diff --git a/skills/firecrawl-developer-index/SKILL.md b/skills/firecrawl-developer-index/SKILL.md index b2a1112433..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:`, 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:`. 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 5a870b5815..6f45220384 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,22 +144,21 @@ 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.' }], + id: `web:${url}`, + url, + title: 'Tokio runtime', + passages: [{ text: 'Runtime overview.' }], }, ]) ); @@ -170,13 +166,9 @@ describe('handleDeveloperSearchCommand', () => { 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(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 () => { 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) =>