@blockrun/runcode 1.5.9 → 1.5.10

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 +36 -0
  2. package/package.json +1 -1
@@ -222,6 +222,42 @@ 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 /branch — show current branch or create new
226
+ if (input === '/branch' || input.startsWith('/branch ')) {
227
+ try {
228
+ const { execSync } = await import('node:child_process');
229
+ const cwd = config.workingDir || process.cwd();
230
+ if (input === '/branch') {
231
+ const branches = execSync('git branch -v --no-color', { cwd, encoding: 'utf-8', timeout: 5000 }).trim();
232
+ onEvent({ kind: 'text_delta', text: `\`\`\`\n${branches}\n\`\`\`\n` });
233
+ }
234
+ else {
235
+ const branchName = input.slice(8).trim();
236
+ execSync(`git checkout -b ${branchName}`, { cwd, encoding: 'utf-8', timeout: 5000 });
237
+ onEvent({ kind: 'text_delta', text: `Created and switched to branch: **${branchName}**\n` });
238
+ }
239
+ }
240
+ catch (e) {
241
+ onEvent({ kind: 'text_delta', text: `Git error: ${e.message?.split('\n')[0] || 'unknown'}\n` });
242
+ }
243
+ onEvent({ kind: 'turn_done', reason: 'completed' });
244
+ continue;
245
+ }
246
+ // Handle /log — show recent git log
247
+ if (input === '/log') {
248
+ try {
249
+ const { execSync } = await import('node:child_process');
250
+ const log = execSync('git log --oneline -15 --no-color', {
251
+ cwd: config.workingDir || process.cwd(), encoding: 'utf-8', timeout: 5000
252
+ }).trim();
253
+ onEvent({ kind: 'text_delta', text: log ? `\`\`\`\n${log}\n\`\`\`\n` : 'No commits.\n' });
254
+ }
255
+ catch {
256
+ onEvent({ kind: 'text_delta', text: 'Not a git repo.\n' });
257
+ }
258
+ onEvent({ kind: 'turn_done', reason: 'completed' });
259
+ continue;
260
+ }
225
261
  // Handle /bug — open issue tracker
226
262
  if (input === '/bug') {
227
263
  onEvent({ kind: 'text_delta', text: 'Report issues at: https://github.com/BlockRunAI/runcode/issues\n' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/runcode",
3
- "version": "1.5.9",
3
+ "version": "1.5.10",
4
4
  "description": "RunCode — AI coding agent powered by 41+ models. Pay per use with USDC.",
5
5
  "type": "module",
6
6
  "bin": {