@superblocksteam/vite-plugin-file-sync 2.0.74-next.2 → 2.0.75-next.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/dist/ai-service/agent/middleware.d.ts +14 -0
- package/dist/ai-service/agent/middleware.d.ts.map +1 -1
- package/dist/ai-service/agent/middleware.js +40 -0
- package/dist/ai-service/agent/middleware.js.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js +66 -5
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/static-analysis.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/apis/static-analysis.js +11 -5
- package/dist/ai-service/agent/subagents/apis/static-analysis.js.map +1 -1
- package/dist/ai-service/agent/subagents/testing/prompt-builder.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/testing/prompt-builder.js +15 -0
- package/dist/ai-service/agent/subagents/testing/prompt-builder.js.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.js +3 -0
- package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api-artifact.js +11 -3
- package/dist/ai-service/agent/tools/apis/build-api-artifact.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api.js +6 -0
- package/dist/ai-service/agent/tools/apis/build-api.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.js +99 -3
- package/dist/ai-service/agent/tools/apis/get-api-docs.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/integration-types.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/integration-types.js +69 -17
- package/dist/ai-service/agent/tools/apis/integration-types.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.d.ts +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.js +26 -45
- package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/write-api.d.ts +2 -2
- package/dist/ai-service/agent/tools/apis/write-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/write-api.js +8 -2
- package/dist/ai-service/agent/tools/apis/write-api.js.map +1 -1
- package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-capture-screenshot.js +3 -0
- package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
- package/dist/ai-service/agent/tools/build-debug.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-debug.js +58 -6
- package/dist/ai-service/agent/tools/build-debug.js.map +1 -1
- package/dist/ai-service/agent/tools/build-delete-file.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-delete-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-delete-file.js +27 -196
- package/dist/ai-service/agent/tools/build-delete-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.js +12 -22
- package/dist/ai-service/agent/tools/build-edit-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-finalize.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-finalize.js +3 -0
- package/dist/ai-service/agent/tools/build-finalize.js.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.js +15 -0
- package/dist/ai-service/agent/tools/build-install-packages.js.map +1 -1
- package/dist/ai-service/agent/tools/build-list-files.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-list-files.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-list-files.js +6 -14
- package/dist/ai-service/agent/tools/build-list-files.js.map +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.js +9 -0
- package/dist/ai-service/agent/tools/build-manage-checklist.js.map +1 -1
- package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts +2 -2
- package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-multi-edit-file.js +8 -25
- package/dist/ai-service/agent/tools/build-multi-edit-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-read-file.d.ts +10 -4
- package/dist/ai-service/agent/tools/build-read-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-read-file.js +75 -77
- package/dist/ai-service/agent/tools/build-read-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-reload-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-reload-file.js +5 -0
- package/dist/ai-service/agent/tools/build-reload-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.js +3 -50
- package/dist/ai-service/agent/tools/build-rename-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-validate-icons.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-validate-icons.js +8 -0
- package/dist/ai-service/agent/tools/build-validate-icons.js.map +1 -1
- package/dist/ai-service/agent/tools/build-write-file.d.ts +2 -2
- package/dist/ai-service/agent/tools/build-write-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-write-file.js +7 -17
- package/dist/ai-service/agent/tools/build-write-file.js.map +1 -1
- package/dist/ai-service/agent/tools/clear-error-cache.d.ts +10 -0
- package/dist/ai-service/agent/tools/clear-error-cache.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/clear-error-cache.js +38 -0
- package/dist/ai-service/agent/tools/clear-error-cache.js.map +1 -0
- package/dist/ai-service/agent/tools/get-console-logs.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/get-console-logs.js +6 -0
- package/dist/ai-service/agent/tools/get-console-logs.js.map +1 -1
- package/dist/ai-service/agent/tools/get-runtime-errors.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/get-runtime-errors.js +4 -0
- package/dist/ai-service/agent/tools/get-runtime-errors.js.map +1 -1
- package/dist/ai-service/agent/tools/index.d.ts +1 -0
- package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/index.js +1 -0
- package/dist/ai-service/agent/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.js +56 -9
- package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.js +6 -0
- package/dist/ai-service/agent/tools/integrations/metadata.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/run-code.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/run-code.js +9 -0
- package/dist/ai-service/agent/tools/integrations/run-code.js.map +1 -1
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +27 -6
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/registry.d.ts +15 -0
- package/dist/ai-service/agent/tools2/registry.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/registry.js +30 -0
- package/dist/ai-service/agent/tools2/registry.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js +11 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/edit.d.ts +4 -1
- package/dist/ai-service/agent/tools2/tools/edit.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/edit.js +10 -8
- package/dist/ai-service/agent/tools2/tools/edit.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/end-test-run.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/end-test-run.js +5 -0
- package/dist/ai-service/agent/tools2/tools/end-test-run.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts +2 -0
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +24 -0
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/glob.d.ts +4 -1
- package/dist/ai-service/agent/tools2/tools/glob.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/glob.js +25 -85
- package/dist/ai-service/agent/tools2/tools/glob.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js +9 -0
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.d.ts +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.js +22 -5
- package/dist/ai-service/agent/tools2/tools/grep.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.js +4 -0
- package/dist/ai-service/agent/tools2/tools/list-attachments.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ls.d.ts +8 -1
- package/dist/ai-service/agent/tools2/tools/ls.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ls.js +102 -83
- package/dist/ai-service/agent/tools2/tools/ls.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/read.d.ts +5 -2
- package/dist/ai-service/agent/tools2/tools/read.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/read.js +24 -12
- package/dist/ai-service/agent/tools2/tools/read.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/start-test-run.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/start-test-run.js +13 -0
- package/dist/ai-service/agent/tools2/tools/start-test-run.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/update-test-case-status.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/update-test-case-status.js +6 -0
- package/dist/ai-service/agent/tools2/tools/update-test-case-status.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/write.d.ts +4 -1
- package/dist/ai-service/agent/tools2/tools/write.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/write.js +9 -4
- package/dist/ai-service/agent/tools2/tools/write.js.map +1 -1
- package/dist/ai-service/agent/tools2/types.d.ts +25 -0
- package/dist/ai-service/agent/tools2/types.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/types.js.map +1 -1
- package/dist/ai-service/app-interface/constants.d.ts +77 -0
- package/dist/ai-service/app-interface/constants.d.ts.map +1 -0
- package/dist/ai-service/app-interface/constants.js +129 -0
- package/dist/ai-service/app-interface/constants.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.d.ts +87 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.js +91 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/handlers/api-handler.d.ts +35 -0
- package/dist/ai-service/app-interface/filesystem/handlers/api-handler.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/handlers/api-handler.js +236 -0
- package/dist/ai-service/app-interface/filesystem/handlers/api-handler.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/handlers/index.d.ts +5 -0
- package/dist/ai-service/app-interface/filesystem/handlers/index.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/handlers/index.js +5 -0
- package/dist/ai-service/app-interface/filesystem/handlers/index.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/index.d.ts +12 -0
- package/dist/ai-service/app-interface/filesystem/index.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/index.js +11 -0
- package/dist/ai-service/app-interface/filesystem/index.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/validation.d.ts +71 -0
- package/dist/ai-service/app-interface/filesystem/validation.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/validation.js +170 -0
- package/dist/ai-service/app-interface/filesystem/validation.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts +108 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.js +157 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-fs-types.d.ts +126 -0
- package/dist/ai-service/app-interface/filesystem/virtual-fs-types.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-fs-types.js +9 -0
- package/dist/ai-service/app-interface/filesystem/virtual-fs-types.js.map +1 -0
- package/dist/ai-service/app-interface/linter.d.ts +4 -1
- package/dist/ai-service/app-interface/linter.d.ts.map +1 -1
- package/dist/ai-service/app-interface/linter.js +10 -6
- package/dist/ai-service/app-interface/linter.js.map +1 -1
- package/dist/ai-service/app-interface/shell.d.ts +205 -1
- package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
- package/dist/ai-service/app-interface/shell.js +474 -14
- package/dist/ai-service/app-interface/shell.js.map +1 -1
- package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store.js +8 -0
- package/dist/ai-service/chat/chat-session-store.js.map +1 -1
- package/dist/ai-service/features.d.ts +8 -0
- package/dist/ai-service/features.d.ts.map +1 -1
- package/dist/ai-service/features.js +8 -0
- package/dist/ai-service/features.js.map +1 -1
- package/dist/ai-service/index.d.ts +1 -1
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +26 -24
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/judge/judge-executor.d.ts.map +1 -1
- package/dist/ai-service/judge/judge-executor.js +4 -0
- package/dist/ai-service/judge/judge-executor.js.map +1 -1
- package/dist/ai-service/llm/client.d.ts +19 -3
- package/dist/ai-service/llm/client.d.ts.map +1 -1
- package/dist/ai-service/llm/client.js +131 -12
- package/dist/ai-service/llm/client.js.map +1 -1
- package/dist/ai-service/llm/context/context.d.ts +4 -1
- package/dist/ai-service/llm/context/context.d.ts.map +1 -1
- package/dist/ai-service/llm/context/context.js +27 -5
- package/dist/ai-service/llm/context/context.js.map +1 -1
- package/dist/ai-service/llm/context/internal-types.d.ts +5 -0
- package/dist/ai-service/llm/context/internal-types.d.ts.map +1 -1
- package/dist/ai-service/llm/context/internal-types.js +5 -0
- package/dist/ai-service/llm/context/internal-types.js.map +1 -1
- package/dist/ai-service/llm/context/levels/l1.d.ts +4 -3
- package/dist/ai-service/llm/context/levels/l1.d.ts.map +1 -1
- package/dist/ai-service/llm/context/levels/l1.js +9 -8
- package/dist/ai-service/llm/context/levels/l1.js.map +1 -1
- package/dist/ai-service/llm/context/serialization.d.ts +8 -0
- package/dist/ai-service/llm/context/serialization.d.ts.map +1 -1
- package/dist/ai-service/llm/context/utils/content-compaction.d.ts +7 -5
- package/dist/ai-service/llm/context/utils/content-compaction.d.ts.map +1 -1
- package/dist/ai-service/llm/context/utils/content-compaction.js +27 -6
- package/dist/ai-service/llm/context/utils/content-compaction.js.map +1 -1
- package/dist/ai-service/llm/error.d.ts +1 -0
- package/dist/ai-service/llm/error.d.ts.map +1 -1
- package/dist/ai-service/llm/error.js +29 -3
- package/dist/ai-service/llm/error.js.map +1 -1
- package/dist/ai-service/llm/stream/config.d.ts +14 -5
- package/dist/ai-service/llm/stream/config.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/config.js +17 -5
- package/dist/ai-service/llm/stream/config.js.map +1 -1
- package/dist/ai-service/llm/stream/errors.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/errors.js +7 -4
- package/dist/ai-service/llm/stream/errors.js.map +1 -1
- package/dist/ai-service/llm/stream/index.d.ts +4 -2
- package/dist/ai-service/llm/stream/index.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/index.js +4 -2
- package/dist/ai-service/llm/stream/index.js.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.d.ts +1 -1
- package/dist/ai-service/llm/stream/orchestrator.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.js +5 -11
- package/dist/ai-service/llm/stream/orchestrator.js.map +1 -1
- package/dist/ai-service/llm/stream/retry-engine.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/retry-engine.js +3 -3
- package/dist/ai-service/llm/stream/retry-engine.js.map +1 -1
- package/dist/ai-service/mcp/adapter/mcp-tool-adapter.d.ts +8 -0
- package/dist/ai-service/mcp/adapter/mcp-tool-adapter.d.ts.map +1 -1
- package/dist/ai-service/mcp/adapter/mcp-tool-adapter.js +108 -0
- package/dist/ai-service/mcp/adapter/mcp-tool-adapter.js.map +1 -1
- package/dist/ai-service/mcp/embedded-playwright-mcp-server.d.ts.map +1 -1
- package/dist/ai-service/mcp/embedded-playwright-mcp-server.js +360 -133
- package/dist/ai-service/mcp/embedded-playwright-mcp-server.js.map +1 -1
- package/dist/ai-service/security/index.d.ts +8 -0
- package/dist/ai-service/security/index.d.ts.map +1 -0
- package/dist/ai-service/security/index.js +8 -0
- package/dist/ai-service/security/index.js.map +1 -0
- package/dist/ai-service/security/safety-classifier.d.ts +103 -0
- package/dist/ai-service/security/safety-classifier.d.ts.map +1 -0
- package/dist/ai-service/security/safety-classifier.js +168 -0
- package/dist/ai-service/security/safety-classifier.js.map +1 -0
- package/dist/ai-service/security/secret-scanner.d.ts +145 -0
- package/dist/ai-service/security/secret-scanner.d.ts.map +1 -0
- package/dist/ai-service/security/secret-scanner.js +344 -0
- package/dist/ai-service/security/secret-scanner.js.map +1 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts +2 -1
- package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.js +29 -8
- package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.js +17 -6
- package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js +9 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
- package/dist/ai-service/template-renderer.d.ts.map +1 -1
- package/dist/ai-service/template-renderer.js +4 -1
- package/dist/ai-service/template-renderer.js.map +1 -1
- package/dist/ai-service/transform/api-builder/shared.js +2 -2
- package/dist/ai-service/transform/api-builder/shared.js.map +1 -1
- package/dist/components-manager.d.ts.map +1 -1
- package/dist/components-manager.js +17 -12
- package/dist/components-manager.js.map +1 -1
- package/dist/ensure-app-provider.d.ts +2 -0
- package/dist/ensure-app-provider.d.ts.map +1 -0
- package/dist/ensure-app-provider.js +209 -0
- package/dist/ensure-app-provider.js.map +1 -0
- package/dist/file-sync-vite-plugin.d.ts.map +1 -1
- package/dist/file-sync-vite-plugin.js +22 -12
- package/dist/file-sync-vite-plugin.js.map +1 -1
- package/dist/file-system-manager.d.ts +0 -6
- package/dist/file-system-manager.d.ts.map +1 -1
- package/dist/file-system-manager.js +119 -144
- package/dist/file-system-manager.js.map +1 -1
- package/dist/parsing/util.d.ts.map +1 -1
- package/dist/parsing/util.js +5 -1
- package/dist/parsing/util.js.map +1 -1
- package/dist/socket-manager.d.ts.map +1 -1
- package/dist/socket-manager.js +5 -0
- package/dist/socket-manager.js.map +1 -1
- package/dist/source-tracker.d.ts +4 -0
- package/dist/source-tracker.d.ts.map +1 -1
- package/dist/source-tracker.js +15 -8
- package/dist/source-tracker.js.map +1 -1
- package/dist/sync-service/index.d.ts.map +1 -1
- package/dist/sync-service/index.js +13 -8
- package/dist/sync-service/index.js.map +1 -1
- package/dist/util/logger.d.ts.map +1 -1
- package/dist/util/logger.js +16 -0
- package/dist/util/logger.js.map +1 -1
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +4 -2
- package/dist/util.js.map +1 -1
- package/package.json +10 -16
- package/dist/ai-service/agent/tools/apis/api-source.d.ts +0 -24
- package/dist/ai-service/agent/tools/apis/api-source.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/apis/api-source.js +0 -108
- package/dist/ai-service/agent/tools/apis/api-source.js.map +0 -1
- package/dist/ai-service/state-machine/helpers/file-read-tracker.d.ts +0 -7
- package/dist/ai-service/state-machine/helpers/file-read-tracker.d.ts.map +0 -1
- package/dist/ai-service/state-machine/helpers/file-read-tracker.js +0 -26
- package/dist/ai-service/state-machine/helpers/file-read-tracker.js.map +0 -1
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import fs from "fs/promises";
|
|
2
|
-
import
|
|
2
|
+
import nodePath from "node:path";
|
|
3
3
|
import * as t from "@babel/types";
|
|
4
4
|
import { PROCESSED_TRANSACTIONS_ATTRIBUTE, ROOT_WIDGET_ATTRIBUTE, SOURCE_ID_ATTRIBUTE, WIDGET_DISABLE_DND, } from "@superblocksteam/library-shared";
|
|
5
5
|
import { addTracingToMethods, TracedEventEmitter, } from "@superblocksteam/shared";
|
|
6
6
|
import { readAppApiYamlFile, writeApiFiles, } from "@superblocksteam/util";
|
|
7
7
|
import { glob } from "glob";
|
|
8
8
|
import { isEqual, debounce } from "lodash-es";
|
|
9
|
+
import { normalizePath } from "vite";
|
|
9
10
|
import yaml from "yaml";
|
|
10
|
-
import { Paths } from "./ai-service/const.js";
|
|
11
|
-
import { YamlToApiBuilderTransformer } from "./ai-service/transform/api-builder/to-sdk-transformer.js";
|
|
12
|
-
import { applyFileTransformations, renderPath, } from "./ai-service/transform/shared.js";
|
|
13
11
|
import { generateJSXAttribute } from "./codegen.js";
|
|
14
12
|
import { ComponentsManager } from "./components-manager.js";
|
|
15
13
|
import { addLegacyCustomComponentVariables, modifyLegacyCustomComponentElements, modifyLegacyCustomComponentImports, } from "./custom-components.js";
|
|
@@ -116,13 +114,13 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
116
114
|
if (!this.rootDir) {
|
|
117
115
|
throw new Error("Root directory not set");
|
|
118
116
|
}
|
|
119
|
-
return
|
|
117
|
+
return nodePath.join(this.rootDir, "App.tsx");
|
|
120
118
|
}
|
|
121
119
|
get rootScopeFilePath() {
|
|
122
120
|
if (!this.rootDir) {
|
|
123
121
|
throw new Error("Root directory not set");
|
|
124
122
|
}
|
|
125
|
-
return
|
|
123
|
+
return nodePath.join(this.rootDir, SCOPE_FILE);
|
|
126
124
|
}
|
|
127
125
|
// MARK: core setup/init
|
|
128
126
|
async watch(watcher, rootPath) {
|
|
@@ -130,7 +128,7 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
130
128
|
this.rootDir = rootPath;
|
|
131
129
|
this.watcher = watcher;
|
|
132
130
|
// APIs and pages are in the pages subfolder
|
|
133
|
-
const fileNames = await readFiles(
|
|
131
|
+
const fileNames = await readFiles(nodePath.join(rootPath));
|
|
134
132
|
// this reads all files excluding ignore list in the root path. Should we read all files in pages and add root.tsx and App.tsx instead?
|
|
135
133
|
const tsxFiles = fileNames.filter((f) => f.endsWith(".tsx") && !f.includes(`${getLegacyComponentsFolder()}/`));
|
|
136
134
|
const yamlFiles = fileNames.filter((f) => f.endsWith(".yaml"));
|
|
@@ -168,7 +166,7 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
168
166
|
// We only want to load the typescript files here, before the source tracker is initialized
|
|
169
167
|
// API setup needs to be deferred until we've parsed the scope files (which is done in the source tracker)
|
|
170
168
|
if (type === "tsx" || type === "ts") {
|
|
171
|
-
this.tsFiles[path] = content;
|
|
169
|
+
this.tsFiles[normalizePath(path)] = content;
|
|
172
170
|
}
|
|
173
171
|
});
|
|
174
172
|
try {
|
|
@@ -287,21 +285,22 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
287
285
|
if (!this.sourceTracker) {
|
|
288
286
|
throw new Error("Source tracker not initialized");
|
|
289
287
|
}
|
|
288
|
+
const normalizedPath = normalizePath(filePath);
|
|
290
289
|
const files = this.sourceTracker.getCurrentFiles();
|
|
291
|
-
if (!files[
|
|
292
|
-
throw new Error("File not found in source tracker " +
|
|
290
|
+
if (!files[normalizedPath]) {
|
|
291
|
+
throw new Error("File not found in source tracker " + normalizedPath);
|
|
293
292
|
}
|
|
294
|
-
let ast = files[
|
|
293
|
+
let ast = files[normalizedPath].ast;
|
|
295
294
|
if (!ast) {
|
|
296
|
-
throw new Error("No AST found for file in source tracker " +
|
|
295
|
+
throw new Error("No AST found for file in source tracker " + normalizedPath);
|
|
297
296
|
}
|
|
298
|
-
if (
|
|
299
|
-
this.tsFiles[
|
|
300
|
-
files[
|
|
297
|
+
if (normalizedPath in this.tsFiles &&
|
|
298
|
+
this.tsFiles[normalizedPath] &&
|
|
299
|
+
files[normalizedPath].code !== this.tsFiles[normalizedPath]) {
|
|
301
300
|
getLogger().error("File code mismatch in source tracker, this should never happen: " +
|
|
302
301
|
filePath);
|
|
303
|
-
await this.handleNonVisualChangeByDeletingIds(filePath, this.tsFiles[
|
|
304
|
-
const newAst = this.sourceTracker.getCurrentFiles()[
|
|
302
|
+
await this.handleNonVisualChangeByDeletingIds(filePath, this.tsFiles[normalizedPath]);
|
|
303
|
+
const newAst = this.sourceTracker.getCurrentFiles()[normalizedPath]?.ast;
|
|
305
304
|
if (!newAst) {
|
|
306
305
|
throw new Error("No AST found for file in source tracker after mismatch:" + filePath);
|
|
307
306
|
}
|
|
@@ -456,46 +455,49 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
456
455
|
return;
|
|
457
456
|
}
|
|
458
457
|
const fileType = SUPPORTED_FILETYPES.find((f) => filePath.endsWith(f.extension));
|
|
458
|
+
// Normalize both paths for comparison (Windows compatibility)
|
|
459
|
+
const normalizedFilePath = normalizePath(filePath);
|
|
460
|
+
const normalizedRootPath = normalizePath(rootPath);
|
|
459
461
|
// Only handle files we care about and that are in our root path
|
|
460
|
-
if (!fileType || !
|
|
462
|
+
if (!fileType || !normalizedFilePath.startsWith(normalizedRootPath)) {
|
|
461
463
|
return;
|
|
462
464
|
}
|
|
463
465
|
// Queue the operation based on the event type
|
|
464
466
|
switch (event) {
|
|
465
467
|
case "add": {
|
|
466
|
-
const file = await readFile(
|
|
468
|
+
const file = await readFile(normalizedFilePath);
|
|
467
469
|
if (typeof file !== "string")
|
|
468
470
|
return;
|
|
469
471
|
switch (fileType.type) {
|
|
470
472
|
case "api":
|
|
471
473
|
case "python-api-step":
|
|
472
474
|
case "js-api-step": {
|
|
473
|
-
await this.processApiFileUpdates(
|
|
475
|
+
await this.processApiFileUpdates(normalizedFilePath, fileType);
|
|
474
476
|
break;
|
|
475
477
|
}
|
|
476
478
|
case "ts":
|
|
477
479
|
case "tsx":
|
|
478
|
-
if (!(
|
|
479
|
-
this.tsFiles[
|
|
480
|
-
await this.handleNonVisualChangeByDeletingIds(
|
|
481
|
-
this.emit("fileChanged",
|
|
480
|
+
if (!(normalizedFilePath in this.tsFiles)) {
|
|
481
|
+
this.tsFiles[normalizedFilePath] = file;
|
|
482
|
+
await this.handleNonVisualChangeByDeletingIds(normalizedFilePath, file);
|
|
483
|
+
this.emit("fileChanged", normalizedFilePath, file, true);
|
|
482
484
|
return;
|
|
483
485
|
}
|
|
484
486
|
}
|
|
485
487
|
break;
|
|
486
488
|
}
|
|
487
489
|
case "change": {
|
|
488
|
-
const fileType = SUPPORTED_FILETYPES.find((f) =>
|
|
489
|
-
if (!fileType || !
|
|
490
|
+
const fileType = SUPPORTED_FILETYPES.find((f) => normalizedFilePath.endsWith(f.extension));
|
|
491
|
+
if (!fileType || !normalizedFilePath.startsWith(rootPath)) {
|
|
490
492
|
return;
|
|
491
493
|
}
|
|
492
|
-
const data = await readFile(
|
|
494
|
+
const data = await readFile(normalizedFilePath);
|
|
493
495
|
if (typeof data !== "string")
|
|
494
496
|
return;
|
|
495
497
|
// Handle router file changes
|
|
496
|
-
if (this.routerFilePath &&
|
|
498
|
+
if (this.routerFilePath && normalizedFilePath === this.routerFilePath) {
|
|
497
499
|
logger.info("Router file changed, emitting routerChange event");
|
|
498
|
-
this.emit("routerChange",
|
|
500
|
+
this.emit("routerChange", normalizedFilePath);
|
|
499
501
|
return;
|
|
500
502
|
}
|
|
501
503
|
switch (fileType.type) {
|
|
@@ -503,17 +505,18 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
503
505
|
case "tsx":
|
|
504
506
|
case "scope":
|
|
505
507
|
{
|
|
506
|
-
if (!(
|
|
507
|
-
|
|
508
|
-
|
|
508
|
+
if (!(normalizedFilePath in this.tsFiles &&
|
|
509
|
+
this.tsFiles[normalizedFilePath] === data)) {
|
|
510
|
+
logger.info(`File changed: ${normalizedFilePath} updating AST tracker`);
|
|
511
|
+
this.tsFiles[normalizedFilePath] = data;
|
|
509
512
|
// only update the source tracker if the file is different
|
|
510
|
-
await this.handleNonVisualChangeByDeletingIds(
|
|
511
|
-
this.emit("fileChanged",
|
|
513
|
+
await this.handleNonVisualChangeByDeletingIds(normalizedFilePath, data);
|
|
514
|
+
this.emit("fileChanged", normalizedFilePath, data, true);
|
|
512
515
|
}
|
|
513
516
|
else {
|
|
514
|
-
logger.info(`File unchanged from last tracked state: ${
|
|
515
|
-
this.emit("fileChanged",
|
|
516
|
-
this.sourceTracker?.updateFileContents(
|
|
517
|
+
logger.info(`File unchanged from last tracked state: ${normalizedFilePath}`);
|
|
518
|
+
this.emit("fileChanged", normalizedFilePath, data, false);
|
|
519
|
+
this.sourceTracker?.updateFileContents(normalizedFilePath, data);
|
|
517
520
|
}
|
|
518
521
|
}
|
|
519
522
|
break;
|
|
@@ -521,16 +524,17 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
521
524
|
case "python-api-step":
|
|
522
525
|
case "js-api-step":
|
|
523
526
|
{
|
|
524
|
-
await this.processApiFileUpdates(
|
|
527
|
+
await this.processApiFileUpdates(normalizedFilePath, fileType);
|
|
525
528
|
}
|
|
526
529
|
break;
|
|
527
530
|
}
|
|
528
531
|
break;
|
|
529
532
|
}
|
|
530
533
|
case "unlink": {
|
|
531
|
-
if (
|
|
532
|
-
await this.deleteTsFile(
|
|
533
|
-
if (this.routerFilePath &&
|
|
534
|
+
if (normalizedFilePath in this.tsFiles) {
|
|
535
|
+
await this.deleteTsFile(normalizedFilePath);
|
|
536
|
+
if (this.routerFilePath &&
|
|
537
|
+
normalizedFilePath === this.routerFilePath) {
|
|
534
538
|
logger.warn("Router file was deleted, attempting to find new router file");
|
|
535
539
|
try {
|
|
536
540
|
this.routerFilePath = await findRouterFile(rootPath);
|
|
@@ -544,18 +548,19 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
544
548
|
}
|
|
545
549
|
}
|
|
546
550
|
}
|
|
547
|
-
else if (
|
|
548
|
-
await this.removeApiData(
|
|
551
|
+
else if (normalizedFilePath in this.apiFiles) {
|
|
552
|
+
await this.removeApiData(normalizedFilePath);
|
|
549
553
|
}
|
|
550
554
|
break;
|
|
551
555
|
}
|
|
552
556
|
}
|
|
553
557
|
};
|
|
554
558
|
async deleteTsFile(filePath) {
|
|
555
|
-
|
|
556
|
-
this.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
+
const normalizedPath = normalizePath(filePath);
|
|
560
|
+
delete this.tsFiles[normalizedPath];
|
|
561
|
+
this.sourceTracker?.removeFile(normalizedPath);
|
|
562
|
+
if (isPageFilePath(normalizedPath)) {
|
|
563
|
+
this.emit("deletePage", normalizedPath);
|
|
559
564
|
}
|
|
560
565
|
}
|
|
561
566
|
getTsFilePaths() {
|
|
@@ -571,65 +576,14 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
571
576
|
setTemplateRenderer(templateRenderer) {
|
|
572
577
|
this.templateRenderer = templateRenderer;
|
|
573
578
|
}
|
|
574
|
-
/**
|
|
575
|
-
* Generate TypeScript source from YAML and write to scratch directory
|
|
576
|
-
* This is called when YAML changes (e.g., UI edits) to keep TS in sync.
|
|
577
|
-
*/
|
|
578
|
-
syncTsFromYaml = debounce((apiName) => {
|
|
579
|
-
return this.fsOperationQueue.enqueue(() => this._syncTsFromYaml(apiName));
|
|
580
|
-
}, 250, { leading: true, trailing: true, maxWait: 500 });
|
|
581
|
-
async _syncTsFromYaml(apiName) {
|
|
582
|
-
const logger = getLogger();
|
|
583
|
-
// Skip if we don't have templateRenderer
|
|
584
|
-
if (!this.templateRenderer || !this.rootDir) {
|
|
585
|
-
logger.warn(`Skipping YAML→TS sync for ${apiName}: templateRenderer or rootDir not available`);
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
logger.info(`Starting YAML→TS sync for: ${apiName}`);
|
|
589
|
-
try {
|
|
590
|
-
const yamlPath = renderPath(Paths.ApiYamls, { apiName });
|
|
591
|
-
logger.debug(`Syncing TS source from YAML for API: ${apiName}`);
|
|
592
|
-
// Create file artifact for transformation
|
|
593
|
-
const yamlArtifact = {
|
|
594
|
-
type: "file",
|
|
595
|
-
filePath: yamlPath,
|
|
596
|
-
content: "", // Transformer just needs the path
|
|
597
|
-
};
|
|
598
|
-
// Transform YAML to TS
|
|
599
|
-
const outputs = await applyFileTransformations([yamlArtifact], [
|
|
600
|
-
new YamlToApiBuilderTransformer({
|
|
601
|
-
appRootDirPath: this.rootDir,
|
|
602
|
-
entityNames: [], // Empty for now, could be enhanced later
|
|
603
|
-
skipCleanup: true,
|
|
604
|
-
templateRenderer: this.templateRenderer,
|
|
605
|
-
}),
|
|
606
|
-
]);
|
|
607
|
-
const tsArtifact = outputs[0];
|
|
608
|
-
if (!tsArtifact) {
|
|
609
|
-
logger.warn(`No TS artifact generated for ${apiName}`);
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
logger.debug(`Generated TS source for ${apiName}, writing to scratch`, tsArtifact.content);
|
|
613
|
-
// Write to scratch directory
|
|
614
|
-
const apiTsFilePath = `${renderPath(Paths.GeneratedApis, { apiName })}.ts`;
|
|
615
|
-
const scratchPath = renderPath(Paths.Scratch, { path: apiTsFilePath });
|
|
616
|
-
const fullPath = path.join(this.rootDir, scratchPath);
|
|
617
|
-
await fs.mkdir(path.dirname(fullPath), { recursive: true });
|
|
618
|
-
await fs.writeFile(fullPath, tsArtifact.content, { encoding: "utf-8" });
|
|
619
|
-
logger.info(`✓ Synced TS source to scratch for ${apiName}`);
|
|
620
|
-
}
|
|
621
|
-
catch (error) {
|
|
622
|
-
logger.error(`Failed to sync TS from YAML for ${apiName}`, getErrorMeta(error));
|
|
623
|
-
// Don't throw - sync failure shouldn't break the API update
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
579
|
// MARK: fs read/write
|
|
627
580
|
async writeFile(path, content, kind) {
|
|
628
581
|
getLogger().info(`Writing file: ${path}, kind: ${kind ?? "other"}`);
|
|
629
582
|
switch (kind) {
|
|
630
583
|
case "ts": {
|
|
631
584
|
// happens eagerly regardless of error - possible desync
|
|
632
|
-
|
|
585
|
+
const normalizedPath = normalizePath(path);
|
|
586
|
+
this.tsFiles[normalizedPath] = content;
|
|
633
587
|
// TODO(george): as an optimization, we could update the memory snapshot of the file that SyncService is holding
|
|
634
588
|
await this.fsOperationQueue.enqueue(async () => {
|
|
635
589
|
const dir = path.substring(0, path.lastIndexOf("/"));
|
|
@@ -641,7 +595,8 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
641
595
|
break;
|
|
642
596
|
}
|
|
643
597
|
case "api": {
|
|
644
|
-
const
|
|
598
|
+
const normalizedPath = normalizePath(path);
|
|
599
|
+
const currentApiFile = this.apiFiles[normalizedPath];
|
|
645
600
|
const apiPb = yaml.parse(content);
|
|
646
601
|
// We don't need ID, organization, or trigger data in code-mode APIs
|
|
647
602
|
if (apiPb.metadata) {
|
|
@@ -655,14 +610,15 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
655
610
|
const scopeId = getScopeIdFromName("App");
|
|
656
611
|
// Update in-memory state before writing to disk (similar to TS files)
|
|
657
612
|
// This allows the file watcher to detect no change and skip duplicate events
|
|
658
|
-
this.apiFiles[
|
|
613
|
+
this.apiFiles[normalizedPath] = {
|
|
659
614
|
apiPb: yaml.parse(JSON.stringify(apiPb)),
|
|
660
615
|
stepPathMap,
|
|
661
616
|
scopeId,
|
|
662
617
|
};
|
|
663
618
|
// TODO(george): as an optimization, we could update the memory snapshot of the file that SyncService is holding
|
|
619
|
+
const apiDir = nodePath.dirname(path);
|
|
664
620
|
await this.fsOperationQueue.enqueue(async () => {
|
|
665
|
-
await writeApiFiles({ apiPb }, "api",
|
|
621
|
+
await writeApiFiles({ apiPb }, "api", apiDir, false, [], [], { extractLargeSourceFiles: true, minLinesForExtraction: 1 }, new Set(Object.keys(this.apiFiles)), stepPathMap);
|
|
666
622
|
});
|
|
667
623
|
break;
|
|
668
624
|
}
|
|
@@ -679,7 +635,7 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
679
635
|
}
|
|
680
636
|
}
|
|
681
637
|
readFile(path) {
|
|
682
|
-
return this.tsFiles[path];
|
|
638
|
+
return this.tsFiles[normalizePath(path)];
|
|
683
639
|
}
|
|
684
640
|
async setFileContents(path, contents) {
|
|
685
641
|
const logger = getLogger();
|
|
@@ -704,14 +660,15 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
704
660
|
}
|
|
705
661
|
getLocalBindingEntities(path) {
|
|
706
662
|
const logger = getLogger();
|
|
663
|
+
const normalizedPath = normalizePath(path);
|
|
707
664
|
const files = this.sourceTracker?.getCurrentFiles();
|
|
708
|
-
if (!files || !files[
|
|
709
|
-
logger.warn(`File not found in source tracker for local binding entities: ${
|
|
665
|
+
if (!files || !files[normalizedPath]) {
|
|
666
|
+
logger.warn(`File not found in source tracker for local binding entities: ${normalizedPath}`);
|
|
710
667
|
return [];
|
|
711
668
|
}
|
|
712
|
-
const ast = files[
|
|
669
|
+
const ast = files[normalizedPath].ast;
|
|
713
670
|
if (!ast) {
|
|
714
|
-
logger.warn(`No AST found for file in source tracker for local binding entities: ${
|
|
671
|
+
logger.warn(`No AST found for file in source tracker for local binding entities: ${normalizedPath}`);
|
|
715
672
|
return [];
|
|
716
673
|
}
|
|
717
674
|
const localBindingEntities = new Set();
|
|
@@ -730,7 +687,7 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
730
687
|
return Array.from(localBindingEntities);
|
|
731
688
|
}
|
|
732
689
|
getPageRootNodes(filePath) {
|
|
733
|
-
const scopeFilePath =
|
|
690
|
+
const scopeFilePath = normalizePath(nodePath.join(nodePath.dirname(filePath), "index.tsx"));
|
|
734
691
|
return this.getRootNodesForFile(scopeFilePath);
|
|
735
692
|
}
|
|
736
693
|
getAppRootNodes() {
|
|
@@ -750,8 +707,8 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
750
707
|
let resolvedPath = await getFullImportPath(localPath);
|
|
751
708
|
// Fallback: manually resolve relative paths if Vite resolver fails
|
|
752
709
|
if (!resolvedPath && localPath.startsWith(".")) {
|
|
753
|
-
const currentDir =
|
|
754
|
-
const potentialPath =
|
|
710
|
+
const currentDir = nodePath.dirname(filePath);
|
|
711
|
+
const potentialPath = nodePath.resolve(currentDir, localPath);
|
|
755
712
|
// Try with different extensions
|
|
756
713
|
const extensions = [
|
|
757
714
|
"/index.tsx",
|
|
@@ -781,22 +738,24 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
781
738
|
return importedFiles;
|
|
782
739
|
}
|
|
783
740
|
async getRootNodesForFile(filePath) {
|
|
784
|
-
const
|
|
741
|
+
const normalizedPath = normalizePath(filePath);
|
|
742
|
+
const currentFile = this.sourceTracker?.getCurrentFiles()[normalizedPath];
|
|
785
743
|
if (!currentFile) {
|
|
786
744
|
return undefined;
|
|
787
745
|
}
|
|
788
746
|
const allFiles = this.sourceTracker?.getCurrentFiles() ?? {};
|
|
789
747
|
// Collect all imported files recursively (including transitive imports)
|
|
790
|
-
const importedNamesToFiles = await this.collectAllImports(
|
|
748
|
+
const importedNamesToFiles = await this.collectAllImports(normalizedPath, allFiles);
|
|
791
749
|
// Get roots from imported files (custom components)
|
|
792
750
|
const importedRoots = Object.entries(importedNamesToFiles).flatMap(([filePath, file]) => getRootNodes(filePath, file));
|
|
793
751
|
// Get roots from the current file
|
|
794
|
-
const roots = getRootNodes(
|
|
752
|
+
const roots = getRootNodes(normalizedPath, currentFile);
|
|
795
753
|
return [...roots, ...importedRoots];
|
|
796
754
|
}
|
|
797
755
|
getScope(filePath, fallback) {
|
|
798
756
|
// Since we no longer use scope.ts files, generate scope info from file path. Pages retain page scope, everything else is App.
|
|
799
|
-
const
|
|
757
|
+
const normalizedPath = normalizePath(filePath);
|
|
758
|
+
const scopeName = getScopeNameFromPath(normalizedPath);
|
|
800
759
|
if (!scopeName) {
|
|
801
760
|
if (fallback) {
|
|
802
761
|
return {
|
|
@@ -972,8 +931,8 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
972
931
|
if (!this.rootDir) {
|
|
973
932
|
throw new Error("Root directory not set");
|
|
974
933
|
}
|
|
975
|
-
// no leading slash
|
|
976
|
-
return
|
|
934
|
+
// no leading slash, normalize to forward slashes for routes (Windows compatibility)
|
|
935
|
+
return normalizePath(nodePath.relative(nodePath.join(this.rootDir, PAGES_DIRECTORY), filePath));
|
|
977
936
|
}
|
|
978
937
|
// MARK: API operations
|
|
979
938
|
handleUpdateApi = async (payload) => {
|
|
@@ -990,7 +949,8 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
990
949
|
throw new Error("Root directory not set");
|
|
991
950
|
}
|
|
992
951
|
const apiFilePath = getApiFilePath(this.rootDir, apiName);
|
|
993
|
-
const
|
|
952
|
+
const normalizedApiFilePath = normalizePath(apiFilePath);
|
|
953
|
+
const apiDir = nodePath.dirname(normalizedApiFilePath);
|
|
994
954
|
try {
|
|
995
955
|
const stats = await fs.stat(apiDir);
|
|
996
956
|
if (!stats.isDirectory()) {
|
|
@@ -1017,11 +977,12 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
1017
977
|
const deletedApis = [];
|
|
1018
978
|
for (const { apiName } of apis) {
|
|
1019
979
|
const apiFilePath = getApiFilePath(rootDir, apiName);
|
|
1020
|
-
const
|
|
980
|
+
const normalizedApiFilePath = normalizePath(apiFilePath);
|
|
981
|
+
const api = this.apiFiles[normalizedApiFilePath];
|
|
1021
982
|
if (!api || !this.sourceTracker) {
|
|
1022
983
|
continue;
|
|
1023
984
|
}
|
|
1024
|
-
const apiDir =
|
|
985
|
+
const apiDir = nodePath.dirname(apiFilePath);
|
|
1025
986
|
try {
|
|
1026
987
|
await this.fsOperationQueue.enqueue(async () => {
|
|
1027
988
|
const stats = await fs.stat(apiDir);
|
|
@@ -1029,7 +990,7 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
1029
990
|
await fs.rmdir(apiDir, { recursive: true });
|
|
1030
991
|
}
|
|
1031
992
|
});
|
|
1032
|
-
delete this.apiFiles[
|
|
993
|
+
delete this.apiFiles[normalizedApiFilePath];
|
|
1033
994
|
const scopeId = this.sourceTracker.deleteApi({
|
|
1034
995
|
apiName,
|
|
1035
996
|
});
|
|
@@ -1054,15 +1015,16 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
1054
1015
|
if (!this.rootDir) {
|
|
1055
1016
|
throw new Error("Root directory not set");
|
|
1056
1017
|
}
|
|
1057
|
-
const existingApiFolder =
|
|
1058
|
-
const newApiFolder =
|
|
1059
|
-
const apiFilePath =
|
|
1060
|
-
const
|
|
1018
|
+
const existingApiFolder = nodePath.join(this.rootDir, "apis", oldName);
|
|
1019
|
+
const newApiFolder = nodePath.join(this.rootDir, "apis", newName);
|
|
1020
|
+
const apiFilePath = nodePath.join(existingApiFolder, "api.yaml");
|
|
1021
|
+
const normalizedApiFilePath = normalizePath(apiFilePath);
|
|
1022
|
+
const apiDef = this.apiFiles[normalizedApiFilePath];
|
|
1061
1023
|
if (!apiDef) {
|
|
1062
1024
|
throw new Error(`API ${oldName} not found`);
|
|
1063
1025
|
}
|
|
1064
1026
|
const otherAPIs = structuredClone(Object.keys(this.apiFiles)
|
|
1065
|
-
.filter((path) => path !==
|
|
1027
|
+
.filter((path) => path !== normalizedApiFilePath)
|
|
1066
1028
|
.map((path) => ({
|
|
1067
1029
|
api: { apiPb: this.apiFiles[path]?.apiPb },
|
|
1068
1030
|
filePath: path,
|
|
@@ -1077,9 +1039,9 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
1077
1039
|
apiDef.apiPb.metadata.name = newName;
|
|
1078
1040
|
await fs.rename(existingApiFolder, newApiFolder);
|
|
1079
1041
|
const scopeId = getScopeIdFromName("App");
|
|
1080
|
-
delete this.apiFiles[
|
|
1042
|
+
delete this.apiFiles[normalizedApiFilePath];
|
|
1081
1043
|
// not waiting because we are queueing the write further down
|
|
1082
|
-
void this.writeFile(
|
|
1044
|
+
void this.writeFile(nodePath.join(newApiFolder, "api.yaml"), yaml.stringify(apiDef.apiPb), "api");
|
|
1083
1045
|
this.watcher?.add(existingApiFolder);
|
|
1084
1046
|
this.watcher?.add(newApiFolder);
|
|
1085
1047
|
const changes = (await this.sourceTracker?.getAndFlushChanges()) ?? [];
|
|
@@ -1107,11 +1069,12 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
1107
1069
|
}));
|
|
1108
1070
|
};
|
|
1109
1071
|
async removeApiData(filePath) {
|
|
1110
|
-
const
|
|
1072
|
+
const normalizedPath = normalizePath(filePath);
|
|
1073
|
+
const api = this.apiFiles[normalizedPath];
|
|
1111
1074
|
if (!api) {
|
|
1112
1075
|
return;
|
|
1113
1076
|
}
|
|
1114
|
-
delete this.apiFiles[
|
|
1077
|
+
delete this.apiFiles[normalizedPath];
|
|
1115
1078
|
this.sourceTracker?.deleteApi({
|
|
1116
1079
|
apiName: api.apiPb.metadata.name,
|
|
1117
1080
|
});
|
|
@@ -1170,9 +1133,10 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
1170
1133
|
let yamlPath = filePath;
|
|
1171
1134
|
if (fileType.type === "python-api-step" ||
|
|
1172
1135
|
fileType.type === "js-api-step") {
|
|
1173
|
-
const apiFolderPath =
|
|
1174
|
-
yamlPath =
|
|
1136
|
+
const apiFolderPath = nodePath.dirname(filePath);
|
|
1137
|
+
yamlPath = nodePath.join(apiFolderPath, "api.yaml");
|
|
1175
1138
|
}
|
|
1139
|
+
const normalizedYamlPath = normalizePath(yamlPath);
|
|
1176
1140
|
const logger = getLogger();
|
|
1177
1141
|
logger.info(`Processing API file update: ${yamlPath}`);
|
|
1178
1142
|
try {
|
|
@@ -1183,9 +1147,9 @@ export class FileSystemManager extends TracedEventEmitter {
|
|
|
1183
1147
|
}
|
|
1184
1148
|
logger.info(`API structure is valid: ${yamlPath}`);
|
|
1185
1149
|
const parsedData = { apiPb: apiContent?.api };
|
|
1186
|
-
if (
|
|
1187
|
-
isEqual(this.apiFiles[
|
|
1188
|
-
logger.info(`No changes detected in API: ${
|
|
1150
|
+
if (normalizedYamlPath in this.apiFiles &&
|
|
1151
|
+
isEqual(this.apiFiles[normalizedYamlPath]?.apiPb, parsedData.apiPb)) {
|
|
1152
|
+
logger.info(`No changes detected in API: ${normalizedYamlPath}`);
|
|
1189
1153
|
return;
|
|
1190
1154
|
}
|
|
1191
1155
|
const { updatedApi, isNewApi } = this.updateInternalApiData({
|
|
@@ -1251,28 +1215,35 @@ export class MockFileSyncManager extends FileSystemManager {
|
|
|
1251
1215
|
}
|
|
1252
1216
|
async writeFile(path, content, kind) {
|
|
1253
1217
|
await this.fsOperationQueue.enqueue(async () => {
|
|
1218
|
+
const normalizedPath = normalizePath(path);
|
|
1254
1219
|
if (kind === "ts") {
|
|
1255
|
-
this.tsFiles[
|
|
1220
|
+
this.tsFiles[normalizedPath] = content;
|
|
1256
1221
|
}
|
|
1257
1222
|
else {
|
|
1258
|
-
this.apiFiles[
|
|
1223
|
+
this.apiFiles[normalizedPath] = {
|
|
1259
1224
|
apiPb: yaml.parse(content),
|
|
1260
1225
|
stepPathMap: {},
|
|
1261
1226
|
scopeId: getScopeIdFromName("App"),
|
|
1262
1227
|
};
|
|
1263
1228
|
}
|
|
1264
1229
|
// Notify subscribers
|
|
1265
|
-
this.emit("fileChanged",
|
|
1230
|
+
this.emit("fileChanged", normalizedPath, content, true);
|
|
1266
1231
|
});
|
|
1267
1232
|
}
|
|
1268
1233
|
// Helper methods for testing
|
|
1269
1234
|
mockFileChange(path, content) {
|
|
1270
|
-
|
|
1271
|
-
this.
|
|
1235
|
+
const normalizedPath = normalizePath(path);
|
|
1236
|
+
this.tsFiles[normalizedPath] = content;
|
|
1237
|
+
this.emit("fileChanged", normalizedPath, content, true);
|
|
1272
1238
|
}
|
|
1273
1239
|
handleUpdateApi = async (payload) => {
|
|
1274
1240
|
const apiName = payload.api.apiPb.metadata.name;
|
|
1275
|
-
this.
|
|
1241
|
+
if (!this.rootDir) {
|
|
1242
|
+
throw new Error("Root directory not set");
|
|
1243
|
+
}
|
|
1244
|
+
const apiFilePath = getApiFilePath(this.rootDir, apiName);
|
|
1245
|
+
const normalizedApiFilePath = normalizePath(apiFilePath);
|
|
1246
|
+
this.apiFiles[normalizedApiFilePath] = {
|
|
1276
1247
|
...payload.api,
|
|
1277
1248
|
stepPathMap: {},
|
|
1278
1249
|
scopeId: payload.scopeId,
|
|
@@ -1303,7 +1274,9 @@ async function readFile(path) {
|
|
|
1303
1274
|
}
|
|
1304
1275
|
}
|
|
1305
1276
|
async function readFiles(dir) {
|
|
1306
|
-
|
|
1277
|
+
const files = await glob("**/*.{tsx,yaml,ts}", {
|
|
1278
|
+
cwd: dir,
|
|
1279
|
+
absolute: true,
|
|
1307
1280
|
ignore: [
|
|
1308
1281
|
"node_modules/**",
|
|
1309
1282
|
"dist/**",
|
|
@@ -1312,8 +1285,10 @@ async function readFiles(dir) {
|
|
|
1312
1285
|
`./${getLegacyComponentsFolder()}/**`,
|
|
1313
1286
|
],
|
|
1314
1287
|
});
|
|
1288
|
+
// Normalize paths to use forward slashes on all platforms (Windows returns backslashes)
|
|
1289
|
+
return files.map((file) => normalizePath(file));
|
|
1315
1290
|
}
|
|
1316
|
-
const getMergedApiContent = async (
|
|
1317
|
-
return readAppApiYamlFile(
|
|
1291
|
+
const getMergedApiContent = async (filePath) => {
|
|
1292
|
+
return readAppApiYamlFile(nodePath.dirname(filePath));
|
|
1318
1293
|
};
|
|
1319
1294
|
//# sourceMappingURL=file-system-manager.js.map
|