Skip to content

Commit 3c9c573

Browse files
authored
Add GitHub Copilot agent instructions (#12)
1 parent 2208ec1 commit 3c9c573

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copilot Instructions
2+
3+
## Structure
4+
5+
Each feature lives under `src/<feature-name>/` and has a parallel test directory at `test/<feature-name>/`:
6+
7+
```
8+
src/<feature-name>/
9+
devcontainer-feature.json # Metadata, mounts, env vars, postCreateCommand
10+
install.sh # Runs at image build time (root, inside container)
11+
NOTES.md # Human-written design notes — update when making meaningful changes
12+
README.md # Auto-generated — DO NOT edit directly, run `mise run docs`
13+
test/<feature-name>/
14+
test.sh # Integration test run inside container after feature install
15+
```
16+
17+
## Adding a Feature
18+
19+
1. Create `src/<feature-name>/devcontainer-feature.json`, `install.sh`, and `NOTES.md`
20+
2. Add `test/<feature-name>/test.sh` covering every installed binary and configured file
21+
3. Add the new feature to the top-level `README.md` features list
22+
4. Run `mise run docs` to generate `src/<feature-name>/README.md`
23+
24+
## `install.sh` Conventions
25+
26+
- Shebang: `#!/usr/bin/bash`; `set -e` at the top
27+
- Detect distro by sourcing `/etc/os-release` and switching on `$ID`
28+
- Support Debian, Ubuntu, and Fedora at minimum; `exit 1` on unknown distros
29+
- Watch for package name differences across distros (e.g. `openssh-client` vs `openssh-clients`)
30+
31+
See [src/personal-setup/install.sh](../src/personal-setup/install.sh) for the reference pattern.
32+
33+
## Tests
34+
35+
Tests use `dev-container-features-test-lib` (injected by the devcontainer test runner):
36+
37+
```bash
38+
source dev-container-features-test-lib
39+
check "label" bash -c "..."
40+
reportResults
41+
```
42+
43+
- Add a `check` for every binary installed and every file/env var configured
44+
- Always write tests for new functionality before considering it complete
45+
- Run tests: `mise run test` (tests against debian, ubuntu, fedora-toolbox, devcontainers/base:ubuntu)
46+
47+
## Before Committing
48+
49+
```sh
50+
mise run lint-shell # ShellCheck all .sh files
51+
mise run docs # Regenerate README.md from devcontainer-feature.json + NOTES.md
52+
mise run test # Full integration test suite (requires Docker)
53+
```
54+
55+
## NOTES.md
56+
57+
Update `src/<feature-name>/NOTES.md` when:
58+
- Adding or removing a package and there's a non-obvious reason why
59+
- Changing the dotfiles/mount/RCM strategy
60+
- Documenting a tradeoff or design decision for future reference
61+
62+
`README.md` is auto-generated and will include the contents of `NOTES.md` — so write `NOTES.md` as if it's public-facing prose.

0 commit comments

Comments
 (0)