agentsys 5.3.0 → 5.3.2
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor/commands/audit-project-agents.md +454 -0
- package/.cursor/commands/audit-project-github.md +141 -0
- package/.cursor/commands/audit-project.md +330 -0
- package/.cursor/commands/consult.md +417 -0
- package/.cursor/commands/debate.md +381 -0
- package/.cursor/commands/delivery-approval.md +334 -0
- package/.cursor/commands/deslop.md +142 -0
- package/.cursor/commands/drift-detect.md +259 -0
- package/.cursor/commands/enhance.md +172 -0
- package/.cursor/commands/learn.md +165 -0
- package/.cursor/commands/next-task.md +519 -0
- package/.cursor/commands/perf.md +464 -0
- package/.cursor/commands/repo-map.md +124 -0
- package/.cursor/commands/ship-ci-review-loop.md +468 -0
- package/.cursor/commands/ship-deployment.md +348 -0
- package/.cursor/commands/ship-error-handling.md +265 -0
- package/.cursor/commands/ship.md +517 -0
- package/.cursor/commands/sync-docs.md +171 -0
- package/.cursor/commands/web-ctl.md +101 -0
- package/.cursor/skills/consult/SKILL.md +425 -0
- package/.cursor/skills/debate/SKILL.md +316 -0
- package/.cursor/skills/deslop/SKILL.md +204 -0
- package/.cursor/skills/discover-tasks/SKILL.md +297 -0
- package/.cursor/skills/drift-analysis/SKILL.md +324 -0
- package/.cursor/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/.cursor/skills/enhance-claude-memory/SKILL.md +387 -0
- package/.cursor/skills/enhance-cross-file/SKILL.md +110 -0
- package/.cursor/skills/enhance-docs/SKILL.md +298 -0
- package/.cursor/skills/enhance-hooks/SKILL.md +554 -0
- package/.cursor/skills/enhance-orchestrator/SKILL.md +255 -0
- package/.cursor/skills/enhance-plugins/SKILL.md +319 -0
- package/.cursor/skills/enhance-prompts/SKILL.md +340 -0
- package/.cursor/skills/enhance-skills/SKILL.md +436 -0
- package/.cursor/skills/learn/SKILL.md +349 -0
- package/.cursor/skills/orchestrate-review/SKILL.md +260 -0
- package/.cursor/skills/perf-analyzer/SKILL.md +37 -0
- package/.cursor/skills/perf-baseline-manager/SKILL.md +30 -0
- package/.cursor/skills/perf-benchmarker/SKILL.md +52 -0
- package/.cursor/skills/perf-code-paths/SKILL.md +32 -0
- package/.cursor/skills/perf-investigation-logger/SKILL.md +41 -0
- package/.cursor/skills/perf-profiler/SKILL.md +42 -0
- package/.cursor/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/.cursor/skills/perf-theory-tester/SKILL.md +36 -0
- package/.cursor/skills/repo-mapping/SKILL.md +83 -0
- package/.cursor/skills/sync-docs/SKILL.md +351 -0
- package/.cursor/skills/validate-delivery/SKILL.md +186 -0
- package/.cursor/skills/web-auth/SKILL.md +177 -0
- package/.cursor/skills/web-browse/SKILL.md +516 -0
- package/.kiro/agents/agent-enhancer.json +12 -0
- package/.kiro/agents/ci-fixer.json +13 -0
- package/.kiro/agents/ci-monitor.json +12 -0
- package/.kiro/agents/claudemd-enhancer.json +12 -0
- package/.kiro/agents/consult-agent.json +13 -0
- package/.kiro/agents/cross-file-enhancer.json +12 -0
- package/.kiro/agents/debate-orchestrator.json +13 -0
- package/.kiro/agents/delivery-validator.json +12 -0
- package/.kiro/agents/deslop-agent.json +12 -0
- package/.kiro/agents/docs-enhancer.json +12 -0
- package/.kiro/agents/exploration-agent.json +12 -0
- package/.kiro/agents/hooks-enhancer.json +11 -0
- package/.kiro/agents/implementation-agent.json +13 -0
- package/.kiro/agents/learn-agent.json +12 -0
- package/.kiro/agents/map-validator.json +11 -0
- package/.kiro/agents/perf-analyzer.json +12 -0
- package/.kiro/agents/perf-code-paths.json +11 -0
- package/.kiro/agents/perf-investigation-logger.json +12 -0
- package/.kiro/agents/perf-orchestrator.json +13 -0
- package/.kiro/agents/perf-theory-gatherer.json +12 -0
- package/.kiro/agents/perf-theory-tester.json +13 -0
- package/.kiro/agents/plan-synthesizer.json +12 -0
- package/.kiro/agents/planning-agent.json +12 -0
- package/.kiro/agents/plugin-enhancer.json +12 -0
- package/.kiro/agents/prompt-enhancer.json +12 -0
- package/.kiro/agents/reviewer-perf-test.json +11 -0
- package/.kiro/agents/reviewer-quality-security.json +11 -0
- package/.kiro/agents/simple-fixer.json +13 -0
- package/.kiro/agents/skills-enhancer.json +11 -0
- package/.kiro/agents/sync-docs-agent.json +13 -0
- package/.kiro/agents/task-discoverer.json +12 -0
- package/.kiro/agents/test-coverage-checker.json +12 -0
- package/.kiro/agents/web-session.json +12 -0
- package/.kiro/agents/worktree-manager.json +13 -0
- package/.kiro/skills/consult/SKILL.md +425 -0
- package/.kiro/skills/debate/SKILL.md +316 -0
- package/.kiro/skills/deslop/SKILL.md +204 -0
- package/.kiro/skills/discover-tasks/SKILL.md +297 -0
- package/.kiro/skills/drift-analysis/SKILL.md +324 -0
- package/.kiro/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/.kiro/skills/enhance-claude-memory/SKILL.md +387 -0
- package/.kiro/skills/enhance-cross-file/SKILL.md +110 -0
- package/.kiro/skills/enhance-docs/SKILL.md +298 -0
- package/.kiro/skills/enhance-hooks/SKILL.md +554 -0
- package/.kiro/skills/enhance-orchestrator/SKILL.md +255 -0
- package/.kiro/skills/enhance-plugins/SKILL.md +319 -0
- package/.kiro/skills/enhance-prompts/SKILL.md +340 -0
- package/.kiro/skills/enhance-skills/SKILL.md +436 -0
- package/.kiro/skills/learn/SKILL.md +349 -0
- package/.kiro/skills/orchestrate-review/SKILL.md +260 -0
- package/.kiro/skills/perf-analyzer/SKILL.md +37 -0
- package/.kiro/skills/perf-baseline-manager/SKILL.md +30 -0
- package/.kiro/skills/perf-benchmarker/SKILL.md +52 -0
- package/.kiro/skills/perf-code-paths/SKILL.md +32 -0
- package/.kiro/skills/perf-investigation-logger/SKILL.md +41 -0
- package/.kiro/skills/perf-profiler/SKILL.md +42 -0
- package/.kiro/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/.kiro/skills/perf-theory-tester/SKILL.md +36 -0
- package/.kiro/skills/repo-mapping/SKILL.md +83 -0
- package/.kiro/skills/sync-docs/SKILL.md +351 -0
- package/.kiro/skills/validate-delivery/SKILL.md +186 -0
- package/.kiro/skills/web-auth/SKILL.md +177 -0
- package/.kiro/skills/web-browse/SKILL.md +516 -0
- package/.kiro/steering/audit-project-agents.md +459 -0
- package/.kiro/steering/audit-project-github.md +146 -0
- package/.kiro/steering/audit-project.md +330 -0
- package/.kiro/steering/consult.md +422 -0
- package/.kiro/steering/debate.md +386 -0
- package/.kiro/steering/delivery-approval.md +339 -0
- package/.kiro/steering/deslop.md +149 -0
- package/.kiro/steering/drift-detect.md +264 -0
- package/.kiro/steering/enhance.md +177 -0
- package/.kiro/steering/learn.md +166 -0
- package/.kiro/steering/next-task.md +481 -0
- package/.kiro/steering/perf.md +469 -0
- package/.kiro/steering/repo-map.md +126 -0
- package/.kiro/steering/ship-ci-review-loop.md +473 -0
- package/.kiro/steering/ship-deployment.md +353 -0
- package/.kiro/steering/ship-error-handling.md +270 -0
- package/.kiro/steering/ship.md +522 -0
- package/.kiro/steering/sync-docs.md +178 -0
- package/.kiro/steering/web-ctl.md +106 -0
- package/CHANGELOG.md +15 -0
- package/bin/cli.js +2 -2
- package/lib/adapter-transforms.js +34 -2
- package/package.json +1 -1
- package/site/content.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-benchmarker
|
|
3
|
+
description: "Use when running performance benchmarks, establishing baselines, or validating regressions with sequential runs. Enforces 60s minimum runs (30s only for binary search) and no parallel benchmarks."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
argument-hint: "[command] [duration]"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# perf-benchmarker
|
|
9
|
+
|
|
10
|
+
Run sequential benchmarks with strict duration rules.
|
|
11
|
+
|
|
12
|
+
Follow `docs/perf-requirements.md` as the canonical contract.
|
|
13
|
+
|
|
14
|
+
## Parse Arguments
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
|
|
18
|
+
const command = args.find(a => !a.match(/^\d+$/)) || '';
|
|
19
|
+
const duration = parseInt(args.find(a => a.match(/^\d+$/)) || '60', 10);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Required Rules
|
|
23
|
+
|
|
24
|
+
- Benchmarks MUST run sequentially (never parallel).
|
|
25
|
+
- Minimum duration: 60s per run (30s only for binary search).
|
|
26
|
+
- Warmup: 10s minimum before measurement.
|
|
27
|
+
- Re-run anomalies.
|
|
28
|
+
|
|
29
|
+
## Output Format
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
command: <benchmark command>
|
|
33
|
+
duration: <seconds>
|
|
34
|
+
warmup: <seconds>
|
|
35
|
+
results: <metrics summary>
|
|
36
|
+
notes: <anomalies or reruns>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Output Contract
|
|
40
|
+
|
|
41
|
+
Benchmarks MUST emit a JSON metrics block between markers:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
PERF_METRICS_START
|
|
45
|
+
{"scenarios":{"low":{"latency_ms":120},"high":{"latency_ms":450}}}
|
|
46
|
+
PERF_METRICS_END
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Constraints
|
|
50
|
+
|
|
51
|
+
- No short runs unless binary-search phase.
|
|
52
|
+
- Do not change code while benchmarking.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-code-paths
|
|
3
|
+
description: "Use when mapping code paths, entrypoints, and likely hot files before profiling."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# perf-code-paths
|
|
8
|
+
|
|
9
|
+
Identify likely implementation paths for a performance scenario.
|
|
10
|
+
|
|
11
|
+
Follow `docs/perf-requirements.md` as the canonical contract.
|
|
12
|
+
|
|
13
|
+
## Required Steps
|
|
14
|
+
|
|
15
|
+
1. Use repo-map if available; otherwise use grep for entrypoints and handlers.
|
|
16
|
+
2. List top candidate files/symbols tied to the scenario.
|
|
17
|
+
3. Include imports/exports or call chains when relevant.
|
|
18
|
+
|
|
19
|
+
## Output Format
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
keywords: <comma-separated list>
|
|
23
|
+
paths:
|
|
24
|
+
- file: <path>
|
|
25
|
+
symbols: [<symbol1>, <symbol2>]
|
|
26
|
+
evidence: <short reason>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Constraints
|
|
30
|
+
|
|
31
|
+
- Focus only on supported languages (Rust, Java, JS/TS, Go, Python).
|
|
32
|
+
- Keep to the most relevant 10-15 files.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-investigation-logger
|
|
3
|
+
description: "Use when appending structured perf investigation notes and evidence."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# perf-investigation-logger
|
|
8
|
+
|
|
9
|
+
Append structured investigation notes to `{state-dir}/perf/investigations/<id>.md`.
|
|
10
|
+
|
|
11
|
+
Follow `docs/perf-requirements.md` as the canonical contract.
|
|
12
|
+
|
|
13
|
+
## Required Content
|
|
14
|
+
|
|
15
|
+
1. Exact user quotes (verbatim)
|
|
16
|
+
2. Phase summary
|
|
17
|
+
3. Decisions and rationale
|
|
18
|
+
4. Evidence pointers (files, metrics, commands)
|
|
19
|
+
|
|
20
|
+
## Output Format
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
## <Phase Name> - <YYYY-MM-DD>
|
|
24
|
+
|
|
25
|
+
**User Quote:** "<exact quote>"
|
|
26
|
+
|
|
27
|
+
**Summary**
|
|
28
|
+
- ...
|
|
29
|
+
|
|
30
|
+
**Evidence**
|
|
31
|
+
- Command: `...`
|
|
32
|
+
- File: `path:line`
|
|
33
|
+
|
|
34
|
+
**Decision**
|
|
35
|
+
- ...
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Constraints
|
|
39
|
+
|
|
40
|
+
- Use `AI_STATE_DIR` for state path (default `.claude`).
|
|
41
|
+
- Do not paraphrase user quotes.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-profiler
|
|
3
|
+
description: "Use when profiling CPU/memory hot paths, generating flame graphs, or capturing JFR/perf evidence."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
argument-hint: "[tool] [command]"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# perf-profiler
|
|
9
|
+
|
|
10
|
+
Run profiling tools and capture hotspots with evidence.
|
|
11
|
+
|
|
12
|
+
Follow `docs/perf-requirements.md` as the canonical contract.
|
|
13
|
+
|
|
14
|
+
## Parse Arguments
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
|
|
18
|
+
const tool = args[0] || '';
|
|
19
|
+
const command = args.slice(1).join(' ');
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Required Rules
|
|
23
|
+
|
|
24
|
+
- Verify debug symbols before profiling.
|
|
25
|
+
- Capture file:line for hotspots.
|
|
26
|
+
- Provide flame graph or equivalent output when possible.
|
|
27
|
+
|
|
28
|
+
## Output Format
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
tool: <profiler>
|
|
32
|
+
command: <command>
|
|
33
|
+
hotspots:
|
|
34
|
+
- file:line - reason
|
|
35
|
+
artifacts:
|
|
36
|
+
- <path to flame graph or profile>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Constraints
|
|
40
|
+
|
|
41
|
+
- No profiling without a clear scenario.
|
|
42
|
+
- Keep outputs minimal and evidence-backed.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-theory-gatherer
|
|
3
|
+
description: "Use when generating performance hypotheses backed by git history and code evidence."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# perf-theory-gatherer
|
|
8
|
+
|
|
9
|
+
Generate performance hypotheses for a specific scenario.
|
|
10
|
+
|
|
11
|
+
Follow `docs/perf-requirements.md` as the canonical contract.
|
|
12
|
+
|
|
13
|
+
## Required Steps
|
|
14
|
+
|
|
15
|
+
1. Review recent git history (scope to relevant paths when possible).
|
|
16
|
+
2. Identify code paths involved in the scenario (repo-map or grep).
|
|
17
|
+
3. Produce up to 5 hypotheses with evidence + confidence.
|
|
18
|
+
|
|
19
|
+
## Output Format
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
hypotheses:
|
|
23
|
+
- id: H1
|
|
24
|
+
hypothesis: <short description>
|
|
25
|
+
evidence: <file/path or git change>
|
|
26
|
+
confidence: low|medium|high
|
|
27
|
+
- id: H2
|
|
28
|
+
...
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Constraints
|
|
32
|
+
|
|
33
|
+
- MUST check git history before hypothesizing.
|
|
34
|
+
- No optimization suggestions; only hypotheses.
|
|
35
|
+
- Keep to 5 hypotheses maximum.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-theory-tester
|
|
3
|
+
description: "Use when running controlled perf experiments to validate hypotheses."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# perf-theory-tester
|
|
8
|
+
|
|
9
|
+
Test hypotheses using controlled experiments.
|
|
10
|
+
|
|
11
|
+
Follow `docs/perf-requirements.md` as the canonical contract.
|
|
12
|
+
|
|
13
|
+
## Required Steps
|
|
14
|
+
|
|
15
|
+
1. Confirm baseline is clean.
|
|
16
|
+
2. Apply a single change tied to the hypothesis.
|
|
17
|
+
3. Run 2+ validation passes.
|
|
18
|
+
4. Revert to baseline before the next experiment.
|
|
19
|
+
|
|
20
|
+
## Output Format
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
hypothesis: <id>
|
|
24
|
+
change: <summary>
|
|
25
|
+
delta: <metrics>
|
|
26
|
+
verdict: accept|reject|inconclusive
|
|
27
|
+
evidence:
|
|
28
|
+
- command: <benchmark command>
|
|
29
|
+
- files: <changed files>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Constraints
|
|
33
|
+
|
|
34
|
+
- One change per experiment.
|
|
35
|
+
- No parallel benchmarks.
|
|
36
|
+
- Record evidence for each run.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: repo-mapping
|
|
3
|
+
description: "Use when user asks to \"create repo map\", \"generate repo map\", \"update repo map\", \"repo map status\", or \"map symbols/imports\". Builds and validates an AST-based repo map using ast-grep."
|
|
4
|
+
argument-hint: "[action] [--force]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Repo Mapping Skill
|
|
8
|
+
|
|
9
|
+
Build and maintain a cached AST-based map of repository symbols and imports using ast-grep.
|
|
10
|
+
|
|
11
|
+
## Parse Arguments
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
|
|
15
|
+
const action = args.find(a => !a.startsWith('--')) || 'status';
|
|
16
|
+
const force = args.includes('--force');
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Primary Responsibilities
|
|
20
|
+
|
|
21
|
+
1. **Generate map** on demand (`/repo-map init`)
|
|
22
|
+
2. **Update map** incrementally (`/repo-map update`)
|
|
23
|
+
3. **Check status** and staleness (`/repo-map status`)
|
|
24
|
+
4. **Validate output** with the map-validator agent
|
|
25
|
+
|
|
26
|
+
## Core Data Contract
|
|
27
|
+
|
|
28
|
+
Repo map is stored in the platform state directory:
|
|
29
|
+
|
|
30
|
+
- Claude Code: `.claude/repo-map.json`
|
|
31
|
+
- OpenCode: `.opencode/repo-map.json`
|
|
32
|
+
- Codex CLI: `.codex/repo-map.json`
|
|
33
|
+
|
|
34
|
+
Minimal structure:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"version": "1.0.0",
|
|
39
|
+
"generated": "2026-01-25T12:00:00Z",
|
|
40
|
+
"updated": "2026-01-25T12:05:00Z",
|
|
41
|
+
"git": { "commit": "abc123", "branch": "main" },
|
|
42
|
+
"project": { "languages": ["typescript", "python"] },
|
|
43
|
+
"stats": { "totalFiles": 142, "totalSymbols": 847 },
|
|
44
|
+
"files": {
|
|
45
|
+
"src/auth/login.ts": {
|
|
46
|
+
"hash": "deadbeef1234abcd",
|
|
47
|
+
"language": "typescript",
|
|
48
|
+
"symbols": { "exports": [], "functions": [], "classes": [] },
|
|
49
|
+
"imports": [ { "source": "./utils", "kind": "named" } ]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Behavior Rules
|
|
56
|
+
|
|
57
|
+
- **Never** run ast-grep without user approval if it is not installed
|
|
58
|
+
- **Never** install dependencies without explicit user consent
|
|
59
|
+
- **Always** validate map output with `map-validator` after init/update
|
|
60
|
+
- **Prefer** incremental update unless map is stale or history rewritten
|
|
61
|
+
|
|
62
|
+
## When to Suggest Repo Map
|
|
63
|
+
|
|
64
|
+
If a user asks for drift detection, documentation alignment, or repo analysis and repo-map is missing:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Repo map not found. For better analysis, run:
|
|
68
|
+
/repo-map init
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Staleness Signals
|
|
72
|
+
|
|
73
|
+
- Map commit not found (rebased)
|
|
74
|
+
- Branch changed
|
|
75
|
+
- Git hooks marked stale
|
|
76
|
+
- Commits behind HEAD
|
|
77
|
+
|
|
78
|
+
## Output Expectations
|
|
79
|
+
|
|
80
|
+
Keep outputs concise:
|
|
81
|
+
|
|
82
|
+
- **init/update**: file count, symbol count, commit, warnings
|
|
83
|
+
- **status**: staleness, commits behind, last updated
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync-docs
|
|
3
|
+
description: "Sync documentation with code. Use when user asks to update docs, check docs, fix stale documentation, update changelog, or after code changes."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
argument-hint: "[report|apply] [--scope=all|recent|before-pr] [--include-undocumented]"
|
|
6
|
+
allowed-tools: Bash(git:*), Read, Grep, Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# sync-docs
|
|
10
|
+
|
|
11
|
+
Unified skill for syncing documentation with code state. Combines discovery, analysis, and CHANGELOG update into a single workflow.
|
|
12
|
+
|
|
13
|
+
## Parse Arguments
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
|
|
17
|
+
const mode = args.find(a => ['report', 'apply'].includes(a)) || 'report';
|
|
18
|
+
const scope = args.find(a => a.startsWith('--scope='))?.split('=')[1] || 'recent';
|
|
19
|
+
const includeUndocumented = args.includes('--include-undocumented');
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start - Agent Instructions
|
|
23
|
+
|
|
24
|
+
**Step 1**: Get changed files (use Bash):
|
|
25
|
+
```bash
|
|
26
|
+
# Recent changes (default scope)
|
|
27
|
+
git diff --name-only origin/main..HEAD 2>/dev/null || git diff --name-only HEAD~5..HEAD
|
|
28
|
+
|
|
29
|
+
# Or for all files
|
|
30
|
+
git ls-files '*.md'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Step 2**: Find docs that reference changed files (use Grep):
|
|
34
|
+
- Search for filenames, function names, class names in `*.md` files
|
|
35
|
+
- Check README.md, CHANGELOG.md, docs/*.md
|
|
36
|
+
|
|
37
|
+
**Step 3**: Analyze each doc for issues:
|
|
38
|
+
- Version mismatches (compare doc versions to package.json)
|
|
39
|
+
- Removed exports (symbols in docs but not in code)
|
|
40
|
+
- Outdated code examples
|
|
41
|
+
- Import path changes
|
|
42
|
+
|
|
43
|
+
**Step 4**: Check CHANGELOG:
|
|
44
|
+
- Look for `## [Unreleased]` section
|
|
45
|
+
- Compare recent commit messages to CHANGELOG entries
|
|
46
|
+
|
|
47
|
+
**Step 5**: If repo-map exists (`{stateDir}/repo-map.json` - platform state directory):
|
|
48
|
+
- Load it to get accurate export list
|
|
49
|
+
- Find exports not mentioned in any documentation
|
|
50
|
+
- Report as `undocumented-export` issues
|
|
51
|
+
|
|
52
|
+
## Input
|
|
53
|
+
|
|
54
|
+
Arguments: `[report|apply] [--scope=all|recent|before-pr] [--include-undocumented]`
|
|
55
|
+
|
|
56
|
+
- **Mode**: `report` (default) or `apply`
|
|
57
|
+
- **Scope**:
|
|
58
|
+
- `recent` (default): Files changed since last commit to main
|
|
59
|
+
- `all`: Scan all docs against all code
|
|
60
|
+
- `before-pr`: Files in current branch, optimized for /next-task Phase 11
|
|
61
|
+
- **--include-undocumented**: Find exports not mentioned in any docs (uses repo-map)
|
|
62
|
+
|
|
63
|
+
## Architecture
|
|
64
|
+
|
|
65
|
+
This skill orchestrates all documentation sync operations:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
sync-docs skill
|
|
69
|
+
|-- Phase 1: Detect project context
|
|
70
|
+
|-- Phase 2: Find related docs (lib/collectors/docs-patterns)
|
|
71
|
+
|-- Phase 3: Analyze issues
|
|
72
|
+
|-- Phase 3.5: Find undocumented exports (repo-map integration)
|
|
73
|
+
|-- Phase 4: Check CHANGELOG
|
|
74
|
+
|-- Phase 5: Return structured results
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The skill MUST NOT apply fixes directly. It returns structured data for the orchestrator to decide what to do.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Implementation Details (Reference)
|
|
82
|
+
|
|
83
|
+
The sections below describe the internal JavaScript implementation for reference only. Agents should follow the Quick Start instructions above using Bash, Read, and Grep tools.
|
|
84
|
+
|
|
85
|
+
### Phase 1: Detect Project Context
|
|
86
|
+
|
|
87
|
+
Detect project type and find documentation files.
|
|
88
|
+
|
|
89
|
+
### Phase 1.5: Ensure Repo-Map
|
|
90
|
+
|
|
91
|
+
Before analyzing issues, ensure repo-map is available for accurate symbol detection:
|
|
92
|
+
|
|
93
|
+
```javascript
|
|
94
|
+
const { ensureRepoMap } = require('../../lib/collectors/docs-patterns');
|
|
95
|
+
|
|
96
|
+
// Try to get repo-map (will auto-init if ast-grep available)
|
|
97
|
+
const repoMapStatus = await ensureRepoMap({
|
|
98
|
+
cwd: process.cwd(),
|
|
99
|
+
askUser: async (opts) => {
|
|
100
|
+
// Use AskUserQuestion tool
|
|
101
|
+
const answer = await AskUserQuestion({
|
|
102
|
+
question: opts.question,
|
|
103
|
+
header: opts.header,
|
|
104
|
+
options: opts.options
|
|
105
|
+
});
|
|
106
|
+
return answer;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
if (repoMapStatus.installInstructions) {
|
|
111
|
+
// User wants to install ast-grep, show instructions
|
|
112
|
+
console.log(repoMapStatus.installInstructions);
|
|
113
|
+
// Wait for user to confirm installation, then retry
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// repoMapStatus.available indicates if repo-map can be used
|
|
117
|
+
// repoMapStatus.fallbackReason explains why if not available
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**User Interaction (only if ast-grep not installed):**
|
|
121
|
+
|
|
122
|
+
Use AskUserQuestion:
|
|
123
|
+
- Header: "ast-grep Required"
|
|
124
|
+
- Question: "ast-grep not found. Install for better doc sync accuracy?"
|
|
125
|
+
- Options:
|
|
126
|
+
- "Yes, show instructions" - Display platform-specific install instructions
|
|
127
|
+
- "No, use regex fallback" - Continue with less accurate regex-based detection
|
|
128
|
+
|
|
129
|
+
If user declines or repo-map unavailable, the system falls back to regex-based export detection automatically.
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
const fs = require('fs');
|
|
133
|
+
const path = require('path');
|
|
134
|
+
const glob = require('glob');
|
|
135
|
+
|
|
136
|
+
// Detect documentation files
|
|
137
|
+
const docFiles = [];
|
|
138
|
+
const commonDocs = ['README.md', 'CHANGELOG.md', 'CONTRIBUTING.md', 'docs/**/*.md'];
|
|
139
|
+
|
|
140
|
+
for (const pattern of commonDocs) {
|
|
141
|
+
// Use glob to find matching files
|
|
142
|
+
const matches = glob.sync(pattern, { cwd: process.cwd() });
|
|
143
|
+
docFiles.push(...matches);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Detect project type from package.json, Cargo.toml, go.mod, etc.
|
|
147
|
+
let projectType = 'unknown';
|
|
148
|
+
if (fs.existsSync('package.json')) projectType = 'javascript';
|
|
149
|
+
else if (fs.existsSync('Cargo.toml')) projectType = 'rust';
|
|
150
|
+
else if (fs.existsSync('go.mod')) projectType = 'go';
|
|
151
|
+
else if (fs.existsSync('pyproject.toml') || fs.existsSync('setup.py')) projectType = 'python';
|
|
152
|
+
|
|
153
|
+
const context = { docFiles, projectType };
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
This phase gathers context about the project without requiring external scripts.
|
|
157
|
+
|
|
158
|
+
## Phase 2: Find Related Documentation
|
|
159
|
+
|
|
160
|
+
Use lib/collectors/docs-patterns to find docs related to changed files:
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
// Use relative path from skill directory to plugin lib
|
|
164
|
+
// Path: skills/sync-docs/ -> ../../lib
|
|
165
|
+
const { collectors } = require('../../lib');
|
|
166
|
+
const docsPatterns = collectors.docsPatterns;
|
|
167
|
+
|
|
168
|
+
// Get changed files based on scope
|
|
169
|
+
let changedFiles;
|
|
170
|
+
if (scope === 'all') {
|
|
171
|
+
changedFiles = await exec("git ls-files '*.js' '*.ts' '*.py' '*.go' '*.rs' '*.java'");
|
|
172
|
+
} else if (scope === 'before-pr') {
|
|
173
|
+
changedFiles = await exec("git diff --name-only origin/main..HEAD");
|
|
174
|
+
} else {
|
|
175
|
+
// recent (default): get the default branch name
|
|
176
|
+
let base = 'main';
|
|
177
|
+
try {
|
|
178
|
+
const { stdout: refOutput } = await exec("git symbolic-ref refs/remotes/origin/HEAD");
|
|
179
|
+
// Parse "refs/remotes/origin/branch-name" to extract "branch-name"
|
|
180
|
+
const rawBase = refOutput.trim().split('/').pop();
|
|
181
|
+
// Sanitize branch name to prevent shell injection (only allow alphanumeric, dash, underscore, dot)
|
|
182
|
+
if (/^[a-zA-Z0-9._-]+$/.test(rawBase)) {
|
|
183
|
+
base = rawBase;
|
|
184
|
+
}
|
|
185
|
+
} catch (e) {
|
|
186
|
+
base = 'main'; // fallback to main if symbolic-ref fails
|
|
187
|
+
}
|
|
188
|
+
changedFiles = await exec(`git diff --name-only origin/${base}..HEAD 2>/dev/null || git diff --name-only HEAD~5..HEAD`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Find related docs
|
|
192
|
+
const relatedDocs = docsPatterns.findRelatedDocs(changedFiles.split('\n').filter(Boolean), {
|
|
193
|
+
cwd: process.cwd()
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Phase 3: Analyze Documentation Issues
|
|
198
|
+
|
|
199
|
+
For each related doc, check for issues:
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
const allIssues = [];
|
|
203
|
+
|
|
204
|
+
for (const { doc, referencedFile } of relatedDocs) {
|
|
205
|
+
const issues = docsPatterns.analyzeDocIssues(doc, referencedFile, {
|
|
206
|
+
cwd: process.cwd()
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
issues.forEach(issue => {
|
|
210
|
+
allIssues.push({
|
|
211
|
+
...issue,
|
|
212
|
+
doc,
|
|
213
|
+
referencedFile
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Issue types detected:
|
|
220
|
+
- `outdated-version`: Version string doesn't match current
|
|
221
|
+
- `removed-export`: References removed symbol
|
|
222
|
+
- `code-example`: Code example may be outdated
|
|
223
|
+
- `import-path`: Import path changed
|
|
224
|
+
- `undocumented-export`: Export exists in code but not mentioned in any docs (requires repo-map)
|
|
225
|
+
|
|
226
|
+
## Phase 4: Check CHANGELOG
|
|
227
|
+
|
|
228
|
+
```javascript
|
|
229
|
+
const changelogResult = docsPatterns.checkChangelog(changedFiles.split('\n').filter(Boolean), {
|
|
230
|
+
cwd: process.cwd()
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// changelogResult contains:
|
|
234
|
+
// - exists: boolean
|
|
235
|
+
// - hasUnreleased: boolean
|
|
236
|
+
// - documented: string[]
|
|
237
|
+
// - undocumented: string[]
|
|
238
|
+
// - suggestion: string | null
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Phase 5: Return Structured Results
|
|
242
|
+
|
|
243
|
+
Combine all results into a single output:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"mode": "report|apply",
|
|
248
|
+
"scope": "recent|all|before-pr|path",
|
|
249
|
+
"context": {
|
|
250
|
+
"projectType": "javascript|python|rust|go|unknown",
|
|
251
|
+
"docFiles": ["README.md", "CHANGELOG.md"]
|
|
252
|
+
},
|
|
253
|
+
"repoMap": {
|
|
254
|
+
"available": true,
|
|
255
|
+
"fallbackReason": null,
|
|
256
|
+
"stats": { "files": 142, "symbols": 847 }
|
|
257
|
+
},
|
|
258
|
+
"discovery": {
|
|
259
|
+
"changedFilesCount": 5,
|
|
260
|
+
"relatedDocsCount": 3,
|
|
261
|
+
"relatedDocs": [
|
|
262
|
+
{ "doc": "README.md", "referencedFile": "src/api.js", "referenceTypes": ["filename", "import"] }
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
"issues": [
|
|
266
|
+
{
|
|
267
|
+
"type": "outdated-version",
|
|
268
|
+
"severity": "low",
|
|
269
|
+
"doc": "README.md",
|
|
270
|
+
"line": 15,
|
|
271
|
+
"current": "1.0.0",
|
|
272
|
+
"expected": "1.1.0",
|
|
273
|
+
"autoFix": true,
|
|
274
|
+
"suggestion": "Update version from 1.0.0 to 1.1.0"
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"undocumentedExports": [
|
|
278
|
+
{
|
|
279
|
+
"type": "undocumented-export",
|
|
280
|
+
"severity": "low",
|
|
281
|
+
"file": "src/utils.js",
|
|
282
|
+
"name": "formatDate",
|
|
283
|
+
"line": 25,
|
|
284
|
+
"certainty": "MEDIUM",
|
|
285
|
+
"suggestion": "Export 'formatDate' in src/utils.js is not mentioned in any documentation"
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
"fixes": [
|
|
289
|
+
{
|
|
290
|
+
"file": "README.md",
|
|
291
|
+
"type": "update-version",
|
|
292
|
+
"line": 15,
|
|
293
|
+
"search": "1.0.0",
|
|
294
|
+
"replace": "1.1.0"
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
"changelog": {
|
|
298
|
+
"exists": true,
|
|
299
|
+
"hasUnreleased": true,
|
|
300
|
+
"undocumented": ["feat: add new feature"],
|
|
301
|
+
"status": "needs-update|ok"
|
|
302
|
+
},
|
|
303
|
+
"summary": {
|
|
304
|
+
"issueCount": 3,
|
|
305
|
+
"fixableCount": 2,
|
|
306
|
+
"bySeverity": { "high": 0, "medium": 1, "low": 2 }
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Output Format
|
|
312
|
+
|
|
313
|
+
Output the result as JSON between markers:
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
=== SYNC_DOCS_RESULT ===
|
|
317
|
+
{JSON output}
|
|
318
|
+
=== END_RESULT ===
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Usage by Agents
|
|
322
|
+
|
|
323
|
+
### sync-docs-agent (standalone /sync-docs)
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
Skill: sync-docs
|
|
327
|
+
Args: report --scope=recent
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### /next-task Phase 11
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
Skill: sync-docs
|
|
334
|
+
Args: apply --scope=before-pr
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
The orchestrator receives the structured result and spawns `simple-fixer` if fixes are needed.
|
|
338
|
+
|
|
339
|
+
## Constraints
|
|
340
|
+
|
|
341
|
+
1. **Report mode by default** - Never modify files unless explicitly in apply mode
|
|
342
|
+
2. **Structured output** - Always return JSON between markers
|
|
343
|
+
3. **No direct fixes** - Return fix instructions, let orchestrator decide
|
|
344
|
+
4. **Preserve formatting** - Fix suggestions should preserve existing style
|
|
345
|
+
5. **Safe changes only** - Only auto-fixable issues get fix entries
|
|
346
|
+
|
|
347
|
+
## Error Handling
|
|
348
|
+
|
|
349
|
+
- **No git**: Exit with error "Git required for change detection"
|
|
350
|
+
- **No docs found**: Report empty docFiles, suggest creating README.md
|
|
351
|
+
- **No changed files**: Report scope as "empty", suggest using --scope=all
|