@blockrun/runcode 1.5.10 → 1.5.12
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/agent/loop.js +37 -0
- package/package.json +1 -1
package/dist/agent/loop.js
CHANGED
|
@@ -222,6 +222,35 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
222
222
|
break; // User wants to exit
|
|
223
223
|
if (input === '')
|
|
224
224
|
continue; // Empty input → re-prompt
|
|
225
|
+
// Handle /stash and /unstash — git stash management
|
|
226
|
+
if (input === '/stash') {
|
|
227
|
+
try {
|
|
228
|
+
const { execSync } = await import('node:child_process');
|
|
229
|
+
const result = execSync('git stash push -m "runcode auto-stash"', {
|
|
230
|
+
cwd: config.workingDir || process.cwd(), encoding: 'utf-8', timeout: 10000
|
|
231
|
+
}).trim();
|
|
232
|
+
onEvent({ kind: 'text_delta', text: result || 'No changes to stash.\n' });
|
|
233
|
+
}
|
|
234
|
+
catch (e) {
|
|
235
|
+
onEvent({ kind: 'text_delta', text: `Stash error: ${e.message?.split('\n')[0]}\n` });
|
|
236
|
+
}
|
|
237
|
+
onEvent({ kind: 'turn_done', reason: 'completed' });
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (input === '/unstash') {
|
|
241
|
+
try {
|
|
242
|
+
const { execSync } = await import('node:child_process');
|
|
243
|
+
const result = execSync('git stash pop', {
|
|
244
|
+
cwd: config.workingDir || process.cwd(), encoding: 'utf-8', timeout: 10000
|
|
245
|
+
}).trim();
|
|
246
|
+
onEvent({ kind: 'text_delta', text: result || 'Stash applied.\n' });
|
|
247
|
+
}
|
|
248
|
+
catch (e) {
|
|
249
|
+
onEvent({ kind: 'text_delta', text: `Unstash error: ${e.message?.split('\n')[0]}\n` });
|
|
250
|
+
}
|
|
251
|
+
onEvent({ kind: 'turn_done', reason: 'completed' });
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
225
254
|
// Handle /branch — show current branch or create new
|
|
226
255
|
if (input === '/branch' || input.startsWith('/branch ')) {
|
|
227
256
|
try {
|
|
@@ -313,6 +342,14 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
313
342
|
if (input === '/commit') {
|
|
314
343
|
input = 'Review the current git diff and staged changes. Stage relevant files with `git add`, then create a commit with a concise message summarizing the changes. Do NOT push to remote.';
|
|
315
344
|
}
|
|
345
|
+
// Handle /review — ask agent to review current changes
|
|
346
|
+
if (input === '/review') {
|
|
347
|
+
input = 'Review the current git diff. For each changed file, check for: bugs, security issues, missing error handling, performance problems, and style issues. Provide a brief summary of findings.';
|
|
348
|
+
}
|
|
349
|
+
// Handle /fix — ask agent to fix the last error or issue
|
|
350
|
+
if (input === '/fix') {
|
|
351
|
+
input = 'Look at the most recent error or issue we discussed and fix it. Check the relevant files, identify the root cause, and apply the fix.';
|
|
352
|
+
}
|
|
316
353
|
// Handle /status — show git status
|
|
317
354
|
if (input === '/status') {
|
|
318
355
|
try {
|