genaicode 0.0.37 → 0.2.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 +3 -1
- package/bin/genaicode-dev.js +11 -0
- package/bin/genaicode.cjs +15 -1
- package/dist/ai-service/ai-studio.d.ts +6 -0
- package/dist/ai-service/ai-studio.js +135 -0
- package/dist/ai-service/ai-studio.js.map +1 -0
- package/dist/ai-service/anthropic.d.ts +6 -0
- package/dist/ai-service/anthropic.js +135 -0
- package/dist/ai-service/anthropic.js.map +1 -0
- package/dist/ai-service/chat-gpt.d.ts +5 -0
- package/dist/ai-service/chat-gpt.js +132 -0
- package/dist/ai-service/chat-gpt.js.map +1 -0
- package/dist/ai-service/common.d.ts +58 -0
- package/dist/ai-service/common.js +38 -0
- package/dist/ai-service/common.js.map +1 -0
- package/dist/ai-service/common.test.d.ts +1 -0
- package/dist/ai-service/common.test.js +85 -0
- package/dist/ai-service/common.test.js.map +1 -0
- package/dist/ai-service/dall-e.d.ts +14 -0
- package/dist/ai-service/dall-e.js +48 -0
- package/dist/ai-service/dall-e.js.map +1 -0
- package/dist/ai-service/vertex-ai-claude.d.ts +5 -0
- package/dist/ai-service/vertex-ai-claude.js +94 -0
- package/dist/ai-service/vertex-ai-claude.js.map +1 -0
- package/dist/ai-service/vertex-ai-imagen.d.ts +14 -0
- package/dist/ai-service/vertex-ai-imagen.js +77 -0
- package/dist/ai-service/vertex-ai-imagen.js.map +1 -0
- package/dist/ai-service/vertex-ai.d.ts +7 -0
- package/dist/ai-service/vertex-ai.js +142 -0
- package/dist/ai-service/vertex-ai.js.map +1 -0
- package/dist/cli/cli-options.d.ts +10 -0
- package/dist/cli/cli-options.js +124 -0
- package/dist/cli/cli-options.js.map +1 -0
- package/dist/cli/cli-options.test.d.ts +1 -0
- package/dist/cli/cli-options.test.js +34 -0
- package/dist/cli/cli-options.test.js.map +1 -0
- package/dist/cli/cli-params.d.ts +30 -0
- package/dist/cli/cli-params.js +109 -0
- package/dist/cli/cli-params.js.map +1 -0
- package/dist/cli/cli-params.test.d.ts +1 -0
- package/dist/cli/cli-params.test.js +38 -0
- package/dist/cli/cli-params.test.js.map +1 -0
- package/dist/cli/service-autodetect.d.ts +2 -0
- package/dist/cli/service-autodetect.js +17 -0
- package/dist/cli/service-autodetect.js.map +1 -0
- package/dist/cli/service-autodetect.test.d.ts +1 -0
- package/dist/cli/service-autodetect.test.js +38 -0
- package/dist/cli/service-autodetect.test.js.map +1 -0
- package/dist/cli/validate-cli-params.d.ts +18 -0
- package/dist/cli/validate-cli-params.js +129 -0
- package/dist/cli/validate-cli-params.js.map +1 -0
- package/dist/cli/validate-cli-params.test.d.ts +1 -0
- package/dist/cli/validate-cli-params.test.js +106 -0
- package/dist/cli/validate-cli-params.test.js.map +1 -0
- package/dist/files/file-utils.d.ts +2 -0
- package/dist/files/file-utils.js +7 -0
- package/dist/files/file-utils.js.map +1 -0
- package/dist/files/file-utils.test.d.ts +1 -0
- package/dist/files/file-utils.test.js +18 -0
- package/dist/files/file-utils.test.js.map +1 -0
- package/dist/files/find-files.d.ts +8 -0
- package/dist/files/find-files.js +76 -0
- package/dist/files/find-files.js.map +1 -0
- package/dist/files/read-files.d.ts +18 -0
- package/dist/files/read-files.js +66 -0
- package/dist/files/read-files.js.map +1 -0
- package/dist/files/read-files.test.d.ts +1 -0
- package/dist/files/read-files.test.js +88 -0
- package/dist/files/read-files.test.js.map +1 -0
- package/dist/files/temp-buffer.d.ts +2 -0
- package/dist/files/temp-buffer.js +12 -0
- package/dist/files/temp-buffer.js.map +1 -0
- package/dist/files/update-files.d.ts +6 -0
- package/dist/files/update-files.js +197 -0
- package/dist/files/update-files.js.map +1 -0
- package/dist/images/ensure-alpha.d.ts +1 -0
- package/dist/images/ensure-alpha.js +5 -0
- package/dist/images/ensure-alpha.js.map +1 -0
- package/dist/images/imgly-remove-background.d.ts +2 -0
- package/dist/images/imgly-remove-background.js +21 -0
- package/dist/images/imgly-remove-background.js.map +1 -0
- package/dist/images/resize-image.d.ts +19 -0
- package/dist/images/resize-image.js +22 -0
- package/dist/images/resize-image.js.map +1 -0
- package/dist/images/split-image.d.ts +18 -0
- package/dist/images/split-image.js +25 -0
- package/dist/images/split-image.js.map +1 -0
- package/dist/main/codegen-interactive-utils.d.ts +8 -0
- package/dist/main/codegen-interactive-utils.js +148 -0
- package/dist/main/codegen-interactive-utils.js.map +1 -0
- package/dist/main/codegen-interactive.d.ts +2 -0
- package/dist/main/codegen-interactive.js +68 -0
- package/dist/main/codegen-interactive.js.map +1 -0
- package/dist/main/codegen-types.d.ts +28 -0
- package/dist/main/codegen-types.js +2 -0
- package/dist/main/codegen-types.js.map +1 -0
- package/dist/main/codegen.d.ts +4 -0
- package/dist/main/codegen.js +164 -0
- package/dist/main/codegen.js.map +1 -0
- package/dist/main/codegen.test.d.ts +2 -0
- package/dist/main/codegen.test.js +273 -0
- package/dist/main/codegen.test.js.map +1 -0
- package/dist/main/config-lib.d.ts +16 -0
- package/dist/main/config-lib.js +28 -0
- package/dist/main/config-lib.js.map +1 -0
- package/dist/main/config-lib.test.d.ts +1 -0
- package/dist/main/config-lib.test.js +64 -0
- package/dist/main/config-lib.test.js.map +1 -0
- package/dist/main/config.d.ts +6 -0
- package/{src → dist}/main/config.js +28 -22
- package/dist/main/config.js.map +1 -0
- package/dist/main/interactive/codegen-interactive.d.ts +2 -0
- package/dist/main/interactive/codegen-interactive.js +55 -0
- package/dist/main/interactive/codegen-interactive.js.map +1 -0
- package/dist/main/interactive/codegen-interactive.test.d.ts +4 -0
- package/dist/main/interactive/codegen-interactive.test.js +77 -0
- package/dist/main/interactive/codegen-interactive.test.js.map +1 -0
- package/dist/main/interactive/codegen-worker.d.ts +3 -0
- package/dist/main/interactive/codegen-worker.js +47 -0
- package/dist/main/interactive/codegen-worker.js.map +1 -0
- package/dist/main/interactive/common.d.ts +5 -0
- package/dist/main/interactive/common.js +51 -0
- package/dist/main/interactive/common.js.map +1 -0
- package/dist/main/interactive/configure.d.ts +2 -0
- package/dist/main/interactive/configure.js +99 -0
- package/dist/main/interactive/configure.js.map +1 -0
- package/dist/main/interactive/error-handling.d.ts +4 -0
- package/dist/main/interactive/error-handling.js +49 -0
- package/dist/main/interactive/error-handling.js.map +1 -0
- package/dist/main/interactive/help.d.ts +1 -0
- package/dist/main/interactive/help.js +22 -0
- package/dist/main/interactive/help.js.map +1 -0
- package/dist/main/interactive/process-comments.d.ts +2 -0
- package/dist/main/interactive/process-comments.js +39 -0
- package/dist/main/interactive/process-comments.js.map +1 -0
- package/dist/main/interactive/select-ai-service.d.ts +2 -0
- package/dist/main/interactive/select-ai-service.js +27 -0
- package/dist/main/interactive/select-ai-service.js.map +1 -0
- package/dist/main/interactive/task-file.d.ts +2 -0
- package/dist/main/interactive/task-file.js +28 -0
- package/dist/main/interactive/task-file.js.map +1 -0
- package/dist/main/interactive/text-prompt.d.ts +2 -0
- package/dist/main/interactive/text-prompt.js +18 -0
- package/dist/main/interactive/text-prompt.js.map +1 -0
- package/dist/main/interactive/user-interrupt.d.ts +1 -0
- package/dist/main/interactive/user-interrupt.js +36 -0
- package/dist/main/interactive/user-interrupt.js.map +1 -0
- package/dist/main/interactive/worker-script.d.ts +1 -0
- package/dist/main/interactive/worker-script.js +24 -0
- package/dist/main/interactive/worker-script.js.map +1 -0
- package/dist/main/interactive/worker.d.ts +2 -0
- package/dist/main/interactive/worker.js +55 -0
- package/dist/main/interactive/worker.js.map +1 -0
- package/dist/prompt/function-calling-validate.d.ts +3 -0
- package/dist/prompt/function-calling-validate.js +33 -0
- package/dist/prompt/function-calling-validate.js.map +1 -0
- package/dist/prompt/function-calling.d.ts +5 -0
- package/{src → dist}/prompt/function-calling.js +25 -24
- package/dist/prompt/function-calling.js.map +1 -0
- package/dist/prompt/function-defs/ask-question.d.ts +65 -0
- package/dist/prompt/function-defs/ask-question.js +67 -0
- package/dist/prompt/function-defs/ask-question.js.map +1 -0
- package/dist/prompt/function-defs/codegen-summary.d.ts +63 -0
- package/dist/prompt/function-defs/codegen-summary.js +80 -0
- package/dist/prompt/function-defs/codegen-summary.js.map +1 -0
- package/dist/prompt/function-defs/create-directory.d.ts +21 -0
- package/dist/prompt/function-defs/create-directory.js +22 -0
- package/dist/prompt/function-defs/create-directory.js.map +1 -0
- package/dist/prompt/function-defs/create-file.d.ts +25 -0
- package/dist/prompt/function-defs/create-file.js +26 -0
- package/dist/prompt/function-defs/create-file.js.map +1 -0
- package/dist/prompt/function-defs/delete-file.d.ts +21 -0
- package/dist/prompt/function-defs/delete-file.js +22 -0
- package/dist/prompt/function-defs/delete-file.js.map +1 -0
- package/dist/prompt/function-defs/download-file.d.ts +25 -0
- package/dist/prompt/function-defs/download-file.js +26 -0
- package/dist/prompt/function-defs/download-file.js.map +1 -0
- package/dist/prompt/function-defs/explanation.d.ts +17 -0
- package/dist/prompt/function-defs/explanation.js +18 -0
- package/dist/prompt/function-defs/explanation.js.map +1 -0
- package/dist/prompt/function-defs/generate-image.d.ts +41 -0
- package/dist/prompt/function-defs/generate-image.js +42 -0
- package/dist/prompt/function-defs/generate-image.js.map +1 -0
- package/dist/prompt/function-defs/get-image-assets.d.ts +20 -0
- package/dist/prompt/function-defs/get-image-assets.js +21 -0
- package/dist/prompt/function-defs/get-image-assets.js.map +1 -0
- package/dist/prompt/function-defs/get-source-code.d.ts +20 -0
- package/dist/prompt/function-defs/get-source-code.js +21 -0
- package/dist/prompt/function-defs/get-source-code.js.map +1 -0
- package/dist/prompt/function-defs/imgly-remove-background.d.ts +25 -0
- package/dist/prompt/function-defs/imgly-remove-background.js +26 -0
- package/dist/prompt/function-defs/imgly-remove-background.js.map +1 -0
- package/dist/prompt/function-defs/move-file.d.ts +25 -0
- package/dist/prompt/function-defs/move-file.js +26 -0
- package/dist/prompt/function-defs/move-file.js.map +1 -0
- package/dist/prompt/function-defs/patch-file.d.ts +25 -0
- package/dist/prompt/function-defs/patch-file.js +39 -0
- package/dist/prompt/function-defs/patch-file.js.map +1 -0
- package/dist/prompt/function-defs/resize-image.d.ts +36 -0
- package/dist/prompt/function-defs/resize-image.js +37 -0
- package/dist/prompt/function-defs/resize-image.js.map +1 -0
- package/dist/prompt/function-defs/split-image.d.ts +57 -0
- package/dist/prompt/function-defs/split-image.js +46 -0
- package/dist/prompt/function-defs/split-image.js.map +1 -0
- package/dist/prompt/function-defs/update-file.d.ts +25 -0
- package/dist/prompt/function-defs/update-file.js +26 -0
- package/dist/prompt/function-defs/update-file.js.map +1 -0
- package/dist/prompt/limits.d.ts +3 -0
- package/dist/prompt/limits.js +19 -0
- package/dist/prompt/limits.js.map +1 -0
- package/dist/prompt/limits.test.d.ts +1 -0
- package/dist/prompt/limits.test.js +35 -0
- package/dist/prompt/limits.test.js.map +1 -0
- package/dist/prompt/prompt-codegen.d.ts +9 -0
- package/dist/prompt/prompt-codegen.js +90 -0
- package/dist/prompt/prompt-codegen.js.map +1 -0
- package/dist/prompt/prompt-codegen.test.d.ts +1 -0
- package/dist/prompt/prompt-codegen.test.js +98 -0
- package/dist/prompt/prompt-codegen.test.js.map +1 -0
- package/dist/prompt/prompt-consts.d.ts +1 -0
- package/{src → dist}/prompt/prompt-consts.js +1 -0
- package/dist/prompt/prompt-consts.js.map +1 -0
- package/dist/prompt/prompt-service-ask-question.test.d.ts +3 -0
- package/dist/prompt/prompt-service-ask-question.test.js +142 -0
- package/dist/prompt/prompt-service-ask-question.test.js.map +1 -0
- package/dist/prompt/prompt-service.d.ts +28 -0
- package/dist/prompt/prompt-service.js +163 -0
- package/dist/prompt/prompt-service.js.map +1 -0
- package/dist/prompt/prompt-service.test.d.ts +1 -0
- package/dist/prompt/prompt-service.test.js +531 -0
- package/dist/prompt/prompt-service.test.js.map +1 -0
- package/dist/prompt/steps/step-ask-question.d.ts +6 -0
- package/dist/prompt/steps/step-ask-question.js +82 -0
- package/dist/prompt/steps/step-ask-question.js.map +1 -0
- package/dist/prompt/steps/step-generate-image.d.ts +2 -0
- package/dist/prompt/steps/step-generate-image.js +29 -0
- package/dist/prompt/steps/step-generate-image.js.map +1 -0
- package/dist/prompt/steps/step-validate-recover.d.ts +13 -0
- package/dist/prompt/steps/step-validate-recover.js +51 -0
- package/dist/prompt/steps/step-validate-recover.js.map +1 -0
- package/dist/prompt/steps/step-verify-patch.d.ts +7 -0
- package/dist/prompt/steps/step-verify-patch.js +41 -0
- package/dist/prompt/steps/step-verify-patch.js.map +1 -0
- package/dist/prompt/steps/steps-types.d.ts +4 -0
- package/dist/prompt/steps/steps-types.js +6 -0
- package/dist/prompt/steps/steps-types.js.map +1 -0
- package/dist/prompt/systemprompt.d.ts +3 -0
- package/dist/prompt/systemprompt.js +47 -0
- package/dist/prompt/systemprompt.js.map +1 -0
- package/dist/prompt/systemprompt.test.d.ts +3 -0
- package/dist/prompt/systemprompt.test.js +46 -0
- package/dist/prompt/systemprompt.test.js.map +1 -0
- package/package.json +15 -5
- package/bin/genaicode.js +0 -5
- package/bin/vertex-monkey-patch.cjs +0 -33
- package/src/ai-service/anthropic.js +0 -126
- package/src/ai-service/chat-gpt.js +0 -126
- package/src/ai-service/common.js +0 -49
- package/src/ai-service/common.test.js +0 -107
- package/src/ai-service/dall-e.js +0 -50
- package/src/ai-service/vertex-ai-claude.js +0 -99
- package/src/ai-service/vertex-ai-imagen.js +0 -78
- package/src/ai-service/vertex-ai.js +0 -156
- package/src/cli/cli-options.js +0 -132
- package/src/cli/cli-options.test.js +0 -50
- package/src/cli/cli-params.js +0 -114
- package/src/cli/cli-params.test.js +0 -43
- package/src/cli/service-autodetect.js +0 -11
- package/src/cli/service-autodetect.test.js +0 -43
- package/src/cli/validate-cli-params.js +0 -137
- package/src/cli/validate-cli-params.test.js +0 -134
- package/src/files/file-utils.js +0 -7
- package/src/files/file-utils.test.js +0 -21
- package/src/files/find-files.js +0 -86
- package/src/files/read-files.js +0 -65
- package/src/files/read-files.test.js +0 -103
- package/src/files/temp-buffer.js +0 -13
- package/src/files/update-files.js +0 -205
- package/src/images/ensure-alpha.js +0 -5
- package/src/images/imgly-remove-background.js +0 -23
- package/src/images/resize-image.js +0 -23
- package/src/images/split-image.js +0 -26
- package/src/main/codegen.js +0 -120
- package/src/main/codegen.test.js +0 -335
- package/src/main/config-lib.js +0 -33
- package/src/main/config-lib.test.js +0 -80
- package/src/prompt/function-calling-validate.js +0 -25
- package/src/prompt/function-defs/ask-question.js +0 -33
- package/src/prompt/function-defs/codegen-summary.js +0 -87
- package/src/prompt/function-defs/create-directory.js +0 -21
- package/src/prompt/function-defs/create-file.js +0 -26
- package/src/prompt/function-defs/delete-file.js +0 -21
- package/src/prompt/function-defs/download-file.js +0 -25
- package/src/prompt/function-defs/explanation.js +0 -17
- package/src/prompt/function-defs/generate-image.js +0 -51
- package/src/prompt/function-defs/get-image-assets.js +0 -21
- package/src/prompt/function-defs/get-source-code.js +0 -21
- package/src/prompt/function-defs/imgly-remove-background.js +0 -25
- package/src/prompt/function-defs/move-file.js +0 -25
- package/src/prompt/function-defs/patch-file.js +0 -39
- package/src/prompt/function-defs/resize-image.js +0 -36
- package/src/prompt/function-defs/split-image.js +0 -45
- package/src/prompt/function-defs/update-file.js +0 -26
- package/src/prompt/limits.js +0 -23
- package/src/prompt/limits.test.js +0 -40
- package/src/prompt/prompt-codegen.js +0 -106
- package/src/prompt/prompt-codegen.test.js +0 -116
- package/src/prompt/prompt-service-ask-question.test.js +0 -163
- package/src/prompt/prompt-service.js +0 -335
- package/src/prompt/prompt-service.test.js +0 -602
- package/src/prompt/systemprompt.js +0 -39
- package/src/prompt/systemprompt.test.js +0 -64
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { temperature, cheap, vision } from '../../cli/cli-params.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Function definition for codegenSummary
|
|
5
|
-
*/
|
|
6
|
-
export const codegenSummary = {
|
|
7
|
-
name: 'codegenSummary',
|
|
8
|
-
description:
|
|
9
|
-
'This function is called with a summary of proposed updates.' +
|
|
10
|
-
'Summary is a data structure(object) which contains:\n' +
|
|
11
|
-
'- `fileUpdates`: list of proposed file updates that will be subject to subsequent code generation request\n' +
|
|
12
|
-
'- `contextPaths`: list of file paths that make sense to use as a context for code generation requests.' +
|
|
13
|
-
'- `explanation`: general explanation of planned code generation updates\n' +
|
|
14
|
-
'It is crticially important to adhere to the schema of parameters',
|
|
15
|
-
parameters: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
contextPaths: {
|
|
19
|
-
type: 'array',
|
|
20
|
-
description:
|
|
21
|
-
'An array of absolute paths of files that should be used to provide context for the following updates. Context files could be for example the dependencies, or files that depend on one of the files that we want to update in the next step.',
|
|
22
|
-
items: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
fileUpdates: {
|
|
27
|
-
type: 'array',
|
|
28
|
-
description: 'An array of proposed file updates, each update is an object with several properties.',
|
|
29
|
-
items: {
|
|
30
|
-
type: 'object',
|
|
31
|
-
description:
|
|
32
|
-
'Proposed update of a file. The update is an object which contains properties like file path, update tool name, and few other important properties.',
|
|
33
|
-
properties: {
|
|
34
|
-
path: { type: 'string', description: 'An absolute path of the project file that will be updated' },
|
|
35
|
-
updateToolName: {
|
|
36
|
-
type: 'string',
|
|
37
|
-
enum: [
|
|
38
|
-
'createFile',
|
|
39
|
-
'updateFile',
|
|
40
|
-
'patchFile',
|
|
41
|
-
'deleteFile',
|
|
42
|
-
'createDirectory',
|
|
43
|
-
'moveFile',
|
|
44
|
-
'generateImage',
|
|
45
|
-
'downloadFile',
|
|
46
|
-
'splitImage',
|
|
47
|
-
'resizeImage',
|
|
48
|
-
'imglyRemoveBackground',
|
|
49
|
-
],
|
|
50
|
-
description: 'A name of the tool that will be used to perform the update.',
|
|
51
|
-
},
|
|
52
|
-
temperature: {
|
|
53
|
-
type: 'number',
|
|
54
|
-
description:
|
|
55
|
-
'Temperature parameter that will be used for LLM request. The value is adjusted to the characteristic of the update. If there is a need for a more creative solution, the value should be lower, but stil within [0.0, 2.0] range. The default value is: ' +
|
|
56
|
-
temperature,
|
|
57
|
-
},
|
|
58
|
-
cheap: {
|
|
59
|
-
type: 'boolean',
|
|
60
|
-
description:
|
|
61
|
-
'true value means that the prompt will be executed with cheaper model, which work faster, but provides lower quality results, so please use it only in situation when lower quality results are acceptable for the prompt. The default value is: ' +
|
|
62
|
-
!!cheap,
|
|
63
|
-
},
|
|
64
|
-
prompt: {
|
|
65
|
-
type: 'string',
|
|
66
|
-
description:
|
|
67
|
-
'Prompt that will be passed to the model request together with the tool request. It summarizes the planned changes for this particular file, so it should be detailed enough for the model to generate necessary changes.',
|
|
68
|
-
},
|
|
69
|
-
contextImageAssets: {
|
|
70
|
-
type: 'array',
|
|
71
|
-
description:
|
|
72
|
-
'A list of of absolute image asset paths that should be included to the context of LLM request.' +
|
|
73
|
-
'This parameter must be used if there is a need to analyze an image.',
|
|
74
|
-
items: { type: 'string' },
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
required: ['path', 'updateToolName', ...(vision ? ['contextImageAssets'] : [])],
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
explanation: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
description: 'Explanation of planned changes or explanation of reasoning for no code changes',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
required: ['fileUpdates', 'contextPaths'],
|
|
86
|
-
},
|
|
87
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for createDirectory
|
|
3
|
-
*/
|
|
4
|
-
export const createDirectory = {
|
|
5
|
-
name: 'createDirectory',
|
|
6
|
-
description: 'Create a new directory',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
filePath: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The directory path to create.',
|
|
13
|
-
},
|
|
14
|
-
explanation: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'The explanation of the reasoning behind creating this directory',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
required: ['filePath'],
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for createFile
|
|
3
|
-
*/
|
|
4
|
-
export const createFile = {
|
|
5
|
-
name: 'createFile',
|
|
6
|
-
description:
|
|
7
|
-
'Create a new file with specified content. The file will be created inside of project folder structure. This tool should not be used of creation if image files.',
|
|
8
|
-
parameters: {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
filePath: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
description: 'Path of the file that will be created, it must not be empty.',
|
|
14
|
-
},
|
|
15
|
-
newContent: {
|
|
16
|
-
type: 'string',
|
|
17
|
-
description: 'Content of the file that will be created, it must no be empty.',
|
|
18
|
-
},
|
|
19
|
-
explanation: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
description: 'The explanation of the reasoning behind creating this file',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
required: ['filePath', 'newContent'],
|
|
25
|
-
},
|
|
26
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for deleteFile
|
|
3
|
-
*/
|
|
4
|
-
export const deleteFile = {
|
|
5
|
-
name: 'deleteFile',
|
|
6
|
-
description: 'Delete a specified file from the application source code.',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
filePath: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The file path to delete.',
|
|
13
|
-
},
|
|
14
|
-
explanation: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'The explanation of the reasoning behind deleting this file',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
required: ['filePath'],
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for downloadFile
|
|
3
|
-
*/
|
|
4
|
-
export const downloadFile = {
|
|
5
|
-
name: 'downloadFile',
|
|
6
|
-
description: 'Download file from url, and save to file',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
filePath: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The file path to save the downloaded file.',
|
|
13
|
-
},
|
|
14
|
-
downloadUrl: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'The url of the file that will be used for downloading.',
|
|
17
|
-
},
|
|
18
|
-
explanation: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: 'The reasoning behind downloading this image.',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
required: ['filePath', 'downloadUrl'],
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for explanation
|
|
3
|
-
*/
|
|
4
|
-
export const explanation = {
|
|
5
|
-
name: 'explanation',
|
|
6
|
-
description: 'Explain the reasoning behind the suggested code changes or reasoning for lack of code changes',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
text: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The explanation text',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
required: ['text'],
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for generateImage
|
|
3
|
-
*/
|
|
4
|
-
export const generateImage = {
|
|
5
|
-
name: 'generateImage',
|
|
6
|
-
description: 'Generate an image using AI service and save it as a file.',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
prompt: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description:
|
|
13
|
-
'The prompt that will be used to generate the image. This prompt must be detailed, it will be used by image generation model.',
|
|
14
|
-
},
|
|
15
|
-
filePath: {
|
|
16
|
-
type: 'string',
|
|
17
|
-
description: 'The file path to save the generated image.',
|
|
18
|
-
},
|
|
19
|
-
contextImagePath: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
description:
|
|
22
|
-
'Path to a image file that will be used as a context for image generation. It is useful if there is a need to edit an image with genAI.',
|
|
23
|
-
},
|
|
24
|
-
size: {
|
|
25
|
-
type: 'object',
|
|
26
|
-
properties: {
|
|
27
|
-
width: {
|
|
28
|
-
type: 'number',
|
|
29
|
-
description: 'width of the image',
|
|
30
|
-
},
|
|
31
|
-
height: {
|
|
32
|
-
type: 'number',
|
|
33
|
-
description: 'height of the image',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
required: ['width', 'height'],
|
|
37
|
-
description: 'The size of the image to generate.',
|
|
38
|
-
},
|
|
39
|
-
cheap: {
|
|
40
|
-
type: 'boolean',
|
|
41
|
-
description:
|
|
42
|
-
'true value means that the prompt will be executed with cheaper model, which work faster, but provides lower quality results, so please use it only in situation when lower quality results are acceptable for the prompt.',
|
|
43
|
-
},
|
|
44
|
-
explanation: {
|
|
45
|
-
type: 'string',
|
|
46
|
-
description: 'The explanation of the reasoning behind generating this image',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
required: ['prompt', 'filePath', 'size', 'cheap'],
|
|
50
|
-
},
|
|
51
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for getImageAssets
|
|
3
|
-
*/
|
|
4
|
-
export const getImageAssets = {
|
|
5
|
-
name: 'getImageAssets',
|
|
6
|
-
description:
|
|
7
|
-
'This function returns a map of application image assets. This map contains absolute file path, and basic metadata information. It does not contain contents. Contents must be requested using dedicated tool.',
|
|
8
|
-
parameters: {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
filePaths: {
|
|
12
|
-
type: 'array',
|
|
13
|
-
description: 'An array of absolute paths of files that should be used to provided context.',
|
|
14
|
-
items: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
required: [],
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for getSourceCode
|
|
3
|
-
*/
|
|
4
|
-
export const getSourceCode = {
|
|
5
|
-
name: 'getSourceCode',
|
|
6
|
-
description:
|
|
7
|
-
'This function returns source code of the application in Map format, where absolute file path is the key, and the value is an object, where one of the properties may be the content of the file. Some keys may not provide content. This function can be called only once during the conversation, and only if suggested by the user.',
|
|
8
|
-
parameters: {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
filePaths: {
|
|
12
|
-
type: 'array',
|
|
13
|
-
description: 'An array of absolute paths of files that should be used to provided context.',
|
|
14
|
-
items: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
required: [],
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for imglyRemoveBackground
|
|
3
|
-
*/
|
|
4
|
-
export const imglyRemoveBackground = {
|
|
5
|
-
name: 'imglyRemoveBackground',
|
|
6
|
-
description: 'Removes background from an image using @imgly/background-removal-node',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
inputFilePath: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The file path of the input image.',
|
|
13
|
-
},
|
|
14
|
-
outputFilePath: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'The file path to save the output image with removed background.',
|
|
17
|
-
},
|
|
18
|
-
explanation: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: 'The explanation of the reasoning behind removing the background from this image',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
required: ['inputFilePath', 'outputFilePath'],
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for moveFile
|
|
3
|
-
*/
|
|
4
|
-
export const moveFile = {
|
|
5
|
-
name: 'moveFile',
|
|
6
|
-
description: 'Move a file from one location to another',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
source: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The current file path.',
|
|
13
|
-
},
|
|
14
|
-
destination: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'The new file path.',
|
|
17
|
-
},
|
|
18
|
-
explanation: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: 'The explanation of the reasoning behind moving this file',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
required: ['source', 'destination'],
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for patchFile
|
|
3
|
-
*/
|
|
4
|
-
export const patchFile = {
|
|
5
|
-
name: 'patchFile',
|
|
6
|
-
description:
|
|
7
|
-
'Partially update a file content. The file must already exists in the application source code. The function should be called only if there is a need to actually change something.',
|
|
8
|
-
parameters: {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
filePath: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
description: 'The file path to patch.',
|
|
14
|
-
},
|
|
15
|
-
patch: {
|
|
16
|
-
type: 'string',
|
|
17
|
-
description: `Modification to the file expressed in patch format. Example patch:
|
|
18
|
-
|
|
19
|
-
\`\`\`
|
|
20
|
-
Index: filename.js
|
|
21
|
-
===================================================================
|
|
22
|
-
--- filename.js
|
|
23
|
-
+++ filename.js
|
|
24
|
-
@@ -1,2 +1,3 @@
|
|
25
|
-
line1
|
|
26
|
-
+line3
|
|
27
|
-
line2
|
|
28
|
-
\
|
|
29
|
-
\`\`\`
|
|
30
|
-
`,
|
|
31
|
-
},
|
|
32
|
-
explanation: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
description: 'The explanation of the reasoning behind the suggested code changes for this file',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
required: ['filePath', 'patch'],
|
|
38
|
-
},
|
|
39
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for resizeImage
|
|
3
|
-
*/
|
|
4
|
-
export const resizeImage = {
|
|
5
|
-
name: 'resizeImage',
|
|
6
|
-
description: 'Resize image to the desired size',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
filePath: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The file path of the image.',
|
|
13
|
-
},
|
|
14
|
-
size: {
|
|
15
|
-
type: 'object',
|
|
16
|
-
properties: {
|
|
17
|
-
width: {
|
|
18
|
-
type: 'number',
|
|
19
|
-
description: 'width of the image',
|
|
20
|
-
},
|
|
21
|
-
height: {
|
|
22
|
-
type: 'number',
|
|
23
|
-
description: 'height of the image',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
required: ['width', 'height'],
|
|
27
|
-
description: 'The size of the image to generate.',
|
|
28
|
-
},
|
|
29
|
-
explanation: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
description: 'The explanation of the reasoning behind removing the background from this image',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
required: ['filePath', 'size'],
|
|
35
|
-
},
|
|
36
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for splitImage
|
|
3
|
-
*/
|
|
4
|
-
export const splitImage = {
|
|
5
|
-
name: 'splitImage',
|
|
6
|
-
description: 'Split an image into multiple parts and save them as separate files.',
|
|
7
|
-
parameters: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
inputFilePath: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The file path of the input image to be split.',
|
|
13
|
-
},
|
|
14
|
-
parts: {
|
|
15
|
-
type: 'array',
|
|
16
|
-
items: {
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
rect: {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
x: { type: 'number', description: 'The x-coordinate of the top-left corner of the rectangle.' },
|
|
23
|
-
y: { type: 'number', description: 'The y-coordinate of the top-left corner of the rectangle.' },
|
|
24
|
-
width: { type: 'number', description: 'The width of the rectangle.' },
|
|
25
|
-
height: { type: 'number', description: 'The height of the rectangle.' },
|
|
26
|
-
},
|
|
27
|
-
required: ['x', 'y', 'width', 'height'],
|
|
28
|
-
},
|
|
29
|
-
outputFilePath: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
description: 'The file path to save the extracted part of the image.',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
required: ['rect', 'outputFilePath'],
|
|
35
|
-
},
|
|
36
|
-
description: 'An array of parts to extract from the image, each with a rectangle and output file path.',
|
|
37
|
-
},
|
|
38
|
-
explanation: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'The explanation of the reasoning behind splitting this image',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
required: ['inputFilePath', 'parts'],
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function definition for updateFile
|
|
3
|
-
*/
|
|
4
|
-
export const updateFile = {
|
|
5
|
-
name: 'updateFile',
|
|
6
|
-
description:
|
|
7
|
-
'Update a file with new content. The file must already exists in the application source code. The function should be called only if there is a need to actually change something.',
|
|
8
|
-
parameters: {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
filePath: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
description: 'The file path to update.',
|
|
14
|
-
},
|
|
15
|
-
newContent: {
|
|
16
|
-
type: 'string',
|
|
17
|
-
description: 'The content to update the file with. Must not be empty.',
|
|
18
|
-
},
|
|
19
|
-
explanation: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
description: 'The explanation of the reasoning behind the suggested code changes for this file',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
required: ['filePath', 'newContent'],
|
|
25
|
-
},
|
|
26
|
-
};
|
package/src/prompt/limits.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
|
|
3
|
-
const SYSTEM_PROMPT_LIMIT = 200;
|
|
4
|
-
const CODEGEN_PROMPT_LIMIT = 500;
|
|
5
|
-
const SOURCE_CODE_LIMIT = 20000;
|
|
6
|
-
|
|
7
|
-
function verifyPromptLimit(promptType, prompt, limit) {
|
|
8
|
-
const tokenCount = prompt.split(/\s+/).length;
|
|
9
|
-
console.log(`${promptType} prompt token count: ${tokenCount}`);
|
|
10
|
-
assert(tokenCount <= limit, `Token limit exceeded: ${tokenCount} > ${limit}`);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function verifySystemPromptLimit(systemPrompt) {
|
|
14
|
-
verifyPromptLimit('system', systemPrompt, SYSTEM_PROMPT_LIMIT);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function verifyCodegenPromptLimit(codeGenPrompt) {
|
|
18
|
-
verifyPromptLimit('codegen', codeGenPrompt, CODEGEN_PROMPT_LIMIT);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function verifySourceCodeLimit(sourceCode) {
|
|
22
|
-
verifyPromptLimit('sourceCode', sourceCode, SOURCE_CODE_LIMIT);
|
|
23
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { verifySystemPromptLimit, verifyCodegenPromptLimit, verifySourceCodeLimit } from './limits.js';
|
|
3
|
-
|
|
4
|
-
describe('Prompt Limits', () => {
|
|
5
|
-
describe('verifySystemPromptLimit', () => {
|
|
6
|
-
it('should not throw for a prompt within the limit', () => {
|
|
7
|
-
const validPrompt = 'A '.repeat(200 - 1);
|
|
8
|
-
expect(() => verifySystemPromptLimit(validPrompt)).not.toThrow();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should throw for a prompt exceeding the limit', () => {
|
|
12
|
-
const invalidPrompt = 'A '.repeat(201);
|
|
13
|
-
expect(() => verifySystemPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 202 > 200');
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('verifyCodegenPromptLimit', () => {
|
|
18
|
-
it('should not throw for a prompt within the limit', () => {
|
|
19
|
-
const validPrompt = 'B '.repeat(200 - 1);
|
|
20
|
-
expect(() => verifyCodegenPromptLimit(validPrompt)).not.toThrow();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should throw for a prompt exceeding the limit', () => {
|
|
24
|
-
const invalidPrompt = 'B '.repeat(501);
|
|
25
|
-
expect(() => verifyCodegenPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 502 > 500');
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe('verifySourceCodeLimit', () => {
|
|
30
|
-
it('should not throw for source code within the limit', () => {
|
|
31
|
-
const validSourceCode = 'C '.repeat(20000 - 1);
|
|
32
|
-
expect(() => verifySourceCodeLimit(validSourceCode)).not.toThrow();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should throw for source code exceeding the limit', () => {
|
|
36
|
-
const invalidSourceCode = 'C '.repeat(20001);
|
|
37
|
-
expect(() => verifySourceCodeLimit(invalidSourceCode)).toThrow('Token limit exceeded: 20002 > 20000');
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
import { getSourceCode } from '../files/read-files.js';
|
|
3
|
-
import { CODEGEN_TRIGGER } from './prompt-consts.js';
|
|
4
|
-
import {
|
|
5
|
-
considerAllFiles,
|
|
6
|
-
allowFileCreate,
|
|
7
|
-
allowFileDelete,
|
|
8
|
-
allowDirectoryCreate,
|
|
9
|
-
allowFileMove,
|
|
10
|
-
explicitPrompt,
|
|
11
|
-
dependencyTree,
|
|
12
|
-
verbosePrompt,
|
|
13
|
-
vision,
|
|
14
|
-
imagen,
|
|
15
|
-
} from '../cli/cli-params.js';
|
|
16
|
-
import { getDependencyList } from '../files/find-files.js';
|
|
17
|
-
import { verifyCodegenPromptLimit } from './limits.js';
|
|
18
|
-
|
|
19
|
-
/** Get codegen prompt */
|
|
20
|
-
export function getCodeGenPrompt() {
|
|
21
|
-
let codeGenFiles;
|
|
22
|
-
if (considerAllFiles) {
|
|
23
|
-
codeGenFiles = Object.keys(getSourceCode());
|
|
24
|
-
} else {
|
|
25
|
-
codeGenFiles = Object.entries(getSourceCode())
|
|
26
|
-
.filter(([, { content }]) => content?.match(new RegExp("([^'^`]+)" + CODEGEN_TRIGGER)))
|
|
27
|
-
.map(([path]) => path);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Add logic to consider dependency tree
|
|
31
|
-
if (dependencyTree) {
|
|
32
|
-
assert(codeGenFiles.length > 0, `You must use ${CODEGEN_TRIGGER} together with --dependency-tree`);
|
|
33
|
-
|
|
34
|
-
const dependencyTreeFiles = new Set();
|
|
35
|
-
codeGenFiles
|
|
36
|
-
.map(getDependencyList)
|
|
37
|
-
.flat()
|
|
38
|
-
.forEach((key) => dependencyTreeFiles.add(key));
|
|
39
|
-
codeGenFiles = Array.from(dependencyTreeFiles);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const codeGenPrompt =
|
|
43
|
-
(explicitPrompt ? explicitPrompt + '\n\n' : '') +
|
|
44
|
-
`${
|
|
45
|
-
considerAllFiles
|
|
46
|
-
? codeGenFiles.length > 0
|
|
47
|
-
? `I have marked some files with the ${CODEGEN_TRIGGER} fragments:\n${codeGenFiles.join('\n')}`
|
|
48
|
-
: `No files are marked with ${CODEGEN_TRIGGER} fragment, so you can consider doing changes in any file.`
|
|
49
|
-
: `Generate updates only for the following files:\n${codeGenFiles.join('\n')}`
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
${
|
|
53
|
-
considerAllFiles
|
|
54
|
-
? 'You are allowed to modify all files in the application regardless if they contain codegen fragments or not.'
|
|
55
|
-
: 'Do not modify files which do not contain the fragments.'
|
|
56
|
-
}
|
|
57
|
-
${allowFileCreate ? 'You are allowed to create new files.' : 'Do not create new files.'}
|
|
58
|
-
${
|
|
59
|
-
allowFileDelete
|
|
60
|
-
? 'You are allowed to delete files, in such case add empty string as content.'
|
|
61
|
-
: 'Do not delete files.'
|
|
62
|
-
}
|
|
63
|
-
${allowDirectoryCreate ? 'You are allowed to create new directories.' : 'Do not create new directories.'}
|
|
64
|
-
${allowFileMove ? 'You are allowed to move files.' : 'Do not move files.'}
|
|
65
|
-
${vision ? 'You are allowed to analyze image assets.' : 'Do not analyze image assets.'}
|
|
66
|
-
${imagen ? 'You are allowed to generate images.' : 'You are not allowed to generate images.'}
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
if (verbosePrompt) {
|
|
70
|
-
console.log('Code gen prompt:');
|
|
71
|
-
console.log(codeGenPrompt);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
verifyCodegenPromptLimit(codeGenPrompt);
|
|
75
|
-
|
|
76
|
-
return codeGenPrompt;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** Get lint fix prompt */
|
|
80
|
-
export function getLintFixPrompt(command, stdout, stderr) {
|
|
81
|
-
const lintFixPrompt = `The following lint errors were encountered after the initial code generation:
|
|
82
|
-
|
|
83
|
-
Lint command: ${command}
|
|
84
|
-
Lint command stdout:
|
|
85
|
-
|
|
86
|
-
\`\`\`
|
|
87
|
-
${stdout}
|
|
88
|
-
\`\`\`
|
|
89
|
-
|
|
90
|
-
Lint command stderr:
|
|
91
|
-
|
|
92
|
-
\`\`\`
|
|
93
|
-
${stderr}
|
|
94
|
-
\`\`\`
|
|
95
|
-
|
|
96
|
-
Please suggest changes to fix these lint errors.`;
|
|
97
|
-
|
|
98
|
-
if (verbosePrompt) {
|
|
99
|
-
console.log('Lint fix prompt:');
|
|
100
|
-
console.log(lintFixPrompt);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
verifyCodegenPromptLimit(lintFixPrompt);
|
|
104
|
-
|
|
105
|
-
return lintFixPrompt;
|
|
106
|
-
}
|