repo-agent-brief 0.2.0 → 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.
- package/README.md +18 -0
- package/package.json +3 -2
- package/skills/repo-agent-brief/SKILL.md +53 -0
- 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.
|
|
@@ -87,3 +101,7 @@ This is not a full secret scanner. It catches common token/private-key/secret-as
|
|
|
87
101
|
## License
|
|
88
102
|
|
|
89
103
|
MIT
|
|
104
|
+
|
|
105
|
+
## Agent Skill
|
|
106
|
+
|
|
107
|
+
This package includes an OpenClaw/Claude-style skill at `skills/repo-agent-brief` that teaches agents to run repo preflight and diff-aware handoff briefs before editing or reviewing code.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repo-agent-brief",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Generate concise, safety-aware project briefs for coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"src",
|
|
14
14
|
"README.md",
|
|
15
|
-
"LICENSE"
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"skills/"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
19
|
"test": "node --test",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: repo-agent-brief
|
|
3
|
+
description: Generate concise, safety-aware repository orientation briefs with repo-agent-brief/agent-brief before coding-agent work, reviews, handoffs, PR analysis, unfamiliar repo edits, diff-aware branch handoffs, or when an agent needs stack/commands/context/risk signals before changing files.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Repo Agent Brief Skill
|
|
7
|
+
|
|
8
|
+
Use `repo-agent-brief` to orient an agent before it edits or reviews a repository. It finds high-signal context files, infers stack/commands, builds a compact repo map, and flags obvious secret/risky-instruction patterns.
|
|
9
|
+
|
|
10
|
+
## Default workflow
|
|
11
|
+
|
|
12
|
+
From the repository root:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx repo-agent-brief . > AGENT_BRIEF.md
|
|
16
|
+
sed -n '1,220p' AGENT_BRIEF.md
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
For in-progress branches:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx repo-agent-brief . --diff origin/main > AGENT_HANDOFF.md
|
|
23
|
+
sed -n '1,260p' AGENT_HANDOFF.md
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
For machine-readable automation:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx repo-agent-brief . --format json > agent-brief.json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## When to use
|
|
33
|
+
|
|
34
|
+
- First pass in an unfamiliar repo.
|
|
35
|
+
- Before delegating to a coding agent.
|
|
36
|
+
- PR/branch handoff where changed files matter.
|
|
37
|
+
- Safety preflight before touching CI, migrations, deploy scripts, auth, or config.
|
|
38
|
+
|
|
39
|
+
## Safety
|
|
40
|
+
|
|
41
|
+
- This is not a full secret scanner. Use Gitleaks/TruffleHog for full audits.
|
|
42
|
+
- If high-risk patterns are found, inspect before proceeding.
|
|
43
|
+
- Use `--fail-on-high-risk` in CI or strict agent workflows.
|
|
44
|
+
- Generated briefs may include snippets from repo context files; avoid posting publicly without review.
|
|
45
|
+
|
|
46
|
+
## Useful commands
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx repo-agent-brief .
|
|
50
|
+
npx repo-agent-brief . --diff HEAD
|
|
51
|
+
npx repo-agent-brief . --diff origin/main --fail-on-high-risk
|
|
52
|
+
npx repo-agent-brief . --no-snippets
|
|
53
|
+
```
|
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) {
|