From 62ab4abc671a1f8d0d5f9ff72231426e4dfd95fb Mon Sep 17 00:00:00 2001 From: PhantomInTheWire <135950363+PhantomInTheWire@users.noreply.github.com> Date: Mon, 9 Nov 2026 15:40:30 +0000 Subject: [PATCH 1/2] fix(developer): print each result header once as kind, title and URL --- skills/firecrawl-developer-index/SKILL.md | 2 +- src/__tests__/commands/developer.test.ts | 31 ++++++----------------- src/commands/developer.ts | 15 +++-------- 3 files changed, 13 insertions(+), 35 deletions(-) diff --git a/skills/firecrawl-developer-index/SKILL.md b/skills/firecrawl-developer-index/SKILL.md index b2a1112433..7b943fb1f1 100644 --- a/skills/firecrawl-developer-index/SKILL.md +++ b/skills/firecrawl-developer-index/SKILL.md @@ -16,7 +16,7 @@ There is **no fixed recipe**. Read the question, decide what kind it is, and cho - HTTP: **`GET|POST https://api.firecrawl.dev/v2/search/developer`** MCP: **`firecrawl_developer_search(query, k?, skills?)`** CLI: **`firecrawl developer [--limit ]`** - Ranked results over the whole index. Each carries `id` (`issue:owner/repo#123`), `url`, and the **matched passages in markdown**, so tables and code blocks survive. The artifact kind is the `id` prefix: `doc:`, `issue:`, `pull_request:`, or `readme:`. + Ranked results over the whole index. Each carries `id` (`issue:owner/repo#123`), `url`, and the **matched passages in markdown**, so tables and code blocks survive. The artifact kind is the `id` prefix: `doc:`, `issue:`, `pull_request:`, `readme:`, or `web:`. The CLI prints each result as `## [kind] title` and then its URL; `--json` keeps the full `id`. The default first move for a developer question. It is the only surface that returns the passages, which is what lets you answer instead of pointing at a page. `k` / `--limit` is 1–100 and defaults to 10. `skills="only"` (HTTP/MCP only) restricts the search to agent-skill files. Keyless; send `Authorization: Bearer $FIRECRAWL_API_KEY` for higher rate limits. diff --git a/src/__tests__/commands/developer.test.ts b/src/__tests__/commands/developer.test.ts index 5a870b5815..116a34c916 100644 --- a/src/__tests__/commands/developer.test.ts +++ b/src/__tests__/commands/developer.test.ts @@ -105,17 +105,14 @@ describe('handleDeveloperSearchCommand', () => { }); describe('output', () => { - it('renders id, type, title, url, and passage in readable output', async () => { + it('renders type, title, url, and passage in readable output', async () => { mockHttpGet.mockResolvedValue(mockDeveloperResponse([sampleResult])); await handleDeveloperSearchCommand({ query: 'tokio spawn_blocking' }); const [content] = vi.mocked(writeOutput).mock.calls[0]; expect(content).toContain( - '## [issue:tokio-rs/tokio#2309] (issue) spawn_blocking panics when exceeding the thread limit' - ); - expect(content).toContain( - 'https://github.com/tokio-rs/tokio/issues/2309' + '## [issue] spawn_blocking panics when exceeding the thread limit\nhttps://github.com/tokio-rs/tokio/issues/2309\n' ); expect(content).toContain('It will panic if this limit is too low.'); }); @@ -147,36 +144,24 @@ describe('handleDeveloperSearchCommand', () => { expect(content).toContain('rust: not indexed'); }); - it('prints a result URL only when its id does not contain it', async () => { - const duplicateUrl = 'https://docs.rs/tokio/latest/tokio'; + it('prints each result URL once, never inside the id', async () => { + const url = 'https://docs.rs/tokio/latest/tokio'; mockHttpGet.mockResolvedValue( mockDeveloperResponse([ - sampleResult, { - id: `web:${duplicateUrl}`, - url: duplicateUrl, + id: `doc:${url}`, + url, title: 'Tokio docs', passages: [{ text: 'Runtime documentation.' }], }, - { - id: `web:${duplicateUrl}/search`, - url: duplicateUrl, - title: 'Tokio search', - passages: [{ text: 'Search documentation.' }], - }, ]) ); await handleDeveloperSearchCommand({ query: 'tokio runtime' }); const [content] = vi.mocked(writeOutput).mock.calls[0] as [string]; - expect(content.split(duplicateUrl).length - 1).toBe(3); - expect(content).toContain( - `## [web:${duplicateUrl}/search] Tokio search\n${duplicateUrl}\n` - ); - expect(content).toContain( - '\nhttps://github.com/tokio-rs/tokio/issues/2309\n' - ); + expect(content.split(url).length - 1).toBe(1); + expect(content).toContain(`## [doc] Tokio docs\n${url}\n`); }); it('does not render separators for empty passages', async () => { diff --git a/src/commands/developer.ts b/src/commands/developer.ts index cbbc451a4b..d0b1ac474e 100644 --- a/src/commands/developer.ts +++ b/src/commands/developer.ts @@ -39,19 +39,12 @@ function fmtLicense(license: DeveloperLicense | string): string { return `License: ${license.state.replace('_', ' ')}`; } -function idEncodesUrl(id: string | undefined, url: string): boolean { - return id === url || id?.endsWith(`:${url}`) === true; -} - function fmtResult(item: DeveloperItem): string { // The wire carries no type field; the artifact kind is the id prefix - // (doc:, issue:, pull_request:, readme:). - const prefix = (item.id ?? '').split(':', 1)[0]; - const kind = ['doc', 'issue', 'pull_request', 'readme'].includes(prefix) - ? ` (${prefix})` - : ''; - const lines = [`## [${item.id ?? '?'}]${kind} ${item.title ?? '(untitled)'}`]; - if (item.url && !idEncodesUrl(item.id, item.url)) lines.push(item.url); + // (doc:, issue:, pull_request:, readme:, web:). + const kind = item.id?.includes(':') ? `[${item.id.split(':', 1)[0]}] ` : ''; + const lines = [`## ${kind}${item.title ?? '(untitled)'}`]; + if (item.url) lines.push(item.url); if (item.license) lines.push(fmtLicense(item.license)); const body = (item.passages ?? []) .map((passage) => From 1013000d96eb6a18808ad8e61895f39daa25ccdb Mon Sep 17 00:00:00 2001 From: PhantomInTheWire <135950363+PhantomInTheWire@users.noreply.github.com> Date: Mon, 9 Nov 2026 17:04:40 +0000 Subject: [PATCH 2/2] test(developer): cover two results sharing a URL; say web results are not a types value --- skills/firecrawl-developer-index/SKILL.md | 2 +- src/__tests__/commands/developer.test.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/skills/firecrawl-developer-index/SKILL.md b/skills/firecrawl-developer-index/SKILL.md index 7b943fb1f1..565b4f063e 100644 --- a/skills/firecrawl-developer-index/SKILL.md +++ b/skills/firecrawl-developer-index/SKILL.md @@ -16,7 +16,7 @@ There is **no fixed recipe**. Read the question, decide what kind it is, and cho - HTTP: **`GET|POST https://api.firecrawl.dev/v2/search/developer`** MCP: **`firecrawl_developer_search(query, k?, skills?)`** CLI: **`firecrawl developer [--limit ]`** - Ranked results over the whole index. Each carries `id` (`issue:owner/repo#123`), `url`, and the **matched passages in markdown**, so tables and code blocks survive. The artifact kind is the `id` prefix: `doc:`, `issue:`, `pull_request:`, `readme:`, or `web:`. The CLI prints each result as `## [kind] title` and then its URL; `--json` keeps the full `id`. + Ranked results over the whole index. Each carries `id` (`issue:owner/repo#123`), `url`, and the **matched passages in markdown**, so tables and code blocks survive. The artifact kind is the `id` prefix: `doc:`, `issue:`, `pull_request:`, `readme:`, or `web:`. A `web:` result is a web page served beside the index hits; it is not a `types` value and cannot be requested. The CLI prints each result as `## [kind] title` and then its URL; `--json` keeps the full `id`. The default first move for a developer question. It is the only surface that returns the passages, which is what lets you answer instead of pointing at a page. `k` / `--limit` is 1–100 and defaults to 10. `skills="only"` (HTTP/MCP only) restricts the search to agent-skill files. Keyless; send `Authorization: Bearer $FIRECRAWL_API_KEY` for higher rate limits. diff --git a/src/__tests__/commands/developer.test.ts b/src/__tests__/commands/developer.test.ts index 116a34c916..6f45220384 100644 --- a/src/__tests__/commands/developer.test.ts +++ b/src/__tests__/commands/developer.test.ts @@ -154,14 +154,21 @@ describe('handleDeveloperSearchCommand', () => { title: 'Tokio docs', passages: [{ text: 'Runtime documentation.' }], }, + { + id: `web:${url}`, + url, + title: 'Tokio runtime', + passages: [{ text: 'Runtime overview.' }], + }, ]) ); await handleDeveloperSearchCommand({ query: 'tokio runtime' }); const [content] = vi.mocked(writeOutput).mock.calls[0] as [string]; - expect(content.split(url).length - 1).toBe(1); + expect(content.split(url).length - 1).toBe(2); expect(content).toContain(`## [doc] Tokio docs\n${url}\n`); + expect(content).toContain(`## [web] Tokio runtime\n${url}\n`); }); it('does not render separators for empty passages', async () => {