claude-code-workflow 6.2.2 → 6.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ccw/dist/cli.d.ts +2 -0
- package/ccw/dist/cli.d.ts.map +1 -0
- package/ccw/dist/cli.js +219 -0
- package/ccw/dist/cli.js.map +1 -0
- package/ccw/dist/commands/cli.d.ts +32 -0
- package/ccw/dist/commands/cli.d.ts.map +1 -0
- package/ccw/dist/commands/cli.js +619 -0
- package/ccw/dist/commands/cli.js.map +1 -0
- package/ccw/dist/commands/core-memory.d.ts +32 -0
- package/ccw/dist/commands/core-memory.d.ts.map +1 -0
- package/ccw/dist/commands/core-memory.js +640 -0
- package/ccw/dist/commands/core-memory.js.map +1 -0
- package/ccw/dist/commands/hook.d.ts +16 -0
- package/ccw/dist/commands/hook.d.ts.map +1 -0
- package/ccw/dist/commands/hook.js +276 -0
- package/ccw/dist/commands/hook.js.map +1 -0
- package/ccw/dist/commands/install.d.ts +12 -0
- package/ccw/dist/commands/install.d.ts.map +1 -0
- package/ccw/dist/commands/install.js +443 -0
- package/ccw/dist/commands/install.js.map +1 -0
- package/ccw/dist/commands/list.d.ts +5 -0
- package/ccw/dist/commands/list.d.ts.map +1 -0
- package/ccw/dist/commands/list.js +32 -0
- package/ccw/dist/commands/list.js.map +1 -0
- package/ccw/dist/commands/memory.d.ts +57 -0
- package/ccw/dist/commands/memory.d.ts.map +1 -0
- package/ccw/dist/commands/memory.js +890 -0
- package/ccw/dist/commands/memory.js.map +1 -0
- package/ccw/dist/commands/serve.d.ts +12 -0
- package/ccw/dist/commands/serve.d.ts.map +1 -0
- package/ccw/dist/commands/serve.js +63 -0
- package/ccw/dist/commands/serve.js.map +1 -0
- package/ccw/dist/commands/session-path-resolver.d.ts +45 -0
- package/ccw/dist/commands/session-path-resolver.d.ts.map +1 -0
- package/ccw/dist/commands/session-path-resolver.js +302 -0
- package/ccw/dist/commands/session-path-resolver.js.map +1 -0
- package/ccw/dist/commands/session.d.ts +12 -0
- package/ccw/dist/commands/session.d.ts.map +1 -0
- package/ccw/dist/commands/session.js +954 -0
- package/ccw/dist/commands/session.js.map +1 -0
- package/ccw/dist/commands/stop.d.ts +11 -0
- package/ccw/dist/commands/stop.d.ts.map +1 -0
- package/ccw/dist/commands/stop.js +96 -0
- package/ccw/dist/commands/stop.js.map +1 -0
- package/ccw/dist/commands/tool.d.ts +29 -0
- package/ccw/dist/commands/tool.d.ts.map +1 -0
- package/ccw/dist/commands/tool.js +173 -0
- package/ccw/dist/commands/tool.js.map +1 -0
- package/ccw/dist/commands/uninstall.d.ts +9 -0
- package/ccw/dist/commands/uninstall.d.ts.map +1 -0
- package/ccw/dist/commands/uninstall.js +239 -0
- package/ccw/dist/commands/uninstall.js.map +1 -0
- package/ccw/dist/commands/upgrade.d.ts +10 -0
- package/ccw/dist/commands/upgrade.d.ts.map +1 -0
- package/ccw/dist/commands/upgrade.js +288 -0
- package/ccw/dist/commands/upgrade.js.map +1 -0
- package/ccw/dist/commands/view.d.ts +14 -0
- package/ccw/dist/commands/view.d.ts.map +1 -0
- package/ccw/dist/commands/view.js +100 -0
- package/ccw/dist/commands/view.js.map +1 -0
- package/ccw/dist/config/storage-paths.d.ts +184 -0
- package/ccw/dist/config/storage-paths.d.ts.map +1 -0
- package/ccw/dist/config/storage-paths.js +536 -0
- package/ccw/dist/config/storage-paths.js.map +1 -0
- package/ccw/dist/core/cache-manager.d.ts +80 -0
- package/ccw/dist/core/cache-manager.d.ts.map +1 -0
- package/ccw/dist/core/cache-manager.js +260 -0
- package/ccw/dist/core/cache-manager.js.map +1 -0
- package/ccw/dist/core/claude-freshness.d.ts +53 -0
- package/ccw/dist/core/claude-freshness.d.ts.map +1 -0
- package/ccw/dist/core/claude-freshness.js +232 -0
- package/ccw/dist/core/claude-freshness.js.map +1 -0
- package/ccw/dist/core/core-memory-store.d.ts +320 -0
- package/ccw/dist/core/core-memory-store.d.ts.map +1 -0
- package/ccw/dist/core/core-memory-store.js +1177 -0
- package/ccw/dist/core/core-memory-store.js.map +1 -0
- package/ccw/dist/core/dashboard-generator-patch.d.ts +2 -0
- package/ccw/dist/core/dashboard-generator-patch.d.ts.map +1 -0
- package/ccw/dist/core/dashboard-generator-patch.js +48 -0
- package/ccw/dist/core/dashboard-generator-patch.js.map +1 -0
- package/ccw/dist/core/dashboard-generator.d.ts +8 -0
- package/ccw/dist/core/dashboard-generator.d.ts.map +1 -0
- package/ccw/dist/core/dashboard-generator.js +695 -0
- package/ccw/dist/core/dashboard-generator.js.map +1 -0
- package/ccw/dist/core/data-aggregator.d.ts +145 -0
- package/ccw/dist/core/data-aggregator.d.ts.map +1 -0
- package/ccw/dist/core/data-aggregator.js +416 -0
- package/ccw/dist/core/data-aggregator.js.map +1 -0
- package/ccw/dist/core/history-importer.d.ts +102 -0
- package/ccw/dist/core/history-importer.d.ts.map +1 -0
- package/ccw/dist/core/history-importer.js +493 -0
- package/ccw/dist/core/history-importer.js.map +1 -0
- package/ccw/dist/core/lite-scanner-complete.d.ts +81 -0
- package/ccw/dist/core/lite-scanner-complete.d.ts.map +1 -0
- package/ccw/dist/core/lite-scanner-complete.js +368 -0
- package/ccw/dist/core/lite-scanner-complete.js.map +1 -0
- package/ccw/dist/core/lite-scanner.d.ts +81 -0
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -0
- package/ccw/dist/core/lite-scanner.js +368 -0
- package/ccw/dist/core/lite-scanner.js.map +1 -0
- package/ccw/dist/core/manifest.d.ts +88 -0
- package/ccw/dist/core/manifest.d.ts.map +1 -0
- package/ccw/dist/core/manifest.js +214 -0
- package/ccw/dist/core/manifest.js.map +1 -0
- package/ccw/dist/core/memory-embedder-bridge.d.ts +83 -0
- package/ccw/dist/core/memory-embedder-bridge.d.ts.map +1 -0
- package/ccw/dist/core/memory-embedder-bridge.js +181 -0
- package/ccw/dist/core/memory-embedder-bridge.js.map +1 -0
- package/ccw/dist/core/memory-store.d.ts +249 -0
- package/ccw/dist/core/memory-store.d.ts.map +1 -0
- package/ccw/dist/core/memory-store.js +781 -0
- package/ccw/dist/core/memory-store.js.map +1 -0
- package/ccw/dist/core/routes/ccw-routes.d.ts +20 -0
- package/ccw/dist/core/routes/ccw-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/ccw-routes.js +70 -0
- package/ccw/dist/core/routes/ccw-routes.js.map +1 -0
- package/ccw/dist/core/routes/claude-routes.d.ts +19 -0
- package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/claude-routes.js +1017 -0
- package/ccw/dist/core/routes/claude-routes.js.map +1 -0
- package/ccw/dist/core/routes/cli-routes.d.ts +20 -0
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/cli-routes.js +468 -0
- package/ccw/dist/core/routes/cli-routes.js.map +1 -0
- package/ccw/dist/core/routes/codexlens-routes.d.ts +20 -0
- package/ccw/dist/core/routes/codexlens-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/codexlens-routes.js +754 -0
- package/ccw/dist/core/routes/codexlens-routes.js.map +1 -0
- package/ccw/dist/core/routes/core-memory-routes.d.ts +21 -0
- package/ccw/dist/core/routes/core-memory-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/core-memory-routes.js +520 -0
- package/ccw/dist/core/routes/core-memory-routes.js.map +1 -0
- package/ccw/dist/core/routes/files-routes.d.ts +20 -0
- package/ccw/dist/core/routes/files-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/files-routes.js +374 -0
- package/ccw/dist/core/routes/files-routes.js.map +1 -0
- package/ccw/dist/core/routes/graph-routes.d.ts +20 -0
- package/ccw/dist/core/routes/graph-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/graph-routes.js +517 -0
- package/ccw/dist/core/routes/graph-routes.js.map +1 -0
- package/ccw/dist/core/routes/help-routes.d.ts +20 -0
- package/ccw/dist/core/routes/help-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/help-routes.js +250 -0
- package/ccw/dist/core/routes/help-routes.js.map +1 -0
- package/ccw/dist/core/routes/hooks-routes.d.ts +21 -0
- package/ccw/dist/core/routes/hooks-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/hooks-routes.js +346 -0
- package/ccw/dist/core/routes/hooks-routes.js.map +1 -0
- package/ccw/dist/core/routes/mcp-routes.d.ts +20 -0
- package/ccw/dist/core/routes/mcp-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/mcp-routes.js +1129 -0
- package/ccw/dist/core/routes/mcp-routes.js.map +1 -0
- package/ccw/dist/core/routes/mcp-templates-db.d.ts +54 -0
- package/ccw/dist/core/routes/mcp-templates-db.d.ts.map +1 -0
- package/ccw/dist/core/routes/mcp-templates-db.js +226 -0
- package/ccw/dist/core/routes/mcp-templates-db.js.map +1 -0
- package/ccw/dist/core/routes/memory-routes.d.ts +21 -0
- package/ccw/dist/core/routes/memory-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/memory-routes.js +1095 -0
- package/ccw/dist/core/routes/memory-routes.js.map +1 -0
- package/ccw/dist/core/routes/rules-routes.d.ts +20 -0
- package/ccw/dist/core/routes/rules-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/rules-routes.js +442 -0
- package/ccw/dist/core/routes/rules-routes.js.map +1 -0
- package/ccw/dist/core/routes/session-routes.d.ts +20 -0
- package/ccw/dist/core/routes/session-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/session-routes.js +423 -0
- package/ccw/dist/core/routes/session-routes.js.map +1 -0
- package/ccw/dist/core/routes/skills-routes.d.ts +20 -0
- package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/skills-routes.js +533 -0
- package/ccw/dist/core/routes/skills-routes.js.map +1 -0
- package/ccw/dist/core/routes/status-routes.d.ts +20 -0
- package/ccw/dist/core/routes/status-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/status-routes.js +38 -0
- package/ccw/dist/core/routes/status-routes.js.map +1 -0
- package/ccw/dist/core/routes/system-routes.d.ts +22 -0
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/system-routes.js +354 -0
- package/ccw/dist/core/routes/system-routes.js.map +1 -0
- package/ccw/dist/core/server.d.ts +17 -0
- package/ccw/dist/core/server.d.ts.map +1 -0
- package/ccw/dist/core/server.js +386 -0
- package/ccw/dist/core/server.js.map +1 -0
- package/ccw/dist/core/session-clustering-service.d.ts +153 -0
- package/ccw/dist/core/session-clustering-service.d.ts.map +1 -0
- package/ccw/dist/core/session-clustering-service.js +1065 -0
- package/ccw/dist/core/session-clustering-service.js.map +1 -0
- package/ccw/dist/core/session-scanner.d.ts +32 -0
- package/ccw/dist/core/session-scanner.d.ts.map +1 -0
- package/ccw/dist/core/session-scanner.js +253 -0
- package/ccw/dist/core/session-scanner.js.map +1 -0
- package/ccw/dist/core/websocket.d.ts +23 -0
- package/ccw/dist/core/websocket.d.ts.map +1 -0
- package/ccw/dist/core/websocket.js +168 -0
- package/ccw/dist/core/websocket.js.map +1 -0
- package/ccw/dist/index.d.ts +10 -0
- package/ccw/dist/index.d.ts.map +1 -0
- package/ccw/dist/index.js +10 -0
- package/ccw/dist/index.js.map +1 -0
- package/ccw/dist/mcp-server/index.d.ts +7 -0
- package/ccw/dist/mcp-server/index.d.ts.map +1 -0
- package/ccw/dist/mcp-server/index.js +157 -0
- package/ccw/dist/mcp-server/index.js.map +1 -0
- package/ccw/dist/tools/classify-folders.d.ts +26 -0
- package/ccw/dist/tools/classify-folders.d.ts.map +1 -0
- package/ccw/dist/tools/classify-folders.js +201 -0
- package/ccw/dist/tools/classify-folders.js.map +1 -0
- package/ccw/dist/tools/cli-config-manager.d.ts +62 -0
- package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -0
- package/ccw/dist/tools/cli-config-manager.js +221 -0
- package/ccw/dist/tools/cli-config-manager.js.map +1 -0
- package/ccw/dist/tools/cli-executor.d.ts +373 -0
- package/ccw/dist/tools/cli-executor.d.ts.map +1 -0
- package/ccw/dist/tools/cli-executor.js +1625 -0
- package/ccw/dist/tools/cli-executor.js.map +1 -0
- package/ccw/dist/tools/cli-history-store.d.ts +330 -0
- package/ccw/dist/tools/cli-history-store.d.ts.map +1 -0
- package/ccw/dist/tools/cli-history-store.js +916 -0
- package/ccw/dist/tools/cli-history-store.js.map +1 -0
- package/ccw/dist/tools/codex-lens.d.ts +118 -0
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -0
- package/ccw/dist/tools/codex-lens.js +962 -0
- package/ccw/dist/tools/codex-lens.js.map +1 -0
- package/ccw/dist/tools/convert-tokens-to-css.d.ts +14 -0
- package/ccw/dist/tools/convert-tokens-to-css.d.ts.map +1 -0
- package/ccw/dist/tools/convert-tokens-to-css.js +244 -0
- package/ccw/dist/tools/convert-tokens-to-css.js.map +1 -0
- package/ccw/dist/tools/core-memory.d.ts +66 -0
- package/ccw/dist/tools/core-memory.d.ts.map +1 -0
- package/ccw/dist/tools/core-memory.js +324 -0
- package/ccw/dist/tools/core-memory.js.map +1 -0
- package/ccw/dist/tools/detect-changed-modules.d.ts +24 -0
- package/ccw/dist/tools/detect-changed-modules.d.ts.map +1 -0
- package/ccw/dist/tools/detect-changed-modules.js +277 -0
- package/ccw/dist/tools/detect-changed-modules.js.map +1 -0
- package/ccw/dist/tools/discover-design-files.d.ts +36 -0
- package/ccw/dist/tools/discover-design-files.d.ts.map +1 -0
- package/ccw/dist/tools/discover-design-files.js +147 -0
- package/ccw/dist/tools/discover-design-files.js.map +1 -0
- package/ccw/dist/tools/edit-file.d.ts +28 -0
- package/ccw/dist/tools/edit-file.d.ts.map +1 -0
- package/ccw/dist/tools/edit-file.js +479 -0
- package/ccw/dist/tools/edit-file.js.map +1 -0
- package/ccw/dist/tools/generate-module-docs.d.ts +22 -0
- package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -0
- package/ccw/dist/tools/generate-module-docs.js +379 -0
- package/ccw/dist/tools/generate-module-docs.js.map +1 -0
- package/ccw/dist/tools/get-modules-by-depth.d.ts +15 -0
- package/ccw/dist/tools/get-modules-by-depth.d.ts.map +1 -0
- package/ccw/dist/tools/get-modules-by-depth.js +296 -0
- package/ccw/dist/tools/get-modules-by-depth.js.map +1 -0
- package/ccw/dist/tools/index.d.ts +55 -0
- package/ccw/dist/tools/index.d.ts.map +1 -0
- package/ccw/dist/tools/index.js +304 -0
- package/ccw/dist/tools/index.js.map +1 -0
- package/ccw/dist/tools/native-session-discovery.d.ts +97 -0
- package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -0
- package/ccw/dist/tools/native-session-discovery.js +700 -0
- package/ccw/dist/tools/native-session-discovery.js.map +1 -0
- package/ccw/dist/tools/notifier.d.ts +50 -0
- package/ccw/dist/tools/notifier.d.ts.map +1 -0
- package/ccw/dist/tools/notifier.js +90 -0
- package/ccw/dist/tools/notifier.js.map +1 -0
- package/ccw/dist/tools/read-file.d.ts +32 -0
- package/ccw/dist/tools/read-file.d.ts.map +1 -0
- package/ccw/dist/tools/read-file.js +329 -0
- package/ccw/dist/tools/read-file.js.map +1 -0
- package/ccw/dist/tools/resume-strategy.d.ts +48 -0
- package/ccw/dist/tools/resume-strategy.d.ts.map +1 -0
- package/ccw/dist/tools/resume-strategy.js +248 -0
- package/ccw/dist/tools/resume-strategy.js.map +1 -0
- package/ccw/dist/tools/session-content-parser.d.ts +58 -0
- package/ccw/dist/tools/session-content-parser.d.ts.map +1 -0
- package/ccw/dist/tools/session-content-parser.js +420 -0
- package/ccw/dist/tools/session-content-parser.js.map +1 -0
- package/ccw/dist/tools/session-manager.d.ts +9 -0
- package/ccw/dist/tools/session-manager.d.ts.map +1 -0
- package/ccw/dist/tools/session-manager.js +834 -0
- package/ccw/dist/tools/session-manager.js.map +1 -0
- package/ccw/dist/tools/smart-context.d.ts +35 -0
- package/ccw/dist/tools/smart-context.d.ts.map +1 -0
- package/ccw/dist/tools/smart-context.js +182 -0
- package/ccw/dist/tools/smart-context.js.map +1 -0
- package/ccw/dist/tools/smart-search.d.ts +105 -0
- package/ccw/dist/tools/smart-search.d.ts.map +1 -0
- package/ccw/dist/tools/smart-search.js +1753 -0
- package/ccw/dist/tools/smart-search.js.map +1 -0
- package/ccw/dist/tools/storage-manager.d.ts +114 -0
- package/ccw/dist/tools/storage-manager.d.ts.map +1 -0
- package/ccw/dist/tools/storage-manager.js +392 -0
- package/ccw/dist/tools/storage-manager.js.map +1 -0
- package/ccw/dist/tools/ui-generate-preview.d.ts +39 -0
- package/ccw/dist/tools/ui-generate-preview.d.ts.map +1 -0
- package/ccw/dist/tools/ui-generate-preview.js +300 -0
- package/ccw/dist/tools/ui-generate-preview.js.map +1 -0
- package/ccw/dist/tools/ui-instantiate-prototypes.d.ts +75 -0
- package/ccw/dist/tools/ui-instantiate-prototypes.d.ts.map +1 -0
- package/ccw/dist/tools/ui-instantiate-prototypes.js +256 -0
- package/ccw/dist/tools/ui-instantiate-prototypes.js.map +1 -0
- package/ccw/dist/tools/update-module-claude.d.ts +80 -0
- package/ccw/dist/tools/update-module-claude.d.ts.map +1 -0
- package/ccw/dist/tools/update-module-claude.js +351 -0
- package/ccw/dist/tools/update-module-claude.js.map +1 -0
- package/ccw/dist/tools/write-file.d.ts +19 -0
- package/ccw/dist/tools/write-file.d.ts.map +1 -0
- package/ccw/dist/tools/write-file.js +193 -0
- package/ccw/dist/tools/write-file.js.map +1 -0
- package/ccw/dist/types/config.d.ts +11 -0
- package/ccw/dist/types/config.d.ts.map +1 -0
- package/ccw/dist/types/config.js +2 -0
- package/ccw/dist/types/config.js.map +1 -0
- package/ccw/dist/types/index.d.ts +4 -0
- package/ccw/dist/types/index.d.ts.map +1 -0
- package/ccw/dist/types/index.js +4 -0
- package/ccw/dist/types/index.js.map +1 -0
- package/ccw/dist/types/session.d.ts +20 -0
- package/ccw/dist/types/session.d.ts.map +1 -0
- package/ccw/dist/types/session.js +2 -0
- package/ccw/dist/types/session.js.map +1 -0
- package/ccw/dist/types/tool.d.ts +36 -0
- package/ccw/dist/types/tool.d.ts.map +1 -0
- package/ccw/dist/types/tool.js +11 -0
- package/ccw/dist/types/tool.js.map +1 -0
- package/ccw/dist/utils/browser-launcher.d.ts +13 -0
- package/ccw/dist/utils/browser-launcher.d.ts.map +1 -0
- package/ccw/dist/utils/browser-launcher.js +60 -0
- package/ccw/dist/utils/browser-launcher.js.map +1 -0
- package/ccw/dist/utils/file-utils.d.ts +25 -0
- package/ccw/dist/utils/file-utils.d.ts.map +1 -0
- package/ccw/dist/utils/file-utils.js +48 -0
- package/ccw/dist/utils/file-utils.js.map +1 -0
- package/ccw/dist/utils/path-resolver.d.ts +80 -0
- package/ccw/dist/utils/path-resolver.d.ts.map +1 -0
- package/ccw/dist/utils/path-resolver.js +260 -0
- package/ccw/dist/utils/path-resolver.js.map +1 -0
- package/ccw/dist/utils/path-validator.d.ts +49 -0
- package/ccw/dist/utils/path-validator.d.ts.map +1 -0
- package/ccw/dist/utils/path-validator.js +123 -0
- package/ccw/dist/utils/path-validator.js.map +1 -0
- package/ccw/dist/utils/ui.d.ts +62 -0
- package/ccw/dist/utils/ui.d.ts.map +1 -0
- package/ccw/dist/utils/ui.js +129 -0
- package/ccw/dist/utils/ui.js.map +1 -0
- package/ccw/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-instantiate-prototypes.js","sourceRoot":"","sources":["../../src/tools/ui-instantiate-prototypes.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAE/C;;GAEG;AACH,SAAS,eAAe,CAAC,YAAY;IACnC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,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AU,EAAE,SAAS;QACrB,cAAc,EAAE,QAAQ;QACxB,KAAK;QACL,cAAc,EAAE,aAAa;QAC7B,eAAe,EAAE,cAAc;QAC/B,gBAAgB,EAAE,cAAc,CAAC,MAAM;QACvC,eAAe,EAAE,cAAc;QAC/B,aAAa,EAAE,YAAY;QAC3B,OAAO,EAAE,aAAa,cAAc,CAAC,MAAM,gBAAgB,aAAa,aAAa,cAAc,cAAc,KAAK,CAAC,MAAM,SAAS;KACvI,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE;;;;;;;;;4EAS6D;IAC1E,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2BAA2B;aACzC;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+DAA+D;aAC7E;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0DAA0D;aACxE;YACD,cAAc,EAAE;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2DAA2D;aACzE;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;aACvD;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kCAAkC;gBAC/C,OAAO,EAAE,YAAY;aACtB;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,wCAAwC;gBACrD,OAAO,EAAE,IAAI;aACd;SACF;QACD,QAAQ,EAAE,CAAC,eAAe,CAAC;KAC5B;IACD,OAAO;CACR,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export namespace updateModuleClaudeTool {
|
|
2
|
+
export let name: string;
|
|
3
|
+
export let description: string;
|
|
4
|
+
export namespace parameters {
|
|
5
|
+
let type: string;
|
|
6
|
+
namespace properties {
|
|
7
|
+
namespace strategy {
|
|
8
|
+
let type_1: string;
|
|
9
|
+
export { type_1 as type };
|
|
10
|
+
let _enum: string[];
|
|
11
|
+
export { _enum as enum };
|
|
12
|
+
let description_1: string;
|
|
13
|
+
export { description_1 as description };
|
|
14
|
+
}
|
|
15
|
+
namespace path {
|
|
16
|
+
let type_2: string;
|
|
17
|
+
export { type_2 as type };
|
|
18
|
+
let description_2: string;
|
|
19
|
+
export { description_2 as description };
|
|
20
|
+
}
|
|
21
|
+
namespace tool {
|
|
22
|
+
let type_3: string;
|
|
23
|
+
export { type_3 as type };
|
|
24
|
+
let _enum_1: string[];
|
|
25
|
+
export { _enum_1 as enum };
|
|
26
|
+
let description_3: string;
|
|
27
|
+
export { description_3 as description };
|
|
28
|
+
let _default: string;
|
|
29
|
+
export { _default as default };
|
|
30
|
+
}
|
|
31
|
+
namespace model {
|
|
32
|
+
let type_4: string;
|
|
33
|
+
export { type_4 as type };
|
|
34
|
+
let description_4: string;
|
|
35
|
+
export { description_4 as description };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let required: string[];
|
|
39
|
+
}
|
|
40
|
+
export { execute };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Main execute function
|
|
44
|
+
*/
|
|
45
|
+
declare function execute(params: any): Promise<{
|
|
46
|
+
success: boolean;
|
|
47
|
+
message: string;
|
|
48
|
+
skipped: boolean;
|
|
49
|
+
strategy?: undefined;
|
|
50
|
+
path?: undefined;
|
|
51
|
+
tool?: undefined;
|
|
52
|
+
model?: undefined;
|
|
53
|
+
file_count?: undefined;
|
|
54
|
+
duration_seconds?: undefined;
|
|
55
|
+
error?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
success: boolean;
|
|
58
|
+
strategy: any;
|
|
59
|
+
path: any;
|
|
60
|
+
tool: any;
|
|
61
|
+
model: any;
|
|
62
|
+
file_count: number;
|
|
63
|
+
duration_seconds: number;
|
|
64
|
+
message: string;
|
|
65
|
+
skipped?: undefined;
|
|
66
|
+
error?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
success: boolean;
|
|
69
|
+
strategy: any;
|
|
70
|
+
path: any;
|
|
71
|
+
tool: any;
|
|
72
|
+
model: any;
|
|
73
|
+
error: any;
|
|
74
|
+
message?: undefined;
|
|
75
|
+
skipped?: undefined;
|
|
76
|
+
file_count?: undefined;
|
|
77
|
+
duration_seconds?: undefined;
|
|
78
|
+
}>;
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=update-module-claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-module-claude.d.ts","sourceRoot":"","sources":["../../src/tools/update-module-claude.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8LA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkJC"}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update Module CLAUDE.md Tool
|
|
3
|
+
* Generate/update CLAUDE.md module documentation using CLI tools
|
|
4
|
+
*/
|
|
5
|
+
import { readdirSync, statSync, existsSync, readFileSync, writeFileSync, unlinkSync } from 'fs';
|
|
6
|
+
import { join, resolve, basename, extname } from 'path';
|
|
7
|
+
import { execSync } from 'child_process';
|
|
8
|
+
import { tmpdir } from 'os';
|
|
9
|
+
// Directories to exclude
|
|
10
|
+
const EXCLUDE_DIRS = [
|
|
11
|
+
'.git', '__pycache__', 'node_modules', '.venv', 'venv', 'env',
|
|
12
|
+
'dist', 'build', '.cache', '.pytest_cache', '.mypy_cache',
|
|
13
|
+
'coverage', '.nyc_output', 'logs', 'tmp', 'temp'
|
|
14
|
+
];
|
|
15
|
+
// Default models for each tool
|
|
16
|
+
const DEFAULT_MODELS = {
|
|
17
|
+
gemini: 'gemini-2.5-flash',
|
|
18
|
+
qwen: 'coder-model',
|
|
19
|
+
codex: 'gpt5-codex'
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Count files in directory
|
|
23
|
+
*/
|
|
24
|
+
function countFiles(dirPath) {
|
|
25
|
+
try {
|
|
26
|
+
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
27
|
+
return entries.filter(e => e.isFile() && !e.name.startsWith('.')).length;
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Scan directory structure
|
|
35
|
+
*/
|
|
36
|
+
function scanDirectoryStructure(targetPath, strategy) {
|
|
37
|
+
const lines = [];
|
|
38
|
+
const dirName = basename(targetPath);
|
|
39
|
+
let totalFiles = 0;
|
|
40
|
+
let totalDirs = 0;
|
|
41
|
+
function countRecursive(dir) {
|
|
42
|
+
try {
|
|
43
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
44
|
+
entries.forEach(e => {
|
|
45
|
+
if (e.name.startsWith('.') || EXCLUDE_DIRS.includes(e.name))
|
|
46
|
+
return;
|
|
47
|
+
if (e.isFile())
|
|
48
|
+
totalFiles++;
|
|
49
|
+
else if (e.isDirectory()) {
|
|
50
|
+
totalDirs++;
|
|
51
|
+
countRecursive(join(dir, e.name));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
// Ignore
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
countRecursive(targetPath);
|
|
60
|
+
lines.push(`Directory: ${dirName}`);
|
|
61
|
+
lines.push(`Total files: ${totalFiles}`);
|
|
62
|
+
lines.push(`Total directories: ${totalDirs}`);
|
|
63
|
+
lines.push('');
|
|
64
|
+
if (strategy === 'multi-layer') {
|
|
65
|
+
lines.push('Subdirectories with files:');
|
|
66
|
+
// List subdirectories with file counts
|
|
67
|
+
function listSubdirs(dir, prefix = '') {
|
|
68
|
+
try {
|
|
69
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
70
|
+
entries.forEach(e => {
|
|
71
|
+
if (!e.isDirectory() || e.name.startsWith('.') || EXCLUDE_DIRS.includes(e.name))
|
|
72
|
+
return;
|
|
73
|
+
const subPath = join(dir, e.name);
|
|
74
|
+
const fileCount = countFiles(subPath);
|
|
75
|
+
if (fileCount > 0) {
|
|
76
|
+
const relPath = subPath.replace(targetPath, '').replace(/^[/\\]/, '');
|
|
77
|
+
lines.push(` - ${relPath}/ (${fileCount} files)`);
|
|
78
|
+
}
|
|
79
|
+
listSubdirs(subPath, prefix + ' ');
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
// Ignore
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
listSubdirs(targetPath);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
lines.push('Direct subdirectories:');
|
|
90
|
+
try {
|
|
91
|
+
const entries = readdirSync(targetPath, { withFileTypes: true });
|
|
92
|
+
entries.forEach(e => {
|
|
93
|
+
if (!e.isDirectory() || e.name.startsWith('.') || EXCLUDE_DIRS.includes(e.name))
|
|
94
|
+
return;
|
|
95
|
+
const subPath = join(targetPath, e.name);
|
|
96
|
+
const fileCount = countFiles(subPath);
|
|
97
|
+
const hasClaude = existsSync(join(subPath, 'CLAUDE.md')) ? ' [has CLAUDE.md]' : '';
|
|
98
|
+
lines.push(` - ${e.name}/ (${fileCount} files)${hasClaude}`);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
// Ignore
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Count file types in current directory
|
|
106
|
+
lines.push('');
|
|
107
|
+
lines.push('Current directory files:');
|
|
108
|
+
try {
|
|
109
|
+
const entries = readdirSync(targetPath, { withFileTypes: true });
|
|
110
|
+
const codeExts = ['.ts', '.tsx', '.js', '.jsx', '.py', '.sh'];
|
|
111
|
+
const configExts = ['.json', '.yaml', '.yml', '.toml'];
|
|
112
|
+
let codeCount = 0, configCount = 0, docCount = 0;
|
|
113
|
+
entries.forEach(e => {
|
|
114
|
+
if (!e.isFile())
|
|
115
|
+
return;
|
|
116
|
+
const ext = extname(e.name).toLowerCase();
|
|
117
|
+
if (codeExts.includes(ext))
|
|
118
|
+
codeCount++;
|
|
119
|
+
else if (configExts.includes(ext))
|
|
120
|
+
configCount++;
|
|
121
|
+
else if (ext === '.md')
|
|
122
|
+
docCount++;
|
|
123
|
+
});
|
|
124
|
+
lines.push(` - Code files: ${codeCount}`);
|
|
125
|
+
lines.push(` - Config files: ${configCount}`);
|
|
126
|
+
lines.push(` - Documentation: ${docCount}`);
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
// Ignore
|
|
130
|
+
}
|
|
131
|
+
return lines.join('\n');
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Load template content
|
|
135
|
+
*/
|
|
136
|
+
function loadTemplate() {
|
|
137
|
+
const templatePath = join(process.env.HOME || process.env.USERPROFILE, '.claude/workflows/cli-templates/prompts/memory/02-document-module-structure.txt');
|
|
138
|
+
if (existsSync(templatePath)) {
|
|
139
|
+
return readFileSync(templatePath, 'utf8');
|
|
140
|
+
}
|
|
141
|
+
return 'Create comprehensive CLAUDE.md documentation following standard structure with Purpose, Structure, Components, Dependencies, Integration, and Implementation sections.';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Create temporary prompt file and return cleanup function
|
|
145
|
+
*/
|
|
146
|
+
function createPromptFile(prompt) {
|
|
147
|
+
const timestamp = Date.now();
|
|
148
|
+
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
149
|
+
const promptFile = join(tmpdir(), `claude-prompt-${timestamp}-${randomSuffix}.txt`);
|
|
150
|
+
writeFileSync(promptFile, prompt, 'utf8');
|
|
151
|
+
return promptFile;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Build CLI command using stdin piping for prompt (avoids shell escaping issues)
|
|
155
|
+
*/
|
|
156
|
+
function buildCliCommand(tool, promptFile, model) {
|
|
157
|
+
// Use stdin piping: cat file | tool or Get-Content | tool
|
|
158
|
+
// This avoids shell escaping issues with multiline prompts
|
|
159
|
+
const normalizedPath = promptFile.replace(/\\/g, '/');
|
|
160
|
+
const isWindows = process.platform === 'win32';
|
|
161
|
+
// Build the cat/read command based on platform
|
|
162
|
+
const catCmd = isWindows ? `Get-Content -Raw "${normalizedPath}" | ` : `cat "${normalizedPath}" | `;
|
|
163
|
+
switch (tool) {
|
|
164
|
+
case 'qwen':
|
|
165
|
+
return model === 'coder-model'
|
|
166
|
+
? `${catCmd}qwen --yolo`
|
|
167
|
+
: `${catCmd}qwen -m "${model}" --yolo`;
|
|
168
|
+
case 'codex':
|
|
169
|
+
// codex uses different syntax - prompt as exec argument
|
|
170
|
+
if (isWindows) {
|
|
171
|
+
return `codex --full-auto exec (Get-Content -Raw "${normalizedPath}") -m "${model}" --skip-git-repo-check -s danger-full-access`;
|
|
172
|
+
}
|
|
173
|
+
return `codex --full-auto exec "$(cat "${normalizedPath}")" -m "${model}" --skip-git-repo-check -s danger-full-access`;
|
|
174
|
+
case 'gemini':
|
|
175
|
+
default:
|
|
176
|
+
// gemini reads from stdin when no positional prompt is given
|
|
177
|
+
return `${catCmd}gemini -m "${model}" --yolo`;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Main execute function
|
|
182
|
+
*/
|
|
183
|
+
async function execute(params) {
|
|
184
|
+
const { strategy, path: modulePath, tool = 'gemini', model } = params;
|
|
185
|
+
// Validate parameters
|
|
186
|
+
if (!strategy) {
|
|
187
|
+
throw new Error('Parameter "strategy" is required. Valid: single-layer, multi-layer');
|
|
188
|
+
}
|
|
189
|
+
if (!['single-layer', 'multi-layer'].includes(strategy)) {
|
|
190
|
+
throw new Error(`Invalid strategy '${strategy}'. Valid: single-layer, multi-layer`);
|
|
191
|
+
}
|
|
192
|
+
if (!modulePath) {
|
|
193
|
+
throw new Error('Parameter "path" is required');
|
|
194
|
+
}
|
|
195
|
+
const targetPath = resolve(process.cwd(), modulePath);
|
|
196
|
+
if (!existsSync(targetPath)) {
|
|
197
|
+
throw new Error(`Directory not found: ${targetPath}`);
|
|
198
|
+
}
|
|
199
|
+
if (!statSync(targetPath).isDirectory()) {
|
|
200
|
+
throw new Error(`Not a directory: ${targetPath}`);
|
|
201
|
+
}
|
|
202
|
+
// Check if directory has files
|
|
203
|
+
const fileCount = countFiles(targetPath);
|
|
204
|
+
if (fileCount === 0) {
|
|
205
|
+
return {
|
|
206
|
+
success: false,
|
|
207
|
+
message: `Skipping '${modulePath}' - no files found`,
|
|
208
|
+
skipped: true
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// Set model
|
|
212
|
+
const actualModel = model || DEFAULT_MODELS[tool] || DEFAULT_MODELS.gemini;
|
|
213
|
+
// Load template
|
|
214
|
+
const templateContent = loadTemplate();
|
|
215
|
+
// Scan directory structure
|
|
216
|
+
const structureInfo = scanDirectoryStructure(targetPath, strategy);
|
|
217
|
+
// Build prompt based on strategy
|
|
218
|
+
let prompt;
|
|
219
|
+
if (strategy === 'multi-layer') {
|
|
220
|
+
prompt = `Directory Structure Analysis:
|
|
221
|
+
${structureInfo}
|
|
222
|
+
|
|
223
|
+
Read: @**/*
|
|
224
|
+
|
|
225
|
+
Generate CLAUDE.md files:
|
|
226
|
+
- Primary: ./CLAUDE.md (current directory)
|
|
227
|
+
- Additional: CLAUDE.md in each subdirectory containing files
|
|
228
|
+
|
|
229
|
+
Template Guidelines:
|
|
230
|
+
${templateContent}
|
|
231
|
+
|
|
232
|
+
Instructions:
|
|
233
|
+
- Work bottom-up: deepest directories first
|
|
234
|
+
- Parent directories reference children
|
|
235
|
+
- Each CLAUDE.md file must be in its respective directory
|
|
236
|
+
- Follow the template guidelines above for consistent structure
|
|
237
|
+
- Use the structure analysis to understand directory hierarchy`;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
prompt = `Directory Structure Analysis:
|
|
241
|
+
${structureInfo}
|
|
242
|
+
|
|
243
|
+
Read: @*/CLAUDE.md @*.ts @*.tsx @*.js @*.jsx @*.py @*.sh @*.md @*.json @*.yaml @*.yml
|
|
244
|
+
|
|
245
|
+
Generate single file: ./CLAUDE.md
|
|
246
|
+
|
|
247
|
+
Template Guidelines:
|
|
248
|
+
${templateContent}
|
|
249
|
+
|
|
250
|
+
Instructions:
|
|
251
|
+
- Create exactly one CLAUDE.md file in the current directory
|
|
252
|
+
- Reference child CLAUDE.md files, do not duplicate their content
|
|
253
|
+
- Follow the template guidelines above for consistent structure
|
|
254
|
+
- Use the structure analysis to understand the current directory context`;
|
|
255
|
+
}
|
|
256
|
+
// Create temporary prompt file (avoids shell escaping issues with multiline prompts)
|
|
257
|
+
const promptFile = createPromptFile(prompt);
|
|
258
|
+
// Build command using file-based prompt
|
|
259
|
+
const command = buildCliCommand(tool, promptFile, actualModel);
|
|
260
|
+
// Log execution info
|
|
261
|
+
console.log(`⚡ Updating: ${modulePath}`);
|
|
262
|
+
console.log(` Strategy: ${strategy} | Tool: ${tool} | Model: ${actualModel} | Files: ${fileCount}`);
|
|
263
|
+
console.log(` Prompt file: ${promptFile}`);
|
|
264
|
+
try {
|
|
265
|
+
const startTime = Date.now();
|
|
266
|
+
execSync(command, {
|
|
267
|
+
cwd: targetPath,
|
|
268
|
+
encoding: 'utf8',
|
|
269
|
+
stdio: 'inherit',
|
|
270
|
+
timeout: 300000, // 5 minutes
|
|
271
|
+
shell: process.platform === 'win32' ? 'powershell.exe' : '/bin/bash'
|
|
272
|
+
});
|
|
273
|
+
const duration = Math.round((Date.now() - startTime) / 1000);
|
|
274
|
+
// Cleanup prompt file
|
|
275
|
+
try {
|
|
276
|
+
unlinkSync(promptFile);
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
// Ignore cleanup errors
|
|
280
|
+
}
|
|
281
|
+
console.log(` ✅ Completed in ${duration}s`);
|
|
282
|
+
return {
|
|
283
|
+
success: true,
|
|
284
|
+
strategy,
|
|
285
|
+
path: modulePath,
|
|
286
|
+
tool,
|
|
287
|
+
model: actualModel,
|
|
288
|
+
file_count: fileCount,
|
|
289
|
+
duration_seconds: duration,
|
|
290
|
+
message: `CLAUDE.md updated successfully in ${duration}s`
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
// Cleanup prompt file on error
|
|
295
|
+
try {
|
|
296
|
+
unlinkSync(promptFile);
|
|
297
|
+
}
|
|
298
|
+
catch (e) {
|
|
299
|
+
// Ignore cleanup errors
|
|
300
|
+
}
|
|
301
|
+
console.log(` ❌ Update failed: ${error.message}`);
|
|
302
|
+
return {
|
|
303
|
+
success: false,
|
|
304
|
+
strategy,
|
|
305
|
+
path: modulePath,
|
|
306
|
+
tool,
|
|
307
|
+
model: actualModel,
|
|
308
|
+
error: error.message
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Tool Definition
|
|
314
|
+
*/
|
|
315
|
+
export const updateModuleClaudeTool = {
|
|
316
|
+
name: 'update_module_claude',
|
|
317
|
+
description: `Generate/update CLAUDE.md module documentation using CLI tools.
|
|
318
|
+
|
|
319
|
+
Strategies:
|
|
320
|
+
- single-layer: Read current dir code + child CLAUDE.md, generate ./CLAUDE.md
|
|
321
|
+
- multi-layer: Read all files, generate CLAUDE.md for each directory
|
|
322
|
+
|
|
323
|
+
Tools: gemini (default), qwen, codex`,
|
|
324
|
+
parameters: {
|
|
325
|
+
type: 'object',
|
|
326
|
+
properties: {
|
|
327
|
+
strategy: {
|
|
328
|
+
type: 'string',
|
|
329
|
+
enum: ['single-layer', 'multi-layer'],
|
|
330
|
+
description: 'Generation strategy'
|
|
331
|
+
},
|
|
332
|
+
path: {
|
|
333
|
+
type: 'string',
|
|
334
|
+
description: 'Module directory path'
|
|
335
|
+
},
|
|
336
|
+
tool: {
|
|
337
|
+
type: 'string',
|
|
338
|
+
enum: ['gemini', 'qwen', 'codex'],
|
|
339
|
+
description: 'CLI tool to use (default: gemini)',
|
|
340
|
+
default: 'gemini'
|
|
341
|
+
},
|
|
342
|
+
model: {
|
|
343
|
+
type: 'string',
|
|
344
|
+
description: 'Model name (optional, uses tool defaults)'
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
required: ['strategy', 'path']
|
|
348
|
+
},
|
|
349
|
+
execute
|
|
350
|
+
};
|
|
351
|
+
//# sourceMappingURL=update-module-claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-module-claude.js","sourceRoot":"","sources":["../../src/tools/update-module-claude.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE5B,yBAAyB;AACzB,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;IAC7D,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa;IACzD,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CACjD,CAAC;AAEF,+BAA+B;AAC/B,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,YAAY;CACpB,CAAC;AAEF;;GAEG;AACH,SAAS,UAAU,CAAC,OAAO;IACzB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,E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ACd,WAAW,EAAE,uBAAuB;aACrC;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;gBACjC,WAAW,EAAE,mCAAmC;gBAChD,OAAO,EAAE,QAAQ;aAClB;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;KAC/B;IACD,OAAO;CACR,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write File Tool - Create or overwrite files
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Create new files or overwrite existing
|
|
6
|
+
* - Auto-create parent directories
|
|
7
|
+
* - Support for text content with proper encoding
|
|
8
|
+
* - Optional backup before overwrite
|
|
9
|
+
*/
|
|
10
|
+
import type { ToolSchema, ToolResult } from '../types/tool.js';
|
|
11
|
+
interface WriteResult {
|
|
12
|
+
path: string;
|
|
13
|
+
bytes: number;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const schema: ToolSchema;
|
|
17
|
+
export declare function handler(params: Record<string, unknown>): Promise<ToolResult<WriteResult>>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=write-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../src/tools/write-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiB/D,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAuED,eAAO,MAAM,MAAM,EAAE,UAoCpB,CAAC;AAGF,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CA+E/F"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write File Tool - Create or overwrite files
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Create new files or overwrite existing
|
|
6
|
+
* - Auto-create parent directories
|
|
7
|
+
* - Support for text content with proper encoding
|
|
8
|
+
* - Optional backup before overwrite
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { writeFileSync, readFileSync, existsSync, mkdirSync, statSync } from 'fs';
|
|
12
|
+
import { resolve, dirname, basename } from 'path';
|
|
13
|
+
import { validatePath } from '../utils/path-validator.js';
|
|
14
|
+
// Define Zod schema for validation
|
|
15
|
+
const ParamsSchema = z.object({
|
|
16
|
+
path: z.string().min(1, 'Path is required'),
|
|
17
|
+
content: z.string(),
|
|
18
|
+
createDirectories: z.boolean().default(true),
|
|
19
|
+
backup: z.boolean().default(false),
|
|
20
|
+
encoding: z.enum(['utf8', 'utf-8', 'ascii', 'latin1', 'binary', 'hex', 'base64']).default('utf8'),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Ensure parent directory exists
|
|
24
|
+
* @param filePath - Path to file
|
|
25
|
+
*/
|
|
26
|
+
function ensureDir(filePath) {
|
|
27
|
+
const dir = dirname(filePath);
|
|
28
|
+
if (!existsSync(dir)) {
|
|
29
|
+
mkdirSync(dir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create backup of existing file
|
|
34
|
+
* @param filePath - Path to file
|
|
35
|
+
* @returns Backup path or null if no backup created
|
|
36
|
+
*/
|
|
37
|
+
function createBackup(filePath) {
|
|
38
|
+
if (!existsSync(filePath)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const dir = dirname(filePath);
|
|
42
|
+
const name = basename(filePath);
|
|
43
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
44
|
+
const backupPath = resolve(dir, `.${name}.${timestamp}.bak`);
|
|
45
|
+
try {
|
|
46
|
+
const content = readFileSync(filePath);
|
|
47
|
+
writeFileSync(backupPath, content);
|
|
48
|
+
return backupPath;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw new Error(`Failed to create backup: ${error.message}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Verify file write operation completed successfully
|
|
56
|
+
* @param filePath - Path to written file
|
|
57
|
+
* @param expectedBytes - Expected file size in bytes
|
|
58
|
+
* @param encoding - File encoding used
|
|
59
|
+
* @returns Error message if verification fails, null if successful
|
|
60
|
+
*/
|
|
61
|
+
function verifyFileWrite(filePath, expectedBytes, encoding) {
|
|
62
|
+
// Check 1: File exists
|
|
63
|
+
if (!existsSync(filePath)) {
|
|
64
|
+
return `File verification failed: file does not exist at ${filePath}`;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
// Check 2: File size matches expected bytes
|
|
68
|
+
const stats = statSync(filePath);
|
|
69
|
+
if (stats.size !== expectedBytes) {
|
|
70
|
+
return `File verification failed: size mismatch (expected ${expectedBytes}B, actual ${stats.size}B)`;
|
|
71
|
+
}
|
|
72
|
+
// Check 3: File is readable (for long JSON files)
|
|
73
|
+
const readContent = readFileSync(filePath, { encoding });
|
|
74
|
+
const actualBytes = Buffer.byteLength(readContent, encoding);
|
|
75
|
+
if (actualBytes !== expectedBytes) {
|
|
76
|
+
return `File verification failed: content size mismatch after read (expected ${expectedBytes}B, read ${actualBytes}B)`;
|
|
77
|
+
}
|
|
78
|
+
return null; // Verification passed
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
return `File verification failed: ${error.message}`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Tool schema for MCP
|
|
85
|
+
export const schema = {
|
|
86
|
+
name: 'write_file',
|
|
87
|
+
description: `Write content to file. Auto-creates parent directories.
|
|
88
|
+
|
|
89
|
+
Usage: write_file(path="file.js", content="code here")
|
|
90
|
+
Options: backup=true (backup before overwrite), createDirectories=false (disable auto-creation), encoding="utf8"`,
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: {
|
|
94
|
+
path: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
description: 'Path to the file to create or overwrite',
|
|
97
|
+
},
|
|
98
|
+
content: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
description: 'Content to write to the file',
|
|
101
|
+
},
|
|
102
|
+
createDirectories: {
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
description: 'Create parent directories if they do not exist (default: true)',
|
|
105
|
+
default: true,
|
|
106
|
+
},
|
|
107
|
+
backup: {
|
|
108
|
+
type: 'boolean',
|
|
109
|
+
description: 'Create backup of existing file before overwriting (default: false)',
|
|
110
|
+
default: false,
|
|
111
|
+
},
|
|
112
|
+
encoding: {
|
|
113
|
+
type: 'string',
|
|
114
|
+
description: 'File encoding (default: utf8)',
|
|
115
|
+
default: 'utf8',
|
|
116
|
+
enum: ['utf8', 'utf-8', 'ascii', 'latin1', 'binary', 'hex', 'base64'],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
required: ['path', 'content'],
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
// Handler function
|
|
123
|
+
export async function handler(params) {
|
|
124
|
+
const parsed = ParamsSchema.safeParse(params);
|
|
125
|
+
if (!parsed.success) {
|
|
126
|
+
return { success: false, error: `Invalid params: ${parsed.error.message}` };
|
|
127
|
+
}
|
|
128
|
+
const { path: filePath, content, createDirectories, backup, encoding, } = parsed.data;
|
|
129
|
+
// Validate and resolve path
|
|
130
|
+
const resolvedPath = await validatePath(filePath);
|
|
131
|
+
const fileExists = existsSync(resolvedPath);
|
|
132
|
+
// Create parent directories if needed
|
|
133
|
+
if (createDirectories) {
|
|
134
|
+
ensureDir(resolvedPath);
|
|
135
|
+
}
|
|
136
|
+
else if (!existsSync(dirname(resolvedPath))) {
|
|
137
|
+
return {
|
|
138
|
+
success: false,
|
|
139
|
+
error: `Parent directory does not exist: ${dirname(resolvedPath)}`,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
// Create backup if requested and file exists
|
|
143
|
+
let backupPath = null;
|
|
144
|
+
if (backup && fileExists) {
|
|
145
|
+
try {
|
|
146
|
+
backupPath = createBackup(resolvedPath);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
return {
|
|
150
|
+
success: false,
|
|
151
|
+
error: error.message,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Write file
|
|
156
|
+
try {
|
|
157
|
+
writeFileSync(resolvedPath, content, { encoding });
|
|
158
|
+
const bytes = Buffer.byteLength(content, encoding);
|
|
159
|
+
// Verify write operation completed successfully
|
|
160
|
+
const verificationError = verifyFileWrite(resolvedPath, bytes, encoding);
|
|
161
|
+
if (verificationError) {
|
|
162
|
+
return {
|
|
163
|
+
success: false,
|
|
164
|
+
error: verificationError,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// Build compact message
|
|
168
|
+
let message;
|
|
169
|
+
if (fileExists) {
|
|
170
|
+
message = backupPath
|
|
171
|
+
? `Overwrote (${bytes}B, backup: ${basename(backupPath)}) - verified`
|
|
172
|
+
: `Overwrote (${bytes}B) - verified`;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
message = `Created (${bytes}B) - verified`;
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
success: true,
|
|
179
|
+
result: {
|
|
180
|
+
path: resolvedPath,
|
|
181
|
+
bytes,
|
|
182
|
+
message,
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
return {
|
|
188
|
+
success: false,
|
|
189
|
+
error: `Failed to write file: ${error.message}`,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=write-file.js.map
|