claude-code-workflow 6.1.4 → 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 -778
- package/.claude/agents/cli-execution-agent.md +266 -269
- package/.claude/agents/cli-explore-agent.md +2 -2
- package/.claude/agents/cli-lite-planning-agent.md +142 -92
- package/.claude/agents/cli-planning-agent.md +4 -4
- package/.claude/agents/code-developer.md +7 -6
- package/.claude/agents/conceptual-planning-agent.md +2 -2
- package/.claude/agents/context-search-agent.md +31 -32
- package/.claude/agents/doc-generator.md +4 -4
- package/.claude/agents/memory-bridge.md +93 -93
- package/.claude/agents/test-context-search-agent.md +8 -7
- package/.claude/agents/test-fix-agent.md +7 -6
- package/.claude/commands/clean.md +516 -0
- package/.claude/commands/memory/compact.md +383 -0
- package/.claude/commands/memory/docs-full-cli.md +471 -471
- package/.claude/commands/memory/docs-related-cli.md +386 -386
- package/.claude/commands/memory/docs.md +615 -615
- package/.claude/commands/memory/load.md +5 -5
- package/.claude/commands/memory/tech-research-rules.md +310 -0
- package/.claude/commands/memory/update-full.md +332 -332
- package/.claude/commands/memory/workflow-skill-memory.md +4 -4
- package/.claude/commands/task/create.md +151 -151
- package/.claude/commands/version.md +254 -254
- package/.claude/commands/workflow/brainstorm/api-designer.md +587 -585
- package/.claude/commands/workflow/brainstorm/artifacts.md +1 -0
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +443 -443
- package/.claude/commands/workflow/brainstorm/data-architect.md +220 -220
- package/.claude/commands/workflow/brainstorm/product-manager.md +200 -200
- package/.claude/commands/workflow/brainstorm/product-owner.md +200 -200
- package/.claude/commands/workflow/brainstorm/scrum-master.md +200 -200
- package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
- package/.claude/commands/workflow/brainstorm/system-architect.md +389 -387
- package/.claude/commands/workflow/brainstorm/ui-designer.md +221 -221
- package/.claude/commands/workflow/brainstorm/ux-expert.md +221 -221
- package/.claude/commands/workflow/debug.md +321 -0
- package/.claude/commands/workflow/execute.md +13 -0
- package/.claude/commands/workflow/init.md +165 -164
- package/.claude/commands/workflow/lite-execute.md +119 -13
- package/.claude/commands/workflow/lite-fix.md +623 -621
- package/.claude/commands/workflow/lite-plan.md +610 -592
- package/.claude/commands/workflow/plan.md +5 -5
- package/.claude/commands/workflow/review-module-cycle.md +2 -0
- package/.claude/commands/workflow/review-session-cycle.md +2 -0
- package/.claude/commands/workflow/review.md +297 -291
- package/.claude/commands/workflow/session/complete.md +153 -500
- package/.claude/commands/workflow/session/list.md +95 -95
- package/.claude/commands/workflow/session/resume.md +60 -60
- package/.claude/commands/workflow/session/start.md +199 -199
- package/.claude/commands/workflow/tdd-plan.md +3 -3
- package/.claude/commands/workflow/tdd-verify.md +23 -9
- package/.claude/commands/workflow/test-cycle-execute.md +2 -0
- package/.claude/commands/workflow/test-fix-gen.md +699 -699
- package/.claude/commands/workflow/tools/conflict-resolution.md +104 -18
- package/.claude/commands/workflow/tools/context-gather.md +436 -434
- package/.claude/commands/workflow/tools/task-generate-agent.md +490 -291
- package/.claude/commands/workflow/tools/task-generate-tdd.md +18 -10
- package/.claude/commands/workflow/tools/test-concept-enhanced.md +2 -1
- package/.claude/commands/workflow/tools/test-context-gather.md +1 -0
- package/.claude/commands/workflow/tools/test-task-generate.md +1 -0
- package/.claude/commands/workflow/ui-design/import-from-code.md +9 -6
- package/.claude/skills/command-guide/SKILL.md +5 -5
- package/.claude/skills/command-guide/index/all-commands.json +1 -1
- package/.claude/skills/command-guide/index/by-category.json +1 -1
- package/.claude/skills/command-guide/index/by-use-case.json +1 -1
- package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +857 -778
- package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +266 -269
- package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +2 -2
- package/.claude/skills/command-guide/reference/agents/cli-lite-planning-agent.md +142 -92
- package/.claude/skills/command-guide/reference/agents/cli-planning-agent.md +4 -4
- package/.claude/skills/command-guide/reference/agents/code-developer.md +7 -6
- package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +2 -2
- package/.claude/skills/command-guide/reference/agents/context-search-agent.md +31 -32
- package/.claude/skills/command-guide/reference/agents/doc-generator.md +4 -4
- package/.claude/skills/command-guide/reference/agents/memory-bridge.md +93 -93
- package/.claude/skills/command-guide/reference/agents/test-context-search-agent.md +8 -7
- package/.claude/skills/command-guide/reference/agents/test-fix-agent.md +7 -6
- package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -471
- package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -386
- package/.claude/skills/command-guide/reference/commands/memory/docs.md +17 -16
- package/.claude/skills/command-guide/reference/commands/memory/load.md +5 -5
- package/.claude/skills/command-guide/reference/commands/memory/tech-research.md +194 -357
- package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -332
- package/.claude/skills/command-guide/reference/commands/memory/workflow-skill-memory.md +4 -4
- package/.claude/skills/command-guide/reference/commands/task/create.md +151 -151
- package/.claude/skills/command-guide/reference/commands/version.md +254 -254
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/api-designer.md +585 -585
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +443 -443
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/data-architect.md +220 -220
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-manager.md +200 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-owner.md +200 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/scrum-master.md +200 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/system-architect.md +387 -387
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ui-designer.md +221 -221
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ux-expert.md +221 -221
- package/.claude/skills/command-guide/reference/commands/workflow/execute.md +25 -20
- package/.claude/skills/command-guide/reference/commands/workflow/init.md +164 -164
- package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +748 -686
- package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +664 -621
- package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +645 -592
- package/.claude/skills/command-guide/reference/commands/workflow/plan.md +5 -5
- package/.claude/skills/command-guide/reference/commands/workflow/review.md +25 -18
- package/.claude/skills/command-guide/reference/commands/workflow/session/complete.md +547 -500
- package/.claude/skills/command-guide/reference/commands/workflow/session/list.md +45 -27
- package/.claude/skills/command-guide/reference/commands/workflow/session/resume.md +35 -19
- package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +90 -33
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +3 -3
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-verify.md +23 -9
- package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +699 -699
- package/.claude/skills/command-guide/reference/commands/workflow/tools/conflict-resolution.md +103 -17
- package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -434
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +487 -291
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +17 -10
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-concept-enhanced.md +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +6 -6
- package/.claude/workflows/chinese-response.md +38 -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/workflow/gemini-solution-design.txt +131 -131
- package/.claude/workflows/cli-templates/prompts/workflow/skill-conflict-patterns.txt +5 -9
- package/.claude/workflows/cli-templates/prompts/workflow/skill-lessons-learned.txt +5 -9
- 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/fix-plan-json-schema.json +25 -0
- package/.claude/workflows/cli-templates/schemas/plan-json-schema.json +25 -0
- package/.claude/workflows/cli-tools-usage.md +526 -0
- package/{CLAUDE.md → .claude/workflows/coding-philosophy.md} +24 -45
- package/.claude/workflows/context-tools.md +84 -0
- package/.claude/workflows/file-modification.md +64 -0
- package/.claude/workflows/tool-strategy.md +216 -79
- package/.claude/workflows/windows-platform.md +16 -0
- package/.claude/workflows/workflow-architecture.md +942 -942
- package/.codex/AGENTS.md +63 -330
- 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 -164
- package/.qwen/QWEN.md +0 -139
- package/README.md +29 -9
- package/ccw/README.md +30 -6
- package/ccw/bin/ccw-mcp.js +7 -0
- package/ccw/bin/ccw.js +9 -9
- package/ccw/package.json +65 -47
- package/ccw/src/.workflow/.cli-history/history.db +0 -0
- package/ccw/src/.workflow/.cli-history/history.db-shm +0 -0
- package/ccw/src/.workflow/.cli-history/history.db-wal +0 -0
- package/ccw/src/cli.ts +244 -0
- package/ccw/src/commands/cli.ts +740 -0
- package/ccw/src/commands/core-memory.ts +770 -0
- package/ccw/src/commands/hook.ts +315 -0
- package/ccw/src/commands/install.ts +519 -0
- package/ccw/src/commands/{list.js → list.ts} +1 -1
- package/ccw/src/commands/memory.ts +1090 -0
- package/ccw/src/commands/{serve.js → serve.ts} +14 -5
- package/ccw/src/commands/session-path-resolver.ts +372 -0
- package/ccw/src/commands/session.ts +1141 -0
- package/ccw/src/commands/{stop.js → stop.ts} +16 -6
- package/ccw/src/commands/tool.ts +201 -0
- package/ccw/src/commands/{uninstall.js → uninstall.ts} +89 -40
- package/ccw/src/commands/{upgrade.js → upgrade.ts} +68 -23
- package/ccw/src/commands/{view.js → view.ts} +22 -8
- package/ccw/src/config/storage-paths.ts +670 -0
- package/ccw/src/core/cache-manager.ts +294 -0
- package/ccw/src/core/claude-freshness.ts +319 -0
- package/ccw/src/core/core-memory-store.ts +1528 -0
- package/ccw/src/core/{dashboard-generator-patch.js → dashboard-generator-patch.ts} +18 -0
- package/ccw/src/core/{dashboard-generator.js → dashboard-generator.ts} +69 -12
- package/ccw/src/core/data-aggregator.ts +584 -0
- package/ccw/src/core/history-importer.ts +625 -0
- package/ccw/src/core/{lite-scanner.js → lite-scanner-complete.ts} +162 -66
- package/ccw/src/core/lite-scanner.ts +469 -0
- package/ccw/src/core/{manifest.js → manifest.ts} +104 -34
- package/ccw/src/core/memory-embedder-bridge.ts +262 -0
- package/ccw/src/core/memory-store.ts +978 -0
- package/ccw/src/core/routes/ccw-routes.ts +96 -0
- package/ccw/src/core/routes/claude-routes.ts +1183 -0
- package/ccw/src/core/routes/cli-routes.ts +561 -0
- package/ccw/src/core/routes/codexlens-routes.ts +806 -0
- package/ccw/src/core/routes/core-memory-routes.ts +605 -0
- package/ccw/src/core/routes/files-routes.ts +428 -0
- package/ccw/src/core/routes/graph-routes.md +164 -0
- package/ccw/src/core/routes/graph-routes.ts +626 -0
- package/ccw/src/core/routes/help-routes.ts +308 -0
- package/ccw/src/core/routes/hooks-routes.ts +405 -0
- package/ccw/src/core/routes/mcp-routes.ts +1271 -0
- package/ccw/src/core/routes/mcp-routes.ts.backup +550 -0
- package/ccw/src/core/routes/mcp-templates-db.ts +268 -0
- package/ccw/src/core/routes/memory-routes.ts +1206 -0
- package/ccw/src/core/routes/rules-routes.ts +526 -0
- package/ccw/src/core/routes/session-routes.ts +467 -0
- package/ccw/src/core/routes/skills-routes.ts +599 -0
- package/ccw/src/core/routes/status-routes.ts +57 -0
- package/ccw/src/core/routes/system-routes.ts +427 -0
- package/ccw/src/core/server.ts +431 -0
- package/ccw/src/core/session-clustering-service.ts +1258 -0
- package/ccw/src/core/session-scanner.ts +283 -0
- package/ccw/src/core/websocket.ts +190 -0
- package/ccw/src/{index.js → index.ts} +1 -0
- package/ccw/src/mcp-server/index.ts +186 -0
- package/ccw/src/templates/assets/css/github-dark.min.css +10 -0
- package/ccw/src/templates/assets/css/github.min.css +10 -0
- package/ccw/src/templates/assets/js/cytoscape.min.js +32 -0
- package/ccw/src/templates/assets/js/d3.min.js +2 -0
- package/ccw/src/templates/assets/js/highlight.min.js +1244 -0
- package/ccw/src/templates/assets/js/lucide.min.js +12 -0
- package/ccw/src/templates/assets/js/marked.min.js +69 -0
- package/ccw/src/templates/assets/js/tailwind.js +83 -0
- package/ccw/src/templates/dashboard-css/01-base.css +11 -0
- package/ccw/src/templates/dashboard-css/02-session.css +22 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +10 -0
- package/ccw/src/templates/dashboard-css/06-cards.css +10 -4
- package/ccw/src/templates/dashboard-css/07-managers.css +1178 -7
- package/ccw/src/templates/dashboard-css/09-explorer.css +23 -12
- package/ccw/src/templates/dashboard-css/10-cli-status.css +337 -0
- package/ccw/src/templates/dashboard-css/11-cli-history.css +271 -0
- package/ccw/src/templates/dashboard-css/12-cli-legacy.css +796 -0
- package/ccw/src/templates/dashboard-css/13-cli-ccw.css +199 -0
- package/ccw/src/templates/dashboard-css/14-cli-modals.css +258 -0
- package/ccw/src/templates/dashboard-css/15-cli-endpoints.css +305 -0
- package/ccw/src/templates/dashboard-css/16-cli-session.css +241 -0
- package/ccw/src/templates/dashboard-css/17-cli-conversation.css +283 -0
- package/ccw/src/templates/dashboard-css/18-cli-settings.css +160 -0
- package/ccw/src/templates/dashboard-css/19-cli-native-session.css +496 -0
- package/ccw/src/templates/dashboard-css/20-cli-taskqueue.css +188 -0
- package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +310 -0
- package/ccw/src/templates/dashboard-css/22-cli-semantic.css +240 -0
- package/ccw/src/templates/dashboard-css/23-memory.css +2390 -0
- package/ccw/src/templates/dashboard-css/24-prompt-history.css +1089 -0
- package/ccw/src/templates/dashboard-css/25-skills-rules.css +326 -0
- package/ccw/src/templates/dashboard-css/26-claude-manager.css +908 -0
- package/ccw/src/templates/dashboard-css/27-graph-explorer.css +1678 -0
- package/ccw/src/templates/dashboard-css/28-mcp-manager.css +748 -0
- package/ccw/src/templates/dashboard-css/29-help.css +264 -0
- package/ccw/src/templates/dashboard-css/30-core-memory.css +1700 -0
- package/ccw/src/templates/dashboard-js/api.js +162 -142
- package/ccw/src/templates/dashboard-js/components/carousel.js +4 -4
- package/ccw/src/templates/dashboard-js/components/cli-history.js +876 -0
- package/ccw/src/templates/dashboard-js/components/cli-status.js +978 -0
- package/ccw/src/templates/dashboard-js/components/global-notifications.js +508 -219
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +1277 -282
- package/ccw/src/templates/dashboard-js/components/index-manager.js +302 -0
- package/ccw/src/templates/dashboard-js/components/mcp-manager.js +718 -27
- package/ccw/src/templates/dashboard-js/components/modals.js +66 -0
- package/ccw/src/templates/dashboard-js/components/navigation.js +80 -12
- package/ccw/src/templates/dashboard-js/components/notifications.js +758 -194
- package/ccw/src/templates/dashboard-js/components/storage-manager.js +478 -0
- package/ccw/src/templates/dashboard-js/components/tabs-other.js +157 -6
- package/ccw/src/templates/dashboard-js/components/task-queue-sidebar.js +716 -0
- package/ccw/src/templates/dashboard-js/help-i18n.js +272 -0
- package/ccw/src/templates/dashboard-js/i18n.js +2807 -0
- package/ccw/src/templates/dashboard-js/main.js +15 -0
- package/ccw/src/templates/dashboard-js/state.js +243 -42
- package/ccw/src/templates/dashboard-js/utils.js +47 -1
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +912 -0
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +2272 -0
- package/ccw/src/templates/dashboard-js/views/codexlens-manager.js +964 -0
- package/ccw/src/templates/dashboard-js/views/core-memory-clusters.js +503 -0
- package/ccw/src/templates/dashboard-js/views/core-memory.js +782 -0
- package/ccw/src/templates/dashboard-js/views/explorer.js +888 -852
- package/ccw/src/templates/dashboard-js/views/graph-explorer.js +1157 -0
- package/ccw/src/templates/dashboard-js/views/help.js +856 -0
- package/ccw/src/templates/dashboard-js/views/history.js +337 -0
- package/ccw/src/templates/dashboard-js/views/home.js +61 -15
- package/ccw/src/templates/dashboard-js/views/hook-manager.js +311 -43
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +204 -28
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2187 -411
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js.backup +1729 -0
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js.new +928 -0
- package/ccw/src/templates/dashboard-js/views/memory.js +1221 -0
- package/ccw/src/templates/dashboard-js/views/prompt-history.js +713 -0
- package/ccw/src/templates/dashboard-js/views/rules-manager.js +828 -0
- package/ccw/src/templates/dashboard-js/views/session-detail.js +54 -53
- package/ccw/src/templates/dashboard-js/views/skills-manager.js +819 -0
- package/ccw/src/templates/dashboard.html +185 -85
- package/ccw/src/templates/hooks-config-example.json +60 -0
- package/ccw/src/tools/classify-folders.ts +245 -0
- package/ccw/src/tools/cli-config-manager.ts +268 -0
- package/ccw/src/tools/cli-executor.ts +2014 -0
- package/ccw/src/tools/cli-history-store.ts +1195 -0
- package/ccw/src/tools/codex-lens.ts +1141 -0
- package/ccw/src/tools/{convert-tokens-to-css.js → convert-tokens-to-css.ts} +73 -23
- package/ccw/src/tools/core-memory.ts +444 -0
- package/ccw/src/tools/detect-changed-modules.ts +325 -0
- package/ccw/src/tools/{discover-design-files.js → discover-design-files.ts} +74 -24
- package/ccw/src/tools/edit-file.ts +568 -0
- package/ccw/src/tools/{generate-module-docs.js → generate-module-docs.ts} +207 -185
- package/ccw/src/tools/{get-modules-by-depth.js → get-modules-by-depth.ts} +120 -79
- package/ccw/src/tools/index.ts +370 -0
- package/ccw/src/tools/native-session-discovery.ts +795 -0
- package/ccw/src/tools/notifier.ts +129 -0
- package/ccw/src/tools/read-file.ts +410 -0
- package/ccw/src/tools/resume-strategy.ts +345 -0
- package/ccw/src/tools/session-content-parser.ts +619 -0
- package/ccw/src/tools/session-manager.ts +1026 -0
- package/ccw/src/tools/smart-context.ts +228 -0
- package/ccw/src/tools/smart-search.ts +2065 -0
- package/ccw/src/tools/smart-search.ts.backup +1233 -0
- package/ccw/src/tools/storage-manager.ts +455 -0
- package/ccw/src/tools/write-file.ts +222 -0
- package/ccw/src/types/config.ts +11 -0
- package/ccw/src/types/index.ts +3 -0
- package/ccw/src/types/session.ts +25 -0
- package/ccw/src/types/tool.ts +41 -0
- package/ccw/src/utils/{browser-launcher.js → browser-launcher.ts} +10 -8
- package/ccw/src/utils/file-utils.ts +48 -0
- package/ccw/src/utils/{path-resolver.js → path-resolver.ts} +114 -78
- package/ccw/src/utils/path-validator.ts +153 -0
- package/ccw/src/utils/{ui.js → ui.ts} +32 -25
- 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 +4 -1
- package/.claude/commands/memory/tech-research.md +0 -477
- package/.claude/scripts/classify-folders.sh +0 -39
- package/.claude/scripts/convert_tokens_to_css.sh +0 -229
- package/.claude/scripts/detect_changed_modules.sh +0 -161
- package/.claude/scripts/discover-design-files.sh +0 -87
- package/.claude/scripts/extract-animations.js +0 -243
- package/.claude/scripts/extract-computed-styles.js +0 -118
- package/.claude/scripts/extract-layout-structure.js +0 -411
- package/.claude/scripts/generate_module_docs.sh +0 -717
- package/.claude/scripts/get_modules_by_depth.sh +0 -170
- package/.claude/scripts/ui-generate-preview.sh +0 -395
- package/.claude/scripts/ui-instantiate-prototypes.sh +0 -815
- package/.claude/scripts/update_module_claude.sh +0 -337
- package/.claude/workflows/context-search-strategy.md +0 -77
- package/.claude/workflows/intelligent-tools-strategy.md +0 -662
- package/ccw/src/cli.js +0 -119
- package/ccw/src/commands/install.js +0 -324
- package/ccw/src/commands/tool.js +0 -138
- package/ccw/src/core/data-aggregator.js +0 -409
- package/ccw/src/core/server.js +0 -2063
- package/ccw/src/core/session-scanner.js +0 -235
- package/ccw/src/tools/classify-folders.js +0 -204
- package/ccw/src/tools/detect-changed-modules.js +0 -288
- package/ccw/src/tools/edit-file.js +0 -266
- package/ccw/src/tools/index.js +0 -176
- package/ccw/src/utils/file-utils.js +0 -48
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
// Core Memory View
|
|
2
|
+
// Manages strategic context entries with knowledge graph and evolution tracking
|
|
3
|
+
|
|
4
|
+
// Notification function
|
|
5
|
+
function showNotification(message, type = 'info') {
|
|
6
|
+
// Create notification container if it doesn't exist
|
|
7
|
+
let container = document.getElementById('notificationContainer');
|
|
8
|
+
if (!container) {
|
|
9
|
+
container = document.createElement('div');
|
|
10
|
+
container.id = 'notificationContainer';
|
|
11
|
+
container.style.cssText = 'position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px;';
|
|
12
|
+
document.body.appendChild(container);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Create notification element
|
|
16
|
+
const notification = document.createElement('div');
|
|
17
|
+
const bgColors = {
|
|
18
|
+
success: 'hsl(var(--success))',
|
|
19
|
+
error: 'hsl(var(--destructive))',
|
|
20
|
+
warning: 'hsl(var(--warning))',
|
|
21
|
+
info: 'hsl(var(--info))'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
notification.style.cssText = `
|
|
25
|
+
background: ${bgColors[type] || bgColors.info};
|
|
26
|
+
color: white;
|
|
27
|
+
padding: 12px 20px;
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
30
|
+
max-width: 350px;
|
|
31
|
+
animation: slideInRight 0.3s ease-out;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
line-height: 1.5;
|
|
34
|
+
`;
|
|
35
|
+
notification.textContent = message;
|
|
36
|
+
|
|
37
|
+
// Add to container
|
|
38
|
+
container.appendChild(notification);
|
|
39
|
+
|
|
40
|
+
// Auto remove after 3 seconds
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
notification.style.animation = 'slideOutRight 0.3s ease-out';
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
container.removeChild(notification);
|
|
45
|
+
if (container.children.length === 0) {
|
|
46
|
+
document.body.removeChild(container);
|
|
47
|
+
}
|
|
48
|
+
}, 300);
|
|
49
|
+
}, 3000);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function renderCoreMemoryView() {
|
|
53
|
+
const content = document.getElementById('mainContent');
|
|
54
|
+
hideStatsAndCarousel();
|
|
55
|
+
|
|
56
|
+
// Fetch core memories
|
|
57
|
+
const archived = false;
|
|
58
|
+
const memories = await fetchCoreMemories(archived);
|
|
59
|
+
|
|
60
|
+
content.innerHTML = `
|
|
61
|
+
<div class="core-memory-container">
|
|
62
|
+
<!-- Tab Navigation -->
|
|
63
|
+
<div class="core-memory-tabs">
|
|
64
|
+
<div class="tab-nav">
|
|
65
|
+
<button class="tab-btn active" id="memoriesViewBtn" onclick="showMemoriesView()">
|
|
66
|
+
<i data-lucide="brain"></i>
|
|
67
|
+
${t('coreMemory.memories')}
|
|
68
|
+
</button>
|
|
69
|
+
<button class="tab-btn" id="favoritesViewBtn" onclick="showFavoritesView()">
|
|
70
|
+
<i data-lucide="star"></i>
|
|
71
|
+
${t('coreMemory.favorites') || 'Favorites'}
|
|
72
|
+
</button>
|
|
73
|
+
<button class="tab-btn" id="clustersViewBtn" onclick="showClustersView()">
|
|
74
|
+
<i data-lucide="folder-tree"></i>
|
|
75
|
+
${t('coreMemory.clusters')}
|
|
76
|
+
</button>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="tab-actions">
|
|
79
|
+
<button class="btn btn-primary" onclick="showCreateMemoryModal()">
|
|
80
|
+
<i data-lucide="plus"></i>
|
|
81
|
+
${t('coreMemory.createNew')}
|
|
82
|
+
</button>
|
|
83
|
+
<button class="btn btn-secondary" onclick="toggleArchivedMemories()">
|
|
84
|
+
<i data-lucide="archive"></i>
|
|
85
|
+
<span id="archiveToggleText">${t('coreMemory.showArchived')}</span>
|
|
86
|
+
</button>
|
|
87
|
+
<button class="btn btn-secondary" onclick="refreshCoreMemories()">
|
|
88
|
+
<i data-lucide="refresh-cw"></i>
|
|
89
|
+
${t('common.refresh')}
|
|
90
|
+
</button>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<!-- Memories Tab Content (default view) -->
|
|
95
|
+
<div class="cm-tab-panel" id="memoriesGrid">
|
|
96
|
+
<div class="memory-stats">
|
|
97
|
+
<div class="stat-item">
|
|
98
|
+
<span class="stat-label">${t('coreMemory.totalMemories')}</span>
|
|
99
|
+
<span class="stat-value" id="totalMemoriesCount">${memories.length}</span>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="memories-grid">
|
|
103
|
+
${memories.length === 0
|
|
104
|
+
? `<div class="empty-state">
|
|
105
|
+
<i data-lucide="brain"></i>
|
|
106
|
+
<p>${t('coreMemory.noMemories')}</p>
|
|
107
|
+
</div>`
|
|
108
|
+
: memories.map(memory => renderMemoryCard(memory)).join('')
|
|
109
|
+
}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<!-- Favorites Tab Content (hidden by default) -->
|
|
114
|
+
<div class="cm-tab-panel" id="favoritesGrid" style="display: none;">
|
|
115
|
+
<div class="memory-stats">
|
|
116
|
+
<div class="stat-item">
|
|
117
|
+
<span class="stat-label">${t('coreMemory.totalFavorites') || 'Total Favorites'}</span>
|
|
118
|
+
<span class="stat-value" id="totalFavoritesCount">0</span>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="memories-grid" id="favoritesGridContent">
|
|
122
|
+
<div class="empty-state">
|
|
123
|
+
<i data-lucide="star"></i>
|
|
124
|
+
<p>${t('coreMemory.noFavorites') || 'No favorites yet'}</p>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<!-- Clusters Tab Content (hidden by default) -->
|
|
130
|
+
<div class="cm-tab-panel clusters-container" id="clustersContainer" style="display: none;">
|
|
131
|
+
<div class="clusters-layout">
|
|
132
|
+
<div class="clusters-sidebar">
|
|
133
|
+
<div class="clusters-sidebar-header">
|
|
134
|
+
<h4>${t('coreMemory.clustersList')}</h4>
|
|
135
|
+
<button class="btn btn-sm btn-primary" onclick="triggerAutoClustering()">
|
|
136
|
+
<i data-lucide="sparkles"></i>
|
|
137
|
+
${t('coreMemory.autoCluster')}
|
|
138
|
+
</button>
|
|
139
|
+
</div>
|
|
140
|
+
<div id="clusterListContainer" class="cluster-list">
|
|
141
|
+
<!-- Clusters will be loaded here -->
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
<div class="clusters-detail">
|
|
145
|
+
<div id="clusterDetailContainer" class="cluster-detail-content">
|
|
146
|
+
<div class="empty-state">
|
|
147
|
+
<i data-lucide="folder-tree"></i>
|
|
148
|
+
<p>${t('coreMemory.selectCluster')}</p>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<!-- Create/Edit Memory Modal -->
|
|
157
|
+
<div id="memoryModal" class="modal-overlay" style="display: none;">
|
|
158
|
+
<div class="modal-content memory-modal">
|
|
159
|
+
<div class="modal-header">
|
|
160
|
+
<h2 id="memoryModalTitle">${t('coreMemory.createNew')}</h2>
|
|
161
|
+
<button class="modal-close" onclick="closeMemoryModal()">
|
|
162
|
+
<i data-lucide="x"></i>
|
|
163
|
+
</button>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="modal-body">
|
|
166
|
+
<div class="form-group">
|
|
167
|
+
<label>${t('coreMemory.content')}</label>
|
|
168
|
+
<textarea
|
|
169
|
+
id="memoryContent"
|
|
170
|
+
rows="10"
|
|
171
|
+
placeholder="${t('coreMemory.contentPlaceholder')}"
|
|
172
|
+
></textarea>
|
|
173
|
+
</div>
|
|
174
|
+
<div class="form-group">
|
|
175
|
+
<label>${t('coreMemory.summary')} (${t('common.optional')})</label>
|
|
176
|
+
<textarea
|
|
177
|
+
id="memorySummary"
|
|
178
|
+
rows="3"
|
|
179
|
+
placeholder="${t('coreMemory.summaryPlaceholder')}"
|
|
180
|
+
></textarea>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="form-group">
|
|
183
|
+
<label>${t('coreMemory.metadata')} (${t('common.optional')})</label>
|
|
184
|
+
<input
|
|
185
|
+
type="text"
|
|
186
|
+
id="memoryMetadata"
|
|
187
|
+
placeholder='{"tags": ["strategy", "architecture"], "priority": "high"}'
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
<div class="modal-footer">
|
|
192
|
+
<button class="btn btn-secondary" onclick="closeMemoryModal()">
|
|
193
|
+
${t('common.cancel')}
|
|
194
|
+
</button>
|
|
195
|
+
<button class="btn btn-primary" onclick="saveMemory()">
|
|
196
|
+
${t('common.save')}
|
|
197
|
+
</button>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<!-- Memory Detail Modal -->
|
|
203
|
+
<div id="memoryDetailModal" class="modal-overlay" style="display: none;">
|
|
204
|
+
<div class="modal-content memory-detail-modal">
|
|
205
|
+
<div class="modal-header">
|
|
206
|
+
<h2 id="memoryDetailTitle"></h2>
|
|
207
|
+
<button class="modal-close" onclick="closeMemoryDetailModal()">
|
|
208
|
+
<i data-lucide="x"></i>
|
|
209
|
+
</button>
|
|
210
|
+
</div>
|
|
211
|
+
<div class="modal-body" id="memoryDetailBody">
|
|
212
|
+
<!-- Content loaded dynamically -->
|
|
213
|
+
</div>
|
|
214
|
+
<div class="modal-footer">
|
|
215
|
+
<button class="btn btn-secondary" onclick="closeMemoryDetailModal()">
|
|
216
|
+
${t('common.close')}
|
|
217
|
+
</button>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
`;
|
|
222
|
+
|
|
223
|
+
lucide.createIcons();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function renderMemoryCard(memory) {
|
|
227
|
+
const createdDate = new Date(memory.created_at).toLocaleString();
|
|
228
|
+
const updatedDate = memory.updated_at ? new Date(memory.updated_at).toLocaleString() : createdDate;
|
|
229
|
+
const isArchived = memory.archived || false;
|
|
230
|
+
|
|
231
|
+
const metadata = memory.metadata || {};
|
|
232
|
+
const tags = metadata.tags || [];
|
|
233
|
+
const priority = metadata.priority || 'medium';
|
|
234
|
+
|
|
235
|
+
return `
|
|
236
|
+
<div class="memory-card ${isArchived ? 'archived' : ''}" data-memory-id="${memory.id}" onclick="viewMemoryDetail('${memory.id}')">
|
|
237
|
+
<div class="memory-card-header">
|
|
238
|
+
<div class="memory-id">
|
|
239
|
+
${metadata.favorite ? '<i data-lucide="star"></i>' : ''}
|
|
240
|
+
<span>${memory.id}</span>
|
|
241
|
+
${isArchived ? `<span class="badge badge-archived">${t('common.archived')}</span>` : ''}
|
|
242
|
+
${priority !== 'medium' ? `<span class="badge badge-priority-${priority}">${priority}</span>` : ''}
|
|
243
|
+
</div>
|
|
244
|
+
<div class="memory-actions" onclick="event.stopPropagation()">
|
|
245
|
+
<button class="icon-btn" onclick="editMemory('${memory.id}')" title="${t('common.edit')}">
|
|
246
|
+
<i data-lucide="edit"></i>
|
|
247
|
+
</button>
|
|
248
|
+
<button class="icon-btn ${metadata.favorite ? 'favorite-active' : ''}" onclick="toggleFavorite('${memory.id}')" title="${t('coreMemory.toggleFavorite') || 'Toggle Favorite'}">
|
|
249
|
+
<i data-lucide="star"></i>
|
|
250
|
+
</button>
|
|
251
|
+
${!isArchived
|
|
252
|
+
? `<button class="icon-btn" onclick="archiveMemory('${memory.id}')" title="${t('common.archive')}">
|
|
253
|
+
<i data-lucide="archive"></i>
|
|
254
|
+
</button>`
|
|
255
|
+
: `<button class="icon-btn" onclick="unarchiveMemory('${memory.id}')" title="${t('coreMemory.unarchive')}">
|
|
256
|
+
<i data-lucide="archive-restore"></i>
|
|
257
|
+
</button>`
|
|
258
|
+
}
|
|
259
|
+
<button class="icon-btn danger" onclick="deleteMemory('${memory.id}')" title="${t('common.delete')}">
|
|
260
|
+
<i data-lucide="trash-2"></i>
|
|
261
|
+
</button>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
<div class="memory-content">
|
|
266
|
+
${memory.summary
|
|
267
|
+
? `<div class="memory-summary">${escapeHtml(memory.summary)}</div>`
|
|
268
|
+
: `<div class="memory-preview">${escapeHtml(memory.content.substring(0, 200))}${memory.content.length > 200 ? '...' : ''}</div>`
|
|
269
|
+
}
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
${tags.length > 0
|
|
273
|
+
? `<div class="memory-tags">
|
|
274
|
+
${tags.map(tag => `<span class="tag">${escapeHtml(tag)}</span>`).join('')}
|
|
275
|
+
</div>`
|
|
276
|
+
: ''
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
<div class="memory-footer">
|
|
280
|
+
<div class="memory-meta">
|
|
281
|
+
<span title="${t('coreMemory.created')}">
|
|
282
|
+
<i data-lucide="calendar"></i>
|
|
283
|
+
${createdDate}
|
|
284
|
+
</span>
|
|
285
|
+
${memory.updated_at
|
|
286
|
+
? `<span title="${t('coreMemory.updated')}">
|
|
287
|
+
<i data-lucide="clock"></i>
|
|
288
|
+
${updatedDate}
|
|
289
|
+
</span>`
|
|
290
|
+
: ''
|
|
291
|
+
}
|
|
292
|
+
</div>
|
|
293
|
+
<div class="memory-features" onclick="event.stopPropagation()">
|
|
294
|
+
<button class="feature-btn" onclick="generateMemorySummary('${memory.id}')" title="${t('coreMemory.generateSummary')}">
|
|
295
|
+
<i data-lucide="sparkles"></i>
|
|
296
|
+
${t('coreMemory.summary')}
|
|
297
|
+
</button>
|
|
298
|
+
<button class="feature-btn" onclick="copyMemoryId('${memory.id}')" title="${t('common.copyId') || 'Copy ID'}">
|
|
299
|
+
<i data-lucide="copy"></i>
|
|
300
|
+
${t('common.copyId') || 'Copy ID'}
|
|
301
|
+
</button>
|
|
302
|
+
<button class="feature-btn" onclick="showMemoryRelations('${memory.id}')" title="${t('coreMemory.showRelations') || 'Show Relations'}">
|
|
303
|
+
<i data-lucide="git-branch"></i>
|
|
304
|
+
${t('coreMemory.relations') || 'Relations'}
|
|
305
|
+
</button>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
`;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// API Functions
|
|
313
|
+
async function fetchCoreMemories(archived = false) {
|
|
314
|
+
try {
|
|
315
|
+
const response = await fetch(`/api/core-memory/memories?path=${encodeURIComponent(projectPath)}&archived=${archived}`);
|
|
316
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
317
|
+
const data = await response.json();
|
|
318
|
+
return data.memories || [];
|
|
319
|
+
} catch (error) {
|
|
320
|
+
console.error('Failed to fetch core memories:', error);
|
|
321
|
+
showNotification(t('coreMemory.fetchError'), 'error');
|
|
322
|
+
return [];
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
async function fetchMemoryById(memoryId) {
|
|
327
|
+
try {
|
|
328
|
+
const response = await fetch(`/api/core-memory/memories/${memoryId}?path=${encodeURIComponent(projectPath)}`);
|
|
329
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
330
|
+
const data = await response.json();
|
|
331
|
+
return data.memory || null;
|
|
332
|
+
} catch (error) {
|
|
333
|
+
console.error('Failed to fetch memory:', error);
|
|
334
|
+
showNotification(t('coreMemory.fetchError'), 'error');
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Modal Functions
|
|
340
|
+
function showCreateMemoryModal() {
|
|
341
|
+
const modal = document.getElementById('memoryModal');
|
|
342
|
+
document.getElementById('memoryModalTitle').textContent = t('coreMemory.createNew');
|
|
343
|
+
document.getElementById('memoryContent').value = '';
|
|
344
|
+
document.getElementById('memorySummary').value = '';
|
|
345
|
+
document.getElementById('memoryMetadata').value = '';
|
|
346
|
+
modal.dataset.editId = '';
|
|
347
|
+
modal.style.display = 'flex';
|
|
348
|
+
lucide.createIcons();
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
async function editMemory(memoryId) {
|
|
352
|
+
const memory = await fetchMemoryById(memoryId);
|
|
353
|
+
if (!memory) return;
|
|
354
|
+
|
|
355
|
+
const modal = document.getElementById('memoryModal');
|
|
356
|
+
document.getElementById('memoryModalTitle').textContent = t('coreMemory.edit');
|
|
357
|
+
document.getElementById('memoryContent').value = memory.content || '';
|
|
358
|
+
document.getElementById('memorySummary').value = memory.summary || '';
|
|
359
|
+
document.getElementById('memoryMetadata').value = memory.metadata ? JSON.stringify(memory.metadata, null, 2) : '';
|
|
360
|
+
modal.dataset.editId = memoryId;
|
|
361
|
+
modal.style.display = 'flex';
|
|
362
|
+
lucide.createIcons();
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function closeMemoryModal() {
|
|
366
|
+
document.getElementById('memoryModal').style.display = 'none';
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
async function saveMemory() {
|
|
370
|
+
const modal = document.getElementById('memoryModal');
|
|
371
|
+
const content = document.getElementById('memoryContent').value.trim();
|
|
372
|
+
const summary = document.getElementById('memorySummary').value.trim();
|
|
373
|
+
const metadataStr = document.getElementById('memoryMetadata').value.trim();
|
|
374
|
+
|
|
375
|
+
if (!content) {
|
|
376
|
+
showNotification(t('coreMemory.contentRequired'), 'error');
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
let metadata = {};
|
|
381
|
+
if (metadataStr) {
|
|
382
|
+
try {
|
|
383
|
+
metadata = JSON.parse(metadataStr);
|
|
384
|
+
} catch (e) {
|
|
385
|
+
showNotification(t('coreMemory.invalidMetadata'), 'error');
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const payload = {
|
|
391
|
+
content,
|
|
392
|
+
summary: summary || undefined,
|
|
393
|
+
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
|
|
394
|
+
path: projectPath
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
const editId = modal.dataset.editId;
|
|
398
|
+
if (editId) {
|
|
399
|
+
payload.id = editId;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
try {
|
|
403
|
+
const response = await fetch('/api/core-memory/memories', {
|
|
404
|
+
method: 'POST',
|
|
405
|
+
headers: { 'Content-Type': 'application/json' },
|
|
406
|
+
body: JSON.stringify(payload)
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
410
|
+
|
|
411
|
+
showNotification(editId ? t('coreMemory.updated') : t('coreMemory.created'), 'success');
|
|
412
|
+
closeMemoryModal();
|
|
413
|
+
await refreshCoreMemories();
|
|
414
|
+
} catch (error) {
|
|
415
|
+
console.error('Failed to save memory:', error);
|
|
416
|
+
showNotification(t('coreMemory.saveError'), 'error');
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
async function archiveMemory(memoryId) {
|
|
421
|
+
if (!confirm(t('coreMemory.confirmArchive'))) return;
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
const response = await fetch(`/api/core-memory/memories/${memoryId}/archive?path=${encodeURIComponent(projectPath)}`, {
|
|
425
|
+
method: 'POST'
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
429
|
+
|
|
430
|
+
showNotification(t('coreMemory.archived'), 'success');
|
|
431
|
+
await refreshCoreMemories();
|
|
432
|
+
} catch (error) {
|
|
433
|
+
console.error('Failed to archive memory:', error);
|
|
434
|
+
showNotification(t('coreMemory.archiveError'), 'error');
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
async function unarchiveMemory(memoryId) {
|
|
439
|
+
try {
|
|
440
|
+
const memory = await fetchMemoryById(memoryId);
|
|
441
|
+
if (!memory) return;
|
|
442
|
+
|
|
443
|
+
memory.archived = false;
|
|
444
|
+
|
|
445
|
+
const response = await fetch('/api/core-memory/memories', {
|
|
446
|
+
method: 'POST',
|
|
447
|
+
headers: { 'Content-Type': 'application/json' },
|
|
448
|
+
body: JSON.stringify({ ...memory, path: projectPath })
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
452
|
+
|
|
453
|
+
showNotification(t('coreMemory.unarchived'), 'success');
|
|
454
|
+
await refreshCoreMemories();
|
|
455
|
+
} catch (error) {
|
|
456
|
+
console.error('Failed to unarchive memory:', error);
|
|
457
|
+
showNotification(t('coreMemory.unarchiveError'), 'error');
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
async function deleteMemory(memoryId) {
|
|
462
|
+
if (!confirm(t('coreMemory.confirmDelete'))) return;
|
|
463
|
+
|
|
464
|
+
try {
|
|
465
|
+
const response = await fetch(`/api/core-memory/memories/${memoryId}?path=${encodeURIComponent(projectPath)}`, {
|
|
466
|
+
method: 'DELETE'
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
470
|
+
|
|
471
|
+
showNotification(t('coreMemory.deleted'), 'success');
|
|
472
|
+
await refreshCoreMemories();
|
|
473
|
+
} catch (error) {
|
|
474
|
+
console.error('Failed to delete memory:', error);
|
|
475
|
+
showNotification(t('coreMemory.deleteError'), 'error');
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// Feature Functions
|
|
480
|
+
async function generateMemorySummary(memoryId) {
|
|
481
|
+
try {
|
|
482
|
+
showNotification(t('coreMemory.generatingSummary'), 'info');
|
|
483
|
+
|
|
484
|
+
const response = await fetch(`/api/core-memory/memories/${memoryId}/summary`, {
|
|
485
|
+
method: 'POST',
|
|
486
|
+
headers: { 'Content-Type': 'application/json' },
|
|
487
|
+
body: JSON.stringify({ tool: 'gemini', path: projectPath })
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
491
|
+
|
|
492
|
+
const result = await response.json();
|
|
493
|
+
showNotification(t('coreMemory.summaryGenerated'), 'success');
|
|
494
|
+
|
|
495
|
+
// Show summary in detail modal
|
|
496
|
+
await viewMemoryDetail(memoryId);
|
|
497
|
+
} catch (error) {
|
|
498
|
+
console.error('Failed to generate summary:', error);
|
|
499
|
+
showNotification(t('coreMemory.summaryError'), 'error');
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
async function viewMemoryDetail(memoryId) {
|
|
504
|
+
const memory = await fetchMemoryById(memoryId);
|
|
505
|
+
if (!memory) return;
|
|
506
|
+
|
|
507
|
+
const modal = document.getElementById('memoryDetailModal');
|
|
508
|
+
document.getElementById('memoryDetailTitle').textContent = memory.id;
|
|
509
|
+
|
|
510
|
+
const body = document.getElementById('memoryDetailBody');
|
|
511
|
+
body.innerHTML = `
|
|
512
|
+
<div class="memory-detail-content">
|
|
513
|
+
${memory.summary
|
|
514
|
+
? `<div class="detail-section">
|
|
515
|
+
<h3>${t('coreMemory.summary')}</h3>
|
|
516
|
+
<div class="detail-text">${escapeHtml(memory.summary)}</div>
|
|
517
|
+
</div>`
|
|
518
|
+
: ''
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
<div class="detail-section">
|
|
522
|
+
<h3>${t('coreMemory.content')}</h3>
|
|
523
|
+
<pre class="detail-code">${escapeHtml(memory.content)}</pre>
|
|
524
|
+
</div>
|
|
525
|
+
|
|
526
|
+
${memory.metadata && Object.keys(memory.metadata).length > 0
|
|
527
|
+
? `<div class="detail-section">
|
|
528
|
+
<h3>${t('coreMemory.metadata')}</h3>
|
|
529
|
+
<pre class="detail-code">${escapeHtml(JSON.stringify(memory.metadata, null, 2))}</pre>
|
|
530
|
+
</div>`
|
|
531
|
+
: ''
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
${memory.raw_output
|
|
535
|
+
? `<div class="detail-section">
|
|
536
|
+
<h3>${t('coreMemory.rawOutput')}</h3>
|
|
537
|
+
<pre class="detail-code">${escapeHtml(memory.raw_output)}</pre>
|
|
538
|
+
</div>`
|
|
539
|
+
: ''
|
|
540
|
+
}
|
|
541
|
+
</div>
|
|
542
|
+
`;
|
|
543
|
+
|
|
544
|
+
modal.style.display = 'flex';
|
|
545
|
+
lucide.createIcons();
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function closeMemoryDetailModal() {
|
|
549
|
+
document.getElementById('memoryDetailModal').style.display = 'none';
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
let showingArchivedMemories = false;
|
|
553
|
+
|
|
554
|
+
async function toggleArchivedMemories() {
|
|
555
|
+
showingArchivedMemories = !showingArchivedMemories;
|
|
556
|
+
const toggleText = document.getElementById('archiveToggleText');
|
|
557
|
+
toggleText.textContent = showingArchivedMemories
|
|
558
|
+
? t('coreMemory.showActive')
|
|
559
|
+
: t('coreMemory.showArchived');
|
|
560
|
+
|
|
561
|
+
await refreshCoreMemories();
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
async function refreshCoreMemories() {
|
|
565
|
+
const memories = await fetchCoreMemories(showingArchivedMemories);
|
|
566
|
+
|
|
567
|
+
const container = document.getElementById('memoriesGrid');
|
|
568
|
+
const grid = container.querySelector('.memories-grid');
|
|
569
|
+
const countEl = document.getElementById('totalMemoriesCount');
|
|
570
|
+
|
|
571
|
+
if (countEl) countEl.textContent = memories.length;
|
|
572
|
+
|
|
573
|
+
if (grid) {
|
|
574
|
+
if (memories.length === 0) {
|
|
575
|
+
grid.innerHTML = `
|
|
576
|
+
<div class="empty-state">
|
|
577
|
+
<i data-lucide="brain"></i>
|
|
578
|
+
<p>${showingArchivedMemories ? t('coreMemory.noArchivedMemories') : t('coreMemory.noMemories')}</p>
|
|
579
|
+
</div>
|
|
580
|
+
`;
|
|
581
|
+
} else {
|
|
582
|
+
grid.innerHTML = memories.map(memory => renderMemoryCard(memory)).join('');
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
lucide.createIcons();
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Utility Functions
|
|
590
|
+
function escapeHtml(text) {
|
|
591
|
+
const div = document.createElement('div');
|
|
592
|
+
div.textContent = text;
|
|
593
|
+
return div.innerHTML;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
async function copyMemoryId(memoryId) {
|
|
597
|
+
try {
|
|
598
|
+
await navigator.clipboard.writeText(memoryId);
|
|
599
|
+
showNotification(t('common.copied') || 'Copied!', 'success');
|
|
600
|
+
} catch (error) {
|
|
601
|
+
console.error('Failed to copy:', error);
|
|
602
|
+
showNotification(t('common.copyError') || 'Failed to copy', 'error');
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// View Toggle Functions
|
|
607
|
+
function showMemoriesView() {
|
|
608
|
+
document.getElementById('memoriesGrid').style.display = '';
|
|
609
|
+
document.getElementById('favoritesGrid').style.display = 'none';
|
|
610
|
+
document.getElementById('clustersContainer').style.display = 'none';
|
|
611
|
+
document.getElementById('memoriesViewBtn').classList.add('active');
|
|
612
|
+
document.getElementById('favoritesViewBtn').classList.remove('active');
|
|
613
|
+
document.getElementById('clustersViewBtn').classList.remove('active');
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
async function showFavoritesView() {
|
|
617
|
+
document.getElementById('memoriesGrid').style.display = 'none';
|
|
618
|
+
document.getElementById('favoritesGrid').style.display = '';
|
|
619
|
+
document.getElementById('clustersContainer').style.display = 'none';
|
|
620
|
+
document.getElementById('memoriesViewBtn').classList.remove('active');
|
|
621
|
+
document.getElementById('favoritesViewBtn').classList.add('active');
|
|
622
|
+
document.getElementById('clustersViewBtn').classList.remove('active');
|
|
623
|
+
|
|
624
|
+
// Load favorites
|
|
625
|
+
await refreshFavorites();
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function showClustersView() {
|
|
629
|
+
document.getElementById('memoriesGrid').style.display = 'none';
|
|
630
|
+
document.getElementById('favoritesGrid').style.display = 'none';
|
|
631
|
+
document.getElementById('clustersContainer').style.display = '';
|
|
632
|
+
document.getElementById('memoriesViewBtn').classList.remove('active');
|
|
633
|
+
document.getElementById('favoritesViewBtn').classList.remove('active');
|
|
634
|
+
document.getElementById('clustersViewBtn').classList.add('active');
|
|
635
|
+
|
|
636
|
+
// Load clusters from core-memory-clusters.js
|
|
637
|
+
if (typeof loadClusters === 'function') {
|
|
638
|
+
loadClusters();
|
|
639
|
+
} else {
|
|
640
|
+
console.error('loadClusters is not available. Make sure core-memory-clusters.js is loaded.');
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// Favorites Functions
|
|
645
|
+
async function refreshFavorites() {
|
|
646
|
+
const allMemories = await fetchCoreMemories(false);
|
|
647
|
+
const favorites = allMemories.filter(m => m.metadata && m.metadata.favorite);
|
|
648
|
+
|
|
649
|
+
const countEl = document.getElementById('totalFavoritesCount');
|
|
650
|
+
const gridEl = document.getElementById('favoritesGridContent');
|
|
651
|
+
|
|
652
|
+
if (countEl) countEl.textContent = favorites.length;
|
|
653
|
+
|
|
654
|
+
if (gridEl) {
|
|
655
|
+
if (favorites.length === 0) {
|
|
656
|
+
gridEl.innerHTML = `
|
|
657
|
+
<div class="empty-state">
|
|
658
|
+
<i data-lucide="star"></i>
|
|
659
|
+
<p>${t('coreMemory.noFavorites') || 'No favorites yet'}</p>
|
|
660
|
+
</div>
|
|
661
|
+
`;
|
|
662
|
+
} else {
|
|
663
|
+
gridEl.innerHTML = favorites.map(memory => renderMemoryCard(memory)).join('');
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
lucide.createIcons();
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
async function showMemoryRelations(memoryId) {
|
|
671
|
+
try {
|
|
672
|
+
// Fetch all clusters
|
|
673
|
+
const response = await fetch(`/api/core-memory/clusters?path=${encodeURIComponent(projectPath)}`);
|
|
674
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
675
|
+
|
|
676
|
+
const result = await response.json();
|
|
677
|
+
const clusters = result.clusters || [];
|
|
678
|
+
|
|
679
|
+
// Find clusters containing this memory
|
|
680
|
+
const relatedClusters = [];
|
|
681
|
+
for (const cluster of clusters) {
|
|
682
|
+
const detailRes = await fetch(`/api/core-memory/clusters/${cluster.id}?path=${encodeURIComponent(projectPath)}`);
|
|
683
|
+
if (detailRes.ok) {
|
|
684
|
+
const detail = await detailRes.json();
|
|
685
|
+
const members = detail.members || [];
|
|
686
|
+
if (members.some(m => m.session_id === memoryId || m.id === memoryId)) {
|
|
687
|
+
relatedClusters.push({
|
|
688
|
+
...cluster,
|
|
689
|
+
relations: detail.relations || []
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// Show in modal
|
|
696
|
+
const modal = document.getElementById('memoryDetailModal');
|
|
697
|
+
document.getElementById('memoryDetailTitle').textContent = t('coreMemory.relationsFor') || `Relations: ${memoryId}`;
|
|
698
|
+
|
|
699
|
+
const body = document.getElementById('memoryDetailBody');
|
|
700
|
+
if (relatedClusters.length === 0) {
|
|
701
|
+
body.innerHTML = `
|
|
702
|
+
<div class="empty-state">
|
|
703
|
+
<i data-lucide="git-branch"></i>
|
|
704
|
+
<p>${t('coreMemory.noRelations') || 'No cluster relations found'}</p>
|
|
705
|
+
<p class="text-muted">${t('coreMemory.noRelationsHint') || 'Use Auto Cluster in the Clusters tab to create relations'}</p>
|
|
706
|
+
</div>
|
|
707
|
+
`;
|
|
708
|
+
} else {
|
|
709
|
+
body.innerHTML = `
|
|
710
|
+
<div class="relations-detail">
|
|
711
|
+
<h4>${t('coreMemory.belongsToClusters') || 'Belongs to Clusters'}</h4>
|
|
712
|
+
<div class="clusters-list">
|
|
713
|
+
${relatedClusters.map(cluster => `
|
|
714
|
+
<div class="relation-cluster-item">
|
|
715
|
+
<div class="relation-cluster-header">
|
|
716
|
+
<i data-lucide="folder"></i>
|
|
717
|
+
<span class="cluster-name">${escapeHtml(cluster.name)}</span>
|
|
718
|
+
<span class="badge badge-${cluster.status}">${cluster.status}</span>
|
|
719
|
+
</div>
|
|
720
|
+
${cluster.relations && cluster.relations.length > 0 ? `
|
|
721
|
+
<div class="cluster-relations-list">
|
|
722
|
+
<span class="relations-label">${t('coreMemory.relatedClusters')}:</span>
|
|
723
|
+
${cluster.relations.map(rel => `
|
|
724
|
+
<span class="relation-tag">
|
|
725
|
+
<i data-lucide="link"></i>
|
|
726
|
+
${escapeHtml(rel.target_name || rel.target_id)}
|
|
727
|
+
<span class="relation-type">${rel.relation_type}</span>
|
|
728
|
+
</span>
|
|
729
|
+
`).join('')}
|
|
730
|
+
</div>
|
|
731
|
+
` : ''}
|
|
732
|
+
</div>
|
|
733
|
+
`).join('')}
|
|
734
|
+
</div>
|
|
735
|
+
</div>
|
|
736
|
+
`;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
modal.style.display = 'flex';
|
|
740
|
+
lucide.createIcons();
|
|
741
|
+
} catch (error) {
|
|
742
|
+
console.error('Failed to load relations:', error);
|
|
743
|
+
showNotification(t('coreMemory.relationsError') || 'Failed to load relations', 'error');
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
async function toggleFavorite(memoryId) {
|
|
748
|
+
try {
|
|
749
|
+
const memory = await fetchMemoryById(memoryId);
|
|
750
|
+
if (!memory) return;
|
|
751
|
+
|
|
752
|
+
const metadata = memory.metadata || {};
|
|
753
|
+
metadata.favorite = !metadata.favorite;
|
|
754
|
+
|
|
755
|
+
const response = await fetch('/api/core-memory/memories', {
|
|
756
|
+
method: 'POST',
|
|
757
|
+
headers: { 'Content-Type': 'application/json' },
|
|
758
|
+
body: JSON.stringify({ ...memory, metadata, path: projectPath })
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
762
|
+
|
|
763
|
+
showNotification(
|
|
764
|
+
metadata.favorite
|
|
765
|
+
? (t('coreMemory.addedToFavorites') || 'Added to favorites')
|
|
766
|
+
: (t('coreMemory.removedFromFavorites') || 'Removed from favorites'),
|
|
767
|
+
'success'
|
|
768
|
+
);
|
|
769
|
+
|
|
770
|
+
// Refresh current view
|
|
771
|
+
await refreshCoreMemories();
|
|
772
|
+
|
|
773
|
+
// Also refresh favorites if visible
|
|
774
|
+
const favoritesGrid = document.getElementById('favoritesGrid');
|
|
775
|
+
if (favoritesGrid && favoritesGrid.style.display !== 'none') {
|
|
776
|
+
await refreshFavorites();
|
|
777
|
+
}
|
|
778
|
+
} catch (error) {
|
|
779
|
+
console.error('Failed to toggle favorite:', error);
|
|
780
|
+
showNotification(t('coreMemory.favoriteError') || 'Failed to update favorite', 'error');
|
|
781
|
+
}
|
|
782
|
+
}
|