Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat(go-sdk): add DeveloperSearch for /v2/search/developer (#5269)
Erik Engervalla53eb272e82e
diff --git a/apps/go-sdk/README.md b/apps/go-sdk/README.mdindex fdd8a1b34..a8b0f4b42 100644--- a/apps/go-sdk/README.md+++ b/apps/go-sdk/README.md@@ -263,6 +263,24 @@ results, err := client.Search(ctx, "firecrawl web scraping", &firecrawl.SearchOp})```+### Developer Search++Search public repositories, GitHub issues, merged pull requests, READMEs and code documentation. `DeveloperSearch` replaces the deprecated `SearchGitHub`.++```go+resp, err := client.DeveloperSearch(ctx, "retry an http request with exponential backoff", &firecrawl.DeveloperSearchOptions{+ K: firecrawl.Int(5),+ Types: []string{"issue", "pull_request"},+ Repos: []string{"golang/go"},+})+if err != nil {+ log.Fatal(err)+}+for _, r := range resp.Results {+ fmt.Println(r.Title, r.URL)+}+```+### AgentRun an AI-powered agent to extract structured data.diff --git a/apps/go-sdk/developer_search_test.go b/apps/go-sdk/developer_search_test.gonew file mode 100644index 000000000..df76ee791--- /dev/null+++ b/apps/go-sdk/developer_search_test.go@@ -0,0 +1,67 @@+package firecrawl++import (+ "context"+ "net/http"+ "net/http/httptest"+ "strings"+ "testing"++ "github.com/firecrawl/firecrawl/apps/go-sdk/option"+)++func TestDeveloperSearchPostsQueryAndOptions(t *testing.T) {+ captured := make(chan capturedRequest, 1)++ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ captured <- captureRequest(r)+ w.Header().Set("Content-Type", "application/json")+ w.WriteHeader(http.StatusOK)+ _, _ = w.Write([]byte(`{"success":true,"results":[{"id":"r1","url":"https://github.com/golang/go/issues/1","title":"retry","passages":[{"text":"use backoff","citation_url":"https://github.com/golang/go/issues/1#c1"}],"license":"BSD-3-Clause"}],"repos":[{"repo":"golang/go","indexed":true,"types":{"issue":true,"pullRequest":true,"readme":false}}]}`))+ }))+ defer server.Close()++ client, err := NewClient(option.WithAPIKey("fc-test"), option.WithAPIURL(server.URL))+ if err != nil {+ t.Fatalf("NewClient: %v", err)+ }++ resp, err := client.DeveloperSearch(context.Background(), "retry backoff", &DeveloperSearchOptions{+ K: Int(5),+ Types: []string{"issue"},+ Repos: []string{"golang/go"},+ MinStars: Int(100),+ })+ if err != nil {+ t.Fatalf("DeveloperSearch: %v", err)+ }++ req := <-captured+ if req.method != http.MethodPost || req.path != "/v2/search/developer" {+ t.Errorf("unexpected request: %s %s", req.method, req.path)+ }+ for _, want := range []string{`"query":"retry backoff"`, `"k":5`, `"types":["issue"]`, `"repos":["golang/go"]`, `"min_stars":100`, `"origin":"go-sdk@` + Version + `"`} {+ if !strings.Contains(req.body, want) {+ t.Errorf("request body missing %s: %q", want, req.body)+ }+ }+ if len(resp.Results) != 1 || resp.Results[0].Passages[0].CitationURL == "" {+ t.Fatalf("unexpected results: %+v", resp.Results)+ }+ if string(resp.Results[0].License) != `"BSD-3-Clause"` {+ t.Errorf("license = %s", resp.Results[0].License)+ }+ if len(resp.Repos) != 1 || !resp.Repos[0].Types.PullRequest {+ t.Errorf("unexpected repos: %+v", resp.Repos)+ }+}++func TestDeveloperSearchRejectsEmptyQuery(t *testing.T) {+ client, err := NewClient(option.WithAPIKey("fc-test"), option.WithAPIURL("http://127.0.0.1:1"))+ if err != nil {+ t.Fatalf("NewClient: %v", err)+ }+ if _, err := client.DeveloperSearch(context.Background(), " ", nil); err == nil {+ t.Fatal("expected an error for an empty query")+ }+}diff --git a/apps/go-sdk/firecrawl.go b/apps/go-sdk/firecrawl.goindex f302208b2..04c8605fc 100644--- a/apps/go-sdk/firecrawl.go+++ b/apps/go-sdk/firecrawl.go@@ -699,10 +699,8 @@ func (c *Client) RelatedPapers(ctx context.Context, paperID, intent string, opts// SearchGitHub searches GitHub research content.//-// Deprecated: stops responding after 2026-11-03. Use the developer index at-// GET or POST /v2/search/developer. This SDK does not wrap it yet, so call it-// directly. It does not carry over the score breakdown or the web fallback-// results.+// Deprecated: stops responding after 2026-11-03. Use DeveloperSearch, which+// does not carry over the score breakdown or the web fallback results.func (c *Client) SearchGitHub(ctx context.Context, query string, opts *SearchGitHubOptions) (*GitHubSearchResponse, error) {if query == "" {return nil, &FirecrawlError{Message: "query is required"}@@ -724,6 +722,26 @@ func (c *Client) SearchGitHub(ctx context.Context, query string, opts *SearchGitreturn &resp, nil}+// DeveloperSearch searches the developer index (public repositories, GitHub+// issues, merged pull requests, READMEs and code documentation).+func (c *Client) DeveloperSearch(ctx context.Context, query string, opts *DeveloperSearchOptions) (*DeveloperSearchResponse, error) {+ if strings.TrimSpace(query) == "" {+ return nil, &FirecrawlError{Message: "query is required"}+ }+ body := map[string]interface{}{"query": query}+ mergeOptions(body, opts)+ body["origin"] = "go-sdk@" + Version+ raw, err := c.http.post(ctx, "/v2/search/developer", body, nil)+ if err != nil {+ return nil, err+ }+ var resp DeveloperSearchResponse+ if err := json.Unmarshal(raw, &resp); err != nil {+ return nil, &FirecrawlError{Message: fmt.Sprintf("failed to decode response: %v", err)}+ }+ return &resp, nil+}+// ================================================================// AGENT// ================================================================diff --git a/apps/go-sdk/models.go b/apps/go-sdk/models.goindex 5d03e9d86..273a80007 100644--- a/apps/go-sdk/models.go+++ b/apps/go-sdk/models.go@@ -308,6 +308,74 @@ type SearchGitHubOptions struct {K *int `json:"k,omitempty"`}+// DeveloperSearchOptions configures DeveloperSearch.+type DeveloperSearchOptions struct {+ // K is the total number of ranked results, 1 to 100 (default 10).+ K *int `json:"k,omitempty"`+ // Passages is the number of passages per result, 1 to 5 (default 1).+ Passages *int `json:"passages,omitempty"`+ // Types limits result kinds: "doc", "issue", "pull_request", "readme".+ Types []string `json:"types,omitempty"`+ // Repos filters by GitHub owner/name, at most 20.+ Repos []string `json:"repos,omitempty"`+ // Sources filters by developer documentation source ID, at most 20.+ Sources []string `json:"sources,omitempty"`+ // Language is one case-insensitive GitHub Linguist primary language.+ Language string `json:"language,omitempty"`+ // Topic lists repository topics that must all match, at most 8.+ Topic []string `json:"topic,omitempty"`+ // License is one case-insensitive SPDX repository license identifier.+ License string `json:"license,omitempty"`+ MinStars *int `json:"min_stars,omitempty"`+ MaxStars *int `json:"max_stars,omitempty"`+ Archived *bool `json:"archived,omitempty"`+ Fork *bool `json:"fork,omitempty"`+ // Skills set to "only" returns packaged agent-skill evidence only.+ Skills string `json:"skills,omitempty"`+}++// DeveloperSearchPassage is one matched passage of a developer search result.+type DeveloperSearchPassage struct {+ Text string `json:"text"`+ CitationURL string `json:"citation_url,omitempty"`+}++// DeveloperSearchResult is one ranked developer search result. License is+// either an SPDX string or a disclosure object, so it is kept raw.+type DeveloperSearchResult struct {+ ID string `json:"id"`+ URL string `json:"url"`+ Title string `json:"title,omitempty"`+ Passages []DeveloperSearchPassage `json:"passages"`+ License json.RawMessage `json:"license,omitempty"`+}++// DeveloperSearchRepoStatus reports whether a requested repository is indexed.+type DeveloperSearchRepoStatus struct {+ Repo string `json:"repo"`+ Indexed bool `json:"indexed"`+ Types struct {+ Issue bool `json:"issue"`+ PullRequest bool `json:"pullRequest"`+ Readme bool `json:"readme"`+ } `json:"types"`+}++// DeveloperSearchSourceStatus reports whether a requested source is indexed.+type DeveloperSearchSourceStatus struct {+ Source string `json:"source"`+ Indexed bool `json:"indexed"`+}++// DeveloperSearchResponse is returned by DeveloperSearch. Repos and Sources+// are present only when those filters were requested.+type DeveloperSearchResponse struct {+ Success bool `json:"success"`+ Results []DeveloperSearchResult `json:"results"`+ Repos []DeveloperSearchRepoStatus `json:"repos,omitempty"`+ Sources []DeveloperSearchSourceStatus `json:"sources,omitempty"`+}+// CrawlResponse is returned when starting an async crawl.type CrawlResponse struct {ID string `json:"id"`diff --git a/apps/go-sdk/version.go b/apps/go-sdk/version.goindex 0b8182495..50344d60b 100644--- a/apps/go-sdk/version.go+++ b/apps/go-sdk/version.go@@ -9,4 +9,4 @@ package firecrawl// Bump this when preparing a new release. The publish-go-sdk GitHub workflow// reads this value and creates the corresponding monorepo-prefixed tag on// merge to main.-const Version = "1.16.6"+const Version = "1.16.7"