@humanu/orchestra 0.5.5 → 0.5.6

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/bin/gw.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { spawnSync } = require('child_process');
5
+
6
+ const installScript = path.join(__dirname, '..', 'install.js');
7
+ const result = spawnSync(process.execPath, [installScript, '--invoke=gw', ...process.argv.slice(2)], {
8
+ stdio: 'inherit',
9
+ });
10
+ process.exit(result.status ?? 0);
package/bin/gwr.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { spawnSync } = require('child_process');
5
+
6
+ const installScript = path.join(__dirname, '..', 'install.js');
7
+ const result = spawnSync(process.execPath, [installScript, '--invoke=gwr', ...process.argv.slice(2)], {
8
+ stdio: 'inherit',
9
+ });
10
+ process.exit(result.status ?? 0);
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { spawnSync } = require('child_process');
5
+
6
+ const installScript = path.join(__dirname, '..', 'install.js');
7
+ const result = spawnSync(process.execPath, [installScript, '--invoke=orchestra', ...process.argv.slice(2)], {
8
+ stdio: 'inherit',
9
+ });
10
+ process.exit(result.status ?? 0);
package/install.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { execSync } = require('child_process');
3
+ const { execSync, spawnSync } = require('child_process');
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
6
 
@@ -10,7 +10,7 @@ const SUPPORTED_PLATFORMS = {
10
10
  'darwin-x64': 'macos-intel',
11
11
  'darwin-arm64': 'macos-arm64',
12
12
  'linux-x64': 'linux-x64',
13
- 'linux-arm64': 'linux-arm64'
13
+ 'linux-arm64': 'linux-arm64',
14
14
  };
15
15
 
16
16
  const packageRoot = __dirname;
@@ -78,14 +78,13 @@ function copyApiScripts() {
78
78
  sourceBase = path.join(projectRoot, 'api');
79
79
  }
80
80
 
81
- ensureDir(path.join(distDir, 'api'));
82
- const apiFiles = fs.existsSync(sourceBase) ? fs.readdirSync(sourceBase) : [];
81
+ const destApiDir = path.join(distDir, 'api');
82
+ ensureDir(destApiDir);
83
+
84
+ const apiFiles = fs.readdirSync(sourceBase).filter((file) => file.endsWith('.sh'));
83
85
  for (const file of apiFiles) {
84
- if (!file.endsWith('.sh')) {
85
- continue;
86
- }
87
86
  const sourcePath = path.join(sourceBase, file);
88
- const destinationPath = path.join(distDir, 'api', file);
87
+ const destinationPath = path.join(destApiDir, file);
89
88
  fs.copyFileSync(sourcePath, destinationPath);
90
89
  fs.chmodSync(destinationPath, 0o755);
91
90
  }
@@ -104,7 +103,6 @@ function linkCompatibilityBinary(binaryPath) {
104
103
  try {
105
104
  fs.symlinkSync(binaryPath, gwTuiPath);
106
105
  } catch (err) {
107
- // Fallback for filesystems that disallow symlinks
108
106
  fs.copyFileSync(binaryPath, gwTuiPath);
109
107
  fs.chmodSync(gwTuiPath, 0o755);
110
108
  }
@@ -153,6 +151,10 @@ function buildFromSource() {
153
151
  linkCompatibilityBinary(destination);
154
152
  }
155
153
 
154
+ function assetsReady() {
155
+ return fs.existsSync(path.join(distDir, BINARY_NAME)) && fs.existsSync(path.join(distDir, 'gwr.sh'));
156
+ }
157
+
156
158
  function printShellWrapperInstructions(binaryPath) {
157
159
  const distPathEscaped = distDir.split('\\').join('\\\\');
158
160
  const binaryPathEscaped = binaryPath.split('\\').join('\\\\');
@@ -182,11 +184,12 @@ gw() {
182
184
  console.log('\nAdd these to your ~/.bashrc or ~/.zshrc, then run: source ~/.bashrc (or source ~/.zshrc)\n');
183
185
  }
184
186
 
185
- function main() {
186
- console.log('Installing Orchestra...\n');
187
+ function performSetup({ quiet = false, showInstructions = false } = {}) {
188
+ if (!quiet) {
189
+ console.log('Installing Orchestra...\n');
190
+ }
187
191
 
188
192
  cleanDir(distDir);
189
-
190
193
  copyShellScripts();
191
194
  copyApiScripts();
192
195
 
@@ -197,8 +200,87 @@ function main() {
197
200
 
198
201
  const binaryPath = path.join(distDir, BINARY_NAME);
199
202
 
200
- console.log('\n✅ Installation complete!');
201
- printShellWrapperInstructions(binaryPath);
203
+ if (!quiet) {
204
+ console.log('\n✅ Installation complete!');
205
+ }
206
+ if (showInstructions) {
207
+ printShellWrapperInstructions(binaryPath);
208
+ }
209
+ }
210
+
211
+ function ensureAssets() {
212
+ if (!assetsReady()) {
213
+ performSetup({ quiet: false, showInstructions: false });
214
+ }
215
+ }
216
+
217
+ function runCommand(command, args) {
218
+ ensureAssets();
219
+
220
+ const scriptName = command === 'gw' ? 'gw.sh' : 'gwr.sh';
221
+ const scriptPath = path.join(distDir, scriptName);
222
+ if (!fs.existsSync(scriptPath)) {
223
+ console.error(`Missing script: ${scriptPath}`);
224
+ process.exit(1);
225
+ }
226
+
227
+ const env = { ...process.env };
228
+ if (command !== 'gw') {
229
+ env.GW_TUI_BIN = path.join(distDir, BINARY_NAME);
230
+ }
231
+
232
+ const result = spawnSync('bash', [scriptPath, ...args], {
233
+ stdio: 'inherit',
234
+ env,
235
+ });
236
+
237
+ if (result.error) {
238
+ console.error(`Failed to launch ${command}:`, result.error.message);
239
+ process.exit(result.status ?? 1);
240
+ }
241
+
242
+ process.exit(result.status ?? 0);
243
+ }
244
+
245
+ function parseArgs() {
246
+ const argv = process.argv.slice(2);
247
+ let invoke = null;
248
+ const args = [];
249
+
250
+ for (let i = 0; i < argv.length; i += 1) {
251
+ const value = argv[i];
252
+ if (value === '--invoke' && i + 1 < argv.length) {
253
+ invoke = argv[i + 1];
254
+ i += 1;
255
+ continue;
256
+ }
257
+ if (value.startsWith('--invoke=')) {
258
+ invoke = value.slice('--invoke='.length);
259
+ continue;
260
+ }
261
+ args.push(value);
262
+ }
263
+
264
+ return { invoke, args };
265
+ }
266
+
267
+ function main() {
268
+ const lifecycle = process.env.npm_lifecycle_event;
269
+ const { invoke, args } = parseArgs();
270
+
271
+ if (lifecycle === 'postinstall') {
272
+ performSetup({ quiet: false, showInstructions: true });
273
+ return;
274
+ }
275
+
276
+ if (invoke) {
277
+ const command = invoke === 'gw' ? 'gw' : 'gwr';
278
+ runCommand(command, args);
279
+ return;
280
+ }
281
+
282
+ // If someone runs `node install.js` manually, treat it as a setup utility.
283
+ performSetup({ quiet: false, showInstructions: true });
202
284
  }
203
285
 
204
286
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanu/orchestra",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "AI-powered Git worktree and tmux session manager with modern TUI",
5
5
  "keywords": [
6
6
  "git",
@@ -26,9 +26,9 @@
26
26
  "author": "Human Unsupervised",
27
27
  "main": "install.js",
28
28
  "bin": {
29
- "orchestra": "install.js",
30
- "gwr": "install.js",
31
- "gw": "install.js"
29
+ "orchestra": "bin/orchestra.js",
30
+ "gwr": "bin/gwr.js",
31
+ "gw": "bin/gw.js"
32
32
  },
33
33
  "files": [
34
34
  "bin/",