jbai-cli 1.5.4 → 1.6.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/README.md CHANGED
@@ -76,6 +76,16 @@ jbai-opencode
76
76
  jbai handoff --task "continue this work in orca-lab"
77
77
  ```
78
78
 
79
+ ### Handoff to Orca Lab (nightly/staging)
80
+ ```bash
81
+ export ORCA_LAB_URL="https://orca-lab-nightly.labs.jb.gg"
82
+ export FACADE_JWT_TOKEN="..." # required for /api/handoff
83
+ export GITHUB_TOKEN="..." # repo clone during provisioning
84
+
85
+ jbai handoff --task "add new e2e test" \
86
+ --repo "https://github.com/JetBrains/jcp-orca-facade.git"
87
+ ```
88
+
79
89
  ### In-session handoff (interactive tools)
80
90
  While running `jbai-codex`, `jbai-claude`, `jbai-gemini`, or `jbai-opencode`:
81
91
  - Press `Ctrl+]` to trigger a handoff to Orca Lab.
@@ -83,7 +93,7 @@ While running `jbai-codex`, `jbai-claude`, `jbai-gemini`, or `jbai-opencode`:
83
93
 
84
94
  Optional environment variables:
85
95
  - `ORCA_LAB_URL` (default: `http://localhost:3000`)
86
- - `FACADE_JWT_TOKEN` (local facade auth)
96
+ - `FACADE_JWT_TOKEN` (required for /api/handoff on hosted Orca Lab)
87
97
  - `GITHUB_TOKEN` / `GH_TOKEN` (private repos)
88
98
  - `JBAI_HANDOFF_TASK` (fallback task if no prompt captured)
89
99
  - `JBAI_HANDOFF_REPO` (override repo URL)
@@ -54,13 +54,33 @@ function runWithHandoff({
54
54
 
55
55
  process.stderr.write(`ℹ️ Handoff trigger: ${label}\n`);
56
56
 
57
- const ptyProcess = pty.spawn(command, args, {
58
- name: 'xterm-256color',
59
- cols: process.stdout.columns || 80,
60
- rows: process.stdout.rows || 24,
61
- cwd: process.cwd(),
62
- env,
63
- });
57
+ let ptyProcess;
58
+ try {
59
+ ptyProcess = pty.spawn(command, args, {
60
+ name: 'xterm-256color',
61
+ cols: process.stdout.columns || 80,
62
+ rows: process.stdout.rows || 24,
63
+ cwd: process.cwd(),
64
+ env,
65
+ });
66
+ } catch (err) {
67
+ // node-pty throws synchronous errors (e.g., posix_spawnp failed) when executable not found
68
+ const error = new Error(err.message || 'Failed to spawn process');
69
+ // Check if this is likely a "command not found" error
70
+ const isNotFound = err.message && (
71
+ err.message.includes('posix_spawnp failed') ||
72
+ err.message.includes('ENOENT') ||
73
+ err.message.includes('not found')
74
+ );
75
+ error.code = isNotFound ? 'ENOENT' : 'SPAWN_ERROR';
76
+ error.command = command;
77
+ error.originalError = err;
78
+ // Return a minimal event emitter that immediately emits the error
79
+ const { EventEmitter } = require('events');
80
+ const fakeChild = new EventEmitter();
81
+ setImmediate(() => fakeChild.emit('error', error));
82
+ return fakeChild;
83
+ }
64
84
 
65
85
  let lineBuffer = '';
66
86
  let lastPrompt = '';
@@ -1,7 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const fs = require('fs');
4
+ const path = require('path');
3
5
  const config = require('./config');
4
6
 
7
+ // Fix node-pty spawn-helper permissions (macOS/Linux)
8
+ // The prebuilt binary sometimes loses execute permissions during npm install
9
+ try {
10
+ const platform = process.platform === 'darwin' ? 'darwin' : process.platform;
11
+ const arch = process.arch;
12
+ const spawnHelperPath = path.join(
13
+ __dirname,
14
+ '..',
15
+ 'node_modules',
16
+ 'node-pty',
17
+ 'prebuilds',
18
+ `${platform}-${arch}`,
19
+ 'spawn-helper'
20
+ );
21
+ if (fs.existsSync(spawnHelperPath)) {
22
+ fs.chmodSync(spawnHelperPath, 0o755);
23
+ }
24
+ } catch {
25
+ // Ignore errors - this is a best-effort fix
26
+ }
27
+
5
28
  console.log(`
6
29
  ╔══════════════════════════════════════════════════════════════╗
7
30
  ║ jbai-cli installed! ║
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jbai-cli",
3
- "version": "1.5.4",
3
+ "version": "1.6.0",
4
4
  "description": "CLI wrappers to use AI coding tools (Claude Code, Codex, Gemini CLI, OpenCode) with JetBrains AI Platform",
5
5
  "keywords": [
6
6
  "jetbrains",