agents-reverse-engineer 0.2.8 → 0.2.9
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.
|
@@ -1,54 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Template generators for AI coding assistant integration files
|
|
3
3
|
*
|
|
4
|
-
* Generates command file templates for Claude Code, OpenCode, and session hooks.
|
|
4
|
+
* Generates command file templates for Claude Code, OpenCode, Gemini CLI, and session hooks.
|
|
5
5
|
*/
|
|
6
6
|
import type { IntegrationTemplate } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Get Claude Code command file templates
|
|
9
|
-
*
|
|
10
|
-
* Returns templates for:
|
|
11
|
-
* - generate.md: Full documentation generation command
|
|
12
|
-
* - update.md: Incremental documentation update command
|
|
13
|
-
* - init.md: Initialize agents-reverse-engineer in a project
|
|
14
|
-
*
|
|
15
|
-
* @returns Array of Claude Code command templates
|
|
16
9
|
*/
|
|
17
10
|
export declare function getClaudeTemplates(): IntegrationTemplate[];
|
|
18
11
|
/**
|
|
19
12
|
* Get OpenCode command file templates
|
|
20
|
-
*
|
|
21
|
-
* Returns templates for:
|
|
22
|
-
* - are-generate.md: Full documentation generation command
|
|
23
|
-
* - are-update.md: Incremental documentation update command
|
|
24
|
-
*
|
|
25
|
-
* @returns Array of OpenCode command templates
|
|
26
13
|
*/
|
|
27
14
|
export declare function getOpenCodeTemplates(): IntegrationTemplate[];
|
|
28
15
|
/**
|
|
29
16
|
* Get Gemini CLI command file templates
|
|
30
|
-
*
|
|
31
|
-
* Returns templates for:
|
|
32
|
-
* - are-generate.md: Full documentation generation command
|
|
33
|
-
* - are-update.md: Incremental documentation update command
|
|
34
|
-
* - are-discover.md: Discover files and create execution plan
|
|
35
|
-
* - are-clean.md: Delete generated documentation artifacts
|
|
36
|
-
*
|
|
37
|
-
* @returns Array of Gemini CLI command templates
|
|
38
17
|
*/
|
|
39
18
|
export declare function getGeminiTemplates(): IntegrationTemplate[];
|
|
40
19
|
/**
|
|
41
20
|
* Get session-end hook template for automatic documentation updates
|
|
42
|
-
*
|
|
43
|
-
* The hook:
|
|
44
|
-
* - Checks ARE_DISABLE_HOOK env var for temporary disable
|
|
45
|
-
* - Checks config file for permanent disable (hook_enabled: false)
|
|
46
|
-
* - Checks git status and exits silently if no changes
|
|
47
|
-
* - Spawns are update --quiet in background (detached, unref'd)
|
|
48
|
-
*
|
|
49
|
-
* Uses CommonJS (require) since hooks run via node directly.
|
|
50
|
-
*
|
|
51
|
-
* @returns JavaScript hook code as a string
|
|
52
21
|
*/
|
|
53
22
|
export declare function getHookTemplate(): string;
|
|
54
23
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/integration/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/integration/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA4WtD;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,mBAAmB,EAAE,CAE1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,mBAAmB,EAAE,CAE5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,mBAAmB,EAAE,CAE1D;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAyCxC"}
|
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Template generators for AI coding assistant integration files
|
|
3
3
|
*
|
|
4
|
-
* Generates command file templates for Claude Code, OpenCode, and session hooks.
|
|
4
|
+
* Generates command file templates for Claude Code, OpenCode, Gemini CLI, and session hooks.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @returns Array of Claude Code command templates
|
|
15
|
-
*/
|
|
16
|
-
export function getClaudeTemplates() {
|
|
17
|
-
return [
|
|
18
|
-
{
|
|
19
|
-
filename: 'generate.md',
|
|
20
|
-
path: '.claude/commands/are/generate.md',
|
|
21
|
-
content: `---
|
|
22
|
-
name: are:generate
|
|
23
|
-
description: Generate AI-friendly documentation for the entire codebase
|
|
24
|
-
argument-hint: "[--budget N] [--dry-run]"
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
Generate comprehensive documentation for this codebase using agents-reverse-engineer.
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Shared Command Content
|
|
8
|
+
// =============================================================================
|
|
9
|
+
const COMMANDS = {
|
|
10
|
+
generate: {
|
|
11
|
+
description: 'Generate AI-friendly documentation for the entire codebase',
|
|
12
|
+
argumentHint: '[--budget N] [--dry-run]',
|
|
13
|
+
content: `Generate comprehensive documentation for this codebase using agents-reverse-engineer.
|
|
28
14
|
|
|
29
15
|
<execution>
|
|
30
16
|
## Phase 0: Check for Existing Plan
|
|
@@ -35,7 +21,7 @@ First, check if a resumable plan exists:
|
|
|
35
21
|
cat .agents-reverse-engineer/GENERATION-PLAN.md 2>/dev/null | head -20
|
|
36
22
|
\`\`\`
|
|
37
23
|
|
|
38
|
-
**If NO plan exists**: Run \`/are:discover\` first to create the GENERATION-PLAN.md, then return here.
|
|
24
|
+
**If NO plan exists**: Run \`/are:discover --plan\` first to create the GENERATION-PLAN.md, then return here.
|
|
39
25
|
|
|
40
26
|
**If plan exists**: Continue to **Resume Execution** below.
|
|
41
27
|
|
|
@@ -117,19 +103,12 @@ After all tasks complete:
|
|
|
117
103
|
- Report number of files analyzed
|
|
118
104
|
- Report number of directories documented
|
|
119
105
|
- Mark plan as complete (change header to show ✓ COMPLETE)
|
|
120
|
-
</execution
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
content: `---
|
|
127
|
-
name: are:update
|
|
128
|
-
description: Incrementally update documentation for changed files
|
|
129
|
-
argument-hint: "[--uncommitted] [--dry-run] [--verbose]"
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
Update documentation for files that changed since last run.
|
|
106
|
+
</execution>`,
|
|
107
|
+
},
|
|
108
|
+
update: {
|
|
109
|
+
description: 'Incrementally update documentation for changed files',
|
|
110
|
+
argumentHint: '[--uncommitted] [--dry-run] [--verbose]',
|
|
111
|
+
content: `Update documentation for files that changed since last run.
|
|
133
112
|
|
|
134
113
|
<execution>
|
|
135
114
|
Run the agents-reverse-engineer update command:
|
|
@@ -144,18 +123,12 @@ After completion, summarize:
|
|
|
144
123
|
- Any orphaned docs cleaned up
|
|
145
124
|
|
|
146
125
|
Use \`--uncommitted\` to include staged but uncommitted changes.
|
|
147
|
-
</execution
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
content: `---
|
|
154
|
-
name: are:init
|
|
155
|
-
description: Initialize agents-reverse-engineer configuration
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
Initialize agents-reverse-engineer configuration in this project.
|
|
126
|
+
</execution>`,
|
|
127
|
+
},
|
|
128
|
+
init: {
|
|
129
|
+
description: 'Initialize agents-reverse-engineer configuration',
|
|
130
|
+
argumentHint: '',
|
|
131
|
+
content: `Initialize agents-reverse-engineer configuration in this project.
|
|
159
132
|
|
|
160
133
|
<execution>
|
|
161
134
|
Run the agents-reverse-engineer init command:
|
|
@@ -171,48 +144,34 @@ To install commands and hooks, use the interactive installer:
|
|
|
171
144
|
\`\`\`bash
|
|
172
145
|
npx agents-reverse-engineer install
|
|
173
146
|
\`\`\`
|
|
174
|
-
</execution
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
content: `---
|
|
181
|
-
name: are:discover
|
|
182
|
-
description: Discover files to analyze (use --plan to create GENERATION-PLAN.md)
|
|
183
|
-
argument-hint: "[path] [--plan] [--show-excluded]"
|
|
184
|
-
---
|
|
185
|
-
|
|
186
|
-
Discover files that will be analyzed for documentation.
|
|
147
|
+
</execution>`,
|
|
148
|
+
},
|
|
149
|
+
discover: {
|
|
150
|
+
description: 'Discover files in codebase',
|
|
151
|
+
argumentHint: '[path] [--plan] [--show-excluded] [--quiet]',
|
|
152
|
+
content: `List files that would be analyzed for documentation.
|
|
187
153
|
|
|
188
154
|
<execution>
|
|
189
|
-
Run
|
|
155
|
+
**CRITICAL**: Run this command EXACTLY as shown. Do NOT add any flags unless the user explicitly provided them in $ARGUMENTS.
|
|
190
156
|
|
|
191
157
|
\`\`\`bash
|
|
192
158
|
npx agents-reverse-engineer@latest discover $ARGUMENTS
|
|
193
159
|
\`\`\`
|
|
194
160
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
Options (only use if user requests):
|
|
198
|
-
- \`--plan\` - Generate GENERATION-PLAN.md file
|
|
199
|
-
- \`--show-excluded\` - Show excluded files with reasons
|
|
200
|
-
- \`--quiet\` - Only show the summary count
|
|
201
|
-
|
|
202
|
-
After completion, summarize what was done based on the flags actually used.
|
|
203
|
-
</execution>
|
|
204
|
-
`,
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
filename: 'clean.md',
|
|
208
|
-
path: '.claude/commands/are/clean.md',
|
|
209
|
-
content: `---
|
|
210
|
-
name: are:clean
|
|
211
|
-
description: Delete all generated documentation artifacts (.sum, AGENTS.md, plan)
|
|
212
|
-
argument-hint: "[--dry-run]"
|
|
213
|
-
---
|
|
161
|
+
If $ARGUMENTS is empty, run: \`npx agents-reverse-engineer@latest discover\` (with NO additional flags)
|
|
214
162
|
|
|
215
|
-
|
|
163
|
+
Available flags (ONLY use if user requested):
|
|
164
|
+
- \`--plan\` - Generate GENERATION-PLAN.md
|
|
165
|
+
- \`--show-excluded\` - Show excluded files
|
|
166
|
+
- \`--quiet\` - Summary only
|
|
167
|
+
|
|
168
|
+
After completion: Report number of files found.
|
|
169
|
+
</execution>`,
|
|
170
|
+
},
|
|
171
|
+
clean: {
|
|
172
|
+
description: 'Delete all generated documentation artifacts (.sum, AGENTS.md, plan)',
|
|
173
|
+
argumentHint: '[--dry-run]',
|
|
174
|
+
content: `Remove all documentation artifacts generated by agents-reverse-engineer.
|
|
216
175
|
|
|
217
176
|
<execution>
|
|
218
177
|
## What Gets Deleted
|
|
@@ -254,19 +213,14 @@ Report:
|
|
|
254
213
|
- Root documents deleted
|
|
255
214
|
- Plan file deleted
|
|
256
215
|
|
|
257
|
-
Suggest running \`/are:discover\` to start fresh.
|
|
258
|
-
</execution
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
name: are:help
|
|
266
|
-
description: Show available ARE commands and usage guide
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
Show help for agents-reverse-engineer commands.
|
|
216
|
+
Suggest running \`/are:discover --plan\` to start fresh.
|
|
217
|
+
</execution>`,
|
|
218
|
+
},
|
|
219
|
+
help: {
|
|
220
|
+
description: 'Show available ARE commands and usage guide',
|
|
221
|
+
argumentHint: '',
|
|
222
|
+
// Content uses COMMAND_PREFIX placeholder, replaced per platform
|
|
223
|
+
content: `Show help for agents-reverse-engineer commands.
|
|
270
224
|
|
|
271
225
|
<execution>
|
|
272
226
|
Display the following help information:
|
|
@@ -275,19 +229,19 @@ Display the following help information:
|
|
|
275
229
|
|
|
276
230
|
| Command | Description |
|
|
277
231
|
|---------|-------------|
|
|
278
|
-
|
|
|
279
|
-
|
|
|
280
|
-
|
|
|
281
|
-
|
|
|
282
|
-
|
|
|
283
|
-
|
|
|
232
|
+
| \`COMMAND_PREFIXhelp\` | Show this help message |
|
|
233
|
+
| \`COMMAND_PREFIXinit\` | Initialize configuration file |
|
|
234
|
+
| \`COMMAND_PREFIXdiscover\` | Discover files (use --plan for GENERATION-PLAN.md) |
|
|
235
|
+
| \`COMMAND_PREFIXgenerate\` | Generate documentation from the plan |
|
|
236
|
+
| \`COMMAND_PREFIXupdate\` | Update docs for changed files only |
|
|
237
|
+
| \`COMMAND_PREFIXclean\` | Remove all generated documentation |
|
|
284
238
|
|
|
285
239
|
## Typical Workflow
|
|
286
240
|
|
|
287
|
-
1.
|
|
288
|
-
2.
|
|
289
|
-
3.
|
|
290
|
-
4.
|
|
241
|
+
1. **\`COMMAND_PREFIXinit\`** — Create \`.agents-reverse-engineer/config.yaml\`
|
|
242
|
+
2. **\`COMMAND_PREFIXdiscover --plan\`** — Scan codebase, create \`GENERATION-PLAN.md\`
|
|
243
|
+
3. **\`COMMAND_PREFIXgenerate\`** — Execute plan, generate \`.sum\` and \`AGENTS.md\` files
|
|
244
|
+
4. **\`COMMAND_PREFIXupdate\`** — After code changes, update only what changed
|
|
291
245
|
|
|
292
246
|
## Generated Files
|
|
293
247
|
|
|
@@ -301,287 +255,85 @@ Display the following help information:
|
|
|
301
255
|
|
|
302
256
|
- Docs: https://github.com/GeoloeG-IsT/agents-reverse-engineer
|
|
303
257
|
- Update: \`npx agents-reverse-engineer@latest\`
|
|
304
|
-
</execution
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
258
|
+
</execution>`,
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
const PLATFORM_CONFIGS = {
|
|
262
|
+
claude: {
|
|
263
|
+
commandPrefix: '/are:',
|
|
264
|
+
pathPrefix: '.claude/commands/are/',
|
|
265
|
+
filenameSeparator: '.',
|
|
266
|
+
usesName: true,
|
|
267
|
+
},
|
|
268
|
+
opencode: {
|
|
269
|
+
commandPrefix: '/are-',
|
|
270
|
+
pathPrefix: '.opencode/commands/',
|
|
271
|
+
filenameSeparator: '-',
|
|
272
|
+
extraFrontmatter: 'agent: build',
|
|
273
|
+
usesName: false,
|
|
274
|
+
},
|
|
275
|
+
gemini: {
|
|
276
|
+
commandPrefix: '/are-',
|
|
277
|
+
pathPrefix: '.gemini/commands/',
|
|
278
|
+
filenameSeparator: '-',
|
|
279
|
+
usesName: false,
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
function buildFrontmatter(platform, commandName, description, argumentHint) {
|
|
283
|
+
const config = PLATFORM_CONFIGS[platform];
|
|
284
|
+
const lines = ['---'];
|
|
285
|
+
if (config.usesName) {
|
|
286
|
+
lines.push(`name: are:${commandName}`);
|
|
287
|
+
}
|
|
288
|
+
lines.push(`description: ${description}`);
|
|
289
|
+
if (argumentHint) {
|
|
290
|
+
lines.push(`argument-hint: "${argumentHint}"`);
|
|
291
|
+
}
|
|
292
|
+
if (config.extraFrontmatter) {
|
|
293
|
+
lines.push(config.extraFrontmatter);
|
|
294
|
+
}
|
|
295
|
+
lines.push('---');
|
|
296
|
+
return lines.join('\n');
|
|
297
|
+
}
|
|
298
|
+
function buildTemplate(platform, commandName, command) {
|
|
299
|
+
const config = PLATFORM_CONFIGS[platform];
|
|
300
|
+
const filename = platform === 'claude' ? `${commandName}.md` : `are-${commandName}.md`;
|
|
301
|
+
const path = `${config.pathPrefix}${filename}`;
|
|
302
|
+
const frontmatter = buildFrontmatter(platform, commandName, command.description, command.argumentHint || undefined);
|
|
303
|
+
// Replace command prefix placeholder in help content
|
|
304
|
+
const content = command.content.replace(/COMMAND_PREFIX/g, config.commandPrefix);
|
|
305
|
+
return {
|
|
306
|
+
filename,
|
|
307
|
+
path,
|
|
308
|
+
content: `${frontmatter}\n\n${content}\n`,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function getTemplatesForPlatform(platform) {
|
|
312
|
+
return Object.entries(COMMANDS).map(([name, command]) => buildTemplate(platform, name, command));
|
|
313
|
+
}
|
|
314
|
+
// =============================================================================
|
|
315
|
+
// Public API
|
|
316
|
+
// =============================================================================
|
|
317
|
+
/**
|
|
318
|
+
* Get Claude Code command file templates
|
|
319
|
+
*/
|
|
320
|
+
export function getClaudeTemplates() {
|
|
321
|
+
return getTemplatesForPlatform('claude');
|
|
308
322
|
}
|
|
309
323
|
/**
|
|
310
324
|
* Get OpenCode command file templates
|
|
311
|
-
*
|
|
312
|
-
* Returns templates for:
|
|
313
|
-
* - are-generate.md: Full documentation generation command
|
|
314
|
-
* - are-update.md: Incremental documentation update command
|
|
315
|
-
*
|
|
316
|
-
* @returns Array of OpenCode command templates
|
|
317
325
|
*/
|
|
318
326
|
export function getOpenCodeTemplates() {
|
|
319
|
-
return
|
|
320
|
-
{
|
|
321
|
-
filename: 'are-generate.md',
|
|
322
|
-
path: '.opencode/commands/are-generate.md',
|
|
323
|
-
content: `---
|
|
324
|
-
description: Generate AI-friendly documentation for the entire codebase
|
|
325
|
-
agent: build
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
Generate comprehensive documentation for this codebase using agents-reverse-engineer.
|
|
329
|
-
|
|
330
|
-
Run: \`npx agents-reverse-engineer@latest generate $ARGUMENTS\`
|
|
331
|
-
|
|
332
|
-
Arguments supported:
|
|
333
|
-
- \`--budget N\` - Override token budget
|
|
334
|
-
- \`--dry-run\` - Show plan without writing files
|
|
335
|
-
- \`--verbose\` - Show detailed output
|
|
336
|
-
`,
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
filename: 'are-update.md',
|
|
340
|
-
path: '.opencode/commands/are-update.md',
|
|
341
|
-
content: `---
|
|
342
|
-
description: Incrementally update documentation for changed files
|
|
343
|
-
agent: build
|
|
344
|
-
---
|
|
345
|
-
|
|
346
|
-
Update documentation for files that changed since last run.
|
|
347
|
-
|
|
348
|
-
Run: \`npx agents-reverse-engineer@latest update $ARGUMENTS\`
|
|
349
|
-
|
|
350
|
-
Arguments supported:
|
|
351
|
-
- \`--uncommitted\` - Include staged but uncommitted changes
|
|
352
|
-
- \`--dry-run\` - Show plan without writing files
|
|
353
|
-
- \`--verbose\` - Show detailed output
|
|
354
|
-
`,
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
filename: 'are-discover.md',
|
|
358
|
-
path: '.opencode/commands/are-discover.md',
|
|
359
|
-
content: `---
|
|
360
|
-
description: Discover files to analyze (use --plan to create GENERATION-PLAN.md)
|
|
361
|
-
agent: build
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
Discover files that will be analyzed for documentation.
|
|
365
|
-
|
|
366
|
-
Run: \`npx agents-reverse-engineer@latest discover $ARGUMENTS\`
|
|
367
|
-
|
|
368
|
-
**IMPORTANT**: Pass $ARGUMENTS exactly as provided. Do NOT add flags the user did not request.
|
|
369
|
-
|
|
370
|
-
Options (only use if user requests):
|
|
371
|
-
- \`--plan\` - Generate GENERATION-PLAN.md file
|
|
372
|
-
- \`--show-excluded\` - Show excluded files with reasons
|
|
373
|
-
- \`--quiet\` - Only show the summary count
|
|
374
|
-
`,
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
filename: 'are-clean.md',
|
|
378
|
-
path: '.opencode/commands/are-clean.md',
|
|
379
|
-
content: `---
|
|
380
|
-
description: Delete all generated documentation artifacts (.sum, AGENTS.md, plan)
|
|
381
|
-
agent: build
|
|
382
|
-
---
|
|
383
|
-
|
|
384
|
-
Remove all documentation artifacts generated by agents-reverse-engineer.
|
|
385
|
-
|
|
386
|
-
Run: \`npx agents-reverse-engineer@latest clean $ARGUMENTS\`
|
|
387
|
-
|
|
388
|
-
Arguments supported:
|
|
389
|
-
- \`--dry-run\` - Preview what would be deleted without deleting
|
|
390
|
-
`,
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
filename: 'are-init.md',
|
|
394
|
-
path: '.opencode/commands/are-init.md',
|
|
395
|
-
content: `---
|
|
396
|
-
description: Initialize agents-reverse-engineer configuration
|
|
397
|
-
agent: build
|
|
398
|
-
---
|
|
399
|
-
|
|
400
|
-
Initialize agents-reverse-engineer configuration in this project.
|
|
401
|
-
|
|
402
|
-
Run: \`npx agents-reverse-engineer@latest init\`
|
|
403
|
-
|
|
404
|
-
This creates \`.agents-reverse-engineer.yaml\` configuration file.
|
|
405
|
-
|
|
406
|
-
To install commands and hooks, use the interactive installer:
|
|
407
|
-
\`npx agents-reverse-engineer install\`
|
|
408
|
-
`,
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
filename: 'are-help.md',
|
|
412
|
-
path: '.opencode/commands/are-help.md',
|
|
413
|
-
content: `---
|
|
414
|
-
description: Show available ARE commands and usage guide
|
|
415
|
-
agent: build
|
|
416
|
-
---
|
|
417
|
-
|
|
418
|
-
## agents-reverse-engineer (ARE) Commands
|
|
419
|
-
|
|
420
|
-
| Command | Description |
|
|
421
|
-
|---------|-------------|
|
|
422
|
-
| \`/are-help\` | Show this help message |
|
|
423
|
-
| \`/are-init\` | Initialize configuration file |
|
|
424
|
-
| \`/are-discover\` | Discover files and create GENERATION-PLAN.md |
|
|
425
|
-
| \`/are-generate\` | Generate documentation from the plan |
|
|
426
|
-
| \`/are-update\` | Update docs for changed files only |
|
|
427
|
-
| \`/are-clean\` | Remove all generated documentation |
|
|
428
|
-
|
|
429
|
-
## Typical Workflow
|
|
430
|
-
|
|
431
|
-
1. **\`/are-init\`** — Create \`.agents-reverse-engineer/config.yaml\`
|
|
432
|
-
2. **\`/are-discover\`** — Scan codebase, create \`GENERATION-PLAN.md\`
|
|
433
|
-
3. **\`/are-generate\`** — Execute plan, generate \`.sum\` and \`AGENTS.md\` files
|
|
434
|
-
4. **\`/are-update\`** — After code changes, update only what changed
|
|
435
|
-
|
|
436
|
-
## More Info
|
|
437
|
-
|
|
438
|
-
Docs: https://github.com/GeoloeG-IsT/agents-reverse-engineer
|
|
439
|
-
`,
|
|
440
|
-
},
|
|
441
|
-
];
|
|
327
|
+
return getTemplatesForPlatform('opencode');
|
|
442
328
|
}
|
|
443
329
|
/**
|
|
444
330
|
* Get Gemini CLI command file templates
|
|
445
|
-
*
|
|
446
|
-
* Returns templates for:
|
|
447
|
-
* - are-generate.md: Full documentation generation command
|
|
448
|
-
* - are-update.md: Incremental documentation update command
|
|
449
|
-
* - are-discover.md: Discover files and create execution plan
|
|
450
|
-
* - are-clean.md: Delete generated documentation artifacts
|
|
451
|
-
*
|
|
452
|
-
* @returns Array of Gemini CLI command templates
|
|
453
331
|
*/
|
|
454
332
|
export function getGeminiTemplates() {
|
|
455
|
-
return
|
|
456
|
-
{
|
|
457
|
-
filename: 'are-generate.md',
|
|
458
|
-
path: '.gemini/commands/are-generate.md',
|
|
459
|
-
content: `---
|
|
460
|
-
description: Generate AI-friendly documentation for the entire codebase
|
|
461
|
-
---
|
|
462
|
-
|
|
463
|
-
Generate comprehensive documentation for this codebase using agents-reverse-engineer.
|
|
464
|
-
|
|
465
|
-
Run: \`npx agents-reverse-engineer@latest generate $ARGUMENTS\`
|
|
466
|
-
|
|
467
|
-
Arguments supported:
|
|
468
|
-
- \`--budget N\` - Override token budget
|
|
469
|
-
- \`--dry-run\` - Show plan without writing files
|
|
470
|
-
- \`--verbose\` - Show detailed output
|
|
471
|
-
`,
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
filename: 'are-update.md',
|
|
475
|
-
path: '.gemini/commands/are-update.md',
|
|
476
|
-
content: `---
|
|
477
|
-
description: Incrementally update documentation for changed files
|
|
478
|
-
---
|
|
479
|
-
|
|
480
|
-
Update documentation for files that changed since last run.
|
|
481
|
-
|
|
482
|
-
Run: \`npx agents-reverse-engineer@latest update $ARGUMENTS\`
|
|
483
|
-
|
|
484
|
-
Arguments supported:
|
|
485
|
-
- \`--uncommitted\` - Include staged but uncommitted changes
|
|
486
|
-
- \`--dry-run\` - Show plan without writing files
|
|
487
|
-
- \`--verbose\` - Show detailed output
|
|
488
|
-
`,
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
filename: 'are-discover.md',
|
|
492
|
-
path: '.gemini/commands/are-discover.md',
|
|
493
|
-
content: `---
|
|
494
|
-
description: Discover files to analyze (use --plan to create GENERATION-PLAN.md)
|
|
495
|
-
---
|
|
496
|
-
|
|
497
|
-
Discover files that will be analyzed for documentation.
|
|
498
|
-
|
|
499
|
-
Run: \`npx agents-reverse-engineer@latest discover $ARGUMENTS\`
|
|
500
|
-
|
|
501
|
-
**IMPORTANT**: Pass $ARGUMENTS exactly as provided. Do NOT add flags the user did not request.
|
|
502
|
-
|
|
503
|
-
Options (only use if user requests):
|
|
504
|
-
- \`--plan\` - Generate GENERATION-PLAN.md file
|
|
505
|
-
- \`--show-excluded\` - Show excluded files with reasons
|
|
506
|
-
- \`--quiet\` - Only show the summary count
|
|
507
|
-
`,
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
filename: 'are-clean.md',
|
|
511
|
-
path: '.gemini/commands/are-clean.md',
|
|
512
|
-
content: `---
|
|
513
|
-
description: Delete all generated documentation artifacts (.sum, AGENTS.md, plan)
|
|
514
|
-
---
|
|
515
|
-
|
|
516
|
-
Remove all documentation artifacts generated by agents-reverse-engineer.
|
|
517
|
-
|
|
518
|
-
Run: \`npx agents-reverse-engineer@latest clean $ARGUMENTS\`
|
|
519
|
-
|
|
520
|
-
Arguments supported:
|
|
521
|
-
- \`--dry-run\` - Preview what would be deleted without deleting
|
|
522
|
-
`,
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
filename: 'are-init.md',
|
|
526
|
-
path: '.gemini/commands/are-init.md',
|
|
527
|
-
content: `---
|
|
528
|
-
description: Initialize agents-reverse-engineer configuration
|
|
529
|
-
---
|
|
530
|
-
|
|
531
|
-
Initialize agents-reverse-engineer configuration in this project.
|
|
532
|
-
|
|
533
|
-
Run: \`npx agents-reverse-engineer@latest init\`
|
|
534
|
-
|
|
535
|
-
This creates \`.agents-reverse-engineer.yaml\` configuration file.
|
|
536
|
-
|
|
537
|
-
To install commands and hooks, use the interactive installer:
|
|
538
|
-
\`npx agents-reverse-engineer install\`
|
|
539
|
-
`,
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
filename: 'are-help.md',
|
|
543
|
-
path: '.gemini/commands/are-help.md',
|
|
544
|
-
content: `---
|
|
545
|
-
description: Show available ARE commands and usage guide
|
|
546
|
-
---
|
|
547
|
-
|
|
548
|
-
## agents-reverse-engineer (ARE) Commands
|
|
549
|
-
|
|
550
|
-
| Command | Description |
|
|
551
|
-
|---------|-------------|
|
|
552
|
-
| \`/are-help\` | Show this help message |
|
|
553
|
-
| \`/are-init\` | Initialize configuration file |
|
|
554
|
-
| \`/are-discover\` | Discover files and create GENERATION-PLAN.md |
|
|
555
|
-
| \`/are-generate\` | Generate documentation from the plan |
|
|
556
|
-
| \`/are-update\` | Update docs for changed files only |
|
|
557
|
-
| \`/are-clean\` | Remove all generated documentation |
|
|
558
|
-
|
|
559
|
-
## Typical Workflow
|
|
560
|
-
|
|
561
|
-
1. **\`/are-init\`** — Create \`.agents-reverse-engineer/config.yaml\`
|
|
562
|
-
2. **\`/are-discover\`** — Scan codebase, create \`GENERATION-PLAN.md\`
|
|
563
|
-
3. **\`/are-generate\`** — Execute plan, generate \`.sum\` and \`AGENTS.md\` files
|
|
564
|
-
4. **\`/are-update\`** — After code changes, update only what changed
|
|
565
|
-
|
|
566
|
-
## More Info
|
|
567
|
-
|
|
568
|
-
Docs: https://github.com/GeoloeG-IsT/agents-reverse-engineer
|
|
569
|
-
`,
|
|
570
|
-
},
|
|
571
|
-
];
|
|
333
|
+
return getTemplatesForPlatform('gemini');
|
|
572
334
|
}
|
|
573
335
|
/**
|
|
574
336
|
* Get session-end hook template for automatic documentation updates
|
|
575
|
-
*
|
|
576
|
-
* The hook:
|
|
577
|
-
* - Checks ARE_DISABLE_HOOK env var for temporary disable
|
|
578
|
-
* - Checks config file for permanent disable (hook_enabled: false)
|
|
579
|
-
* - Checks git status and exits silently if no changes
|
|
580
|
-
* - Spawns are update --quiet in background (detached, unref'd)
|
|
581
|
-
*
|
|
582
|
-
* Uses CommonJS (require) since hooks run via node directly.
|
|
583
|
-
*
|
|
584
|
-
* @returns JavaScript hook code as a string
|
|
585
337
|
*/
|
|
586
338
|
export function getHookTemplate() {
|
|
587
339
|
return `#!/usr/bin/env node
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/integration/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/integration/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,gFAAgF;AAChF,yBAAyB;AACzB,gFAAgF;AAEhF,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE;QACR,WAAW,EAAE,4DAA4D;QACzE,YAAY,EAAE,0BAA0B;QACxC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA6FA;KACV;IAED,MAAM,EAAE;QACN,WAAW,EAAE,sDAAsD;QACnE,YAAY,EAAE,yCAAyC;QACvD,OAAO,EAAE;;;;;;;;;;;;;;;aAeA;KACV;IAED,IAAI,EAAE;QACJ,WAAW,EAAE,kDAAkD;QAC/D,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE;;;;;;;;;;;;;;;;aAgBA;KACV;IAED,QAAQ,EAAE;QACR,WAAW,EAAE,4BAA4B;QACzC,YAAY,EAAE,6CAA6C;QAC3D,OAAO,EAAE;;;;;;;;;;;;;;;;;aAiBA;KACV;IAED,KAAK,EAAE;QACL,WAAW,EAAE,sEAAsE;QACnF,YAAY,EAAE,aAAa;QAC3B,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA2CA;KACV;IAED,IAAI,EAAE;QACJ,WAAW,EAAE,6CAA6C;QAC1D,YAAY,EAAE,EAAE;QAChB,iEAAiE;QACjE,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAmCA;KACV;CACO,CAAC;AAgBX,MAAM,gBAAgB,GAAqC;IACzD,MAAM,EAAE;QACN,aAAa,EAAE,OAAO;QACtB,UAAU,EAAE,uBAAuB;QACnC,iBAAiB,EAA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