claude-code-workflow 6.3.32 → 6.3.34
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 +6 -1
- package/.claude/agents/action-planning-agent.md +885 -885
- package/.claude/agents/cli-discuss-agent.md +391 -391
- package/.claude/agents/cli-execution-agent.md +7 -6
- package/.claude/agents/cli-lite-planning-agent.md +1 -1
- package/.claude/agents/cli-planning-agent.md +2 -2
- package/.claude/agents/code-developer.md +407 -403
- package/.claude/agents/conceptual-planning-agent.md +11 -0
- package/.claude/agents/debug-explore-agent.md +3 -3
- package/.claude/agents/doc-generator.md +3 -3
- package/.claude/agents/issue-plan-agent.md +333 -340
- package/.claude/agents/issue-queue-agent.md +1 -1
- package/.claude/agents/memory-bridge.md +95 -95
- package/.claude/agents/test-context-search-agent.md +402 -402
- package/.claude/agents/ui-design-agent.md +595 -595
- package/.claude/agents/universal-executor.md +134 -134
- package/.claude/commands/cli/codex-review.md +355 -0
- package/.claude/commands/issue/discover-by-prompt.md +1 -1
- package/.claude/commands/issue/execute.md +581 -581
- package/.claude/commands/issue/new.md +413 -413
- package/.claude/commands/issue/plan.md +1 -1
- package/.claude/commands/issue/queue.md +441 -382
- package/.claude/commands/memory/code-map-memory.md +687 -687
- package/.claude/commands/memory/compact.md +383 -383
- package/.claude/commands/memory/docs-full-cli.md +471 -471
- package/.claude/commands/memory/docs-related-cli.md +386 -386
- package/.claude/commands/memory/docs.md +615 -615
- package/.claude/commands/memory/load-skill-memory.md +182 -182
- package/.claude/commands/memory/skill-memory.md +525 -525
- package/.claude/commands/memory/style-skill-memory.md +396 -396
- package/.claude/commands/memory/swagger-docs.md +773 -773
- package/.claude/commands/memory/tech-research-rules.md +2 -2
- package/.claude/commands/memory/update-full.md +332 -332
- package/.claude/commands/memory/workflow-skill-memory.md +517 -517
- package/.claude/commands/task/create.md +151 -151
- package/.claude/commands/task/replan.md +436 -436
- package/.claude/commands/version.md +254 -254
- package/.claude/commands/workflow/brainstorm/api-designer.md +587 -587
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +11 -0
- package/.claude/commands/workflow/brainstorm/data-architect.md +220 -220
- package/.claude/commands/workflow/brainstorm/product-manager.md +200 -200
- package/.claude/commands/workflow/brainstorm/product-owner.md +200 -200
- package/.claude/commands/workflow/brainstorm/scrum-master.md +200 -200
- package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
- package/.claude/commands/workflow/brainstorm/system-architect.md +389 -389
- package/.claude/commands/workflow/brainstorm/ui-designer.md +221 -221
- package/.claude/commands/workflow/brainstorm/ux-expert.md +221 -221
- package/.claude/commands/workflow/debug-with-file.md +666 -0
- package/.claude/commands/workflow/debug.md +327 -327
- package/.claude/commands/workflow/execute.md +498 -498
- package/.claude/commands/workflow/lite-execute.md +23 -20
- package/.claude/commands/workflow/lite-fix.md +631 -631
- package/.claude/commands/workflow/lite-lite-lite.md +39 -11
- package/.claude/commands/workflow/lite-plan.md +4 -2
- package/.claude/commands/workflow/multi-cli-plan.md +97 -39
- package/.claude/commands/workflow/plan.md +551 -551
- package/.claude/commands/workflow/replan.md +515 -515
- package/.claude/commands/workflow/review-fix.md +610 -610
- package/.claude/commands/workflow/review-module-cycle.md +771 -771
- package/.claude/commands/workflow/review-session-cycle.md +782 -782
- package/.claude/commands/workflow/review.md +322 -322
- package/.claude/commands/workflow/session/list.md +95 -95
- package/.claude/commands/workflow/session/resume.md +60 -60
- package/.claude/commands/workflow/session/solidify.md +299 -299
- package/.claude/commands/workflow/tdd-plan.md +597 -460
- package/.claude/commands/workflow/test-cycle-execute.md +504 -504
- package/.claude/commands/workflow/test-fix-gen.md +699 -699
- package/.claude/commands/workflow/tools/conflict-resolution.md +2 -2
- package/.claude/commands/workflow/tools/task-generate-tdd.md +517 -517
- package/.claude/commands/workflow/tools/tdd-coverage-analysis.md +309 -309
- package/.claude/commands/workflow/tools/test-concept-enhanced.md +1 -1
- package/.claude/commands/workflow/tools/test-context-gather.md +235 -235
- package/.claude/commands/workflow/tools/test-task-generate.md +255 -255
- package/.claude/commands/workflow/ui-design/animation-extract.md +1150 -1150
- package/.claude/commands/workflow/ui-design/design-sync.md +454 -454
- package/.claude/commands/workflow/ui-design/explore-auto.md +678 -678
- package/.claude/commands/workflow/ui-design/imitate-auto.md +745 -745
- package/.claude/commands/workflow/ui-design/layout-extract.md +788 -788
- package/.claude/commands/workflow/ui-design/reference-page-generator.md +356 -356
- package/.claude/commands/workflow/ui-design/style-extract.md +773 -773
- package/.claude/skills/ccw/SKILL.md +522 -352
- package/.claude/skills/ccw/command.json +641 -547
- package/.claude/skills/ccw-help/SKILL.md +116 -116
- package/.claude/skills/ccw-help/command.json +520 -520
- package/.claude/skills/copyright-docs/phases/01.5-project-exploration.md +150 -150
- package/.claude/skills/copyright-docs/phases/02.5-consolidation.md +192 -192
- package/.claude/skills/copyright-docs/templates/agent-base.md +200 -200
- package/.claude/skills/project-analyze/phases/03.5-consolidation.md +233 -233
- package/.claude/skills/project-analyze/specs/writing-style.md +152 -152
- package/.claude/skills/review-code/phases/state-manager.md +752 -752
- package/.claude/skills/review-code/specs/rules/index.md +140 -140
- package/.claude/skills/skill-generator/specs/cli-integration.md +13 -19
- package/.claude/skills/skill-generator/specs/scripting-integration.md +265 -265
- package/.claude/skills/skill-generator/templates/code-analysis-action.md +503 -503
- package/.claude/skills/skill-generator/templates/llm-action.md +355 -355
- package/.claude/skills/skill-generator/templates/script-bash.md +277 -277
- package/.claude/skills/skill-generator/templates/script-python.md +198 -198
- package/.claude/skills/skill-generator/templates/skill-md.md +235 -235
- package/.claude/skills/skill-tuning/SKILL.md +303 -303
- package/.claude/skills/skill-tuning/phases/actions/action-abort.md +164 -164
- package/.claude/skills/skill-tuning/phases/actions/action-apply-fix.md +206 -206
- package/.claude/skills/skill-tuning/phases/actions/action-complete.md +195 -195
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-agent.md +317 -317
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-context.md +243 -243
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-dataflow.md +318 -318
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-memory.md +269 -269
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-token-consumption.md +200 -200
- package/.claude/skills/skill-tuning/phases/actions/action-gemini-analysis.md +322 -322
- package/.claude/skills/skill-tuning/phases/actions/action-generate-report.md +228 -228
- package/.claude/skills/skill-tuning/phases/actions/action-init.md +149 -149
- package/.claude/skills/skill-tuning/phases/actions/action-propose-fixes.md +317 -317
- package/.claude/skills/skill-tuning/phases/actions/action-verify.md +222 -222
- package/.claude/skills/skill-tuning/phases/orchestrator.md +377 -377
- package/.claude/skills/skill-tuning/phases/state-schema.md +378 -378
- package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +318 -318
- package/.claude/skills/skill-tuning/specs/quality-gates.md +263 -263
- package/.claude/skills/skill-tuning/specs/tuning-strategies.md +1537 -1537
- package/.claude/skills/skill-tuning/templates/diagnosis-report.md +153 -153
- package/.claude/skills/skill-tuning/templates/fix-proposal.md +204 -204
- package/.claude/skills/software-manual/SKILL.md +184 -184
- package/.claude/skills/software-manual/phases/01-requirements-discovery.md +162 -162
- package/.claude/skills/software-manual/phases/02-project-exploration.md +101 -101
- package/.claude/skills/software-manual/phases/03-parallel-analysis.md +183 -183
- package/.claude/skills/software-manual/phases/03.5-consolidation.md +82 -82
- package/.claude/skills/software-manual/phases/04-screenshot-capture.md +89 -89
- package/.claude/skills/software-manual/phases/05-html-assembly.md +132 -132
- package/.claude/skills/software-manual/phases/06-iterative-refinement.md +259 -259
- package/.claude/skills/software-manual/scripts/screenshot-helper.md +447 -447
- package/.claude/skills/software-manual/scripts/swagger-runner.md +419 -419
- package/.claude/skills/software-manual/scripts/typedoc-runner.md +357 -357
- package/.claude/skills/software-manual/specs/html-template.md +325 -325
- package/.claude/skills/software-manual/specs/quality-standards.md +253 -253
- package/.claude/skills/software-manual/specs/writing-style.md +298 -298
- package/.claude/skills/text-formatter/SKILL.md +196 -196
- package/.claude/skills/text-formatter/phases/01-input-collection.md +111 -111
- package/.claude/skills/text-formatter/phases/02-content-analysis.md +248 -248
- package/.claude/skills/text-formatter/phases/03-format-transform.md +245 -245
- package/.claude/skills/text-formatter/phases/04-output-preview.md +183 -183
- package/.claude/skills/text-formatter/specs/callout-types.md +293 -293
- package/.claude/skills/text-formatter/specs/element-mapping.md +226 -226
- package/.claude/skills/text-formatter/specs/format-rules.md +273 -273
- package/.claude/skills/text-formatter/templates/bbcode-template.md +350 -350
- package/.claude/workflows/chinese-response.md +25 -25
- package/.claude/workflows/cli-templates/memory/style-skill-memory/skill-md-template.md +299 -299
- package/.claude/workflows/cli-templates/planning-roles/product-owner.md +261 -261
- package/.claude/workflows/cli-templates/prompts/{analysis/03-analyze-performance.txt → analysis-analyze-performance.txt} +29 -29
- package/.claude/workflows/cli-templates/prompts/{analysis/03-assess-security-risks.txt → analysis-assess-security-risks.txt} +29 -29
- package/.claude/workflows/cli-templates/prompts/{analysis/02-review-architecture.txt → analysis-review-architecture.txt} +29 -29
- package/.claude/workflows/cli-templates/prompts/{analysis/02-review-code-quality.txt → analysis-review-code-quality.txt} +28 -28
- package/.claude/workflows/cli-templates/prompts/{analysis/03-review-quality-standards.txt → analysis-review-quality-standards.txt} +29 -29
- package/.claude/workflows/cli-templates/prompts/{analysis/01-trace-code-execution.txt → analysis-trace-code-execution.txt} +115 -115
- package/.claude/workflows/cli-templates/prompts/{documentation/api.txt → documentation-api.txt} +14 -14
- package/.claude/workflows/cli-templates/prompts/{documentation/folder-navigation.txt → documentation-folder-navigation.txt} +26 -26
- package/.claude/workflows/cli-templates/prompts/{documentation/project-architecture.txt → documentation-project-architecture.txt} +40 -40
- package/.claude/workflows/cli-templates/prompts/{documentation/project-examples.txt → documentation-project-examples.txt} +34 -34
- package/.claude/workflows/cli-templates/prompts/{documentation/project-readme.txt → documentation-project-readme.txt} +34 -34
- package/.claude/workflows/cli-templates/prompts/{documentation/swagger-api.txt → documentation-swagger-api.txt} +266 -266
- package/.claude/workflows/cli-templates/prompts/{planning/02-design-component-spec.txt → planning-design-component-spec.txt} +28 -28
- package/.claude/workflows/cli-templates/prompts/{verification/codex-technical.txt → verification-codex-technical.txt} +28 -28
- package/.claude/workflows/cli-templates/prompts/{verification/cross-validation.txt → verification-cross-validation.txt} +28 -28
- package/.claude/workflows/cli-templates/prompts/{verification/gemini-strategic.txt → verification-gemini-strategic.txt} +27 -27
- package/.claude/workflows/cli-templates/prompts/{workflow/analysis-results-structure.txt → workflow-analysis-results-structure.txt} +224 -224
- package/.claude/workflows/cli-templates/prompts/{workflow/impl-plan-template.txt → workflow-impl-plan-template.txt} +286 -286
- package/.claude/workflows/cli-templates/prompts/{workflow/skill-conflict-patterns.txt → workflow-skill-conflict-patterns.txt} +2 -2
- package/.claude/workflows/cli-templates/prompts/{workflow/skill-lessons-learned.txt → workflow-skill-lessons-learned.txt} +2 -2
- package/.claude/workflows/cli-templates/prompts/{workflow/task-json-agent-mode.txt → workflow-task-json-agent-mode.txt} +123 -123
- package/.claude/workflows/cli-templates/schemas/project-guidelines-schema.json +141 -141
- package/.claude/workflows/cli-tools-usage.md +113 -117
- package/.claude/workflows/coding-philosophy.md +69 -69
- package/.claude/workflows/context-tools.md +76 -76
- package/.claude/workflows/file-modification.md +64 -64
- package/.claude/workflows/review-directory-specification.md +336 -336
- package/.claude/workflows/windows-platform.md +19 -19
- package/.claude/workflows/workflow-architecture.md +942 -942
- package/.codex/prompts/issue-execute.md +176 -70
- package/README.md +250 -214
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +15 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/cli.d.ts +5 -0
- package/ccw/dist/commands/cli.d.ts.map +1 -1
- package/ccw/dist/commands/cli.js +116 -19
- package/ccw/dist/commands/cli.js.map +1 -1
- package/ccw/dist/commands/install.d.ts +17 -0
- package/ccw/dist/commands/install.d.ts.map +1 -1
- package/ccw/dist/commands/install.js +211 -2
- package/ccw/dist/commands/install.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +208 -28
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/commands/uninstall.d.ts.map +1 -1
- package/ccw/dist/commands/uninstall.js +22 -1
- package/ccw/dist/commands/uninstall.js.map +1 -1
- package/ccw/dist/commands/view.d.ts.map +1 -1
- package/ccw/dist/commands/view.js +3 -0
- package/ccw/dist/commands/view.js.map +1 -1
- package/ccw/dist/commands/workflow.d.ts +11 -0
- package/ccw/dist/commands/workflow.d.ts.map +1 -0
- package/ccw/dist/commands/workflow.js +294 -0
- package/ccw/dist/commands/workflow.js.map +1 -0
- package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/claude-routes.js +57 -3
- package/ccw/dist/core/routes/claude-routes.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.d.ts +13 -0
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js +46 -0
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/hooks-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/hooks-routes.js +33 -0
- package/ccw/dist/core/routes/hooks-routes.js.map +1 -1
- package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/issue-routes.js +211 -29
- package/ccw/dist/core/routes/issue-routes.js.map +1 -1
- package/ccw/dist/core/routes/mcp-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/mcp-routes.js +4 -1
- package/ccw/dist/core/routes/mcp-routes.js.map +1 -1
- package/ccw/dist/core/routes/rules-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/rules-routes.js +22 -6
- package/ccw/dist/core/routes/rules-routes.js.map +1 -1
- package/ccw/dist/core/routes/session-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/session-routes.js +23 -1
- package/ccw/dist/core/routes/session-routes.js.map +1 -1
- package/ccw/dist/mcp-server/index.js +8 -2
- package/ccw/dist/mcp-server/index.js.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +52 -28
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-core.js +33 -8
- package/ccw/dist/tools/cli-executor-core.js.map +1 -1
- package/ccw/dist/tools/cli-executor-state.d.ts +2 -0
- package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-state.js.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.d.ts +7 -0
- package/ccw/dist/tools/cli-executor-utils.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.js +18 -4
- package/ccw/dist/tools/cli-executor-utils.js.map +1 -1
- package/ccw/dist/tools/cli-history-store.d.ts +21 -0
- package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
- package/ccw/dist/tools/cli-history-store.js +106 -30
- package/ccw/dist/tools/cli-history-store.js.map +1 -1
- package/ccw/dist/tools/cli-output-converter.d.ts +2 -1
- package/ccw/dist/tools/cli-output-converter.d.ts.map +1 -1
- package/ccw/dist/tools/cli-output-converter.js +65 -10
- package/ccw/dist/tools/cli-output-converter.js.map +1 -1
- package/ccw/dist/tools/codex-lens-lsp.d.ts +61 -0
- package/ccw/dist/tools/codex-lens-lsp.d.ts.map +1 -0
- package/ccw/dist/tools/codex-lens-lsp.js +320 -0
- package/ccw/dist/tools/codex-lens-lsp.js.map +1 -0
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens.js +74 -54
- package/ccw/dist/tools/codex-lens.js.map +1 -1
- package/ccw/dist/tools/index.d.ts.map +1 -1
- package/ccw/dist/tools/index.js +4 -0
- package/ccw/dist/tools/index.js.map +1 -1
- package/ccw/dist/tools/template-discovery.d.ts +85 -0
- package/ccw/dist/tools/template-discovery.d.ts.map +1 -0
- package/ccw/dist/tools/template-discovery.js +239 -0
- package/ccw/dist/tools/template-discovery.js.map +1 -0
- package/ccw/dist/tools/vscode-lsp.d.ts +57 -0
- package/ccw/dist/tools/vscode-lsp.d.ts.map +1 -0
- package/ccw/dist/tools/vscode-lsp.js +250 -0
- package/ccw/dist/tools/vscode-lsp.js.map +1 -0
- package/ccw/dist/utils/path-resolver.d.ts +16 -2
- package/ccw/dist/utils/path-resolver.d.ts.map +1 -1
- package/ccw/dist/utils/path-resolver.js +36 -6
- package/ccw/dist/utils/path-resolver.js.map +1 -1
- package/ccw/dist/utils/path-validator.d.ts +5 -0
- package/ccw/dist/utils/path-validator.d.ts.map +1 -1
- package/ccw/dist/utils/path-validator.js +16 -5
- package/ccw/dist/utils/path-validator.js.map +1 -1
- package/ccw/dist/utils/project-root.d.ts +25 -0
- package/ccw/dist/utils/project-root.d.ts.map +1 -0
- package/ccw/dist/utils/project-root.js +63 -0
- package/ccw/dist/utils/project-root.js.map +1 -0
- package/ccw/dist/utils/shell-escape.d.ts +47 -3
- package/ccw/dist/utils/shell-escape.d.ts.map +1 -1
- package/ccw/dist/utils/shell-escape.js +98 -15
- package/ccw/dist/utils/shell-escape.js.map +1 -1
- package/ccw/dist/utils/update-checker.d.ts +11 -0
- package/ccw/dist/utils/update-checker.d.ts.map +1 -0
- package/ccw/dist/utils/update-checker.js +167 -0
- package/ccw/dist/utils/update-checker.js.map +1 -0
- package/ccw/src/cli.ts +16 -0
- package/ccw/src/commands/cli.ts +126 -19
- package/ccw/src/commands/install.ts +239 -2
- package/ccw/src/commands/issue.ts +245 -31
- package/ccw/src/commands/uninstall.ts +23 -1
- package/ccw/src/commands/view.ts +4 -0
- package/ccw/src/commands/workflow.ts +348 -0
- package/ccw/src/core/routes/claude-routes.ts +64 -3
- package/ccw/src/core/routes/cli-routes.ts +58 -0
- package/ccw/src/core/routes/hooks-routes.ts +32 -0
- package/ccw/src/core/routes/issue-routes.ts +242 -28
- package/ccw/src/core/routes/mcp-routes.ts +6 -2
- package/ccw/src/core/routes/rules-routes.ts +24 -6
- package/ccw/src/core/routes/session-routes.ts +24 -1
- package/ccw/src/mcp-server/index.ts +7 -2
- package/ccw/src/templates/dashboard-css/26-claude-manager.css +179 -0
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +3427 -3302
- package/ccw/src/templates/dashboard-css/33-cli-stream-viewer.css +3 -2
- package/ccw/src/templates/dashboard-js/components/cli-history.js +4 -1
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +57 -21
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +1492 -1492
- package/ccw/src/templates/dashboard-js/components/mcp-manager.js +107 -20
- package/ccw/src/templates/dashboard-js/components/version-check.js +135 -1
- package/ccw/src/templates/dashboard-js/i18n.js +42 -0
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +168 -0
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +1 -0
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +201 -1
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +3502 -3478
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +16 -0
- package/ccw/src/templates/dashboard.html +112 -0
- package/ccw/src/tools/claude-cli-tools.ts +54 -28
- package/ccw/src/tools/cli-executor-core.ts +36 -8
- package/ccw/src/tools/cli-executor-state.ts +2 -0
- package/ccw/src/tools/cli-executor-utils.ts +26 -4
- package/ccw/src/tools/cli-history-store.ts +122 -31
- package/ccw/src/tools/cli-output-converter.ts +76 -12
- package/ccw/src/tools/codex-lens-lsp.ts +405 -0
- package/ccw/src/tools/codex-lens.ts +82 -59
- package/ccw/src/tools/index.ts +4 -0
- package/ccw/src/tools/template-discovery.ts +303 -0
- package/ccw/src/tools/vscode-lsp.ts +317 -0
- package/ccw/src/utils/path-resolver.ts +37 -6
- package/ccw/src/utils/path-validator.ts +17 -5
- package/ccw/src/utils/project-root.ts +73 -0
- package/ccw/src/utils/shell-escape.ts +103 -16
- package/ccw/src/utils/update-checker.ts +178 -0
- package/codex-lens/pyproject.toml +14 -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__/errors.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/errors.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__init__.py +88 -0
- package/codex-lens/src/codexlens/api/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/definition.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/definition.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/file_context.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/file_context.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/hover.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/hover.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/models.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/models.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/references.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/references.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/semantic.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/semantic.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/symbols.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/symbols.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/utils.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/api/__pycache__/utils.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/api/definition.py +126 -0
- package/codex-lens/src/codexlens/api/file_context.py +271 -0
- package/codex-lens/src/codexlens/api/hover.py +148 -0
- package/codex-lens/src/codexlens/api/models.py +281 -0
- package/codex-lens/src/codexlens/api/references.py +345 -0
- package/codex-lens/src/codexlens/api/semantic.py +471 -0
- package/codex-lens/src/codexlens/api/symbols.py +146 -0
- package/codex-lens/src/codexlens/api/utils.py +153 -0
- package/codex-lens/src/codexlens/config.py +7 -0
- package/codex-lens/src/codexlens/errors.py +4 -0
- package/codex-lens/src/codexlens/hybrid_search/__init__.py +28 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/data_structures.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/data_structures.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/__pycache__/engine.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/hybrid_search/data_structures.py +602 -0
- package/codex-lens/src/codexlens/lsp/__init__.py +34 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/handlers.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/lsp_bridge.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/lsp_bridge.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/lsp_graph_builder.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/lsp_graph_builder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/providers.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/server.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/__pycache__/standalone_manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/lsp/handlers.py +551 -0
- package/codex-lens/src/codexlens/lsp/lsp_bridge.py +834 -0
- package/codex-lens/src/codexlens/lsp/lsp_graph_builder.py +375 -0
- package/codex-lens/src/codexlens/lsp/providers.py +177 -0
- package/codex-lens/src/codexlens/lsp/server.py +263 -0
- package/codex-lens/src/codexlens/lsp/standalone_manager.py +1159 -0
- package/codex-lens/src/codexlens/mcp/__init__.py +20 -0
- package/codex-lens/src/codexlens/mcp/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/mcp/__pycache__/hooks.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/mcp/__pycache__/provider.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/mcp/__pycache__/schema.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/mcp/hooks.py +170 -0
- package/codex-lens/src/codexlens/mcp/provider.py +202 -0
- package/codex-lens/src/codexlens/mcp/schema.py +113 -0
- package/codex-lens/src/codexlens/search/__init__.py +53 -15
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-313.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__/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-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/QUICK_START.md +257 -0
- package/codex-lens/src/codexlens/search/association_tree/README.md +188 -0
- package/codex-lens/src/codexlens/search/association_tree/__init__.py +21 -0
- package/codex-lens/src/codexlens/search/association_tree/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/__pycache__/builder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/__pycache__/data_structures.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/__pycache__/deduplicator.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/association_tree/builder.py +450 -0
- package/codex-lens/src/codexlens/search/association_tree/data_structures.py +191 -0
- package/codex-lens/src/codexlens/search/association_tree/deduplicator.py +301 -0
- package/codex-lens/src/codexlens/search/chain_search.py +864 -3
- package/codex-lens/src/codexlens/search/clustering/__init__.py +124 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/__init__.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/base.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/base.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/dbscan_strategy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/factory.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/factory.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/frequency_strategy.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/frequency_strategy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/hdbscan_strategy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/noop_strategy.cpython-312.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/__pycache__/noop_strategy.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/clustering/base.py +153 -0
- package/codex-lens/src/codexlens/search/clustering/dbscan_strategy.py +197 -0
- package/codex-lens/src/codexlens/search/clustering/factory.py +202 -0
- package/codex-lens/src/codexlens/search/clustering/frequency_strategy.py +263 -0
- package/codex-lens/src/codexlens/search/clustering/hdbscan_strategy.py +153 -0
- package/codex-lens/src/codexlens/search/clustering/noop_strategy.py +83 -0
- package/codex-lens/src/codexlens/search/hybrid_search.py +194 -2
- package/codex-lens/src/codexlens/search/ranking.py +6 -4
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-312.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-312.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/global_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/dir_index.py +172 -0
- package/codex-lens/src/codexlens/storage/global_index.py +33 -0
- package/package.json +92 -92
- /package/.claude/workflows/cli-templates/prompts/{analysis/02-analyze-code-patterns.txt → analysis-analyze-code-patterns.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{analysis/02-analyze-technical-document.txt → analysis-analyze-technical-document.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{analysis/01-diagnose-bug-root-cause.txt → analysis-diagnose-bug-root-cause.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{development/03-debug-runtime-issues.txt → development-debug-runtime-issues.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{development/02-generate-tests.txt → development-generate-tests.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{development/02-implement-component-ui.txt → development-implement-component-ui.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{development/02-implement-feature.txt → development-implement-feature.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{development/02-refactor-codebase.txt → development-refactor-codebase.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{documentation/module-readme.txt → documentation-module-readme.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{memory/02-document-module-structure.txt → memory-document-module-structure.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{planning/02-breakdown-task-steps.txt → planning-breakdown-task-steps.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{planning/03-evaluate-concept-feasibility.txt → planning-evaluate-concept-feasibility.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{planning/01-plan-architecture-design.txt → planning-plan-architecture-design.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{planning/03-plan-migration-strategy.txt → planning-plan-migration-strategy.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{rules/rule-api.txt → rules-rule-api.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{rules/rule-components.txt → rules-rule-components.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{rules/rule-config.txt → rules-rule-config.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{rules/rule-core.txt → rules-rule-core.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{rules/rule-patterns.txt → rules-rule-patterns.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{rules/rule-testing.txt → rules-rule-testing.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{rules/tech-rules-agent-prompt.txt → rules-tech-rules-agent-prompt.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{tech/tech-module-format.txt → tech-tech-module-format.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{tech/tech-skill-index.txt → tech-tech-skill-index.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{test/test-concept-analysis.txt → test-test-concept-analysis.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{universal/00-universal-creative-style.txt → universal-universal-creative-style.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{universal/00-universal-rigorous-style.txt → universal-universal-rigorous-style.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{workflow/codex-feasibility-validation.txt → workflow-codex-feasibility-validation.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{workflow/gemini-solution-design.txt → workflow-gemini-solution-design.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{workflow/skill-aggregation.txt → workflow-skill-aggregation.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{workflow/skill-index.txt → workflow-skill-index.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{workflow/skill-sessions-timeline.txt → workflow-skill-sessions-timeline.txt} +0 -0
- /package/.claude/workflows/cli-templates/prompts/{workflow/task-json-cli-mode.txt → workflow-task-json-cli-mode.txt} +0 -0
|
@@ -1,503 +1,503 @@
|
|
|
1
|
-
# Code Analysis Action Template
|
|
2
|
-
|
|
3
|
-
代码分析动作模板,用于在 Skill 中集成代码探索和分析能力。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 配置结构
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
interface CodeAnalysisActionConfig {
|
|
11
|
-
id: string; // "analyze-structure", "explore-patterns"
|
|
12
|
-
name: string; // "Code Structure Analysis"
|
|
13
|
-
type: 'code-analysis'; // 动作类型标识
|
|
14
|
-
|
|
15
|
-
// 分析范围
|
|
16
|
-
scope: {
|
|
17
|
-
paths: string[]; // 目标路径
|
|
18
|
-
patterns: string[]; // Glob 模式
|
|
19
|
-
excludes?: string[]; // 排除模式
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// 分析类型
|
|
23
|
-
analysis_type: 'structure' | 'patterns' | 'dependencies' | 'quality' | 'security';
|
|
24
|
-
|
|
25
|
-
// Agent 配置
|
|
26
|
-
agent: {
|
|
27
|
-
type: 'Explore' | 'cli-explore-agent' | 'universal-executor';
|
|
28
|
-
thoroughness: 'quick' | 'medium' | 'very thorough';
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// 输出配置
|
|
32
|
-
output: {
|
|
33
|
-
format: 'json' | 'markdown';
|
|
34
|
-
file: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// MCP 工具增强
|
|
38
|
-
mcp_tools?: string[]; // ['mcp__ace-tool__search_context']
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## 模板生成函数
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
function generateCodeAnalysisAction(config) {
|
|
48
|
-
const { id, name, scope, analysis_type, agent, output, mcp_tools = [] } = config;
|
|
49
|
-
|
|
50
|
-
return `
|
|
51
|
-
# ${name}
|
|
52
|
-
|
|
53
|
-
## Action: ${id}
|
|
54
|
-
|
|
55
|
-
### 分析范围
|
|
56
|
-
|
|
57
|
-
- **路径**: ${scope.paths.join(', ')}
|
|
58
|
-
- **模式**: ${scope.patterns.join(', ')}
|
|
59
|
-
${scope.excludes ? `- **排除**: ${scope.excludes.join(', ')}` : ''}
|
|
60
|
-
|
|
61
|
-
### 执行逻辑
|
|
62
|
-
|
|
63
|
-
\`\`\`javascript
|
|
64
|
-
async function execute${toPascalCase(id)}(context) {
|
|
65
|
-
const workDir = context.workDir;
|
|
66
|
-
const results = [];
|
|
67
|
-
|
|
68
|
-
// 1. 文件发现
|
|
69
|
-
const files = await discoverFiles({
|
|
70
|
-
paths: ${JSON.stringify(scope.paths)},
|
|
71
|
-
patterns: ${JSON.stringify(scope.patterns)},
|
|
72
|
-
excludes: ${JSON.stringify(scope.excludes || [])}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
console.log(\`Found \${files.length} files to analyze\`);
|
|
76
|
-
|
|
77
|
-
// 2. 使用 MCP 工具进行语义搜索(如果配置)
|
|
78
|
-
${mcp_tools.length > 0 ? `
|
|
79
|
-
const semanticResults = await mcp__ace_tool__search_context({
|
|
80
|
-
project_root_path: context.projectRoot,
|
|
81
|
-
query: '${getQueryForAnalysisType(analysis_type)}'
|
|
82
|
-
});
|
|
83
|
-
results.push({ type: 'semantic', data: semanticResults });
|
|
84
|
-
` : '// No MCP tools configured'}
|
|
85
|
-
|
|
86
|
-
// 3. 启动 Agent 进行深度分析
|
|
87
|
-
const agentResult = await Task({
|
|
88
|
-
subagent_type: '${agent.type}',
|
|
89
|
-
prompt: \`
|
|
90
|
-
${generateAgentPrompt(analysis_type, scope)}
|
|
91
|
-
\`,
|
|
92
|
-
run_in_background: false
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
results.push({ type: 'agent', data: agentResult });
|
|
96
|
-
|
|
97
|
-
// 4. 汇总结果
|
|
98
|
-
const summary = aggregateResults(results);
|
|
99
|
-
|
|
100
|
-
// 5. 输出结果
|
|
101
|
-
const outputPath = \`\${workDir}/${output.file}\`;
|
|
102
|
-
${output.format === 'json'
|
|
103
|
-
? `Write(outputPath, JSON.stringify(summary, null, 2));`
|
|
104
|
-
: `Write(outputPath, formatAsMarkdown(summary));`}
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
success: true,
|
|
108
|
-
output: '${output.file}',
|
|
109
|
-
files_analyzed: files.length,
|
|
110
|
-
analysis_type: '${analysis_type}'
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
\`\`\`
|
|
114
|
-
`;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function getQueryForAnalysisType(type) {
|
|
118
|
-
const queries = {
|
|
119
|
-
structure: 'main entry points, module organization, exports',
|
|
120
|
-
patterns: 'design patterns, abstractions, reusable components',
|
|
121
|
-
dependencies: 'imports, external dependencies, coupling',
|
|
122
|
-
quality: 'code complexity, test coverage, documentation',
|
|
123
|
-
security: 'authentication, authorization, input validation, secrets'
|
|
124
|
-
};
|
|
125
|
-
return queries[type] || queries.structure;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function generateAgentPrompt(type, scope) {
|
|
129
|
-
const prompts = {
|
|
130
|
-
structure: `分析以下路径的代码结构:
|
|
131
|
-
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
132
|
-
|
|
133
|
-
任务:
|
|
134
|
-
1. 识别主要模块和入口点
|
|
135
|
-
2. 分析目录组织结构
|
|
136
|
-
3. 提取模块间的导入导出关系
|
|
137
|
-
4. 生成结构概览图 (Mermaid)
|
|
138
|
-
|
|
139
|
-
输出格式: JSON
|
|
140
|
-
{
|
|
141
|
-
"modules": [...],
|
|
142
|
-
"entry_points": [...],
|
|
143
|
-
"structure_diagram": "mermaid code"
|
|
144
|
-
}`,
|
|
145
|
-
|
|
146
|
-
patterns: `分析以下路径的设计模式:
|
|
147
|
-
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
148
|
-
|
|
149
|
-
任务:
|
|
150
|
-
1. 识别使用的设计模式 (Factory, Strategy, Observer 等)
|
|
151
|
-
2. 分析抽象层级
|
|
152
|
-
3. 评估模式使用的恰当性
|
|
153
|
-
4. 提取可复用的模式实例
|
|
154
|
-
|
|
155
|
-
输出格式: JSON
|
|
156
|
-
{
|
|
157
|
-
"patterns": [{ "name": "...", "location": "...", "usage": "..." }],
|
|
158
|
-
"abstractions": [...],
|
|
159
|
-
"reusable_components": [...]
|
|
160
|
-
}`,
|
|
161
|
-
|
|
162
|
-
dependencies: `分析以下路径的依赖关系:
|
|
163
|
-
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
164
|
-
|
|
165
|
-
任务:
|
|
166
|
-
1. 提取内部模块依赖
|
|
167
|
-
2. 识别外部包依赖
|
|
168
|
-
3. 分析耦合度
|
|
169
|
-
4. 检测循环依赖
|
|
170
|
-
|
|
171
|
-
输出格式: JSON
|
|
172
|
-
{
|
|
173
|
-
"internal_deps": [...],
|
|
174
|
-
"external_deps": [...],
|
|
175
|
-
"coupling_score": 0-100,
|
|
176
|
-
"circular_deps": [...]
|
|
177
|
-
}`,
|
|
178
|
-
|
|
179
|
-
quality: `分析以下路径的代码质量:
|
|
180
|
-
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
181
|
-
|
|
182
|
-
任务:
|
|
183
|
-
1. 评估代码复杂度
|
|
184
|
-
2. 检查测试覆盖率
|
|
185
|
-
3. 分析文档完整性
|
|
186
|
-
4. 识别技术债务
|
|
187
|
-
|
|
188
|
-
输出格式: JSON
|
|
189
|
-
{
|
|
190
|
-
"complexity": { "avg": 0, "max": 0, "hotspots": [...] },
|
|
191
|
-
"test_coverage": { "percentage": 0, "gaps": [...] },
|
|
192
|
-
"documentation": { "score": 0, "missing": [...] },
|
|
193
|
-
"tech_debt": [...]
|
|
194
|
-
}`,
|
|
195
|
-
|
|
196
|
-
security: `分析以下路径的安全性:
|
|
197
|
-
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
198
|
-
|
|
199
|
-
任务:
|
|
200
|
-
1. 检查认证授权实现
|
|
201
|
-
2. 分析输入验证
|
|
202
|
-
3. 检测敏感数据处理
|
|
203
|
-
4. 识别常见漏洞模式
|
|
204
|
-
|
|
205
|
-
输出格式: JSON
|
|
206
|
-
{
|
|
207
|
-
"auth": { "methods": [...], "issues": [...] },
|
|
208
|
-
"input_validation": { "coverage": 0, "gaps": [...] },
|
|
209
|
-
"sensitive_data": { "found": [...], "protected": true/false },
|
|
210
|
-
"vulnerabilities": [{ "type": "...", "severity": "...", "location": "..." }]
|
|
211
|
-
}`
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
return prompts[type] || prompts.structure;
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
## 预置代码分析动作
|
|
221
|
-
|
|
222
|
-
### 1. 项目结构分析
|
|
223
|
-
|
|
224
|
-
```yaml
|
|
225
|
-
id: analyze-project-structure
|
|
226
|
-
name: Project Structure Analysis
|
|
227
|
-
type: code-analysis
|
|
228
|
-
scope:
|
|
229
|
-
paths:
|
|
230
|
-
- src/
|
|
231
|
-
patterns:
|
|
232
|
-
- "**/*.ts"
|
|
233
|
-
- "**/*.js"
|
|
234
|
-
excludes:
|
|
235
|
-
- "**/node_modules/**"
|
|
236
|
-
- "**/*.test.*"
|
|
237
|
-
analysis_type: structure
|
|
238
|
-
agent:
|
|
239
|
-
type: Explore
|
|
240
|
-
thoroughness: medium
|
|
241
|
-
output:
|
|
242
|
-
format: json
|
|
243
|
-
file: structure-analysis.json
|
|
244
|
-
mcp_tools:
|
|
245
|
-
- mcp__ace-tool__search_context
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### 2. 设计模式提取
|
|
249
|
-
|
|
250
|
-
```yaml
|
|
251
|
-
id: extract-design-patterns
|
|
252
|
-
name: Design Pattern Extraction
|
|
253
|
-
type: code-analysis
|
|
254
|
-
scope:
|
|
255
|
-
paths:
|
|
256
|
-
- src/
|
|
257
|
-
patterns:
|
|
258
|
-
- "**/*.ts"
|
|
259
|
-
analysis_type: patterns
|
|
260
|
-
agent:
|
|
261
|
-
type: cli-explore-agent
|
|
262
|
-
thoroughness: very thorough
|
|
263
|
-
output:
|
|
264
|
-
format: markdown
|
|
265
|
-
file: patterns-report.md
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### 3. 依赖关系分析
|
|
269
|
-
|
|
270
|
-
```yaml
|
|
271
|
-
id: analyze-dependencies
|
|
272
|
-
name: Dependency Analysis
|
|
273
|
-
type: code-analysis
|
|
274
|
-
scope:
|
|
275
|
-
paths:
|
|
276
|
-
- src/
|
|
277
|
-
- packages/
|
|
278
|
-
patterns:
|
|
279
|
-
- "**/package.json"
|
|
280
|
-
- "**/*.ts"
|
|
281
|
-
analysis_type: dependencies
|
|
282
|
-
agent:
|
|
283
|
-
type: Explore
|
|
284
|
-
thoroughness: medium
|
|
285
|
-
output:
|
|
286
|
-
format: json
|
|
287
|
-
file: dependency-graph.json
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### 4. 安全审计
|
|
291
|
-
|
|
292
|
-
```yaml
|
|
293
|
-
id: security-audit
|
|
294
|
-
name: Security Audit
|
|
295
|
-
type: code-analysis
|
|
296
|
-
scope:
|
|
297
|
-
paths:
|
|
298
|
-
- src/auth/
|
|
299
|
-
- src/api/
|
|
300
|
-
patterns:
|
|
301
|
-
- "**/*.ts"
|
|
302
|
-
analysis_type: security
|
|
303
|
-
agent:
|
|
304
|
-
type: universal-executor
|
|
305
|
-
thoroughness: very thorough
|
|
306
|
-
output:
|
|
307
|
-
format: json
|
|
308
|
-
file: security-report.json
|
|
309
|
-
mcp_tools:
|
|
310
|
-
- mcp__ace-tool__search_context
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
---
|
|
314
|
-
|
|
315
|
-
## 使用示例
|
|
316
|
-
|
|
317
|
-
### 在 Phase 中使用
|
|
318
|
-
|
|
319
|
-
```javascript
|
|
320
|
-
// phases/01-code-exploration.md
|
|
321
|
-
|
|
322
|
-
const analysisConfig = {
|
|
323
|
-
id: 'explore-skill-structure',
|
|
324
|
-
name: 'Skill Structure Exploration',
|
|
325
|
-
type: 'code-analysis',
|
|
326
|
-
scope: {
|
|
327
|
-
paths: ['D:\\Claude_dms3\\.claude\\skills\\software-manual'],
|
|
328
|
-
patterns: ['**/*.md'],
|
|
329
|
-
excludes: ['**/node_modules/**']
|
|
330
|
-
},
|
|
331
|
-
analysis_type: 'structure',
|
|
332
|
-
agent: {
|
|
333
|
-
type: 'Explore',
|
|
334
|
-
thoroughness: 'medium'
|
|
335
|
-
},
|
|
336
|
-
output: {
|
|
337
|
-
format: 'json',
|
|
338
|
-
file: 'skill-structure.json'
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
// 执行
|
|
343
|
-
const result = await executeCodeAnalysis(analysisConfig, context);
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
### 组合多种分析
|
|
347
|
-
|
|
348
|
-
```javascript
|
|
349
|
-
// 串行执行多种分析
|
|
350
|
-
const analyses = [
|
|
351
|
-
{ type: 'structure', file: 'structure.json' },
|
|
352
|
-
{ type: 'patterns', file: 'patterns.json' },
|
|
353
|
-
{ type: 'dependencies', file: 'deps.json' }
|
|
354
|
-
];
|
|
355
|
-
|
|
356
|
-
for (const analysis of analyses) {
|
|
357
|
-
await executeCodeAnalysis({
|
|
358
|
-
...baseConfig,
|
|
359
|
-
analysis_type: analysis.type,
|
|
360
|
-
output: { format: 'json', file: analysis.file }
|
|
361
|
-
}, context);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// 并行执行(独立分析)
|
|
365
|
-
const parallelResults = await Promise.all(
|
|
366
|
-
analyses.map(a => executeCodeAnalysis({
|
|
367
|
-
...baseConfig,
|
|
368
|
-
analysis_type: a.type,
|
|
369
|
-
output: { format: 'json', file: a.file }
|
|
370
|
-
}, context))
|
|
371
|
-
);
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
---
|
|
375
|
-
|
|
376
|
-
## Agent 选择指南
|
|
377
|
-
|
|
378
|
-
| 分析类型 | 推荐 Agent | Thoroughness | 原因 |
|
|
379
|
-
|---------|-----------|--------------|------|
|
|
380
|
-
| structure | Explore | medium | 快速获取目录结构 |
|
|
381
|
-
| patterns | cli-explore-agent | very thorough | 需要深度代码理解 |
|
|
382
|
-
| dependencies | Explore | medium | 主要分析 import 语句 |
|
|
383
|
-
| quality | universal-executor | medium | 需要运行分析工具 |
|
|
384
|
-
| security | universal-executor | very thorough | 需要全面扫描 |
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
## MCP 工具集成
|
|
389
|
-
|
|
390
|
-
### 语义搜索增强
|
|
391
|
-
|
|
392
|
-
```javascript
|
|
393
|
-
// 使用 ACE 工具进行语义搜索
|
|
394
|
-
const semanticContext = await mcp__ace_tool__search_context({
|
|
395
|
-
project_root_path: projectRoot,
|
|
396
|
-
query: 'authentication logic, user session management'
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
// 将语义搜索结果作为 Agent 的输入上下文
|
|
400
|
-
const agentResult = await Task({
|
|
401
|
-
subagent_type: 'Explore',
|
|
402
|
-
prompt: `
|
|
403
|
-
基于以下语义搜索结果进行深度分析:
|
|
404
|
-
|
|
405
|
-
${semanticContext}
|
|
406
|
-
|
|
407
|
-
任务: 分析认证逻辑的实现细节...
|
|
408
|
-
`,
|
|
409
|
-
run_in_background: false
|
|
410
|
-
});
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
### smart_search 集成
|
|
414
|
-
|
|
415
|
-
```javascript
|
|
416
|
-
// 使用 smart_search 进行精确搜索
|
|
417
|
-
const exactMatches = await mcp__ccw_tools__smart_search({
|
|
418
|
-
action: 'search',
|
|
419
|
-
query: 'class.*Controller',
|
|
420
|
-
mode: 'ripgrep',
|
|
421
|
-
path: 'src/'
|
|
422
|
-
});
|
|
423
|
-
|
|
424
|
-
// 使用 find_files 发现文件
|
|
425
|
-
const configFiles = await mcp__ccw_tools__smart_search({
|
|
426
|
-
action: 'find_files',
|
|
427
|
-
pattern: '**/*.config.ts',
|
|
428
|
-
path: 'src/'
|
|
429
|
-
});
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
---
|
|
433
|
-
|
|
434
|
-
## 结果聚合
|
|
435
|
-
|
|
436
|
-
```javascript
|
|
437
|
-
function aggregateResults(results) {
|
|
438
|
-
const aggregated = {
|
|
439
|
-
timestamp: new Date().toISOString(),
|
|
440
|
-
sources: [],
|
|
441
|
-
summary: {},
|
|
442
|
-
details: []
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
for (const result of results) {
|
|
446
|
-
aggregated.sources.push(result.type);
|
|
447
|
-
|
|
448
|
-
if (result.type === 'semantic') {
|
|
449
|
-
aggregated.summary.semantic_matches = result.data.length;
|
|
450
|
-
aggregated.details.push({
|
|
451
|
-
source: 'semantic',
|
|
452
|
-
data: result.data.slice(0, 10) // Top 10
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (result.type === 'agent') {
|
|
457
|
-
aggregated.summary.agent_findings = extractKeyFindings(result.data);
|
|
458
|
-
aggregated.details.push({
|
|
459
|
-
source: 'agent',
|
|
460
|
-
data: result.data
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
return aggregated;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
function extractKeyFindings(agentResult) {
|
|
469
|
-
// 从 Agent 结果中提取关键发现
|
|
470
|
-
// 实现取决于 Agent 的输出格式
|
|
471
|
-
return {
|
|
472
|
-
modules: agentResult.modules?.length || 0,
|
|
473
|
-
patterns: agentResult.patterns?.length || 0,
|
|
474
|
-
issues: agentResult.issues?.length || 0
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
---
|
|
480
|
-
|
|
481
|
-
## 最佳实践
|
|
482
|
-
|
|
483
|
-
1. **范围控制**
|
|
484
|
-
- 使用精确的 patterns 减少分析范围
|
|
485
|
-
- 配置 excludes 排除无关文件
|
|
486
|
-
|
|
487
|
-
2. **Agent 选择**
|
|
488
|
-
- 快速探索用 Explore
|
|
489
|
-
- 深度分析用 cli-explore-agent
|
|
490
|
-
- 需要执行操作用 universal-executor
|
|
491
|
-
|
|
492
|
-
3. **MCP 工具组合**
|
|
493
|
-
- 先用 mcp__ace-tool__search_context 获取语义上下文
|
|
494
|
-
- 再用 Agent 进行深度分析
|
|
495
|
-
- 最后用 smart_search 补充精确匹配
|
|
496
|
-
|
|
497
|
-
4. **结果缓存**
|
|
498
|
-
- 将分析结果持久化到 workDir
|
|
499
|
-
- 后续阶段可直接读取,避免重复分析
|
|
500
|
-
|
|
501
|
-
5. **Brief Returns**
|
|
502
|
-
- Agent 返回路径 + 摘要,而非完整内容
|
|
503
|
-
- 避免上下文溢出
|
|
1
|
+
# Code Analysis Action Template
|
|
2
|
+
|
|
3
|
+
代码分析动作模板,用于在 Skill 中集成代码探索和分析能力。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 配置结构
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
interface CodeAnalysisActionConfig {
|
|
11
|
+
id: string; // "analyze-structure", "explore-patterns"
|
|
12
|
+
name: string; // "Code Structure Analysis"
|
|
13
|
+
type: 'code-analysis'; // 动作类型标识
|
|
14
|
+
|
|
15
|
+
// 分析范围
|
|
16
|
+
scope: {
|
|
17
|
+
paths: string[]; // 目标路径
|
|
18
|
+
patterns: string[]; // Glob 模式
|
|
19
|
+
excludes?: string[]; // 排除模式
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// 分析类型
|
|
23
|
+
analysis_type: 'structure' | 'patterns' | 'dependencies' | 'quality' | 'security';
|
|
24
|
+
|
|
25
|
+
// Agent 配置
|
|
26
|
+
agent: {
|
|
27
|
+
type: 'Explore' | 'cli-explore-agent' | 'universal-executor';
|
|
28
|
+
thoroughness: 'quick' | 'medium' | 'very thorough';
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// 输出配置
|
|
32
|
+
output: {
|
|
33
|
+
format: 'json' | 'markdown';
|
|
34
|
+
file: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// MCP 工具增强
|
|
38
|
+
mcp_tools?: string[]; // ['mcp__ace-tool__search_context']
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 模板生成函数
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
function generateCodeAnalysisAction(config) {
|
|
48
|
+
const { id, name, scope, analysis_type, agent, output, mcp_tools = [] } = config;
|
|
49
|
+
|
|
50
|
+
return `
|
|
51
|
+
# ${name}
|
|
52
|
+
|
|
53
|
+
## Action: ${id}
|
|
54
|
+
|
|
55
|
+
### 分析范围
|
|
56
|
+
|
|
57
|
+
- **路径**: ${scope.paths.join(', ')}
|
|
58
|
+
- **模式**: ${scope.patterns.join(', ')}
|
|
59
|
+
${scope.excludes ? `- **排除**: ${scope.excludes.join(', ')}` : ''}
|
|
60
|
+
|
|
61
|
+
### 执行逻辑
|
|
62
|
+
|
|
63
|
+
\`\`\`javascript
|
|
64
|
+
async function execute${toPascalCase(id)}(context) {
|
|
65
|
+
const workDir = context.workDir;
|
|
66
|
+
const results = [];
|
|
67
|
+
|
|
68
|
+
// 1. 文件发现
|
|
69
|
+
const files = await discoverFiles({
|
|
70
|
+
paths: ${JSON.stringify(scope.paths)},
|
|
71
|
+
patterns: ${JSON.stringify(scope.patterns)},
|
|
72
|
+
excludes: ${JSON.stringify(scope.excludes || [])}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
console.log(\`Found \${files.length} files to analyze\`);
|
|
76
|
+
|
|
77
|
+
// 2. 使用 MCP 工具进行语义搜索(如果配置)
|
|
78
|
+
${mcp_tools.length > 0 ? `
|
|
79
|
+
const semanticResults = await mcp__ace_tool__search_context({
|
|
80
|
+
project_root_path: context.projectRoot,
|
|
81
|
+
query: '${getQueryForAnalysisType(analysis_type)}'
|
|
82
|
+
});
|
|
83
|
+
results.push({ type: 'semantic', data: semanticResults });
|
|
84
|
+
` : '// No MCP tools configured'}
|
|
85
|
+
|
|
86
|
+
// 3. 启动 Agent 进行深度分析
|
|
87
|
+
const agentResult = await Task({
|
|
88
|
+
subagent_type: '${agent.type}',
|
|
89
|
+
prompt: \`
|
|
90
|
+
${generateAgentPrompt(analysis_type, scope)}
|
|
91
|
+
\`,
|
|
92
|
+
run_in_background: false
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
results.push({ type: 'agent', data: agentResult });
|
|
96
|
+
|
|
97
|
+
// 4. 汇总结果
|
|
98
|
+
const summary = aggregateResults(results);
|
|
99
|
+
|
|
100
|
+
// 5. 输出结果
|
|
101
|
+
const outputPath = \`\${workDir}/${output.file}\`;
|
|
102
|
+
${output.format === 'json'
|
|
103
|
+
? `Write(outputPath, JSON.stringify(summary, null, 2));`
|
|
104
|
+
: `Write(outputPath, formatAsMarkdown(summary));`}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
success: true,
|
|
108
|
+
output: '${output.file}',
|
|
109
|
+
files_analyzed: files.length,
|
|
110
|
+
analysis_type: '${analysis_type}'
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
\`\`\`
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getQueryForAnalysisType(type) {
|
|
118
|
+
const queries = {
|
|
119
|
+
structure: 'main entry points, module organization, exports',
|
|
120
|
+
patterns: 'design patterns, abstractions, reusable components',
|
|
121
|
+
dependencies: 'imports, external dependencies, coupling',
|
|
122
|
+
quality: 'code complexity, test coverage, documentation',
|
|
123
|
+
security: 'authentication, authorization, input validation, secrets'
|
|
124
|
+
};
|
|
125
|
+
return queries[type] || queries.structure;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function generateAgentPrompt(type, scope) {
|
|
129
|
+
const prompts = {
|
|
130
|
+
structure: `分析以下路径的代码结构:
|
|
131
|
+
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
132
|
+
|
|
133
|
+
任务:
|
|
134
|
+
1. 识别主要模块和入口点
|
|
135
|
+
2. 分析目录组织结构
|
|
136
|
+
3. 提取模块间的导入导出关系
|
|
137
|
+
4. 生成结构概览图 (Mermaid)
|
|
138
|
+
|
|
139
|
+
输出格式: JSON
|
|
140
|
+
{
|
|
141
|
+
"modules": [...],
|
|
142
|
+
"entry_points": [...],
|
|
143
|
+
"structure_diagram": "mermaid code"
|
|
144
|
+
}`,
|
|
145
|
+
|
|
146
|
+
patterns: `分析以下路径的设计模式:
|
|
147
|
+
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
148
|
+
|
|
149
|
+
任务:
|
|
150
|
+
1. 识别使用的设计模式 (Factory, Strategy, Observer 等)
|
|
151
|
+
2. 分析抽象层级
|
|
152
|
+
3. 评估模式使用的恰当性
|
|
153
|
+
4. 提取可复用的模式实例
|
|
154
|
+
|
|
155
|
+
输出格式: JSON
|
|
156
|
+
{
|
|
157
|
+
"patterns": [{ "name": "...", "location": "...", "usage": "..." }],
|
|
158
|
+
"abstractions": [...],
|
|
159
|
+
"reusable_components": [...]
|
|
160
|
+
}`,
|
|
161
|
+
|
|
162
|
+
dependencies: `分析以下路径的依赖关系:
|
|
163
|
+
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
164
|
+
|
|
165
|
+
任务:
|
|
166
|
+
1. 提取内部模块依赖
|
|
167
|
+
2. 识别外部包依赖
|
|
168
|
+
3. 分析耦合度
|
|
169
|
+
4. 检测循环依赖
|
|
170
|
+
|
|
171
|
+
输出格式: JSON
|
|
172
|
+
{
|
|
173
|
+
"internal_deps": [...],
|
|
174
|
+
"external_deps": [...],
|
|
175
|
+
"coupling_score": 0-100,
|
|
176
|
+
"circular_deps": [...]
|
|
177
|
+
}`,
|
|
178
|
+
|
|
179
|
+
quality: `分析以下路径的代码质量:
|
|
180
|
+
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
181
|
+
|
|
182
|
+
任务:
|
|
183
|
+
1. 评估代码复杂度
|
|
184
|
+
2. 检查测试覆盖率
|
|
185
|
+
3. 分析文档完整性
|
|
186
|
+
4. 识别技术债务
|
|
187
|
+
|
|
188
|
+
输出格式: JSON
|
|
189
|
+
{
|
|
190
|
+
"complexity": { "avg": 0, "max": 0, "hotspots": [...] },
|
|
191
|
+
"test_coverage": { "percentage": 0, "gaps": [...] },
|
|
192
|
+
"documentation": { "score": 0, "missing": [...] },
|
|
193
|
+
"tech_debt": [...]
|
|
194
|
+
}`,
|
|
195
|
+
|
|
196
|
+
security: `分析以下路径的安全性:
|
|
197
|
+
${scope.paths.map(p => `- ${p}`).join('\\n')}
|
|
198
|
+
|
|
199
|
+
任务:
|
|
200
|
+
1. 检查认证授权实现
|
|
201
|
+
2. 分析输入验证
|
|
202
|
+
3. 检测敏感数据处理
|
|
203
|
+
4. 识别常见漏洞模式
|
|
204
|
+
|
|
205
|
+
输出格式: JSON
|
|
206
|
+
{
|
|
207
|
+
"auth": { "methods": [...], "issues": [...] },
|
|
208
|
+
"input_validation": { "coverage": 0, "gaps": [...] },
|
|
209
|
+
"sensitive_data": { "found": [...], "protected": true/false },
|
|
210
|
+
"vulnerabilities": [{ "type": "...", "severity": "...", "location": "..." }]
|
|
211
|
+
}`
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
return prompts[type] || prompts.structure;
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 预置代码分析动作
|
|
221
|
+
|
|
222
|
+
### 1. 项目结构分析
|
|
223
|
+
|
|
224
|
+
```yaml
|
|
225
|
+
id: analyze-project-structure
|
|
226
|
+
name: Project Structure Analysis
|
|
227
|
+
type: code-analysis
|
|
228
|
+
scope:
|
|
229
|
+
paths:
|
|
230
|
+
- src/
|
|
231
|
+
patterns:
|
|
232
|
+
- "**/*.ts"
|
|
233
|
+
- "**/*.js"
|
|
234
|
+
excludes:
|
|
235
|
+
- "**/node_modules/**"
|
|
236
|
+
- "**/*.test.*"
|
|
237
|
+
analysis_type: structure
|
|
238
|
+
agent:
|
|
239
|
+
type: Explore
|
|
240
|
+
thoroughness: medium
|
|
241
|
+
output:
|
|
242
|
+
format: json
|
|
243
|
+
file: structure-analysis.json
|
|
244
|
+
mcp_tools:
|
|
245
|
+
- mcp__ace-tool__search_context
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 2. 设计模式提取
|
|
249
|
+
|
|
250
|
+
```yaml
|
|
251
|
+
id: extract-design-patterns
|
|
252
|
+
name: Design Pattern Extraction
|
|
253
|
+
type: code-analysis
|
|
254
|
+
scope:
|
|
255
|
+
paths:
|
|
256
|
+
- src/
|
|
257
|
+
patterns:
|
|
258
|
+
- "**/*.ts"
|
|
259
|
+
analysis_type: patterns
|
|
260
|
+
agent:
|
|
261
|
+
type: cli-explore-agent
|
|
262
|
+
thoroughness: very thorough
|
|
263
|
+
output:
|
|
264
|
+
format: markdown
|
|
265
|
+
file: patterns-report.md
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### 3. 依赖关系分析
|
|
269
|
+
|
|
270
|
+
```yaml
|
|
271
|
+
id: analyze-dependencies
|
|
272
|
+
name: Dependency Analysis
|
|
273
|
+
type: code-analysis
|
|
274
|
+
scope:
|
|
275
|
+
paths:
|
|
276
|
+
- src/
|
|
277
|
+
- packages/
|
|
278
|
+
patterns:
|
|
279
|
+
- "**/package.json"
|
|
280
|
+
- "**/*.ts"
|
|
281
|
+
analysis_type: dependencies
|
|
282
|
+
agent:
|
|
283
|
+
type: Explore
|
|
284
|
+
thoroughness: medium
|
|
285
|
+
output:
|
|
286
|
+
format: json
|
|
287
|
+
file: dependency-graph.json
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### 4. 安全审计
|
|
291
|
+
|
|
292
|
+
```yaml
|
|
293
|
+
id: security-audit
|
|
294
|
+
name: Security Audit
|
|
295
|
+
type: code-analysis
|
|
296
|
+
scope:
|
|
297
|
+
paths:
|
|
298
|
+
- src/auth/
|
|
299
|
+
- src/api/
|
|
300
|
+
patterns:
|
|
301
|
+
- "**/*.ts"
|
|
302
|
+
analysis_type: security
|
|
303
|
+
agent:
|
|
304
|
+
type: universal-executor
|
|
305
|
+
thoroughness: very thorough
|
|
306
|
+
output:
|
|
307
|
+
format: json
|
|
308
|
+
file: security-report.json
|
|
309
|
+
mcp_tools:
|
|
310
|
+
- mcp__ace-tool__search_context
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## 使用示例
|
|
316
|
+
|
|
317
|
+
### 在 Phase 中使用
|
|
318
|
+
|
|
319
|
+
```javascript
|
|
320
|
+
// phases/01-code-exploration.md
|
|
321
|
+
|
|
322
|
+
const analysisConfig = {
|
|
323
|
+
id: 'explore-skill-structure',
|
|
324
|
+
name: 'Skill Structure Exploration',
|
|
325
|
+
type: 'code-analysis',
|
|
326
|
+
scope: {
|
|
327
|
+
paths: ['D:\\Claude_dms3\\.claude\\skills\\software-manual'],
|
|
328
|
+
patterns: ['**/*.md'],
|
|
329
|
+
excludes: ['**/node_modules/**']
|
|
330
|
+
},
|
|
331
|
+
analysis_type: 'structure',
|
|
332
|
+
agent: {
|
|
333
|
+
type: 'Explore',
|
|
334
|
+
thoroughness: 'medium'
|
|
335
|
+
},
|
|
336
|
+
output: {
|
|
337
|
+
format: 'json',
|
|
338
|
+
file: 'skill-structure.json'
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// 执行
|
|
343
|
+
const result = await executeCodeAnalysis(analysisConfig, context);
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### 组合多种分析
|
|
347
|
+
|
|
348
|
+
```javascript
|
|
349
|
+
// 串行执行多种分析
|
|
350
|
+
const analyses = [
|
|
351
|
+
{ type: 'structure', file: 'structure.json' },
|
|
352
|
+
{ type: 'patterns', file: 'patterns.json' },
|
|
353
|
+
{ type: 'dependencies', file: 'deps.json' }
|
|
354
|
+
];
|
|
355
|
+
|
|
356
|
+
for (const analysis of analyses) {
|
|
357
|
+
await executeCodeAnalysis({
|
|
358
|
+
...baseConfig,
|
|
359
|
+
analysis_type: analysis.type,
|
|
360
|
+
output: { format: 'json', file: analysis.file }
|
|
361
|
+
}, context);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// 并行执行(独立分析)
|
|
365
|
+
const parallelResults = await Promise.all(
|
|
366
|
+
analyses.map(a => executeCodeAnalysis({
|
|
367
|
+
...baseConfig,
|
|
368
|
+
analysis_type: a.type,
|
|
369
|
+
output: { format: 'json', file: a.file }
|
|
370
|
+
}, context))
|
|
371
|
+
);
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Agent 选择指南
|
|
377
|
+
|
|
378
|
+
| 分析类型 | 推荐 Agent | Thoroughness | 原因 |
|
|
379
|
+
|---------|-----------|--------------|------|
|
|
380
|
+
| structure | Explore | medium | 快速获取目录结构 |
|
|
381
|
+
| patterns | cli-explore-agent | very thorough | 需要深度代码理解 |
|
|
382
|
+
| dependencies | Explore | medium | 主要分析 import 语句 |
|
|
383
|
+
| quality | universal-executor | medium | 需要运行分析工具 |
|
|
384
|
+
| security | universal-executor | very thorough | 需要全面扫描 |
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## MCP 工具集成
|
|
389
|
+
|
|
390
|
+
### 语义搜索增强
|
|
391
|
+
|
|
392
|
+
```javascript
|
|
393
|
+
// 使用 ACE 工具进行语义搜索
|
|
394
|
+
const semanticContext = await mcp__ace_tool__search_context({
|
|
395
|
+
project_root_path: projectRoot,
|
|
396
|
+
query: 'authentication logic, user session management'
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
// 将语义搜索结果作为 Agent 的输入上下文
|
|
400
|
+
const agentResult = await Task({
|
|
401
|
+
subagent_type: 'Explore',
|
|
402
|
+
prompt: `
|
|
403
|
+
基于以下语义搜索结果进行深度分析:
|
|
404
|
+
|
|
405
|
+
${semanticContext}
|
|
406
|
+
|
|
407
|
+
任务: 分析认证逻辑的实现细节...
|
|
408
|
+
`,
|
|
409
|
+
run_in_background: false
|
|
410
|
+
});
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### smart_search 集成
|
|
414
|
+
|
|
415
|
+
```javascript
|
|
416
|
+
// 使用 smart_search 进行精确搜索
|
|
417
|
+
const exactMatches = await mcp__ccw_tools__smart_search({
|
|
418
|
+
action: 'search',
|
|
419
|
+
query: 'class.*Controller',
|
|
420
|
+
mode: 'ripgrep',
|
|
421
|
+
path: 'src/'
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
// 使用 find_files 发现文件
|
|
425
|
+
const configFiles = await mcp__ccw_tools__smart_search({
|
|
426
|
+
action: 'find_files',
|
|
427
|
+
pattern: '**/*.config.ts',
|
|
428
|
+
path: 'src/'
|
|
429
|
+
});
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## 结果聚合
|
|
435
|
+
|
|
436
|
+
```javascript
|
|
437
|
+
function aggregateResults(results) {
|
|
438
|
+
const aggregated = {
|
|
439
|
+
timestamp: new Date().toISOString(),
|
|
440
|
+
sources: [],
|
|
441
|
+
summary: {},
|
|
442
|
+
details: []
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
for (const result of results) {
|
|
446
|
+
aggregated.sources.push(result.type);
|
|
447
|
+
|
|
448
|
+
if (result.type === 'semantic') {
|
|
449
|
+
aggregated.summary.semantic_matches = result.data.length;
|
|
450
|
+
aggregated.details.push({
|
|
451
|
+
source: 'semantic',
|
|
452
|
+
data: result.data.slice(0, 10) // Top 10
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (result.type === 'agent') {
|
|
457
|
+
aggregated.summary.agent_findings = extractKeyFindings(result.data);
|
|
458
|
+
aggregated.details.push({
|
|
459
|
+
source: 'agent',
|
|
460
|
+
data: result.data
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return aggregated;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function extractKeyFindings(agentResult) {
|
|
469
|
+
// 从 Agent 结果中提取关键发现
|
|
470
|
+
// 实现取决于 Agent 的输出格式
|
|
471
|
+
return {
|
|
472
|
+
modules: agentResult.modules?.length || 0,
|
|
473
|
+
patterns: agentResult.patterns?.length || 0,
|
|
474
|
+
issues: agentResult.issues?.length || 0
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## 最佳实践
|
|
482
|
+
|
|
483
|
+
1. **范围控制**
|
|
484
|
+
- 使用精确的 patterns 减少分析范围
|
|
485
|
+
- 配置 excludes 排除无关文件
|
|
486
|
+
|
|
487
|
+
2. **Agent 选择**
|
|
488
|
+
- 快速探索用 Explore
|
|
489
|
+
- 深度分析用 cli-explore-agent
|
|
490
|
+
- 需要执行操作用 universal-executor
|
|
491
|
+
|
|
492
|
+
3. **MCP 工具组合**
|
|
493
|
+
- 先用 mcp__ace-tool__search_context 获取语义上下文
|
|
494
|
+
- 再用 Agent 进行深度分析
|
|
495
|
+
- 最后用 smart_search 补充精确匹配
|
|
496
|
+
|
|
497
|
+
4. **结果缓存**
|
|
498
|
+
- 将分析结果持久化到 workDir
|
|
499
|
+
- 后续阶段可直接读取,避免重复分析
|
|
500
|
+
|
|
501
|
+
5. **Brief Returns**
|
|
502
|
+
- Agent 返回路径 + 摘要,而非完整内容
|
|
503
|
+
- 避免上下文溢出
|