@apmantza/greedysearch-pi 1.0.13 → 1.0.14
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/coding-task.mjs +18 -3
- package/package.json +1 -1
package/coding-task.mjs
CHANGED
|
@@ -281,7 +281,8 @@ async function main() {
|
|
|
281
281
|
'',
|
|
282
282
|
'Examples:',
|
|
283
283
|
' node coding-task.mjs "write a debounce function in JS" --engine gemini',
|
|
284
|
-
' node coding-task.mjs "review this module" --mode review --engine all --
|
|
284
|
+
' node coding-task.mjs "review this module" --mode review --engine all --file src/myfile.mjs',
|
|
285
|
+
' node coding-task.mjs "debug this" --mode debug --engine all --file a.mjs --file b.mjs',
|
|
285
286
|
' node coding-task.mjs "I want to build X, here is my plan: ..." --mode plan --engine all',
|
|
286
287
|
].join('\n') + '\n');
|
|
287
288
|
process.exit(1);
|
|
@@ -290,7 +291,6 @@ async function main() {
|
|
|
290
291
|
const engineFlagIdx = args.indexOf('--engine');
|
|
291
292
|
const engineArg = engineFlagIdx !== -1 ? args[engineFlagIdx + 1] : 'gemini';
|
|
292
293
|
const contextFlagIdx = args.indexOf('--context');
|
|
293
|
-
const context = contextFlagIdx !== -1 ? args[contextFlagIdx + 1] : null;
|
|
294
294
|
const outIdx = args.indexOf('--out');
|
|
295
295
|
const outFile = outIdx !== -1 ? args[outIdx + 1] : null;
|
|
296
296
|
const tabFlagIdx = args.indexOf('--tab');
|
|
@@ -299,16 +299,31 @@ async function main() {
|
|
|
299
299
|
const mode = modeFlagIdx !== -1 ? args[modeFlagIdx + 1] : 'code';
|
|
300
300
|
|
|
301
301
|
if (!MODE_PROMPTS.hasOwnProperty(mode)) {
|
|
302
|
-
process.stderr.write(`Error: unknown mode "${mode}". Use: code, review, plan\n`);
|
|
302
|
+
process.stderr.write(`Error: unknown mode "${mode}". Use: code, review, plan, test, debug\n`);
|
|
303
303
|
process.exit(1);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
// --file can be repeated: --file a.mjs --file b.mjs
|
|
307
|
+
const fileIndices = [];
|
|
308
|
+
const filePaths = [];
|
|
309
|
+
for (let i = 0; i < args.length; i++) {
|
|
310
|
+
if (args[i] === '--file' && args[i + 1]) {
|
|
311
|
+
fileIndices.push(i, i + 1);
|
|
312
|
+
filePaths.push(args[i + 1]);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
const fileContext = filePaths.length > 0
|
|
316
|
+
? filePaths.map(p => `// FILE: ${p}\n${readFileSync(p, 'utf8')}`).join('\n\n')
|
|
317
|
+
: null;
|
|
318
|
+
const context = fileContext || (contextFlagIdx !== -1 ? args[contextFlagIdx + 1] : null);
|
|
319
|
+
|
|
306
320
|
const skipFlags = new Set([
|
|
307
321
|
...(engineFlagIdx >= 0 ? [engineFlagIdx, engineFlagIdx + 1] : []),
|
|
308
322
|
...(contextFlagIdx >= 0 ? [contextFlagIdx, contextFlagIdx + 1] : []),
|
|
309
323
|
...(outIdx >= 0 ? [outIdx, outIdx + 1] : []),
|
|
310
324
|
...(tabFlagIdx >= 0 ? [tabFlagIdx, tabFlagIdx + 1] : []),
|
|
311
325
|
...(modeFlagIdx >= 0 ? [modeFlagIdx, modeFlagIdx + 1] : []),
|
|
326
|
+
...fileIndices,
|
|
312
327
|
]);
|
|
313
328
|
const task = args.filter((_, i) => !skipFlags.has(i)).join(' ');
|
|
314
329
|
|
package/package.json
CHANGED