genaicode 0.9.6 → 0.10.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.
Files changed (165) hide show
  1. package/dist/ai-service/ai-studio.d.ts +1 -1
  2. package/dist/ai-service/ai-studio.js +114 -31
  3. package/dist/ai-service/ai-studio.js.map +1 -1
  4. package/dist/ai-service/anthropic.js +64 -28
  5. package/dist/ai-service/anthropic.js.map +1 -1
  6. package/dist/ai-service/common-types.d.ts +28 -7
  7. package/dist/ai-service/local-llm.d.ts +6 -0
  8. package/dist/ai-service/local-llm.js +77 -0
  9. package/dist/ai-service/local-llm.js.map +1 -0
  10. package/dist/ai-service/openai.d.ts +3 -13
  11. package/dist/ai-service/openai.js +107 -51
  12. package/dist/ai-service/openai.js.map +1 -1
  13. package/dist/ai-service/service-configurations-types.d.ts +14 -4
  14. package/dist/ai-service/service-configurations-types.js +0 -4
  15. package/dist/ai-service/service-configurations-types.js.map +1 -1
  16. package/dist/ai-service/service-configurations.d.ts +9 -1
  17. package/dist/ai-service/service-configurations.js +108 -12
  18. package/dist/ai-service/service-configurations.js.map +1 -1
  19. package/dist/ai-service/vertex-ai-claude.d.ts +1 -1
  20. package/dist/ai-service/vertex-ai-claude.js +80 -39
  21. package/dist/ai-service/vertex-ai-claude.js.map +1 -1
  22. package/dist/ai-service/vertex-ai.d.ts +1 -1
  23. package/dist/ai-service/vertex-ai.js +261 -155
  24. package/dist/ai-service/vertex-ai.js.map +1 -1
  25. package/dist/cli/cli-options.js +1 -1
  26. package/dist/cli/cli-options.js.map +1 -1
  27. package/dist/cli/validate-cli-params.js +1 -1
  28. package/dist/cli/validate-cli-params.js.map +1 -1
  29. package/dist/main/codegen-utils.js +9 -1
  30. package/dist/main/codegen-utils.js.map +1 -1
  31. package/dist/main/codegen.js +2 -0
  32. package/dist/main/codegen.js.map +1 -1
  33. package/dist/main/common/user-actions.d.ts +2 -0
  34. package/dist/main/common/user-actions.js.map +1 -1
  35. package/dist/main/config-schema.js +16 -0
  36. package/dist/main/config-schema.js.map +1 -1
  37. package/dist/main/config-types.d.ts +15 -0
  38. package/dist/main/config.js +1 -0
  39. package/dist/main/config.js.map +1 -1
  40. package/dist/main/interactive/select-ai-service.js +1 -0
  41. package/dist/main/interactive/select-ai-service.js.map +1 -1
  42. package/dist/main/plugin-loader.d.ts +1 -2
  43. package/dist/main/plugin-loader.js.map +1 -1
  44. package/dist/main/ui/backend/endpoints/question-endpoint.js +34 -3
  45. package/dist/main/ui/backend/endpoints/question-endpoint.js.map +1 -1
  46. package/dist/main/ui/backend/service.d.ts +6 -5
  47. package/dist/main/ui/backend/service.js +54 -17
  48. package/dist/main/ui/backend/service.js.map +1 -1
  49. package/dist/main/ui/common/api-types.d.ts +1 -0
  50. package/dist/main/ui/frontend/assets/index-BlVGo0E6.js +1902 -0
  51. package/dist/main/ui/frontend/index.html +1 -1
  52. package/dist/project-profiles/types.d.ts +1 -1
  53. package/dist/project-profiles/types.js +1 -1
  54. package/dist/project-profiles/types.js.map +1 -1
  55. package/dist/prompt/function-calling.js +6 -0
  56. package/dist/prompt/function-calling.js.map +1 -1
  57. package/dist/prompt/function-defs/ask-question.js +8 -4
  58. package/dist/prompt/function-defs/ask-question.js.map +1 -1
  59. package/dist/prompt/function-defs/conversation-summary.d.ts +2 -0
  60. package/dist/prompt/function-defs/conversation-summary.js +15 -0
  61. package/dist/prompt/function-defs/conversation-summary.js.map +1 -0
  62. package/dist/prompt/function-defs/explore-external-directories.d.ts +16 -0
  63. package/dist/prompt/function-defs/explore-external-directories.js +48 -0
  64. package/dist/prompt/function-defs/explore-external-directories.js.map +1 -0
  65. package/dist/prompt/function-defs/read-external-files.d.ts +9 -0
  66. package/dist/prompt/function-defs/read-external-files.js +30 -0
  67. package/dist/prompt/function-defs/read-external-files.js.map +1 -0
  68. package/dist/prompt/limits.js +1 -1
  69. package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.js +23 -18
  70. package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.js.map +1 -1
  71. package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.js +60 -28
  72. package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.js.map +1 -1
  73. package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js +76 -73
  74. package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js.map +1 -1
  75. package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.js +1 -1
  76. package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.js.map +1 -1
  77. package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.d.ts +2 -0
  78. package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.js +277 -0
  79. package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.js.map +1 -0
  80. package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.js +13 -1
  81. package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.js.map +1 -1
  82. package/dist/prompt/steps/step-ask-question/handlers/handle-generate-image.js +13 -1
  83. package/dist/prompt/steps/step-ask-question/handlers/handle-generate-image.js.map +1 -1
  84. package/dist/prompt/steps/step-ask-question/handlers/handle-lint.d.ts +1 -1
  85. package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js +54 -61
  86. package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js.map +1 -1
  87. package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js +22 -10
  88. package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js.map +1 -1
  89. package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.js +13 -1
  90. package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.js.map +1 -1
  91. package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.js +13 -1
  92. package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.js.map +1 -1
  93. package/dist/prompt/steps/step-ask-question/handlers/handle-read-external-files.d.ts +2 -0
  94. package/dist/prompt/steps/step-ask-question/handlers/handle-read-external-files.js +144 -0
  95. package/dist/prompt/steps/step-ask-question/handlers/handle-read-external-files.js.map +1 -0
  96. package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js +27 -6
  97. package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js.map +1 -1
  98. package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.js +13 -1
  99. package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.js.map +1 -1
  100. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.js +14 -5
  101. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.js.map +1 -1
  102. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.js +26 -2
  103. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.js.map +1 -1
  104. package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.js +13 -1
  105. package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.js.map +1 -1
  106. package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js +14 -2
  107. package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js.map +1 -1
  108. package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js +1 -0
  109. package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js.map +1 -1
  110. package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js +59 -60
  111. package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js.map +1 -1
  112. package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +5 -1
  113. package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +2 -0
  114. package/dist/prompt/steps/step-ask-question/step-ask-question.js +14 -7
  115. package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
  116. package/dist/prompt/steps/step-codegen-planning.js +14 -5
  117. package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
  118. package/dist/prompt/steps/step-context-compression.js +14 -5
  119. package/dist/prompt/steps/step-context-compression.js.map +1 -1
  120. package/dist/prompt/steps/step-context-optimization.js +10 -5
  121. package/dist/prompt/steps/step-context-optimization.js.map +1 -1
  122. package/dist/prompt/steps/step-generate-codegen-summary.js +14 -5
  123. package/dist/prompt/steps/step-generate-codegen-summary.js.map +1 -1
  124. package/dist/prompt/steps/step-generate-summary.d.ts +6 -0
  125. package/dist/prompt/steps/step-generate-summary.js +36 -16
  126. package/dist/prompt/steps/step-generate-summary.js.map +1 -1
  127. package/dist/prompt/steps/step-history-update.js +14 -5
  128. package/dist/prompt/steps/step-history-update.js.map +1 -1
  129. package/dist/prompt/steps/step-process-file-updates.js +10 -5
  130. package/dist/prompt/steps/step-process-file-updates.js.map +1 -1
  131. package/dist/prompt/steps/step-summarization.js +14 -2
  132. package/dist/prompt/steps/step-summarization.js.map +1 -1
  133. package/dist/prompt/steps/step-validate-recover.d.ts +2 -4
  134. package/dist/prompt/steps/step-validate-recover.js +18 -9
  135. package/dist/prompt/steps/step-validate-recover.js.map +1 -1
  136. package/dist/prompt/steps/step-verify-patch.js +14 -5
  137. package/dist/prompt/steps/step-verify-patch.js.map +1 -1
  138. package/dist/prompt/systemprompt.js +5 -3
  139. package/dist/prompt/systemprompt.js.map +1 -1
  140. package/package.json +4 -4
  141. package/dist/main/ui/frontend/assets/index-DI1ngpa2.js +0 -1840
  142. package/dist/prompt/steps/step-ask-question/handlers/code-generation.d.ts +0 -4
  143. package/dist/prompt/steps/step-ask-question/handlers/code-generation.js +0 -167
  144. package/dist/prompt/steps/step-ask-question/handlers/code-generation.js.map +0 -1
  145. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +0 -2
  146. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +0 -34
  147. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +0 -1
  148. package/dist/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +0 -2
  149. package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +0 -32
  150. package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +0 -1
  151. package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.d.ts +0 -1
  152. package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.js +0 -251
  153. package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.js.map +0 -1
  154. package/dist/prompt/steps/step-ask-question/handlers/lint.d.ts +0 -6
  155. package/dist/prompt/steps/step-ask-question/handlers/lint.js +0 -103
  156. package/dist/prompt/steps/step-ask-question/handlers/lint.js.map +0 -1
  157. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +0 -2
  158. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +0 -82
  159. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +0 -1
  160. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +0 -8
  161. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +0 -179
  162. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +0 -1
  163. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +0 -2
  164. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js +0 -69
  165. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +0 -1
@@ -1,4 +0,0 @@
1
- import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';
2
- export declare const CODEGEN_SUMMARY_GENERATED_MESSAGE = "Codegen summary is generated. Would you like to proceed with the code changes?";
3
- export declare const CODEGEN_SUMMARY_APPROVED = "Accept codegen summary and continue";
4
- export declare function handleCodeGeneration({ generateContentFn, generateImageFn, waitIfPaused, prompt, options, }: ActionHandlerProps): Promise<ActionResult>;
@@ -1,167 +0,0 @@
1
- import { putAssistantMessage, putSystemMessage, putUserMessage } from '../../../../main/common/content-bus.js';
2
- import { askUserForConfirmation, askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';
3
- import { getFunctionDefs } from '../../../function-calling.js';
4
- import { CODEGEN_SUMMARY_PROMPT } from '../../../static-prompts.js';
5
- import { executeStepCodegenPlanning } from '../../step-codegen-planning.js';
6
- import { generateCodegenSummary } from '../../step-generate-codegen-summary.js';
7
- import { processFileUpdates } from '../../step-process-file-updates.js';
8
- import { StepResult } from '../../steps-types.js';
9
- import { updateFiles } from '../../../../files/update-files.js';
10
- import { executeStepContextCompression } from '../../step-context-compression.js';
11
- export const CODEGEN_SUMMARY_GENERATED_MESSAGE = 'Codegen summary is generated. Would you like to proceed with the code changes?';
12
- export const CODEGEN_SUMMARY_APPROVED = 'Accept codegen summary and continue';
13
- export async function handleCodeGeneration({ generateContentFn, generateImageFn, waitIfPaused, prompt, options, }) {
14
- const planningResult = await executeStepCodegenPlanning(generateContentFn, prompt, options);
15
- if (planningResult === StepResult.BREAK) {
16
- return {
17
- breakLoop: true,
18
- items: [],
19
- };
20
- }
21
- // Ask user to confirm the planning result
22
- const planningConfirmation = await askUserForConfirmationWithAnswer(CODEGEN_SUMMARY_PROMPT, 'Accept plan', 'Reject plan', true, options);
23
- if (!planningConfirmation.confirmed) {
24
- // User rejected the planning, return to conversation
25
- return {
26
- breakLoop: false,
27
- items: [
28
- {
29
- assistant: {
30
- type: 'assistant',
31
- text: CODEGEN_SUMMARY_PROMPT,
32
- functionCalls: [],
33
- },
34
- user: {
35
- type: 'user',
36
- text: planningConfirmation.answer || 'Planning rejected. Returning to conversation.',
37
- },
38
- },
39
- ],
40
- };
41
- }
42
- // Add user's planning confirmation answer to prompt history
43
- const assistantItem = {
44
- type: 'assistant',
45
- text: CODEGEN_SUMMARY_PROMPT,
46
- };
47
- putAssistantMessage(assistantItem.text, undefined, undefined, undefined, assistantItem);
48
- prompt.push(assistantItem);
49
- const userItem = {
50
- type: 'user',
51
- text: 'Accept planning and continue.' + (planningConfirmation.answer ? `\n\n${planningConfirmation.answer}` : ''),
52
- };
53
- putUserMessage(userItem.text, undefined, undefined, undefined, userItem);
54
- prompt.push(userItem);
55
- try {
56
- // First step: Generate and validate codegen summary
57
- const { codegenSummaryRequest, baseResult } = await generateCodegenSummary(generateContentFn, prompt, getFunctionDefs(), options);
58
- // Ask user to confirm the codegen summary
59
- const codegenSummaryConfirmation = await askUserForConfirmationWithAnswer(CODEGEN_SUMMARY_GENERATED_MESSAGE, 'Accept codegen summary', 'Reject codegen summary', true, options);
60
- if (!codegenSummaryConfirmation.confirmed) {
61
- // User rejected the codegen summary, return to conversation
62
- return {
63
- breakLoop: false,
64
- items: [
65
- {
66
- assistant: {
67
- type: 'assistant',
68
- text: CODEGEN_SUMMARY_GENERATED_MESSAGE,
69
- },
70
- user: {
71
- type: 'user',
72
- text: codegenSummaryConfirmation.answer || 'Codegen summary rejected. Returning to conversation.',
73
- },
74
- },
75
- ],
76
- };
77
- }
78
- putAssistantMessage(CODEGEN_SUMMARY_GENERATED_MESSAGE);
79
- putUserMessage(codegenSummaryConfirmation.answer || CODEGEN_SUMMARY_APPROVED);
80
- prompt.push({
81
- type: 'assistant',
82
- text: CODEGEN_SUMMARY_GENERATED_MESSAGE,
83
- }, {
84
- type: 'user',
85
- text: codegenSummaryConfirmation.answer || CODEGEN_SUMMARY_APPROVED,
86
- });
87
- // Second step: Process file updates
88
- const updateResults = await processFileUpdates(generateContentFn, prompt, getFunctionDefs(), options, codegenSummaryRequest, waitIfPaused, generateImageFn);
89
- const functionCalls = [...baseResult, ...updateResults];
90
- const confirmApply = await askUserForConfirmationWithAnswer('Code changes are generated, now what?', 'Apply code changes', 'Reject code changes', true, options);
91
- putAssistantMessage('Code changes are generated, now what?');
92
- if (confirmApply.confirmed) {
93
- putUserMessage(confirmApply.answer || 'Apply code changes.');
94
- prompt.push({
95
- type: 'assistant',
96
- text: 'Code changes are generated, now what?',
97
- }, {
98
- type: 'user',
99
- text: 'Apply code changes. ' + confirmApply.answer,
100
- });
101
- putSystemMessage('Applying code changes...');
102
- if (options.dryRun) {
103
- putSystemMessage('Dry run mode, not updating files');
104
- }
105
- else {
106
- // Apply the code changes
107
- await updateFiles(functionCalls.filter((call) => call.name !== 'explanation' && call.name !== 'getSourceCode' && call.name !== 'codegenSummary'), options);
108
- putSystemMessage('Code changes applied successfully');
109
- }
110
- }
111
- else {
112
- putUserMessage(confirmApply.answer || 'Reject code changes.');
113
- putSystemMessage('Rejecting code changes...');
114
- prompt.push({
115
- type: 'assistant',
116
- text: 'Code changes are generated, now what?',
117
- }, {
118
- type: 'user',
119
- text: 'Reject code changes. ' + confirmApply.answer,
120
- });
121
- }
122
- if (!(await askUserForConfirmation('Code generation completed, do you want to continue conversation?', false, options, 'Continue conversation', 'End conversation')).confirmed) {
123
- return {
124
- breakLoop: true,
125
- stepResult: functionCalls,
126
- items: [],
127
- };
128
- }
129
- putSystemMessage('Continuing conversation...');
130
- const compressionResult = await executeStepContextCompression(generateContentFn, prompt, options);
131
- prompt.push({
132
- type: 'assistant',
133
- text: `Code generation completed, changes ${confirmApply.confirmed ? 'were accepted and applied' : 'changes were rejected and not applied'}. Should we continue the conversation?`,
134
- }, {
135
- type: 'user',
136
- text: 'Thank you for doing the code generation, now lets continue the conversation.',
137
- });
138
- return {
139
- breakLoop: compressionResult !== StepResult.CONTINUE,
140
- stepResult: functionCalls,
141
- items: [],
142
- };
143
- }
144
- catch (error) {
145
- putSystemMessage(`Error during code generation: ${error instanceof Error ? error.message : 'Unknown error'}`);
146
- const tryAgainConfirm = await askUserForConfirmation('An error occurred during code generation. Would you like to try again or continue the conversation?', false, options, 'Try again', 'Continue conversation');
147
- return {
148
- breakLoop: !tryAgainConfirm.confirmed,
149
- items: [
150
- {
151
- assistant: {
152
- type: 'assistant',
153
- text: 'An error occurred during code generation. Would you like to try again or continue the conversation?',
154
- functionCalls: [],
155
- },
156
- user: {
157
- type: 'user',
158
- text: tryAgainConfirm.confirmed
159
- ? 'Lets continue the conversation'
160
- : 'Error occurred during code generation.',
161
- },
162
- },
163
- ],
164
- };
165
- }
166
- }
167
- //# sourceMappingURL=code-generation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AACnH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF,MAAM,CAAC,MAAM,iCAAiC,GAC5C,gFAAgF,CAAC;AAEnF,MAAM,CAAC,MAAM,wBAAwB,GAAG,qCAAqC,CAAC;AAE9E,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,EACzC,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,MAAM,EACN,OAAO,GACY;IACnB,MAAM,cAAc,GAAG,MAAM,0BAA0B,CAAC,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5F,IAAI,cAAc,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC;QACxC,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED,0CAA0C;IAC1C,MAAM,oBAAoB,GAAG,MAAM,gCAAgC,CACjE,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,IAAI,EACJ,OAAO,CACR,CAAC;IAEF,IAAI,CAAC,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CAAC,IAAI,CACT;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,sCAAsC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,uCAAuC,wCAAwC;SACnL,EACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,8EAA8E;SACrF,CACF,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,iBAAiB,KAAK,UAAU,CAAC,QAAQ;YACpD,UAAU,EAAE,aAAa;YACzB,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAE9G,MAAM,eAAe,GAAG,MAAM,sBAAsB,CAClD,qGAAqG,EACrG,KAAK,EACL,OAAO,EACP,WAAW,EACX,uBAAuB,CACxB,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,CAAC,eAAe,CAAC,SAAS;YACrC,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,qGAAqG;wBAC3G,aAAa,EAAE,EAAE;qBAClB;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,eAAe,CAAC,SAAS;4BAC7B,CAAC,CAAC,gCAAgC;4BAClC,CAAC,CAAC,wCAAwC;qBAC7C;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';
2
- export declare function handleConfirmCodeGeneration({ askQuestionCall, options, }: ActionHandlerProps): Promise<ActionResult>;
@@ -1,34 +0,0 @@
1
- import { putSystemMessage } from '../../../../main/common/content-bus.js';
2
- import { askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';
3
- export async function handleConfirmCodeGeneration({ askQuestionCall, options, }) {
4
- const userConfirmation = await askUserForConfirmationWithAnswer('The assistant is ready to start code generation. Do you want to proceed?', 'Start code generation', 'Continue conversation', true, options);
5
- if (userConfirmation.confirmed) {
6
- putSystemMessage('Proceeding with code generation.');
7
- return {
8
- breakLoop: true,
9
- executeCodegen: true,
10
- items: [
11
- {
12
- assistant: { type: 'assistant', text: askQuestionCall.args?.message ?? '', functionCalls: [] },
13
- user: { type: 'user', text: userConfirmation.answer || 'Confirmed. Proceed with code generation.' },
14
- },
15
- ],
16
- };
17
- }
18
- else {
19
- putSystemMessage('Declined. Continuing the conversation.');
20
- return {
21
- breakLoop: false,
22
- items: [
23
- {
24
- assistant: { type: 'assistant', text: askQuestionCall.args?.message ?? '' },
25
- user: {
26
- type: 'user',
27
- text: userConfirmation.answer || 'Declined. Please continue the conversation.',
28
- },
29
- },
30
- ],
31
- };
32
- }
33
- }
34
- //# sourceMappingURL=confirm-code-generation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"confirm-code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/confirm-code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAG3F,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,EAChD,eAAe,EACf,OAAO,GACY;IACnB,MAAM,gBAAgB,GAAG,MAAM,gCAAgC,CAC7D,0EAA0E,EAC1E,uBAAuB,EACvB,uBAAuB,EACvB,IAAI,EACJ,OAAO,CACR,CAAC;IACF,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAC/B,gBAAgB,CAAC,kCAAkC,CAAC,CAAC;QACrD,OAAO;YACL,SAAS,EAAE,IAAI;YACf,cAAc,EAAE,IAAI;YACpB,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;oBAC9F,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,IAAI,0CAA0C,EAAE;iBACpG;aACF;SACF,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,gBAAgB,CAAC,wCAAwC,CAAC,CAAC;QAC3D,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE;oBAC3E,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,gBAAgB,CAAC,MAAM,IAAI,6CAA6C;qBAC/E;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';
2
- export declare function handleContextOptimization({ askQuestionCall, prompt, options, generateContentFn, }: ActionHandlerProps): Promise<ActionResult>;
@@ -1,32 +0,0 @@
1
- import { refreshFiles } from '../../../../files/find-files.js';
2
- import { putSystemMessage } from '../../../../main/common/content-bus.js';
3
- import { askUserForConfirmation } from '../../../../main/common/user-actions.js';
4
- import { executeStepContextOptimization } from '../../step-context-optimization.js';
5
- export async function handleContextOptimization({ askQuestionCall, prompt, options, generateContentFn, }) {
6
- const userConfirmation = await askUserForConfirmation('The assistant suggests optimizing the context to reduce token usage, cost, and latency. Do you want to proceed?', false, options);
7
- const user = {
8
- type: 'user',
9
- text: userConfirmation ? 'Context optimization applied.' : 'Context optimization not applied.',
10
- };
11
- const assistant = {
12
- type: 'assistant',
13
- text: askQuestionCall.args?.message ?? '',
14
- };
15
- if (userConfirmation.confirmed) {
16
- // the request may be caused be an appearance of a new file, so lets refresh
17
- refreshFiles();
18
- // Execute context optimization step
19
- putSystemMessage('Executing context optimization step.');
20
- await executeStepContextOptimization(generateContentFn, [...prompt, assistant, user], options);
21
- }
22
- return {
23
- breakLoop: false,
24
- items: [
25
- {
26
- assistant,
27
- user,
28
- },
29
- ],
30
- };
31
- }
32
- //# sourceMappingURL=context-optimization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-optimization.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/context-optimization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AAGpF,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAC9C,eAAe,EACf,MAAM,EACN,OAAO,EACP,iBAAiB,GACE;IACnB,MAAM,gBAAgB,GAAG,MAAM,sBAAsB,CACnD,iHAAiH,EACjH,KAAK,EACL,OAAO,CACR,CAAC;IAEF,MAAM,IAAI,GAAa;QACrB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,mCAAmC;KAC/F,CAAC;IAEF,MAAM,SAAS,GAAkB;QAC/B,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;KAC1C,CAAC;IAEF,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAC/B,4EAA4E;QAC5E,YAAY,EAAE,CAAC;QAEf,oCAAoC;QACpC,gBAAgB,CAAC,sCAAsC,CAAC,CAAC;QACzD,MAAM,8BAA8B,CAAC,iBAAiB,EAAE,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACjG,CAAC;IAED,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE;YACL;gBACE,SAAS;gBACT,IAAI;aACL;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- export declare const GENAICODE_HELP_DOCUMENT = "# GenAIcode Help Documentation\n\n## Overview\n\nGenAIcode is an AI-powered code generation and management tool designed to streamline software development. It leverages various AI services (Vertex AI, AI Studio, OpenAI, Anthropic) to generate, modify, and analyze code. The tool supports interactive and UI modes, allowing developers to execute code generation tasks, manage prompts, and visualize outputs.\n\n## Features\n\n### Core Features\n\n1. **Multiple AI Service Integration**\n - Vertex AI (with Gemini Pro support)\n - OpenAI (GPT-4 with function calling)\n - Anthropic (Claude 3 with tool use)\n - AI Studio (Gemini Pro)\n - AI Service Fallback handling\n - Plugin-based AI service extensibility\n\n2. **Operation Modes**\n - Interactive CLI mode\n - Web UI mode\n - Task file execution\n - Batch processing\n\n3. **Code Generation Capabilities**\n - Smart context management\n - File operations (create, update, delete, move)\n - Code analysis and optimization\n - Image generation and processing\n - Plugin system for custom operations\n\n### Advanced Features\n\n1. **Context Optimization**\n - Automatic context pruning\n - Smart file selection\n - Token usage optimization\n - History management\n\n2. **Project Profiles**\n - Automatic project type detection\n - Framework-specific configurations\n - Custom profile support\n\n3. **Plugin System**\n - Custom AI services\n - Operation extensions\n - Action handlers\n - Pre/post operation hooks\n\n## CLI Options\n\n### Basic Options\n```bash\ngenaicode [options] [prompt]\n```\n\n- `--interactive`: Enable interactive mode\n- `--ui`: Launch web UI interface\n- `--task-file <path>`: Execute task from file\n- `--verbose-prompt`: Enable detailed prompt logging\n\n### Permission Options\n- `--allow-file-create`: Allow file creation\n- `--allow-file-delete`: Allow file deletion\n- `--allow-directory-create`: Allow directory creation\n- `--allow-file-move`: Allow file moving\n\n### AI Service Options\n- `--ai-service <service>`: Select AI service (vertex-ai|ai-studio|openai|anthropic)\n- `--vision`: Enable image analysis capabilities\n- `--imagen <service>`: Enable image generation (vertex-ai|dall-e)\n\n### Optimization Options\n- `--temperature <value>`: Set model temperature (0.0-2.0)\n- `--cheap`: Use faster, cheaper model variants\n- `--content-mask <path>`: Filter content by path\n- `--disable-context-optimization`: Disable automatic context optimization\n\n### Control Options\n- `--disable-ask-question`: Disable interactive questioning\n- `--disable-explanations`: Disable detailed explanations\n- `--disable-cache`: Disable caching\n- `--disable-history`: Disable conversation history\n- `--ui-port <port>`: Set UI server port\n\n## Configuration\n\n### .genaicoderc File\n```json\n{\n \"rootDir\": \".\",\n \"ignorePaths\": [\n \"node_modules\",\n \"dist\",\n \"coverage\"\n ],\n \"lintCommand\": \"npm run lint\",\n \"extensions\": [\".js\", \".ts\", \".jsx\", \".tsx\"],\n \"importantContext\": {\n \"files\": [\"important-file.ts\"],\n \"systemPrompt\": [\"Custom system prompt\"]\n },\n \"plugins\": [\"./path/to/plugin.js\"],\n \"modelOverrides\": {\n \"aiStudio\": {\n \"default\": \"gemini-pro\",\n \"cheap\": \"gemini-2.0-flash\"\n }\n }\n}\n```\n\n### Configuration Options\n\n1. **Root Directory**\n - `rootDir`: Project root directory\n - Relative to .genaicoderc location\n\n2. **File Management**\n - `ignorePaths`: Paths to exclude\n - `extensions`: File extensions to process\n - `lintCommand`: Custom lint command\n\n3. **Context Management**\n - `importantContext`: Critical files and prompts\n - `contentMask`: Path-based content filtering\n\n4. **AI Services**\n - `modelOverrides`: Service-specific model settings\n - `plugins`: Custom AI service plugins\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Permission Errors**\n ```\n Error: Operation not allowed\n ```\n Solution: Use appropriate permission flags (--allow-file-create, etc.)\n\n2. **Context Size Limits**\n ```\n Error: Context size exceeded\n ```\n Solution: Enable context optimization or use content masks\n\n3. **AI Service Errors**\n ```\n Error: Rate limit exceeded\n ```\n Solution: Switch to a different AI service or wait before retrying\n\n4. **Plugin Loading Issues**\n ```\n Error: Failed to load plugin\n ```\n Solution: Check plugin path and compatibility\n\n### Best Practices\n\n1. **Context Optimization**\n - Use content masks for large projects\n - Enable context optimization\n - Keep important files in configuration\n\n2. **Performance**\n - Use cheap mode for rapid iterations\n - Enable caching for repeated operations\n - Use appropriate temperature settings\n\n3. **Code Generation**\n - Provide clear, specific prompts\n - Use task files for complex operations\n - Review changes before applying\n\n## Examples\n\n### Basic Usage\n\n1. **Interactive Mode**\n ```bash\n genaicode --interactive\n ```\n\n2. **Web UI**\n ```bash\n genaicode --ui --ui-port 3000\n ```\n\n3. **Direct Prompt**\n ```bash\n genaicode \"Create a new React component\"\n ```\n\n### Advanced Usage\n\n1. **Task File Execution**\n ```bash\n genaicode --task-file tasks/new-feature.md\n ```\n\n2. **Custom AI Service**\n ```bash\n genaicode --ai-service openai --temperature 0.7\n ```\n\n3. **Image Generation**\n ```bash\n genaicode --imagen vertex-ai \"Generate logo\"\n ```\n\n### Project Configuration\n\n1. **Basic Configuration**\n ```json\n {\n \"rootDir\": \".\",\n \"ignorePaths\": [\"node_modules\"],\n \"lintCommand\": \"npm run lint\"\n }\n ```\n\n2. **Advanced Configuration**\n ```json\n {\n \"rootDir\": \".\",\n \"extensions\": [\".ts\", \".tsx\"],\n \"importantContext\": {\n \"files\": [\"src/main.ts\"]\n },\n \"plugins\": [\"./plugins/custom.js\"]\n }\n ```\n\n## Additional Resources\n\n1. **Documentation**\n - [GitHub Repository](https://github.com/your-repo/genaicode)\n - [API Documentation](https://your-docs-url)\n - [Plugin Development Guide](https://your-docs-url/plugins)\n\n2. **Community**\n - [Issue Tracker](https://github.com/your-repo/genaicode/issues)\n - [Discussion Forum](https://github.com/your-repo/genaicode/discussions)\n\n3. **Contributing**\n - [Contributing Guidelines](CONTRIBUTING.md)\n - [Code of Conduct](CODE_OF_CONDUCT.md)";
@@ -1,251 +0,0 @@
1
- export const GENAICODE_HELP_DOCUMENT = `# GenAIcode Help Documentation
2
-
3
- ## Overview
4
-
5
- GenAIcode is an AI-powered code generation and management tool designed to streamline software development. It leverages various AI services (Vertex AI, AI Studio, OpenAI, Anthropic) to generate, modify, and analyze code. The tool supports interactive and UI modes, allowing developers to execute code generation tasks, manage prompts, and visualize outputs.
6
-
7
- ## Features
8
-
9
- ### Core Features
10
-
11
- 1. **Multiple AI Service Integration**
12
- - Vertex AI (with Gemini Pro support)
13
- - OpenAI (GPT-4 with function calling)
14
- - Anthropic (Claude 3 with tool use)
15
- - AI Studio (Gemini Pro)
16
- - AI Service Fallback handling
17
- - Plugin-based AI service extensibility
18
-
19
- 2. **Operation Modes**
20
- - Interactive CLI mode
21
- - Web UI mode
22
- - Task file execution
23
- - Batch processing
24
-
25
- 3. **Code Generation Capabilities**
26
- - Smart context management
27
- - File operations (create, update, delete, move)
28
- - Code analysis and optimization
29
- - Image generation and processing
30
- - Plugin system for custom operations
31
-
32
- ### Advanced Features
33
-
34
- 1. **Context Optimization**
35
- - Automatic context pruning
36
- - Smart file selection
37
- - Token usage optimization
38
- - History management
39
-
40
- 2. **Project Profiles**
41
- - Automatic project type detection
42
- - Framework-specific configurations
43
- - Custom profile support
44
-
45
- 3. **Plugin System**
46
- - Custom AI services
47
- - Operation extensions
48
- - Action handlers
49
- - Pre/post operation hooks
50
-
51
- ## CLI Options
52
-
53
- ### Basic Options
54
- \`\`\`bash
55
- genaicode [options] [prompt]
56
- \`\`\`
57
-
58
- - \`--interactive\`: Enable interactive mode
59
- - \`--ui\`: Launch web UI interface
60
- - \`--task-file <path>\`: Execute task from file
61
- - \`--verbose-prompt\`: Enable detailed prompt logging
62
-
63
- ### Permission Options
64
- - \`--allow-file-create\`: Allow file creation
65
- - \`--allow-file-delete\`: Allow file deletion
66
- - \`--allow-directory-create\`: Allow directory creation
67
- - \`--allow-file-move\`: Allow file moving
68
-
69
- ### AI Service Options
70
- - \`--ai-service <service>\`: Select AI service (vertex-ai|ai-studio|openai|anthropic)
71
- - \`--vision\`: Enable image analysis capabilities
72
- - \`--imagen <service>\`: Enable image generation (vertex-ai|dall-e)
73
-
74
- ### Optimization Options
75
- - \`--temperature <value>\`: Set model temperature (0.0-2.0)
76
- - \`--cheap\`: Use faster, cheaper model variants
77
- - \`--content-mask <path>\`: Filter content by path
78
- - \`--disable-context-optimization\`: Disable automatic context optimization
79
-
80
- ### Control Options
81
- - \`--disable-ask-question\`: Disable interactive questioning
82
- - \`--disable-explanations\`: Disable detailed explanations
83
- - \`--disable-cache\`: Disable caching
84
- - \`--disable-history\`: Disable conversation history
85
- - \`--ui-port <port>\`: Set UI server port
86
-
87
- ## Configuration
88
-
89
- ### .genaicoderc File
90
- \`\`\`json
91
- {
92
- "rootDir": ".",
93
- "ignorePaths": [
94
- "node_modules",
95
- "dist",
96
- "coverage"
97
- ],
98
- "lintCommand": "npm run lint",
99
- "extensions": [".js", ".ts", ".jsx", ".tsx"],
100
- "importantContext": {
101
- "files": ["important-file.ts"],
102
- "systemPrompt": ["Custom system prompt"]
103
- },
104
- "plugins": ["./path/to/plugin.js"],
105
- "modelOverrides": {
106
- "aiStudio": {
107
- "default": "gemini-pro",
108
- "cheap": "gemini-2.0-flash"
109
- }
110
- }
111
- }
112
- \`\`\`
113
-
114
- ### Configuration Options
115
-
116
- 1. **Root Directory**
117
- - \`rootDir\`: Project root directory
118
- - Relative to .genaicoderc location
119
-
120
- 2. **File Management**
121
- - \`ignorePaths\`: Paths to exclude
122
- - \`extensions\`: File extensions to process
123
- - \`lintCommand\`: Custom lint command
124
-
125
- 3. **Context Management**
126
- - \`importantContext\`: Critical files and prompts
127
- - \`contentMask\`: Path-based content filtering
128
-
129
- 4. **AI Services**
130
- - \`modelOverrides\`: Service-specific model settings
131
- - \`plugins\`: Custom AI service plugins
132
-
133
- ## Troubleshooting
134
-
135
- ### Common Issues
136
-
137
- 1. **Permission Errors**
138
- \`\`\`
139
- Error: Operation not allowed
140
- \`\`\`
141
- Solution: Use appropriate permission flags (--allow-file-create, etc.)
142
-
143
- 2. **Context Size Limits**
144
- \`\`\`
145
- Error: Context size exceeded
146
- \`\`\`
147
- Solution: Enable context optimization or use content masks
148
-
149
- 3. **AI Service Errors**
150
- \`\`\`
151
- Error: Rate limit exceeded
152
- \`\`\`
153
- Solution: Switch to a different AI service or wait before retrying
154
-
155
- 4. **Plugin Loading Issues**
156
- \`\`\`
157
- Error: Failed to load plugin
158
- \`\`\`
159
- Solution: Check plugin path and compatibility
160
-
161
- ### Best Practices
162
-
163
- 1. **Context Optimization**
164
- - Use content masks for large projects
165
- - Enable context optimization
166
- - Keep important files in configuration
167
-
168
- 2. **Performance**
169
- - Use cheap mode for rapid iterations
170
- - Enable caching for repeated operations
171
- - Use appropriate temperature settings
172
-
173
- 3. **Code Generation**
174
- - Provide clear, specific prompts
175
- - Use task files for complex operations
176
- - Review changes before applying
177
-
178
- ## Examples
179
-
180
- ### Basic Usage
181
-
182
- 1. **Interactive Mode**
183
- \`\`\`bash
184
- genaicode --interactive
185
- \`\`\`
186
-
187
- 2. **Web UI**
188
- \`\`\`bash
189
- genaicode --ui --ui-port 3000
190
- \`\`\`
191
-
192
- 3. **Direct Prompt**
193
- \`\`\`bash
194
- genaicode "Create a new React component"
195
- \`\`\`
196
-
197
- ### Advanced Usage
198
-
199
- 1. **Task File Execution**
200
- \`\`\`bash
201
- genaicode --task-file tasks/new-feature.md
202
- \`\`\`
203
-
204
- 2. **Custom AI Service**
205
- \`\`\`bash
206
- genaicode --ai-service openai --temperature 0.7
207
- \`\`\`
208
-
209
- 3. **Image Generation**
210
- \`\`\`bash
211
- genaicode --imagen vertex-ai "Generate logo"
212
- \`\`\`
213
-
214
- ### Project Configuration
215
-
216
- 1. **Basic Configuration**
217
- \`\`\`json
218
- {
219
- "rootDir": ".",
220
- "ignorePaths": ["node_modules"],
221
- "lintCommand": "npm run lint"
222
- }
223
- \`\`\`
224
-
225
- 2. **Advanced Configuration**
226
- \`\`\`json
227
- {
228
- "rootDir": ".",
229
- "extensions": [".ts", ".tsx"],
230
- "importantContext": {
231
- "files": ["src/main.ts"]
232
- },
233
- "plugins": ["./plugins/custom.js"]
234
- }
235
- \`\`\`
236
-
237
- ## Additional Resources
238
-
239
- 1. **Documentation**
240
- - [GitHub Repository](https://github.com/your-repo/genaicode)
241
- - [API Documentation](https://your-docs-url)
242
- - [Plugin Development Guide](https://your-docs-url/plugins)
243
-
244
- 2. **Community**
245
- - [Issue Tracker](https://github.com/your-repo/genaicode/issues)
246
- - [Discussion Forum](https://github.com/your-repo/genaicode/discussions)
247
-
248
- 3. **Contributing**
249
- - [Contributing Guidelines](CONTRIBUTING.md)
250
- - [Code of Conduct](CODE_OF_CONDUCT.md)`;
251
- //# sourceMappingURL=genaicode-help-document.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"genaicode-help-document.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/genaicode-help-document.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAyPI,CAAC"}
@@ -1,6 +0,0 @@
1
- import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';
2
- /**
3
- * Handles the lint action by executing the lint command and processing its results.
4
- * If the lint command fails, it will ask for user confirmation to continue with code generation.
5
- */
6
- export declare function handleLint({ askQuestionCall }: ActionHandlerProps): Promise<ActionResult>;
@@ -1,103 +0,0 @@
1
- import { exec } from 'child_process';
2
- import { promisify } from 'util';
3
- import { putSystemMessage } from '../../../../main/common/content-bus.js';
4
- import { rcConfig } from '../../../../main/config.js';
5
- const execPromise = promisify(exec);
6
- /**
7
- * Handles the lint action by executing the lint command and processing its results.
8
- * If the lint command fails, it will ask for user confirmation to continue with code generation.
9
- */
10
- export async function handleLint({ askQuestionCall }) {
11
- if (!rcConfig.lintCommand) {
12
- return {
13
- breakLoop: false,
14
- items: [
15
- {
16
- assistant: {
17
- type: 'assistant',
18
- text: askQuestionCall.args?.message ?? '',
19
- functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
20
- },
21
- user: {
22
- type: 'user',
23
- text: 'Lint command not configured. Skipping lint check.',
24
- functionResponses: [
25
- {
26
- name: 'lint',
27
- call_id: askQuestionCall.id + '_lint',
28
- content: JSON.stringify({ error: 'Lint command not configured' }),
29
- },
30
- ],
31
- },
32
- },
33
- ],
34
- };
35
- }
36
- let lintResult;
37
- try {
38
- putSystemMessage(`Executing lint command: ${rcConfig.lintCommand}`);
39
- await execPromise(rcConfig.lintCommand, { cwd: rcConfig.rootDir });
40
- lintResult = {
41
- success: true,
42
- };
43
- return {
44
- breakLoop: false,
45
- lintResult,
46
- items: [
47
- {
48
- assistant: {
49
- type: 'assistant',
50
- text: askQuestionCall.args?.message ?? '',
51
- functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
52
- },
53
- user: {
54
- type: 'user',
55
- text: 'Lint command executed successfully, no issues found.',
56
- functionResponses: [
57
- {
58
- name: 'lint',
59
- call_id: askQuestionCall.id + '_lint',
60
- content: JSON.stringify(lintResult),
61
- },
62
- ],
63
- },
64
- },
65
- ],
66
- };
67
- }
68
- catch (error) {
69
- const { stdout, stderr } = error;
70
- lintResult = {
71
- success: false,
72
- stdout,
73
- stderr,
74
- };
75
- // User confirmed to continue despite lint errors
76
- return {
77
- breakLoop: false,
78
- lintResult,
79
- items: [
80
- {
81
- assistant: {
82
- type: 'assistant',
83
- text: askQuestionCall.args?.message ?? '',
84
- functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
85
- },
86
- user: {
87
- type: 'user',
88
- text: 'Lint command failed, please analyze the output.',
89
- data: { stdout, stderr },
90
- functionResponses: [
91
- {
92
- name: 'lint',
93
- call_id: askQuestionCall.id + '_lint',
94
- content: JSON.stringify(lintResult),
95
- },
96
- ],
97
- },
98
- },
99
- ],
100
- };
101
- }
102
- }
103
- //# sourceMappingURL=lint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAE,eAAe,EAAsB;IACtE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC1B,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;wBACzC,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;qBACpE;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,mDAAmD;wBACzD,iBAAiB,EAAE;4BACjB;gCACE,IAAI,EAAE,MAAM;gCACZ,OAAO,EAAE,eAAe,CAAC,EAAE,GAAG,OAAO;gCACrC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,6BAA6B,EAAE,CAAC;6BAClE;yBACF;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAED,IAAI,UAAsB,CAAC;IAE3B,IAAI,CAAC;QACH,gBAAg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O,EAAE,CAAC;qBACpE;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,iDAAiD;wBACvD,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;wBACxB,iBAAiB,EAAE;4BACjB;gCACE,IAAI,EAAE,MAAM;gCACZ,OAAO,EAAE,eAAe,CAAC,EAAE,GAAG,OAAO;gCACrC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;6BACpC;yBACF;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';
2
- export declare function handleRemoveFilesFromContext({ askQuestionCall, generateContentFn, prompt, options, }: ActionHandlerProps): Promise<ActionResult>;