claude-code-workflow 6.2.2 → 6.2.3
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/ccw/dist/cli.d.ts +2 -0
- package/ccw/dist/cli.d.ts.map +1 -0
- package/ccw/dist/cli.js +219 -0
- package/ccw/dist/cli.js.map +1 -0
- package/ccw/dist/commands/cli.d.ts +32 -0
- package/ccw/dist/commands/cli.d.ts.map +1 -0
- package/ccw/dist/commands/cli.js +619 -0
- package/ccw/dist/commands/cli.js.map +1 -0
- package/ccw/dist/commands/core-memory.d.ts +32 -0
- package/ccw/dist/commands/core-memory.d.ts.map +1 -0
- package/ccw/dist/commands/core-memory.js +640 -0
- package/ccw/dist/commands/core-memory.js.map +1 -0
- package/ccw/dist/commands/hook.d.ts +16 -0
- package/ccw/dist/commands/hook.d.ts.map +1 -0
- package/ccw/dist/commands/hook.js +276 -0
- package/ccw/dist/commands/hook.js.map +1 -0
- package/ccw/dist/commands/install.d.ts +12 -0
- package/ccw/dist/commands/install.d.ts.map +1 -0
- package/ccw/dist/commands/install.js +443 -0
- package/ccw/dist/commands/install.js.map +1 -0
- package/ccw/dist/commands/list.d.ts +5 -0
- package/ccw/dist/commands/list.d.ts.map +1 -0
- package/ccw/dist/commands/list.js +32 -0
- package/ccw/dist/commands/list.js.map +1 -0
- package/ccw/dist/commands/memory.d.ts +57 -0
- package/ccw/dist/commands/memory.d.ts.map +1 -0
- package/ccw/dist/commands/memory.js +890 -0
- package/ccw/dist/commands/memory.js.map +1 -0
- package/ccw/dist/commands/serve.d.ts +12 -0
- package/ccw/dist/commands/serve.d.ts.map +1 -0
- package/ccw/dist/commands/serve.js +63 -0
- package/ccw/dist/commands/serve.js.map +1 -0
- package/ccw/dist/commands/session-path-resolver.d.ts +45 -0
- package/ccw/dist/commands/session-path-resolver.d.ts.map +1 -0
- package/ccw/dist/commands/session-path-resolver.js +302 -0
- package/ccw/dist/commands/session-path-resolver.js.map +1 -0
- package/ccw/dist/commands/session.d.ts +12 -0
- package/ccw/dist/commands/session.d.ts.map +1 -0
- package/ccw/dist/commands/session.js +954 -0
- package/ccw/dist/commands/session.js.map +1 -0
- package/ccw/dist/commands/stop.d.ts +11 -0
- package/ccw/dist/commands/stop.d.ts.map +1 -0
- package/ccw/dist/commands/stop.js +96 -0
- package/ccw/dist/commands/stop.js.map +1 -0
- package/ccw/dist/commands/tool.d.ts +29 -0
- package/ccw/dist/commands/tool.d.ts.map +1 -0
- package/ccw/dist/commands/tool.js +173 -0
- package/ccw/dist/commands/tool.js.map +1 -0
- package/ccw/dist/commands/uninstall.d.ts +9 -0
- package/ccw/dist/commands/uninstall.d.ts.map +1 -0
- package/ccw/dist/commands/uninstall.js +239 -0
- package/ccw/dist/commands/uninstall.js.map +1 -0
- package/ccw/dist/commands/upgrade.d.ts +10 -0
- package/ccw/dist/commands/upgrade.d.ts.map +1 -0
- package/ccw/dist/commands/upgrade.js +288 -0
- package/ccw/dist/commands/upgrade.js.map +1 -0
- package/ccw/dist/commands/view.d.ts +14 -0
- package/ccw/dist/commands/view.d.ts.map +1 -0
- package/ccw/dist/commands/view.js +100 -0
- package/ccw/dist/commands/view.js.map +1 -0
- package/ccw/dist/config/storage-paths.d.ts +184 -0
- package/ccw/dist/config/storage-paths.d.ts.map +1 -0
- package/ccw/dist/config/storage-paths.js +536 -0
- package/ccw/dist/config/storage-paths.js.map +1 -0
- package/ccw/dist/core/cache-manager.d.ts +80 -0
- package/ccw/dist/core/cache-manager.d.ts.map +1 -0
- package/ccw/dist/core/cache-manager.js +260 -0
- package/ccw/dist/core/cache-manager.js.map +1 -0
- package/ccw/dist/core/claude-freshness.d.ts +53 -0
- package/ccw/dist/core/claude-freshness.d.ts.map +1 -0
- package/ccw/dist/core/claude-freshness.js +232 -0
- package/ccw/dist/core/claude-freshness.js.map +1 -0
- package/ccw/dist/core/core-memory-store.d.ts +320 -0
- package/ccw/dist/core/core-memory-store.d.ts.map +1 -0
- package/ccw/dist/core/core-memory-store.js +1177 -0
- package/ccw/dist/core/core-memory-store.js.map +1 -0
- package/ccw/dist/core/dashboard-generator-patch.d.ts +2 -0
- package/ccw/dist/core/dashboard-generator-patch.d.ts.map +1 -0
- package/ccw/dist/core/dashboard-generator-patch.js +48 -0
- package/ccw/dist/core/dashboard-generator-patch.js.map +1 -0
- package/ccw/dist/core/dashboard-generator.d.ts +8 -0
- package/ccw/dist/core/dashboard-generator.d.ts.map +1 -0
- package/ccw/dist/core/dashboard-generator.js +695 -0
- package/ccw/dist/core/dashboard-generator.js.map +1 -0
- package/ccw/dist/core/data-aggregator.d.ts +145 -0
- package/ccw/dist/core/data-aggregator.d.ts.map +1 -0
- package/ccw/dist/core/data-aggregator.js +416 -0
- package/ccw/dist/core/data-aggregator.js.map +1 -0
- package/ccw/dist/core/history-importer.d.ts +102 -0
- package/ccw/dist/core/history-importer.d.ts.map +1 -0
- package/ccw/dist/core/history-importer.js +493 -0
- package/ccw/dist/core/history-importer.js.map +1 -0
- package/ccw/dist/core/lite-scanner-complete.d.ts +81 -0
- package/ccw/dist/core/lite-scanner-complete.d.ts.map +1 -0
- package/ccw/dist/core/lite-scanner-complete.js +368 -0
- package/ccw/dist/core/lite-scanner-complete.js.map +1 -0
- package/ccw/dist/core/lite-scanner.d.ts +81 -0
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -0
- package/ccw/dist/core/lite-scanner.js +368 -0
- package/ccw/dist/core/lite-scanner.js.map +1 -0
- package/ccw/dist/core/manifest.d.ts +88 -0
- package/ccw/dist/core/manifest.d.ts.map +1 -0
- package/ccw/dist/core/manifest.js +214 -0
- package/ccw/dist/core/manifest.js.map +1 -0
- package/ccw/dist/core/memory-embedder-bridge.d.ts +83 -0
- package/ccw/dist/core/memory-embedder-bridge.d.ts.map +1 -0
- package/ccw/dist/core/memory-embedder-bridge.js +181 -0
- package/ccw/dist/core/memory-embedder-bridge.js.map +1 -0
- package/ccw/dist/core/memory-store.d.ts +249 -0
- package/ccw/dist/core/memory-store.d.ts.map +1 -0
- package/ccw/dist/core/memory-store.js +781 -0
- package/ccw/dist/core/memory-store.js.map +1 -0
- package/ccw/dist/core/routes/ccw-routes.d.ts +20 -0
- package/ccw/dist/core/routes/ccw-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/ccw-routes.js +70 -0
- package/ccw/dist/core/routes/ccw-routes.js.map +1 -0
- package/ccw/dist/core/routes/claude-routes.d.ts +19 -0
- package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/claude-routes.js +1017 -0
- package/ccw/dist/core/routes/claude-routes.js.map +1 -0
- package/ccw/dist/core/routes/cli-routes.d.ts +20 -0
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/cli-routes.js +468 -0
- package/ccw/dist/core/routes/cli-routes.js.map +1 -0
- package/ccw/dist/core/routes/codexlens-routes.d.ts +20 -0
- package/ccw/dist/core/routes/codexlens-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/codexlens-routes.js +754 -0
- package/ccw/dist/core/routes/codexlens-routes.js.map +1 -0
- package/ccw/dist/core/routes/core-memory-routes.d.ts +21 -0
- package/ccw/dist/core/routes/core-memory-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/core-memory-routes.js +520 -0
- package/ccw/dist/core/routes/core-memory-routes.js.map +1 -0
- package/ccw/dist/core/routes/files-routes.d.ts +20 -0
- package/ccw/dist/core/routes/files-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/files-routes.js +374 -0
- package/ccw/dist/core/routes/files-routes.js.map +1 -0
- package/ccw/dist/core/routes/graph-routes.d.ts +20 -0
- package/ccw/dist/core/routes/graph-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/graph-routes.js +517 -0
- package/ccw/dist/core/routes/graph-routes.js.map +1 -0
- package/ccw/dist/core/routes/help-routes.d.ts +20 -0
- package/ccw/dist/core/routes/help-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/help-routes.js +250 -0
- package/ccw/dist/core/routes/help-routes.js.map +1 -0
- package/ccw/dist/core/routes/hooks-routes.d.ts +21 -0
- package/ccw/dist/core/routes/hooks-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/hooks-routes.js +346 -0
- package/ccw/dist/core/routes/hooks-routes.js.map +1 -0
- package/ccw/dist/core/routes/mcp-routes.d.ts +20 -0
- package/ccw/dist/core/routes/mcp-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/mcp-routes.js +1129 -0
- package/ccw/dist/core/routes/mcp-routes.js.map +1 -0
- package/ccw/dist/core/routes/mcp-templates-db.d.ts +54 -0
- package/ccw/dist/core/routes/mcp-templates-db.d.ts.map +1 -0
- package/ccw/dist/core/routes/mcp-templates-db.js +226 -0
- package/ccw/dist/core/routes/mcp-templates-db.js.map +1 -0
- package/ccw/dist/core/routes/memory-routes.d.ts +21 -0
- package/ccw/dist/core/routes/memory-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/memory-routes.js +1095 -0
- package/ccw/dist/core/routes/memory-routes.js.map +1 -0
- package/ccw/dist/core/routes/rules-routes.d.ts +20 -0
- package/ccw/dist/core/routes/rules-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/rules-routes.js +442 -0
- package/ccw/dist/core/routes/rules-routes.js.map +1 -0
- package/ccw/dist/core/routes/session-routes.d.ts +20 -0
- package/ccw/dist/core/routes/session-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/session-routes.js +423 -0
- package/ccw/dist/core/routes/session-routes.js.map +1 -0
- package/ccw/dist/core/routes/skills-routes.d.ts +20 -0
- package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/skills-routes.js +533 -0
- package/ccw/dist/core/routes/skills-routes.js.map +1 -0
- package/ccw/dist/core/routes/status-routes.d.ts +20 -0
- package/ccw/dist/core/routes/status-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/status-routes.js +38 -0
- package/ccw/dist/core/routes/status-routes.js.map +1 -0
- package/ccw/dist/core/routes/system-routes.d.ts +22 -0
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/system-routes.js +354 -0
- package/ccw/dist/core/routes/system-routes.js.map +1 -0
- package/ccw/dist/core/server.d.ts +17 -0
- package/ccw/dist/core/server.d.ts.map +1 -0
- package/ccw/dist/core/server.js +386 -0
- package/ccw/dist/core/server.js.map +1 -0
- package/ccw/dist/core/session-clustering-service.d.ts +153 -0
- package/ccw/dist/core/session-clustering-service.d.ts.map +1 -0
- package/ccw/dist/core/session-clustering-service.js +1065 -0
- package/ccw/dist/core/session-clustering-service.js.map +1 -0
- package/ccw/dist/core/session-scanner.d.ts +32 -0
- package/ccw/dist/core/session-scanner.d.ts.map +1 -0
- package/ccw/dist/core/session-scanner.js +253 -0
- package/ccw/dist/core/session-scanner.js.map +1 -0
- package/ccw/dist/core/websocket.d.ts +23 -0
- package/ccw/dist/core/websocket.d.ts.map +1 -0
- package/ccw/dist/core/websocket.js +168 -0
- package/ccw/dist/core/websocket.js.map +1 -0
- package/ccw/dist/index.d.ts +10 -0
- package/ccw/dist/index.d.ts.map +1 -0
- package/ccw/dist/index.js +10 -0
- package/ccw/dist/index.js.map +1 -0
- package/ccw/dist/mcp-server/index.d.ts +7 -0
- package/ccw/dist/mcp-server/index.d.ts.map +1 -0
- package/ccw/dist/mcp-server/index.js +157 -0
- package/ccw/dist/mcp-server/index.js.map +1 -0
- package/ccw/dist/tools/classify-folders.d.ts +26 -0
- package/ccw/dist/tools/classify-folders.d.ts.map +1 -0
- package/ccw/dist/tools/classify-folders.js +201 -0
- package/ccw/dist/tools/classify-folders.js.map +1 -0
- package/ccw/dist/tools/cli-config-manager.d.ts +62 -0
- package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -0
- package/ccw/dist/tools/cli-config-manager.js +221 -0
- package/ccw/dist/tools/cli-config-manager.js.map +1 -0
- package/ccw/dist/tools/cli-executor.d.ts +373 -0
- package/ccw/dist/tools/cli-executor.d.ts.map +1 -0
- package/ccw/dist/tools/cli-executor.js +1625 -0
- package/ccw/dist/tools/cli-executor.js.map +1 -0
- package/ccw/dist/tools/cli-history-store.d.ts +330 -0
- package/ccw/dist/tools/cli-history-store.d.ts.map +1 -0
- package/ccw/dist/tools/cli-history-store.js +916 -0
- package/ccw/dist/tools/cli-history-store.js.map +1 -0
- package/ccw/dist/tools/codex-lens.d.ts +118 -0
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -0
- package/ccw/dist/tools/codex-lens.js +962 -0
- package/ccw/dist/tools/codex-lens.js.map +1 -0
- package/ccw/dist/tools/convert-tokens-to-css.d.ts +14 -0
- package/ccw/dist/tools/convert-tokens-to-css.d.ts.map +1 -0
- package/ccw/dist/tools/convert-tokens-to-css.js +244 -0
- package/ccw/dist/tools/convert-tokens-to-css.js.map +1 -0
- package/ccw/dist/tools/core-memory.d.ts +66 -0
- package/ccw/dist/tools/core-memory.d.ts.map +1 -0
- package/ccw/dist/tools/core-memory.js +324 -0
- package/ccw/dist/tools/core-memory.js.map +1 -0
- package/ccw/dist/tools/detect-changed-modules.d.ts +24 -0
- package/ccw/dist/tools/detect-changed-modules.d.ts.map +1 -0
- package/ccw/dist/tools/detect-changed-modules.js +277 -0
- package/ccw/dist/tools/detect-changed-modules.js.map +1 -0
- package/ccw/dist/tools/discover-design-files.d.ts +36 -0
- package/ccw/dist/tools/discover-design-files.d.ts.map +1 -0
- package/ccw/dist/tools/discover-design-files.js +147 -0
- package/ccw/dist/tools/discover-design-files.js.map +1 -0
- package/ccw/dist/tools/edit-file.d.ts +28 -0
- package/ccw/dist/tools/edit-file.d.ts.map +1 -0
- package/ccw/dist/tools/edit-file.js +479 -0
- package/ccw/dist/tools/edit-file.js.map +1 -0
- package/ccw/dist/tools/generate-module-docs.d.ts +22 -0
- package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -0
- package/ccw/dist/tools/generate-module-docs.js +379 -0
- package/ccw/dist/tools/generate-module-docs.js.map +1 -0
- package/ccw/dist/tools/get-modules-by-depth.d.ts +15 -0
- package/ccw/dist/tools/get-modules-by-depth.d.ts.map +1 -0
- package/ccw/dist/tools/get-modules-by-depth.js +296 -0
- package/ccw/dist/tools/get-modules-by-depth.js.map +1 -0
- package/ccw/dist/tools/index.d.ts +55 -0
- package/ccw/dist/tools/index.d.ts.map +1 -0
- package/ccw/dist/tools/index.js +304 -0
- package/ccw/dist/tools/index.js.map +1 -0
- package/ccw/dist/tools/native-session-discovery.d.ts +97 -0
- package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -0
- package/ccw/dist/tools/native-session-discovery.js +700 -0
- package/ccw/dist/tools/native-session-discovery.js.map +1 -0
- package/ccw/dist/tools/notifier.d.ts +50 -0
- package/ccw/dist/tools/notifier.d.ts.map +1 -0
- package/ccw/dist/tools/notifier.js +90 -0
- package/ccw/dist/tools/notifier.js.map +1 -0
- package/ccw/dist/tools/read-file.d.ts +32 -0
- package/ccw/dist/tools/read-file.d.ts.map +1 -0
- package/ccw/dist/tools/read-file.js +329 -0
- package/ccw/dist/tools/read-file.js.map +1 -0
- package/ccw/dist/tools/resume-strategy.d.ts +48 -0
- package/ccw/dist/tools/resume-strategy.d.ts.map +1 -0
- package/ccw/dist/tools/resume-strategy.js +248 -0
- package/ccw/dist/tools/resume-strategy.js.map +1 -0
- package/ccw/dist/tools/session-content-parser.d.ts +58 -0
- package/ccw/dist/tools/session-content-parser.d.ts.map +1 -0
- package/ccw/dist/tools/session-content-parser.js +420 -0
- package/ccw/dist/tools/session-content-parser.js.map +1 -0
- package/ccw/dist/tools/session-manager.d.ts +9 -0
- package/ccw/dist/tools/session-manager.d.ts.map +1 -0
- package/ccw/dist/tools/session-manager.js +834 -0
- package/ccw/dist/tools/session-manager.js.map +1 -0
- package/ccw/dist/tools/smart-context.d.ts +35 -0
- package/ccw/dist/tools/smart-context.d.ts.map +1 -0
- package/ccw/dist/tools/smart-context.js +182 -0
- package/ccw/dist/tools/smart-context.js.map +1 -0
- package/ccw/dist/tools/smart-search.d.ts +105 -0
- package/ccw/dist/tools/smart-search.d.ts.map +1 -0
- package/ccw/dist/tools/smart-search.js +1753 -0
- package/ccw/dist/tools/smart-search.js.map +1 -0
- package/ccw/dist/tools/storage-manager.d.ts +114 -0
- package/ccw/dist/tools/storage-manager.d.ts.map +1 -0
- package/ccw/dist/tools/storage-manager.js +392 -0
- package/ccw/dist/tools/storage-manager.js.map +1 -0
- package/ccw/dist/tools/ui-generate-preview.d.ts +39 -0
- package/ccw/dist/tools/ui-generate-preview.d.ts.map +1 -0
- package/ccw/dist/tools/ui-generate-preview.js +300 -0
- package/ccw/dist/tools/ui-generate-preview.js.map +1 -0
- package/ccw/dist/tools/ui-instantiate-prototypes.d.ts +75 -0
- package/ccw/dist/tools/ui-instantiate-prototypes.d.ts.map +1 -0
- package/ccw/dist/tools/ui-instantiate-prototypes.js +256 -0
- package/ccw/dist/tools/ui-instantiate-prototypes.js.map +1 -0
- package/ccw/dist/tools/update-module-claude.d.ts +80 -0
- package/ccw/dist/tools/update-module-claude.d.ts.map +1 -0
- package/ccw/dist/tools/update-module-claude.js +351 -0
- package/ccw/dist/tools/update-module-claude.js.map +1 -0
- package/ccw/dist/tools/write-file.d.ts +19 -0
- package/ccw/dist/tools/write-file.d.ts.map +1 -0
- package/ccw/dist/tools/write-file.js +193 -0
- package/ccw/dist/tools/write-file.js.map +1 -0
- package/ccw/dist/types/config.d.ts +11 -0
- package/ccw/dist/types/config.d.ts.map +1 -0
- package/ccw/dist/types/config.js +2 -0
- package/ccw/dist/types/config.js.map +1 -0
- package/ccw/dist/types/index.d.ts +4 -0
- package/ccw/dist/types/index.d.ts.map +1 -0
- package/ccw/dist/types/index.js +4 -0
- package/ccw/dist/types/index.js.map +1 -0
- package/ccw/dist/types/session.d.ts +20 -0
- package/ccw/dist/types/session.d.ts.map +1 -0
- package/ccw/dist/types/session.js +2 -0
- package/ccw/dist/types/session.js.map +1 -0
- package/ccw/dist/types/tool.d.ts +36 -0
- package/ccw/dist/types/tool.d.ts.map +1 -0
- package/ccw/dist/types/tool.js +11 -0
- package/ccw/dist/types/tool.js.map +1 -0
- package/ccw/dist/utils/browser-launcher.d.ts +13 -0
- package/ccw/dist/utils/browser-launcher.d.ts.map +1 -0
- package/ccw/dist/utils/browser-launcher.js +60 -0
- package/ccw/dist/utils/browser-launcher.js.map +1 -0
- package/ccw/dist/utils/file-utils.d.ts +25 -0
- package/ccw/dist/utils/file-utils.d.ts.map +1 -0
- package/ccw/dist/utils/file-utils.js +48 -0
- package/ccw/dist/utils/file-utils.js.map +1 -0
- package/ccw/dist/utils/path-resolver.d.ts +80 -0
- package/ccw/dist/utils/path-resolver.d.ts.map +1 -0
- package/ccw/dist/utils/path-resolver.js +260 -0
- package/ccw/dist/utils/path-resolver.js.map +1 -0
- package/ccw/dist/utils/path-validator.d.ts +49 -0
- package/ccw/dist/utils/path-validator.d.ts.map +1 -0
- package/ccw/dist/utils/path-validator.js +123 -0
- package/ccw/dist/utils/path-validator.js.map +1 -0
- package/ccw/dist/utils/ui.d.ts +62 -0
- package/ccw/dist/utils/ui.d.ts.map +1 -0
- package/ccw/dist/utils/ui.js +129 -0
- package/ccw/dist/utils/ui.js.map +1 -0
- package/ccw/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Memory Command - Simplified CLI for core memory management
|
|
3
|
+
* Commands: list, import, export, summary, projects, cluster
|
|
4
|
+
*/
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { getCoreMemoryStore, listAllProjects, getMemoriesFromProject, importMemories } from '../core/core-memory-store.js';
|
|
7
|
+
import { notifyRefreshRequired } from '../tools/notifier.js';
|
|
8
|
+
/**
|
|
9
|
+
* Get project path from current working directory
|
|
10
|
+
*/
|
|
11
|
+
function getProjectPath() {
|
|
12
|
+
return process.cwd();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* List all memories
|
|
16
|
+
*/
|
|
17
|
+
async function listAction() {
|
|
18
|
+
try {
|
|
19
|
+
const store = getCoreMemoryStore(getProjectPath());
|
|
20
|
+
const memories = store.getMemories({ limit: 100 });
|
|
21
|
+
console.log(chalk.bold.cyan('\n Core Memories\n'));
|
|
22
|
+
if (memories.length === 0) {
|
|
23
|
+
console.log(chalk.yellow(' No memories found\n'));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
27
|
+
for (const memory of memories) {
|
|
28
|
+
const date = new Date(memory.updated_at).toLocaleString();
|
|
29
|
+
const archived = memory.archived ? chalk.gray(' [archived]') : '';
|
|
30
|
+
console.log(chalk.cyan(` ${memory.id}`) + archived);
|
|
31
|
+
console.log(chalk.white(` ${memory.summary || memory.content.substring(0, 80)}${memory.content.length > 80 ? '...' : ''}`));
|
|
32
|
+
console.log(chalk.gray(` Updated: ${date}`));
|
|
33
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
34
|
+
}
|
|
35
|
+
console.log(chalk.gray(`\n Total: ${memories.length}\n`));
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Import text as a new memory
|
|
44
|
+
*/
|
|
45
|
+
async function importAction(text) {
|
|
46
|
+
if (!text || text.trim() === '') {
|
|
47
|
+
console.error(chalk.red('Error: Text content is required'));
|
|
48
|
+
console.error(chalk.gray('Usage: ccw core-memory import "your text content here"'));
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const store = getCoreMemoryStore(getProjectPath());
|
|
53
|
+
const memory = store.upsertMemory({
|
|
54
|
+
content: text.trim()
|
|
55
|
+
});
|
|
56
|
+
console.log(chalk.green(`✓ Created memory: ${memory.id}`));
|
|
57
|
+
// Notify dashboard
|
|
58
|
+
notifyRefreshRequired('memory').catch(() => { });
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Export a memory as plain text (searches all projects if not found locally)
|
|
67
|
+
*/
|
|
68
|
+
async function exportAction(options) {
|
|
69
|
+
const { id } = options;
|
|
70
|
+
if (!id) {
|
|
71
|
+
console.error(chalk.red('Error: --id is required'));
|
|
72
|
+
console.error(chalk.gray('Usage: ccw core-memory export --id <id>'));
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
// First try current project
|
|
77
|
+
const store = getCoreMemoryStore(getProjectPath());
|
|
78
|
+
let memory = store.getMemory(id);
|
|
79
|
+
// If not found, search all projects
|
|
80
|
+
if (!memory) {
|
|
81
|
+
const projects = listAllProjects();
|
|
82
|
+
for (const project of projects) {
|
|
83
|
+
try {
|
|
84
|
+
const memories = getMemoriesFromProject(project.id);
|
|
85
|
+
const found = memories.find(m => m.id === id);
|
|
86
|
+
if (found) {
|
|
87
|
+
memory = found;
|
|
88
|
+
console.error(chalk.gray(`Found in project: ${project.id}`));
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Skip projects that can't be read
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!memory) {
|
|
98
|
+
console.error(chalk.red(`Error: Memory "${id}" not found in any project`));
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
// Output plain text content
|
|
102
|
+
console.log(memory.content);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* List all projects with their memory counts
|
|
111
|
+
*/
|
|
112
|
+
async function projectsAction(options) {
|
|
113
|
+
try {
|
|
114
|
+
const projects = listAllProjects();
|
|
115
|
+
if (options.json) {
|
|
116
|
+
console.log(JSON.stringify(projects, null, 2));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
console.log(chalk.bold.cyan('\n All CCW Projects\n'));
|
|
120
|
+
if (projects.length === 0) {
|
|
121
|
+
console.log(chalk.yellow(' No projects found\n'));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
125
|
+
for (const project of projects) {
|
|
126
|
+
const hasData = project.memoriesCount > 0 || project.clustersCount > 0;
|
|
127
|
+
const icon = hasData ? '●' : '○';
|
|
128
|
+
const color = hasData ? chalk.cyan : chalk.gray;
|
|
129
|
+
console.log(color(` ${icon} ${project.id}`));
|
|
130
|
+
console.log(chalk.white(` Path: ${project.path}`));
|
|
131
|
+
console.log(chalk.white(` Memories: ${project.memoriesCount} | Clusters: ${project.clustersCount}`));
|
|
132
|
+
if (project.lastUpdated) {
|
|
133
|
+
console.log(chalk.gray(` Last updated: ${new Date(project.lastUpdated).toLocaleString()}`));
|
|
134
|
+
}
|
|
135
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
136
|
+
}
|
|
137
|
+
console.log(chalk.gray(`\n Total: ${projects.length} projects\n`));
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Import memories from file or another project
|
|
146
|
+
*/
|
|
147
|
+
async function importFromAction(source, options) {
|
|
148
|
+
if (!source) {
|
|
149
|
+
console.error(chalk.red('Error: Source is required'));
|
|
150
|
+
console.error(chalk.gray('Usage: ccw core-memory import-from <source>'));
|
|
151
|
+
console.error(chalk.gray(' source: file.json or project-id'));
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const result = importMemories(getProjectPath(), source, {
|
|
156
|
+
overwrite: options.overwrite,
|
|
157
|
+
prefix: options.prefix
|
|
158
|
+
});
|
|
159
|
+
console.log(chalk.green(`✓ Import complete`));
|
|
160
|
+
console.log(chalk.white(` Imported: ${result.imported}`));
|
|
161
|
+
console.log(chalk.white(` Skipped: ${result.skipped} (already exist)`));
|
|
162
|
+
if (result.imported > 0) {
|
|
163
|
+
notifyRefreshRequired('memory').catch(() => { });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* List memories from another project
|
|
173
|
+
*/
|
|
174
|
+
async function listFromAction(projectId, options) {
|
|
175
|
+
if (!projectId) {
|
|
176
|
+
console.error(chalk.red('Error: Project ID is required'));
|
|
177
|
+
console.error(chalk.gray('Usage: ccw core-memory list-from <project-id>'));
|
|
178
|
+
console.error(chalk.gray(' Use "ccw core-memory projects" to see available projects'));
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
const memories = getMemoriesFromProject(projectId);
|
|
183
|
+
if (options.json) {
|
|
184
|
+
console.log(JSON.stringify(memories, null, 2));
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
console.log(chalk.bold.cyan(`\n Memories from ${projectId}\n`));
|
|
188
|
+
if (memories.length === 0) {
|
|
189
|
+
console.log(chalk.yellow(' No memories found\n'));
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
193
|
+
for (const memory of memories) {
|
|
194
|
+
const date = new Date(memory.updated_at).toLocaleString();
|
|
195
|
+
const archived = memory.archived ? chalk.gray(' [archived]') : '';
|
|
196
|
+
console.log(chalk.cyan(` ${memory.id}`) + archived);
|
|
197
|
+
console.log(chalk.white(` ${memory.summary || memory.content.substring(0, 80)}${memory.content.length > 80 ? '...' : ''}`));
|
|
198
|
+
console.log(chalk.gray(` Updated: ${date}`));
|
|
199
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
200
|
+
}
|
|
201
|
+
console.log(chalk.gray(`\n Total: ${memories.length}\n`));
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Generate summary for a memory
|
|
210
|
+
*/
|
|
211
|
+
async function summaryAction(options) {
|
|
212
|
+
const { id, tool = 'gemini' } = options;
|
|
213
|
+
if (!id) {
|
|
214
|
+
console.error(chalk.red('Error: --id is required'));
|
|
215
|
+
console.error(chalk.gray('Usage: ccw core-memory summary --id <id> [--tool gemini|qwen]'));
|
|
216
|
+
process.exit(1);
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
const store = getCoreMemoryStore(getProjectPath());
|
|
220
|
+
const memory = store.getMemory(id);
|
|
221
|
+
if (!memory) {
|
|
222
|
+
console.error(chalk.red(`Error: Memory "${id}" not found`));
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
console.log(chalk.cyan(`Generating summary using ${tool}...`));
|
|
226
|
+
const summary = await store.generateSummary(id, tool);
|
|
227
|
+
console.log(chalk.green('\n✓ Summary generated:\n'));
|
|
228
|
+
console.log(chalk.white(` ${summary}\n`));
|
|
229
|
+
// Notify dashboard
|
|
230
|
+
notifyRefreshRequired('memory').catch(() => { });
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* List all clusters
|
|
239
|
+
*/
|
|
240
|
+
async function clustersAction(options) {
|
|
241
|
+
try {
|
|
242
|
+
const store = getCoreMemoryStore(getProjectPath());
|
|
243
|
+
const clusters = store.listClusters(options.status);
|
|
244
|
+
if (options.json) {
|
|
245
|
+
console.log(JSON.stringify(clusters, null, 2));
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (clusters.length === 0) {
|
|
249
|
+
console.log(chalk.yellow('\n No clusters found. Run "ccw core-memory cluster --auto" to create clusters.\n'));
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
console.log(chalk.bold.cyan('\n 📦 Session Clusters\n'));
|
|
253
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
254
|
+
for (const cluster of clusters) {
|
|
255
|
+
const members = store.getClusterMembers(cluster.id);
|
|
256
|
+
console.log(chalk.cyan(` ● ${cluster.name}`) + chalk.gray(` (${cluster.id})`));
|
|
257
|
+
console.log(chalk.white(` Status: ${cluster.status} | Sessions: ${members.length}`));
|
|
258
|
+
console.log(chalk.gray(` Updated: ${cluster.updated_at}`));
|
|
259
|
+
if (cluster.intent)
|
|
260
|
+
console.log(chalk.white(` Intent: ${cluster.intent}`));
|
|
261
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
262
|
+
}
|
|
263
|
+
console.log(chalk.gray(`\n Total: ${clusters.length}\n`));
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
267
|
+
process.exit(1);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* View cluster details or create new cluster
|
|
272
|
+
*/
|
|
273
|
+
async function clusterAction(clusterId, options) {
|
|
274
|
+
try {
|
|
275
|
+
const store = getCoreMemoryStore(getProjectPath());
|
|
276
|
+
// Auto clustering
|
|
277
|
+
if (options.auto) {
|
|
278
|
+
const { SessionClusteringService } = await import('../core/session-clustering-service.js');
|
|
279
|
+
const service = new SessionClusteringService(getProjectPath());
|
|
280
|
+
console.log(chalk.cyan('🔄 Running auto-clustering...'));
|
|
281
|
+
const scope = options.scope === 'all' || options.scope === 'recent' || options.scope === 'unclustered'
|
|
282
|
+
? options.scope
|
|
283
|
+
: 'recent';
|
|
284
|
+
const result = await service.autocluster({ scope });
|
|
285
|
+
console.log(chalk.green(`✓ Created ${result.clustersCreated} clusters`));
|
|
286
|
+
console.log(chalk.white(` Processed ${result.sessionsProcessed} sessions`));
|
|
287
|
+
console.log(chalk.white(` Clustered ${result.sessionsClustered} sessions`));
|
|
288
|
+
// Notify dashboard
|
|
289
|
+
notifyRefreshRequired('memory').catch(() => { });
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
// Deduplicate clusters
|
|
293
|
+
if (options.dedup) {
|
|
294
|
+
const { SessionClusteringService } = await import('../core/session-clustering-service.js');
|
|
295
|
+
const service = new SessionClusteringService(getProjectPath());
|
|
296
|
+
console.log(chalk.cyan('🔄 Deduplicating clusters...'));
|
|
297
|
+
const result = await service.deduplicateClusters();
|
|
298
|
+
console.log(chalk.green(`✓ Deduplication complete`));
|
|
299
|
+
console.log(chalk.white(` Merged: ${result.merged} clusters`));
|
|
300
|
+
console.log(chalk.white(` Deleted: ${result.deleted} empty clusters`));
|
|
301
|
+
console.log(chalk.white(` Remaining: ${result.remaining} clusters`));
|
|
302
|
+
// Notify dashboard
|
|
303
|
+
notifyRefreshRequired('memory').catch(() => { });
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
// Delete cluster
|
|
307
|
+
if (options.delete && clusterId) {
|
|
308
|
+
const cluster = store.getCluster(clusterId);
|
|
309
|
+
if (!cluster) {
|
|
310
|
+
console.error(chalk.red(`Cluster not found: ${clusterId}`));
|
|
311
|
+
process.exit(1);
|
|
312
|
+
}
|
|
313
|
+
const deleted = store.deleteCluster(clusterId);
|
|
314
|
+
if (deleted) {
|
|
315
|
+
console.log(chalk.green(`✓ Deleted cluster: ${clusterId}`));
|
|
316
|
+
notifyRefreshRequired('memory').catch(() => { });
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
console.error(chalk.red(`Failed to delete cluster: ${clusterId}`));
|
|
320
|
+
process.exit(1);
|
|
321
|
+
}
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
// Merge clusters
|
|
325
|
+
if (options.merge && clusterId) {
|
|
326
|
+
const targetCluster = store.getCluster(clusterId);
|
|
327
|
+
if (!targetCluster) {
|
|
328
|
+
console.error(chalk.red(`Target cluster not found: ${clusterId}`));
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
const sourceIds = options.merge.split(',').map(s => s.trim());
|
|
332
|
+
console.log(chalk.cyan(`🔄 Merging ${sourceIds.length} clusters into ${clusterId}...`));
|
|
333
|
+
try {
|
|
334
|
+
const membersMoved = store.mergeClusters(clusterId, sourceIds);
|
|
335
|
+
console.log(chalk.green(`✓ Merged successfully`));
|
|
336
|
+
console.log(chalk.white(` Members moved: ${membersMoved}`));
|
|
337
|
+
console.log(chalk.white(` Clusters deleted: ${sourceIds.length}`));
|
|
338
|
+
notifyRefreshRequired('memory').catch(() => { });
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
console.error(chalk.red(`Failed to merge: ${error.message}`));
|
|
342
|
+
process.exit(1);
|
|
343
|
+
}
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
// Create new cluster
|
|
347
|
+
if (options.create) {
|
|
348
|
+
if (!options.name) {
|
|
349
|
+
console.error(chalk.red('Error: --name is required for --create'));
|
|
350
|
+
process.exit(1);
|
|
351
|
+
}
|
|
352
|
+
const cluster = store.createCluster({ name: options.name });
|
|
353
|
+
console.log(chalk.green(`✓ Created cluster: ${cluster.id}`));
|
|
354
|
+
// Add members if specified
|
|
355
|
+
if (options.members) {
|
|
356
|
+
const memberIds = options.members.split(',').map(s => s.trim());
|
|
357
|
+
for (const memberId of memberIds) {
|
|
358
|
+
// Detect session type from ID
|
|
359
|
+
let sessionType = 'core_memory';
|
|
360
|
+
if (memberId.startsWith('WFS-'))
|
|
361
|
+
sessionType = 'workflow';
|
|
362
|
+
else if (memberId.includes('-gemini') || memberId.includes('-qwen') || memberId.includes('-codex')) {
|
|
363
|
+
sessionType = 'cli_history';
|
|
364
|
+
}
|
|
365
|
+
store.addClusterMember({
|
|
366
|
+
cluster_id: cluster.id,
|
|
367
|
+
session_id: memberId,
|
|
368
|
+
session_type: sessionType,
|
|
369
|
+
sequence_order: memberIds.indexOf(memberId) + 1,
|
|
370
|
+
relevance_score: 1.0
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
console.log(chalk.white(` Added ${memberIds.length} members`));
|
|
374
|
+
}
|
|
375
|
+
// Notify dashboard
|
|
376
|
+
notifyRefreshRequired('memory').catch(() => { });
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
// View cluster details
|
|
380
|
+
if (clusterId) {
|
|
381
|
+
const cluster = store.getCluster(clusterId);
|
|
382
|
+
if (!cluster) {
|
|
383
|
+
console.error(chalk.red(`Cluster not found: ${clusterId}`));
|
|
384
|
+
process.exit(1);
|
|
385
|
+
}
|
|
386
|
+
const members = store.getClusterMembers(clusterId);
|
|
387
|
+
const relations = store.getClusterRelations(clusterId);
|
|
388
|
+
console.log(chalk.bold.cyan(`\n 📦 Cluster: ${cluster.name}\n`));
|
|
389
|
+
console.log(chalk.white(` ID: ${cluster.id}`));
|
|
390
|
+
console.log(chalk.white(` Status: ${cluster.status}`));
|
|
391
|
+
if (cluster.description)
|
|
392
|
+
console.log(chalk.white(` Description: ${cluster.description}`));
|
|
393
|
+
if (cluster.intent)
|
|
394
|
+
console.log(chalk.white(` Intent: ${cluster.intent}`));
|
|
395
|
+
if (members.length > 0) {
|
|
396
|
+
console.log(chalk.bold.white('\n 📋 Sessions:'));
|
|
397
|
+
for (const member of members) {
|
|
398
|
+
const meta = store.getSessionMetadata(member.session_id);
|
|
399
|
+
console.log(chalk.cyan(` ${member.sequence_order}. ${member.session_id}`) + chalk.gray(` (${member.session_type})`));
|
|
400
|
+
if (meta?.title)
|
|
401
|
+
console.log(chalk.white(` ${meta.title}`));
|
|
402
|
+
if (meta?.token_estimate)
|
|
403
|
+
console.log(chalk.gray(` ~${meta.token_estimate} tokens`));
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (relations.length > 0) {
|
|
407
|
+
console.log(chalk.bold.white('\n 🔗 Relations:'));
|
|
408
|
+
for (const rel of relations) {
|
|
409
|
+
console.log(chalk.white(` → ${rel.relation_type} ${rel.target_cluster_id}`));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
console.log();
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
// No action specified - show usage
|
|
416
|
+
console.log(chalk.yellow('Usage: ccw core-memory cluster <id> or --auto or --create --name <name>'));
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
420
|
+
process.exit(1);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Get progressive disclosure context
|
|
425
|
+
*/
|
|
426
|
+
async function contextAction(options) {
|
|
427
|
+
try {
|
|
428
|
+
const { SessionClusteringService } = await import('../core/session-clustering-service.js');
|
|
429
|
+
const service = new SessionClusteringService(getProjectPath());
|
|
430
|
+
// Default to session-start for CLI usage
|
|
431
|
+
const index = await service.getProgressiveIndex({
|
|
432
|
+
type: 'session-start'
|
|
433
|
+
});
|
|
434
|
+
if (options.format === 'json') {
|
|
435
|
+
console.log(JSON.stringify({ index }, null, 2));
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
console.log(index);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
443
|
+
process.exit(1);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Load cluster context
|
|
448
|
+
*/
|
|
449
|
+
async function loadClusterAction(clusterId, options) {
|
|
450
|
+
if (!clusterId) {
|
|
451
|
+
console.error(chalk.red('Error: Cluster ID is required'));
|
|
452
|
+
console.error(chalk.gray('Usage: ccw core-memory load-cluster <id> [--level metadata|keyFiles|full]'));
|
|
453
|
+
process.exit(1);
|
|
454
|
+
}
|
|
455
|
+
try {
|
|
456
|
+
const store = getCoreMemoryStore(getProjectPath());
|
|
457
|
+
const cluster = store.getCluster(clusterId);
|
|
458
|
+
if (!cluster) {
|
|
459
|
+
console.error(chalk.red(`Cluster not found: ${clusterId}`));
|
|
460
|
+
process.exit(1);
|
|
461
|
+
}
|
|
462
|
+
const members = store.getClusterMembers(clusterId);
|
|
463
|
+
const level = options.level || 'metadata';
|
|
464
|
+
console.log(chalk.bold.cyan(`\n# Cluster: ${cluster.name}\n`));
|
|
465
|
+
if (cluster.intent)
|
|
466
|
+
console.log(chalk.white(`Intent: ${cluster.intent}\n`));
|
|
467
|
+
console.log(chalk.bold.white('## Sessions\n'));
|
|
468
|
+
for (const member of members) {
|
|
469
|
+
const meta = store.getSessionMetadata(member.session_id);
|
|
470
|
+
console.log(chalk.bold.cyan(`### ${member.sequence_order}. ${member.session_id}`));
|
|
471
|
+
console.log(chalk.white(`Type: ${member.session_type}`));
|
|
472
|
+
if (meta) {
|
|
473
|
+
if (meta.title)
|
|
474
|
+
console.log(chalk.white(`Title: ${meta.title}`));
|
|
475
|
+
if (level === 'metadata') {
|
|
476
|
+
if (meta.summary)
|
|
477
|
+
console.log(chalk.white(`Summary: ${meta.summary}`));
|
|
478
|
+
}
|
|
479
|
+
else if (level === 'keyFiles' || level === 'full') {
|
|
480
|
+
if (meta.summary)
|
|
481
|
+
console.log(chalk.white(`Summary: ${meta.summary}`));
|
|
482
|
+
if (meta.file_patterns) {
|
|
483
|
+
const patterns = JSON.parse(meta.file_patterns);
|
|
484
|
+
console.log(chalk.white(`Files: ${patterns.join(', ')}`));
|
|
485
|
+
}
|
|
486
|
+
if (meta.keywords) {
|
|
487
|
+
const keywords = JSON.parse(meta.keywords);
|
|
488
|
+
console.log(chalk.white(`Keywords: ${keywords.join(', ')}`));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (level === 'full') {
|
|
492
|
+
// Load full content based on session type
|
|
493
|
+
if (member.session_type === 'core_memory') {
|
|
494
|
+
const memory = store.getMemory(member.session_id);
|
|
495
|
+
if (memory) {
|
|
496
|
+
console.log(chalk.white('\nContent:'));
|
|
497
|
+
console.log(chalk.gray(memory.content));
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
console.log();
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
catch (error) {
|
|
506
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
507
|
+
process.exit(1);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Search sessions by keyword
|
|
512
|
+
*/
|
|
513
|
+
async function searchAction(keyword, options) {
|
|
514
|
+
if (!keyword || keyword.trim() === '') {
|
|
515
|
+
console.error(chalk.red('Error: Keyword is required'));
|
|
516
|
+
console.error(chalk.gray('Usage: ccw core-memory search <keyword> [--type core|workflow|cli|all]'));
|
|
517
|
+
process.exit(1);
|
|
518
|
+
}
|
|
519
|
+
try {
|
|
520
|
+
const store = getCoreMemoryStore(getProjectPath());
|
|
521
|
+
const results = store.searchSessionsByKeyword(keyword);
|
|
522
|
+
if (results.length === 0) {
|
|
523
|
+
console.log(chalk.yellow(`\n No sessions found for: "${keyword}"\n`));
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
// Filter by type if specified
|
|
527
|
+
let filtered = results;
|
|
528
|
+
if (options.type && options.type !== 'all') {
|
|
529
|
+
const typeMap = {
|
|
530
|
+
core: 'core_memory',
|
|
531
|
+
workflow: 'workflow',
|
|
532
|
+
cli: 'cli_history'
|
|
533
|
+
};
|
|
534
|
+
filtered = results.filter(r => r.session_type === typeMap[options.type]);
|
|
535
|
+
}
|
|
536
|
+
console.log(chalk.bold.cyan(`\n 🔍 Found ${filtered.length} sessions for "${keyword}"\n`));
|
|
537
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
538
|
+
for (const result of filtered) {
|
|
539
|
+
console.log(chalk.cyan(` ● ${result.session_id}`) + chalk.gray(` (${result.session_type})`));
|
|
540
|
+
if (result.title)
|
|
541
|
+
console.log(chalk.white(` ${result.title}`));
|
|
542
|
+
if (result.token_estimate)
|
|
543
|
+
console.log(chalk.gray(` ~${result.token_estimate} tokens`));
|
|
544
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────────────────────────'));
|
|
545
|
+
}
|
|
546
|
+
console.log();
|
|
547
|
+
}
|
|
548
|
+
catch (error) {
|
|
549
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
550
|
+
process.exit(1);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Core Memory command entry point
|
|
555
|
+
*/
|
|
556
|
+
export async function coreMemoryCommand(subcommand, args, options) {
|
|
557
|
+
const argsArray = Array.isArray(args) ? args : (args ? [args] : []);
|
|
558
|
+
const textArg = argsArray.join(' ');
|
|
559
|
+
switch (subcommand) {
|
|
560
|
+
case 'list':
|
|
561
|
+
await listAction();
|
|
562
|
+
break;
|
|
563
|
+
case 'import':
|
|
564
|
+
await importAction(textArg);
|
|
565
|
+
break;
|
|
566
|
+
case 'export':
|
|
567
|
+
await exportAction(options);
|
|
568
|
+
break;
|
|
569
|
+
case 'summary':
|
|
570
|
+
await summaryAction(options);
|
|
571
|
+
break;
|
|
572
|
+
case 'clusters':
|
|
573
|
+
await clustersAction(options);
|
|
574
|
+
break;
|
|
575
|
+
case 'cluster':
|
|
576
|
+
await clusterAction(argsArray[0], options);
|
|
577
|
+
break;
|
|
578
|
+
case 'context':
|
|
579
|
+
await contextAction(options);
|
|
580
|
+
break;
|
|
581
|
+
case 'load-cluster':
|
|
582
|
+
await loadClusterAction(textArg, options);
|
|
583
|
+
break;
|
|
584
|
+
case 'search':
|
|
585
|
+
await searchAction(textArg, options);
|
|
586
|
+
break;
|
|
587
|
+
case 'projects':
|
|
588
|
+
await projectsAction(options);
|
|
589
|
+
break;
|
|
590
|
+
case 'import-from':
|
|
591
|
+
await importFromAction(textArg, options);
|
|
592
|
+
break;
|
|
593
|
+
case 'list-from':
|
|
594
|
+
await listFromAction(textArg, options);
|
|
595
|
+
break;
|
|
596
|
+
default:
|
|
597
|
+
console.log(chalk.bold.cyan('\n CCW Core Memory\n'));
|
|
598
|
+
console.log(' Manage core memory entries and session clusters.\n');
|
|
599
|
+
console.log(chalk.bold(' Basic Commands:'));
|
|
600
|
+
console.log(chalk.white(' list ') + chalk.gray('List all memories'));
|
|
601
|
+
console.log(chalk.white(' import "<text>" ') + chalk.gray('Import text as new memory'));
|
|
602
|
+
console.log(chalk.white(' export --id <id> ') + chalk.gray('Export memory (searches all projects)'));
|
|
603
|
+
console.log(chalk.white(' summary --id <id> ') + chalk.gray('Generate AI summary'));
|
|
604
|
+
console.log();
|
|
605
|
+
console.log(chalk.bold(' Cross-Workspace Commands:'));
|
|
606
|
+
console.log(chalk.white(' projects ') + chalk.gray('List all CCW projects'));
|
|
607
|
+
console.log(chalk.white(' list-from <project-id> ') + chalk.gray('List memories from another project'));
|
|
608
|
+
console.log();
|
|
609
|
+
console.log(chalk.bold(' Clustering Commands:'));
|
|
610
|
+
console.log(chalk.white(' clusters [--status] ') + chalk.gray('List all clusters'));
|
|
611
|
+
console.log(chalk.white(' cluster [id] ') + chalk.gray('View cluster details'));
|
|
612
|
+
console.log(chalk.white(' cluster --auto ') + chalk.gray('Run auto-clustering'));
|
|
613
|
+
console.log(chalk.white(' cluster --dedup ') + chalk.gray('Deduplicate similar clusters'));
|
|
614
|
+
console.log(chalk.white(' cluster <id> --delete ') + chalk.gray('Delete a cluster'));
|
|
615
|
+
console.log(chalk.white(' cluster <id> --merge <ids> ') + chalk.gray('Merge clusters into target'));
|
|
616
|
+
console.log(chalk.white(' cluster --create --name ') + chalk.gray('Create new cluster'));
|
|
617
|
+
console.log(chalk.white(' context ') + chalk.gray('Get progressive index'));
|
|
618
|
+
console.log(chalk.white(' load-cluster <id> ') + chalk.gray('Load cluster context'));
|
|
619
|
+
console.log(chalk.white(' search <keyword> ') + chalk.gray('Search sessions'));
|
|
620
|
+
console.log();
|
|
621
|
+
console.log(chalk.bold(' Options:'));
|
|
622
|
+
console.log(chalk.gray(' --id <id> Memory ID (for export/summary)'));
|
|
623
|
+
console.log(chalk.gray(' --tool gemini|qwen AI tool for summary (default: gemini)'));
|
|
624
|
+
console.log(chalk.gray(' --json Output as JSON'));
|
|
625
|
+
console.log(chalk.gray(' --scope <scope> Auto-cluster scope (all/recent/unclustered)'));
|
|
626
|
+
console.log(chalk.gray(' --dedup Deduplicate similar clusters'));
|
|
627
|
+
console.log(chalk.gray(' --delete Delete a cluster'));
|
|
628
|
+
console.log(chalk.gray(' --merge <ids> Merge source clusters into target'));
|
|
629
|
+
console.log();
|
|
630
|
+
console.log(chalk.bold(' Examples:'));
|
|
631
|
+
console.log(chalk.gray(' ccw core-memory list'));
|
|
632
|
+
console.log(chalk.gray(' ccw core-memory export --id CMEM-xxx # Searches all projects'));
|
|
633
|
+
console.log(chalk.gray(' ccw core-memory projects # List all projects'));
|
|
634
|
+
console.log(chalk.gray(' ccw core-memory list-from d--other-project'));
|
|
635
|
+
console.log(chalk.gray(' ccw core-memory cluster --auto'));
|
|
636
|
+
console.log(chalk.gray(' ccw core-memory cluster --dedup'));
|
|
637
|
+
console.log();
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
//# sourceMappingURL=core-memory.js.map
|