@blockrun/runcode 1.5.9 → 1.5.11

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 +65 -0
  2. package/package.json +1 -1
@@ -222,6 +222,71 @@ 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
+ }
254
+ // Handle /branch — show current branch or create new
255
+ if (input === '/branch' || input.startsWith('/branch ')) {
256
+ try {
257
+ const { execSync } = await import('node:child_process');
258
+ const cwd = config.workingDir || process.cwd();
259
+ if (input === '/branch') {
260
+ const branches = execSync('git branch -v --no-color', { cwd, encoding: 'utf-8', timeout: 5000 }).trim();
261
+ onEvent({ kind: 'text_delta', text: `\`\`\`\n${branches}\n\`\`\`\n` });
262
+ }
263
+ else {
264
+ const branchName = input.slice(8).trim();
265
+ execSync(`git checkout -b ${branchName}`, { cwd, encoding: 'utf-8', timeout: 5000 });
266
+ onEvent({ kind: 'text_delta', text: `Created and switched to branch: **${branchName}**\n` });
267
+ }
268
+ }
269
+ catch (e) {
270
+ onEvent({ kind: 'text_delta', text: `Git error: ${e.message?.split('\n')[0] || 'unknown'}\n` });
271
+ }
272
+ onEvent({ kind: 'turn_done', reason: 'completed' });
273
+ continue;
274
+ }
275
+ // Handle /log — show recent git log
276
+ if (input === '/log') {
277
+ try {
278
+ const { execSync } = await import('node:child_process');
279
+ const log = execSync('git log --oneline -15 --no-color', {
280
+ cwd: config.workingDir || process.cwd(), encoding: 'utf-8', timeout: 5000
281
+ }).trim();
282
+ onEvent({ kind: 'text_delta', text: log ? `\`\`\`\n${log}\n\`\`\`\n` : 'No commits.\n' });
283
+ }
284
+ catch {
285
+ onEvent({ kind: 'text_delta', text: 'Not a git repo.\n' });
286
+ }
287
+ onEvent({ kind: 'turn_done', reason: 'completed' });
288
+ continue;
289
+ }
225
290
  // Handle /bug — open issue tracker
226
291
  if (input === '/bug') {
227
292
  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.11",
4
4
  "description": "RunCode — AI coding agent powered by 41+ models. Pay per use with USDC.",
5
5
  "type": "module",
6
6
  "bin": {