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.
- package/bin/install.js +38 -9
- 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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
+ '
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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) {
|