robot-resources 1.12.0 → 1.12.2

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 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
  });
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import { select } from '@inquirer/prompts';
4
- import { isClaudeCodeInstalled, isCursorInstalled } from './detect.js';
4
+ import { isClaudeCodeInstalled, isCursorInstalled, detectAgentRuntime } from './detect.js';
5
5
  import { configureClaudeCode, configureCursor } from './tool-config.js';
6
6
  import { header, info, success, warn, blank } from './ui.js';
7
7
  import { readConfig } from './config.mjs';
@@ -223,6 +223,29 @@ export async function runNonOcWizard({ nonInteractive = false, target = null } =
223
223
  }
224
224
 
225
225
  if (nonInteractive) {
226
+ // Phase 3.5: when project shape is unambiguous (cwd has a package.json
227
+ // OR a Python project file), auto-install the matching shim instead of
228
+ // bailing with a hint. CI/agents running `npx robot-resources` from
229
+ // their repo are exactly this case — making them pass `--for=` is
230
+ // friction we don't need.
231
+ //
232
+ // The Phase 3 noninteractive_no_target path is preserved for the case
233
+ // where detection finds nothing (truly empty cwd, generic shell run).
234
+ const runtime = detectAgentRuntime();
235
+ let autoTarget = null;
236
+ if (runtime.kind === 'node' || runtime.kind === 'both') autoTarget = 'js';
237
+ else if (runtime.kind === 'python') autoTarget = 'python';
238
+
239
+ if (autoTarget) {
240
+ // Brief context so the install step doesn't feel sudden.
241
+ info(`Detected a ${autoTarget === 'js' ? 'Node' : 'Python'} project — installing the matching shim automatically.`);
242
+ info(' Pass --for=<other> to override, or --uninstall to remove later.');
243
+ blank();
244
+ await runPath(autoTarget);
245
+ await emitPathChosen(autoTarget);
246
+ return;
247
+ }
248
+
226
249
  info('Robot Resources requires OpenClaw, which we did not detect on this machine.');
227
250
  info('To bypass this prompt in CI / non-TTY contexts, re-run with --for=<target>:');
228
251
  info(' npx robot-resources --for=langchain # JS/TS agent');
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
- blank();
219
- step('Installing Scraper...');
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
- scraperRegistered = registerScraperMcp();
224
- if (scraperRegistered) {
225
- success('Scraper MCP registered in OpenClaw — scraper_compress_url(url) available');
226
- results.scraper = true;
227
- results.scraperMcpRegistered = true;
228
- } else {
229
- try {
230
- const ocConfig = JSON.parse(readFileSync(join(homedir(), '.openclaw', 'openclaw.json'), 'utf-8'));
231
- if (ocConfig?.mcp?.servers?.['robot-resources-scraper']) {
232
- success('Scraper MCP already registered in OpenClaw');
233
- results.scraper = true;
234
- results.scraperMcpRegistered = true;
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robot-resources",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "Robot Resources — AI agent tools. One command to install everything.",
5
5
  "type": "module",
6
6
  "bin": {