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,2187 @@
|
|
|
1
|
+
// MCP Manager View
|
|
2
|
+
// Renders the MCP server management interface
|
|
3
|
+
|
|
4
|
+
// CCW Tools available for MCP
|
|
5
|
+
const CCW_MCP_TOOLS = [
|
|
6
|
+
// Core tools (always recommended)
|
|
7
|
+
{ name: 'write_file', desc: 'Write/create files', core: true },
|
|
8
|
+
{ name: 'edit_file', desc: 'Edit/replace content', core: true },
|
|
9
|
+
{ name: 'smart_search', desc: 'Hybrid search (regex + semantic)', core: true },
|
|
10
|
+
{ name: 'core_memory', desc: 'Core memory management', core: true },
|
|
11
|
+
// Optional tools
|
|
12
|
+
{ name: 'session_manager', desc: 'Workflow sessions', core: false },
|
|
13
|
+
{ name: 'generate_module_docs', desc: 'Generate docs', core: false },
|
|
14
|
+
{ name: 'update_module_claude', desc: 'Update CLAUDE.md', core: false },
|
|
15
|
+
{ name: 'cli_executor', desc: 'Gemini/Qwen/Codex CLI', core: false },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
// Get currently enabled tools from installed config (Claude)
|
|
19
|
+
function getCcwEnabledTools() {
|
|
20
|
+
const currentPath = projectPath; // Keep original format (forward slash)
|
|
21
|
+
const projectData = mcpAllProjects[currentPath] || {};
|
|
22
|
+
const ccwConfig = projectData.mcpServers?.['ccw-tools'];
|
|
23
|
+
if (ccwConfig?.env?.CCW_ENABLED_TOOLS) {
|
|
24
|
+
const val = ccwConfig.env.CCW_ENABLED_TOOLS;
|
|
25
|
+
if (val.toLowerCase() === 'all') return CCW_MCP_TOOLS.map(t => t.name);
|
|
26
|
+
return val.split(',').map(t => t.trim());
|
|
27
|
+
}
|
|
28
|
+
return CCW_MCP_TOOLS.filter(t => t.core).map(t => t.name);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Get currently enabled tools from Codex config
|
|
32
|
+
function getCcwEnabledToolsCodex() {
|
|
33
|
+
const ccwConfig = codexMcpServers?.['ccw-tools'];
|
|
34
|
+
if (ccwConfig?.env?.CCW_ENABLED_TOOLS) {
|
|
35
|
+
const val = ccwConfig.env.CCW_ENABLED_TOOLS;
|
|
36
|
+
if (val.toLowerCase() === 'all') return CCW_MCP_TOOLS.map(t => t.name);
|
|
37
|
+
return val.split(',').map(t => t.trim());
|
|
38
|
+
}
|
|
39
|
+
// Default to core tools if not installed
|
|
40
|
+
return CCW_MCP_TOOLS.filter(t => t.core).map(t => t.name);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Get current CCW_PROJECT_ROOT from config
|
|
44
|
+
function getCcwProjectRoot() {
|
|
45
|
+
// Try project config first, then global config
|
|
46
|
+
const currentPath = projectPath;
|
|
47
|
+
const projectData = mcpAllProjects[currentPath] || {};
|
|
48
|
+
const projectCcwConfig = projectData.mcpServers?.['ccw-tools'];
|
|
49
|
+
if (projectCcwConfig?.env?.CCW_PROJECT_ROOT) {
|
|
50
|
+
return projectCcwConfig.env.CCW_PROJECT_ROOT;
|
|
51
|
+
}
|
|
52
|
+
// Fallback to global config
|
|
53
|
+
const globalCcwConfig = mcpUserServers?.['ccw-tools'];
|
|
54
|
+
return globalCcwConfig?.env?.CCW_PROJECT_ROOT || '';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Get current CCW_ALLOWED_DIRS from config
|
|
58
|
+
function getCcwAllowedDirs() {
|
|
59
|
+
// Try project config first, then global config
|
|
60
|
+
const currentPath = projectPath;
|
|
61
|
+
const projectData = mcpAllProjects[currentPath] || {};
|
|
62
|
+
const projectCcwConfig = projectData.mcpServers?.['ccw-tools'];
|
|
63
|
+
if (projectCcwConfig?.env?.CCW_ALLOWED_DIRS) {
|
|
64
|
+
return projectCcwConfig.env.CCW_ALLOWED_DIRS;
|
|
65
|
+
}
|
|
66
|
+
// Fallback to global config
|
|
67
|
+
const globalCcwConfig = mcpUserServers?.['ccw-tools'];
|
|
68
|
+
return globalCcwConfig?.env?.CCW_ALLOWED_DIRS || '';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Get current CCW_PROJECT_ROOT from Codex config
|
|
72
|
+
function getCcwProjectRootCodex() {
|
|
73
|
+
const ccwConfig = codexMcpServers?.['ccw-tools'];
|
|
74
|
+
return ccwConfig?.env?.CCW_PROJECT_ROOT || '';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Get current CCW_ALLOWED_DIRS from Codex config
|
|
78
|
+
function getCcwAllowedDirsCodex() {
|
|
79
|
+
const ccwConfig = codexMcpServers?.['ccw-tools'];
|
|
80
|
+
return ccwConfig?.env?.CCW_ALLOWED_DIRS || '';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function renderMcpManager() {
|
|
84
|
+
const container = document.getElementById('mainContent');
|
|
85
|
+
if (!container) return;
|
|
86
|
+
|
|
87
|
+
// Hide stats grid and search for MCP view
|
|
88
|
+
const statsGrid = document.getElementById('statsGrid');
|
|
89
|
+
const searchInput = document.getElementById('searchInput');
|
|
90
|
+
if (statsGrid) statsGrid.style.display = 'none';
|
|
91
|
+
if (searchInput) searchInput.parentElement.style.display = 'none';
|
|
92
|
+
|
|
93
|
+
// Load MCP config if not already loaded
|
|
94
|
+
if (!mcpConfig) {
|
|
95
|
+
await loadMcpConfig();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Load MCP templates
|
|
99
|
+
await loadMcpTemplates();
|
|
100
|
+
|
|
101
|
+
const currentPath = projectPath; // Keep original format (forward slash)
|
|
102
|
+
const projectData = mcpAllProjects[currentPath] || {};
|
|
103
|
+
const projectServers = projectData.mcpServers || {};
|
|
104
|
+
const disabledServers = projectData.disabledMcpServers || [];
|
|
105
|
+
const hasMcpJson = projectData.hasMcpJson || false;
|
|
106
|
+
const mcpJsonPath = projectData.mcpJsonPath || null;
|
|
107
|
+
|
|
108
|
+
// Get all available servers from all projects
|
|
109
|
+
const allAvailableServers = getAllAvailableMcpServers();
|
|
110
|
+
|
|
111
|
+
// Separate servers by category:
|
|
112
|
+
// 1. Project Available = Global + Project-specific (servers available to current project)
|
|
113
|
+
// 2. Global Management = Global servers that can be managed
|
|
114
|
+
// 3. Other Projects = Servers from other projects (can install to project or global)
|
|
115
|
+
|
|
116
|
+
const currentProjectServerNames = Object.keys(projectServers);
|
|
117
|
+
const globalServerNames = Object.keys(mcpUserServers || {});
|
|
118
|
+
const enterpriseServerNames = Object.keys(mcpEnterpriseServers || {});
|
|
119
|
+
|
|
120
|
+
// Project Available MCP: servers available to current project
|
|
121
|
+
// This includes: Enterprise (highest priority) + Global + Project-specific
|
|
122
|
+
const projectAvailableEntries = [];
|
|
123
|
+
|
|
124
|
+
// Add enterprise servers first (highest priority)
|
|
125
|
+
for (const [name, config] of Object.entries(mcpEnterpriseServers || {})) {
|
|
126
|
+
projectAvailableEntries.push({
|
|
127
|
+
name,
|
|
128
|
+
config,
|
|
129
|
+
source: 'enterprise',
|
|
130
|
+
canRemove: false,
|
|
131
|
+
canToggle: false
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Add global servers
|
|
136
|
+
for (const [name, config] of Object.entries(mcpUserServers || {})) {
|
|
137
|
+
if (!enterpriseServerNames.includes(name)) {
|
|
138
|
+
projectAvailableEntries.push({
|
|
139
|
+
name,
|
|
140
|
+
config,
|
|
141
|
+
source: 'global',
|
|
142
|
+
canRemove: false, // Can't remove from project view, must go to global management
|
|
143
|
+
canToggle: true,
|
|
144
|
+
isEnabled: !disabledServers.includes(name)
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Add project-specific servers
|
|
150
|
+
for (const [name, config] of Object.entries(projectServers)) {
|
|
151
|
+
if (!enterpriseServerNames.includes(name) && !globalServerNames.includes(name)) {
|
|
152
|
+
projectAvailableEntries.push({
|
|
153
|
+
name,
|
|
154
|
+
config,
|
|
155
|
+
source: 'project',
|
|
156
|
+
canRemove: true,
|
|
157
|
+
canToggle: true,
|
|
158
|
+
isEnabled: !disabledServers.includes(name)
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Global Management: user global servers (for management)
|
|
164
|
+
const globalManagementEntries = Object.entries(mcpUserServers || {});
|
|
165
|
+
|
|
166
|
+
// Enterprise servers (for display only, read-only)
|
|
167
|
+
const enterpriseServerEntries = Object.entries(mcpEnterpriseServers || {});
|
|
168
|
+
|
|
169
|
+
// Other Projects: servers from other projects (not in current project, not global)
|
|
170
|
+
const otherProjectServers = Object.entries(allAvailableServers)
|
|
171
|
+
.filter(([name, info]) => !currentProjectServerNames.includes(name) && !info.isGlobal);
|
|
172
|
+
// Check if CCW Tools is already installed
|
|
173
|
+
const isCcwToolsInstalled = currentProjectServerNames.includes("ccw-tools");
|
|
174
|
+
const enabledTools = getCcwEnabledTools();
|
|
175
|
+
const enabledToolsCodex = getCcwEnabledToolsCodex();
|
|
176
|
+
|
|
177
|
+
// Prepare Codex servers data
|
|
178
|
+
const codexServerEntries = Object.entries(codexMcpServers || {});
|
|
179
|
+
const codexConfigExists = codexMcpConfig?.exists || false;
|
|
180
|
+
const codexConfigPath = codexMcpConfig?.configPath || '~/.codex/config.toml';
|
|
181
|
+
|
|
182
|
+
// Collect cross-CLI servers (servers from other CLI not yet in current CLI)
|
|
183
|
+
const crossCliServers = [];
|
|
184
|
+
if (currentCliMode === 'claude') {
|
|
185
|
+
// In Claude mode, show Codex servers that aren't in Claude
|
|
186
|
+
for (const [name, config] of Object.entries(codexMcpServers || {})) {
|
|
187
|
+
const existsInClaude = currentProjectServerNames.includes(name) || globalServerNames.includes(name);
|
|
188
|
+
if (!existsInClaude) {
|
|
189
|
+
crossCliServers.push({ name, config, fromCli: 'codex' });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
// In Codex mode, show Claude servers that aren't in Codex
|
|
194
|
+
const allClaudeServers = { ...mcpUserServers, ...projectServers };
|
|
195
|
+
for (const [name, config] of Object.entries(allClaudeServers)) {
|
|
196
|
+
const existsInCodex = codexMcpServers && codexMcpServers[name];
|
|
197
|
+
if (!existsInCodex) {
|
|
198
|
+
crossCliServers.push({ name, config, fromCli: 'claude' });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
container.innerHTML = `
|
|
204
|
+
<div class="mcp-manager">
|
|
205
|
+
<!-- CLI Mode Toggle -->
|
|
206
|
+
<div class="mcp-cli-toggle mb-6">
|
|
207
|
+
<div class="flex items-center justify-between bg-card border border-border rounded-lg p-4">
|
|
208
|
+
<div class="flex items-center gap-3">
|
|
209
|
+
<span class="text-sm font-medium text-foreground">${t('mcp.cliMode')}</span>
|
|
210
|
+
<div class="flex items-center bg-muted rounded-lg p-1">
|
|
211
|
+
<button class="cli-mode-btn px-4 py-2 text-sm font-medium rounded-md transition-all ${currentCliMode === 'claude' ? 'bg-primary text-primary-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground'}"
|
|
212
|
+
onclick="setCliMode('claude')">
|
|
213
|
+
<i data-lucide="bot" class="w-4 h-4 inline mr-1.5"></i>
|
|
214
|
+
Claude
|
|
215
|
+
</button>
|
|
216
|
+
<button class="cli-mode-btn px-4 py-2 text-sm font-medium rounded-md transition-all ${currentCliMode === 'codex' ? 'shadow-sm' : 'text-muted-foreground hover:text-foreground'}"
|
|
217
|
+
onclick="setCliMode('codex')"
|
|
218
|
+
style="${currentCliMode === 'codex' ? 'background-color: #f97316; color: white;' : ''}">
|
|
219
|
+
<i data-lucide="code-2" class="w-4 h-4 inline mr-1.5"></i>
|
|
220
|
+
Codex
|
|
221
|
+
</button>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
<div class="text-xs text-muted-foreground">
|
|
225
|
+
${currentCliMode === 'claude'
|
|
226
|
+
? `<span class="flex items-center gap-1"><i data-lucide="file-json" class="w-3 h-3"></i> ~/.claude.json</span>`
|
|
227
|
+
: `<span class="flex items-center gap-1"><i data-lucide="file-code" class="w-3 h-3"></i> ${codexConfigPath}</span>`
|
|
228
|
+
}
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
${currentCliMode === 'codex' ? `
|
|
234
|
+
<!-- CCW Tools MCP Server Card (Codex mode) -->
|
|
235
|
+
<div class="mcp-section mb-6">
|
|
236
|
+
<div class="ccw-tools-card bg-gradient-to-br from-primary/10 to-primary/5 border-2 ${codexMcpServers && codexMcpServers['ccw-tools'] ? 'border-success' : 'border-primary/30'} rounded-lg p-6 hover:shadow-lg transition-all">
|
|
237
|
+
<div class="flex items-start justify-between gap-4">
|
|
238
|
+
<div class="flex items-start gap-4 flex-1">
|
|
239
|
+
<div class="shrink-0 w-12 h-12 bg-primary rounded-lg flex items-center justify-center">
|
|
240
|
+
<i data-lucide="wrench" class="w-6 h-6 text-white"></i>
|
|
241
|
+
</div>
|
|
242
|
+
<div class="flex-1 min-w-0">
|
|
243
|
+
<div class="flex items-center gap-2 mb-2">
|
|
244
|
+
<h3 class="text-lg font-bold text-foreground">CCW Tools MCP</h3>
|
|
245
|
+
<span class="text-xs px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300 rounded-full">Codex</span>
|
|
246
|
+
${codexMcpServers && codexMcpServers['ccw-tools'] ? `
|
|
247
|
+
<span class="inline-flex items-center gap-1 px-2 py-0.5 text-xs font-semibold rounded-full bg-success-light text-success">
|
|
248
|
+
<i data-lucide="check" class="w-3 h-3"></i>
|
|
249
|
+
${enabledToolsCodex.length} tools
|
|
250
|
+
</span>
|
|
251
|
+
` : `
|
|
252
|
+
<span class="inline-flex items-center gap-1 px-2 py-0.5 text-xs font-semibold rounded-full bg-primary/20 text-primary">
|
|
253
|
+
<i data-lucide="package" class="w-3 h-3"></i>
|
|
254
|
+
${t('mcp.available')}
|
|
255
|
+
</span>
|
|
256
|
+
`}
|
|
257
|
+
</div>
|
|
258
|
+
<p class="text-sm text-muted-foreground mb-3">${t('mcp.ccwToolsDesc')}</p>
|
|
259
|
+
<!-- Tool Selection Grid for Codex -->
|
|
260
|
+
<div class="grid grid-cols-3 sm:grid-cols-5 gap-2 mb-3">
|
|
261
|
+
${CCW_MCP_TOOLS.map(tool => `
|
|
262
|
+
<label class="flex items-center gap-1.5 text-xs cursor-pointer hover:bg-muted/50 rounded px-1.5 py-1 transition-colors">
|
|
263
|
+
<input type="checkbox" class="ccw-tool-checkbox-codex w-3 h-3"
|
|
264
|
+
data-tool="${tool.name}"
|
|
265
|
+
${enabledToolsCodex.includes(tool.name) ? 'checked' : ''}>
|
|
266
|
+
<span class="${tool.core ? 'font-medium' : 'text-muted-foreground'}">${tool.desc}</span>
|
|
267
|
+
</label>
|
|
268
|
+
`).join('')}
|
|
269
|
+
</div>
|
|
270
|
+
<div class="flex items-center gap-3 text-xs">
|
|
271
|
+
<button class="text-primary hover:underline" onclick="selectCcwToolsCodex('core')">Core only</button>
|
|
272
|
+
<button class="text-primary hover:underline" onclick="selectCcwToolsCodex('all')">All</button>
|
|
273
|
+
<button class="text-muted-foreground hover:underline" onclick="selectCcwToolsCodex('none')">None</button>
|
|
274
|
+
</div>
|
|
275
|
+
<!-- Path Settings -->
|
|
276
|
+
<div class="ccw-path-settings mt-3 pt-3 border-t border-border/50">
|
|
277
|
+
<div class="flex items-center gap-2 mb-2">
|
|
278
|
+
<i data-lucide="folder-root" class="w-4 h-4 text-muted-foreground"></i>
|
|
279
|
+
<span class="text-xs font-medium text-muted-foreground">${t('mcp.pathSettings')}</span>
|
|
280
|
+
</div>
|
|
281
|
+
<div class="grid grid-cols-1 gap-2">
|
|
282
|
+
<div class="flex items-center gap-2">
|
|
283
|
+
<label class="text-xs text-muted-foreground w-36 shrink-0">CCW_PROJECT_ROOT</label>
|
|
284
|
+
<input type="text"
|
|
285
|
+
class="ccw-project-root-input flex-1 px-2 py-1 text-xs bg-background border border-border rounded focus:outline-none focus:ring-1 focus:ring-primary"
|
|
286
|
+
placeholder="${projectPath || t('mcp.useCurrentDir')}"
|
|
287
|
+
value="${getCcwProjectRootCodex()}">
|
|
288
|
+
<button class="p-1 text-muted-foreground hover:text-foreground"
|
|
289
|
+
onclick="setCcwProjectRootToCurrent()"
|
|
290
|
+
title="${t('mcp.useCurrentProject')}">
|
|
291
|
+
<i data-lucide="locate-fixed" class="w-4 h-4"></i>
|
|
292
|
+
</button>
|
|
293
|
+
</div>
|
|
294
|
+
<div class="flex items-center gap-2">
|
|
295
|
+
<label class="text-xs text-muted-foreground w-36 shrink-0">CCW_ALLOWED_DIRS</label>
|
|
296
|
+
<input type="text"
|
|
297
|
+
class="ccw-allowed-dirs-input flex-1 px-2 py-1 text-xs bg-background border border-border rounded focus:outline-none focus:ring-1 focus:ring-primary"
|
|
298
|
+
placeholder="${t('mcp.allowedDirsPlaceholder')}"
|
|
299
|
+
value="${getCcwAllowedDirsCodex()}">
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
<div class="shrink-0">
|
|
306
|
+
<button class="px-4 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1"
|
|
307
|
+
data-action="install-ccw-codex">
|
|
308
|
+
<i data-lucide="download" class="w-4 h-4"></i>
|
|
309
|
+
${codexMcpServers && codexMcpServers['ccw-tools'] ? t('mcp.update') : t('mcp.install')}
|
|
310
|
+
</button>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
<!-- Codex MCP Servers Section -->
|
|
317
|
+
<div class="mcp-section mb-6">
|
|
318
|
+
<div class="flex items-center justify-between mb-4">
|
|
319
|
+
<div class="flex items-center gap-3">
|
|
320
|
+
<div class="flex items-center gap-2">
|
|
321
|
+
<i data-lucide="code-2" class="w-5 h-5 text-primary"></i>
|
|
322
|
+
<h3 class="text-lg font-semibold text-foreground">${t('mcp.codex.globalServers')}</h3>
|
|
323
|
+
</div>
|
|
324
|
+
<button class="px-3 py-1.5 text-sm bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1"
|
|
325
|
+
onclick="openCodexMcpCreateModal()">
|
|
326
|
+
<span>+</span> ${t('mcp.codex.newServer')}
|
|
327
|
+
</button>
|
|
328
|
+
${codexConfigExists ? `
|
|
329
|
+
<span class="inline-flex items-center gap-1.5 px-2 py-1 text-xs bg-success/10 text-success rounded-md border border-success/20">
|
|
330
|
+
<i data-lucide="file-check" class="w-3.5 h-3.5"></i>
|
|
331
|
+
config.toml
|
|
332
|
+
</span>
|
|
333
|
+
` : `
|
|
334
|
+
<span class="inline-flex items-center gap-1.5 px-2 py-1 text-xs bg-muted text-muted-foreground rounded-md border border-border" title="Will create ~/.codex/config.toml">
|
|
335
|
+
<i data-lucide="file-plus" class="w-3.5 h-3.5"></i>
|
|
336
|
+
Will create config.toml
|
|
337
|
+
</span>
|
|
338
|
+
`}
|
|
339
|
+
</div>
|
|
340
|
+
<span class="text-sm text-muted-foreground">${codexServerEntries.length} ${t('mcp.serversAvailable')}</span>
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
<!-- Info about Codex MCP -->
|
|
344
|
+
<div class="bg-green-50 dark:bg-green-950/30 border border-primary/20 rounded-lg p-4 mb-4">
|
|
345
|
+
<div class="flex items-start gap-3">
|
|
346
|
+
<i data-lucide="info" class="w-5 h-5 text-green-500 shrink-0 mt-0.5"></i>
|
|
347
|
+
<div class="text-sm">
|
|
348
|
+
<p class="text-primary font-medium mb-1">${t('mcp.codex.infoTitle')}</p>
|
|
349
|
+
<p class="text-primary/80 text-xs">${t('mcp.codex.infoDesc')}</p>
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
|
|
354
|
+
${codexServerEntries.length === 0 ? `
|
|
355
|
+
<div class="mcp-empty-state bg-card border border-border rounded-lg p-6 text-center">
|
|
356
|
+
<div class="text-muted-foreground mb-3"><i data-lucide="plug" class="w-10 h-10 mx-auto"></i></div>
|
|
357
|
+
<p class="text-muted-foreground">${t('mcp.codex.noServers')}</p>
|
|
358
|
+
<p class="text-sm text-muted-foreground mt-1">${t('mcp.codex.noServersHint')}</p>
|
|
359
|
+
</div>
|
|
360
|
+
` : `
|
|
361
|
+
<div class="mcp-server-grid grid gap-3">
|
|
362
|
+
${codexServerEntries.map(([serverName, serverConfig]) => {
|
|
363
|
+
return renderCodexServerCard(serverName, serverConfig);
|
|
364
|
+
}).join('')}
|
|
365
|
+
</div>
|
|
366
|
+
`}
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<!-- Copy Claude Servers to Codex -->
|
|
370
|
+
${Object.keys(mcpUserServers || {}).length > 0 ? `
|
|
371
|
+
<div class="mcp-section mb-6">
|
|
372
|
+
<div class="flex items-center justify-between mb-4">
|
|
373
|
+
<h3 class="text-lg font-semibold text-foreground flex items-center gap-2">
|
|
374
|
+
<i data-lucide="copy" class="w-5 h-5"></i>
|
|
375
|
+
${t('mcp.codex.copyFromClaude')}
|
|
376
|
+
</h3>
|
|
377
|
+
<span class="text-sm text-muted-foreground">${Object.keys(mcpUserServers || {}).length} ${t('mcp.serversAvailable')}</span>
|
|
378
|
+
</div>
|
|
379
|
+
<div class="mcp-server-grid grid gap-3">
|
|
380
|
+
${Object.entries(mcpUserServers || {}).map(([serverName, serverConfig]) => {
|
|
381
|
+
const alreadyInCodex = codexMcpServers && codexMcpServers[serverName];
|
|
382
|
+
return `
|
|
383
|
+
<div class="mcp-server-card bg-card border ${alreadyInCodex ? 'border-success/50' : 'border-border'} border-dashed rounded-lg p-4 hover:shadow-md transition-all">
|
|
384
|
+
<div class="flex items-start justify-between mb-3">
|
|
385
|
+
<div class="flex items-center gap-2">
|
|
386
|
+
<i data-lucide="bot" class="w-5 h-5 text-primary"></i>
|
|
387
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(serverName)}</h4>
|
|
388
|
+
<span class="text-xs px-2 py-0.5 bg-primary/10 text-primary rounded-full">Claude</span>
|
|
389
|
+
${alreadyInCodex ? `<span class="text-xs px-2 py-0.5 bg-success/10 text-success rounded-full">${t('mcp.codex.alreadyAdded')}</span>` : ''}
|
|
390
|
+
</div>
|
|
391
|
+
${!alreadyInCodex ? `
|
|
392
|
+
<button class="px-3 py-1 text-xs bg-primary text-primary-foreground rounded hover:opacity-90 transition-opacity"
|
|
393
|
+
data-action="copy-to-codex"
|
|
394
|
+
data-server-name="${escapeHtml(serverName)}"
|
|
395
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
396
|
+
title="${t('mcp.codex.copyToCodex')}">
|
|
397
|
+
<i data-lucide="arrow-right" class="w-3.5 h-3.5 inline"></i> Codex
|
|
398
|
+
</button>
|
|
399
|
+
` : ''}
|
|
400
|
+
</div>
|
|
401
|
+
<div class="mcp-server-details text-sm space-y-1">
|
|
402
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
403
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.cmd')}</span>
|
|
404
|
+
<span class="truncate" title="${escapeHtml(serverConfig.command || 'N/A')}">${escapeHtml(serverConfig.command || 'N/A')}</span>
|
|
405
|
+
</div>
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
`;
|
|
409
|
+
}).join('')}
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
` : ''}
|
|
413
|
+
|
|
414
|
+
<!-- Available MCP Servers from Other Projects (Codex mode) -->
|
|
415
|
+
<div class="mcp-section mb-6">
|
|
416
|
+
<div class="flex items-center justify-between mb-4">
|
|
417
|
+
<h3 class="text-lg font-semibold text-foreground">${t('mcp.availableOther')}</h3>
|
|
418
|
+
<span class="text-sm text-muted-foreground">${otherProjectServers.length} ${t('mcp.serversAvailable')}</span>
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
${otherProjectServers.length === 0 ? `
|
|
422
|
+
<div class="mcp-empty-state bg-card border border-border rounded-lg p-6 text-center">
|
|
423
|
+
<p class="text-muted-foreground">${t('empty.noAdditionalMcp')}</p>
|
|
424
|
+
</div>
|
|
425
|
+
` : `
|
|
426
|
+
<div class="mcp-server-grid grid gap-3">
|
|
427
|
+
${otherProjectServers.map(([serverName, serverInfo]) => {
|
|
428
|
+
return renderAvailableServerCardForCodex(serverName, serverInfo);
|
|
429
|
+
}).join('')}
|
|
430
|
+
</div>
|
|
431
|
+
`}
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
<!-- Cross-CLI Servers: Available from Claude (Codex mode) -->
|
|
435
|
+
${crossCliServers.length > 0 ? `
|
|
436
|
+
<div class="mcp-section">
|
|
437
|
+
<div class="flex items-center justify-between mb-4">
|
|
438
|
+
<h3 class="text-lg font-semibold text-foreground flex items-center gap-2">
|
|
439
|
+
<i data-lucide="circle" class="w-5 h-5 text-primary"></i>
|
|
440
|
+
${t('mcp.codex.copyFromClaude')}
|
|
441
|
+
</h3>
|
|
442
|
+
<span class="text-sm text-muted-foreground">${crossCliServers.length} ${t('mcp.serversAvailable')}</span>
|
|
443
|
+
</div>
|
|
444
|
+
<div class="mcp-server-grid grid gap-3">
|
|
445
|
+
${crossCliServers.map(server => renderCrossCliServerCard(server, false)).join('')}
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
` : ''}
|
|
449
|
+
` : `
|
|
450
|
+
<!-- CCW Tools MCP Server Card -->
|
|
451
|
+
<div class="mcp-section mb-6">
|
|
452
|
+
<div class="ccw-tools-card bg-gradient-to-br from-primary/10 to-primary/5 border-2 ${isCcwToolsInstalled ? 'border-success' : 'border-primary/30'} rounded-lg p-6 hover:shadow-lg transition-all">
|
|
453
|
+
<div class="flex items-start justify-between gap-4">
|
|
454
|
+
<div class="flex items-start gap-4 flex-1">
|
|
455
|
+
<div class="shrink-0 w-12 h-12 bg-primary rounded-lg flex items-center justify-center">
|
|
456
|
+
<i data-lucide="wrench" class="w-6 h-6 text-white"></i>
|
|
457
|
+
</div>
|
|
458
|
+
<div class="flex-1 min-w-0">
|
|
459
|
+
<div class="flex items-center gap-2 mb-2">
|
|
460
|
+
<h3 class="text-lg font-bold text-foreground">CCW Tools MCP</h3>
|
|
461
|
+
${isCcwToolsInstalled ? `
|
|
462
|
+
<span class="inline-flex items-center gap-1 px-2 py-0.5 text-xs font-semibold rounded-full bg-success-light text-success">
|
|
463
|
+
<i data-lucide="check" class="w-3 h-3"></i>
|
|
464
|
+
${enabledTools.length} tools
|
|
465
|
+
</span>
|
|
466
|
+
` : `
|
|
467
|
+
<span class="inline-flex items-center gap-1 px-2 py-0.5 text-xs font-semibold rounded-full bg-primary/20 text-primary">
|
|
468
|
+
<i data-lucide="package" class="w-3 h-3"></i>
|
|
469
|
+
Available
|
|
470
|
+
</span>
|
|
471
|
+
`}
|
|
472
|
+
</div>
|
|
473
|
+
<!-- Tool Selection Grid -->
|
|
474
|
+
<div class="grid grid-cols-3 sm:grid-cols-5 gap-2 mb-3">
|
|
475
|
+
${CCW_MCP_TOOLS.map(tool => `
|
|
476
|
+
<label class="flex items-center gap-1.5 text-xs cursor-pointer hover:bg-muted/50 rounded px-1.5 py-1 transition-colors">
|
|
477
|
+
<input type="checkbox" class="ccw-tool-checkbox w-3 h-3"
|
|
478
|
+
data-tool="${tool.name}"
|
|
479
|
+
${enabledTools.includes(tool.name) ? 'checked' : ''}>
|
|
480
|
+
<span class="${tool.core ? 'font-medium' : 'text-muted-foreground'}">${tool.desc}</span>
|
|
481
|
+
</label>
|
|
482
|
+
`).join('')}
|
|
483
|
+
</div>
|
|
484
|
+
<div class="flex items-center gap-3 text-xs">
|
|
485
|
+
<button class="text-primary hover:underline" onclick="selectCcwTools('core')">Core only</button>
|
|
486
|
+
<button class="text-primary hover:underline" onclick="selectCcwTools('all')">All</button>
|
|
487
|
+
<button class="text-muted-foreground hover:underline" onclick="selectCcwTools('none')">None</button>
|
|
488
|
+
</div>
|
|
489
|
+
<!-- Path Settings -->
|
|
490
|
+
<div class="ccw-path-settings mt-3 pt-3 border-t border-border/50">
|
|
491
|
+
<div class="flex items-center gap-2 mb-2">
|
|
492
|
+
<i data-lucide="folder-root" class="w-4 h-4 text-muted-foreground"></i>
|
|
493
|
+
<span class="text-xs font-medium text-muted-foreground">${t('mcp.pathSettings')}</span>
|
|
494
|
+
</div>
|
|
495
|
+
<div class="grid grid-cols-1 gap-2">
|
|
496
|
+
<div class="flex items-center gap-2">
|
|
497
|
+
<label class="text-xs text-muted-foreground w-36 shrink-0">CCW_PROJECT_ROOT</label>
|
|
498
|
+
<input type="text"
|
|
499
|
+
class="ccw-project-root-input flex-1 px-2 py-1 text-xs bg-background border border-border rounded focus:outline-none focus:ring-1 focus:ring-primary"
|
|
500
|
+
placeholder="${projectPath || t('mcp.useCurrentDir')}"
|
|
501
|
+
value="${getCcwProjectRoot()}">
|
|
502
|
+
<button class="p-1 text-muted-foreground hover:text-foreground"
|
|
503
|
+
onclick="setCcwProjectRootToCurrent()"
|
|
504
|
+
title="${t('mcp.useCurrentProject')}">
|
|
505
|
+
<i data-lucide="locate-fixed" class="w-4 h-4"></i>
|
|
506
|
+
</button>
|
|
507
|
+
</div>
|
|
508
|
+
<div class="flex items-center gap-2">
|
|
509
|
+
<label class="text-xs text-muted-foreground w-36 shrink-0">CCW_ALLOWED_DIRS</label>
|
|
510
|
+
<input type="text"
|
|
511
|
+
class="ccw-allowed-dirs-input flex-1 px-2 py-1 text-xs bg-background border border-border rounded focus:outline-none focus:ring-1 focus:ring-primary"
|
|
512
|
+
placeholder="${t('mcp.allowedDirsPlaceholder')}"
|
|
513
|
+
value="${getCcwAllowedDirs()}">
|
|
514
|
+
</div>
|
|
515
|
+
</div>
|
|
516
|
+
</div>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
<div class="shrink-0 flex gap-2">
|
|
520
|
+
${isCcwToolsInstalled ? `
|
|
521
|
+
<button class="px-4 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1"
|
|
522
|
+
data-action="update-ccw-workspace"
|
|
523
|
+
title="${t('mcp.updateInWorkspace')}">
|
|
524
|
+
<i data-lucide="folder" class="w-4 h-4"></i>
|
|
525
|
+
${t('mcp.updateInWorkspace')}
|
|
526
|
+
</button>
|
|
527
|
+
<button class="px-4 py-2 text-sm bg-success text-success-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1"
|
|
528
|
+
data-action="update-ccw-global"
|
|
529
|
+
title="${t('mcp.updateInGlobal')}">
|
|
530
|
+
<i data-lucide="globe" class="w-4 h-4"></i>
|
|
531
|
+
${t('mcp.updateInGlobal')}
|
|
532
|
+
</button>
|
|
533
|
+
` : `
|
|
534
|
+
<button class="px-4 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1"
|
|
535
|
+
data-action="install-ccw-workspace"
|
|
536
|
+
title="${t('mcp.installToWorkspace')}">
|
|
537
|
+
<i data-lucide="folder" class="w-4 h-4"></i>
|
|
538
|
+
${t('mcp.installToWorkspace')}
|
|
539
|
+
</button>
|
|
540
|
+
<button class="px-4 py-2 text-sm bg-success text-success-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1"
|
|
541
|
+
data-action="install-ccw-global"
|
|
542
|
+
title="${t('mcp.installToGlobal')}">
|
|
543
|
+
<i data-lucide="globe" class="w-4 h-4"></i>
|
|
544
|
+
${t('mcp.installToGlobal')}
|
|
545
|
+
</button>
|
|
546
|
+
`}
|
|
547
|
+
</div>
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
</div>
|
|
551
|
+
|
|
552
|
+
<!-- Project Available MCP Servers -->
|
|
553
|
+
<div class="mcp-section mb-6">
|
|
554
|
+
<div class="flex items-center justify-between mb-4">
|
|
555
|
+
<div class="flex items-center gap-3">
|
|
556
|
+
<h3 class="text-lg font-semibold text-foreground">${t('mcp.projectAvailable')}</h3>
|
|
557
|
+
<button class="px-3 py-1.5 text-sm bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1"
|
|
558
|
+
onclick="openMcpCreateModal('project')">
|
|
559
|
+
<span>+</span> ${t('mcp.newProjectServer')}
|
|
560
|
+
</button>
|
|
561
|
+
<!-- Project Config Type Toggle -->
|
|
562
|
+
<button class="project-config-toggle inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg border cursor-pointer transition-all hover:shadow-md"
|
|
563
|
+
onclick="toggleProjectConfigType()"
|
|
564
|
+
title="${t('mcp.clickToSwitch')}"
|
|
565
|
+
style="${getPreferredProjectConfigType() === 'mcp'
|
|
566
|
+
? 'background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.3); color: rgb(34, 197, 94);'
|
|
567
|
+
: 'background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.3); color: rgb(59, 130, 246);'}">
|
|
568
|
+
<i data-lucide="${getPreferredProjectConfigType() === 'mcp' ? 'file-json' : 'settings'}" class="w-3.5 h-3.5"></i>
|
|
569
|
+
<span>${getPreferredProjectConfigType() === 'mcp' ? '.mcp.json' : 'claude.json'}</span>
|
|
570
|
+
<i data-lucide="chevrons-up-down" class="w-3 h-3 opacity-50"></i>
|
|
571
|
+
</button>
|
|
572
|
+
${hasMcpJson ? `
|
|
573
|
+
<span class="inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] bg-success/10 text-success rounded border border-success/20">
|
|
574
|
+
<i data-lucide="check" class="w-2.5 h-2.5"></i>
|
|
575
|
+
exists
|
|
576
|
+
</span>
|
|
577
|
+
` : ''}
|
|
578
|
+
</div>
|
|
579
|
+
<span class="text-sm text-muted-foreground">${projectAvailableEntries.length} ${t('mcp.serversAvailable')}</span>
|
|
580
|
+
</div>
|
|
581
|
+
|
|
582
|
+
${projectAvailableEntries.length === 0 ? `
|
|
583
|
+
<div class="mcp-empty-state bg-card border border-border rounded-lg p-6 text-center">
|
|
584
|
+
<div class="text-muted-foreground mb-3"><i data-lucide="plug" class="w-10 h-10 mx-auto"></i></div>
|
|
585
|
+
<p class="text-muted-foreground">${t('empty.noMcpServers')}</p>
|
|
586
|
+
<p class="text-sm text-muted-foreground mt-1">${t('empty.addMcpServersHint')}</p>
|
|
587
|
+
</div>
|
|
588
|
+
` : `
|
|
589
|
+
<div class="mcp-server-grid grid gap-3">
|
|
590
|
+
${projectAvailableEntries.map(entry => {
|
|
591
|
+
return renderProjectAvailableServerCard(entry);
|
|
592
|
+
}).join('')}
|
|
593
|
+
</div>
|
|
594
|
+
`}
|
|
595
|
+
</div>
|
|
596
|
+
|
|
597
|
+
<!-- Global Available MCP Servers -->
|
|
598
|
+
<div class="mcp-section mb-6">
|
|
599
|
+
<div class="flex items-center justify-between mb-4">
|
|
600
|
+
<div class="flex items-center gap-3">
|
|
601
|
+
<div class="flex items-center gap-2">
|
|
602
|
+
<i data-lucide="globe" class="w-5 h-5 text-success"></i>
|
|
603
|
+
<h3 class="text-lg font-semibold text-foreground">${t('mcp.globalAvailable')}</h3>
|
|
604
|
+
</div>
|
|
605
|
+
<button class="px-3 py-1.5 text-sm bg-success text-success-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1"
|
|
606
|
+
onclick="openMcpCreateModal('global')">
|
|
607
|
+
<span>+</span> ${t('mcp.newGlobalServer')}
|
|
608
|
+
</button>
|
|
609
|
+
</div>
|
|
610
|
+
<span class="text-sm text-muted-foreground">${globalManagementEntries.length} ${t('mcp.globalServersFrom')}</span>
|
|
611
|
+
</div>
|
|
612
|
+
|
|
613
|
+
${globalManagementEntries.length === 0 ? `
|
|
614
|
+
<div class="mcp-empty-state bg-card border border-border rounded-lg p-6 text-center">
|
|
615
|
+
<div class="text-muted-foreground mb-3"><i data-lucide="globe" class="w-10 h-10 mx-auto"></i></div>
|
|
616
|
+
<p class="text-muted-foreground">${t('empty.noGlobalMcpServers')}</p>
|
|
617
|
+
<p class="text-sm text-muted-foreground mt-1">${t('empty.globalServersHint')}</p>
|
|
618
|
+
</div>
|
|
619
|
+
` : `
|
|
620
|
+
<div class="mcp-server-grid grid gap-3">
|
|
621
|
+
${globalManagementEntries.map(([serverName, serverConfig]) => {
|
|
622
|
+
return renderGlobalManagementCard(serverName, serverConfig);
|
|
623
|
+
}).join('')}
|
|
624
|
+
</div>
|
|
625
|
+
`}
|
|
626
|
+
</div>
|
|
627
|
+
|
|
628
|
+
<!-- Available MCP Servers from Other Projects -->
|
|
629
|
+
<div class="mcp-section mb-6">
|
|
630
|
+
<div class="flex items-center justify-between mb-4">
|
|
631
|
+
<h3 class="text-lg font-semibold text-foreground">${t('mcp.availableOther')}</h3>
|
|
632
|
+
<span class="text-sm text-muted-foreground">${otherProjectServers.length} ${t('mcp.serversAvailable')}</span>
|
|
633
|
+
</div>
|
|
634
|
+
|
|
635
|
+
${otherProjectServers.length === 0 ? `
|
|
636
|
+
<div class="mcp-empty-state bg-card border border-border rounded-lg p-6 text-center">
|
|
637
|
+
<p class="text-muted-foreground">${t('empty.noAdditionalMcp')}</p>
|
|
638
|
+
</div>
|
|
639
|
+
` : `
|
|
640
|
+
<div class="mcp-server-grid grid gap-3">
|
|
641
|
+
${otherProjectServers.map(([serverName, serverInfo]) => {
|
|
642
|
+
return renderAvailableServerCard(serverName, serverInfo);
|
|
643
|
+
}).join('')}
|
|
644
|
+
</div>
|
|
645
|
+
`}
|
|
646
|
+
</div>
|
|
647
|
+
|
|
648
|
+
<!-- Cross-CLI Servers: Available from Codex (Claude mode) -->
|
|
649
|
+
${crossCliServers.length > 0 ? `
|
|
650
|
+
<div class="mcp-section mb-6">
|
|
651
|
+
<div class="flex items-center justify-between mb-4">
|
|
652
|
+
<h3 class="text-lg font-semibold text-foreground flex items-center gap-2">
|
|
653
|
+
<i data-lucide="circle-dashed" class="w-5 h-5 text-primary"></i>
|
|
654
|
+
${t('mcp.claude.copyFromCodex')}
|
|
655
|
+
</h3>
|
|
656
|
+
<span class="text-sm text-muted-foreground">${crossCliServers.length} ${t('mcp.serversAvailable')}</span>
|
|
657
|
+
</div>
|
|
658
|
+
<div class="mcp-server-grid grid gap-3">
|
|
659
|
+
${crossCliServers.map(server => renderCrossCliServerCard(server, true)).join('')}
|
|
660
|
+
</div>
|
|
661
|
+
</div>
|
|
662
|
+
` : ''}
|
|
663
|
+
|
|
664
|
+
<!-- MCP Templates Section -->
|
|
665
|
+
${mcpTemplates.length > 0 ? `
|
|
666
|
+
<div class="mcp-section mt-6">
|
|
667
|
+
<div class="flex items-center justify-between mb-4">
|
|
668
|
+
<h3 class="text-lg font-semibold text-foreground flex items-center gap-2">
|
|
669
|
+
<i data-lucide="layout-template" class="w-5 h-5"></i>
|
|
670
|
+
${t('mcp.templates')}
|
|
671
|
+
</h3>
|
|
672
|
+
<span class="text-sm text-muted-foreground">${mcpTemplates.length} ${t('mcp.savedTemplates')}</span>
|
|
673
|
+
</div>
|
|
674
|
+
|
|
675
|
+
<div class="mcp-server-grid grid gap-3">
|
|
676
|
+
${mcpTemplates.map(template => `
|
|
677
|
+
<div class="mcp-template-card mcp-server-card bg-card border border-border border-dashed rounded-lg p-4 hover:shadow-md hover:border-solid transition-all">
|
|
678
|
+
<div class="flex items-start justify-between mb-3">
|
|
679
|
+
<div class="flex items-center gap-2 flex-wrap">
|
|
680
|
+
<span><i data-lucide="layout-template" class="w-5 h-5 text-muted-foreground"></i></span>
|
|
681
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(template.name)}</h4>
|
|
682
|
+
${template.description ? `
|
|
683
|
+
<span class="text-xs px-2 py-0.5 bg-muted text-muted-foreground rounded-full truncate max-w-32" title="${escapeHtml(template.description)}">
|
|
684
|
+
${escapeHtml(template.description)}
|
|
685
|
+
</span>
|
|
686
|
+
` : ''}
|
|
687
|
+
</div>
|
|
688
|
+
<div class="flex gap-2">
|
|
689
|
+
<button class="px-3 py-1 text-xs bg-primary text-primary-foreground rounded hover:opacity-90 transition-opacity"
|
|
690
|
+
data-template-name="${escapeHtml(template.name)}"
|
|
691
|
+
data-scope="project"
|
|
692
|
+
data-action="install-template"
|
|
693
|
+
title="${t('mcp.installToProject')}">
|
|
694
|
+
<i data-lucide="folder-plus" class="w-3.5 h-3.5 inline"></i>
|
|
695
|
+
</button>
|
|
696
|
+
<button class="px-3 py-1 text-xs bg-success text-success-foreground rounded hover:opacity-90 transition-opacity"
|
|
697
|
+
data-template-name="${escapeHtml(template.name)}"
|
|
698
|
+
data-scope="global"
|
|
699
|
+
data-action="install-template"
|
|
700
|
+
title="${t('mcp.installToGlobal')}">
|
|
701
|
+
<i data-lucide="globe" class="w-3.5 h-3.5 inline"></i>
|
|
702
|
+
</button>
|
|
703
|
+
</div>
|
|
704
|
+
</div>
|
|
705
|
+
|
|
706
|
+
<div class="mcp-server-details text-sm space-y-1">
|
|
707
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
708
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.cmd')}</span>
|
|
709
|
+
<span class="truncate" title="${escapeHtml(template.serverConfig.command)}">${escapeHtml(template.serverConfig.command)}</span>
|
|
710
|
+
</div>
|
|
711
|
+
${template.serverConfig.args && template.serverConfig.args.length > 0 ? `
|
|
712
|
+
<div class="flex items-start gap-2 text-muted-foreground">
|
|
713
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">${t('mcp.args')}</span>
|
|
714
|
+
<span class="text-xs font-mono truncate" title="${escapeHtml(template.serverConfig.args.join(' '))}">${escapeHtml(template.serverConfig.args.slice(0, 3).join(' '))}${template.serverConfig.args.length > 3 ? '...' : ''}</span>
|
|
715
|
+
</div>
|
|
716
|
+
` : ''}
|
|
717
|
+
</div>
|
|
718
|
+
|
|
719
|
+
<div class="mt-3 pt-3 border-t border-border flex items-center justify-between gap-2">
|
|
720
|
+
<div class="flex items-center gap-2">
|
|
721
|
+
<button class="text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1"
|
|
722
|
+
data-template-name="${escapeHtml(template.name)}"
|
|
723
|
+
data-scope="project"
|
|
724
|
+
data-action="install-template"
|
|
725
|
+
title="${t('mcp.installToProject')}">
|
|
726
|
+
<i data-lucide="download" class="w-3 h-3"></i>
|
|
727
|
+
${t('mcp.toProject')}
|
|
728
|
+
</button>
|
|
729
|
+
<button class="text-xs text-success hover:text-success/80 transition-colors flex items-center gap-1"
|
|
730
|
+
data-template-name="${escapeHtml(template.name)}"
|
|
731
|
+
data-scope="global"
|
|
732
|
+
data-action="install-template"
|
|
733
|
+
title="${t('mcp.installToGlobal')}">
|
|
734
|
+
<i data-lucide="globe" class="w-3 h-3"></i>
|
|
735
|
+
${t('mcp.toGlobal')}
|
|
736
|
+
</button>
|
|
737
|
+
</div>
|
|
738
|
+
<button class="text-xs text-destructive hover:text-destructive/80 transition-colors"
|
|
739
|
+
data-template-name="${escapeHtml(template.name)}"
|
|
740
|
+
data-action="delete-template"
|
|
741
|
+
title="${t('mcp.deleteTemplate')}">
|
|
742
|
+
<i data-lucide="trash-2" class="w-3 h-3"></i>
|
|
743
|
+
</button>
|
|
744
|
+
</div>
|
|
745
|
+
</div>
|
|
746
|
+
`).join('')}
|
|
747
|
+
</div>
|
|
748
|
+
</div>
|
|
749
|
+
` : ''}
|
|
750
|
+
|
|
751
|
+
<!-- Copy Codex Servers to Claude (Claude mode only) -->
|
|
752
|
+
${currentCliMode === 'claude' && Object.keys(codexMcpServers || {}).length > 0 ? `
|
|
753
|
+
<div class="mcp-section mb-6">
|
|
754
|
+
<div class="flex items-center justify-between mb-4">
|
|
755
|
+
<h3 class="text-lg font-semibold text-foreground flex items-center gap-2">
|
|
756
|
+
<i data-lucide="copy" class="w-5 h-5"></i>
|
|
757
|
+
${t('mcp.claude.copyFromCodex')}
|
|
758
|
+
</h3>
|
|
759
|
+
<span class="text-sm text-muted-foreground">${Object.keys(codexMcpServers || {}).length} ${t('mcp.serversAvailable')}</span>
|
|
760
|
+
</div>
|
|
761
|
+
<div class="mcp-server-grid grid gap-3">
|
|
762
|
+
${Object.entries(codexMcpServers || {}).map(([serverName, serverConfig]) => {
|
|
763
|
+
const alreadyInClaude = mcpUserServers && mcpUserServers[serverName];
|
|
764
|
+
const isStdio = !!serverConfig.command;
|
|
765
|
+
const isHttp = !!serverConfig.url;
|
|
766
|
+
return `
|
|
767
|
+
<div class="mcp-server-card bg-card border ${alreadyInClaude ? 'border-success/50' : 'border-primary/20'} border-dashed rounded-lg p-4 hover:shadow-md transition-all">
|
|
768
|
+
<div class="flex items-start justify-between mb-3">
|
|
769
|
+
<div class="flex items-center gap-2 flex-wrap">
|
|
770
|
+
<i data-lucide="code-2" class="w-5 h-5 text-primary"></i>
|
|
771
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(serverName)}</h4>
|
|
772
|
+
<span class="text-xs px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300 rounded-full">Codex</span>
|
|
773
|
+
${isHttp
|
|
774
|
+
? '<span class="text-xs px-2 py-0.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 rounded-full">HTTP</span>'
|
|
775
|
+
: '<span class="text-xs px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300 rounded-full">STDIO</span>'
|
|
776
|
+
}
|
|
777
|
+
${alreadyInClaude ? '<span class="text-xs px-2 py-0.5 bg-success/10 text-success rounded-full">' + t('mcp.claude.alreadyAdded') + '</span>' : ''}
|
|
778
|
+
</div>
|
|
779
|
+
${!alreadyInClaude ? `
|
|
780
|
+
<button class="px-3 py-1 text-xs bg-primary text-primary-foreground rounded hover:opacity-90 transition-opacity"
|
|
781
|
+
data-action="copy-codex-to-claude"
|
|
782
|
+
data-server-name="${escapeHtml(serverName)}"
|
|
783
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
784
|
+
title="${t('mcp.claude.copyToClaude')}">
|
|
785
|
+
<i data-lucide="arrow-right" class="w-3.5 h-3.5 inline"></i> Claude
|
|
786
|
+
</button>
|
|
787
|
+
` : ''}
|
|
788
|
+
</div>
|
|
789
|
+
<div class="mcp-server-details text-sm space-y-1">
|
|
790
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
791
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${isHttp ? t('mcp.url') : t('mcp.cmd')}</span>
|
|
792
|
+
<span class="truncate" title="${escapeHtml(serverConfig.command || serverConfig.url || 'N/A')}">${escapeHtml(serverConfig.command || serverConfig.url || 'N/A')}</span>
|
|
793
|
+
</div>
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
`;
|
|
797
|
+
}).join('')}
|
|
798
|
+
</div>
|
|
799
|
+
</div>
|
|
800
|
+
` : ''}
|
|
801
|
+
|
|
802
|
+
<!-- All Projects MCP Overview Table (Claude mode only) -->
|
|
803
|
+
${currentCliMode === 'claude' ? `
|
|
804
|
+
<div class="mcp-section mt-6">
|
|
805
|
+
<div class="flex items-center justify-between mb-4">
|
|
806
|
+
<h3 class="text-lg font-semibold text-foreground">${t('mcp.allProjects')}</h3>
|
|
807
|
+
<span class="text-sm text-muted-foreground">${Object.keys(mcpAllProjects).length} ${t('mcp.projects')}</span>
|
|
808
|
+
</div>
|
|
809
|
+
|
|
810
|
+
<div class="mcp-projects-table bg-card border border-border rounded-lg overflow-hidden">
|
|
811
|
+
<table class="w-full">
|
|
812
|
+
<thead class="bg-muted/50">
|
|
813
|
+
<tr>
|
|
814
|
+
<th class="text-left px-4 py-3 text-sm font-semibold text-foreground border-b border-border">${t('mcp.project')}</th>
|
|
815
|
+
<th class="text-left px-4 py-3 text-sm font-semibold text-foreground border-b border-border">${t('mcp.servers')}</th>
|
|
816
|
+
<th class="text-center px-4 py-3 text-sm font-semibold text-foreground border-b border-border w-24">${t('mcp.status')}</th>
|
|
817
|
+
</tr>
|
|
818
|
+
</thead>
|
|
819
|
+
<tbody>
|
|
820
|
+
${Object.entries(mcpAllProjects).map(([path, config]) => {
|
|
821
|
+
const servers = config.mcpServers || {};
|
|
822
|
+
const projectDisabled = config.disabledMcpServers || [];
|
|
823
|
+
const serverNames = Object.keys(servers);
|
|
824
|
+
const isCurrentProject = path === currentPath;
|
|
825
|
+
const enabledCount = serverNames.filter(s => !projectDisabled.includes(s)).length;
|
|
826
|
+
const projectHasMcpJson = config.hasMcpJson || false;
|
|
827
|
+
|
|
828
|
+
return `
|
|
829
|
+
<tr class="border-b border-border last:border-b-0 ${isCurrentProject ? 'bg-primary/5' : 'hover:bg-hover/50'}">
|
|
830
|
+
<td class="px-4 py-3">
|
|
831
|
+
<div class="flex items-center gap-2 min-w-0">
|
|
832
|
+
<span class="shrink-0">${isCurrentProject ? '<i data-lucide="map-pin" class="w-4 h-4 text-primary"></i>' : '<i data-lucide="folder" class="w-4 h-4"></i>'}</span>
|
|
833
|
+
<div class="min-w-0">
|
|
834
|
+
<div class="font-medium text-foreground truncate text-sm flex items-center gap-2" title="${escapeHtml(path)}">
|
|
835
|
+
<span class="truncate">${escapeHtml(path.split('\\').pop() || path)}</span>
|
|
836
|
+
${isCurrentProject ? `<span class="text-xs text-primary font-medium shrink-0">${t('mcp.current')}</span>` : ''}
|
|
837
|
+
${projectHasMcpJson ? `<span class="shrink-0 inline-flex items-center gap-1 px-1.5 py-0.5 text-xs bg-success/10 text-success rounded" title=".mcp.json detected"><i data-lucide="file-check" class="w-3 h-3"></i></span>` : ''}
|
|
838
|
+
</div>
|
|
839
|
+
<div class="text-xs text-muted-foreground truncate">${escapeHtml(path)}</div>
|
|
840
|
+
</div>
|
|
841
|
+
</div>
|
|
842
|
+
</td>
|
|
843
|
+
<td class="px-4 py-3">
|
|
844
|
+
<div class="flex flex-wrap gap-1.5">
|
|
845
|
+
${serverNames.length === 0
|
|
846
|
+
? `<span class="text-xs text-muted-foreground italic">${t('mcp.noMcpServers')}</span>`
|
|
847
|
+
: serverNames.map(serverName => {
|
|
848
|
+
const isEnabled = !projectDisabled.includes(serverName);
|
|
849
|
+
return `
|
|
850
|
+
<span class="inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full ${isEnabled ? 'bg-success-light text-success' : 'bg-hover text-muted-foreground'}">
|
|
851
|
+
<span class="w-1.5 h-1.5 rounded-full ${isEnabled ? 'bg-success' : 'bg-muted-foreground'}"></span>
|
|
852
|
+
${escapeHtml(serverName)}
|
|
853
|
+
</span>
|
|
854
|
+
`;
|
|
855
|
+
}).join('')
|
|
856
|
+
}
|
|
857
|
+
</div>
|
|
858
|
+
</td>
|
|
859
|
+
<td class="px-4 py-3 text-center">
|
|
860
|
+
<span class="inline-flex items-center px-2 py-1 text-xs font-semibold rounded-full ${serverNames.length > 0 ? 'bg-success-light text-success' : 'bg-hover text-muted-foreground'}">
|
|
861
|
+
${enabledCount}/${serverNames.length}
|
|
862
|
+
</span>
|
|
863
|
+
</td>
|
|
864
|
+
</tr>
|
|
865
|
+
`;
|
|
866
|
+
}).join('')}
|
|
867
|
+
</tbody>
|
|
868
|
+
</table>
|
|
869
|
+
</div>
|
|
870
|
+
</div>
|
|
871
|
+
` : ''}
|
|
872
|
+
`}
|
|
873
|
+
|
|
874
|
+
<!-- MCP Server Details Modal -->
|
|
875
|
+
<div id="mcpDetailsModal" class="fixed inset-0 bg-black/50 flex items-center justify-center z-50 hidden">
|
|
876
|
+
<div class="bg-card border border-border rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-hidden flex flex-col">
|
|
877
|
+
<!-- Modal Header -->
|
|
878
|
+
<div class="flex items-center justify-between px-6 py-4 border-b border-border">
|
|
879
|
+
<h2 class="text-lg font-semibold text-foreground">${t('mcp.detailsModal.title')}</h2>
|
|
880
|
+
<button id="mcpDetailsModalClose" class="text-muted-foreground hover:text-foreground transition-colors">
|
|
881
|
+
<i data-lucide="x" class="w-5 h-5"></i>
|
|
882
|
+
</button>
|
|
883
|
+
</div>
|
|
884
|
+
|
|
885
|
+
<!-- Modal Body -->
|
|
886
|
+
<div id="mcpDetailsModalBody" class="px-6 py-4 overflow-y-auto flex-1">
|
|
887
|
+
<!-- Content will be dynamically filled -->
|
|
888
|
+
</div>
|
|
889
|
+
</div>
|
|
890
|
+
</div>
|
|
891
|
+
</div>
|
|
892
|
+
`;
|
|
893
|
+
|
|
894
|
+
// Initialize Lucide icons FIRST (before attaching event listeners)
|
|
895
|
+
// lucide.createIcons() may replace DOM elements, which would remove event listeners
|
|
896
|
+
if (typeof lucide !== 'undefined') lucide.createIcons();
|
|
897
|
+
|
|
898
|
+
// Attach event listeners AFTER icon initialization
|
|
899
|
+
attachMcpEventListeners();
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
// Render card for Project Available MCP (current project can use)
|
|
903
|
+
function renderProjectAvailableServerCard(entry) {
|
|
904
|
+
const { name, config, source, canRemove, canToggle, isEnabled } = entry;
|
|
905
|
+
const command = config.command || 'N/A';
|
|
906
|
+
const args = config.args || [];
|
|
907
|
+
const hasEnv = config.env && Object.keys(config.env).length > 0;
|
|
908
|
+
|
|
909
|
+
// Source badge
|
|
910
|
+
let sourceBadge = '';
|
|
911
|
+
if (source === 'enterprise') {
|
|
912
|
+
sourceBadge = `<span class="text-xs px-2 py-0.5 bg-warning/20 text-warning rounded-full">${t('mcp.sourceEnterprise')}</span>`;
|
|
913
|
+
} else if (source === 'global') {
|
|
914
|
+
sourceBadge = `<span class="text-xs px-2 py-0.5 bg-success/10 text-success rounded-full">${t('mcp.sourceGlobal')}</span>`;
|
|
915
|
+
} else if (source === 'project') {
|
|
916
|
+
sourceBadge = `<span class="text-xs px-2 py-0.5 bg-primary/10 text-primary rounded-full">${t('mcp.sourceProject')}</span>`;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
return `
|
|
920
|
+
<div class="mcp-server-card bg-card border border-border rounded-lg p-4 hover:shadow-md transition-all cursor-pointer ${canToggle && !isEnabled ? 'opacity-60' : ''}"
|
|
921
|
+
data-server-name="${escapeHtml(name)}"
|
|
922
|
+
data-server-config="${encodeConfigData(config)}"
|
|
923
|
+
data-server-source="${source}"
|
|
924
|
+
data-action="view-details"
|
|
925
|
+
title="${t('mcp.clickToViewDetails')}">
|
|
926
|
+
<div class="flex items-start justify-between mb-3">
|
|
927
|
+
<div class="flex items-center gap-2">
|
|
928
|
+
<span>${canToggle && isEnabled ? '<i data-lucide="check-circle" class="w-5 h-5 text-success"></i>' : '<i data-lucide="circle" class="w-5 h-5 text-muted-foreground"></i>'}</span>
|
|
929
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(name)}</h4>
|
|
930
|
+
${sourceBadge}
|
|
931
|
+
</div>
|
|
932
|
+
${canToggle ? `
|
|
933
|
+
<label class="mcp-toggle relative inline-flex items-center cursor-pointer" onclick="event.stopPropagation()">
|
|
934
|
+
<input type="checkbox" class="sr-only peer"
|
|
935
|
+
${isEnabled ? 'checked' : ''}
|
|
936
|
+
data-server-name="${escapeHtml(name)}"
|
|
937
|
+
data-action="toggle">
|
|
938
|
+
<div class="w-9 h-5 bg-hover peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-success"></div>
|
|
939
|
+
</label>
|
|
940
|
+
` : ''}
|
|
941
|
+
</div>
|
|
942
|
+
|
|
943
|
+
<div class="mcp-server-details text-sm space-y-1">
|
|
944
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
945
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.cmd')}</span>
|
|
946
|
+
<span class="truncate" title="${escapeHtml(command)}">${escapeHtml(command)}</span>
|
|
947
|
+
</div>
|
|
948
|
+
${args.length > 0 ? `
|
|
949
|
+
<div class="flex items-start gap-2 text-muted-foreground">
|
|
950
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">${t('mcp.args')}</span>
|
|
951
|
+
<span class="text-xs font-mono truncate" title="${escapeHtml(args.join(' '))}">${escapeHtml(args.slice(0, 3).join(' '))}${args.length > 3 ? '...' : ''}</span>
|
|
952
|
+
</div>
|
|
953
|
+
` : ''}
|
|
954
|
+
${hasEnv ? `
|
|
955
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
956
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.env')}</span>
|
|
957
|
+
<span class="text-xs">${Object.keys(config.env).length} ${t('mcp.variables')}</span>
|
|
958
|
+
</div>
|
|
959
|
+
` : ''}
|
|
960
|
+
</div>
|
|
961
|
+
|
|
962
|
+
<div class="mt-3 pt-3 border-t border-border flex items-center justify-between gap-2">
|
|
963
|
+
<div class="flex items-center gap-2">
|
|
964
|
+
<button class="text-xs text-success hover:text-success/80 transition-colors flex items-center gap-1"
|
|
965
|
+
data-server-name="${escapeHtml(name)}"
|
|
966
|
+
data-server-config="${encodeConfigData(config)}"
|
|
967
|
+
data-action="save-as-template"
|
|
968
|
+
onclick="event.stopPropagation()"
|
|
969
|
+
title="${t('mcp.saveAsTemplate')}">
|
|
970
|
+
<i data-lucide="save" class="w-3 h-3"></i>
|
|
971
|
+
${t('mcp.saveAsTemplate')}
|
|
972
|
+
</button>
|
|
973
|
+
</div>
|
|
974
|
+
${canRemove ? `
|
|
975
|
+
<button class="text-xs text-destructive hover:text-destructive/80 transition-colors"
|
|
976
|
+
data-server-name="${escapeHtml(name)}"
|
|
977
|
+
data-action="remove"
|
|
978
|
+
onclick="event.stopPropagation()">
|
|
979
|
+
${t('mcp.removeFromProject')}
|
|
980
|
+
</button>
|
|
981
|
+
` : ''}
|
|
982
|
+
</div>
|
|
983
|
+
</div>
|
|
984
|
+
`;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// Render card for Global Management (manage global servers)
|
|
988
|
+
function renderGlobalManagementCard(serverName, serverConfig) {
|
|
989
|
+
const command = serverConfig.command || serverConfig.url || 'N/A';
|
|
990
|
+
const args = serverConfig.args || [];
|
|
991
|
+
const hasEnv = serverConfig.env && Object.keys(serverConfig.env).length > 0;
|
|
992
|
+
const serverType = serverConfig.type || 'stdio';
|
|
993
|
+
|
|
994
|
+
return `
|
|
995
|
+
<div class="mcp-server-card mcp-server-global bg-card border border-success/30 rounded-lg p-4 hover:shadow-md transition-all cursor-pointer"
|
|
996
|
+
data-server-name="${escapeHtml(serverName)}"
|
|
997
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
998
|
+
data-server-source="global"
|
|
999
|
+
data-action="view-details"
|
|
1000
|
+
title="${t('mcp.clickToEdit')}">
|
|
1001
|
+
<div class="flex items-start justify-between mb-3">
|
|
1002
|
+
<div class="flex items-center gap-2">
|
|
1003
|
+
<i data-lucide="globe" class="w-5 h-5 text-success"></i>
|
|
1004
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(serverName)}</h4>
|
|
1005
|
+
</div>
|
|
1006
|
+
</div>
|
|
1007
|
+
|
|
1008
|
+
<div class="mcp-server-details text-sm space-y-1">
|
|
1009
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1010
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${serverType === 'stdio' ? t('mcp.cmd') : t('mcp.url')}</span>
|
|
1011
|
+
<span class="truncate" title="${escapeHtml(command)}">${escapeHtml(command)}</span>
|
|
1012
|
+
</div>
|
|
1013
|
+
${args.length > 0 ? `
|
|
1014
|
+
<div class="flex items-start gap-2 text-muted-foreground">
|
|
1015
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">${t('mcp.args')}</span>
|
|
1016
|
+
<span class="text-xs font-mono truncate" title="${escapeHtml(args.join(' '))}">${escapeHtml(args.slice(0, 3).join(' '))}${args.length > 3 ? '...' : ''}</span>
|
|
1017
|
+
</div>
|
|
1018
|
+
` : ''}
|
|
1019
|
+
${hasEnv ? `
|
|
1020
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1021
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.env')}</span>
|
|
1022
|
+
<span class="text-xs">${Object.keys(serverConfig.env).length} ${t('mcp.variables')}</span>
|
|
1023
|
+
</div>
|
|
1024
|
+
` : ''}
|
|
1025
|
+
<div class="flex items-center gap-2 text-muted-foreground mt-1">
|
|
1026
|
+
<span class="text-xs italic">${t('mcp.availableToAll')}</span>
|
|
1027
|
+
</div>
|
|
1028
|
+
</div>
|
|
1029
|
+
|
|
1030
|
+
<div class="mt-3 pt-3 border-t border-border flex items-center justify-end">
|
|
1031
|
+
<button class="text-xs text-destructive hover:text-destructive/80 transition-colors"
|
|
1032
|
+
data-server-name="${escapeHtml(serverName)}"
|
|
1033
|
+
data-action="remove-global"
|
|
1034
|
+
onclick="event.stopPropagation()">
|
|
1035
|
+
${t('mcp.removeGlobal')}
|
|
1036
|
+
</button>
|
|
1037
|
+
</div>
|
|
1038
|
+
</div>
|
|
1039
|
+
`;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
function renderAvailableServerCard(serverName, serverInfo) {
|
|
1043
|
+
const serverConfig = serverInfo.config;
|
|
1044
|
+
const usedIn = serverInfo.usedIn || [];
|
|
1045
|
+
const command = serverConfig.command || 'N/A';
|
|
1046
|
+
const args = serverConfig.args || [];
|
|
1047
|
+
|
|
1048
|
+
// Get the actual name to use when adding (original name if different from display key)
|
|
1049
|
+
const originalName = serverInfo.originalName || serverName;
|
|
1050
|
+
const hasVariant = serverInfo.originalName && serverInfo.originalName !== serverName;
|
|
1051
|
+
|
|
1052
|
+
// Get source project info
|
|
1053
|
+
const sourceProject = serverInfo.sourceProject;
|
|
1054
|
+
const sourceProjectName = sourceProject ? (sourceProject.split('\\').pop() || sourceProject.split('/').pop()) : null;
|
|
1055
|
+
|
|
1056
|
+
// Generate args preview
|
|
1057
|
+
const argsPreview = args.length > 0 ? args.slice(0, 3).join(' ') + (args.length > 3 ? '...' : '') : '';
|
|
1058
|
+
|
|
1059
|
+
return `
|
|
1060
|
+
<div class="mcp-server-card mcp-server-available bg-card border border-border border-dashed rounded-lg p-4 hover:shadow-md hover:border-solid transition-all">
|
|
1061
|
+
<div class="flex items-start justify-between mb-3">
|
|
1062
|
+
<div class="flex items-center gap-2 flex-wrap">
|
|
1063
|
+
<span><i data-lucide="circle-dashed" class="w-5 h-5 text-muted-foreground"></i></span>
|
|
1064
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(originalName)}</h4>
|
|
1065
|
+
${hasVariant ? `
|
|
1066
|
+
<span class="text-xs px-2 py-0.5 bg-warning/20 text-warning rounded-full" title="Different config from: ${escapeHtml(sourceProject || '')}">
|
|
1067
|
+
${escapeHtml(sourceProjectName || 'variant')}
|
|
1068
|
+
</span>
|
|
1069
|
+
` : ''}
|
|
1070
|
+
</div>
|
|
1071
|
+
<div class="flex gap-2">
|
|
1072
|
+
<button class="px-3 py-1 text-xs bg-primary text-primary-foreground rounded hover:opacity-90 transition-opacity"
|
|
1073
|
+
data-server-name="${escapeHtml(originalName)}"
|
|
1074
|
+
data-server-key="${escapeHtml(serverName)}"
|
|
1075
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
1076
|
+
data-scope="project"
|
|
1077
|
+
data-action="add-from-other"
|
|
1078
|
+
title="${t('mcp.installToProject')}">
|
|
1079
|
+
<i data-lucide="folder-plus" class="w-3.5 h-3.5 inline"></i>
|
|
1080
|
+
</button>
|
|
1081
|
+
<button class="px-3 py-1 text-xs bg-success text-success-foreground rounded hover:opacity-90 transition-opacity"
|
|
1082
|
+
data-server-name="${escapeHtml(originalName)}"
|
|
1083
|
+
data-server-key="${escapeHtml(serverName)}"
|
|
1084
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
1085
|
+
data-scope="global"
|
|
1086
|
+
data-action="add-from-other"
|
|
1087
|
+
title="${t('mcp.installToGlobal')}">
|
|
1088
|
+
<i data-lucide="globe" class="w-3.5 h-3.5 inline"></i>
|
|
1089
|
+
</button>
|
|
1090
|
+
</div>
|
|
1091
|
+
</div>
|
|
1092
|
+
|
|
1093
|
+
<div class="mcp-server-details text-sm space-y-1">
|
|
1094
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1095
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.cmd')}</span>
|
|
1096
|
+
<span class="truncate" title="${escapeHtml(command)}">${escapeHtml(command)}</span>
|
|
1097
|
+
</div>
|
|
1098
|
+
${argsPreview ? `
|
|
1099
|
+
<div class="flex items-start gap-2 text-muted-foreground">
|
|
1100
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">${t('mcp.args')}</span>
|
|
1101
|
+
<span class="text-xs font-mono truncate" title="${escapeHtml(args.join(' '))}">${escapeHtml(argsPreview)}</span>
|
|
1102
|
+
</div>
|
|
1103
|
+
` : ''}
|
|
1104
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1105
|
+
<span class="text-xs">${t('mcp.usedInCount').replace('{count}', usedIn.length).replace('{s}', usedIn.length !== 1 ? 's' : '')}</span>
|
|
1106
|
+
${sourceProjectName ? `<span class="text-xs text-muted-foreground/70">• ${t('mcp.from')} ${escapeHtml(sourceProjectName)}</span>` : ''}
|
|
1107
|
+
</div>
|
|
1108
|
+
</div>
|
|
1109
|
+
|
|
1110
|
+
<div class="mt-3 pt-3 border-t border-border flex items-center gap-2">
|
|
1111
|
+
<button class="text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1"
|
|
1112
|
+
data-server-name="${escapeHtml(originalName)}"
|
|
1113
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
1114
|
+
data-action="install-to-project"
|
|
1115
|
+
title="${t('mcp.installToProject')}">
|
|
1116
|
+
<i data-lucide="download" class="w-3 h-3"></i>
|
|
1117
|
+
${t('mcp.installToProject')}
|
|
1118
|
+
</button>
|
|
1119
|
+
<button class="text-xs text-success hover:text-success/80 transition-colors flex items-center gap-1"
|
|
1120
|
+
data-server-name="${escapeHtml(originalName)}"
|
|
1121
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
1122
|
+
data-action="install-to-global"
|
|
1123
|
+
title="${t('mcp.installToGlobal')}">
|
|
1124
|
+
<i data-lucide="globe" class="w-3 h-3"></i>
|
|
1125
|
+
${t('mcp.installToGlobal')}
|
|
1126
|
+
</button>
|
|
1127
|
+
</div>
|
|
1128
|
+
</div>
|
|
1129
|
+
`;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
// Render available server card for Codex mode (with Claude badge and copy to Codex button)
|
|
1133
|
+
function renderAvailableServerCardForCodex(serverName, serverInfo) {
|
|
1134
|
+
const serverConfig = serverInfo.config;
|
|
1135
|
+
const usedIn = serverInfo.usedIn || [];
|
|
1136
|
+
const command = serverConfig.command || serverConfig.url || 'N/A';
|
|
1137
|
+
const args = serverConfig.args || [];
|
|
1138
|
+
|
|
1139
|
+
// Get the actual name to use when adding
|
|
1140
|
+
const originalName = serverInfo.originalName || serverName;
|
|
1141
|
+
const hasVariant = serverInfo.originalName && serverInfo.originalName !== serverName;
|
|
1142
|
+
|
|
1143
|
+
// Get source project info
|
|
1144
|
+
const sourceProject = serverInfo.sourceProject;
|
|
1145
|
+
const sourceProjectName = sourceProject ? (sourceProject.split('\\').pop() || sourceProject.split('/').pop()) : null;
|
|
1146
|
+
|
|
1147
|
+
// Generate args preview
|
|
1148
|
+
const argsPreview = args.length > 0 ? args.slice(0, 3).join(' ') + (args.length > 3 ? '...' : '') : '';
|
|
1149
|
+
|
|
1150
|
+
// Check if already in Codex
|
|
1151
|
+
const alreadyInCodex = codexMcpServers && codexMcpServers[originalName];
|
|
1152
|
+
|
|
1153
|
+
return `
|
|
1154
|
+
<div class="mcp-server-card mcp-server-available bg-card border ${alreadyInCodex ? 'border-success/50' : 'border-border'} border-dashed rounded-lg p-4 hover:shadow-md hover:border-solid transition-all">
|
|
1155
|
+
<div class="flex items-start justify-between mb-3">
|
|
1156
|
+
<div class="flex items-center gap-2 flex-wrap">
|
|
1157
|
+
<span><i data-lucide="circle-dashed" class="w-5 h-5 text-muted-foreground"></i></span>
|
|
1158
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(originalName)}</h4>
|
|
1159
|
+
<span class="text-xs px-2 py-0.5 bg-primary/10 text-primary rounded-full">Claude</span>
|
|
1160
|
+
${hasVariant ? `
|
|
1161
|
+
<span class="text-xs px-2 py-0.5 bg-warning/20 text-warning rounded-full" title="Different config from: ${escapeHtml(sourceProject || '')}">
|
|
1162
|
+
${escapeHtml(sourceProjectName || 'variant')}
|
|
1163
|
+
</span>
|
|
1164
|
+
` : ''}
|
|
1165
|
+
${alreadyInCodex ? `<span class="text-xs px-2 py-0.5 bg-success/10 text-success rounded-full">${t('mcp.codex.alreadyAdded')}</span>` : ''}
|
|
1166
|
+
</div>
|
|
1167
|
+
${!alreadyInCodex ? `
|
|
1168
|
+
<button class="px-3 py-1 text-xs bg-primary text-primary-foreground rounded hover:opacity-90 transition-opacity"
|
|
1169
|
+
data-action="copy-to-codex"
|
|
1170
|
+
data-server-name="${escapeHtml(originalName)}"
|
|
1171
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
1172
|
+
title="${t('mcp.codex.copyToCodex')}">
|
|
1173
|
+
<i data-lucide="arrow-right" class="w-3.5 h-3.5 inline"></i> Codex
|
|
1174
|
+
</button>
|
|
1175
|
+
` : ''}
|
|
1176
|
+
</div>
|
|
1177
|
+
|
|
1178
|
+
<div class="mcp-server-details text-sm space-y-1">
|
|
1179
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1180
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.cmd')}</span>
|
|
1181
|
+
<span class="truncate" title="${escapeHtml(command)}">${escapeHtml(command)}</span>
|
|
1182
|
+
</div>
|
|
1183
|
+
${argsPreview ? `
|
|
1184
|
+
<div class="flex items-start gap-2 text-muted-foreground">
|
|
1185
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">${t('mcp.args')}</span>
|
|
1186
|
+
<span class="text-xs font-mono truncate" title="${escapeHtml(args.join(' '))}">${escapeHtml(argsPreview)}</span>
|
|
1187
|
+
</div>
|
|
1188
|
+
` : ''}
|
|
1189
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1190
|
+
<span class="text-xs">${t('mcp.usedInCount').replace('{count}', usedIn.length).replace('{s}', usedIn.length !== 1 ? 's' : '')}</span>
|
|
1191
|
+
${sourceProjectName ? `<span class="text-xs text-muted-foreground/70">• ${t('mcp.from')} ${escapeHtml(sourceProjectName)}</span>` : ''}
|
|
1192
|
+
</div>
|
|
1193
|
+
</div>
|
|
1194
|
+
|
|
1195
|
+
<div class="mt-3 pt-3 border-t border-border flex items-center gap-2">
|
|
1196
|
+
<button class="text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1"
|
|
1197
|
+
data-action="copy-to-codex"
|
|
1198
|
+
data-server-name="${escapeHtml(originalName)}"
|
|
1199
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
1200
|
+
title="${t('mcp.codex.copyToCodex')}">
|
|
1201
|
+
<i data-lucide="download" class="w-3 h-3"></i>
|
|
1202
|
+
${t('mcp.codex.install')}
|
|
1203
|
+
</button>
|
|
1204
|
+
</div>
|
|
1205
|
+
</div>
|
|
1206
|
+
`;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
// ========================================
|
|
1210
|
+
// Codex MCP Server Card Renderer
|
|
1211
|
+
// ========================================
|
|
1212
|
+
|
|
1213
|
+
function renderCodexServerCard(serverName, serverConfig) {
|
|
1214
|
+
const isStdio = !!serverConfig.command;
|
|
1215
|
+
const isHttp = !!serverConfig.url;
|
|
1216
|
+
const isEnabled = serverConfig.enabled !== false; // Default to enabled
|
|
1217
|
+
const command = serverConfig.command || serverConfig.url || 'N/A';
|
|
1218
|
+
const args = serverConfig.args || [];
|
|
1219
|
+
const hasEnv = serverConfig.env && Object.keys(serverConfig.env).length > 0;
|
|
1220
|
+
|
|
1221
|
+
// Server type badge
|
|
1222
|
+
const typeBadge = isHttp
|
|
1223
|
+
? `<span class="text-xs px-2 py-0.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 rounded-full">HTTP</span>`
|
|
1224
|
+
: `<span class="text-xs px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300 rounded-full">STDIO</span>`;
|
|
1225
|
+
|
|
1226
|
+
return `
|
|
1227
|
+
<div class="mcp-server-card bg-card border border-primary/20 rounded-lg p-4 hover:shadow-md transition-all cursor-pointer ${!isEnabled ? 'opacity-60' : ''}"
|
|
1228
|
+
data-server-name="${escapeHtml(serverName)}"
|
|
1229
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
1230
|
+
data-cli-type="codex"
|
|
1231
|
+
data-action="view-details-codex"
|
|
1232
|
+
title="${t('mcp.clickToEdit')}">
|
|
1233
|
+
<div class="flex items-start justify-between mb-3">
|
|
1234
|
+
<div class="flex items-center gap-2 flex-wrap">
|
|
1235
|
+
<span>${isEnabled ? '<i data-lucide="check-circle" class="w-5 h-5 text-primary"></i>' : '<i data-lucide="circle" class="w-5 h-5 text-muted-foreground"></i>'}</span>
|
|
1236
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(serverName)}</h4>
|
|
1237
|
+
<span class="text-xs px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300 rounded-full">Codex</span>
|
|
1238
|
+
${typeBadge}
|
|
1239
|
+
</div>
|
|
1240
|
+
<label class="mcp-toggle relative inline-flex items-center cursor-pointer" onclick="event.stopPropagation()">
|
|
1241
|
+
<input type="checkbox" class="sr-only peer"
|
|
1242
|
+
${isEnabled ? 'checked' : ''}
|
|
1243
|
+
data-server-name="${escapeHtml(serverName)}"
|
|
1244
|
+
data-action="toggle-codex">
|
|
1245
|
+
<div class="w-9 h-5 bg-hover peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-primary"></div>
|
|
1246
|
+
</label>
|
|
1247
|
+
</div>
|
|
1248
|
+
|
|
1249
|
+
<div class="mcp-server-details text-sm space-y-1">
|
|
1250
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1251
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${isHttp ? t('mcp.url') : t('mcp.cmd')}</span>
|
|
1252
|
+
<span class="truncate" title="${escapeHtml(command)}">${escapeHtml(command)}</span>
|
|
1253
|
+
</div>
|
|
1254
|
+
${args.length > 0 ? `
|
|
1255
|
+
<div class="flex items-start gap-2 text-muted-foreground">
|
|
1256
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">${t('mcp.args')}</span>
|
|
1257
|
+
<span class="text-xs font-mono truncate" title="${escapeHtml(args.join(' '))}">${escapeHtml(args.slice(0, 3).join(' '))}${args.length > 3 ? '...' : ''}</span>
|
|
1258
|
+
</div>
|
|
1259
|
+
` : ''}
|
|
1260
|
+
${hasEnv ? `
|
|
1261
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1262
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.env')}</span>
|
|
1263
|
+
<span class="text-xs">${Object.keys(serverConfig.env).length} ${t('mcp.variables')}</span>
|
|
1264
|
+
</div>
|
|
1265
|
+
` : ''}
|
|
1266
|
+
${serverConfig.enabled_tools ? `
|
|
1267
|
+
<div class="flex items-center gap-2 text-muted-foreground">
|
|
1268
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${t('mcp.codex.enabledTools')}</span>
|
|
1269
|
+
<span class="text-xs">${serverConfig.enabled_tools.length} ${t('mcp.codex.tools')}</span>
|
|
1270
|
+
</div>
|
|
1271
|
+
` : ''}
|
|
1272
|
+
</div>
|
|
1273
|
+
|
|
1274
|
+
<div class="mt-3 pt-3 border-t border-border flex items-center justify-between gap-2" onclick="event.stopPropagation()">
|
|
1275
|
+
<div class="flex items-center gap-2">
|
|
1276
|
+
<button class="text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1"
|
|
1277
|
+
data-action="copy-codex-to-claude"
|
|
1278
|
+
data-server-name="${escapeHtml(serverName)}"
|
|
1279
|
+
data-server-config="${encodeConfigData(serverConfig)}"
|
|
1280
|
+
title="${t('mcp.codex.copyToClaude')}">
|
|
1281
|
+
<i data-lucide="copy" class="w-3 h-3"></i>
|
|
1282
|
+
${t('mcp.codex.copyToClaude')}
|
|
1283
|
+
</button>
|
|
1284
|
+
</div>
|
|
1285
|
+
<button class="text-xs text-destructive hover:text-destructive/80 transition-colors"
|
|
1286
|
+
data-server-name="${escapeHtml(serverName)}"
|
|
1287
|
+
data-action="remove-codex">
|
|
1288
|
+
${t('mcp.codex.remove')}
|
|
1289
|
+
</button>
|
|
1290
|
+
</div>
|
|
1291
|
+
</div>
|
|
1292
|
+
`;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
// Render card for cross-CLI servers (servers from other CLI not in current CLI)
|
|
1296
|
+
function renderCrossCliServerCard(server, isClaude) {
|
|
1297
|
+
const { name, config, fromCli } = server;
|
|
1298
|
+
const isStdio = !!config.command;
|
|
1299
|
+
const isHttp = !!config.url;
|
|
1300
|
+
const command = config.command || config.url || 'N/A';
|
|
1301
|
+
const args = config.args || [];
|
|
1302
|
+
|
|
1303
|
+
// Icon and color based on source CLI
|
|
1304
|
+
const icon = fromCli === 'codex' ? 'circle-dashed' : 'circle';
|
|
1305
|
+
const sourceBadgeColor = fromCli === 'codex' ? 'green' : 'orange';
|
|
1306
|
+
const targetCli = isClaude ? 'project' : 'codex';
|
|
1307
|
+
const buttonText = isClaude ? t('mcp.codex.copyToClaude') : t('mcp.claude.copyToCodex');
|
|
1308
|
+
const typeBadge = isHttp
|
|
1309
|
+
? `<span class="text-xs px-2 py-0.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 rounded-full">HTTP</span>`
|
|
1310
|
+
: `<span class="text-xs px-2 py-0.5 bg-muted text-muted-foreground rounded-full">STDIO</span>`;
|
|
1311
|
+
|
|
1312
|
+
// CLI badge with color
|
|
1313
|
+
const cliBadge = fromCli === 'codex'
|
|
1314
|
+
? `<span class="text-xs px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300 rounded-full">Codex</span>`
|
|
1315
|
+
: `<span class="text-xs px-2 py-0.5 bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300 rounded-full">Claude</span>`;
|
|
1316
|
+
|
|
1317
|
+
return `
|
|
1318
|
+
<div class="mcp-server-card bg-card border border-dashed border-primary/20 rounded-lg p-4 hover:shadow-md hover:border-solid transition-all">
|
|
1319
|
+
<div class="flex items-start justify-between mb-3">
|
|
1320
|
+
<div class="flex items-start gap-3">
|
|
1321
|
+
<div class="shrink-0">
|
|
1322
|
+
<i data-lucide="${icon}" class="w-5 h-5 text-primary"></i>
|
|
1323
|
+
</div>
|
|
1324
|
+
<div>
|
|
1325
|
+
<div class="flex items-center gap-2 flex-wrap mb-1">
|
|
1326
|
+
<h4 class="font-semibold text-foreground">${escapeHtml(name)}</h4>
|
|
1327
|
+
${cliBadge}
|
|
1328
|
+
${typeBadge}
|
|
1329
|
+
</div>
|
|
1330
|
+
<div class="text-sm space-y-1 text-muted-foreground">
|
|
1331
|
+
<div class="flex items-center gap-2">
|
|
1332
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded">${isHttp ? t('mcp.url') : t('mcp.cmd')}</span>
|
|
1333
|
+
<span class="truncate text-xs" title="${escapeHtml(command)}">${escapeHtml(command)}</span>
|
|
1334
|
+
</div>
|
|
1335
|
+
${args.length > 0 ? `
|
|
1336
|
+
<div class="flex items-start gap-2">
|
|
1337
|
+
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">${t('mcp.args')}</span>
|
|
1338
|
+
<span class="text-xs font-mono truncate" title="${escapeHtml(args.join(' '))}">${escapeHtml(args.slice(0, 3).join(' '))}${args.length > 3 ? '...' : ''}</span>
|
|
1339
|
+
</div>
|
|
1340
|
+
` : ''}
|
|
1341
|
+
</div>
|
|
1342
|
+
</div>
|
|
1343
|
+
</div>
|
|
1344
|
+
</div>
|
|
1345
|
+
<div class="mt-3 pt-3 border-t border-border">
|
|
1346
|
+
<button class="w-full px-3 py-2 text-sm font-medium bg-primary hover:bg-primary/90 text-primary-foreground rounded-lg transition-colors flex items-center justify-center gap-1.5"
|
|
1347
|
+
data-action="copy-cross-cli"
|
|
1348
|
+
data-server-name="${escapeHtml(name)}"
|
|
1349
|
+
data-server-config="${encodeConfigData(config)}"
|
|
1350
|
+
data-from-cli="${fromCli}"
|
|
1351
|
+
data-target-cli="${targetCli}">
|
|
1352
|
+
<i data-lucide="copy" class="w-4 h-4"></i>
|
|
1353
|
+
${buttonText}
|
|
1354
|
+
</button>
|
|
1355
|
+
</div>
|
|
1356
|
+
</div>
|
|
1357
|
+
`;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// Copy server from one CLI to another
|
|
1361
|
+
async function copyCrossCliServer(name, config, fromCli, targetCli) {
|
|
1362
|
+
try {
|
|
1363
|
+
let endpoint, body;
|
|
1364
|
+
|
|
1365
|
+
if (targetCli === 'codex') {
|
|
1366
|
+
// Copy from Claude to Codex
|
|
1367
|
+
endpoint = '/api/codex-mcp-add';
|
|
1368
|
+
body = { serverName: name, serverConfig: config };
|
|
1369
|
+
} else if (targetCli === 'project') {
|
|
1370
|
+
// Copy from Codex to Claude project
|
|
1371
|
+
endpoint = '/api/mcp-copy-server';
|
|
1372
|
+
body = { projectPath, serverName: name, serverConfig: config, configType: 'mcp' };
|
|
1373
|
+
} else if (targetCli === 'global') {
|
|
1374
|
+
// Copy to Claude global
|
|
1375
|
+
endpoint = '/api/mcp-add-global-server';
|
|
1376
|
+
body = { serverName: name, serverConfig: config };
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
const res = await fetch(endpoint, {
|
|
1380
|
+
method: 'POST',
|
|
1381
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1382
|
+
body: JSON.stringify(body)
|
|
1383
|
+
});
|
|
1384
|
+
|
|
1385
|
+
const data = await res.json();
|
|
1386
|
+
if (data.success) {
|
|
1387
|
+
const targetName = targetCli === 'codex' ? 'Codex' : 'Claude';
|
|
1388
|
+
showToast(t('mcp.success'), `${t('mcp.serverInstalled')} (${targetName})`, 'success');
|
|
1389
|
+
await loadMcpConfig();
|
|
1390
|
+
renderMcpManager();
|
|
1391
|
+
} else {
|
|
1392
|
+
showToast(t('mcp.error'), data.error, 'error');
|
|
1393
|
+
}
|
|
1394
|
+
} catch (error) {
|
|
1395
|
+
showToast(t('mcp.error'), error.message, 'error');
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
// ========================================
|
|
1400
|
+
// Codex MCP Create Modal
|
|
1401
|
+
// ========================================
|
|
1402
|
+
|
|
1403
|
+
function openCodexMcpCreateModal() {
|
|
1404
|
+
// Reuse the existing modal with different settings
|
|
1405
|
+
const modal = document.getElementById('mcpCreateModal');
|
|
1406
|
+
if (modal) {
|
|
1407
|
+
modal.classList.remove('hidden');
|
|
1408
|
+
// Reset to form mode
|
|
1409
|
+
mcpCreateMode = 'form';
|
|
1410
|
+
switchMcpCreateTab('form');
|
|
1411
|
+
// Clear form
|
|
1412
|
+
document.getElementById('mcpServerName').value = '';
|
|
1413
|
+
document.getElementById('mcpServerCommand').value = '';
|
|
1414
|
+
document.getElementById('mcpServerArgs').value = '';
|
|
1415
|
+
document.getElementById('mcpServerEnv').value = '';
|
|
1416
|
+
// Clear JSON input
|
|
1417
|
+
document.getElementById('mcpServerJson').value = '';
|
|
1418
|
+
document.getElementById('mcpJsonPreview').classList.add('hidden');
|
|
1419
|
+
// Set scope to codex
|
|
1420
|
+
const scopeSelect = document.getElementById('mcpServerScope');
|
|
1421
|
+
if (scopeSelect) {
|
|
1422
|
+
// Add codex option if not exists
|
|
1423
|
+
if (!scopeSelect.querySelector('option[value="codex"]')) {
|
|
1424
|
+
const codexOption = document.createElement('option');
|
|
1425
|
+
codexOption.value = 'codex';
|
|
1426
|
+
codexOption.textContent = t('mcp.codex.scopeCodex');
|
|
1427
|
+
scopeSelect.appendChild(codexOption);
|
|
1428
|
+
}
|
|
1429
|
+
scopeSelect.value = 'codex';
|
|
1430
|
+
}
|
|
1431
|
+
// Focus on name input
|
|
1432
|
+
document.getElementById('mcpServerName').focus();
|
|
1433
|
+
// Setup JSON input listener
|
|
1434
|
+
setupMcpJsonListener();
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
function attachMcpEventListeners() {
|
|
1439
|
+
// Debug: Log event listener attachment
|
|
1440
|
+
const viewDetailsCards = document.querySelectorAll('.mcp-server-card[data-action="view-details"]');
|
|
1441
|
+
const codexCards = document.querySelectorAll('.mcp-server-card[data-action="view-details-codex"]');
|
|
1442
|
+
console.log('[MCP] Attaching event listeners - Claude cards:', viewDetailsCards.length, 'Codex cards:', codexCards.length);
|
|
1443
|
+
|
|
1444
|
+
// Toggle switches
|
|
1445
|
+
document.querySelectorAll('.mcp-server-card input[data-action="toggle"]').forEach(input => {
|
|
1446
|
+
input.addEventListener('change', async (e) => {
|
|
1447
|
+
const serverName = e.target.dataset.serverName;
|
|
1448
|
+
const enable = e.target.checked;
|
|
1449
|
+
await toggleMcpServer(serverName, enable);
|
|
1450
|
+
});
|
|
1451
|
+
});
|
|
1452
|
+
|
|
1453
|
+
// Add from other projects (with scope selection)
|
|
1454
|
+
document.querySelectorAll('.mcp-server-card button[data-action="add-from-other"]').forEach(btn => {
|
|
1455
|
+
btn.addEventListener('click', async (e) => {
|
|
1456
|
+
try {
|
|
1457
|
+
const serverName = btn.dataset.serverName;
|
|
1458
|
+
const serverConfig = decodeConfigData(btn.dataset.serverConfig);
|
|
1459
|
+
const scope = btn.dataset.scope; // 'project' or 'global'
|
|
1460
|
+
|
|
1461
|
+
if (scope === 'global') {
|
|
1462
|
+
await addGlobalMcpServer(serverName, serverConfig);
|
|
1463
|
+
} else {
|
|
1464
|
+
await copyMcpServerToProject(serverName, serverConfig);
|
|
1465
|
+
}
|
|
1466
|
+
} catch (err) {
|
|
1467
|
+
console.error('[MCP] Error adding server from other project:', err);
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
});
|
|
1471
|
+
|
|
1472
|
+
// Remove buttons (project-level)
|
|
1473
|
+
document.querySelectorAll('.mcp-server-card button[data-action="remove"]').forEach(btn => {
|
|
1474
|
+
btn.addEventListener('click', async (e) => {
|
|
1475
|
+
const serverName = btn.dataset.serverName;
|
|
1476
|
+
if (confirm(t('mcp.removeConfirm', { name: serverName }))) {
|
|
1477
|
+
await removeMcpServerFromProject(serverName);
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
});
|
|
1481
|
+
|
|
1482
|
+
// Remove buttons (global-level)
|
|
1483
|
+
document.querySelectorAll('.mcp-server-card button[data-action="remove-global"]').forEach(btn => {
|
|
1484
|
+
btn.addEventListener('click', async (e) => {
|
|
1485
|
+
const serverName = btn.dataset.serverName;
|
|
1486
|
+
if (confirm(t('mcp.removeGlobalConfirm', { name: serverName }))) {
|
|
1487
|
+
await removeGlobalMcpServer(serverName);
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
// Install to project buttons
|
|
1493
|
+
document.querySelectorAll('.mcp-server-card button[data-action="install-to-project"]').forEach(btn => {
|
|
1494
|
+
btn.addEventListener('click', async (e) => {
|
|
1495
|
+
try {
|
|
1496
|
+
const serverName = btn.dataset.serverName;
|
|
1497
|
+
const serverConfig = decodeConfigData(btn.dataset.serverConfig);
|
|
1498
|
+
await copyMcpServerToProject(serverName, serverConfig);
|
|
1499
|
+
} catch (err) {
|
|
1500
|
+
console.error('[MCP] Error installing to project:', err);
|
|
1501
|
+
}
|
|
1502
|
+
});
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
// Install to global buttons
|
|
1506
|
+
document.querySelectorAll('.mcp-server-card button[data-action="install-to-global"]').forEach(btn => {
|
|
1507
|
+
btn.addEventListener('click', async (e) => {
|
|
1508
|
+
try {
|
|
1509
|
+
const serverName = btn.dataset.serverName;
|
|
1510
|
+
const serverConfig = decodeConfigData(btn.dataset.serverConfig);
|
|
1511
|
+
await addGlobalMcpServer(serverName, serverConfig);
|
|
1512
|
+
} catch (err) {
|
|
1513
|
+
console.error('[MCP] Error installing to global:', err);
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
});
|
|
1517
|
+
|
|
1518
|
+
// Save as template buttons
|
|
1519
|
+
document.querySelectorAll('.mcp-server-card button[data-action="save-as-template"]').forEach(btn => {
|
|
1520
|
+
btn.addEventListener('click', async (e) => {
|
|
1521
|
+
try {
|
|
1522
|
+
const serverName = btn.dataset.serverName;
|
|
1523
|
+
const serverConfig = decodeConfigData(btn.dataset.serverConfig);
|
|
1524
|
+
await saveMcpAsTemplate(serverName, serverConfig);
|
|
1525
|
+
} catch (err) {
|
|
1526
|
+
console.error('[MCP] Error saving as template:', err);
|
|
1527
|
+
}
|
|
1528
|
+
});
|
|
1529
|
+
});
|
|
1530
|
+
|
|
1531
|
+
// Install from template buttons
|
|
1532
|
+
document.querySelectorAll('.mcp-template-card button[data-action="install-template"]').forEach(btn => {
|
|
1533
|
+
btn.addEventListener('click', async (e) => {
|
|
1534
|
+
const templateName = btn.dataset.templateName;
|
|
1535
|
+
const scope = btn.dataset.scope || 'project';
|
|
1536
|
+
await installFromTemplate(templateName, scope);
|
|
1537
|
+
});
|
|
1538
|
+
});
|
|
1539
|
+
|
|
1540
|
+
// Delete template buttons
|
|
1541
|
+
document.querySelectorAll('.mcp-template-card button[data-action="delete-template"]').forEach(btn => {
|
|
1542
|
+
btn.addEventListener('click', async (e) => {
|
|
1543
|
+
const templateName = btn.dataset.templateName;
|
|
1544
|
+
if (confirm(t('mcp.deleteTemplateConfirm', { name: templateName }))) {
|
|
1545
|
+
await deleteMcpTemplate(templateName);
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1550
|
+
// ========================================
|
|
1551
|
+
// CCW Tools MCP Event Listeners
|
|
1552
|
+
// ========================================
|
|
1553
|
+
|
|
1554
|
+
// CCW Tools action buttons (workspace/global install/update)
|
|
1555
|
+
const ccwActions = {
|
|
1556
|
+
'update-ccw-workspace': () => updateCcwToolsMcp('workspace'),
|
|
1557
|
+
'update-ccw-global': () => updateCcwToolsMcp('global'),
|
|
1558
|
+
'install-ccw-workspace': () => installCcwToolsMcp('workspace'),
|
|
1559
|
+
'install-ccw-global': () => installCcwToolsMcp('global'),
|
|
1560
|
+
'install-ccw-codex': () => installCcwToolsMcpToCodex()
|
|
1561
|
+
};
|
|
1562
|
+
|
|
1563
|
+
// Mode-specific and conditionally rendered actions (don't warn if not found)
|
|
1564
|
+
const conditionalActions = new Set([
|
|
1565
|
+
'install-ccw-codex', // Only in Codex mode
|
|
1566
|
+
'update-ccw-workspace', // Only if ccw-tools installed
|
|
1567
|
+
'update-ccw-global' // Only if ccw-tools installed
|
|
1568
|
+
]);
|
|
1569
|
+
|
|
1570
|
+
Object.entries(ccwActions).forEach(([action, handler]) => {
|
|
1571
|
+
const btns = document.querySelectorAll(`button[data-action="${action}"]`);
|
|
1572
|
+
|
|
1573
|
+
if (btns.length > 0) {
|
|
1574
|
+
console.log(`[MCP] Attaching listener to ${action} (${btns.length} button(s) found)`);
|
|
1575
|
+
btns.forEach(btn => {
|
|
1576
|
+
btn.addEventListener('click', async (e) => {
|
|
1577
|
+
e.preventDefault();
|
|
1578
|
+
console.log(`[MCP] Button clicked: ${action}`);
|
|
1579
|
+
try {
|
|
1580
|
+
await handler();
|
|
1581
|
+
} catch (err) {
|
|
1582
|
+
console.error(`[MCP] Error executing handler for ${action}:`, err);
|
|
1583
|
+
if (typeof showRefreshToast === 'function') {
|
|
1584
|
+
showRefreshToast(`Action failed: ${err.message}`, 'error');
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
});
|
|
1589
|
+
} else if (!conditionalActions.has(action)) {
|
|
1590
|
+
// Only warn if button is not conditionally rendered
|
|
1591
|
+
console.warn(`[MCP] No buttons found for action: ${action}`);
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
|
|
1595
|
+
// ========================================
|
|
1596
|
+
// Codex MCP Event Listeners
|
|
1597
|
+
// ========================================
|
|
1598
|
+
|
|
1599
|
+
// Toggle Codex MCP servers
|
|
1600
|
+
document.querySelectorAll('.mcp-server-card input[data-action="toggle-codex"]').forEach(input => {
|
|
1601
|
+
input.addEventListener('change', async (e) => {
|
|
1602
|
+
const serverName = e.target.dataset.serverName;
|
|
1603
|
+
const enable = e.target.checked;
|
|
1604
|
+
await toggleCodexMcpServer(serverName, enable);
|
|
1605
|
+
});
|
|
1606
|
+
});
|
|
1607
|
+
|
|
1608
|
+
// Remove Codex MCP servers
|
|
1609
|
+
document.querySelectorAll('.mcp-server-card button[data-action="remove-codex"]').forEach(btn => {
|
|
1610
|
+
btn.addEventListener('click', async (e) => {
|
|
1611
|
+
const serverName = btn.dataset.serverName;
|
|
1612
|
+
if (confirm(t('mcp.codex.removeConfirm', { name: serverName }))) {
|
|
1613
|
+
await removeCodexMcpServer(serverName);
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
});
|
|
1617
|
+
|
|
1618
|
+
// Copy Claude servers to Codex
|
|
1619
|
+
document.querySelectorAll('button[data-action="copy-to-codex"]').forEach(btn => {
|
|
1620
|
+
btn.addEventListener('click', async (e) => {
|
|
1621
|
+
e.preventDefault();
|
|
1622
|
+
try {
|
|
1623
|
+
const serverName = btn.dataset.serverName;
|
|
1624
|
+
const serverConfig = decodeConfigData(btn.dataset.serverConfig);
|
|
1625
|
+
console.log('[MCP] Copying to Codex:', serverName);
|
|
1626
|
+
await copyClaudeServerToCodex(serverName, serverConfig);
|
|
1627
|
+
} catch (err) {
|
|
1628
|
+
console.error('[MCP] Error copying to Codex:', err);
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
});
|
|
1632
|
+
|
|
1633
|
+
// Copy Codex servers to Claude
|
|
1634
|
+
document.querySelectorAll('button[data-action="copy-codex-to-claude"]').forEach(btn => {
|
|
1635
|
+
btn.addEventListener('click', async (e) => {
|
|
1636
|
+
e.preventDefault();
|
|
1637
|
+
e.stopPropagation();
|
|
1638
|
+
const serverName = btn.dataset.serverName;
|
|
1639
|
+
let serverConfig;
|
|
1640
|
+
try {
|
|
1641
|
+
serverConfig = decodeConfigData(btn.dataset.serverConfig);
|
|
1642
|
+
} catch (err) {
|
|
1643
|
+
console.error('[MCP] JSON Parse Error:', err);
|
|
1644
|
+
if (typeof showRefreshToast === 'function') {
|
|
1645
|
+
showRefreshToast('Failed to parse server configuration', 'error');
|
|
1646
|
+
}
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
console.log('[MCP] Copying Codex to Claude:', serverName);
|
|
1650
|
+
await copyCodexServerToClaude(serverName, serverConfig);
|
|
1651
|
+
});
|
|
1652
|
+
});
|
|
1653
|
+
|
|
1654
|
+
// Copy servers across CLI tools
|
|
1655
|
+
document.querySelectorAll('button[data-action="copy-cross-cli"]').forEach(btn => {
|
|
1656
|
+
btn.addEventListener('click', async (e) => {
|
|
1657
|
+
e.preventDefault();
|
|
1658
|
+
e.stopPropagation();
|
|
1659
|
+
const serverName = btn.dataset.serverName;
|
|
1660
|
+
let serverConfig;
|
|
1661
|
+
try {
|
|
1662
|
+
serverConfig = decodeConfigData(btn.dataset.serverConfig);
|
|
1663
|
+
} catch (err) {
|
|
1664
|
+
console.error('[MCP] JSON Parse Error:', err);
|
|
1665
|
+
if (typeof showRefreshToast === 'function') {
|
|
1666
|
+
showRefreshToast('Failed to parse server configuration', 'error');
|
|
1667
|
+
}
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
const fromCli = btn.dataset.fromCli;
|
|
1671
|
+
const targetCli = btn.dataset.targetCli;
|
|
1672
|
+
console.log('[MCP] Copying cross-CLI:', serverName, 'from', fromCli, 'to', targetCli);
|
|
1673
|
+
await copyCrossCliServer(serverName, serverConfig, fromCli, targetCli);
|
|
1674
|
+
});
|
|
1675
|
+
});
|
|
1676
|
+
|
|
1677
|
+
// View details / Edit - click on Claude server card
|
|
1678
|
+
document.querySelectorAll('.mcp-server-card[data-action="view-details"]').forEach(card => {
|
|
1679
|
+
card.addEventListener('click', (e) => {
|
|
1680
|
+
// Don't trigger if clicking on buttons or toggle
|
|
1681
|
+
if (e.target.closest('button') || e.target.closest('label') || e.target.closest('input')) {
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
try {
|
|
1685
|
+
const serverName = card.dataset.serverName;
|
|
1686
|
+
const configData = card.dataset.serverConfig;
|
|
1687
|
+
if (!configData) {
|
|
1688
|
+
console.error('[MCP] Missing server config for:', serverName);
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
const serverConfig = decodeConfigData(configData);
|
|
1692
|
+
if (!serverConfig) {
|
|
1693
|
+
console.error('[MCP] Failed to decode server config for:', serverName);
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
const serverSource = card.dataset.serverSource;
|
|
1697
|
+
console.log('[MCP] Card clicked:', serverName, serverSource);
|
|
1698
|
+
showMcpEditModal(serverName, serverConfig, serverSource, 'claude');
|
|
1699
|
+
} catch (err) {
|
|
1700
|
+
console.error('[MCP] Error handling card click:', err);
|
|
1701
|
+
}
|
|
1702
|
+
});
|
|
1703
|
+
});
|
|
1704
|
+
|
|
1705
|
+
// View details / Edit - click on Codex server card
|
|
1706
|
+
document.querySelectorAll('.mcp-server-card[data-action="view-details-codex"]').forEach(card => {
|
|
1707
|
+
card.addEventListener('click', (e) => {
|
|
1708
|
+
// Don't trigger if clicking on buttons or toggle
|
|
1709
|
+
if (e.target.closest('button') || e.target.closest('label') || e.target.closest('input')) {
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
try {
|
|
1713
|
+
const serverName = card.dataset.serverName;
|
|
1714
|
+
const configData = card.dataset.serverConfig;
|
|
1715
|
+
if (!configData) {
|
|
1716
|
+
console.error('[MCP] Missing server config for:', serverName);
|
|
1717
|
+
return;
|
|
1718
|
+
}
|
|
1719
|
+
const serverConfig = decodeConfigData(configData);
|
|
1720
|
+
if (!serverConfig) {
|
|
1721
|
+
console.error('[MCP] Failed to decode server config for:', serverName);
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
console.log('[MCP] Codex card clicked:', serverName);
|
|
1725
|
+
showMcpEditModal(serverName, serverConfig, 'codex', 'codex');
|
|
1726
|
+
} catch (err) {
|
|
1727
|
+
console.error('[MCP] Error handling Codex card click:', err);
|
|
1728
|
+
}
|
|
1729
|
+
});
|
|
1730
|
+
});
|
|
1731
|
+
|
|
1732
|
+
// Modal close button
|
|
1733
|
+
const closeBtn = document.getElementById('mcpDetailsModalClose');
|
|
1734
|
+
const modal = document.getElementById('mcpDetailsModal');
|
|
1735
|
+
if (closeBtn && modal) {
|
|
1736
|
+
closeBtn.addEventListener('click', () => {
|
|
1737
|
+
modal.classList.add('hidden');
|
|
1738
|
+
});
|
|
1739
|
+
// Close on background click
|
|
1740
|
+
modal.addEventListener('click', (e) => {
|
|
1741
|
+
if (e.target === modal) {
|
|
1742
|
+
modal.classList.add('hidden');
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
// ========================================
|
|
1749
|
+
// MCP Edit Modal (replaces Details Modal)
|
|
1750
|
+
// ========================================
|
|
1751
|
+
|
|
1752
|
+
// Store current editing context
|
|
1753
|
+
let mcpEditContext = {
|
|
1754
|
+
serverName: null,
|
|
1755
|
+
serverConfig: null,
|
|
1756
|
+
serverSource: null,
|
|
1757
|
+
cliType: 'claude'
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
function showMcpDetails(serverName, serverConfig, serverSource, cliType = 'claude') {
|
|
1761
|
+
showMcpEditModal(serverName, serverConfig, serverSource, cliType);
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
function showMcpEditModal(serverName, serverConfig, serverSource, cliType = 'claude') {
|
|
1765
|
+
const modal = document.getElementById('mcpDetailsModal');
|
|
1766
|
+
const modalBody = document.getElementById('mcpDetailsModalBody');
|
|
1767
|
+
|
|
1768
|
+
if (!modal || !modalBody) return;
|
|
1769
|
+
|
|
1770
|
+
// Store editing context
|
|
1771
|
+
mcpEditContext = {
|
|
1772
|
+
serverName,
|
|
1773
|
+
serverConfig: JSON.parse(JSON.stringify(serverConfig)), // Deep clone
|
|
1774
|
+
serverSource,
|
|
1775
|
+
cliType
|
|
1776
|
+
};
|
|
1777
|
+
|
|
1778
|
+
// Check if editable (enterprise is read-only)
|
|
1779
|
+
const isReadOnly = serverSource === 'enterprise';
|
|
1780
|
+
const isCodex = cliType === 'codex';
|
|
1781
|
+
|
|
1782
|
+
// Build source badge
|
|
1783
|
+
let sourceBadge = '';
|
|
1784
|
+
if (serverSource === 'enterprise') {
|
|
1785
|
+
sourceBadge = `<span class="inline-flex items-center px-2 py-1 text-xs font-semibold rounded-full bg-warning/20 text-warning">${t('mcp.sourceEnterprise')}</span>`;
|
|
1786
|
+
} else if (serverSource === 'global') {
|
|
1787
|
+
sourceBadge = `<span class="inline-flex items-center px-2 py-1 text-xs font-semibold rounded-full bg-success/10 text-success">${t('mcp.sourceGlobal')}</span>`;
|
|
1788
|
+
} else if (serverSource === 'project') {
|
|
1789
|
+
sourceBadge = `<span class="inline-flex items-center px-2 py-1 text-xs font-semibold rounded-full bg-primary/10 text-primary">${t('mcp.sourceProject')}</span>`;
|
|
1790
|
+
} else if (isCodex) {
|
|
1791
|
+
sourceBadge = `<span class="inline-flex items-center px-2 py-1 text-xs font-semibold rounded-full bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300">Codex</span>`;
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
// Format args and env for textarea
|
|
1795
|
+
const argsText = (serverConfig.args || []).join('\n');
|
|
1796
|
+
const envText = Object.entries(serverConfig.env || {}).map(([k, v]) => `${k}=${v}`).join('\n');
|
|
1797
|
+
|
|
1798
|
+
// Build edit form HTML
|
|
1799
|
+
modalBody.innerHTML = `
|
|
1800
|
+
<div class="space-y-4">
|
|
1801
|
+
<!-- Server Name and Source -->
|
|
1802
|
+
<div>
|
|
1803
|
+
<label class="text-xs font-semibold text-muted-foreground uppercase tracking-wide">${t('mcp.detailsModal.serverName')}</label>
|
|
1804
|
+
<div class="mt-1 flex items-center gap-2">
|
|
1805
|
+
<input type="text" id="mcpEditName" value="${escapeHtml(serverName)}"
|
|
1806
|
+
class="text-lg font-bold text-foreground bg-transparent border-b border-border focus:border-primary outline-none px-1 py-0.5 flex-1"
|
|
1807
|
+
${isReadOnly ? 'disabled' : ''}
|
|
1808
|
+
placeholder="${t('mcp.editModal.serverNamePlaceholder')}">
|
|
1809
|
+
${sourceBadge}
|
|
1810
|
+
</div>
|
|
1811
|
+
</div>
|
|
1812
|
+
|
|
1813
|
+
<!-- Command/URL -->
|
|
1814
|
+
<div>
|
|
1815
|
+
<label class="text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1 block">
|
|
1816
|
+
${serverConfig.url ? t('mcp.url') : t('mcp.cmd')}
|
|
1817
|
+
</label>
|
|
1818
|
+
<input type="text" id="mcpEditCommand" value="${escapeHtml(serverConfig.command || serverConfig.url || '')}"
|
|
1819
|
+
class="w-full px-3 py-2 text-sm font-mono bg-muted border border-border rounded-lg focus:border-primary outline-none"
|
|
1820
|
+
${isReadOnly ? 'disabled' : ''}
|
|
1821
|
+
placeholder="${serverConfig.url ? 'https://...' : 'npx, node, python...'}">
|
|
1822
|
+
</div>
|
|
1823
|
+
|
|
1824
|
+
<!-- Arguments -->
|
|
1825
|
+
<div>
|
|
1826
|
+
<label class="text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1 block">
|
|
1827
|
+
${t('mcp.args')} <span class="font-normal">(${t('mcp.editModal.onePerLine')})</span>
|
|
1828
|
+
</label>
|
|
1829
|
+
<textarea id="mcpEditArgs" rows="3"
|
|
1830
|
+
class="w-full px-3 py-2 text-sm font-mono bg-muted border border-border rounded-lg focus:border-primary outline-none resize-none"
|
|
1831
|
+
${isReadOnly ? 'disabled' : ''}
|
|
1832
|
+
placeholder="-y package-name">${escapeHtml(argsText)}</textarea>
|
|
1833
|
+
</div>
|
|
1834
|
+
|
|
1835
|
+
<!-- Environment Variables -->
|
|
1836
|
+
<div>
|
|
1837
|
+
<label class="text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1 block">
|
|
1838
|
+
${t('mcp.env')} <span class="font-normal">(KEY=VALUE ${t('mcp.editModal.onePerLine')})</span>
|
|
1839
|
+
</label>
|
|
1840
|
+
<textarea id="mcpEditEnv" rows="3"
|
|
1841
|
+
class="w-full px-3 py-2 text-sm font-mono bg-muted border border-border rounded-lg focus:border-primary outline-none resize-none"
|
|
1842
|
+
${isReadOnly ? 'disabled' : ''}
|
|
1843
|
+
placeholder="API_KEY=your-key DEBUG=true">${escapeHtml(envText)}</textarea>
|
|
1844
|
+
</div>
|
|
1845
|
+
|
|
1846
|
+
${isCodex ? `
|
|
1847
|
+
<!-- Codex-specific: enabled_tools -->
|
|
1848
|
+
<div>
|
|
1849
|
+
<label class="text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1 block">
|
|
1850
|
+
${t('mcp.codex.enabledTools')} <span class="font-normal">(${t('mcp.editModal.onePerLine')})</span>
|
|
1851
|
+
</label>
|
|
1852
|
+
<textarea id="mcpEditEnabledTools" rows="2"
|
|
1853
|
+
class="w-full px-3 py-2 text-sm font-mono bg-muted border border-border rounded-lg focus:border-primary outline-none resize-none"
|
|
1854
|
+
${isReadOnly ? 'disabled' : ''}
|
|
1855
|
+
placeholder="tool1 tool2">${escapeHtml((serverConfig.enabled_tools || []).join('\n'))}</textarea>
|
|
1856
|
+
</div>
|
|
1857
|
+
` : ''}
|
|
1858
|
+
|
|
1859
|
+
<!-- Raw JSON Preview (collapsible) -->
|
|
1860
|
+
<details class="group">
|
|
1861
|
+
<summary class="text-xs font-semibold text-muted-foreground uppercase tracking-wide cursor-pointer flex items-center gap-1">
|
|
1862
|
+
<i data-lucide="chevron-right" class="w-3 h-3 transition-transform group-open:rotate-90"></i>
|
|
1863
|
+
Raw JSON
|
|
1864
|
+
</summary>
|
|
1865
|
+
<pre id="mcpEditJsonPreview" class="mt-2 bg-muted rounded-lg p-3 text-xs font-mono overflow-x-auto">${escapeHtml(JSON.stringify(serverConfig, null, 2))}</pre>
|
|
1866
|
+
</details>
|
|
1867
|
+
|
|
1868
|
+
<!-- Action Buttons -->
|
|
1869
|
+
${!isReadOnly ? `
|
|
1870
|
+
<div class="flex items-center justify-between pt-4 border-t border-border">
|
|
1871
|
+
<div class="flex items-center gap-2">
|
|
1872
|
+
${serverSource === 'project' || isCodex ? `
|
|
1873
|
+
<button onclick="deleteMcpFromEdit()" class="px-4 py-2 text-sm text-destructive hover:bg-destructive/10 rounded-lg transition-colors flex items-center gap-1.5">
|
|
1874
|
+
<i data-lucide="trash-2" class="w-4 h-4"></i>
|
|
1875
|
+
${t('mcp.editModal.delete')}
|
|
1876
|
+
</button>
|
|
1877
|
+
` : ''}
|
|
1878
|
+
</div>
|
|
1879
|
+
<div class="flex items-center gap-2">
|
|
1880
|
+
<button onclick="closeMcpEditModal()" class="px-4 py-2 text-sm text-muted-foreground hover:bg-muted rounded-lg transition-colors">
|
|
1881
|
+
${t('common.cancel')}
|
|
1882
|
+
</button>
|
|
1883
|
+
<button onclick="saveMcpEdit()" class="px-4 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity flex items-center gap-1.5">
|
|
1884
|
+
<i data-lucide="check" class="w-4 h-4"></i>
|
|
1885
|
+
${t('mcp.editModal.save')}
|
|
1886
|
+
</button>
|
|
1887
|
+
</div>
|
|
1888
|
+
</div>
|
|
1889
|
+
` : `
|
|
1890
|
+
<div class="flex items-center justify-end pt-4 border-t border-border">
|
|
1891
|
+
<button onclick="closeMcpEditModal()" class="px-4 py-2 text-sm bg-muted text-foreground rounded-lg hover:bg-muted/80 transition-colors">
|
|
1892
|
+
${t('common.close')}
|
|
1893
|
+
</button>
|
|
1894
|
+
</div>
|
|
1895
|
+
`}
|
|
1896
|
+
</div>
|
|
1897
|
+
`;
|
|
1898
|
+
|
|
1899
|
+
// Update modal title
|
|
1900
|
+
const modalTitle = modal.querySelector('h2');
|
|
1901
|
+
if (modalTitle) {
|
|
1902
|
+
modalTitle.textContent = isReadOnly ? t('mcp.detailsModal.title') : t('mcp.editModal.title');
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// Show modal
|
|
1906
|
+
modal.classList.remove('hidden');
|
|
1907
|
+
|
|
1908
|
+
// Re-initialize Lucide icons in modal
|
|
1909
|
+
if (typeof lucide !== 'undefined') lucide.createIcons();
|
|
1910
|
+
|
|
1911
|
+
// Add input listeners to update JSON preview
|
|
1912
|
+
if (!isReadOnly) {
|
|
1913
|
+
['mcpEditCommand', 'mcpEditArgs', 'mcpEditEnv', 'mcpEditEnabledTools'].forEach(id => {
|
|
1914
|
+
const el = document.getElementById(id);
|
|
1915
|
+
if (el) {
|
|
1916
|
+
el.addEventListener('input', updateMcpEditJsonPreview);
|
|
1917
|
+
}
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
function closeMcpEditModal() {
|
|
1923
|
+
const modal = document.getElementById('mcpDetailsModal');
|
|
1924
|
+
if (modal) {
|
|
1925
|
+
modal.classList.add('hidden');
|
|
1926
|
+
}
|
|
1927
|
+
mcpEditContext = { serverName: null, serverConfig: null, serverSource: null, cliType: 'claude' };
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
function updateMcpEditJsonPreview() {
|
|
1931
|
+
const preview = document.getElementById('mcpEditJsonPreview');
|
|
1932
|
+
if (!preview) return;
|
|
1933
|
+
|
|
1934
|
+
const config = buildConfigFromEditForm();
|
|
1935
|
+
preview.textContent = JSON.stringify(config, null, 2);
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
function buildConfigFromEditForm() {
|
|
1939
|
+
const command = document.getElementById('mcpEditCommand')?.value.trim() || '';
|
|
1940
|
+
const argsText = document.getElementById('mcpEditArgs')?.value.trim() || '';
|
|
1941
|
+
const envText = document.getElementById('mcpEditEnv')?.value.trim() || '';
|
|
1942
|
+
const enabledToolsEl = document.getElementById('mcpEditEnabledTools');
|
|
1943
|
+
|
|
1944
|
+
// Build config
|
|
1945
|
+
const config = {};
|
|
1946
|
+
|
|
1947
|
+
// Command or URL
|
|
1948
|
+
if (mcpEditContext.serverConfig?.url) {
|
|
1949
|
+
config.url = command;
|
|
1950
|
+
} else {
|
|
1951
|
+
config.command = command;
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
// Args
|
|
1955
|
+
if (argsText) {
|
|
1956
|
+
config.args = argsText.split('\n').map(a => a.trim()).filter(a => a);
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
// Env
|
|
1960
|
+
if (envText) {
|
|
1961
|
+
config.env = {};
|
|
1962
|
+
envText.split('\n').forEach(line => {
|
|
1963
|
+
const trimmed = line.trim();
|
|
1964
|
+
if (trimmed && trimmed.includes('=')) {
|
|
1965
|
+
const eqIndex = trimmed.indexOf('=');
|
|
1966
|
+
const key = trimmed.substring(0, eqIndex).trim();
|
|
1967
|
+
const value = trimmed.substring(eqIndex + 1).trim();
|
|
1968
|
+
if (key) {
|
|
1969
|
+
config.env[key] = value;
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
});
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
// Codex-specific: enabled_tools
|
|
1976
|
+
if (enabledToolsEl) {
|
|
1977
|
+
const toolsText = enabledToolsEl.value.trim();
|
|
1978
|
+
if (toolsText) {
|
|
1979
|
+
config.enabled_tools = toolsText.split('\n').map(t => t.trim()).filter(t => t);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
return config;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
async function saveMcpEdit() {
|
|
1987
|
+
const newName = document.getElementById('mcpEditName')?.value.trim();
|
|
1988
|
+
if (!newName) {
|
|
1989
|
+
showRefreshToast(t('mcp.editModal.nameRequired'), 'error');
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
const newConfig = buildConfigFromEditForm();
|
|
1994
|
+
|
|
1995
|
+
if (!newConfig.command && !newConfig.url) {
|
|
1996
|
+
showRefreshToast(t('mcp.editModal.commandRequired'), 'error');
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
const { serverName, serverSource, cliType } = mcpEditContext;
|
|
2001
|
+
const nameChanged = newName !== serverName;
|
|
2002
|
+
|
|
2003
|
+
try {
|
|
2004
|
+
if (cliType === 'codex') {
|
|
2005
|
+
// Codex MCP update
|
|
2006
|
+
// If name changed, remove old and add new
|
|
2007
|
+
if (nameChanged) {
|
|
2008
|
+
await removeCodexMcpServer(serverName);
|
|
2009
|
+
}
|
|
2010
|
+
await addCodexMcpServer(newName, newConfig);
|
|
2011
|
+
} else if (serverSource === 'global') {
|
|
2012
|
+
// Global MCP update
|
|
2013
|
+
if (nameChanged) {
|
|
2014
|
+
await removeGlobalMcpServer(serverName);
|
|
2015
|
+
}
|
|
2016
|
+
await addGlobalMcpServer(newName, newConfig);
|
|
2017
|
+
} else if (serverSource === 'project') {
|
|
2018
|
+
// Project MCP update
|
|
2019
|
+
if (nameChanged) {
|
|
2020
|
+
await removeMcpServerFromProject(serverName);
|
|
2021
|
+
}
|
|
2022
|
+
await copyMcpServerToProject(newName, newConfig, 'mcp');
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
closeMcpEditModal();
|
|
2026
|
+
showRefreshToast(t('mcp.editModal.saved', { name: newName }), 'success');
|
|
2027
|
+
} catch (err) {
|
|
2028
|
+
console.error('Failed to save MCP edit:', err);
|
|
2029
|
+
showRefreshToast(t('mcp.editModal.saveFailed') + ': ' + err.message, 'error');
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
async function deleteMcpFromEdit() {
|
|
2034
|
+
const { serverName, serverSource, cliType } = mcpEditContext;
|
|
2035
|
+
|
|
2036
|
+
if (!confirm(t('mcp.editModal.deleteConfirm', { name: serverName }))) {
|
|
2037
|
+
return;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
try {
|
|
2041
|
+
if (cliType === 'codex') {
|
|
2042
|
+
await removeCodexMcpServer(serverName);
|
|
2043
|
+
} else if (serverSource === 'global') {
|
|
2044
|
+
await removeGlobalMcpServer(serverName);
|
|
2045
|
+
} else if (serverSource === 'project') {
|
|
2046
|
+
await removeMcpServerFromProject(serverName);
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
closeMcpEditModal();
|
|
2050
|
+
showRefreshToast(t('mcp.editModal.deleted', { name: serverName }), 'success');
|
|
2051
|
+
} catch (err) {
|
|
2052
|
+
console.error('Failed to delete MCP:', err);
|
|
2053
|
+
showRefreshToast(t('mcp.editModal.deleteFailed') + ': ' + err.message, 'error');
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
// ========================================
|
|
2058
|
+
// MCP Template Management Functions
|
|
2059
|
+
// ========================================
|
|
2060
|
+
|
|
2061
|
+
let mcpTemplates = [];
|
|
2062
|
+
|
|
2063
|
+
/**
|
|
2064
|
+
* Load all MCP templates from API
|
|
2065
|
+
*/
|
|
2066
|
+
async function loadMcpTemplates() {
|
|
2067
|
+
try {
|
|
2068
|
+
const response = await fetch('/api/mcp-templates');
|
|
2069
|
+
const data = await response.json();
|
|
2070
|
+
|
|
2071
|
+
if (data.success) {
|
|
2072
|
+
mcpTemplates = data.templates || [];
|
|
2073
|
+
console.log('[MCP Templates] Loaded', mcpTemplates.length, 'templates');
|
|
2074
|
+
} else {
|
|
2075
|
+
console.error('[MCP Templates] Failed to load:', data.error);
|
|
2076
|
+
mcpTemplates = [];
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
return mcpTemplates;
|
|
2080
|
+
} catch (error) {
|
|
2081
|
+
console.error('[MCP Templates] Error loading templates:', error);
|
|
2082
|
+
mcpTemplates = [];
|
|
2083
|
+
return [];
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* Save MCP server configuration as a template
|
|
2089
|
+
*/
|
|
2090
|
+
async function saveMcpAsTemplate(serverName, serverConfig) {
|
|
2091
|
+
try {
|
|
2092
|
+
// Prompt for template name and description
|
|
2093
|
+
const templateName = prompt(t('mcp.enterTemplateName'), serverName);
|
|
2094
|
+
if (!templateName) return;
|
|
2095
|
+
|
|
2096
|
+
const description = prompt(t('mcp.enterTemplateDesc'), `Template for ${serverName}`);
|
|
2097
|
+
|
|
2098
|
+
const payload = {
|
|
2099
|
+
name: templateName,
|
|
2100
|
+
description: description || '',
|
|
2101
|
+
serverConfig: serverConfig,
|
|
2102
|
+
category: 'user'
|
|
2103
|
+
};
|
|
2104
|
+
|
|
2105
|
+
const response = await fetch('/api/mcp-templates', {
|
|
2106
|
+
method: 'POST',
|
|
2107
|
+
headers: { 'Content-Type': 'application/json' },
|
|
2108
|
+
body: JSON.stringify(payload)
|
|
2109
|
+
});
|
|
2110
|
+
|
|
2111
|
+
const data = await response.json();
|
|
2112
|
+
|
|
2113
|
+
if (data.success) {
|
|
2114
|
+
showRefreshToast(t('mcp.templateSaved', { name: templateName }), 'success');
|
|
2115
|
+
await loadMcpTemplates();
|
|
2116
|
+
await renderMcpManager(); // Refresh view
|
|
2117
|
+
} else {
|
|
2118
|
+
showRefreshToast(t('mcp.templateSaveFailed', { error: data.error }), 'error');
|
|
2119
|
+
}
|
|
2120
|
+
} catch (error) {
|
|
2121
|
+
console.error('[MCP] Save template error:', error);
|
|
2122
|
+
showRefreshToast(t('mcp.templateSaveFailed', { error: error.message }), 'error');
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
/**
|
|
2127
|
+
* Install MCP server from template
|
|
2128
|
+
*/
|
|
2129
|
+
async function installFromTemplate(templateName, scope = 'project') {
|
|
2130
|
+
try {
|
|
2131
|
+
// Find template
|
|
2132
|
+
const template = mcpTemplates.find(t => t.name === templateName);
|
|
2133
|
+
if (!template) {
|
|
2134
|
+
showRefreshToast(t('mcp.templateNotFound', { name: templateName }), 'error');
|
|
2135
|
+
return;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
// Prompt for server name (default to template name)
|
|
2139
|
+
const serverName = prompt(t('mcp.enterServerName'), templateName);
|
|
2140
|
+
if (!serverName) return;
|
|
2141
|
+
|
|
2142
|
+
// Install based on scope
|
|
2143
|
+
if (scope === 'project') {
|
|
2144
|
+
await copyMcpServerToProject(serverName, template.serverConfig);
|
|
2145
|
+
} else if (scope === 'global') {
|
|
2146
|
+
await addGlobalMcpServer(serverName, template.serverConfig);
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
showRefreshToast(t('mcp.templateInstalled', { name: serverName }), 'success');
|
|
2150
|
+
await renderMcpManager();
|
|
2151
|
+
} catch (error) {
|
|
2152
|
+
console.error('[MCP] Install from template error:', error);
|
|
2153
|
+
showRefreshToast(t('mcp.templateInstallFailed', { error: error.message }), 'error');
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/**
|
|
2158
|
+
* Delete MCP template
|
|
2159
|
+
*/
|
|
2160
|
+
async function deleteMcpTemplate(templateName) {
|
|
2161
|
+
try {
|
|
2162
|
+
const response = await fetch(`/api/mcp-templates/${encodeURIComponent(templateName)}`, {
|
|
2163
|
+
method: 'DELETE'
|
|
2164
|
+
});
|
|
2165
|
+
|
|
2166
|
+
const data = await response.json();
|
|
2167
|
+
|
|
2168
|
+
if (data.success) {
|
|
2169
|
+
showRefreshToast(t('mcp.templateDeleted', { name: templateName }), 'success');
|
|
2170
|
+
await loadMcpTemplates();
|
|
2171
|
+
await renderMcpManager();
|
|
2172
|
+
} else {
|
|
2173
|
+
showRefreshToast(t('mcp.templateDeleteFailed', { error: data.error }), 'error');
|
|
2174
|
+
}
|
|
2175
|
+
} catch (error) {
|
|
2176
|
+
console.error('[MCP] Delete template error:', error);
|
|
2177
|
+
showRefreshToast(t('mcp.templateDeleteFailed', { error: error.message }), 'error');
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
// ========== Global Exports for onclick handlers ==========
|
|
2182
|
+
// Expose functions to global scope to support inline onclick handlers
|
|
2183
|
+
window.openCodexMcpCreateModal = openCodexMcpCreateModal;
|
|
2184
|
+
window.closeMcpEditModal = closeMcpEditModal;
|
|
2185
|
+
window.saveMcpEdit = saveMcpEdit;
|
|
2186
|
+
window.deleteMcpFromEdit = deleteMcpFromEdit;
|
|
2187
|
+
window.saveMcpAsTemplate = saveMcpAsTemplate;
|