firecrawl-cli 1.15.0 → 1.15.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.
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  * `firecrawl create` command — scaffolds Firecrawl starter projects.
3
3
  *
4
- * Hidden from --help until `firecrawl-agent-cli` is published to npm.
4
+ * Hidden from --help until the flow is battle-tested in the wild. The
5
+ * scaffolder is vendored under `src/utils/agent-scaffold/` (mirrored from
6
+ * `firecrawl/firecrawl-agent`). At runtime it clones the public agent repo
7
+ * to get templates — no separate npm package for the agent CLI.
8
+ *
5
9
  * Once visible, the command tree will grow to include additional kinds
6
10
  * (scrape, browser, ai, app). For now, `agent` is the only kind.
7
- *
8
- * Implementation is a thin delegator: `firecrawl create agent ...` execs
9
- * `npx -y firecrawl-agent-cli create ...` and passes all flags through.
10
- * This avoids vendoring the scaffold code in the root CLI; the agent repo
11
- * remains the single source of truth for templates and the manifest.
12
11
  */
13
12
  import { Command } from 'commander';
14
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2HpC;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAQ7C"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0EpC;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAQ7C"}
@@ -2,48 +2,57 @@
2
2
  /**
3
3
  * `firecrawl create` command — scaffolds Firecrawl starter projects.
4
4
  *
5
- * Hidden from --help until `firecrawl-agent-cli` is published to npm.
5
+ * Hidden from --help until the flow is battle-tested in the wild. The
6
+ * scaffolder is vendored under `src/utils/agent-scaffold/` (mirrored from
7
+ * `firecrawl/firecrawl-agent`). At runtime it clones the public agent repo
8
+ * to get templates — no separate npm package for the agent CLI.
9
+ *
6
10
  * Once visible, the command tree will grow to include additional kinds
7
11
  * (scrape, browser, ai, app). For now, `agent` is the only kind.
8
- *
9
- * Implementation is a thin delegator: `firecrawl create agent ...` execs
10
- * `npx -y firecrawl-agent-cli create ...` and passes all flags through.
11
- * This avoids vendoring the scaffold code in the root CLI; the agent repo
12
- * remains the single source of truth for templates and the manifest.
13
12
  */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
14
46
  Object.defineProperty(exports, "__esModule", { value: true });
15
47
  exports.createCreateCommand = createCreateCommand;
16
48
  const commander_1 = require("commander");
17
- const child_process_1 = require("child_process");
18
- /** npm package name of the Firecrawl Agent CLI (bin: `firecrawl-agent`). */
19
- const AGENT_CLI_PACKAGE = 'firecrawl-agent-cli';
20
- /**
21
- * Execute `npx -y <AGENT_CLI_PACKAGE> create ...` with inherited stdio so
22
- * the agent CLI's interactive prompts render in the user's terminal.
23
- * Resolves with the child exit code; callers forward it to `process.exit`.
24
- */
25
- function runAgentCli(args) {
26
- const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
27
- return new Promise((resolve) => {
28
- const child = (0, child_process_1.spawn)(npx, ['-y', AGENT_CLI_PACKAGE, 'create', ...args], {
29
- stdio: 'inherit',
30
- env: process.env,
31
- });
32
- child.on('exit', (code) => resolve(code ?? 1));
33
- child.on('error', (err) => {
34
- console.error(`\nFailed to launch ${AGENT_CLI_PACKAGE} via npx:`, err.message);
35
- console.error(`\n Install it directly and retry: npm install -g ${AGENT_CLI_PACKAGE}\n`);
36
- resolve(1);
37
- });
38
- });
39
- }
40
49
  function collect(val, acc) {
41
50
  acc.push(val);
42
51
  return acc;
43
52
  }
44
53
  /**
45
- * Build the `agent` subcommand. Flag surface mirrors `firecrawl-agent create`
46
- * exactly anything the downstream CLI accepts is passed through verbatim.
54
+ * Build the `agent` subcommand. Flag surface mirrors the upstream agent CLI.
55
+ * The scaffold flow itself lives in `utils/agent-scaffold/create-flow.ts`.
47
56
  */
48
57
  function createAgentSubcommand() {
49
58
  return new commander_1.Command('agent')
@@ -58,44 +67,23 @@ function createAgentSubcommand() {
58
67
  .option('--api-key <key>', 'Firecrawl API key')
59
68
  .option('--key <provider=key>', 'Provider API key (repeatable, e.g. --key anthropic=sk-...)', collect, [])
60
69
  .option('--skip-install', 'Skip npm install')
61
- .allowUnknownOption() // Forward future flags without requiring a CLI update
62
- .action(async (projectName, options, cmd) => {
63
- const args = [];
64
- if (projectName)
65
- args.push(projectName);
66
- // Pass through known options. Commander camelCases hyphenated flags,
67
- // so we map back to the CLI-facing kebab-case form.
68
- const flagMap = [
69
- ['template', '-t'],
70
- ['provider', '--provider'],
71
- ['model', '--model'],
72
- ['subAgentProvider', '--sub-agent-provider'],
73
- ['subAgentModel', '--sub-agent-model'],
74
- ['from', '--from'],
75
- ['apiKey', '--api-key'],
76
- ];
77
- for (const [optKey, flag] of flagMap) {
78
- const val = options[optKey];
79
- if (typeof val === 'string' && val.length > 0)
80
- args.push(flag, val);
81
- }
82
- // --key is repeatable
83
- const keys = options.key;
84
- if (Array.isArray(keys)) {
85
- for (const k of keys) {
86
- if (typeof k === 'string' && k.length > 0)
87
- args.push('--key', k);
88
- }
89
- }
90
- if (options.skipInstall)
91
- args.push('--skip-install');
92
- // Forward any unknown/forward-compatible options verbatim.
93
- const passthrough = cmd.args.slice(projectName ? 1 : 0);
94
- for (const extra of passthrough)
95
- args.push(extra);
96
- const code = await runAgentCli(args);
97
- if (code !== 0)
98
- process.exit(code);
70
+ .action(async (projectName, options) => {
71
+ // Lazy-load the scaffolder so startup cost (inquirer, git) only hits
72
+ // users who actually invoke `create`. Keeps the rest of the CLI snappy.
73
+ const { handleCreate } = await Promise.resolve().then(() => __importStar(require('../utils/agent-scaffold/create-flow')));
74
+ await handleCreate(projectName, {
75
+ template: options.template,
76
+ provider: options.provider,
77
+ model: options.model,
78
+ subAgentProvider: options.subAgentProvider,
79
+ subAgentModel: options.subAgentModel,
80
+ from: options.from,
81
+ apiKey: options.apiKey,
82
+ key: Array.isArray(options.key)
83
+ ? options.key
84
+ : undefined,
85
+ skipInstall: options.skipInstall,
86
+ });
99
87
  });
100
88
  }
101
89
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAiIH,kDAQC;AAvID,yCAAoC;AACpC,iDAAsC;AAEtC,4EAA4E;AAC5E,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEhD;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAAc;I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AED;;;GAGG;AACH,SAAgB,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAC3C,sCAAsC,CACvC,CAAC;IAEF,GAAG,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAExC,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Vendored from firecrawl/firecrawl-agent:.internal/cli/src/commands/init.ts
3
+ *
4
+ * This is the interactive-to-non-interactive create flow. The original file
5
+ * also exposed a `createInitCommand` commander builder — we drop that here
6
+ * because the root CLI's `src/commands/create.ts` owns the command surface.
7
+ * `handleCreate` (renamed from `handleInit`) is what we export.
8
+ *
9
+ * Keep in sync with upstream when the create flow evolves.
10
+ */
11
+ export interface CreateOptions {
12
+ template?: string;
13
+ provider?: string;
14
+ model?: string;
15
+ subAgentProvider?: string;
16
+ subAgentModel?: string;
17
+ from?: string;
18
+ apiKey?: string;
19
+ key?: string[];
20
+ skipInstall?: boolean;
21
+ }
22
+ export declare function handleCreate(rawName: string | undefined, options: CreateOptions): Promise<void>;
23
+ //# sourceMappingURL=create-flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-flow.d.ts","sourceRoot":"","sources":["../../../src/utils/agent-scaffold/create-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAgCH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAkED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,IAAI,CAAC,CAwZf"}