agentsys 5.3.4 → 5.3.5

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 (74) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +8 -0
  4. package/bin/cli.js +40 -28
  5. package/lib/adapter-transforms.js +3 -3
  6. package/package.json +1 -1
  7. package/site/content.json +32 -8
  8. package/.cursor/commands/audit-project-agents.md +0 -454
  9. package/.cursor/commands/audit-project-github.md +0 -141
  10. package/.cursor/commands/audit-project.md +0 -330
  11. package/.cursor/commands/consult.md +0 -417
  12. package/.cursor/commands/debate.md +0 -381
  13. package/.cursor/commands/delivery-approval.md +0 -334
  14. package/.cursor/commands/deslop.md +0 -142
  15. package/.cursor/commands/drift-detect.md +0 -259
  16. package/.cursor/commands/enhance.md +0 -172
  17. package/.cursor/commands/learn.md +0 -165
  18. package/.cursor/commands/next-task.md +0 -519
  19. package/.cursor/commands/perf.md +0 -464
  20. package/.cursor/commands/repo-map.md +0 -124
  21. package/.cursor/commands/ship-ci-review-loop.md +0 -468
  22. package/.cursor/commands/ship-deployment.md +0 -348
  23. package/.cursor/commands/ship-error-handling.md +0 -265
  24. package/.cursor/commands/ship.md +0 -517
  25. package/.cursor/commands/sync-docs.md +0 -171
  26. package/.cursor/commands/web-ctl.md +0 -101
  27. package/.cursor/skills/consult/SKILL.md +0 -425
  28. package/.cursor/skills/debate/SKILL.md +0 -316
  29. package/.cursor/skills/deslop/SKILL.md +0 -204
  30. package/.cursor/skills/discover-tasks/SKILL.md +0 -297
  31. package/.cursor/skills/drift-analysis/SKILL.md +0 -324
  32. package/.cursor/skills/enhance-agent-prompts/SKILL.md +0 -277
  33. package/.cursor/skills/enhance-claude-memory/SKILL.md +0 -387
  34. package/.cursor/skills/enhance-cross-file/SKILL.md +0 -110
  35. package/.cursor/skills/enhance-docs/SKILL.md +0 -298
  36. package/.cursor/skills/enhance-hooks/SKILL.md +0 -554
  37. package/.cursor/skills/enhance-orchestrator/SKILL.md +0 -255
  38. package/.cursor/skills/enhance-plugins/SKILL.md +0 -319
  39. package/.cursor/skills/enhance-prompts/SKILL.md +0 -340
  40. package/.cursor/skills/enhance-skills/SKILL.md +0 -436
  41. package/.cursor/skills/learn/SKILL.md +0 -349
  42. package/.cursor/skills/orchestrate-review/SKILL.md +0 -260
  43. package/.cursor/skills/perf-analyzer/SKILL.md +0 -37
  44. package/.cursor/skills/perf-baseline-manager/SKILL.md +0 -30
  45. package/.cursor/skills/perf-benchmarker/SKILL.md +0 -52
  46. package/.cursor/skills/perf-code-paths/SKILL.md +0 -32
  47. package/.cursor/skills/perf-investigation-logger/SKILL.md +0 -41
  48. package/.cursor/skills/perf-profiler/SKILL.md +0 -42
  49. package/.cursor/skills/perf-theory-gatherer/SKILL.md +0 -35
  50. package/.cursor/skills/perf-theory-tester/SKILL.md +0 -36
  51. package/.cursor/skills/repo-mapping/SKILL.md +0 -83
  52. package/.cursor/skills/sync-docs/SKILL.md +0 -351
  53. package/.cursor/skills/validate-delivery/SKILL.md +0 -186
  54. package/.cursor/skills/web-auth/SKILL.md +0 -177
  55. package/.cursor/skills/web-browse/SKILL.md +0 -516
  56. package/.kiro/steering/audit-project-agents.md +0 -459
  57. package/.kiro/steering/audit-project-github.md +0 -146
  58. package/.kiro/steering/audit-project.md +0 -330
  59. package/.kiro/steering/consult.md +0 -422
  60. package/.kiro/steering/debate.md +0 -386
  61. package/.kiro/steering/delivery-approval.md +0 -339
  62. package/.kiro/steering/deslop.md +0 -149
  63. package/.kiro/steering/drift-detect.md +0 -264
  64. package/.kiro/steering/enhance.md +0 -177
  65. package/.kiro/steering/learn.md +0 -166
  66. package/.kiro/steering/next-task.md +0 -481
  67. package/.kiro/steering/perf.md +0 -469
  68. package/.kiro/steering/repo-map.md +0 -126
  69. package/.kiro/steering/ship-ci-review-loop.md +0 -473
  70. package/.kiro/steering/ship-deployment.md +0 -353
  71. package/.kiro/steering/ship-error-handling.md +0 -270
  72. package/.kiro/steering/ship.md +0 -522
  73. package/.kiro/steering/sync-docs.md +0 -178
  74. package/.kiro/steering/web-ctl.md +0 -106
@@ -1,464 +0,0 @@
1
-
2
- # /perf - Performance Investigation Workflow
3
-
4
- Run a rigorous, evidence-driven performance investigation with strict rules, baselines, and reproducible benchmarks.
5
-
6
- ## Canonical Requirements
7
-
8
- All behavior must follow:
9
- - `docs/perf-requirements.md` (source of truth)
10
- - `docs/perf-research-methodology.md`
11
-
12
- ## Arguments
13
-
14
- - `--resume`: Continue the latest investigation from `{state-dir}/perf/investigation.json`
15
- - `--phase <phase>`: Force starting phase (use only when resuming)
16
- - `--id <id>`: Set investigation id (new only)
17
- - `--scenario <text>`: Short scenario description
18
- - `--command <cmd>`: Benchmark command (prints PERF_METRICS markers)
19
- - `--version <ver>`: Baseline version label
20
- - `--duration <seconds>`: Benchmark duration override (default 60s; use smaller values for micro-benchmarks)
21
- - `--runs <n>`: Number of runs for start-to-end benchmarks (use with median aggregation)
22
- - `--aggregate <median|mean|min|max>`: Aggregation method for multi-run benchmarks (default median)
23
- - `--quote <text>`: User quote to record in logs
24
- - `--hypotheses-file <path>`: JSON file with hypothesis list (for hypotheses phase)
25
- - `--param-env <name>`: Env var for breaking-point value (default PERF_PARAM_VALUE)
26
- - `--param-min <n>`: Breaking-point min value (default 1)
27
- - `--param-max <n>`: Breaking-point max value (default 500)
28
- - `--cpu <limit>`: Constraint CPU limit (default 1)
29
- - `--memory <limit>`: Constraint memory limit (default 1GB)
30
- - `--change <summary>`: Optimization change summary
31
- - `--verdict <continue|stop>`: Decision verdict
32
- - `--rationale <text>`: Decision rationale
33
-
34
- ## Phase 1: Initialize Investigation State
35
-
36
- ```javascript
37
-
38
- const pluginRoot = getPluginRoot('perf');
39
- if (!pluginRoot) { console.error('Error: Could not locate perf plugin root'); process.exit(1); }
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
- const args = argumentParser.parseArguments('$ARGUMENTS');
55
- const options = {
56
- resume: false,
57
- phase: null,
58
- id: null,
59
- scenario: '',
60
- command: '',
61
- version: '',
62
- duration: null,
63
- runs: null,
64
- aggregate: '',
65
- quote: '',
66
- hypothesesFile: '',
67
- paramEnv: 'PERF_PARAM_VALUE',
68
- paramMin: 1,
69
- paramMax: 500,
70
- cpu: '1',
71
- memory: '1GB',
72
- change: '',
73
- verdict: '',
74
- rationale: ''
75
- };
76
-
77
- for (let i = 0; i < args.length; i++) {
78
- const arg = args[i];
79
- if (arg === '--resume') options.resume = true;
80
- else if (arg === '--phase' && args[i + 1]) options.phase = args[++i];
81
- else if (arg === '--id' && args[i + 1]) options.id = args[++i];
82
- else if (arg === '--scenario' && args[i + 1]) options.scenario = args[++i];
83
- else if (arg === '--command' && args[i + 1]) options.command = args[++i];
84
- else if (arg === '--version' && args[i + 1]) options.version = args[++i];
85
- else if (arg === '--duration' && args[i + 1]) options.duration = Number(args[++i]);
86
- else if (arg === '--runs' && args[i + 1]) options.runs = Number(args[++i]);
87
- else if (arg === '--aggregate' && args[i + 1]) options.aggregate = args[++i];
88
- else if (arg === '--quote' && args[i + 1]) options.quote = args[++i];
89
- else if (arg === '--hypotheses-file' && args[i + 1]) options.hypothesesFile = args[++i];
90
- else if (arg === '--param-env' && args[i + 1]) options.paramEnv = args[++i];
91
- else if (arg === '--param-min' && args[i + 1]) options.paramMin = Number(args[++i]);
92
- else if (arg === '--param-max' && args[i + 1]) options.paramMax = Number(args[++i]);
93
- else if (arg === '--cpu' && args[i + 1]) options.cpu = args[++i];
94
- else if (arg === '--memory' && args[i + 1]) options.memory = args[++i];
95
- else if (arg === '--change' && args[i + 1]) options.change = args[++i];
96
- else if (arg === '--verdict' && args[i + 1]) options.verdict = args[++i];
97
- else if (arg === '--rationale' && args[i + 1]) options.rationale = args[++i];
98
- }
99
-
100
- const cwd = process.cwd();
101
- const allowedPhases = investigationState.PHASES;
102
- if (options.phase && !allowedPhases.includes(options.phase)) {
103
- console.error(`Invalid phase: ${options.phase}. Allowed: ${allowedPhases.join(', ')}`);
104
- process.exit(1);
105
- }
106
-
107
- let state = investigationState.readInvestigation(cwd);
108
- if (options.resume) {
109
- if (!state) {
110
- console.error('No active investigation found. Run /perf without --resume first.');
111
- process.exit(1);
112
- }
113
- } else {
114
- state = investigationState.initializeInvestigation({
115
- id: options.id,
116
- phase: options.phase,
117
- scenario: options.scenario
118
- }, cwd);
119
- }
120
-
121
- if (options.phase && options.resume) {
122
- state = investigationState.updateInvestigation({ phase: options.phase }, cwd);
123
- }
124
-
125
- const userQuote = options.quote || options.scenario || 'n/a';
126
- if (options.command || options.version || options.scenario) {
127
- state = investigationState.updateInvestigation({
128
- scenario: {
129
- description: options.scenario || state.scenario?.description || '',
130
- metrics: state.scenario?.metrics || [],
131
- successCriteria: state.scenario?.successCriteria || '',
132
- scenarios: state.scenario?.scenarios || []
133
- },
134
- benchmark: {
135
- command: options.command || state.benchmark?.command || '',
136
- version: options.version || state.benchmark?.version || '',
137
- duration: Number.isFinite(options.duration) ? options.duration : state.benchmark?.duration,
138
- runs: Number.isFinite(options.runs) ? options.runs : state.benchmark?.runs,
139
- aggregate: options.aggregate || state.benchmark?.aggregate
140
- }
141
- }, cwd);
142
- }
143
-
144
- console.log(`
145
- ## /perf Investigation
146
-
147
- **ID**: ${state.id}
148
- **Phase**: ${state.phase}
149
- **Scenario**: ${state.scenario?.description || 'n/a'}
150
-
151
- Running phase handler...
152
- `);
153
-
154
- const phase = state.phase;
155
- const command = state.benchmark?.command || options.command;
156
- const version = state.benchmark?.version || options.version;
157
-
158
- function requireFields(fields) {
159
- const missing = fields.filter(Boolean);
160
- if (missing.length > 0) {
161
- console.error(`Missing required input(s): ${missing.join(', ')}`);
162
- process.exit(1);
163
- }
164
- }
165
-
166
- const phaseRequirements = {
167
- setup: () => requireFields([
168
- state.scenario?.description ? '' : '--scenario',
169
- command ? '' : '--command',
170
- version ? '' : '--version'
171
- ]),
172
- baseline: () => requireFields([command ? '' : '--command', version ? '' : '--version']),
173
- 'breaking-point': () => requireFields([command ? '' : '--command']),
174
- constraints: () => requireFields([command ? '' : '--command']),
175
- hypotheses: () => requireFields([state.scenario?.description ? '' : '--scenario']),
176
- 'code-paths': () => requireFields([state.scenario?.description ? '' : '--scenario']),
177
- profiling: () => requireFields([]),
178
- optimization: () => requireFields([options.change ? '' : '--change']),
179
- decision: () => requireFields([options.verdict ? '' : '--verdict', options.rationale ? '' : '--rationale']),
180
- consolidation: () => requireFields([version ? '' : '--version'])
181
- };
182
-
183
- async function runPhase() {
184
- if (phaseRequirements[phase]) {
185
- phaseRequirements[phase]();
186
- }
187
- switch (phase) {
188
- case 'setup': {
189
- state = investigationState.updateInvestigation({ phase: 'baseline' }, cwd);
190
- investigationState.appendSetupLog({
191
- id: state.id,
192
- userQuote,
193
- scenario: state.scenario?.description || '',
194
- command,
195
- version,
196
- duration: Number.isFinite(options.duration) ? options.duration : state.benchmark?.duration,
197
- runs: Number.isFinite(options.runs) ? options.runs : state.benchmark?.runs,
198
- aggregate: options.aggregate || state.benchmark?.aggregate
199
- }, cwd);
200
- checkpoint.commitCheckpoint({
201
- phase: 'setup',
202
- id: state.id,
203
- baselineVersion: version,
204
- deltaSummary: 'n/a'
205
- });
206
- return;
207
- }
208
- case 'baseline': {
209
- const runs = Number.isFinite(options.runs) ? options.runs : state.benchmark?.runs;
210
- const aggregate = options.aggregate || state.benchmark?.aggregate;
211
- const result = benchmarkRunner.runBenchmarkSeries(command, {
212
- duration: Number.isFinite(options.duration) ? options.duration : undefined,
213
- runs,
214
- aggregate
215
- });
216
- baselineStore.writeBaseline(version, { command, metrics: result.metrics }, cwd);
217
- const baselinePath = baselineStore.getBaselinePath(version, cwd);
218
- investigationState.appendBaselineLog({
219
- id: state.id,
220
- userQuote,
221
- command,
222
- metrics: result.metrics,
223
- baselinePath,
224
- duration: Number.isFinite(options.duration) ? options.duration : state.benchmark?.duration,
225
- runs,
226
- aggregate: aggregate || (runs ? 'median' : undefined),
227
- scenarios: state.scenario?.scenarios
228
- }, cwd);
229
- state = investigationState.updateInvestigation({ phase: 'breaking-point' }, cwd);
230
- checkpoint.commitCheckpoint({
231
- phase: 'baseline',
232
- id: state.id,
233
- baselineVersion: version,
234
- deltaSummary: 'n/a'
235
- });
236
- return;
237
- }
238
- case 'breaking-point': {
239
- const result = await breakingPointRunner.runBreakingPointSearch({
240
- command,
241
- paramEnv: options.paramEnv,
242
- min: options.paramMin,
243
- max: options.paramMax
244
- });
245
- investigationState.updateInvestigation({
246
- breakingPoint: result.breakingPoint,
247
- breakingPointHistory: result.history,
248
- phase: 'constraints'
249
- }, cwd);
250
- investigationState.appendBreakingPointLog({
251
- id: state.id,
252
- userQuote,
253
- paramEnv: options.paramEnv,
254
- min: options.paramMin,
255
- max: options.paramMax,
256
- breakingPoint: result.breakingPoint,
257
- history: result.history
258
- }, cwd);
259
- checkpoint.commitCheckpoint({
260
- phase: 'breaking-point',
261
- id: state.id,
262
- baselineVersion: version || 'n/a',
263
- deltaSummary: `breakingPoint=${result.breakingPoint ?? 'n/a'}`
264
- });
265
- return;
266
- }
267
- case 'constraints': {
268
- const runs = Number.isFinite(options.runs) ? options.runs : state.benchmark?.runs;
269
- const aggregate = options.aggregate || state.benchmark?.aggregate;
270
- const results = constraintRunner.runConstraintTest({
271
- command,
272
- constraints: { cpu: options.cpu, memory: options.memory },
273
- duration: Number.isFinite(options.duration) ? options.duration : undefined,
274
- runs,
275
- aggregate
276
- });
277
- const nextResults = Array.isArray(state.constraintResults) ? state.constraintResults : [];
278
- nextResults.push(results);
279
- investigationState.updateInvestigation({ constraintResults: nextResults, phase: 'hypotheses' }, cwd);
280
- investigationState.appendConstraintLog({
281
- id: state.id,
282
- userQuote,
283
- constraints: results.constraints,
284
- delta: results.delta
285
- }, cwd);
286
- checkpoint.commitCheckpoint({
287
- phase: 'constraints',
288
- id: state.id,
289
- baselineVersion: version || 'n/a',
290
- deltaSummary: 'constraints'
291
- });
292
- return;
293
- }
294
- case 'hypotheses': {
295
- const gitHistory = checkpoint.getRecentCommits(5);
296
- let hypotheses = Array.isArray(state.hypotheses) ? state.hypotheses : [];
297
- if (hypotheses.length === 0) {
298
- if (!options.hypothesesFile) {
299
- console.error('Missing hypotheses. Run perf-theory-gatherer or provide --hypotheses-file.');
300
- process.exit(1);
301
- }
302
- try {
303
- const raw = fs.readFileSync(options.hypothesesFile, 'utf8');
304
- const parsed = JSON.parse(raw);
305
- hypotheses = Array.isArray(parsed.hypotheses) ? parsed.hypotheses : parsed;
306
- } catch (error) {
307
- console.error(`Failed to load hypotheses file: ${error.message}`);
308
- process.exit(1);
309
- }
310
- }
311
- investigationState.updateInvestigation({ hypotheses, phase: 'code-paths' }, cwd);
312
- investigationState.appendHypothesesLog({
313
- id: state.id,
314
- userQuote,
315
- hypotheses,
316
- gitHistory,
317
- hypothesesFile: options.hypothesesFile || null
318
- }, cwd);
319
- checkpoint.commitCheckpoint({
320
- phase: 'hypotheses',
321
- id: state.id,
322
- baselineVersion: version || 'n/a',
323
- deltaSummary: 'n/a'
324
- });
325
- return;
326
- }
327
- case 'code-paths': {
328
- const mapStatus = repoMap.status(cwd);
329
- if (!mapStatus.exists) {
330
- console.log('Repo map not found. Run /repo-map init for better code-path coverage.');
331
- }
332
- const repoMapStatus = mapStatus.exists
333
- ? `available (files=${mapStatus.status?.files ?? 'n/a'}, symbols=${mapStatus.status?.symbols ?? 'n/a'})`
334
- : 'missing';
335
- const map = repoMap.load(cwd);
336
- const result = codePaths.collectCodePaths(map, state.scenario?.description || '');
337
- investigationState.updateInvestigation({ codePaths: result.paths, phase: 'profiling' }, cwd);
338
- investigationState.appendCodePathsLog({
339
- id: state.id,
340
- userQuote,
341
- keywords: result.keywords,
342
- paths: result.paths,
343
- repoMapStatus
344
- }, cwd);
345
- checkpoint.commitCheckpoint({
346
- phase: 'code-paths',
347
- id: state.id,
348
- baselineVersion: version || 'n/a',
349
- deltaSummary: `paths=${result.paths.length}`
350
- });
351
- return;
352
- }
353
- case 'profiling': {
354
- const result = profilingRunner.runProfiling({ repoPath: cwd, command });
355
- if (!result.ok) {
356
- console.error(`Profiling failed: ${result.error}`);
357
- process.exit(1);
358
- }
359
- const nextResults = Array.isArray(state.profilingResults) ? state.profilingResults : [];
360
- nextResults.push(result.result);
361
- investigationState.updateInvestigation({ profilingResults: nextResults, phase: 'optimization' }, cwd);
362
- investigationState.appendProfilingLog({
363
- id: state.id,
364
- userQuote,
365
- tool: result.result.tool,
366
- command: result.result.command,
367
- artifacts: result.result.artifacts,
368
- hotspots: result.result.hotspots
369
- }, cwd);
370
- checkpoint.commitCheckpoint({
371
- phase: 'profiling',
372
- id: state.id,
373
- baselineVersion: version || 'n/a',
374
- deltaSummary: 'n/a'
375
- });
376
- return;
377
- }
378
- case 'optimization': {
379
- const gitHistory = checkpoint.getRecentCommits(5);
380
- const runs = Number.isFinite(options.runs) ? options.runs : state.benchmark?.runs;
381
- const aggregate = options.aggregate || state.benchmark?.aggregate;
382
- const result = optimizationRunner.runOptimizationExperiment({
383
- command,
384
- changeSummary: options.change,
385
- duration: Number.isFinite(options.duration) ? options.duration : undefined,
386
- runs,
387
- aggregate
388
- });
389
- const nextResults = Array.isArray(state.results) ? state.results : [];
390
- nextResults.push(result);
391
- investigationState.updateInvestigation({ results: nextResults, phase: 'decision' }, cwd);
392
- investigationState.appendOptimizationLog({
393
- id: state.id,
394
- userQuote,
395
- change: options.change,
396
- delta: result.delta,
397
- verdict: result.verdict,
398
- gitHistory,
399
- runs,
400
- aggregate: aggregate || (runs ? 'median' : undefined)
401
- }, cwd);
402
- checkpoint.commitCheckpoint({
403
- phase: 'optimization',
404
- id: state.id,
405
- baselineVersion: version || 'n/a',
406
- deltaSummary: 'n/a'
407
- });
408
- return;
409
- }
410
- case 'decision': {
411
- const decision = { verdict: options.verdict, rationale: options.rationale };
412
- investigationState.updateInvestigation({ decision, phase: 'consolidation' }, cwd);
413
- investigationState.appendDecisionLog({
414
- id: state.id,
415
- userQuote,
416
- verdict: options.verdict,
417
- rationale: options.rationale,
418
- resultsCount: Array.isArray(state.results) ? state.results.length : 0
419
- }, cwd);
420
- checkpoint.commitCheckpoint({
421
- phase: 'decision',
422
- id: state.id,
423
- baselineVersion: version || 'n/a',
424
- deltaSummary: 'n/a'
425
- });
426
- return;
427
- }
428
- case 'consolidation': {
429
- const baseline = baselineStore.readBaseline(version, cwd);
430
- if (!baseline) {
431
- console.error(`Baseline not found for version ${version}`);
432
- process.exit(1);
433
- }
434
- const result = consolidation.consolidateBaseline({ version, baseline }, cwd);
435
- investigationState.appendConsolidationLog({
436
- id: state.id,
437
- userQuote,
438
- version,
439
- path: result.path
440
- }, cwd);
441
- investigationState.updateInvestigation({ phase: 'complete' }, cwd);
442
- checkpoint.commitCheckpoint({
443
- phase: 'consolidation',
444
- id: state.id,
445
- baselineVersion: version,
446
- deltaSummary: 'n/a'
447
- });
448
- return;
449
- }
450
- default:
451
- return;
452
- }
453
- }
454
-
455
- await runPhase();
456
- ```
457
-
458
- ## Output
459
-
460
- - Updated `{state-dir}/perf/investigation.json`
461
- - Investigation log at `{state-dir}/perf/investigations/<id>.md`
462
- - Baseline files at `{state-dir}/perf/baselines/<version>.json`
463
-
464
- Begin the performance investigation now.
@@ -1,124 +0,0 @@
1
-
2
- # /repo-map - AST Repo Map
3
-
4
- Generate a cached repository map of symbols and imports using ast-grep. This enables faster drift detection and more accurate code context.
5
-
6
- ## Arguments
7
-
8
- Parse from `$ARGUMENTS`:
9
-
10
- - **Action**: `init` | `update` | `status` | `rebuild` (default: `status`)
11
- - `--force`: Force rebuild (for `init`)
12
- - `--full`: Force full rebuild (for `update`)
13
-
14
- Examples:
15
-
16
- - `/repo-map init`
17
- - `/repo-map update --full`
18
- - `/repo-map status`
19
-
20
- ## Execution
21
-
22
- ### 1) Load Repo Map Module
23
-
24
- ```javascript
25
-
26
- const pluginRoot = getPluginRoot('repo-map');
27
- if (!pluginRoot) { console.error('Error: Could not locate repo-map plugin root'); process.exit(1); }
28
-
29
- ```
30
-
31
- ### 2) Parse Arguments
32
-
33
- ```javascript
34
- const args = '$ARGUMENTS'.split(' ').filter(Boolean);
35
- const action = (args[0] || 'status').toLowerCase();
36
-
37
- const options = {
38
- force: args.includes('--force'),
39
- full: args.includes('--full')
40
- };
41
- ```
42
-
43
- ### 3) Ensure ast-grep is Available
44
-
45
- ```javascript
46
- const installed = await repoMap.checkAstGrepInstalled();
47
- if (!installed.found || !repoMap.installer.meetsMinimumVersion(installed.version)) {
48
- const suggestion = repoMap.getInstallInstructions();
49
- const choice = await AskUserQuestion({
50
- questions: [{
51
- header: 'Install ast-grep?',
52
- question: 'ast-grep is required for repo-map. Install now?',
53
- options: [
54
- { label: 'Install via npm', description: 'Runs: npm install -g @ast-grep/cli' },
55
- { label: 'Skip for now', description: 'Show install instructions and exit' }
56
- ]
57
- }]
58
- });
59
-
60
- if (choice?.[0] === 'Install via npm') {
61
- await Bash('npm install -g @ast-grep/cli');
62
- } else {
63
- console.log(suggestion);
64
- return;
65
- }
66
- }
67
- ```
68
-
69
- ### 4) Run Action
70
-
71
- ```javascript
72
- let result;
73
-
74
- if (action === 'init' || action === 'rebuild') {
75
- result = await repoMap.init(process.cwd(), {
76
- force: action === 'rebuild' || options.force
77
- });
78
- } else if (action === 'update') {
79
- result = await repoMap.update(process.cwd(), { full: options.full });
80
- } else if (action === 'status') {
81
- result = repoMap.status(process.cwd());
82
- } else {
83
- console.log('Unknown action. Use: init | update | status | rebuild');
84
- return;
85
- }
86
-
87
- if (result?.success === false) {
88
- console.log(result.error || 'Repo-map failed');
89
- if (result.installSuggestion) console.log(result.installSuggestion);
90
- return;
91
- }
92
-
93
- if (action === 'status' && !result.exists) {
94
- console.log('No repo-map found. Run /repo-map init to generate one.');
95
- return;
96
- }
97
- ```
98
-
99
- ### 5) Validate Results (init/update only)
100
-
101
- After `init` or `update`, run validation using the lightweight agent:
102
-
103
- ```javascript
104
- if (action === 'init' || action === 'rebuild' || action === 'update') {
105
- const summary = result?.map?.stats || result?.summary || result?.changes || {};
106
- const validation = Invoke the map-validator agent
107
- console.log(validation);
108
- }
109
- ```
110
-
111
- ## Output Format
112
-
113
- ```markdown
114
- ## Repo Map Result
115
-
116
- **Action**: init|update|status
117
- **Files**: <count>
118
- **Symbols**: <count>
119
- **Languages**: <list>
120
- **Commit**: <hash>
121
-
122
- ### Notes
123
- - <warnings or validation results>
124
- ```