cloving 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cloving_gpt/adapters/claude.js +0 -2
- package/dist/cloving_gpt/index.js +12 -18
- package/dist/commands/config.js +54 -82
- package/dist/commands/generate/code.js +49 -93
- package/dist/commands/generate/context.js +8 -16
- package/dist/commands/generate/review.js +12 -16
- package/dist/commands/generate/shell.js +22 -35
- package/dist/commands/generate/unit_tests.js +23 -40
- package/dist/commands/init.js +9 -17
- package/dist/commands/project/build.js +11 -19
- package/dist/commands/project/init.js +4 -8
- package/dist/index.js +5 -0
- package/dist/package.json +16 -17
- package/dist/utils/config_utils.js +2 -1
- package/package.json +16 -17
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const axios_1 = __importDefault(require("axios"));
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const process_1 = __importDefault(require("process"));
|
|
9
|
-
const
|
|
9
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
10
10
|
const claude_1 = require("./adapters/claude");
|
|
11
11
|
const openai_1 = require("./adapters/openai");
|
|
12
12
|
const mistral_1 = require("./adapters/mistral");
|
|
@@ -14,7 +14,7 @@ const ollama_1 = require("./adapters/ollama");
|
|
|
14
14
|
const gemini_1 = require("./adapters/gemini");
|
|
15
15
|
const config_utils_1 = require("../utils/config_utils");
|
|
16
16
|
class ClovingGPT {
|
|
17
|
-
constructor(options
|
|
17
|
+
constructor(options) {
|
|
18
18
|
const { model: partialModel } = options;
|
|
19
19
|
const config = (0, config_utils_1.getConfig)(options);
|
|
20
20
|
if (!config || !config.models) {
|
|
@@ -28,6 +28,7 @@ class ClovingGPT {
|
|
|
28
28
|
}
|
|
29
29
|
const { provider, model, config: modelConfig } = primaryModel;
|
|
30
30
|
this.apiKey = modelConfig.apiKey;
|
|
31
|
+
this.temperature = options.temperature || modelConfig.temperature || 0.2;
|
|
31
32
|
this.silent = options.silent || modelConfig.silent;
|
|
32
33
|
switch (provider) {
|
|
33
34
|
case 'claude':
|
|
@@ -53,14 +54,10 @@ class ClovingGPT {
|
|
|
53
54
|
if (this.silent)
|
|
54
55
|
return;
|
|
55
56
|
const tokenCount = Math.ceil(prompt.length / 4).toLocaleString();
|
|
56
|
-
const
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
message: `Do you want to review the ~${tokenCount} token prompt before sending it to ${endpoint}?`,
|
|
61
|
-
default: true
|
|
62
|
-
}
|
|
63
|
-
]);
|
|
57
|
+
const reviewPrompt = await (0, prompts_1.confirm)({
|
|
58
|
+
message: `Do you want to review the ~${tokenCount} token prompt before sending it to ${endpoint}?`,
|
|
59
|
+
default: true
|
|
60
|
+
});
|
|
64
61
|
if (reviewPrompt) {
|
|
65
62
|
const less = (0, child_process_1.spawn)('less', ['-R'], { stdio: ['pipe', process_1.default.stdout, process_1.default.stderr] });
|
|
66
63
|
less.stdin.write(prompt);
|
|
@@ -72,14 +69,10 @@ class ClovingGPT {
|
|
|
72
69
|
reject(new Error('Less command failed'));
|
|
73
70
|
return;
|
|
74
71
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
message: 'Do you want to continue?',
|
|
80
|
-
default: true
|
|
81
|
-
}
|
|
82
|
-
]);
|
|
72
|
+
const confirmContinue = await (0, prompts_1.confirm)({
|
|
73
|
+
message: 'Do you want to continue?',
|
|
74
|
+
default: true
|
|
75
|
+
});
|
|
83
76
|
if (!confirmContinue) {
|
|
84
77
|
console.error('Operation cancelled');
|
|
85
78
|
process_1.default.exit(1);
|
|
@@ -99,6 +92,7 @@ class ClovingGPT {
|
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
94
|
async generateText(request) {
|
|
95
|
+
request.temperature || (request.temperature = this.temperature);
|
|
102
96
|
const endpoint = this.adapter.getEndpoint();
|
|
103
97
|
const payload = this.adapter.getPayload(request);
|
|
104
98
|
const headers = this.adapter.getHeaders(this.apiKey);
|
package/dist/commands/config.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.config = void 0;
|
|
7
4
|
const config_utils_1 = require("../utils/config_utils");
|
|
8
5
|
const command_utils_1 = require("../utils/command_utils");
|
|
9
|
-
const
|
|
6
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
10
7
|
const config = async () => {
|
|
11
8
|
let currentConfig = (0, config_utils_1.getConfig)({});
|
|
12
9
|
// Ensure models are initialized properly
|
|
@@ -21,92 +18,71 @@ const config = async () => {
|
|
|
21
18
|
let continueConfig = true;
|
|
22
19
|
while (continueConfig) {
|
|
23
20
|
const providers = [...new Set(models.map(model => model.split(':')[0]))];
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
message: 'Select a provider:',
|
|
29
|
-
choices: providers.map(provider => ({ name: provider, value: provider })),
|
|
30
|
-
},
|
|
31
|
-
]);
|
|
21
|
+
const selectedProvider = await (0, prompts_1.select)({
|
|
22
|
+
message: 'Select a provider:',
|
|
23
|
+
choices: providers.map(provider => ({ name: provider, value: provider })),
|
|
24
|
+
});
|
|
32
25
|
const providerModels = models.filter(model => model.startsWith(selectedProvider));
|
|
33
26
|
const modelCategories = [...new Set(providerModels.map(model => model.split(':')[1]))];
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
message: 'Select a category:',
|
|
39
|
-
choices: modelCategories.map(category => ({ name: category, value: category })),
|
|
40
|
-
},
|
|
41
|
-
]);
|
|
27
|
+
const selectedCategory = await (0, prompts_1.select)({
|
|
28
|
+
message: 'Select a category:',
|
|
29
|
+
choices: modelCategories.map(category => ({ name: category, value: category })),
|
|
30
|
+
});
|
|
42
31
|
const specificModels = providerModels.filter(model => model.split(':')[1] === selectedCategory);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
choices: specificModels.map((model, index) => ({ name: model, value: index })),
|
|
49
|
-
pageSize: specificModels.length,
|
|
50
|
-
},
|
|
51
|
-
]);
|
|
32
|
+
const modelIndex = await (0, prompts_1.select)({
|
|
33
|
+
message: 'Select an AI model you\'d like to use:',
|
|
34
|
+
choices: specificModels.map((model, index) => ({ name: model, value: index })),
|
|
35
|
+
pageSize: specificModels.length,
|
|
36
|
+
});
|
|
52
37
|
const selectedModel = specificModels[modelIndex];
|
|
53
|
-
const
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
message: `Enter your API key for ${selectedModel}: `,
|
|
58
|
-
},
|
|
59
|
-
]);
|
|
60
|
-
const [provider, ...modelParts] = selectedModel.split(':');
|
|
38
|
+
const apiKey = await (0, prompts_1.input)({
|
|
39
|
+
message: `Enter your API key for ${selectedModel}: `,
|
|
40
|
+
});
|
|
41
|
+
const [provider, ...modelParts] = selectedModel?.split(':') || [];
|
|
61
42
|
const model = modelParts.join(':');
|
|
62
43
|
if (!currentConfig.models[provider]) {
|
|
63
44
|
currentConfig.models[provider] = {};
|
|
64
45
|
}
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
default: primary ? '100' : '0',
|
|
79
|
-
validate: (input) => {
|
|
80
|
-
const num = parseInt(input, 10);
|
|
81
|
-
if (isNaN(num) || num < 0 || num > 100) {
|
|
82
|
-
return 'Please enter a valid number between 0 and 100.';
|
|
83
|
-
}
|
|
84
|
-
return true;
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
]);
|
|
88
|
-
const { review } = await inquirer_1.default.prompt([
|
|
89
|
-
{
|
|
90
|
-
type: 'confirm',
|
|
91
|
-
name: 'review',
|
|
92
|
-
message: `Do you want to review all prompts before they are sent to ${selectedModel}?`,
|
|
93
|
-
default: true,
|
|
46
|
+
const primary = await (0, prompts_1.confirm)({
|
|
47
|
+
message: 'Set this model as the primary? Primary models are used by default if your prompt fits within its context window. You can configure backup models for larger prompts.',
|
|
48
|
+
default: true,
|
|
49
|
+
});
|
|
50
|
+
const priority = await (0, prompts_1.input)({
|
|
51
|
+
message: 'Enter the priority for this model (0-100). Higher priority AI APIs are chosen as long as the prompt fits its context window:',
|
|
52
|
+
default: primary ? '100' : '0',
|
|
53
|
+
validate: (input) => {
|
|
54
|
+
const num = parseInt(input, 10);
|
|
55
|
+
if (isNaN(num) || num < 0 || num > 100) {
|
|
56
|
+
return 'Please enter a valid number between 0 and 100.';
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
94
59
|
},
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
60
|
+
});
|
|
61
|
+
const review = await (0, prompts_1.confirm)({
|
|
62
|
+
message: `Do you want to review all prompts before they are sent to ${selectedModel}?`,
|
|
63
|
+
default: true,
|
|
64
|
+
});
|
|
65
|
+
const trust = await (0, prompts_1.confirm)({
|
|
66
|
+
message: `Do you trust ${selectedModel} with sensitive information?`,
|
|
67
|
+
default: false,
|
|
68
|
+
});
|
|
69
|
+
const temperature = await (0, prompts_1.number)({
|
|
70
|
+
message: `Enter the temperature for ${selectedModel} (0.0 - 1.0): [0.2]`,
|
|
71
|
+
default: 0.2,
|
|
72
|
+
validate: (value) => {
|
|
73
|
+
if (value && (isNaN(value) || value < 0 || value > 1)) {
|
|
74
|
+
return 'Please enter a valid number between 0.0 and 1.0.';
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
102
77
|
},
|
|
103
|
-
|
|
78
|
+
}) || 0.2;
|
|
104
79
|
const modelConfig = {
|
|
105
80
|
apiKey,
|
|
106
81
|
primary,
|
|
107
82
|
priority: parseInt(priority, 10),
|
|
108
83
|
silent: !review,
|
|
109
84
|
trust,
|
|
85
|
+
temperature,
|
|
110
86
|
};
|
|
111
87
|
currentConfig.models[provider][model] = modelConfig;
|
|
112
88
|
if (primary) {
|
|
@@ -119,14 +95,10 @@ const config = async () => {
|
|
|
119
95
|
}
|
|
120
96
|
}
|
|
121
97
|
}
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
message: 'Do you want to configure another model?',
|
|
127
|
-
default: true,
|
|
128
|
-
},
|
|
129
|
-
]);
|
|
98
|
+
const anotherModel = await (0, prompts_1.confirm)({
|
|
99
|
+
message: 'Do you want to configure another model?',
|
|
100
|
+
default: true,
|
|
101
|
+
});
|
|
130
102
|
continueConfig = anotherModel;
|
|
131
103
|
}
|
|
132
104
|
(0, config_utils_1.saveConfig)(currentConfig);
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const copy_paste_1 = __importDefault(require("copy-paste"));
|
|
7
|
-
const
|
|
7
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
8
8
|
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
@@ -127,40 +127,28 @@ const handleUserAction = async (gpt, rawCodeCommand, prompt, allSrcFiles, contex
|
|
|
127
127
|
await updateContextFiles(contextFiles, files, fileContents);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
name: '
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
{ name: 'Done', value: 'done' },
|
|
143
|
-
],
|
|
144
|
-
},
|
|
145
|
-
]);
|
|
130
|
+
const action = await (0, prompts_1.select)({
|
|
131
|
+
message: 'What would you like to do?',
|
|
132
|
+
choices: [
|
|
133
|
+
{ name: 'Revise', value: 'revise' },
|
|
134
|
+
{ name: 'Explain', value: 'explain' },
|
|
135
|
+
{ name: 'Save a Source Code File', value: 'save' },
|
|
136
|
+
{ name: 'Save All Source Code Files', value: 'saveAll' },
|
|
137
|
+
{ name: 'Copy Source Code to Clipboard', value: 'copySource' },
|
|
138
|
+
{ name: 'Copy Entire Response to Clipboard', value: 'copyAll' },
|
|
139
|
+
{ name: 'Done', value: 'done' },
|
|
140
|
+
],
|
|
141
|
+
});
|
|
146
142
|
switch (action) {
|
|
147
143
|
case 'revise':
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
name: 'newPrompt',
|
|
152
|
-
message: 'How would you like to modify the output:',
|
|
153
|
-
},
|
|
154
|
-
]);
|
|
144
|
+
const newPrompt = await (0, prompts_1.input)({
|
|
145
|
+
message: 'How would you like to modify the output:',
|
|
146
|
+
});
|
|
155
147
|
let includeMoreFiles = true;
|
|
156
148
|
while (includeMoreFiles) {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
name: 'contextFile',
|
|
161
|
-
message: 'Enter the relative path of a file or directory you would like to include as context (or press enter to continue):',
|
|
162
|
-
},
|
|
163
|
-
]);
|
|
149
|
+
const contextFile = await (0, prompts_1.input)({
|
|
150
|
+
message: 'Enter the relative path of a file or directory you would like to include as context (or press enter to continue):',
|
|
151
|
+
});
|
|
164
152
|
if (contextFile) {
|
|
165
153
|
contextFiles = await (0, command_utils_1.addFileOrDirectoryToContext)(contextFile, contextFiles, options);
|
|
166
154
|
}
|
|
@@ -180,14 +168,10 @@ const handleUserAction = async (gpt, rawCodeCommand, prompt, allSrcFiles, contex
|
|
|
180
168
|
case 'copySource':
|
|
181
169
|
let copyAnother = true;
|
|
182
170
|
while (copyAnother) {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
message: 'Which file do you want to copy to the clipboard?',
|
|
188
|
-
choices: files.map(file => ({ name: file, value: file })),
|
|
189
|
-
},
|
|
190
|
-
]);
|
|
171
|
+
const fileToCopy = await (0, prompts_1.select)({
|
|
172
|
+
message: 'Which file do you want to copy to the clipboard?',
|
|
173
|
+
choices: files.map(file => ({ name: file, value: file })),
|
|
174
|
+
});
|
|
191
175
|
if (fileContents[fileToCopy]) {
|
|
192
176
|
copy_paste_1.default.copy(fileContents[fileToCopy], () => {
|
|
193
177
|
console.log(`${fileToCopy} copied to clipboard`);
|
|
@@ -196,14 +180,10 @@ const handleUserAction = async (gpt, rawCodeCommand, prompt, allSrcFiles, contex
|
|
|
196
180
|
else {
|
|
197
181
|
console.log('File content not found.');
|
|
198
182
|
}
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
message: 'Do you want to copy another file?',
|
|
204
|
-
default: true,
|
|
205
|
-
},
|
|
206
|
-
]);
|
|
183
|
+
const copyMore = await (0, prompts_1.confirm)({
|
|
184
|
+
message: 'Do you want to copy another file?',
|
|
185
|
+
default: true,
|
|
186
|
+
});
|
|
207
187
|
copyAnother = copyMore;
|
|
208
188
|
}
|
|
209
189
|
break;
|
|
@@ -215,14 +195,10 @@ const handleUserAction = async (gpt, rawCodeCommand, prompt, allSrcFiles, contex
|
|
|
215
195
|
case 'save':
|
|
216
196
|
let saveAnother = true;
|
|
217
197
|
while (saveAnother) {
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
message: 'Which file do you want to save?',
|
|
223
|
-
choices: files.map(file => ({ name: file, value: file })),
|
|
224
|
-
},
|
|
225
|
-
]);
|
|
198
|
+
const fileToSave = await (0, prompts_1.select)({
|
|
199
|
+
message: 'Which file do you want to save?',
|
|
200
|
+
choices: files.map(file => ({ name: file, value: file })),
|
|
201
|
+
});
|
|
226
202
|
if (fileContents[fileToSave]) {
|
|
227
203
|
const filePath = path_1.default.resolve(fileToSave);
|
|
228
204
|
await fs_1.default.promises.mkdir(path_1.default.dirname(filePath), { recursive: true });
|
|
@@ -233,14 +209,10 @@ const handleUserAction = async (gpt, rawCodeCommand, prompt, allSrcFiles, contex
|
|
|
233
209
|
else {
|
|
234
210
|
console.log('File content not found.');
|
|
235
211
|
}
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
message: 'Do you want to save another file?',
|
|
241
|
-
default: true,
|
|
242
|
-
},
|
|
243
|
-
]);
|
|
212
|
+
const saveMore = await (0, prompts_1.confirm)({
|
|
213
|
+
message: 'Do you want to save another file?',
|
|
214
|
+
default: true,
|
|
215
|
+
});
|
|
244
216
|
saveAnother = saveMore;
|
|
245
217
|
}
|
|
246
218
|
break;
|
|
@@ -260,8 +232,8 @@ const code = async (options) => {
|
|
|
260
232
|
const allSrcFiles = await (0, config_utils_1.getAllFiles)(options, false);
|
|
261
233
|
let contextFiles = {};
|
|
262
234
|
try {
|
|
263
|
-
if (
|
|
264
|
-
for (const file of
|
|
235
|
+
if (allSrcFiles) {
|
|
236
|
+
for (const file of allSrcFiles) {
|
|
265
237
|
const filePath = path_1.default.resolve(file);
|
|
266
238
|
if (await fs_1.default.promises.stat(filePath).then(stat => stat.isFile()).catch(() => false)) {
|
|
267
239
|
const content = await fs_1.default.promises.readFile(filePath, 'utf-8');
|
|
@@ -272,13 +244,9 @@ const code = async (options) => {
|
|
|
272
244
|
else {
|
|
273
245
|
let includeMoreFiles = true;
|
|
274
246
|
while (includeMoreFiles) {
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
name: 'contextFile',
|
|
279
|
-
message: `Enter the relative path of a file or directory you would like to include as context (or press enter to continue):`,
|
|
280
|
-
},
|
|
281
|
-
]);
|
|
247
|
+
const contextFile = await (0, prompts_1.input)({
|
|
248
|
+
message: `Enter the relative path of a file or directory you would like to include as context (or press enter to continue):`,
|
|
249
|
+
});
|
|
282
250
|
if (contextFile) {
|
|
283
251
|
contextFiles = await (0, command_utils_1.addFileOrDirectoryToContext)(contextFile, contextFiles, options);
|
|
284
252
|
}
|
|
@@ -288,13 +256,9 @@ const code = async (options) => {
|
|
|
288
256
|
}
|
|
289
257
|
}
|
|
290
258
|
if (!prompt) {
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
name: 'userPrompt',
|
|
295
|
-
message: 'What would you like the code to do:',
|
|
296
|
-
},
|
|
297
|
-
]);
|
|
259
|
+
const userPrompt = await (0, prompts_1.input)({
|
|
260
|
+
message: 'What would you like the code to do:',
|
|
261
|
+
});
|
|
298
262
|
prompt = userPrompt;
|
|
299
263
|
}
|
|
300
264
|
let rawCodeCommand = await generateCode(gpt, prompt, allSrcFiles, contextFiles);
|
|
@@ -310,26 +274,18 @@ const code = async (options) => {
|
|
|
310
274
|
if (options.interactive) {
|
|
311
275
|
let continueInteractive = true;
|
|
312
276
|
while (continueInteractive) {
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
name: 'newPrompt',
|
|
317
|
-
message: 'Revise the code (or press enter to finish):',
|
|
318
|
-
},
|
|
319
|
-
]);
|
|
277
|
+
const newPrompt = await (0, prompts_1.input)({
|
|
278
|
+
message: 'Revise the code (or press enter to finish):',
|
|
279
|
+
});
|
|
320
280
|
if (newPrompt.trim() === '') {
|
|
321
281
|
continueInteractive = false;
|
|
322
282
|
}
|
|
323
283
|
else {
|
|
324
284
|
let includeMoreFiles = true;
|
|
325
285
|
while (includeMoreFiles) {
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
name: 'contextFile',
|
|
330
|
-
message: 'Enter the relative path of a file or directory you would like to include as context (or press enter to continue):',
|
|
331
|
-
},
|
|
332
|
-
]);
|
|
286
|
+
const contextFile = await (0, prompts_1.input)({
|
|
287
|
+
message: 'Enter the relative path of a file or directory you would like to include as context (or press enter to continue):',
|
|
288
|
+
});
|
|
333
289
|
if (contextFile) {
|
|
334
290
|
contextFiles = await (0, command_utils_1.addFileOrDirectoryToContext)(contextFile, contextFiles, options);
|
|
335
291
|
}
|
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
7
6
|
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
8
7
|
const copy_paste_1 = __importDefault(require("copy-paste"));
|
|
9
8
|
const fs_1 = __importDefault(require("fs"));
|
|
10
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
11
11
|
const command_utils_1 = require("../../utils/command_utils");
|
|
12
12
|
const config_utils_1 = require("../../utils/config_utils");
|
|
13
13
|
const generateContextPrompt = (files, contextFiles) => {
|
|
@@ -44,13 +44,9 @@ const context = async (options) => {
|
|
|
44
44
|
else {
|
|
45
45
|
let includeMoreFiles = true;
|
|
46
46
|
while (includeMoreFiles) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
name: 'contextFile',
|
|
51
|
-
message: `Enter the relative path of a file or directory you would like to include as context (or press enter to continue):`,
|
|
52
|
-
},
|
|
53
|
-
]);
|
|
47
|
+
const contextFile = await (0, prompts_1.input)({
|
|
48
|
+
message: 'Enter the relative path of a file or directory you would like to include as context (or press enter to continue):',
|
|
49
|
+
});
|
|
54
50
|
if (contextFile) {
|
|
55
51
|
contextFiles = await (0, command_utils_1.addFileOrDirectoryToContext)(contextFile, contextFiles, options);
|
|
56
52
|
}
|
|
@@ -62,14 +58,10 @@ const context = async (options) => {
|
|
|
62
58
|
const contextPrompt = generateContextPrompt(allSrcFiles, contextFiles);
|
|
63
59
|
console.log('\nGenerated Context Prompt:');
|
|
64
60
|
console.log((0, cli_highlight_1.default)(contextPrompt, { language: 'markdown' }));
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
message: 'Do you want to copy the context prompt to your clipboard?',
|
|
70
|
-
default: true,
|
|
71
|
-
},
|
|
72
|
-
]);
|
|
61
|
+
const copyToClipboard = await (0, prompts_1.confirm)({
|
|
62
|
+
message: 'Do you want to copy the context prompt to your clipboard?',
|
|
63
|
+
default: true,
|
|
64
|
+
});
|
|
73
65
|
if (copyToClipboard) {
|
|
74
66
|
copy_paste_1.default.copy(contextPrompt, () => {
|
|
75
67
|
console.log('Context prompt copied to clipboard');
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
7
|
-
const
|
|
7
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
8
8
|
const copy_paste_1 = __importDefault(require("copy-paste"));
|
|
9
9
|
const cloving_gpt_1 = __importDefault(require("../../cloving_gpt"));
|
|
10
10
|
const git_utils_1 = require("../../utils/git_utils");
|
|
@@ -16,7 +16,7 @@ const review = async (options) => {
|
|
|
16
16
|
try {
|
|
17
17
|
// Define the prompt for analysis
|
|
18
18
|
const gitDiff = await (0, git_utils_1.getGitDiff)();
|
|
19
|
-
const
|
|
19
|
+
const promptText = `==== begin diff =====
|
|
20
20
|
${gitDiff}
|
|
21
21
|
==== end diff =====
|
|
22
22
|
|
|
@@ -77,7 +77,7 @@ I would like you to explain why these change are being made and document a descr
|
|
|
77
77
|
Also list any bugs in the new code as well as recommended fixes for those bugs with code examples.
|
|
78
78
|
Format the output of this code review in Markdown format.`;
|
|
79
79
|
// get the analysis
|
|
80
|
-
const analysis = await gpt.generateText({ prompt });
|
|
80
|
+
const analysis = await gpt.generateText({ prompt: promptText });
|
|
81
81
|
// Print the analysis to the console
|
|
82
82
|
(0, string_utils_1.parseMarkdownInstructions)(analysis).map(code => {
|
|
83
83
|
if (code.trim().startsWith('```')) {
|
|
@@ -104,19 +104,15 @@ Format the output of this code review in Markdown format.`;
|
|
|
104
104
|
return match ? match[0].trim() : '';
|
|
105
105
|
};
|
|
106
106
|
// Prompt the user with options for copying to clipboard
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
name: '
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{ name: 'Done', value: 'Done' }
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
]);
|
|
107
|
+
const clipboardOption = await (0, prompts_1.select)({
|
|
108
|
+
message: 'What would you like to copy to the clipboard?',
|
|
109
|
+
choices: [
|
|
110
|
+
{ name: 'Copy only the Changes Overview', value: 'Changes Overview' },
|
|
111
|
+
{ name: 'Copy only the Potential Bugs and Recommended Fixes', value: 'Potential Bugs and Recommended Fixes' },
|
|
112
|
+
{ name: 'Copy everything', value: 'Everything' },
|
|
113
|
+
{ name: 'Done', value: 'Done' }
|
|
114
|
+
]
|
|
115
|
+
});
|
|
120
116
|
let contentToCopy = '';
|
|
121
117
|
switch (clipboardOption) {
|
|
122
118
|
case 'Changes Overview':
|
|
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
7
|
-
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
8
6
|
const child_process_1 = require("child_process");
|
|
7
|
+
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
9
8
|
const copy_paste_1 = __importDefault(require("copy-paste"));
|
|
10
9
|
const string_utils_1 = require("../../utils/string_utils");
|
|
11
10
|
const config_utils_1 = require("../../utils/config_utils");
|
|
12
11
|
const cloving_gpt_1 = __importDefault(require("../../cloving_gpt"));
|
|
12
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
13
13
|
const generateShellPrompt = (prompt) => {
|
|
14
14
|
const shell = (0, child_process_1.execSync)('echo $SHELL').toString().trim();
|
|
15
15
|
const os = (0, child_process_1.execSync)('echo $OSTYPE').toString().trim();
|
|
@@ -48,32 +48,24 @@ const displayGeneratedShell = (rawShellCommand) => {
|
|
|
48
48
|
const handleUserAction = async (gpt, rawShellCommand, prompt) => {
|
|
49
49
|
const generatedShell = (0, string_utils_1.extractMarkdown)(rawShellCommand);
|
|
50
50
|
const generatedShellWithoutShebang = generatedShell.replace(/^#!.*?\s/, '');
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
name: '
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{ name: 'Cancel', value: 'cancel' },
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
]);
|
|
51
|
+
const action = await (0, prompts_1.select)({
|
|
52
|
+
message: 'What would you like to do?',
|
|
53
|
+
choices: [
|
|
54
|
+
{ name: 'Execute', value: 'execute' },
|
|
55
|
+
{ name: 'Revise', value: 'revise' },
|
|
56
|
+
{ name: 'Explain', value: 'explain' },
|
|
57
|
+
{ name: 'Copy to Clipboard', value: 'copy' },
|
|
58
|
+
{ name: 'Cancel', value: 'cancel' },
|
|
59
|
+
],
|
|
60
|
+
});
|
|
65
61
|
switch (action) {
|
|
66
62
|
case 'execute':
|
|
67
63
|
(0, child_process_1.execSync)(generatedShellWithoutShebang, { stdio: 'inherit' });
|
|
68
64
|
break;
|
|
69
65
|
case 'revise':
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
name: 'newPrompt',
|
|
74
|
-
message: 'How would you like to modify the output:',
|
|
75
|
-
},
|
|
76
|
-
]);
|
|
66
|
+
const newPrompt = await (0, prompts_1.input)({
|
|
67
|
+
message: 'How would you like to modify the output:',
|
|
68
|
+
});
|
|
77
69
|
const newRawShellCommand = await generateShell(gpt, newPrompt);
|
|
78
70
|
displayGeneratedShell(newRawShellCommand);
|
|
79
71
|
await handleUserAction(gpt, newRawShellCommand, newPrompt);
|
|
@@ -99,23 +91,18 @@ const handleUserAction = async (gpt, rawShellCommand, prompt) => {
|
|
|
99
91
|
}
|
|
100
92
|
};
|
|
101
93
|
const shell = async (options) => {
|
|
102
|
-
let { prompt } = options;
|
|
94
|
+
let { prompt: userPrompt } = options;
|
|
103
95
|
options.silent = (0, config_utils_1.getConfig)(options).globalSilent || false;
|
|
104
96
|
const gpt = new cloving_gpt_1.default(options);
|
|
105
97
|
try {
|
|
106
|
-
if (!
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
name: 'userPrompt',
|
|
111
|
-
message: 'What would you like to do: '
|
|
112
|
-
}
|
|
113
|
-
]);
|
|
114
|
-
prompt = userPrompt;
|
|
98
|
+
if (!userPrompt) {
|
|
99
|
+
userPrompt = await (0, prompts_1.input)({
|
|
100
|
+
message: 'What would you like to do: '
|
|
101
|
+
});
|
|
115
102
|
}
|
|
116
|
-
const rawShellCommand = await generateShell(gpt,
|
|
103
|
+
const rawShellCommand = await generateShell(gpt, userPrompt);
|
|
117
104
|
displayGeneratedShell(rawShellCommand);
|
|
118
|
-
await handleUserAction(gpt, rawShellCommand,
|
|
105
|
+
await handleUserAction(gpt, rawShellCommand, userPrompt);
|
|
119
106
|
}
|
|
120
107
|
catch (error) {
|
|
121
108
|
console.error('Could not generate shell script', error);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
9
|
-
const
|
|
9
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const git_utils_1 = require("../../utils/git_utils");
|
|
12
12
|
const config_utils_1 = require("../../utils/config_utils");
|
|
@@ -80,32 +80,24 @@ const handleUserAction = async (analysis, autoSave = false) => {
|
|
|
80
80
|
console.log('All unit test files have been saved.');
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
name: '
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{ name: 'Done', value: 'done' },
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
]);
|
|
83
|
+
const action = await (0, prompts_1.select)({
|
|
84
|
+
message: 'What would you like to do?',
|
|
85
|
+
choices: [
|
|
86
|
+
{ name: 'Save a Unit Test File', value: 'save' },
|
|
87
|
+
{ name: 'Save All Unit Test Files', value: 'saveAll' },
|
|
88
|
+
{ name: 'Copy Unit Test to Clipboard', value: 'copyTest' },
|
|
89
|
+
{ name: 'Copy Entire Response to Clipboard', value: 'copyAll' },
|
|
90
|
+
{ name: 'Done', value: 'done' },
|
|
91
|
+
],
|
|
92
|
+
});
|
|
97
93
|
switch (action) {
|
|
98
94
|
case 'save':
|
|
99
95
|
let saveAnother = true;
|
|
100
96
|
while (saveAnother) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
message: 'Which unit test file do you want to save?',
|
|
106
|
-
choices: files.map(file => ({ name: file, value: file })),
|
|
107
|
-
},
|
|
108
|
-
]);
|
|
97
|
+
const fileToSave = await (0, prompts_1.select)({
|
|
98
|
+
message: 'Which unit test file do you want to save?',
|
|
99
|
+
choices: files.map(file => ({ name: file, value: file })),
|
|
100
|
+
});
|
|
109
101
|
if (fileContents[fileToSave]) {
|
|
110
102
|
const filePath = path_1.default.resolve(fileToSave);
|
|
111
103
|
await fs_1.promises.mkdir(path_1.default.dirname(filePath), { recursive: true });
|
|
@@ -115,15 +107,10 @@ const handleUserAction = async (analysis, autoSave = false) => {
|
|
|
115
107
|
else {
|
|
116
108
|
console.log('File content not found.');
|
|
117
109
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
message: 'Do you want to save another file?',
|
|
123
|
-
default: false,
|
|
124
|
-
},
|
|
125
|
-
]);
|
|
126
|
-
saveAnother = saveMore;
|
|
110
|
+
saveAnother = await (0, prompts_1.confirm)({
|
|
111
|
+
message: 'Do you want to save another file?',
|
|
112
|
+
default: false,
|
|
113
|
+
});
|
|
127
114
|
}
|
|
128
115
|
break;
|
|
129
116
|
case 'saveAll':
|
|
@@ -141,14 +128,10 @@ const handleUserAction = async (analysis, autoSave = false) => {
|
|
|
141
128
|
console.log('All unit test files have been saved.');
|
|
142
129
|
break;
|
|
143
130
|
case 'copyTest':
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
message: 'Which unit test file do you want to copy to the clipboard?',
|
|
149
|
-
choices: files.map(file => ({ name: file, value: file })),
|
|
150
|
-
},
|
|
151
|
-
]);
|
|
131
|
+
const fileToCopy = await (0, prompts_1.select)({
|
|
132
|
+
message: 'Which unit test file do you want to copy to the clipboard?',
|
|
133
|
+
choices: files.map(file => ({ name: file, value: file })),
|
|
134
|
+
});
|
|
152
135
|
if (fileContents[fileToCopy]) {
|
|
153
136
|
process.nextTick(() => {
|
|
154
137
|
require('copy-paste').copy(fileContents[fileToCopy], () => {
|
package/dist/commands/init.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.init = void 0;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const
|
|
10
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
11
11
|
const cloving_gpt_1 = __importDefault(require("../cloving_gpt"));
|
|
12
12
|
const ignore_1 = __importDefault(require("ignore"));
|
|
13
13
|
const string_utils_1 = require("../utils/string_utils");
|
|
@@ -42,14 +42,10 @@ technologies used. This will provide better context for future Cloving requests.
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
if (!(0, command_utils_1.checkForSpecialFiles)()) {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
message: 'No special files detected. Please describe the main technologies used in your project:',
|
|
50
|
-
validate: (input) => input.trim().length > 0 || 'Please provide a description of the technologies used.',
|
|
51
|
-
},
|
|
52
|
-
]);
|
|
45
|
+
const technologies = await (0, prompts_1.input)({
|
|
46
|
+
message: 'No special files detected. Please describe the main technologies used in your project:',
|
|
47
|
+
validate: (input) => input.trim().length > 0 || 'Please provide a description of the technologies used.',
|
|
48
|
+
});
|
|
53
49
|
specialFileContents['description'] = technologies;
|
|
54
50
|
}
|
|
55
51
|
const tempFilePath = path_1.default.join(os_1.default.tmpdir(), `describe_${Date.now()}.tmp`);
|
|
@@ -207,14 +203,10 @@ Here is an example response:
|
|
|
207
203
|
console.log('[done] Project data saved to cloving.json');
|
|
208
204
|
// Prompt the user if they want to review the generated cloving.json
|
|
209
205
|
if (!options.silent) {
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
message: 'Do you want to review the generated data?',
|
|
215
|
-
default: true,
|
|
216
|
-
},
|
|
217
|
-
]);
|
|
206
|
+
const reviewAnswer = await (0, prompts_1.confirm)({
|
|
207
|
+
message: 'Do you want to review the generated data?',
|
|
208
|
+
default: true,
|
|
209
|
+
});
|
|
218
210
|
if (reviewAnswer) {
|
|
219
211
|
console.log(cleanAiChatResponse);
|
|
220
212
|
}
|
|
@@ -7,7 +7,7 @@ exports.buildProject = void 0;
|
|
|
7
7
|
const copy_paste_1 = __importDefault(require("copy-paste"));
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
10
|
-
const
|
|
10
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
11
11
|
const cloving_gpt_1 = __importDefault(require("../../cloving_gpt"));
|
|
12
12
|
const config_utils_1 = require("../../utils/config_utils");
|
|
13
13
|
const git_utils_1 = require("../../utils/git_utils");
|
|
@@ -42,15 +42,11 @@ const buildProject = async (options) => {
|
|
|
42
42
|
console.log('No plan items found.');
|
|
43
43
|
process.exit(1);
|
|
44
44
|
}
|
|
45
|
-
// Use inquirer to select a plan item
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
message: 'Select a plan item:',
|
|
51
|
-
choices: planItems.map(([key, item]) => ({ name: key, value: key })),
|
|
52
|
-
},
|
|
53
|
-
]);
|
|
45
|
+
// Use @inquirer/prompts to select a plan item
|
|
46
|
+
const selectedPlanItemKey = await (0, prompts_1.select)({
|
|
47
|
+
message: 'Select a plan item:',
|
|
48
|
+
choices: planItems.map(([key, item]) => ({ name: key, value: key })),
|
|
49
|
+
});
|
|
54
50
|
const selectedPlanItem = planItems.find(([key]) => key === selectedPlanItemKey);
|
|
55
51
|
if (!selectedPlanItem) {
|
|
56
52
|
console.log('Selected plan item not found.');
|
|
@@ -77,15 +73,11 @@ const buildProject = async (options) => {
|
|
|
77
73
|
console.log((0, cli_highlight_1.default)(code, { language: 'markdown' }));
|
|
78
74
|
}
|
|
79
75
|
});
|
|
80
|
-
// Prompt the user to copy the project to the clipboard using inquirer
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
message: 'Do you want to copy this project to the clipboard?',
|
|
86
|
-
default: true,
|
|
87
|
-
},
|
|
88
|
-
]);
|
|
76
|
+
// Prompt the user to copy the project to the clipboard using @inquirer/prompts
|
|
77
|
+
const copyToClipboard = await (0, prompts_1.confirm)({
|
|
78
|
+
message: 'Do you want to copy this project to the clipboard?',
|
|
79
|
+
default: true,
|
|
80
|
+
});
|
|
89
81
|
if (copyToClipboard) {
|
|
90
82
|
copy_paste_1.default.copy(projectCode, () => {
|
|
91
83
|
console.log('Project copied to clipboard');
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.initProject = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
|
-
const
|
|
8
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
9
9
|
const cloving_gpt_1 = __importDefault(require("../../cloving_gpt"));
|
|
10
10
|
const config_utils_1 = require("../../utils/config_utils");
|
|
11
11
|
const git_utils_1 = require("../../utils/git_utils");
|
|
@@ -52,13 +52,9 @@ const initProject = async (options) => {
|
|
|
52
52
|
console.log(`You are on the ${defaultBranchName} branch. Please checkout to a git branch and try again. For example: git branch -b my-new-project`);
|
|
53
53
|
process.exit(1);
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
name: 'projectTask',
|
|
59
|
-
message: 'Describe the task you want to accomplish with this project:',
|
|
60
|
-
},
|
|
61
|
-
]);
|
|
55
|
+
const projectTask = await (0, prompts_1.input)({
|
|
56
|
+
message: 'Describe the task you want to accomplish with this project:',
|
|
57
|
+
});
|
|
62
58
|
const prompt = await generatePrompt(projectName, projectTask);
|
|
63
59
|
const contextFiles = await gpt.generateText({ prompt });
|
|
64
60
|
// Initialize variables
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,7 @@ generate
|
|
|
65
65
|
.option('-s, --silent', 'Run the command without asking for confirmation of submitting prompts')
|
|
66
66
|
.option('-m, --model <model>', 'Select the model to use (e.g., openai, claude, ollama, ollama:llama3, claude:claude-3-5-sonnet-20240620)')
|
|
67
67
|
.option('-p, --prompt <prompt>', 'Specify the prompt to use')
|
|
68
|
+
.option('-t, --temperature <temperature>', 'Temperature for the model (default 0.2)')
|
|
68
69
|
.action(shell_1.default);
|
|
69
70
|
generate
|
|
70
71
|
.command('code')
|
|
@@ -74,12 +75,14 @@ generate
|
|
|
74
75
|
.option('-i, --interactive', 'Auto-save generated code and then show a new prompt with existing context to revise the code further')
|
|
75
76
|
.option('-s, --silent', 'Run the command without asking for confirmation of submitting prompts')
|
|
76
77
|
.option('-m, --model <model>', 'Select the model to use (e.g., openai, claude, ollama, ollama:llama3, claude:claude-3-5:sonnet-20240620)')
|
|
78
|
+
.option('-t, --temperature <temperature>', 'Temperature for the model (default 0.2)')
|
|
77
79
|
.option('-p, --prompt <prompt>', 'Specify the prompt to use')
|
|
78
80
|
.option('-f, --files <filenames...>', 'Specify filenames of files with context to use for generating code')
|
|
79
81
|
.action(code_1.default);
|
|
80
82
|
generate
|
|
81
83
|
.command('commit')
|
|
82
84
|
.description('Generate a commit message and commit the changes')
|
|
85
|
+
.option('-t, --temperature <temperature>', 'Temperature for the model (default 0.2)')
|
|
83
86
|
.option('-s, --silent', 'Run the command without asking for confirmation of submitting prompts')
|
|
84
87
|
.option('-m, --model <model>', 'Select the model to use (e.g., openai, claude, ollama, ollama:llama3, claude:claude-3-5-sonnet-20240620)')
|
|
85
88
|
.action(commit_1.default);
|
|
@@ -96,6 +99,7 @@ generate
|
|
|
96
99
|
.option('-s, --silent', 'Run the command without asking for confirmation of submitting prompts')
|
|
97
100
|
.option('-f, --files <filenames...>', 'Specify filenames for the unit tests')
|
|
98
101
|
.option('-m, --model <model>', 'Select the model to use (e.g., openai, claude, ollama, ollama:llama3, claude:claude-3-5-sonnet-20240620)')
|
|
102
|
+
.option('-t, --temperature <temperature>', 'Temperature for the model (default 0.2)')
|
|
99
103
|
.action(unit_tests_1.default);
|
|
100
104
|
generate
|
|
101
105
|
.command('review')
|
|
@@ -103,6 +107,7 @@ generate
|
|
|
103
107
|
.description('Review the code for commited changes that differ from the main/master branch')
|
|
104
108
|
.option('-s, --silent', 'Run the command without asking for confirmation of submitting prompts')
|
|
105
109
|
.option('-m, --model <model>', 'Select the model to use (e.g., openai, claude, ollama, ollama:llama3, claude:claude-3-5-sonnet-20240620)')
|
|
110
|
+
.option('-t, --temperature <temperature>', 'Temperature for the model (default 0.2)')
|
|
106
111
|
.action(review_1.default);
|
|
107
112
|
// Project commands
|
|
108
113
|
const project = program
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloving",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"packageManager": "yarn@1.22.22",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
@@ -11,9 +12,7 @@
|
|
|
11
12
|
"test": "bash -c jest",
|
|
12
13
|
"prepare": "husky"
|
|
13
14
|
},
|
|
14
|
-
"bin":
|
|
15
|
-
"cloving": "./dist/index.js"
|
|
16
|
-
},
|
|
15
|
+
"bin": "./dist/index.js",
|
|
17
16
|
"files": [
|
|
18
17
|
"dist",
|
|
19
18
|
"!**/test/**"
|
|
@@ -37,37 +36,37 @@
|
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"
|
|
39
|
+
"@inquirer/prompts": "^5.3.6",
|
|
40
|
+
"axios": "^1.7.3",
|
|
41
41
|
"cli-highlight": "^2.1.11",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
43
|
"copy-paste": "^1.5.3",
|
|
44
|
-
"eslint": "^9.
|
|
44
|
+
"eslint": "^9.8.0",
|
|
45
45
|
"eslint-config-prettier": "^9.1.0",
|
|
46
46
|
"eslint-config-raine": "^0.5.0",
|
|
47
47
|
"eslint-config-standard": "^17.1.0",
|
|
48
48
|
"eslint-plugin-import": "^2.29.1",
|
|
49
|
-
"eslint-plugin-jsdoc": "^48.
|
|
50
|
-
"eslint-plugin-n": "^17.
|
|
51
|
-
"eslint-plugin-promise": "^
|
|
49
|
+
"eslint-plugin-jsdoc": "^48.11.0",
|
|
50
|
+
"eslint-plugin-n": "^17.10.1",
|
|
51
|
+
"eslint-plugin-promise": "^7.0.0",
|
|
52
52
|
"ignore": "^5.3.1",
|
|
53
53
|
"ini": "^4.1.3",
|
|
54
|
-
"inquirer": "^10.0.1",
|
|
55
54
|
"nock": "^13.5.4",
|
|
56
|
-
"vite": "^5.3.
|
|
57
|
-
"vite-node": "^2.0.
|
|
55
|
+
"vite": "^5.3.5",
|
|
56
|
+
"vite-node": "^2.0.5"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
59
|
"@types/copy-paste": "^1.1.33",
|
|
61
60
|
"@types/ini": "^4.1.1",
|
|
62
61
|
"@types/inquirer": "^9.0.7",
|
|
63
62
|
"@types/jest": "^29.5.12",
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"husky": "^9.
|
|
63
|
+
"@types/node": "^22.1.0",
|
|
64
|
+
"husky": "^9.1.4",
|
|
66
65
|
"jest": "^29.7.0",
|
|
67
66
|
"lint-prepush": "^2.2.2",
|
|
68
|
-
"lint-staged": "^15.2.
|
|
69
|
-
"ts-jest": "^29.2.
|
|
70
|
-
"typescript": "^5.5.
|
|
67
|
+
"lint-staged": "^15.2.8",
|
|
68
|
+
"ts-jest": "^29.2.4",
|
|
69
|
+
"typescript": "^5.5.4"
|
|
71
70
|
},
|
|
72
71
|
"resolutions": {
|
|
73
72
|
"eslint": "8.57.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloving",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"packageManager": "yarn@1.22.22",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
@@ -11,9 +12,7 @@
|
|
|
11
12
|
"test": "bash -c jest",
|
|
12
13
|
"prepare": "husky"
|
|
13
14
|
},
|
|
14
|
-
"bin":
|
|
15
|
-
"cloving": "./dist/index.js"
|
|
16
|
-
},
|
|
15
|
+
"bin": "./dist/index.js",
|
|
17
16
|
"files": [
|
|
18
17
|
"dist",
|
|
19
18
|
"!**/test/**"
|
|
@@ -37,37 +36,37 @@
|
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"
|
|
39
|
+
"@inquirer/prompts": "^5.3.6",
|
|
40
|
+
"axios": "^1.7.3",
|
|
41
41
|
"cli-highlight": "^2.1.11",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
43
|
"copy-paste": "^1.5.3",
|
|
44
|
-
"eslint": "^9.
|
|
44
|
+
"eslint": "^9.8.0",
|
|
45
45
|
"eslint-config-prettier": "^9.1.0",
|
|
46
46
|
"eslint-config-raine": "^0.5.0",
|
|
47
47
|
"eslint-config-standard": "^17.1.0",
|
|
48
48
|
"eslint-plugin-import": "^2.29.1",
|
|
49
|
-
"eslint-plugin-jsdoc": "^48.
|
|
50
|
-
"eslint-plugin-n": "^17.
|
|
51
|
-
"eslint-plugin-promise": "^
|
|
49
|
+
"eslint-plugin-jsdoc": "^48.11.0",
|
|
50
|
+
"eslint-plugin-n": "^17.10.1",
|
|
51
|
+
"eslint-plugin-promise": "^7.0.0",
|
|
52
52
|
"ignore": "^5.3.1",
|
|
53
53
|
"ini": "^4.1.3",
|
|
54
|
-
"inquirer": "^10.0.1",
|
|
55
54
|
"nock": "^13.5.4",
|
|
56
|
-
"vite": "^5.3.
|
|
57
|
-
"vite-node": "^2.0.
|
|
55
|
+
"vite": "^5.3.5",
|
|
56
|
+
"vite-node": "^2.0.5"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
59
|
"@types/copy-paste": "^1.1.33",
|
|
61
60
|
"@types/ini": "^4.1.1",
|
|
62
61
|
"@types/inquirer": "^9.0.7",
|
|
63
62
|
"@types/jest": "^29.5.12",
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"husky": "^9.
|
|
63
|
+
"@types/node": "^22.1.0",
|
|
64
|
+
"husky": "^9.1.4",
|
|
66
65
|
"jest": "^29.7.0",
|
|
67
66
|
"lint-prepush": "^2.2.2",
|
|
68
|
-
"lint-staged": "^15.2.
|
|
69
|
-
"ts-jest": "^29.2.
|
|
70
|
-
"typescript": "^5.5.
|
|
67
|
+
"lint-staged": "^15.2.8",
|
|
68
|
+
"ts-jest": "^29.2.4",
|
|
69
|
+
"typescript": "^5.5.4"
|
|
71
70
|
},
|
|
72
71
|
"resolutions": {
|
|
73
72
|
"eslint": "8.57.0",
|