Skip to content

Commit 155ddde

Browse files
digitaraldHarald Kirschner
andauthored
feat: agent plugin with SKILL.md-based instruction generation (#75)
* feat: agent plugin with SKILL.md-based instruction generation Replace hardcoded inline prompts with SKILL.md assets loaded via the Copilot SDK skillDirectories option and invoked with /skill-name prefixes. - Add plugin/ directory with 4 skills: root-instructions, area-instructions, nested-hub, nested-detail - Add plugin manifest (plugin/.github/plugin/plugin.json) and marketplace manifest (.github/plugin/marketplace.json) - Add skills.ts resolver with dev/bundled/extension path resolution - Update instructions.ts to use skillDirectories + /skill-name invocation - Copy skill assets at build time (tsup onSuccess, esbuild onEnd) - Initialize skills dir in VS Code extension activate() - Add tests with filesystem assertions and SKILL.md frontmatter validation - Update docs: copilot-instructions.md, CHANGELOG, README, plugin/README.md * fix: address PR review feedback - CRLF-safe frontmatter parser in skills test (fixes Windows CI) - Clean dist/skills/ and out/skills/ before copy to remove stale assets - Fix AGENTS.md typo and add .instructions.md to root-instructions glob - Add explicit marketplace manifest URL in plugin/README.md - Migrate .github/copilot-instructions.md → AGENTS.md --------- Co-authored-by: Harald Kirschner <digitarald@gmail.com>
1 parent bbfd2bd commit 155ddde

18 files changed

Lines changed: 494 additions & 158 deletions

File tree

.github/copilot-instructions.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

.github/plugin/marketplace.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "agentrc-plugins",
3+
"metadata": {
4+
"description": "AgentRC plugins for GitHub Copilot — skills for AI-assisted repository priming",
5+
"version": "1.0.0"
6+
},
7+
"owner": {
8+
"name": "Microsoft"
9+
},
10+
"plugins": [
11+
{
12+
"name": "agentrc",
13+
"source": "./plugin",
14+
"description": "Skills for generating instruction files (copilot-instructions.md, area instructions, AGENTS.md) by analyzing repository structure and conventions.",
15+
"version": "2.1.0",
16+
"skills": [
17+
"./skills/root-instructions",
18+
"./skills/area-instructions",
19+
"./skills/nested-hub",
20+
"./skills/nested-detail"
21+
]
22+
}
23+
]
24+
}

AGENTS.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# AgentRC Copilot Instructions
2+
3+
`@microsoft/agentrc` is a CLI tool (and VS Code extension) that sets up repositories for AI-assisted development. It analyzes repos, generates instruction files, evaluates AI responses, and runs readiness reports.
4+
5+
## Architecture
6+
7+
```
8+
src/ # CLI entry point and commands
9+
cli.ts # Commander program, withGlobalOpts helper
10+
commands/ # Thin command wrappers (parse args → call services)
11+
ui/ # Ink/React TUI components
12+
packages/core/src/ # Shared services and utilities (bundled into dist)
13+
services/ # analyzer, generator, instructions, readiness, policy, ...
14+
utils/ # fs, output, logger, repo, pr
15+
plugin/skills/ # Built-in skill markdown files (copied to dist/skills/ on build)
16+
vscode-extension/ # See .github/instructions/vscode-extension.instructions.md
17+
```
18+
19+
`@agentrc/core` (in `packages/core/`) is **bundled** into the CLI output — it is not an external npm package. Use the `@agentrc/core/*` path alias for all cross-package imports.
20+
21+
## Build & Test
22+
23+
```sh
24+
npm run build # tsup → dist/index.js (ESM, Node 20)
25+
npm run dev # tsx src/index.ts (run from source)
26+
npm run typecheck # tsc --noEmit
27+
npm run lint # eslint
28+
npm test # vitest run
29+
npm run test:coverage # vitest run --coverage
30+
```
31+
32+
Output is ESM (`"type": "module"`). All node_modules are external except `@agentrc/core`, `@github/copilot-sdk`, and `vscode-jsonrpc` (bundled via `noExternal` in `tsup.config.ts`).
33+
34+
> **SDK shim**: `tsup.config.ts` patches `getBundledCliPath()` in the Copilot SDK. An identical shim lives in `vscode-extension/esbuild.mjs` — update **both** together if SDK internals change.
35+
36+
## Command Pattern
37+
38+
Commands in `src/commands/` are thin wrappers:
39+
40+
1. Resolve paths and options
41+
2. Call services from `@agentrc/core/services/*`
42+
3. Write output using the output utilities
43+
44+
Wrap every command action with `withGlobalOpts` (from `src/cli.ts`) so `--json`, `--quiet`, and `--accessible` are merged into the options object.
45+
46+
## Output Convention
47+
48+
| Stream | Purpose |
49+
| -------- | ------------------------------------------------- |
50+
| `stdout` | Machine-readable JSON only (when `--json` is set) |
51+
| `stderr` | Human-readable progress, logs, warnings, errors |
52+
53+
Never write progress to stdout. Use `outputResult` / `outputError` from `@agentrc/core/utils/output`. Use `shouldLog(options)` before writing stderr text. Use `createProgressReporter(silent)` for step-by-step progress.
54+
55+
`CommandResult<T>` shape: `{ ok, status: "success"|"partial"|"noop"|"error", data?, errors? }`.
56+
57+
## Skills
58+
59+
Built-in skills live in `plugin/skills/<skill-name>/SKILL.md` with YAML frontmatter (`name`, `description`). They are copied to `dist/skills/` on build via `tsup.config.ts`'s `onSuccess` hook. Resolve the skills directory with `getSkillDirectory()` from `@agentrc/core/services/skills` — never hardcode paths.
60+
61+
## Code Conventions
62+
63+
- **Type imports**: always use `import type` for type-only imports (`@typescript-eslint/consistent-type-imports` is enforced).
64+
- **Import order**: alphabetical, grouped by node built-ins → external packages → internal (`@agentrc/core/*`) → relative. ESLint enforces this.
65+
- **Tests**: test files live in `src/services/__tests__/` and use vitest. Default timeout is 10 s.
66+
- **Unused vars**: prefix with `_` to suppress the lint warning.
67+
- **Strict TypeScript**: `strict: true`, `moduleResolution: Bundler`, target `ES2022`.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.
66

77
### Features
88

9+
- **Agent plugin & marketplace** — expose built-in instruction-generation skills as a VS Code agent plugin (`plugin/`) with marketplace manifest (`.github/plugin/marketplace.json`). Skills can be installed from source or discovered through the marketplace.
10+
- **SKILL.md-based prompts** — replace hardcoded inline prompts with SKILL.md assets loaded via the Copilot SDK `skillDirectories` option and invoked with `/skill-name` prefixes.
911
- **Enhanced .NET detection** — F# support, framework parsing, and expanded signals (#60)
1012
- **De-branded terminology**`--dry-run` flag, batch instructions command (#55)
1113

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Works with **GitHub** and **Azure DevOps**. Supports monorepos, multi-root VS Co
8383
| **[At Scale](docs/at-scale.md)** | Batch processing across orgs |
8484
| **[CI Integration](docs/ci-integration.md)** | GitHub Actions & Azure Pipelines |
8585
| **[VS Code Extension](docs/extension.md)** | Sidebar views, commands, settings |
86+
| **[Agent Plugin](plugin/README.md)** | Install as a Copilot agent plugin with built-in skills |
8687
| **[Examples](examples/)** | Configs, evals, and policies |
8788

8889
[Customize AI in VS Code](https://code.visualstudio.com/docs/copilot/customization/overview) · [Custom instructions](https://code.visualstudio.com/docs/copilot/customization/custom-instructions) · [CONTRIBUTING.md](CONTRIBUTING.md)

packages/core/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ export {
9090
stripMarkdownFences
9191
} from "./services/instructions";
9292

93+
export { setBuiltinSkillsDir, getSkillDirectory } from "./services/skills";
94+
export type { BuiltinSkillName } from "./services/skills";
95+
9396
export { parsePolicySources, loadPolicy, resolveChain } from "./services/policy";
9497

9598
export {

0 commit comments

Comments
 (0)