Repository navigation
feat(cli): let wrappers set the integration tag with FIRECRAWL_INTEGRATION #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
fe52185
fix(setup, init): skip unavailable clients in --agent all and only of…
erikengervall cb9a041
fix(setup): require an executable for client detection; tighten templ…
erikengervall 8b4e2b7
feat(cli): let wrappers set the integration tag with FIRECRAWL_INTEGR…
erikengervall f69759c
test: cover the integration tag in feedback requests and narrow the R…
erikengervall 77c4fa4
chore(deps): bump firecrawl SDK to 4.49.1
erikengervall e6d7427
Merge remote-tracking branch 'origin/main' into capy/skip-unavailable…
erikengervall f26abb7
chore: bump version to 1.26.11
erikengervall ecd89bb
Merge remote-tracking branch 'origin/capy/skip-unavailable-clients-in…
erikengervall 0c4e55a
chore: bump version to 1.26.12
erikengervall 017f527
Merge branch 'capy/bump-firecrawl-sdk-4-49-1' into capy/firecrawl-int…
erikengervall e34d00f
fix(setup): keep quiet setup mcp output compact; name the failing-cli…
erikengervall 4902305
Merge remote-tracking branch 'origin/capy/skip-unavailable-clients-in…
erikengervall 747caf9
Merge branch 'capy/bump-firecrawl-sdk-4-49-1' into capy/firecrawl-int…
erikengervall 3c12476
fix(setup): treat empty PATH entries as the current directory; docume…
erikengervall d1d7e25
Merge remote-tracking branch 'origin/capy/skip-unavailable-clients-in…
erikengervall 2a4a9aa
Merge branch 'capy/bump-firecrawl-sdk-4-49-1' into capy/firecrawl-int…
erikengervall ffdc439
fix(setup): ignore an unset PATH in client detection; name --agent in…
erikengervall cff0387
Merge remote-tracking branch 'origin/capy/skip-unavailable-clients-in…
erikengervall 0af7559
Merge branch 'capy/bump-firecrawl-sdk-4-49-1' into capy/firecrawl-int…
erikengervall be477ff
fix(setup): normalize Cursor, Gemini CLI, Windsurf and Antigravity ag…
erikengervall 3b256ed
Merge remote-tracking branch 'origin/capy/skip-unavailable-clients-in…
erikengervall e82692f
Merge branch 'capy/bump-firecrawl-sdk-4-49-1' into capy/firecrawl-int…
erikengervall 242752b
chore(deps): bump firecrawl SDK to 4.50.0
erikengervall be748c3
Merge branch 'capy/bump-firecrawl-sdk-4-49-1' into capy/firecrawl-int…
erikengervall 2c2447e
docs(readme): list search-feedback among the integration-tagged requests
erikengervall 35e5a99
Merge remote-tracking branch 'origin/main' into capy/bump-firecrawl-s…
erikengervall e824ae9
Merge branch 'capy/bump-firecrawl-sdk-4-49-1' into capy/firecrawl-int…
erikengervall 77fe095
Merge remote-tracking branch 'origin/main' into capy/firecrawl-integr…
erikengervall 3910162
feat(cli): send FIRECRAWL_INTEGRATION as the X-Integration header on …
erikengervall e9251a3
test(doctor): assert X-Integration on doctor requests; fix the README…
erikengervall ada5fde
docs(readme): say a value that cannot be a header is not sent
erikengervall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "firecrawl-cli", | ||
| "version": "1.26.14", | ||
| "version": "1.26.15", | ||
| "publishConfig": { | ||
| "tag": "latest" | ||
| }, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| /** | ||
| * Tests for the X-Integration header | ||
| */ | ||
|
|
||
| import http from 'http'; | ||
| import type { AddressInfo } from 'net'; | ||
| import { | ||
| afterAll, | ||
| afterEach, | ||
| beforeAll, | ||
| describe, | ||
| expect, | ||
| it, | ||
| vi, | ||
| } from 'vitest'; | ||
| import { getClient, keylessRequest, resetClient } from '../../utils/client'; | ||
| import { initializeConfig, resetConfig } from '../../utils/config'; | ||
| import { integrationHeaders } from '../../utils/integration'; | ||
|
|
||
| describe('integrationHeaders', () => { | ||
| afterEach(() => { | ||
| vi.unstubAllEnvs(); | ||
| }); | ||
|
|
||
| it('sends nothing when FIRECRAWL_INTEGRATION is unset or blank', () => { | ||
| vi.stubEnv('FIRECRAWL_INTEGRATION', undefined); | ||
| expect(integrationHeaders()).toEqual({}); | ||
| vi.stubEnv('FIRECRAWL_INTEGRATION', ' '); | ||
| expect(integrationHeaders()).toEqual({}); | ||
| }); | ||
|
|
||
| it.each(['rtk', 'hermes', '_rtk', 'not a valid tag!'])( | ||
| 'sends %j as is, with no list to match', | ||
| (value) => { | ||
| vi.stubEnv('FIRECRAWL_INTEGRATION', value); | ||
| expect(integrationHeaders()).toEqual({ 'X-Integration': value }); | ||
| } | ||
| ); | ||
|
|
||
| it('trims surrounding whitespace', () => { | ||
| vi.stubEnv('FIRECRAWL_INTEGRATION', ' hermes\n'); | ||
| expect(integrationHeaders()).toEqual({ 'X-Integration': 'hermes' }); | ||
| }); | ||
|
|
||
| it.each(['bad\nvalue', 'tag\u2713'])( | ||
| 'drops %j, which cannot be sent as a header', | ||
| (value) => { | ||
| vi.stubEnv('FIRECRAWL_INTEGRATION', value); | ||
| expect(integrationHeaders()).toEqual({}); | ||
| } | ||
| ); | ||
| }); | ||
|
|
||
| describe('X-Integration on the wire', () => { | ||
| const received: http.IncomingHttpHeaders[] = []; | ||
| let server: http.Server; | ||
| let apiUrl: string; | ||
|
|
||
| beforeAll(async () => { | ||
| server = http.createServer((req, res) => { | ||
| received.push(req.headers); | ||
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify({ success: true, data: {} })); | ||
| }); | ||
| await new Promise<void>((resolve) => | ||
| server.listen(0, '127.0.0.1', resolve) | ||
| ); | ||
| apiUrl = `http://127.0.0.1:${(server.address() as AddressInfo).port}`; | ||
| }); | ||
|
|
||
| afterAll(async () => { | ||
| await new Promise((resolve) => server.close(resolve)); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| vi.unstubAllEnvs(); | ||
| received.length = 0; | ||
| resetClient(); | ||
| resetConfig(); | ||
| }); | ||
|
|
||
| it.each(['rtk', 'hermes', '_rtk'])( | ||
| 'puts %j on SDK client requests while the body keeps integration cli', | ||
| async (value) => { | ||
| vi.stubEnv('FIRECRAWL_INTEGRATION', value); | ||
| const client = getClient({ apiKey: 'fc-test', apiUrl }); | ||
| await (client as any).http.post('/v2/scrape', { integration: 'cli' }); | ||
| await (client as any).http.get('/v2/search/developer?integration=cli'); | ||
| expect(received.map((h) => h['x-integration'])).toEqual([value, value]); | ||
| } | ||
| ); | ||
|
|
||
| it('lets a request with a junk value succeed', async () => { | ||
| vi.stubEnv('FIRECRAWL_INTEGRATION', 'not a valid tag!'); | ||
| initializeConfig({ apiUrl }); | ||
| await expect( | ||
| keylessRequest('/v2/scrape', { url: 'https://example.com' }) | ||
| ).resolves.toEqual({ success: true, data: {} }); | ||
| expect(received[0]['x-integration']).toBe('not a valid tag!'); | ||
| }); | ||
|
|
||
| it('lets a request succeed without the header when the value cannot be sent', async () => { | ||
| vi.stubEnv('FIRECRAWL_INTEGRATION', 'bad\nvalue'); | ||
| const client = getClient({ apiKey: 'fc-test', apiUrl }); | ||
| await expect( | ||
| (client as any).http.post('/v2/scrape', { integration: 'cli' }) | ||
| ).resolves.toMatchObject({ status: 200 }); | ||
| expect(received[0]['x-integration']).toBeUndefined(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.