@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.
src/ # CLI entry point and commands
cli.ts # Commander program, withGlobalOpts helper
commands/ # Thin command wrappers (parse args → call services)
ui/ # Ink/React TUI components
packages/core/src/ # Shared services and utilities (bundled into dist)
services/ # analyzer, generator, instructions, readiness, policy, ...
utils/ # fs, output, logger, repo, pr
plugin/skills/ # Built-in skill markdown files (copied to dist/skills/ on build)
vscode-extension/ # See .github/instructions/vscode-extension.instructions.md
@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.
npm run build # tsup → dist/index.js (ESM, Node 20)
npm run dev # tsx src/index.ts (run from source)
npm run typecheck # tsc --noEmit
npm run lint # eslint
npm test # vitest run
npm run test:coverage # vitest run --coverageOutput 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).
SDK shim:
tsup.config.tspatchesgetBundledCliPath()in the Copilot SDK. An identical shim lives invscode-extension/esbuild.mjs— update both together if SDK internals change.
Commands in src/commands/ are thin wrappers:
- Resolve paths and options
- Call services from
@agentrc/core/services/* - Write output using the output utilities
Wrap every command action with withGlobalOpts (from src/cli.ts) so --json, --quiet, and --accessible are merged into the options object.
| Stream | Purpose |
|---|---|
stdout |
Machine-readable JSON only (when --json is set) |
stderr |
Human-readable progress, logs, warnings, errors |
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.
CommandResult<T> shape: { ok, status: "success"|"partial"|"noop"|"error", data?, errors? }.
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.
- Type imports: always use
import typefor type-only imports (@typescript-eslint/consistent-type-importsis enforced). - Import order: alphabetical, grouped by node built-ins → external packages → internal (
@agentrc/core/*) → relative. ESLint enforces this. - Tests: test files live in
src/services/__tests__/and use vitest. Default timeout is 10 s. - Unused vars: prefix with
_to suppress the lint warning. - Strict TypeScript:
strict: true,moduleResolution: Bundler, targetES2022.