nubos-pilot 1.0.0 → 1.0.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/bin/install.js +38 -9
  2. package/package.json +1 -1
package/bin/install.js CHANGED
@@ -146,23 +146,52 @@ function _opencodeManifestPrefix(scope) {
146
146
  : OPENCODE_MANIFEST_PREFIX;
147
147
  }
148
148
 
149
- function _writeToolsShim(projectRoot) {
150
- const shimDir = path.join(projectRoot, STATE_SUBPATH, 'bin');
151
- const shimPath = path.join(shimDir, 'np-tools.cjs');
152
- const target = path.resolve(__dirname, '..', 'np-tools.cjs');
153
- const body = '#!/usr/bin/env node\n'
149
+ // Bins the workflows reference via `node .nubos-pilot/bin/<name>`. Each one
150
+ // gets a thin shim in the project's bin dir that re-execs the npm-installed
151
+ // target. New bins added at the source side must be added here too — the
152
+ // installer doesn't autodiscover.
153
+ const PROJECT_BIN_SHIMS = [
154
+ { name: 'np-tools.cjs', targetRel: '../np-tools.cjs', mode: 'main' },
155
+ { name: 'researcher-merge.cjs', targetRel: 'researcher-merge.cjs', mode: 'spawn' },
156
+ ];
157
+
158
+ function _renderShim(target, mode) {
159
+ if (mode === 'main') {
160
+ return '#!/usr/bin/env node\n'
161
+ + "'use strict';\n"
162
+ + 'const fs = require(\'node:fs\');\n'
163
+ + 'const TARGET = ' + JSON.stringify(target) + ';\n'
164
+ + 'if (!fs.existsSync(TARGET)) {\n'
165
+ + ' process.stderr.write("nubos-pilot: tool binary fehlt unter " + TARGET + "\\nFix: npx nubos-pilot@latest update\\n");\n'
166
+ + ' process.exit(1);\n'
167
+ + '}\n'
168
+ + 'require(TARGET).main();\n';
169
+ }
170
+ return '#!/usr/bin/env node\n'
154
171
  + "'use strict';\n"
155
172
  + 'const fs = require(\'node:fs\');\n'
173
+ + 'const { spawn } = require(\'node:child_process\');\n'
156
174
  + 'const TARGET = ' + JSON.stringify(target) + ';\n'
157
175
  + 'if (!fs.existsSync(TARGET)) {\n'
158
176
  + ' process.stderr.write("nubos-pilot: tool binary fehlt unter " + TARGET + "\\nFix: npx nubos-pilot@latest update\\n");\n'
159
177
  + ' process.exit(1);\n'
160
178
  + '}\n'
161
- + 'require(TARGET).main();\n';
179
+ + 'const child = spawn(process.execPath, [TARGET, ...process.argv.slice(2)], { stdio: \'inherit\' });\n'
180
+ + 'child.on(\'exit\', (code, sig) => { if (sig) process.kill(process.pid, sig); else process.exit(code == null ? 1 : code); });\n';
181
+ }
182
+
183
+ function _writeToolsShim(projectRoot) {
184
+ const shimDir = path.join(projectRoot, STATE_SUBPATH, 'bin');
162
185
  fs.mkdirSync(shimDir, { recursive: true });
163
- atomicWriteFileSync(shimPath, body);
164
- try { fs.chmodSync(shimPath, 0o755); } catch {}
165
- return shimPath;
186
+ let primary = null;
187
+ for (const spec of PROJECT_BIN_SHIMS) {
188
+ const shimPath = path.join(shimDir, spec.name);
189
+ const target = path.resolve(__dirname, spec.targetRel);
190
+ atomicWriteFileSync(shimPath, _renderShim(target, spec.mode));
191
+ try { fs.chmodSync(shimPath, 0o755); } catch {}
192
+ if (spec.name === 'np-tools.cjs') primary = shimPath;
193
+ }
194
+ return primary;
166
195
  }
167
196
 
168
197
  function _stateDirFor(projectRoot) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nubos-pilot",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "AI-driven planning and execution tool for code projects",
5
5
  "homepage": "https://github.com/Nubos-AI/nubos-pilot",
6
6
  "repository": {