firecrawl-cli 1.15.0 → 1.15.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/dist/commands/create.d.ts +5 -6
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +57 -69
- package/dist/commands/create.js.map +1 -1
- package/dist/utils/agent-scaffold/create-flow.d.ts +23 -0
- package/dist/utils/agent-scaffold/create-flow.d.ts.map +1 -0
- package/dist/utils/agent-scaffold/create-flow.js +515 -0
- package/dist/utils/agent-scaffold/create-flow.js.map +1 -0
- package/dist/utils/agent-scaffold/credentials.d.ts +20 -0
- package/dist/utils/agent-scaffold/credentials.d.ts.map +1 -0
- package/dist/utils/agent-scaffold/credentials.js +84 -0
- package/dist/utils/agent-scaffold/credentials.js.map +1 -0
- package/dist/utils/agent-scaffold/manifest.d.ts +57 -0
- package/dist/utils/agent-scaffold/manifest.d.ts.map +1 -0
- package/dist/utils/agent-scaffold/manifest.js +176 -0
- package/dist/utils/agent-scaffold/manifest.js.map +1 -0
- package/dist/utils/agent-scaffold/scaffold.d.ts +21 -0
- package/dist/utils/agent-scaffold/scaffold.d.ts.map +1 -0
- package/dist/utils/agent-scaffold/scaffold.js +213 -0
- package/dist/utils/agent-scaffold/scaffold.js.map +1 -0
- package/dist/utils/agent-scaffold/ui.d.ts +20 -0
- package/dist/utils/agent-scaffold/ui.d.ts.map +1 -0
- package/dist/utils/agent-scaffold/ui.js +44 -0
- package/dist/utils/agent-scaffold/ui.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `firecrawl create` command — scaffolds Firecrawl starter projects.
|
|
3
3
|
*
|
|
4
|
-
* Hidden from --help until
|
|
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/web-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
|
|
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"}
|
package/dist/commands/create.js
CHANGED
|
@@ -2,48 +2,57 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* `firecrawl create` command — scaffolds Firecrawl starter projects.
|
|
4
4
|
*
|
|
5
|
-
* Hidden from --help until
|
|
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/web-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
|
|
46
|
-
*
|
|
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
|
-
.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFH,kDAQC;AAtFD,yCAAoC;AAGpC,SAAS,OAAO,CAAC,GAAW,EAAE,GAAa;IACzC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACd,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,SAAS,qBAAqB;IAC5B,OAAO,IAAI,mBAAO,CAAC,OAAO,CAAC;SACxB,WAAW,CACV,uEAAuE,CACxE;SACA,QAAQ,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;SACpD,MAAM,CACL,qBAAqB,EACrB,2CAA2C,EAC3C,MAAM,CACP;SACA,MAAM,CACL,iBAAiB,EACjB,iFAAiF,CAClF;SACA,MAAM,CAAC,cAAc,EAAE,uBAAuB,CAAC;SAC/C,MAAM,CACL,2BAA2B,EAC3B,qDAAqD,CACtD;SACA,MAAM,CACL,wBAAwB,EACxB,+CAA+C,CAChD;SACA,MAAM,CACL,iBAAiB,EACjB,kEAAkE,CACnE;SACA,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;SAC9C,MAAM,CACL,sBAAsB,EACtB,4DAA4D,EAC5D,OAAO,EACP,EAAE,CACH;SACA,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;SAC5C,MAAM,CACL,KAAK,EACH,WAA+B,EAC/B,OAAgD,EAChD,EAAE;QACF,qEAAqE;QACrE,wEAAwE;QACxE,MAAM,EAAE,YAAY,EAAE,GACpB,wDAAa,qCAAqC,GAAC,CAAC;QACtD,MAAM,YAAY,CAAC,WAAW,EAAE;YAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;gBAC7B,CAAC,CAAE,OAAO,CAAC,GAAgB;gBAC3B,CAAC,CAAC,SAAS;YACb,WAAW,EAAE,OAAO,CAAC,WAAkC;SACxD,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACN,CAAC;AAED;;;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/web-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"}
|