diff --git a/.github/agents/new-feature.agent.md b/.github/agents/new-feature.agent.md new file mode 100644 index 0000000..3702b79 --- /dev/null +++ b/.github/agents/new-feature.agent.md @@ -0,0 +1,234 @@ +--- +name: New Feature +description: "Implement a new Dev Container Feature in this repository." +tools: + - search/codebase + - search/fileSearch + - search/textSearch + - read/readFile + - edit/createDirectory + - edit/createFile + - edit/editFiles + - execute/runInTerminal + - execute/getTerminalOutput + - web/fetch + - web/githubRepo + - todo +user-invocable: true +disable-model-invocation: false +target: vscode +--- + + +You MUST parse the user invocation to extract FEATURE_ID, SOURCE_REPO, and optional parameters. +You MUST inspect SOURCE_REPO's latest GitHub release to determine the release asset naming pattern. +You MUST install tools from GitHub releases, not from package managers like apt. +You MUST support a version option defaulting to "latest" that resolves via the GitHub API. +You MUST implement multi-architecture support mapping uname -m to release asset names per ARCH_MAP. +You MUST create all files listed in DELIVERABLES_CREATE. +You MUST update all files listed in DELIVERABLES_UPDATE with minimal targeted changes. +You MUST follow the install.sh conventions from existing features in this repository. +You MUST use set -e or set -euo pipefail in all generated shell scripts. +You MUST include the root check pattern in generated install.sh files. +You MUST include the check_packages helper for apt dependencies in generated install.sh files. +You MUST verify installation with the binary's version command in install.sh. +You MUST use the dev-container-features-test-lib pattern in generated test files. +You MUST use conventional commit format for any commits. +You MUST NOT modify unrelated files or make drive-by refactors. +You MUST NOT remove or reorder existing README content beyond adding the new entry. +You MUST NOT run devcontainer features test automatically. +You SHOULD read an existing feature's install.sh as a reference before generating a new one. +You SHOULD provide graceful fallback logic when GitHub API calls fail during version resolution. +You SHOULD suggest test commands to the user after scaffolding using format:SCAFFOLD_SUMMARY. +You MAY implement checksum verification if the user requests it and upstream provides checksums. +You MAY add extra options to devcontainer-feature.json if the user specifies them. + + + +INVOCATION_EXAMPLES: TEXT<< +- new-feature ripgrep in @BurntSushi/ripgrep +- new-feature mise in @jdx/mise version=2024.7.1 +- new-feature protolint in @yoheimuta/protolint checksum=true +>> + +DELIVERABLES_CREATE: YAML<< +- path: "src/{FEATURE_ID}/devcontainer-feature.json" + purpose: "Feature metadata with id, name, version, description, and options" +- path: "src/{FEATURE_ID}/install.sh" + purpose: "Installer script that downloads from GitHub releases" +- path: "test/{FEATURE_ID}/test.sh" + purpose: "Basic smoke test using dev-container-features-test-lib" +- path: "test/_global/{FEATURE_ID}-specific-version.sh" + purpose: "Version-pinned test that greps for expected version string" +>> + +DELIVERABLES_UPDATE: YAML<< +- path: "test/_global/all-tools.sh" + action: "Add a check line for the new binary before reportResults" +- path: "test/_global/scenarios.json" + action: "Add feature to all-tools.features and add a version-pinned scenario" +- path: ".github/workflows/test.yaml" + action: "Add feature id to matrix.features array" +- path: "README.md" + action: "Add row to features table and add usage section" +>> + +ARCH_MAP: YAML<< +x86_64: "x86_64" +amd64: "x86_64" +aarch64: "aarch64" +arm64: "aarch64" +armv7l: "armv7" +i386: "i686" +i686: "i686" +>> + +FEATURE_JSON_TEMPLATE: JSON<< +{ + "name": "{FEATURE_DISPLAY_NAME}", + "id": "{FEATURE_ID}", + "version": "1.0.0", + "description": "{DESCRIPTION}", + "options": { + "version": { + "type": "string", + "default": "latest", + "description": "Version to install from GitHub releases" + } + } +} +>> + +INSTALL_SH_STRUCTURE: TEXT<< +1. Shebang: #!/usr/bin/env bash with set -e +2. Variables: REPO_OWNER, REPO_NAME, BINARY_NAME, VERSION +3. Root check: exit 1 if $(id -u) is not 0 +4. Clean up: rm -rf /var/lib/apt/lists/* +5. check_packages helper: install apt deps if missing +6. Install deps: curl jq ca-certificates tar +7. get_latest_version: query GitHub API /repos/OWNER/REPO/releases/latest +8. Version resolution: if empty or "latest" call get_latest_version +9. Architecture: uname -m with case for x86_64, i686, aarch64, armv7l +10. OS: uname -s mapped to linux/darwin identifiers +11. Download URL: construct from owner/repo/version/arch/os +12. Temp dir: mktemp -d, cd, curl -sSL, extract +13. Move: mv binary /usr/local/bin/, chmod if needed +14. Cleanup: rm -rf temp dir, rm -rf /var/lib/apt/lists/* +15. Verify: run binary --version +>> + +TEST_PATTERN: TEXT<< +#!/bin/bash +set -e +source dev-container-features-test-lib +check "{FEATURE_ID}" {BINARY_NAME} --version +reportResults +>> + +VERSION_TEST_PATTERN: TEXT<< +#!/bin/bash +set -e +source dev-container-features-test-lib +check "{FEATURE_ID} with specific version" /bin/bash -c "{BINARY_NAME} --version | grep '{PIN_VERSION}'" +reportResults +>> + + + + +# Feature: () + +Source: + +## Files Created + + +## Files Updated + + +## Suggested Test Commands + + +## Notes + +WHERE: +- is Markdown; bulleted list of created file paths. +- is String; human-friendly feature name. +- is String; lowercase identifier used in file paths. +- is String; warnings, assumptions, or follow-up actions. +- is String; GitHub owner/repo of the upstream tool. +- is Markdown; shell commands to test the new feature. +- is Markdown; bulleted list of updated file paths with change summary. + + + + +FEATURE_ID: "" +FEATURE_DISPLAY_NAME: "" +SOURCE_REPO: "" +BINARY_NAME: "" +REQUESTED_VERSION: "latest" +SUPPORT_CHECKSUM: false +RELEASE_ASSET_PATTERN: "" + + + + + + + + +RUN `parse-input` +RUN `inspect-upstream` +RUN `scaffold` +RUN `integrate` +RETURN: format="SCAFFOLD_SUMMARY" + + + +SET FEATURE_ID := (from "Agent Inference" using INP) +SET SOURCE_REPO := (from "Agent Inference" using INP) +SET FEATURE_DISPLAY_NAME := (from "Agent Inference" using FEATURE_ID) +SET BINARY_NAME := (from "Agent Inference" using FEATURE_ID) +IF INP contains "version=": + SET REQUESTED_VERSION := (from "Agent Inference" using INP) +IF INP contains "checksum=true": + SET SUPPORT_CHECKSUM := true (from "Agent Inference") + + + +USE `web/githubRepo` where: query="latest release assets", repo=SOURCE_REPO +CAPTURE RELEASE_ASSET_PATTERN from result + + + +USE `read/readFile` where: filePath="src/bat/install.sh" +CAPTURE REFERENCE_INSTALL from result +USE `edit/createDirectory` where: dirPath="src/{FEATURE_ID}" +SET FEATURE_JSON := (from "Agent Inference" using FEATURE_DISPLAY_NAME, FEATURE_ID, FEATURE_JSON_TEMPLATE) +USE `edit/createFile` where: content=FEATURE_JSON, filePath="src/{FEATURE_ID}/devcontainer-feature.json" +SET INSTALL_SCRIPT :=