@microsoft/agentrc 2.0.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,279 @@
1
+ # AgentRC
2
+
3
+ > Prime your repositories for AI-assisted development.
4
+
5
+ [![CI](https://github.com/microsoft/agentrc/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/agentrc/actions/workflows/ci.yml)
6
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
+
8
+ > [!WARNING]
9
+ > **Experimental** — This project is under active development. Expect breaking changes to commands, APIs, and output formats. Ready for early adopter feedback — [open an issue](https://github.com/microsoft/agentrc/issues).
10
+
11
+ AI coding agents are only as effective as the context they receive. AgentRC is a CLI and VS Code extension that closes the gap — from a single repo to hundreds across your org.
12
+
13
+ **Measure** — Analyze repo structure and score AI readiness across a 5-level maturity model.
14
+ **Generate** — Produce tailored instructions, evals, and dev configs using the Copilot SDK.
15
+ **Maintain** — Run evaluations in CI to catch instruction drift as code evolves.
16
+
17
+ ![AgentRC — Measure, Generate, Maintain cycle](docs/assets/agentrc-overview.png)
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ # Run directly (no install needed)
23
+ npx github:microsoft/agentrc readiness
24
+ ```
25
+
26
+ `npx github:<owner>/agentrc ...` installs from the Git repository and runs the package `prepare` script, which builds the CLI before first use.
27
+
28
+ Or install locally:
29
+
30
+ ```bash
31
+ git clone https://github.com/microsoft/agentrc.git
32
+ cd agentrc && npm install && npm run build && npm link
33
+
34
+ # 1. Inspect the repo shape
35
+ agentrc analyze
36
+
37
+ # 2. Check how AI-ready your repo is
38
+ agentrc readiness
39
+
40
+ # 3. Generate AI instructions
41
+ agentrc instructions
42
+
43
+ # 4. Generate MCP and VS Code configs
44
+ agentrc generate mcp
45
+ agentrc generate vscode
46
+
47
+ # Or do the guided flow interactively
48
+ agentrc init
49
+ ```
50
+
51
+ ## Prerequisites
52
+
53
+ | Requirement | Notes |
54
+ | --------------------------------- | ---------------------------------------------------------------- |
55
+ | **Node.js 20+** | Runtime |
56
+ | **GitHub Copilot CLI** | Bundled with the VS Code Copilot Chat extension |
57
+ | **Copilot authentication** | Run `copilot` → `/login` |
58
+ | **GitHub CLI** _(optional)_ | For batch processing and PRs: `brew install gh && gh auth login` |
59
+ | **Azure DevOps PAT** _(optional)_ | Set `AZURE_DEVOPS_PAT` for Azure DevOps workflows |
60
+
61
+ ## Commands
62
+
63
+ ### `agentrc analyze` — Inspect Repository Structure
64
+
65
+ Detects languages, frameworks, monorepo/workspace structure, and area mappings:
66
+
67
+ ```bash
68
+ agentrc analyze # terminal summary
69
+ agentrc analyze --json # machine-readable analysis
70
+ agentrc analyze --output analysis.json # save JSON report
71
+ agentrc analyze --output analysis.md # save Markdown report
72
+ agentrc analyze --output analysis.json --force # overwrite existing report
73
+ ```
74
+
75
+ ### `agentrc readiness` — Assess AI Readiness
76
+
77
+ Score a repo across 9 pillars grouped into **Repo Health** and **AI Setup**:
78
+
79
+ ```bash
80
+ agentrc readiness # terminal summary
81
+ agentrc readiness --visual # GitHub-themed HTML report
82
+ agentrc readiness --per-area # include per-area breakdown
83
+ agentrc readiness --output readiness.json # save JSON report
84
+ agentrc readiness --output readiness.md # save Markdown report
85
+ agentrc readiness --output readiness.html # save HTML report
86
+ agentrc readiness --policy ./examples/policies/strict.json # apply a custom policy
87
+ agentrc readiness --json # machine-readable JSON
88
+ agentrc readiness --fail-level 3 # CI gate: exit 1 if below level 3
89
+ ```
90
+
91
+ **Maturity levels:**
92
+
93
+ | Level | Name | What it means |
94
+ | ----- | ---------- | -------------------------------------------------- |
95
+ | 1 | Functional | Builds, tests, basic tooling in place |
96
+ | 2 | Documented | README, CONTRIBUTING, custom AI instructions exist |
97
+
98
+ At Level 2, AgentRC also checks **instruction consistency** — when a repo has multiple AI instruction files (e.g. `copilot-instructions.md`, `CLAUDE.md`, `AGENTS.md`), it detects whether they diverge. Symlinked or identical files pass; diverging files fail with a similarity score and a suggestion to consolidate.
99
+
100
+ | 3 | Standardized | CI/CD, security policies, CODEOWNERS, observability |
101
+ | 4 | Optimized | MCP servers, custom agents, AI skills configured |
102
+ | 5 | Autonomous | Full AI-native development with minimal oversight |
103
+
104
+ ### `agentrc instructions` — Generate Instructions
105
+
106
+ Generate `copilot-instructions.md` or `AGENTS.md` using the Copilot SDK:
107
+
108
+ ```bash
109
+ agentrc instructions # copilot-instructions.md (default)
110
+ agentrc instructions --format agents-md # AGENTS.md
111
+ agentrc instructions --per-app # per-app in monorepos
112
+ agentrc instructions --areas # root + all detected areas
113
+ agentrc instructions --area frontend # single area
114
+ agentrc instructions --model claude-sonnet-4.5
115
+ ```
116
+
117
+ ### `agentrc eval` — Evaluate Instructions
118
+
119
+ Measure how instructions improve AI responses with a judge model:
120
+
121
+ ```bash
122
+ agentrc eval --init # scaffold eval config from codebase
123
+ agentrc eval agentrc.eval.json # run evaluation
124
+ agentrc eval --model gpt-4.1 --judge-model claude-sonnet-4.5
125
+ agentrc eval --fail-level 80 # CI gate: exit 1 if pass rate < 80%
126
+ ```
127
+
128
+ ### `agentrc generate` — Generate Configs
129
+
130
+ ```bash
131
+ agentrc generate mcp # .vscode/mcp.json
132
+ agentrc generate vscode --force # .vscode/settings.json (overwrite)
133
+ ```
134
+
135
+ ### `agentrc batch` / `agentrc pr` — Batch & PRs
136
+
137
+ ```bash
138
+ agentrc batch # interactive TUI (GitHub)
139
+ agentrc batch --provider azure # Azure DevOps
140
+ agentrc batch owner/repo1 owner/repo2 --json
141
+ agentrc batch-readiness --output team.html
142
+ agentrc pr owner/repo-name # clone → generate → open PR
143
+ ```
144
+
145
+ ### `agentrc tui` — Interactive Mode
146
+
147
+ ```bash
148
+ agentrc tui
149
+ ```
150
+
151
+ ### `agentrc init` — Guided Setup
152
+
153
+ Interactive or headless repo onboarding — detects your stack and walks through readiness, instructions, and config generation. For monorepos, auto-detects workspaces and bootstraps `agentrc.config.json` with workspace and area definitions.
154
+
155
+ ### Global Options
156
+
157
+ All commands support `--json` (structured JSON to stdout) and `--quiet` (suppress stderr). JSON output uses a `CommandResult<T>` envelope:
158
+
159
+ ```json
160
+ { "ok": true, "status": "success", "data": { ... } }
161
+ ```
162
+
163
+ ### Readiness Policies
164
+
165
+ Policies customize scoring criteria, override metadata, and tune thresholds:
166
+
167
+ ```bash
168
+ agentrc readiness --policy ./examples/policies/strict.json
169
+ agentrc readiness --policy ./examples/policies/strict.json,./my-overrides.json # chain multiple
170
+ ```
171
+
172
+ ```json
173
+ {
174
+ "name": "my-org-policy",
175
+ "criteria": {
176
+ "disable": ["lint-config"],
177
+ "override": { "readme": { "impact": "high", "level": 2 } }
178
+ },
179
+ "extras": { "disable": ["pre-commit"] },
180
+ "thresholds": { "passRate": 0.9 }
181
+ }
182
+ ```
183
+
184
+ Policies can also be set in `agentrc.config.json` (`{ "policies": ["./my-policy.json"] }`).
185
+
186
+ ### Configuration File
187
+
188
+ `agentrc.config.json` (repo root or `.github/`) configures areas, workspaces, and policies:
189
+
190
+ ```json
191
+ {
192
+ "areas": [{ "name": "docs", "applyTo": "docs/**" }],
193
+ "workspaces": [
194
+ {
195
+ "name": "frontend",
196
+ "path": "packages/frontend",
197
+ "areas": [
198
+ { "name": "app", "applyTo": "app/**" },
199
+ { "name": "shared", "applyTo": ["shared/**", "common/**"] }
200
+ ]
201
+ }
202
+ ],
203
+ "policies": ["./policies/strict.json"]
204
+ }
205
+ ```
206
+
207
+ - **`areas`** — standalone areas with glob patterns (relative to repo root)
208
+ - **`workspaces`** — monorepo sub-projects; each workspace groups areas scoped to a subdirectory. Area `applyTo` patterns are relative to the workspace path. Workspace areas get namespaced names (`frontend/app`) and a `workingDirectory` for scoped eval sessions.
209
+ - `agentrc init` auto-detects workspaces (via `.vscode` folders and sibling-area grouping) and bootstraps this file.
210
+
211
+ > **Security:** Config-sourced policies are restricted to JSON files only — JS/TS module policies must be passed via `--policy`.
212
+
213
+ See [docs/plugins.md](docs/plugins.md) for the full plugin authoring guide, including imperative TypeScript plugins, lifecycle hooks, and the trust model.
214
+
215
+ ## Development
216
+
217
+ ```bash
218
+ npm run typecheck # type check
219
+ npm run lint # ESLint (flat config + Prettier)
220
+ npm run test # Vitest tests
221
+ npm run test:coverage # with coverage
222
+ npm run build # production build via tsup
223
+ npx tsx src/index.ts --help # run from source
224
+ ```
225
+
226
+ ### VS Code Extension
227
+
228
+ ```bash
229
+ cd vscode-extension
230
+ npm install && npm run build
231
+ # Press F5 to launch Extension Development Host
232
+ ```
233
+
234
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for workflow and code style guidelines.
235
+
236
+ ## Project Structure
237
+
238
+ ```
239
+ packages/core/
240
+ └── src/
241
+ ├── index.ts # Shared public API surface
242
+ ├── services/ # Core product logic reused by CLI and extension
243
+ │ ├── readiness.ts # 9-pillar scoring engine with pillar groups
244
+ │ ├── visualReport.ts # HTML report generator
245
+ │ ├── instructions.ts # Copilot SDK integration
246
+ │ ├── analyzer.ts # Repo scanning (languages, frameworks, monorepos)
247
+ │ ├── evaluator.ts # Eval runner + trajectory viewer
248
+ │ ├── generator.ts # MCP/VS Code config generation
249
+ │ ├── policy.ts # Readiness policy loading and chain resolution
250
+ │ ├── policy/ # Plugin engine (types, compiler, loader, adapter, shadow)
251
+ │ ├── git.ts # Git operations (clone, branch, push)
252
+ │ ├── github.ts # GitHub API (Octokit)
253
+ │ └── azureDevops.ts # Azure DevOps API
254
+ └── utils/ # Shared utilities (fs, logger, output)
255
+
256
+ src/
257
+ ├── cli.ts # Commander CLI wiring
258
+ ├── commands/ # CLI subcommands (thin orchestrators)
259
+ ├── index.ts # CLI entrypoint
260
+ └── ui/ # Ink/React terminal UI
261
+
262
+ vscode-extension/ # VS Code extension shell over packages/core
263
+ ```
264
+
265
+ ## Troubleshooting
266
+
267
+ **"Copilot CLI not found"** — Install the GitHub Copilot Chat extension in VS Code. The CLI is bundled with it.
268
+
269
+ **"Copilot CLI not logged in"** — Run `copilot` in your terminal, then `/login` to authenticate.
270
+
271
+ **"GitHub authentication required"** — Install GitHub CLI (`brew install gh && gh auth login`) or set `GITHUB_TOKEN` / `GH_TOKEN`.
272
+
273
+ ## License
274
+
275
+ [MIT](LICENSE)
276
+
277
+ ## Trademarks
278
+
279
+ This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.