@blockrun/runcode 1.6.5 → 1.7.1

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 (2) hide show
  1. package/dist/agent/loop.js +53 -0
  2. package/package.json +1 -1
@@ -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,36 @@ 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
+ }
425
+ // Handle /security — security audit
426
+ if (input === '/security') {
427
+ input = 'Audit the codebase for security issues. Check for: SQL injection, XSS, command injection, hardcoded secrets, insecure dependencies, OWASP top 10 vulnerabilities. Report findings with severity.';
428
+ }
429
+ // Handle /lint — code quality
430
+ if (input === '/lint') {
431
+ input = 'Check for code quality issues: unused imports, inconsistent naming, missing type annotations, long functions, duplicated code. Suggest improvements.';
432
+ }
433
+ // Handle /doc <target> — generate documentation
434
+ if (input.startsWith('/doc ')) {
435
+ const target = input.slice(5).trim();
436
+ input = `Generate documentation for ${target}. Include: purpose, API/interface description, usage examples, and important notes.`;
437
+ }
438
+ // Handle /migrate — migration helper
439
+ if (input === '/migrate') {
440
+ input = 'Check for pending database migrations, outdated dependencies, or breaking changes that need addressing. List required migration steps.';
441
+ }
442
+ // Handle /clean — cleanup dead code
443
+ if (input === '/clean') {
444
+ input = 'Find and remove dead code: unused imports, unreachable code, commented-out blocks, unused variables and functions. Show what would be removed before making changes.';
445
+ }
393
446
  // Handle /status — show git status
394
447
  if (input === '/status') {
395
448
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/runcode",
3
- "version": "1.6.5",
3
+ "version": "1.7.1",
4
4
  "description": "RunCode — AI coding agent powered by 41+ models. Pay per use with USDC.",
5
5
  "type": "module",
6
6
  "bin": {