claude-code-workflow 6.3.18 → 6.3.20
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 +8 -5
- package/.claude/agents/action-planning-agent.md +26 -2
- package/.claude/agents/code-developer.md +132 -43
- package/.claude/agents/debug-explore-agent.md +434 -0
- package/.claude/agents/issue-plan-agent.md +31 -2
- package/.claude/agents/test-fix-agent.md +14 -0
- package/.claude/commands/issue/discover.md +41 -0
- package/.claude/commands/issue/execute.md +200 -19
- package/.claude/commands/issue/new.md +93 -3
- package/.claude/commands/issue/plan.md +9 -3
- package/.claude/commands/issue/queue.md +94 -39
- package/.claude/commands/memory/swagger-docs.md +773 -0
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +21 -21
- package/.claude/commands/workflow/execute.md +54 -34
- package/.claude/commands/workflow/lite-execute.md +48 -164
- package/.claude/commands/workflow/lite-fix.md +4 -4
- package/.claude/commands/workflow/lite-plan.md +5 -5
- package/.claude/commands/workflow/plan.md +27 -27
- package/.claude/commands/workflow/review.md +42 -17
- package/.claude/commands/workflow/tdd-plan.md +25 -25
- package/.claude/commands/workflow/test-fix-gen.md +10 -10
- package/.claude/commands/workflow/test-gen.md +14 -14
- package/.claude/commands/workflow/ui-design/explore-auto.md +21 -21
- package/.claude/commands/workflow/ui-design/imitate-auto.md +24 -24
- package/.claude/skills/_shared/SKILL-DESIGN-SPEC.md +693 -0
- package/.claude/skills/ccw/SKILL.md +462 -0
- package/.claude/skills/ccw/index/command-capabilities.json +127 -0
- package/.claude/skills/ccw/index/intent-rules.json +136 -0
- package/.claude/skills/ccw/index/workflow-chains.json +451 -0
- package/.claude/skills/ccw/phases/actions/bugfix.md +218 -0
- package/.claude/skills/ccw/phases/actions/coupled.md +194 -0
- package/.claude/skills/ccw/phases/actions/docs.md +93 -0
- package/.claude/skills/ccw/phases/actions/full.md +154 -0
- package/.claude/skills/ccw/phases/actions/issue.md +201 -0
- package/.claude/skills/ccw/phases/actions/rapid.md +104 -0
- package/.claude/skills/ccw/phases/actions/review-fix.md +84 -0
- package/.claude/skills/ccw/phases/actions/tdd.md +66 -0
- package/.claude/skills/ccw/phases/actions/ui.md +79 -0
- package/.claude/skills/ccw/phases/orchestrator.md +435 -0
- package/.claude/skills/ccw/specs/intent-classification.md +336 -0
- package/.claude/skills/ccw-help/SKILL.md +177 -0
- package/.claude/skills/ccw-help/index/all-agents.json +82 -0
- package/.claude/skills/{command-guide → ccw-help}/index/all-commands.json +183 -73
- package/.claude/skills/{command-guide → ccw-help}/index/by-category.json +187 -73
- package/.claude/skills/{command-guide → ccw-help}/index/by-use-case.json +295 -185
- package/.claude/skills/{command-guide → ccw-help}/index/command-relationships.json +19 -166
- package/.claude/skills/{command-guide → ccw-help}/index/essential-commands.json +10 -10
- package/.claude/skills/ccw-help/scripts/analyze_commands.py +337 -0
- package/.claude/skills/code-reviewer/README.md +340 -0
- package/.claude/skills/code-reviewer/SKILL.md +308 -0
- package/.claude/skills/code-reviewer/phases/01-code-discovery.md +246 -0
- package/.claude/skills/code-reviewer/phases/02-security-analysis.md +442 -0
- package/.claude/skills/code-reviewer/phases/03-best-practices-review.md +36 -0
- package/.claude/skills/code-reviewer/phases/04-report-generation.md +278 -0
- package/.claude/skills/code-reviewer/specs/best-practices-requirements.md +346 -0
- package/.claude/skills/code-reviewer/specs/quality-standards.md +252 -0
- package/.claude/skills/code-reviewer/specs/security-requirements.md +243 -0
- package/.claude/skills/code-reviewer/templates/best-practice-finding.md +234 -0
- package/.claude/skills/code-reviewer/templates/report-template.md +316 -0
- package/.claude/skills/code-reviewer/templates/security-finding.md +161 -0
- package/.claude/skills/skill-generator/SKILL.md +187 -0
- package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +239 -0
- package/.claude/skills/skill-generator/phases/02-structure-generation.md +207 -0
- package/.claude/skills/skill-generator/phases/03-phase-generation.md +802 -0
- package/.claude/skills/skill-generator/phases/04-specs-templates.md +328 -0
- package/.claude/skills/skill-generator/phases/05-validation.md +334 -0
- package/.claude/skills/skill-generator/specs/cli-integration.md +448 -0
- package/.claude/skills/skill-generator/specs/execution-modes.md +396 -0
- package/.claude/skills/skill-generator/specs/scripting-integration.md +265 -0
- package/.claude/skills/skill-generator/specs/skill-requirements.md +466 -0
- package/.claude/skills/skill-generator/templates/autonomous-action.md +517 -0
- package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +276 -0
- package/.claude/skills/skill-generator/templates/code-analysis-action.md +503 -0
- package/.claude/skills/skill-generator/templates/llm-action.md +355 -0
- package/.claude/skills/skill-generator/templates/script-bash.md +277 -0
- package/.claude/skills/skill-generator/templates/script-python.md +198 -0
- package/.claude/skills/skill-generator/templates/sequential-phase.md +441 -0
- package/.claude/skills/skill-generator/templates/skill-md.md +156 -0
- package/.claude/workflows/chinese-response.md +15 -28
- package/.claude/workflows/cli-templates/prompts/documentation/swagger-api.txt +266 -0
- package/.claude/workflows/cli-tools-usage.md +221 -177
- package/.claude/workflows/windows-platform.md +13 -10
- package/.codex/prompts/issue-execute.md +310 -82
- package/.codex/prompts/issue-queue.md +22 -0
- package/.codex/prompts/lite-execute.md +36 -11
- package/README.md +309 -305
- package/ccw/README.md +10 -4
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +4 -1
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/cli.d.ts.map +1 -1
- package/ccw/dist/commands/cli.js +131 -34
- package/ccw/dist/commands/cli.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts +152 -0
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +550 -85
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/commands/serve.d.ts +1 -0
- package/ccw/dist/commands/serve.d.ts.map +1 -1
- package/ccw/dist/commands/serve.js +12 -5
- package/ccw/dist/commands/serve.js.map +1 -1
- package/ccw/dist/commands/stop.d.ts.map +1 -1
- package/ccw/dist/commands/stop.js +29 -5
- package/ccw/dist/commands/stop.js.map +1 -1
- package/ccw/dist/commands/tool.d.ts.map +1 -1
- package/ccw/dist/commands/tool.js +19 -2
- package/ccw/dist/commands/tool.js.map +1 -1
- package/ccw/dist/commands/view.d.ts +1 -0
- package/ccw/dist/commands/view.d.ts.map +1 -1
- package/ccw/dist/commands/view.js +10 -3
- package/ccw/dist/commands/view.js.map +1 -1
- package/ccw/dist/config/cli-settings-manager.d.ts +86 -0
- package/ccw/dist/config/cli-settings-manager.d.ts.map +1 -0
- package/ccw/dist/config/cli-settings-manager.js +392 -0
- package/ccw/dist/config/cli-settings-manager.js.map +1 -0
- package/ccw/dist/config/litellm-api-config-manager.d.ts +71 -5
- package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.js +290 -20
- package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
- package/ccw/dist/core/auth/csrf-manager.d.ts +18 -0
- package/ccw/dist/core/auth/csrf-manager.d.ts.map +1 -0
- package/ccw/dist/core/auth/csrf-manager.js +80 -0
- package/ccw/dist/core/auth/csrf-manager.js.map +1 -0
- package/ccw/dist/core/auth/csrf-middleware.d.ts +8 -0
- package/ccw/dist/core/auth/csrf-middleware.d.ts.map +1 -0
- package/ccw/dist/core/auth/csrf-middleware.js +141 -0
- package/ccw/dist/core/auth/csrf-middleware.js.map +1 -0
- package/ccw/dist/core/auth/middleware.d.ts +15 -0
- package/ccw/dist/core/auth/middleware.d.ts.map +1 -0
- package/ccw/dist/core/auth/middleware.js +76 -0
- package/ccw/dist/core/auth/middleware.js.map +1 -0
- package/ccw/dist/core/auth/token-manager.d.ts +41 -0
- package/ccw/dist/core/auth/token-manager.d.ts.map +1 -0
- package/ccw/dist/core/auth/token-manager.js +171 -0
- package/ccw/dist/core/auth/token-manager.js.map +1 -0
- package/ccw/dist/core/cache-manager.d.ts +6 -6
- package/ccw/dist/core/cache-manager.d.ts.map +1 -1
- package/ccw/dist/core/cache-manager.js +70 -48
- package/ccw/dist/core/cache-manager.js.map +1 -1
- package/ccw/dist/core/claude-freshness.d.ts.map +1 -1
- package/ccw/dist/core/claude-freshness.js +23 -3
- package/ccw/dist/core/claude-freshness.js.map +1 -1
- package/ccw/dist/core/core-memory-store.d.ts.map +1 -1
- package/ccw/dist/core/core-memory-store.js +2 -1
- package/ccw/dist/core/core-memory-store.js.map +1 -1
- package/ccw/dist/core/cors.d.ts +3 -0
- package/ccw/dist/core/cors.d.ts.map +1 -0
- package/ccw/dist/core/cors.js +10 -0
- package/ccw/dist/core/cors.js.map +1 -0
- package/ccw/dist/core/dashboard-generator-patch.js +0 -1
- package/ccw/dist/core/dashboard-generator-patch.js.map +1 -1
- package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
- package/ccw/dist/core/dashboard-generator.js +417 -416
- package/ccw/dist/core/dashboard-generator.js.map +1 -1
- package/ccw/dist/core/data-aggregator.js +2 -2
- package/ccw/dist/core/data-aggregator.js.map +1 -1
- package/ccw/dist/core/lite-scanner.d.ts +1 -1
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -1
- package/ccw/dist/core/lite-scanner.js +130 -127
- package/ccw/dist/core/lite-scanner.js.map +1 -1
- package/ccw/dist/core/routes/auth-routes.d.ts +12 -0
- package/ccw/dist/core/routes/auth-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/auth-routes.js +80 -0
- package/ccw/dist/core/routes/auth-routes.js.map +1 -0
- package/ccw/dist/core/routes/ccw-routes.d.ts +1 -14
- package/ccw/dist/core/routes/ccw-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/ccw-routes.js +9 -4
- package/ccw/dist/core/routes/ccw-routes.js.map +1 -1
- package/ccw/dist/core/routes/claude-routes.d.ts +1 -14
- package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/claude-routes.js +98 -39
- package/ccw/dist/core/routes/claude-routes.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.d.ts +14 -12
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js +122 -43
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/cli-settings-routes.d.ts +11 -0
- package/ccw/dist/core/routes/cli-settings-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/cli-settings-routes.js +204 -0
- package/ccw/dist/core/routes/cli-settings-routes.js.map +1 -0
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts +6 -0
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -0
- package/ccw/dist/core/routes/codexlens/config-handlers.js +1195 -0
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -0
- package/ccw/dist/core/routes/codexlens/index-handlers.d.ts +10 -0
- package/ccw/dist/core/routes/codexlens/index-handlers.d.ts.map +1 -0
- package/ccw/dist/core/routes/codexlens/index-handlers.js +322 -0
- package/ccw/dist/core/routes/codexlens/index-handlers.js.map +1 -0
- package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts +6 -0
- package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts.map +1 -0
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js +865 -0
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js.map +1 -0
- package/ccw/dist/core/routes/codexlens/utils.d.ts +23 -0
- package/ccw/dist/core/routes/codexlens/utils.d.ts.map +1 -0
- package/ccw/dist/core/routes/codexlens/utils.js +85 -0
- package/ccw/dist/core/routes/codexlens/utils.js.map +1 -0
- package/ccw/dist/core/routes/codexlens/watcher-handlers.d.ts +13 -0
- package/ccw/dist/core/routes/codexlens/watcher-handlers.d.ts.map +1 -0
- package/ccw/dist/core/routes/codexlens/watcher-handlers.js +235 -0
- package/ccw/dist/core/routes/codexlens/watcher-handlers.js.map +1 -0
- package/ccw/dist/core/routes/codexlens-routes.d.ts +2 -11
- package/ccw/dist/core/routes/codexlens-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens-routes.js +10 -981
- package/ccw/dist/core/routes/codexlens-routes.js.map +1 -1
- package/ccw/dist/core/routes/discovery-routes.d.ts +1 -35
- package/ccw/dist/core/routes/discovery-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/discovery-routes.js +25 -0
- package/ccw/dist/core/routes/discovery-routes.js.map +1 -1
- package/ccw/dist/core/routes/files-routes.d.ts +1 -14
- package/ccw/dist/core/routes/files-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/files-routes.js +57 -14
- package/ccw/dist/core/routes/files-routes.js.map +1 -1
- package/ccw/dist/core/routes/graph-routes.d.ts +1 -14
- package/ccw/dist/core/routes/graph-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/graph-routes.js +36 -37
- package/ccw/dist/core/routes/graph-routes.js.map +1 -1
- package/ccw/dist/core/routes/help-routes.d.ts +1 -14
- package/ccw/dist/core/routes/help-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/help-routes.js +5 -0
- package/ccw/dist/core/routes/help-routes.js.map +1 -1
- package/ccw/dist/core/routes/hooks-routes.d.ts +4 -14
- package/ccw/dist/core/routes/hooks-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/hooks-routes.js +43 -21
- package/ccw/dist/core/routes/hooks-routes.js.map +1 -1
- package/ccw/dist/core/routes/issue-routes.d.ts +1 -34
- package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/issue-routes.js +24 -0
- package/ccw/dist/core/routes/issue-routes.js.map +1 -1
- package/ccw/dist/core/routes/litellm-api-routes.d.ts +1 -14
- package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/litellm-api-routes.js +513 -48
- package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
- package/ccw/dist/core/routes/litellm-routes.d.ts +1 -14
- package/ccw/dist/core/routes/litellm-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/litellm-routes.js +28 -11
- package/ccw/dist/core/routes/litellm-routes.js.map +1 -1
- package/ccw/dist/core/routes/mcp-routes.d.ts +1 -14
- package/ccw/dist/core/routes/mcp-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/mcp-routes.js +99 -30
- package/ccw/dist/core/routes/mcp-routes.js.map +1 -1
- package/ccw/dist/core/routes/mcp-templates-db.d.ts.map +1 -1
- package/ccw/dist/core/routes/mcp-templates-db.js +30 -31
- package/ccw/dist/core/routes/mcp-templates-db.js.map +1 -1
- package/ccw/dist/core/routes/memory-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/memory-routes.js +74 -24
- package/ccw/dist/core/routes/memory-routes.js.map +1 -1
- package/ccw/dist/core/routes/nav-status-routes.d.ts +3 -0
- package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/nav-status-routes.js +217 -0
- package/ccw/dist/core/routes/nav-status-routes.js.map +1 -0
- package/ccw/dist/core/routes/rules-routes.d.ts +1 -14
- package/ccw/dist/core/routes/rules-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/rules-routes.js +481 -58
- package/ccw/dist/core/routes/rules-routes.js.map +1 -1
- package/ccw/dist/core/routes/session-routes.d.ts +1 -14
- package/ccw/dist/core/routes/session-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/session-routes.js +15 -3
- package/ccw/dist/core/routes/session-routes.js.map +1 -1
- package/ccw/dist/core/routes/skills-routes.d.ts +1 -14
- package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/skills-routes.js +394 -112
- package/ccw/dist/core/routes/skills-routes.js.map +1 -1
- package/ccw/dist/core/routes/status-routes.d.ts +1 -14
- package/ccw/dist/core/routes/status-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/status-routes.js +4 -0
- package/ccw/dist/core/routes/status-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts +4 -10
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +6 -4
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/routes/types.d.ts +19 -0
- package/ccw/dist/core/routes/types.d.ts.map +1 -0
- package/ccw/dist/core/routes/types.js +2 -0
- package/ccw/dist/core/routes/types.js.map +1 -0
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +206 -29
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/core/services/api-key-tester.d.ts +42 -0
- package/ccw/dist/core/services/api-key-tester.d.ts.map +1 -0
- package/ccw/dist/core/services/api-key-tester.js +126 -0
- package/ccw/dist/core/services/api-key-tester.js.map +1 -0
- package/ccw/dist/core/services/health-check-service.d.ts +88 -0
- package/ccw/dist/core/services/health-check-service.d.ts.map +1 -0
- package/ccw/dist/core/services/health-check-service.js +293 -0
- package/ccw/dist/core/services/health-check-service.js.map +1 -0
- package/ccw/dist/core/websocket.d.ts +9 -7
- package/ccw/dist/core/websocket.d.ts.map +1 -1
- package/ccw/dist/core/websocket.js +9 -4
- package/ccw/dist/core/websocket.js.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.d.ts +152 -28
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +490 -100
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/cli-config-manager.d.ts +24 -8
- package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
- package/ccw/dist/tools/cli-config-manager.js +76 -156
- package/ccw/dist/tools/cli-config-manager.js.map +1 -1
- package/ccw/dist/tools/cli-executor-core.d.ts +85 -0
- package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -0
- package/ccw/dist/tools/cli-executor-core.js +1310 -0
- package/ccw/dist/tools/cli-executor-core.js.map +1 -0
- package/ccw/dist/tools/cli-executor-state.d.ts +241 -0
- package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -0
- package/ccw/dist/tools/cli-executor-state.js +392 -0
- package/ccw/dist/tools/cli-executor-state.js.map +1 -0
- package/ccw/dist/tools/cli-executor-utils.d.ts +36 -0
- package/ccw/dist/tools/cli-executor-utils.d.ts.map +1 -0
- package/ccw/dist/tools/cli-executor-utils.js +298 -0
- package/ccw/dist/tools/cli-executor-utils.js.map +1 -0
- package/ccw/dist/tools/cli-executor.d.ts +3 -377
- package/ccw/dist/tools/cli-executor.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor.js +3 -1884
- package/ccw/dist/tools/cli-executor.js.map +1 -1
- package/ccw/dist/tools/cli-history-store.d.ts +2 -0
- package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
- package/ccw/dist/tools/cli-history-store.js.map +1 -1
- package/ccw/dist/tools/cli-output-converter.d.ts +192 -0
- package/ccw/dist/tools/cli-output-converter.d.ts.map +1 -0
- package/ccw/dist/tools/cli-output-converter.js +1047 -0
- package/ccw/dist/tools/cli-output-converter.js.map +1 -0
- package/ccw/dist/tools/cli-prompt-builder.d.ts +113 -0
- package/ccw/dist/tools/cli-prompt-builder.d.ts.map +1 -0
- package/ccw/dist/tools/cli-prompt-builder.js +363 -0
- package/ccw/dist/tools/cli-prompt-builder.js.map +1 -0
- package/ccw/dist/tools/codex-lens.d.ts +15 -1
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens.js +289 -55
- package/ccw/dist/tools/codex-lens.js.map +1 -1
- package/ccw/dist/tools/detect-changed-modules.d.ts.map +1 -1
- package/ccw/dist/tools/detect-changed-modules.js +22 -4
- package/ccw/dist/tools/detect-changed-modules.js.map +1 -1
- package/ccw/dist/tools/index.d.ts.map +1 -1
- package/ccw/dist/tools/index.js +2 -0
- package/ccw/dist/tools/index.js.map +1 -1
- package/ccw/dist/tools/litellm-client.d.ts.map +1 -1
- package/ccw/dist/tools/litellm-client.js +10 -4
- package/ccw/dist/tools/litellm-client.js.map +1 -1
- package/ccw/dist/tools/litellm-executor.d.ts +2 -4
- package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
- package/ccw/dist/tools/litellm-executor.js +39 -8
- package/ccw/dist/tools/litellm-executor.js.map +1 -1
- package/ccw/dist/tools/native-session-discovery.d.ts +2 -0
- package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -1
- package/ccw/dist/tools/native-session-discovery.js +197 -1
- package/ccw/dist/tools/native-session-discovery.js.map +1 -1
- package/ccw/dist/tools/session-manager.d.ts.map +1 -1
- package/ccw/dist/tools/session-manager.js +79 -0
- package/ccw/dist/tools/session-manager.js.map +1 -1
- package/ccw/dist/tools/skill-context-loader.d.ts +15 -0
- package/ccw/dist/tools/skill-context-loader.d.ts.map +1 -0
- package/ccw/dist/tools/skill-context-loader.js +198 -0
- package/ccw/dist/tools/skill-context-loader.js.map +1 -0
- package/ccw/dist/tools/smart-search.d.ts +8 -3
- package/ccw/dist/tools/smart-search.d.ts.map +1 -1
- package/ccw/dist/tools/smart-search.js +378 -75
- package/ccw/dist/tools/smart-search.js.map +1 -1
- package/ccw/dist/types/cli-settings.d.ts +86 -0
- package/ccw/dist/types/cli-settings.d.ts.map +1 -0
- package/ccw/dist/types/cli-settings.js +54 -0
- package/ccw/dist/types/cli-settings.js.map +1 -0
- package/ccw/dist/types/litellm-api-config.d.ts +40 -1
- package/ccw/dist/types/litellm-api-config.d.ts.map +1 -1
- package/ccw/dist/utils/exec-constants.d.ts +25 -0
- package/ccw/dist/utils/exec-constants.d.ts.map +1 -0
- package/ccw/dist/utils/exec-constants.js +25 -0
- package/ccw/dist/utils/exec-constants.js.map +1 -0
- package/ccw/dist/utils/path-resolver.d.ts +1 -0
- package/ccw/dist/utils/path-resolver.d.ts.map +1 -1
- package/ccw/dist/utils/path-resolver.js +48 -3
- package/ccw/dist/utils/path-resolver.js.map +1 -1
- package/ccw/dist/utils/path-validator.d.ts.map +1 -1
- package/ccw/dist/utils/path-validator.js +25 -6
- package/ccw/dist/utils/path-validator.js.map +1 -1
- package/ccw/dist/utils/python-utils.d.ts.map +1 -1
- package/ccw/dist/utils/python-utils.js +27 -7
- package/ccw/dist/utils/python-utils.js.map +1 -1
- package/ccw/dist/utils/shell-escape.d.ts +8 -0
- package/ccw/dist/utils/shell-escape.d.ts.map +1 -0
- package/ccw/dist/utils/shell-escape.js +24 -0
- package/ccw/dist/utils/shell-escape.js.map +1 -0
- package/ccw/dist/utils/uv-manager.d.ts +167 -0
- package/ccw/dist/utils/uv-manager.d.ts.map +1 -0
- package/ccw/dist/utils/uv-manager.js +644 -0
- package/ccw/dist/utils/uv-manager.js.map +1 -0
- package/ccw/src/cli.ts +4 -1
- package/ccw/src/commands/cli.ts +132 -34
- package/ccw/src/commands/issue.ts +605 -91
- package/ccw/src/commands/serve.ts +15 -5
- package/ccw/src/commands/stop.ts +32 -5
- package/ccw/src/commands/tool.ts +17 -2
- package/ccw/src/commands/view.ts +13 -3
- package/ccw/src/config/cli-settings-manager.ts +460 -0
- package/ccw/src/config/litellm-api-config-manager.ts +392 -57
- package/ccw/src/core/auth/csrf-manager.ts +104 -0
- package/ccw/src/core/auth/csrf-middleware.ts +159 -0
- package/ccw/src/core/auth/middleware.ts +94 -0
- package/ccw/src/core/auth/token-manager.ts +219 -0
- package/ccw/src/core/cache-manager.ts +64 -52
- package/ccw/src/core/claude-freshness.ts +26 -6
- package/ccw/src/core/core-memory-store.ts +2 -1
- package/ccw/src/core/cors.ts +10 -0
- package/ccw/src/core/dashboard-generator-patch.ts +47 -48
- package/ccw/src/core/dashboard-generator.ts +797 -744
- package/ccw/src/core/data-aggregator.ts +667 -667
- package/ccw/src/core/lite-scanner.ts +156 -140
- package/ccw/src/core/routes/auth-routes.ts +98 -0
- package/ccw/src/core/routes/ccw-routes.ts +10 -20
- package/ccw/src/core/routes/claude-routes.ts +101 -51
- package/ccw/src/core/routes/cli-routes.ts +152 -55
- package/ccw/src/core/routes/cli-settings-routes.ts +232 -0
- package/ccw/src/core/routes/codexlens/README.md +37 -0
- package/ccw/src/core/routes/codexlens/config-handlers.ts +1269 -0
- package/ccw/src/core/routes/codexlens/index-handlers.ts +354 -0
- package/ccw/src/core/routes/codexlens/semantic-handlers.ts +931 -0
- package/ccw/src/core/routes/codexlens/utils.ts +96 -0
- package/ccw/src/core/routes/codexlens/watcher-handlers.ts +265 -0
- package/ccw/src/core/routes/codexlens-routes.ts +11 -1044
- package/ccw/src/core/routes/discovery-routes.ts +1 -12
- package/ccw/src/core/routes/files-routes.ts +112 -40
- package/ccw/src/core/routes/graph-routes.ts +39 -46
- package/ccw/src/core/routes/help-routes.ts +2 -12
- package/ccw/src/core/routes/hooks-routes.ts +83 -44
- package/ccw/src/core/routes/issue-routes.ts +1 -12
- package/ccw/src/core/routes/litellm-api-routes.ts +574 -60
- package/ccw/src/core/routes/litellm-routes.ts +35 -27
- package/ccw/src/core/routes/mcp-routes.ts +157 -60
- package/ccw/src/core/routes/mcp-routes.ts.backup +549 -550
- package/ccw/src/core/routes/mcp-templates-db.ts +267 -268
- package/ccw/src/core/routes/memory-routes.ts +76 -22
- package/ccw/src/core/routes/nav-status-routes.ts +231 -0
- package/ccw/src/core/routes/rules-routes.ts +600 -81
- package/ccw/src/core/routes/session-routes.ts +28 -22
- package/ccw/src/core/routes/skills-routes.ts +452 -132
- package/ccw/src/core/routes/status-routes.ts +1 -12
- package/ccw/src/core/routes/system-routes.ts +15 -22
- package/ccw/src/core/routes/types.ts +25 -0
- package/ccw/src/core/server.ts +657 -468
- package/ccw/src/core/services/api-key-tester.ts +160 -0
- package/ccw/src/core/services/health-check-service.ts +366 -0
- package/ccw/src/core/websocket.ts +20 -12
- package/ccw/src/templates/dashboard-css/01-base.css +109 -0
- package/ccw/src/templates/dashboard-css/10-cli-status.css +202 -0
- package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +308 -0
- package/ccw/src/templates/dashboard-css/30-core-memory.css +20 -0
- package/ccw/src/templates/dashboard-css/31-api-settings.css +751 -14
- package/ccw/src/templates/dashboard-css/33-cli-stream-viewer.css +230 -2
- package/ccw/src/templates/dashboard-js/api.js +5 -0
- package/ccw/src/templates/dashboard-js/components/cli-status.js +279 -107
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +262 -20
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +105 -5
- package/ccw/src/templates/dashboard-js/components/mcp-manager.js +317 -0
- package/ccw/src/templates/dashboard-js/components/navigation.js +45 -0
- package/ccw/src/templates/dashboard-js/components/notifications.js +128 -0
- package/ccw/src/templates/dashboard-js/i18n.js +4448 -3983
- package/ccw/src/templates/dashboard-js/main.js +71 -0
- package/ccw/src/templates/dashboard-js/services.js +289 -0
- package/ccw/src/templates/dashboard-js/views/api-settings.js +5613 -3361
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +1 -7
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +581 -87
- package/ccw/src/templates/dashboard-js/views/codexlens-manager.js +6101 -1965
- package/ccw/src/templates/dashboard-js/views/core-memory.js +129 -20
- package/ccw/src/templates/dashboard-js/views/hook-manager.js +17 -3
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +63 -0
- package/ccw/src/templates/dashboard-js/views/project-overview.js +182 -37
- package/ccw/src/templates/dashboard-js/views/rules-manager.js +26 -3
- package/ccw/src/templates/dashboard-js/views/skills-manager.js +2 -42
- package/ccw/src/templates/dashboard.html +6 -0
- package/ccw/src/tools/README.md +29 -0
- package/ccw/src/tools/claude-cli-tools.ts +640 -125
- package/ccw/src/tools/cli-config-manager.ts +102 -172
- package/ccw/src/tools/cli-executor-core.ts +1533 -0
- package/ccw/src/tools/cli-executor-state.ts +560 -0
- package/ccw/src/tools/cli-executor-utils.ts +349 -0
- package/ccw/src/tools/cli-executor.ts +3 -2309
- package/ccw/src/tools/cli-history-store.ts +2 -0
- package/ccw/src/tools/cli-output-converter.ts +1237 -0
- package/ccw/src/tools/cli-prompt-builder.ts +487 -0
- package/ccw/src/tools/codex-lens.ts +324 -59
- package/ccw/src/tools/detect-changed-modules.ts +24 -6
- package/ccw/src/tools/index.ts +2 -0
- package/ccw/src/tools/litellm-client.ts +10 -4
- package/ccw/src/tools/litellm-executor.ts +146 -114
- package/ccw/src/tools/native-session-discovery.ts +209 -1
- package/ccw/src/tools/session-manager.ts +88 -0
- package/ccw/src/tools/skill-context-loader.ts +213 -0
- package/ccw/src/tools/smart-search.ts +427 -76
- package/ccw/src/types/cli-settings.ts +137 -0
- package/ccw/src/types/litellm-api-config.ts +55 -1
- package/ccw/src/utils/exec-constants.ts +24 -0
- package/ccw/src/utils/path-resolver.ts +49 -3
- package/ccw/src/utils/path-validator.ts +28 -6
- package/ccw/src/utils/python-utils.ts +140 -121
- package/ccw/src/utils/shell-escape.ts +30 -0
- package/ccw/src/utils/uv-manager.ts +796 -0
- package/ccw-litellm/src/ccw_litellm/__pycache__/__init__.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/__pycache__/__init__.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/__init__.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/__init__.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_embedder.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_embedder.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_embedder.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_llm.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_llm.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_llm.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +270 -251
- package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +33 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/__init__.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/__init__.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/loader.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/loader.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/loader.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/models.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/models.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/__pycache__/models.cpython-313.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/config/loader.py +343 -316
- package/ccw-litellm/src/ccw_litellm/config/models.py +162 -130
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/__init__.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/__init__.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/embedder.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/embedder.cpython-312.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/llm.cpython-310.pyc +0 -0
- package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/llm.cpython-312.pyc +0 -0
- package/codex-lens/pyproject.toml +43 -0
- package/codex-lens/src/codexlens/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__main__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__main__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/config.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/config.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/entities.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/entities.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/entities.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/env_config.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/env_config.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/env_config.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/errors.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/errors.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/embedding_manager.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/embedding_manager.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/embedding_manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/model_manager.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/model_manager.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/model_manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/output.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__pycache__/output.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/cli/commands.py +4416 -2295
- package/codex-lens/src/codexlens/cli/embedding_manager.py +777 -15
- package/codex-lens/src/codexlens/cli/model_manager.py +676 -0
- package/codex-lens/src/codexlens/config.py +356 -12
- package/codex-lens/src/codexlens/entities.py +4 -1
- package/codex-lens/src/codexlens/env_config.py +304 -0
- package/codex-lens/src/codexlens/indexing/__init__.py +23 -1
- package/codex-lens/src/codexlens/indexing/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/indexing/__pycache__/embedding.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/indexing/__pycache__/symbol_extractor.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/indexing/embedding.py +582 -0
- package/codex-lens/src/codexlens/indexing/symbol_extractor.py +62 -28
- package/codex-lens/src/codexlens/parsers/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/factory.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/factory.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/factory.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/tokenizer.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/tokenizer.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/factory.py +139 -10
- package/codex-lens/src/codexlens/parsers/treesitter_parser.py +487 -13
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/binary_searcher.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/enrichment.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/graph_expander.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/binary_searcher.py +277 -0
- package/codex-lens/src/codexlens/search/chain_search.py +1652 -8
- package/codex-lens/src/codexlens/search/enrichment.py +21 -0
- package/codex-lens/src/codexlens/search/graph_expander.py +264 -0
- package/codex-lens/src/codexlens/search/hybrid_search.py +772 -37
- package/codex-lens/src/codexlens/search/ranking.py +397 -8
- package/codex-lens/src/codexlens/semantic/SPLADE_IMPLEMENTATION.md +225 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/base.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/base.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/factory.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/factory.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/factory.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/gpu_support.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/gpu_support.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/gpu_support.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/litellm_embedder.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/litellm_embedder.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/litellm_embedder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/splade_encoder.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/splade_encoder.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/splade_encoder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/ann_index.py +654 -0
- package/codex-lens/src/codexlens/semantic/chunker.py +328 -23
- package/codex-lens/src/codexlens/semantic/factory.py +63 -3
- package/codex-lens/src/codexlens/semantic/gpu_support.py +19 -2
- package/codex-lens/src/codexlens/semantic/litellm_embedder.py +144 -144
- package/codex-lens/src/codexlens/semantic/reranker/__init__.py +25 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/api_reranker.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/api_reranker.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/api_reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/base.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/base.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/base.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/factory.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/factory.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/factory.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/fastembed_reranker.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/fastembed_reranker.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/fastembed_reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/legacy.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/legacy.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/legacy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/litellm_reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/onnx_reranker.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/onnx_reranker.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/__pycache__/onnx_reranker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/reranker/api_reranker.py +403 -0
- package/codex-lens/src/codexlens/semantic/reranker/base.py +46 -0
- package/codex-lens/src/codexlens/semantic/reranker/factory.py +159 -0
- package/codex-lens/src/codexlens/semantic/reranker/fastembed_reranker.py +257 -0
- package/codex-lens/src/codexlens/semantic/reranker/legacy.py +91 -0
- package/codex-lens/src/codexlens/semantic/reranker/litellm_reranker.py +214 -0
- package/codex-lens/src/codexlens/semantic/reranker/onnx_reranker.py +268 -0
- package/codex-lens/src/codexlens/semantic/splade_encoder.py +567 -0
- package/codex-lens/src/codexlens/semantic/vector_store.py +472 -352
- package/codex-lens/src/codexlens/storage/__init__.py +3 -0
- package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/global_index.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/global_index.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/merkle_tree.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/path_mapper.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/path_mapper.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/splade_index.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/splade_index.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/splade_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_utils.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/sqlite_utils.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/vector_meta_store.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/vector_meta_store.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/vector_meta_store.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/dir_index.py +310 -12
- package/codex-lens/src/codexlens/storage/index_tree.py +240 -25
- package/codex-lens/src/codexlens/storage/merkle_tree.py +136 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_006_enhance_relationships.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_007_add_graph_neighbors.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_007_add_graph_neighbors.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_007_add_graph_neighbors.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_008_add_merkle_hashes.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_009_add_splade.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_010_add_multi_vector_chunks.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_006_enhance_relationships.py +37 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_007_add_graph_neighbors.py +47 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_008_add_merkle_hashes.py +81 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_009_add_splade.py +103 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_010_add_multi_vector_chunks.py +162 -0
- package/codex-lens/src/codexlens/storage/splade_index.py +578 -0
- package/codex-lens/src/codexlens/storage/sqlite_store.py +508 -184
- package/codex-lens/src/codexlens/storage/vector_meta_store.py +415 -0
- package/codex-lens/src/codexlens/watcher/__init__.py +17 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/__init__.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/events.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/events.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/events.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/file_watcher.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/file_watcher.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/file_watcher.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/incremental_indexer.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/incremental_indexer.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/incremental_indexer.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/manager.cpython-310.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/manager.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/__pycache__/manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/watcher/events.py +82 -0
- package/codex-lens/src/codexlens/watcher/file_watcher.py +347 -0
- package/codex-lens/src/codexlens/watcher/incremental_indexer.py +369 -0
- package/codex-lens/src/codexlens/watcher/manager.py +255 -0
- package/package.json +4 -1
- package/.claude/commands/workflow/docs/analyze.md +0 -1467
- package/.claude/commands/workflow/docs/copyright.md +0 -1265
- package/.claude/skills/command-guide/SKILL.md +0 -388
- package/.claude/skills/command-guide/UPDATE-GUIDELINE.md +0 -592
- package/.claude/skills/command-guide/guides/cli-tools-guide.md +0 -410
- package/.claude/skills/command-guide/guides/examples.md +0 -537
- package/.claude/skills/command-guide/guides/getting-started.md +0 -242
- package/.claude/skills/command-guide/guides/implementation-details.md +0 -1010
- package/.claude/skills/command-guide/guides/index-structure.md +0 -326
- package/.claude/skills/command-guide/guides/troubleshooting.md +0 -92
- package/.claude/skills/command-guide/guides/ui-design-workflow-guide.md +0 -316
- package/.claude/skills/command-guide/guides/workflow-patterns.md +0 -662
- package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +0 -855
- package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +0 -267
- package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +0 -182
- package/.claude/skills/command-guide/reference/agents/cli-lite-planning-agent.md +0 -446
- package/.claude/skills/command-guide/reference/agents/cli-planning-agent.md +0 -558
- package/.claude/skills/command-guide/reference/agents/code-developer.md +0 -311
- package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +0 -308
- package/.claude/skills/command-guide/reference/agents/context-search-agent.md +0 -581
- package/.claude/skills/command-guide/reference/agents/doc-generator.md +0 -330
- package/.claude/skills/command-guide/reference/agents/memory-bridge.md +0 -94
- package/.claude/skills/command-guide/reference/agents/test-context-search-agent.md +0 -400
- package/.claude/skills/command-guide/reference/agents/test-fix-agent.md +0 -344
- package/.claude/skills/command-guide/reference/agents/ui-design-agent.md +0 -593
- package/.claude/skills/command-guide/reference/agents/universal-executor.md +0 -131
- package/.claude/skills/command-guide/reference/commands/cli/cli-init.md +0 -440
- package/.claude/skills/command-guide/reference/commands/enhance-prompt.md +0 -93
- package/.claude/skills/command-guide/reference/commands/memory/code-map-memory.md +0 -687
- package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +0 -471
- package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +0 -386
- package/.claude/skills/command-guide/reference/commands/memory/docs.md +0 -616
- package/.claude/skills/command-guide/reference/commands/memory/load-skill-memory.md +0 -182
- package/.claude/skills/command-guide/reference/commands/memory/load.md +0 -240
- package/.claude/skills/command-guide/reference/commands/memory/skill-memory.md +0 -525
- package/.claude/skills/command-guide/reference/commands/memory/style-skill-memory.md +0 -396
- package/.claude/skills/command-guide/reference/commands/memory/tech-research.md +0 -314
- package/.claude/skills/command-guide/reference/commands/memory/update-full.md +0 -332
- package/.claude/skills/command-guide/reference/commands/memory/update-related.md +0 -332
- package/.claude/skills/command-guide/reference/commands/memory/workflow-skill-memory.md +0 -517
- package/.claude/skills/command-guide/reference/commands/task/breakdown.md +0 -204
- package/.claude/skills/command-guide/reference/commands/task/create.md +0 -152
- package/.claude/skills/command-guide/reference/commands/task/execute.md +0 -270
- package/.claude/skills/command-guide/reference/commands/task/replan.md +0 -437
- package/.claude/skills/command-guide/reference/commands/version.md +0 -254
- package/.claude/skills/command-guide/reference/commands/workflow/action-plan-verify.md +0 -447
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/api-designer.md +0 -585
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/artifacts.md +0 -452
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +0 -443
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/data-architect.md +0 -220
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-manager.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-owner.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/scrum-master.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/synthesis.md +0 -398
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/system-architect.md +0 -387
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ui-designer.md +0 -221
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ux-expert.md +0 -221
- package/.claude/skills/command-guide/reference/commands/workflow/execute.md +0 -465
- package/.claude/skills/command-guide/reference/commands/workflow/init.md +0 -164
- package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +0 -748
- package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +0 -664
- package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +0 -645
- package/.claude/skills/command-guide/reference/commands/workflow/plan.md +0 -551
- package/.claude/skills/command-guide/reference/commands/workflow/replan.md +0 -515
- package/.claude/skills/command-guide/reference/commands/workflow/review-fix.md +0 -606
- package/.claude/skills/command-guide/reference/commands/workflow/review-module-cycle.md +0 -765
- package/.claude/skills/command-guide/reference/commands/workflow/review-session-cycle.md +0 -776
- package/.claude/skills/command-guide/reference/commands/workflow/review.md +0 -298
- package/.claude/skills/command-guide/reference/commands/workflow/session/complete.md +0 -547
- package/.claude/skills/command-guide/reference/commands/workflow/session/list.md +0 -114
- package/.claude/skills/command-guide/reference/commands/workflow/session/resume.md +0 -77
- package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +0 -257
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +0 -460
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-verify.md +0 -400
- package/.claude/skills/command-guide/reference/commands/workflow/test-cycle-execute.md +0 -498
- package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +0 -699
- package/.claude/skills/command-guide/reference/commands/workflow/test-gen.md +0 -529
- package/.claude/skills/command-guide/reference/commands/workflow/tools/conflict-resolution.md +0 -766
- package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +0 -433
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +0 -487
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +0 -518
- package/.claude/skills/command-guide/reference/commands/workflow/tools/tdd-coverage-analysis.md +0 -309
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-concept-enhanced.md +0 -163
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-context-gather.md +0 -232
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +0 -254
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/animation-extract.md +0 -1150
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/codify-style.md +0 -652
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/design-sync.md +0 -454
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/explore-auto.md +0 -678
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/generate.md +0 -504
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/imitate-auto.md +0 -745
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +0 -537
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/layout-extract.md +0 -788
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/reference-page-generator.md +0 -356
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/style-extract.md +0 -773
- package/.claude/skills/command-guide/scripts/analyze_commands.py +0 -502
- package/.claude/skills/command-guide/scripts/update-index.sh +0 -130
- package/.claude/skills/command-guide/templates/issue-bug.md +0 -104
- package/.claude/skills/command-guide/templates/issue-diagnosis.md +0 -275
- package/.claude/skills/command-guide/templates/issue-feature.md +0 -97
- package/.claude/skills/command-guide/templates/issue-question.md +0 -141
|
@@ -1,1467 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: analyze
|
|
3
|
-
description: Multi-phase iterative project analysis with user-guided focus, produces architecture/design/method reports through incremental updates
|
|
4
|
-
argument-hint: "[scope|path] [--type=architecture|design|methods|comprehensive]"
|
|
5
|
-
allowed-tools: Task(*), AskUserQuestion(*), Read(*), Bash(*), Glob(*), Grep(*), TodoWrite(*), Write(*)
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Workflow Docs Analyze Command (/workflow:docs:analyze)
|
|
9
|
-
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
**Iterative project analysis command** that guides users through multi-phase analysis to produce tailored project reports. Uses multi-agent collaboration with incremental report updates based on user feedback.
|
|
13
|
-
|
|
14
|
-
**Core Differentiator**: Unlike static analysis tools, this command engages in multi-round dialogue to understand user's specific focus areas and iteratively refines reports until user satisfaction.
|
|
15
|
-
|
|
16
|
-
## Report Types
|
|
17
|
-
|
|
18
|
-
| Type | Focus | Output |
|
|
19
|
-
|------|-------|--------|
|
|
20
|
-
| `architecture` | System structure, module relationships, dependencies | ARCHITECTURE-REPORT.md |
|
|
21
|
-
| `design` | Design patterns, class diagrams, component interactions | DESIGN-REPORT.md |
|
|
22
|
-
| `methods` | Key algorithms, critical paths, core functions explained | METHODS-REPORT.md |
|
|
23
|
-
| `comprehensive` | All above combined | COMPREHENSIVE-REPORT.md |
|
|
24
|
-
|
|
25
|
-
## Execution Philosophy
|
|
26
|
-
|
|
27
|
-
**User-Centric Iteration Model**:
|
|
28
|
-
1. **Discover** user's actual analysis needs (not assume)
|
|
29
|
-
2. **Explore** codebase from multiple angles
|
|
30
|
-
3. **Generate** initial report with clear structure
|
|
31
|
-
4. **Iterate** based on user feedback until satisfied
|
|
32
|
-
5. **Finalize** polished report
|
|
33
|
-
|
|
34
|
-
## Execution Process
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
Input Parsing:
|
|
38
|
-
├─ Parse: scope/path (optional, defaults to project root)
|
|
39
|
-
└─ Parse: --type flag (optional, determines initial focus)
|
|
40
|
-
|
|
41
|
-
Phase 1: Requirements Discovery (AskUserQuestion)
|
|
42
|
-
├─ Ask: Report type preference (if not specified)
|
|
43
|
-
├─ Ask: Focus areas within chosen type
|
|
44
|
-
├─ Ask: Depth level (overview/detailed/deep-dive)
|
|
45
|
-
└─ Output: analysis_config object
|
|
46
|
-
|
|
47
|
-
Phase 2: Project Exploration (cli-explore-agent)
|
|
48
|
-
├─ Execute: Parallel exploration by focus areas
|
|
49
|
-
├─ Generate: exploration-{angle}.json files
|
|
50
|
-
└─ Output: explorations-manifest.json
|
|
51
|
-
|
|
52
|
-
Phase 3: Deep Analysis (Gemini CLI)
|
|
53
|
-
├─ Execute: Multi-dimensional analysis
|
|
54
|
-
├─ Generate: analysis-{dimension}.json files
|
|
55
|
-
└─ Output: analysis-manifest.json
|
|
56
|
-
|
|
57
|
-
Phase 4: Initial Report Generation
|
|
58
|
-
├─ Synthesize: Merge all analysis results
|
|
59
|
-
├─ Generate: {TYPE}-REPORT.md (draft)
|
|
60
|
-
└─ Output: Present report to user
|
|
61
|
-
|
|
62
|
-
Phase 5: Iterative Refinement (Loop)
|
|
63
|
-
├─ Ask: User feedback on current report
|
|
64
|
-
├─ Decision:
|
|
65
|
-
│ ├─ "satisfied" → Finalize and exit
|
|
66
|
-
│ ├─ "expand section X" → Deep-dive specific area
|
|
67
|
-
│ ├─ "add details on Y" → Augment with new analysis
|
|
68
|
-
│ └─ "change focus" → Re-run Phase 3 with new config
|
|
69
|
-
└─ Update: Incremental report modification
|
|
70
|
-
|
|
71
|
-
Finalize:
|
|
72
|
-
└─ Output: Final {TYPE}-REPORT.md
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## 5-Phase Execution
|
|
76
|
-
|
|
77
|
-
### Phase 1: Requirements Discovery
|
|
78
|
-
|
|
79
|
-
**Purpose**: Understand user's actual analysis needs through interactive questioning
|
|
80
|
-
|
|
81
|
-
**Step 1.1: Initialize TodoWrite**
|
|
82
|
-
|
|
83
|
-
```javascript
|
|
84
|
-
TodoWrite([
|
|
85
|
-
{content: "Phase 1: Requirements Discovery", status: "in_progress", activeForm: "Discovering analysis requirements"},
|
|
86
|
-
{content: "Phase 2: Project Exploration", status: "pending", activeForm: "Exploring project structure"},
|
|
87
|
-
{content: "Phase 3: Deep Analysis", status: "pending", activeForm: "Performing deep analysis"},
|
|
88
|
-
{content: "Phase 4: Initial Report Generation", status: "pending", activeForm: "Generating initial report"},
|
|
89
|
-
{content: "Phase 5: Iterative Refinement", status: "pending", activeForm: "Refining report based on feedback"}
|
|
90
|
-
])
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Step 1.2: Report Type Selection (if not specified)**
|
|
94
|
-
|
|
95
|
-
```javascript
|
|
96
|
-
if (!type_specified) {
|
|
97
|
-
AskUserQuestion({
|
|
98
|
-
questions: [{
|
|
99
|
-
question: "What type of project analysis report would you like?",
|
|
100
|
-
header: "Report Type",
|
|
101
|
-
multiSelect: false,
|
|
102
|
-
options: [
|
|
103
|
-
{label: "Architecture (Recommended)", description: "System structure, module relationships, layer analysis, dependency graph"},
|
|
104
|
-
{label: "Design", description: "Design patterns, class relationships, component interactions, abstraction analysis"},
|
|
105
|
-
{label: "Methods", description: "Key algorithms, critical code paths, core function explanations with examples"},
|
|
106
|
-
{label: "Comprehensive", description: "All above combined into a complete project analysis"}
|
|
107
|
-
]
|
|
108
|
-
}]
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**Step 1.3: Focus Area Discovery**
|
|
114
|
-
|
|
115
|
-
```javascript
|
|
116
|
-
// Based on report type, ask focused questions
|
|
117
|
-
const focusQuestions = {
|
|
118
|
-
architecture: {
|
|
119
|
-
question: "Which architectural aspects are you most interested in?",
|
|
120
|
-
header: "Focus Areas",
|
|
121
|
-
multiSelect: true,
|
|
122
|
-
options: [
|
|
123
|
-
{label: "Layer Structure", description: "How the system is divided into layers (presentation, business, data)"},
|
|
124
|
-
{label: "Module Dependencies", description: "How modules depend on and communicate with each other"},
|
|
125
|
-
{label: "Entry Points", description: "How requests flow through the system from entry to response"},
|
|
126
|
-
{label: "Data Flow", description: "How data moves and transforms across the system"}
|
|
127
|
-
]
|
|
128
|
-
},
|
|
129
|
-
design: {
|
|
130
|
-
question: "Which design aspects do you want to understand?",
|
|
131
|
-
header: "Design Focus",
|
|
132
|
-
multiSelect: true,
|
|
133
|
-
options: [
|
|
134
|
-
{label: "Design Patterns", description: "Identify and explain patterns used in the codebase"},
|
|
135
|
-
{label: "Class Relationships", description: "Inheritance, composition, and associations between classes"},
|
|
136
|
-
{label: "Interface Contracts", description: "How components communicate through interfaces/protocols"},
|
|
137
|
-
{label: "State Management", description: "How application state is managed and mutated"}
|
|
138
|
-
]
|
|
139
|
-
},
|
|
140
|
-
methods: {
|
|
141
|
-
question: "What kind of method analysis do you need?",
|
|
142
|
-
header: "Method Focus",
|
|
143
|
-
multiSelect: true,
|
|
144
|
-
options: [
|
|
145
|
-
{label: "Core Algorithms", description: "Key algorithms that define the system's behavior"},
|
|
146
|
-
{label: "Critical Paths", description: "Most important execution flows in the application"},
|
|
147
|
-
{label: "Public APIs", description: "External-facing methods and their contracts"},
|
|
148
|
-
{label: "Complex Logic", description: "Methods with high cyclomatic complexity explained"}
|
|
149
|
-
]
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
AskUserQuestion({questions: [focusQuestions[selected_type]]})
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
**Step 1.4: Depth Level Selection**
|
|
157
|
-
|
|
158
|
-
```javascript
|
|
159
|
-
AskUserQuestion({
|
|
160
|
-
questions: [{
|
|
161
|
-
question: "How detailed should the analysis be?",
|
|
162
|
-
header: "Depth",
|
|
163
|
-
multiSelect: false,
|
|
164
|
-
options: [
|
|
165
|
-
{label: "Overview (Recommended)", description: "High-level understanding, suitable for onboarding or quick review"},
|
|
166
|
-
{label: "Detailed", description: "In-depth analysis with code examples and explanations"},
|
|
167
|
-
{label: "Deep-Dive", description: "Exhaustive analysis with implementation details and edge cases"}
|
|
168
|
-
]
|
|
169
|
-
}]
|
|
170
|
-
})
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**Step 1.5: Store Analysis Config**
|
|
174
|
-
|
|
175
|
-
```javascript
|
|
176
|
-
const analysis_config = {
|
|
177
|
-
type: selected_type,
|
|
178
|
-
focus_areas: selected_focus_areas,
|
|
179
|
-
depth: selected_depth,
|
|
180
|
-
scope: scope_path || ".",
|
|
181
|
-
timestamp: new Date().toISOString()
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
// Create output directory
|
|
185
|
-
const outputDir = `.workflow/.scratchpad/analyze-${Date.now()}`;
|
|
186
|
-
bash(`mkdir -p ${outputDir}`);
|
|
187
|
-
Write(`${outputDir}/analysis-config.json`, JSON.stringify(analysis_config, null, 2));
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
**TodoWrite**: Mark Phase 1 completed, Phase 2 in_progress
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
### Phase 2: Project Exploration
|
|
195
|
-
|
|
196
|
-
**Purpose**: Multi-angle exploration based on user's focus areas
|
|
197
|
-
|
|
198
|
-
**Step 2.1: Launch Parallel Explore Agents**
|
|
199
|
-
|
|
200
|
-
```javascript
|
|
201
|
-
const explorationAngles = mapFocusToAngles(analysis_config.focus_areas);
|
|
202
|
-
// Examples:
|
|
203
|
-
// - "Layer Structure" → ["architecture", "dependencies"]
|
|
204
|
-
// - "Design Patterns" → ["patterns", "abstractions"]
|
|
205
|
-
// - "Core Algorithms" → ["algorithms", "complexity"]
|
|
206
|
-
|
|
207
|
-
const explorationTasks = explorationAngles.map((angle, index) =>
|
|
208
|
-
Task({
|
|
209
|
-
subagent_type: "cli-explore-agent",
|
|
210
|
-
run_in_background: false,
|
|
211
|
-
description: `Explore: ${angle}`,
|
|
212
|
-
prompt: `
|
|
213
|
-
## Exploration Objective
|
|
214
|
-
Execute **${angle}** exploration for project analysis report.
|
|
215
|
-
|
|
216
|
-
## Context
|
|
217
|
-
- **Angle**: ${angle}
|
|
218
|
-
- **Report Type**: ${analysis_config.type}
|
|
219
|
-
- **Depth**: ${analysis_config.depth}
|
|
220
|
-
- **Scope**: ${analysis_config.scope}
|
|
221
|
-
- **Output**: ${outputDir}/exploration-${angle}.json
|
|
222
|
-
|
|
223
|
-
## Exploration Protocol
|
|
224
|
-
|
|
225
|
-
**Step 1: Structural Discovery**
|
|
226
|
-
- Execute: ccw tool exec get_modules_by_depth '{}'
|
|
227
|
-
- Find files relevant to ${angle} using rg/glob
|
|
228
|
-
- Map directory structure and module boundaries
|
|
229
|
-
|
|
230
|
-
**Step 2: Pattern Recognition**
|
|
231
|
-
- Identify ${angle}-related patterns and conventions
|
|
232
|
-
- Note file naming, organization patterns
|
|
233
|
-
- Extract key abstractions
|
|
234
|
-
|
|
235
|
-
**Step 3: Relationship Mapping**
|
|
236
|
-
- Map dependencies and relationships
|
|
237
|
-
- Identify integration points
|
|
238
|
-
- Note coupling and cohesion patterns
|
|
239
|
-
|
|
240
|
-
## Output Format
|
|
241
|
-
{
|
|
242
|
-
"angle": "${angle}",
|
|
243
|
-
"findings": {
|
|
244
|
-
"structure": [...],
|
|
245
|
-
"patterns": [...],
|
|
246
|
-
"relationships": [...],
|
|
247
|
-
"key_files": [{path, relevance, rationale}]
|
|
248
|
-
},
|
|
249
|
-
"insights": [...],
|
|
250
|
-
"depth_notes": "${analysis_config.depth}-specific observations"
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
Write output to: ${outputDir}/exploration-${angle}.json
|
|
254
|
-
`
|
|
255
|
-
})
|
|
256
|
-
);
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
**Step 2.2: Generate Exploration Manifest**
|
|
260
|
-
|
|
261
|
-
```javascript
|
|
262
|
-
const manifest = {
|
|
263
|
-
config: analysis_config,
|
|
264
|
-
explorations: explorationAngles.map(angle => ({
|
|
265
|
-
angle,
|
|
266
|
-
file: `exploration-${angle}.json`
|
|
267
|
-
})),
|
|
268
|
-
timestamp: new Date().toISOString()
|
|
269
|
-
};
|
|
270
|
-
Write(`${outputDir}/explorations-manifest.json`, JSON.stringify(manifest, null, 2));
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**TodoWrite**: Mark Phase 2 completed, Phase 3 in_progress
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
### Phase 3: Deep Analysis
|
|
278
|
-
|
|
279
|
-
**Purpose**: Use Gemini CLI for in-depth analysis based on exploration results
|
|
280
|
-
|
|
281
|
-
**Step 3.1: Synthesize Exploration Results**
|
|
282
|
-
|
|
283
|
-
```javascript
|
|
284
|
-
// Read all exploration files
|
|
285
|
-
const explorations = explorationAngles.map(angle =>
|
|
286
|
-
JSON.parse(Read(`${outputDir}/exploration-${angle}.json`))
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
// Extract key files to analyze
|
|
290
|
-
const keyFiles = explorations.flatMap(e => e.findings.key_files)
|
|
291
|
-
.sort((a, b) => b.relevance - a.relevance)
|
|
292
|
-
.slice(0, 20); // Top 20 most relevant files
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
**Step 3.2: Execute Deep Analysis via Gemini CLI**
|
|
296
|
-
|
|
297
|
-
```javascript
|
|
298
|
-
const analysisPrompt = buildAnalysisPrompt(analysis_config, keyFiles);
|
|
299
|
-
|
|
300
|
-
Bash({
|
|
301
|
-
command: `ccw cli -p "
|
|
302
|
-
PURPOSE: Generate ${analysis_config.type} analysis report for project
|
|
303
|
-
TASK:
|
|
304
|
-
• Analyze project structure and patterns from ${analysis_config.type} perspective
|
|
305
|
-
• Focus on: ${analysis_config.focus_areas.join(', ')}
|
|
306
|
-
• Depth level: ${analysis_config.depth}
|
|
307
|
-
• Key files to analyze: ${keyFiles.map(f => f.path).join(', ')}
|
|
308
|
-
MODE: analysis
|
|
309
|
-
CONTEXT: @**/* | Exploration results from ${outputDir}/
|
|
310
|
-
EXPECTED:
|
|
311
|
-
- Structured ${analysis_config.type} analysis
|
|
312
|
-
- Clear explanations with code references
|
|
313
|
-
- Mermaid diagrams where applicable
|
|
314
|
-
- Actionable insights
|
|
315
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) |
|
|
316
|
-
Focus on ${analysis_config.focus_areas.join(', ')} |
|
|
317
|
-
Depth: ${analysis_config.depth}
|
|
318
|
-
" --tool gemini --mode analysis`,
|
|
319
|
-
run_in_background: true,
|
|
320
|
-
timeout: 600000
|
|
321
|
-
});
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
**Step 3.3: Store Analysis Results**
|
|
325
|
-
|
|
326
|
-
```javascript
|
|
327
|
-
// After CLI completes, store structured results
|
|
328
|
-
Write(`${outputDir}/deep-analysis.json`, JSON.stringify({
|
|
329
|
-
type: analysis_config.type,
|
|
330
|
-
focus_areas: analysis_config.focus_areas,
|
|
331
|
-
analysis_result: cli_output,
|
|
332
|
-
diagrams: extracted_diagrams,
|
|
333
|
-
code_references: extracted_references
|
|
334
|
-
}, null, 2));
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
**TodoWrite**: Mark Phase 3 completed, Phase 3.5 in_progress
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
### Phase 3.5: Diagram Generation
|
|
342
|
-
|
|
343
|
-
**Purpose**: Generate Mermaid diagrams based on analysis results, tailored to report type
|
|
344
|
-
|
|
345
|
-
**Step 3.5.1: Determine Required Diagrams**
|
|
346
|
-
|
|
347
|
-
```javascript
|
|
348
|
-
// Map report types to required diagram types
|
|
349
|
-
const diagramRequirements = {
|
|
350
|
-
architecture: [
|
|
351
|
-
{type: 'architecture', format: 'graph TD', name: 'System Architecture'},
|
|
352
|
-
{type: 'layers', format: 'graph TD', name: 'Layer Structure'},
|
|
353
|
-
{type: 'dependencies', format: 'graph LR', name: 'Module Dependencies'},
|
|
354
|
-
{type: 'dataflow', format: 'flowchart LR', name: 'Data Flow'}
|
|
355
|
-
],
|
|
356
|
-
design: [
|
|
357
|
-
{type: 'class', format: 'classDiagram', name: 'Class Diagram'},
|
|
358
|
-
{type: 'components', format: 'graph TD', name: 'Component Diagram'},
|
|
359
|
-
{type: 'patterns', format: 'graph TD', name: 'Design Patterns'},
|
|
360
|
-
{type: 'state', format: 'stateDiagram-v2', name: 'State Management'}
|
|
361
|
-
],
|
|
362
|
-
methods: [
|
|
363
|
-
{type: 'algorithm', format: 'flowchart TD', name: 'Algorithm Flowchart'},
|
|
364
|
-
{type: 'sequence', format: 'sequenceDiagram', name: 'Call Sequence'},
|
|
365
|
-
{type: 'critical_path', format: 'flowchart LR', name: 'Critical Path'},
|
|
366
|
-
{type: 'api', format: 'graph LR', name: 'API Structure'}
|
|
367
|
-
],
|
|
368
|
-
comprehensive: [
|
|
369
|
-
{type: 'architecture', format: 'graph TD', name: 'System Architecture'},
|
|
370
|
-
{type: 'class', format: 'classDiagram', name: 'Class Diagram'},
|
|
371
|
-
{type: 'sequence', format: 'sequenceDiagram', name: 'Key Sequences'},
|
|
372
|
-
{type: 'dataflow', format: 'flowchart LR', name: 'Data Flow'}
|
|
373
|
-
]
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
const requiredDiagrams = diagramRequirements[config.type];
|
|
377
|
-
bash(`mkdir -p ${outputDir}/diagrams`);
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
**Step 3.5.2: Generate Architecture Diagrams (graph TD)**
|
|
381
|
-
|
|
382
|
-
```javascript
|
|
383
|
-
function generateArchitectureDiagram(analysis) {
|
|
384
|
-
let mermaid = 'graph TD\n';
|
|
385
|
-
|
|
386
|
-
// Subgraphs for layers/modules
|
|
387
|
-
const layers = analysis.structure?.layers || extractLayers(analysis);
|
|
388
|
-
for (const layer of layers) {
|
|
389
|
-
mermaid += ` subgraph ${sanitizeId(layer.name)}["${escapeLabel(layer.name)}"]\n`;
|
|
390
|
-
for (const component of layer.components || []) {
|
|
391
|
-
mermaid += ` ${sanitizeId(component.id)}["${escapeLabel(component.name)}"]\n`;
|
|
392
|
-
}
|
|
393
|
-
mermaid += ' end\n';
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// Connections
|
|
397
|
-
const connections = analysis.relationships || [];
|
|
398
|
-
for (const conn of connections) {
|
|
399
|
-
const label = conn.label ? `|"${escapeLabel(conn.label)}"|` : '';
|
|
400
|
-
mermaid += ` ${sanitizeId(conn.from)} -->${label} ${sanitizeId(conn.to)}\n`;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// Styling
|
|
404
|
-
mermaid += '\n %% Styling\n';
|
|
405
|
-
mermaid += ' classDef core fill:#e1f5fe,stroke:#01579b\n';
|
|
406
|
-
mermaid += ' classDef external fill:#fff3e0,stroke:#e65100\n';
|
|
407
|
-
|
|
408
|
-
return mermaid;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
if (requiredDiagrams.some(d => d.type === 'architecture')) {
|
|
412
|
-
const archDiagram = generateArchitectureDiagram(deepAnalysis);
|
|
413
|
-
Write(`${outputDir}/diagrams/architecture.mmd`, archDiagram);
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
**Step 3.5.3: Generate Layer/Dependency Diagrams**
|
|
418
|
-
|
|
419
|
-
```javascript
|
|
420
|
-
function generateLayerDiagram(analysis) {
|
|
421
|
-
let mermaid = 'graph TD\n';
|
|
422
|
-
|
|
423
|
-
const layers = ['Presentation', 'Application', 'Domain', 'Infrastructure'];
|
|
424
|
-
const detectedLayers = analysis.layers || inferLayers(analysis);
|
|
425
|
-
|
|
426
|
-
for (let i = 0; i < detectedLayers.length; i++) {
|
|
427
|
-
const layer = detectedLayers[i];
|
|
428
|
-
mermaid += ` subgraph L${i}["${escapeLabel(layer.name)}"]\n`;
|
|
429
|
-
mermaid += ` direction LR\n`;
|
|
430
|
-
for (const mod of layer.modules || []) {
|
|
431
|
-
mermaid += ` ${sanitizeId(mod)}["${escapeLabel(mod)}"]\n`;
|
|
432
|
-
}
|
|
433
|
-
mermaid += ' end\n';
|
|
434
|
-
|
|
435
|
-
if (i < detectedLayers.length - 1) {
|
|
436
|
-
mermaid += ` L${i} --> L${i + 1}\n`;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
return mermaid;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
function generateDependencyDiagram(analysis) {
|
|
444
|
-
let mermaid = 'graph LR\n';
|
|
445
|
-
|
|
446
|
-
const modules = analysis.modules || [];
|
|
447
|
-
const deps = analysis.dependencies || [];
|
|
448
|
-
|
|
449
|
-
// Nodes
|
|
450
|
-
for (const mod of modules) {
|
|
451
|
-
const shape = mod.type === 'core' ? '([' : '[';
|
|
452
|
-
const shapeEnd = mod.type === 'core' ? '])' : ']';
|
|
453
|
-
mermaid += ` ${sanitizeId(mod.name)}${shape}"${escapeLabel(mod.name)}"${shapeEnd}\n`;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// Edges with labels
|
|
457
|
-
for (const dep of deps) {
|
|
458
|
-
const style = dep.type === 'weak' ? '-.->' : '-->';
|
|
459
|
-
const label = dep.count ? `|"${dep.count} refs"|` : '';
|
|
460
|
-
mermaid += ` ${sanitizeId(dep.from)} ${style}${label} ${sanitizeId(dep.to)}\n`;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
return mermaid;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
if (requiredDiagrams.some(d => d.type === 'layers')) {
|
|
467
|
-
Write(`${outputDir}/diagrams/layers.mmd`, generateLayerDiagram(deepAnalysis));
|
|
468
|
-
}
|
|
469
|
-
if (requiredDiagrams.some(d => d.type === 'dependencies')) {
|
|
470
|
-
Write(`${outputDir}/diagrams/dependencies.mmd`, generateDependencyDiagram(deepAnalysis));
|
|
471
|
-
}
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
**Step 3.5.4: Generate Class Diagrams (classDiagram)**
|
|
475
|
-
|
|
476
|
-
```javascript
|
|
477
|
-
function generateClassDiagram(analysis) {
|
|
478
|
-
let mermaid = 'classDiagram\n';
|
|
479
|
-
|
|
480
|
-
const entities = analysis.entities || analysis.classes || [];
|
|
481
|
-
|
|
482
|
-
// Classes with properties and methods
|
|
483
|
-
for (const entity of entities.slice(0, 15)) { // Limit for readability
|
|
484
|
-
mermaid += ` class ${sanitizeId(entity.name)} {\n`;
|
|
485
|
-
|
|
486
|
-
// Properties
|
|
487
|
-
for (const prop of (entity.properties || []).slice(0, 8)) {
|
|
488
|
-
const vis = {public: '+', private: '-', protected: '#'}[prop.visibility] || '+';
|
|
489
|
-
mermaid += ` ${vis}${sanitizeType(prop.type)} ${prop.name}\n`;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// Methods
|
|
493
|
-
for (const method of (entity.methods || []).slice(0, 6)) {
|
|
494
|
-
const vis = {public: '+', private: '-', protected: '#'}[method.visibility] || '+';
|
|
495
|
-
const params = (method.params || []).map(p => `${p.name}`).join(', ');
|
|
496
|
-
mermaid += ` ${vis}${method.name}(${params}) ${sanitizeType(method.returnType || 'void')}\n`;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
mermaid += ' }\n';
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// Relationships
|
|
503
|
-
const relationships = analysis.relationships || [];
|
|
504
|
-
const arrows = {
|
|
505
|
-
inheritance: '--|>',
|
|
506
|
-
implementation: '..|>',
|
|
507
|
-
composition: '*--',
|
|
508
|
-
aggregation: 'o--',
|
|
509
|
-
association: '-->',
|
|
510
|
-
dependency: '..>'
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
for (const rel of relationships) {
|
|
514
|
-
const arrow = arrows[rel.type] || '-->';
|
|
515
|
-
const label = rel.label ? ` : ${escapeLabel(rel.label)}` : '';
|
|
516
|
-
mermaid += ` ${sanitizeId(rel.from)} ${arrow} ${sanitizeId(rel.to)}${label}\n`;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
return mermaid;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
if (requiredDiagrams.some(d => d.type === 'class')) {
|
|
523
|
-
Write(`${outputDir}/diagrams/class-diagram.mmd`, generateClassDiagram(deepAnalysis));
|
|
524
|
-
}
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
**Step 3.5.5: Generate Flowcharts (flowchart TD)**
|
|
528
|
-
|
|
529
|
-
```javascript
|
|
530
|
-
function generateAlgorithmFlowchart(algorithm) {
|
|
531
|
-
let mermaid = 'flowchart TD\n';
|
|
532
|
-
|
|
533
|
-
// Start
|
|
534
|
-
mermaid += ` START(["Start: ${escapeLabel(algorithm.name)}"])\n`;
|
|
535
|
-
|
|
536
|
-
// Input processing
|
|
537
|
-
if (algorithm.inputs?.length > 0) {
|
|
538
|
-
mermaid += ` INPUT[/"Input: ${algorithm.inputs.map(i => i.name).join(', ')}"/]\n`;
|
|
539
|
-
mermaid += ' START --> INPUT\n';
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
// Process steps
|
|
543
|
-
let prevNode = algorithm.inputs?.length > 0 ? 'INPUT' : 'START';
|
|
544
|
-
for (let i = 0; i < (algorithm.steps || []).length; i++) {
|
|
545
|
-
const step = algorithm.steps[i];
|
|
546
|
-
const nodeId = `STEP${i}`;
|
|
547
|
-
|
|
548
|
-
if (step.type === 'decision') {
|
|
549
|
-
mermaid += ` ${nodeId}{"${escapeLabel(step.description)}"}\n`;
|
|
550
|
-
mermaid += ` ${prevNode} --> ${nodeId}\n`;
|
|
551
|
-
if (step.yes_branch) {
|
|
552
|
-
mermaid += ` ${nodeId} -->|"Yes"| ${sanitizeId(step.yes_branch)}\n`;
|
|
553
|
-
}
|
|
554
|
-
if (step.no_branch) {
|
|
555
|
-
mermaid += ` ${nodeId} -->|"No"| ${sanitizeId(step.no_branch)}\n`;
|
|
556
|
-
}
|
|
557
|
-
} else {
|
|
558
|
-
mermaid += ` ${nodeId}["${escapeLabel(step.description)}"]\n`;
|
|
559
|
-
mermaid += ` ${prevNode} --> ${nodeId}\n`;
|
|
560
|
-
}
|
|
561
|
-
prevNode = nodeId;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// Output and end
|
|
565
|
-
mermaid += ` OUTPUT[/"Output: ${escapeLabel(algorithm.output || 'Result')}"/]\n`;
|
|
566
|
-
mermaid += ` ${prevNode} --> OUTPUT\n`;
|
|
567
|
-
mermaid += ' END_([End])\n';
|
|
568
|
-
mermaid += ' OUTPUT --> END_\n';
|
|
569
|
-
|
|
570
|
-
return mermaid;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
function generateDataFlowDiagram(analysis) {
|
|
574
|
-
let mermaid = 'flowchart LR\n';
|
|
575
|
-
|
|
576
|
-
const flows = analysis.dataFlows || [];
|
|
577
|
-
|
|
578
|
-
// Data stores
|
|
579
|
-
mermaid += ' subgraph DataStores["Data Stores"]\n';
|
|
580
|
-
for (const store of analysis.dataStores || []) {
|
|
581
|
-
mermaid += ` ${sanitizeId(store.id)}[("${escapeLabel(store.name)}")]\n`;
|
|
582
|
-
}
|
|
583
|
-
mermaid += ' end\n';
|
|
584
|
-
|
|
585
|
-
// Processes
|
|
586
|
-
mermaid += ' subgraph Processes["Processes"]\n';
|
|
587
|
-
for (const proc of analysis.processes || []) {
|
|
588
|
-
mermaid += ` ${sanitizeId(proc.id)}["${escapeLabel(proc.name)}"]\n`;
|
|
589
|
-
}
|
|
590
|
-
mermaid += ' end\n';
|
|
591
|
-
|
|
592
|
-
// Flows
|
|
593
|
-
for (const flow of flows) {
|
|
594
|
-
mermaid += ` ${sanitizeId(flow.from)} -->|"${escapeLabel(flow.data)}"| ${sanitizeId(flow.to)}\n`;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
return mermaid;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
// Generate algorithm flowcharts
|
|
601
|
-
const algorithms = deepAnalysis.algorithms || [];
|
|
602
|
-
for (const algo of algorithms.slice(0, 3)) { // Top 3 algorithms
|
|
603
|
-
const flowchart = generateAlgorithmFlowchart(algo);
|
|
604
|
-
Write(`${outputDir}/diagrams/algorithm-${sanitizeId(algo.name)}.mmd`, flowchart);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
if (requiredDiagrams.some(d => d.type === 'dataflow')) {
|
|
608
|
-
Write(`${outputDir}/diagrams/dataflow.mmd`, generateDataFlowDiagram(deepAnalysis));
|
|
609
|
-
}
|
|
610
|
-
```
|
|
611
|
-
|
|
612
|
-
**Step 3.5.6: Generate Sequence Diagrams (sequenceDiagram)**
|
|
613
|
-
|
|
614
|
-
```javascript
|
|
615
|
-
function generateSequenceDiagram(scenario) {
|
|
616
|
-
let mermaid = 'sequenceDiagram\n';
|
|
617
|
-
|
|
618
|
-
// Title
|
|
619
|
-
mermaid += ` title ${escapeLabel(scenario.name)}\n`;
|
|
620
|
-
|
|
621
|
-
// Participants
|
|
622
|
-
for (const actor of scenario.actors || []) {
|
|
623
|
-
const type = actor.type === 'external' ? 'actor' : 'participant';
|
|
624
|
-
mermaid += ` ${type} ${sanitizeId(actor.id)} as ${escapeLabel(actor.name)}\n`;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
mermaid += '\n';
|
|
628
|
-
|
|
629
|
-
// Messages
|
|
630
|
-
for (const msg of scenario.messages || []) {
|
|
631
|
-
let arrow;
|
|
632
|
-
switch (msg.type) {
|
|
633
|
-
case 'async': arrow = '->>'; break;
|
|
634
|
-
case 'response': arrow = '-->>'; break;
|
|
635
|
-
case 'create': arrow = '->>+'; break;
|
|
636
|
-
case 'destroy': arrow = '->>-'; break;
|
|
637
|
-
default: arrow = '->>';
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
mermaid += ` ${sanitizeId(msg.from)}${arrow}${sanitizeId(msg.to)}: ${escapeLabel(msg.description)}\n`;
|
|
641
|
-
|
|
642
|
-
// Activations
|
|
643
|
-
if (msg.activate) {
|
|
644
|
-
mermaid += ` activate ${sanitizeId(msg.to)}\n`;
|
|
645
|
-
}
|
|
646
|
-
if (msg.deactivate) {
|
|
647
|
-
mermaid += ` deactivate ${sanitizeId(msg.from)}\n`;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
// Notes
|
|
651
|
-
if (msg.note) {
|
|
652
|
-
mermaid += ` Note over ${sanitizeId(msg.to)}: ${escapeLabel(msg.note)}\n`;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// Loops and conditions
|
|
657
|
-
for (const block of scenario.blocks || []) {
|
|
658
|
-
if (block.type === 'loop') {
|
|
659
|
-
mermaid += ` loop ${escapeLabel(block.condition)}\n`;
|
|
660
|
-
for (const m of block.messages) {
|
|
661
|
-
mermaid += ` ${sanitizeId(m.from)}->>${sanitizeId(m.to)}: ${escapeLabel(m.description)}\n`;
|
|
662
|
-
}
|
|
663
|
-
mermaid += ' end\n';
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
return mermaid;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
// Generate sequence diagrams for key scenarios
|
|
671
|
-
const scenarios = deepAnalysis.sequences || deepAnalysis.scenarios || [];
|
|
672
|
-
for (const scenario of scenarios.slice(0, 3)) {
|
|
673
|
-
const seqDiagram = generateSequenceDiagram(scenario);
|
|
674
|
-
Write(`${outputDir}/diagrams/sequence-${sanitizeId(scenario.name)}.mmd`, seqDiagram);
|
|
675
|
-
}
|
|
676
|
-
```
|
|
677
|
-
|
|
678
|
-
**Step 3.5.7: Generate State Diagrams (stateDiagram-v2)**
|
|
679
|
-
|
|
680
|
-
```javascript
|
|
681
|
-
function generateStateDiagram(stateAnalysis) {
|
|
682
|
-
let mermaid = 'stateDiagram-v2\n';
|
|
683
|
-
|
|
684
|
-
const states = stateAnalysis.states || [];
|
|
685
|
-
const transitions = stateAnalysis.transitions || [];
|
|
686
|
-
|
|
687
|
-
// States
|
|
688
|
-
for (const state of states) {
|
|
689
|
-
if (state.type === 'initial') {
|
|
690
|
-
mermaid += ` [*] --> ${sanitizeId(state.name)}\n`;
|
|
691
|
-
} else if (state.type === 'final') {
|
|
692
|
-
mermaid += ` ${sanitizeId(state.name)} --> [*]\n`;
|
|
693
|
-
} else if (state.substates) {
|
|
694
|
-
mermaid += ` state ${sanitizeId(state.name)} {\n`;
|
|
695
|
-
for (const sub of state.substates) {
|
|
696
|
-
mermaid += ` ${sanitizeId(sub.name)}\n`;
|
|
697
|
-
}
|
|
698
|
-
mermaid += ' }\n';
|
|
699
|
-
} else {
|
|
700
|
-
mermaid += ` ${sanitizeId(state.name)} : ${escapeLabel(state.description || state.name)}\n`;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
// Transitions
|
|
705
|
-
for (const trans of transitions) {
|
|
706
|
-
const label = trans.event ? ` : ${escapeLabel(trans.event)}` : '';
|
|
707
|
-
mermaid += ` ${sanitizeId(trans.from)} --> ${sanitizeId(trans.to)}${label}\n`;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
return mermaid;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
if (requiredDiagrams.some(d => d.type === 'state')) {
|
|
714
|
-
const stateAnalysis = deepAnalysis.stateManagement || {};
|
|
715
|
-
if (stateAnalysis.states?.length > 0) {
|
|
716
|
-
Write(`${outputDir}/diagrams/state.mmd`, generateStateDiagram(stateAnalysis));
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
**Step 3.5.8: Helper Functions & Validation**
|
|
722
|
-
|
|
723
|
-
```javascript
|
|
724
|
-
// Sanitize ID for Mermaid (only alphanumeric and underscore)
|
|
725
|
-
function sanitizeId(text) {
|
|
726
|
-
return text.replace(/[^a-zA-Z0-9_]/g, '_').replace(/^[0-9]/, '_$&');
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
// Escape special characters in labels
|
|
730
|
-
function escapeLabel(text) {
|
|
731
|
-
if (!text) return '';
|
|
732
|
-
return text
|
|
733
|
-
.replace(/"/g, "'")
|
|
734
|
-
.replace(/[(){}[\]<>]/g, char => `#${char.charCodeAt(0)};`)
|
|
735
|
-
.substring(0, 50); // Limit length
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
// Sanitize type names
|
|
739
|
-
function sanitizeType(type) {
|
|
740
|
-
if (!type) return 'any';
|
|
741
|
-
return type.replace(/[<>]/g, '').replace(/\|/g, ' or ');
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
// Validate all generated diagrams
|
|
745
|
-
function validateMermaidDiagrams(diagramDir) {
|
|
746
|
-
const files = Glob(`${diagramDir}/*.mmd`);
|
|
747
|
-
const results = [];
|
|
748
|
-
|
|
749
|
-
for (const file of files) {
|
|
750
|
-
const content = Read(file);
|
|
751
|
-
const issues = [];
|
|
752
|
-
|
|
753
|
-
// Check for common syntax errors
|
|
754
|
-
if (content.includes('undefined')) issues.push('Contains undefined');
|
|
755
|
-
if (content.match(/-->.*-->/)) issues.push('Double arrow syntax');
|
|
756
|
-
if (!content.match(/^(graph|flowchart|classDiagram|sequenceDiagram|stateDiagram)/m)) {
|
|
757
|
-
issues.push('Missing diagram type declaration');
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
// Check for unescaped special chars in labels
|
|
761
|
-
const labelMatches = content.match(/\["[^"]*[(){}[\]<>][^"]*"\]/g);
|
|
762
|
-
if (labelMatches?.some(m => !m.includes('#'))) {
|
|
763
|
-
issues.push('Unescaped special characters in labels');
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
results.push({
|
|
767
|
-
file: file.split('/').pop(),
|
|
768
|
-
valid: issues.length === 0,
|
|
769
|
-
issues
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
return results;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
const validationResults = validateMermaidDiagrams(`${outputDir}/diagrams`);
|
|
777
|
-
Write(`${outputDir}/diagrams/validation.json`, JSON.stringify(validationResults, null, 2));
|
|
778
|
-
|
|
779
|
-
// Log validation summary
|
|
780
|
-
const validCount = validationResults.filter(r => r.valid).length;
|
|
781
|
-
console.log(`Diagram Validation: ${validCount}/${validationResults.length} passed`);
|
|
782
|
-
```
|
|
783
|
-
|
|
784
|
-
**Step 3.5.9: Generate Diagram Manifest**
|
|
785
|
-
|
|
786
|
-
```javascript
|
|
787
|
-
const diagramManifest = {
|
|
788
|
-
report_type: config.type,
|
|
789
|
-
generated_at: new Date().toISOString(),
|
|
790
|
-
diagrams: requiredDiagrams.map(req => {
|
|
791
|
-
const filename = `${req.type}.mmd`;
|
|
792
|
-
const exists = file_exists(`${outputDir}/diagrams/${filename}`);
|
|
793
|
-
return {
|
|
794
|
-
type: req.type,
|
|
795
|
-
format: req.format,
|
|
796
|
-
name: req.name,
|
|
797
|
-
filename: exists ? filename : null,
|
|
798
|
-
status: exists ? 'generated' : 'skipped'
|
|
799
|
-
};
|
|
800
|
-
}),
|
|
801
|
-
validation: validationResults
|
|
802
|
-
};
|
|
803
|
-
|
|
804
|
-
Write(`${outputDir}/diagrams/manifest.json`, JSON.stringify(diagramManifest, null, 2));
|
|
805
|
-
```
|
|
806
|
-
|
|
807
|
-
**TodoWrite**: Mark Phase 3.5 completed, Phase 4 in_progress
|
|
808
|
-
|
|
809
|
-
---
|
|
810
|
-
|
|
811
|
-
### Phase 4: Initial Report Generation
|
|
812
|
-
|
|
813
|
-
**Purpose**: Synthesize all analysis into structured report
|
|
814
|
-
|
|
815
|
-
**Step 4.1: Load All Analysis Data and Diagrams**
|
|
816
|
-
|
|
817
|
-
```javascript
|
|
818
|
-
const config = JSON.parse(Read(`${outputDir}/analysis-config.json`));
|
|
819
|
-
const explorations = JSON.parse(Read(`${outputDir}/explorations-manifest.json`));
|
|
820
|
-
const deepAnalysis = JSON.parse(Read(`${outputDir}/deep-analysis.json`));
|
|
821
|
-
const diagramManifest = JSON.parse(Read(`${outputDir}/diagrams/manifest.json`));
|
|
822
|
-
|
|
823
|
-
// Load all generated diagrams
|
|
824
|
-
const diagrams = {};
|
|
825
|
-
for (const diag of diagramManifest.diagrams.filter(d => d.status === 'generated')) {
|
|
826
|
-
diagrams[diag.type] = Read(`${outputDir}/diagrams/${diag.filename}`);
|
|
827
|
-
}
|
|
828
|
-
```
|
|
829
|
-
|
|
830
|
-
**Step 4.2: Generate Report Structure**
|
|
831
|
-
|
|
832
|
-
```javascript
|
|
833
|
-
const reportTemplate = getReportTemplate(config.type);
|
|
834
|
-
// Templates define section structure for each report type
|
|
835
|
-
|
|
836
|
-
const reportSections = {
|
|
837
|
-
architecture: [
|
|
838
|
-
"# Architecture Report",
|
|
839
|
-
"## Executive Summary",
|
|
840
|
-
"## System Overview",
|
|
841
|
-
"## Layer Analysis",
|
|
842
|
-
"## Module Dependencies",
|
|
843
|
-
"## Data Flow",
|
|
844
|
-
"## Entry Points & Critical Paths",
|
|
845
|
-
"## Dependency Graph (Mermaid)",
|
|
846
|
-
"## Recommendations"
|
|
847
|
-
],
|
|
848
|
-
design: [
|
|
849
|
-
"# Design Report",
|
|
850
|
-
"## Executive Summary",
|
|
851
|
-
"## Design Patterns Used",
|
|
852
|
-
"## Class Relationships",
|
|
853
|
-
"## Interface Contracts",
|
|
854
|
-
"## State Management",
|
|
855
|
-
"## Component Diagrams (Mermaid)",
|
|
856
|
-
"## Design Recommendations"
|
|
857
|
-
],
|
|
858
|
-
methods: [
|
|
859
|
-
"# Key Methods Report",
|
|
860
|
-
"## Executive Summary",
|
|
861
|
-
"## Core Algorithms",
|
|
862
|
-
"## Critical Code Paths",
|
|
863
|
-
"## Public API Reference",
|
|
864
|
-
"## Complex Logic Breakdown",
|
|
865
|
-
"## Sequence Diagrams (Mermaid)",
|
|
866
|
-
"## Optimization Suggestions"
|
|
867
|
-
],
|
|
868
|
-
comprehensive: [
|
|
869
|
-
"# Comprehensive Project Analysis",
|
|
870
|
-
"## Executive Summary",
|
|
871
|
-
"## Architecture Overview",
|
|
872
|
-
"## Design Patterns & Principles",
|
|
873
|
-
"## Key Methods & Algorithms",
|
|
874
|
-
"## System Diagrams",
|
|
875
|
-
"## Recommendations & Next Steps"
|
|
876
|
-
]
|
|
877
|
-
};
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
**Step 4.3: Generate Initial Report**
|
|
881
|
-
|
|
882
|
-
```javascript
|
|
883
|
-
const reportPath = `${outputDir}/${config.type.toUpperCase()}-REPORT.md`;
|
|
884
|
-
const report = generateReport(reportSections[config.type], explorations, deepAnalysis);
|
|
885
|
-
Write(reportPath, report);
|
|
886
|
-
```
|
|
887
|
-
|
|
888
|
-
**Step 4.4: Present to User**
|
|
889
|
-
|
|
890
|
-
```markdown
|
|
891
|
-
## Initial Report Generated
|
|
892
|
-
|
|
893
|
-
**Report Type**: ${config.type}
|
|
894
|
-
**Focus Areas**: ${config.focus_areas.join(', ')}
|
|
895
|
-
**Depth**: ${config.depth}
|
|
896
|
-
|
|
897
|
-
**Output**: ${reportPath}
|
|
898
|
-
|
|
899
|
-
### Report Preview
|
|
900
|
-
[First 50 lines of report...]
|
|
901
|
-
|
|
902
|
-
---
|
|
903
|
-
**Ready for your feedback.** The report can be refined based on your input.
|
|
904
|
-
```
|
|
905
|
-
|
|
906
|
-
**TodoWrite**: Mark Phase 4 completed, Phase 5 in_progress
|
|
907
|
-
|
|
908
|
-
---
|
|
909
|
-
|
|
910
|
-
### Phase 5: Iterative Refinement (Discovery-Driven)
|
|
911
|
-
|
|
912
|
-
**Purpose**: Generate targeted questions based on agent analysis findings, then refine report based on user responses
|
|
913
|
-
|
|
914
|
-
**Core Philosophy**: Questions are NOT predetermined. They emerge from what the agent discovered during analysis.
|
|
915
|
-
|
|
916
|
-
**Step 5.1: Extract Discoveries from Analysis**
|
|
917
|
-
|
|
918
|
-
```javascript
|
|
919
|
-
// Parse deep analysis results for actionable discoveries
|
|
920
|
-
function extractDiscoveries(deepAnalysis) {
|
|
921
|
-
return {
|
|
922
|
-
// Ambiguities: Areas where analysis found multiple interpretations
|
|
923
|
-
ambiguities: deepAnalysis.findings.filter(f => f.confidence < 0.7),
|
|
924
|
-
|
|
925
|
-
// Complexity hotspots: Areas that may need deeper explanation
|
|
926
|
-
complexityHotspots: deepAnalysis.findings.filter(f => f.complexity === 'high'),
|
|
927
|
-
|
|
928
|
-
// Pattern variations: Where code deviates from expected patterns
|
|
929
|
-
patternDeviations: deepAnalysis.patterns.filter(p => p.consistency < 0.8),
|
|
930
|
-
|
|
931
|
-
// Unclear dependencies: Relationships that couldn't be fully traced
|
|
932
|
-
unclearDependencies: deepAnalysis.dependencies.filter(d => d.type === 'implicit'),
|
|
933
|
-
|
|
934
|
-
// Potential issues: Areas flagged for attention
|
|
935
|
-
potentialIssues: deepAnalysis.recommendations.filter(r => r.priority === 'investigate'),
|
|
936
|
-
|
|
937
|
-
// Depth opportunities: Sections that could benefit from expansion
|
|
938
|
-
depthOpportunities: deepAnalysis.sections.filter(s => s.has_more_detail)
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
const discoveries = extractDiscoveries(deepAnalysis);
|
|
943
|
-
```
|
|
944
|
-
|
|
945
|
-
**Step 5.2: Generate Dynamic Questions Based on Discoveries**
|
|
946
|
-
|
|
947
|
-
```javascript
|
|
948
|
-
function buildDynamicQuestions(discoveries, config) {
|
|
949
|
-
const questions = [];
|
|
950
|
-
|
|
951
|
-
// Question 1: Address ambiguities found
|
|
952
|
-
if (discoveries.ambiguities.length > 0) {
|
|
953
|
-
const topAmbiguity = discoveries.ambiguities[0];
|
|
954
|
-
questions.push({
|
|
955
|
-
question: `Analysis found ambiguity in "${topAmbiguity.area}": ${topAmbiguity.description}. Which interpretation is correct?`,
|
|
956
|
-
header: "Clarify",
|
|
957
|
-
multiSelect: false,
|
|
958
|
-
options: topAmbiguity.interpretations.map((interp, i) => ({
|
|
959
|
-
label: interp.summary,
|
|
960
|
-
description: interp.detail
|
|
961
|
-
}))
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
// Question 2: Complexity deep-dive selection
|
|
966
|
-
if (discoveries.complexityHotspots.length > 0) {
|
|
967
|
-
questions.push({
|
|
968
|
-
question: `These areas have high complexity. Which would you like explained in more detail?`,
|
|
969
|
-
header: "Deep-Dive",
|
|
970
|
-
multiSelect: true,
|
|
971
|
-
options: discoveries.complexityHotspots.slice(0, 4).map(h => ({
|
|
972
|
-
label: h.name,
|
|
973
|
-
description: `${h.file}:${h.line} - ${h.brief}`
|
|
974
|
-
}))
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
// Question 3: Pattern deviation confirmation
|
|
979
|
-
if (discoveries.patternDeviations.length > 0) {
|
|
980
|
-
const deviation = discoveries.patternDeviations[0];
|
|
981
|
-
questions.push({
|
|
982
|
-
question: `Found pattern inconsistency: "${deviation.pattern}" is used differently in ${deviation.locations.length} places. Should I analyze this deviation?`,
|
|
983
|
-
header: "Patterns",
|
|
984
|
-
multiSelect: false,
|
|
985
|
-
options: [
|
|
986
|
-
{label: "Yes, analyze differences", description: "Add detailed comparison to report"},
|
|
987
|
-
{label: "Skip, it's intentional", description: "Note as intentional variation"},
|
|
988
|
-
{label: "Flag as tech debt", description: "Add to recommendations section"}
|
|
989
|
-
]
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
// Question 4: Dependency clarification
|
|
994
|
-
if (discoveries.unclearDependencies.length > 0) {
|
|
995
|
-
questions.push({
|
|
996
|
-
question: `Found ${discoveries.unclearDependencies.length} implicit dependencies. Should I trace them fully?`,
|
|
997
|
-
header: "Dependencies",
|
|
998
|
-
multiSelect: false,
|
|
999
|
-
options: [
|
|
1000
|
-
{label: "Yes, trace all (Recommended)", description: "Complete dependency graph, may take longer"},
|
|
1001
|
-
{label: "Only critical paths", description: "Focus on main execution flows"},
|
|
1002
|
-
{label: "Skip for now", description: "Keep current analysis level"}
|
|
1003
|
-
]
|
|
1004
|
-
});
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
// Always include satisfaction check as final question
|
|
1008
|
-
questions.push({
|
|
1009
|
-
question: "How would you like to proceed with the current report?",
|
|
1010
|
-
header: "Action",
|
|
1011
|
-
multiSelect: false,
|
|
1012
|
-
options: [
|
|
1013
|
-
{label: "Continue refining", description: "Apply above selections and show next discoveries"},
|
|
1014
|
-
{label: "Finalize report", description: "Report meets my needs, generate final version"},
|
|
1015
|
-
{label: "Change scope", description: "Adjust focus areas or analysis depth"}
|
|
1016
|
-
]
|
|
1017
|
-
});
|
|
1018
|
-
|
|
1019
|
-
return questions.slice(0, 4); // Max 4 questions per iteration
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
const dynamicQuestions = buildDynamicQuestions(discoveries, config);
|
|
1023
|
-
AskUserQuestion({questions: dynamicQuestions});
|
|
1024
|
-
```
|
|
1025
|
-
|
|
1026
|
-
**Step 5.3: Process User Responses and Update Analysis**
|
|
1027
|
-
|
|
1028
|
-
```javascript
|
|
1029
|
-
function processResponses(responses, discoveries, deepAnalysis) {
|
|
1030
|
-
const updates = [];
|
|
1031
|
-
|
|
1032
|
-
// Handle ambiguity resolution
|
|
1033
|
-
if (responses.clarify) {
|
|
1034
|
-
const resolution = {
|
|
1035
|
-
area: discoveries.ambiguities[0].area,
|
|
1036
|
-
resolved_to: responses.clarify,
|
|
1037
|
-
confidence: 1.0 // User confirmed
|
|
1038
|
-
};
|
|
1039
|
-
updates.push({type: 'resolve_ambiguity', data: resolution});
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
// Handle deep-dive requests
|
|
1043
|
-
if (responses.deepDive && responses.deepDive.length > 0) {
|
|
1044
|
-
const deepDiveTargets = responses.deepDive;
|
|
1045
|
-
updates.push({type: 'expand_sections', data: deepDiveTargets});
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
// Handle pattern deviation response
|
|
1049
|
-
if (responses.patterns) {
|
|
1050
|
-
updates.push({type: 'pattern_handling', data: responses.patterns});
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
// Handle dependency tracing
|
|
1054
|
-
if (responses.dependencies) {
|
|
1055
|
-
updates.push({type: 'dependency_depth', data: responses.dependencies});
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
return updates;
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
const updates = processResponses(user_responses, discoveries, deepAnalysis);
|
|
1062
|
-
```
|
|
1063
|
-
|
|
1064
|
-
**Step 5.4: Incremental Analysis & Report Update**
|
|
1065
|
-
|
|
1066
|
-
```javascript
|
|
1067
|
-
// Execute targeted re-analysis based on user responses
|
|
1068
|
-
async function applyUpdates(updates, outputDir, config) {
|
|
1069
|
-
for (const update of updates) {
|
|
1070
|
-
switch (update.type) {
|
|
1071
|
-
case 'expand_sections':
|
|
1072
|
-
// Re-run Gemini CLI for specific sections only
|
|
1073
|
-
for (const target of update.data) {
|
|
1074
|
-
Bash({
|
|
1075
|
-
command: `ccw cli -p "
|
|
1076
|
-
PURPOSE: Deep-dive analysis of ${target.name}
|
|
1077
|
-
TASK: Provide detailed explanation of ${target.file}:${target.line}
|
|
1078
|
-
• Trace execution flow step by step
|
|
1079
|
-
• Explain complex logic with examples
|
|
1080
|
-
• Show relationships to other components
|
|
1081
|
-
MODE: analysis
|
|
1082
|
-
CONTEXT: @${target.file} | Previous analysis from ${outputDir}/
|
|
1083
|
-
EXPECTED: Detailed section content for report insertion
|
|
1084
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md)
|
|
1085
|
-
" --tool gemini --mode analysis`,
|
|
1086
|
-
run_in_background: true
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
break;
|
|
1090
|
-
|
|
1091
|
-
case 'resolve_ambiguity':
|
|
1092
|
-
// Update analysis with confirmed interpretation
|
|
1093
|
-
deepAnalysis.findings = deepAnalysis.findings.map(f =>
|
|
1094
|
-
f.area === update.data.area
|
|
1095
|
-
? {...f, interpretation: update.data.resolved_to, confidence: 1.0}
|
|
1096
|
-
: f
|
|
1097
|
-
);
|
|
1098
|
-
break;
|
|
1099
|
-
|
|
1100
|
-
case 'dependency_depth':
|
|
1101
|
-
if (update.data === 'Yes, trace all (Recommended)') {
|
|
1102
|
-
// Launch dependency tracing agent
|
|
1103
|
-
Task({
|
|
1104
|
-
subagent_type: "cli-explore-agent",
|
|
1105
|
-
description: "Trace full dependencies",
|
|
1106
|
-
prompt: `Trace all implicit dependencies found in ${outputDir}/deep-analysis.json`
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
break;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
await applyUpdates(updates, outputDir, config);
|
|
1115
|
-
|
|
1116
|
-
// Regenerate report sections affected by updates
|
|
1117
|
-
const currentReport = Read(reportPath);
|
|
1118
|
-
const updatedSections = regenerateAffectedSections(currentReport, updates);
|
|
1119
|
-
Write(reportPath, updatedSections);
|
|
1120
|
-
Write(`${outputDir}/iterations/v${iteration_count}.md`, currentReport); // Archive previous version
|
|
1121
|
-
```
|
|
1122
|
-
|
|
1123
|
-
**Step 5.5: Check Termination or Continue Loop**
|
|
1124
|
-
|
|
1125
|
-
```javascript
|
|
1126
|
-
iteration_count++;
|
|
1127
|
-
|
|
1128
|
-
if (user_responses.action === 'Finalize report') {
|
|
1129
|
-
// Exit refinement loop
|
|
1130
|
-
finalized = true;
|
|
1131
|
-
} else if (user_responses.action === 'Change scope') {
|
|
1132
|
-
// Return to Phase 1 for scope adjustment
|
|
1133
|
-
goto Phase1_Step1_3; // Focus area selection
|
|
1134
|
-
} else {
|
|
1135
|
-
// Extract new discoveries from updated analysis
|
|
1136
|
-
const newDiscoveries = extractDiscoveries(deepAnalysis);
|
|
1137
|
-
|
|
1138
|
-
if (newDiscoveries.total_count === 0) {
|
|
1139
|
-
// No more discoveries to clarify
|
|
1140
|
-
console.log("All ambiguities resolved. Report is comprehensive.");
|
|
1141
|
-
AskUserQuestion({
|
|
1142
|
-
questions: [{
|
|
1143
|
-
question: "No further clarifications needed. Finalize the report?",
|
|
1144
|
-
header: "Complete",
|
|
1145
|
-
multiSelect: false,
|
|
1146
|
-
options: [
|
|
1147
|
-
{label: "Yes, finalize", description: "Generate final polished report"},
|
|
1148
|
-
{label: "Add custom section", description: "I want to add something specific"}
|
|
1149
|
-
]
|
|
1150
|
-
}]
|
|
1151
|
-
});
|
|
1152
|
-
} else {
|
|
1153
|
-
// Continue with next round of discovery-driven questions
|
|
1154
|
-
goto Step5.2;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
// Safety limit
|
|
1159
|
-
if (iteration_count > 7) {
|
|
1160
|
-
console.log("Maximum refinement iterations reached. Finalizing report.");
|
|
1161
|
-
finalized = true;
|
|
1162
|
-
}
|
|
1163
|
-
```
|
|
1164
|
-
|
|
1165
|
-
**Step 5.6: Discovery Summary Between Iterations**
|
|
1166
|
-
|
|
1167
|
-
```javascript
|
|
1168
|
-
// Show user what was learned in this iteration
|
|
1169
|
-
function summarizeIteration(iteration_count, updates, discoveries) {
|
|
1170
|
-
return `
|
|
1171
|
-
### Iteration ${iteration_count} Summary
|
|
1172
|
-
|
|
1173
|
-
**Clarifications Applied**: ${updates.filter(u => u.type === 'resolve_ambiguity').length}
|
|
1174
|
-
**Sections Expanded**: ${updates.filter(u => u.type === 'expand_sections').length}
|
|
1175
|
-
**Patterns Addressed**: ${updates.filter(u => u.type === 'pattern_handling').length}
|
|
1176
|
-
|
|
1177
|
-
**Remaining Discoveries**:
|
|
1178
|
-
- Ambiguities: ${discoveries.ambiguities.length}
|
|
1179
|
-
- Complexity hotspots: ${discoveries.complexityHotspots.length}
|
|
1180
|
-
- Pattern deviations: ${discoveries.patternDeviations.length}
|
|
1181
|
-
|
|
1182
|
-
**Report Sections Updated**: [list affected sections]
|
|
1183
|
-
`;
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
console.log(summarizeIteration(iteration_count, updates, discoveries));
|
|
1187
|
-
```
|
|
1188
|
-
|
|
1189
|
-
---
|
|
1190
|
-
|
|
1191
|
-
### Finalization
|
|
1192
|
-
|
|
1193
|
-
**Step 6.1: Polish Final Report**
|
|
1194
|
-
|
|
1195
|
-
```javascript
|
|
1196
|
-
// Add metadata and finalize formatting
|
|
1197
|
-
const finalReport = `
|
|
1198
|
-
<!-- Generated by /workflow:docs:analyze -->
|
|
1199
|
-
<!-- Type: ${config.type} | Focus: ${config.focus_areas.join(', ')} | Depth: ${config.depth} -->
|
|
1200
|
-
<!-- Generated: ${new Date().toISOString()} | Iterations: ${iteration_count} -->
|
|
1201
|
-
|
|
1202
|
-
${report_content}
|
|
1203
|
-
|
|
1204
|
-
---
|
|
1205
|
-
*Report generated through ${iteration_count} refinement iterations.*
|
|
1206
|
-
`;
|
|
1207
|
-
|
|
1208
|
-
Write(reportPath, finalReport);
|
|
1209
|
-
```
|
|
1210
|
-
|
|
1211
|
-
**Step 6.2: Summary Output**
|
|
1212
|
-
|
|
1213
|
-
```markdown
|
|
1214
|
-
## Analysis Complete
|
|
1215
|
-
|
|
1216
|
-
**Final Report**: ${reportPath}
|
|
1217
|
-
**Report Type**: ${config.type}
|
|
1218
|
-
**Focus Areas**: ${config.focus_areas.join(', ')}
|
|
1219
|
-
**Refinement Iterations**: ${iteration_count}
|
|
1220
|
-
|
|
1221
|
-
### Report Contents
|
|
1222
|
-
- ${section_count} sections
|
|
1223
|
-
- ${diagram_count} Mermaid diagrams
|
|
1224
|
-
- ${code_reference_count} code references
|
|
1225
|
-
|
|
1226
|
-
### Recommended Next Steps
|
|
1227
|
-
1. Share report with team members
|
|
1228
|
-
2. Use findings to guide development decisions
|
|
1229
|
-
3. Run `/workflow:plan` to create implementation tasks based on recommendations
|
|
1230
|
-
```
|
|
1231
|
-
|
|
1232
|
-
**TodoWrite**: Mark Phase 5 completed
|
|
1233
|
-
|
|
1234
|
-
---
|
|
1235
|
-
|
|
1236
|
-
## TodoWrite Pattern
|
|
1237
|
-
|
|
1238
|
-
**Dynamic Task Tracking** with phase-level visibility:
|
|
1239
|
-
|
|
1240
|
-
```javascript
|
|
1241
|
-
// Initial state
|
|
1242
|
-
[
|
|
1243
|
-
{content: "Phase 1: Requirements Discovery", status: "pending", activeForm: "Discovering analysis requirements"},
|
|
1244
|
-
{content: "Phase 2: Project Exploration", status: "pending", activeForm: "Exploring project structure"},
|
|
1245
|
-
{content: "Phase 3: Deep Analysis", status: "pending", activeForm: "Performing deep analysis"},
|
|
1246
|
-
{content: "Phase 3.5: Diagram Generation", status: "pending", activeForm: "Generating Mermaid diagrams"},
|
|
1247
|
-
{content: "Phase 4: Initial Report Generation", status: "pending", activeForm: "Generating initial report"},
|
|
1248
|
-
{content: "Phase 5: Iterative Refinement", status: "pending", activeForm: "Refining report based on feedback"}
|
|
1249
|
-
]
|
|
1250
|
-
|
|
1251
|
-
// During Phase 3.5, show diagram generation progress
|
|
1252
|
-
[
|
|
1253
|
-
{content: "Phase 1: Requirements Discovery", status: "completed", activeForm: "Discovering analysis requirements"},
|
|
1254
|
-
{content: "Phase 2: Project Exploration", status: "completed", activeForm: "Exploring project structure"},
|
|
1255
|
-
{content: "Phase 3: Deep Analysis", status: "completed", activeForm: "Performing deep analysis"},
|
|
1256
|
-
{content: "Phase 3.5: Diagram Generation", status: "in_progress", activeForm: "Generating Mermaid diagrams"},
|
|
1257
|
-
{content: " → Architecture diagram", status: "completed", activeForm: "Generating architecture diagram"},
|
|
1258
|
-
{content: " → Class diagram", status: "in_progress", activeForm: "Generating class diagram"},
|
|
1259
|
-
{content: " → Sequence diagrams", status: "pending", activeForm: "Generating sequence diagrams"},
|
|
1260
|
-
{content: "Phase 4: Initial Report Generation", status: "pending", activeForm: "Generating initial report"},
|
|
1261
|
-
{content: "Phase 5: Iterative Refinement", status: "pending", activeForm: "Refining report based on feedback"}
|
|
1262
|
-
]
|
|
1263
|
-
|
|
1264
|
-
// During Phase 5 iterations, expand to show current refinement
|
|
1265
|
-
[
|
|
1266
|
-
{content: "Phase 1: Requirements Discovery", status: "completed", activeForm: "Discovering analysis requirements"},
|
|
1267
|
-
{content: "Phase 2: Project Exploration", status: "completed", activeForm: "Exploring project structure"},
|
|
1268
|
-
{content: "Phase 3: Deep Analysis", status: "completed", activeForm: "Performing deep analysis"},
|
|
1269
|
-
{content: "Phase 3.5: Diagram Generation", status: "completed", activeForm: "Generating Mermaid diagrams"},
|
|
1270
|
-
{content: "Phase 4: Initial Report Generation", status: "completed", activeForm: "Generating initial report"},
|
|
1271
|
-
{content: "Phase 5: Iterative Refinement", status: "in_progress", activeForm: "Refining report based on feedback"},
|
|
1272
|
-
{content: " → Iteration 2: Expanding Architecture section", status: "in_progress", activeForm: "Expanding section"}
|
|
1273
|
-
]
|
|
1274
|
-
```
|
|
1275
|
-
|
|
1276
|
-
## Usage Examples
|
|
1277
|
-
|
|
1278
|
-
```bash
|
|
1279
|
-
# Interactive analysis (prompts for all preferences)
|
|
1280
|
-
/workflow:docs:analyze
|
|
1281
|
-
|
|
1282
|
-
# Architecture report for specific directory
|
|
1283
|
-
/workflow:docs:analyze src/core --type=architecture
|
|
1284
|
-
|
|
1285
|
-
# Design patterns analysis
|
|
1286
|
-
/workflow:docs:analyze --type=design
|
|
1287
|
-
|
|
1288
|
-
# Comprehensive analysis of entire project
|
|
1289
|
-
/workflow:docs:analyze --type=comprehensive
|
|
1290
|
-
|
|
1291
|
-
# Key methods analysis for API module
|
|
1292
|
-
/workflow:docs:analyze src/api --type=methods
|
|
1293
|
-
```
|
|
1294
|
-
|
|
1295
|
-
## Output Structure
|
|
1296
|
-
|
|
1297
|
-
```
|
|
1298
|
-
.workflow/.scratchpad/analyze-{timestamp}/
|
|
1299
|
-
├── analysis-config.json # User's analysis preferences
|
|
1300
|
-
├── exploration-{angle}.json # Per-angle exploration results
|
|
1301
|
-
├── explorations-manifest.json # Exploration summary
|
|
1302
|
-
├── deep-analysis.json # Gemini CLI analysis output
|
|
1303
|
-
├── diagrams/ # Generated Mermaid diagrams
|
|
1304
|
-
│ ├── manifest.json # Diagram generation manifest
|
|
1305
|
-
│ ├── validation.json # Syntax validation results
|
|
1306
|
-
│ ├── architecture.mmd # System architecture (graph TD)
|
|
1307
|
-
│ ├── layers.mmd # Layer structure (graph TD)
|
|
1308
|
-
│ ├── dependencies.mmd # Module dependencies (graph LR)
|
|
1309
|
-
│ ├── class-diagram.mmd # Class relationships (classDiagram)
|
|
1310
|
-
│ ├── dataflow.mmd # Data flow (flowchart LR)
|
|
1311
|
-
│ ├── algorithm-*.mmd # Algorithm flowcharts (flowchart TD)
|
|
1312
|
-
│ ├── sequence-*.mmd # Call sequences (sequenceDiagram)
|
|
1313
|
-
│ └── state.mmd # State transitions (stateDiagram-v2)
|
|
1314
|
-
├── {TYPE}-REPORT.md # Final report (main output)
|
|
1315
|
-
└── iterations/ # Refinement history
|
|
1316
|
-
├── v1-initial.md
|
|
1317
|
-
├── v2-expanded.md
|
|
1318
|
-
└── ...
|
|
1319
|
-
```
|
|
1320
|
-
|
|
1321
|
-
## Report Quality Standards
|
|
1322
|
-
|
|
1323
|
-
**All reports must include**:
|
|
1324
|
-
1. **Executive Summary**: 3-5 key takeaways
|
|
1325
|
-
2. **Visual Diagrams**: Mermaid syntax for architecture/flow visualization
|
|
1326
|
-
3. **Code References**: `file:line` format for easy navigation
|
|
1327
|
-
4. **Actionable Insights**: Specific recommendations, not generic advice
|
|
1328
|
-
5. **Consistent Depth**: Match user's selected depth level throughout
|
|
1329
|
-
|
|
1330
|
-
**Quality Gates**:
|
|
1331
|
-
- [ ] All focus areas addressed
|
|
1332
|
-
- [ ] Diagrams render correctly (Mermaid syntax valid)
|
|
1333
|
-
- [ ] Code references are accurate (files exist)
|
|
1334
|
-
- [ ] No placeholder content
|
|
1335
|
-
- [ ] Recommendations are project-specific
|
|
1336
|
-
|
|
1337
|
-
## Error Handling
|
|
1338
|
-
|
|
1339
|
-
| Error | Recovery |
|
|
1340
|
-
|-------|----------|
|
|
1341
|
-
| CLI timeout | Reduce scope, retry with fewer files |
|
|
1342
|
-
| Exploration failure | Fall back to direct file reading |
|
|
1343
|
-
| User abandons iteration | Save current progress, allow resume |
|
|
1344
|
-
| Invalid scope path | Prompt user to correct path |
|
|
1345
|
-
|
|
1346
|
-
## Related Commands
|
|
1347
|
-
|
|
1348
|
-
**Prerequisite Commands**:
|
|
1349
|
-
- None required (can be run independently)
|
|
1350
|
-
|
|
1351
|
-
**Follow-up Commands**:
|
|
1352
|
-
- `/workflow:plan` - Create implementation tasks from recommendations
|
|
1353
|
-
- `/memory:docs` - Generate project documentation
|
|
1354
|
-
- `/workflow:review` - Review specific areas identified in analysis
|
|
1355
|
-
|
|
1356
|
-
**Alternative Commands**:
|
|
1357
|
-
- `/memory:code-map-memory` - For feature-specific code mapping
|
|
1358
|
-
- `/memory:load` - For quick context loading without reports
|
|
1359
|
-
|
|
1360
|
-
---
|
|
1361
|
-
|
|
1362
|
-
## Mermaid Diagram Specifications
|
|
1363
|
-
|
|
1364
|
-
### Diagram Types by Report
|
|
1365
|
-
|
|
1366
|
-
| Report Type | Diagrams Generated |
|
|
1367
|
-
|-------------|-------------------|
|
|
1368
|
-
| `architecture` | architecture.mmd, layers.mmd, dependencies.mmd, dataflow.mmd |
|
|
1369
|
-
| `design` | class-diagram.mmd, components.mmd, patterns.mmd, state.mmd |
|
|
1370
|
-
| `methods` | algorithm-*.mmd, sequence-*.mmd, critical-path.mmd, api.mmd |
|
|
1371
|
-
| `comprehensive` | architecture.mmd, class-diagram.mmd, sequence-*.mmd, dataflow.mmd |
|
|
1372
|
-
|
|
1373
|
-
### Syntax Rules (Ensuring Valid Diagrams)
|
|
1374
|
-
|
|
1375
|
-
```javascript
|
|
1376
|
-
// 1. Node IDs: Only alphanumeric and underscore
|
|
1377
|
-
sanitizeId("User-Service") → "User_Service"
|
|
1378
|
-
sanitizeId("3rdParty") → "_3rdParty"
|
|
1379
|
-
|
|
1380
|
-
// 2. Labels: Escape special characters with HTML entities
|
|
1381
|
-
escapeLabel("Process(data)") → "Process#40;data#41;"
|
|
1382
|
-
escapeLabel("Check {valid?}") → "Check #123;valid?#125;"
|
|
1383
|
-
|
|
1384
|
-
// 3. Edge labels: Always use double quotes
|
|
1385
|
-
// ✓ Correct
|
|
1386
|
-
A -->|"calls(param)"| B
|
|
1387
|
-
|
|
1388
|
-
// ✗ Wrong
|
|
1389
|
-
A -->|calls(param)| B
|
|
1390
|
-
|
|
1391
|
-
// 4. Subgraph titles: Use quoted labels
|
|
1392
|
-
// ✓ Correct
|
|
1393
|
-
subgraph ServiceLayer["Service Layer (Core)"]
|
|
1394
|
-
|
|
1395
|
-
// ✗ Wrong
|
|
1396
|
-
subgraph ServiceLayer[Service Layer (Core)]
|
|
1397
|
-
```
|
|
1398
|
-
|
|
1399
|
-
### Diagram Format Examples
|
|
1400
|
-
|
|
1401
|
-
**Architecture (graph TD)**:
|
|
1402
|
-
```mermaid
|
|
1403
|
-
graph TD
|
|
1404
|
-
subgraph Presentation["Presentation Layer"]
|
|
1405
|
-
API["API Gateway"]
|
|
1406
|
-
CLI["CLI Interface"]
|
|
1407
|
-
end
|
|
1408
|
-
subgraph Business["Business Layer"]
|
|
1409
|
-
SVC["Core Services"]
|
|
1410
|
-
end
|
|
1411
|
-
API --> SVC
|
|
1412
|
-
CLI --> SVC
|
|
1413
|
-
```
|
|
1414
|
-
|
|
1415
|
-
**Class Diagram (classDiagram)**:
|
|
1416
|
-
```mermaid
|
|
1417
|
-
classDiagram
|
|
1418
|
-
class UserService {
|
|
1419
|
-
+string name
|
|
1420
|
-
+getUser(id) User
|
|
1421
|
-
-validate() boolean
|
|
1422
|
-
}
|
|
1423
|
-
class Repository {
|
|
1424
|
-
<<interface>>
|
|
1425
|
-
+find(id) Entity
|
|
1426
|
-
}
|
|
1427
|
-
UserService --> Repository : uses
|
|
1428
|
-
```
|
|
1429
|
-
|
|
1430
|
-
**Sequence Diagram (sequenceDiagram)**:
|
|
1431
|
-
```mermaid
|
|
1432
|
-
sequenceDiagram
|
|
1433
|
-
participant C as Client
|
|
1434
|
-
participant S as Server
|
|
1435
|
-
participant D as Database
|
|
1436
|
-
C->>S: request(data)
|
|
1437
|
-
activate S
|
|
1438
|
-
S->>D: query
|
|
1439
|
-
D-->>S: result
|
|
1440
|
-
S-->>C: response
|
|
1441
|
-
deactivate S
|
|
1442
|
-
```
|
|
1443
|
-
|
|
1444
|
-
**Flowchart (flowchart TD)**:
|
|
1445
|
-
```mermaid
|
|
1446
|
-
flowchart TD
|
|
1447
|
-
START(["Start"])
|
|
1448
|
-
INPUT[/"Read input"/]
|
|
1449
|
-
CHECK{"Valid?"}
|
|
1450
|
-
PROCESS["Process data"]
|
|
1451
|
-
OUTPUT[/"Write output"/]
|
|
1452
|
-
END_(["End"])
|
|
1453
|
-
|
|
1454
|
-
START --> INPUT --> CHECK
|
|
1455
|
-
CHECK -->|"Yes"| PROCESS --> OUTPUT --> END_
|
|
1456
|
-
CHECK -->|"No"| END_
|
|
1457
|
-
```
|
|
1458
|
-
|
|
1459
|
-
### Validation Checks
|
|
1460
|
-
|
|
1461
|
-
The diagram generator validates:
|
|
1462
|
-
- [ ] Diagram type declaration present
|
|
1463
|
-
- [ ] No `undefined` values in output
|
|
1464
|
-
- [ ] Special characters properly escaped
|
|
1465
|
-
- [ ] No double arrow syntax errors
|
|
1466
|
-
- [ ] Subgraph brackets balanced
|
|
1467
|
-
- [ ] Node IDs are valid identifiers
|