claude-code-workflow 6.2.1 → 6.2.2
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 +10 -0
- package/.claude/agents/action-planning-agent.md +857 -0
- package/.claude/agents/cli-execution-agent.md +267 -0
- package/.claude/agents/cli-explore-agent.md +182 -0
- package/.claude/agents/cli-lite-planning-agent.md +446 -0
- package/.claude/agents/cli-planning-agent.md +558 -0
- package/.claude/agents/code-developer.md +311 -0
- package/.claude/agents/conceptual-planning-agent.md +308 -0
- package/.claude/agents/context-search-agent.md +581 -0
- package/.claude/agents/doc-generator.md +330 -0
- package/.claude/agents/memory-bridge.md +94 -0
- package/.claude/agents/test-context-search-agent.md +400 -0
- package/.claude/agents/test-fix-agent.md +344 -0
- package/.claude/agents/ui-design-agent.md +593 -0
- package/.claude/agents/universal-executor.md +131 -0
- package/.claude/commands/clean.md +516 -0
- package/.claude/commands/cli/cli-init.md +440 -0
- package/.claude/commands/enhance-prompt.md +93 -0
- package/.claude/commands/memory/code-map-memory.md +687 -0
- package/.claude/commands/memory/compact.md +383 -0
- package/.claude/commands/memory/docs-full-cli.md +471 -0
- package/.claude/commands/memory/docs-related-cli.md +386 -0
- package/.claude/commands/memory/docs.md +615 -0
- package/.claude/commands/memory/load-skill-memory.md +182 -0
- package/.claude/commands/memory/load.md +240 -0
- package/.claude/commands/memory/skill-memory.md +525 -0
- package/.claude/commands/memory/style-skill-memory.md +396 -0
- package/.claude/commands/memory/tech-research-rules.md +310 -0
- package/.claude/commands/memory/update-full.md +332 -0
- package/.claude/commands/memory/update-related.md +332 -0
- package/.claude/commands/memory/workflow-skill-memory.md +517 -0
- package/.claude/commands/task/breakdown.md +204 -0
- package/.claude/commands/task/create.md +152 -0
- package/.claude/commands/task/execute.md +270 -0
- package/.claude/commands/task/replan.md +437 -0
- package/.claude/commands/version.md +254 -0
- package/.claude/commands/workflow/action-plan-verify.md +447 -0
- package/.claude/commands/workflow/brainstorm/api-designer.md +587 -0
- package/.claude/commands/workflow/brainstorm/artifacts.md +453 -0
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +443 -0
- package/.claude/commands/workflow/brainstorm/data-architect.md +220 -0
- package/.claude/commands/workflow/brainstorm/product-manager.md +200 -0
- package/.claude/commands/workflow/brainstorm/product-owner.md +200 -0
- package/.claude/commands/workflow/brainstorm/scrum-master.md +200 -0
- package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +200 -0
- package/.claude/commands/workflow/brainstorm/synthesis.md +398 -0
- package/.claude/commands/workflow/brainstorm/system-architect.md +389 -0
- package/.claude/commands/workflow/brainstorm/ui-designer.md +221 -0
- package/.claude/commands/workflow/brainstorm/ux-expert.md +221 -0
- package/.claude/commands/workflow/debug.md +321 -0
- package/.claude/commands/workflow/execute.md +475 -0
- package/.claude/commands/workflow/init.md +165 -0
- package/.claude/commands/workflow/lite-execute.md +792 -0
- package/.claude/commands/workflow/lite-fix.md +623 -0
- package/.claude/commands/workflow/lite-plan.md +610 -0
- package/.claude/commands/workflow/plan.md +551 -0
- package/.claude/commands/workflow/replan.md +515 -0
- package/.claude/commands/workflow/review-fix.md +606 -0
- package/.claude/commands/workflow/review-module-cycle.md +767 -0
- package/.claude/commands/workflow/review-session-cycle.md +778 -0
- package/.claude/commands/workflow/review.md +297 -0
- package/.claude/commands/workflow/session/complete.md +153 -0
- package/.claude/commands/workflow/session/list.md +96 -0
- package/.claude/commands/workflow/session/resume.md +61 -0
- package/.claude/commands/workflow/session/start.md +200 -0
- package/.claude/commands/workflow/tdd-plan.md +460 -0
- package/.claude/commands/workflow/tdd-verify.md +400 -0
- package/.claude/commands/workflow/test-cycle-execute.md +500 -0
- package/.claude/commands/workflow/test-fix-gen.md +699 -0
- package/.claude/commands/workflow/test-gen.md +529 -0
- package/.claude/commands/workflow/tools/conflict-resolution.md +766 -0
- package/.claude/commands/workflow/tools/context-gather.md +436 -0
- package/.claude/commands/workflow/tools/task-generate-agent.md +490 -0
- package/.claude/commands/workflow/tools/task-generate-tdd.md +526 -0
- package/.claude/commands/workflow/tools/tdd-coverage-analysis.md +309 -0
- package/.claude/commands/workflow/tools/test-concept-enhanced.md +164 -0
- package/.claude/commands/workflow/tools/test-context-gather.md +236 -0
- package/.claude/commands/workflow/tools/test-task-generate.md +257 -0
- package/.claude/commands/workflow/ui-design/animation-extract.md +1150 -0
- package/.claude/commands/workflow/ui-design/codify-style.md +652 -0
- package/.claude/commands/workflow/ui-design/design-sync.md +454 -0
- package/.claude/commands/workflow/ui-design/explore-auto.md +678 -0
- package/.claude/commands/workflow/ui-design/generate.md +504 -0
- package/.claude/commands/workflow/ui-design/imitate-auto.md +745 -0
- package/.claude/commands/workflow/ui-design/import-from-code.md +540 -0
- package/.claude/commands/workflow/ui-design/layout-extract.md +788 -0
- package/.claude/commands/workflow/ui-design/reference-page-generator.md +356 -0
- package/.claude/commands/workflow/ui-design/style-extract.md +773 -0
- package/.claude/skills/command-guide/SKILL.md +388 -0
- package/.claude/skills/command-guide/UPDATE-GUIDELINE.md +592 -0
- package/.claude/skills/command-guide/guides/cli-tools-guide.md +410 -0
- package/.claude/skills/command-guide/guides/examples.md +537 -0
- package/.claude/skills/command-guide/guides/getting-started.md +242 -0
- package/.claude/skills/command-guide/guides/implementation-details.md +1010 -0
- package/.claude/skills/command-guide/guides/index-structure.md +326 -0
- package/.claude/skills/command-guide/guides/troubleshooting.md +92 -0
- package/.claude/skills/command-guide/guides/ui-design-workflow-guide.md +316 -0
- package/.claude/skills/command-guide/guides/workflow-patterns.md +662 -0
- package/.claude/skills/command-guide/index/all-commands.json +772 -0
- package/.claude/skills/command-guide/index/by-category.json +800 -0
- package/.claude/skills/command-guide/index/by-use-case.json +786 -0
- package/.claude/skills/command-guide/index/command-relationships.json +307 -0
- package/.claude/skills/command-guide/index/essential-commands.json +112 -0
- package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +857 -0
- package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +267 -0
- package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +182 -0
- package/.claude/skills/command-guide/reference/agents/cli-lite-planning-agent.md +446 -0
- package/.claude/skills/command-guide/reference/agents/cli-planning-agent.md +558 -0
- package/.claude/skills/command-guide/reference/agents/code-developer.md +311 -0
- package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +308 -0
- package/.claude/skills/command-guide/reference/agents/context-search-agent.md +581 -0
- package/.claude/skills/command-guide/reference/agents/doc-generator.md +330 -0
- package/.claude/skills/command-guide/reference/agents/memory-bridge.md +94 -0
- package/.claude/skills/command-guide/reference/agents/test-context-search-agent.md +400 -0
- package/.claude/skills/command-guide/reference/agents/test-fix-agent.md +344 -0
- package/.claude/skills/command-guide/reference/agents/ui-design-agent.md +593 -0
- package/.claude/skills/command-guide/reference/agents/universal-executor.md +131 -0
- package/.claude/skills/command-guide/reference/commands/cli/cli-init.md +440 -0
- package/.claude/skills/command-guide/reference/commands/enhance-prompt.md +93 -0
- package/.claude/skills/command-guide/reference/commands/memory/code-map-memory.md +687 -0
- package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -0
- package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -0
- package/.claude/skills/command-guide/reference/commands/memory/docs.md +616 -0
- package/.claude/skills/command-guide/reference/commands/memory/load-skill-memory.md +182 -0
- package/.claude/skills/command-guide/reference/commands/memory/load.md +240 -0
- package/.claude/skills/command-guide/reference/commands/memory/skill-memory.md +525 -0
- package/.claude/skills/command-guide/reference/commands/memory/style-skill-memory.md +396 -0
- package/.claude/skills/command-guide/reference/commands/memory/tech-research.md +314 -0
- package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -0
- package/.claude/skills/command-guide/reference/commands/memory/update-related.md +332 -0
- package/.claude/skills/command-guide/reference/commands/memory/workflow-skill-memory.md +517 -0
- package/.claude/skills/command-guide/reference/commands/task/breakdown.md +204 -0
- package/.claude/skills/command-guide/reference/commands/task/create.md +152 -0
- package/.claude/skills/command-guide/reference/commands/task/execute.md +270 -0
- package/.claude/skills/command-guide/reference/commands/task/replan.md +437 -0
- package/.claude/skills/command-guide/reference/commands/version.md +254 -0
- package/.claude/skills/command-guide/reference/commands/workflow/action-plan-verify.md +447 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/api-designer.md +585 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/artifacts.md +452 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +443 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/data-architect.md +220 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-manager.md +200 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-owner.md +200 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/scrum-master.md +200 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/subject-matter-expert.md +200 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/synthesis.md +398 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/system-architect.md +387 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ui-designer.md +221 -0
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ux-expert.md +221 -0
- package/.claude/skills/command-guide/reference/commands/workflow/execute.md +465 -0
- package/.claude/skills/command-guide/reference/commands/workflow/init.md +164 -0
- package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +748 -0
- package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +664 -0
- package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +645 -0
- package/.claude/skills/command-guide/reference/commands/workflow/plan.md +551 -0
- package/.claude/skills/command-guide/reference/commands/workflow/replan.md +515 -0
- package/.claude/skills/command-guide/reference/commands/workflow/review-fix.md +606 -0
- package/.claude/skills/command-guide/reference/commands/workflow/review-module-cycle.md +765 -0
- package/.claude/skills/command-guide/reference/commands/workflow/review-session-cycle.md +776 -0
- package/.claude/skills/command-guide/reference/commands/workflow/review.md +298 -0
- package/.claude/skills/command-guide/reference/commands/workflow/session/complete.md +547 -0
- package/.claude/skills/command-guide/reference/commands/workflow/session/list.md +114 -0
- package/.claude/skills/command-guide/reference/commands/workflow/session/resume.md +77 -0
- package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +257 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +460 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-verify.md +400 -0
- package/.claude/skills/command-guide/reference/commands/workflow/test-cycle-execute.md +498 -0
- package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +699 -0
- package/.claude/skills/command-guide/reference/commands/workflow/test-gen.md +529 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tools/conflict-resolution.md +766 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +487 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +525 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tools/tdd-coverage-analysis.md +309 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-concept-enhanced.md +163 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-context-gather.md +235 -0
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +256 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/animation-extract.md +1150 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/codify-style.md +652 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/design-sync.md +454 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/explore-auto.md +678 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/generate.md +504 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/imitate-auto.md +745 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +537 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/layout-extract.md +788 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/reference-page-generator.md +356 -0
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/style-extract.md +773 -0
- package/.claude/skills/command-guide/scripts/analyze_commands.py +502 -0
- package/.claude/skills/command-guide/scripts/update-index.sh +130 -0
- package/.claude/skills/command-guide/templates/issue-bug.md +104 -0
- package/.claude/skills/command-guide/templates/issue-diagnosis.md +275 -0
- package/.claude/skills/command-guide/templates/issue-feature.md +97 -0
- package/.claude/skills/command-guide/templates/issue-question.md +141 -0
- package/.claude/skills/prompt-enhancer/SKILL.md +124 -0
- package/.claude/workflows/_template-compare-matrix.html +692 -0
- package/.claude/workflows/chinese-response.md +38 -0
- package/.claude/workflows/cli-templates/fix-plan-template.json +75 -0
- package/.claude/workflows/cli-templates/fix-progress-template.json +48 -0
- package/.claude/workflows/cli-templates/memory/style-skill-memory/skill-md-template.md +299 -0
- package/.claude/workflows/cli-templates/planning-roles/data-architect.md +120 -0
- package/.claude/workflows/cli-templates/planning-roles/product-manager.md +119 -0
- package/.claude/workflows/cli-templates/planning-roles/product-owner.md +261 -0
- package/.claude/workflows/cli-templates/planning-roles/scrum-master.md +186 -0
- package/.claude/workflows/cli-templates/planning-roles/subject-matter-expert.md +281 -0
- package/.claude/workflows/cli-templates/planning-roles/synthesis-role.md +414 -0
- package/.claude/workflows/cli-templates/planning-roles/system-architect.md +106 -0
- package/.claude/workflows/cli-templates/planning-roles/test-strategist.md +124 -0
- package/.claude/workflows/cli-templates/planning-roles/ui-designer.md +379 -0
- package/.claude/workflows/cli-templates/planning-roles/ux-expert.md +240 -0
- package/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt +127 -0
- package/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt +115 -0
- package/.claude/workflows/cli-templates/prompts/analysis/02-analyze-code-patterns.txt +37 -0
- package/.claude/workflows/cli-templates/prompts/analysis/02-analyze-technical-document.txt +33 -0
- package/.claude/workflows/cli-templates/prompts/analysis/02-review-architecture.txt +29 -0
- package/.claude/workflows/cli-templates/prompts/analysis/02-review-code-quality.txt +28 -0
- package/.claude/workflows/cli-templates/prompts/analysis/03-analyze-performance.txt +29 -0
- package/.claude/workflows/cli-templates/prompts/analysis/03-assess-security-risks.txt +29 -0
- package/.claude/workflows/cli-templates/prompts/analysis/03-review-quality-standards.txt +29 -0
- package/.claude/workflows/cli-templates/prompts/development/02-generate-tests.txt +70 -0
- package/.claude/workflows/cli-templates/prompts/development/02-implement-component-ui.txt +55 -0
- package/.claude/workflows/cli-templates/prompts/development/02-implement-feature.txt +58 -0
- package/.claude/workflows/cli-templates/prompts/development/02-refactor-codebase.txt +55 -0
- package/.claude/workflows/cli-templates/prompts/development/03-debug-runtime-issues.txt +55 -0
- package/.claude/workflows/cli-templates/prompts/documentation/api.txt +15 -0
- package/.claude/workflows/cli-templates/prompts/documentation/folder-navigation.txt +27 -0
- package/.claude/workflows/cli-templates/prompts/documentation/module-readme.txt +49 -0
- package/.claude/workflows/cli-templates/prompts/documentation/project-architecture.txt +41 -0
- package/.claude/workflows/cli-templates/prompts/documentation/project-examples.txt +35 -0
- package/.claude/workflows/cli-templates/prompts/documentation/project-readme.txt +35 -0
- package/.claude/workflows/cli-templates/prompts/memory/02-document-module-structure.txt +165 -0
- package/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt +109 -0
- package/.claude/workflows/cli-templates/prompts/planning/02-breakdown-task-steps.txt +30 -0
- package/.claude/workflows/cli-templates/prompts/planning/02-design-component-spec.txt +28 -0
- package/.claude/workflows/cli-templates/prompts/planning/03-evaluate-concept-feasibility.txt +127 -0
- package/.claude/workflows/cli-templates/prompts/planning/03-plan-migration-strategy.txt +30 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-api.txt +122 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-components.txt +122 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-config.txt +89 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-core.txt +60 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-patterns.txt +70 -0
- package/.claude/workflows/cli-templates/prompts/rules/rule-testing.txt +81 -0
- package/.claude/workflows/cli-templates/prompts/rules/tech-rules-agent-prompt.txt +89 -0
- package/.claude/workflows/cli-templates/prompts/tech/tech-module-format.txt +359 -0
- package/.claude/workflows/cli-templates/prompts/tech/tech-skill-index.txt +185 -0
- package/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.txt +179 -0
- package/.claude/workflows/cli-templates/prompts/universal/00-universal-creative-style.txt +95 -0
- package/.claude/workflows/cli-templates/prompts/universal/00-universal-rigorous-style.txt +92 -0
- package/.claude/workflows/cli-templates/prompts/verification/codex-technical.txt +28 -0
- package/.claude/workflows/cli-templates/prompts/verification/cross-validation.txt +28 -0
- package/.claude/workflows/cli-templates/prompts/verification/gemini-strategic.txt +27 -0
- package/.claude/workflows/cli-templates/prompts/workflow/analysis-results-structure.txt +224 -0
- package/.claude/workflows/cli-templates/prompts/workflow/codex-feasibility-validation.txt +176 -0
- package/.claude/workflows/cli-templates/prompts/workflow/gemini-solution-design.txt +131 -0
- package/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt +286 -0
- package/.claude/workflows/cli-templates/prompts/workflow/skill-aggregation.txt +172 -0
- package/.claude/workflows/cli-templates/prompts/workflow/skill-conflict-patterns.txt +94 -0
- package/.claude/workflows/cli-templates/prompts/workflow/skill-index.txt +224 -0
- package/.claude/workflows/cli-templates/prompts/workflow/skill-lessons-learned.txt +94 -0
- package/.claude/workflows/cli-templates/prompts/workflow/skill-sessions-timeline.txt +53 -0
- package/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt +123 -0
- package/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt +182 -0
- package/.claude/workflows/cli-templates/protocols/analysis-protocol.md +112 -0
- package/.claude/workflows/cli-templates/protocols/write-protocol.md +201 -0
- package/.claude/workflows/cli-templates/schemas/conflict-resolution-schema.json +137 -0
- package/.claude/workflows/cli-templates/schemas/debug-log-json-schema.json +127 -0
- package/.claude/workflows/cli-templates/schemas/diagnosis-json-schema.json +234 -0
- package/.claude/workflows/cli-templates/schemas/explore-json-schema.json +124 -0
- package/.claude/workflows/cli-templates/schemas/fix-plan-json-schema.json +298 -0
- package/.claude/workflows/cli-templates/schemas/plan-json-schema.json +244 -0
- package/.claude/workflows/cli-templates/schemas/project-json-schema.json +221 -0
- package/.claude/workflows/cli-templates/schemas/review-deep-dive-results-schema.json +82 -0
- package/.claude/workflows/cli-templates/schemas/review-dimension-results-schema.json +51 -0
- package/.claude/workflows/cli-templates/tech-stacks/go-dev.md +91 -0
- package/.claude/workflows/cli-templates/tech-stacks/java-dev.md +107 -0
- package/.claude/workflows/cli-templates/tech-stacks/javascript-dev.md +58 -0
- package/.claude/workflows/cli-templates/tech-stacks/python-dev.md +79 -0
- package/.claude/workflows/cli-templates/tech-stacks/react-dev.md +103 -0
- package/.claude/workflows/cli-templates/tech-stacks/typescript-dev.md +83 -0
- package/.claude/workflows/cli-templates/ui-design/systems/animation-tokens.json +247 -0
- package/.claude/workflows/cli-templates/ui-design/systems/design-tokens.json +342 -0
- package/.claude/workflows/cli-templates/ui-design/systems/layout-templates.json +145 -0
- package/.claude/workflows/cli-tools-usage.md +526 -0
- package/.claude/workflows/coding-philosophy.md +70 -0
- package/.claude/workflows/context-tools.md +84 -0
- package/.claude/workflows/file-modification.md +64 -0
- package/.claude/workflows/review-directory-specification.md +336 -0
- package/.claude/workflows/task-core.md +214 -0
- package/.claude/workflows/tool-strategy.md +216 -0
- package/.claude/workflows/windows-platform.md +16 -0
- package/.claude/workflows/workflow-architecture.md +942 -0
- package/.codex/AGENTS.md +63 -0
- package/.codex/prompts/debug.md +318 -0
- package/.codex/prompts/execute.md +273 -0
- package/.codex/prompts/lite-execute.md +164 -0
- package/.codex/prompts/lite-plan.md +469 -0
- package/.codex/prompts.zip +0 -0
- package/.gemini/GEMINI.md +25 -0
- package/.qwen/QWEN.md +25 -0
- package/LICENSE +21 -0
- package/README.md +294 -145
- package/ccw/README.md +145 -0
- package/ccw/package.json +65 -0
- package/codex-lens/pyproject.toml +48 -0
- package/codex-lens/src/codexlens/.workflow/.cli-history/history.db +0 -0
- package/codex-lens/src/codexlens/__init__.py +28 -0
- package/codex-lens/src/codexlens/__main__.py +14 -0
- package/codex-lens/src/codexlens/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/__main__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/entities.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/__pycache__/errors.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/__init__.py +27 -0
- package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-313.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-313.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-313.pyc +0 -0
- package/codex-lens/src/codexlens/cli/commands.py +1931 -0
- package/codex-lens/src/codexlens/cli/embedding_manager.py +620 -0
- package/codex-lens/src/codexlens/cli/model_manager.py +289 -0
- package/codex-lens/src/codexlens/cli/output.py +124 -0
- package/codex-lens/src/codexlens/config.py +201 -0
- package/codex-lens/src/codexlens/entities.py +121 -0
- package/codex-lens/src/codexlens/errors.py +55 -0
- package/codex-lens/src/codexlens/indexing/README.md +77 -0
- package/codex-lens/src/codexlens/indexing/__init__.py +4 -0
- package/codex-lens/src/codexlens/indexing/__pycache__/__init__.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/symbol_extractor.py +243 -0
- package/codex-lens/src/codexlens/parsers/__init__.py +8 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/encoding.cpython-313.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-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/parsers/encoding.py +202 -0
- package/codex-lens/src/codexlens/parsers/factory.py +256 -0
- package/codex-lens/src/codexlens/parsers/tokenizer.py +98 -0
- package/codex-lens/src/codexlens/parsers/treesitter_parser.py +335 -0
- package/codex-lens/src/codexlens/search/__init__.py +15 -0
- package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-313.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__/hybrid_search.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/query_parser.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/chain_search.py +647 -0
- package/codex-lens/src/codexlens/search/enrichment.py +150 -0
- package/codex-lens/src/codexlens/search/hybrid_search.py +313 -0
- package/codex-lens/src/codexlens/search/query_parser.py +242 -0
- package/codex-lens/src/codexlens/search/ranking.py +274 -0
- package/codex-lens/src/codexlens/semantic/__init__.py +39 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/code_extractor.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/graph_analyzer.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/__pycache__/llm_enhancer.cpython-313.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 +414 -0
- package/codex-lens/src/codexlens/semantic/chunker.py +448 -0
- package/codex-lens/src/codexlens/semantic/code_extractor.py +274 -0
- package/codex-lens/src/codexlens/semantic/embedder.py +185 -0
- package/codex-lens/src/codexlens/semantic/vector_store.py +955 -0
- package/codex-lens/src/codexlens/storage/__init__.py +29 -0
- package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/file_cache.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/migration_manager.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/path_mapper.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-313.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-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/dir_index.py +1850 -0
- package/codex-lens/src/codexlens/storage/file_cache.py +32 -0
- package/codex-lens/src/codexlens/storage/index_tree.py +776 -0
- package/codex-lens/src/codexlens/storage/migration_manager.py +154 -0
- package/codex-lens/src/codexlens/storage/migrations/__init__.py +1 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_001_normalize_keywords.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_002_add_token_metadata.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_003_code_relationships.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_004_dual_fts.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_005_cleanup_unused_fields.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_001_normalize_keywords.py +123 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_002_add_token_metadata.py +48 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_004_dual_fts.py +232 -0
- package/codex-lens/src/codexlens/storage/migrations/migration_005_cleanup_unused_fields.py +196 -0
- package/codex-lens/src/codexlens/storage/path_mapper.py +274 -0
- package/codex-lens/src/codexlens/storage/registry.py +670 -0
- package/codex-lens/src/codexlens/storage/sqlite_store.py +576 -0
- package/codex-lens/src/codexlens/storage/sqlite_utils.py +64 -0
- package/package.json +37 -32
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -219
- package/dist/cli.js.map +0 -1
- package/dist/commands/cli.d.ts +0 -32
- package/dist/commands/cli.d.ts.map +0 -1
- package/dist/commands/cli.js +0 -619
- package/dist/commands/cli.js.map +0 -1
- package/dist/commands/core-memory.d.ts +0 -32
- package/dist/commands/core-memory.d.ts.map +0 -1
- package/dist/commands/core-memory.js +0 -640
- package/dist/commands/core-memory.js.map +0 -1
- package/dist/commands/hook.d.ts +0 -16
- package/dist/commands/hook.d.ts.map +0 -1
- package/dist/commands/hook.js +0 -276
- package/dist/commands/hook.js.map +0 -1
- package/dist/commands/install.d.ts +0 -12
- package/dist/commands/install.d.ts.map +0 -1
- package/dist/commands/install.js +0 -443
- package/dist/commands/install.js.map +0 -1
- package/dist/commands/list.d.ts +0 -5
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js +0 -32
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/memory.d.ts +0 -57
- package/dist/commands/memory.d.ts.map +0 -1
- package/dist/commands/memory.js +0 -890
- package/dist/commands/memory.js.map +0 -1
- package/dist/commands/serve.d.ts +0 -12
- package/dist/commands/serve.d.ts.map +0 -1
- package/dist/commands/serve.js +0 -63
- package/dist/commands/serve.js.map +0 -1
- package/dist/commands/session-path-resolver.d.ts +0 -45
- package/dist/commands/session-path-resolver.d.ts.map +0 -1
- package/dist/commands/session-path-resolver.js +0 -302
- package/dist/commands/session-path-resolver.js.map +0 -1
- package/dist/commands/session.d.ts +0 -12
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js +0 -954
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/stop.d.ts +0 -11
- package/dist/commands/stop.d.ts.map +0 -1
- package/dist/commands/stop.js +0 -96
- package/dist/commands/stop.js.map +0 -1
- package/dist/commands/tool.d.ts +0 -29
- package/dist/commands/tool.d.ts.map +0 -1
- package/dist/commands/tool.js +0 -173
- package/dist/commands/tool.js.map +0 -1
- package/dist/commands/uninstall.d.ts +0 -9
- package/dist/commands/uninstall.d.ts.map +0 -1
- package/dist/commands/uninstall.js +0 -239
- package/dist/commands/uninstall.js.map +0 -1
- package/dist/commands/upgrade.d.ts +0 -10
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/upgrade.js +0 -288
- package/dist/commands/upgrade.js.map +0 -1
- package/dist/commands/view.d.ts +0 -14
- package/dist/commands/view.d.ts.map +0 -1
- package/dist/commands/view.js +0 -100
- package/dist/commands/view.js.map +0 -1
- package/dist/config/storage-paths.d.ts +0 -184
- package/dist/config/storage-paths.d.ts.map +0 -1
- package/dist/config/storage-paths.js +0 -536
- package/dist/config/storage-paths.js.map +0 -1
- package/dist/core/cache-manager.d.ts +0 -80
- package/dist/core/cache-manager.d.ts.map +0 -1
- package/dist/core/cache-manager.js +0 -260
- package/dist/core/cache-manager.js.map +0 -1
- package/dist/core/claude-freshness.d.ts +0 -53
- package/dist/core/claude-freshness.d.ts.map +0 -1
- package/dist/core/claude-freshness.js +0 -232
- package/dist/core/claude-freshness.js.map +0 -1
- package/dist/core/core-memory-store.d.ts +0 -320
- package/dist/core/core-memory-store.d.ts.map +0 -1
- package/dist/core/core-memory-store.js +0 -1177
- package/dist/core/core-memory-store.js.map +0 -1
- package/dist/core/dashboard-generator-patch.d.ts +0 -2
- package/dist/core/dashboard-generator-patch.d.ts.map +0 -1
- package/dist/core/dashboard-generator-patch.js +0 -48
- package/dist/core/dashboard-generator-patch.js.map +0 -1
- package/dist/core/dashboard-generator.d.ts +0 -8
- package/dist/core/dashboard-generator.d.ts.map +0 -1
- package/dist/core/dashboard-generator.js +0 -695
- package/dist/core/dashboard-generator.js.map +0 -1
- package/dist/core/data-aggregator.d.ts +0 -145
- package/dist/core/data-aggregator.d.ts.map +0 -1
- package/dist/core/data-aggregator.js +0 -416
- package/dist/core/data-aggregator.js.map +0 -1
- package/dist/core/history-importer.d.ts +0 -102
- package/dist/core/history-importer.d.ts.map +0 -1
- package/dist/core/history-importer.js +0 -493
- package/dist/core/history-importer.js.map +0 -1
- package/dist/core/lite-scanner-complete.d.ts +0 -81
- package/dist/core/lite-scanner-complete.d.ts.map +0 -1
- package/dist/core/lite-scanner-complete.js +0 -368
- package/dist/core/lite-scanner-complete.js.map +0 -1
- package/dist/core/lite-scanner.d.ts +0 -81
- package/dist/core/lite-scanner.d.ts.map +0 -1
- package/dist/core/lite-scanner.js +0 -368
- package/dist/core/lite-scanner.js.map +0 -1
- package/dist/core/manifest.d.ts +0 -88
- package/dist/core/manifest.d.ts.map +0 -1
- package/dist/core/manifest.js +0 -214
- package/dist/core/manifest.js.map +0 -1
- package/dist/core/memory-embedder-bridge.d.ts +0 -83
- package/dist/core/memory-embedder-bridge.d.ts.map +0 -1
- package/dist/core/memory-embedder-bridge.js +0 -181
- package/dist/core/memory-embedder-bridge.js.map +0 -1
- package/dist/core/memory-store.d.ts +0 -249
- package/dist/core/memory-store.d.ts.map +0 -1
- package/dist/core/memory-store.js +0 -781
- package/dist/core/memory-store.js.map +0 -1
- package/dist/core/routes/ccw-routes.d.ts +0 -20
- package/dist/core/routes/ccw-routes.d.ts.map +0 -1
- package/dist/core/routes/ccw-routes.js +0 -70
- package/dist/core/routes/ccw-routes.js.map +0 -1
- package/dist/core/routes/claude-routes.d.ts +0 -19
- package/dist/core/routes/claude-routes.d.ts.map +0 -1
- package/dist/core/routes/claude-routes.js +0 -1017
- package/dist/core/routes/claude-routes.js.map +0 -1
- package/dist/core/routes/cli-routes.d.ts +0 -20
- package/dist/core/routes/cli-routes.d.ts.map +0 -1
- package/dist/core/routes/cli-routes.js +0 -468
- package/dist/core/routes/cli-routes.js.map +0 -1
- package/dist/core/routes/codexlens-routes.d.ts +0 -20
- package/dist/core/routes/codexlens-routes.d.ts.map +0 -1
- package/dist/core/routes/codexlens-routes.js +0 -754
- package/dist/core/routes/codexlens-routes.js.map +0 -1
- package/dist/core/routes/core-memory-routes.d.ts +0 -21
- package/dist/core/routes/core-memory-routes.d.ts.map +0 -1
- package/dist/core/routes/core-memory-routes.js +0 -520
- package/dist/core/routes/core-memory-routes.js.map +0 -1
- package/dist/core/routes/files-routes.d.ts +0 -20
- package/dist/core/routes/files-routes.d.ts.map +0 -1
- package/dist/core/routes/files-routes.js +0 -374
- package/dist/core/routes/files-routes.js.map +0 -1
- package/dist/core/routes/graph-routes.d.ts +0 -20
- package/dist/core/routes/graph-routes.d.ts.map +0 -1
- package/dist/core/routes/graph-routes.js +0 -517
- package/dist/core/routes/graph-routes.js.map +0 -1
- package/dist/core/routes/help-routes.d.ts +0 -20
- package/dist/core/routes/help-routes.d.ts.map +0 -1
- package/dist/core/routes/help-routes.js +0 -250
- package/dist/core/routes/help-routes.js.map +0 -1
- package/dist/core/routes/hooks-routes.d.ts +0 -21
- package/dist/core/routes/hooks-routes.d.ts.map +0 -1
- package/dist/core/routes/hooks-routes.js +0 -346
- package/dist/core/routes/hooks-routes.js.map +0 -1
- package/dist/core/routes/mcp-routes.d.ts +0 -20
- package/dist/core/routes/mcp-routes.d.ts.map +0 -1
- package/dist/core/routes/mcp-routes.js +0 -1129
- package/dist/core/routes/mcp-routes.js.map +0 -1
- package/dist/core/routes/mcp-templates-db.d.ts +0 -54
- package/dist/core/routes/mcp-templates-db.d.ts.map +0 -1
- package/dist/core/routes/mcp-templates-db.js +0 -226
- package/dist/core/routes/mcp-templates-db.js.map +0 -1
- package/dist/core/routes/memory-routes.d.ts +0 -21
- package/dist/core/routes/memory-routes.d.ts.map +0 -1
- package/dist/core/routes/memory-routes.js +0 -1095
- package/dist/core/routes/memory-routes.js.map +0 -1
- package/dist/core/routes/rules-routes.d.ts +0 -20
- package/dist/core/routes/rules-routes.d.ts.map +0 -1
- package/dist/core/routes/rules-routes.js +0 -442
- package/dist/core/routes/rules-routes.js.map +0 -1
- package/dist/core/routes/session-routes.d.ts +0 -20
- package/dist/core/routes/session-routes.d.ts.map +0 -1
- package/dist/core/routes/session-routes.js +0 -423
- package/dist/core/routes/session-routes.js.map +0 -1
- package/dist/core/routes/skills-routes.d.ts +0 -20
- package/dist/core/routes/skills-routes.d.ts.map +0 -1
- package/dist/core/routes/skills-routes.js +0 -533
- package/dist/core/routes/skills-routes.js.map +0 -1
- package/dist/core/routes/status-routes.d.ts +0 -20
- package/dist/core/routes/status-routes.d.ts.map +0 -1
- package/dist/core/routes/status-routes.js +0 -38
- package/dist/core/routes/status-routes.js.map +0 -1
- package/dist/core/routes/system-routes.d.ts +0 -22
- package/dist/core/routes/system-routes.d.ts.map +0 -1
- package/dist/core/routes/system-routes.js +0 -354
- package/dist/core/routes/system-routes.js.map +0 -1
- package/dist/core/server.d.ts +0 -17
- package/dist/core/server.d.ts.map +0 -1
- package/dist/core/server.js +0 -386
- package/dist/core/server.js.map +0 -1
- package/dist/core/session-clustering-service.d.ts +0 -153
- package/dist/core/session-clustering-service.d.ts.map +0 -1
- package/dist/core/session-clustering-service.js +0 -1065
- package/dist/core/session-clustering-service.js.map +0 -1
- package/dist/core/session-scanner.d.ts +0 -32
- package/dist/core/session-scanner.d.ts.map +0 -1
- package/dist/core/session-scanner.js +0 -253
- package/dist/core/session-scanner.js.map +0 -1
- package/dist/core/websocket.d.ts +0 -23
- package/dist/core/websocket.d.ts.map +0 -1
- package/dist/core/websocket.js +0 -168
- package/dist/core/websocket.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -10
- package/dist/index.js.map +0 -1
- package/dist/mcp-server/index.d.ts +0 -7
- package/dist/mcp-server/index.d.ts.map +0 -1
- package/dist/mcp-server/index.js +0 -157
- package/dist/mcp-server/index.js.map +0 -1
- package/dist/tools/classify-folders.d.ts +0 -26
- package/dist/tools/classify-folders.d.ts.map +0 -1
- package/dist/tools/classify-folders.js +0 -201
- package/dist/tools/classify-folders.js.map +0 -1
- package/dist/tools/cli-config-manager.d.ts +0 -62
- package/dist/tools/cli-config-manager.d.ts.map +0 -1
- package/dist/tools/cli-config-manager.js +0 -221
- package/dist/tools/cli-config-manager.js.map +0 -1
- package/dist/tools/cli-executor.d.ts +0 -373
- package/dist/tools/cli-executor.d.ts.map +0 -1
- package/dist/tools/cli-executor.js +0 -1625
- package/dist/tools/cli-executor.js.map +0 -1
- package/dist/tools/cli-history-store.d.ts +0 -330
- package/dist/tools/cli-history-store.d.ts.map +0 -1
- package/dist/tools/cli-history-store.js +0 -916
- package/dist/tools/cli-history-store.js.map +0 -1
- package/dist/tools/codex-lens.d.ts +0 -118
- package/dist/tools/codex-lens.d.ts.map +0 -1
- package/dist/tools/codex-lens.js +0 -962
- package/dist/tools/codex-lens.js.map +0 -1
- package/dist/tools/convert-tokens-to-css.d.ts +0 -14
- package/dist/tools/convert-tokens-to-css.d.ts.map +0 -1
- package/dist/tools/convert-tokens-to-css.js +0 -244
- package/dist/tools/convert-tokens-to-css.js.map +0 -1
- package/dist/tools/core-memory.d.ts +0 -66
- package/dist/tools/core-memory.d.ts.map +0 -1
- package/dist/tools/core-memory.js +0 -324
- package/dist/tools/core-memory.js.map +0 -1
- package/dist/tools/detect-changed-modules.d.ts +0 -24
- package/dist/tools/detect-changed-modules.d.ts.map +0 -1
- package/dist/tools/detect-changed-modules.js +0 -277
- package/dist/tools/detect-changed-modules.js.map +0 -1
- package/dist/tools/discover-design-files.d.ts +0 -36
- package/dist/tools/discover-design-files.d.ts.map +0 -1
- package/dist/tools/discover-design-files.js +0 -147
- package/dist/tools/discover-design-files.js.map +0 -1
- package/dist/tools/edit-file.d.ts +0 -28
- package/dist/tools/edit-file.d.ts.map +0 -1
- package/dist/tools/edit-file.js +0 -479
- package/dist/tools/edit-file.js.map +0 -1
- package/dist/tools/generate-module-docs.d.ts +0 -22
- package/dist/tools/generate-module-docs.d.ts.map +0 -1
- package/dist/tools/generate-module-docs.js +0 -379
- package/dist/tools/generate-module-docs.js.map +0 -1
- package/dist/tools/get-modules-by-depth.d.ts +0 -15
- package/dist/tools/get-modules-by-depth.d.ts.map +0 -1
- package/dist/tools/get-modules-by-depth.js +0 -296
- package/dist/tools/get-modules-by-depth.js.map +0 -1
- package/dist/tools/index.d.ts +0 -55
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -304
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/native-session-discovery.d.ts +0 -97
- package/dist/tools/native-session-discovery.d.ts.map +0 -1
- package/dist/tools/native-session-discovery.js +0 -700
- package/dist/tools/native-session-discovery.js.map +0 -1
- package/dist/tools/notifier.d.ts +0 -50
- package/dist/tools/notifier.d.ts.map +0 -1
- package/dist/tools/notifier.js +0 -90
- package/dist/tools/notifier.js.map +0 -1
- package/dist/tools/read-file.d.ts +0 -32
- package/dist/tools/read-file.d.ts.map +0 -1
- package/dist/tools/read-file.js +0 -329
- package/dist/tools/read-file.js.map +0 -1
- package/dist/tools/resume-strategy.d.ts +0 -48
- package/dist/tools/resume-strategy.d.ts.map +0 -1
- package/dist/tools/resume-strategy.js +0 -248
- package/dist/tools/resume-strategy.js.map +0 -1
- package/dist/tools/session-content-parser.d.ts +0 -58
- package/dist/tools/session-content-parser.d.ts.map +0 -1
- package/dist/tools/session-content-parser.js +0 -420
- package/dist/tools/session-content-parser.js.map +0 -1
- package/dist/tools/session-manager.d.ts +0 -9
- package/dist/tools/session-manager.d.ts.map +0 -1
- package/dist/tools/session-manager.js +0 -834
- package/dist/tools/session-manager.js.map +0 -1
- package/dist/tools/smart-context.d.ts +0 -35
- package/dist/tools/smart-context.d.ts.map +0 -1
- package/dist/tools/smart-context.js +0 -182
- package/dist/tools/smart-context.js.map +0 -1
- package/dist/tools/smart-search.d.ts +0 -105
- package/dist/tools/smart-search.d.ts.map +0 -1
- package/dist/tools/smart-search.js +0 -1753
- package/dist/tools/smart-search.js.map +0 -1
- package/dist/tools/storage-manager.d.ts +0 -114
- package/dist/tools/storage-manager.d.ts.map +0 -1
- package/dist/tools/storage-manager.js +0 -392
- package/dist/tools/storage-manager.js.map +0 -1
- package/dist/tools/ui-generate-preview.d.ts +0 -39
- package/dist/tools/ui-generate-preview.d.ts.map +0 -1
- package/dist/tools/ui-generate-preview.js +0 -300
- package/dist/tools/ui-generate-preview.js.map +0 -1
- package/dist/tools/ui-instantiate-prototypes.d.ts +0 -75
- package/dist/tools/ui-instantiate-prototypes.d.ts.map +0 -1
- package/dist/tools/ui-instantiate-prototypes.js +0 -256
- package/dist/tools/ui-instantiate-prototypes.js.map +0 -1
- package/dist/tools/update-module-claude.d.ts +0 -80
- package/dist/tools/update-module-claude.d.ts.map +0 -1
- package/dist/tools/update-module-claude.js +0 -351
- package/dist/tools/update-module-claude.js.map +0 -1
- package/dist/tools/write-file.d.ts +0 -19
- package/dist/tools/write-file.d.ts.map +0 -1
- package/dist/tools/write-file.js +0 -193
- package/dist/tools/write-file.js.map +0 -1
- package/dist/types/config.d.ts +0 -11
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js +0 -2
- package/dist/types/config.js.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +0 -1
- package/dist/types/session.d.ts +0 -20
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/session.js +0 -2
- package/dist/types/session.js.map +0 -1
- package/dist/types/tool.d.ts +0 -36
- package/dist/types/tool.d.ts.map +0 -1
- package/dist/types/tool.js +0 -11
- package/dist/types/tool.js.map +0 -1
- package/dist/utils/browser-launcher.d.ts +0 -13
- package/dist/utils/browser-launcher.d.ts.map +0 -1
- package/dist/utils/browser-launcher.js +0 -60
- package/dist/utils/browser-launcher.js.map +0 -1
- package/dist/utils/file-utils.d.ts +0 -25
- package/dist/utils/file-utils.d.ts.map +0 -1
- package/dist/utils/file-utils.js +0 -48
- package/dist/utils/file-utils.js.map +0 -1
- package/dist/utils/path-resolver.d.ts +0 -80
- package/dist/utils/path-resolver.d.ts.map +0 -1
- package/dist/utils/path-resolver.js +0 -260
- package/dist/utils/path-resolver.js.map +0 -1
- package/dist/utils/path-validator.d.ts +0 -49
- package/dist/utils/path-validator.d.ts.map +0 -1
- package/dist/utils/path-validator.js +0 -123
- package/dist/utils/path-validator.js.map +0 -1
- package/dist/utils/ui.d.ts +0 -62
- package/dist/utils/ui.d.ts.map +0 -1
- package/dist/utils/ui.js +0 -129
- package/dist/utils/ui.js.map +0 -1
- /package/{bin → ccw/bin}/ccw-mcp.js +0 -0
- /package/{bin → ccw/bin}/ccw.js +0 -0
- /package/{src → ccw/src}/.workflow/.cli-history/history.db +0 -0
- /package/{src → ccw/src}/.workflow/.cli-history/history.db-shm +0 -0
- /package/{src → ccw/src}/.workflow/.cli-history/history.db-wal +0 -0
- /package/{src → ccw/src}/cli.ts +0 -0
- /package/{src → ccw/src}/commands/cli.ts +0 -0
- /package/{src → ccw/src}/commands/core-memory.ts +0 -0
- /package/{src → ccw/src}/commands/hook.ts +0 -0
- /package/{src → ccw/src}/commands/install.ts +0 -0
- /package/{src → ccw/src}/commands/list.ts +0 -0
- /package/{src → ccw/src}/commands/memory.ts +0 -0
- /package/{src → ccw/src}/commands/serve.ts +0 -0
- /package/{src → ccw/src}/commands/session-path-resolver.ts +0 -0
- /package/{src → ccw/src}/commands/session.ts +0 -0
- /package/{src → ccw/src}/commands/stop.ts +0 -0
- /package/{src → ccw/src}/commands/tool.ts +0 -0
- /package/{src → ccw/src}/commands/uninstall.ts +0 -0
- /package/{src → ccw/src}/commands/upgrade.ts +0 -0
- /package/{src → ccw/src}/commands/view.ts +0 -0
- /package/{src → ccw/src}/config/storage-paths.ts +0 -0
- /package/{src → ccw/src}/core/cache-manager.ts +0 -0
- /package/{src → ccw/src}/core/claude-freshness.ts +0 -0
- /package/{src → ccw/src}/core/core-memory-store.ts +0 -0
- /package/{src → ccw/src}/core/dashboard-generator-patch.ts +0 -0
- /package/{src → ccw/src}/core/dashboard-generator.ts +0 -0
- /package/{src → ccw/src}/core/data-aggregator.ts +0 -0
- /package/{src → ccw/src}/core/history-importer.ts +0 -0
- /package/{src → ccw/src}/core/lite-scanner-complete.ts +0 -0
- /package/{src → ccw/src}/core/lite-scanner.ts +0 -0
- /package/{src → ccw/src}/core/manifest.ts +0 -0
- /package/{src → ccw/src}/core/memory-embedder-bridge.ts +0 -0
- /package/{src → ccw/src}/core/memory-store.ts +0 -0
- /package/{src → ccw/src}/core/routes/ccw-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/claude-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/cli-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/codexlens-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/core-memory-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/files-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/graph-routes.md +0 -0
- /package/{src → ccw/src}/core/routes/graph-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/help-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/hooks-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/mcp-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/mcp-routes.ts.backup +0 -0
- /package/{src → ccw/src}/core/routes/mcp-templates-db.ts +0 -0
- /package/{src → ccw/src}/core/routes/memory-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/rules-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/session-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/skills-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/status-routes.ts +0 -0
- /package/{src → ccw/src}/core/routes/system-routes.ts +0 -0
- /package/{src → ccw/src}/core/server.ts +0 -0
- /package/{src → ccw/src}/core/session-clustering-service.ts +0 -0
- /package/{src → ccw/src}/core/session-scanner.ts +0 -0
- /package/{src → ccw/src}/core/websocket.ts +0 -0
- /package/{src → ccw/src}/index.ts +0 -0
- /package/{src → ccw/src}/mcp-server/index.ts +0 -0
- /package/{src → ccw/src}/templates/assets/css/github-dark.min.css +0 -0
- /package/{src → ccw/src}/templates/assets/css/github.min.css +0 -0
- /package/{src → ccw/src}/templates/assets/js/cytoscape.min.js +0 -0
- /package/{src → ccw/src}/templates/assets/js/d3.min.js +0 -0
- /package/{src → ccw/src}/templates/assets/js/highlight.min.js +0 -0
- /package/{src → ccw/src}/templates/assets/js/lucide.min.js +0 -0
- /package/{src → ccw/src}/templates/assets/js/marked.min.js +0 -0
- /package/{src → ccw/src}/templates/assets/js/tailwind.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/01-base.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/02-session.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/03-tasks.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/04-lite-tasks.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/05-context.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/06-cards.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/07-managers.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/08-review.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/09-explorer.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/10-cli-status.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/11-cli-history.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/12-cli-legacy.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/13-cli-ccw.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/14-cli-modals.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/15-cli-endpoints.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/16-cli-session.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/17-cli-conversation.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/18-cli-settings.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/19-cli-native-session.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/20-cli-taskqueue.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/21-cli-toolmgmt.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/22-cli-semantic.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/23-memory.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/24-prompt-history.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/25-skills-rules.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/26-claude-manager.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/27-graph-explorer.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/28-mcp-manager.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/29-help.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-css/30-core-memory.css +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/api.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/_conflict_tab.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/_exp_helpers.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/_review_tab.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/carousel.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/cli-history.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/cli-status.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/flowchart.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/global-notifications.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/hook-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/index-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/mcp-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/modals.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/navigation.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/notifications.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/sidebar.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/storage-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/tabs-context.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/tabs-other.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/task-drawer-core.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/task-drawer-renderers.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/task-queue-sidebar.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/theme.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/components/version-check.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/help-i18n.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/i18n.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/main.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/state.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/utils.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/claude-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/cli-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/codexlens-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/core-memory-clusters.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/core-memory.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/explorer.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/fix-session.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/graph-explorer.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/help.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/history.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/home.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/hook-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/lite-tasks.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/mcp-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/mcp-manager.js.backup +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/mcp-manager.js.new +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/memory.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/project-overview.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/prompt-history.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/review-session.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/rules-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/session-detail.js +0 -0
- /package/{src → ccw/src}/templates/dashboard-js/views/skills-manager.js +0 -0
- /package/{src → ccw/src}/templates/dashboard.html +0 -0
- /package/{src → ccw/src}/templates/hooks-config-example.json +0 -0
- /package/{src → ccw/src}/templates/review-cycle-dashboard.html +0 -0
- /package/{src → ccw/src}/templates/workflow-dashboard.html +0 -0
- /package/{src → ccw/src}/tools/classify-folders.ts +0 -0
- /package/{src → ccw/src}/tools/cli-config-manager.ts +0 -0
- /package/{src → ccw/src}/tools/cli-executor.ts +0 -0
- /package/{src → ccw/src}/tools/cli-history-store.ts +0 -0
- /package/{src → ccw/src}/tools/codex-lens.ts +0 -0
- /package/{src → ccw/src}/tools/convert-tokens-to-css.ts +0 -0
- /package/{src → ccw/src}/tools/core-memory.ts +0 -0
- /package/{src → ccw/src}/tools/detect-changed-modules.ts +0 -0
- /package/{src → ccw/src}/tools/discover-design-files.ts +0 -0
- /package/{src → ccw/src}/tools/edit-file.ts +0 -0
- /package/{src → ccw/src}/tools/generate-module-docs.ts +0 -0
- /package/{src → ccw/src}/tools/get-modules-by-depth.ts +0 -0
- /package/{src → ccw/src}/tools/index.ts +0 -0
- /package/{src → ccw/src}/tools/native-session-discovery.ts +0 -0
- /package/{src → ccw/src}/tools/notifier.ts +0 -0
- /package/{src → ccw/src}/tools/read-file.ts +0 -0
- /package/{src → ccw/src}/tools/resume-strategy.ts +0 -0
- /package/{src → ccw/src}/tools/session-content-parser.ts +0 -0
- /package/{src → ccw/src}/tools/session-manager.ts +0 -0
- /package/{src → ccw/src}/tools/smart-context.ts +0 -0
- /package/{src → ccw/src}/tools/smart-search.ts +0 -0
- /package/{src → ccw/src}/tools/smart-search.ts.backup +0 -0
- /package/{src → ccw/src}/tools/storage-manager.ts +0 -0
- /package/{src → ccw/src}/tools/ui-generate-preview.js +0 -0
- /package/{src → ccw/src}/tools/ui-instantiate-prototypes.js +0 -0
- /package/{src → ccw/src}/tools/update-module-claude.js +0 -0
- /package/{src → ccw/src}/tools/write-file.ts +0 -0
- /package/{src → ccw/src}/types/config.ts +0 -0
- /package/{src → ccw/src}/types/index.ts +0 -0
- /package/{src → ccw/src}/types/session.ts +0 -0
- /package/{src → ccw/src}/types/tool.ts +0 -0
- /package/{src → ccw/src}/utils/browser-launcher.ts +0 -0
- /package/{src → ccw/src}/utils/file-utils.ts +0 -0
- /package/{src → ccw/src}/utils/path-resolver.ts +0 -0
- /package/{src → ccw/src}/utils/path-validator.ts +0 -0
- /package/{src → ccw/src}/utils/ui.ts +0 -0
|
@@ -1,1017 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, existsSync, readdirSync, statSync } from 'fs';
|
|
2
|
-
import { join, relative } from 'path';
|
|
3
|
-
import { homedir } from 'os';
|
|
4
|
-
/**
|
|
5
|
-
* Parse frontmatter from markdown file
|
|
6
|
-
* Reuses logic from rules-routes.ts
|
|
7
|
-
*/
|
|
8
|
-
function parseClaudeFrontmatter(content) {
|
|
9
|
-
const result = {
|
|
10
|
-
paths: [],
|
|
11
|
-
content: content
|
|
12
|
-
};
|
|
13
|
-
if (content.startsWith('---')) {
|
|
14
|
-
const endIndex = content.indexOf('---', 3);
|
|
15
|
-
if (endIndex > 0) {
|
|
16
|
-
const frontmatter = content.substring(3, endIndex).trim();
|
|
17
|
-
result.content = content.substring(endIndex + 3).trim();
|
|
18
|
-
const lines = frontmatter.split('\n');
|
|
19
|
-
for (const line of lines) {
|
|
20
|
-
const colonIndex = line.indexOf(':');
|
|
21
|
-
if (colonIndex > 0) {
|
|
22
|
-
const key = line.substring(0, colonIndex).trim().toLowerCase();
|
|
23
|
-
const value = line.substring(colonIndex + 1).trim();
|
|
24
|
-
if (key === 'paths') {
|
|
25
|
-
result.paths = value.replace(/^\[|\]$/g, '').split(',').map(t => t.trim()).filter(Boolean);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Calculate file statistics
|
|
35
|
-
*/
|
|
36
|
-
function calculateFileStats(content) {
|
|
37
|
-
const lines = content.split('\n').length;
|
|
38
|
-
const words = content.split(/\s+/).filter(w => w.length > 0).length;
|
|
39
|
-
const characters = content.length;
|
|
40
|
-
return { lines, words, characters };
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Create ClaudeFile object from file path
|
|
44
|
-
*/
|
|
45
|
-
function createClaudeFile(filePath, level, basePath, isMainFile, depth) {
|
|
46
|
-
try {
|
|
47
|
-
if (!existsSync(filePath))
|
|
48
|
-
return null;
|
|
49
|
-
const stat = statSync(filePath);
|
|
50
|
-
const content = readFileSync(filePath, 'utf8');
|
|
51
|
-
const parsed = parseClaudeFrontmatter(content);
|
|
52
|
-
const relativePath = relative(basePath, filePath).replace(/\\/g, '/');
|
|
53
|
-
const fileName = filePath.split(/[\\/]/).pop() || 'CLAUDE.md';
|
|
54
|
-
// Parent directory for module-level files
|
|
55
|
-
const parentDir = level === 'module'
|
|
56
|
-
? filePath.split(/[\\/]/).slice(-2, -1)[0]
|
|
57
|
-
: undefined;
|
|
58
|
-
return {
|
|
59
|
-
id: `${level}-${relativePath}`,
|
|
60
|
-
level,
|
|
61
|
-
path: filePath,
|
|
62
|
-
relativePath,
|
|
63
|
-
name: fileName,
|
|
64
|
-
content: parsed.content,
|
|
65
|
-
size: stat.size,
|
|
66
|
-
lastModified: stat.mtime.toISOString(),
|
|
67
|
-
frontmatter: { paths: parsed.paths },
|
|
68
|
-
stats: calculateFileStats(content),
|
|
69
|
-
isMainFile,
|
|
70
|
-
parentDirectory: parentDir,
|
|
71
|
-
depth
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
console.error(`Error creating ClaudeFile for ${filePath}:`, e);
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Scan rules directory (recursive)
|
|
81
|
-
* Adapted from rules-routes.ts::scanRulesDirectory
|
|
82
|
-
*/
|
|
83
|
-
function scanClaudeRulesDirectory(dirPath, level, basePath) {
|
|
84
|
-
const files = [];
|
|
85
|
-
try {
|
|
86
|
-
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
87
|
-
for (const entry of entries) {
|
|
88
|
-
const fullPath = join(dirPath, entry.name);
|
|
89
|
-
if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
90
|
-
const file = createClaudeFile(fullPath, level, basePath, false);
|
|
91
|
-
if (file)
|
|
92
|
-
files.push(file);
|
|
93
|
-
}
|
|
94
|
-
else if (entry.isDirectory()) {
|
|
95
|
-
const subFiles = scanClaudeRulesDirectory(fullPath, level, basePath);
|
|
96
|
-
files.push(...subFiles);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
// Ignore errors
|
|
102
|
-
}
|
|
103
|
-
return files;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Scan modules for CLAUDE.md files
|
|
107
|
-
* Uses get-modules-by-depth logic
|
|
108
|
-
*/
|
|
109
|
-
function scanModules(projectPath) {
|
|
110
|
-
const modules = [];
|
|
111
|
-
const visited = new Set();
|
|
112
|
-
// Directories to exclude (from get-modules-by-depth.ts)
|
|
113
|
-
const SYSTEM_EXCLUDES = [
|
|
114
|
-
'.git', '.svn', '.hg', '__pycache__', 'node_modules', '.npm', '.yarn',
|
|
115
|
-
'dist', 'build', 'out', '.cache', '.venv', 'venv', 'env', 'coverage'
|
|
116
|
-
];
|
|
117
|
-
function scanDirectory(dirPath, depth) {
|
|
118
|
-
try {
|
|
119
|
-
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
120
|
-
// Check for CLAUDE.md in current directory
|
|
121
|
-
const claudePath = join(dirPath, 'CLAUDE.md');
|
|
122
|
-
if (existsSync(claudePath) && !visited.has(claudePath)) {
|
|
123
|
-
visited.add(claudePath);
|
|
124
|
-
const file = createClaudeFile(claudePath, 'module', projectPath, true, depth);
|
|
125
|
-
if (file)
|
|
126
|
-
modules.push(file);
|
|
127
|
-
}
|
|
128
|
-
// Recurse into subdirectories
|
|
129
|
-
for (const entry of entries) {
|
|
130
|
-
if (!entry.isDirectory())
|
|
131
|
-
continue;
|
|
132
|
-
if (SYSTEM_EXCLUDES.includes(entry.name))
|
|
133
|
-
continue;
|
|
134
|
-
const fullPath = join(dirPath, entry.name);
|
|
135
|
-
scanDirectory(fullPath, depth + 1);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (e) {
|
|
139
|
-
// Ignore permission errors
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
scanDirectory(projectPath, 0);
|
|
143
|
-
return modules.sort((a, b) => (b.depth || 0) - (a.depth || 0)); // Deepest first
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Scan all CLAUDE.md files
|
|
147
|
-
*/
|
|
148
|
-
function scanAllClaudeFiles(projectPath) {
|
|
149
|
-
const result = {
|
|
150
|
-
user: { main: null },
|
|
151
|
-
project: { main: null },
|
|
152
|
-
modules: [],
|
|
153
|
-
summary: { totalFiles: 0, totalSize: 0 }
|
|
154
|
-
};
|
|
155
|
-
// User-level files (only main CLAUDE.md, no rules)
|
|
156
|
-
const userHome = homedir();
|
|
157
|
-
const userClaudeDir = join(userHome, '.claude');
|
|
158
|
-
const userClaudePath = join(userClaudeDir, 'CLAUDE.md');
|
|
159
|
-
if (existsSync(userClaudePath)) {
|
|
160
|
-
result.user.main = createClaudeFile(userClaudePath, 'user', userHome, true);
|
|
161
|
-
}
|
|
162
|
-
// Project-level files (only main CLAUDE.md, no rules)
|
|
163
|
-
const projectClaudeDir = join(projectPath, '.claude');
|
|
164
|
-
const projectClaudePath = join(projectClaudeDir, 'CLAUDE.md');
|
|
165
|
-
if (existsSync(projectClaudePath)) {
|
|
166
|
-
result.project.main = createClaudeFile(projectClaudePath, 'project', projectPath, true);
|
|
167
|
-
}
|
|
168
|
-
// Module-level files
|
|
169
|
-
result.modules = scanModules(projectPath);
|
|
170
|
-
// Calculate summary (only main CLAUDE.md files, no rules)
|
|
171
|
-
const allFiles = [
|
|
172
|
-
result.user.main,
|
|
173
|
-
result.project.main,
|
|
174
|
-
...result.modules
|
|
175
|
-
].filter(f => f !== null);
|
|
176
|
-
result.summary = {
|
|
177
|
-
totalFiles: allFiles.length,
|
|
178
|
-
totalSize: allFiles.reduce((sum, f) => sum + f.size, 0),
|
|
179
|
-
lastSync: new Date().toISOString()
|
|
180
|
-
};
|
|
181
|
-
return result;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Get single file content
|
|
185
|
-
*/
|
|
186
|
-
function getClaudeFile(filePath) {
|
|
187
|
-
try {
|
|
188
|
-
if (!existsSync(filePath)) {
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
const stat = statSync(filePath);
|
|
192
|
-
const content = readFileSync(filePath, 'utf8');
|
|
193
|
-
const parsed = parseClaudeFrontmatter(content);
|
|
194
|
-
// Determine level based on path
|
|
195
|
-
let level = 'module';
|
|
196
|
-
if (filePath.includes(join(homedir(), '.claude'))) {
|
|
197
|
-
level = 'user';
|
|
198
|
-
}
|
|
199
|
-
else if (filePath.includes('.claude')) {
|
|
200
|
-
level = 'project';
|
|
201
|
-
}
|
|
202
|
-
const isMainFile = filePath.endsWith('CLAUDE.md') && !filePath.includes('rules');
|
|
203
|
-
return {
|
|
204
|
-
id: `${level}-${filePath}`,
|
|
205
|
-
level,
|
|
206
|
-
path: filePath,
|
|
207
|
-
relativePath: filePath,
|
|
208
|
-
name: filePath.split(/[\\/]/).pop() || 'CLAUDE.md',
|
|
209
|
-
content: parsed.content,
|
|
210
|
-
size: stat.size,
|
|
211
|
-
lastModified: stat.mtime.toISOString(),
|
|
212
|
-
frontmatter: { paths: parsed.paths },
|
|
213
|
-
stats: calculateFileStats(content),
|
|
214
|
-
isMainFile
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
catch (error) {
|
|
218
|
-
console.error('Error reading CLAUDE.md file:', error);
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Save file content
|
|
224
|
-
*/
|
|
225
|
-
function saveClaudeFile(filePath, content, createBackup = false) {
|
|
226
|
-
try {
|
|
227
|
-
if (!existsSync(filePath)) {
|
|
228
|
-
return { success: false, error: 'File not found' };
|
|
229
|
-
}
|
|
230
|
-
// Create backup if requested
|
|
231
|
-
if (createBackup) {
|
|
232
|
-
const backupPath = `${filePath}.backup-${Date.now()}`;
|
|
233
|
-
const originalContent = readFileSync(filePath, 'utf8');
|
|
234
|
-
writeFileSync(backupPath, originalContent, 'utf8');
|
|
235
|
-
}
|
|
236
|
-
// Write new content
|
|
237
|
-
writeFileSync(filePath, content, 'utf8');
|
|
238
|
-
return { success: true };
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
return { success: false, error: error.message };
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Generate CLI prompt for syncing CLAUDE.md files
|
|
246
|
-
*/
|
|
247
|
-
function generateSyncPrompt(level, modulePath) {
|
|
248
|
-
if (level === 'module' && modulePath) {
|
|
249
|
-
// Module-level prompt
|
|
250
|
-
return `PURPOSE: Generate module-level CLAUDE.md for ${modulePath}
|
|
251
|
-
TASK: • Analyze module's purpose and responsibilities • Document public APIs and interfaces • Identify dependencies and integration points • Note testing patterns and conventions
|
|
252
|
-
MODE: analysis
|
|
253
|
-
CONTEXT: @${modulePath}/**/* | Memory: Project conventions from .claude/CLAUDE.md
|
|
254
|
-
EXPECTED: Module-level CLAUDE.md with: - Module purpose (1-2 sentences) - Key files and their roles - Public API documentation - Integration points - Testing approach
|
|
255
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/planning/02-design-component-spec.txt) | Module-level perspective only | Concrete examples | analysis=READ-ONLY`;
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
// User/Project level prompt
|
|
259
|
-
const contextPath = level === 'user' ? '~/.claude' : '.claude';
|
|
260
|
-
return `PURPOSE: Update CLAUDE.md with current ${level} understanding
|
|
261
|
-
TASK: • Analyze ${level} configuration and conventions • Identify common patterns and anti-patterns • Generate concise, actionable rules • Maintain existing structure and formatting
|
|
262
|
-
MODE: analysis
|
|
263
|
-
CONTEXT: @${contextPath}/**/*
|
|
264
|
-
EXPECTED: Updated CLAUDE.md content with: - Preserved existing sections - New insights appended to relevant sections - Timestamp header - Focus on ${level}-level concerns
|
|
265
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-analyze-code-patterns.txt) | Maintain existing CLAUDE.md structure | Focus on actionable rules | analysis=READ-ONLY`;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Smart merge CLAUDE.md content (update mode)
|
|
270
|
-
*/
|
|
271
|
-
function smartMergeContent(existingContent, cliOutput) {
|
|
272
|
-
// For now, use simple append strategy
|
|
273
|
-
// TODO: Implement intelligent section-based merging
|
|
274
|
-
const timestamp = new Date().toISOString();
|
|
275
|
-
const separator = '\n\n---\n\n';
|
|
276
|
-
const header = `## Updated: ${timestamp}\n\n`;
|
|
277
|
-
return existingContent + separator + header + cliOutput;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Scan all files in project directory
|
|
281
|
-
*/
|
|
282
|
-
function scanAllProjectFiles(projectPath) {
|
|
283
|
-
const SYSTEM_EXCLUDES = [
|
|
284
|
-
'.git', '.svn', '.hg', '__pycache__', 'node_modules', '.npm', '.yarn',
|
|
285
|
-
'dist', 'build', 'out', '.cache', '.venv', 'venv', 'env', 'coverage',
|
|
286
|
-
'.next', '.nuxt', '.output', '.turbo', '.parcel-cache', 'logs', 'tmp', 'temp'
|
|
287
|
-
];
|
|
288
|
-
const results = {
|
|
289
|
-
files: [],
|
|
290
|
-
summary: { totalFiles: 0, totalDirectories: 0, totalSize: 0 }
|
|
291
|
-
};
|
|
292
|
-
function scanDir(dirPath, depth = 0) {
|
|
293
|
-
if (depth > 10)
|
|
294
|
-
return []; // Max depth limit
|
|
295
|
-
const files = [];
|
|
296
|
-
try {
|
|
297
|
-
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
298
|
-
for (const entry of entries) {
|
|
299
|
-
// Skip system excludes and hidden files (except .claude and .workflow)
|
|
300
|
-
if (SYSTEM_EXCLUDES.includes(entry.name))
|
|
301
|
-
continue;
|
|
302
|
-
if (entry.name.startsWith('.') && entry.name !== '.claude' && entry.name !== '.workflow')
|
|
303
|
-
continue;
|
|
304
|
-
const fullPath = join(dirPath, entry.name);
|
|
305
|
-
const relativePath = relative(projectPath, fullPath).replace(/\\/g, '/');
|
|
306
|
-
if (entry.isDirectory()) {
|
|
307
|
-
results.summary.totalDirectories++;
|
|
308
|
-
const dirNode = {
|
|
309
|
-
path: fullPath,
|
|
310
|
-
name: entry.name,
|
|
311
|
-
type: 'directory',
|
|
312
|
-
depth,
|
|
313
|
-
children: scanDir(fullPath, depth + 1)
|
|
314
|
-
};
|
|
315
|
-
files.push(dirNode);
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
const stat = statSync(fullPath);
|
|
319
|
-
results.summary.totalFiles++;
|
|
320
|
-
results.summary.totalSize += stat.size;
|
|
321
|
-
files.push({
|
|
322
|
-
path: fullPath,
|
|
323
|
-
name: entry.name,
|
|
324
|
-
type: 'file',
|
|
325
|
-
size: stat.size,
|
|
326
|
-
lastModified: stat.mtime.toISOString(),
|
|
327
|
-
depth
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
catch (e) {
|
|
333
|
-
// Ignore permission errors
|
|
334
|
-
}
|
|
335
|
-
return files;
|
|
336
|
-
}
|
|
337
|
-
results.files = scanDir(projectPath);
|
|
338
|
-
return results;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Read single file content
|
|
342
|
-
*/
|
|
343
|
-
function readSingleFile(filePath) {
|
|
344
|
-
try {
|
|
345
|
-
if (!existsSync(filePath))
|
|
346
|
-
return null;
|
|
347
|
-
const stat = statSync(filePath);
|
|
348
|
-
const content = readFileSync(filePath, 'utf8');
|
|
349
|
-
return {
|
|
350
|
-
content,
|
|
351
|
-
size: stat.size,
|
|
352
|
-
lastModified: stat.mtime.toISOString()
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
catch (e) {
|
|
356
|
-
return null;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Delete CLAUDE.md file
|
|
361
|
-
*/
|
|
362
|
-
function deleteClaudeFile(filePath) {
|
|
363
|
-
try {
|
|
364
|
-
if (!existsSync(filePath)) {
|
|
365
|
-
return { success: false, error: 'File not found' };
|
|
366
|
-
}
|
|
367
|
-
// Create backup before deletion
|
|
368
|
-
const backupPath = `${filePath}.deleted-${Date.now()}`;
|
|
369
|
-
const content = readFileSync(filePath, 'utf8');
|
|
370
|
-
writeFileSync(backupPath, content, 'utf8');
|
|
371
|
-
// Delete original file
|
|
372
|
-
const fs = require('fs');
|
|
373
|
-
fs.unlinkSync(filePath);
|
|
374
|
-
return { success: true };
|
|
375
|
-
}
|
|
376
|
-
catch (error) {
|
|
377
|
-
return { success: false, error: error.message };
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Create new CLAUDE.md file with template
|
|
382
|
-
*/
|
|
383
|
-
function createNewClaudeFile(level, template, pathParam) {
|
|
384
|
-
try {
|
|
385
|
-
let filePath;
|
|
386
|
-
let content;
|
|
387
|
-
// Determine file path
|
|
388
|
-
if (level === 'user') {
|
|
389
|
-
filePath = join(homedir(), '.claude', 'CLAUDE.md');
|
|
390
|
-
}
|
|
391
|
-
else if (level === 'project' && pathParam) {
|
|
392
|
-
filePath = join(pathParam, '.claude', 'CLAUDE.md');
|
|
393
|
-
}
|
|
394
|
-
else if (level === 'module' && pathParam) {
|
|
395
|
-
filePath = join(pathParam, 'CLAUDE.md');
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
return { success: false, error: 'Invalid parameters' };
|
|
399
|
-
}
|
|
400
|
-
// Check if file already exists
|
|
401
|
-
if (existsSync(filePath)) {
|
|
402
|
-
return { success: false, error: 'File already exists' };
|
|
403
|
-
}
|
|
404
|
-
// Generate content based on template
|
|
405
|
-
const timestamp = new Date().toISOString();
|
|
406
|
-
if (template === 'minimal') {
|
|
407
|
-
content = `# CLAUDE.md (${level.toUpperCase()} Level)\n\n> Created: ${timestamp}\n\n## Purpose\n\n[Describe the purpose of this ${level}-level context]\n\n## Guidelines\n\n- [Add guideline 1]\n- [Add guideline 2]\n`;
|
|
408
|
-
}
|
|
409
|
-
else if (template === 'comprehensive') {
|
|
410
|
-
content = `# CLAUDE.md (${level.toUpperCase()} Level)\n\n> Created: ${timestamp}\n\n## Purpose\n\n[Describe the purpose and scope]\n\n## Architecture\n\n[Describe key architectural decisions]\n\n## Coding Conventions\n\n### Naming\n\n- [Convention 1]\n- [Convention 2]\n\n### Patterns\n\n- [Pattern 1]\n- [Pattern 2]\n\n## Testing Guidelines\n\n[Testing approach and conventions]\n\n## Dependencies\n\n[Key dependencies and integration points]\n\n## Common Tasks\n\n### Task 1\n\n[Steps for task 1]\n\n### Task 2\n\n[Steps for task 2]\n`;
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
// default template
|
|
414
|
-
content = `# CLAUDE.md (${level.toUpperCase()} Level)\n\n> Created: ${timestamp}\n\n## Overview\n\n[Brief description of this ${level}-level context]\n\n## Key Conventions\n\n- [Convention 1]\n- [Convention 2]\n- [Convention 3]\n\n## Guidelines\n\n### Code Style\n\n[Style guidelines]\n\n### Best Practices\n\n[Best practices]\n`;
|
|
415
|
-
}
|
|
416
|
-
// Ensure directory exists
|
|
417
|
-
const dir = filePath.substring(0, filePath.lastIndexOf('/') || filePath.lastIndexOf('\\'));
|
|
418
|
-
const fs = require('fs');
|
|
419
|
-
if (!existsSync(dir)) {
|
|
420
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
421
|
-
}
|
|
422
|
-
// Write file
|
|
423
|
-
writeFileSync(filePath, content, 'utf8');
|
|
424
|
-
return { success: true, path: filePath };
|
|
425
|
-
}
|
|
426
|
-
catch (error) {
|
|
427
|
-
return { success: false, error: error.message };
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Handle CLAUDE.md routes
|
|
432
|
-
*/
|
|
433
|
-
export async function handleClaudeRoutes(ctx) {
|
|
434
|
-
const { pathname, url, req, res, initialPath, handlePostRequest, broadcastToClients } = ctx;
|
|
435
|
-
// API: Scan all CLAUDE.md files
|
|
436
|
-
if (pathname === '/api/memory/claude/scan') {
|
|
437
|
-
const projectPathParam = url.searchParams.get('path') || initialPath;
|
|
438
|
-
const filesData = scanAllClaudeFiles(projectPathParam);
|
|
439
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
440
|
-
res.end(JSON.stringify(filesData));
|
|
441
|
-
return true;
|
|
442
|
-
}
|
|
443
|
-
// API: Scan all project files (not just CLAUDE.md)
|
|
444
|
-
if (pathname === '/api/memory/claude/scan-all') {
|
|
445
|
-
const projectPathParam = url.searchParams.get('path') || initialPath;
|
|
446
|
-
const filesData = scanAllProjectFiles(projectPathParam);
|
|
447
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
448
|
-
res.end(JSON.stringify(filesData));
|
|
449
|
-
return true;
|
|
450
|
-
}
|
|
451
|
-
// API: Read single file
|
|
452
|
-
if (pathname === '/api/memory/claude/read-file' && req.method === 'GET') {
|
|
453
|
-
const filePath = url.searchParams.get('path');
|
|
454
|
-
if (!filePath) {
|
|
455
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
456
|
-
res.end(JSON.stringify({ error: 'Missing path parameter' }));
|
|
457
|
-
return true;
|
|
458
|
-
}
|
|
459
|
-
const fileData = readSingleFile(filePath);
|
|
460
|
-
if (!fileData) {
|
|
461
|
-
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
462
|
-
res.end(JSON.stringify({ error: 'File not found' }));
|
|
463
|
-
return true;
|
|
464
|
-
}
|
|
465
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
466
|
-
res.end(JSON.stringify(fileData));
|
|
467
|
-
return true;
|
|
468
|
-
}
|
|
469
|
-
// API: CLI Sync (analyze and update CLAUDE.md using CLI tools)
|
|
470
|
-
if (pathname === '/api/memory/claude/sync' && req.method === 'POST') {
|
|
471
|
-
handlePostRequest(req, res, async (body) => {
|
|
472
|
-
const { level, path: modulePath, tool = 'gemini', mode = 'update', targets } = body;
|
|
473
|
-
if (!level) {
|
|
474
|
-
return { error: 'Missing level parameter', status: 400 };
|
|
475
|
-
}
|
|
476
|
-
try {
|
|
477
|
-
// Import CLI executor
|
|
478
|
-
const { executeCliTool } = await import('../../tools/cli-executor.js');
|
|
479
|
-
// Determine file path based on level
|
|
480
|
-
let filePath;
|
|
481
|
-
let workingDir;
|
|
482
|
-
if (level === 'user') {
|
|
483
|
-
filePath = join(homedir(), '.claude', 'CLAUDE.md');
|
|
484
|
-
workingDir = join(homedir(), '.claude');
|
|
485
|
-
}
|
|
486
|
-
else if (level === 'project') {
|
|
487
|
-
filePath = join(initialPath, '.claude', 'CLAUDE.md');
|
|
488
|
-
workingDir = join(initialPath, '.claude');
|
|
489
|
-
}
|
|
490
|
-
else if (level === 'module' && modulePath) {
|
|
491
|
-
filePath = join(modulePath, 'CLAUDE.md');
|
|
492
|
-
workingDir = modulePath;
|
|
493
|
-
}
|
|
494
|
-
else {
|
|
495
|
-
return { error: 'Invalid level or missing path for module level', status: 400 };
|
|
496
|
-
}
|
|
497
|
-
// Check if file exists (for update/append modes)
|
|
498
|
-
const fileExists = existsSync(filePath);
|
|
499
|
-
if (!fileExists && mode !== 'generate') {
|
|
500
|
-
return { error: 'File does not exist. Use generate mode to create it.', status: 404 };
|
|
501
|
-
}
|
|
502
|
-
// Read existing content
|
|
503
|
-
const existingContent = fileExists ? readFileSync(filePath, 'utf8') : '';
|
|
504
|
-
// Generate CLI prompt
|
|
505
|
-
const cliPrompt = generateSyncPrompt(level, modulePath);
|
|
506
|
-
// Execute CLI tool
|
|
507
|
-
const syncId = `claude-sync-${level}-${Date.now()}`;
|
|
508
|
-
const result = await executeCliTool({
|
|
509
|
-
tool: tool === 'qwen' ? 'qwen' : 'gemini',
|
|
510
|
-
prompt: cliPrompt,
|
|
511
|
-
mode: 'analysis',
|
|
512
|
-
format: 'plain',
|
|
513
|
-
cd: workingDir,
|
|
514
|
-
timeout: 600000, // 10 minutes
|
|
515
|
-
stream: false,
|
|
516
|
-
category: 'internal',
|
|
517
|
-
id: syncId
|
|
518
|
-
});
|
|
519
|
-
if (!result.success || !result.execution?.output) {
|
|
520
|
-
return {
|
|
521
|
-
error: 'CLI execution failed',
|
|
522
|
-
details: result.execution?.error || 'No output received',
|
|
523
|
-
status: 500
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
// Extract CLI output
|
|
527
|
-
const cliOutput = typeof result.execution.output === 'string'
|
|
528
|
-
? result.execution.output
|
|
529
|
-
: result.execution.output.stdout || '';
|
|
530
|
-
if (!cliOutput || cliOutput.trim().length === 0) {
|
|
531
|
-
return { error: 'CLI returned empty output', status: 500 };
|
|
532
|
-
}
|
|
533
|
-
// Process content based on mode
|
|
534
|
-
let finalContent;
|
|
535
|
-
if (mode === 'generate') {
|
|
536
|
-
// Full replace
|
|
537
|
-
const timestamp = new Date().toISOString();
|
|
538
|
-
finalContent = `# CLAUDE.md (${level.toUpperCase()} Level)\n\n> Auto-generated using ${tool.toUpperCase()}\n> Last updated: ${timestamp}\n\n---\n\n${cliOutput}`;
|
|
539
|
-
}
|
|
540
|
-
else if (mode === 'append') {
|
|
541
|
-
// Simple append
|
|
542
|
-
const timestamp = new Date().toISOString();
|
|
543
|
-
finalContent = existingContent + `\n\n---\n\n## Updated: ${timestamp}\n\n${cliOutput}`;
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
// Smart merge (update mode)
|
|
547
|
-
finalContent = smartMergeContent(existingContent, cliOutput);
|
|
548
|
-
}
|
|
549
|
-
// Write updated content
|
|
550
|
-
writeFileSync(filePath, finalContent, 'utf8');
|
|
551
|
-
// Mark file as updated for freshness tracking
|
|
552
|
-
try {
|
|
553
|
-
const { markFileAsUpdated } = await import('../claude-freshness.js');
|
|
554
|
-
markFileAsUpdated(filePath, level, 'cli_sync', initialPath, { tool, mode });
|
|
555
|
-
}
|
|
556
|
-
catch (e) {
|
|
557
|
-
console.error('Failed to mark file as updated:', e);
|
|
558
|
-
}
|
|
559
|
-
// Broadcast WebSocket event
|
|
560
|
-
broadcastToClients({
|
|
561
|
-
type: 'CLAUDE_FILE_SYNCED',
|
|
562
|
-
payload: {
|
|
563
|
-
path: filePath,
|
|
564
|
-
level,
|
|
565
|
-
tool,
|
|
566
|
-
mode,
|
|
567
|
-
executionId: syncId,
|
|
568
|
-
timestamp: new Date().toISOString()
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
return {
|
|
572
|
-
success: true,
|
|
573
|
-
path: filePath,
|
|
574
|
-
executionId: syncId,
|
|
575
|
-
mode,
|
|
576
|
-
tool
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
catch (error) {
|
|
580
|
-
console.error('Error syncing CLAUDE.md file:', error);
|
|
581
|
-
return {
|
|
582
|
-
error: 'Sync failed',
|
|
583
|
-
details: error.message,
|
|
584
|
-
status: 500
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
return true;
|
|
589
|
-
}
|
|
590
|
-
// API: Get single file
|
|
591
|
-
if (pathname === '/api/memory/claude/file' && req.method === 'GET') {
|
|
592
|
-
const filePath = url.searchParams.get('path');
|
|
593
|
-
if (!filePath) {
|
|
594
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
595
|
-
res.end(JSON.stringify({ error: 'Missing path parameter' }));
|
|
596
|
-
return true;
|
|
597
|
-
}
|
|
598
|
-
const file = getClaudeFile(filePath);
|
|
599
|
-
if (!file) {
|
|
600
|
-
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
601
|
-
res.end(JSON.stringify({ error: 'File not found' }));
|
|
602
|
-
return true;
|
|
603
|
-
}
|
|
604
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
605
|
-
res.end(JSON.stringify(file));
|
|
606
|
-
return true;
|
|
607
|
-
}
|
|
608
|
-
// API: Save file
|
|
609
|
-
if (pathname === '/api/memory/claude/file' && req.method === 'POST') {
|
|
610
|
-
handlePostRequest(req, res, async (body) => {
|
|
611
|
-
const { path: filePath, content, createBackup } = body;
|
|
612
|
-
if (!filePath || content === undefined) {
|
|
613
|
-
return { error: 'Missing path or content parameter', status: 400 };
|
|
614
|
-
}
|
|
615
|
-
const result = saveClaudeFile(filePath, content, createBackup);
|
|
616
|
-
if (result.success) {
|
|
617
|
-
// Broadcast update to all clients
|
|
618
|
-
ctx.broadcastToClients({
|
|
619
|
-
type: 'CLAUDE_FILE_UPDATED',
|
|
620
|
-
data: { path: filePath }
|
|
621
|
-
});
|
|
622
|
-
return { success: true, path: filePath };
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
625
|
-
return { error: result.error, status: 500 };
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
return true;
|
|
629
|
-
}
|
|
630
|
-
// API: Delete file
|
|
631
|
-
if (pathname === '/api/memory/claude/file' && req.method === 'DELETE') {
|
|
632
|
-
const filePath = url.searchParams.get('path');
|
|
633
|
-
const confirm = url.searchParams.get('confirm');
|
|
634
|
-
if (!filePath) {
|
|
635
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
636
|
-
res.end(JSON.stringify({ error: 'Missing path parameter' }));
|
|
637
|
-
return true;
|
|
638
|
-
}
|
|
639
|
-
if (confirm !== 'true') {
|
|
640
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
641
|
-
res.end(JSON.stringify({ error: 'Confirmation required' }));
|
|
642
|
-
return true;
|
|
643
|
-
}
|
|
644
|
-
const result = deleteClaudeFile(filePath);
|
|
645
|
-
if (result.success) {
|
|
646
|
-
broadcastToClients({
|
|
647
|
-
type: 'CLAUDE_FILE_DELETED',
|
|
648
|
-
data: { path: filePath }
|
|
649
|
-
});
|
|
650
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
651
|
-
res.end(JSON.stringify({ success: true }));
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
655
|
-
res.end(JSON.stringify({ error: result.error }));
|
|
656
|
-
}
|
|
657
|
-
return true;
|
|
658
|
-
}
|
|
659
|
-
// API: Create file
|
|
660
|
-
if (pathname === '/api/memory/claude/create' && req.method === 'POST') {
|
|
661
|
-
handlePostRequest(req, res, async (body) => {
|
|
662
|
-
const { level, path, template = 'default' } = body;
|
|
663
|
-
if (!level) {
|
|
664
|
-
return { error: 'Missing level parameter', status: 400 };
|
|
665
|
-
}
|
|
666
|
-
let result;
|
|
667
|
-
if (level === 'project') {
|
|
668
|
-
// For project level, use initialPath
|
|
669
|
-
const filePath = join(initialPath, '.claude', 'CLAUDE.md');
|
|
670
|
-
result = createNewClaudeFile(level, template, initialPath);
|
|
671
|
-
}
|
|
672
|
-
else if (level === 'module') {
|
|
673
|
-
if (!path) {
|
|
674
|
-
return { error: 'Module path required', status: 400 };
|
|
675
|
-
}
|
|
676
|
-
result = createNewClaudeFile(level, template, path);
|
|
677
|
-
}
|
|
678
|
-
else {
|
|
679
|
-
result = createNewClaudeFile(level, template);
|
|
680
|
-
}
|
|
681
|
-
if (result.success) {
|
|
682
|
-
broadcastToClients({
|
|
683
|
-
type: 'CLAUDE_FILE_CREATED',
|
|
684
|
-
data: { path: result.path, level }
|
|
685
|
-
});
|
|
686
|
-
return { success: true, path: result.path };
|
|
687
|
-
}
|
|
688
|
-
else {
|
|
689
|
-
return { error: result.error, status: 500 };
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
return true;
|
|
693
|
-
}
|
|
694
|
-
// API: Get Chinese response setting status
|
|
695
|
-
if (pathname === '/api/language/chinese-response' && req.method === 'GET') {
|
|
696
|
-
try {
|
|
697
|
-
const userClaudePath = join(homedir(), '.claude', 'CLAUDE.md');
|
|
698
|
-
const chineseRefPattern = /@.*chinese-response\.md/i;
|
|
699
|
-
let enabled = false;
|
|
700
|
-
let guidelinesPath = '';
|
|
701
|
-
// Check if user CLAUDE.md exists and contains Chinese response reference
|
|
702
|
-
if (existsSync(userClaudePath)) {
|
|
703
|
-
const content = readFileSync(userClaudePath, 'utf8');
|
|
704
|
-
enabled = chineseRefPattern.test(content);
|
|
705
|
-
}
|
|
706
|
-
// Find guidelines file path - always use user-level path
|
|
707
|
-
const userGuidelinesPath = join(homedir(), '.claude', 'workflows', 'chinese-response.md');
|
|
708
|
-
if (existsSync(userGuidelinesPath)) {
|
|
709
|
-
guidelinesPath = userGuidelinesPath;
|
|
710
|
-
}
|
|
711
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
712
|
-
res.end(JSON.stringify({
|
|
713
|
-
enabled,
|
|
714
|
-
guidelinesPath,
|
|
715
|
-
guidelinesExists: !!guidelinesPath,
|
|
716
|
-
userClaudeMdExists: existsSync(userClaudePath)
|
|
717
|
-
}));
|
|
718
|
-
return true;
|
|
719
|
-
}
|
|
720
|
-
catch (error) {
|
|
721
|
-
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
722
|
-
res.end(JSON.stringify({ error: error.message }));
|
|
723
|
-
return true;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
// API: Toggle Chinese response setting
|
|
727
|
-
if (pathname === '/api/language/chinese-response' && req.method === 'POST') {
|
|
728
|
-
handlePostRequest(req, res, async (body) => {
|
|
729
|
-
const { enabled } = body;
|
|
730
|
-
if (typeof enabled !== 'boolean') {
|
|
731
|
-
return { error: 'Missing or invalid enabled parameter', status: 400 };
|
|
732
|
-
}
|
|
733
|
-
try {
|
|
734
|
-
const userClaudePath = join(homedir(), '.claude', 'CLAUDE.md');
|
|
735
|
-
const userClaudeDir = join(homedir(), '.claude');
|
|
736
|
-
// Find guidelines file path - always use user-level path with ~ shorthand
|
|
737
|
-
const userGuidelinesPath = join(homedir(), '.claude', 'workflows', 'chinese-response.md');
|
|
738
|
-
if (!existsSync(userGuidelinesPath)) {
|
|
739
|
-
return { error: 'Chinese response guidelines file not found at ~/.claude/workflows/chinese-response.md', status: 404 };
|
|
740
|
-
}
|
|
741
|
-
const guidelinesRef = '~/.claude/workflows/chinese-response.md';
|
|
742
|
-
const chineseRefLine = `- **中文回复准则**: @${guidelinesRef}`;
|
|
743
|
-
const chineseRefPattern = /^- \*\*中文回复准则\*\*:.*chinese-response\.md.*$/gm;
|
|
744
|
-
// Ensure user .claude directory exists
|
|
745
|
-
if (!existsSync(userClaudeDir)) {
|
|
746
|
-
const fs = require('fs');
|
|
747
|
-
fs.mkdirSync(userClaudeDir, { recursive: true });
|
|
748
|
-
}
|
|
749
|
-
let content = '';
|
|
750
|
-
if (existsSync(userClaudePath)) {
|
|
751
|
-
content = readFileSync(userClaudePath, 'utf8');
|
|
752
|
-
}
|
|
753
|
-
else {
|
|
754
|
-
// Create new CLAUDE.md with header
|
|
755
|
-
content = '# Claude Instructions\n\n';
|
|
756
|
-
}
|
|
757
|
-
if (enabled) {
|
|
758
|
-
// Check if reference already exists
|
|
759
|
-
if (chineseRefPattern.test(content)) {
|
|
760
|
-
return { success: true, message: 'Already enabled' };
|
|
761
|
-
}
|
|
762
|
-
// Add reference after the header line or at the beginning
|
|
763
|
-
const headerMatch = content.match(/^# Claude Instructions\n\n?/);
|
|
764
|
-
if (headerMatch) {
|
|
765
|
-
const insertPosition = headerMatch[0].length;
|
|
766
|
-
content = content.slice(0, insertPosition) + chineseRefLine + '\n' + content.slice(insertPosition);
|
|
767
|
-
}
|
|
768
|
-
else {
|
|
769
|
-
// Add header and reference
|
|
770
|
-
content = '# Claude Instructions\n\n' + chineseRefLine + '\n' + content;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
else {
|
|
774
|
-
// Remove reference
|
|
775
|
-
content = content.replace(chineseRefPattern, '').replace(/\n{3,}/g, '\n\n').trim();
|
|
776
|
-
if (content)
|
|
777
|
-
content += '\n';
|
|
778
|
-
}
|
|
779
|
-
writeFileSync(userClaudePath, content, 'utf8');
|
|
780
|
-
// Broadcast update
|
|
781
|
-
broadcastToClients({
|
|
782
|
-
type: 'LANGUAGE_SETTING_CHANGED',
|
|
783
|
-
data: { chineseResponse: enabled }
|
|
784
|
-
});
|
|
785
|
-
return { success: true, enabled };
|
|
786
|
-
}
|
|
787
|
-
catch (error) {
|
|
788
|
-
return { error: error.message, status: 500 };
|
|
789
|
-
}
|
|
790
|
-
});
|
|
791
|
-
return true;
|
|
792
|
-
}
|
|
793
|
-
// API: Get Windows platform setting status
|
|
794
|
-
if (pathname === '/api/language/windows-platform' && req.method === 'GET') {
|
|
795
|
-
try {
|
|
796
|
-
const userClaudePath = join(homedir(), '.claude', 'CLAUDE.md');
|
|
797
|
-
const windowsRefPattern = /@.*windows-platform\.md/i;
|
|
798
|
-
let enabled = false;
|
|
799
|
-
let guidelinesPath = '';
|
|
800
|
-
// Check if user CLAUDE.md exists and contains Windows platform reference
|
|
801
|
-
if (existsSync(userClaudePath)) {
|
|
802
|
-
const content = readFileSync(userClaudePath, 'utf8');
|
|
803
|
-
enabled = windowsRefPattern.test(content);
|
|
804
|
-
}
|
|
805
|
-
// Find guidelines file path - always use user-level path
|
|
806
|
-
const userGuidelinesPath = join(homedir(), '.claude', 'workflows', 'windows-platform.md');
|
|
807
|
-
if (existsSync(userGuidelinesPath)) {
|
|
808
|
-
guidelinesPath = userGuidelinesPath;
|
|
809
|
-
}
|
|
810
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
811
|
-
res.end(JSON.stringify({
|
|
812
|
-
enabled,
|
|
813
|
-
guidelinesPath,
|
|
814
|
-
guidelinesExists: !!guidelinesPath,
|
|
815
|
-
userClaudeMdExists: existsSync(userClaudePath)
|
|
816
|
-
}));
|
|
817
|
-
return true;
|
|
818
|
-
}
|
|
819
|
-
catch (error) {
|
|
820
|
-
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
821
|
-
res.end(JSON.stringify({ error: error.message }));
|
|
822
|
-
return true;
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
// API: Toggle Windows platform setting
|
|
826
|
-
if (pathname === '/api/language/windows-platform' && req.method === 'POST') {
|
|
827
|
-
handlePostRequest(req, res, async (body) => {
|
|
828
|
-
const { enabled } = body;
|
|
829
|
-
if (typeof enabled !== 'boolean') {
|
|
830
|
-
return { error: 'Missing or invalid enabled parameter', status: 400 };
|
|
831
|
-
}
|
|
832
|
-
try {
|
|
833
|
-
const userClaudePath = join(homedir(), '.claude', 'CLAUDE.md');
|
|
834
|
-
const userClaudeDir = join(homedir(), '.claude');
|
|
835
|
-
// Find guidelines file path - always use user-level path with ~ shorthand
|
|
836
|
-
const userGuidelinesPath = join(homedir(), '.claude', 'workflows', 'windows-platform.md');
|
|
837
|
-
if (!existsSync(userGuidelinesPath)) {
|
|
838
|
-
return { error: 'Windows platform guidelines file not found at ~/.claude/workflows/windows-platform.md', status: 404 };
|
|
839
|
-
}
|
|
840
|
-
const guidelinesRef = '~/.claude/workflows/windows-platform.md';
|
|
841
|
-
const windowsRefLine = `- **Windows Platform**: @${guidelinesRef}`;
|
|
842
|
-
const windowsRefPattern = /^- \*\*Windows Platform\*\*:.*windows-platform\.md.*$/gm;
|
|
843
|
-
// Ensure user .claude directory exists
|
|
844
|
-
if (!existsSync(userClaudeDir)) {
|
|
845
|
-
const fs = require('fs');
|
|
846
|
-
fs.mkdirSync(userClaudeDir, { recursive: true });
|
|
847
|
-
}
|
|
848
|
-
let content = '';
|
|
849
|
-
if (existsSync(userClaudePath)) {
|
|
850
|
-
content = readFileSync(userClaudePath, 'utf8');
|
|
851
|
-
}
|
|
852
|
-
else {
|
|
853
|
-
// Create new CLAUDE.md with header
|
|
854
|
-
content = '# Claude Instructions\n\n';
|
|
855
|
-
}
|
|
856
|
-
if (enabled) {
|
|
857
|
-
// Check if reference already exists
|
|
858
|
-
if (windowsRefPattern.test(content)) {
|
|
859
|
-
return { success: true, message: 'Already enabled' };
|
|
860
|
-
}
|
|
861
|
-
// Add reference after the header line or at the beginning
|
|
862
|
-
const headerMatch = content.match(/^# Claude Instructions\n\n?/);
|
|
863
|
-
if (headerMatch) {
|
|
864
|
-
const insertPosition = headerMatch[0].length;
|
|
865
|
-
content = content.slice(0, insertPosition) + windowsRefLine + '\n' + content.slice(insertPosition);
|
|
866
|
-
}
|
|
867
|
-
else {
|
|
868
|
-
// Add header and reference
|
|
869
|
-
content = '# Claude Instructions\n\n' + windowsRefLine + '\n' + content;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
else {
|
|
873
|
-
// Remove reference
|
|
874
|
-
content = content.replace(windowsRefPattern, '').replace(/\n{3,}/g, '\n\n').trim();
|
|
875
|
-
if (content)
|
|
876
|
-
content += '\n';
|
|
877
|
-
}
|
|
878
|
-
writeFileSync(userClaudePath, content, 'utf8');
|
|
879
|
-
// Broadcast update
|
|
880
|
-
broadcastToClients({
|
|
881
|
-
type: 'LANGUAGE_SETTING_CHANGED',
|
|
882
|
-
data: { windowsPlatform: enabled }
|
|
883
|
-
});
|
|
884
|
-
return { success: true, enabled };
|
|
885
|
-
}
|
|
886
|
-
catch (error) {
|
|
887
|
-
return { error: error.message, status: 500 };
|
|
888
|
-
}
|
|
889
|
-
});
|
|
890
|
-
return true;
|
|
891
|
-
}
|
|
892
|
-
// API: Get freshness scores for all CLAUDE.md files
|
|
893
|
-
if (pathname === '/api/memory/claude/freshness' && req.method === 'GET') {
|
|
894
|
-
try {
|
|
895
|
-
const { calculateAllFreshness } = await import('../claude-freshness.js');
|
|
896
|
-
const projectPathParam = url.searchParams.get('path') || initialPath;
|
|
897
|
-
const threshold = parseInt(url.searchParams.get('threshold') || '20', 10);
|
|
898
|
-
// Get all CLAUDE.md files
|
|
899
|
-
const filesData = scanAllClaudeFiles(projectPathParam);
|
|
900
|
-
// Prepare file list for freshness calculation
|
|
901
|
-
const claudeFiles = [];
|
|
902
|
-
if (filesData.user.main) {
|
|
903
|
-
claudeFiles.push({
|
|
904
|
-
path: filesData.user.main.path,
|
|
905
|
-
level: 'user',
|
|
906
|
-
lastModified: filesData.user.main.lastModified
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
if (filesData.project.main) {
|
|
910
|
-
claudeFiles.push({
|
|
911
|
-
path: filesData.project.main.path,
|
|
912
|
-
level: 'project',
|
|
913
|
-
lastModified: filesData.project.main.lastModified
|
|
914
|
-
});
|
|
915
|
-
}
|
|
916
|
-
for (const module of filesData.modules) {
|
|
917
|
-
claudeFiles.push({
|
|
918
|
-
path: module.path,
|
|
919
|
-
level: 'module',
|
|
920
|
-
lastModified: module.lastModified
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
// Calculate freshness
|
|
924
|
-
const freshnessData = calculateAllFreshness(claudeFiles, projectPathParam, threshold);
|
|
925
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
926
|
-
res.end(JSON.stringify(freshnessData));
|
|
927
|
-
return true;
|
|
928
|
-
}
|
|
929
|
-
catch (error) {
|
|
930
|
-
console.error('Error calculating freshness:', error);
|
|
931
|
-
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
932
|
-
res.end(JSON.stringify({ error: error.message }));
|
|
933
|
-
return true;
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
// API: Mark a CLAUDE.md file as updated
|
|
937
|
-
if (pathname === '/api/memory/claude/mark-updated' && req.method === 'POST') {
|
|
938
|
-
handlePostRequest(req, res, async (body) => {
|
|
939
|
-
const { path: filePath, source, metadata } = body;
|
|
940
|
-
if (!filePath) {
|
|
941
|
-
return { error: 'Missing path parameter', status: 400 };
|
|
942
|
-
}
|
|
943
|
-
if (!source || !['manual', 'cli_sync', 'dashboard', 'api'].includes(source)) {
|
|
944
|
-
return { error: 'Invalid or missing source parameter', status: 400 };
|
|
945
|
-
}
|
|
946
|
-
try {
|
|
947
|
-
const { markFileAsUpdated } = await import('../claude-freshness.js');
|
|
948
|
-
// Determine file level
|
|
949
|
-
let level = 'module';
|
|
950
|
-
if (filePath.includes(join(homedir(), '.claude'))) {
|
|
951
|
-
level = 'user';
|
|
952
|
-
}
|
|
953
|
-
else if (filePath.includes('.claude')) {
|
|
954
|
-
level = 'project';
|
|
955
|
-
}
|
|
956
|
-
const record = markFileAsUpdated(filePath, level, source, initialPath, metadata);
|
|
957
|
-
// Broadcast update
|
|
958
|
-
broadcastToClients({
|
|
959
|
-
type: 'CLAUDE_FRESHNESS_UPDATED',
|
|
960
|
-
data: {
|
|
961
|
-
path: filePath,
|
|
962
|
-
level,
|
|
963
|
-
updatedAt: record.updated_at,
|
|
964
|
-
source
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
return {
|
|
968
|
-
success: true,
|
|
969
|
-
record: {
|
|
970
|
-
id: record.id,
|
|
971
|
-
updated_at: record.updated_at,
|
|
972
|
-
filesChangedBeforeUpdate: record.files_changed_before_update
|
|
973
|
-
}
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
catch (error) {
|
|
977
|
-
console.error('Error marking file as updated:', error);
|
|
978
|
-
return { error: error.message, status: 500 };
|
|
979
|
-
}
|
|
980
|
-
});
|
|
981
|
-
return true;
|
|
982
|
-
}
|
|
983
|
-
// API: Get update history for a CLAUDE.md file
|
|
984
|
-
if (pathname === '/api/memory/claude/history' && req.method === 'GET') {
|
|
985
|
-
const filePath = url.searchParams.get('path');
|
|
986
|
-
const limit = parseInt(url.searchParams.get('limit') || '50', 10);
|
|
987
|
-
if (!filePath) {
|
|
988
|
-
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
989
|
-
res.end(JSON.stringify({ error: 'Missing path parameter' }));
|
|
990
|
-
return true;
|
|
991
|
-
}
|
|
992
|
-
try {
|
|
993
|
-
const { getUpdateHistory } = await import('../claude-freshness.js');
|
|
994
|
-
const records = getUpdateHistory(filePath, initialPath, limit);
|
|
995
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
996
|
-
res.end(JSON.stringify({
|
|
997
|
-
records: records.map(r => ({
|
|
998
|
-
id: r.id,
|
|
999
|
-
updated_at: r.updated_at,
|
|
1000
|
-
update_source: r.update_source,
|
|
1001
|
-
git_commit_hash: r.git_commit_hash,
|
|
1002
|
-
files_changed_before_update: r.files_changed_before_update,
|
|
1003
|
-
metadata: r.metadata ? JSON.parse(r.metadata) : undefined
|
|
1004
|
-
}))
|
|
1005
|
-
}));
|
|
1006
|
-
return true;
|
|
1007
|
-
}
|
|
1008
|
-
catch (error) {
|
|
1009
|
-
console.error('Error getting update history:', error);
|
|
1010
|
-
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
1011
|
-
res.end(JSON.stringify({ error: error.message }));
|
|
1012
|
-
return true;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
return false;
|
|
1016
|
-
}
|
|
1017
|
-
//# sourceMappingURL=claude-routes.js.map
|