@narumitw/pi-firecrawl 0.20.0 → 0.31.0

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/README.md CHANGED
@@ -158,7 +158,8 @@ Start a crawl with markdown extraction:
158
158
  ```txt
159
159
  extensions/pi-firecrawl/
160
160
  ├── src/
161
- │ ├── firecrawl.ts # Pi entrypoint and command orchestration
161
+ │ ├── index.ts # Pi package entrypoint
162
+ │ ├── firecrawl.ts # Extension registration and command orchestration
162
163
  │ └── *.ts # Package-local client, settings, selector, and tool modules
163
164
  ├── README.md
164
165
  ├── LICENSE
@@ -166,7 +167,7 @@ extensions/pi-firecrawl/
166
167
  └── package.json
167
168
  ```
168
169
 
169
- Only `firecrawl.ts` is a Pi entrypoint; the other source modules are internal.
170
+ `index.ts` is the Pi entrypoint and forwards to `firecrawl.ts`; the other source modules are internal.
170
171
 
171
172
  ## 🔎 Keywords
172
173
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-firecrawl",
3
- "version": "0.20.0",
3
+ "version": "0.31.0",
4
4
  "description": "Pi extension that exposes Firecrawl web scraping and crawling tools.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "pi": {
22
22
  "extensions": [
23
- "./src/firecrawl.ts"
23
+ "./src/index.ts"
24
24
  ]
25
25
  },
26
26
  "scripts": {
@@ -29,11 +29,11 @@
29
29
  "typecheck": "tsc --noEmit"
30
30
  },
31
31
  "dependencies": {
32
- "typebox": "^1.3.3"
32
+ "typebox": "^1.3.8"
33
33
  },
34
34
  "devDependencies": {
35
- "@biomejs/biome": "2.5.3",
36
- "@earendil-works/pi-coding-agent": "0.80.10",
35
+ "@biomejs/biome": "2.5.5",
36
+ "@earendil-works/pi-coding-agent": "0.82.1",
37
37
  "typescript": "7.0.2"
38
38
  },
39
39
  "repository": {
package/src/client.ts CHANGED
@@ -32,7 +32,9 @@ export async function firecrawlRequest(
32
32
  const responseText = await response.text();
33
33
  const payload = parseResponseBody(responseText);
34
34
  if (!response.ok) {
35
- throw new Error(`Firecrawl ${method} ${path} failed (${response.status}): ${formatPayload(payload)}`);
35
+ throw new Error(
36
+ `Firecrawl ${method} ${path} failed (${response.status}): ${formatPayload(payload)}`,
37
+ );
36
38
  }
37
39
  return payload;
38
40
  }
package/src/firecrawl.ts CHANGED
@@ -2,25 +2,17 @@ import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-c
2
2
  import { hasApiKey } from "./client.js";
3
3
  import { loadSettings } from "./settings.js";
4
4
  import {
5
+ allFirecrawlTools,
6
+ applyFirecrawlTools,
5
7
  buildCommandGuide,
6
8
  buildConfigMessage,
7
9
  buildStatusMessage,
8
10
  clearSettingsNotice,
9
- applyFirecrawlTools,
10
11
  recordSettingsNotice,
11
- setSelectedFirecrawlTools,
12
12
  showToolSelector,
13
13
  updateFirecrawlTools,
14
- allFirecrawlTools,
15
14
  } from "./tool-selector.js";
16
- import {
17
- crawlStatusTool,
18
- crawlTool,
19
- FIRECRAWL_TOOL_NAMES,
20
- mapTool,
21
- scrapeTool,
22
- searchTool,
23
- } from "./tools.js";
15
+ import { crawlStatusTool, crawlTool, mapTool, scrapeTool, searchTool } from "./tools.js";
24
16
 
25
17
  const STATUS_KEY = "firecrawl";
26
18
  const COMMAND_COMPLETIONS = [
@@ -118,7 +110,10 @@ async function handleFirecrawlCommand(pi: ExtensionAPI, args: string, ctx: Comma
118
110
 
119
111
  async function showMenu(pi: ExtensionAPI, ctx: CommandContext) {
120
112
  if (!ctx.hasUI) {
121
- ctx.ui.notify(`${buildCommandGuide()}\n\n${await buildStatusMessage(pi)}`, hasApiKey() ? "info" : "warning");
113
+ ctx.ui.notify(
114
+ `${buildCommandGuide()}\n\n${await buildStatusMessage(pi)}`,
115
+ hasApiKey() ? "info" : "warning",
116
+ );
122
117
  return;
123
118
  }
124
119
 
@@ -168,6 +163,12 @@ export function commandCompletions(prefix: string) {
168
163
  return matches.length > 0 ? matches : null;
169
164
  }
170
165
 
171
- export { cleanObject, formatPayload, jsonResult, normalizeApiUrl, parseResponseBody } from "./client.js";
166
+ export {
167
+ cleanObject,
168
+ formatPayload,
169
+ jsonResult,
170
+ normalizeApiUrl,
171
+ parseResponseBody,
172
+ } from "./client.js";
172
173
  export { installSettingsFileExclusively, normalizeFirecrawlSettings } from "./settings.js";
173
174
  export { formatPersistedSelection, orderedFirecrawlTools } from "./tool-selector.js";
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./firecrawl.js";
package/src/settings.ts CHANGED
@@ -97,10 +97,7 @@ async function migrateLegacySettings(
97
97
  ): Promise<SettingsMigrationResult> {
98
98
  const newPath = settingsFilePath();
99
99
  try {
100
- await installSettingsFileExclusively(
101
- newPath,
102
- `${JSON.stringify(settings, null, 2)}\n`,
103
- );
100
+ await installSettingsFileExclusively(newPath, `${JSON.stringify(settings, null, 2)}\n`);
104
101
  } catch (error) {
105
102
  return {
106
103
  kind: "failed",
@@ -182,7 +179,3 @@ function isNodeError(error: unknown): error is NodeJS.ErrnoException {
182
179
  function formatError(error: unknown) {
183
180
  return error instanceof Error ? error.message : String(error);
184
181
  }
185
-
186
- function unique<T>(values: T[]) {
187
- return Array.from(new Set(values));
188
- }
@@ -1,6 +1,11 @@
1
1
  import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
2
2
  import { configuredApiUrl, hasApiKey } from "./client.js";
3
- import { loadSettings, saveSettings, settingsFilePath, type SettingsLoadResult } from "./settings.js";
3
+ import {
4
+ loadSettings,
5
+ type SettingsLoadResult,
6
+ saveSettings,
7
+ settingsFilePath,
8
+ } from "./settings.js";
4
9
  import { FIRECRAWL_TOOL_NAMES, type FirecrawlToolName } from "./tools.js";
5
10
 
6
11
  type CommandContext = ExtensionCommandContext;
@@ -318,10 +323,7 @@ function formatError(error: unknown) {
318
323
  return error instanceof Error ? error.message : String(error);
319
324
  }
320
325
 
321
- async function persistSettings(
322
- ctx: CommandContext,
323
- selectedTools: readonly FirecrawlToolName[],
324
- ) {
326
+ async function persistSettings(ctx: CommandContext, selectedTools: readonly FirecrawlToolName[]) {
325
327
  try {
326
328
  await saveSettings({ tools: [...selectedTools], updatedAt: Date.now() });
327
329
  } catch (error) {