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