@blockrun/runcode 1.6.4 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/loop.js +32 -0
- package/dist/commands/stats.js +1 -1
- package/package.json +1 -1
package/dist/agent/loop.js
CHANGED
|
@@ -342,6 +342,29 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
342
342
|
if (input === '/commit') {
|
|
343
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.';
|
|
344
344
|
}
|
|
345
|
+
// Handle /undo — undo last commit (keep changes)
|
|
346
|
+
if (input === '/undo') {
|
|
347
|
+
try {
|
|
348
|
+
const { execSync } = await import('node:child_process');
|
|
349
|
+
const result = execSync('git reset --soft HEAD~1', {
|
|
350
|
+
cwd: config.workingDir || process.cwd(), encoding: 'utf-8', timeout: 5000
|
|
351
|
+
}).trim();
|
|
352
|
+
onEvent({ kind: 'text_delta', text: result || 'Last commit undone. Changes preserved in staging.\n' });
|
|
353
|
+
}
|
|
354
|
+
catch (e) {
|
|
355
|
+
onEvent({ kind: 'text_delta', text: `Undo error: ${e.message?.split('\n')[0]}\n` });
|
|
356
|
+
}
|
|
357
|
+
onEvent({ kind: 'turn_done', reason: 'completed' });
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
// Handle /push — push to remote
|
|
361
|
+
if (input === '/push') {
|
|
362
|
+
input = 'Push the current branch to the remote repository using `git push`. Show the result.';
|
|
363
|
+
}
|
|
364
|
+
// Handle /pr — create pull request
|
|
365
|
+
if (input === '/pr') {
|
|
366
|
+
input = 'Create a pull request for the current branch. First check `git log --oneline main..HEAD` to see commits, then use `gh pr create` with a descriptive title and body summarizing the changes. If gh CLI is not available, show the manual steps.';
|
|
367
|
+
}
|
|
345
368
|
// Handle /review — ask agent to review current changes
|
|
346
369
|
if (input === '/review') {
|
|
347
370
|
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.';
|
|
@@ -390,6 +413,15 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
390
413
|
if (input === '/deps') {
|
|
391
414
|
input = 'Read the project dependency file (package.json, requirements.txt, go.mod, Cargo.toml, etc.) and list key dependencies with their versions.';
|
|
392
415
|
}
|
|
416
|
+
// Handle /scaffold <desc> — generate boilerplate
|
|
417
|
+
if (input.startsWith('/scaffold ')) {
|
|
418
|
+
const desc = input.slice(10).trim();
|
|
419
|
+
input = `Create the scaffolding/boilerplate for: ${desc}. Generate the file structure and initial code. Ask me if you need clarification on requirements.`;
|
|
420
|
+
}
|
|
421
|
+
// Handle /optimize — performance optimization
|
|
422
|
+
if (input === '/optimize') {
|
|
423
|
+
input = 'Analyze the codebase for performance issues. Check for: unnecessary re-renders, N+1 queries, missing indexes, unoptimized loops, large bundle sizes, and memory leaks. Provide specific recommendations.';
|
|
424
|
+
}
|
|
393
425
|
// Handle /status — show git status
|
|
394
426
|
if (input === '/status') {
|
|
395
427
|
try {
|
package/dist/commands/stats.js
CHANGED
|
@@ -37,7 +37,7 @@ export function statsCommand(options) {
|
|
|
37
37
|
console.log(chalk.bold('\n Overview') + chalk.gray(` (${period})\n`));
|
|
38
38
|
console.log(` Requests: ${chalk.cyan(stats.totalRequests.toLocaleString())}`);
|
|
39
39
|
console.log(` Total Cost: ${chalk.green('$' + stats.totalCostUsd.toFixed(4))}`);
|
|
40
|
-
console.log(` Avg per Request
|
|
40
|
+
console.log(` Avg per Request: ${chalk.gray('$' + avgCostPerRequest.toFixed(6))}`);
|
|
41
41
|
console.log(` Input Tokens: ${stats.totalInputTokens.toLocaleString()}`);
|
|
42
42
|
console.log(` Output Tokens: ${stats.totalOutputTokens.toLocaleString()}`);
|
|
43
43
|
if (stats.totalFallbacks > 0) {
|