repo-agent-brief 0.2.1 → 0.3.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.
Files changed (3) hide show
  1. package/README.md +14 -0
  2. package/package.json +1 -1
  3. package/src/index.js +47 -0
package/README.md CHANGED
@@ -15,6 +15,7 @@ npx repo-agent-brief
15
15
  - Finds high-signal files: `AGENTS.md`, `CLAUDE.md`, `README.md`, `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, etc.
16
16
  - Infers stack and common commands.
17
17
  - Builds a compact repo map.
18
+ - Suggests a prioritized verification plan (`must` / `should` / `optional`) from detected scripts, risks, and changed files.
18
19
  - Optionally summarizes the current git diff so agents can start from “what changed?” instead of rereading the whole repo.
19
20
  - Scans context files for obvious secrets and risky operational instructions.
20
21
  - Emits Markdown for humans/agents or JSON for automation.
@@ -65,6 +66,19 @@ agent-brief . --diff origin/main > AGENT_HANDOFF.md
65
66
 
66
67
  The brief adds a `Git diff` section with changed paths, line counts, and warnings for high-impact files such as GitHub Actions workflows, deploy scripts, migrations, Docker Compose files, and lockfiles. This keeps the first agent turn grounded in the actual patch instead of a vague repo overview.
67
68
 
69
+ ## Verification plans
70
+
71
+ Every brief now includes a `Suggested verification plan` section. It turns discovered scripts plus patch context into a short checklist an agent can follow before finalizing:
72
+
73
+ ```markdown
74
+ ## Suggested verification plan
75
+ - [must] Run type checks for changed code paths — `npm run typecheck`
76
+ - [should] Run lint for fast static feedback — `npm run lint`
77
+ - [must] Run the primary test suite before final handoff — `npm run test`
78
+ ```
79
+
80
+ If you pass `--diff`, the plan gets sharper: docs-only changes downgrade expensive checks, source changes promote tests/typechecks, and CI/deploy/infra/lockfile changes add a manual high-impact-path review. If no test/lint/build commands are found, the plan calls that gap out plainly so the agent does not pretend verification happened.
81
+
68
82
  ## Why this exists
69
83
 
70
84
  The current agent tooling boom has plenty of orchestration, MCP servers, and observability dashboards. The missing small thing is a cheap, local preflight that gives any agent the same crisp project orientation before it spends tokens or touches files.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-agent-brief",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Generate concise, safety-aware project briefs for coding agents.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -44,6 +44,7 @@ export function generateBrief(root = process.cwd(), options = {}) {
44
44
  const risks = scanRisks(absRoot, context.files);
45
45
  const commands = inferCommands(absRoot, packageInfo);
46
46
  const stack = inferStack(absRoot, packageInfo);
47
+ const verificationPlan = inferVerificationPlan({ commands, diff, risks });
47
48
  const score = scoreRepo({ context, commands, risks });
48
49
 
49
50
  return {
@@ -55,6 +56,7 @@ export function generateBrief(root = process.cwd(), options = {}) {
55
56
  diff,
56
57
  stack,
57
58
  commands,
59
+ verificationPlan,
58
60
  contextFiles: context.files,
59
61
  tree,
60
62
  risks,
@@ -83,6 +85,17 @@ export function formatMarkdown(brief) {
83
85
  }
84
86
  lines.push('');
85
87
 
88
+ lines.push('## Suggested verification plan');
89
+ if (brief.verificationPlan.length) {
90
+ for (const step of brief.verificationPlan) {
91
+ const command = step.command ? ` — \`${step.command}\`` : '';
92
+ lines.push(`- [${step.priority}] ${step.reason}${command}`);
93
+ }
94
+ } else {
95
+ lines.push('- No automatic verification plan could be inferred. Add test/lint/build scripts for better agent handoffs.');
96
+ }
97
+ lines.push('');
98
+
86
99
  if (brief.diff) {
87
100
  lines.push(`## Git diff vs ${brief.diff.ref}`);
88
101
  if (brief.diff.available) {
@@ -295,6 +308,40 @@ function inferCommands(root, pkg) {
295
308
  return dedupe(commands, c => c.command);
296
309
  }
297
310
 
311
+ function inferVerificationPlan({ commands, diff, risks }) {
312
+ const plan = [];
313
+ const byName = new Map(commands.map(command => [command.name, command]));
314
+ const add = (priority, reason, command) => {
315
+ if (command && plan.some(step => step.command === command.command)) return;
316
+ plan.push({ priority, reason, command: command?.command || '' });
317
+ };
318
+
319
+ if (risks.some(r => r.severity === 'high')) {
320
+ add('must', 'Manually inspect high-severity risk matches before sharing output or committing changes');
321
+ }
322
+
323
+ const changedPaths = diff?.available ? diff.files.map(file => file.path) : [];
324
+ const onlyDocsChanged = changedPaths.length > 0 && changedPaths.every(path => /(^|\/)(README|CHANGELOG|AGENTS|CLAUDE|GEMINI)\.md$|\.md$/i.test(path));
325
+ const changedPackageOrLock = changedPaths.some(path => /(^|\/)(package\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$/i.test(path));
326
+ const changedSource = changedPaths.some(path => /(^|\/)(src|lib|app|pages|components|test|tests|spec)\//i.test(path) || /\.(?:[cm]?[jt]sx?|tsx?|py|rs|go)$/i.test(path));
327
+ const changedCiOrDeploy = changedPaths.some(isRiskyChangedPath);
328
+
329
+ if (changedCiOrDeploy) add('must', 'Review high-impact changed paths such as CI, deploy, infra, lockfiles, or migrations');
330
+ if (changedPackageOrLock) add('should', 'Inspect dependency or package metadata changes before publishing/merging');
331
+
332
+ if (byName.has('typecheck')) add(changedSource ? 'must' : 'should', 'Run type checks for changed code paths', byName.get('typecheck'));
333
+ if (byName.has('lint')) add(changedSource ? 'should' : 'optional', 'Run lint for fast static feedback', byName.get('lint'));
334
+ if (byName.has('test')) add(changedSource || !onlyDocsChanged ? 'must' : 'optional', 'Run the primary test suite before final handoff', byName.get('test'));
335
+ if (byName.has('build')) add(changedSource || changedPackageOrLock ? 'should' : 'optional', 'Run a production build if behavior or packaging changed', byName.get('build'));
336
+
337
+ if (!commands.some(c => ['test', 'lint', 'typecheck', 'build'].includes(c.name))) {
338
+ add('should', 'No test/lint/build commands were detected; do a focused manual smoke check and document the gap');
339
+ }
340
+
341
+ if (!diff) add('optional', 'Run with --diff origin/main or --diff HEAD to tailor this plan to the current patch');
342
+ return plan;
343
+ }
344
+
298
345
  function inferStack(root, pkg) {
299
346
  const stack = [];
300
347
  if (pkg) {