genaicode 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -10
- package/dist/ai-service/anthropic.js +7 -2
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/chat-gpt.d.ts +2 -0
- package/dist/ai-service/chat-gpt.js +7 -4
- package/dist/ai-service/chat-gpt.js.map +1 -1
- package/dist/ai-service/common.test.js +2 -1
- package/dist/ai-service/common.test.js.map +1 -1
- package/dist/ai-service/dall-e.js +1 -0
- package/dist/ai-service/dall-e.js.map +1 -1
- package/dist/ai-service/vertex-ai-claude.js +1 -0
- package/dist/ai-service/vertex-ai-claude.js.map +1 -1
- package/dist/cli/cli-options.js +10 -22
- package/dist/cli/cli-options.js.map +1 -1
- package/dist/cli/cli-params.d.ts +1 -5
- package/dist/cli/cli-params.js +10 -29
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.js +16 -11
- package/dist/cli/validate-cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.test.js +2 -2
- package/dist/cli/validate-cli-params.test.js.map +1 -1
- package/dist/examples/genaicode_plugins/fake_ai_service.d.ts +3 -0
- package/dist/examples/genaicode_plugins/fake_ai_service.js +11 -0
- package/dist/examples/genaicode_plugins/fake_ai_service.js.map +1 -0
- package/dist/examples/genaicode_plugins/grok_ai_service.d.ts +3 -0
- package/dist/examples/genaicode_plugins/grok_ai_service.js +153 -0
- package/dist/examples/genaicode_plugins/grok_ai_service.js.map +1 -0
- package/dist/examples/genaicode_plugins/nonsense_operation.d.ts +3 -0
- package/dist/examples/genaicode_plugins/nonsense_operation.js +23 -0
- package/dist/examples/genaicode_plugins/nonsense_operation.js.map +1 -0
- package/dist/files/path-utils.d.ts +1 -0
- package/dist/files/path-utils.js +12 -0
- package/dist/files/path-utils.js.map +1 -0
- package/dist/files/update-files.d.ts +1 -1
- package/dist/files/update-files.js +8 -183
- package/dist/files/update-files.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/main/codegen-types.d.ts +29 -1
- package/dist/main/codegen-utils.d.ts +3 -0
- package/dist/main/codegen-utils.js +18 -0
- package/dist/main/codegen-utils.js.map +1 -0
- package/dist/main/codegen.js +14 -25
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/codegen.test.js +12 -15
- package/dist/main/codegen.test.js.map +1 -1
- package/dist/main/common/user-actions.d.ts +14 -2
- package/dist/main/common/user-actions.js +16 -1
- package/dist/main/common/user-actions.js.map +1 -1
- package/dist/main/config-lib.d.ts +1 -0
- package/dist/main/config-lib.js +7 -0
- package/dist/main/config-lib.js.map +1 -1
- package/dist/main/config.js +3 -0
- package/dist/main/config.js.map +1 -1
- package/dist/main/interactive/user-action-handlers.js +2 -2
- package/dist/main/interactive/user-action-handlers.js.map +1 -1
- package/dist/main/plugin-loader.d.ts +9 -0
- package/dist/main/plugin-loader.js +55 -0
- package/dist/main/plugin-loader.js.map +1 -0
- package/dist/main/ui/backend/api-utils.js +2 -2
- package/dist/main/ui/backend/api-utils.js.map +1 -1
- package/dist/main/ui/backend/api.js +15 -3
- package/dist/main/ui/backend/api.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +6 -11
- package/dist/main/ui/backend/service.js +11 -7
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/common/api-types.d.ts +20 -0
- package/dist/main/ui/common/api-types.js +2 -0
- package/dist/main/ui/common/api-types.js.map +1 -0
- package/dist/main/ui/frontend/assets/{index-Dicb_1yw.js → index-Dk_qaEQg.js} +75 -72
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/main/ui/user-action-handlers.js +9 -4
- package/dist/main/ui/user-action-handlers.js.map +1 -1
- package/dist/operations/create-directory/create-directory-def.d.ts +9 -0
- package/dist/operations/create-directory/create-directory-def.js +22 -0
- package/dist/operations/create-directory/create-directory-def.js.map +1 -0
- package/dist/operations/create-directory/create-directory-executor.d.ts +6 -0
- package/dist/operations/create-directory/create-directory-executor.js +22 -0
- package/dist/operations/create-directory/create-directory-executor.js.map +1 -0
- package/dist/operations/create-file/create-file-def.d.ts +10 -0
- package/dist/operations/create-file/create-file-def.js +26 -0
- package/dist/operations/create-file/create-file-def.js.map +1 -0
- package/dist/operations/create-file/create-file-executor.d.ts +6 -0
- package/dist/operations/create-file/create-file-executor.js +27 -0
- package/dist/operations/create-file/create-file-executor.js.map +1 -0
- package/dist/operations/delete-file/delete-file-def.d.ts +9 -0
- package/dist/operations/delete-file/delete-file-def.js +22 -0
- package/dist/operations/delete-file/delete-file-def.js.map +1 -0
- package/dist/operations/delete-file/delete-file-executor.d.ts +6 -0
- package/dist/operations/delete-file/delete-file-executor.js +23 -0
- package/dist/operations/delete-file/delete-file-executor.js.map +1 -0
- package/dist/operations/download-file/download-file-def.d.ts +10 -0
- package/dist/operations/download-file/download-file-def.js +26 -0
- package/dist/operations/download-file/download-file-def.js.map +1 -0
- package/dist/operations/download-file/download-file-executor.d.ts +6 -0
- package/dist/operations/download-file/download-file-executor.js +44 -0
- package/dist/operations/download-file/download-file-executor.js.map +1 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.d.ts +10 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.js +26 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.js.map +1 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-executor.d.ts +6 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-executor.js +40 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-executor.js.map +1 -0
- package/dist/operations/move-file/move-file-def.d.ts +10 -0
- package/dist/operations/move-file/move-file-def.js +26 -0
- package/dist/operations/move-file/move-file-def.js.map +1 -0
- package/dist/operations/move-file/move-file-executor.d.ts +6 -0
- package/dist/operations/move-file/move-file-executor.js +29 -0
- package/dist/operations/move-file/move-file-executor.js.map +1 -0
- package/dist/operations/operations-index.d.ts +3 -0
- package/dist/operations/operations-index.js +33 -0
- package/dist/operations/operations-index.js.map +1 -0
- package/dist/operations/patch-file/patch-file-def.d.ts +10 -0
- package/dist/operations/patch-file/patch-file-def.js +39 -0
- package/dist/operations/patch-file/patch-file-def.js.map +1 -0
- package/dist/operations/patch-file/patch-file-executor.d.ts +5 -0
- package/dist/operations/patch-file/patch-file-executor.js +26 -0
- package/dist/operations/patch-file/patch-file-executor.js.map +1 -0
- package/dist/operations/resize-image/resize-image-def.d.ts +13 -0
- package/dist/operations/resize-image/resize-image-def.js +37 -0
- package/dist/operations/resize-image/resize-image-def.js.map +1 -0
- package/dist/operations/resize-image/resize-image-executor.d.ts +5 -0
- package/dist/operations/resize-image/resize-image-executor.js +30 -0
- package/dist/operations/resize-image/resize-image-executor.js.map +1 -0
- package/dist/operations/split-image/split-image-def.d.ts +18 -0
- package/dist/operations/split-image/split-image-def.js +46 -0
- package/dist/operations/split-image/split-image-def.js.map +1 -0
- package/dist/operations/split-image/split-image-executor.d.ts +6 -0
- package/dist/operations/split-image/split-image-executor.js +51 -0
- package/dist/operations/split-image/split-image-executor.js.map +1 -0
- package/dist/operations/update-file/update-file-def.d.ts +10 -0
- package/dist/operations/update-file/update-file-def.js +26 -0
- package/dist/operations/update-file/update-file-def.js.map +1 -0
- package/dist/operations/update-file/update-file-executor.d.ts +5 -0
- package/dist/operations/update-file/update-file-executor.js +22 -0
- package/dist/operations/update-file/update-file-executor.js.map +1 -0
- package/dist/prompt/ai-service-fallback.js.map +1 -1
- package/dist/prompt/function-calling-validate.js +2 -2
- package/dist/prompt/function-calling-validate.js.map +1 -1
- package/dist/prompt/function-calling.d.ts +1 -1
- package/dist/prompt/function-calling.js +29 -44
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question-reflect.d.ts +2 -20
- package/dist/prompt/function-defs/ask-question-reflect.js.map +1 -1
- package/dist/prompt/function-defs/ask-question.d.ts +2 -73
- package/dist/prompt/function-defs/ask-question.js +28 -14
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/codegen-summary.d.ts +2 -62
- package/dist/prompt/function-defs/codegen-summary.js +4 -2
- package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
- package/dist/prompt/function-defs/explanation.d.ts +2 -14
- package/dist/prompt/function-defs/explanation.js.map +1 -1
- package/dist/prompt/function-defs/generate-image.d.ts +2 -38
- package/dist/prompt/function-defs/generate-image.js.map +1 -1
- package/dist/prompt/function-defs/get-image-assets.d.ts +2 -17
- package/dist/prompt/function-defs/get-image-assets.js.map +1 -1
- package/dist/prompt/function-defs/get-source-code.d.ts +2 -17
- package/dist/prompt/function-defs/get-source-code.js.map +1 -1
- package/dist/prompt/function-defs/optimize-context.d.ts +2 -43
- package/dist/prompt/function-defs/optimize-context.js.map +1 -1
- package/dist/prompt/function-defs/read-history.d.ts +2 -13
- package/dist/prompt/function-defs/read-history.js.map +1 -1
- package/dist/prompt/function-defs/set-summaries.d.ts +2 -28
- package/dist/prompt/function-defs/set-summaries.js.map +1 -1
- package/dist/prompt/function-defs/update-history.d.ts +2 -18
- package/dist/prompt/function-defs/update-history.js.map +1 -1
- package/dist/prompt/prompt-service.js +6 -6
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/prompt-service.test.js +16 -19
- package/dist/prompt/prompt-service.test.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +16 -0
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +37 -0
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +36 -0
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/default-action.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js +18 -0
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.js +20 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +43 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +49 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js +46 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js +16 -0
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.d.ts +0 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js +2 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.d.ts +4 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js +91 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +56 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.js +2 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +6 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +95 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -0
- package/dist/prompt/steps/step-context-optimization.js +9 -2
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-generate-summary.js +2 -2
- package/dist/prompt/steps/step-generate-summary.js.map +1 -1
- package/dist/prompt/steps/step-history-update.js +2 -2
- package/dist/prompt/steps/step-history-update.js.map +1 -1
- package/dist/prompt/steps/step-summarization.js +2 -2
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/src/ai-service/ai-studio.d.ts +6 -0
- package/dist/src/ai-service/ai-studio.js +190 -0
- package/dist/src/ai-service/ai-studio.js.map +1 -0
- package/dist/src/ai-service/anthropic.d.ts +6 -0
- package/dist/src/ai-service/anthropic.js +150 -0
- package/dist/src/ai-service/anthropic.js.map +1 -0
- package/dist/src/ai-service/chat-gpt.d.ts +5 -0
- package/dist/src/ai-service/chat-gpt.js +146 -0
- package/dist/src/ai-service/chat-gpt.js.map +1 -0
- package/dist/src/ai-service/common.d.ts +69 -0
- package/dist/src/ai-service/common.js +38 -0
- package/dist/src/ai-service/common.js.map +1 -0
- package/dist/src/ai-service/common.test.d.ts +1 -0
- package/dist/src/ai-service/common.test.js +86 -0
- package/dist/src/ai-service/common.test.js.map +1 -0
- package/dist/src/ai-service/dall-e.d.ts +14 -0
- package/dist/src/ai-service/dall-e.js +50 -0
- package/dist/src/ai-service/dall-e.js.map +1 -0
- package/dist/src/ai-service/unescape-function-call.d.ts +7 -0
- package/dist/src/ai-service/unescape-function-call.js +59 -0
- package/dist/src/ai-service/unescape-function-call.js.map +1 -0
- package/dist/src/ai-service/unescape-function-call.test.d.ts +1 -0
- package/dist/src/ai-service/unescape-function-call.test.js +18 -0
- package/dist/src/ai-service/unescape-function-call.test.js.map +1 -0
- package/dist/src/ai-service/vertex-ai-claude.d.ts +5 -0
- package/dist/src/ai-service/vertex-ai-claude.js +104 -0
- package/dist/src/ai-service/vertex-ai-claude.js.map +1 -0
- package/dist/src/ai-service/vertex-ai-imagen.d.ts +14 -0
- package/dist/src/ai-service/vertex-ai-imagen.js +77 -0
- package/dist/src/ai-service/vertex-ai-imagen.js.map +1 -0
- package/dist/src/ai-service/vertex-ai.d.ts +6 -0
- package/dist/src/ai-service/vertex-ai.js +202 -0
- package/dist/src/ai-service/vertex-ai.js.map +1 -0
- package/dist/src/cli/cli-options.d.ts +10 -0
- package/dist/src/cli/cli-options.js +132 -0
- package/dist/src/cli/cli-options.js.map +1 -0
- package/dist/src/cli/cli-options.test.d.ts +1 -0
- package/dist/src/cli/cli-options.test.js +34 -0
- package/dist/src/cli/cli-options.test.js.map +1 -0
- package/dist/src/cli/cli-params.d.ts +32 -0
- package/dist/src/cli/cli-params.js +106 -0
- package/dist/src/cli/cli-params.js.map +1 -0
- package/dist/src/cli/cli-params.test.d.ts +1 -0
- package/dist/src/cli/cli-params.test.js +38 -0
- package/dist/src/cli/cli-params.test.js.map +1 -0
- package/dist/src/cli/service-autodetect.d.ts +2 -0
- package/dist/src/cli/service-autodetect.js +17 -0
- package/dist/src/cli/service-autodetect.js.map +1 -0
- package/dist/src/cli/service-autodetect.test.d.ts +1 -0
- package/dist/src/cli/service-autodetect.test.js +38 -0
- package/dist/src/cli/service-autodetect.test.js.map +1 -0
- package/dist/src/cli/validate-cli-params.d.ts +18 -0
- package/dist/src/cli/validate-cli-params.js +145 -0
- package/dist/src/cli/validate-cli-params.js.map +1 -0
- package/dist/src/cli/validate-cli-params.test.d.ts +1 -0
- package/dist/src/cli/validate-cli-params.test.js +106 -0
- package/dist/src/cli/validate-cli-params.test.js.map +1 -0
- package/dist/src/files/cache-file.d.ts +3 -0
- package/dist/src/files/cache-file.js +36 -0
- package/dist/src/files/cache-file.js.map +1 -0
- package/dist/src/files/file-utils.d.ts +2 -0
- package/dist/src/files/file-utils.js +7 -0
- package/dist/src/files/file-utils.js.map +1 -0
- package/dist/src/files/file-utils.test.d.ts +1 -0
- package/dist/src/files/file-utils.test.js +18 -0
- package/dist/src/files/file-utils.test.js.map +1 -0
- package/dist/src/files/find-files.d.ts +9 -0
- package/dist/src/files/find-files.js +81 -0
- package/dist/src/files/find-files.js.map +1 -0
- package/dist/src/files/path-utils.d.ts +1 -0
- package/dist/src/files/path-utils.js +12 -0
- package/dist/src/files/path-utils.js.map +1 -0
- package/dist/src/files/read-files.d.ts +21 -0
- package/dist/src/files/read-files.js +68 -0
- package/dist/src/files/read-files.js.map +1 -0
- package/dist/src/files/read-files.test.d.ts +1 -0
- package/dist/src/files/read-files.test.js +89 -0
- package/dist/src/files/read-files.test.js.map +1 -0
- package/dist/src/files/temp-buffer.d.ts +2 -0
- package/dist/src/files/temp-buffer.js +12 -0
- package/dist/src/files/temp-buffer.js.map +1 -0
- package/dist/src/files/update-files.d.ts +6 -0
- package/dist/src/files/update-files.js +19 -0
- package/dist/src/files/update-files.js.map +1 -0
- package/dist/src/images/ensure-alpha.d.ts +1 -0
- package/dist/src/images/ensure-alpha.js +5 -0
- package/dist/src/images/ensure-alpha.js.map +1 -0
- package/dist/src/images/imgly-remove-background.d.ts +2 -0
- package/dist/src/images/imgly-remove-background.js +21 -0
- package/dist/src/images/imgly-remove-background.js.map +1 -0
- package/dist/src/images/resize-image.d.ts +19 -0
- package/dist/src/images/resize-image.js +22 -0
- package/dist/src/images/resize-image.js.map +1 -0
- package/dist/src/images/split-image.d.ts +18 -0
- package/dist/src/images/split-image.js +25 -0
- package/dist/src/images/split-image.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/main/codegen-types.d.ts +58 -0
- package/dist/src/main/codegen-types.js +2 -0
- package/dist/src/main/codegen-types.js.map +1 -0
- package/dist/src/main/codegen-utils.d.ts +3 -0
- package/dist/src/main/codegen-utils.js +18 -0
- package/dist/src/main/codegen-utils.js.map +1 -0
- package/dist/src/main/codegen.d.ts +4 -0
- package/dist/src/main/codegen.js +201 -0
- package/dist/src/main/codegen.js.map +1 -0
- package/dist/src/main/codegen.test.d.ts +3 -0
- package/dist/src/main/codegen.test.js +288 -0
- package/dist/src/main/codegen.test.js.map +1 -0
- package/dist/src/main/common/content-bus-types.d.ts +21 -0
- package/dist/src/main/common/content-bus-types.js +11 -0
- package/dist/src/main/common/content-bus-types.js.map +1 -0
- package/dist/src/main/common/content-bus.d.ts +10 -0
- package/dist/src/main/common/content-bus.js +39 -0
- package/dist/src/main/common/content-bus.js.map +1 -0
- package/dist/src/main/common/cost-collector.d.ts +11 -0
- package/dist/src/main/common/cost-collector.js +90 -0
- package/dist/src/main/common/cost-collector.js.map +1 -0
- package/dist/src/main/common/user-actions.d.ts +19 -0
- package/dist/src/main/common/user-actions.js +30 -0
- package/dist/src/main/common/user-actions.js.map +1 -0
- package/dist/src/main/config-lib.d.ts +36 -0
- package/dist/src/main/config-lib.js +51 -0
- package/dist/src/main/config-lib.js.map +1 -0
- package/dist/src/main/config-lib.test.d.ts +1 -0
- package/dist/src/main/config-lib.test.js +64 -0
- package/dist/src/main/config-lib.test.js.map +1 -0
- package/dist/src/main/config.d.ts +7 -0
- package/dist/src/main/config.js +51 -0
- package/dist/src/main/config.js.map +1 -0
- package/dist/src/main/interactive/codegen-interactive.d.ts +2 -0
- package/dist/src/main/interactive/codegen-interactive.js +61 -0
- package/dist/src/main/interactive/codegen-interactive.js.map +1 -0
- package/dist/src/main/interactive/codegen-interactive.test.d.ts +5 -0
- package/dist/src/main/interactive/codegen-interactive.test.js +79 -0
- package/dist/src/main/interactive/codegen-interactive.test.js.map +1 -0
- package/dist/src/main/interactive/codegen-worker.d.ts +3 -0
- package/dist/src/main/interactive/codegen-worker.js +54 -0
- package/dist/src/main/interactive/codegen-worker.js.map +1 -0
- package/dist/src/main/interactive/common.d.ts +5 -0
- package/dist/src/main/interactive/common.js +51 -0
- package/dist/src/main/interactive/common.js.map +1 -0
- package/dist/src/main/interactive/configure.d.ts +2 -0
- package/dist/src/main/interactive/configure.js +99 -0
- package/dist/src/main/interactive/configure.js.map +1 -0
- package/dist/src/main/interactive/error-handling.d.ts +1 -0
- package/dist/src/main/interactive/error-handling.js +43 -0
- package/dist/src/main/interactive/error-handling.js.map +1 -0
- package/dist/src/main/interactive/help.d.ts +1 -0
- package/dist/src/main/interactive/help.js +22 -0
- package/dist/src/main/interactive/help.js.map +1 -0
- package/dist/src/main/interactive/process-comments.d.ts +2 -0
- package/dist/src/main/interactive/process-comments.js +39 -0
- package/dist/src/main/interactive/process-comments.js.map +1 -0
- package/dist/src/main/interactive/select-ai-service.d.ts +2 -0
- package/dist/src/main/interactive/select-ai-service.js +27 -0
- package/dist/src/main/interactive/select-ai-service.js.map +1 -0
- package/dist/src/main/interactive/task-file.d.ts +2 -0
- package/dist/src/main/interactive/task-file.js +35 -0
- package/dist/src/main/interactive/task-file.js.map +1 -0
- package/dist/src/main/interactive/text-prompt.d.ts +2 -0
- package/dist/src/main/interactive/text-prompt.js +18 -0
- package/dist/src/main/interactive/text-prompt.js.map +1 -0
- package/dist/src/main/interactive/user-action-handlers.d.ts +1 -0
- package/dist/src/main/interactive/user-action-handlers.js +13 -0
- package/dist/src/main/interactive/user-action-handlers.js.map +1 -0
- package/dist/src/main/interactive/user-interrupt.d.ts +1 -0
- package/dist/src/main/interactive/user-interrupt.js +36 -0
- package/dist/src/main/interactive/user-interrupt.js.map +1 -0
- package/dist/src/main/plugin-loader.d.ts +6 -0
- package/dist/src/main/plugin-loader.js +40 -0
- package/dist/src/main/plugin-loader.js.map +1 -0
- package/dist/src/main/ui/backend/api-utils.d.ts +2 -0
- package/dist/src/main/ui/backend/api-utils.js +18 -0
- package/dist/src/main/ui/backend/api-utils.js.map +1 -0
- package/dist/src/main/ui/backend/api.d.ts +2 -0
- package/dist/src/main/ui/backend/api.js +210 -0
- package/dist/src/main/ui/backend/api.js.map +1 -0
- package/dist/src/main/ui/backend/server.d.ts +7 -0
- package/dist/src/main/ui/backend/server.js +83 -0
- package/dist/src/main/ui/backend/server.js.map +1 -0
- package/dist/src/main/ui/backend/service.d.ts +44 -0
- package/dist/src/main/ui/backend/service.js +171 -0
- package/dist/src/main/ui/backend/service.js.map +1 -0
- package/dist/src/main/ui/codegen-ui.d.ts +2 -0
- package/dist/src/main/ui/codegen-ui.js +13 -0
- package/dist/src/main/ui/codegen-ui.js.map +1 -0
- package/dist/src/main/ui/common/api-types.d.ts +20 -0
- package/dist/src/main/ui/common/api-types.js +2 -0
- package/dist/src/main/ui/common/api-types.js.map +1 -0
- package/dist/src/main/ui/user-action-handlers.d.ts +2 -0
- package/dist/src/main/ui/user-action-handlers.js +14 -0
- package/dist/src/main/ui/user-action-handlers.js.map +1 -0
- package/dist/src/operations/create-directory/create-directory-def.d.ts +9 -0
- package/dist/src/operations/create-directory/create-directory-def.js +22 -0
- package/dist/src/operations/create-directory/create-directory-def.js.map +1 -0
- package/dist/src/operations/create-directory/create-directory-executor.d.ts +6 -0
- package/dist/src/operations/create-directory/create-directory-executor.js +22 -0
- package/dist/src/operations/create-directory/create-directory-executor.js.map +1 -0
- package/dist/src/operations/create-file/create-file-def.d.ts +10 -0
- package/dist/src/operations/create-file/create-file-def.js +26 -0
- package/dist/src/operations/create-file/create-file-def.js.map +1 -0
- package/dist/src/operations/create-file/create-file-executor.d.ts +6 -0
- package/dist/src/operations/create-file/create-file-executor.js +27 -0
- package/dist/src/operations/create-file/create-file-executor.js.map +1 -0
- package/dist/src/operations/delete-file/delete-file-def.d.ts +9 -0
- package/dist/src/operations/delete-file/delete-file-def.js +22 -0
- package/dist/src/operations/delete-file/delete-file-def.js.map +1 -0
- package/dist/src/operations/delete-file/delete-file-executor.d.ts +6 -0
- package/dist/src/operations/delete-file/delete-file-executor.js +23 -0
- package/dist/src/operations/delete-file/delete-file-executor.js.map +1 -0
- package/dist/src/operations/download-file/download-file-def.d.ts +10 -0
- package/dist/src/operations/download-file/download-file-def.js +26 -0
- package/dist/src/operations/download-file/download-file-def.js.map +1 -0
- package/dist/src/operations/download-file/download-file-executor.d.ts +6 -0
- package/dist/src/operations/download-file/download-file-executor.js +44 -0
- package/dist/src/operations/download-file/download-file-executor.js.map +1 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.d.ts +10 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.js +26 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.js.map +1 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.d.ts +6 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.js +40 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.js.map +1 -0
- package/dist/src/operations/move-file/move-file-def.d.ts +10 -0
- package/dist/src/operations/move-file/move-file-def.js +26 -0
- package/dist/src/operations/move-file/move-file-def.js.map +1 -0
- package/dist/src/operations/move-file/move-file-executor.d.ts +6 -0
- package/dist/src/operations/move-file/move-file-executor.js +29 -0
- package/dist/src/operations/move-file/move-file-executor.js.map +1 -0
- package/dist/src/operations/operations-index.d.ts +3 -0
- package/dist/src/operations/operations-index.js +33 -0
- package/dist/src/operations/operations-index.js.map +1 -0
- package/dist/src/operations/patch-file/patch-file-def.d.ts +10 -0
- package/dist/src/operations/patch-file/patch-file-def.js +39 -0
- package/dist/src/operations/patch-file/patch-file-def.js.map +1 -0
- package/dist/src/operations/patch-file/patch-file-executor.d.ts +5 -0
- package/dist/src/operations/patch-file/patch-file-executor.js +26 -0
- package/dist/src/operations/patch-file/patch-file-executor.js.map +1 -0
- package/dist/src/operations/resize-image/resize-image-def.d.ts +13 -0
- package/dist/src/operations/resize-image/resize-image-def.js +37 -0
- package/dist/src/operations/resize-image/resize-image-def.js.map +1 -0
- package/dist/src/operations/resize-image/resize-image-executor.d.ts +5 -0
- package/dist/src/operations/resize-image/resize-image-executor.js +30 -0
- package/dist/src/operations/resize-image/resize-image-executor.js.map +1 -0
- package/dist/src/operations/split-image/split-image-def.d.ts +18 -0
- package/dist/src/operations/split-image/split-image-def.js +46 -0
- package/dist/src/operations/split-image/split-image-def.js.map +1 -0
- package/dist/src/operations/split-image/split-image-executor.d.ts +6 -0
- package/dist/src/operations/split-image/split-image-executor.js +51 -0
- package/dist/src/operations/split-image/split-image-executor.js.map +1 -0
- package/dist/src/operations/update-file/update-file-def.d.ts +10 -0
- package/dist/src/operations/update-file/update-file-def.js +26 -0
- package/dist/src/operations/update-file/update-file-def.js.map +1 -0
- package/dist/src/operations/update-file/update-file-executor.d.ts +5 -0
- package/dist/src/operations/update-file/update-file-executor.js +22 -0
- package/dist/src/operations/update-file/update-file-executor.js.map +1 -0
- package/dist/src/prompt/ai-service-fallback.d.ts +3 -0
- package/dist/src/prompt/ai-service-fallback.js +84 -0
- package/dist/src/prompt/ai-service-fallback.js.map +1 -0
- package/dist/src/prompt/function-calling-validate.d.ts +3 -0
- package/dist/src/prompt/function-calling-validate.js +99 -0
- package/dist/src/prompt/function-calling-validate.js.map +1 -0
- package/dist/src/prompt/function-calling.d.ts +5 -0
- package/dist/src/prompt/function-calling.js +43 -0
- package/dist/src/prompt/function-calling.js.map +1 -0
- package/dist/src/prompt/function-defs/ask-question-reflect.d.ts +2 -0
- package/dist/src/prompt/function-defs/ask-question-reflect.js +21 -0
- package/dist/src/prompt/function-defs/ask-question-reflect.js.map +1 -0
- package/dist/src/prompt/function-defs/ask-question.d.ts +8 -0
- package/dist/src/prompt/function-defs/ask-question.js +100 -0
- package/dist/src/prompt/function-defs/ask-question.js.map +1 -0
- package/dist/src/prompt/function-defs/codegen-summary.d.ts +5 -0
- package/dist/src/prompt/function-defs/codegen-summary.js +82 -0
- package/dist/src/prompt/function-defs/codegen-summary.js.map +1 -0
- package/dist/src/prompt/function-defs/explanation.d.ts +5 -0
- package/dist/src/prompt/function-defs/explanation.js +18 -0
- package/dist/src/prompt/function-defs/explanation.js.map +1 -0
- package/dist/src/prompt/function-defs/generate-image.d.ts +5 -0
- package/dist/src/prompt/function-defs/generate-image.js +42 -0
- package/dist/src/prompt/function-defs/generate-image.js.map +1 -0
- package/dist/src/prompt/function-defs/get-image-assets.d.ts +5 -0
- package/dist/src/prompt/function-defs/get-image-assets.js +21 -0
- package/dist/src/prompt/function-defs/get-image-assets.js.map +1 -0
- package/dist/src/prompt/function-defs/get-source-code.d.ts +5 -0
- package/dist/src/prompt/function-defs/get-source-code.js +22 -0
- package/dist/src/prompt/function-defs/get-source-code.js.map +1 -0
- package/dist/src/prompt/function-defs/optimize-context.d.ts +5 -0
- package/dist/src/prompt/function-defs/optimize-context.js +47 -0
- package/dist/src/prompt/function-defs/optimize-context.js.map +1 -0
- package/dist/src/prompt/function-defs/read-history.d.ts +2 -0
- package/dist/src/prompt/function-defs/read-history.js +14 -0
- package/dist/src/prompt/function-defs/read-history.js.map +1 -0
- package/dist/src/prompt/function-defs/set-summaries.d.ts +5 -0
- package/dist/src/prompt/function-defs/set-summaries.js +32 -0
- package/dist/src/prompt/function-defs/set-summaries.js.map +1 -0
- package/dist/src/prompt/function-defs/update-history.d.ts +5 -0
- package/dist/src/prompt/function-defs/update-history.js +22 -0
- package/dist/src/prompt/function-defs/update-history.js.map +1 -0
- package/dist/src/prompt/limits.d.ts +3 -0
- package/dist/src/prompt/limits.js +21 -0
- package/dist/src/prompt/limits.js.map +1 -0
- package/dist/src/prompt/limits.test.d.ts +1 -0
- package/dist/src/prompt/limits.test.js +35 -0
- package/dist/src/prompt/limits.test.js.map +1 -0
- package/dist/src/prompt/prompt-codegen.d.ts +9 -0
- package/dist/src/prompt/prompt-codegen.js +117 -0
- package/dist/src/prompt/prompt-codegen.js.map +1 -0
- package/dist/src/prompt/prompt-codegen.test.d.ts +1 -0
- package/dist/src/prompt/prompt-codegen.test.js +98 -0
- package/dist/src/prompt/prompt-codegen.test.js.map +1 -0
- package/dist/src/prompt/prompt-consts.d.ts +1 -0
- package/dist/src/prompt/prompt-consts.js +2 -0
- package/dist/src/prompt/prompt-consts.js.map +1 -0
- package/dist/src/prompt/prompt-service-ask-question.test.d.ts +4 -0
- package/dist/src/prompt/prompt-service-ask-question.test.js +215 -0
- package/dist/src/prompt/prompt-service-ask-question.test.js.map +1 -0
- package/dist/src/prompt/prompt-service.d.ts +5 -0
- package/dist/src/prompt/prompt-service.js +214 -0
- package/dist/src/prompt/prompt-service.js.map +1 -0
- package/dist/src/prompt/prompt-service.test.d.ts +2 -0
- package/dist/src/prompt/prompt-service.test.js +553 -0
- package/dist/src/prompt/prompt-service.test.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +16 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +37 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.js +36 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.js +18 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.js +20 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +43 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.js +49 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.js +46 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.js +16 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.d.ts +0 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.js +2 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.d.ts +4 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.js +91 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.d.ts +55 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.js +2 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.d.ts +6 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.js +88 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.js.map +1 -0
- package/dist/src/prompt/steps/step-context-optimization.d.ts +4 -0
- package/dist/src/prompt/steps/step-context-optimization.js +200 -0
- package/dist/src/prompt/steps/step-context-optimization.js.map +1 -0
- package/dist/src/prompt/steps/step-generate-image.d.ts +2 -0
- package/dist/src/prompt/steps/step-generate-image.js +29 -0
- package/dist/src/prompt/steps/step-generate-image.js.map +1 -0
- package/dist/src/prompt/steps/step-generate-summary.d.ts +3 -0
- package/dist/src/prompt/steps/step-generate-summary.js +41 -0
- package/dist/src/prompt/steps/step-generate-summary.js.map +1 -0
- package/dist/src/prompt/steps/step-history-update.d.ts +5 -0
- package/dist/src/prompt/steps/step-history-update.js +54 -0
- package/dist/src/prompt/steps/step-history-update.js.map +1 -0
- package/dist/src/prompt/steps/step-summarization.d.ts +8 -0
- package/dist/src/prompt/steps/step-summarization.js +75 -0
- package/dist/src/prompt/steps/step-summarization.js.map +1 -0
- package/dist/src/prompt/steps/step-validate-recover.d.ts +2 -0
- package/dist/src/prompt/steps/step-validate-recover.js +51 -0
- package/dist/src/prompt/steps/step-validate-recover.js.map +1 -0
- package/dist/src/prompt/steps/step-verify-patch.d.ts +6 -0
- package/dist/src/prompt/steps/step-verify-patch.js +34 -0
- package/dist/src/prompt/steps/step-verify-patch.js.map +1 -0
- package/dist/src/prompt/steps/steps-types.d.ts +16 -0
- package/dist/src/prompt/steps/steps-types.js +6 -0
- package/dist/src/prompt/steps/steps-types.js.map +1 -0
- package/dist/src/prompt/steps/steps-utils.d.ts +7 -0
- package/dist/src/prompt/steps/steps-utils.js +11 -0
- package/dist/src/prompt/steps/steps-utils.js.map +1 -0
- package/dist/src/prompt/systemprompt.d.ts +3 -0
- package/dist/src/prompt/systemprompt.js +209 -0
- package/dist/src/prompt/systemprompt.js.map +1 -0
- package/dist/src/prompt/systemprompt.test.d.ts +3 -0
- package/dist/src/prompt/systemprompt.test.js +43 -0
- package/dist/src/prompt/systemprompt.test.js.map +1 -0
- package/dist/src/prompt/token-estimator.d.ts +8 -0
- package/dist/src/prompt/token-estimator.js +31 -0
- package/dist/src/prompt/token-estimator.js.map +1 -0
- package/dist/src/vite-genaicode/vite-genaicode-frontend.d.ts +1 -0
- package/dist/src/vite-genaicode/vite-genaicode-frontend.js +142 -0
- package/dist/src/vite-genaicode/vite-genaicode-frontend.js.map +1 -0
- package/dist/src/vite-genaicode/vite-genaicode-plugin.d.ts +7 -0
- package/dist/src/vite-genaicode/vite-genaicode-plugin.js +40 -0
- package/dist/src/vite-genaicode/vite-genaicode-plugin.js.map +1 -0
- package/dist/vite-genaicode/vite-genaicode-plugin.js +3 -3
- package/dist/vite-genaicode/vite-genaicode-plugin.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-files.js","sourceRoot":"","sources":["../../../src/files/read-files.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import mime from 'mime-types';
|
|
4
|
+
import sizeOf from 'image-size';
|
|
5
|
+
import { getSourceCode, getImageAssets } from './read-files.js';
|
|
6
|
+
import { getSourceFiles, getImageAssetFiles } from './find-files.js';
|
|
7
|
+
import { verifySourceCodeLimit } from '../prompt/limits.js';
|
|
8
|
+
import * as cliParams from '../cli/cli-params.js';
|
|
9
|
+
import { rcConfig } from '../main/config.js';
|
|
10
|
+
vi.mock('fs');
|
|
11
|
+
vi.mock('mime-types');
|
|
12
|
+
vi.mock('image-size');
|
|
13
|
+
vi.mock('./find-files.js', () => ({
|
|
14
|
+
getImageAssetFiles: vi.fn(),
|
|
15
|
+
getSourceFiles: vi.fn(),
|
|
16
|
+
}));
|
|
17
|
+
vi.mock('../prompt/limits.js');
|
|
18
|
+
vi.mock('../cli/cli-params.js', () => ({
|
|
19
|
+
taskFile: null,
|
|
20
|
+
contentMask: null,
|
|
21
|
+
disableExplanations: true,
|
|
22
|
+
ignorePatterns: [],
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('../main/config.js', () => ({
|
|
25
|
+
rcConfig: { rootDir: '/home/project' },
|
|
26
|
+
importantContext: {},
|
|
27
|
+
}));
|
|
28
|
+
describe('read-files', () => {
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
vi.resetAllMocks();
|
|
31
|
+
vi.mocked(cliParams).contentMask = undefined;
|
|
32
|
+
});
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
vi.clearAllMocks();
|
|
35
|
+
});
|
|
36
|
+
describe('getSourceCode', () => {
|
|
37
|
+
it('should return source code for all files', () => {
|
|
38
|
+
const mockFiles = ['/home/project/file1.js', '/home/project/file2.js'];
|
|
39
|
+
vi.mocked(getSourceFiles).mockReturnValue(mockFiles);
|
|
40
|
+
vi.mocked(fs).readFileSync.mockImplementation((file) => `Content of ${file}`);
|
|
41
|
+
rcConfig.rootDir = '/home/project';
|
|
42
|
+
const result = getSourceCode({ taskFile: undefined }, { aiService: 'vertex-ai' });
|
|
43
|
+
expect(result).toEqual({
|
|
44
|
+
'/home/project/file1.js': { content: 'Content of /home/project/file1.js' },
|
|
45
|
+
'/home/project/file2.js': { content: 'Content of /home/project/file2.js' },
|
|
46
|
+
});
|
|
47
|
+
expect(verifySourceCodeLimit).toHaveBeenCalled();
|
|
48
|
+
});
|
|
49
|
+
it('should apply content mask when specified', () => {
|
|
50
|
+
const mockFiles = ['/home/project/file1.js', '/home/project/subfolder/file2.js'];
|
|
51
|
+
vi.mocked(getSourceFiles).mockReturnValue(mockFiles);
|
|
52
|
+
vi.mocked(fs).readFileSync.mockImplementation((file) => `Content of ${file}`);
|
|
53
|
+
rcConfig.rootDir = '/home/project';
|
|
54
|
+
const result = getSourceCode({ taskFile: undefined }, { aiService: 'vertex-ai', contentMask: 'subfolder' });
|
|
55
|
+
expect(result).toEqual({
|
|
56
|
+
'/home/project/file1.js': { content: null },
|
|
57
|
+
'/home/project/subfolder/file2.js': {
|
|
58
|
+
content: 'Content of /home/project/subfolder/file2.js',
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
it('should include task file when specified', () => {
|
|
63
|
+
const mockFiles = ['/home/project/file1.js'];
|
|
64
|
+
vi.mocked(getSourceFiles).mockReturnValue(mockFiles);
|
|
65
|
+
vi.mocked(fs).readFileSync.mockImplementation((file) => `Content of ${file}`);
|
|
66
|
+
rcConfig.rootDir = '/home/project';
|
|
67
|
+
const result = getSourceCode({ taskFile: '/home/project/task.md' }, { aiService: 'vertex-ai' });
|
|
68
|
+
expect(result).toEqual({
|
|
69
|
+
'/home/project/file1.js': { content: 'Content of /home/project/file1.js' },
|
|
70
|
+
'/home/project/task.md': { content: 'Content of /home/project/task.md' },
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe('getImageAssets', () => {
|
|
75
|
+
it('should return image assets information', () => {
|
|
76
|
+
const mockImageFiles = ['/home/project/image1.png', '/home/project/image2.jpg'];
|
|
77
|
+
vi.mocked(getImageAssetFiles).mockReturnValue(mockImageFiles);
|
|
78
|
+
vi.mocked(mime).lookup.mockImplementation((file) => (file.endsWith('.png') ? 'image/png' : 'image/jpeg'));
|
|
79
|
+
vi.mocked(sizeOf).mockImplementation(() => ({ width: 100, height: 200 }));
|
|
80
|
+
const result = getImageAssets();
|
|
81
|
+
expect(result).toEqual({
|
|
82
|
+
'/home/project/image1.png': { mimeType: 'image/png', width: 100, height: 200 },
|
|
83
|
+
'/home/project/image2.jpg': { mimeType: 'image/jpeg', width: 100, height: 200 },
|
|
84
|
+
});
|
|
85
|
+
expect(verifySourceCodeLimit).toHaveBeenCalled();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=read-files.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-files.test.js","sourceRoot":"","sources":["../../../src/files/read-files.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Temporary storage */
|
|
2
|
+
let tempId = 1;
|
|
3
|
+
const temp = {};
|
|
4
|
+
export function getTempBuffer(url) {
|
|
5
|
+
return temp[url];
|
|
6
|
+
}
|
|
7
|
+
export function setTempBuffer(buffer) {
|
|
8
|
+
const imageUrl = 'temp://' + tempId++;
|
|
9
|
+
temp[imageUrl] = buffer;
|
|
10
|
+
return imageUrl;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=temp-buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temp-buffer.js","sourceRoot":"","sources":["../../../src/files/temp-buffer.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,IAAI,MAAM,GAAG,CAAC,CAAC;AACf,MAAM,IAAI,GAA8B,EAAE,CAAC;AAE3C,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,QAAQ,GAAG,SAAS,GAAG,MAAM,EAAE,CAAC;IACtC,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IACxB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CodegenOptions } from '../main/codegen-types.js';
|
|
2
|
+
import { FunctionCall } from '../ai-service/common.js';
|
|
3
|
+
/**
|
|
4
|
+
* @param functionCalls Result of the code generation, a map of file paths to new content
|
|
5
|
+
*/
|
|
6
|
+
export declare function updateFiles(functionCalls: FunctionCall[], options: CodegenOptions): Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getOperationExecutor } from '../operations/operations-index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @param functionCalls Result of the code generation, a map of file paths to new content
|
|
4
|
+
*/
|
|
5
|
+
export async function updateFiles(functionCalls, options) {
|
|
6
|
+
for (const { name, args } of functionCalls) {
|
|
7
|
+
const executor = getOperationExecutor(name);
|
|
8
|
+
if (!executor) {
|
|
9
|
+
console.warn(`Unknown operation: ${name}`);
|
|
10
|
+
}
|
|
11
|
+
else if (args === undefined) {
|
|
12
|
+
console.warn(`Operation ${name} has no arguments`);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
await executor(args, options);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=update-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-files.js","sourceRoot":"","sources":["../../../src/files/update-files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,aAA6B,EAAE,OAAuB;IACtF,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,aAAa,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;aAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,mBAAmB,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ensureAlpha(image: string | Buffer): Promise<Buffer>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-alpha.js","sourceRoot":"","sources":["../../../src/images/ensure-alpha.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAsB;IACtD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { removeBackground } from '@imgly/background-removal-node';
|
|
4
|
+
/** Converts white color to transparency on a image and saves to destination path */
|
|
5
|
+
export async function imglyRemoveBackground(inputFilePath, outputFilePath) {
|
|
6
|
+
try {
|
|
7
|
+
console.log(`Removing background for image: ${inputFilePath}`);
|
|
8
|
+
const publicPath = 'file://' + createRequire(import.meta.url).resolve('@imgly/background-removal-node');
|
|
9
|
+
const blob = await removeBackground(inputFilePath, {
|
|
10
|
+
publicPath,
|
|
11
|
+
});
|
|
12
|
+
fs.writeFileSync(outputFilePath, Buffer.from(await blob.arrayBuffer()));
|
|
13
|
+
console.log(`Background removed successfully. Saved to: ${outputFilePath}`);
|
|
14
|
+
return outputFilePath;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error('Error removing background:', error);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=imgly-remove-background.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imgly-remove-background.js","sourceRoot":"","sources":["../../../src/images/imgly-remove-background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,aAAqB,EAAE,cAAsB;IACvF,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,kCAAkC,aAAa,EAAE,CAAC,CAAC;QAE/D,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;QACxG,MAAM,IAAI,GAAS,MAAM,gBAAgB,CAAC,aAAa,EAAE;YACvD,UAAU;SACX,CAAC,CAAC;QACH,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAExE,OAAO,CAAC,GAAG,CAAC,8CAA8C,cAAc,EAAE,CAAC,CAAC;QAC5E,OAAO,cAAc,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface ImageSize {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Resize an image buffer to the desired size
|
|
7
|
+
* @param {Buffer} input - The input image buffer
|
|
8
|
+
* @param {ImageSize} size - The desired size of the image
|
|
9
|
+
* @returns {Promise<Buffer>} - The resized image buffer
|
|
10
|
+
*/
|
|
11
|
+
export declare function resizeImageBuffer(input: Buffer, size: ImageSize): Promise<Buffer>;
|
|
12
|
+
/**
|
|
13
|
+
* Resize an image file to the desired size and save it back to the same file
|
|
14
|
+
* @param {string} filePath - The path of the image file to resize
|
|
15
|
+
* @param {ImageSize} size - The desired size of the image
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
18
|
+
export declare function resizeImageFile(filePath: string, size: ImageSize): Promise<void>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import sharp from 'sharp';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
/**
|
|
4
|
+
* Resize an image buffer to the desired size
|
|
5
|
+
* @param {Buffer} input - The input image buffer
|
|
6
|
+
* @param {ImageSize} size - The desired size of the image
|
|
7
|
+
* @returns {Promise<Buffer>} - The resized image buffer
|
|
8
|
+
*/
|
|
9
|
+
export async function resizeImageBuffer(input, size) {
|
|
10
|
+
return await sharp(input).resize(size.width, size.height).toBuffer();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resize an image file to the desired size and save it back to the same file
|
|
14
|
+
* @param {string} filePath - The path of the image file to resize
|
|
15
|
+
* @param {ImageSize} size - The desired size of the image
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
18
|
+
export async function resizeImageFile(filePath, size) {
|
|
19
|
+
const buffer = await resizeImageBuffer(await fs.promises.readFile(filePath), size);
|
|
20
|
+
await fs.promises.writeFile(filePath, buffer);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=resize-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-image.js","sourceRoot":"","sources":["../../../src/images/resize-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;AAOpB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAAa,EAAE,IAAe;IACpE,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;AACvE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAgB,EAAE,IAAe;IACrE,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;IACnF,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface Rect {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
interface Part {
|
|
8
|
+
rect: Rect;
|
|
9
|
+
outputFilePath: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* This function opens the input file, and splits its into parts, extracting parts of the input image, and saving to outputFilePaths
|
|
13
|
+
*
|
|
14
|
+
* @param {string} inputFilePath
|
|
15
|
+
* @param {Part[]} parts
|
|
16
|
+
*/
|
|
17
|
+
export declare function splitImage(inputFilePath: string, parts: Part[]): Promise<void>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import sharp from 'sharp';
|
|
2
|
+
/**
|
|
3
|
+
* This function opens the input file, and splits its into parts, extracting parts of the input image, and saving to outputFilePaths
|
|
4
|
+
*
|
|
5
|
+
* @param {string} inputFilePath
|
|
6
|
+
* @param {Part[]} parts
|
|
7
|
+
*/
|
|
8
|
+
export async function splitImage(inputFilePath, parts) {
|
|
9
|
+
try {
|
|
10
|
+
// Process each part
|
|
11
|
+
for (const part of parts) {
|
|
12
|
+
const { rect, outputFilePath } = part;
|
|
13
|
+
const { x, y, width, height } = rect;
|
|
14
|
+
// Extract the specified rectangle from the input image
|
|
15
|
+
console.log('Extracting', rect, outputFilePath);
|
|
16
|
+
await sharp(inputFilePath).extract({ left: x, top: y, width, height }).toFile(outputFilePath);
|
|
17
|
+
}
|
|
18
|
+
console.log('Image splitting completed successfully.');
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error splitting image:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=split-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-image.js","sourceRoot":"","sources":["../../../src/images/split-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,aAAqB,EAAE,KAAa;IACnE,IAAI,CAAC;QACH,oBAAoB;QACpB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;YACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;YAErC,uDAAuD;YACvD,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;YAChD,MAAM,KAAK,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAChG,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IACzD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC/C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { FunctionDef, GenerateContentFunction } from '../ai-service/common';
|
|
2
|
+
export type PluginAiServiceType = `plugin:${string}`;
|
|
3
|
+
export type AiServiceType = 'vertex-ai' | 'ai-studio' | 'vertex-ai-claude' | 'chat-gpt' | 'anthropic' | PluginAiServiceType;
|
|
4
|
+
export type ImagenType = 'vertex-ai' | 'dall-e';
|
|
5
|
+
export interface UploadedImage {
|
|
6
|
+
base64url: string;
|
|
7
|
+
mediaType: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
|
|
8
|
+
originalName: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CodegenOptions {
|
|
11
|
+
explicitPrompt?: string;
|
|
12
|
+
taskFile?: string;
|
|
13
|
+
considerAllFiles?: boolean;
|
|
14
|
+
allowFileCreate?: boolean;
|
|
15
|
+
allowFileDelete?: boolean;
|
|
16
|
+
allowDirectoryCreate?: boolean;
|
|
17
|
+
allowFileMove?: boolean;
|
|
18
|
+
vision?: boolean;
|
|
19
|
+
imagen?: ImagenType;
|
|
20
|
+
aiService: AiServiceType;
|
|
21
|
+
disableContextOptimization?: boolean;
|
|
22
|
+
temperature?: number;
|
|
23
|
+
cheap?: boolean;
|
|
24
|
+
dryRun?: boolean;
|
|
25
|
+
verbose?: boolean;
|
|
26
|
+
requireExplanations?: boolean;
|
|
27
|
+
geminiBlockNone?: boolean;
|
|
28
|
+
disableInitialLint?: boolean;
|
|
29
|
+
contentMask?: string;
|
|
30
|
+
ignorePatterns?: string[];
|
|
31
|
+
askQuestion?: boolean;
|
|
32
|
+
interactive?: boolean;
|
|
33
|
+
ui?: boolean;
|
|
34
|
+
uiPort?: number;
|
|
35
|
+
uiFrameAncestors?: string[];
|
|
36
|
+
disableCache?: boolean;
|
|
37
|
+
dependencyTree?: boolean;
|
|
38
|
+
historyEnabled?: boolean;
|
|
39
|
+
disableAiServiceFallback?: boolean;
|
|
40
|
+
selfReflectionEnabled?: boolean;
|
|
41
|
+
conversationSummaryEnabled?: boolean;
|
|
42
|
+
images?: UploadedImage[];
|
|
43
|
+
isDev?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface ExecutorArgs {
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
export type OperationExecutor = (args: ExecutorArgs, options: CodegenOptions) => Promise<void>;
|
|
49
|
+
export type Operation = {
|
|
50
|
+
executor: OperationExecutor;
|
|
51
|
+
def: FunctionDef;
|
|
52
|
+
};
|
|
53
|
+
export interface Plugin {
|
|
54
|
+
name: string;
|
|
55
|
+
aiServices?: Record<string, GenerateContentFunction>;
|
|
56
|
+
operations?: Record<string, Operation>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen-types.js","sourceRoot":"","sources":["../../../src/main/codegen-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as cliParams from '../cli/cli-params.js';
|
|
2
|
+
import { getRegisteredAiServices } from './plugin-loader.js';
|
|
3
|
+
export function getSupportedAiServices() {
|
|
4
|
+
return ['vertex-ai', 'ai-studio', 'vertex-ai-claude', 'chat-gpt', 'anthropic', ...getRegisteredAiServices().keys()];
|
|
5
|
+
}
|
|
6
|
+
export function cliParamToAiService() {
|
|
7
|
+
const aiService = cliParams.aiService;
|
|
8
|
+
if (!aiService) {
|
|
9
|
+
throw new Error('Please specify which AI service should be used with --ai-service option');
|
|
10
|
+
}
|
|
11
|
+
// Validate that the provided AI service is supported
|
|
12
|
+
const supportedServices = getSupportedAiServices();
|
|
13
|
+
if (!supportedServices.includes(aiService)) {
|
|
14
|
+
throw new Error(`Unsupported AI service: ${aiService}. Supported services are: ${supportedServices.join(', ')}`);
|
|
15
|
+
}
|
|
16
|
+
return aiService;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=codegen-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen-utils.js","sourceRoot":"","sources":["../../../src/main/codegen-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,UAAU,sBAAsB;IACpC,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,uBAAuB,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AACtH,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;IACtC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;IAED,qDAAqD;IACrD,MAAM,iBAAiB,GAAG,sBAAsB,EAAE,CAAC;IACnD,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,SAA0B,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,6BAA6B,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnH,CAAC;IAED,OAAO,SAA0B,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CodegenOptions } from './codegen-types.js';
|
|
2
|
+
/** Executes codegen */
|
|
3
|
+
export declare function runCodegen(isDev?: boolean): Promise<void>;
|
|
4
|
+
export declare function runCodegenIteration(options: CodegenOptions, abortSignal?: AbortSignal, waitIfPaused?: () => Promise<void>): Promise<void>;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import util from 'util';
|
|
3
|
+
import * as cliParams from '../cli/cli-params.js';
|
|
4
|
+
import { validateCliParams } from '../cli/validate-cli-params.js';
|
|
5
|
+
import { generateContent as generateContentVertexAi } from '../ai-service/vertex-ai.js';
|
|
6
|
+
import { generateContent as generateContentGPT } from '../ai-service/chat-gpt.js';
|
|
7
|
+
import { generateContent as generateContentAnthropic } from '../ai-service/anthropic.js';
|
|
8
|
+
import { generateContent as generateContentVertexAiClaude } from '../ai-service/vertex-ai-claude.js';
|
|
9
|
+
import { generateContent as generateContentAiStudio } from '../ai-service/ai-studio.js';
|
|
10
|
+
import { generateImage as generateImageDallE } from '../ai-service/dall-e.js';
|
|
11
|
+
import { generateImage as generateImageVertexAi } from '../ai-service/vertex-ai-imagen.js';
|
|
12
|
+
import { promptService } from '../prompt/prompt-service.js';
|
|
13
|
+
import { updateFiles } from '../files/update-files.js';
|
|
14
|
+
import { rcConfig } from '../main/config.js';
|
|
15
|
+
import { getLintFixPrompt } from '../prompt/prompt-codegen.js';
|
|
16
|
+
import { printHelpMessage } from '../cli/cli-options.js';
|
|
17
|
+
import { getCodeGenPrompt } from '../prompt/prompt-codegen.js';
|
|
18
|
+
import { runInteractiveMode } from './interactive/codegen-interactive.js';
|
|
19
|
+
import { runCodegenUI } from './ui/codegen-ui.js';
|
|
20
|
+
import { putSystemMessage, putUserMessage, setCurrentIterationId, unsetCurrentIterationId, } from './common/content-bus.js';
|
|
21
|
+
import { refreshFiles } from '../files/find-files.js';
|
|
22
|
+
import { getRegisteredAiServices } from './plugin-loader.js';
|
|
23
|
+
import { cliParamToAiService } from './codegen-utils.js';
|
|
24
|
+
/** Executes codegen */
|
|
25
|
+
export async function runCodegen(isDev = false) {
|
|
26
|
+
// Print to console the received parameters
|
|
27
|
+
console.log(`Received parameters: ${process.argv.slice(2).join(' ')}`);
|
|
28
|
+
validateCliParams();
|
|
29
|
+
// Handle --help option
|
|
30
|
+
if (cliParams.helpRequested) {
|
|
31
|
+
printHelpMessage();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const options = {
|
|
35
|
+
explicitPrompt: cliParams.explicitPrompt,
|
|
36
|
+
taskFile: cliParams.taskFile,
|
|
37
|
+
considerAllFiles: cliParams.considerAllFiles,
|
|
38
|
+
dependencyTree: cliParams.dependencyTree,
|
|
39
|
+
allowFileCreate: cliParams.allowFileCreate,
|
|
40
|
+
allowFileDelete: cliParams.allowFileDelete,
|
|
41
|
+
allowDirectoryCreate: cliParams.allowDirectoryCreate,
|
|
42
|
+
allowFileMove: cliParams.allowFileMove,
|
|
43
|
+
aiService: cliParamToAiService(),
|
|
44
|
+
vision: cliParams.vision,
|
|
45
|
+
imagen: cliParams.imagen,
|
|
46
|
+
disableContextOptimization: cliParams.disableContextOptimization,
|
|
47
|
+
temperature: cliParams.temperature,
|
|
48
|
+
cheap: cliParams.cheap,
|
|
49
|
+
dryRun: cliParams.dryRun,
|
|
50
|
+
verbose: cliParams.verbosePrompt,
|
|
51
|
+
requireExplanations: !cliParams.disableExplanations,
|
|
52
|
+
geminiBlockNone: cliParams.geminiBlockNone,
|
|
53
|
+
disableInitialLint: cliParams.disableInitialLint,
|
|
54
|
+
contentMask: cliParams.contentMask,
|
|
55
|
+
ignorePatterns: cliParams.ignorePatterns,
|
|
56
|
+
askQuestion: cliParams.askQuestion,
|
|
57
|
+
disableCache: cliParams.disableCache,
|
|
58
|
+
interactive: cliParams.interactive,
|
|
59
|
+
ui: cliParams.ui,
|
|
60
|
+
uiPort: cliParams.uiPort,
|
|
61
|
+
disableAiServiceFallback: cliParams.disableAiServiceFallback,
|
|
62
|
+
historyEnabled: !cliParams.disableHistory,
|
|
63
|
+
selfReflectionEnabled: !cliParams.disableSelfReflection,
|
|
64
|
+
conversationSummaryEnabled: !cliParams.disableConversationSummary,
|
|
65
|
+
isDev,
|
|
66
|
+
};
|
|
67
|
+
if (cliParams.ui) {
|
|
68
|
+
await runCodegenUI(options);
|
|
69
|
+
}
|
|
70
|
+
else if (cliParams.interactive) {
|
|
71
|
+
// Handle interactive mode
|
|
72
|
+
await runInteractiveMode(options);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
console.log('Executing codegen in non-interactive mode');
|
|
76
|
+
await runCodegenIteration(options);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export async function runCodegenIteration(options, abortSignal, waitIfPaused = () => Promise.resolve()) {
|
|
80
|
+
refreshFiles();
|
|
81
|
+
setCurrentIterationId();
|
|
82
|
+
putUserMessage(options.explicitPrompt ?? options.taskFile ?? 'Run codegen iteration without explicit prompt.');
|
|
83
|
+
if (rcConfig.lintCommand && !options.disableInitialLint) {
|
|
84
|
+
try {
|
|
85
|
+
putSystemMessage(`Executing lint command: ${rcConfig.lintCommand}`);
|
|
86
|
+
await execPromise(rcConfig.lintCommand, { cwd: rcConfig.rootDir });
|
|
87
|
+
putSystemMessage('Lint command executed successfully');
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const { stderr, stdout } = error;
|
|
91
|
+
putSystemMessage('Lint command failed. Aborting codegen, please fix lint issues before running codegen, or use --disable-initial-lint');
|
|
92
|
+
console.log('Lint errors:', stdout, stderr);
|
|
93
|
+
unsetCurrentIterationId();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (rcConfig.lintCommand && options.disableInitialLint) {
|
|
98
|
+
console.log('Initial lint was skipped.');
|
|
99
|
+
}
|
|
100
|
+
if (abortSignal?.aborted) {
|
|
101
|
+
unsetCurrentIterationId();
|
|
102
|
+
throw new Error('Codegen iteration aborted');
|
|
103
|
+
}
|
|
104
|
+
await waitIfPaused();
|
|
105
|
+
putSystemMessage('Generating response');
|
|
106
|
+
try {
|
|
107
|
+
const functionCalls = await promptService(getGenerateContentFunctions(), GENERATE_IMAGE_FNS, getCodeGenPrompt(options), waitIfPaused);
|
|
108
|
+
console.log('Received function calls:', functionCalls);
|
|
109
|
+
await waitIfPaused();
|
|
110
|
+
if (functionCalls.length === 0) {
|
|
111
|
+
putSystemMessage('No updates to apply');
|
|
112
|
+
}
|
|
113
|
+
else if (options.dryRun) {
|
|
114
|
+
putSystemMessage('Dry run mode, not updating files');
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
putSystemMessage('Update files');
|
|
118
|
+
await updateFiles(functionCalls.filter((call) => call.name !== 'explanation' && call.name !== 'getSourceCode'), options);
|
|
119
|
+
putSystemMessage('Initial updates applied');
|
|
120
|
+
if (abortSignal?.aborted) {
|
|
121
|
+
throw new Error('Codegen iteration aborted after initial updates');
|
|
122
|
+
}
|
|
123
|
+
await waitIfPaused();
|
|
124
|
+
// Check if lintCommand is specified in .genaicoderc
|
|
125
|
+
if (rcConfig.lintCommand && functionCalls.length > 0) {
|
|
126
|
+
try {
|
|
127
|
+
putSystemMessage(`Executing lint command: ${rcConfig.lintCommand}`);
|
|
128
|
+
await execPromise(rcConfig.lintCommand, { cwd: rcConfig.rootDir });
|
|
129
|
+
putSystemMessage('Lint command executed successfully');
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
putSystemMessage('Lint command failed. Attempting to fix issues...');
|
|
133
|
+
// Prepare the lint error output for the second pass
|
|
134
|
+
const firstLintError = error;
|
|
135
|
+
const lintErrorPrompt = getLintFixPrompt(rcConfig.lintCommand, options, firstLintError.stdout, firstLintError.stderr);
|
|
136
|
+
putSystemMessage('Generating response for lint fixes');
|
|
137
|
+
const lintFixFunctionCalls = (await promptService(getGenerateContentFunctions(), GENERATE_IMAGE_FNS, {
|
|
138
|
+
prompt: lintErrorPrompt,
|
|
139
|
+
options: { ...options, considerAllFiles: true },
|
|
140
|
+
}, waitIfPaused));
|
|
141
|
+
console.log('Received function calls for lint fixes:', lintFixFunctionCalls);
|
|
142
|
+
await waitIfPaused();
|
|
143
|
+
putSystemMessage('Applying lint fixes');
|
|
144
|
+
updateFiles(lintFixFunctionCalls.filter((call) => call.name !== 'explanation' && call.name !== 'getSourceCode'), options);
|
|
145
|
+
if (abortSignal?.aborted) {
|
|
146
|
+
throw new Error('Codegen iteration aborted after lint fixes');
|
|
147
|
+
}
|
|
148
|
+
// Run lint command again to verify fixes
|
|
149
|
+
try {
|
|
150
|
+
putSystemMessage(`Re-running lint command: ${rcConfig.lintCommand}`);
|
|
151
|
+
await execPromise(rcConfig.lintCommand);
|
|
152
|
+
putSystemMessage('Lint command executed successfully after fixes');
|
|
153
|
+
}
|
|
154
|
+
catch (secondLintError) {
|
|
155
|
+
const error = secondLintError;
|
|
156
|
+
putSystemMessage('Lint command still failing after fixes. Manual intervention may be required.');
|
|
157
|
+
console.log('Lint errors:', error.stdout, error.stderr);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
console.log('Done!');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
if (error instanceof Error) {
|
|
166
|
+
if (error.name === 'AbortError' || error.message.includes('interrupted')) {
|
|
167
|
+
putSystemMessage('Codegen iteration was interrupted');
|
|
168
|
+
}
|
|
169
|
+
else if (error.message.includes('Rate limit exceeded')) {
|
|
170
|
+
putSystemMessage('Rate limit exceeded. Consider switching to a different AI service or waiting before retrying.');
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
putSystemMessage(`An error occurred during codegen: ${error.message}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
putSystemMessage('An unknown error occurred during codegen');
|
|
178
|
+
}
|
|
179
|
+
console.error('Error details:', error);
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
unsetCurrentIterationId();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// helper functions and consts
|
|
186
|
+
const execPromise = util.promisify(exec);
|
|
187
|
+
function getGenerateContentFunctions() {
|
|
188
|
+
return {
|
|
189
|
+
'vertex-ai-claude': generateContentVertexAiClaude,
|
|
190
|
+
'vertex-ai': generateContentVertexAi,
|
|
191
|
+
'ai-studio': generateContentAiStudio,
|
|
192
|
+
anthropic: generateContentAnthropic,
|
|
193
|
+
'chat-gpt': generateContentGPT,
|
|
194
|
+
...Object.fromEntries(getRegisteredAiServices().entries()),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
const GENERATE_IMAGE_FNS = {
|
|
198
|
+
'dall-e': generateImageDallE,
|
|
199
|
+
'vertex-ai': generateImageVertexAi,
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=codegen.js.map
|