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,1177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core Memory Store - Independent storage system for core memories
|
|
3
|
-
* Provides persistent storage for high-level architectural and strategic context
|
|
4
|
-
*/
|
|
5
|
-
import Database from 'better-sqlite3';
|
|
6
|
-
import { existsSync } from 'fs';
|
|
7
|
-
import { join } from 'path';
|
|
8
|
-
import { StoragePaths, ensureStorageDir } from '../config/storage-paths.js';
|
|
9
|
-
/**
|
|
10
|
-
* Core Memory Store using SQLite
|
|
11
|
-
*/
|
|
12
|
-
export class CoreMemoryStore {
|
|
13
|
-
db;
|
|
14
|
-
dbPath;
|
|
15
|
-
projectPath;
|
|
16
|
-
constructor(projectPath) {
|
|
17
|
-
this.projectPath = projectPath;
|
|
18
|
-
// Use centralized storage path
|
|
19
|
-
const paths = StoragePaths.project(projectPath);
|
|
20
|
-
const coreMemoryDir = join(paths.root, 'core-memory');
|
|
21
|
-
ensureStorageDir(coreMemoryDir);
|
|
22
|
-
this.dbPath = join(coreMemoryDir, 'core_memory.db');
|
|
23
|
-
this.db = new Database(this.dbPath);
|
|
24
|
-
this.db.pragma('journal_mode = WAL');
|
|
25
|
-
this.db.pragma('synchronous = NORMAL');
|
|
26
|
-
this.initDatabase();
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Initialize database schema
|
|
30
|
-
*/
|
|
31
|
-
initDatabase() {
|
|
32
|
-
// Migrate old tables
|
|
33
|
-
this.migrateDatabase();
|
|
34
|
-
this.db.exec(`
|
|
35
|
-
-- Core memories table
|
|
36
|
-
CREATE TABLE IF NOT EXISTS memories (
|
|
37
|
-
id TEXT PRIMARY KEY,
|
|
38
|
-
content TEXT NOT NULL,
|
|
39
|
-
summary TEXT,
|
|
40
|
-
raw_output TEXT,
|
|
41
|
-
created_at TEXT NOT NULL,
|
|
42
|
-
updated_at TEXT NOT NULL,
|
|
43
|
-
archived INTEGER DEFAULT 0,
|
|
44
|
-
metadata TEXT
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
-- Session clusters table
|
|
48
|
-
CREATE TABLE IF NOT EXISTS session_clusters (
|
|
49
|
-
id TEXT PRIMARY KEY,
|
|
50
|
-
name TEXT NOT NULL,
|
|
51
|
-
description TEXT,
|
|
52
|
-
intent TEXT,
|
|
53
|
-
created_at TEXT NOT NULL,
|
|
54
|
-
updated_at TEXT NOT NULL,
|
|
55
|
-
status TEXT DEFAULT 'active',
|
|
56
|
-
metadata TEXT
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
-- Cluster members table
|
|
60
|
-
CREATE TABLE IF NOT EXISTS cluster_members (
|
|
61
|
-
cluster_id TEXT NOT NULL,
|
|
62
|
-
session_id TEXT NOT NULL,
|
|
63
|
-
session_type TEXT NOT NULL,
|
|
64
|
-
sequence_order INTEGER NOT NULL,
|
|
65
|
-
added_at TEXT NOT NULL,
|
|
66
|
-
relevance_score REAL DEFAULT 1.0,
|
|
67
|
-
PRIMARY KEY (cluster_id, session_id),
|
|
68
|
-
FOREIGN KEY (cluster_id) REFERENCES session_clusters(id) ON DELETE CASCADE
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
-- Cluster relations table
|
|
72
|
-
CREATE TABLE IF NOT EXISTS cluster_relations (
|
|
73
|
-
source_cluster_id TEXT NOT NULL,
|
|
74
|
-
target_cluster_id TEXT NOT NULL,
|
|
75
|
-
relation_type TEXT NOT NULL,
|
|
76
|
-
created_at TEXT NOT NULL,
|
|
77
|
-
PRIMARY KEY (source_cluster_id, target_cluster_id),
|
|
78
|
-
FOREIGN KEY (source_cluster_id) REFERENCES session_clusters(id) ON DELETE CASCADE,
|
|
79
|
-
FOREIGN KEY (target_cluster_id) REFERENCES session_clusters(id) ON DELETE CASCADE
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
-- Session metadata cache table
|
|
83
|
-
CREATE TABLE IF NOT EXISTS session_metadata_cache (
|
|
84
|
-
session_id TEXT PRIMARY KEY,
|
|
85
|
-
session_type TEXT NOT NULL,
|
|
86
|
-
title TEXT,
|
|
87
|
-
summary TEXT,
|
|
88
|
-
keywords TEXT,
|
|
89
|
-
token_estimate INTEGER,
|
|
90
|
-
file_patterns TEXT,
|
|
91
|
-
created_at TEXT,
|
|
92
|
-
last_accessed TEXT,
|
|
93
|
-
access_count INTEGER DEFAULT 0
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
-- Memory chunks table for embeddings
|
|
97
|
-
CREATE TABLE IF NOT EXISTS memory_chunks (
|
|
98
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
99
|
-
source_id TEXT NOT NULL,
|
|
100
|
-
source_type TEXT NOT NULL,
|
|
101
|
-
chunk_index INTEGER NOT NULL,
|
|
102
|
-
content TEXT NOT NULL,
|
|
103
|
-
embedding BLOB,
|
|
104
|
-
metadata TEXT,
|
|
105
|
-
created_at TEXT NOT NULL,
|
|
106
|
-
UNIQUE(source_id, chunk_index)
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
-- CLAUDE.md update history table
|
|
110
|
-
CREATE TABLE IF NOT EXISTS claude_update_history (
|
|
111
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
112
|
-
file_path TEXT NOT NULL,
|
|
113
|
-
file_level TEXT NOT NULL CHECK(file_level IN ('user', 'project', 'module')),
|
|
114
|
-
module_path TEXT,
|
|
115
|
-
updated_at TEXT NOT NULL,
|
|
116
|
-
update_source TEXT NOT NULL CHECK(update_source IN ('manual', 'cli_sync', 'dashboard', 'api')),
|
|
117
|
-
git_commit_hash TEXT,
|
|
118
|
-
files_changed_before_update INTEGER DEFAULT 0,
|
|
119
|
-
metadata TEXT,
|
|
120
|
-
UNIQUE(file_path, updated_at)
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
-- Indexes for efficient queries
|
|
124
|
-
CREATE INDEX IF NOT EXISTS idx_memories_created ON memories(created_at DESC);
|
|
125
|
-
CREATE INDEX IF NOT EXISTS idx_memories_updated ON memories(updated_at DESC);
|
|
126
|
-
CREATE INDEX IF NOT EXISTS idx_memories_archived ON memories(archived);
|
|
127
|
-
CREATE INDEX IF NOT EXISTS idx_session_clusters_status ON session_clusters(status);
|
|
128
|
-
CREATE INDEX IF NOT EXISTS idx_cluster_members_cluster ON cluster_members(cluster_id);
|
|
129
|
-
CREATE INDEX IF NOT EXISTS idx_cluster_members_session ON cluster_members(session_id);
|
|
130
|
-
CREATE INDEX IF NOT EXISTS idx_session_metadata_type ON session_metadata_cache(session_type);
|
|
131
|
-
CREATE INDEX IF NOT EXISTS idx_memory_chunks_source ON memory_chunks(source_id, source_type);
|
|
132
|
-
CREATE INDEX IF NOT EXISTS idx_memory_chunks_embedded ON memory_chunks(embedding IS NOT NULL);
|
|
133
|
-
CREATE INDEX IF NOT EXISTS idx_claude_history_path ON claude_update_history(file_path);
|
|
134
|
-
CREATE INDEX IF NOT EXISTS idx_claude_history_updated ON claude_update_history(updated_at DESC);
|
|
135
|
-
CREATE INDEX IF NOT EXISTS idx_claude_history_module ON claude_update_history(module_path);
|
|
136
|
-
`);
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Migrate database by removing old tables, views, and triggers
|
|
140
|
-
*/
|
|
141
|
-
migrateDatabase() {
|
|
142
|
-
const oldTables = ['knowledge_graph', 'knowledge_graph_edges', 'evolution_history'];
|
|
143
|
-
try {
|
|
144
|
-
// Disable foreign key constraints during migration
|
|
145
|
-
this.db.pragma('foreign_keys = OFF');
|
|
146
|
-
// Drop any triggers that might reference old tables
|
|
147
|
-
const triggers = this.db.prepare(`SELECT name FROM sqlite_master WHERE type='trigger'`).all();
|
|
148
|
-
for (const trigger of triggers) {
|
|
149
|
-
try {
|
|
150
|
-
this.db.exec(`DROP TRIGGER IF EXISTS "${trigger.name}"`);
|
|
151
|
-
}
|
|
152
|
-
catch (e) {
|
|
153
|
-
// Ignore trigger drop errors
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// Drop any views that might reference old tables
|
|
157
|
-
const views = this.db.prepare(`SELECT name FROM sqlite_master WHERE type='view'`).all();
|
|
158
|
-
for (const view of views) {
|
|
159
|
-
try {
|
|
160
|
-
this.db.exec(`DROP VIEW IF EXISTS "${view.name}"`);
|
|
161
|
-
}
|
|
162
|
-
catch (e) {
|
|
163
|
-
// Ignore view drop errors
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// Now drop the old tables
|
|
167
|
-
for (const table of oldTables) {
|
|
168
|
-
try {
|
|
169
|
-
this.db.exec(`DROP TABLE IF EXISTS "${table}"`);
|
|
170
|
-
}
|
|
171
|
-
catch (e) {
|
|
172
|
-
// Ignore if table doesn't exist
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// Re-enable foreign key constraints
|
|
176
|
-
this.db.pragma('foreign_keys = ON');
|
|
177
|
-
}
|
|
178
|
-
catch (e) {
|
|
179
|
-
// If migration fails, continue - tables may not exist
|
|
180
|
-
try {
|
|
181
|
-
this.db.pragma('foreign_keys = ON');
|
|
182
|
-
}
|
|
183
|
-
catch (_) {
|
|
184
|
-
// Ignore
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Generate timestamp-based ID for core memory
|
|
190
|
-
*/
|
|
191
|
-
generateId() {
|
|
192
|
-
const now = new Date();
|
|
193
|
-
const year = now.getFullYear();
|
|
194
|
-
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
195
|
-
const day = String(now.getDate()).padStart(2, '0');
|
|
196
|
-
const hours = String(now.getHours()).padStart(2, '0');
|
|
197
|
-
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
198
|
-
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
199
|
-
return `CMEM-${year}${month}${day}-${hours}${minutes}${seconds}`;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Generate cluster ID
|
|
203
|
-
*/
|
|
204
|
-
generateClusterId() {
|
|
205
|
-
const now = new Date();
|
|
206
|
-
const year = now.getFullYear();
|
|
207
|
-
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
208
|
-
const day = String(now.getDate()).padStart(2, '0');
|
|
209
|
-
const hours = String(now.getHours()).padStart(2, '0');
|
|
210
|
-
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
211
|
-
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
212
|
-
const ms = String(now.getMilliseconds()).padStart(3, '0');
|
|
213
|
-
// Add random 4-digit suffix to ensure uniqueness (10000 combinations)
|
|
214
|
-
const random = String(Math.floor(Math.random() * 10000)).padStart(4, '0');
|
|
215
|
-
return `CLST-${year}${month}${day}-${hours}${minutes}${seconds}${ms}${random}`;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Upsert a core memory
|
|
219
|
-
*/
|
|
220
|
-
upsertMemory(memory) {
|
|
221
|
-
const now = new Date().toISOString();
|
|
222
|
-
const id = memory.id || this.generateId();
|
|
223
|
-
// Check if memory exists
|
|
224
|
-
const existingMemory = this.getMemory(id);
|
|
225
|
-
if (existingMemory) {
|
|
226
|
-
// Update existing memory
|
|
227
|
-
const stmt = this.db.prepare(`
|
|
228
|
-
UPDATE memories
|
|
229
|
-
SET content = ?, summary = ?, raw_output = ?, updated_at = ?, archived = ?, metadata = ?
|
|
230
|
-
WHERE id = ?
|
|
231
|
-
`);
|
|
232
|
-
stmt.run(memory.content, memory.summary || existingMemory.summary, memory.raw_output || existingMemory.raw_output, now, memory.archived !== undefined ? (memory.archived ? 1 : 0) : existingMemory.archived ? 1 : 0, memory.metadata || existingMemory.metadata, id);
|
|
233
|
-
return this.getMemory(id);
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
// Insert new memory
|
|
237
|
-
const stmt = this.db.prepare(`
|
|
238
|
-
INSERT INTO memories (id, content, summary, raw_output, created_at, updated_at, archived, metadata)
|
|
239
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
240
|
-
`);
|
|
241
|
-
stmt.run(id, memory.content, memory.summary || '', memory.raw_output || null, now, now, memory.archived ? 1 : 0, memory.metadata || null);
|
|
242
|
-
return this.getMemory(id);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Get memory by ID
|
|
247
|
-
*/
|
|
248
|
-
getMemory(id) {
|
|
249
|
-
const stmt = this.db.prepare(`SELECT * FROM memories WHERE id = ?`);
|
|
250
|
-
const row = stmt.get(id);
|
|
251
|
-
if (!row)
|
|
252
|
-
return null;
|
|
253
|
-
return {
|
|
254
|
-
id: row.id,
|
|
255
|
-
content: row.content,
|
|
256
|
-
summary: row.summary,
|
|
257
|
-
raw_output: row.raw_output,
|
|
258
|
-
created_at: row.created_at,
|
|
259
|
-
updated_at: row.updated_at,
|
|
260
|
-
archived: Boolean(row.archived),
|
|
261
|
-
metadata: row.metadata
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Get all memories
|
|
266
|
-
*/
|
|
267
|
-
getMemories(options = {}) {
|
|
268
|
-
const { archived = false, limit = 50, offset = 0 } = options;
|
|
269
|
-
const stmt = this.db.prepare(`
|
|
270
|
-
SELECT * FROM memories
|
|
271
|
-
WHERE archived = ?
|
|
272
|
-
ORDER BY updated_at DESC
|
|
273
|
-
LIMIT ? OFFSET ?
|
|
274
|
-
`);
|
|
275
|
-
const rows = stmt.all(archived ? 1 : 0, limit, offset);
|
|
276
|
-
return rows.map(row => ({
|
|
277
|
-
id: row.id,
|
|
278
|
-
content: row.content,
|
|
279
|
-
summary: row.summary,
|
|
280
|
-
raw_output: row.raw_output,
|
|
281
|
-
created_at: row.created_at,
|
|
282
|
-
updated_at: row.updated_at,
|
|
283
|
-
archived: Boolean(row.archived),
|
|
284
|
-
metadata: row.metadata
|
|
285
|
-
}));
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Archive a memory
|
|
289
|
-
*/
|
|
290
|
-
archiveMemory(id) {
|
|
291
|
-
const stmt = this.db.prepare(`
|
|
292
|
-
UPDATE memories
|
|
293
|
-
SET archived = 1, updated_at = ?
|
|
294
|
-
WHERE id = ?
|
|
295
|
-
`);
|
|
296
|
-
stmt.run(new Date().toISOString(), id);
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Delete a memory
|
|
300
|
-
*/
|
|
301
|
-
deleteMemory(id) {
|
|
302
|
-
const stmt = this.db.prepare(`DELETE FROM memories WHERE id = ?`);
|
|
303
|
-
stmt.run(id);
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Generate summary for a memory using CLI tool
|
|
307
|
-
*/
|
|
308
|
-
async generateSummary(memoryId, tool = 'gemini') {
|
|
309
|
-
const memory = this.getMemory(memoryId);
|
|
310
|
-
if (!memory)
|
|
311
|
-
throw new Error('Memory not found');
|
|
312
|
-
// Import CLI executor
|
|
313
|
-
const { executeCliTool } = await import('../tools/cli-executor.js');
|
|
314
|
-
const prompt = `
|
|
315
|
-
PURPOSE: Generate a concise summary (2-3 sentences) of the following core memory content
|
|
316
|
-
TASK: Extract key architectural decisions, strategic insights, and important context
|
|
317
|
-
MODE: analysis
|
|
318
|
-
EXPECTED: Plain text summary without markdown or formatting
|
|
319
|
-
RULES: Be concise. Focus on high-level understanding. No technical jargon unless essential.
|
|
320
|
-
|
|
321
|
-
CONTENT:
|
|
322
|
-
${memory.content}
|
|
323
|
-
`;
|
|
324
|
-
const result = await executeCliTool({
|
|
325
|
-
tool,
|
|
326
|
-
prompt,
|
|
327
|
-
mode: 'analysis',
|
|
328
|
-
timeout: 60000,
|
|
329
|
-
cd: this.projectPath,
|
|
330
|
-
category: 'internal'
|
|
331
|
-
});
|
|
332
|
-
const summary = result.stdout?.trim() || 'Failed to generate summary';
|
|
333
|
-
// Update memory with summary
|
|
334
|
-
const stmt = this.db.prepare(`
|
|
335
|
-
UPDATE memories
|
|
336
|
-
SET summary = ?, updated_at = ?
|
|
337
|
-
WHERE id = ?
|
|
338
|
-
`);
|
|
339
|
-
stmt.run(summary, new Date().toISOString(), memoryId);
|
|
340
|
-
return summary;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Create a new session cluster
|
|
344
|
-
*/
|
|
345
|
-
createCluster(cluster) {
|
|
346
|
-
const now = new Date().toISOString();
|
|
347
|
-
const id = cluster.id || this.generateClusterId();
|
|
348
|
-
const stmt = this.db.prepare(`
|
|
349
|
-
INSERT INTO session_clusters (id, name, description, intent, created_at, updated_at, status, metadata)
|
|
350
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
351
|
-
`);
|
|
352
|
-
stmt.run(id, cluster.name, cluster.description || null, cluster.intent || null, now, now, cluster.status || 'active', cluster.metadata || null);
|
|
353
|
-
return this.getCluster(id);
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Get cluster by ID
|
|
357
|
-
*/
|
|
358
|
-
getCluster(id) {
|
|
359
|
-
const stmt = this.db.prepare(`SELECT * FROM session_clusters WHERE id = ?`);
|
|
360
|
-
const row = stmt.get(id);
|
|
361
|
-
if (!row)
|
|
362
|
-
return null;
|
|
363
|
-
return {
|
|
364
|
-
id: row.id,
|
|
365
|
-
name: row.name,
|
|
366
|
-
description: row.description,
|
|
367
|
-
intent: row.intent,
|
|
368
|
-
created_at: row.created_at,
|
|
369
|
-
updated_at: row.updated_at,
|
|
370
|
-
status: row.status,
|
|
371
|
-
metadata: row.metadata
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* List all clusters
|
|
376
|
-
*/
|
|
377
|
-
listClusters(status) {
|
|
378
|
-
let query = 'SELECT * FROM session_clusters';
|
|
379
|
-
const params = [];
|
|
380
|
-
if (status) {
|
|
381
|
-
query += ' WHERE status = ?';
|
|
382
|
-
params.push(status);
|
|
383
|
-
}
|
|
384
|
-
query += ' ORDER BY updated_at DESC';
|
|
385
|
-
const stmt = this.db.prepare(query);
|
|
386
|
-
const rows = stmt.all(...params);
|
|
387
|
-
return rows.map(row => ({
|
|
388
|
-
id: row.id,
|
|
389
|
-
name: row.name,
|
|
390
|
-
description: row.description,
|
|
391
|
-
intent: row.intent,
|
|
392
|
-
created_at: row.created_at,
|
|
393
|
-
updated_at: row.updated_at,
|
|
394
|
-
status: row.status,
|
|
395
|
-
metadata: row.metadata
|
|
396
|
-
}));
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Update cluster
|
|
400
|
-
*/
|
|
401
|
-
updateCluster(id, updates) {
|
|
402
|
-
const existing = this.getCluster(id);
|
|
403
|
-
if (!existing)
|
|
404
|
-
return null;
|
|
405
|
-
const now = new Date().toISOString();
|
|
406
|
-
const stmt = this.db.prepare(`
|
|
407
|
-
UPDATE session_clusters
|
|
408
|
-
SET name = ?, description = ?, intent = ?, updated_at = ?, status = ?, metadata = ?
|
|
409
|
-
WHERE id = ?
|
|
410
|
-
`);
|
|
411
|
-
stmt.run(updates.name || existing.name, updates.description !== undefined ? updates.description : existing.description, updates.intent !== undefined ? updates.intent : existing.intent, now, updates.status || existing.status, updates.metadata !== undefined ? updates.metadata : existing.metadata, id);
|
|
412
|
-
return this.getCluster(id);
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Delete cluster
|
|
416
|
-
*/
|
|
417
|
-
deleteCluster(id) {
|
|
418
|
-
const stmt = this.db.prepare(`DELETE FROM session_clusters WHERE id = ?`);
|
|
419
|
-
const result = stmt.run(id);
|
|
420
|
-
return result.changes > 0;
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Merge multiple clusters into one
|
|
424
|
-
* Keeps the first cluster and moves all members from others into it
|
|
425
|
-
* @param targetClusterId The cluster to keep
|
|
426
|
-
* @param sourceClusterIds The clusters to merge into target (will be deleted)
|
|
427
|
-
* @returns Number of members moved
|
|
428
|
-
*/
|
|
429
|
-
mergeClusters(targetClusterId, sourceClusterIds) {
|
|
430
|
-
const targetCluster = this.getCluster(targetClusterId);
|
|
431
|
-
if (!targetCluster) {
|
|
432
|
-
throw new Error(`Target cluster not found: ${targetClusterId}`);
|
|
433
|
-
}
|
|
434
|
-
let membersMoved = 0;
|
|
435
|
-
const existingMembers = new Set(this.getClusterMembers(targetClusterId).map(m => m.session_id));
|
|
436
|
-
for (const sourceId of sourceClusterIds) {
|
|
437
|
-
if (sourceId === targetClusterId)
|
|
438
|
-
continue;
|
|
439
|
-
const sourceMembers = this.getClusterMembers(sourceId);
|
|
440
|
-
const maxOrder = this.getClusterMembers(targetClusterId).length;
|
|
441
|
-
for (const member of sourceMembers) {
|
|
442
|
-
// Skip if already exists in target
|
|
443
|
-
if (existingMembers.has(member.session_id))
|
|
444
|
-
continue;
|
|
445
|
-
// Move member to target cluster
|
|
446
|
-
this.addClusterMember({
|
|
447
|
-
cluster_id: targetClusterId,
|
|
448
|
-
session_id: member.session_id,
|
|
449
|
-
session_type: member.session_type,
|
|
450
|
-
sequence_order: maxOrder + membersMoved + 1,
|
|
451
|
-
relevance_score: member.relevance_score
|
|
452
|
-
});
|
|
453
|
-
existingMembers.add(member.session_id);
|
|
454
|
-
membersMoved++;
|
|
455
|
-
}
|
|
456
|
-
// Delete source cluster
|
|
457
|
-
this.deleteCluster(sourceId);
|
|
458
|
-
}
|
|
459
|
-
// Update target cluster description
|
|
460
|
-
const finalMembers = this.getClusterMembers(targetClusterId);
|
|
461
|
-
this.updateCluster(targetClusterId, {
|
|
462
|
-
description: `Merged cluster with ${finalMembers.length} sessions`
|
|
463
|
-
});
|
|
464
|
-
return membersMoved;
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Add member to cluster
|
|
468
|
-
*/
|
|
469
|
-
addClusterMember(member) {
|
|
470
|
-
const now = new Date().toISOString();
|
|
471
|
-
const stmt = this.db.prepare(`
|
|
472
|
-
INSERT INTO cluster_members (cluster_id, session_id, session_type, sequence_order, added_at, relevance_score)
|
|
473
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
474
|
-
`);
|
|
475
|
-
stmt.run(member.cluster_id, member.session_id, member.session_type, member.sequence_order, now, member.relevance_score);
|
|
476
|
-
return {
|
|
477
|
-
...member,
|
|
478
|
-
added_at: now
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Remove member from cluster
|
|
483
|
-
*/
|
|
484
|
-
removeClusterMember(clusterId, sessionId) {
|
|
485
|
-
const stmt = this.db.prepare(`
|
|
486
|
-
DELETE FROM cluster_members
|
|
487
|
-
WHERE cluster_id = ? AND session_id = ?
|
|
488
|
-
`);
|
|
489
|
-
const result = stmt.run(clusterId, sessionId);
|
|
490
|
-
return result.changes > 0;
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* Get all members of a cluster
|
|
494
|
-
*/
|
|
495
|
-
getClusterMembers(clusterId) {
|
|
496
|
-
const stmt = this.db.prepare(`
|
|
497
|
-
SELECT * FROM cluster_members
|
|
498
|
-
WHERE cluster_id = ?
|
|
499
|
-
ORDER BY sequence_order ASC
|
|
500
|
-
`);
|
|
501
|
-
const rows = stmt.all(clusterId);
|
|
502
|
-
return rows.map(row => ({
|
|
503
|
-
cluster_id: row.cluster_id,
|
|
504
|
-
session_id: row.session_id,
|
|
505
|
-
session_type: row.session_type,
|
|
506
|
-
sequence_order: row.sequence_order,
|
|
507
|
-
added_at: row.added_at,
|
|
508
|
-
relevance_score: row.relevance_score
|
|
509
|
-
}));
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Get all clusters that contain a session
|
|
513
|
-
*/
|
|
514
|
-
getSessionClusters(sessionId) {
|
|
515
|
-
const stmt = this.db.prepare(`
|
|
516
|
-
SELECT sc.*
|
|
517
|
-
FROM session_clusters sc
|
|
518
|
-
INNER JOIN cluster_members cm ON sc.id = cm.cluster_id
|
|
519
|
-
WHERE cm.session_id = ?
|
|
520
|
-
ORDER BY sc.updated_at DESC
|
|
521
|
-
`);
|
|
522
|
-
const rows = stmt.all(sessionId);
|
|
523
|
-
return rows.map(row => ({
|
|
524
|
-
id: row.id,
|
|
525
|
-
name: row.name,
|
|
526
|
-
description: row.description,
|
|
527
|
-
intent: row.intent,
|
|
528
|
-
created_at: row.created_at,
|
|
529
|
-
updated_at: row.updated_at,
|
|
530
|
-
status: row.status,
|
|
531
|
-
metadata: row.metadata
|
|
532
|
-
}));
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Add relation between clusters
|
|
536
|
-
*/
|
|
537
|
-
addClusterRelation(relation) {
|
|
538
|
-
const now = new Date().toISOString();
|
|
539
|
-
const stmt = this.db.prepare(`
|
|
540
|
-
INSERT INTO cluster_relations (source_cluster_id, target_cluster_id, relation_type, created_at)
|
|
541
|
-
VALUES (?, ?, ?, ?)
|
|
542
|
-
`);
|
|
543
|
-
stmt.run(relation.source_cluster_id, relation.target_cluster_id, relation.relation_type, now);
|
|
544
|
-
return {
|
|
545
|
-
...relation,
|
|
546
|
-
created_at: now
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* Remove relation between clusters
|
|
551
|
-
*/
|
|
552
|
-
removeClusterRelation(sourceId, targetId) {
|
|
553
|
-
const stmt = this.db.prepare(`
|
|
554
|
-
DELETE FROM cluster_relations
|
|
555
|
-
WHERE source_cluster_id = ? AND target_cluster_id = ?
|
|
556
|
-
`);
|
|
557
|
-
const result = stmt.run(sourceId, targetId);
|
|
558
|
-
return result.changes > 0;
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Get all relations for a cluster
|
|
562
|
-
*/
|
|
563
|
-
getClusterRelations(clusterId) {
|
|
564
|
-
const stmt = this.db.prepare(`
|
|
565
|
-
SELECT * FROM cluster_relations
|
|
566
|
-
WHERE source_cluster_id = ? OR target_cluster_id = ?
|
|
567
|
-
ORDER BY created_at DESC
|
|
568
|
-
`);
|
|
569
|
-
const rows = stmt.all(clusterId, clusterId);
|
|
570
|
-
return rows.map(row => ({
|
|
571
|
-
source_cluster_id: row.source_cluster_id,
|
|
572
|
-
target_cluster_id: row.target_cluster_id,
|
|
573
|
-
relation_type: row.relation_type,
|
|
574
|
-
created_at: row.created_at
|
|
575
|
-
}));
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* Upsert session metadata
|
|
579
|
-
*/
|
|
580
|
-
upsertSessionMetadata(metadata) {
|
|
581
|
-
const now = new Date().toISOString();
|
|
582
|
-
const existing = this.getSessionMetadata(metadata.session_id);
|
|
583
|
-
if (existing) {
|
|
584
|
-
const stmt = this.db.prepare(`
|
|
585
|
-
UPDATE session_metadata_cache
|
|
586
|
-
SET session_type = ?, title = ?, summary = ?, keywords = ?, token_estimate = ?,
|
|
587
|
-
file_patterns = ?, last_accessed = ?, access_count = ?
|
|
588
|
-
WHERE session_id = ?
|
|
589
|
-
`);
|
|
590
|
-
stmt.run(metadata.session_type, metadata.title || null, metadata.summary || null, metadata.keywords ? JSON.stringify(metadata.keywords) : null, metadata.token_estimate || null, metadata.file_patterns ? JSON.stringify(metadata.file_patterns) : null, now, existing.access_count + 1, metadata.session_id);
|
|
591
|
-
}
|
|
592
|
-
else {
|
|
593
|
-
const stmt = this.db.prepare(`
|
|
594
|
-
INSERT INTO session_metadata_cache
|
|
595
|
-
(session_id, session_type, title, summary, keywords, token_estimate, file_patterns, created_at, last_accessed, access_count)
|
|
596
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
597
|
-
`);
|
|
598
|
-
stmt.run(metadata.session_id, metadata.session_type, metadata.title || null, metadata.summary || null, metadata.keywords ? JSON.stringify(metadata.keywords) : null, metadata.token_estimate || null, metadata.file_patterns ? JSON.stringify(metadata.file_patterns) : null, metadata.created_at || now, now, metadata.access_count || 1);
|
|
599
|
-
}
|
|
600
|
-
return this.getSessionMetadata(metadata.session_id);
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Get session metadata
|
|
604
|
-
*/
|
|
605
|
-
getSessionMetadata(sessionId) {
|
|
606
|
-
const stmt = this.db.prepare(`SELECT * FROM session_metadata_cache WHERE session_id = ?`);
|
|
607
|
-
const row = stmt.get(sessionId);
|
|
608
|
-
if (!row)
|
|
609
|
-
return null;
|
|
610
|
-
return {
|
|
611
|
-
session_id: row.session_id,
|
|
612
|
-
session_type: row.session_type,
|
|
613
|
-
title: row.title,
|
|
614
|
-
summary: row.summary,
|
|
615
|
-
keywords: row.keywords ? JSON.parse(row.keywords) : undefined,
|
|
616
|
-
token_estimate: row.token_estimate,
|
|
617
|
-
file_patterns: row.file_patterns ? JSON.parse(row.file_patterns) : undefined,
|
|
618
|
-
created_at: row.created_at,
|
|
619
|
-
last_accessed: row.last_accessed,
|
|
620
|
-
access_count: row.access_count
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Search sessions by keyword
|
|
625
|
-
*/
|
|
626
|
-
searchSessionsByKeyword(keyword) {
|
|
627
|
-
const stmt = this.db.prepare(`
|
|
628
|
-
SELECT * FROM session_metadata_cache
|
|
629
|
-
WHERE title LIKE ? OR summary LIKE ? OR keywords LIKE ?
|
|
630
|
-
ORDER BY access_count DESC, last_accessed DESC
|
|
631
|
-
`);
|
|
632
|
-
const pattern = `%${keyword}%`;
|
|
633
|
-
const rows = stmt.all(pattern, pattern, pattern);
|
|
634
|
-
return rows.map(row => ({
|
|
635
|
-
session_id: row.session_id,
|
|
636
|
-
session_type: row.session_type,
|
|
637
|
-
title: row.title,
|
|
638
|
-
summary: row.summary,
|
|
639
|
-
keywords: row.keywords ? JSON.parse(row.keywords) : undefined,
|
|
640
|
-
token_estimate: row.token_estimate,
|
|
641
|
-
file_patterns: row.file_patterns ? JSON.parse(row.file_patterns) : undefined,
|
|
642
|
-
created_at: row.created_at,
|
|
643
|
-
last_accessed: row.last_accessed,
|
|
644
|
-
access_count: row.access_count
|
|
645
|
-
}));
|
|
646
|
-
}
|
|
647
|
-
// ============================================================================
|
|
648
|
-
// Memory Chunks CRUD Operations
|
|
649
|
-
// ============================================================================
|
|
650
|
-
/**
|
|
651
|
-
* Chunk content into smaller pieces for embedding
|
|
652
|
-
* @param content Content to chunk
|
|
653
|
-
* @param sourceId Source identifier (e.g., memory ID)
|
|
654
|
-
* @param sourceType Type of source
|
|
655
|
-
* @returns Array of chunk content strings
|
|
656
|
-
*/
|
|
657
|
-
chunkContent(content, sourceId, sourceType) {
|
|
658
|
-
const CHUNK_SIZE = 1500;
|
|
659
|
-
const OVERLAP = 200;
|
|
660
|
-
const chunks = [];
|
|
661
|
-
// Split by paragraph boundaries first
|
|
662
|
-
const paragraphs = content.split(/\n\n+/);
|
|
663
|
-
let currentChunk = '';
|
|
664
|
-
for (const paragraph of paragraphs) {
|
|
665
|
-
// If adding this paragraph would exceed chunk size
|
|
666
|
-
if (currentChunk.length + paragraph.length > CHUNK_SIZE && currentChunk.length > 0) {
|
|
667
|
-
// Save current chunk
|
|
668
|
-
chunks.push(currentChunk.trim());
|
|
669
|
-
// Start new chunk with overlap
|
|
670
|
-
const overlapText = currentChunk.slice(-OVERLAP);
|
|
671
|
-
currentChunk = overlapText + '\n\n' + paragraph;
|
|
672
|
-
}
|
|
673
|
-
else {
|
|
674
|
-
// Add paragraph to current chunk
|
|
675
|
-
currentChunk += (currentChunk ? '\n\n' : '') + paragraph;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
// Add remaining chunk
|
|
679
|
-
if (currentChunk.trim()) {
|
|
680
|
-
chunks.push(currentChunk.trim());
|
|
681
|
-
}
|
|
682
|
-
// If no paragraphs or chunks are still too large, split by sentences
|
|
683
|
-
const finalChunks = [];
|
|
684
|
-
for (const chunk of chunks) {
|
|
685
|
-
if (chunk.length <= CHUNK_SIZE) {
|
|
686
|
-
finalChunks.push(chunk);
|
|
687
|
-
}
|
|
688
|
-
else {
|
|
689
|
-
// Split by sentence boundaries
|
|
690
|
-
const sentences = chunk.split(/\. +/);
|
|
691
|
-
let sentenceChunk = '';
|
|
692
|
-
for (const sentence of sentences) {
|
|
693
|
-
const sentenceWithPeriod = sentence + '. ';
|
|
694
|
-
if (sentenceChunk.length + sentenceWithPeriod.length > CHUNK_SIZE && sentenceChunk.length > 0) {
|
|
695
|
-
finalChunks.push(sentenceChunk.trim());
|
|
696
|
-
const overlapText = sentenceChunk.slice(-OVERLAP);
|
|
697
|
-
sentenceChunk = overlapText + sentenceWithPeriod;
|
|
698
|
-
}
|
|
699
|
-
else {
|
|
700
|
-
sentenceChunk += sentenceWithPeriod;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
if (sentenceChunk.trim()) {
|
|
704
|
-
finalChunks.push(sentenceChunk.trim());
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
return finalChunks.length > 0 ? finalChunks : [content];
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Insert a single chunk
|
|
712
|
-
*/
|
|
713
|
-
insertChunk(chunk) {
|
|
714
|
-
const now = new Date().toISOString();
|
|
715
|
-
const stmt = this.db.prepare(`
|
|
716
|
-
INSERT INTO memory_chunks (source_id, source_type, chunk_index, content, embedding, metadata, created_at)
|
|
717
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
718
|
-
`);
|
|
719
|
-
const result = stmt.run(chunk.source_id, chunk.source_type, chunk.chunk_index, chunk.content, chunk.embedding || null, chunk.metadata || null, chunk.created_at || now);
|
|
720
|
-
return result.lastInsertRowid;
|
|
721
|
-
}
|
|
722
|
-
/**
|
|
723
|
-
* Insert multiple chunks in a batch
|
|
724
|
-
*/
|
|
725
|
-
insertChunksBatch(chunks) {
|
|
726
|
-
const now = new Date().toISOString();
|
|
727
|
-
const insert = this.db.prepare(`
|
|
728
|
-
INSERT INTO memory_chunks (source_id, source_type, chunk_index, content, embedding, metadata, created_at)
|
|
729
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
730
|
-
`);
|
|
731
|
-
const transaction = this.db.transaction((chunks) => {
|
|
732
|
-
for (const chunk of chunks) {
|
|
733
|
-
insert.run(chunk.source_id, chunk.source_type, chunk.chunk_index, chunk.content, chunk.embedding || null, chunk.metadata || null, chunk.created_at || now);
|
|
734
|
-
}
|
|
735
|
-
});
|
|
736
|
-
transaction(chunks);
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* Get all chunks for a source
|
|
740
|
-
*/
|
|
741
|
-
getChunks(sourceId) {
|
|
742
|
-
const stmt = this.db.prepare(`
|
|
743
|
-
SELECT * FROM memory_chunks
|
|
744
|
-
WHERE source_id = ?
|
|
745
|
-
ORDER BY chunk_index ASC
|
|
746
|
-
`);
|
|
747
|
-
const rows = stmt.all(sourceId);
|
|
748
|
-
return rows.map(row => ({
|
|
749
|
-
id: row.id,
|
|
750
|
-
source_id: row.source_id,
|
|
751
|
-
source_type: row.source_type,
|
|
752
|
-
chunk_index: row.chunk_index,
|
|
753
|
-
content: row.content,
|
|
754
|
-
embedding: row.embedding,
|
|
755
|
-
metadata: row.metadata,
|
|
756
|
-
created_at: row.created_at
|
|
757
|
-
}));
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* Get chunks by source type
|
|
761
|
-
*/
|
|
762
|
-
getChunksByType(sourceType) {
|
|
763
|
-
const stmt = this.db.prepare(`
|
|
764
|
-
SELECT * FROM memory_chunks
|
|
765
|
-
WHERE source_type = ?
|
|
766
|
-
ORDER BY source_id, chunk_index ASC
|
|
767
|
-
`);
|
|
768
|
-
const rows = stmt.all(sourceType);
|
|
769
|
-
return rows.map(row => ({
|
|
770
|
-
id: row.id,
|
|
771
|
-
source_id: row.source_id,
|
|
772
|
-
source_type: row.source_type,
|
|
773
|
-
chunk_index: row.chunk_index,
|
|
774
|
-
content: row.content,
|
|
775
|
-
embedding: row.embedding,
|
|
776
|
-
metadata: row.metadata,
|
|
777
|
-
created_at: row.created_at
|
|
778
|
-
}));
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* Get chunks without embeddings
|
|
782
|
-
*/
|
|
783
|
-
getUnembeddedChunks(limit) {
|
|
784
|
-
const query = `
|
|
785
|
-
SELECT * FROM memory_chunks
|
|
786
|
-
WHERE embedding IS NULL
|
|
787
|
-
ORDER BY created_at ASC
|
|
788
|
-
${limit ? 'LIMIT ?' : ''}
|
|
789
|
-
`;
|
|
790
|
-
const stmt = this.db.prepare(query);
|
|
791
|
-
const rows = (limit ? stmt.all(limit) : stmt.all());
|
|
792
|
-
return rows.map(row => ({
|
|
793
|
-
id: row.id,
|
|
794
|
-
source_id: row.source_id,
|
|
795
|
-
source_type: row.source_type,
|
|
796
|
-
chunk_index: row.chunk_index,
|
|
797
|
-
content: row.content,
|
|
798
|
-
embedding: row.embedding,
|
|
799
|
-
metadata: row.metadata,
|
|
800
|
-
created_at: row.created_at
|
|
801
|
-
}));
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* Update embedding for a chunk
|
|
805
|
-
*/
|
|
806
|
-
updateChunkEmbedding(chunkId, embedding) {
|
|
807
|
-
const stmt = this.db.prepare(`
|
|
808
|
-
UPDATE memory_chunks
|
|
809
|
-
SET embedding = ?
|
|
810
|
-
WHERE id = ?
|
|
811
|
-
`);
|
|
812
|
-
stmt.run(embedding, chunkId);
|
|
813
|
-
}
|
|
814
|
-
/**
|
|
815
|
-
* Update embeddings for multiple chunks in a batch
|
|
816
|
-
*/
|
|
817
|
-
updateChunkEmbeddingsBatch(updates) {
|
|
818
|
-
const update = this.db.prepare(`
|
|
819
|
-
UPDATE memory_chunks
|
|
820
|
-
SET embedding = ?
|
|
821
|
-
WHERE id = ?
|
|
822
|
-
`);
|
|
823
|
-
const transaction = this.db.transaction((updates) => {
|
|
824
|
-
for (const { id, embedding } of updates) {
|
|
825
|
-
update.run(embedding, id);
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
transaction(updates);
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
* Delete all chunks for a source
|
|
832
|
-
*/
|
|
833
|
-
deleteChunks(sourceId) {
|
|
834
|
-
const stmt = this.db.prepare(`
|
|
835
|
-
DELETE FROM memory_chunks
|
|
836
|
-
WHERE source_id = ?
|
|
837
|
-
`);
|
|
838
|
-
stmt.run(sourceId);
|
|
839
|
-
}
|
|
840
|
-
// ============================================================================
|
|
841
|
-
// CLAUDE.md Update History CRUD Operations
|
|
842
|
-
// ============================================================================
|
|
843
|
-
/**
|
|
844
|
-
* Insert a CLAUDE.md update record
|
|
845
|
-
*/
|
|
846
|
-
insertClaudeUpdateRecord(record) {
|
|
847
|
-
const stmt = this.db.prepare(`
|
|
848
|
-
INSERT INTO claude_update_history
|
|
849
|
-
(file_path, file_level, module_path, updated_at, update_source, git_commit_hash, files_changed_before_update, metadata)
|
|
850
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
851
|
-
`);
|
|
852
|
-
const result = stmt.run(record.file_path, record.file_level, record.module_path || null, record.updated_at, record.update_source, record.git_commit_hash || null, record.files_changed_before_update, record.metadata || null);
|
|
853
|
-
return {
|
|
854
|
-
id: result.lastInsertRowid,
|
|
855
|
-
...record
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
/**
|
|
859
|
-
* Get the last update record for a file
|
|
860
|
-
*/
|
|
861
|
-
getLastClaudeUpdate(filePath) {
|
|
862
|
-
const stmt = this.db.prepare(`
|
|
863
|
-
SELECT * FROM claude_update_history
|
|
864
|
-
WHERE file_path = ?
|
|
865
|
-
ORDER BY updated_at DESC
|
|
866
|
-
LIMIT 1
|
|
867
|
-
`);
|
|
868
|
-
const row = stmt.get(filePath);
|
|
869
|
-
if (!row)
|
|
870
|
-
return null;
|
|
871
|
-
return {
|
|
872
|
-
id: row.id,
|
|
873
|
-
file_path: row.file_path,
|
|
874
|
-
file_level: row.file_level,
|
|
875
|
-
module_path: row.module_path,
|
|
876
|
-
updated_at: row.updated_at,
|
|
877
|
-
update_source: row.update_source,
|
|
878
|
-
git_commit_hash: row.git_commit_hash,
|
|
879
|
-
files_changed_before_update: row.files_changed_before_update,
|
|
880
|
-
metadata: row.metadata
|
|
881
|
-
};
|
|
882
|
-
}
|
|
883
|
-
/**
|
|
884
|
-
* Get update history for a file
|
|
885
|
-
*/
|
|
886
|
-
getClaudeUpdateHistory(filePath, limit = 50) {
|
|
887
|
-
const stmt = this.db.prepare(`
|
|
888
|
-
SELECT * FROM claude_update_history
|
|
889
|
-
WHERE file_path = ?
|
|
890
|
-
ORDER BY updated_at DESC
|
|
891
|
-
LIMIT ?
|
|
892
|
-
`);
|
|
893
|
-
const rows = stmt.all(filePath, limit);
|
|
894
|
-
return rows.map(row => ({
|
|
895
|
-
id: row.id,
|
|
896
|
-
file_path: row.file_path,
|
|
897
|
-
file_level: row.file_level,
|
|
898
|
-
module_path: row.module_path,
|
|
899
|
-
updated_at: row.updated_at,
|
|
900
|
-
update_source: row.update_source,
|
|
901
|
-
git_commit_hash: row.git_commit_hash,
|
|
902
|
-
files_changed_before_update: row.files_changed_before_update,
|
|
903
|
-
metadata: row.metadata
|
|
904
|
-
}));
|
|
905
|
-
}
|
|
906
|
-
/**
|
|
907
|
-
* Get all CLAUDE.md update records for freshness calculation
|
|
908
|
-
*/
|
|
909
|
-
getAllClaudeUpdateRecords() {
|
|
910
|
-
const stmt = this.db.prepare(`
|
|
911
|
-
SELECT * FROM claude_update_history
|
|
912
|
-
WHERE id IN (
|
|
913
|
-
SELECT MAX(id) FROM claude_update_history
|
|
914
|
-
GROUP BY file_path
|
|
915
|
-
)
|
|
916
|
-
ORDER BY updated_at DESC
|
|
917
|
-
`);
|
|
918
|
-
const rows = stmt.all();
|
|
919
|
-
return rows.map(row => ({
|
|
920
|
-
id: row.id,
|
|
921
|
-
file_path: row.file_path,
|
|
922
|
-
file_level: row.file_level,
|
|
923
|
-
module_path: row.module_path,
|
|
924
|
-
updated_at: row.updated_at,
|
|
925
|
-
update_source: row.update_source,
|
|
926
|
-
git_commit_hash: row.git_commit_hash,
|
|
927
|
-
files_changed_before_update: row.files_changed_before_update,
|
|
928
|
-
metadata: row.metadata
|
|
929
|
-
}));
|
|
930
|
-
}
|
|
931
|
-
/**
|
|
932
|
-
* Delete update records for a file
|
|
933
|
-
*/
|
|
934
|
-
deleteClaudeUpdateRecords(filePath) {
|
|
935
|
-
const stmt = this.db.prepare(`
|
|
936
|
-
DELETE FROM claude_update_history
|
|
937
|
-
WHERE file_path = ?
|
|
938
|
-
`);
|
|
939
|
-
const result = stmt.run(filePath);
|
|
940
|
-
return result.changes;
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Close database connection
|
|
944
|
-
*/
|
|
945
|
-
close() {
|
|
946
|
-
this.db.close();
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
// Singleton instance cache
|
|
950
|
-
const storeCache = new Map();
|
|
951
|
-
/**
|
|
952
|
-
* Get or create a store instance for a project
|
|
953
|
-
*/
|
|
954
|
-
export function getCoreMemoryStore(projectPath) {
|
|
955
|
-
const normalizedPath = projectPath.toLowerCase().replace(/\\/g, '/');
|
|
956
|
-
if (!storeCache.has(normalizedPath)) {
|
|
957
|
-
storeCache.set(normalizedPath, new CoreMemoryStore(projectPath));
|
|
958
|
-
}
|
|
959
|
-
return storeCache.get(normalizedPath);
|
|
960
|
-
}
|
|
961
|
-
// ============================================================================
|
|
962
|
-
// Cross-workspace management functions
|
|
963
|
-
// ============================================================================
|
|
964
|
-
import { readdirSync, writeFileSync, readFileSync } from 'fs';
|
|
965
|
-
import { homedir } from 'os';
|
|
966
|
-
/**
|
|
967
|
-
* Get CCW home directory
|
|
968
|
-
*/
|
|
969
|
-
function getCCWHome() {
|
|
970
|
-
return process.env.CCW_DATA_DIR || join(homedir(), '.ccw');
|
|
971
|
-
}
|
|
972
|
-
/**
|
|
973
|
-
* List all projects with their memory counts
|
|
974
|
-
*/
|
|
975
|
-
export function listAllProjects() {
|
|
976
|
-
const projectsDir = join(getCCWHome(), 'projects');
|
|
977
|
-
if (!existsSync(projectsDir)) {
|
|
978
|
-
return [];
|
|
979
|
-
}
|
|
980
|
-
const projects = [];
|
|
981
|
-
const entries = readdirSync(projectsDir, { withFileTypes: true });
|
|
982
|
-
for (const entry of entries) {
|
|
983
|
-
if (!entry.isDirectory())
|
|
984
|
-
continue;
|
|
985
|
-
const projectId = entry.name;
|
|
986
|
-
const coreMemoryDb = join(projectsDir, projectId, 'core-memory', 'core_memory.db');
|
|
987
|
-
let memoriesCount = 0;
|
|
988
|
-
let clustersCount = 0;
|
|
989
|
-
let lastUpdated;
|
|
990
|
-
if (existsSync(coreMemoryDb)) {
|
|
991
|
-
try {
|
|
992
|
-
const db = new Database(coreMemoryDb, { readonly: true });
|
|
993
|
-
// Count memories
|
|
994
|
-
const memResult = db.prepare('SELECT COUNT(*) as count FROM memories').get();
|
|
995
|
-
memoriesCount = memResult?.count || 0;
|
|
996
|
-
// Count clusters
|
|
997
|
-
try {
|
|
998
|
-
const clusterResult = db.prepare('SELECT COUNT(*) as count FROM session_clusters').get();
|
|
999
|
-
clustersCount = clusterResult?.count || 0;
|
|
1000
|
-
}
|
|
1001
|
-
catch {
|
|
1002
|
-
// Table might not exist
|
|
1003
|
-
}
|
|
1004
|
-
// Get last update time
|
|
1005
|
-
const lastMemory = db.prepare('SELECT MAX(updated_at) as last FROM memories').get();
|
|
1006
|
-
lastUpdated = lastMemory?.last;
|
|
1007
|
-
db.close();
|
|
1008
|
-
}
|
|
1009
|
-
catch {
|
|
1010
|
-
// Database might be locked or corrupted
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
// Convert project ID back to approximate path
|
|
1014
|
-
const approximatePath = projectId
|
|
1015
|
-
.replace(/^([a-z])--/, '$1:/') // d-- -> d:/
|
|
1016
|
-
.replace(/--/g, '/')
|
|
1017
|
-
.replace(/-/g, ' ');
|
|
1018
|
-
projects.push({
|
|
1019
|
-
id: projectId,
|
|
1020
|
-
path: approximatePath,
|
|
1021
|
-
memoriesCount,
|
|
1022
|
-
clustersCount,
|
|
1023
|
-
lastUpdated
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
// Sort by last updated (most recent first)
|
|
1027
|
-
return projects.sort((a, b) => {
|
|
1028
|
-
if (!a.lastUpdated)
|
|
1029
|
-
return 1;
|
|
1030
|
-
if (!b.lastUpdated)
|
|
1031
|
-
return -1;
|
|
1032
|
-
return b.lastUpdated.localeCompare(a.lastUpdated);
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
* Get memories from another project by ID
|
|
1037
|
-
*/
|
|
1038
|
-
export function getMemoriesFromProject(projectId) {
|
|
1039
|
-
const projectsDir = join(getCCWHome(), 'projects');
|
|
1040
|
-
const coreMemoryDb = join(projectsDir, projectId, 'core-memory', 'core_memory.db');
|
|
1041
|
-
if (!existsSync(coreMemoryDb)) {
|
|
1042
|
-
throw new Error(`Project not found: ${projectId}`);
|
|
1043
|
-
}
|
|
1044
|
-
const db = new Database(coreMemoryDb, { readonly: true });
|
|
1045
|
-
const stmt = db.prepare('SELECT * FROM memories ORDER BY updated_at DESC');
|
|
1046
|
-
const rows = stmt.all();
|
|
1047
|
-
db.close();
|
|
1048
|
-
return rows.map(row => ({
|
|
1049
|
-
id: row.id,
|
|
1050
|
-
content: row.content,
|
|
1051
|
-
summary: row.summary || '',
|
|
1052
|
-
raw_output: row.raw_output,
|
|
1053
|
-
created_at: row.created_at,
|
|
1054
|
-
updated_at: row.updated_at,
|
|
1055
|
-
archived: Boolean(row.archived),
|
|
1056
|
-
metadata: row.metadata
|
|
1057
|
-
}));
|
|
1058
|
-
}
|
|
1059
|
-
/**
|
|
1060
|
-
* Find a memory by ID across all projects
|
|
1061
|
-
* Searches through all project databases to locate a specific memory
|
|
1062
|
-
*/
|
|
1063
|
-
export function findMemoryAcrossProjects(memoryId) {
|
|
1064
|
-
const projectsDir = join(getCCWHome(), 'projects');
|
|
1065
|
-
if (!existsSync(projectsDir)) {
|
|
1066
|
-
return null;
|
|
1067
|
-
}
|
|
1068
|
-
const entries = readdirSync(projectsDir, { withFileTypes: true });
|
|
1069
|
-
for (const entry of entries) {
|
|
1070
|
-
if (!entry.isDirectory())
|
|
1071
|
-
continue;
|
|
1072
|
-
const projectId = entry.name;
|
|
1073
|
-
const coreMemoryDb = join(projectsDir, projectId, 'core-memory', 'core_memory.db');
|
|
1074
|
-
if (!existsSync(coreMemoryDb))
|
|
1075
|
-
continue;
|
|
1076
|
-
try {
|
|
1077
|
-
const db = new Database(coreMemoryDb, { readonly: true });
|
|
1078
|
-
const row = db.prepare('SELECT * FROM memories WHERE id = ?').get(memoryId);
|
|
1079
|
-
db.close();
|
|
1080
|
-
if (row) {
|
|
1081
|
-
return {
|
|
1082
|
-
memory: {
|
|
1083
|
-
id: row.id,
|
|
1084
|
-
content: row.content,
|
|
1085
|
-
summary: row.summary || '',
|
|
1086
|
-
raw_output: row.raw_output,
|
|
1087
|
-
created_at: row.created_at,
|
|
1088
|
-
updated_at: row.updated_at,
|
|
1089
|
-
archived: Boolean(row.archived),
|
|
1090
|
-
metadata: row.metadata
|
|
1091
|
-
},
|
|
1092
|
-
projectId
|
|
1093
|
-
};
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
catch {
|
|
1097
|
-
// Database might be locked or corrupted, skip
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
return null;
|
|
1101
|
-
}
|
|
1102
|
-
/**
|
|
1103
|
-
* Export memories to a JSON file
|
|
1104
|
-
*/
|
|
1105
|
-
export function exportMemories(projectPath, outputPath, options) {
|
|
1106
|
-
const store = getCoreMemoryStore(projectPath);
|
|
1107
|
-
let memories = store.getMemories({ archived: options?.includeArchived || false, limit: 10000 });
|
|
1108
|
-
// Filter by IDs if specified
|
|
1109
|
-
if (options?.ids && options.ids.length > 0) {
|
|
1110
|
-
const idSet = new Set(options.ids);
|
|
1111
|
-
memories = memories.filter(m => idSet.has(m.id));
|
|
1112
|
-
}
|
|
1113
|
-
const exportData = {
|
|
1114
|
-
version: '1.0',
|
|
1115
|
-
exportedAt: new Date().toISOString(),
|
|
1116
|
-
sourceProject: projectPath,
|
|
1117
|
-
memories
|
|
1118
|
-
};
|
|
1119
|
-
writeFileSync(outputPath, JSON.stringify(exportData, null, 2), 'utf-8');
|
|
1120
|
-
return memories.length;
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Import memories from a JSON file or another project
|
|
1124
|
-
*/
|
|
1125
|
-
export function importMemories(targetProjectPath, source, // File path or project ID
|
|
1126
|
-
options) {
|
|
1127
|
-
const store = getCoreMemoryStore(targetProjectPath);
|
|
1128
|
-
let memories;
|
|
1129
|
-
// Check if source is a file or project ID
|
|
1130
|
-
if (existsSync(source) && source.endsWith('.json')) {
|
|
1131
|
-
// Import from file
|
|
1132
|
-
const content = readFileSync(source, 'utf-8');
|
|
1133
|
-
const data = JSON.parse(content);
|
|
1134
|
-
memories = data.memories;
|
|
1135
|
-
}
|
|
1136
|
-
else {
|
|
1137
|
-
// Import from project ID
|
|
1138
|
-
memories = getMemoriesFromProject(source);
|
|
1139
|
-
}
|
|
1140
|
-
let imported = 0;
|
|
1141
|
-
let skipped = 0;
|
|
1142
|
-
for (const memory of memories) {
|
|
1143
|
-
// Generate new ID with optional prefix
|
|
1144
|
-
let newId = memory.id;
|
|
1145
|
-
if (options?.prefix) {
|
|
1146
|
-
newId = `${options.prefix}-${memory.id}`;
|
|
1147
|
-
}
|
|
1148
|
-
// Check if already exists
|
|
1149
|
-
const existing = store.getMemory(newId);
|
|
1150
|
-
if (existing && !options?.overwrite) {
|
|
1151
|
-
skipped++;
|
|
1152
|
-
continue;
|
|
1153
|
-
}
|
|
1154
|
-
// Import memory
|
|
1155
|
-
store.upsertMemory({
|
|
1156
|
-
id: newId,
|
|
1157
|
-
content: memory.content,
|
|
1158
|
-
summary: memory.summary,
|
|
1159
|
-
raw_output: memory.raw_output,
|
|
1160
|
-
metadata: memory.metadata
|
|
1161
|
-
});
|
|
1162
|
-
imported++;
|
|
1163
|
-
}
|
|
1164
|
-
return { imported, skipped };
|
|
1165
|
-
}
|
|
1166
|
-
/**
|
|
1167
|
-
* Close all store instances
|
|
1168
|
-
*/
|
|
1169
|
-
export function closeAllStores() {
|
|
1170
|
-
const stores = Array.from(storeCache.values());
|
|
1171
|
-
for (const store of stores) {
|
|
1172
|
-
store.close();
|
|
1173
|
-
}
|
|
1174
|
-
storeCache.clear();
|
|
1175
|
-
}
|
|
1176
|
-
export default CoreMemoryStore;
|
|
1177
|
-
//# sourceMappingURL=core-memory-store.js.map
|