|
1 | 1 | # Copilot Instructions |
2 | 2 |
|
3 | | -- **Repo purpose**: A single dev container Feature set hosted on GHCR; current Feature installs the ClickHouse Local CLI for file-based SQL. Layout follows the standard Features spec in the repo root [README.md](README.md). |
4 | | -- **Feature structure**: Each Feature lives under `src/<feature>` with metadata in [src/clickhouse-local/devcontainer-feature.json](src/clickhouse-local/devcontainer-feature.json#L1-L20), an installer in [src/clickhouse-local/install.sh](src/clickhouse-local/install.sh#L1-L60), and tests in [test/clickhouse-local/test.sh](test/clickhouse-local/test.sh#L1-L39). Add shared test helpers in [test/_global/common-utils.sh](test/_global/common-utils.sh#L1-L24). |
5 | | -- **Option -> env mapping**: Feature options are exposed as uppercase env vars; `version` becomes `VERSION` and `installMethod` becomes `INSTALLMETHOD` consumed in [src/clickhouse-local/install.sh](src/clickhouse-local/install.sh#L6-L7). Defaults are `latest` and `quick` per [src/clickhouse-local/devcontainer-feature.json](src/clickhouse-local/devcontainer-feature.json#L8-L18). |
6 | | -- **Install methods**: |
7 | | - - `quick` (default) uses the official ClickHouse quick installer, then moves the binary to `/usr/local/bin` and symlinks `clickhouse`, `clickhouse-local`, and `clickhouse-client` in [src/clickhouse-local/install.sh](src/clickhouse-local/install.sh#L38-L51). |
8 | | - - `apt` adds the ClickHouse apt repo and key, then installs `clickhouse-client` with an optional pinned version in [src/clickhouse-local/install.sh](src/clickhouse-local/install.sh#L12-L36). Uses `DEBIAN_FRONTEND=noninteractive` and installs curl/gnupg prerequisites. |
9 | | -- **Verification**: Installer validates the binary with `clickhouse-local --version`; failures exit non-zero [src/clickhouse-local/install.sh](src/clickhouse-local/install.sh#L54-L60). |
10 | | -- **Testing**: Feature tests assume the command exists in PATH, check `clickhouse-local --version`, and run `SELECT 1` via stdin in [test/clickhouse-local/test.sh](test/clickhouse-local/test.sh#L10-L36). Run with `bash test/clickhouse-local/test.sh` inside a container where the Feature is installed; they honor `set -e`. |
11 | | -- **Shared test helpers**: Use `check`/`reportResults` utilities when adding richer tests [test/_global/common-utils.sh](test/_global/common-utils.sh#L1-L24). |
12 | | -- **Versioning/publishing**: Feature version is `1.0.0` in metadata [src/clickhouse-local/devcontainer-feature.json](src/clickhouse-local/devcontainer-feature.json#L2-L3). Packages publish to `ghcr.io/proxayfox/devcontainer-features/<feature>:<version>` per root guidance in [README.md](README.md#L60-L74). Keep semver in the metadata in sync with published tags. |
13 | | -- **Adding features**: Copy the existing pattern: create `src/<name>/devcontainer-feature.json` with options, `install.sh` for build-time install, and `test/<name>/test.sh` for validation. Update the root [README.md](README.md#L5-L52) with a short description and usage snippet. |
14 | | -- **Notes for edits**: Prefer minimal dependencies in installers; keep non-interactive apt usage and clean up temp GPG dirs as shown in [src/clickhouse-local/install.sh](src/clickhouse-local/install.sh#L18-L24). Preserve symlinks so both `clickhouse` and `clickhouse-local` work. |
| 3 | +- **Repo purpose**: Single dev container Feature set published to GHCR; see available Features in [README.md](README.md). Each Feature follows containers.dev spec with metadata, installer, and tests under its own folder. |
| 4 | +- **Layout**: One Feature per subfolder in `src/<feature>` with `devcontainer-feature.json`, `install.sh`, and a matching test in `test/<feature>/test.sh`. Shared test helpers live in [test/_global/common-utils.sh](test/_global/common-utils.sh). |
| 5 | +- **Option → env mapping**: Feature options become uppercase env vars (e.g., `version` -> `VERSION`, `installMethod` -> `INSTALLMETHOD`). Default values live in each `devcontainer-feature.json`. |
| 6 | +- **ClickHouse Local**: Defaults `version=latest`, `installMethod=quick` ([src/clickhouse-local/devcontainer-feature.json](src/clickhouse-local/devcontainer-feature.json)). Installer supports `quick` binary or `apt` path, adds key/repo when apt is chosen, creates `clickhouse-local`/`clickhouse`/`clickhouse-client` symlinks, and verifies with `clickhouse-local --version` ([src/clickhouse-local/install.sh](src/clickhouse-local/install.sh)). Tests run a `SELECT 1` sanity query ([test/clickhouse-local/test.sh](test/clickhouse-local/test.sh)). |
| 7 | +- **Lazydocker**: Option `version` default `0.24.2` ([src/lazydocker/devcontainer-feature.json](src/lazydocker/devcontainer-feature.json)). Installer maps `uname -m` to GitHub release arch, downloads the tarball, validates gzip via `file`, installs to `/usr/local/bin`, and verifies `lazydocker --version` ([src/lazydocker/install.sh](src/lazydocker/install.sh)). Tests assert presence, version output, and executable bit ([test/lazydocker/test.sh](test/lazydocker/test.sh)). |
| 8 | +- **Aikido pre-commit**: Options `version` (default `v1.0.116`) and `setupGlobalHooks` (default true) ([src/aikido-precommit/devcontainer-feature.json](src/aikido-precommit/devcontainer-feature.json)). Installer normalizes version prefix, downloads platform/arch-specific zip, installs `aikido-local-scanner`, and optionally wires global git `core.hooksPath` with a pre-commit snippet guarding missing binaries ([src/aikido-precommit/install.sh](src/aikido-precommit/install.sh)). Tests validate binary availability, hook configuration when enabled, and exercise `pre-commit-scan` in a temp repo ([test/aikido-precommit/test.sh](test/aikido-precommit/test.sh)). |
| 9 | +- **Testing workflow**: Run the full suite with `devcontainer features test` or individual scripts via `bash test/<feature>/test.sh` inside a built dev container. Tests assume the feature binaries are already installed in PATH and use `set -e` for fast failures. |
| 10 | +- **Installer conventions**: Keep installers non-interactive (`DEBIAN_FRONTEND=noninteractive`), install minimal prerequisites, and clean temp dirs/archives. Prefer `install -m 755` for binaries and confirm installs with a command run at the end. |
| 11 | +- **Adding/updating features**: Mirror existing folder pattern, expose options in `devcontainer-feature.json`, consume them via uppercase env vars in `install.sh`, add verification to the installer, and provide a sanity test in `test/<feature>/test.sh`. Update [README.md](README.md) with a short blurb and usage snippet. |
| 12 | +- **Publishing/versioning**: Each feature is semvered in its `devcontainer-feature.json`; images publish to `ghcr.io/proxayfox/devcontainer-features/<feature>:<version>`. Keep metadata version in sync with published tags. |
0 commit comments