robot-resources 1.12.0 → 1.12.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/setup.js +7 -1
- package/lib/wizard.js +28 -18
- package/package.json +1 -1
package/bin/setup.js
CHANGED
|
@@ -19,13 +19,19 @@ if (args.includes('--uninstall')) {
|
|
|
19
19
|
const targetArg = args.find((a) => a.startsWith('--for='));
|
|
20
20
|
const target = targetArg ? targetArg.slice('--for='.length) : null;
|
|
21
21
|
|
|
22
|
+
// Phase 5: --scope=router-only is the entry from `npx @robot-resources/router`
|
|
23
|
+
// (the standalone bin). Skips scraper steps. Default 'full' matches the
|
|
24
|
+
// unified `npx robot-resources` behavior.
|
|
25
|
+
const scopeArg = args.find((a) => a.startsWith('--scope='));
|
|
26
|
+
const scope = scopeArg ? scopeArg.slice('--scope='.length) : 'full';
|
|
27
|
+
|
|
22
28
|
// Treat piped/CI runs (no TTY on stdin OR stdout) as non-interactive so the
|
|
23
29
|
// wizard never blocks on a prompt that can't be answered. The interactive
|
|
24
30
|
// menu is only opened when both stdin and stdout are real terminals.
|
|
25
31
|
const hasTty = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
26
32
|
const nonInteractive = explicitNonInteractive || !hasTty;
|
|
27
33
|
|
|
28
|
-
runWizard({ nonInteractive, target }).catch((err) => {
|
|
34
|
+
runWizard({ nonInteractive, target, scope }).catch((err) => {
|
|
29
35
|
console.error(`\n ✗ Setup failed: ${err.message}\n`);
|
|
30
36
|
process.exit(1);
|
|
31
37
|
});
|
package/lib/wizard.js
CHANGED
|
@@ -43,7 +43,7 @@ const CLI_VERSION = (() => {
|
|
|
43
43
|
*
|
|
44
44
|
* No Python, no venv, no systemd, no port probe.
|
|
45
45
|
*/
|
|
46
|
-
export async function runWizard({ nonInteractive = false, target = null } = {}) {
|
|
46
|
+
export async function runWizard({ nonInteractive = false, target = null, scope = 'full' } = {}) {
|
|
47
47
|
header();
|
|
48
48
|
|
|
49
49
|
// Detect OC once up front. Used both to branch into the non-OC wizard and
|
|
@@ -147,6 +147,10 @@ export async function runWizard({ nonInteractive = false, target = null } = {})
|
|
|
147
147
|
// non-OC wizard handles (Node shim, Python shim, MCP, docs).
|
|
148
148
|
// Finer per-path attribution still comes from wizard_path_chosen.
|
|
149
149
|
entry: openclawDetected ? 'oc' : 'non-oc',
|
|
150
|
+
// Phase 5: 'full' is the unified `npx robot-resources` flow;
|
|
151
|
+
// 'router-only' is the standalone `npx @robot-resources/router`
|
|
152
|
+
// bin (skips scraper).
|
|
153
|
+
scope,
|
|
150
154
|
},
|
|
151
155
|
}),
|
|
152
156
|
signal: AbortSignal.timeout(5_000),
|
|
@@ -214,27 +218,33 @@ export async function runWizard({ nonInteractive = false, target = null } = {})
|
|
|
214
218
|
// Independent of router. Register scraper MCP in openclaw.json (if OC
|
|
215
219
|
// is present). Gateway restart happens once at the very end (merged
|
|
216
220
|
// with plugin restart).
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
step
|
|
221
|
+
//
|
|
222
|
+
// Phase 5: when invoked from `npx @robot-resources/router` (scope=router-only),
|
|
223
|
+
// we skip this step entirely. The standalone router CLI ships a smaller
|
|
224
|
+
// surface for users who explicitly want only routing, no scraper.
|
|
220
225
|
|
|
221
226
|
let scraperRegistered = false;
|
|
222
227
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
228
|
+
if (scope !== 'router-only') {
|
|
229
|
+
blank();
|
|
230
|
+
step('Installing Scraper...');
|
|
231
|
+
|
|
232
|
+
scraperRegistered = registerScraperMcp();
|
|
233
|
+
if (scraperRegistered) {
|
|
234
|
+
success('Scraper MCP registered in OpenClaw — scraper_compress_url(url) available');
|
|
235
|
+
results.scraper = true;
|
|
236
|
+
results.scraperMcpRegistered = true;
|
|
237
|
+
} else {
|
|
238
|
+
try {
|
|
239
|
+
const ocConfig = JSON.parse(readFileSync(join(homedir(), '.openclaw', 'openclaw.json'), 'utf-8'));
|
|
240
|
+
if (ocConfig?.mcp?.servers?.['robot-resources-scraper']) {
|
|
241
|
+
success('Scraper MCP already registered in OpenClaw');
|
|
242
|
+
results.scraper = true;
|
|
243
|
+
results.scraperMcpRegistered = true;
|
|
244
|
+
}
|
|
245
|
+
} catch {
|
|
246
|
+
// No openclaw.json — not on OC, skip
|
|
235
247
|
}
|
|
236
|
-
} catch {
|
|
237
|
-
// No openclaw.json — not on OC, skip
|
|
238
248
|
}
|
|
239
249
|
}
|
|
240
250
|
|