claude-code-workflow 6.1.4 → 6.2.1
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/README.md +145 -274
- package/bin/ccw-mcp.js +7 -0
- package/bin/ccw.js +10 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +219 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/cli.d.ts +32 -0
- package/dist/commands/cli.d.ts.map +1 -0
- package/dist/commands/cli.js +619 -0
- package/dist/commands/cli.js.map +1 -0
- package/dist/commands/core-memory.d.ts +32 -0
- package/dist/commands/core-memory.d.ts.map +1 -0
- package/dist/commands/core-memory.js +640 -0
- package/dist/commands/core-memory.js.map +1 -0
- package/dist/commands/hook.d.ts +16 -0
- package/dist/commands/hook.d.ts.map +1 -0
- package/dist/commands/hook.js +276 -0
- package/dist/commands/hook.js.map +1 -0
- package/dist/commands/install.d.ts +12 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +443 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/list.d.ts +5 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +32 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/memory.d.ts +57 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +890 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/serve.d.ts +12 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +63 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/session-path-resolver.d.ts +45 -0
- package/dist/commands/session-path-resolver.d.ts.map +1 -0
- package/dist/commands/session-path-resolver.js +302 -0
- package/dist/commands/session-path-resolver.js.map +1 -0
- package/dist/commands/session.d.ts +12 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +954 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/stop.d.ts +11 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +96 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/commands/tool.d.ts +29 -0
- package/dist/commands/tool.d.ts.map +1 -0
- package/dist/commands/tool.js +173 -0
- package/dist/commands/tool.js.map +1 -0
- package/dist/commands/uninstall.d.ts +9 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +239 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/upgrade.d.ts +10 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +288 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/view.d.ts +14 -0
- package/dist/commands/view.d.ts.map +1 -0
- package/dist/commands/view.js +100 -0
- package/dist/commands/view.js.map +1 -0
- package/dist/config/storage-paths.d.ts +184 -0
- package/dist/config/storage-paths.d.ts.map +1 -0
- package/dist/config/storage-paths.js +536 -0
- package/dist/config/storage-paths.js.map +1 -0
- package/dist/core/cache-manager.d.ts +80 -0
- package/dist/core/cache-manager.d.ts.map +1 -0
- package/dist/core/cache-manager.js +260 -0
- package/dist/core/cache-manager.js.map +1 -0
- package/dist/core/claude-freshness.d.ts +53 -0
- package/dist/core/claude-freshness.d.ts.map +1 -0
- package/dist/core/claude-freshness.js +232 -0
- package/dist/core/claude-freshness.js.map +1 -0
- package/dist/core/core-memory-store.d.ts +320 -0
- package/dist/core/core-memory-store.d.ts.map +1 -0
- package/dist/core/core-memory-store.js +1177 -0
- package/dist/core/core-memory-store.js.map +1 -0
- package/dist/core/dashboard-generator-patch.d.ts +2 -0
- package/dist/core/dashboard-generator-patch.d.ts.map +1 -0
- package/dist/core/dashboard-generator-patch.js +48 -0
- package/dist/core/dashboard-generator-patch.js.map +1 -0
- package/dist/core/dashboard-generator.d.ts +8 -0
- package/dist/core/dashboard-generator.d.ts.map +1 -0
- package/dist/core/dashboard-generator.js +695 -0
- package/dist/core/dashboard-generator.js.map +1 -0
- package/dist/core/data-aggregator.d.ts +145 -0
- package/dist/core/data-aggregator.d.ts.map +1 -0
- package/dist/core/data-aggregator.js +416 -0
- package/dist/core/data-aggregator.js.map +1 -0
- package/dist/core/history-importer.d.ts +102 -0
- package/dist/core/history-importer.d.ts.map +1 -0
- package/dist/core/history-importer.js +493 -0
- package/dist/core/history-importer.js.map +1 -0
- package/dist/core/lite-scanner-complete.d.ts +81 -0
- package/dist/core/lite-scanner-complete.d.ts.map +1 -0
- package/dist/core/lite-scanner-complete.js +368 -0
- package/dist/core/lite-scanner-complete.js.map +1 -0
- package/dist/core/lite-scanner.d.ts +81 -0
- package/dist/core/lite-scanner.d.ts.map +1 -0
- package/dist/core/lite-scanner.js +368 -0
- package/dist/core/lite-scanner.js.map +1 -0
- package/dist/core/manifest.d.ts +88 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/core/manifest.js +214 -0
- package/dist/core/manifest.js.map +1 -0
- package/dist/core/memory-embedder-bridge.d.ts +83 -0
- package/dist/core/memory-embedder-bridge.d.ts.map +1 -0
- package/dist/core/memory-embedder-bridge.js +181 -0
- package/dist/core/memory-embedder-bridge.js.map +1 -0
- package/dist/core/memory-store.d.ts +249 -0
- package/dist/core/memory-store.d.ts.map +1 -0
- package/dist/core/memory-store.js +781 -0
- package/dist/core/memory-store.js.map +1 -0
- package/dist/core/routes/ccw-routes.d.ts +20 -0
- package/dist/core/routes/ccw-routes.d.ts.map +1 -0
- package/dist/core/routes/ccw-routes.js +70 -0
- package/dist/core/routes/ccw-routes.js.map +1 -0
- package/dist/core/routes/claude-routes.d.ts +19 -0
- package/dist/core/routes/claude-routes.d.ts.map +1 -0
- package/dist/core/routes/claude-routes.js +1017 -0
- package/dist/core/routes/claude-routes.js.map +1 -0
- package/dist/core/routes/cli-routes.d.ts +20 -0
- package/dist/core/routes/cli-routes.d.ts.map +1 -0
- package/dist/core/routes/cli-routes.js +468 -0
- package/dist/core/routes/cli-routes.js.map +1 -0
- package/dist/core/routes/codexlens-routes.d.ts +20 -0
- package/dist/core/routes/codexlens-routes.d.ts.map +1 -0
- package/dist/core/routes/codexlens-routes.js +754 -0
- package/dist/core/routes/codexlens-routes.js.map +1 -0
- package/dist/core/routes/core-memory-routes.d.ts +21 -0
- package/dist/core/routes/core-memory-routes.d.ts.map +1 -0
- package/dist/core/routes/core-memory-routes.js +520 -0
- package/dist/core/routes/core-memory-routes.js.map +1 -0
- package/dist/core/routes/files-routes.d.ts +20 -0
- package/dist/core/routes/files-routes.d.ts.map +1 -0
- package/dist/core/routes/files-routes.js +374 -0
- package/dist/core/routes/files-routes.js.map +1 -0
- package/dist/core/routes/graph-routes.d.ts +20 -0
- package/dist/core/routes/graph-routes.d.ts.map +1 -0
- package/dist/core/routes/graph-routes.js +517 -0
- package/dist/core/routes/graph-routes.js.map +1 -0
- package/dist/core/routes/help-routes.d.ts +20 -0
- package/dist/core/routes/help-routes.d.ts.map +1 -0
- package/dist/core/routes/help-routes.js +250 -0
- package/dist/core/routes/help-routes.js.map +1 -0
- package/dist/core/routes/hooks-routes.d.ts +21 -0
- package/dist/core/routes/hooks-routes.d.ts.map +1 -0
- package/dist/core/routes/hooks-routes.js +346 -0
- package/dist/core/routes/hooks-routes.js.map +1 -0
- package/dist/core/routes/mcp-routes.d.ts +20 -0
- package/dist/core/routes/mcp-routes.d.ts.map +1 -0
- package/dist/core/routes/mcp-routes.js +1129 -0
- package/dist/core/routes/mcp-routes.js.map +1 -0
- package/dist/core/routes/mcp-templates-db.d.ts +54 -0
- package/dist/core/routes/mcp-templates-db.d.ts.map +1 -0
- package/dist/core/routes/mcp-templates-db.js +226 -0
- package/dist/core/routes/mcp-templates-db.js.map +1 -0
- package/dist/core/routes/memory-routes.d.ts +21 -0
- package/dist/core/routes/memory-routes.d.ts.map +1 -0
- package/dist/core/routes/memory-routes.js +1095 -0
- package/dist/core/routes/memory-routes.js.map +1 -0
- package/dist/core/routes/rules-routes.d.ts +20 -0
- package/dist/core/routes/rules-routes.d.ts.map +1 -0
- package/dist/core/routes/rules-routes.js +442 -0
- package/dist/core/routes/rules-routes.js.map +1 -0
- package/dist/core/routes/session-routes.d.ts +20 -0
- package/dist/core/routes/session-routes.d.ts.map +1 -0
- package/dist/core/routes/session-routes.js +423 -0
- package/dist/core/routes/session-routes.js.map +1 -0
- package/dist/core/routes/skills-routes.d.ts +20 -0
- package/dist/core/routes/skills-routes.d.ts.map +1 -0
- package/dist/core/routes/skills-routes.js +533 -0
- package/dist/core/routes/skills-routes.js.map +1 -0
- package/dist/core/routes/status-routes.d.ts +20 -0
- package/dist/core/routes/status-routes.d.ts.map +1 -0
- package/dist/core/routes/status-routes.js +38 -0
- package/dist/core/routes/status-routes.js.map +1 -0
- package/dist/core/routes/system-routes.d.ts +22 -0
- package/dist/core/routes/system-routes.d.ts.map +1 -0
- package/dist/core/routes/system-routes.js +354 -0
- package/dist/core/routes/system-routes.js.map +1 -0
- package/dist/core/server.d.ts +17 -0
- package/dist/core/server.d.ts.map +1 -0
- package/dist/core/server.js +386 -0
- package/dist/core/server.js.map +1 -0
- package/dist/core/session-clustering-service.d.ts +153 -0
- package/dist/core/session-clustering-service.d.ts.map +1 -0
- package/dist/core/session-clustering-service.js +1065 -0
- package/dist/core/session-clustering-service.js.map +1 -0
- package/dist/core/session-scanner.d.ts +32 -0
- package/dist/core/session-scanner.d.ts.map +1 -0
- package/dist/core/session-scanner.js +253 -0
- package/dist/core/session-scanner.js.map +1 -0
- package/dist/core/websocket.d.ts +23 -0
- package/dist/core/websocket.d.ts.map +1 -0
- package/dist/core/websocket.js +168 -0
- package/dist/core/websocket.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/index.d.ts +7 -0
- package/dist/mcp-server/index.d.ts.map +1 -0
- package/dist/mcp-server/index.js +157 -0
- package/dist/mcp-server/index.js.map +1 -0
- package/dist/tools/classify-folders.d.ts +26 -0
- package/dist/tools/classify-folders.d.ts.map +1 -0
- package/dist/tools/classify-folders.js +201 -0
- package/dist/tools/classify-folders.js.map +1 -0
- package/dist/tools/cli-config-manager.d.ts +62 -0
- package/dist/tools/cli-config-manager.d.ts.map +1 -0
- package/dist/tools/cli-config-manager.js +221 -0
- package/dist/tools/cli-config-manager.js.map +1 -0
- package/dist/tools/cli-executor.d.ts +373 -0
- package/dist/tools/cli-executor.d.ts.map +1 -0
- package/dist/tools/cli-executor.js +1625 -0
- package/dist/tools/cli-executor.js.map +1 -0
- package/dist/tools/cli-history-store.d.ts +330 -0
- package/dist/tools/cli-history-store.d.ts.map +1 -0
- package/dist/tools/cli-history-store.js +916 -0
- package/dist/tools/cli-history-store.js.map +1 -0
- package/dist/tools/codex-lens.d.ts +118 -0
- package/dist/tools/codex-lens.d.ts.map +1 -0
- package/dist/tools/codex-lens.js +962 -0
- package/dist/tools/codex-lens.js.map +1 -0
- package/dist/tools/convert-tokens-to-css.d.ts +14 -0
- package/dist/tools/convert-tokens-to-css.d.ts.map +1 -0
- package/dist/tools/convert-tokens-to-css.js +244 -0
- package/dist/tools/convert-tokens-to-css.js.map +1 -0
- package/dist/tools/core-memory.d.ts +66 -0
- package/dist/tools/core-memory.d.ts.map +1 -0
- package/dist/tools/core-memory.js +324 -0
- package/dist/tools/core-memory.js.map +1 -0
- package/dist/tools/detect-changed-modules.d.ts +24 -0
- package/dist/tools/detect-changed-modules.d.ts.map +1 -0
- package/dist/tools/detect-changed-modules.js +277 -0
- package/dist/tools/detect-changed-modules.js.map +1 -0
- package/dist/tools/discover-design-files.d.ts +36 -0
- package/dist/tools/discover-design-files.d.ts.map +1 -0
- package/dist/tools/discover-design-files.js +147 -0
- package/dist/tools/discover-design-files.js.map +1 -0
- package/dist/tools/edit-file.d.ts +28 -0
- package/dist/tools/edit-file.d.ts.map +1 -0
- package/dist/tools/edit-file.js +479 -0
- package/dist/tools/edit-file.js.map +1 -0
- package/dist/tools/generate-module-docs.d.ts +22 -0
- package/dist/tools/generate-module-docs.d.ts.map +1 -0
- package/dist/tools/generate-module-docs.js +379 -0
- package/dist/tools/generate-module-docs.js.map +1 -0
- package/dist/tools/get-modules-by-depth.d.ts +15 -0
- package/dist/tools/get-modules-by-depth.d.ts.map +1 -0
- package/dist/tools/get-modules-by-depth.js +296 -0
- package/dist/tools/get-modules-by-depth.js.map +1 -0
- package/dist/tools/index.d.ts +55 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +304 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/native-session-discovery.d.ts +97 -0
- package/dist/tools/native-session-discovery.d.ts.map +1 -0
- package/dist/tools/native-session-discovery.js +700 -0
- package/dist/tools/native-session-discovery.js.map +1 -0
- package/dist/tools/notifier.d.ts +50 -0
- package/dist/tools/notifier.d.ts.map +1 -0
- package/dist/tools/notifier.js +90 -0
- package/dist/tools/notifier.js.map +1 -0
- package/dist/tools/read-file.d.ts +32 -0
- package/dist/tools/read-file.d.ts.map +1 -0
- package/dist/tools/read-file.js +329 -0
- package/dist/tools/read-file.js.map +1 -0
- package/dist/tools/resume-strategy.d.ts +48 -0
- package/dist/tools/resume-strategy.d.ts.map +1 -0
- package/dist/tools/resume-strategy.js +248 -0
- package/dist/tools/resume-strategy.js.map +1 -0
- package/dist/tools/session-content-parser.d.ts +58 -0
- package/dist/tools/session-content-parser.d.ts.map +1 -0
- package/dist/tools/session-content-parser.js +420 -0
- package/dist/tools/session-content-parser.js.map +1 -0
- package/dist/tools/session-manager.d.ts +9 -0
- package/dist/tools/session-manager.d.ts.map +1 -0
- package/dist/tools/session-manager.js +834 -0
- package/dist/tools/session-manager.js.map +1 -0
- package/dist/tools/smart-context.d.ts +35 -0
- package/dist/tools/smart-context.d.ts.map +1 -0
- package/dist/tools/smart-context.js +182 -0
- package/dist/tools/smart-context.js.map +1 -0
- package/dist/tools/smart-search.d.ts +105 -0
- package/dist/tools/smart-search.d.ts.map +1 -0
- package/dist/tools/smart-search.js +1753 -0
- package/dist/tools/smart-search.js.map +1 -0
- package/dist/tools/storage-manager.d.ts +114 -0
- package/dist/tools/storage-manager.d.ts.map +1 -0
- package/dist/tools/storage-manager.js +392 -0
- package/dist/tools/storage-manager.js.map +1 -0
- package/dist/tools/ui-generate-preview.d.ts +39 -0
- package/dist/tools/ui-generate-preview.d.ts.map +1 -0
- package/dist/tools/ui-generate-preview.js +300 -0
- package/dist/tools/ui-generate-preview.js.map +1 -0
- package/dist/tools/ui-instantiate-prototypes.d.ts +75 -0
- package/dist/tools/ui-instantiate-prototypes.d.ts.map +1 -0
- package/dist/tools/ui-instantiate-prototypes.js +256 -0
- package/dist/tools/ui-instantiate-prototypes.js.map +1 -0
- package/dist/tools/update-module-claude.d.ts +80 -0
- package/dist/tools/update-module-claude.d.ts.map +1 -0
- package/dist/tools/update-module-claude.js +351 -0
- package/dist/tools/update-module-claude.js.map +1 -0
- package/dist/tools/write-file.d.ts +19 -0
- package/dist/tools/write-file.d.ts.map +1 -0
- package/dist/tools/write-file.js +193 -0
- package/dist/tools/write-file.js.map +1 -0
- package/dist/types/config.d.ts +11 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/session.d.ts +20 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +2 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/tool.d.ts +36 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/tool.js +11 -0
- package/dist/types/tool.js.map +1 -0
- package/dist/utils/browser-launcher.d.ts +13 -0
- package/dist/utils/browser-launcher.d.ts.map +1 -0
- package/dist/utils/browser-launcher.js +60 -0
- package/dist/utils/browser-launcher.js.map +1 -0
- package/dist/utils/file-utils.d.ts +25 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +48 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/path-resolver.d.ts +80 -0
- package/dist/utils/path-resolver.d.ts.map +1 -0
- package/dist/utils/path-resolver.js +260 -0
- package/dist/utils/path-resolver.js.map +1 -0
- package/dist/utils/path-validator.d.ts +49 -0
- package/dist/utils/path-validator.d.ts.map +1 -0
- package/dist/utils/path-validator.js +123 -0
- package/dist/utils/path-validator.js.map +1 -0
- package/dist/utils/ui.d.ts +62 -0
- package/dist/utils/ui.d.ts.map +1 -0
- package/dist/utils/ui.js +129 -0
- package/dist/utils/ui.js.map +1 -0
- package/package.json +32 -34
- package/src/.workflow/.cli-history/history.db +0 -0
- package/src/.workflow/.cli-history/history.db-shm +0 -0
- package/src/.workflow/.cli-history/history.db-wal +0 -0
- package/src/cli.ts +244 -0
- package/src/commands/cli.ts +740 -0
- package/src/commands/core-memory.ts +770 -0
- package/src/commands/hook.ts +315 -0
- package/src/commands/install.ts +519 -0
- package/src/commands/list.ts +37 -0
- package/src/commands/memory.ts +1090 -0
- package/src/commands/serve.ts +76 -0
- package/src/commands/session-path-resolver.ts +372 -0
- package/src/commands/session.ts +1141 -0
- package/src/commands/stop.ts +111 -0
- package/src/commands/tool.ts +201 -0
- package/src/commands/uninstall.ts +287 -0
- package/src/commands/upgrade.ts +352 -0
- package/src/commands/view.ts +119 -0
- package/src/config/storage-paths.ts +670 -0
- package/src/core/cache-manager.ts +294 -0
- package/src/core/claude-freshness.ts +319 -0
- package/src/core/core-memory-store.ts +1528 -0
- package/src/core/dashboard-generator-patch.ts +47 -0
- package/src/core/dashboard-generator.ts +739 -0
- package/src/core/data-aggregator.ts +584 -0
- package/src/core/history-importer.ts +625 -0
- package/src/core/lite-scanner-complete.ts +469 -0
- package/src/core/lite-scanner.ts +469 -0
- package/src/core/manifest.ts +271 -0
- package/src/core/memory-embedder-bridge.ts +262 -0
- package/src/core/memory-store.ts +978 -0
- package/src/core/routes/ccw-routes.ts +96 -0
- package/src/core/routes/claude-routes.ts +1183 -0
- package/src/core/routes/cli-routes.ts +561 -0
- package/src/core/routes/codexlens-routes.ts +806 -0
- package/src/core/routes/core-memory-routes.ts +605 -0
- package/src/core/routes/files-routes.ts +428 -0
- package/src/core/routes/graph-routes.md +164 -0
- package/src/core/routes/graph-routes.ts +626 -0
- package/src/core/routes/help-routes.ts +308 -0
- package/src/core/routes/hooks-routes.ts +405 -0
- package/src/core/routes/mcp-routes.ts +1271 -0
- package/src/core/routes/mcp-routes.ts.backup +550 -0
- package/src/core/routes/mcp-templates-db.ts +268 -0
- package/src/core/routes/memory-routes.ts +1206 -0
- package/src/core/routes/rules-routes.ts +526 -0
- package/src/core/routes/session-routes.ts +467 -0
- package/src/core/routes/skills-routes.ts +599 -0
- package/src/core/routes/status-routes.ts +57 -0
- package/src/core/routes/system-routes.ts +427 -0
- package/src/core/server.ts +431 -0
- package/src/core/session-clustering-service.ts +1258 -0
- package/src/core/session-scanner.ts +283 -0
- package/src/core/websocket.ts +190 -0
- package/src/index.ts +10 -0
- package/src/mcp-server/index.ts +186 -0
- package/src/templates/assets/css/github-dark.min.css +10 -0
- package/src/templates/assets/css/github.min.css +10 -0
- package/src/templates/assets/js/cytoscape.min.js +32 -0
- package/src/templates/assets/js/d3.min.js +2 -0
- package/src/templates/assets/js/highlight.min.js +1244 -0
- package/src/templates/assets/js/lucide.min.js +12 -0
- package/src/templates/assets/js/marked.min.js +69 -0
- package/src/templates/assets/js/tailwind.js +83 -0
- package/src/templates/dashboard-css/01-base.css +302 -0
- package/src/templates/dashboard-css/02-session.css +748 -0
- package/src/templates/dashboard-css/04-lite-tasks.css +1181 -0
- package/src/templates/dashboard-css/06-cards.css +1576 -0
- package/src/templates/dashboard-css/07-managers.css +2107 -0
- package/src/templates/dashboard-css/09-explorer.css +1408 -0
- package/src/templates/dashboard-css/10-cli-status.css +337 -0
- package/src/templates/dashboard-css/11-cli-history.css +271 -0
- package/src/templates/dashboard-css/12-cli-legacy.css +796 -0
- package/src/templates/dashboard-css/13-cli-ccw.css +199 -0
- package/src/templates/dashboard-css/14-cli-modals.css +258 -0
- package/src/templates/dashboard-css/15-cli-endpoints.css +305 -0
- package/src/templates/dashboard-css/16-cli-session.css +241 -0
- package/src/templates/dashboard-css/17-cli-conversation.css +283 -0
- package/src/templates/dashboard-css/18-cli-settings.css +160 -0
- package/src/templates/dashboard-css/19-cli-native-session.css +496 -0
- package/src/templates/dashboard-css/20-cli-taskqueue.css +188 -0
- package/src/templates/dashboard-css/21-cli-toolmgmt.css +310 -0
- package/src/templates/dashboard-css/22-cli-semantic.css +240 -0
- package/src/templates/dashboard-css/23-memory.css +2390 -0
- package/src/templates/dashboard-css/24-prompt-history.css +1089 -0
- package/src/templates/dashboard-css/25-skills-rules.css +326 -0
- package/src/templates/dashboard-css/26-claude-manager.css +908 -0
- package/src/templates/dashboard-css/27-graph-explorer.css +1678 -0
- package/src/templates/dashboard-css/28-mcp-manager.css +748 -0
- package/src/templates/dashboard-css/29-help.css +264 -0
- package/src/templates/dashboard-css/30-core-memory.css +1700 -0
- package/src/templates/dashboard-js/api.js +220 -0
- package/src/templates/dashboard-js/components/carousel.js +398 -0
- package/src/templates/dashboard-js/components/cli-history.js +876 -0
- package/src/templates/dashboard-js/components/cli-status.js +978 -0
- package/src/templates/dashboard-js/components/global-notifications.js +508 -0
- package/src/templates/dashboard-js/components/hook-manager.js +1278 -0
- package/src/templates/dashboard-js/components/index-manager.js +302 -0
- package/src/templates/dashboard-js/components/mcp-manager.js +1219 -0
- package/src/templates/dashboard-js/components/modals.js +326 -0
- package/src/templates/dashboard-js/components/navigation.js +313 -0
- package/src/templates/dashboard-js/components/notifications.js +758 -0
- package/src/templates/dashboard-js/components/storage-manager.js +478 -0
- package/src/templates/dashboard-js/components/tabs-other.js +424 -0
- package/src/templates/dashboard-js/components/task-queue-sidebar.js +716 -0
- package/src/templates/dashboard-js/help-i18n.js +272 -0
- package/src/templates/dashboard-js/i18n.js +2807 -0
- package/src/templates/dashboard-js/main.js +87 -0
- package/src/templates/dashboard-js/state.js +243 -0
- package/src/templates/dashboard-js/utils.js +199 -0
- package/src/templates/dashboard-js/views/claude-manager.js +912 -0
- package/src/templates/dashboard-js/views/cli-manager.js +2272 -0
- package/src/templates/dashboard-js/views/codexlens-manager.js +964 -0
- package/src/templates/dashboard-js/views/core-memory-clusters.js +503 -0
- package/src/templates/dashboard-js/views/core-memory.js +782 -0
- package/src/templates/dashboard-js/views/explorer.js +888 -0
- package/src/templates/dashboard-js/views/graph-explorer.js +1157 -0
- package/src/templates/dashboard-js/views/help.js +856 -0
- package/src/templates/dashboard-js/views/history.js +337 -0
- package/src/templates/dashboard-js/views/home.js +243 -0
- package/src/templates/dashboard-js/views/hook-manager.js +660 -0
- package/src/templates/dashboard-js/views/lite-tasks.js +861 -0
- package/src/templates/dashboard-js/views/mcp-manager.js +2187 -0
- package/src/templates/dashboard-js/views/mcp-manager.js.backup +1729 -0
- package/src/templates/dashboard-js/views/mcp-manager.js.new +928 -0
- package/src/templates/dashboard-js/views/memory.js +1221 -0
- package/src/templates/dashboard-js/views/prompt-history.js +713 -0
- package/src/templates/dashboard-js/views/rules-manager.js +828 -0
- package/src/templates/dashboard-js/views/session-detail.js +781 -0
- package/src/templates/dashboard-js/views/skills-manager.js +819 -0
- package/src/templates/dashboard.html +831 -0
- package/src/templates/hooks-config-example.json +60 -0
- package/src/tools/classify-folders.ts +245 -0
- package/src/tools/cli-config-manager.ts +268 -0
- package/src/tools/cli-executor.ts +2014 -0
- package/src/tools/cli-history-store.ts +1195 -0
- package/src/tools/codex-lens.ts +1141 -0
- package/src/tools/convert-tokens-to-css.ts +300 -0
- package/src/tools/core-memory.ts +444 -0
- package/src/tools/detect-changed-modules.ts +325 -0
- package/src/tools/discover-design-files.ts +184 -0
- package/src/tools/edit-file.ts +568 -0
- package/src/tools/generate-module-docs.ts +438 -0
- package/src/tools/get-modules-by-depth.ts +349 -0
- package/src/tools/index.ts +370 -0
- package/src/tools/native-session-discovery.ts +795 -0
- package/src/tools/notifier.ts +129 -0
- package/src/tools/read-file.ts +410 -0
- package/src/tools/resume-strategy.ts +345 -0
- package/src/tools/session-content-parser.ts +619 -0
- package/src/tools/session-manager.ts +1026 -0
- package/src/tools/smart-context.ts +228 -0
- package/src/tools/smart-search.ts +2065 -0
- package/src/tools/smart-search.ts.backup +1233 -0
- package/src/tools/storage-manager.ts +455 -0
- package/src/tools/write-file.ts +222 -0
- package/src/types/config.ts +11 -0
- package/src/types/index.ts +3 -0
- package/src/types/session.ts +25 -0
- package/src/types/tool.ts +41 -0
- package/src/utils/browser-launcher.ts +62 -0
- package/src/utils/file-utils.ts +48 -0
- package/src/utils/path-resolver.ts +315 -0
- package/src/utils/path-validator.ts +153 -0
- package/src/utils/ui.ts +155 -0
- package/.claude/agents/action-planning-agent.md +0 -778
- package/.claude/agents/cli-execution-agent.md +0 -270
- package/.claude/agents/cli-explore-agent.md +0 -182
- package/.claude/agents/cli-lite-planning-agent.md +0 -396
- package/.claude/agents/cli-planning-agent.md +0 -558
- package/.claude/agents/code-developer.md +0 -310
- package/.claude/agents/conceptual-planning-agent.md +0 -308
- package/.claude/agents/context-search-agent.md +0 -582
- package/.claude/agents/doc-generator.md +0 -330
- package/.claude/agents/memory-bridge.md +0 -94
- package/.claude/agents/test-context-search-agent.md +0 -399
- package/.claude/agents/test-fix-agent.md +0 -343
- package/.claude/agents/ui-design-agent.md +0 -593
- package/.claude/agents/universal-executor.md +0 -131
- package/.claude/commands/cli/cli-init.md +0 -440
- package/.claude/commands/enhance-prompt.md +0 -93
- package/.claude/commands/memory/code-map-memory.md +0 -687
- package/.claude/commands/memory/docs-full-cli.md +0 -471
- package/.claude/commands/memory/docs-related-cli.md +0 -386
- package/.claude/commands/memory/docs.md +0 -615
- package/.claude/commands/memory/load-skill-memory.md +0 -182
- package/.claude/commands/memory/load.md +0 -240
- package/.claude/commands/memory/skill-memory.md +0 -525
- package/.claude/commands/memory/style-skill-memory.md +0 -396
- package/.claude/commands/memory/tech-research.md +0 -477
- package/.claude/commands/memory/update-full.md +0 -332
- package/.claude/commands/memory/update-related.md +0 -332
- package/.claude/commands/memory/workflow-skill-memory.md +0 -517
- package/.claude/commands/task/breakdown.md +0 -204
- package/.claude/commands/task/create.md +0 -152
- package/.claude/commands/task/execute.md +0 -270
- package/.claude/commands/task/replan.md +0 -437
- package/.claude/commands/version.md +0 -254
- package/.claude/commands/workflow/action-plan-verify.md +0 -447
- package/.claude/commands/workflow/brainstorm/api-designer.md +0 -585
- package/.claude/commands/workflow/brainstorm/artifacts.md +0 -452
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +0 -443
- package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
- package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
- package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
- package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
- package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
- package/.claude/commands/workflow/brainstorm/synthesis.md +0 -398
- package/.claude/commands/workflow/brainstorm/system-architect.md +0 -387
- package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
- package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
- package/.claude/commands/workflow/execute.md +0 -462
- package/.claude/commands/workflow/init.md +0 -164
- package/.claude/commands/workflow/lite-execute.md +0 -686
- package/.claude/commands/workflow/lite-fix.md +0 -621
- package/.claude/commands/workflow/lite-plan.md +0 -592
- package/.claude/commands/workflow/plan.md +0 -551
- package/.claude/commands/workflow/replan.md +0 -515
- package/.claude/commands/workflow/review-fix.md +0 -606
- package/.claude/commands/workflow/review-module-cycle.md +0 -765
- package/.claude/commands/workflow/review-session-cycle.md +0 -776
- package/.claude/commands/workflow/review.md +0 -291
- package/.claude/commands/workflow/session/complete.md +0 -500
- package/.claude/commands/workflow/session/list.md +0 -96
- package/.claude/commands/workflow/session/resume.md +0 -61
- package/.claude/commands/workflow/session/start.md +0 -200
- package/.claude/commands/workflow/tdd-plan.md +0 -460
- package/.claude/commands/workflow/tdd-verify.md +0 -386
- package/.claude/commands/workflow/test-cycle-execute.md +0 -498
- package/.claude/commands/workflow/test-fix-gen.md +0 -699
- package/.claude/commands/workflow/test-gen.md +0 -529
- package/.claude/commands/workflow/tools/conflict-resolution.md +0 -680
- package/.claude/commands/workflow/tools/context-gather.md +0 -434
- package/.claude/commands/workflow/tools/task-generate-agent.md +0 -291
- package/.claude/commands/workflow/tools/task-generate-tdd.md +0 -518
- package/.claude/commands/workflow/tools/tdd-coverage-analysis.md +0 -309
- package/.claude/commands/workflow/tools/test-concept-enhanced.md +0 -163
- package/.claude/commands/workflow/tools/test-context-gather.md +0 -235
- package/.claude/commands/workflow/tools/test-task-generate.md +0 -256
- package/.claude/commands/workflow/ui-design/animation-extract.md +0 -1150
- package/.claude/commands/workflow/ui-design/codify-style.md +0 -652
- package/.claude/commands/workflow/ui-design/design-sync.md +0 -454
- package/.claude/commands/workflow/ui-design/explore-auto.md +0 -678
- package/.claude/commands/workflow/ui-design/generate.md +0 -504
- package/.claude/commands/workflow/ui-design/imitate-auto.md +0 -745
- package/.claude/commands/workflow/ui-design/import-from-code.md +0 -537
- package/.claude/commands/workflow/ui-design/layout-extract.md +0 -788
- package/.claude/commands/workflow/ui-design/reference-page-generator.md +0 -356
- package/.claude/commands/workflow/ui-design/style-extract.md +0 -773
- 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/skills/command-guide/SKILL.md +0 -388
- package/.claude/skills/command-guide/UPDATE-GUIDELINE.md +0 -592
- package/.claude/skills/command-guide/guides/cli-tools-guide.md +0 -410
- package/.claude/skills/command-guide/guides/examples.md +0 -537
- package/.claude/skills/command-guide/guides/getting-started.md +0 -242
- package/.claude/skills/command-guide/guides/implementation-details.md +0 -1010
- package/.claude/skills/command-guide/guides/index-structure.md +0 -326
- package/.claude/skills/command-guide/guides/troubleshooting.md +0 -92
- package/.claude/skills/command-guide/guides/ui-design-workflow-guide.md +0 -316
- package/.claude/skills/command-guide/guides/workflow-patterns.md +0 -662
- package/.claude/skills/command-guide/index/all-commands.json +0 -772
- package/.claude/skills/command-guide/index/by-category.json +0 -800
- package/.claude/skills/command-guide/index/by-use-case.json +0 -786
- package/.claude/skills/command-guide/index/command-relationships.json +0 -307
- package/.claude/skills/command-guide/index/essential-commands.json +0 -112
- package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +0 -778
- package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +0 -270
- package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +0 -182
- package/.claude/skills/command-guide/reference/agents/cli-lite-planning-agent.md +0 -396
- package/.claude/skills/command-guide/reference/agents/cli-planning-agent.md +0 -558
- package/.claude/skills/command-guide/reference/agents/code-developer.md +0 -310
- package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +0 -308
- package/.claude/skills/command-guide/reference/agents/context-search-agent.md +0 -582
- package/.claude/skills/command-guide/reference/agents/doc-generator.md +0 -330
- package/.claude/skills/command-guide/reference/agents/memory-bridge.md +0 -94
- package/.claude/skills/command-guide/reference/agents/test-context-search-agent.md +0 -399
- package/.claude/skills/command-guide/reference/agents/test-fix-agent.md +0 -343
- package/.claude/skills/command-guide/reference/agents/ui-design-agent.md +0 -593
- package/.claude/skills/command-guide/reference/agents/universal-executor.md +0 -131
- package/.claude/skills/command-guide/reference/commands/cli/cli-init.md +0 -440
- package/.claude/skills/command-guide/reference/commands/enhance-prompt.md +0 -93
- package/.claude/skills/command-guide/reference/commands/memory/code-map-memory.md +0 -687
- package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +0 -471
- package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +0 -386
- package/.claude/skills/command-guide/reference/commands/memory/docs.md +0 -615
- package/.claude/skills/command-guide/reference/commands/memory/load-skill-memory.md +0 -182
- package/.claude/skills/command-guide/reference/commands/memory/load.md +0 -240
- package/.claude/skills/command-guide/reference/commands/memory/skill-memory.md +0 -525
- package/.claude/skills/command-guide/reference/commands/memory/style-skill-memory.md +0 -396
- package/.claude/skills/command-guide/reference/commands/memory/tech-research.md +0 -477
- package/.claude/skills/command-guide/reference/commands/memory/update-full.md +0 -332
- package/.claude/skills/command-guide/reference/commands/memory/update-related.md +0 -332
- package/.claude/skills/command-guide/reference/commands/memory/workflow-skill-memory.md +0 -517
- package/.claude/skills/command-guide/reference/commands/task/breakdown.md +0 -204
- package/.claude/skills/command-guide/reference/commands/task/create.md +0 -152
- package/.claude/skills/command-guide/reference/commands/task/execute.md +0 -270
- package/.claude/skills/command-guide/reference/commands/task/replan.md +0 -437
- package/.claude/skills/command-guide/reference/commands/version.md +0 -254
- package/.claude/skills/command-guide/reference/commands/workflow/action-plan-verify.md +0 -447
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/api-designer.md +0 -585
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/artifacts.md +0 -452
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +0 -443
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/data-architect.md +0 -220
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-manager.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-owner.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/scrum-master.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/synthesis.md +0 -398
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/system-architect.md +0 -387
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ui-designer.md +0 -221
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ux-expert.md +0 -221
- package/.claude/skills/command-guide/reference/commands/workflow/execute.md +0 -460
- package/.claude/skills/command-guide/reference/commands/workflow/init.md +0 -164
- package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +0 -686
- package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +0 -621
- package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +0 -592
- package/.claude/skills/command-guide/reference/commands/workflow/plan.md +0 -551
- package/.claude/skills/command-guide/reference/commands/workflow/replan.md +0 -515
- package/.claude/skills/command-guide/reference/commands/workflow/review-fix.md +0 -606
- package/.claude/skills/command-guide/reference/commands/workflow/review-module-cycle.md +0 -765
- package/.claude/skills/command-guide/reference/commands/workflow/review-session-cycle.md +0 -776
- package/.claude/skills/command-guide/reference/commands/workflow/review.md +0 -291
- package/.claude/skills/command-guide/reference/commands/workflow/session/complete.md +0 -500
- package/.claude/skills/command-guide/reference/commands/workflow/session/list.md +0 -96
- package/.claude/skills/command-guide/reference/commands/workflow/session/resume.md +0 -61
- package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +0 -200
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +0 -460
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-verify.md +0 -386
- package/.claude/skills/command-guide/reference/commands/workflow/test-cycle-execute.md +0 -498
- package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +0 -699
- package/.claude/skills/command-guide/reference/commands/workflow/test-gen.md +0 -529
- package/.claude/skills/command-guide/reference/commands/workflow/tools/conflict-resolution.md +0 -680
- package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +0 -434
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +0 -291
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +0 -518
- package/.claude/skills/command-guide/reference/commands/workflow/tools/tdd-coverage-analysis.md +0 -309
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-concept-enhanced.md +0 -163
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-context-gather.md +0 -235
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +0 -256
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/animation-extract.md +0 -1150
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/codify-style.md +0 -652
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/design-sync.md +0 -454
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/explore-auto.md +0 -678
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/generate.md +0 -504
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/imitate-auto.md +0 -745
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +0 -537
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/layout-extract.md +0 -788
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/reference-page-generator.md +0 -356
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/style-extract.md +0 -773
- package/.claude/skills/command-guide/scripts/analyze_commands.py +0 -502
- package/.claude/skills/command-guide/scripts/update-index.sh +0 -130
- package/.claude/skills/command-guide/templates/issue-bug.md +0 -104
- package/.claude/skills/command-guide/templates/issue-diagnosis.md +0 -275
- package/.claude/skills/command-guide/templates/issue-feature.md +0 -97
- package/.claude/skills/command-guide/templates/issue-question.md +0 -141
- package/.claude/skills/prompt-enhancer/SKILL.md +0 -124
- package/.claude/workflows/_template-compare-matrix.html +0 -692
- package/.claude/workflows/cli-templates/fix-plan-template.json +0 -75
- package/.claude/workflows/cli-templates/fix-progress-template.json +0 -48
- package/.claude/workflows/cli-templates/memory/style-skill-memory/skill-md-template.md +0 -299
- package/.claude/workflows/cli-templates/planning-roles/data-architect.md +0 -120
- package/.claude/workflows/cli-templates/planning-roles/product-manager.md +0 -119
- package/.claude/workflows/cli-templates/planning-roles/product-owner.md +0 -261
- package/.claude/workflows/cli-templates/planning-roles/scrum-master.md +0 -186
- package/.claude/workflows/cli-templates/planning-roles/subject-matter-expert.md +0 -281
- package/.claude/workflows/cli-templates/planning-roles/synthesis-role.md +0 -414
- package/.claude/workflows/cli-templates/planning-roles/system-architect.md +0 -106
- package/.claude/workflows/cli-templates/planning-roles/test-strategist.md +0 -124
- package/.claude/workflows/cli-templates/planning-roles/ui-designer.md +0 -379
- package/.claude/workflows/cli-templates/planning-roles/ux-expert.md +0 -240
- package/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt +0 -127
- package/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt +0 -115
- package/.claude/workflows/cli-templates/prompts/analysis/02-analyze-code-patterns.txt +0 -37
- package/.claude/workflows/cli-templates/prompts/analysis/02-analyze-technical-document.txt +0 -33
- package/.claude/workflows/cli-templates/prompts/analysis/02-review-architecture.txt +0 -29
- package/.claude/workflows/cli-templates/prompts/analysis/02-review-code-quality.txt +0 -28
- package/.claude/workflows/cli-templates/prompts/analysis/03-analyze-performance.txt +0 -29
- package/.claude/workflows/cli-templates/prompts/analysis/03-assess-security-risks.txt +0 -29
- package/.claude/workflows/cli-templates/prompts/analysis/03-review-quality-standards.txt +0 -29
- package/.claude/workflows/cli-templates/prompts/development/02-generate-tests.txt +0 -70
- package/.claude/workflows/cli-templates/prompts/development/02-implement-component-ui.txt +0 -55
- package/.claude/workflows/cli-templates/prompts/development/02-implement-feature.txt +0 -58
- package/.claude/workflows/cli-templates/prompts/development/02-refactor-codebase.txt +0 -55
- package/.claude/workflows/cli-templates/prompts/development/03-debug-runtime-issues.txt +0 -55
- package/.claude/workflows/cli-templates/prompts/documentation/api.txt +0 -15
- package/.claude/workflows/cli-templates/prompts/documentation/folder-navigation.txt +0 -27
- package/.claude/workflows/cli-templates/prompts/documentation/module-readme.txt +0 -49
- package/.claude/workflows/cli-templates/prompts/documentation/project-architecture.txt +0 -41
- package/.claude/workflows/cli-templates/prompts/documentation/project-examples.txt +0 -35
- package/.claude/workflows/cli-templates/prompts/documentation/project-readme.txt +0 -35
- package/.claude/workflows/cli-templates/prompts/memory/02-document-module-structure.txt +0 -165
- package/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt +0 -109
- package/.claude/workflows/cli-templates/prompts/planning/02-breakdown-task-steps.txt +0 -30
- package/.claude/workflows/cli-templates/prompts/planning/02-design-component-spec.txt +0 -28
- package/.claude/workflows/cli-templates/prompts/planning/03-evaluate-concept-feasibility.txt +0 -127
- package/.claude/workflows/cli-templates/prompts/planning/03-plan-migration-strategy.txt +0 -30
- package/.claude/workflows/cli-templates/prompts/tech/tech-module-format.txt +0 -359
- package/.claude/workflows/cli-templates/prompts/tech/tech-skill-index.txt +0 -185
- package/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.txt +0 -179
- package/.claude/workflows/cli-templates/prompts/universal/00-universal-creative-style.txt +0 -95
- package/.claude/workflows/cli-templates/prompts/universal/00-universal-rigorous-style.txt +0 -92
- package/.claude/workflows/cli-templates/prompts/verification/codex-technical.txt +0 -28
- package/.claude/workflows/cli-templates/prompts/verification/cross-validation.txt +0 -28
- package/.claude/workflows/cli-templates/prompts/verification/gemini-strategic.txt +0 -27
- package/.claude/workflows/cli-templates/prompts/workflow/analysis-results-structure.txt +0 -224
- package/.claude/workflows/cli-templates/prompts/workflow/codex-feasibility-validation.txt +0 -176
- package/.claude/workflows/cli-templates/prompts/workflow/gemini-solution-design.txt +0 -131
- package/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt +0 -286
- package/.claude/workflows/cli-templates/prompts/workflow/skill-aggregation.txt +0 -172
- package/.claude/workflows/cli-templates/prompts/workflow/skill-conflict-patterns.txt +0 -98
- package/.claude/workflows/cli-templates/prompts/workflow/skill-index.txt +0 -224
- package/.claude/workflows/cli-templates/prompts/workflow/skill-lessons-learned.txt +0 -98
- package/.claude/workflows/cli-templates/prompts/workflow/skill-sessions-timeline.txt +0 -53
- package/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt +0 -123
- package/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt +0 -182
- package/.claude/workflows/cli-templates/schemas/diagnosis-json-schema.json +0 -234
- package/.claude/workflows/cli-templates/schemas/explore-json-schema.json +0 -124
- package/.claude/workflows/cli-templates/schemas/fix-plan-json-schema.json +0 -273
- package/.claude/workflows/cli-templates/schemas/plan-json-schema.json +0 -219
- package/.claude/workflows/cli-templates/schemas/project-json-schema.json +0 -221
- package/.claude/workflows/cli-templates/schemas/review-deep-dive-results-schema.json +0 -82
- package/.claude/workflows/cli-templates/schemas/review-dimension-results-schema.json +0 -51
- package/.claude/workflows/cli-templates/tech-stacks/go-dev.md +0 -91
- package/.claude/workflows/cli-templates/tech-stacks/java-dev.md +0 -107
- package/.claude/workflows/cli-templates/tech-stacks/javascript-dev.md +0 -58
- package/.claude/workflows/cli-templates/tech-stacks/python-dev.md +0 -79
- package/.claude/workflows/cli-templates/tech-stacks/react-dev.md +0 -103
- package/.claude/workflows/cli-templates/tech-stacks/typescript-dev.md +0 -83
- package/.claude/workflows/cli-templates/ui-design/systems/animation-tokens.json +0 -247
- package/.claude/workflows/cli-templates/ui-design/systems/design-tokens.json +0 -342
- package/.claude/workflows/cli-templates/ui-design/systems/layout-templates.json +0 -145
- package/.claude/workflows/context-search-strategy.md +0 -77
- package/.claude/workflows/intelligent-tools-strategy.md +0 -662
- package/.claude/workflows/review-directory-specification.md +0 -336
- package/.claude/workflows/task-core.md +0 -214
- package/.claude/workflows/tool-strategy.md +0 -79
- package/.claude/workflows/workflow-architecture.md +0 -942
- package/.codex/AGENTS.md +0 -330
- package/.gemini/GEMINI.md +0 -164
- package/.qwen/QWEN.md +0 -164
- package/CLAUDE.md +0 -91
- package/LICENSE +0 -21
- package/ccw/README.md +0 -121
- package/ccw/bin/ccw.js +0 -10
- package/ccw/package.json +0 -47
- package/ccw/src/cli.js +0 -119
- package/ccw/src/commands/install.js +0 -324
- package/ccw/src/commands/list.js +0 -37
- package/ccw/src/commands/serve.js +0 -67
- package/ccw/src/commands/stop.js +0 -101
- package/ccw/src/commands/tool.js +0 -138
- package/ccw/src/commands/uninstall.js +0 -238
- package/ccw/src/commands/upgrade.js +0 -307
- package/ccw/src/commands/view.js +0 -105
- package/ccw/src/core/dashboard-generator-patch.js +0 -29
- package/ccw/src/core/dashboard-generator.js +0 -682
- package/ccw/src/core/data-aggregator.js +0 -409
- package/ccw/src/core/lite-scanner.js +0 -373
- package/ccw/src/core/manifest.js +0 -201
- package/ccw/src/core/server.js +0 -2063
- package/ccw/src/core/session-scanner.js +0 -235
- package/ccw/src/index.js +0 -9
- package/ccw/src/templates/dashboard-css/01-base.css +0 -291
- package/ccw/src/templates/dashboard-css/02-session.css +0 -726
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +0 -1171
- package/ccw/src/templates/dashboard-css/06-cards.css +0 -1570
- package/ccw/src/templates/dashboard-css/07-managers.css +0 -936
- package/ccw/src/templates/dashboard-css/09-explorer.css +0 -1397
- package/ccw/src/templates/dashboard-js/api.js +0 -200
- package/ccw/src/templates/dashboard-js/components/carousel.js +0 -398
- package/ccw/src/templates/dashboard-js/components/global-notifications.js +0 -219
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +0 -283
- package/ccw/src/templates/dashboard-js/components/mcp-manager.js +0 -528
- package/ccw/src/templates/dashboard-js/components/modals.js +0 -260
- package/ccw/src/templates/dashboard-js/components/navigation.js +0 -245
- package/ccw/src/templates/dashboard-js/components/notifications.js +0 -194
- package/ccw/src/templates/dashboard-js/components/tabs-other.js +0 -273
- package/ccw/src/templates/dashboard-js/main.js +0 -72
- package/ccw/src/templates/dashboard-js/state.js +0 -42
- package/ccw/src/templates/dashboard-js/utils.js +0 -153
- package/ccw/src/templates/dashboard-js/views/explorer.js +0 -852
- package/ccw/src/templates/dashboard-js/views/home.js +0 -197
- package/ccw/src/templates/dashboard-js/views/hook-manager.js +0 -392
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +0 -685
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +0 -411
- package/ccw/src/templates/dashboard-js/views/session-detail.js +0 -780
- package/ccw/src/templates/dashboard.html +0 -731
- package/ccw/src/tools/classify-folders.js +0 -204
- package/ccw/src/tools/convert-tokens-to-css.js +0 -250
- package/ccw/src/tools/detect-changed-modules.js +0 -288
- package/ccw/src/tools/discover-design-files.js +0 -134
- package/ccw/src/tools/edit-file.js +0 -266
- package/ccw/src/tools/generate-module-docs.js +0 -416
- package/ccw/src/tools/get-modules-by-depth.js +0 -308
- package/ccw/src/tools/index.js +0 -176
- package/ccw/src/utils/browser-launcher.js +0 -60
- package/ccw/src/utils/file-utils.js +0 -48
- package/ccw/src/utils/path-resolver.js +0 -279
- package/ccw/src/utils/ui.js +0 -148
- /package/{ccw/src → src}/templates/dashboard-css/03-tasks.css +0 -0
- /package/{ccw/src → src}/templates/dashboard-css/05-context.css +0 -0
- /package/{ccw/src → src}/templates/dashboard-css/08-review.css +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/_conflict_tab.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/_exp_helpers.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/_review_tab.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/flowchart.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/sidebar.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/tabs-context.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/task-drawer-core.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/task-drawer-renderers.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/theme.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/components/version-check.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/views/fix-session.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/views/project-overview.js +0 -0
- /package/{ccw/src → src}/templates/dashboard-js/views/review-session.js +0 -0
- /package/{ccw/src → src}/templates/review-cycle-dashboard.html +0 -0
- /package/{ccw/src → src}/templates/workflow-dashboard.html +0 -0
- /package/{ccw/src → src}/tools/ui-generate-preview.js +0 -0
- /package/{ccw/src → src}/tools/ui-instantiate-prototypes.js +0 -0
- /package/{ccw/src → src}/tools/update-module-claude.js +0 -0
|
@@ -0,0 +1,2272 @@
|
|
|
1
|
+
// CLI Manager View
|
|
2
|
+
// Main view combining CLI status and CCW installations panels (two-column layout)
|
|
3
|
+
|
|
4
|
+
// ========== CLI Manager State ==========
|
|
5
|
+
var currentCliExecution = null;
|
|
6
|
+
var cliExecutionOutput = '';
|
|
7
|
+
var ccwInstallations = [];
|
|
8
|
+
var ccwEndpointTools = [];
|
|
9
|
+
var cliToolConfig = null; // Store loaded CLI config
|
|
10
|
+
var predefinedModels = {}; // Store predefined models per tool
|
|
11
|
+
|
|
12
|
+
// ========== CCW Installations ==========
|
|
13
|
+
async function loadCcwInstallations() {
|
|
14
|
+
try {
|
|
15
|
+
var response = await fetch('/api/ccw/installations');
|
|
16
|
+
if (!response.ok) throw new Error('Failed to load CCW installations');
|
|
17
|
+
var data = await response.json();
|
|
18
|
+
ccwInstallations = data.installations || [];
|
|
19
|
+
return ccwInstallations;
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.error('Failed to load CCW installations:', err);
|
|
22
|
+
ccwInstallations = [];
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// ========== CCW Endpoint Tools ==========
|
|
28
|
+
async function loadCcwEndpointTools() {
|
|
29
|
+
try {
|
|
30
|
+
var response = await fetch('/api/ccw/tools');
|
|
31
|
+
if (!response.ok) throw new Error('Failed to load CCW endpoint tools');
|
|
32
|
+
var data = await response.json();
|
|
33
|
+
ccwEndpointTools = data.tools || [];
|
|
34
|
+
return ccwEndpointTools;
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.error('Failed to load CCW endpoint tools:', err);
|
|
37
|
+
ccwEndpointTools = [];
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ========== CLI Tool Configuration ==========
|
|
43
|
+
async function loadCliToolConfig() {
|
|
44
|
+
try {
|
|
45
|
+
var response = await fetch('/api/cli/config');
|
|
46
|
+
if (!response.ok) throw new Error('Failed to load CLI config');
|
|
47
|
+
var data = await response.json();
|
|
48
|
+
cliToolConfig = data.config || null;
|
|
49
|
+
predefinedModels = data.predefinedModels || {};
|
|
50
|
+
return data;
|
|
51
|
+
} catch (err) {
|
|
52
|
+
console.error('Failed to load CLI config:', err);
|
|
53
|
+
cliToolConfig = null;
|
|
54
|
+
predefinedModels = {};
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function updateCliToolConfig(tool, updates) {
|
|
60
|
+
try {
|
|
61
|
+
var response = await fetch('/api/cli/config/' + tool, {
|
|
62
|
+
method: 'PUT',
|
|
63
|
+
headers: { 'Content-Type': 'application/json' },
|
|
64
|
+
body: JSON.stringify(updates)
|
|
65
|
+
});
|
|
66
|
+
if (!response.ok) throw new Error('Failed to update CLI config');
|
|
67
|
+
var data = await response.json();
|
|
68
|
+
if (data.success && cliToolConfig && cliToolConfig.tools) {
|
|
69
|
+
cliToolConfig.tools[tool] = data.config;
|
|
70
|
+
}
|
|
71
|
+
return data;
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.error('Failed to update CLI config:', err);
|
|
74
|
+
throw err;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ========== Tool Configuration Modal ==========
|
|
79
|
+
async function showToolConfigModal(toolName) {
|
|
80
|
+
// Load config if not already loaded
|
|
81
|
+
if (!cliToolConfig) {
|
|
82
|
+
await loadCliToolConfig();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var toolConfig = cliToolConfig && cliToolConfig.tools ? cliToolConfig.tools[toolName] : null;
|
|
86
|
+
var models = predefinedModels[toolName] || [];
|
|
87
|
+
var status = cliToolStatus[toolName] || {};
|
|
88
|
+
|
|
89
|
+
if (!toolConfig) {
|
|
90
|
+
toolConfig = { enabled: true, primaryModel: '', secondaryModel: '' };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var content = buildToolConfigModalContent(toolName, toolConfig, models, status);
|
|
94
|
+
showModal('Configure ' + toolName.charAt(0).toUpperCase() + toolName.slice(1), content, { size: 'md' });
|
|
95
|
+
|
|
96
|
+
// Initialize event handlers after modal is shown
|
|
97
|
+
setTimeout(function() {
|
|
98
|
+
initToolConfigModalEvents(toolName, toolConfig, models);
|
|
99
|
+
}, 100);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function buildToolConfigModalContent(tool, config, models, status) {
|
|
103
|
+
var isAvailable = status.available;
|
|
104
|
+
var isEnabled = config.enabled;
|
|
105
|
+
|
|
106
|
+
// Check if model is custom (not in predefined list or empty)
|
|
107
|
+
var isPrimaryCustom = !config.primaryModel || models.indexOf(config.primaryModel) === -1;
|
|
108
|
+
var isSecondaryCustom = !config.secondaryModel || models.indexOf(config.secondaryModel) === -1;
|
|
109
|
+
|
|
110
|
+
var modelsOptionsHtml = function(selected, isCustom) {
|
|
111
|
+
var html = '';
|
|
112
|
+
for (var i = 0; i < models.length; i++) {
|
|
113
|
+
var m = models[i];
|
|
114
|
+
html += '<option value="' + escapeHtml(m) + '"' + (m === selected && !isCustom ? ' selected' : '') + '>' + escapeHtml(m) + '</option>';
|
|
115
|
+
}
|
|
116
|
+
html += '<option value="__custom__"' + (isCustom ? ' selected' : '') + '>Custom...</option>';
|
|
117
|
+
return html;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return '<div class="tool-config-modal">' +
|
|
121
|
+
// Status Section
|
|
122
|
+
'<div class="tool-config-section">' +
|
|
123
|
+
'<h4>Status</h4>' +
|
|
124
|
+
'<div class="tool-config-badges">' +
|
|
125
|
+
'<span class="badge ' + (isAvailable ? 'badge-success' : 'badge-muted') + '">' +
|
|
126
|
+
'<i data-lucide="' + (isAvailable ? 'check-circle' : 'circle-dashed') + '" class="w-3 h-3"></i> ' +
|
|
127
|
+
(isAvailable ? 'Installed' : 'Not Installed') +
|
|
128
|
+
'</span>' +
|
|
129
|
+
'<span class="badge ' + (isEnabled ? 'badge-primary' : 'badge-muted') + '">' +
|
|
130
|
+
'<i data-lucide="' + (isEnabled ? 'toggle-right' : 'toggle-left') + '" class="w-3 h-3"></i> ' +
|
|
131
|
+
(isEnabled ? 'Enabled' : 'Disabled') +
|
|
132
|
+
'</span>' +
|
|
133
|
+
'</div>' +
|
|
134
|
+
'</div>' +
|
|
135
|
+
|
|
136
|
+
// Actions Section
|
|
137
|
+
'<div class="tool-config-section">' +
|
|
138
|
+
'<h4>Actions</h4>' +
|
|
139
|
+
'<div class="tool-config-actions">' +
|
|
140
|
+
'<button class="btn-sm ' + (isEnabled ? 'btn-outline' : 'btn-primary') + '" id="toggleEnableBtn" ' + (!isAvailable ? 'disabled' : '') + '>' +
|
|
141
|
+
'<i data-lucide="' + (isEnabled ? 'toggle-left' : 'toggle-right') + '" class="w-3 h-3"></i> ' +
|
|
142
|
+
(isEnabled ? 'Disable' : 'Enable') +
|
|
143
|
+
'</button>' +
|
|
144
|
+
'<button class="btn-sm ' + (isAvailable ? 'btn-outline btn-danger-outline' : 'btn-primary') + '" id="installBtn">' +
|
|
145
|
+
'<i data-lucide="' + (isAvailable ? 'trash-2' : 'download') + '" class="w-3 h-3"></i> ' +
|
|
146
|
+
(isAvailable ? 'Uninstall' : 'Install') +
|
|
147
|
+
'</button>' +
|
|
148
|
+
'</div>' +
|
|
149
|
+
'</div>' +
|
|
150
|
+
|
|
151
|
+
// Primary Model Section
|
|
152
|
+
'<div class="tool-config-section">' +
|
|
153
|
+
'<h4>Primary Model <span class="text-muted">(CLI endpoint calls)</span></h4>' +
|
|
154
|
+
'<div class="model-select-group">' +
|
|
155
|
+
'<select id="primaryModelSelect" class="tool-config-select">' +
|
|
156
|
+
modelsOptionsHtml(config.primaryModel, isPrimaryCustom) +
|
|
157
|
+
'</select>' +
|
|
158
|
+
'<input type="text" id="primaryModelCustom" class="tool-config-input" ' +
|
|
159
|
+
'style="display: ' + (isPrimaryCustom ? 'block' : 'none') + ';" ' +
|
|
160
|
+
'placeholder="Enter model name (e.g., gemini-2.5-pro)" ' +
|
|
161
|
+
'value="' + (isPrimaryCustom && config.primaryModel ? escapeHtml(config.primaryModel) : '') + '" />' +
|
|
162
|
+
'</div>' +
|
|
163
|
+
'</div>' +
|
|
164
|
+
|
|
165
|
+
// Secondary Model Section
|
|
166
|
+
'<div class="tool-config-section">' +
|
|
167
|
+
'<h4>Secondary Model <span class="text-muted">(internal tools)</span></h4>' +
|
|
168
|
+
'<div class="model-select-group">' +
|
|
169
|
+
'<select id="secondaryModelSelect" class="tool-config-select">' +
|
|
170
|
+
modelsOptionsHtml(config.secondaryModel, isSecondaryCustom) +
|
|
171
|
+
'</select>' +
|
|
172
|
+
'<input type="text" id="secondaryModelCustom" class="tool-config-input" ' +
|
|
173
|
+
'style="display: ' + (isSecondaryCustom ? 'block' : 'none') + ';" ' +
|
|
174
|
+
'placeholder="Enter model name (e.g., gemini-2.5-flash)" ' +
|
|
175
|
+
'value="' + (isSecondaryCustom && config.secondaryModel ? escapeHtml(config.secondaryModel) : '') + '" />' +
|
|
176
|
+
'</div>' +
|
|
177
|
+
'</div>' +
|
|
178
|
+
|
|
179
|
+
// Footer
|
|
180
|
+
'<div class="tool-config-footer">' +
|
|
181
|
+
'<button class="btn btn-outline" onclick="closeModal()">' + t('common.cancel') + '</button>' +
|
|
182
|
+
'<button class="btn btn-primary" id="saveConfigBtn">' +
|
|
183
|
+
'<i data-lucide="save" class="w-3.5 h-3.5"></i> ' + t('common.save') +
|
|
184
|
+
'</button>' +
|
|
185
|
+
'</div>' +
|
|
186
|
+
'</div>';
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function initToolConfigModalEvents(tool, currentConfig, models) {
|
|
190
|
+
// Toggle Enable/Disable
|
|
191
|
+
var toggleBtn = document.getElementById('toggleEnableBtn');
|
|
192
|
+
if (toggleBtn) {
|
|
193
|
+
toggleBtn.onclick = async function() {
|
|
194
|
+
var newEnabled = !currentConfig.enabled;
|
|
195
|
+
try {
|
|
196
|
+
await updateCliToolConfig(tool, { enabled: newEnabled });
|
|
197
|
+
showRefreshToast(tool + ' ' + (newEnabled ? 'enabled' : 'disabled'), 'success');
|
|
198
|
+
closeModal();
|
|
199
|
+
renderToolsSection();
|
|
200
|
+
if (window.lucide) lucide.createIcons();
|
|
201
|
+
} catch (err) {
|
|
202
|
+
showRefreshToast('Failed to update: ' + err.message, 'error');
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Install/Uninstall
|
|
208
|
+
var installBtn = document.getElementById('installBtn');
|
|
209
|
+
if (installBtn) {
|
|
210
|
+
installBtn.onclick = function() {
|
|
211
|
+
var status = cliToolStatus[tool] || {};
|
|
212
|
+
closeModal();
|
|
213
|
+
|
|
214
|
+
if (status.available) {
|
|
215
|
+
openCliUninstallWizard(tool);
|
|
216
|
+
} else {
|
|
217
|
+
openCliInstallWizard(tool);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Model select handlers
|
|
223
|
+
var primarySelect = document.getElementById('primaryModelSelect');
|
|
224
|
+
var primaryCustom = document.getElementById('primaryModelCustom');
|
|
225
|
+
var secondarySelect = document.getElementById('secondaryModelSelect');
|
|
226
|
+
var secondaryCustom = document.getElementById('secondaryModelCustom');
|
|
227
|
+
|
|
228
|
+
if (primarySelect && primaryCustom) {
|
|
229
|
+
primarySelect.onchange = function() {
|
|
230
|
+
if (this.value === '__custom__') {
|
|
231
|
+
primaryCustom.style.display = 'block';
|
|
232
|
+
primaryCustom.focus();
|
|
233
|
+
} else {
|
|
234
|
+
primaryCustom.style.display = 'none';
|
|
235
|
+
primaryCustom.value = '';
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (secondarySelect && secondaryCustom) {
|
|
241
|
+
secondarySelect.onchange = function() {
|
|
242
|
+
if (this.value === '__custom__') {
|
|
243
|
+
secondaryCustom.style.display = 'block';
|
|
244
|
+
secondaryCustom.focus();
|
|
245
|
+
} else {
|
|
246
|
+
secondaryCustom.style.display = 'none';
|
|
247
|
+
secondaryCustom.value = '';
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Save button
|
|
253
|
+
var saveBtn = document.getElementById('saveConfigBtn');
|
|
254
|
+
if (saveBtn) {
|
|
255
|
+
saveBtn.onclick = async function() {
|
|
256
|
+
var primaryModel = primarySelect.value === '__custom__'
|
|
257
|
+
? primaryCustom.value.trim()
|
|
258
|
+
: primarySelect.value;
|
|
259
|
+
var secondaryModel = secondarySelect.value === '__custom__'
|
|
260
|
+
? secondaryCustom.value.trim()
|
|
261
|
+
: secondarySelect.value;
|
|
262
|
+
|
|
263
|
+
if (!primaryModel) {
|
|
264
|
+
showRefreshToast('Primary model is required', 'error');
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (!secondaryModel) {
|
|
268
|
+
showRefreshToast('Secondary model is required', 'error');
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
try {
|
|
273
|
+
await updateCliToolConfig(tool, {
|
|
274
|
+
primaryModel: primaryModel,
|
|
275
|
+
secondaryModel: secondaryModel
|
|
276
|
+
});
|
|
277
|
+
showRefreshToast('Configuration saved', 'success');
|
|
278
|
+
closeModal();
|
|
279
|
+
} catch (err) {
|
|
280
|
+
showRefreshToast('Failed to save: ' + err.message, 'error');
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Initialize lucide icons in modal
|
|
286
|
+
if (window.lucide) lucide.createIcons();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// ========== Rendering ==========
|
|
290
|
+
async function renderCliManager() {
|
|
291
|
+
var container = document.getElementById('mainContent');
|
|
292
|
+
if (!container) return;
|
|
293
|
+
|
|
294
|
+
// Hide stats grid and search for CLI view
|
|
295
|
+
var statsGrid = document.getElementById('statsGrid');
|
|
296
|
+
var searchInput = document.getElementById('searchInput');
|
|
297
|
+
if (statsGrid) statsGrid.style.display = 'none';
|
|
298
|
+
if (searchInput) searchInput.parentElement.style.display = 'none';
|
|
299
|
+
|
|
300
|
+
// Load data (including CodexLens status for tools section)
|
|
301
|
+
await Promise.all([
|
|
302
|
+
loadCliToolStatus(),
|
|
303
|
+
loadCodexLensStatus(),
|
|
304
|
+
loadCcwInstallations(),
|
|
305
|
+
loadCcwEndpointTools()
|
|
306
|
+
]);
|
|
307
|
+
|
|
308
|
+
container.innerHTML = '<div class="status-manager">' +
|
|
309
|
+
'<div class="status-two-column">' +
|
|
310
|
+
'<div class="cli-section" id="tools-section"></div>' +
|
|
311
|
+
'<div class="cli-section" id="ccw-section"></div>' +
|
|
312
|
+
'</div>' +
|
|
313
|
+
'<div class="cli-section" id="language-settings-section" style="margin-top: 1.5rem;"></div>' +
|
|
314
|
+
'<div class="cli-settings-section" id="cli-settings-section" style="margin-top: 1.5rem;"></div>' +
|
|
315
|
+
'<div class="cli-section" id="ccw-endpoint-tools-section" style="margin-top: 1.5rem;"></div>' +
|
|
316
|
+
'</div>' +
|
|
317
|
+
'<section id="storageCard" class="mb-6"></section>' +
|
|
318
|
+
'<section id="indexCard" class="mb-6"></section>';
|
|
319
|
+
|
|
320
|
+
// Render sub-panels
|
|
321
|
+
renderToolsSection();
|
|
322
|
+
renderCcwSection();
|
|
323
|
+
renderLanguageSettingsSection();
|
|
324
|
+
renderCliSettingsSection();
|
|
325
|
+
renderCcwEndpointToolsSection();
|
|
326
|
+
|
|
327
|
+
// Initialize storage manager card
|
|
328
|
+
if (typeof initStorageManager === 'function') {
|
|
329
|
+
initStorageManager();
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Initialize index manager card
|
|
333
|
+
if (typeof initIndexManager === 'function') {
|
|
334
|
+
initIndexManager();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Initialize Lucide icons
|
|
338
|
+
if (window.lucide) lucide.createIcons();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// ========== Helper Functions ==========
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Get selected embedding model from dropdown
|
|
345
|
+
* @returns {string} Selected model profile (code, fast, multilingual, balanced)
|
|
346
|
+
*/
|
|
347
|
+
function getSelectedModel() {
|
|
348
|
+
var select = document.getElementById('codexlensModelSelect');
|
|
349
|
+
return select ? select.value : 'code';
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// ========== Tools Section (Left Column) ==========
|
|
353
|
+
function renderToolsSection() {
|
|
354
|
+
var container = document.getElementById('tools-section');
|
|
355
|
+
if (!container) return;
|
|
356
|
+
|
|
357
|
+
var toolDescriptions = {
|
|
358
|
+
gemini: t('cli.geminiDesc'),
|
|
359
|
+
qwen: t('cli.qwenDesc'),
|
|
360
|
+
codex: t('cli.codexDesc')
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
var tools = ['gemini', 'qwen', 'codex'];
|
|
364
|
+
var available = Object.values(cliToolStatus).filter(function(t) { return t.available; }).length;
|
|
365
|
+
|
|
366
|
+
var toolsHtml = tools.map(function(tool) {
|
|
367
|
+
var status = cliToolStatus[tool] || {};
|
|
368
|
+
var isAvailable = status.available;
|
|
369
|
+
var isDefault = defaultCliTool === tool;
|
|
370
|
+
|
|
371
|
+
return '<div class="tool-item clickable ' + (isAvailable ? 'available' : 'unavailable') + '" onclick="showToolConfigModal(\'' + tool + '\')">' +
|
|
372
|
+
'<div class="tool-item-left">' +
|
|
373
|
+
'<span class="tool-status-dot ' + (isAvailable ? 'status-available' : 'status-unavailable') + '"></span>' +
|
|
374
|
+
'<div class="tool-item-info">' +
|
|
375
|
+
'<div class="tool-item-name">' + tool.charAt(0).toUpperCase() + tool.slice(1) +
|
|
376
|
+
(isDefault ? '<span class="tool-default-badge">' + t('cli.default') + '</span>' : '') +
|
|
377
|
+
'<i data-lucide="settings" class="w-3 h-3 tool-config-icon"></i>' +
|
|
378
|
+
'</div>' +
|
|
379
|
+
'<div class="tool-item-desc">' + toolDescriptions[tool] + '</div>' +
|
|
380
|
+
'</div>' +
|
|
381
|
+
'</div>' +
|
|
382
|
+
'<div class="tool-item-right">' +
|
|
383
|
+
(isAvailable
|
|
384
|
+
? '<span class="tool-status-text success"><i data-lucide="check-circle" class="w-3.5 h-3.5"></i> ' + t('cli.ready') + '</span>'
|
|
385
|
+
: '<span class="tool-status-text muted"><i data-lucide="circle-dashed" class="w-3.5 h-3.5"></i> ' + t('cli.notInstalled') + '</span>') +
|
|
386
|
+
(isAvailable && !isDefault
|
|
387
|
+
? '<button class="btn-sm btn-outline" onclick="event.stopPropagation(); setDefaultCliTool(\'' + tool + '\')"><i data-lucide="star" class="w-3 h-3"></i> ' + t('cli.setDefault') + '</button>'
|
|
388
|
+
: '') +
|
|
389
|
+
'</div>' +
|
|
390
|
+
'</div>';
|
|
391
|
+
}).join('');
|
|
392
|
+
|
|
393
|
+
// CodexLens item
|
|
394
|
+
var codexLensHtml = '<div class="tool-item clickable ' + (codexLensStatus.ready ? 'available' : 'unavailable') + '" onclick="showCodexLensConfigModal()">' +
|
|
395
|
+
'<div class="tool-item-left">' +
|
|
396
|
+
'<span class="tool-status-dot ' + (codexLensStatus.ready ? 'status-available' : 'status-unavailable') + '"></span>' +
|
|
397
|
+
'<div class="tool-item-info">' +
|
|
398
|
+
'<div class="tool-item-name">CodexLens <span class="tool-type-badge">Index</span>' +
|
|
399
|
+
'<i data-lucide="settings" class="w-3 h-3 tool-config-icon"></i></div>' +
|
|
400
|
+
'<div class="tool-item-desc">' + (codexLensStatus.ready ? t('cli.codexLensDesc') : t('cli.codexLensDescFull')) + '</div>' +
|
|
401
|
+
'</div>' +
|
|
402
|
+
'</div>' +
|
|
403
|
+
'<div class="tool-item-right">' +
|
|
404
|
+
(codexLensStatus.ready
|
|
405
|
+
? '<span class="tool-status-text success"><i data-lucide="check-circle" class="w-3.5 h-3.5"></i> v' + (codexLensStatus.version || 'installed') + '</span>' +
|
|
406
|
+
'<select id="codexlensModelSelect" class="btn-sm bg-muted border border-border rounded text-xs" onclick="event.stopPropagation()" title="' + (t('index.selectModel') || 'Select embedding model') + '">' +
|
|
407
|
+
'<option value="code">' + (t('index.modelCode') || 'Code (768d)') + '</option>' +
|
|
408
|
+
'<option value="fast">' + (t('index.modelFast') || 'Fast (384d)') + '</option>' +
|
|
409
|
+
'<option value="multilingual">' + (t('index.modelMultilingual') || 'Multilingual (1024d)') + '</option>' +
|
|
410
|
+
'<option value="balanced">' + (t('index.modelBalanced') || 'Balanced (1024d)') + '</option>' +
|
|
411
|
+
'</select>' +
|
|
412
|
+
'<button class="btn-sm btn-primary" onclick="event.stopPropagation(); initCodexLensIndex(\'full\', getSelectedModel())" title="' + (t('index.fullDesc') || 'FTS + Semantic search (recommended)') + '"><i data-lucide="layers" class="w-3 h-3"></i> ' + (t('index.fullIndex') || '全部索引') + '</button>' +
|
|
413
|
+
'<button class="btn-sm btn-outline" onclick="event.stopPropagation(); initCodexLensIndex(\'vector\', getSelectedModel())" title="' + (t('index.vectorDesc') || 'Semantic search with embeddings') + '"><i data-lucide="sparkles" class="w-3 h-3"></i> ' + (t('index.vectorIndex') || '向量索引') + '</button>' +
|
|
414
|
+
'<button class="btn-sm btn-outline" onclick="event.stopPropagation(); initCodexLensIndex(\'normal\')" title="' + (t('index.normalDesc') || 'Fast full-text search only') + '"><i data-lucide="file-text" class="w-3 h-3"></i> ' + (t('index.normalIndex') || 'FTS索引') + '</button>' +
|
|
415
|
+
'<button class="btn-sm btn-outline btn-danger" onclick="event.stopPropagation(); uninstallCodexLens()"><i data-lucide="trash-2" class="w-3 h-3"></i> ' + t('cli.uninstall') + '</button>'
|
|
416
|
+
: '<span class="tool-status-text muted"><i data-lucide="circle-dashed" class="w-3.5 h-3.5"></i> ' + t('cli.notInstalled') + '</span>' +
|
|
417
|
+
'<button class="btn-sm btn-primary" onclick="event.stopPropagation(); installCodexLens()"><i data-lucide="download" class="w-3 h-3"></i> ' + t('cli.install') + '</button>') +
|
|
418
|
+
'</div>' +
|
|
419
|
+
'</div>';
|
|
420
|
+
|
|
421
|
+
// Semantic Search item (only show if CodexLens is installed)
|
|
422
|
+
var semanticHtml = '';
|
|
423
|
+
if (codexLensStatus.ready) {
|
|
424
|
+
semanticHtml = '<div class="tool-item ' + (semanticStatus.available ? 'available' : 'unavailable') + '">' +
|
|
425
|
+
'<div class="tool-item-left">' +
|
|
426
|
+
'<span class="tool-status-dot ' + (semanticStatus.available ? 'status-available' : 'status-unavailable') + '"></span>' +
|
|
427
|
+
'<div class="tool-item-info">' +
|
|
428
|
+
'<div class="tool-item-name">Semantic Search <span class="tool-type-badge ai">AI</span></div>' +
|
|
429
|
+
'<div class="tool-item-desc">' + (semanticStatus.available ? 'AI-powered code understanding' : 'Natural language code search') + '</div>' +
|
|
430
|
+
'</div>' +
|
|
431
|
+
'</div>' +
|
|
432
|
+
'<div class="tool-item-right">' +
|
|
433
|
+
(semanticStatus.available
|
|
434
|
+
? '<span class="tool-status-text success"><i data-lucide="sparkles" class="w-3.5 h-3.5"></i> ' + (semanticStatus.backend || 'Ready') + '</span>'
|
|
435
|
+
: '<span class="tool-status-text muted"><i data-lucide="circle-dashed" class="w-3.5 h-3.5"></i> Not Installed</span>' +
|
|
436
|
+
'<button class="btn-sm btn-primary" onclick="event.stopPropagation(); openSemanticInstallWizard()"><i data-lucide="brain" class="w-3 h-3"></i> Install</button>') +
|
|
437
|
+
'</div>' +
|
|
438
|
+
'</div>';
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
container.innerHTML = '<div class="section-header">' +
|
|
442
|
+
'<div class="section-header-left">' +
|
|
443
|
+
'<h3><i data-lucide="terminal" class="w-4 h-4"></i> ' + t('cli.tools') + '</h3>' +
|
|
444
|
+
'<span class="section-count">' + available + '/' + tools.length + ' ' + t('cli.available') + '</span>' +
|
|
445
|
+
'</div>' +
|
|
446
|
+
'<button class="btn-icon" onclick="refreshAllCliStatus()" title="' + t('cli.refreshStatus') + '">' +
|
|
447
|
+
'<i data-lucide="refresh-cw" class="w-4 h-4"></i>' +
|
|
448
|
+
'</button>' +
|
|
449
|
+
'</div>' +
|
|
450
|
+
'<div class="tools-list">' +
|
|
451
|
+
toolsHtml +
|
|
452
|
+
codexLensHtml +
|
|
453
|
+
semanticHtml +
|
|
454
|
+
'</div>';
|
|
455
|
+
|
|
456
|
+
if (window.lucide) lucide.createIcons();
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// ========== CCW Section (Right Column) ==========
|
|
460
|
+
function renderCcwSection() {
|
|
461
|
+
var container = document.getElementById('ccw-section');
|
|
462
|
+
if (!container) return;
|
|
463
|
+
|
|
464
|
+
var installationsHtml = '';
|
|
465
|
+
|
|
466
|
+
if (ccwInstallations.length === 0) {
|
|
467
|
+
installationsHtml = '<div class="ccw-empty-state">' +
|
|
468
|
+
'<i data-lucide="package-x" class="w-8 h-8"></i>' +
|
|
469
|
+
'<p>' + t('ccw.noInstallations') + '</p>' +
|
|
470
|
+
'<button class="btn btn-sm btn-primary" onclick="showCcwInstallModal()">' +
|
|
471
|
+
'<i data-lucide="download" class="w-3 h-3"></i> ' + t('ccw.installCcw') + '</button>' +
|
|
472
|
+
'</div>';
|
|
473
|
+
} else {
|
|
474
|
+
installationsHtml = '<div class="ccw-list">';
|
|
475
|
+
for (var i = 0; i < ccwInstallations.length; i++) {
|
|
476
|
+
var inst = ccwInstallations[i];
|
|
477
|
+
var isGlobal = inst.installation_mode === 'Global';
|
|
478
|
+
var modeIcon = isGlobal ? 'home' : 'folder';
|
|
479
|
+
var version = inst.application_version || 'unknown';
|
|
480
|
+
var installDate = new Date(inst.installation_date).toLocaleDateString();
|
|
481
|
+
|
|
482
|
+
installationsHtml += '<div class="ccw-item">' +
|
|
483
|
+
'<div class="ccw-item-left">' +
|
|
484
|
+
'<div class="ccw-item-mode ' + (isGlobal ? 'global' : 'path') + '">' +
|
|
485
|
+
'<i data-lucide="' + modeIcon + '" class="w-4 h-4"></i>' +
|
|
486
|
+
'</div>' +
|
|
487
|
+
'<div class="ccw-item-info">' +
|
|
488
|
+
'<div class="ccw-item-header">' +
|
|
489
|
+
'<span class="ccw-item-name">' + inst.installation_mode + '</span>' +
|
|
490
|
+
'<span class="ccw-version-tag">v' + version + '</span>' +
|
|
491
|
+
'</div>' +
|
|
492
|
+
'<div class="ccw-item-path" title="' + inst.installation_path + '">' + escapeHtml(inst.installation_path) + '</div>' +
|
|
493
|
+
'<div class="ccw-item-meta">' +
|
|
494
|
+
'<span><i data-lucide="calendar" class="w-3 h-3"></i> ' + installDate + '</span>' +
|
|
495
|
+
'<span><i data-lucide="file" class="w-3 h-3"></i> ' + (inst.files_count || 0) + ' files</span>' +
|
|
496
|
+
'</div>' +
|
|
497
|
+
'</div>' +
|
|
498
|
+
'</div>' +
|
|
499
|
+
'<div class="ccw-item-actions">' +
|
|
500
|
+
'<button class="btn-icon btn-icon-sm" onclick="runCcwUpgrade()" title="Upgrade">' +
|
|
501
|
+
'<i data-lucide="arrow-up-circle" class="w-4 h-4"></i>' +
|
|
502
|
+
'</button>' +
|
|
503
|
+
'<button class="btn-icon btn-icon-sm btn-danger" onclick="confirmCcwUninstall(\'' + escapeHtml(inst.installation_path) + '\')" title="Uninstall">' +
|
|
504
|
+
'<i data-lucide="trash-2" class="w-4 h-4"></i>' +
|
|
505
|
+
'</button>' +
|
|
506
|
+
'</div>' +
|
|
507
|
+
'</div>';
|
|
508
|
+
}
|
|
509
|
+
installationsHtml += '</div>';
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
container.innerHTML = '<div class="section-header">' +
|
|
513
|
+
'<div class="section-header-left">' +
|
|
514
|
+
'<h3><i data-lucide="package" class="w-4 h-4"></i> ' + t('ccw.install') + '</h3>' +
|
|
515
|
+
'<span class="section-count">' + ccwInstallations.length + ' ' + (ccwInstallations.length !== 1 ? t('ccw.installationsPlural') : t('ccw.installations')) + '</span>' +
|
|
516
|
+
'</div>' +
|
|
517
|
+
'<div class="section-header-actions">' +
|
|
518
|
+
'<button class="btn-icon" onclick="showCcwInstallModal()" title="Add Installation">' +
|
|
519
|
+
'<i data-lucide="plus" class="w-4 h-4"></i>' +
|
|
520
|
+
'</button>' +
|
|
521
|
+
'<button class="btn-icon" onclick="loadCcwInstallations().then(function() { renderCcwSection(); if (window.lucide) lucide.createIcons(); })" title="Refresh">' +
|
|
522
|
+
'<i data-lucide="refresh-cw" class="w-4 h-4"></i>' +
|
|
523
|
+
'</button>' +
|
|
524
|
+
'</div>' +
|
|
525
|
+
'</div>' +
|
|
526
|
+
installationsHtml;
|
|
527
|
+
|
|
528
|
+
if (window.lucide) lucide.createIcons();
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// ========== Language Settings State ==========
|
|
532
|
+
var chineseResponseEnabled = false;
|
|
533
|
+
var chineseResponseLoading = false;
|
|
534
|
+
var windowsPlatformEnabled = false;
|
|
535
|
+
var windowsPlatformLoading = false;
|
|
536
|
+
|
|
537
|
+
// ========== Language Settings Section ==========
|
|
538
|
+
async function loadLanguageSettings() {
|
|
539
|
+
try {
|
|
540
|
+
var response = await fetch('/api/language/chinese-response');
|
|
541
|
+
if (!response.ok) throw new Error('Failed to load language settings');
|
|
542
|
+
var data = await response.json();
|
|
543
|
+
chineseResponseEnabled = data.enabled || false;
|
|
544
|
+
return data;
|
|
545
|
+
} catch (err) {
|
|
546
|
+
console.error('Failed to load language settings:', err);
|
|
547
|
+
chineseResponseEnabled = false;
|
|
548
|
+
return { enabled: false, guidelinesExists: false };
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
async function loadWindowsPlatformSettings() {
|
|
553
|
+
try {
|
|
554
|
+
var response = await fetch('/api/language/windows-platform');
|
|
555
|
+
if (!response.ok) throw new Error('Failed to load Windows platform settings');
|
|
556
|
+
var data = await response.json();
|
|
557
|
+
windowsPlatformEnabled = data.enabled || false;
|
|
558
|
+
return data;
|
|
559
|
+
} catch (err) {
|
|
560
|
+
console.error('Failed to load Windows platform settings:', err);
|
|
561
|
+
windowsPlatformEnabled = false;
|
|
562
|
+
return { enabled: false, guidelinesExists: false };
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
async function toggleChineseResponse(enabled) {
|
|
567
|
+
if (chineseResponseLoading) return;
|
|
568
|
+
chineseResponseLoading = true;
|
|
569
|
+
|
|
570
|
+
try {
|
|
571
|
+
var response = await fetch('/api/language/chinese-response', {
|
|
572
|
+
method: 'POST',
|
|
573
|
+
headers: { 'Content-Type': 'application/json' },
|
|
574
|
+
body: JSON.stringify({ enabled: enabled })
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
if (!response.ok) {
|
|
578
|
+
var errData = await response.json();
|
|
579
|
+
throw new Error(errData.error || 'Failed to update setting');
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
var data = await response.json();
|
|
583
|
+
chineseResponseEnabled = data.enabled;
|
|
584
|
+
|
|
585
|
+
// Update UI
|
|
586
|
+
renderLanguageSettingsSection();
|
|
587
|
+
|
|
588
|
+
// Show toast
|
|
589
|
+
showRefreshToast(enabled ? t('lang.enableSuccess') : t('lang.disableSuccess'), 'success');
|
|
590
|
+
} catch (err) {
|
|
591
|
+
console.error('Failed to toggle Chinese response:', err);
|
|
592
|
+
showRefreshToast(enabled ? t('lang.enableFailed') : t('lang.disableFailed'), 'error');
|
|
593
|
+
} finally {
|
|
594
|
+
chineseResponseLoading = false;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
async function toggleWindowsPlatform(enabled) {
|
|
599
|
+
if (windowsPlatformLoading) return;
|
|
600
|
+
windowsPlatformLoading = true;
|
|
601
|
+
|
|
602
|
+
try {
|
|
603
|
+
var response = await fetch('/api/language/windows-platform', {
|
|
604
|
+
method: 'POST',
|
|
605
|
+
headers: { 'Content-Type': 'application/json' },
|
|
606
|
+
body: JSON.stringify({ enabled: enabled })
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
if (!response.ok) {
|
|
610
|
+
var errData = await response.json();
|
|
611
|
+
throw new Error(errData.error || 'Failed to update setting');
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
var data = await response.json();
|
|
615
|
+
windowsPlatformEnabled = data.enabled;
|
|
616
|
+
|
|
617
|
+
// Update UI
|
|
618
|
+
renderLanguageSettingsSection();
|
|
619
|
+
|
|
620
|
+
// Show toast
|
|
621
|
+
showRefreshToast(enabled ? t('lang.windowsEnableSuccess') : t('lang.windowsDisableSuccess'), 'success');
|
|
622
|
+
} catch (err) {
|
|
623
|
+
console.error('Failed to toggle Windows platform:', err);
|
|
624
|
+
showRefreshToast(enabled ? t('lang.windowsEnableFailed') : t('lang.windowsDisableFailed'), 'error');
|
|
625
|
+
} finally {
|
|
626
|
+
windowsPlatformLoading = false;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
async function renderLanguageSettingsSection() {
|
|
631
|
+
var container = document.getElementById('language-settings-section');
|
|
632
|
+
if (!container) return;
|
|
633
|
+
|
|
634
|
+
// Load current state if not loaded
|
|
635
|
+
if (!chineseResponseEnabled && !chineseResponseLoading) {
|
|
636
|
+
await loadLanguageSettings();
|
|
637
|
+
}
|
|
638
|
+
if (!windowsPlatformEnabled && !windowsPlatformLoading) {
|
|
639
|
+
await loadWindowsPlatformSettings();
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
var settingsHtml = '<div class="section-header">' +
|
|
643
|
+
'<div class="section-header-left">' +
|
|
644
|
+
'<h3><i data-lucide="languages" class="w-4 h-4"></i> ' + t('lang.settings') + '</h3>' +
|
|
645
|
+
'</div>' +
|
|
646
|
+
'</div>' +
|
|
647
|
+
'<div class="cli-settings-grid" style="grid-template-columns: 1fr 1fr;">' +
|
|
648
|
+
'<div class="cli-setting-item">' +
|
|
649
|
+
'<label class="cli-setting-label">' +
|
|
650
|
+
'<i data-lucide="message-square-text" class="w-3 h-3"></i>' +
|
|
651
|
+
t('lang.chinese') +
|
|
652
|
+
'</label>' +
|
|
653
|
+
'<div class="cli-setting-control">' +
|
|
654
|
+
'<label class="cli-toggle">' +
|
|
655
|
+
'<input type="checkbox"' + (chineseResponseEnabled ? ' checked' : '') + ' onchange="toggleChineseResponse(this.checked)"' + (chineseResponseLoading ? ' disabled' : '') + '>' +
|
|
656
|
+
'<span class="cli-toggle-slider"></span>' +
|
|
657
|
+
'</label>' +
|
|
658
|
+
'<span class="cli-setting-status ' + (chineseResponseEnabled ? 'enabled' : 'disabled') + '">' +
|
|
659
|
+
(chineseResponseEnabled ? t('lang.enabled') : t('lang.disabled')) +
|
|
660
|
+
'</span>' +
|
|
661
|
+
'</div>' +
|
|
662
|
+
'<p class="cli-setting-desc">' + t('lang.chineseDesc') + '</p>' +
|
|
663
|
+
'</div>' +
|
|
664
|
+
'<div class="cli-setting-item">' +
|
|
665
|
+
'<label class="cli-setting-label">' +
|
|
666
|
+
'<i data-lucide="monitor" class="w-3 h-3"></i>' +
|
|
667
|
+
t('lang.windows') +
|
|
668
|
+
'</label>' +
|
|
669
|
+
'<div class="cli-setting-control">' +
|
|
670
|
+
'<label class="cli-toggle">' +
|
|
671
|
+
'<input type="checkbox"' + (windowsPlatformEnabled ? ' checked' : '') + ' onchange="toggleWindowsPlatform(this.checked)"' + (windowsPlatformLoading ? ' disabled' : '') + '>' +
|
|
672
|
+
'<span class="cli-toggle-slider"></span>' +
|
|
673
|
+
'</label>' +
|
|
674
|
+
'<span class="cli-setting-status ' + (windowsPlatformEnabled ? 'enabled' : 'disabled') + '">' +
|
|
675
|
+
(windowsPlatformEnabled ? t('lang.enabled') : t('lang.disabled')) +
|
|
676
|
+
'</span>' +
|
|
677
|
+
'</div>' +
|
|
678
|
+
'<p class="cli-setting-desc">' + t('lang.windowsDesc') + '</p>' +
|
|
679
|
+
'</div>' +
|
|
680
|
+
'</div>';
|
|
681
|
+
|
|
682
|
+
container.innerHTML = settingsHtml;
|
|
683
|
+
if (window.lucide) lucide.createIcons();
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// ========== CLI Settings Section (Full Width) ==========
|
|
687
|
+
function renderCliSettingsSection() {
|
|
688
|
+
var container = document.getElementById('cli-settings-section');
|
|
689
|
+
if (!container) return;
|
|
690
|
+
|
|
691
|
+
var settingsHtml = '<div class="section-header">' +
|
|
692
|
+
'<div class="section-header-left">' +
|
|
693
|
+
'<h3><i data-lucide="settings" class="w-4 h-4"></i> ' + t('cli.settings') + '</h3>' +
|
|
694
|
+
'</div>' +
|
|
695
|
+
'</div>' +
|
|
696
|
+
'<div class="cli-settings-grid">' +
|
|
697
|
+
'<div class="cli-setting-item">' +
|
|
698
|
+
'<label class="cli-setting-label">' +
|
|
699
|
+
'<i data-lucide="layers" class="w-3 h-3"></i>' +
|
|
700
|
+
t('cli.promptFormat') +
|
|
701
|
+
'</label>' +
|
|
702
|
+
'<div class="cli-setting-control">' +
|
|
703
|
+
'<select class="cli-setting-select" onchange="setPromptFormat(this.value)">' +
|
|
704
|
+
'<option value="plain"' + (promptConcatFormat === 'plain' ? ' selected' : '') + '>Plain Text</option>' +
|
|
705
|
+
'<option value="yaml"' + (promptConcatFormat === 'yaml' ? ' selected' : '') + '>YAML</option>' +
|
|
706
|
+
'<option value="json"' + (promptConcatFormat === 'json' ? ' selected' : '') + '>JSON</option>' +
|
|
707
|
+
'</select>' +
|
|
708
|
+
'</div>' +
|
|
709
|
+
'<p class="cli-setting-desc">' + t('cli.promptFormatDesc') + '</p>' +
|
|
710
|
+
'</div>' +
|
|
711
|
+
'<div class="cli-setting-item">' +
|
|
712
|
+
'<label class="cli-setting-label">' +
|
|
713
|
+
'<i data-lucide="database" class="w-3 h-3"></i>' +
|
|
714
|
+
t('cli.storageBackend') +
|
|
715
|
+
'</label>' +
|
|
716
|
+
'<div class="cli-setting-control">' +
|
|
717
|
+
'<span class="cli-setting-value">SQLite</span>' +
|
|
718
|
+
'</div>' +
|
|
719
|
+
'<p class="cli-setting-desc">' + t('cli.storageBackendDesc') + '</p>' +
|
|
720
|
+
'</div>' +
|
|
721
|
+
'<div class="cli-setting-item">' +
|
|
722
|
+
'<label class="cli-setting-label">' +
|
|
723
|
+
'<i data-lucide="sparkles" class="w-3 h-3"></i>' +
|
|
724
|
+
t('cli.smartContext') +
|
|
725
|
+
'</label>' +
|
|
726
|
+
'<div class="cli-setting-control">' +
|
|
727
|
+
'<label class="cli-toggle">' +
|
|
728
|
+
'<input type="checkbox"' + (smartContextEnabled ? ' checked' : '') + ' onchange="setSmartContextEnabled(this.checked)">' +
|
|
729
|
+
'<span class="cli-toggle-slider"></span>' +
|
|
730
|
+
'</label>' +
|
|
731
|
+
'</div>' +
|
|
732
|
+
'<p class="cli-setting-desc">' + t('cli.smartContextDesc') + '</p>' +
|
|
733
|
+
'</div>' +
|
|
734
|
+
'<div class="cli-setting-item">' +
|
|
735
|
+
'<label class="cli-setting-label">' +
|
|
736
|
+
'<i data-lucide="refresh-cw" class="w-3 h-3"></i>' +
|
|
737
|
+
t('cli.nativeResume') +
|
|
738
|
+
'</label>' +
|
|
739
|
+
'<div class="cli-setting-control">' +
|
|
740
|
+
'<label class="cli-toggle">' +
|
|
741
|
+
'<input type="checkbox"' + (nativeResumeEnabled ? ' checked' : '') + ' onchange="setNativeResumeEnabled(this.checked)">' +
|
|
742
|
+
'<span class="cli-toggle-slider"></span>' +
|
|
743
|
+
'</label>' +
|
|
744
|
+
'</div>' +
|
|
745
|
+
'<p class="cli-setting-desc">' + t('cli.nativeResumeDesc') + '</p>' +
|
|
746
|
+
'</div>' +
|
|
747
|
+
'<div class="cli-setting-item">' +
|
|
748
|
+
'<label class="cli-setting-label">' +
|
|
749
|
+
'<i data-lucide="git-branch" class="w-3 h-3"></i>' +
|
|
750
|
+
t('cli.recursiveQuery') +
|
|
751
|
+
'</label>' +
|
|
752
|
+
'<div class="cli-setting-control">' +
|
|
753
|
+
'<label class="cli-toggle">' +
|
|
754
|
+
'<input type="checkbox"' + (recursiveQueryEnabled ? ' checked' : '') + ' onchange="setRecursiveQueryEnabled(this.checked)">' +
|
|
755
|
+
'<span class="cli-toggle-slider"></span>' +
|
|
756
|
+
'</label>' +
|
|
757
|
+
'</div>' +
|
|
758
|
+
'<p class="cli-setting-desc">' + t('cli.recursiveQueryDesc') + '</p>' +
|
|
759
|
+
'</div>' +
|
|
760
|
+
'<div class="cli-setting-item' + (!smartContextEnabled ? ' disabled' : '') + '">' +
|
|
761
|
+
'<label class="cli-setting-label">' +
|
|
762
|
+
'<i data-lucide="files" class="w-3 h-3"></i>' +
|
|
763
|
+
t('cli.maxContextFiles') +
|
|
764
|
+
'</label>' +
|
|
765
|
+
'<div class="cli-setting-control">' +
|
|
766
|
+
'<select class="cli-setting-select" onchange="setSmartContextMaxFiles(this.value)"' + (!smartContextEnabled ? ' disabled' : '') + '>' +
|
|
767
|
+
'<option value="5"' + (smartContextMaxFiles === 5 ? ' selected' : '') + '>5 files</option>' +
|
|
768
|
+
'<option value="10"' + (smartContextMaxFiles === 10 ? ' selected' : '') + '>10 files</option>' +
|
|
769
|
+
'<option value="20"' + (smartContextMaxFiles === 20 ? ' selected' : '') + '>20 files</option>' +
|
|
770
|
+
'</select>' +
|
|
771
|
+
'</div>' +
|
|
772
|
+
'<p class="cli-setting-desc">' + t('cli.maxContextFilesDesc') + '</p>' +
|
|
773
|
+
'</div>' +
|
|
774
|
+
'</div>';
|
|
775
|
+
|
|
776
|
+
container.innerHTML = settingsHtml;
|
|
777
|
+
if (window.lucide) lucide.createIcons();
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// ========== CCW Endpoint Tools Section (Full Width) ==========
|
|
781
|
+
function renderCcwEndpointToolsSection() {
|
|
782
|
+
var container = document.getElementById('ccw-endpoint-tools-section');
|
|
783
|
+
if (!container) return;
|
|
784
|
+
|
|
785
|
+
var count = (ccwEndpointTools || []).length;
|
|
786
|
+
var toolsHtml = '';
|
|
787
|
+
|
|
788
|
+
if (!ccwEndpointTools || ccwEndpointTools.length === 0) {
|
|
789
|
+
toolsHtml = '<div class="ccw-empty-state">' +
|
|
790
|
+
'<i data-lucide="wrench" class="w-8 h-8"></i>' +
|
|
791
|
+
'<p>' + t('ccw.noEndpointTools') + '</p>' +
|
|
792
|
+
'<button class="btn btn-sm btn-primary" onclick="loadCcwEndpointTools().then(function() { renderCcwEndpointToolsSection(); if (window.lucide) lucide.createIcons(); })">' +
|
|
793
|
+
'<i data-lucide="refresh-cw" class="w-3 h-3"></i> ' + t('common.refresh') + '</button>' +
|
|
794
|
+
'</div>';
|
|
795
|
+
} else {
|
|
796
|
+
toolsHtml = '<div class="endpoint-tools-grid">' +
|
|
797
|
+
ccwEndpointTools.map(function(t, idx) {
|
|
798
|
+
var name = t && t.name ? String(t.name) : 'unknown';
|
|
799
|
+
var desc = t && t.description ? String(t.description) : '';
|
|
800
|
+
var requiredCount = (t && t.parameters && Array.isArray(t.parameters.required)) ? t.parameters.required.length : 0;
|
|
801
|
+
var propsCount = (t && t.parameters && t.parameters.properties) ? Object.keys(t.parameters.properties).length : 0;
|
|
802
|
+
var shortDesc = desc.length > 60 ? desc.substring(0, 60) + '...' : desc;
|
|
803
|
+
|
|
804
|
+
return '<div class="endpoint-tool-card" onclick="showEndpointToolDetail(' + idx + ')">' +
|
|
805
|
+
'<div class="endpoint-tool-header">' +
|
|
806
|
+
'<span class="endpoint-tool-dot"></span>' +
|
|
807
|
+
'<span class="endpoint-tool-name">' + escapeHtml(name) + '</span>' +
|
|
808
|
+
'</div>' +
|
|
809
|
+
'<div class="endpoint-tool-desc">' + escapeHtml(shortDesc || 'No description') + '</div>' +
|
|
810
|
+
'<div class="endpoint-tool-meta">' +
|
|
811
|
+
'<span class="endpoint-tool-params">' +
|
|
812
|
+
'<i data-lucide="braces" class="w-3 h-3"></i> ' + propsCount +
|
|
813
|
+
'</span>' +
|
|
814
|
+
(requiredCount > 0 ? '<span class="endpoint-tool-required">' + requiredCount + ' required</span>' : '') +
|
|
815
|
+
'</div>' +
|
|
816
|
+
'</div>';
|
|
817
|
+
}).join('') +
|
|
818
|
+
'</div>';
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
container.innerHTML = '<div class="section-header">' +
|
|
822
|
+
'<div class="section-header-left">' +
|
|
823
|
+
'<h3><i data-lucide="server" class="w-4 h-4"></i> ' + t('ccw.endpointTools') + '</h3>' +
|
|
824
|
+
'<span class="section-count">' + count + ' ' + (count !== 1 ? t('ccw.tools') : t('ccw.tool')) + '</span>' +
|
|
825
|
+
'</div>' +
|
|
826
|
+
'<button class="btn-icon" onclick="loadCcwEndpointTools().then(function() { renderCcwEndpointToolsSection(); if (window.lucide) lucide.createIcons(); })" title="Refresh">' +
|
|
827
|
+
'<i data-lucide="refresh-cw" class="w-4 h-4"></i>' +
|
|
828
|
+
'</button>' +
|
|
829
|
+
'</div>' +
|
|
830
|
+
toolsHtml;
|
|
831
|
+
|
|
832
|
+
if (window.lucide) lucide.createIcons();
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
// ========== Endpoint Tool Detail Modal ==========
|
|
836
|
+
function showEndpointToolDetail(toolIndex) {
|
|
837
|
+
var tool = ccwEndpointTools[toolIndex];
|
|
838
|
+
if (!tool) return;
|
|
839
|
+
|
|
840
|
+
var name = tool.name || 'unknown';
|
|
841
|
+
var desc = tool.description || 'No description available';
|
|
842
|
+
var params = tool.parameters || {};
|
|
843
|
+
var properties = params.properties || {};
|
|
844
|
+
var required = params.required || [];
|
|
845
|
+
|
|
846
|
+
// Build parameters table
|
|
847
|
+
var paramsHtml = '';
|
|
848
|
+
var propKeys = Object.keys(properties);
|
|
849
|
+
|
|
850
|
+
if (propKeys.length > 0) {
|
|
851
|
+
paramsHtml = '<div class="tool-detail-params">' +
|
|
852
|
+
'<h4><i data-lucide="settings-2" class="w-4 h-4"></i> Parameters</h4>' +
|
|
853
|
+
'<div class="tool-params-list">';
|
|
854
|
+
|
|
855
|
+
for (var i = 0; i < propKeys.length; i++) {
|
|
856
|
+
var key = propKeys[i];
|
|
857
|
+
var prop = properties[key];
|
|
858
|
+
var isRequired = required.indexOf(key) !== -1;
|
|
859
|
+
var propType = prop.type || 'any';
|
|
860
|
+
var propDesc = prop.description || '';
|
|
861
|
+
var propDefault = prop.default !== undefined ? JSON.stringify(prop.default) : null;
|
|
862
|
+
var propEnum = prop.enum ? prop.enum.join(', ') : null;
|
|
863
|
+
|
|
864
|
+
paramsHtml += '<div class="tool-param-item">' +
|
|
865
|
+
'<div class="tool-param-header">' +
|
|
866
|
+
'<code class="tool-param-name">' + escapeHtml(key) + '</code>' +
|
|
867
|
+
'<span class="tool-param-type">' + escapeHtml(propType) + '</span>' +
|
|
868
|
+
(isRequired ? '<span class="tool-param-required">required</span>' : '<span class="tool-param-optional">optional</span>') +
|
|
869
|
+
'</div>' +
|
|
870
|
+
(propDesc ? '<div class="tool-param-desc">' + escapeHtml(propDesc) + '</div>' : '') +
|
|
871
|
+
(propDefault ? '<div class="tool-param-default">Default: <code>' + escapeHtml(propDefault) + '</code></div>' : '') +
|
|
872
|
+
(propEnum ? '<div class="tool-param-enum">Options: <code>' + escapeHtml(propEnum) + '</code></div>' : '') +
|
|
873
|
+
'</div>';
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
paramsHtml += '</div></div>';
|
|
877
|
+
} else {
|
|
878
|
+
paramsHtml = '<div class="tool-detail-no-params">' +
|
|
879
|
+
'<i data-lucide="info" class="w-4 h-4"></i>' +
|
|
880
|
+
'<span>This tool has no parameters</span>' +
|
|
881
|
+
'</div>';
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// Usage example
|
|
885
|
+
var usageExample = 'ccw tool exec ' + name;
|
|
886
|
+
if (propKeys.length > 0) {
|
|
887
|
+
var exampleParams = {};
|
|
888
|
+
for (var j = 0; j < Math.min(propKeys.length, 2); j++) {
|
|
889
|
+
var k = propKeys[j];
|
|
890
|
+
var p = properties[k];
|
|
891
|
+
if (p.type === 'string') exampleParams[k] = '<value>';
|
|
892
|
+
else if (p.type === 'boolean') exampleParams[k] = true;
|
|
893
|
+
else if (p.type === 'number') exampleParams[k] = 0;
|
|
894
|
+
else exampleParams[k] = '<value>';
|
|
895
|
+
}
|
|
896
|
+
usageExample += " '" + JSON.stringify(exampleParams) + "'";
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
var modalContent = '<div class="tool-detail-modal">' +
|
|
900
|
+
'<div class="tool-detail-header">' +
|
|
901
|
+
'<div class="tool-detail-icon"><i data-lucide="terminal" class="w-6 h-6"></i></div>' +
|
|
902
|
+
'<div class="tool-detail-title">' +
|
|
903
|
+
'<h3>' + escapeHtml(name) + '</h3>' +
|
|
904
|
+
'<span class="tool-detail-badge">endpoint tool</span>' +
|
|
905
|
+
'</div>' +
|
|
906
|
+
'</div>' +
|
|
907
|
+
'<div class="tool-detail-desc">' + escapeHtml(desc) + '</div>' +
|
|
908
|
+
paramsHtml +
|
|
909
|
+
'<div class="tool-detail-usage">' +
|
|
910
|
+
'<h4><i data-lucide="terminal-square" class="w-4 h-4"></i> Usage Example</h4>' +
|
|
911
|
+
'<div class="tool-usage-code">' +
|
|
912
|
+
'<code>' + escapeHtml(usageExample) + '</code>' +
|
|
913
|
+
'<button class="tool-copy-btn" onclick="copyToolUsage(this, \'' + escapeHtml(usageExample.replace(/'/g, "\\'")) + '\')" title="Copy">' +
|
|
914
|
+
'<i data-lucide="copy" class="w-3.5 h-3.5"></i>' +
|
|
915
|
+
'</button>' +
|
|
916
|
+
'</div>' +
|
|
917
|
+
'</div>' +
|
|
918
|
+
'</div>';
|
|
919
|
+
|
|
920
|
+
showModal(name, modalContent, { size: 'lg' });
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
function copyToolUsage(btn, text) {
|
|
924
|
+
navigator.clipboard.writeText(text).then(function() {
|
|
925
|
+
var icon = btn.querySelector('i');
|
|
926
|
+
if (icon) {
|
|
927
|
+
icon.setAttribute('data-lucide', 'check');
|
|
928
|
+
if (window.lucide) lucide.createIcons();
|
|
929
|
+
setTimeout(function() {
|
|
930
|
+
icon.setAttribute('data-lucide', 'copy');
|
|
931
|
+
if (window.lucide) lucide.createIcons();
|
|
932
|
+
}, 2000);
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// CCW Install Carousel State
|
|
938
|
+
var ccwCarouselIndex = 0;
|
|
939
|
+
|
|
940
|
+
function renderCcwInstallPanel() {
|
|
941
|
+
var container = document.getElementById('ccw-install-panel');
|
|
942
|
+
if (!container) return;
|
|
943
|
+
|
|
944
|
+
var html = '<div class="cli-status-header"><h3><i data-lucide="package" class="w-4 h-4"></i> CCW Installations</h3>' +
|
|
945
|
+
'<div class="ccw-header-actions">' +
|
|
946
|
+
'<button class="btn-icon" onclick="showCcwInstallModal()" title="Add Installation">' +
|
|
947
|
+
'<i data-lucide="plus" class="w-4 h-4"></i></button>' +
|
|
948
|
+
'<button class="btn-icon" onclick="loadCcwInstallations().then(function() { renderCcwInstallPanel(); })" title="Refresh">' +
|
|
949
|
+
'<i data-lucide="refresh-cw" class="w-4 h-4"></i></button>' +
|
|
950
|
+
'</div></div>' +
|
|
951
|
+
'<div class="ccw-install-content">';
|
|
952
|
+
|
|
953
|
+
if (ccwInstallations.length === 0) {
|
|
954
|
+
html += '<div class="ccw-empty-state">' +
|
|
955
|
+
'<i data-lucide="package-x" class="w-8 h-8"></i>' +
|
|
956
|
+
'<p>No installations found</p>' +
|
|
957
|
+
'<button class="btn btn-sm btn-primary" onclick="showCcwInstallModal()">' +
|
|
958
|
+
'<i data-lucide="download" class="w-3 h-3"></i> Install CCW</button></div>';
|
|
959
|
+
} else {
|
|
960
|
+
// Carousel container
|
|
961
|
+
html += '<div class="ccw-carousel-wrapper">';
|
|
962
|
+
|
|
963
|
+
// Left arrow (show only if more than 1 installation)
|
|
964
|
+
if (ccwInstallations.length > 1) {
|
|
965
|
+
html += '<button class="ccw-carousel-btn ccw-carousel-prev" onclick="ccwCarouselPrev()" title="Previous">' +
|
|
966
|
+
'<i data-lucide="chevron-left" class="w-4 h-4"></i></button>';
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
html += '<div class="ccw-carousel-track" id="ccwCarouselTrack">';
|
|
970
|
+
|
|
971
|
+
for (var i = 0; i < ccwInstallations.length; i++) {
|
|
972
|
+
var inst = ccwInstallations[i];
|
|
973
|
+
var isGlobal = inst.installation_mode === 'Global';
|
|
974
|
+
var modeIcon = isGlobal ? 'home' : 'folder';
|
|
975
|
+
var version = inst.application_version || 'unknown';
|
|
976
|
+
var installDate = new Date(inst.installation_date).toLocaleDateString();
|
|
977
|
+
var activeClass = i === ccwCarouselIndex ? 'active' : '';
|
|
978
|
+
|
|
979
|
+
html += '<div class="ccw-carousel-card ' + activeClass + '" data-index="' + i + '">' +
|
|
980
|
+
'<div class="ccw-card-header">' +
|
|
981
|
+
'<div class="ccw-card-mode ' + (isGlobal ? 'global' : 'path') + '">' +
|
|
982
|
+
'<i data-lucide="' + modeIcon + '" class="w-4 h-4"></i>' +
|
|
983
|
+
'<span>' + inst.installation_mode + '</span>' +
|
|
984
|
+
'</div>' +
|
|
985
|
+
'<div class="ccw-card-header-right">' +
|
|
986
|
+
'<span class="ccw-version-tag">v' + version + '</span>' +
|
|
987
|
+
'<button class="btn-icon btn-icon-sm" onclick="runCcwUpgrade()" title="Upgrade">' +
|
|
988
|
+
'<i data-lucide="arrow-up-circle" class="w-3.5 h-3.5"></i></button>' +
|
|
989
|
+
'<button class="btn-icon btn-icon-sm btn-danger" onclick="confirmCcwUninstall(\'' + escapeHtml(inst.installation_path) + '\')" title="Uninstall">' +
|
|
990
|
+
'<i data-lucide="trash-2" class="w-3.5 h-3.5"></i></button>' +
|
|
991
|
+
'</div>' +
|
|
992
|
+
'</div>' +
|
|
993
|
+
'<div class="ccw-card-path" title="' + inst.installation_path + '">' + escapeHtml(inst.installation_path) + '</div>' +
|
|
994
|
+
'<div class="ccw-card-meta">' +
|
|
995
|
+
'<span><i data-lucide="calendar" class="w-3 h-3"></i> ' + installDate + '</span>' +
|
|
996
|
+
'<span><i data-lucide="file" class="w-3 h-3"></i> ' + (inst.files_count || 0) + ' files</span>' +
|
|
997
|
+
'</div>' +
|
|
998
|
+
'</div>';
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
html += '</div>';
|
|
1002
|
+
|
|
1003
|
+
// Right arrow (show only if more than 1 installation)
|
|
1004
|
+
if (ccwInstallations.length > 1) {
|
|
1005
|
+
html += '<button class="ccw-carousel-btn ccw-carousel-next" onclick="ccwCarouselNext()" title="Next">' +
|
|
1006
|
+
'<i data-lucide="chevron-right" class="w-4 h-4"></i></button>';
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
html += '</div>';
|
|
1010
|
+
|
|
1011
|
+
// Dots indicator (show only if more than 1 installation)
|
|
1012
|
+
if (ccwInstallations.length > 1) {
|
|
1013
|
+
html += '<div class="ccw-carousel-dots">';
|
|
1014
|
+
for (var j = 0; j < ccwInstallations.length; j++) {
|
|
1015
|
+
var dotActive = j === ccwCarouselIndex ? 'active' : '';
|
|
1016
|
+
html += '<button class="ccw-carousel-dot ' + dotActive + '" onclick="ccwCarouselGoTo(' + j + ')"></button>';
|
|
1017
|
+
}
|
|
1018
|
+
html += '</div>';
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
html += '</div>';
|
|
1023
|
+
container.innerHTML = html;
|
|
1024
|
+
if (window.lucide) lucide.createIcons();
|
|
1025
|
+
|
|
1026
|
+
// Update carousel position
|
|
1027
|
+
updateCcwCarouselPosition();
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
function ccwCarouselPrev() {
|
|
1031
|
+
if (ccwCarouselIndex > 0) {
|
|
1032
|
+
ccwCarouselIndex--;
|
|
1033
|
+
updateCcwCarouselPosition();
|
|
1034
|
+
updateCcwCarouselDots();
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
function ccwCarouselNext() {
|
|
1039
|
+
if (ccwCarouselIndex < ccwInstallations.length - 1) {
|
|
1040
|
+
ccwCarouselIndex++;
|
|
1041
|
+
updateCcwCarouselPosition();
|
|
1042
|
+
updateCcwCarouselDots();
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
function ccwCarouselGoTo(index) {
|
|
1047
|
+
ccwCarouselIndex = index;
|
|
1048
|
+
updateCcwCarouselPosition();
|
|
1049
|
+
updateCcwCarouselDots();
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
function updateCcwCarouselPosition() {
|
|
1053
|
+
var track = document.getElementById('ccwCarouselTrack');
|
|
1054
|
+
if (track) {
|
|
1055
|
+
track.style.transform = 'translateX(-' + (ccwCarouselIndex * 100) + '%)';
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// Update card active states
|
|
1059
|
+
var cards = document.querySelectorAll('.ccw-carousel-card');
|
|
1060
|
+
cards.forEach(function(card, idx) {
|
|
1061
|
+
card.classList.toggle('active', idx === ccwCarouselIndex);
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
function updateCcwCarouselDots() {
|
|
1066
|
+
var dots = document.querySelectorAll('.ccw-carousel-dot');
|
|
1067
|
+
dots.forEach(function(dot, idx) {
|
|
1068
|
+
dot.classList.toggle('active', idx === ccwCarouselIndex);
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// CCW Install Modal
|
|
1073
|
+
function showCcwInstallModal() {
|
|
1074
|
+
var modalContent = '<div class="ccw-install-modal">' +
|
|
1075
|
+
'<div class="ccw-install-options">' +
|
|
1076
|
+
'<div class="ccw-install-option" onclick="selectCcwInstallMode(\'Global\')">' +
|
|
1077
|
+
'<div class="ccw-option-icon global"><i data-lucide="home" class="w-6 h-6"></i></div>' +
|
|
1078
|
+
'<div class="ccw-option-info">' +
|
|
1079
|
+
'<div class="ccw-option-title">Global Installation</div>' +
|
|
1080
|
+
'<div class="ccw-option-desc">Install to user home directory (~/.claude)</div>' +
|
|
1081
|
+
'</div>' +
|
|
1082
|
+
'<i data-lucide="chevron-right" class="w-4 h-4 text-muted-foreground"></i>' +
|
|
1083
|
+
'</div>' +
|
|
1084
|
+
'<div class="ccw-install-option" onclick="toggleCcwPathInput()">' +
|
|
1085
|
+
'<div class="ccw-option-icon path"><i data-lucide="folder" class="w-6 h-6"></i></div>' +
|
|
1086
|
+
'<div class="ccw-option-info">' +
|
|
1087
|
+
'<div class="ccw-option-title">Path Installation</div>' +
|
|
1088
|
+
'<div class="ccw-option-desc">Install to a specific project folder</div>' +
|
|
1089
|
+
'</div>' +
|
|
1090
|
+
'<i data-lucide="chevron-right" class="w-4 h-4 text-muted-foreground"></i>' +
|
|
1091
|
+
'</div>' +
|
|
1092
|
+
'</div>' +
|
|
1093
|
+
'<div class="ccw-path-input-section hidden" id="ccwPathInputSection">' +
|
|
1094
|
+
'<div class="ccw-path-input-group">' +
|
|
1095
|
+
'<label>Installation Path</label>' +
|
|
1096
|
+
'<input type="text" id="ccwInstallPath" class="cli-textarea" placeholder="D:/projects/my-project" value="' + (projectPath || '') + '">' +
|
|
1097
|
+
'</div>' +
|
|
1098
|
+
'<div class="ccw-install-action">' +
|
|
1099
|
+
'<button class="btn btn-primary" onclick="executeCcwInstall()">' +
|
|
1100
|
+
'<i data-lucide="download" class="w-4 h-4"></i> Install to Path</button>' +
|
|
1101
|
+
'</div>' +
|
|
1102
|
+
'</div>' +
|
|
1103
|
+
'</div>';
|
|
1104
|
+
|
|
1105
|
+
showModal('Install CCW', modalContent);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
function selectCcwInstallMode(mode) {
|
|
1109
|
+
if (mode === 'Global') {
|
|
1110
|
+
closeModal();
|
|
1111
|
+
runCcwInstall('Global');
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
function toggleCcwPathInput() {
|
|
1116
|
+
var section = document.getElementById('ccwPathInputSection');
|
|
1117
|
+
if (section) {
|
|
1118
|
+
section.classList.toggle('hidden');
|
|
1119
|
+
if (!section.classList.contains('hidden')) {
|
|
1120
|
+
var input = document.getElementById('ccwInstallPath');
|
|
1121
|
+
if (input) input.focus();
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
function executeCcwInstall() {
|
|
1127
|
+
var input = document.getElementById('ccwInstallPath');
|
|
1128
|
+
var path = input ? input.value.trim() : '';
|
|
1129
|
+
|
|
1130
|
+
if (!path) {
|
|
1131
|
+
showRefreshToast('Please enter a path', 'error');
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
closeModal();
|
|
1136
|
+
runCcwInstall('Path', path);
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
function truncatePath(path) {
|
|
1140
|
+
if (!path) return '';
|
|
1141
|
+
var maxLen = 35;
|
|
1142
|
+
if (path.length <= maxLen) return path;
|
|
1143
|
+
return '...' + path.slice(-maxLen + 3);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
function renderCliExecutePanel() {
|
|
1147
|
+
var container = document.getElementById('cli-execute-panel');
|
|
1148
|
+
if (!container) return;
|
|
1149
|
+
|
|
1150
|
+
var tools = ['gemini', 'qwen', 'codex'];
|
|
1151
|
+
var modes = ['analysis', 'write', 'auto'];
|
|
1152
|
+
|
|
1153
|
+
var html = '<div class="cli-execute-header"><h3>Quick Execute</h3></div>' +
|
|
1154
|
+
'<div class="cli-execute-form"><div class="cli-execute-row">' +
|
|
1155
|
+
'<div class="cli-form-group"><label for="cli-exec-tool">Tool</label>' +
|
|
1156
|
+
'<select id="cli-exec-tool" class="cli-select">';
|
|
1157
|
+
for (var i = 0; i < tools.length; i++) {
|
|
1158
|
+
var tool = tools[i];
|
|
1159
|
+
var selected = tool === defaultCliTool ? 'selected' : '';
|
|
1160
|
+
html += '<option value="' + tool + '" ' + selected + '>' + tool.charAt(0).toUpperCase() + tool.slice(1) + '</option>';
|
|
1161
|
+
}
|
|
1162
|
+
html += '</select></div>' +
|
|
1163
|
+
'<div class="cli-form-group"><label for="cli-exec-mode">Mode</label>' +
|
|
1164
|
+
'<select id="cli-exec-mode" class="cli-select">';
|
|
1165
|
+
for (var j = 0; j < modes.length; j++) {
|
|
1166
|
+
var mode = modes[j];
|
|
1167
|
+
var sel = mode === 'analysis' ? 'selected' : '';
|
|
1168
|
+
html += '<option value="' + mode + '" ' + sel + '>' + mode.charAt(0).toUpperCase() + mode.slice(1) + '</option>';
|
|
1169
|
+
}
|
|
1170
|
+
html += '</select></div></div>' +
|
|
1171
|
+
'<div class="cli-form-group"><label for="cli-exec-prompt">Prompt</label>' +
|
|
1172
|
+
'<textarea id="cli-exec-prompt" class="cli-textarea" placeholder="Enter your prompt..."></textarea></div>' +
|
|
1173
|
+
'<div class="cli-execute-actions">' +
|
|
1174
|
+
'<button class="btn btn-primary" onclick="executeCliFromDashboard()" ' + (currentCliExecution ? 'disabled' : '') + '>' +
|
|
1175
|
+
'<i data-lucide="play" class="w-4 h-4"></i> Execute</button></div></div>';
|
|
1176
|
+
container.innerHTML = html;
|
|
1177
|
+
if (window.lucide) lucide.createIcons();
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// ========== CCW Actions ==========
|
|
1181
|
+
function runCcwInstall(mode, customPath) {
|
|
1182
|
+
var command;
|
|
1183
|
+
if (mode === 'Global') {
|
|
1184
|
+
command = 'ccw install --mode Global';
|
|
1185
|
+
} else {
|
|
1186
|
+
var installPath = customPath || projectPath;
|
|
1187
|
+
command = 'ccw install --mode Path --path "' + installPath + '"';
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
// Copy command to clipboard
|
|
1191
|
+
if (navigator.clipboard) {
|
|
1192
|
+
navigator.clipboard.writeText(command).then(function() {
|
|
1193
|
+
showRefreshToast('Command copied: ' + command, 'success');
|
|
1194
|
+
}).catch(function() {
|
|
1195
|
+
showRefreshToast('Run: ' + command, 'info');
|
|
1196
|
+
});
|
|
1197
|
+
} else {
|
|
1198
|
+
showRefreshToast('Run: ' + command, 'info');
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
async function runCcwUpgrade() {
|
|
1203
|
+
showRefreshToast(t('ccw.upgradeStarting'), 'info');
|
|
1204
|
+
|
|
1205
|
+
try {
|
|
1206
|
+
var response = await fetch('/api/ccw/upgrade', {
|
|
1207
|
+
method: 'POST',
|
|
1208
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1209
|
+
body: JSON.stringify({})
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
var result = await response.json();
|
|
1213
|
+
|
|
1214
|
+
if (result.success) {
|
|
1215
|
+
showRefreshToast(t('ccw.upgradeCompleted'), 'success');
|
|
1216
|
+
// Reload installations after upgrade
|
|
1217
|
+
setTimeout(function() {
|
|
1218
|
+
loadCcwInstallations().then(function() {
|
|
1219
|
+
renderCcwInstallPanel();
|
|
1220
|
+
});
|
|
1221
|
+
}, 1000);
|
|
1222
|
+
} else {
|
|
1223
|
+
showRefreshToast(t('ccw.upgradeFailed', { error: result.error || 'Unknown error' }), 'error');
|
|
1224
|
+
}
|
|
1225
|
+
} catch (err) {
|
|
1226
|
+
showRefreshToast(t('ccw.upgradeFailed', { error: err.message }), 'error');
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
function confirmCcwUninstall(installPath) {
|
|
1231
|
+
if (confirm(t('ccw.uninstallConfirm') + '\n' + (installPath || 'Current installation'))) {
|
|
1232
|
+
var command = installPath
|
|
1233
|
+
? 'ccw uninstall --path "' + installPath + '"'
|
|
1234
|
+
: 'ccw uninstall';
|
|
1235
|
+
|
|
1236
|
+
if (navigator.clipboard) {
|
|
1237
|
+
navigator.clipboard.writeText(command).then(function() {
|
|
1238
|
+
showRefreshToast('Command copied: ' + command, 'success');
|
|
1239
|
+
}).catch(function() {
|
|
1240
|
+
showRefreshToast('Run: ' + command, 'info');
|
|
1241
|
+
});
|
|
1242
|
+
} else {
|
|
1243
|
+
showRefreshToast('Run: ' + command, 'info');
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
// ========== Execution ==========
|
|
1249
|
+
async function executeCliFromDashboard() {
|
|
1250
|
+
var toolEl = document.getElementById('cli-exec-tool');
|
|
1251
|
+
var modeEl = document.getElementById('cli-exec-mode');
|
|
1252
|
+
var promptEl = document.getElementById('cli-exec-prompt');
|
|
1253
|
+
|
|
1254
|
+
var tool = toolEl ? toolEl.value : 'gemini';
|
|
1255
|
+
var mode = modeEl ? modeEl.value : 'analysis';
|
|
1256
|
+
var prompt = promptEl ? promptEl.value.trim() : '';
|
|
1257
|
+
|
|
1258
|
+
if (!prompt) {
|
|
1259
|
+
showRefreshToast(t('toast.enterPrompt'), 'error');
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
currentCliExecution = { tool: tool, mode: mode, prompt: prompt, startTime: Date.now() };
|
|
1264
|
+
cliExecutionOutput = '';
|
|
1265
|
+
|
|
1266
|
+
var outputPanel = document.getElementById('cli-output-panel');
|
|
1267
|
+
var outputContent = document.getElementById('cli-output-content');
|
|
1268
|
+
var statusIndicator = document.getElementById('cli-output-status-indicator');
|
|
1269
|
+
var statusText = document.getElementById('cli-output-status-text');
|
|
1270
|
+
|
|
1271
|
+
if (outputPanel) outputPanel.classList.remove('hidden');
|
|
1272
|
+
if (outputContent) outputContent.textContent = '';
|
|
1273
|
+
if (statusIndicator) statusIndicator.className = 'status-indicator running';
|
|
1274
|
+
if (statusText) statusText.textContent = 'Running...';
|
|
1275
|
+
|
|
1276
|
+
var execBtn = document.querySelector('.cli-execute-actions .btn-primary');
|
|
1277
|
+
if (execBtn) execBtn.disabled = true;
|
|
1278
|
+
|
|
1279
|
+
try {
|
|
1280
|
+
var response = await fetch('/api/cli/execute', {
|
|
1281
|
+
method: 'POST',
|
|
1282
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1283
|
+
body: JSON.stringify({
|
|
1284
|
+
tool: tool,
|
|
1285
|
+
mode: mode,
|
|
1286
|
+
prompt: prompt,
|
|
1287
|
+
dir: projectPath,
|
|
1288
|
+
format: promptConcatFormat,
|
|
1289
|
+
smartContext: {
|
|
1290
|
+
enabled: smartContextEnabled,
|
|
1291
|
+
maxFiles: smartContextMaxFiles
|
|
1292
|
+
}
|
|
1293
|
+
})
|
|
1294
|
+
});
|
|
1295
|
+
var result = await response.json();
|
|
1296
|
+
|
|
1297
|
+
if (statusIndicator) statusIndicator.className = 'status-indicator ' + (result.success ? 'success' : 'error');
|
|
1298
|
+
if (statusText) {
|
|
1299
|
+
var duration = formatDuration(result.execution ? result.execution.duration_ms : (Date.now() - currentCliExecution.startTime));
|
|
1300
|
+
statusText.textContent = result.success ? 'Completed in ' + duration : 'Failed: ' + (result.error || 'Unknown');
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
await loadCliHistory();
|
|
1304
|
+
renderCliHistory();
|
|
1305
|
+
showRefreshToast(result.success ? t('toast.completed') : (result.error || t('toast.failed')), result.success ? 'success' : 'error');
|
|
1306
|
+
} catch (error) {
|
|
1307
|
+
if (statusIndicator) statusIndicator.className = 'status-indicator error';
|
|
1308
|
+
if (statusText) statusText.textContent = 'Error: ' + error.message;
|
|
1309
|
+
showRefreshToast(t('toast.error', { error: error.message }), 'error');
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
currentCliExecution = null;
|
|
1313
|
+
if (execBtn) execBtn.disabled = false;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// ========== WebSocket Event Handlers ==========
|
|
1317
|
+
function handleCliExecutionStarted(payload) {
|
|
1318
|
+
currentCliExecution = {
|
|
1319
|
+
executionId: payload.executionId,
|
|
1320
|
+
tool: payload.tool,
|
|
1321
|
+
mode: payload.mode,
|
|
1322
|
+
startTime: new Date(payload.timestamp).getTime()
|
|
1323
|
+
};
|
|
1324
|
+
cliExecutionOutput = '';
|
|
1325
|
+
|
|
1326
|
+
// Show toast notification
|
|
1327
|
+
if (typeof addGlobalNotification === 'function') {
|
|
1328
|
+
addGlobalNotification('info', 'CLI ' + payload.tool + ' started', payload.mode + ' mode', 'CLI');
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
if (currentView === 'cli-manager') {
|
|
1332
|
+
var outputPanel = document.getElementById('cli-output-panel');
|
|
1333
|
+
var outputContent = document.getElementById('cli-output-content');
|
|
1334
|
+
var statusIndicator = document.getElementById('cli-output-status-indicator');
|
|
1335
|
+
var statusText = document.getElementById('cli-output-status-text');
|
|
1336
|
+
|
|
1337
|
+
if (outputPanel) outputPanel.classList.remove('hidden');
|
|
1338
|
+
if (outputContent) outputContent.textContent = '';
|
|
1339
|
+
if (statusIndicator) statusIndicator.className = 'status-indicator running';
|
|
1340
|
+
if (statusText) statusText.textContent = 'Running ' + payload.tool + ' (' + payload.mode + ')...';
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
function handleCliOutput(payload) {
|
|
1345
|
+
cliExecutionOutput += payload.data;
|
|
1346
|
+
var outputContent = document.getElementById('cli-output-content');
|
|
1347
|
+
if (outputContent) {
|
|
1348
|
+
outputContent.textContent = cliExecutionOutput;
|
|
1349
|
+
outputContent.scrollTop = outputContent.scrollHeight;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
function handleCliExecutionCompleted(payload) {
|
|
1354
|
+
var statusIndicator = document.getElementById('cli-output-status-indicator');
|
|
1355
|
+
var statusText = document.getElementById('cli-output-status-text');
|
|
1356
|
+
|
|
1357
|
+
if (statusIndicator) statusIndicator.className = 'status-indicator ' + (payload.success ? 'success' : 'error');
|
|
1358
|
+
if (statusText) statusText.textContent = payload.success ? 'Completed in ' + formatDuration(payload.duration_ms) : 'Failed: ' + payload.status;
|
|
1359
|
+
|
|
1360
|
+
// Show toast notification
|
|
1361
|
+
if (typeof addGlobalNotification === 'function') {
|
|
1362
|
+
if (payload.success) {
|
|
1363
|
+
addGlobalNotification('success', 'CLI execution completed', formatDuration(payload.duration_ms), 'CLI');
|
|
1364
|
+
} else {
|
|
1365
|
+
addGlobalNotification('error', 'CLI execution failed', payload.status, 'CLI');
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
currentCliExecution = null;
|
|
1370
|
+
if (currentView === 'cli-manager') {
|
|
1371
|
+
loadCliHistory().then(function() { renderCliHistory(); });
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
function handleCliExecutionError(payload) {
|
|
1376
|
+
var statusIndicator = document.getElementById('cli-output-status-indicator');
|
|
1377
|
+
var statusText = document.getElementById('cli-output-status-text');
|
|
1378
|
+
|
|
1379
|
+
if (statusIndicator) statusIndicator.className = 'status-indicator error';
|
|
1380
|
+
if (statusText) statusText.textContent = 'Error: ' + payload.error;
|
|
1381
|
+
|
|
1382
|
+
// Show toast notification
|
|
1383
|
+
if (typeof addGlobalNotification === 'function') {
|
|
1384
|
+
addGlobalNotification('error', 'CLI execution error', payload.error, 'CLI');
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
currentCliExecution = null;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// ========== CLI Tool Install/Uninstall Wizards ==========
|
|
1391
|
+
function openCliInstallWizard(toolName) {
|
|
1392
|
+
var toolDescriptions = {
|
|
1393
|
+
gemini: 'Google AI for code analysis and generation',
|
|
1394
|
+
qwen: 'Alibaba AI assistant for coding',
|
|
1395
|
+
codex: 'OpenAI code generation and understanding',
|
|
1396
|
+
claude: 'Anthropic AI assistant'
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
var toolPackages = {
|
|
1400
|
+
gemini: '@google/gemini-cli',
|
|
1401
|
+
qwen: '@qwen-code/qwen-code',
|
|
1402
|
+
codex: '@openai/codex',
|
|
1403
|
+
claude: '@anthropic-ai/claude-code'
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
var modal = document.createElement('div');
|
|
1407
|
+
modal.id = 'cliInstallModal';
|
|
1408
|
+
modal.className = 'fixed inset-0 bg-black/50 flex items-center justify-center z-50';
|
|
1409
|
+
modal.innerHTML =
|
|
1410
|
+
'<div class="bg-card rounded-lg shadow-xl w-full max-w-md mx-4 overflow-hidden">' +
|
|
1411
|
+
'<div class="p-6">' +
|
|
1412
|
+
'<div class="flex items-center gap-3 mb-4">' +
|
|
1413
|
+
'<div class="w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center">' +
|
|
1414
|
+
'<i data-lucide="download" class="w-5 h-5 text-primary"></i>' +
|
|
1415
|
+
'</div>' +
|
|
1416
|
+
'<div>' +
|
|
1417
|
+
'<h3 class="text-lg font-semibold">Install ' + toolName.charAt(0).toUpperCase() + toolName.slice(1) + '</h3>' +
|
|
1418
|
+
'<p class="text-sm text-muted-foreground">' + (toolDescriptions[toolName] || 'CLI tool') + '</p>' +
|
|
1419
|
+
'</div>' +
|
|
1420
|
+
'</div>' +
|
|
1421
|
+
'<div class="space-y-4">' +
|
|
1422
|
+
'<div class="bg-muted/50 rounded-lg p-4">' +
|
|
1423
|
+
'<h4 class="font-medium mb-2">What will be installed:</h4>' +
|
|
1424
|
+
'<ul class="text-sm space-y-2 text-muted-foreground">' +
|
|
1425
|
+
'<li class="flex items-start gap-2">' +
|
|
1426
|
+
'<i data-lucide="check" class="w-4 h-4 text-success mt-0.5"></i>' +
|
|
1427
|
+
'<span><strong>NPM Package:</strong> <code class="bg-muted px-1 rounded">' + (toolPackages[toolName] || toolName) + '</code></span>' +
|
|
1428
|
+
'</li>' +
|
|
1429
|
+
'<li class="flex items-start gap-2">' +
|
|
1430
|
+
'<i data-lucide="check" class="w-4 h-4 text-success mt-0.5"></i>' +
|
|
1431
|
+
'<span><strong>Global installation</strong> - Available system-wide</span>' +
|
|
1432
|
+
'</li>' +
|
|
1433
|
+
'<li class="flex items-start gap-2">' +
|
|
1434
|
+
'<i data-lucide="check" class="w-4 h-4 text-success mt-0.5"></i>' +
|
|
1435
|
+
'<span><strong>CLI commands</strong> - Accessible from terminal</span>' +
|
|
1436
|
+
'</li>' +
|
|
1437
|
+
'</ul>' +
|
|
1438
|
+
'</div>' +
|
|
1439
|
+
'<div class="bg-primary/5 border border-primary/20 rounded-lg p-3">' +
|
|
1440
|
+
'<div class="flex items-start gap-2">' +
|
|
1441
|
+
'<i data-lucide="info" class="w-4 h-4 text-primary mt-0.5"></i>' +
|
|
1442
|
+
'<div class="text-sm text-muted-foreground">' +
|
|
1443
|
+
'<p class="font-medium text-foreground">Installation Method</p>' +
|
|
1444
|
+
'<p class="mt-1">Uses <code class="bg-muted px-1 rounded">npm install -g</code></p>' +
|
|
1445
|
+
'<p class="mt-1">First installation may take 1-2 minutes depending on network speed.</p>' +
|
|
1446
|
+
'</div>' +
|
|
1447
|
+
'</div>' +
|
|
1448
|
+
'</div>' +
|
|
1449
|
+
'<div id="cliInstallProgress" class="hidden">' +
|
|
1450
|
+
'<div class="flex items-center gap-3">' +
|
|
1451
|
+
'<div class="animate-spin w-5 h-5 border-2 border-primary border-t-transparent rounded-full"></div>' +
|
|
1452
|
+
'<span class="text-sm" id="cliInstallStatus">Starting installation...</span>' +
|
|
1453
|
+
'</div>' +
|
|
1454
|
+
'<div class="mt-2 h-2 bg-muted rounded-full overflow-hidden">' +
|
|
1455
|
+
'<div id="cliInstallProgressBar" class="h-full bg-primary transition-all duration-300" style="width: 0%"></div>' +
|
|
1456
|
+
'</div>' +
|
|
1457
|
+
'</div>' +
|
|
1458
|
+
'</div>' +
|
|
1459
|
+
'</div>' +
|
|
1460
|
+
'<div class="border-t border-border p-4 flex justify-end gap-3 bg-muted/30">' +
|
|
1461
|
+
'<button class="btn-outline px-4 py-2" onclick="closeCliInstallWizard()">Cancel</button>' +
|
|
1462
|
+
'<button id="cliInstallBtn" class="btn-primary px-4 py-2" onclick="startCliInstall(\'' + toolName + '\')">' +
|
|
1463
|
+
'<i data-lucide="download" class="w-4 h-4 mr-2"></i>' +
|
|
1464
|
+
'Install Now' +
|
|
1465
|
+
'</button>' +
|
|
1466
|
+
'</div>' +
|
|
1467
|
+
'</div>';
|
|
1468
|
+
|
|
1469
|
+
document.body.appendChild(modal);
|
|
1470
|
+
|
|
1471
|
+
if (window.lucide) {
|
|
1472
|
+
lucide.createIcons();
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
function closeCliInstallWizard() {
|
|
1477
|
+
var modal = document.getElementById('cliInstallModal');
|
|
1478
|
+
if (modal) {
|
|
1479
|
+
modal.remove();
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
async function startCliInstall(toolName) {
|
|
1484
|
+
var progressDiv = document.getElementById('cliInstallProgress');
|
|
1485
|
+
var installBtn = document.getElementById('cliInstallBtn');
|
|
1486
|
+
var statusText = document.getElementById('cliInstallStatus');
|
|
1487
|
+
var progressBar = document.getElementById('cliInstallProgressBar');
|
|
1488
|
+
|
|
1489
|
+
progressDiv.classList.remove('hidden');
|
|
1490
|
+
installBtn.disabled = true;
|
|
1491
|
+
installBtn.innerHTML = '<span class="animate-pulse">Installing...</span>';
|
|
1492
|
+
|
|
1493
|
+
var stages = [
|
|
1494
|
+
{ progress: 20, text: 'Connecting to NPM registry...' },
|
|
1495
|
+
{ progress: 40, text: 'Downloading package...' },
|
|
1496
|
+
{ progress: 60, text: 'Installing dependencies...' },
|
|
1497
|
+
{ progress: 80, text: 'Setting up CLI commands...' },
|
|
1498
|
+
{ progress: 95, text: 'Finalizing installation...' }
|
|
1499
|
+
];
|
|
1500
|
+
|
|
1501
|
+
var currentStage = 0;
|
|
1502
|
+
var progressInterval = setInterval(function() {
|
|
1503
|
+
if (currentStage < stages.length) {
|
|
1504
|
+
statusText.textContent = stages[currentStage].text;
|
|
1505
|
+
progressBar.style.width = stages[currentStage].progress + '%';
|
|
1506
|
+
currentStage++;
|
|
1507
|
+
}
|
|
1508
|
+
}, 1000);
|
|
1509
|
+
|
|
1510
|
+
try {
|
|
1511
|
+
var response = await fetch('/api/cli/install', {
|
|
1512
|
+
method: 'POST',
|
|
1513
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1514
|
+
body: JSON.stringify({ tool: toolName })
|
|
1515
|
+
});
|
|
1516
|
+
|
|
1517
|
+
clearInterval(progressInterval);
|
|
1518
|
+
var result = await response.json();
|
|
1519
|
+
|
|
1520
|
+
if (result.success) {
|
|
1521
|
+
progressBar.style.width = '100%';
|
|
1522
|
+
statusText.textContent = 'Installation complete!';
|
|
1523
|
+
|
|
1524
|
+
setTimeout(function() {
|
|
1525
|
+
closeCliInstallWizard();
|
|
1526
|
+
showRefreshToast(toolName + ' installed successfully!', 'success');
|
|
1527
|
+
loadCliToolStatus().then(function() {
|
|
1528
|
+
renderToolsSection();
|
|
1529
|
+
if (window.lucide) lucide.createIcons();
|
|
1530
|
+
});
|
|
1531
|
+
}, 1000);
|
|
1532
|
+
} else {
|
|
1533
|
+
statusText.textContent = 'Error: ' + result.error;
|
|
1534
|
+
progressBar.classList.add('bg-destructive');
|
|
1535
|
+
installBtn.disabled = false;
|
|
1536
|
+
installBtn.innerHTML = '<i data-lucide="refresh-cw" class="w-4 h-4 mr-2"></i> Retry';
|
|
1537
|
+
if (window.lucide) lucide.createIcons();
|
|
1538
|
+
}
|
|
1539
|
+
} catch (err) {
|
|
1540
|
+
clearInterval(progressInterval);
|
|
1541
|
+
statusText.textContent = 'Error: ' + err.message;
|
|
1542
|
+
progressBar.classList.add('bg-destructive');
|
|
1543
|
+
installBtn.disabled = false;
|
|
1544
|
+
installBtn.innerHTML = '<i data-lucide="refresh-cw" class="w-4 h-4 mr-2"></i> Retry';
|
|
1545
|
+
if (window.lucide) lucide.createIcons();
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
function openCliUninstallWizard(toolName) {
|
|
1550
|
+
var modal = document.createElement('div');
|
|
1551
|
+
modal.id = 'cliUninstallModal';
|
|
1552
|
+
modal.className = 'fixed inset-0 bg-black/50 flex items-center justify-center z-50';
|
|
1553
|
+
modal.innerHTML =
|
|
1554
|
+
'<div class="bg-card rounded-lg shadow-xl w-full max-w-md mx-4 overflow-hidden">' +
|
|
1555
|
+
'<div class="p-6">' +
|
|
1556
|
+
'<div class="flex items-center gap-3 mb-4">' +
|
|
1557
|
+
'<div class="w-10 h-10 rounded-full bg-destructive/10 flex items-center justify-center">' +
|
|
1558
|
+
'<i data-lucide="trash-2" class="w-5 h-5 text-destructive"></i>' +
|
|
1559
|
+
'</div>' +
|
|
1560
|
+
'<div>' +
|
|
1561
|
+
'<h3 class="text-lg font-semibold">Uninstall ' + toolName.charAt(0).toUpperCase() + toolName.slice(1) + '</h3>' +
|
|
1562
|
+
'<p class="text-sm text-muted-foreground">Remove CLI tool from system</p>' +
|
|
1563
|
+
'</div>' +
|
|
1564
|
+
'</div>' +
|
|
1565
|
+
'<div class="space-y-4">' +
|
|
1566
|
+
'<div class="bg-destructive/5 border border-destructive/20 rounded-lg p-4">' +
|
|
1567
|
+
'<h4 class="font-medium text-destructive mb-2">What will be removed:</h4>' +
|
|
1568
|
+
'<ul class="text-sm space-y-2 text-muted-foreground">' +
|
|
1569
|
+
'<li class="flex items-start gap-2">' +
|
|
1570
|
+
'<i data-lucide="x" class="w-4 h-4 text-destructive mt-0.5"></i>' +
|
|
1571
|
+
'<span>Global NPM package</span>' +
|
|
1572
|
+
'</li>' +
|
|
1573
|
+
'<li class="flex items-start gap-2">' +
|
|
1574
|
+
'<i data-lucide="x" class="w-4 h-4 text-destructive mt-0.5"></i>' +
|
|
1575
|
+
'<span>CLI commands and executables</span>' +
|
|
1576
|
+
'</li>' +
|
|
1577
|
+
'<li class="flex items-start gap-2">' +
|
|
1578
|
+
'<i data-lucide="x" class="w-4 h-4 text-destructive mt-0.5"></i>' +
|
|
1579
|
+
'<span>Tool configuration (if any)</span>' +
|
|
1580
|
+
'</li>' +
|
|
1581
|
+
'</ul>' +
|
|
1582
|
+
'</div>' +
|
|
1583
|
+
'<div class="bg-warning/10 border border-warning/20 rounded-lg p-3">' +
|
|
1584
|
+
'<div class="flex items-start gap-2">' +
|
|
1585
|
+
'<i data-lucide="alert-triangle" class="w-4 h-4 text-warning mt-0.5"></i>' +
|
|
1586
|
+
'<div class="text-sm">' +
|
|
1587
|
+
'<p class="font-medium text-warning">Note</p>' +
|
|
1588
|
+
'<p class="text-muted-foreground">You can reinstall this tool anytime from the CLI Manager.</p>' +
|
|
1589
|
+
'</div>' +
|
|
1590
|
+
'</div>' +
|
|
1591
|
+
'</div>' +
|
|
1592
|
+
'<div id="cliUninstallProgress" class="hidden">' +
|
|
1593
|
+
'<div class="flex items-center gap-3">' +
|
|
1594
|
+
'<div class="animate-spin w-5 h-5 border-2 border-destructive border-t-transparent rounded-full"></div>' +
|
|
1595
|
+
'<span class="text-sm" id="cliUninstallStatus">Removing package...</span>' +
|
|
1596
|
+
'</div>' +
|
|
1597
|
+
'<div class="mt-2 h-2 bg-muted rounded-full overflow-hidden">' +
|
|
1598
|
+
'<div id="cliUninstallProgressBar" class="h-full bg-destructive transition-all duration-300" style="width: 0%"></div>' +
|
|
1599
|
+
'</div>' +
|
|
1600
|
+
'</div>' +
|
|
1601
|
+
'</div>' +
|
|
1602
|
+
'</div>' +
|
|
1603
|
+
'<div class="border-t border-border p-4 flex justify-end gap-3 bg-muted/30">' +
|
|
1604
|
+
'<button class="btn-outline px-4 py-2" onclick="closeCliUninstallWizard()">Cancel</button>' +
|
|
1605
|
+
'<button id="cliUninstallBtn" class="btn-destructive px-4 py-2" onclick="startCliUninstall(\'' + toolName + '\')">' +
|
|
1606
|
+
'<i data-lucide="trash-2" class="w-4 h-4 mr-2"></i>' +
|
|
1607
|
+
'Uninstall' +
|
|
1608
|
+
'</button>' +
|
|
1609
|
+
'</div>' +
|
|
1610
|
+
'</div>';
|
|
1611
|
+
|
|
1612
|
+
document.body.appendChild(modal);
|
|
1613
|
+
|
|
1614
|
+
if (window.lucide) {
|
|
1615
|
+
lucide.createIcons();
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
function closeCliUninstallWizard() {
|
|
1620
|
+
var modal = document.getElementById('cliUninstallModal');
|
|
1621
|
+
if (modal) {
|
|
1622
|
+
modal.remove();
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
async function startCliUninstall(toolName) {
|
|
1627
|
+
var progressDiv = document.getElementById('cliUninstallProgress');
|
|
1628
|
+
var uninstallBtn = document.getElementById('cliUninstallBtn');
|
|
1629
|
+
var statusText = document.getElementById('cliUninstallStatus');
|
|
1630
|
+
var progressBar = document.getElementById('cliUninstallProgressBar');
|
|
1631
|
+
|
|
1632
|
+
progressDiv.classList.remove('hidden');
|
|
1633
|
+
uninstallBtn.disabled = true;
|
|
1634
|
+
uninstallBtn.innerHTML = '<span class="animate-pulse">Uninstalling...</span>';
|
|
1635
|
+
|
|
1636
|
+
var stages = [
|
|
1637
|
+
{ progress: 33, text: 'Removing package files...' },
|
|
1638
|
+
{ progress: 66, text: 'Cleaning up dependencies...' },
|
|
1639
|
+
{ progress: 90, text: 'Finalizing removal...' }
|
|
1640
|
+
];
|
|
1641
|
+
|
|
1642
|
+
var currentStage = 0;
|
|
1643
|
+
var progressInterval = setInterval(function() {
|
|
1644
|
+
if (currentStage < stages.length) {
|
|
1645
|
+
statusText.textContent = stages[currentStage].text;
|
|
1646
|
+
progressBar.style.width = stages[currentStage].progress + '%';
|
|
1647
|
+
currentStage++;
|
|
1648
|
+
}
|
|
1649
|
+
}, 500);
|
|
1650
|
+
|
|
1651
|
+
try {
|
|
1652
|
+
var response = await fetch('/api/cli/uninstall', {
|
|
1653
|
+
method: 'POST',
|
|
1654
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1655
|
+
body: JSON.stringify({ tool: toolName })
|
|
1656
|
+
});
|
|
1657
|
+
|
|
1658
|
+
clearInterval(progressInterval);
|
|
1659
|
+
var result = await response.json();
|
|
1660
|
+
|
|
1661
|
+
if (result.success) {
|
|
1662
|
+
progressBar.style.width = '100%';
|
|
1663
|
+
statusText.textContent = 'Uninstallation complete!';
|
|
1664
|
+
|
|
1665
|
+
setTimeout(function() {
|
|
1666
|
+
closeCliUninstallWizard();
|
|
1667
|
+
showRefreshToast(toolName + ' uninstalled successfully!', 'success');
|
|
1668
|
+
loadCliToolStatus().then(function() {
|
|
1669
|
+
renderToolsSection();
|
|
1670
|
+
if (window.lucide) lucide.createIcons();
|
|
1671
|
+
});
|
|
1672
|
+
}, 1000);
|
|
1673
|
+
} else {
|
|
1674
|
+
statusText.textContent = 'Error: ' + result.error;
|
|
1675
|
+
progressBar.classList.remove('bg-destructive');
|
|
1676
|
+
progressBar.classList.add('bg-destructive');
|
|
1677
|
+
uninstallBtn.disabled = false;
|
|
1678
|
+
uninstallBtn.innerHTML = '<i data-lucide="refresh-cw" class="w-4 h-4 mr-2"></i> Retry';
|
|
1679
|
+
if (window.lucide) lucide.createIcons();
|
|
1680
|
+
}
|
|
1681
|
+
} catch (err) {
|
|
1682
|
+
clearInterval(progressInterval);
|
|
1683
|
+
statusText.textContent = 'Error: ' + err.message;
|
|
1684
|
+
progressBar.classList.remove('bg-destructive');
|
|
1685
|
+
progressBar.classList.add('bg-destructive');
|
|
1686
|
+
uninstallBtn.disabled = false;
|
|
1687
|
+
uninstallBtn.innerHTML = '<i data-lucide="refresh-cw" class="w-4 h-4 mr-2"></i> Retry';
|
|
1688
|
+
if (window.lucide) lucide.createIcons();
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
// ========== CodexLens Configuration Modal ==========
|
|
1693
|
+
async function showCodexLensConfigModal() {
|
|
1694
|
+
var loadingContent = '<div class="text-center py-8">' +
|
|
1695
|
+
'<div class="animate-spin w-8 h-8 border-2 border-primary border-t-transparent rounded-full mx-auto mb-4"></div>' +
|
|
1696
|
+
'<p class="text-muted-foreground">' + t('codexlens.loadingConfig') + '</p>' +
|
|
1697
|
+
'</div>';
|
|
1698
|
+
|
|
1699
|
+
showModal(t('codexlens.config'), loadingContent, { size: 'md' });
|
|
1700
|
+
|
|
1701
|
+
try {
|
|
1702
|
+
// Fetch current configuration
|
|
1703
|
+
var response = await fetch('/api/codexlens/config');
|
|
1704
|
+
var config = await response.json();
|
|
1705
|
+
|
|
1706
|
+
var content = buildCodexLensConfigContent(config);
|
|
1707
|
+
showModal('CodexLens Configuration', content, { size: 'md' });
|
|
1708
|
+
|
|
1709
|
+
setTimeout(function() {
|
|
1710
|
+
initCodexLensConfigEvents(config);
|
|
1711
|
+
if (window.lucide) lucide.createIcons();
|
|
1712
|
+
}, 100);
|
|
1713
|
+
} catch (err) {
|
|
1714
|
+
var errorContent = '<div class="bg-destructive/10 border border-destructive/20 rounded-lg p-4">' +
|
|
1715
|
+
'<div class="flex items-start gap-2">' +
|
|
1716
|
+
'<i data-lucide="alert-circle" class="w-5 h-5 text-destructive mt-0.5"></i>' +
|
|
1717
|
+
'<div>' +
|
|
1718
|
+
'<p class="font-medium text-destructive">Failed to load configuration</p>' +
|
|
1719
|
+
'<p class="text-sm text-muted-foreground mt-1">' + err.message + '</p>' +
|
|
1720
|
+
'</div>' +
|
|
1721
|
+
'</div>' +
|
|
1722
|
+
'</div>';
|
|
1723
|
+
showModal('CodexLens Configuration', errorContent, { size: 'md' });
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
function buildCodexLensConfigContent(config) {
|
|
1728
|
+
var status = codexLensStatus || {};
|
|
1729
|
+
var isInstalled = status.ready;
|
|
1730
|
+
var indexDir = config.index_dir || '~/.codexlens/indexes';
|
|
1731
|
+
var currentWorkspace = config.current_workspace || 'None';
|
|
1732
|
+
var indexCount = config.index_count || 0;
|
|
1733
|
+
|
|
1734
|
+
return '<div class="tool-config-modal">' +
|
|
1735
|
+
// Status Section
|
|
1736
|
+
'<div class="tool-config-section">' +
|
|
1737
|
+
'<h4>' + t('codexlens.status') + '</h4>' +
|
|
1738
|
+
'<div class="tool-config-badges">' +
|
|
1739
|
+
'<span class="badge ' + (isInstalled ? 'badge-success' : 'badge-muted') + '">' +
|
|
1740
|
+
'<i data-lucide="' + (isInstalled ? 'check-circle' : 'circle-dashed') + '" class="w-3 h-3"></i> ' +
|
|
1741
|
+
(isInstalled ? t('codexlens.installed') : t('codexlens.notInstalled')) +
|
|
1742
|
+
'</span>' +
|
|
1743
|
+
'<span class="badge badge-primary">' +
|
|
1744
|
+
'<i data-lucide="database" class="w-3 h-3"></i> ' + indexCount + ' ' + t('codexlens.indexes') +
|
|
1745
|
+
'</span>' +
|
|
1746
|
+
'</div>' +
|
|
1747
|
+
(currentWorkspace !== 'None'
|
|
1748
|
+
? '<div class="mt-3 p-3 bg-muted/30 rounded-lg">' +
|
|
1749
|
+
'<p class="text-sm text-muted-foreground mb-1">' + t('codexlens.currentWorkspace') + ':</p>' +
|
|
1750
|
+
'<p class="text-sm font-mono break-all">' + escapeHtml(currentWorkspace) + '</p>' +
|
|
1751
|
+
'</div>'
|
|
1752
|
+
: '') +
|
|
1753
|
+
'</div>' +
|
|
1754
|
+
|
|
1755
|
+
// Index Storage Path Section
|
|
1756
|
+
'<div class="tool-config-section">' +
|
|
1757
|
+
'<h4>' + t('codexlens.indexStoragePath') + ' <span class="text-muted">(' + t('codexlens.whereIndexesStored') + ')</span></h4>' +
|
|
1758
|
+
'<div class="space-y-3">' +
|
|
1759
|
+
'<div class="bg-muted/30 rounded-lg p-3">' +
|
|
1760
|
+
'<p class="text-sm text-muted-foreground mb-2">' + t('codexlens.currentPath') + ':</p>' +
|
|
1761
|
+
'<p class="text-sm font-mono break-all bg-background px-2 py-1 rounded border border-border">' +
|
|
1762
|
+
escapeHtml(indexDir) +
|
|
1763
|
+
'</p>' +
|
|
1764
|
+
'</div>' +
|
|
1765
|
+
'<div>' +
|
|
1766
|
+
'<label class="text-sm font-medium mb-2 block">' + t('codexlens.newStoragePath') + ':</label>' +
|
|
1767
|
+
'<input type="text" id="indexDirInput" class="tool-config-input w-full" ' +
|
|
1768
|
+
'placeholder="' + t('codexlens.pathPlaceholder') + '" ' +
|
|
1769
|
+
'value="' + escapeHtml(indexDir) + '" />' +
|
|
1770
|
+
'<p class="text-xs text-muted-foreground mt-2">' +
|
|
1771
|
+
'<i data-lucide="info" class="w-3 h-3 inline"></i> ' +
|
|
1772
|
+
t('codexlens.pathInfo') +
|
|
1773
|
+
'</p>' +
|
|
1774
|
+
'</div>' +
|
|
1775
|
+
'<div class="bg-warning/10 border border-warning/20 rounded-lg p-3">' +
|
|
1776
|
+
'<div class="flex items-start gap-2">' +
|
|
1777
|
+
'<i data-lucide="alert-triangle" class="w-4 h-4 text-warning mt-0.5"></i>' +
|
|
1778
|
+
'<div class="text-sm">' +
|
|
1779
|
+
'<p class="font-medium text-warning">' + t('codexlens.migrationRequired') + '</p>' +
|
|
1780
|
+
'<p class="text-muted-foreground mt-1">' + t('codexlens.migrationWarning') + '</p>' +
|
|
1781
|
+
'</div>' +
|
|
1782
|
+
'</div>' +
|
|
1783
|
+
'</div>' +
|
|
1784
|
+
'</div>' +
|
|
1785
|
+
'</div>' +
|
|
1786
|
+
|
|
1787
|
+
// Actions Section
|
|
1788
|
+
'<div class="tool-config-section">' +
|
|
1789
|
+
'<h4>' + t('codexlens.actions') + '</h4>' +
|
|
1790
|
+
'<div class="tool-config-actions">' +
|
|
1791
|
+
(isInstalled
|
|
1792
|
+
? '<button class="btn-sm btn-outline" onclick="event.stopPropagation(); initCodexLensIndex()">' +
|
|
1793
|
+
'<i data-lucide="database" class="w-3 h-3"></i> ' + t('codexlens.initializeIndex') +
|
|
1794
|
+
'</button>' +
|
|
1795
|
+
'<button class="btn-sm btn-outline" onclick="event.stopPropagation(); cleanCurrentWorkspaceIndex()">' +
|
|
1796
|
+
'<i data-lucide="folder-x" class="w-3 h-3"></i> ' + t('codexlens.cleanCurrentWorkspace') +
|
|
1797
|
+
'</button>' +
|
|
1798
|
+
'<button class="btn-sm btn-outline" onclick="event.stopPropagation(); cleanCodexLensIndexes()">' +
|
|
1799
|
+
'<i data-lucide="trash" class="w-3 h-3"></i> ' + t('codexlens.cleanAllIndexes') +
|
|
1800
|
+
'</button>' +
|
|
1801
|
+
'<button class="btn-sm btn-outline btn-danger" onclick="event.stopPropagation(); uninstallCodexLens()">' +
|
|
1802
|
+
'<i data-lucide="trash-2" class="w-3 h-3"></i> ' + t('cli.uninstall') +
|
|
1803
|
+
'</button>'
|
|
1804
|
+
: '<button class="btn-sm btn-primary" onclick="event.stopPropagation(); installCodexLens()">' +
|
|
1805
|
+
'<i data-lucide="download" class="w-3 h-3"></i> ' + t('codexlens.installCodexLens') +
|
|
1806
|
+
'</button>') +
|
|
1807
|
+
'</div>' +
|
|
1808
|
+
'</div>' +
|
|
1809
|
+
|
|
1810
|
+
// Semantic Dependencies Section
|
|
1811
|
+
(isInstalled
|
|
1812
|
+
? '<div class="tool-config-section">' +
|
|
1813
|
+
'<h4>' + t('codexlens.semanticDeps') + '</h4>' +
|
|
1814
|
+
'<div id="semanticDepsStatus" class="space-y-2">' +
|
|
1815
|
+
'<div class="text-sm text-muted-foreground">' + t('codexlens.checkingDeps') + '</div>' +
|
|
1816
|
+
'</div>' +
|
|
1817
|
+
'</div>'
|
|
1818
|
+
: '') +
|
|
1819
|
+
|
|
1820
|
+
// Model Management Section
|
|
1821
|
+
(isInstalled
|
|
1822
|
+
? '<div class="tool-config-section">' +
|
|
1823
|
+
'<h4>' + t('codexlens.modelManagement') + '</h4>' +
|
|
1824
|
+
'<div id="modelListContainer" class="space-y-2">' +
|
|
1825
|
+
'<div class="text-sm text-muted-foreground">' + t('codexlens.loadingModels') + '</div>' +
|
|
1826
|
+
'</div>' +
|
|
1827
|
+
'</div>'
|
|
1828
|
+
: '') +
|
|
1829
|
+
|
|
1830
|
+
// Test Search Section
|
|
1831
|
+
(isInstalled
|
|
1832
|
+
? '<div class="tool-config-section">' +
|
|
1833
|
+
'<h4>' + t('codexlens.testSearch') + ' <span class="text-muted">(' + t('codexlens.testFunctionality') + ')</span></h4>' +
|
|
1834
|
+
'<div class="space-y-3">' +
|
|
1835
|
+
'<div class="flex gap-2">' +
|
|
1836
|
+
'<select id="searchTypeSelect" class="tool-config-select flex-1">' +
|
|
1837
|
+
'<option value="search">' + t('codexlens.textSearch') + '</option>' +
|
|
1838
|
+
'<option value="search_files">' + t('codexlens.fileSearch') + '</option>' +
|
|
1839
|
+
'<option value="symbol">' + t('codexlens.symbolSearch') + '</option>' +
|
|
1840
|
+
'</select>' +
|
|
1841
|
+
'<select id="searchModeSelect" class="tool-config-select flex-1">' +
|
|
1842
|
+
'<option value="exact">' + t('codexlens.exactMode') + '</option>' +
|
|
1843
|
+
'<option value="fuzzy">' + t('codexlens.fuzzyMode') + '</option>' +
|
|
1844
|
+
'<option value="hybrid">' + t('codexlens.hybridMode') + '</option>' +
|
|
1845
|
+
'<option value="vector">' + t('codexlens.vectorMode') + '</option>' +
|
|
1846
|
+
'</select>' +
|
|
1847
|
+
'</div>' +
|
|
1848
|
+
'<div>' +
|
|
1849
|
+
'<input type="text" id="searchQueryInput" class="tool-config-input w-full" ' +
|
|
1850
|
+
'placeholder="' + t('codexlens.searchPlaceholder') + '" />' +
|
|
1851
|
+
'</div>' +
|
|
1852
|
+
'<div>' +
|
|
1853
|
+
'<button class="btn-sm btn-primary w-full" id="runSearchBtn">' +
|
|
1854
|
+
'<i data-lucide="search" class="w-3 h-3"></i> ' + t('codexlens.runSearch') +
|
|
1855
|
+
'</button>' +
|
|
1856
|
+
'</div>' +
|
|
1857
|
+
'<div id="searchResults" class="hidden">' +
|
|
1858
|
+
'<div class="bg-muted/30 rounded-lg p-3 max-h-64 overflow-y-auto">' +
|
|
1859
|
+
'<div class="flex items-center justify-between mb-2">' +
|
|
1860
|
+
'<p class="text-sm font-medium">' + t('codexlens.results') + ':</p>' +
|
|
1861
|
+
'<span id="searchResultCount" class="text-xs text-muted-foreground"></span>' +
|
|
1862
|
+
'</div>' +
|
|
1863
|
+
'<pre id="searchResultContent" class="text-xs font-mono whitespace-pre-wrap break-all"></pre>' +
|
|
1864
|
+
'</div>' +
|
|
1865
|
+
'</div>' +
|
|
1866
|
+
'</div>' +
|
|
1867
|
+
'</div>'
|
|
1868
|
+
: '') +
|
|
1869
|
+
|
|
1870
|
+
// Footer
|
|
1871
|
+
'<div class="tool-config-footer">' +
|
|
1872
|
+
'<button class="btn btn-outline" onclick="closeModal()">' + t('common.cancel') + '</button>' +
|
|
1873
|
+
'<button class="btn btn-primary" id="saveCodexLensConfigBtn">' +
|
|
1874
|
+
'<i data-lucide="save" class="w-3.5 h-3.5"></i> ' + t('codexlens.saveConfig') +
|
|
1875
|
+
'</button>' +
|
|
1876
|
+
'</div>' +
|
|
1877
|
+
'</div>';
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
function initCodexLensConfigEvents(currentConfig) {
|
|
1881
|
+
var saveBtn = document.getElementById('saveCodexLensConfigBtn');
|
|
1882
|
+
if (saveBtn) {
|
|
1883
|
+
saveBtn.onclick = async function() {
|
|
1884
|
+
var indexDirInput = document.getElementById('indexDirInput');
|
|
1885
|
+
var newIndexDir = indexDirInput ? indexDirInput.value.trim() : '';
|
|
1886
|
+
|
|
1887
|
+
if (!newIndexDir) {
|
|
1888
|
+
showRefreshToast(t('codexlens.pathEmpty'), 'error');
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
if (newIndexDir === currentConfig.index_dir) {
|
|
1893
|
+
closeModal();
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
saveBtn.disabled = true;
|
|
1898
|
+
saveBtn.innerHTML = '<span class="animate-pulse">' + t('common.saving') + '</span>';
|
|
1899
|
+
|
|
1900
|
+
try {
|
|
1901
|
+
var response = await fetch('/api/codexlens/config', {
|
|
1902
|
+
method: 'POST',
|
|
1903
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1904
|
+
body: JSON.stringify({ index_dir: newIndexDir })
|
|
1905
|
+
});
|
|
1906
|
+
|
|
1907
|
+
var result = await response.json();
|
|
1908
|
+
|
|
1909
|
+
if (result.success) {
|
|
1910
|
+
showRefreshToast(t('codexlens.configSaved'), 'success');
|
|
1911
|
+
closeModal();
|
|
1912
|
+
|
|
1913
|
+
// Refresh CodexLens status
|
|
1914
|
+
if (typeof loadCodexLensStatus === 'function') {
|
|
1915
|
+
await loadCodexLensStatus();
|
|
1916
|
+
renderToolsSection();
|
|
1917
|
+
if (window.lucide) lucide.createIcons();
|
|
1918
|
+
}
|
|
1919
|
+
} else {
|
|
1920
|
+
showRefreshToast(t('common.saveFailed') + ': ' + result.error, 'error');
|
|
1921
|
+
saveBtn.disabled = false;
|
|
1922
|
+
saveBtn.innerHTML = '<i data-lucide="save" class="w-3.5 h-3.5"></i> ' + t('codexlens.saveConfig');
|
|
1923
|
+
if (window.lucide) lucide.createIcons();
|
|
1924
|
+
}
|
|
1925
|
+
} catch (err) {
|
|
1926
|
+
showRefreshToast(t('common.error') + ': ' + err.message, 'error');
|
|
1927
|
+
saveBtn.disabled = false;
|
|
1928
|
+
saveBtn.innerHTML = '<i data-lucide="save" class="w-3.5 h-3.5"></i> ' + t('codexlens.saveConfig');
|
|
1929
|
+
if (window.lucide) lucide.createIcons();
|
|
1930
|
+
}
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
// Test Search Button
|
|
1935
|
+
var runSearchBtn = document.getElementById('runSearchBtn');
|
|
1936
|
+
if (runSearchBtn) {
|
|
1937
|
+
runSearchBtn.onclick = async function() {
|
|
1938
|
+
var searchType = document.getElementById('searchTypeSelect').value;
|
|
1939
|
+
var searchMode = document.getElementById('searchModeSelect').value;
|
|
1940
|
+
var query = document.getElementById('searchQueryInput').value.trim();
|
|
1941
|
+
var resultsDiv = document.getElementById('searchResults');
|
|
1942
|
+
var resultCount = document.getElementById('searchResultCount');
|
|
1943
|
+
var resultContent = document.getElementById('searchResultContent');
|
|
1944
|
+
|
|
1945
|
+
if (!query) {
|
|
1946
|
+
showRefreshToast(t('codexlens.enterQuery'), 'warning');
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
runSearchBtn.disabled = true;
|
|
1951
|
+
runSearchBtn.innerHTML = '<span class="animate-pulse">' + t('codexlens.searching') + '</span>';
|
|
1952
|
+
resultsDiv.classList.add('hidden');
|
|
1953
|
+
|
|
1954
|
+
try {
|
|
1955
|
+
var endpoint = '/api/codexlens/' + searchType;
|
|
1956
|
+
var params = new URLSearchParams({ query: query, limit: '20' });
|
|
1957
|
+
// Add mode parameter for search and search_files (not for symbol search)
|
|
1958
|
+
if (searchType === 'search' || searchType === 'search_files') {
|
|
1959
|
+
params.append('mode', searchMode);
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
var response = await fetch(endpoint + '?' + params.toString());
|
|
1963
|
+
var result = await response.json();
|
|
1964
|
+
|
|
1965
|
+
console.log('[CodexLens Test] Search result:', result);
|
|
1966
|
+
|
|
1967
|
+
if (result.success) {
|
|
1968
|
+
var results = result.results || result.files || [];
|
|
1969
|
+
resultCount.textContent = results.length + ' ' + t('codexlens.resultsCount');
|
|
1970
|
+
resultContent.textContent = JSON.stringify(results, null, 2);
|
|
1971
|
+
resultsDiv.classList.remove('hidden');
|
|
1972
|
+
showRefreshToast(t('codexlens.searchCompleted') + ': ' + results.length + ' ' + t('codexlens.resultsCount'), 'success');
|
|
1973
|
+
} else {
|
|
1974
|
+
resultContent.textContent = t('common.error') + ': ' + (result.error || t('common.unknownError'));
|
|
1975
|
+
resultsDiv.classList.remove('hidden');
|
|
1976
|
+
showRefreshToast(t('codexlens.searchFailed') + ': ' + result.error, 'error');
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
runSearchBtn.disabled = false;
|
|
1980
|
+
runSearchBtn.innerHTML = '<i data-lucide="search" class="w-3 h-3"></i> ' + t('codexlens.runSearch');
|
|
1981
|
+
if (window.lucide) lucide.createIcons();
|
|
1982
|
+
} catch (err) {
|
|
1983
|
+
console.error('[CodexLens Test] Error:', err);
|
|
1984
|
+
resultContent.textContent = t('common.exception') + ': ' + err.message;
|
|
1985
|
+
resultsDiv.classList.remove('hidden');
|
|
1986
|
+
showRefreshToast(t('common.error') + ': ' + err.message, 'error');
|
|
1987
|
+
runSearchBtn.disabled = false;
|
|
1988
|
+
runSearchBtn.innerHTML = '<i data-lucide="search" class="w-3 h-3"></i> ' + t('codexlens.runSearch');
|
|
1989
|
+
if (window.lucide) lucide.createIcons();
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
// Load semantic dependencies status
|
|
1995
|
+
loadSemanticDepsStatus();
|
|
1996
|
+
|
|
1997
|
+
// Load model list
|
|
1998
|
+
loadModelList();
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
// Load semantic dependencies status
|
|
2002
|
+
async function loadSemanticDepsStatus() {
|
|
2003
|
+
var container = document.getElementById('semanticDepsStatus');
|
|
2004
|
+
if (!container) return;
|
|
2005
|
+
|
|
2006
|
+
try {
|
|
2007
|
+
var response = await fetch('/api/codexlens/semantic/status');
|
|
2008
|
+
var result = await response.json();
|
|
2009
|
+
|
|
2010
|
+
if (result.available) {
|
|
2011
|
+
container.innerHTML =
|
|
2012
|
+
'<div class="flex items-center gap-2 text-sm">' +
|
|
2013
|
+
'<i data-lucide="check-circle" class="w-4 h-4 text-success"></i>' +
|
|
2014
|
+
'<span>' + t('codexlens.semanticInstalled') + '</span>' +
|
|
2015
|
+
'<span class="text-muted-foreground">(' + (result.backend || 'fastembed') + ')</span>' +
|
|
2016
|
+
'</div>';
|
|
2017
|
+
} else {
|
|
2018
|
+
container.innerHTML =
|
|
2019
|
+
'<div class="space-y-2">' +
|
|
2020
|
+
'<div class="flex items-center gap-2 text-sm text-muted-foreground">' +
|
|
2021
|
+
'<i data-lucide="alert-circle" class="w-4 h-4"></i>' +
|
|
2022
|
+
'<span>' + t('codexlens.semanticNotInstalled') + '</span>' +
|
|
2023
|
+
'</div>' +
|
|
2024
|
+
'<button class="btn-sm btn-outline" onclick="installSemanticDeps()">' +
|
|
2025
|
+
'<i data-lucide="download" class="w-3 h-3"></i> ' + t('codexlens.installDeps') +
|
|
2026
|
+
'</button>' +
|
|
2027
|
+
'</div>';
|
|
2028
|
+
}
|
|
2029
|
+
if (window.lucide) lucide.createIcons();
|
|
2030
|
+
} catch (err) {
|
|
2031
|
+
container.innerHTML =
|
|
2032
|
+
'<div class="text-sm text-error">' + t('common.error') + ': ' + err.message + '</div>';
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
// Install semantic dependencies
|
|
2037
|
+
async function installSemanticDeps() {
|
|
2038
|
+
var container = document.getElementById('semanticDepsStatus');
|
|
2039
|
+
if (!container) return;
|
|
2040
|
+
|
|
2041
|
+
container.innerHTML =
|
|
2042
|
+
'<div class="text-sm text-muted-foreground animate-pulse">' + t('codexlens.installingDeps') + '</div>';
|
|
2043
|
+
|
|
2044
|
+
try {
|
|
2045
|
+
var response = await fetch('/api/codexlens/semantic/install', { method: 'POST' });
|
|
2046
|
+
var result = await response.json();
|
|
2047
|
+
|
|
2048
|
+
if (result.success) {
|
|
2049
|
+
showRefreshToast(t('codexlens.depsInstalled'), 'success');
|
|
2050
|
+
await loadSemanticDepsStatus();
|
|
2051
|
+
await loadModelList();
|
|
2052
|
+
} else {
|
|
2053
|
+
showRefreshToast(t('codexlens.depsInstallFailed') + ': ' + result.error, 'error');
|
|
2054
|
+
await loadSemanticDepsStatus();
|
|
2055
|
+
}
|
|
2056
|
+
} catch (err) {
|
|
2057
|
+
showRefreshToast(t('common.error') + ': ' + err.message, 'error');
|
|
2058
|
+
await loadSemanticDepsStatus();
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
// Load model list
|
|
2063
|
+
async function loadModelList() {
|
|
2064
|
+
var container = document.getElementById('modelListContainer');
|
|
2065
|
+
if (!container) return;
|
|
2066
|
+
|
|
2067
|
+
try {
|
|
2068
|
+
var response = await fetch('/api/codexlens/models');
|
|
2069
|
+
var result = await response.json();
|
|
2070
|
+
|
|
2071
|
+
if (!result.success || !result.result || !result.result.models) {
|
|
2072
|
+
container.innerHTML =
|
|
2073
|
+
'<div class="text-sm text-muted-foreground">' + t('codexlens.semanticNotInstalled') + '</div>';
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
var models = result.result.models;
|
|
2078
|
+
var html = '<div class="space-y-2">';
|
|
2079
|
+
|
|
2080
|
+
models.forEach(function(model) {
|
|
2081
|
+
var statusIcon = model.installed
|
|
2082
|
+
? '<i data-lucide="check-circle" class="w-4 h-4 text-success"></i>'
|
|
2083
|
+
: '<i data-lucide="circle" class="w-4 h-4 text-muted"></i>';
|
|
2084
|
+
|
|
2085
|
+
var sizeText = model.installed
|
|
2086
|
+
? model.actual_size_mb.toFixed(1) + ' MB'
|
|
2087
|
+
: '~' + model.estimated_size_mb + ' MB';
|
|
2088
|
+
|
|
2089
|
+
var actionBtn = model.installed
|
|
2090
|
+
? '<button class="btn-sm btn-outline btn-danger" onclick="deleteModel(\'' + model.profile + '\')">' +
|
|
2091
|
+
'<i data-lucide="trash-2" class="w-3 h-3"></i> ' + t('codexlens.deleteModel') +
|
|
2092
|
+
'</button>'
|
|
2093
|
+
: '<button class="btn-sm btn-outline" onclick="downloadModel(\'' + model.profile + '\')">' +
|
|
2094
|
+
'<i data-lucide="download" class="w-3 h-3"></i> ' + t('codexlens.downloadModel') +
|
|
2095
|
+
'</button>';
|
|
2096
|
+
|
|
2097
|
+
html +=
|
|
2098
|
+
'<div class="border rounded-lg p-3 space-y-2" id="model-' + model.profile + '">' +
|
|
2099
|
+
'<div class="flex items-start justify-between">' +
|
|
2100
|
+
'<div class="flex-1">' +
|
|
2101
|
+
'<div class="flex items-center gap-2 mb-1">' +
|
|
2102
|
+
statusIcon +
|
|
2103
|
+
'<span class="font-medium">' + model.profile + '</span>' +
|
|
2104
|
+
'<span class="text-xs text-muted-foreground">(' + model.dimensions + ' dims)</span>' +
|
|
2105
|
+
'</div>' +
|
|
2106
|
+
'<div class="text-xs text-muted-foreground mb-1">' + model.model_name + '</div>' +
|
|
2107
|
+
'<div class="text-xs text-muted-foreground">' + model.use_case + '</div>' +
|
|
2108
|
+
'</div>' +
|
|
2109
|
+
'<div class="text-right">' +
|
|
2110
|
+
'<div class="text-xs text-muted-foreground mb-2">' + sizeText + '</div>' +
|
|
2111
|
+
actionBtn +
|
|
2112
|
+
'</div>' +
|
|
2113
|
+
'</div>' +
|
|
2114
|
+
'</div>';
|
|
2115
|
+
});
|
|
2116
|
+
|
|
2117
|
+
html += '</div>';
|
|
2118
|
+
container.innerHTML = html;
|
|
2119
|
+
if (window.lucide) lucide.createIcons();
|
|
2120
|
+
} catch (err) {
|
|
2121
|
+
container.innerHTML =
|
|
2122
|
+
'<div class="text-sm text-error">' + t('common.error') + ': ' + err.message + '</div>';
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
// Download model
|
|
2127
|
+
async function downloadModel(profile) {
|
|
2128
|
+
var modelCard = document.getElementById('model-' + profile);
|
|
2129
|
+
if (!modelCard) return;
|
|
2130
|
+
|
|
2131
|
+
var originalHTML = modelCard.innerHTML;
|
|
2132
|
+
modelCard.innerHTML =
|
|
2133
|
+
'<div class="flex items-center justify-center p-3">' +
|
|
2134
|
+
'<span class="text-sm text-muted-foreground animate-pulse">' + t('codexlens.downloading') + '</span>' +
|
|
2135
|
+
'</div>';
|
|
2136
|
+
|
|
2137
|
+
try {
|
|
2138
|
+
var response = await fetch('/api/codexlens/models/download', {
|
|
2139
|
+
method: 'POST',
|
|
2140
|
+
headers: { 'Content-Type': 'application/json' },
|
|
2141
|
+
body: JSON.stringify({ profile: profile })
|
|
2142
|
+
});
|
|
2143
|
+
|
|
2144
|
+
var result = await response.json();
|
|
2145
|
+
|
|
2146
|
+
if (result.success) {
|
|
2147
|
+
showRefreshToast(t('codexlens.modelDownloaded') + ': ' + profile, 'success');
|
|
2148
|
+
await loadModelList();
|
|
2149
|
+
} else {
|
|
2150
|
+
showRefreshToast(t('codexlens.modelDownloadFailed') + ': ' + result.error, 'error');
|
|
2151
|
+
modelCard.innerHTML = originalHTML;
|
|
2152
|
+
if (window.lucide) lucide.createIcons();
|
|
2153
|
+
}
|
|
2154
|
+
} catch (err) {
|
|
2155
|
+
showRefreshToast(t('common.error') + ': ' + err.message, 'error');
|
|
2156
|
+
modelCard.innerHTML = originalHTML;
|
|
2157
|
+
if (window.lucide) lucide.createIcons();
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
// Delete model
|
|
2162
|
+
async function deleteModel(profile) {
|
|
2163
|
+
if (!confirm(t('codexlens.deleteModelConfirm') + ' ' + profile + '?')) {
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
var modelCard = document.getElementById('model-' + profile);
|
|
2168
|
+
if (!modelCard) return;
|
|
2169
|
+
|
|
2170
|
+
var originalHTML = modelCard.innerHTML;
|
|
2171
|
+
modelCard.innerHTML =
|
|
2172
|
+
'<div class="flex items-center justify-center p-3">' +
|
|
2173
|
+
'<span class="text-sm text-muted-foreground animate-pulse">' + t('codexlens.deleting') + '</span>' +
|
|
2174
|
+
'</div>';
|
|
2175
|
+
|
|
2176
|
+
try {
|
|
2177
|
+
var response = await fetch('/api/codexlens/models/delete', {
|
|
2178
|
+
method: 'POST',
|
|
2179
|
+
headers: { 'Content-Type': 'application/json' },
|
|
2180
|
+
body: JSON.stringify({ profile: profile })
|
|
2181
|
+
});
|
|
2182
|
+
|
|
2183
|
+
var result = await response.json();
|
|
2184
|
+
|
|
2185
|
+
if (result.success) {
|
|
2186
|
+
showRefreshToast(t('codexlens.modelDeleted') + ': ' + profile, 'success');
|
|
2187
|
+
await loadModelList();
|
|
2188
|
+
} else {
|
|
2189
|
+
showRefreshToast(t('codexlens.modelDeleteFailed') + ': ' + result.error, 'error');
|
|
2190
|
+
modelCard.innerHTML = originalHTML;
|
|
2191
|
+
if (window.lucide) lucide.createIcons();
|
|
2192
|
+
}
|
|
2193
|
+
} catch (err) {
|
|
2194
|
+
showRefreshToast(t('common.error') + ': ' + err.message, 'error');
|
|
2195
|
+
modelCard.innerHTML = originalHTML;
|
|
2196
|
+
if (window.lucide) lucide.createIcons();
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Clean current workspace index
|
|
2201
|
+
*/
|
|
2202
|
+
async function cleanCurrentWorkspaceIndex() {
|
|
2203
|
+
if (!confirm(t('codexlens.cleanCurrentWorkspaceConfirm'))) {
|
|
2204
|
+
return;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
try {
|
|
2208
|
+
showRefreshToast(t('codexlens.cleaning'), 'info');
|
|
2209
|
+
|
|
2210
|
+
// Get current workspace path (projectPath is a global variable from state.js)
|
|
2211
|
+
var workspacePath = projectPath;
|
|
2212
|
+
|
|
2213
|
+
var response = await fetch('/api/codexlens/clean', {
|
|
2214
|
+
method: 'POST',
|
|
2215
|
+
headers: { 'Content-Type': 'application/json' },
|
|
2216
|
+
body: JSON.stringify({ path: workspacePath })
|
|
2217
|
+
});
|
|
2218
|
+
|
|
2219
|
+
var result = await response.json();
|
|
2220
|
+
|
|
2221
|
+
if (result.success) {
|
|
2222
|
+
showRefreshToast(t('codexlens.cleanCurrentWorkspaceSuccess'), 'success');
|
|
2223
|
+
|
|
2224
|
+
// Refresh status
|
|
2225
|
+
if (typeof loadCodexLensStatus === 'function') {
|
|
2226
|
+
await loadCodexLensStatus();
|
|
2227
|
+
renderToolsSection();
|
|
2228
|
+
if (window.lucide) lucide.createIcons();
|
|
2229
|
+
}
|
|
2230
|
+
} else {
|
|
2231
|
+
showRefreshToast(t('codexlens.cleanFailed') + ': ' + result.error, 'error');
|
|
2232
|
+
}
|
|
2233
|
+
} catch (err) {
|
|
2234
|
+
showRefreshToast(t('common.error') + ': ' + err.message, 'error');
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* Clean all CodexLens indexes
|
|
2240
|
+
*/
|
|
2241
|
+
async function cleanCodexLensIndexes() {
|
|
2242
|
+
if (!confirm(t('codexlens.cleanConfirm'))) {
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
try {
|
|
2247
|
+
showRefreshToast(t('codexlens.cleaning'), 'info');
|
|
2248
|
+
|
|
2249
|
+
var response = await fetch('/api/codexlens/clean', {
|
|
2250
|
+
method: 'POST',
|
|
2251
|
+
headers: { 'Content-Type': 'application/json' },
|
|
2252
|
+
body: JSON.stringify({ all: true })
|
|
2253
|
+
});
|
|
2254
|
+
|
|
2255
|
+
var result = await response.json();
|
|
2256
|
+
|
|
2257
|
+
if (result.success) {
|
|
2258
|
+
showRefreshToast(t('codexlens.cleanSuccess'), 'success');
|
|
2259
|
+
|
|
2260
|
+
// Refresh status
|
|
2261
|
+
if (typeof loadCodexLensStatus === 'function') {
|
|
2262
|
+
await loadCodexLensStatus();
|
|
2263
|
+
renderToolsSection();
|
|
2264
|
+
if (window.lucide) lucide.createIcons();
|
|
2265
|
+
}
|
|
2266
|
+
} else {
|
|
2267
|
+
showRefreshToast(t('codexlens.cleanFailed') + ': ' + result.error, 'error');
|
|
2268
|
+
}
|
|
2269
|
+
} catch (err) {
|
|
2270
|
+
showRefreshToast(t('common.error') + ': ' + err.message, 'error');
|
|
2271
|
+
}
|
|
2272
|
+
}
|