claude-code-workflow 6.3.10 → 6.3.12
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/CLAUDE.md +33 -33
- package/.claude/agents/issue-plan-agent.md +18 -5
- package/.claude/agents/issue-queue-agent.md +12 -5
- package/.claude/commands/issue/discover.md +427 -0
- package/.claude/commands/issue/new.md +13 -1
- package/.claude/commands/issue/plan.md +48 -32
- package/.claude/commands/issue/queue.md +99 -7
- package/.claude/skills/software-manual/SKILL.md +184 -0
- package/.claude/skills/software-manual/phases/01-requirements-discovery.md +162 -0
- package/.claude/skills/software-manual/phases/02-project-exploration.md +101 -0
- package/.claude/skills/software-manual/phases/02.5-api-extraction.md +161 -0
- package/.claude/skills/software-manual/phases/03-parallel-analysis.md +183 -0
- package/.claude/skills/software-manual/phases/03.5-consolidation.md +82 -0
- package/.claude/skills/software-manual/phases/04-screenshot-capture.md +89 -0
- package/.claude/skills/software-manual/phases/05-html-assembly.md +132 -0
- package/.claude/skills/software-manual/phases/06-iterative-refinement.md +259 -0
- package/.claude/skills/software-manual/scripts/api-extractor.md +245 -0
- package/.claude/skills/software-manual/scripts/assemble_docsify.py +584 -0
- package/.claude/skills/software-manual/scripts/bundle-libraries.md +85 -0
- package/.claude/skills/software-manual/scripts/extract_apis.py +270 -0
- package/.claude/skills/software-manual/scripts/screenshot-helper.md +447 -0
- package/.claude/skills/software-manual/scripts/swagger-runner.md +419 -0
- package/.claude/skills/software-manual/scripts/typedoc-runner.md +357 -0
- package/.claude/skills/software-manual/specs/html-template.md +325 -0
- package/.claude/skills/software-manual/specs/quality-standards.md +253 -0
- package/.claude/skills/software-manual/specs/writing-style.md +298 -0
- package/.claude/skills/software-manual/templates/css/docsify-base.css +984 -0
- package/.claude/skills/software-manual/templates/css/wiki-base.css +788 -0
- package/.claude/skills/software-manual/templates/css/wiki-dark.css +278 -0
- package/.claude/skills/software-manual/templates/docsify-shell.html +466 -0
- package/.claude/skills/software-manual/templates/tiddlywiki-shell.html +327 -0
- package/.claude/workflows/cli-templates/schemas/discovery-finding-schema.json +219 -0
- package/.claude/workflows/cli-templates/schemas/discovery-state-schema.json +125 -0
- package/.claude/workflows/cli-templates/schemas/issues-jsonl-schema.json +168 -74
- package/.codex/prompts/issue-execute.md +174 -84
- package/.codex/prompts/issue-plan.md +106 -0
- package/.codex/prompts/issue-queue.md +225 -0
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +1 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +97 -9
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
- package/ccw/dist/core/dashboard-generator.js +4 -1
- package/ccw/dist/core/dashboard-generator.js.map +1 -1
- package/ccw/dist/core/data-aggregator.d.ts +32 -0
- package/ccw/dist/core/data-aggregator.d.ts.map +1 -1
- package/ccw/dist/core/data-aggregator.js +55 -11
- package/ccw/dist/core/data-aggregator.js.map +1 -1
- package/ccw/dist/core/routes/discovery-routes.d.ts +37 -0
- package/ccw/dist/core/routes/discovery-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/discovery-routes.js +514 -0
- package/ccw/dist/core/routes/discovery-routes.js.map +1 -0
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +9 -1
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/tools/codex-lens.d.ts +12 -1
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens.js +56 -7
- package/ccw/dist/tools/codex-lens.js.map +1 -1
- package/ccw/src/cli.ts +1 -0
- package/ccw/src/commands/issue.ts +108 -10
- package/ccw/src/core/dashboard-generator.ts +4 -1
- package/ccw/src/core/data-aggregator.ts +94 -11
- package/ccw/src/core/routes/discovery-routes.ts +607 -0
- package/ccw/src/core/server.ts +9 -1
- package/ccw/src/templates/dashboard-css/33-cli-stream-viewer.css +580 -467
- package/ccw/src/templates/dashboard-css/34-discovery.css +783 -0
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +532 -461
- package/ccw/src/templates/dashboard-js/components/navigation.js +8 -0
- package/ccw/src/templates/dashboard-js/components/notifications.js +774 -774
- package/ccw/src/templates/dashboard-js/i18n.js +144 -0
- package/ccw/src/templates/dashboard-js/views/codexlens-manager.js +13 -3
- package/ccw/src/templates/dashboard-js/views/issue-discovery.js +730 -0
- package/ccw/src/templates/dashboard-js/views/project-overview.js +153 -0
- package/ccw/src/templates/dashboard.html +15 -0
- package/ccw/src/tools/claude-cli-tools.ts +388 -388
- package/ccw/src/tools/codex-lens.ts +75 -9
- package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/config.py +19 -3
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/ranking.py +15 -4
- package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/vector_store.py +57 -47
- package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/registry.py +114 -101
- package/package.json +2 -2
|
@@ -172,19 +172,17 @@ TodoWrite({
|
|
|
172
172
|
});
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
### Phase 2: Unified Explore + Plan (issue-plan-agent)
|
|
175
|
+
### Phase 2: Unified Explore + Plan (issue-plan-agent) - PARALLEL
|
|
176
176
|
|
|
177
177
|
```javascript
|
|
178
178
|
Bash(`mkdir -p .workflow/issues/solutions`);
|
|
179
179
|
const pendingSelections = []; // Collect multi-solution issues for user selection
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
// Build issue list with metadata for agent context
|
|
181
|
+
// Build prompts for all batches
|
|
182
|
+
const agentTasks = batches.map((batch, batchIndex) => {
|
|
185
183
|
const issueList = batch.map(i => `- ${i.id}: ${i.title}${i.tags.length ? ` [${i.tags.join(', ')}]` : ''}`).join('\n');
|
|
184
|
+
const batchIds = batch.map(i => i.id);
|
|
186
185
|
|
|
187
|
-
// Build minimal prompt - agent handles exploration, planning, and binding
|
|
188
186
|
const issuePrompt = `
|
|
189
187
|
## Plan Issues
|
|
190
188
|
|
|
@@ -202,8 +200,9 @@ ${issueList}
|
|
|
202
200
|
### Steps
|
|
203
201
|
1. Fetch: \`ccw issue status <id> --json\`
|
|
204
202
|
2. Load project context (project-tech.json + project-guidelines.json)
|
|
205
|
-
3.
|
|
206
|
-
4.
|
|
203
|
+
3. **If source=discovery**: Use discovery_context (file, line, snippet, suggested_fix) as planning hints
|
|
204
|
+
4. Explore (ACE) → Plan solution (respecting guidelines)
|
|
205
|
+
5. Register & bind: \`ccw issue bind <id> --solution <file>\`
|
|
207
206
|
|
|
208
207
|
### Generate Files
|
|
209
208
|
\`.workflow/issues/solutions/{issue-id}.jsonl\` - Solution with tasks (schema: cat .claude/workflows/cli-templates/schemas/solution-schema.json)
|
|
@@ -222,40 +221,57 @@ ${issueList}
|
|
|
222
221
|
\`\`\`
|
|
223
222
|
`;
|
|
224
223
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
//
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
224
|
+
return { batchIndex, batchIds, issuePrompt, batch };
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// Launch agents in parallel (max 10 concurrent)
|
|
228
|
+
const MAX_PARALLEL = 10;
|
|
229
|
+
for (let i = 0; i < agentTasks.length; i += MAX_PARALLEL) {
|
|
230
|
+
const chunk = agentTasks.slice(i, i + MAX_PARALLEL);
|
|
231
|
+
const taskIds = [];
|
|
232
|
+
|
|
233
|
+
// Launch chunk in parallel
|
|
234
|
+
for (const { batchIndex, batchIds, issuePrompt, batch } of chunk) {
|
|
235
|
+
updateTodo(`Plan batch ${batchIndex + 1}`, 'in_progress');
|
|
236
|
+
const taskId = Task(
|
|
237
|
+
subagent_type="issue-plan-agent",
|
|
238
|
+
run_in_background=true,
|
|
239
|
+
description=`Explore & plan ${batch.length} issues: ${batchIds.join(', ')}`,
|
|
240
|
+
prompt=issuePrompt
|
|
241
|
+
);
|
|
242
|
+
taskIds.push({ taskId, batchIndex });
|
|
240
243
|
}
|
|
241
244
|
|
|
242
|
-
|
|
243
|
-
pendingSelections.push(...(summary.pending_selection || []));
|
|
245
|
+
console.log(`Launched ${taskIds.length} agents (batch ${i/MAX_PARALLEL + 1}/${Math.ceil(agentTasks.length/MAX_PARALLEL)})...`);
|
|
244
246
|
|
|
245
|
-
//
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
// Collect results from this chunk
|
|
248
|
+
for (const { taskId, batchIndex } of taskIds) {
|
|
249
|
+
const result = TaskOutput(task_id=taskId, block=true);
|
|
250
|
+
const summary = JSON.parse(result);
|
|
249
251
|
|
|
250
|
-
|
|
252
|
+
for (const item of summary.bound || []) {
|
|
253
|
+
console.log(`✓ ${item.issue_id}: ${item.solution_id} (${item.task_count} tasks)`);
|
|
254
|
+
}
|
|
255
|
+
// Collect and notify pending selections
|
|
256
|
+
for (const pending of summary.pending_selection || []) {
|
|
257
|
+
console.log(`⏳ ${pending.issue_id}: ${pending.solutions.length} solutions → awaiting selection`);
|
|
258
|
+
pendingSelections.push(pending);
|
|
259
|
+
}
|
|
260
|
+
if (summary.conflicts?.length > 0) {
|
|
261
|
+
console.log(`⚠ Conflicts: ${summary.conflicts.map(c => c.file).join(', ')}`);
|
|
262
|
+
}
|
|
263
|
+
updateTodo(`Plan batch ${batchIndex + 1}`, 'completed');
|
|
264
|
+
}
|
|
251
265
|
}
|
|
252
266
|
```
|
|
253
267
|
|
|
254
|
-
### Phase 3: Multi-Solution Selection
|
|
268
|
+
### Phase 3: Multi-Solution Selection (MANDATORY when pendingSelections > 0)
|
|
255
269
|
|
|
256
270
|
```javascript
|
|
257
|
-
//
|
|
271
|
+
// MUST trigger user selection when multiple solutions exist
|
|
258
272
|
if (pendingSelections.length > 0) {
|
|
273
|
+
console.log(`\n## User Selection Required: ${pendingSelections.length} issue(s) have multiple solutions\n`);
|
|
274
|
+
|
|
259
275
|
const answer = AskUserQuestion({
|
|
260
276
|
questions: pendingSelections.map(({ issue_id, solutions }) => ({
|
|
261
277
|
question: `Select solution for ${issue_id}:`,
|
|
@@ -199,6 +199,8 @@ Phase 5: Queue Output
|
|
|
199
199
|
|
|
200
200
|
### Phase 1: Solution Loading
|
|
201
201
|
|
|
202
|
+
**NOTE**: Execute code directly. DO NOT pre-read solution files - Bash cat handles all reading.
|
|
203
|
+
|
|
202
204
|
```javascript
|
|
203
205
|
// Load issues.jsonl
|
|
204
206
|
const issuesPath = '.workflow/issues/issues.jsonl';
|
|
@@ -258,10 +260,15 @@ console.log(`Loaded ${allSolutions.length} solutions from ${plannedIssues.length
|
|
|
258
260
|
### Phase 2-4: Agent-Driven Queue Formation
|
|
259
261
|
|
|
260
262
|
```javascript
|
|
263
|
+
// Generate queue-id ONCE here, pass to agent
|
|
264
|
+
const now = new Date();
|
|
265
|
+
const queueId = `QUE-${now.toISOString().replace(/[-:T]/g, '').slice(0, 14)}`;
|
|
266
|
+
|
|
261
267
|
// Build minimal prompt - agent orders SOLUTIONS, not tasks
|
|
262
268
|
const agentPrompt = `
|
|
263
269
|
## Order Solutions
|
|
264
270
|
|
|
271
|
+
**Queue ID**: ${queueId}
|
|
265
272
|
**Solutions**: ${allSolutions.length} from ${plannedIssues.length} issues
|
|
266
273
|
**Project Root**: ${process.cwd()}
|
|
267
274
|
|
|
@@ -291,11 +298,13 @@ ${JSON.stringify(allSolutions, null, 2)}
|
|
|
291
298
|
3. More tasks = higher priority (larger impact)
|
|
292
299
|
- **Parallel Safety**: Solutions in same parallel group must have NO file overlaps
|
|
293
300
|
- **Queue Item ID Format**: \`S-N\` (S-1, S-2, S-3, ...)
|
|
294
|
-
- **Queue ID
|
|
301
|
+
- **Queue ID**: Use the provided Queue ID (passed above), do NOT generate new one
|
|
302
|
+
|
|
303
|
+
### Generate Files (STRICT - only these 2)
|
|
304
|
+
1. \`.workflow/issues/queues/{Queue ID}.json\` - Use Queue ID from above
|
|
305
|
+
2. \`.workflow/issues/queues/index.json\` - Update existing index
|
|
295
306
|
|
|
296
|
-
|
|
297
|
-
1. \`.workflow/issues/queues/\${queueId}.json\` - Full queue with solutions array
|
|
298
|
-
2. \`.workflow/issues/queues/index.json\` - Update with new entry
|
|
307
|
+
Write ONLY these 2 files, using the provided Queue ID.
|
|
299
308
|
|
|
300
309
|
### Return Summary
|
|
301
310
|
\`\`\`json
|
|
@@ -320,10 +329,83 @@ const result = Task(
|
|
|
320
329
|
const summary = JSON.parse(result);
|
|
321
330
|
```
|
|
322
331
|
|
|
323
|
-
### Phase 5:
|
|
332
|
+
### Phase 5: Validation & Status Update
|
|
324
333
|
|
|
325
334
|
```javascript
|
|
326
|
-
//
|
|
335
|
+
// ============ VALIDATION: Prevent "next returns empty" issues ============
|
|
336
|
+
|
|
337
|
+
const queuesDir = '.workflow/issues/queues';
|
|
338
|
+
const indexPath = `${queuesDir}/index.json`;
|
|
339
|
+
const queuePath = `${queuesDir}/${queueId}.json`;
|
|
340
|
+
|
|
341
|
+
// 1. Validate index.json has active_queue_id
|
|
342
|
+
const indexContent = Bash(`cat "${indexPath}" 2>/dev/null || echo '{}'`);
|
|
343
|
+
const index = JSON.parse(indexContent);
|
|
344
|
+
|
|
345
|
+
if (index.active_queue_id !== queueId) {
|
|
346
|
+
console.log(`⚠ Fixing: index.json active_queue_id not set to ${queueId}`);
|
|
347
|
+
index.active_queue_id = queueId;
|
|
348
|
+
// Ensure queue entry exists in index
|
|
349
|
+
if (!index.queues) index.queues = [];
|
|
350
|
+
const existing = index.queues.find(q => q.id === queueId);
|
|
351
|
+
if (!existing) {
|
|
352
|
+
index.queues.unshift({
|
|
353
|
+
id: queueId,
|
|
354
|
+
status: 'active',
|
|
355
|
+
issue_ids: summary.issues_queued,
|
|
356
|
+
total_solutions: summary.total_solutions,
|
|
357
|
+
completed_solutions: 0,
|
|
358
|
+
created_at: new Date().toISOString()
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
Bash(`echo '${JSON.stringify(index, null, 2)}' > "${indexPath}"`);
|
|
362
|
+
console.log(`✓ Fixed: index.json updated with active_queue_id: ${queueId}`);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// 2. Validate queue file exists and has correct structure
|
|
366
|
+
const queueContent = Bash(`cat "${queuePath}" 2>/dev/null || echo '{}'`);
|
|
367
|
+
const queue = JSON.parse(queueContent);
|
|
368
|
+
|
|
369
|
+
if (!queue.solutions || queue.solutions.length === 0) {
|
|
370
|
+
console.error(`✗ ERROR: Queue file ${queuePath} has no solutions array`);
|
|
371
|
+
console.error(' Agent did not generate queue correctly. Aborting.');
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// 3. Validate all solutions have status: "pending" (not "queued" or other)
|
|
376
|
+
let statusFixed = 0;
|
|
377
|
+
for (const sol of queue.solutions) {
|
|
378
|
+
if (sol.status !== 'pending' && sol.status !== 'executing' && sol.status !== 'completed') {
|
|
379
|
+
console.log(`⚠ Fixing: ${sol.item_id} status "${sol.status}" → "pending"`);
|
|
380
|
+
sol.status = 'pending';
|
|
381
|
+
statusFixed++;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// 4. Validate at least one item has no dependencies (DAG entry point)
|
|
386
|
+
const entryPoints = queue.solutions.filter(s =>
|
|
387
|
+
s.status === 'pending' && (!s.depends_on || s.depends_on.length === 0)
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
if (entryPoints.length === 0) {
|
|
391
|
+
console.error(`✗ ERROR: No entry points found (all items have dependencies)`);
|
|
392
|
+
console.error(' This will cause "ccw issue next" to return empty.');
|
|
393
|
+
console.error(' Check depends_on fields for circular dependencies.');
|
|
394
|
+
// Try to fix by clearing first item's dependencies
|
|
395
|
+
if (queue.solutions.length > 0) {
|
|
396
|
+
console.log(`⚠ Fixing: Clearing depends_on for first item ${queue.solutions[0].item_id}`);
|
|
397
|
+
queue.solutions[0].depends_on = [];
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// Write back fixed queue if any changes made
|
|
402
|
+
if (statusFixed > 0 || entryPoints.length === 0) {
|
|
403
|
+
Bash(`echo '${JSON.stringify(queue, null, 2)}' > "${queuePath}"`);
|
|
404
|
+
console.log(`✓ Queue file updated with ${statusFixed} status fixes`);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// ============ OUTPUT SUMMARY ============
|
|
408
|
+
|
|
327
409
|
console.log(`
|
|
328
410
|
## Queue Formed: ${summary.queue_id}
|
|
329
411
|
|
|
@@ -332,14 +414,20 @@ console.log(`
|
|
|
332
414
|
**Issues**: ${summary.issues_queued.join(', ')}
|
|
333
415
|
**Groups**: ${summary.execution_groups.map(g => `${g.id}(${g.count})`).join(', ')}
|
|
334
416
|
**Conflicts Resolved**: ${summary.conflicts_resolved}
|
|
417
|
+
**Entry Points**: ${entryPoints.length} (items ready for immediate execution)
|
|
335
418
|
|
|
336
|
-
Next: \`/issue:execute\`
|
|
419
|
+
Next: \`/issue:execute\` or \`ccw issue next\`
|
|
337
420
|
`);
|
|
338
421
|
|
|
339
422
|
// Update issue statuses via CLI
|
|
340
423
|
for (const issueId of summary.issues_queued) {
|
|
341
424
|
Bash(`ccw issue update ${issueId} --status queued`);
|
|
342
425
|
}
|
|
426
|
+
|
|
427
|
+
// Final verification
|
|
428
|
+
const verifyResult = Bash(`ccw issue queue dag 2>/dev/null | head -20`);
|
|
429
|
+
console.log('\n### Verification (DAG Preview):');
|
|
430
|
+
console.log(verifyResult);
|
|
343
431
|
```
|
|
344
432
|
|
|
345
433
|
## Error Handling
|
|
@@ -350,6 +438,10 @@ for (const issueId of summary.issues_queued) {
|
|
|
350
438
|
| Circular dependency | List cycles, abort queue formation |
|
|
351
439
|
| Unresolved conflicts | Agent resolves using ordering rules |
|
|
352
440
|
| Invalid task reference | Skip and warn |
|
|
441
|
+
| **index.json not updated** | Auto-fix: Set active_queue_id to new queue |
|
|
442
|
+
| **Wrong status value** | Auto-fix: Convert non-pending status to "pending" |
|
|
443
|
+
| **No entry points (all have deps)** | Auto-fix: Clear depends_on for first item |
|
|
444
|
+
| **Queue file missing solutions** | Abort with error, agent must regenerate |
|
|
353
445
|
|
|
354
446
|
## Related Commands
|
|
355
447
|
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: software-manual
|
|
3
|
+
description: Generate interactive TiddlyWiki-style HTML software manuals with screenshots, API docs, and multi-level code examples. Use when creating user guides, software documentation, or API references. Triggers on "software manual", "user guide", "generate manual", "create docs".
|
|
4
|
+
allowed-tools: Task, AskUserQuestion, Read, Bash, Glob, Grep, Write, mcp__chrome__*
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Software Manual Skill
|
|
8
|
+
|
|
9
|
+
Generate comprehensive, interactive software manuals in TiddlyWiki-style single-file HTML format.
|
|
10
|
+
|
|
11
|
+
## Architecture Overview
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
15
|
+
│ Context-Optimized Architecture │
|
|
16
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
17
|
+
│ │
|
|
18
|
+
│ Phase 1: Requirements → manual-config.json │
|
|
19
|
+
│ ↓ │
|
|
20
|
+
│ Phase 2: Exploration → exploration-*.json │
|
|
21
|
+
│ ↓ │
|
|
22
|
+
│ Phase 3: Parallel Agents → sections/section-*.md │
|
|
23
|
+
│ ↓ (6 Agents) │
|
|
24
|
+
│ Phase 3.5: Consolidation → consolidation-summary.md │
|
|
25
|
+
│ ↓ │
|
|
26
|
+
│ Phase 4: Screenshot → screenshots/*.png │
|
|
27
|
+
│ Capture (via Chrome MCP) │
|
|
28
|
+
│ ↓ │
|
|
29
|
+
│ Phase 5: HTML Assembly → {name}-使用手册.html │
|
|
30
|
+
│ ↓ │
|
|
31
|
+
│ Phase 6: Refinement → iterations/ │
|
|
32
|
+
│ │
|
|
33
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Key Design Principles
|
|
37
|
+
|
|
38
|
+
1. **主 Agent 编排,子 Agent 执行**: 所有繁重计算委托给 `universal-executor` 子 Agent
|
|
39
|
+
2. **Brief Returns**: Agents return path + summary, not full content (avoid context overflow)
|
|
40
|
+
3. **System Agents**: 使用 `cli-explore-agent` (探索) 和 `universal-executor` (执行)
|
|
41
|
+
4. **成熟库内嵌**: marked.js (MD 解析) + highlight.js (语法高亮),无 CDN 依赖
|
|
42
|
+
5. **Single-File HTML**: TiddlyWiki-style interactive document with embedded resources
|
|
43
|
+
6. **动态标签**: 根据实际章节自动生成导航标签
|
|
44
|
+
|
|
45
|
+
## Execution Flow
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
49
|
+
│ Phase 1: Requirements Discovery (主 Agent) │
|
|
50
|
+
│ → AskUserQuestion: 收集软件类型、目标用户、文档范围 │
|
|
51
|
+
│ → Output: manual-config.json │
|
|
52
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
53
|
+
│ Phase 2: Project Exploration (cli-explore-agent × N) │
|
|
54
|
+
│ → 并行探索: architecture, ui-routes, api-endpoints, config │
|
|
55
|
+
│ → Output: exploration-*.json │
|
|
56
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
57
|
+
│ Phase 2.5: API Extraction (extract_apis.py) │
|
|
58
|
+
│ → 自动提取: FastAPI/TypeDoc/pdoc │
|
|
59
|
+
│ → Output: api-docs/{backend,frontend,modules}/*.md │
|
|
60
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
61
|
+
│ Phase 3: Parallel Analysis (universal-executor × 6) │
|
|
62
|
+
│ → 6 个子 Agent 并行: overview, ui-guide, api-docs, config, │
|
|
63
|
+
│ troubleshooting, code-examples │
|
|
64
|
+
│ → Output: sections/section-*.md │
|
|
65
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
66
|
+
│ Phase 3.5: Consolidation (universal-executor) │
|
|
67
|
+
│ → 质量检查: 一致性、交叉引用、截图标记 │
|
|
68
|
+
│ → Output: consolidation-summary.md, screenshots-list.json │
|
|
69
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
70
|
+
│ Phase 4: Screenshot Capture (universal-executor + Chrome MCP) │
|
|
71
|
+
│ → 批量截图: 调用 mcp__chrome__screenshot │
|
|
72
|
+
│ → Output: screenshots/*.png + manifest.json │
|
|
73
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
74
|
+
│ Phase 5: HTML Assembly (universal-executor) │
|
|
75
|
+
│ → 组装 HTML: MD→tiddlers, 嵌入 CSS/JS/图片 │
|
|
76
|
+
│ → Output: {name}-使用手册.html │
|
|
77
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
78
|
+
│ Phase 6: Iterative Refinement (主 Agent) │
|
|
79
|
+
│ → 预览 + 用户反馈 + 迭代修复 │
|
|
80
|
+
│ → Output: iterations/v*.html │
|
|
81
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Agent Configuration
|
|
85
|
+
|
|
86
|
+
| Agent | Role | Output File | Focus Areas |
|
|
87
|
+
|-------|------|-------------|-------------|
|
|
88
|
+
| overview | Product Manager | section-overview.md | Product intro, features, quick start |
|
|
89
|
+
| ui-guide | UX Expert | section-ui-guide.md | UI operations, step-by-step guides |
|
|
90
|
+
| api-docs | API Architect | section-api-reference.md | REST API, Frontend API |
|
|
91
|
+
| config | DevOps Engineer | section-configuration.md | Env vars, deployment, settings |
|
|
92
|
+
| troubleshooting | Support Engineer | section-troubleshooting.md | FAQs, error codes, solutions |
|
|
93
|
+
| code-examples | Developer Advocate | section-examples.md | Beginner/Intermediate/Advanced examples |
|
|
94
|
+
|
|
95
|
+
## Agent Return Format
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
interface ManualAgentReturn {
|
|
99
|
+
status: "completed" | "partial" | "failed";
|
|
100
|
+
output_file: string;
|
|
101
|
+
summary: string; // Max 50 chars
|
|
102
|
+
screenshots_needed: Array<{
|
|
103
|
+
id: string; // e.g., "ss-login-form"
|
|
104
|
+
url: string; // Relative or absolute URL
|
|
105
|
+
description: string; // "Login form interface"
|
|
106
|
+
selector?: string; // CSS selector for partial screenshot
|
|
107
|
+
wait_for?: string; // Element to wait for
|
|
108
|
+
}>;
|
|
109
|
+
cross_references: string[]; // Other sections referenced
|
|
110
|
+
difficulty_level: "beginner" | "intermediate" | "advanced";
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## HTML Features (TiddlyWiki-style)
|
|
115
|
+
|
|
116
|
+
1. **Search**: Full-text search with result highlighting
|
|
117
|
+
2. **Collapse/Expand**: Per-section collapsible content
|
|
118
|
+
3. **Tag Navigation**: Filter by category tags
|
|
119
|
+
4. **Theme Toggle**: Light/Dark mode with localStorage persistence
|
|
120
|
+
5. **Single File**: All CSS/JS/images embedded as Base64
|
|
121
|
+
6. **Offline**: Works without internet connection
|
|
122
|
+
7. **Print-friendly**: Optimized print stylesheet
|
|
123
|
+
|
|
124
|
+
## Directory Setup
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
// Generate timestamp directory name
|
|
128
|
+
const timestamp = new Date().toISOString().slice(0,19).replace(/[-:T]/g, '');
|
|
129
|
+
const dir = `.workflow/.scratchpad/manual-${timestamp}`;
|
|
130
|
+
|
|
131
|
+
// Windows
|
|
132
|
+
Bash(`mkdir "${dir}\\sections" && mkdir "${dir}\\screenshots" && mkdir "${dir}\\api-docs" && mkdir "${dir}\\iterations"`);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Output Structure
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
.workflow/.scratchpad/manual-{timestamp}/
|
|
139
|
+
├── manual-config.json # Phase 1
|
|
140
|
+
├── exploration/ # Phase 2
|
|
141
|
+
│ ├── exploration-architecture.json
|
|
142
|
+
│ ├── exploration-ui-routes.json
|
|
143
|
+
│ └── exploration-api-endpoints.json
|
|
144
|
+
├── sections/ # Phase 3
|
|
145
|
+
│ ├── section-overview.md
|
|
146
|
+
│ ├── section-ui-guide.md
|
|
147
|
+
│ ├── section-api-reference.md
|
|
148
|
+
│ ├── section-configuration.md
|
|
149
|
+
│ ├── section-troubleshooting.md
|
|
150
|
+
│ └── section-examples.md
|
|
151
|
+
├── consolidation-summary.md # Phase 3.5
|
|
152
|
+
├── api-docs/ # API documentation
|
|
153
|
+
│ ├── frontend/ # TypeDoc output
|
|
154
|
+
│ └── backend/ # Swagger/OpenAPI output
|
|
155
|
+
├── screenshots/ # Phase 4
|
|
156
|
+
│ ├── ss-*.png
|
|
157
|
+
│ └── screenshots-manifest.json
|
|
158
|
+
├── iterations/ # Phase 6
|
|
159
|
+
│ ├── v1.html
|
|
160
|
+
│ └── v2.html
|
|
161
|
+
└── {软件名}-使用手册.html # Final Output
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Reference Documents
|
|
165
|
+
|
|
166
|
+
| Document | Purpose |
|
|
167
|
+
|----------|---------|
|
|
168
|
+
| [phases/01-requirements-discovery.md](phases/01-requirements-discovery.md) | 用户配置收集 |
|
|
169
|
+
| [phases/02-project-exploration.md](phases/02-project-exploration.md) | 项目类型检测 |
|
|
170
|
+
| [phases/02.5-api-extraction.md](phases/02.5-api-extraction.md) | API 自动提取 |
|
|
171
|
+
| [phases/03-parallel-analysis.md](phases/03-parallel-analysis.md) | 6 Agent 并行分析 |
|
|
172
|
+
| [phases/03.5-consolidation.md](phases/03.5-consolidation.md) | 整合与质量检查 |
|
|
173
|
+
| [phases/04-screenshot-capture.md](phases/04-screenshot-capture.md) | Chrome MCP 截图 |
|
|
174
|
+
| [phases/05-html-assembly.md](phases/05-html-assembly.md) | HTML 组装 |
|
|
175
|
+
| [phases/06-iterative-refinement.md](phases/06-iterative-refinement.md) | 迭代优化 |
|
|
176
|
+
| [specs/quality-standards.md](specs/quality-standards.md) | 质量标准 |
|
|
177
|
+
| [specs/writing-style.md](specs/writing-style.md) | 写作风格 |
|
|
178
|
+
| [templates/tiddlywiki-shell.html](templates/tiddlywiki-shell.html) | HTML 模板 |
|
|
179
|
+
| [templates/css/wiki-base.css](templates/css/wiki-base.css) | 基础样式 |
|
|
180
|
+
| [templates/css/wiki-dark.css](templates/css/wiki-dark.css) | 暗色主题 |
|
|
181
|
+
| [scripts/bundle-libraries.md](scripts/bundle-libraries.md) | 库文件打包 |
|
|
182
|
+
| [scripts/api-extractor.md](scripts/api-extractor.md) | API 提取说明 |
|
|
183
|
+
| [scripts/extract_apis.py](scripts/extract_apis.py) | API 提取脚本 |
|
|
184
|
+
| [scripts/screenshot-helper.md](scripts/screenshot-helper.md) | 截图辅助 |
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Phase 1: Requirements Discovery
|
|
2
|
+
|
|
3
|
+
Collect user requirements and generate configuration for the manual generation process.
|
|
4
|
+
|
|
5
|
+
## Objective
|
|
6
|
+
|
|
7
|
+
Gather essential information about the software project to customize the manual generation:
|
|
8
|
+
- Software type and characteristics
|
|
9
|
+
- Target user audience
|
|
10
|
+
- Documentation scope and depth
|
|
11
|
+
- Special requirements
|
|
12
|
+
|
|
13
|
+
## Execution Steps
|
|
14
|
+
|
|
15
|
+
### Step 1: Software Information Collection
|
|
16
|
+
|
|
17
|
+
Use `AskUserQuestion` to collect:
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
AskUserQuestion({
|
|
21
|
+
questions: [
|
|
22
|
+
{
|
|
23
|
+
question: "What type of software is this project?",
|
|
24
|
+
header: "Software Type",
|
|
25
|
+
options: [
|
|
26
|
+
{ label: "Web Application", description: "Frontend + Backend web app with UI" },
|
|
27
|
+
{ label: "CLI Tool", description: "Command-line interface tool" },
|
|
28
|
+
{ label: "SDK/Library", description: "Developer library or SDK" },
|
|
29
|
+
{ label: "Desktop App", description: "Desktop application (Electron, etc.)" }
|
|
30
|
+
],
|
|
31
|
+
multiSelect: false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
question: "Who is the target audience for this manual?",
|
|
35
|
+
header: "Target Users",
|
|
36
|
+
options: [
|
|
37
|
+
{ label: "End Users", description: "Non-technical users who use the product" },
|
|
38
|
+
{ label: "Developers", description: "Developers integrating or extending the product" },
|
|
39
|
+
{ label: "Administrators", description: "System admins deploying and maintaining" },
|
|
40
|
+
{ label: "All Audiences", description: "Mixed audience with different sections" }
|
|
41
|
+
],
|
|
42
|
+
multiSelect: false
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
question: "What documentation scope do you need?",
|
|
46
|
+
header: "Doc Scope",
|
|
47
|
+
options: [
|
|
48
|
+
{ label: "Quick Start", description: "Essential getting started guide only" },
|
|
49
|
+
{ label: "User Guide", description: "Complete user-facing documentation" },
|
|
50
|
+
{ label: "API Reference", description: "Focus on API documentation" },
|
|
51
|
+
{ label: "Comprehensive", description: "Full documentation including all sections" }
|
|
52
|
+
],
|
|
53
|
+
multiSelect: false
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
question: "What difficulty levels should code examples cover?",
|
|
57
|
+
header: "Example Levels",
|
|
58
|
+
options: [
|
|
59
|
+
{ label: "Beginner Only", description: "Simple, basic examples" },
|
|
60
|
+
{ label: "Beginner + Intermediate", description: "Basic to moderate complexity" },
|
|
61
|
+
{ label: "All Levels", description: "Beginner, Intermediate, and Advanced" }
|
|
62
|
+
],
|
|
63
|
+
multiSelect: false
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Step 2: Auto-Detection (Supplement)
|
|
70
|
+
|
|
71
|
+
Automatically detect project characteristics:
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
// Detect from package.json
|
|
75
|
+
const packageJson = Read('package.json');
|
|
76
|
+
const softwareName = packageJson.name;
|
|
77
|
+
const version = packageJson.version;
|
|
78
|
+
const description = packageJson.description;
|
|
79
|
+
|
|
80
|
+
// Detect tech stack
|
|
81
|
+
const hasReact = packageJson.dependencies?.react;
|
|
82
|
+
const hasVue = packageJson.dependencies?.vue;
|
|
83
|
+
const hasExpress = packageJson.dependencies?.express;
|
|
84
|
+
const hasNestJS = packageJson.dependencies?.['@nestjs/core'];
|
|
85
|
+
|
|
86
|
+
// Detect CLI
|
|
87
|
+
const hasBin = !!packageJson.bin;
|
|
88
|
+
|
|
89
|
+
// Detect UI
|
|
90
|
+
const hasPages = Glob('src/pages/**/*').length > 0 || Glob('pages/**/*').length > 0;
|
|
91
|
+
const hasRoutes = Glob('**/routes.*').length > 0;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Step 3: Generate Configuration
|
|
95
|
+
|
|
96
|
+
Create `manual-config.json`:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"software": {
|
|
101
|
+
"name": "{{detected or user input}}",
|
|
102
|
+
"version": "{{from package.json}}",
|
|
103
|
+
"description": "{{from package.json}}",
|
|
104
|
+
"type": "{{web|cli|sdk|desktop}}"
|
|
105
|
+
},
|
|
106
|
+
"target_audience": "{{end_users|developers|admins|all}}",
|
|
107
|
+
"doc_scope": "{{quick_start|user_guide|api_reference|comprehensive}}",
|
|
108
|
+
"example_levels": ["beginner", "intermediate", "advanced"],
|
|
109
|
+
"tech_stack": {
|
|
110
|
+
"frontend": "{{react|vue|angular|vanilla}}",
|
|
111
|
+
"backend": "{{express|nestjs|fastify|none}}",
|
|
112
|
+
"language": "{{typescript|javascript}}",
|
|
113
|
+
"ui_framework": "{{tailwind|mui|antd|none}}"
|
|
114
|
+
},
|
|
115
|
+
"features": {
|
|
116
|
+
"has_ui": true,
|
|
117
|
+
"has_api": true,
|
|
118
|
+
"has_cli": false,
|
|
119
|
+
"has_config": true
|
|
120
|
+
},
|
|
121
|
+
"agents_to_run": [
|
|
122
|
+
"overview",
|
|
123
|
+
"ui-guide",
|
|
124
|
+
"api-docs",
|
|
125
|
+
"config",
|
|
126
|
+
"troubleshooting",
|
|
127
|
+
"code-examples"
|
|
128
|
+
],
|
|
129
|
+
"screenshot_config": {
|
|
130
|
+
"enabled": true,
|
|
131
|
+
"dev_command": "npm run dev",
|
|
132
|
+
"dev_url": "http://localhost:3000",
|
|
133
|
+
"wait_timeout": 5000
|
|
134
|
+
},
|
|
135
|
+
"output": {
|
|
136
|
+
"filename": "{{name}}-使用手册.html",
|
|
137
|
+
"theme": "light",
|
|
138
|
+
"language": "zh-CN"
|
|
139
|
+
},
|
|
140
|
+
"timestamp": "{{ISO8601}}"
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Agent Selection Logic
|
|
145
|
+
|
|
146
|
+
Based on `doc_scope`, select agents to run:
|
|
147
|
+
|
|
148
|
+
| Scope | Agents |
|
|
149
|
+
|-------|--------|
|
|
150
|
+
| quick_start | overview |
|
|
151
|
+
| user_guide | overview, ui-guide, config, troubleshooting |
|
|
152
|
+
| api_reference | overview, api-docs, code-examples |
|
|
153
|
+
| comprehensive | ALL 6 agents |
|
|
154
|
+
|
|
155
|
+
## Output
|
|
156
|
+
|
|
157
|
+
- **File**: `manual-config.json`
|
|
158
|
+
- **Location**: `.workflow/.scratchpad/manual-{timestamp}/`
|
|
159
|
+
|
|
160
|
+
## Next Phase
|
|
161
|
+
|
|
162
|
+
Proceed to [Phase 2: Project Exploration](02-project-exploration.md) with the generated configuration.
|