From 9cb38d9e7702224885e18d5060b151d9e9d2ae8e Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 27 Aug 2026 16:24:49 +0000 Subject: [PATCH 001/119] fix(openapi): strip empty-object defaults from the generated spec Stainless-Generated-From: 77e35290807406d40de75f3d45674e6cde2d5d4b --- go.mod | 2 +- go.sum | 4 ++-- pkg/cmd/news.go | 1 - pkg/cmd/parse.go | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index e8318bb..8604556 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.12.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.13.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 8aeb563..5415828 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.12.0 h1:cA6jbkTtWal7kfdGDi0Km1ABgAD4sjmKayD8HttGil0= -github.com/context-dot-dev/context-go-sdk/v2 v2.12.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.13.0 h1:4XJmz1E3jso9ngv8WEN0sfQmp5+2tgDT2xl4GVTu0Ug= +github.com/context-dot-dev/context-go-sdk/v2 v2.13.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/pkg/cmd/news.go b/pkg/cmd/news.go index e9f54cc..298e93b 100644 --- a/pkg/cmd/news.go +++ b/pkg/cmd/news.go @@ -33,7 +33,6 @@ var newsSearch = requestflag.WithInnerFlags(cli.Command{ &requestflag.Flag[map[string]any]{ Name: "filter-by", Usage: "Optional result filters.", - Default: map[string]any{}, BodyPath: "filterBy", }, &requestflag.Flag[int64]{ diff --git a/pkg/cmd/parse.go b/pkg/cmd/parse.go index 7f53188..944ab9f 100644 --- a/pkg/cmd/parse.go +++ b/pkg/cmd/parse.go @@ -58,7 +58,6 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ &requestflag.Flag[map[string]any]{ Name: "pdf", Usage: `PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.`, - Default: map[string]any{}, QueryPath: "pdf", }, &requestflag.Flag[bool]{ From 126d27d4684b5f3e75de83dfe32de7c34f9c5a81 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 3 Sep 2026 08:25:03 +0000 Subject: [PATCH 002/119] feat(sitemap): add subdomain discovery Stainless-Generated-From: a90de429784938edd4d439daafa6d613b3448932 --- pkg/cmd/web.go | 8 +++++++- pkg/cmd/web_test.go | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index bd2b64d..f6771cf 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -948,7 +948,7 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ var webWebScrapeSitemap = cli.Command{ Name: "web-scrape-sitemap", - Usage: "Crawl an entire website's sitemap and return all discovered page URLs. Pass\n`search` to have the crawled sitemap filtered down to the pages about a phrase\n(for example `pricing and plans` or `api authentication docs`), most relevant\nfirst — a searched crawl scans the whole sitemap and costs 2 credits instead\nof 1.", + Usage: "Crawl an entire website's sitemap and return all discovered page URLs. Set\n`includeSubdomains=true` to also discover public pages and sitemaps on child\nhosts such as `docs.example.com` or `brand.example.com`. Pass `search` to have\nthe discovered URLs filtered down to the pages about a phrase (for example\n`pricing and plans` or `api authentication docs`), most relevant first — a\nsearched crawl scans the whole sitemap and costs 2 credits instead of 1.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -962,6 +962,12 @@ var webWebScrapeSitemap = cli.Command{ Usage: "Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.", QueryPath: "headers", }, + &requestflag.Flag[bool]{ + Name: "include-subdomains", + Usage: "When true, discover and include public pages and sitemaps on subdomains of the requested domain. Defaults to false.", + Default: false, + QueryPath: "includeSubdomains", + }, &requestflag.Flag[int64]{ Name: "max-links", Usage: "Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index acbcf47..410cd22 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -591,6 +591,7 @@ func TestWebWebScrapeSitemap(t *testing.T) { "web", "web-scrape-sitemap", "--domain", "xxx", "--headers", "{foo: J!}", + "--include-subdomains=true", "--max-links", "1", "--search", "help center and troubleshooting articles", "--sitemap-url", "https://example.com", From 34071f917e9e778b6b75a616bd550dad9d676d82 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 3 Sep 2026 12:27:34 +0000 Subject: [PATCH 003/119] Build SDK Stainless-Generated-From: 5ade09f4dc271eb95e570b7b8b8bc8528c55eeb6 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8604556..fada419 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.13.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.14.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 5415828..07cbdc1 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.13.0 h1:4XJmz1E3jso9ngv8WEN0sfQmp5+2tgDT2xl4GVTu0Ug= -github.com/context-dot-dev/context-go-sdk/v2 v2.13.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.14.0 h1:N9CU3QkAJagTBJEV4e2qPycQG+JSZNicffXgLC9wdaE= +github.com/context-dot-dev/context-go-sdk/v2 v2.14.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From d366bd323f7875132dfe35ceb8fdfe3d92e9edaf Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 7 Sep 2026 21:59:00 +0000 Subject: [PATCH 004/119] feat(webhooks): add configurable retries and manual replay Stainless-Generated-From: e8e908c91e4d4729adff54498dab7cd889708218 --- .stats.yml | 2 +- pkg/cmd/batch.go | 23 ++- pkg/cmd/batch_test.go | 32 ++++ pkg/cmd/cmd.go | 11 ++ pkg/cmd/monitor.go | 10 + pkg/cmd/monitor_test.go | 28 ++- pkg/cmd/webhookdelivery.go | 321 ++++++++++++++++++++++++++++++++ pkg/cmd/webhookdelivery_test.go | 90 +++++++++ 8 files changed, 509 insertions(+), 8 deletions(-) create mode 100644 pkg/cmd/webhookdelivery.go create mode 100644 pkg/cmd/webhookdelivery_test.go diff --git a/.stats.yml b/.stats.yml index 1fd2991..c7c071b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 41 +configured_endpoints: 45 diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index 1eff5c6..e42040a 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -128,7 +128,7 @@ var batchGetResults = cli.Command{ HideHelpCommand: true, } -var batchSubmit = cli.Command{ +var batchSubmit = requestflag.WithInnerFlags(cli.Command{ Name: "submit", Usage: "Scrape 25K URLs or crawl large websites asynchronously.", Suggest: true, @@ -144,9 +144,14 @@ var batchSubmit = cli.Command{ Usage: "Tags stored on the batch. Filter the batch list by them later.", BodyPath: "tags", }, + &requestflag.Flag[map[string]any]{ + Name: "webhook", + Usage: "Completion webhook settings. Cannot be combined with webhookUrl. Omitting retry preserves legacy delivery; retry: {} opts into durable retries.", + BodyPath: "webhook", + }, &requestflag.Flag[string]{ Name: "webhook-url", - Usage: "URL notified when the batch finishes.", + Usage: "Legacy URL notified when the batch finishes. Preserves one best-effort attempt. Cannot be combined with webhook.", BodyPath: "webhookUrl", }, &requestflag.Flag[string]{ @@ -157,7 +162,19 @@ var batchSubmit = cli.Command{ }, Action: handleBatchSubmit, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "webhook": { + &requestflag.InnerFlag[string]{ + Name: "webhook.url", + InnerField: "url", + }, + &requestflag.InnerFlag[map[string]any]{ + Name: "webhook.retry", + Usage: "Opt into durable webhook delivery. An empty object uses the default retry schedule. Omit retry to preserve legacy delivery behavior. The policy is snapshotted for each event.", + InnerField: "retry", + }, + }, +}) func handleBatchRetrieve(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index 82a5e97..eb892b7 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/context-dot-dev/context-dev-cli/internal/mocktest" + "github.com/context-dot-dev/context-dev-cli/internal/requestflag" ) func TestBatchRetrieve(t *testing.T) { @@ -85,6 +86,26 @@ func TestBatchSubmit(t *testing.T) { "--input", "{data: {format: markdown, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], options: {country: de, excludeSelectors: [x], includeHTML: true, includeImages: true, includeLinks: true, includeSelectors: [x], maxAgeMs: 0, pdf: {end: 1, ocr: true, shouldParse: true, start: 1}, settleAnimations: true, shortenBase64Images: true, useMainContentOnly: true, waitForMs: 0}}, mode: scrape}", "--tag", "docs", "--tag", "competitor", + "--webhook", "{url: https://example.com, retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", + "--webhook-url", "webhookUrl", + "--idempotency-key", "Idempotency-Key", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(batchSubmit) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "batch", "submit", + "--input", "{data: {format: markdown, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], options: {country: de, excludeSelectors: [x], includeHTML: true, includeImages: true, includeLinks: true, includeSelectors: [x], maxAgeMs: 0, pdf: {end: 1, ocr: true, shouldParse: true, start: 1}, settleAnimations: true, shortenBase64Images: true, useMainContentOnly: true, waitForMs: 0}}, mode: scrape}", + "--tag", "docs", + "--tag", "competitor", + "--webhook.url", "https://example.com", + "--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}", "--webhook-url", "webhookUrl", "--idempotency-key", "Idempotency-Key", ) @@ -128,6 +149,17 @@ func TestBatchSubmit(t *testing.T) { "tags:\n" + " - docs\n" + " - competitor\n" + + "webhook:\n" + + " url: https://example.com\n" + + " retry:\n" + + " delays_seconds:\n" + + " - 10\n" + + " - 60\n" + + " - 300\n" + + " - 1800\n" + + " - 7200\n" + + " - 21600\n" + + " - 57600\n" + "webhookUrl: webhookUrl\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index 673b8eb..c7a759f 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -179,6 +179,17 @@ func init() { &batchSubmit, }, }, + { + Name: "webhooks:deliveries", + Category: "API RESOURCE", + Suggest: true, + Commands: []*cli.Command{ + &webhooksDeliveriesRetrieve, + &webhooksDeliveriesList, + &webhooksDeliveriesListAttempts, + &webhooksDeliveriesRetry, + }, + }, { Name: "people", Category: "API RESOURCE", diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index fac0f1c..45bc9bc 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -86,6 +86,11 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ Usage: "Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `[\"change.detected\"]` when omitted.", InnerField: "events", }, + &requestflag.InnerFlag[map[string]any]{ + Name: "webhook.retry", + Usage: "Opt into durable webhook delivery. An empty object uses the default retry schedule. Omit retry to preserve legacy delivery behavior. The policy is snapshotted for each event.", + InnerField: "retry", + }, &requestflag.InnerFlag[string]{ Name: "webhook.secret", Usage: "Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `\"{t}.{rawRequestBody}\"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients.", @@ -185,6 +190,11 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ Usage: "Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `[\"change.detected\"]` when omitted.", InnerField: "events", }, + &requestflag.InnerFlag[map[string]any]{ + Name: "webhook.retry", + Usage: "Opt into durable webhook delivery. An empty object uses the default retry schedule. Omit retry to preserve legacy delivery behavior. The policy is snapshotted for each event.", + InnerField: "retry", + }, &requestflag.InnerFlag[string]{ Name: "webhook.secret", Usage: "Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `\"{t}.{rawRequestBody}\"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients.", diff --git a/pkg/cmd/monitor_test.go b/pkg/cmd/monitor_test.go index 983650e..5586f96 100644 --- a/pkg/cmd/monitor_test.go +++ b/pkg/cmd/monitor_test.go @@ -23,7 +23,7 @@ func TestMonitorsCreate(t *testing.T) { "--schedule", "{frequency: 6, type: interval, unit: hours}", "--tag", "pricing", "--tag", "competitor", - "--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed]}", + "--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed], retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", ) }) @@ -47,6 +47,7 @@ func TestMonitorsCreate(t *testing.T) { "--tag", "competitor", "--webhook.url", "https://example.com/webhook", "--webhook.events", "[change.detected, run.completed]", + "--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}", ) }) @@ -75,7 +76,16 @@ func TestMonitorsCreate(t *testing.T) { " url: https://example.com/webhook\n" + " events:\n" + " - change.detected\n" + - " - run.completed\n") + " - run.completed\n" + + " retry:\n" + + " delays_seconds:\n" + + " - 10\n" + + " - 60\n" + + " - 300\n" + + " - 1800\n" + + " - 7200\n" + + " - 21600\n" + + " - 57600\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", @@ -111,7 +121,7 @@ func TestMonitorsUpdate(t *testing.T) { "--tag", "pricing", "--tag", "competitor", "--target", "{type: page, url: https://acme.com/pricing, instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}", - "--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed]}", + "--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed], retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", ) }) @@ -136,6 +146,7 @@ func TestMonitorsUpdate(t *testing.T) { "--target", "{type: page, url: https://acme.com/pricing, instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}", "--webhook.url", "https://example.com/webhook", "--webhook.events", "[change.detected, run.completed]", + "--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}", ) }) @@ -164,7 +175,16 @@ func TestMonitorsUpdate(t *testing.T) { " url: https://example.com/webhook\n" + " events:\n" + " - change.detected\n" + - " - run.completed\n") + " - run.completed\n" + + " retry:\n" + + " delays_seconds:\n" + + " - 10\n" + + " - 60\n" + + " - 300\n" + + " - 1800\n" + + " - 7200\n" + + " - 21600\n" + + " - 57600\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/webhookdelivery.go b/pkg/cmd/webhookdelivery.go new file mode 100644 index 0000000..2042df5 --- /dev/null +++ b/pkg/cmd/webhookdelivery.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package cmd + +import ( + "context" + "fmt" + + "github.com/context-dot-dev/context-dev-cli/internal/apiquery" + "github.com/context-dot-dev/context-dev-cli/internal/requestflag" + "github.com/context-dot-dev/context-go-sdk/v2" + "github.com/context-dot-dev/context-go-sdk/v2/option" + "github.com/tidwall/gjson" + "github.com/urfave/cli/v3" +) + +var webhooksDeliveriesRetrieve = cli.Command{ + Name: "retrieve", + Usage: "Get the live status, retry policy, latest attempt, and replay expiration for a\nretained delivery. Use the attempts endpoint for its complete paginated history.\nThis endpoint costs no credits.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "delivery-id", + Required: true, + PathParam: "delivery_id", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + QueryPath: "tags", + }, + }, + Action: handleWebhooksDeliveriesRetrieve, + HideHelpCommand: true, +} + +var webhooksDeliveriesList = cli.Command{ + Name: "list", + Usage: "List retained batch and monitor webhook deliveries for your organization, newest\nfirst. Filter by at most one of batch_id, monitor_id, or run_id, optionally\ncombined with status. Historical events without retained payloads are not\nlisted. This endpoint costs no credits.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "batch-id", + QueryPath: "batch_id", + }, + &requestflag.Flag[string]{ + Name: "cursor", + QueryPath: "cursor", + }, + &requestflag.Flag[int64]{ + Name: "limit", + Default: 25, + QueryPath: "limit", + }, + &requestflag.Flag[string]{ + Name: "monitor-id", + QueryPath: "monitor_id", + }, + &requestflag.Flag[string]{ + Name: "run-id", + QueryPath: "run_id", + }, + &requestflag.Flag[string]{ + Name: "status", + Usage: `Allowed values: "pending", "delivering", "retrying", "delivered", "failed", "cancelled".`, + QueryPath: "status", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + QueryPath: "tags", + }, + }, + Action: handleWebhooksDeliveriesList, + HideHelpCommand: true, +} + +var webhooksDeliveriesListAttempts = cli.Command{ + Name: "list-attempts", + Usage: "List individual HTTP attempts for a delivery, newest first, including their\ndestination, timestamps, HTTP status, and error. An interrupted attempt may have\nreached the endpoint even when its outcome is unknown. This endpoint costs no\ncredits.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "delivery-id", + Required: true, + PathParam: "delivery_id", + }, + &requestflag.Flag[string]{ + Name: "cursor", + QueryPath: "cursor", + }, + &requestflag.Flag[int64]{ + Name: "limit", + Default: 25, + QueryPath: "limit", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + QueryPath: "tags", + }, + }, + Action: handleWebhooksDeliveriesListAttempts, + HideHelpCommand: true, +} + +var webhooksDeliveriesRetry = cli.Command{ + Name: "retry", + Usage: "Queue an immediate attempt without rerunning or billing the underlying batch or\nmonitor. A waiting retry is brought forward. A failed delivery gets one\nadditional attempt without restarting its automatic retry budget. Set force:\ntrue to resend an acknowledged delivery. An in-progress attempt cannot be\nduplicated. The stored event body, event ID, and creation time remain unchanged;\neach attempt receives a fresh signature. Monitor retries use the current URL and\nsecret; removing the webhook cancels pending deliveries. Batch result URLs in\nold payloads may have expired: retrieve the batch to get fresh URLs. Replay is\navailable for seven days. A successful attempt cancels remaining automatic\nretries. Idempotency-Key is scoped to your organization and retained with the\ndelivery metadata; repeating the same key and input returns the original\naccepted response.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "delivery-id", + Required: true, + PathParam: "delivery_id", + }, + &requestflag.Flag[bool]{ + Name: "force", + BodyPath: "force", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + BodyPath: "tags", + }, + &requestflag.Flag[string]{ + Name: "idempotency-key", + HeaderPath: "Idempotency-Key", + }, + }, + Action: handleWebhooksDeliveriesRetry, + HideHelpCommand: true, +} + +func handleWebhooksDeliveriesRetrieve(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("delivery-id") && len(unusedArgs) > 0 { + cmd.Set("delivery-id", unusedArgs[0]) + unusedArgs = unusedArgs[1:] + } + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + params := contextdev.WebhookDeliveryGetParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Webhooks.Deliveries.Get( + ctx, + cmd.Value("delivery-id").(string), + params, + options..., + ) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "webhooks:deliveries retrieve", + Transform: transform, + }) +} + +func handleWebhooksDeliveriesList(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + params := contextdev.WebhookDeliveryListParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Webhooks.Deliveries.List(ctx, params, options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "webhooks:deliveries list", + Transform: transform, + }) +} + +func handleWebhooksDeliveriesListAttempts(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("delivery-id") && len(unusedArgs) > 0 { + cmd.Set("delivery-id", unusedArgs[0]) + unusedArgs = unusedArgs[1:] + } + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + params := contextdev.WebhookDeliveryListAttemptsParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Webhooks.Deliveries.ListAttempts( + ctx, + cmd.Value("delivery-id").(string), + params, + options..., + ) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "webhooks:deliveries list-attempts", + Transform: transform, + }) +} + +func handleWebhooksDeliveriesRetry(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("delivery-id") && len(unusedArgs) > 0 { + cmd.Set("delivery-id", unusedArgs[0]) + unusedArgs = unusedArgs[1:] + } + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + ApplicationJSON, + false, + ) + if err != nil { + return err + } + + params := contextdev.WebhookDeliveryRetryParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Webhooks.Deliveries.Retry( + ctx, + cmd.Value("delivery-id").(string), + params, + options..., + ) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "webhooks:deliveries retry", + Transform: transform, + }) +} diff --git a/pkg/cmd/webhookdelivery_test.go b/pkg/cmd/webhookdelivery_test.go new file mode 100644 index 0000000..8a0bd91 --- /dev/null +++ b/pkg/cmd/webhookdelivery_test.go @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package cmd + +import ( + "testing" + + "github.com/context-dot-dev/context-dev-cli/internal/mocktest" +) + +func TestWebhooksDeliveriesRetrieve(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "webhooks:deliveries", "retrieve", + "--delivery-id", "whd_210b9798eb53baa4e69d31c1071cf03d", + "--tag", "production", + "--tag", "team-alpha", + ) + }) +} + +func TestWebhooksDeliveriesList(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "webhooks:deliveries", "list", + "--batch-id", "batch_id", + "--cursor", "whd_210b9798eb53baa4e69d31c1071cf03d", + "--limit", "1", + "--monitor-id", "monitor_id", + "--run-id", "run_id", + "--status", "pending", + "--tag", "production", + "--tag", "team-alpha", + ) + }) +} + +func TestWebhooksDeliveriesListAttempts(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "webhooks:deliveries", "list-attempts", + "--delivery-id", "whd_210b9798eb53baa4e69d31c1071cf03d", + "--cursor", "wha_210b9798eb53baa4e69d31c1071cf03d", + "--limit", "1", + "--tag", "production", + "--tag", "team-alpha", + ) + }) +} + +func TestWebhooksDeliveriesRetry(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "webhooks:deliveries", "retry", + "--delivery-id", "whd_210b9798eb53baa4e69d31c1071cf03d", + "--force=true", + "--tag", "production", + "--tag", "team-alpha", + "--idempotency-key", "Idempotency-Key", + ) + }) + + t.Run("piping data", func(t *testing.T) { + // Test piping YAML data over stdin + pipeData := []byte("" + + "force: true\n" + + "tags:\n" + + " - production\n" + + " - team-alpha\n") + mocktest.TestRunMockTestWithPipeAndFlags( + t, pipeData, + "--api-key", "string", + "webhooks:deliveries", "retry", + "--delivery-id", "whd_210b9798eb53baa4e69d31c1071cf03d", + "--idempotency-key", "Idempotency-Key", + ) + }) +} From 7fd54b92fa451965a26df73df1ac6b4cc0d8d458 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 8 Sep 2026 00:00:23 +0000 Subject: [PATCH 005/119] feat(webhooks): simplify delivery APIs Stainless-Generated-From: 8e86d20d97155caef7882d9d77aebc214cd368e2 --- pkg/cmd/batch.go | 2 +- pkg/cmd/brand.go | 4 +- pkg/cmd/industry.go | 4 +- pkg/cmd/monitor.go | 4 +- pkg/cmd/parse.go | 2 +- pkg/cmd/web.go | 16 +++---- pkg/cmd/webhookdelivery.go | 75 +++++++++++++++++++++------------ pkg/cmd/webhookdelivery_test.go | 23 +++++++++- 8 files changed, 86 insertions(+), 44 deletions(-) diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index e42040a..bdd9ee3 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -170,7 +170,7 @@ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[map[string]any]{ Name: "webhook.retry", - Usage: "Opt into durable webhook delivery. An empty object uses the default retry schedule. Omit retry to preserve legacy delivery behavior. The policy is snapshotted for each event.", + Usage: "Webhook retry settings. Use {} for the default schedule.", InnerField: "retry", }, }, diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index 249d26f..1638b33 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -134,7 +134,7 @@ var brandRetrieveSimplified = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[string]{ @@ -177,7 +177,7 @@ var brandSearch = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ diff --git a/pkg/cmd/industry.go b/pkg/cmd/industry.go index 4fd74f4..0cbc254 100644 --- a/pkg/cmd/industry.go +++ b/pkg/cmd/industry.go @@ -39,7 +39,7 @@ var industryRetrieveNaics = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ @@ -77,7 +77,7 @@ var industryRetrieveSic = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index 45bc9bc..b5d95d1 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -88,7 +88,7 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[map[string]any]{ Name: "webhook.retry", - Usage: "Opt into durable webhook delivery. An empty object uses the default retry schedule. Omit retry to preserve legacy delivery behavior. The policy is snapshotted for each event.", + Usage: "Webhook retry settings. Use {} for the default schedule.", InnerField: "retry", }, &requestflag.InnerFlag[string]{ @@ -192,7 +192,7 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[map[string]any]{ Name: "webhook.retry", - Usage: "Opt into durable webhook delivery. An empty object uses the default retry schedule. Omit retry to preserve legacy delivery behavior. The policy is snapshotted for each event.", + Usage: "Webhook retry settings. Use {} for the default schedule.", InnerField: "retry", }, &requestflag.InnerFlag[string]{ diff --git a/pkg/cmd/parse.go b/pkg/cmd/parse.go index 944ab9f..1458917 100644 --- a/pkg/cmd/parse.go +++ b/pkg/cmd/parse.go @@ -68,7 +68,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[bool]{ diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index f6771cf..1a6b74f 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -150,7 +150,7 @@ var webExtractCompetitors = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ @@ -186,7 +186,7 @@ var webExtractFonts = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ @@ -227,7 +227,7 @@ var webExtractStyleguide = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ @@ -300,7 +300,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ @@ -673,7 +673,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ @@ -766,7 +766,7 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ @@ -893,7 +893,7 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ @@ -986,7 +986,7 @@ var webWebScrapeSitemap = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, &requestflag.Flag[int64]{ diff --git a/pkg/cmd/webhookdelivery.go b/pkg/cmd/webhookdelivery.go index 2042df5..5922f5b 100644 --- a/pkg/cmd/webhookdelivery.go +++ b/pkg/cmd/webhookdelivery.go @@ -16,17 +16,18 @@ import ( var webhooksDeliveriesRetrieve = cli.Command{ Name: "retrieve", - Usage: "Get the live status, retry policy, latest attempt, and replay expiration for a\nretained delivery. Use the attempts endpoint for its complete paginated history.\nThis endpoint costs no credits.", + Usage: "Get a webhook delivery, including its status and latest attempt.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "delivery-id", + Usage: "Delivery ID.", Required: true, PathParam: "delivery_id", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, }, @@ -36,39 +37,55 @@ var webhooksDeliveriesRetrieve = cli.Command{ var webhooksDeliveriesList = cli.Command{ Name: "list", - Usage: "List retained batch and monitor webhook deliveries for your organization, newest\nfirst. Filter by at most one of batch_id, monitor_id, or run_id, optionally\ncombined with status. Historical events without retained payloads are not\nlisted. This endpoint costs no credits.", + Usage: "List your batch or monitor webhook deliveries, newest first.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ - Name: "batch-id", - QueryPath: "batch_id", + Name: "type", + Usage: "Delivery source.", + Required: true, + BodyPath: "type", }, &requestflag.Flag[string]{ - Name: "cursor", - QueryPath: "cursor", + Name: "batch-id", + Usage: "Filter by batch ID.", + BodyPath: "batch_id", }, - &requestflag.Flag[int64]{ - Name: "limit", - Default: 25, - QueryPath: "limit", + &requestflag.Flag[any]{ + Name: "created-after", + Usage: "Only include events created after this ISO 8601 timestamp.", + BodyPath: "created_after", }, &requestflag.Flag[string]{ - Name: "monitor-id", - QueryPath: "monitor_id", + Name: "cursor", + Usage: "The next_cursor from the previous response.", + BodyPath: "cursor", }, - &requestflag.Flag[string]{ - Name: "run-id", - QueryPath: "run_id", + &requestflag.Flag[int64]{ + Name: "limit", + Usage: "Number of deliveries to return.", + Default: 25, + BodyPath: "limit", }, &requestflag.Flag[string]{ - Name: "status", - Usage: `Allowed values: "pending", "delivering", "retrying", "delivered", "failed", "cancelled".`, - QueryPath: "status", + Name: "status", + Usage: "Filter by delivery status.", + BodyPath: "status", }, &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", + Name: "tag", + Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + BodyPath: "tags", + }, + &requestflag.Flag[string]{ + Name: "monitor-id", + Usage: "Filter by monitor ID.", + BodyPath: "monitor_id", + }, + &requestflag.Flag[string]{ + Name: "run-id", + Usage: "Filter by monitor run ID.", + BodyPath: "run_id", }, }, Action: handleWebhooksDeliveriesList, @@ -77,26 +94,29 @@ var webhooksDeliveriesList = cli.Command{ var webhooksDeliveriesListAttempts = cli.Command{ Name: "list-attempts", - Usage: "List individual HTTP attempts for a delivery, newest first, including their\ndestination, timestamps, HTTP status, and error. An interrupted attempt may have\nreached the endpoint even when its outcome is unknown. This endpoint costs no\ncredits.", + Usage: "List delivery attempts, newest first.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "delivery-id", + Usage: "Delivery ID.", Required: true, PathParam: "delivery_id", }, &requestflag.Flag[string]{ Name: "cursor", + Usage: "The next_cursor from the previous response.", QueryPath: "cursor", }, &requestflag.Flag[int64]{ Name: "limit", + Usage: "Number of attempts to return.", Default: 25, QueryPath: "limit", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, }, @@ -106,16 +126,18 @@ var webhooksDeliveriesListAttempts = cli.Command{ var webhooksDeliveriesRetry = cli.Command{ Name: "retry", - Usage: "Queue an immediate attempt without rerunning or billing the underlying batch or\nmonitor. A waiting retry is brought forward. A failed delivery gets one\nadditional attempt without restarting its automatic retry budget. Set force:\ntrue to resend an acknowledged delivery. An in-progress attempt cannot be\nduplicated. The stored event body, event ID, and creation time remain unchanged;\neach attempt receives a fresh signature. Monitor retries use the current URL and\nsecret; removing the webhook cancels pending deliveries. Batch result URLs in\nold payloads may have expired: retrieve the batch to get fresh URLs. Replay is\navailable for seven days. A successful attempt cancels remaining automatic\nretries. Idempotency-Key is scoped to your organization and retained with the\ndelivery metadata; repeating the same key and input returns the original\naccepted response.", + Usage: "Retry a webhook delivery within seven days of creation.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "delivery-id", + Usage: "Delivery ID.", Required: true, PathParam: "delivery_id", }, &requestflag.Flag[bool]{ Name: "force", + Usage: "Resend a delivery that already succeeded.", BodyPath: "force", }, &requestflag.Flag[[]string]{ @@ -125,6 +147,7 @@ var webhooksDeliveriesRetry = cli.Command{ }, &requestflag.Flag[string]{ Name: "idempotency-key", + Usage: "Unique key to prevent duplicate retry requests.", HeaderPath: "Idempotency-Key", }, }, @@ -193,7 +216,7 @@ func handleWebhooksDeliveriesList(ctx context.Context, cmd *cli.Command) error { cmd, apiquery.NestedQueryFormatBrackets, apiquery.ArrayQueryFormatComma, - EmptyBody, + ApplicationJSON, false, ) if err != nil { diff --git a/pkg/cmd/webhookdelivery_test.go b/pkg/cmd/webhookdelivery_test.go index 8a0bd91..7c6e670 100644 --- a/pkg/cmd/webhookdelivery_test.go +++ b/pkg/cmd/webhookdelivery_test.go @@ -29,16 +29,35 @@ func TestWebhooksDeliveriesList(t *testing.T) { t, "--api-key", "string", "webhooks:deliveries", "list", + "--type", "batch", "--batch-id", "batch_id", + "--created-after", "'2026-09-01T00:00:00Z'", "--cursor", "whd_210b9798eb53baa4e69d31c1071cf03d", "--limit", "1", - "--monitor-id", "monitor_id", - "--run-id", "run_id", "--status", "pending", "--tag", "production", "--tag", "team-alpha", ) }) + + t.Run("piping data", func(t *testing.T) { + // Test piping YAML data over stdin + pipeData := []byte("" + + "type: batch\n" + + "batch_id: batch_id\n" + + "created_after: '2026-09-01T00:00:00Z'\n" + + "cursor: whd_210b9798eb53baa4e69d31c1071cf03d\n" + + "limit: 1\n" + + "status: pending\n" + + "tags:\n" + + " - production\n" + + " - team-alpha\n") + mocktest.TestRunMockTestWithPipeAndFlags( + t, pipeData, + "--api-key", "string", + "webhooks:deliveries", "list", + ) + }) } func TestWebhooksDeliveriesListAttempts(t *testing.T) { From 0871fe10f6224d978ab978eed851a6512f568f26 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 8 Sep 2026 00:42:08 +0000 Subject: [PATCH 006/119] Build SDK Stainless-Generated-From: 03889ed8828dbebb812efbfd8f3d3444ecb8dd37 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fada419..d862125 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.14.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.15.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 07cbdc1..adbef32 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.14.0 h1:N9CU3QkAJagTBJEV4e2qPycQG+JSZNicffXgLC9wdaE= -github.com/context-dot-dev/context-go-sdk/v2 v2.14.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.15.0 h1:jprRKr+F5KHnf/F09Ncd7aptHQwxw7p4FbXMQeiqTVs= +github.com/context-dot-dev/context-go-sdk/v2 v2.15.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 7e03bf3075934de07ee9364819531f14756816e5 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 9 Sep 2026 12:37:28 +0000 Subject: [PATCH 007/119] fix(api): reject timeoutMS too short for waitForMs Stainless-Generated-From: 4265cce9e8ec60bc719c657884ea253811409408 --- pkg/cmd/web.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 1a6b74f..dcd15f8 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -316,7 +316,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[*int64]{ Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted.", + Usage: "Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. When combined with timeoutMS, timeoutMS must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", Default: requestflag.Ptr[int64](3000), QueryPath: "waitForMs", }, @@ -689,7 +689,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[*int64]{ Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds).", + Usage: "Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). When combined with timeoutMS, timeoutMS must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", QueryPath: "waitForMs", }, &requestflag.Flag[string]{ @@ -776,7 +776,7 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[*int64]{ Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds).", + Usage: "Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). When combined with timeoutMS, timeoutMS must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", QueryPath: "waitForMs", }, }, @@ -909,7 +909,7 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[*int64]{ Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds).", + Usage: "Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). When combined with timeoutMS, timeoutMS must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", QueryPath: "waitForMs", }, &requestflag.Flag[string]{ From 08ee0ebeb58a3fa865c4df7c5ba2364d2745b9ee Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 11 Sep 2026 20:54:07 +0000 Subject: [PATCH 008/119] feat(logs): expose request log endpoints in SDKs (#1025) Stainless-Generated-From: 3211b8270afdd0df5d7118e384cf0fd333ab9f5c --- .stats.yml | 2 +- pkg/cmd/cmd.go | 9 +++ pkg/cmd/log.go | 182 ++++++++++++++++++++++++++++++++++++++++++++ pkg/cmd/log_test.go | 43 +++++++++++ 4 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 pkg/cmd/log.go create mode 100644 pkg/cmd/log_test.go diff --git a/.stats.yml b/.stats.yml index c7c071b..006b15f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 45 +configured_endpoints: 47 diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index c7a759f..da4eaf3 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -206,6 +206,15 @@ func init() { &newsSearch, }, }, + { + Name: "logs", + Category: "API RESOURCE", + Suggest: true, + Commands: []*cli.Command{ + &logsRetrieve, + &logsList, + }, + }, { Name: "@manpages", Usage: "Generate documentation for 'man'", diff --git a/pkg/cmd/log.go b/pkg/cmd/log.go new file mode 100644 index 0000000..fe695b7 --- /dev/null +++ b/pkg/cmd/log.go @@ -0,0 +1,182 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package cmd + +import ( + "context" + "fmt" + + "github.com/context-dot-dev/context-dev-cli/internal/apiquery" + "github.com/context-dot-dev/context-dev-cli/internal/requestflag" + "github.com/context-dot-dev/context-go-sdk/v2" + "github.com/context-dot-dev/context-go-sdk/v2/option" + "github.com/tidwall/gjson" + "github.com/urfave/cli/v3" +) + +var logsRetrieve = cli.Command{ + Name: "retrieve", + Usage: "Get one logged API call, including its request input and response body.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "request-id", + Usage: "The request ID of the logged API call.", + Required: true, + PathParam: "request_id", + }, + }, + Action: handleLogsRetrieve, + HideHelpCommand: true, +} + +var logsList = cli.Command{ + Name: "list", + Usage: "List your organization's API requests, newest first. Defaults to the last 24\nhours.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "error-code", + Usage: "Filter by the `error_code` returned in the response.", + QueryPath: "error_code", + }, + &requestflag.Flag[bool]{ + Name: "errors-only", + Usage: "Only include requests that returned a 4xx or 5xx status.", + Default: false, + QueryPath: "errors_only", + }, + &requestflag.Flag[any]{ + Name: "from", + Usage: "Only include requests at or after this ISO 8601 timestamp. Defaults to 24 hours before `to`.", + QueryPath: "from", + }, + &requestflag.Flag[string]{ + Name: "key-id", + Usage: "Filter by the API key that made the request.", + QueryPath: "key_id", + }, + &requestflag.Flag[int64]{ + Name: "limit", + Usage: "Number of log entries per page.", + Default: 50, + QueryPath: "limit", + }, + &requestflag.Flag[int64]{ + Name: "page", + Usage: "Page number, starting at 1.", + Default: 1, + QueryPath: "page", + }, + &requestflag.Flag[string]{ + Name: "path", + Usage: "Filter by endpoint path, with or without the /v1 prefix.", + QueryPath: "path", + }, + &requestflag.Flag[string]{ + Name: "search", + Usage: "Case-insensitive substring match against the request query and body, e.g. a domain.", + QueryPath: "search", + }, + &requestflag.Flag[int64]{ + Name: "status-code", + Usage: "Filter by exact HTTP status code.", + QueryPath: "status_code", + }, + &requestflag.Flag[string]{ + Name: "tags", + Usage: "Comma-separated request tags. Matches requests carrying any of them. Up to 20 tags, each 1-50 characters.", + QueryPath: "tags", + }, + &requestflag.Flag[any]{ + Name: "to", + Usage: "Only include requests at or before this ISO 8601 timestamp. Defaults to now.", + QueryPath: "to", + }, + }, + Action: handleLogsList, + HideHelpCommand: true, +} + +func handleLogsRetrieve(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("request-id") && len(unusedArgs) > 0 { + cmd.Set("request-id", unusedArgs[0]) + unusedArgs = unusedArgs[1:] + } + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Logs.Get(ctx, cmd.Value("request-id").(string), options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "logs retrieve", + Transform: transform, + }) +} + +func handleLogsList(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + params := contextdev.LogListParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Logs.List(ctx, params, options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "logs list", + Transform: transform, + }) +} diff --git a/pkg/cmd/log_test.go b/pkg/cmd/log_test.go new file mode 100644 index 0000000..b1088a5 --- /dev/null +++ b/pkg/cmd/log_test.go @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package cmd + +import ( + "testing" + + "github.com/context-dot-dev/context-dev-cli/internal/mocktest" +) + +func TestLogsRetrieve(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "logs", "retrieve", + "--request-id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + }) +} + +func TestLogsList(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "logs", "list", + "--error-code", "WEBSITE_ACCESS_ERROR", + "--errors-only=true", + "--from", "'2026-09-10T00:00:00Z'", + "--key-id", "x", + "--limit", "1", + "--page", "1", + "--path", "/brand/retrieve", + "--search", "acme.com", + "--status-code", "500", + "--tags", "nightly-import,team-alpha", + "--to", "'2026-09-11T00:00:00Z'", + ) + }) +} From 36ca4925d60ee9217789de5852bd8dfead5976a7 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 11 Sep 2026 22:23:17 +0000 Subject: [PATCH 009/119] Build SDK Stainless-Generated-From: 1890e653b22be8f063ff3752eed379251d5e77c7 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d862125..4b1f7bd 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.15.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.16.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index adbef32..260bac2 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.15.0 h1:jprRKr+F5KHnf/F09Ncd7aptHQwxw7p4FbXMQeiqTVs= -github.com/context-dot-dev/context-go-sdk/v2 v2.15.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.16.0 h1:l+V+yndagsUKUx0cp4Q5aOt2a21tweSlH5JFhaqLnVA= +github.com/context-dot-dev/context-go-sdk/v2 v2.16.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 39ca377527e965766a22a5dcf583101cbffd1692 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 12 Sep 2026 19:52:36 +0000 Subject: [PATCH 010/119] feat(monitors): add page selector filters (#1037) Stainless-Generated-From: f472fabf9d436861207974b71d902b8418aa387b --- pkg/cmd/monitor_test.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/monitor_test.go b/pkg/cmd/monitor_test.go index 5586f96..67a43ac 100644 --- a/pkg/cmd/monitor_test.go +++ b/pkg/cmd/monitor_test.go @@ -17,7 +17,7 @@ func TestMonitorsCreate(t *testing.T) { "--api-key", "string", "monitors", "create", "--name", "Acme pricing page", - "--target", "{type: page, url: https://acme.com/pricing, instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}", + "--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--change-detection", "{type: exact}", "--mode", "web", "--schedule", "{frequency: 6, type: interval, unit: hours}", @@ -37,7 +37,7 @@ func TestMonitorsCreate(t *testing.T) { "--api-key", "string", "monitors", "create", "--name", "Acme pricing page", - "--target", "{type: page, url: https://acme.com/pricing, instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}", + "--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--change-detection", "{type: exact}", "--mode", "web", "--schedule.frequency", "6", @@ -58,6 +58,11 @@ func TestMonitorsCreate(t *testing.T) { "target:\n" + " type: page\n" + " url: https://acme.com/pricing\n" + + " exclude_selectors:\n" + + " - .carousel\n" + + " - '[id^=\"TA_\"]'\n" + + " include_selectors:\n" + + " - '#attraction-details'\n" + " instructions: >-\n" + " Report pricing or plan availability changes. Ignore counters, timestamps,\n" + " testimonials, and navigation.\n" + @@ -120,7 +125,7 @@ func TestMonitorsUpdate(t *testing.T) { "--status", "active", "--tag", "pricing", "--tag", "competitor", - "--target", "{type: page, url: https://acme.com/pricing, instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}", + "--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed], retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", ) }) @@ -143,7 +148,7 @@ func TestMonitorsUpdate(t *testing.T) { "--status", "active", "--tag", "pricing", "--tag", "competitor", - "--target", "{type: page, url: https://acme.com/pricing, instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}", + "--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--webhook.url", "https://example.com/webhook", "--webhook.events", "[change.detected, run.completed]", "--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}", @@ -167,6 +172,11 @@ func TestMonitorsUpdate(t *testing.T) { "target:\n" + " type: page\n" + " url: https://acme.com/pricing\n" + + " exclude_selectors:\n" + + " - .carousel\n" + + " - '[id^=\"TA_\"]'\n" + + " include_selectors:\n" + + " - '#attraction-details'\n" + " instructions: >-\n" + " Report pricing or plan availability changes. Ignore counters, timestamps,\n" + " testimonials, and navigation.\n" + From f2427ba6e9d7538546b0dee7b90a037c082b6d03 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 12 Sep 2026 20:03:04 +0000 Subject: [PATCH 011/119] feat(api-keys): enforce scoped API key permissions (#1038) Stainless-Generated-From: c4490679ad1c4036f4865d52b7b223b9daf73af8 --- pkg/cmd/monitor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index b5d95d1..b63edb5 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -93,7 +93,7 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "webhook.secret", - Usage: "Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `\"{t}.{rawRequestBody}\"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients.", + Usage: "Signing secret used to verify webhook authenticity. Omitted unless the API key has monitors:write permission or full access. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `\"{t}.{rawRequestBody}\"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients.", InnerField: "secret", }, }, @@ -197,7 +197,7 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "webhook.secret", - Usage: "Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `\"{t}.{rawRequestBody}\"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients.", + Usage: "Signing secret used to verify webhook authenticity. Omitted unless the API key has monitors:write permission or full access. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `\"{t}.{rawRequestBody}\"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients.", InnerField: "secret", }, }, From d7173ff5eff964c53db99e59a4da62df112bdaba Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 13 Sep 2026 01:05:45 +0000 Subject: [PATCH 012/119] fix(webhooks): format Slack webhook notifications (#1045) Stainless-Generated-From: 54050499f81f1b0c67565bcb0231fc88402eccac --- pkg/cmd/monitor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index b63edb5..054d9af 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -78,7 +78,7 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ "webhook": { &requestflag.InnerFlag[string]{ Name: "webhook.url", - Usage: "Webhook URL events are delivered to.", + Usage: "Webhook URL events are delivered to. Slack incoming webhook URLs are automatically formatted as Slack messages.", InnerField: "url", }, &requestflag.InnerFlag[[]string]{ @@ -182,7 +182,7 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ "webhook": { &requestflag.InnerFlag[string]{ Name: "webhook.url", - Usage: "Webhook URL events are delivered to.", + Usage: "Webhook URL events are delivered to. Slack incoming webhook URLs are automatically formatted as Slack messages.", InnerField: "url", }, &requestflag.InnerFlag[[]string]{ From 97370fd41d8d503270a786dc474ffe2a84c94214 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 13 Sep 2026 02:16:53 +0000 Subject: [PATCH 013/119] fix(api): honour maxAgeMs=0 on brand retrieve, styleguide and fonts endpoints (#998) Stainless-Generated-From: 4477f7a60e52a3267b213b91a9c0dca57a2fdaa1 --- pkg/cmd/brand.go | 4 ++-- pkg/cmd/web.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index 1638b33..8386547 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -37,7 +37,7 @@ var brandRetrieve = cli.Command{ }, &requestflag.Flag[int64]{ Name: "max-age-ms", - Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year.", + Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms) are clamped to 1 year.", BodyPath: "maxAgeMs", }, &requestflag.Flag[bool]{ @@ -128,7 +128,7 @@ var brandRetrieveSimplified = cli.Command{ }, &requestflag.Flag[*int64]{ Name: "max-age-ms", - Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year.", + Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms) are clamped to 1 year.", Default: requestflag.Ptr[int64](7776000000), QueryPath: "maxAgeMs", }, diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index dcd15f8..649f394 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -180,7 +180,7 @@ var webExtractFonts = cli.Command{ }, &requestflag.Flag[*int64]{ Name: "max-age-ms", - Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year.", + Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms) are clamped to 1 year.", Default: requestflag.Ptr[int64](7776000000), QueryPath: "maxAgeMs", }, @@ -221,7 +221,7 @@ var webExtractStyleguide = cli.Command{ }, &requestflag.Flag[*int64]{ Name: "max-age-ms", - Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year.", + Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms) are clamped to 1 year.", Default: requestflag.Ptr[int64](7776000000), QueryPath: "maxAgeMs", }, From 8f226f8287e196fcd383f1bef037d804a493c222 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 13 Sep 2026 02:33:54 +0000 Subject: [PATCH 014/119] feat(answers): add live web research with fast and ultra modes (#954) Stainless-Generated-From: 462dacbcb30fa1a30926f16d800581d9e4cb508b --- .stats.yml | 2 +- pkg/cmd/cmd.go | 1 + pkg/cmd/web.go | 77 +++++++++++++++++++++++++++++++++++++++++++++ pkg/cmd/web_test.go | 36 +++++++++++++++++++++ 4 files changed, 115 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 006b15f..58526a7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 47 +configured_endpoints: 48 diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index da4eaf3..7c19c08 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -97,6 +97,7 @@ func init() { Category: "API RESOURCE", Suggest: true, Commands: []*cli.Command{ + &webAnswers, &webExtract, &webExtractCompetitors, &webExtractFonts, diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 649f394..3b7930d 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -14,6 +14,42 @@ import ( "github.com/urfave/cli/v3" ) +var webAnswers = cli.Command{ + Name: "answers", + Usage: "Researches the live web and returns a sourced answer in your requested JSON\nshape. Select fast for a smaller research budget at 10 credits or ultra for\ndeeper reasoning at 100 credits. Defaults to ultra. Fast research is limited to\n30 seconds and ultra to 50 seconds; timeoutMS can shorten either deadline.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "task", + Usage: `What to research and answer, in plain language. Naming a domain in the task (for example "pricing on context.dev") makes the agent read that site before it searches.`, + Required: true, + BodyPath: "task", + }, + &requestflag.Flag[map[string]any]{ + Name: "json-format", + Usage: `An example object with placeholder values (for example {"pricing_page_url": "", "plans": [{"name": "", "price": 0}]}). Object keys and value types are preserved; unknown values may be null. Empty arrays accept any JSON items. Defaults to {"result": ""}. Maximum 8 levels, 500 values, and 16000 characters.`, + BodyPath: "json_format", + }, + &requestflag.Flag[string]{ + Name: "mode", + Usage: "Research level: fast uses a smaller model and research budget for 10 credits; ultra uses deeper reasoning and research for 100 credits. Defaults to ultra. Only successful requests consume credits.", + BodyPath: "mode", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + BodyPath: "tags", + }, + &requestflag.Flag[int64]{ + Name: "timeout-ms", + Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", + BodyPath: "timeoutMS", + }, + }, + Action: handleWebAnswers, + HideHelpCommand: true, +} + var webExtract = requestflag.WithInnerFlags(cli.Command{ Name: "extract", Usage: "Crawl a website, use the provided JSON Schema and instructions to prioritize\nrelevant internal links, and extract structured data from the selected pages.", @@ -1010,6 +1046,47 @@ var webWebScrapeSitemap = cli.Command{ HideHelpCommand: true, } +func handleWebAnswers(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + ApplicationJSON, + false, + ) + if err != nil { + return err + } + + params := contextdev.WebAnswersParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Web.Answers(ctx, params, options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "web answers", + Transform: transform, + }) +} + func handleWebExtract(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) unusedArgs := cmd.Args().Slice() diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 410cd22..6833511 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -9,6 +9,42 @@ import ( "github.com/context-dot-dev/context-dev-cli/internal/requestflag" ) +func TestWebAnswers(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "answers", + "--task", "Find the pricing page URL and plan names for context.dev.", + "--json-format", "{pricing_page_url: bar, plans: bar}", + "--mode", "fast", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-ms", "1000", + ) + }) + + t.Run("piping data", func(t *testing.T) { + // Test piping YAML data over stdin + pipeData := []byte("" + + "task: Find the pricing page URL and plan names for context.dev.\n" + + "json_format:\n" + + " pricing_page_url: bar\n" + + " plans: bar\n" + + "mode: fast\n" + + "tags:\n" + + " - production\n" + + " - team-alpha\n" + + "timeoutMS: 1000\n") + mocktest.TestRunMockTestWithPipeAndFlags( + t, pipeData, + "--api-key", "string", + "web", "answers", + ) + }) +} + func TestWebExtract(t *testing.T) { t.Skip("Mock server tests are disabled") t.Run("regular flags", func(t *testing.T) { From 5d4595725c6a850bc9df5e265ddcd2b6eb8321eb Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 15 Sep 2026 07:50:12 +0000 Subject: [PATCH 015/119] feat(web): add raw bytes scraping endpoint (#1081) Stainless-Generated-From: 8c17db7388df4327e1396492725dcd8847491418 --- .stats.yml | 2 +- pkg/cmd/cmd.go | 1 + pkg/cmd/web.go | 83 +++++++++++++++++++++++++++++++++++++++++++++ pkg/cmd/web_test.go | 18 ++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 58526a7..85f79b6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 48 +configured_endpoints: 49 diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index 7c19c08..fc6a67b 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -105,6 +105,7 @@ func init() { &webScreenshot, &webSearch, &webWebCrawlMd, + &webWebScrapeBytes, &webWebScrapeHTML, &webWebScrapeImages, &webWebScrapeMd, diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 3b7930d..08b1b4d 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -647,6 +647,48 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, }) +var webWebScrapeBytes = cli.Command{ + Name: "web-scrape-bytes", + Usage: "Downloads a resource and returns its bytes as base64. Supports images, PDFs,\nHTML pages, and any other content type without image conversion, text\nextraction, or character-encoding changes. HTTP compression is decoded before\nbase64 encoding. HTML is the original HTTP response; JavaScript is not rendered.\nFollows public redirects and retries failed downloads through ISP and\nresidential proxies, with a direct fallback. When country is specified, only a\nresidential proxy in that country is used. Supply headers such as Referer for\nimages that require a referring page. Downloads are not cached. Maximum decoded\nresource size: 20 MiB (20971520 bytes), before base64 encoding. Successful\nrequests cost 1 credit; errors are not billed.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "url", + Usage: "Full HTTP(S) URL of the resource to download, such as an image, PDF, or page.", + Required: true, + QueryPath: "url", + }, + &requestflag.Flag[string]{ + Name: "country", + Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", + QueryPath: "country", + }, + &requestflag.Flag[map[string]any]{ + Name: "headers", + Usage: "Optional outbound HTTP headers, such as Referer, Cookie, or Authorization. Send as a JSON object or deep-object query params such as headers[Referer]=https://example.com/. Host, Content-Length, and hop-by-hop transport headers are rejected. Authorization and cookies are removed when a redirect changes origin.", + QueryPath: "headers", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + QueryPath: "tags", + }, + &requestflag.Flag[int64]{ + Name: "timeout-ms", + Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", + QueryPath: "timeoutMS", + }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + QueryPath: "zdr", + }, + }, + Action: handleWebWebScrapeBytes, + HideHelpCommand: true, +} + var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ Name: "web-scrape-html", Usage: "Scrapes the given URL and returns the raw HTML content of the page. The base\nrequest costs 1 credit; requests with browser actions cost 2 credits.", @@ -1374,6 +1416,47 @@ func handleWebWebCrawlMd(ctx context.Context, cmd *cli.Command) error { }) } +func handleWebWebScrapeBytes(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + params := contextdev.WebWebScrapeBytesParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Web.WebScrapeBytes(ctx, params, options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "web web-scrape-bytes", + Transform: transform, + }) +} + func handleWebWebScrapeHTML(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) unusedArgs := cmd.Args().Slice() diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 6833511..6139445 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -448,6 +448,24 @@ func TestWebWebCrawlMd(t *testing.T) { }) } +func TestWebWebScrapeBytes(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "web-scrape-bytes", + "--url", "https://example.com", + "--country", "de", + "--headers", "{foo: J!}", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-ms", "1", + "--zdr", "enabled", + ) + }) +} + func TestWebWebScrapeHTML(t *testing.T) { t.Skip("Mock server tests are disabled") t.Run("regular flags", func(t *testing.T) { From 467f13ab47753ff0889e46d3315604841dab78d4 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 15 Sep 2026 09:02:27 +0000 Subject: [PATCH 016/119] feat(api): unify timeout configuration and return partial results (#1030) Stainless-Generated-From: 18213ddac7685de467dcc665aab9a54e9799721e --- pkg/cmd/ai.go | 50 +++++-- pkg/cmd/ai_test.go | 50 ++++++- pkg/cmd/brand.go | 50 +++++-- pkg/cmd/brand_test.go | 49 ++++++- pkg/cmd/industry.go | 50 +++++-- pkg/cmd/industry_test.go | 44 +++++- pkg/cmd/person.go | 20 ++- pkg/cmd/person_test.go | 9 +- pkg/cmd/utility.go | 25 +++- pkg/cmd/utility_test.go | 25 +++- pkg/cmd/web.go | 310 +++++++++++++++++++++++++++++---------- pkg/cmd/web_test.go | 191 ++++++++++++++++++++---- 12 files changed, 712 insertions(+), 161 deletions(-) diff --git a/pkg/cmd/ai.go b/pkg/cmd/ai.go index 34a436a..763ec4f 100644 --- a/pkg/cmd/ai.go +++ b/pkg/cmd/ai.go @@ -14,7 +14,7 @@ import ( "github.com/urfave/cli/v3" ) -var aiExtractProduct = cli.Command{ +var aiExtractProduct = requestflag.WithInnerFlags(cli.Command{ Name: "extract-product", Usage: "Given a single URL, determines if it is a product page and extracts the product\ninformation.", Suggest: true, @@ -36,17 +36,30 @@ var aiExtractProduct = cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, }, Action: handleAIExtractProduct, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) -var aiExtractProducts = cli.Command{ +var aiExtractProducts = requestflag.WithInnerFlags(cli.Command{ Name: "extract-products", Usage: "Extract product information from a brand's website. We will analyze the website\nand return a list of products with details such as name, description, image,\npricing, features, and more.", Suggest: true, @@ -72,10 +85,10 @@ var aiExtractProducts = cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "direct-url", @@ -85,7 +98,20 @@ var aiExtractProducts = cli.Command{ }, Action: handleAIExtractProducts, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) func handleAIExtractProduct(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) diff --git a/pkg/cmd/ai_test.go b/pkg/cmd/ai_test.go index e6ed136..60e3f90 100644 --- a/pkg/cmd/ai_test.go +++ b/pkg/cmd/ai_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/context-dot-dev/context-dev-cli/internal/mocktest" + "github.com/context-dot-dev/context-dev-cli/internal/requestflag" ) func TestAIExtractProduct(t *testing.T) { @@ -19,7 +20,25 @@ func TestAIExtractProduct(t *testing.T) { "--max-age-ms", "0", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(aiExtractProduct) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "ai", "extract-product", + "--url", "https://example.com", + "--max-age-ms", "0", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) @@ -31,7 +50,9 @@ func TestAIExtractProduct(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n") + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", @@ -52,7 +73,26 @@ func TestAIExtractProducts(t *testing.T) { "--max-products", "1", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(aiExtractProducts) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "ai", "extract-products", + "--domain", "domain", + "--max-age-ms", "0", + "--max-products", "1", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) @@ -65,7 +105,9 @@ func TestAIExtractProducts(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n") + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index 8386547..c557913 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -14,7 +14,7 @@ import ( "github.com/urfave/cli/v3" ) -var brandRetrieve = cli.Command{ +var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ Name: "retrieve", Usage: "Retrieve logos, backdrops, colors, industry, description, and more. Provide\nexactly one lookup identifier in the request body: a domain, company name, email\naddress, stock ticker, transaction descriptor, or direct URL. Note:\n`by_direct_url` fetches brand data only from the provided URL — not from the\nentire internet.", Suggest: true, @@ -50,10 +50,10 @@ var brandRetrieve = cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "name", @@ -113,9 +113,22 @@ var brandRetrieve = cli.Command{ }, Action: handleBrandRetrieve, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) -var brandRetrieveSimplified = cli.Command{ +var brandRetrieveSimplified = requestflag.WithInnerFlags(cli.Command{ Name: "retrieve-simplified", Usage: "Returns a simplified version of brand data containing only essential\ninformation: domain, title, colors, logos, and backdrops. Optimized for faster\nresponses and reduced data transfer.", Suggest: true, @@ -142,15 +155,28 @@ var brandRetrieveSimplified = cli.Command{ Usage: "Optional theme preference used when selecting brand assets.", QueryPath: "theme", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, }, Action: handleBrandRetrieveSimplified, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) var brandSearch = cli.Command{ Name: "search", diff --git a/pkg/cmd/brand_test.go b/pkg/cmd/brand_test.go index a46bd9c..e025d9e 100644 --- a/pkg/cmd/brand_test.go +++ b/pkg/cmd/brand_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/context-dot-dev/context-dev-cli/internal/mocktest" + "github.com/context-dot-dev/context-dev-cli/internal/requestflag" ) func TestBrandRetrieve(t *testing.T) { @@ -22,7 +23,28 @@ func TestBrandRetrieve(t *testing.T) { "--max-speed=true", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(brandRetrieve) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "brand", "retrieve", + "--domain", "xxx", + "--type", "by_domain", + "--force-language", "afrikaans", + "--max-age-ms", "0", + "--max-speed=true", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) @@ -37,7 +59,9 @@ func TestBrandRetrieve(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n") + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", @@ -58,7 +82,26 @@ func TestBrandRetrieveSimplified(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--theme", "light", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(brandRetrieveSimplified) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "brand", "retrieve-simplified", + "--domain", "xxx", + "--max-age-ms", "0", + "--tag", "production", + "--tag", "team-alpha", + "--theme", "light", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) } diff --git a/pkg/cmd/industry.go b/pkg/cmd/industry.go index 0cbc254..22cbae6 100644 --- a/pkg/cmd/industry.go +++ b/pkg/cmd/industry.go @@ -14,7 +14,7 @@ import ( "github.com/urfave/cli/v3" ) -var industryRetrieveNaics = cli.Command{ +var industryRetrieveNaics = requestflag.WithInnerFlags(cli.Command{ Name: "retrieve-naics", Usage: "Classify any brand into 2022 NAICS industry codes from its domain or name.", Suggest: true, @@ -42,17 +42,30 @@ var industryRetrieveNaics = cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, }, Action: handleIndustryRetrieveNaics, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) -var industryRetrieveSic = cli.Command{ +var industryRetrieveSic = requestflag.WithInnerFlags(cli.Command{ Name: "retrieve-sic", Usage: "Classify any brand into Standard Industrial Classification (SIC) codes from its\ndomain or name. Choose between the original SIC system (`original_sic`) or the\nlatest SIC list maintained by the SEC (`latest_sec`).", Suggest: true, @@ -80,10 +93,10 @@ var industryRetrieveSic = cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "type", @@ -94,7 +107,20 @@ var industryRetrieveSic = cli.Command{ }, Action: handleIndustryRetrieveSic, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) func handleIndustryRetrieveNaics(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) diff --git a/pkg/cmd/industry_test.go b/pkg/cmd/industry_test.go index b7f6329..ac4e273 100644 --- a/pkg/cmd/industry_test.go +++ b/pkg/cmd/industry_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/context-dot-dev/context-dev-cli/internal/mocktest" + "github.com/context-dot-dev/context-dev-cli/internal/requestflag" ) func TestIndustryRetrieveNaics(t *testing.T) { @@ -20,7 +21,26 @@ func TestIndustryRetrieveNaics(t *testing.T) { "--min-results", "1", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(industryRetrieveNaics) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "industry", "retrieve-naics", + "--input", "xxxx", + "--max-results", "1", + "--min-results", "1", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) } @@ -37,7 +57,27 @@ func TestIndustryRetrieveSic(t *testing.T) { "--min-results", "1", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + "--type", "original_sic", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(industryRetrieveSic) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "industry", "retrieve-sic", + "--input", "xxxx", + "--max-results", "1", + "--min-results", "1", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", "--type", "original_sic", ) }) diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index efc6e30..9803cd4 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -48,10 +48,10 @@ var peopleEnrich = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, }, Action: handlePeopleEnrich, @@ -109,6 +109,18 @@ var peopleEnrich = requestflag.WithInnerFlags(cli.Command{ InnerField: "last", }, }, + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, }) func handlePeopleEnrich(ctx context.Context, cmd *cli.Command) error { diff --git a/pkg/cmd/person_test.go b/pkg/cmd/person_test.go index 2a1a4b1..6394f4d 100644 --- a/pkg/cmd/person_test.go +++ b/pkg/cmd/person_test.go @@ -24,7 +24,7 @@ func TestPeopleEnrich(t *testing.T) { "--social-url", "https://www.linkedin.com/in/ada-lovelace/", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", ) }) @@ -52,7 +52,8 @@ func TestPeopleEnrich(t *testing.T) { "--social-url", "https://www.linkedin.com/in/ada-lovelace/", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) @@ -82,7 +83,9 @@ func TestPeopleEnrich(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n") + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/utility.go b/pkg/cmd/utility.go index 4173edf..9d57c63 100644 --- a/pkg/cmd/utility.go +++ b/pkg/cmd/utility.go @@ -14,7 +14,7 @@ import ( "github.com/urfave/cli/v3" ) -var utilityPrefetch = cli.Command{ +var utilityPrefetch = requestflag.WithInnerFlags(cli.Command{ Name: "prefetch", Usage: "Signal that you may fetch data soon to improve latency. The type field selects\nwhat to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a\nstyleguide extraction) and identifier carries exactly one lookup key: a domain,\nor an email whose domain is extracted and validated (free email providers and\ndisposable email addresses are not allowed).", Suggest: true, @@ -36,15 +36,28 @@ var utilityPrefetch = cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, }, Action: handleUtilityPrefetch, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. This endpoint supports "fail": return 408 REQUEST_TIMEOUT without charging credits.`, + InnerField: "behavior", + }, + }, +}) func handleUtilityPrefetch(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) diff --git a/pkg/cmd/utility_test.go b/pkg/cmd/utility_test.go index 8f43739..c7f4816 100644 --- a/pkg/cmd/utility_test.go +++ b/pkg/cmd/utility_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/context-dot-dev/context-dev-cli/internal/mocktest" + "github.com/context-dot-dev/context-dev-cli/internal/requestflag" ) func TestUtilityPrefetch(t *testing.T) { @@ -19,7 +20,25 @@ func TestUtilityPrefetch(t *testing.T) { "--type", "brand", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(utilityPrefetch) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "utility", "prefetch", + "--identifier", "{domain: xxx}", + "--type", "brand", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) @@ -32,7 +51,9 @@ func TestUtilityPrefetch(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n") + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 08b1b4d..063bd4f 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -14,9 +14,9 @@ import ( "github.com/urfave/cli/v3" ) -var webAnswers = cli.Command{ +var webAnswers = requestflag.WithInnerFlags(cli.Command{ Name: "answers", - Usage: "Researches the live web and returns a sourced answer in your requested JSON\nshape. Select fast for a smaller research budget at 10 credits or ultra for\ndeeper reasoning at 100 credits. Defaults to ultra. Fast research is limited to\n30 seconds and ultra to 50 seconds; timeoutMS can shorten either deadline.", + Usage: "Researches the live web and returns a sourced answer in your requested JSON\nshape. Select fast for a smaller research budget at 10 credits or ultra for\ndeeper reasoning at 100 credits. Defaults to ultra. Fast research is limited to\n30 seconds and ultra to 50 seconds; timeoutOpts.milliseconds can shorten either\ndeadline.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -40,15 +40,28 @@ var webAnswers = cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, }, Action: handleWebAnswers, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) var webExtract = requestflag.WithInnerFlags(cli.Command{ Name: "extract", @@ -134,10 +147,10 @@ var webExtract = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, &requestflag.Flag[int64]{ Name: "wait-for-ms", @@ -165,9 +178,21 @@ var webExtract = requestflag.WithInnerFlags(cli.Command{ InnerField: "start", }, }, + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, }) -var webExtractCompetitors = cli.Command{ +var webExtractCompetitors = requestflag.WithInnerFlags(cli.Command{ Name: "extract-competitors", Usage: "Analyze a company's landing page and web search evidence to return direct\ncompetitors for the same product or market.", Suggest: true, @@ -189,17 +214,30 @@ var webExtractCompetitors = cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, }, Action: handleWebExtractCompetitors, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) -var webExtractFonts = cli.Command{ +var webExtractFonts = requestflag.WithInnerFlags(cli.Command{ Name: "extract-fonts", Usage: "Scrape font information from a website including font families, usage\nstatistics, fallbacks, and element/word counts.", Suggest: true, @@ -225,17 +263,30 @@ var webExtractFonts = cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, }, Action: handleWebExtractFonts, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + InnerField: "behavior", + }, + }, +}) -var webExtractStyleguide = cli.Command{ +var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ Name: "extract-styleguide", Usage: "Extract a comprehensive design system from a website including colors,\ntypography, spacing, shadows, and UI components.", Suggest: true, @@ -266,15 +317,28 @@ var webExtractStyleguide = cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, }, Action: handleWebExtractStyleguide, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + InnerField: "behavior", + }, + }, +}) var webScreenshot = requestflag.WithInnerFlags(cli.Command{ Name: "screenshot", @@ -339,10 +403,10 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, &requestflag.Flag[map[string]any]{ Name: "viewport", @@ -352,7 +416,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[*int64]{ Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. When combined with timeoutMS, timeoutMS must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", + Usage: "Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", Default: requestflag.Ptr[int64](3000), QueryPath: "waitForMs", }, @@ -366,6 +430,18 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ Action: handleWebScreenshot, HideHelpCommand: true, }, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + InnerField: "behavior", + }, + }, "viewport": { &requestflag.InnerFlag[int64]{ Name: "viewport.height", @@ -432,10 +508,10 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, }, Action: handleWebSearch, @@ -477,10 +553,10 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Truncate inline base64 image payloads to keep responses small.", InnerField: "shortenBase64Images", }, - &requestflag.InnerFlag[int64]{ - Name: "markdown-options.timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - InnerField: "timeoutMS", + &requestflag.InnerFlag[map[string]any]{ + Name: "markdown-options.timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + InnerField: "timeoutOpts", }, &requestflag.InnerFlag[bool]{ Name: "markdown-options.use-main-content-only", @@ -493,6 +569,18 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ InnerField: "waitForMs", }, }, + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, }) var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ @@ -591,10 +679,10 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", BodyPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - BodyPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + BodyPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "url-regex", @@ -645,9 +733,21 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ InnerField: "start", }, }, + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, }) -var webWebScrapeBytes = cli.Command{ +var webWebScrapeBytes = requestflag.WithInnerFlags(cli.Command{ Name: "web-scrape-bytes", Usage: "Downloads a resource and returns its bytes as base64. Supports images, PDFs,\nHTML pages, and any other content type without image conversion, text\nextraction, or character-encoding changes. HTTP compression is decoded before\nbase64 encoding. HTML is the original HTTP response; JavaScript is not rendered.\nFollows public redirects and retries failed downloads through ISP and\nresidential proxies, with a direct fallback. When country is specified, only a\nresidential proxy in that country is used. Supply headers such as Referer for\nimages that require a referring page. Downloads are not cached. Maximum decoded\nresource size: 20 MiB (20971520 bytes), before base64 encoding. Successful\nrequests cost 1 credit; errors are not billed.", Suggest: true, @@ -673,10 +773,10 @@ var webWebScrapeBytes = cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "zdr", @@ -687,11 +787,24 @@ var webWebScrapeBytes = cli.Command{ }, Action: handleWebWebScrapeBytes, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. This endpoint supports "fail": return 408 REQUEST_TIMEOUT without charging credits.`, + InnerField: "behavior", + }, + }, +}) var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ Name: "web-scrape-html", - Usage: "Scrapes the given URL and returns the raw HTML content of the page. The base\nrequest costs 1 credit; requests with browser actions cost 2 credits.", + Usage: "Scrapes the given URL and returns the raw HTML content of the page. The base\nrequest costs 1 credit; requests with browser actions cost 2 credits. A request\nthat hits its timeoutOpts.milliseconds deadline fails with 408 and is not\nbilled, unless timeoutOpts.behavior=return-partial is set — then the page as\nrendered so far is returned with `finalDOMState: \"still-loading\"` and billed at\nthe base cost of 1 credit.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -754,10 +867,10 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, &requestflag.Flag[bool]{ Name: "use-main-content-only", @@ -767,7 +880,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[*int64]{ Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). When combined with timeoutMS, timeoutMS must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", + Usage: "Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", QueryPath: "waitForMs", }, &requestflag.Flag[string]{ @@ -802,6 +915,18 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ InnerField: "start", }, }, + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + InnerField: "behavior", + }, + }, }) var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ @@ -847,14 +972,14 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, &requestflag.Flag[*int64]{ Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). When combined with timeoutMS, timeoutMS must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", + Usage: "Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", QueryPath: "waitForMs", }, }, @@ -883,6 +1008,18 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ InnerField: "resolution", }, }, + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + InnerField: "behavior", + }, + }, }) var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ @@ -974,10 +1111,10 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, &requestflag.Flag[bool]{ Name: "use-main-content-only", @@ -987,7 +1124,7 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[*int64]{ Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). When combined with timeoutMS, timeoutMS must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", + Usage: "Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", QueryPath: "waitForMs", }, &requestflag.Flag[string]{ @@ -1022,9 +1159,21 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ InnerField: "start", }, }, + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + InnerField: "behavior", + }, + }, }) -var webWebScrapeSitemap = cli.Command{ +var webWebScrapeSitemap = requestflag.WithInnerFlags(cli.Command{ Name: "web-scrape-sitemap", Usage: "Crawl an entire website's sitemap and return all discovered page URLs. Set\n`includeSubdomains=true` to also discover public pages and sitemaps on child\nhosts such as `docs.example.com` or `brand.example.com`. Pass `search` to have\nthe discovered URLs filtered down to the pages about a phrase (for example\n`pricing and plans` or `api authentication docs`), most relevant first — a\nsearched crawl scans the whole sitemap and costs 2 credits instead of 1.", Suggest: true, @@ -1067,10 +1216,10 @@ var webWebScrapeSitemap = cli.Command{ Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", QueryPath: "tags", }, - &requestflag.Flag[int64]{ - Name: "timeout-ms", - Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).", - QueryPath: "timeoutMS", + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "url-regex", @@ -1086,7 +1235,20 @@ var webWebScrapeSitemap = cli.Command{ }, Action: handleWebWebScrapeSitemap, HideHelpCommand: true, -} +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + InnerField: "behavior", + }, + }, +}) func handleWebAnswers(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 6139445..3dd84cd 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -21,7 +21,26 @@ func TestWebAnswers(t *testing.T) { "--mode", "fast", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(webAnswers) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "answers", + "--task", "Find the pricing page URL and plan names for context.dev.", + "--json-format", "{pricing_page_url: bar, plans: bar}", + "--mode", "fast", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) @@ -36,7 +55,9 @@ func TestWebAnswers(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n") + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", @@ -67,7 +88,7 @@ func TestWebExtract(t *testing.T) { "--stop-after-ms", "10000", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", "--wait-for-ms", "0", ) }) @@ -98,7 +119,8 @@ func TestWebExtract(t *testing.T) { "--stop-after-ms", "10000", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", "--wait-for-ms", "0", ) }) @@ -131,7 +153,9 @@ func TestWebExtract(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n" + + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n" + "waitForMs: 0\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, @@ -152,7 +176,25 @@ func TestWebExtractCompetitors(t *testing.T) { "--num-competitors", "1", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(webExtractCompetitors) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "extract-competitors", + "--domain", "xxx", + "--num-competitors", "1", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) } @@ -169,7 +211,26 @@ func TestWebExtractFonts(t *testing.T) { "--max-age-ms", "0", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(webExtractFonts) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "extract-fonts", + "--direct-url", "https://example.com", + "--domain", "xxx", + "--max-age-ms", "0", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", ) }) } @@ -187,7 +248,27 @@ func TestWebExtractStyleguide(t *testing.T) { "--max-age-ms", "0", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(webExtractStyleguide) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "extract-styleguide", + "--color-scheme", "light", + "--direct-url", "https://example.com", + "--domain", "xxx", + "--max-age-ms", "0", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", ) }) } @@ -211,7 +292,7 @@ func TestWebScreenshot(t *testing.T) { "--scroll-offset", "0", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", "--viewport", "{height: 240, width: 240}", "--wait-for-ms", "0", "--zdr", "enabled", @@ -239,7 +320,8 @@ func TestWebScreenshot(t *testing.T) { "--scroll-offset", "0", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", "--viewport.height", "240", "--viewport.width", "240", "--wait-for-ms", "0", @@ -260,12 +342,12 @@ func TestWebSearch(t *testing.T) { "--exclude-domain", "string", "--freshness", "last_24_hours", "--include-domain", "string", - "--markdown-options", "{enabled: true, includeFrames: true, includeImages: true, includeLinks: true, maxAgeMs: 0, pdf: {end: 1, shouldParse: true, start: 1}, shortenBase64Images: true, timeoutMS: 1000, useMainContentOnly: true, waitForMs: 0}", + "--markdown-options", "{enabled: true, includeFrames: true, includeImages: true, includeLinks: true, maxAgeMs: 0, pdf: {end: 1, shouldParse: true, start: 1}, shortenBase64Images: true, timeoutOpts: {milliseconds: 1, behavior: fail}, useMainContentOnly: true, waitForMs: 0}", "--num-results", "10", "--query-fanout=true", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", ) }) @@ -290,14 +372,15 @@ func TestWebSearch(t *testing.T) { "--markdown-options.max-age-ms", "0", "--markdown-options.pdf", "{end: 1, shouldParse: true, start: 1}", "--markdown-options.shorten-base64-images=true", - "--markdown-options.timeout-ms", "1000", + "--markdown-options.timeout-opts", "{milliseconds: 1, behavior: fail}", "--markdown-options.use-main-content-only=true", "--markdown-options.wait-for-ms", "0", "--num-results", "10", "--query-fanout=true", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", ) }) @@ -322,7 +405,9 @@ func TestWebSearch(t *testing.T) { " shouldParse: true\n" + " start: 1\n" + " shortenBase64Images: true\n" + - " timeoutMS: 1000\n" + + " timeoutOpts:\n" + + " milliseconds: 1\n" + + " behavior: fail\n" + " useMainContentOnly: true\n" + " waitForMs: 0\n" + "numResults: 10\n" + @@ -330,7 +415,9 @@ func TestWebSearch(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n") + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", @@ -363,7 +450,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--stop-after-ms", "10000", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts", "{milliseconds: 1000, behavior: fail}", "--url-regex", "^https?://[^/]+/blog/", "--use-main-content-only=true", "--wait-for-ms", "0", @@ -400,7 +487,8 @@ func TestWebWebCrawlMd(t *testing.T) { "--stop-after-ms", "10000", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1000", + "--timeout-opts.milliseconds", "1000", + "--timeout-opts.behavior", "fail", "--url-regex", "^https?://[^/]+/blog/", "--use-main-content-only=true", "--wait-for-ms", "0", @@ -435,7 +523,9 @@ func TestWebWebCrawlMd(t *testing.T) { "tags:\n" + " - production\n" + " - team-alpha\n" + - "timeoutMS: 1000\n" + + "timeoutOpts:\n" + + " milliseconds: 1000\n" + + " behavior: fail\n" + "urlRegex: ^https?://[^/]+/blog/\n" + "useMainContentOnly: true\n" + "waitForMs: 0\n" + @@ -460,7 +550,27 @@ func TestWebWebScrapeBytes(t *testing.T) { "--headers", "{foo: J!}", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", + "--zdr", "enabled", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(webWebScrapeBytes) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "web-scrape-bytes", + "--url", "https://example.com", + "--country", "de", + "--headers", "{foo: J!}", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", "--zdr", "enabled", ) }) @@ -485,7 +595,7 @@ func TestWebWebScrapeHTML(t *testing.T) { "--settle-animations=true", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", "--use-main-content-only=true", "--wait-for-ms", "0", "--zdr", "enabled", @@ -516,7 +626,8 @@ func TestWebWebScrapeHTML(t *testing.T) { "--settle-animations=true", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", "--use-main-content-only=true", "--wait-for-ms", "0", "--zdr", "enabled", @@ -539,7 +650,7 @@ func TestWebWebScrapeImages(t *testing.T) { "--max-age-ms", "0", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", "--wait-for-ms", "0", ) }) @@ -564,7 +675,8 @@ func TestWebWebScrapeImages(t *testing.T) { "--max-age-ms", "0", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", "--wait-for-ms", "0", ) }) @@ -593,7 +705,7 @@ func TestWebWebScrapeMd(t *testing.T) { "--shorten-base64-images=true", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", "--use-main-content-only=true", "--wait-for-ms", "0", "--zdr", "enabled", @@ -628,7 +740,8 @@ func TestWebWebScrapeMd(t *testing.T) { "--shorten-base64-images=true", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", "--use-main-content-only=true", "--wait-for-ms", "0", "--zdr", "enabled", @@ -651,7 +764,31 @@ func TestWebWebScrapeSitemap(t *testing.T) { "--sitemap-url", "https://example.com", "--tag", "production", "--tag", "team-alpha", - "--timeout-ms", "1", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", + "--url-regex", "^https?://[^/]+/blog/", + "--zdr", "enabled", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(webWebScrapeSitemap) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "web-scrape-sitemap", + "--domain", "xxx", + "--headers", "{foo: J!}", + "--include-subdomains=true", + "--max-links", "1", + "--search", "help center and troubleshooting articles", + "--sitemap-url", "https://example.com", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", "--url-regex", "^https?://[^/]+/blog/", "--zdr", "enabled", ) From 1fc274a8c9bbe1711442c49f0cef7d393318c270 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 15 Sep 2026 10:30:12 +0000 Subject: [PATCH 017/119] fix(api): guarantee search descriptions and align response types (#1089) Stainless-Generated-From: 450cb009fe0c9ba5cfb5a4321e798a2904655df0 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4b1f7bd..c2d8814 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.16.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.17.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 260bac2..cf9c989 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.16.0 h1:l+V+yndagsUKUx0cp4Q5aOt2a21tweSlH5JFhaqLnVA= -github.com/context-dot-dev/context-go-sdk/v2 v2.16.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.17.0 h1:5T1AfvH4nhna/pIbdfCCN9aEZEdgpcSo0YtTyZpZXds= +github.com/context-dot-dev/context-go-sdk/v2 v2.17.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 161df3c559112ccd18b47bb55c2600739f4991ad Mon Sep 17 00:00:00 2001 From: contextualbeer Date: Tue, 15 Sep 2026 12:35:01 +0200 Subject: [PATCH 018/119] release: 1.10.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 24 ++++++++++++++++++++++++ pkg/cmd/version.go | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c3c9552..eb4e0db 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.9.0" + ".": "1.10.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e8d11..1f113a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## [1.10.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.9.0...v1.10.0) (2026-09-15) + + +### Features + +* **answers:** add live web research with fast and ultra modes ([#954](https://github.com/context-dot-dev/context-dev-cli/issues/954)) ([8f226f8](https://github.com/context-dot-dev/context-dev-cli/commit/8f226f8287e196fcd383f1bef037d804a493c222)) +* **api-keys:** enforce scoped API key permissions ([#1038](https://github.com/context-dot-dev/context-dev-cli/issues/1038)) ([f2427ba](https://github.com/context-dot-dev/context-dev-cli/commit/f2427ba6e9d7538546b0dee7b90a037c082b6d03)) +* **api:** unify timeout configuration and return partial results ([#1030](https://github.com/context-dot-dev/context-dev-cli/issues/1030)) ([467f13a](https://github.com/context-dot-dev/context-dev-cli/commit/467f13ab47753ff0889e46d3315604841dab78d4)) +* **logs:** expose request log endpoints in SDKs ([#1025](https://github.com/context-dot-dev/context-dev-cli/issues/1025)) ([08ee0eb](https://github.com/context-dot-dev/context-dev-cli/commit/08ee0ebeb58a3fa865c4df7c5ba2364d2745b9ee)) +* **monitors:** add page selector filters ([#1037](https://github.com/context-dot-dev/context-dev-cli/issues/1037)) ([39ca377](https://github.com/context-dot-dev/context-dev-cli/commit/39ca377527e965766a22a5dcf583101cbffd1692)) +* **sitemap:** add subdomain discovery ([126d27d](https://github.com/context-dot-dev/context-dev-cli/commit/126d27d4684b5f3e75de83dfe32de7c34f9c5a81)) +* **web:** add raw bytes scraping endpoint ([#1081](https://github.com/context-dot-dev/context-dev-cli/issues/1081)) ([5d45957](https://github.com/context-dot-dev/context-dev-cli/commit/5d4595725c6a850bc9df5e265ddcd2b6eb8321eb)) +* **webhooks:** add configurable retries and manual replay ([d366bd3](https://github.com/context-dot-dev/context-dev-cli/commit/d366bd323f7875132dfe35ceb8fdfe3d92e9edaf)) +* **webhooks:** simplify delivery APIs ([7fd54b9](https://github.com/context-dot-dev/context-dev-cli/commit/7fd54b92fa451965a26df73df1ac6b4cc0d8d458)) + + +### Bug Fixes + +* **api:** guarantee search descriptions and align response types ([#1089](https://github.com/context-dot-dev/context-dev-cli/issues/1089)) ([1fc274a](https://github.com/context-dot-dev/context-dev-cli/commit/1fc274a8c9bbe1711442c49f0cef7d393318c270)) +* **api:** honour maxAgeMs=0 on brand retrieve, styleguide and fonts endpoints ([#998](https://github.com/context-dot-dev/context-dev-cli/issues/998)) ([97370fd](https://github.com/context-dot-dev/context-dev-cli/commit/97370fd41d8d503270a786dc474ffe2a84c94214)) +* **api:** reject timeoutMS too short for waitForMs ([7e03bf3](https://github.com/context-dot-dev/context-dev-cli/commit/7e03bf3075934de07ee9364819531f14756816e5)) +* **openapi:** strip empty-object defaults from the generated spec ([9cb38d9](https://github.com/context-dot-dev/context-dev-cli/commit/9cb38d9e7702224885e18d5060b151d9e9d2ae8e)) +* **webhooks:** format Slack webhook notifications ([#1045](https://github.com/context-dot-dev/context-dev-cli/issues/1045)) ([d7173ff](https://github.com/context-dot-dev/context-dev-cli/commit/d7173ff5eff964c53db99e59a4da62df112bdaba)) + ## [1.9.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.8.0...v1.9.0) (2026-08-27) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index a82500c..becade7 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.9.0" // x-release-please-version +const Version = "1.10.0" // x-release-please-version From 112da341e5dd3d484b59b90de0f399d4441fab20 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 15 Sep 2026 12:27:00 +0000 Subject: [PATCH 019/119] Build SDK Stainless-Generated-From: 5c095c4d237eaa09cd5a65f6e9981dfbec81085c --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c2d8814..9259d3f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.17.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.17.1 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index cf9c989..76eb7bd 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.17.0 h1:5T1AfvH4nhna/pIbdfCCN9aEZEdgpcSo0YtTyZpZXds= -github.com/context-dot-dev/context-go-sdk/v2 v2.17.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.17.1 h1:VCCGH0Z9ICtJcZGxOGMQzNFNu9RgYSQFwox//5xHyVo= +github.com/context-dot-dev/context-go-sdk/v2 v2.17.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 29338a15ff1b82c1c1908af5db66c6011461814d Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 16 Sep 2026 17:39:03 +0000 Subject: [PATCH 020/119] fix(api): lower partial scrape timeout minimum to five seconds (#1118) Stainless-Generated-From: 4e6296a0593f46382669238126328ea7d599a197 --- pkg/cmd/web.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 063bd4f..bd3a602 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -280,7 +280,7 @@ var webExtractFonts = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, InnerField: "behavior", }, }, @@ -334,7 +334,7 @@ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, InnerField: "behavior", }, }, @@ -438,7 +438,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, InnerField: "behavior", }, }, @@ -923,7 +923,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, InnerField: "behavior", }, }, @@ -1016,7 +1016,7 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, InnerField: "behavior", }, }, @@ -1167,7 +1167,7 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 15000.`, + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, InnerField: "behavior", }, }, From 7312544df2c45bcc1a83b53385349c5c0f587280 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 18 Sep 2026 05:16:22 +0000 Subject: [PATCH 021/119] feat(scrape): add CSS extraction rules to HTML scraping (#1146) Stainless-Generated-From: c9a2aa88567a8fb4c0050459dd1822c5f7047bab --- pkg/cmd/web.go | 7 ++++++- pkg/cmd/web_test.go | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index bd3a602..bd013be 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -804,7 +804,7 @@ var webWebScrapeBytes = requestflag.WithInnerFlags(cli.Command{ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ Name: "web-scrape-html", - Usage: "Scrapes the given URL and returns the raw HTML content of the page. The base\nrequest costs 1 credit; requests with browser actions cost 2 credits. A request\nthat hits its timeoutOpts.milliseconds deadline fails with 408 and is not\nbilled, unless timeoutOpts.behavior=return-partial is set — then the page as\nrendered so far is returned with `finalDOMState: \"still-loading\"` and billed at\nthe base cost of 1 credit.", + Usage: "Scrapes the given URL and returns the HTML content of the page. Optional\nextractRules return deterministic structured data in extracted using CSS\nselectors, attributes, lists, and nested rules, without an LLM or additional\ncredits. Rules run on the returned HTML after selector and main-content\nfiltering. Send extractRules as a JSON-encoded query parameter. The base request\ncosts 1 credit; requests with browser actions cost 2 credits. A request that\nhits its timeoutOpts.milliseconds deadline fails with 408 and is not billed,\nunless timeoutOpts.behavior=return-partial is set — then the page as rendered so\nfar is returned with `finalDOMState: \"still-loading\"` and billed at the base\ncost of 1 credit.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -828,6 +828,11 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ Usage: `CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".`, QueryPath: "excludeSelectors", }, + &requestflag.Flag[map[string]any]{ + Name: "extract-rules", + Usage: `Optional CSS extraction rules applied to the returned HTML after selector and main-content filtering. Use selector strings ("h1", "a@href") or objects with selector, type (item or list), and output (text, html, @attribute, or nested rules). Text whitespace is normalized; html includes the matched element; attributes are returned as written. Missing items are null and missing lists are empty. CSS only; XPath is not supported. Maximum: 100 fields across 5 levels. Send a JSON-encoded string in the extractRules query parameter.`, + QueryPath: "extractRules", + }, &requestflag.Flag[map[string]any]{ Name: "headers", Usage: "Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 3dd84cd..7d143dc 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -587,6 +587,7 @@ func TestWebWebScrapeHTML(t *testing.T) { "--action", "[{do: wait, timeMs: 0}]", "--country", "de", "--exclude-selector", "[x]", + "--extract-rules", "{foo: x}", "--headers", "{foo: J!}", "--include-frames=true", "--include-selector", "[x]", @@ -615,6 +616,7 @@ func TestWebWebScrapeHTML(t *testing.T) { "--action", "[{do: wait, timeMs: 0}]", "--country", "de", "--exclude-selector", "[x]", + "--extract-rules", "{foo: x}", "--headers", "{foo: J!}", "--include-frames=true", "--include-selector", "[x]", From cd708cab6ed78bd33d9d6237f09cbc38e45347d4 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 18 Sep 2026 05:27:49 +0000 Subject: [PATCH 022/119] feat(api): enable ZDR on remaining AI endpoints via OpenAI (#1099) Stainless-Generated-From: 03f378782a8fc17b633ef91c00aa314c9184e016 --- pkg/cmd/ai.go | 6 +++++ pkg/cmd/ai_test.go | 5 ++++- pkg/cmd/industry.go | 12 ++++++++++ pkg/cmd/industry_test.go | 4 ++++ pkg/cmd/parse.go | 2 +- pkg/cmd/person.go | 5 +++++ pkg/cmd/person_test.go | 5 ++++- pkg/cmd/web.go | 47 +++++++++++++++++++++++++++++++++++----- pkg/cmd/web_test.go | 21 +++++++++++++++--- 9 files changed, 95 insertions(+), 12 deletions(-) diff --git a/pkg/cmd/ai.go b/pkg/cmd/ai.go index 763ec4f..0b95902 100644 --- a/pkg/cmd/ai.go +++ b/pkg/cmd/ai.go @@ -41,6 +41,12 @@ var aiExtractProduct = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", BodyPath: "timeoutOpts", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + BodyPath: "zdr", + }, }, Action: handleAIExtractProduct, HideHelpCommand: true, diff --git a/pkg/cmd/ai_test.go b/pkg/cmd/ai_test.go index 60e3f90..9c898f0 100644 --- a/pkg/cmd/ai_test.go +++ b/pkg/cmd/ai_test.go @@ -21,6 +21,7 @@ func TestAIExtractProduct(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + "--zdr", "enabled", ) }) @@ -39,6 +40,7 @@ func TestAIExtractProduct(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", + "--zdr", "enabled", ) }) @@ -52,7 +54,8 @@ func TestAIExtractProduct(t *testing.T) { " - team-alpha\n" + "timeoutOpts:\n" + " milliseconds: 1000\n" + - " behavior: fail\n") + " behavior: fail\n" + + "zdr: enabled\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/industry.go b/pkg/cmd/industry.go index 22cbae6..daec276 100644 --- a/pkg/cmd/industry.go +++ b/pkg/cmd/industry.go @@ -47,6 +47,12 @@ var industryRetrieveNaics = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", QueryPath: "timeoutOpts", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + QueryPath: "zdr", + }, }, Action: handleIndustryRetrieveNaics, HideHelpCommand: true, @@ -104,6 +110,12 @@ var industryRetrieveSic = requestflag.WithInnerFlags(cli.Command{ Default: "original_sic", QueryPath: "type", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + QueryPath: "zdr", + }, }, Action: handleIndustryRetrieveSic, HideHelpCommand: true, diff --git a/pkg/cmd/industry_test.go b/pkg/cmd/industry_test.go index ac4e273..7400553 100644 --- a/pkg/cmd/industry_test.go +++ b/pkg/cmd/industry_test.go @@ -22,6 +22,7 @@ func TestIndustryRetrieveNaics(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + "--zdr", "enabled", ) }) @@ -41,6 +42,7 @@ func TestIndustryRetrieveNaics(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", + "--zdr", "enabled", ) }) } @@ -59,6 +61,7 @@ func TestIndustryRetrieveSic(t *testing.T) { "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", "--type", "original_sic", + "--zdr", "enabled", ) }) @@ -79,6 +82,7 @@ func TestIndustryRetrieveSic(t *testing.T) { "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", "--type", "original_sic", + "--zdr", "enabled", ) }) } diff --git a/pkg/cmd/parse.go b/pkg/cmd/parse.go index 1458917..0e41787 100644 --- a/pkg/cmd/parse.go +++ b/pkg/cmd/parse.go @@ -79,7 +79,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", Default: "disabled", QueryPath: "zdr", }, diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index 9803cd4..b5c840b 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -53,6 +53,11 @@ var peopleEnrich = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", BodyPath: "timeoutOpts", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + BodyPath: "zdr", + }, }, Action: handlePeopleEnrich, HideHelpCommand: true, diff --git a/pkg/cmd/person_test.go b/pkg/cmd/person_test.go index 6394f4d..2279b11 100644 --- a/pkg/cmd/person_test.go +++ b/pkg/cmd/person_test.go @@ -25,6 +25,7 @@ func TestPeopleEnrich(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + "--zdr", "enabled", ) }) @@ -54,6 +55,7 @@ func TestPeopleEnrich(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", + "--zdr", "enabled", ) }) @@ -85,7 +87,8 @@ func TestPeopleEnrich(t *testing.T) { " - team-alpha\n" + "timeoutOpts:\n" + " milliseconds: 1000\n" + - " behavior: fail\n") + " behavior: fail\n" + + "zdr: enabled\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index bd013be..8c42112 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -45,6 +45,11 @@ var webAnswers = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", BodyPath: "timeoutOpts", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + BodyPath: "zdr", + }, }, Action: handleWebAnswers, HideHelpCommand: true, @@ -157,6 +162,12 @@ var webExtract = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional browser wait time in milliseconds after initial page load for each crawled page.", BodyPath: "waitForMs", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + BodyPath: "zdr", + }, }, Action: handleWebExtract, HideHelpCommand: true, @@ -219,6 +230,12 @@ var webExtractCompetitors = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", QueryPath: "timeoutOpts", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + QueryPath: "zdr", + }, }, Action: handleWebExtractCompetitors, HideHelpCommand: true, @@ -322,6 +339,12 @@ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", QueryPath: "timeoutOpts", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + QueryPath: "zdr", + }, }, Action: handleWebExtractStyleguide, HideHelpCommand: true, @@ -422,7 +445,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", Default: "disabled", QueryPath: "zdr", }, @@ -513,6 +536,12 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", BodyPath: "timeoutOpts", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + BodyPath: "zdr", + }, }, Action: handleWebSearch, HideHelpCommand: true, @@ -780,7 +809,7 @@ var webWebScrapeBytes = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", Default: "disabled", QueryPath: "zdr", }, @@ -890,7 +919,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", Default: "disabled", QueryPath: "zdr", }, @@ -987,6 +1016,12 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", QueryPath: "waitForMs", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + QueryPath: "zdr", + }, }, Action: handleWebWebScrapeImages, HideHelpCommand: true, @@ -999,7 +1034,7 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[bool]{ Name: "enrichment.hosted-url", - Usage: "Host materializable images on the Brand.dev CDN and return their URL and MIME type.", + Usage: "Host materializable images on the Brand.dev CDN and return their URL and MIME type. Ignored when zero data retention is enabled.", InnerField: "hostedUrl", }, &requestflag.InnerFlag[int64]{ @@ -1134,7 +1169,7 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", Default: "disabled", QueryPath: "zdr", }, @@ -1233,7 +1268,7 @@ var webWebScrapeSitemap = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", Default: "disabled", QueryPath: "zdr", }, diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 7d143dc..3913afa 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -22,6 +22,7 @@ func TestWebAnswers(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + "--zdr", "enabled", ) }) @@ -41,6 +42,7 @@ func TestWebAnswers(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", + "--zdr", "enabled", ) }) @@ -57,7 +59,8 @@ func TestWebAnswers(t *testing.T) { " - team-alpha\n" + "timeoutOpts:\n" + " milliseconds: 1000\n" + - " behavior: fail\n") + " behavior: fail\n" + + "zdr: enabled\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", @@ -90,6 +93,7 @@ func TestWebExtract(t *testing.T) { "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", "--wait-for-ms", "0", + "--zdr", "enabled", ) }) @@ -122,6 +126,7 @@ func TestWebExtract(t *testing.T) { "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", "--wait-for-ms", "0", + "--zdr", "enabled", ) }) @@ -156,7 +161,8 @@ func TestWebExtract(t *testing.T) { "timeoutOpts:\n" + " milliseconds: 1000\n" + " behavior: fail\n" + - "waitForMs: 0\n") + "waitForMs: 0\n" + + "zdr: enabled\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", @@ -177,6 +183,7 @@ func TestWebExtractCompetitors(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + "--zdr", "enabled", ) }) @@ -195,6 +202,7 @@ func TestWebExtractCompetitors(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", + "--zdr", "enabled", ) }) } @@ -249,6 +257,7 @@ func TestWebExtractStyleguide(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1, behavior: fail}", + "--zdr", "enabled", ) }) @@ -269,6 +278,7 @@ func TestWebExtractStyleguide(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1", "--timeout-opts.behavior", "fail", + "--zdr", "enabled", ) }) } @@ -348,6 +358,7 @@ func TestWebSearch(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + "--zdr", "enabled", ) }) @@ -381,6 +392,7 @@ func TestWebSearch(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", + "--zdr", "enabled", ) }) @@ -417,7 +429,8 @@ func TestWebSearch(t *testing.T) { " - team-alpha\n" + "timeoutOpts:\n" + " milliseconds: 1000\n" + - " behavior: fail\n") + " behavior: fail\n" + + "zdr: enabled\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", @@ -654,6 +667,7 @@ func TestWebWebScrapeImages(t *testing.T) { "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1, behavior: fail}", "--wait-for-ms", "0", + "--zdr", "enabled", ) }) @@ -680,6 +694,7 @@ func TestWebWebScrapeImages(t *testing.T) { "--timeout-opts.milliseconds", "1", "--timeout-opts.behavior", "fail", "--wait-for-ms", "0", + "--zdr", "enabled", ) }) } From 730903032b70d9bbd6026d005946170cd79ef560 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 18 Sep 2026 06:39:34 +0000 Subject: [PATCH 023/119] feat(web): add URL-based scrape screenshot endpoint (#1150) Stainless-Generated-From: cddaf198e50970afef181308f89cc32da4fb48b2 --- .stats.yml | 2 +- pkg/cmd/cmd.go | 1 + pkg/cmd/web.go | 147 ++++++++++++++++++++++++++++++++++++++++++++ pkg/cmd/web_test.go | 53 ++++++++++++++++ 4 files changed, 202 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 85f79b6..4e6a016 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 49 +configured_endpoints: 50 diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index fc6a67b..aad5f54 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -109,6 +109,7 @@ func init() { &webWebScrapeHTML, &webWebScrapeImages, &webWebScrapeMd, + &webWebScrapeScreenshot, &webWebScrapeSitemap, }, }, diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 8c42112..75dbf98 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -1213,6 +1213,112 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ }, }) +var webWebScrapeScreenshot = requestflag.WithInnerFlags(cli.Command{ + Name: "web-scrape-screenshot", + Usage: "Capture the given HTTP or HTTPS URL with configurable viewport, full-page\ncapture, wait time, popup handling, theme, scroll offset, cache age, country,\nand request timeout. Defaults to a 1920x1080 viewport, a 3-second wait, and a\ncache age of 1 day. With timeoutOpts.behavior=return-partial, a screenshot of\nthe page rendered so far may be returned; inspect finalDOMState to identify an\nincomplete render. Successful requests cost 1 credit; errors are not billed.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "url", + Required: true, + QueryPath: "url", + }, + &requestflag.Flag[bool]{ + Name: "clear-popups", + Usage: "Optional parameter for comprehensive popup cleanup. If 'true', the browser dismisses detected cookie/consent UI and clears other detected obstructive popups and overlays before capture. If 'false' or not provided, this parameter requests no cleanup; handleCookiePopup can still request cookie/consent handling independently.", + Default: false, + QueryPath: "clearPopups", + }, + &requestflag.Flag[string]{ + Name: "color-scheme", + Usage: "Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances.", + QueryPath: "colorScheme", + }, + &requestflag.Flag[string]{ + Name: "country", + Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", + QueryPath: "country", + }, + &requestflag.Flag[string]{ + Name: "full-screenshot", + Usage: "Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view).", + QueryPath: "fullScreenshot", + }, + &requestflag.Flag[bool]{ + Name: "handle-cookie-popup", + Usage: "Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step.", + Default: false, + QueryPath: "handleCookiePopup", + }, + &requestflag.Flag[*int64]{ + Name: "max-age-ms", + Usage: "Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.", + Default: requestflag.Ptr[int64](86400000), + QueryPath: "maxAgeMs", + }, + &requestflag.Flag[*int64]{ + Name: "scroll-offset", + Usage: "Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000.", + QueryPath: "scrollOffset", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + QueryPath: "tags", + }, + &requestflag.Flag[map[string]any]{ + Name: "timeout-opts", + Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + QueryPath: "timeoutOpts", + }, + &requestflag.Flag[map[string]any]{ + Name: "viewport", + Usage: "Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.", + Default: map[string]any{"width": 1920, "height": 1080}, + QueryPath: "viewport", + }, + &requestflag.Flag[*int64]{ + Name: "wait-for-ms", + Usage: "Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", + Default: requestflag.Ptr[int64](3000), + QueryPath: "waitForMs", + }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Default: "disabled", + QueryPath: "zdr", + }, + }, + Action: handleWebWebScrapeScreenshot, + HideHelpCommand: true, +}, map[string][]requestflag.HasOuterFlag{ + "timeout-opts": { + &requestflag.InnerFlag[int64]{ + Name: "timeout-opts.milliseconds", + Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + InnerField: "milliseconds", + }, + &requestflag.InnerFlag[string]{ + Name: "timeout-opts.behavior", + Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, + InnerField: "behavior", + }, + }, + "viewport": { + &requestflag.InnerFlag[int64]{ + Name: "viewport.height", + Usage: "Viewport height in pixels.", + InnerField: "height", + }, + &requestflag.InnerFlag[int64]{ + Name: "viewport.width", + Usage: "Viewport width in pixels.", + InnerField: "width", + }, + }, +}) + var webWebScrapeSitemap = requestflag.WithInnerFlags(cli.Command{ Name: "web-scrape-sitemap", Usage: "Crawl an entire website's sitemap and return all discovered page URLs. Set\n`includeSubdomains=true` to also discover public pages and sitemaps on child\nhosts such as `docs.example.com` or `brand.example.com`. Pass `search` to have\nthe discovered URLs filtered down to the pages about a phrase (for example\n`pricing and plans` or `api authentication docs`), most relevant first — a\nsearched crawl scans the whole sitemap and costs 2 credits instead of 1.", @@ -1782,6 +1888,47 @@ func handleWebWebScrapeMd(ctx context.Context, cmd *cli.Command) error { }) } +func handleWebWebScrapeScreenshot(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + params := contextdev.WebWebScrapeScreenshotParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Web.WebScrapeScreenshot(ctx, params, options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "web web-scrape-screenshot", + Transform: transform, + }) +} + func handleWebWebScrapeSitemap(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) unusedArgs := cmd.Args().Slice() diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 3913afa..544b996 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -766,6 +766,59 @@ func TestWebWebScrapeMd(t *testing.T) { }) } +func TestWebWebScrapeScreenshot(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "web-scrape-screenshot", + "--url", "https://example.com", + "--clear-popups=true", + "--color-scheme", "light", + "--country", "de", + "--full-screenshot", "true", + "--handle-cookie-popup=true", + "--max-age-ms", "0", + "--scroll-offset", "0", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts", "{milliseconds: 1, behavior: fail}", + "--viewport", "{height: 240, width: 240}", + "--wait-for-ms", "0", + "--zdr", "enabled", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(webWebScrapeScreenshot) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "web", "web-scrape-screenshot", + "--url", "https://example.com", + "--clear-popups=true", + "--color-scheme", "light", + "--country", "de", + "--full-screenshot", "true", + "--handle-cookie-popup=true", + "--max-age-ms", "0", + "--scroll-offset", "0", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-opts.milliseconds", "1", + "--timeout-opts.behavior", "fail", + "--viewport.height", "240", + "--viewport.width", "240", + "--wait-for-ms", "0", + "--zdr", "enabled", + ) + }) +} + func TestWebWebScrapeSitemap(t *testing.T) { t.Skip("Mock server tests are disabled") t.Run("regular flags", func(t *testing.T) { From da081b109221008938d7e9665584fcbbedc3a49c Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 18 Sep 2026 07:58:57 +0000 Subject: [PATCH 024/119] feat(billing): charge for 404s and skip fraud accounting (#1152) Stainless-Generated-From: b583d04f50427cd3dff3875934af9ad7684f11d2 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9259d3f..1ff0b9f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.17.1 + github.com/context-dot-dev/context-go-sdk/v2 v2.18.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 76eb7bd..0eaf1b6 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.17.1 h1:VCCGH0Z9ICtJcZGxOGMQzNFNu9RgYSQFwox//5xHyVo= -github.com/context-dot-dev/context-go-sdk/v2 v2.17.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.18.0 h1:Tnej3PXGPQq5HCepw5uiyG9mYa2lEoydUnyoWTzIRj0= +github.com/context-dot-dev/context-go-sdk/v2 v2.18.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 0d84fa4da25faa2ba9687880140bf82e6868199b Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 21 Sep 2026 03:21:19 +0000 Subject: [PATCH 025/119] feat(scrape): support waitForMs for byte downloads (#1170) Stainless-Generated-From: c8cbb7d292e6d740878c36ffb43edd5d598ca677 --- pkg/cmd/web.go | 7 ++++++- pkg/cmd/web_test.go | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 75dbf98..0284024 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -778,7 +778,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ var webWebScrapeBytes = requestflag.WithInnerFlags(cli.Command{ Name: "web-scrape-bytes", - Usage: "Downloads a resource and returns its bytes as base64. Supports images, PDFs,\nHTML pages, and any other content type without image conversion, text\nextraction, or character-encoding changes. HTTP compression is decoded before\nbase64 encoding. HTML is the original HTTP response; JavaScript is not rendered.\nFollows public redirects and retries failed downloads through ISP and\nresidential proxies, with a direct fallback. When country is specified, only a\nresidential proxy in that country is used. Supply headers such as Referer for\nimages that require a referring page. Downloads are not cached. Maximum decoded\nresource size: 20 MiB (20971520 bytes), before base64 encoding. Successful\nrequests cost 1 credit; errors are not billed.", + Usage: "Downloads a resource and returns its bytes as base64. Without waitForMs, returns\nthe original HTTP response without image conversion, text extraction, or\ncharacter-encoding changes. HTTP compression is decoded before base64 encoding.\nSupply waitForMs to render HTML with JavaScript in the browser and return the\nresulting HTML as UTF-8 bytes after the wait. Non-HTML resources, including\nimages and PDFs, keep their original bytes and do not incur a browser wait.\nFollows public redirects and retries failed downloads through ISP and\nresidential proxies, with a direct fallback. When country is specified, only a\nresidential proxy in that country is used. Supply headers such as Referer for\nimages that require a referring page. Downloads are not cached. Maximum decoded\nresource size: 20 MiB (20971520 bytes), before base64 encoding. Successful\nrequests cost 1 credit; errors are not billed.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -807,6 +807,11 @@ var webWebScrapeBytes = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", QueryPath: "timeoutOpts", }, + &requestflag.Flag[*int64]{ + Name: "wait-for-ms", + Usage: "Optional browser wait time after initial page load, in milliseconds (0–30000; 0 uses 500). When supplied, HTML is rendered with JavaScript and returned as UTF-8 bytes. Other resources keep their original bytes without a browser wait. Omit to download the original HTTP response. When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", + QueryPath: "waitForMs", + }, &requestflag.Flag[string]{ Name: "zdr", Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 544b996..01715fd 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -564,6 +564,7 @@ func TestWebWebScrapeBytes(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1, behavior: fail}", + "--wait-for-ms", "0", "--zdr", "enabled", ) }) @@ -584,6 +585,7 @@ func TestWebWebScrapeBytes(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1", "--timeout-opts.behavior", "fail", + "--wait-for-ms", "0", "--zdr", "enabled", ) }) From efaf86495456996b4b0e7f21eb1f7608da6ff1e6 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 21 Sep 2026 03:32:03 +0000 Subject: [PATCH 026/119] feat(scrape): support custom screenshot headers (#1169) Stainless-Generated-From: 6c64f9cd8d5247e7f42ee55c9127fd80e8b8bfe6 --- pkg/cmd/web.go | 10 ++++++++++ pkg/cmd/web_test.go | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 0284024..e99a178 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -405,6 +405,11 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ Default: false, QueryPath: "handleCookiePopup", }, + &requestflag.Flag[map[string]any]{ + Name: "headers", + Usage: "Optional outbound HTTP headers, using the same JSON object or deep-object query format as other scrape endpoints (for example headers[Authorization]=Bearer token). Headers are scoped to the target origin during capture. For domain/page requests, discovery receives no custom headers and only pages on the resolved origin are eligible. Non-empty headers bypass screenshot caching and return an in-memory data URL; no screenshot is uploaded. Empty objects behave like omitted headers.", + QueryPath: "headers", + }, &requestflag.Flag[*int64]{ Name: "max-age-ms", Usage: "Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.", @@ -1255,6 +1260,11 @@ var webWebScrapeScreenshot = requestflag.WithInnerFlags(cli.Command{ Default: false, QueryPath: "handleCookiePopup", }, + &requestflag.Flag[map[string]any]{ + Name: "headers", + Usage: "Optional outbound HTTP headers, using the same JSON object or deep-object query format as other scrape endpoints (for example headers[Authorization]=Bearer token). Headers are scoped to the target origin during capture. For domain/page requests, discovery receives no custom headers and only pages on the resolved origin are eligible. Non-empty headers bypass screenshot caching and return an in-memory data URL; no screenshot is uploaded. Empty objects behave like omitted headers.", + QueryPath: "headers", + }, &requestflag.Flag[*int64]{ Name: "max-age-ms", Usage: "Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 01715fd..4cc63d4 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -297,6 +297,7 @@ func TestWebScreenshot(t *testing.T) { "--domain", "xxx", "--full-screenshot", "true", "--handle-cookie-popup=true", + "--headers", "{foo: J!}", "--max-age-ms", "0", "--page", "login", "--scroll-offset", "0", @@ -325,6 +326,7 @@ func TestWebScreenshot(t *testing.T) { "--domain", "xxx", "--full-screenshot", "true", "--handle-cookie-popup=true", + "--headers", "{foo: J!}", "--max-age-ms", "0", "--page", "login", "--scroll-offset", "0", @@ -781,6 +783,7 @@ func TestWebWebScrapeScreenshot(t *testing.T) { "--country", "de", "--full-screenshot", "true", "--handle-cookie-popup=true", + "--headers", "{foo: J!}", "--max-age-ms", "0", "--scroll-offset", "0", "--tag", "production", @@ -807,6 +810,7 @@ func TestWebWebScrapeScreenshot(t *testing.T) { "--country", "de", "--full-screenshot", "true", "--handle-cookie-popup=true", + "--headers", "{foo: J!}", "--max-age-ms", "0", "--scroll-offset", "0", "--tag", "production", From 5f66062092a3fa099f0cd043915e726f315c0de5 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 21 Sep 2026 03:41:03 +0000 Subject: [PATCH 027/119] feat(scrape): add cache age support to byte downloads (#1171) feat(scrape): support country for image scraping (#1172) Stainless-Generated-From: 96d81bf9343cf24cae5bbd53710bfd102942a1b6 --- pkg/cmd/web.go | 15 +++++++++++++-- pkg/cmd/web_test.go | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index e99a178..6842bd4 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -783,7 +783,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ var webWebScrapeBytes = requestflag.WithInnerFlags(cli.Command{ Name: "web-scrape-bytes", - Usage: "Downloads a resource and returns its bytes as base64. Without waitForMs, returns\nthe original HTTP response without image conversion, text extraction, or\ncharacter-encoding changes. HTTP compression is decoded before base64 encoding.\nSupply waitForMs to render HTML with JavaScript in the browser and return the\nresulting HTML as UTF-8 bytes after the wait. Non-HTML resources, including\nimages and PDFs, keep their original bytes and do not incur a browser wait.\nFollows public redirects and retries failed downloads through ISP and\nresidential proxies, with a direct fallback. When country is specified, only a\nresidential proxy in that country is used. Supply headers such as Referer for\nimages that require a referring page. Downloads are not cached. Maximum decoded\nresource size: 20 MiB (20971520 bytes), before base64 encoding. Successful\nrequests cost 1 credit; errors are not billed.", + Usage: "Downloads a resource and returns its bytes as base64. Without waitForMs, returns\nthe original HTTP response without image conversion, text extraction, or\ncharacter-encoding changes. HTTP compression is decoded before base64 encoding.\nSupply waitForMs to render HTML with JavaScript in the browser and return the\nresulting HTML as UTF-8 bytes after the wait. Non-HTML resources, including\nimages and PDFs, keep their original bytes and do not incur a browser wait.\nFollows public redirects and retries failed downloads through ISP and\nresidential proxies, with a direct fallback. When country is specified, only a\nresidential proxy in that country is used. Supply headers such as Referer for\nimages that require a referring page. Cached results are reused according to\nmaxAgeMs (default: 1 day; maximum: 30 days). Set maxAgeMs=0 to fetch fresh and\nrefresh the cache. Cache identity includes the exact URL, country, waitForMs,\nand normalized outbound headers. Credential-bearing headers and zero data\nretention bypass cache reads and writes. cache_metadata reports hit, miss, or\nzdr and the cached result age in milliseconds. Maximum decoded resource size: 20\nMiB (20971520 bytes), before base64 encoding. Successful requests cost 1 credit;\nerrors are not billed.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -799,9 +799,15 @@ var webWebScrapeBytes = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[map[string]any]{ Name: "headers", - Usage: "Optional outbound HTTP headers, such as Referer, Cookie, or Authorization. Send as a JSON object or deep-object query params such as headers[Referer]=https://example.com/. Host, Content-Length, and hop-by-hop transport headers are rejected. Authorization and cookies are removed when a redirect changes origin.", + Usage: "Optional outbound HTTP headers, such as Referer, Cookie, or Authorization. Send as a JSON object or deep-object query params such as headers[Referer]=https://example.com/. Host, Content-Length, and hop-by-hop transport headers are rejected. Authorization and cookies are removed when a redirect changes origin. Credential-bearing headers bypass cache reads and writes; other headers are included in the cache key.", QueryPath: "headers", }, + &requestflag.Flag[*int64]{ + Name: "max-age-ms", + Usage: "Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.", + Default: requestflag.Ptr[int64](86400000), + QueryPath: "maxAgeMs", + }, &requestflag.Flag[[]string]{ Name: "tag", Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", @@ -989,6 +995,11 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions.", QueryPath: "actions", }, + &requestflag.Flag[string]{ + Name: "country", + Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", + QueryPath: "country", + }, &requestflag.Flag[bool]{ Name: "dedupe", Usage: "When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 4cc63d4..be8fc0c 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -563,6 +563,7 @@ func TestWebWebScrapeBytes(t *testing.T) { "--url", "https://example.com", "--country", "de", "--headers", "{foo: J!}", + "--max-age-ms", "0", "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1, behavior: fail}", @@ -583,6 +584,7 @@ func TestWebWebScrapeBytes(t *testing.T) { "--url", "https://example.com", "--country", "de", "--headers", "{foo: J!}", + "--max-age-ms", "0", "--tag", "production", "--tag", "team-alpha", "--timeout-opts.milliseconds", "1", @@ -663,6 +665,7 @@ func TestWebWebScrapeImages(t *testing.T) { "web", "web-scrape-images", "--url", "https://example.com", "--action", "[{do: wait, timeMs: 0}]", + "--country", "de", "--dedupe=true", "--enrichment", "{classification: true, hostedUrl: true, maxTimePerMs: 1, resolution: true}", "--headers", "{foo: J!}", @@ -686,6 +689,7 @@ func TestWebWebScrapeImages(t *testing.T) { "web", "web-scrape-images", "--url", "https://example.com", "--action", "[{do: wait, timeMs: 0}]", + "--country", "de", "--dedupe=true", "--enrichment.classification=true", "--enrichment.hosted-url=true", From b022ea7a62ec6e043d354c691ddaa16df07f1b2b Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 22 Sep 2026 06:27:23 +0000 Subject: [PATCH 028/119] feat(scrape): align timeout options and public SDK methods (#1207) Stainless-Generated-From: 109522694545d6e7d845b86910efb0b03d09c32c --- .stats.yml | 2 +- pkg/cmd/ai.go | 202 ------- pkg/cmd/ai_test.go | 120 ----- pkg/cmd/brand.go | 91 ---- pkg/cmd/brand_test.go | 36 -- pkg/cmd/cmd.go | 18 - pkg/cmd/web.go | 1175 +---------------------------------------- pkg/cmd/web_test.go | 460 ---------------- 8 files changed, 12 insertions(+), 2092 deletions(-) delete mode 100644 pkg/cmd/ai.go delete mode 100644 pkg/cmd/ai_test.go diff --git a/.stats.yml b/.stats.yml index 4e6a016..58d3483 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 50 +configured_endpoints: 39 diff --git a/pkg/cmd/ai.go b/pkg/cmd/ai.go deleted file mode 100644 index 0b95902..0000000 --- a/pkg/cmd/ai.go +++ /dev/null @@ -1,202 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package cmd - -import ( - "context" - "fmt" - - "github.com/context-dot-dev/context-dev-cli/internal/apiquery" - "github.com/context-dot-dev/context-dev-cli/internal/requestflag" - "github.com/context-dot-dev/context-go-sdk/v2" - "github.com/context-dot-dev/context-go-sdk/v2/option" - "github.com/tidwall/gjson" - "github.com/urfave/cli/v3" -) - -var aiExtractProduct = requestflag.WithInnerFlags(cli.Command{ - Name: "extract-product", - Usage: "Given a single URL, determines if it is a product page and extracts the product\ninformation.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "url", - Usage: "The product page URL to extract product data from.", - Required: true, - BodyPath: "url", - }, - &requestflag.Flag[int64]{ - Name: "max-age-ms", - Usage: "Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.", - Default: 604800000, - BodyPath: "maxAgeMs", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", - BodyPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - BodyPath: "timeoutOpts", - }, - &requestflag.Flag[string]{ - Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", - Default: "disabled", - BodyPath: "zdr", - }, - }, - Action: handleAIExtractProduct, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, - InnerField: "behavior", - }, - }, -}) - -var aiExtractProducts = requestflag.WithInnerFlags(cli.Command{ - Name: "extract-products", - Usage: "Extract product information from a brand's website. We will analyze the website\nand return a list of products with details such as name, description, image,\npricing, features, and more.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "domain", - Usage: "The domain name to analyze.", - BodyPath: "domain", - }, - &requestflag.Flag[int64]{ - Name: "max-age-ms", - Usage: "Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.", - Default: 604800000, - BodyPath: "maxAgeMs", - }, - &requestflag.Flag[int64]{ - Name: "max-products", - Usage: "Maximum number of products to extract.", - BodyPath: "maxProducts", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", - BodyPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - BodyPath: "timeoutOpts", - }, - &requestflag.Flag[string]{ - Name: "direct-url", - Usage: "A specific URL to use directly as the starting point for extraction without domain resolution.", - BodyPath: "directUrl", - }, - }, - Action: handleAIExtractProducts, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, - InnerField: "behavior", - }, - }, -}) - -func handleAIExtractProduct(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - ApplicationJSON, - false, - ) - if err != nil { - return err - } - - params := contextdev.AIExtractProductParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.AI.ExtractProduct(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "ai extract-product", - Transform: transform, - }) -} - -func handleAIExtractProducts(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - ApplicationJSON, - false, - ) - if err != nil { - return err - } - - params := contextdev.AIExtractProductsParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.AI.ExtractProducts(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "ai extract-products", - Transform: transform, - }) -} diff --git a/pkg/cmd/ai_test.go b/pkg/cmd/ai_test.go deleted file mode 100644 index 9c898f0..0000000 --- a/pkg/cmd/ai_test.go +++ /dev/null @@ -1,120 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package cmd - -import ( - "testing" - - "github.com/context-dot-dev/context-dev-cli/internal/mocktest" - "github.com/context-dot-dev/context-dev-cli/internal/requestflag" -) - -func TestAIExtractProduct(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "ai", "extract-product", - "--url", "https://example.com", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1000, behavior: fail}", - "--zdr", "enabled", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(aiExtractProduct) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "ai", "extract-product", - "--url", "https://example.com", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1000", - "--timeout-opts.behavior", "fail", - "--zdr", "enabled", - ) - }) - - t.Run("piping data", func(t *testing.T) { - // Test piping YAML data over stdin - pipeData := []byte("" + - "url: https://example.com\n" + - "maxAgeMs: 0\n" + - "tags:\n" + - " - production\n" + - " - team-alpha\n" + - "timeoutOpts:\n" + - " milliseconds: 1000\n" + - " behavior: fail\n" + - "zdr: enabled\n") - mocktest.TestRunMockTestWithPipeAndFlags( - t, pipeData, - "--api-key", "string", - "ai", "extract-product", - ) - }) -} - -func TestAIExtractProducts(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "ai", "extract-products", - "--domain", "domain", - "--max-age-ms", "0", - "--max-products", "1", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1000, behavior: fail}", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(aiExtractProducts) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "ai", "extract-products", - "--domain", "domain", - "--max-age-ms", "0", - "--max-products", "1", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1000", - "--timeout-opts.behavior", "fail", - ) - }) - - t.Run("piping data", func(t *testing.T) { - // Test piping YAML data over stdin - pipeData := []byte("" + - "domain: domain\n" + - "maxAgeMs: 0\n" + - "maxProducts: 1\n" + - "tags:\n" + - " - production\n" + - " - team-alpha\n" + - "timeoutOpts:\n" + - " milliseconds: 1000\n" + - " behavior: fail\n") - mocktest.TestRunMockTestWithPipeAndFlags( - t, pipeData, - "--api-key", "string", - "ai", "extract-products", - ) - }) -} diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index c557913..078d18a 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -128,56 +128,6 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ }, }) -var brandRetrieveSimplified = requestflag.WithInnerFlags(cli.Command{ - Name: "retrieve-simplified", - Usage: "Returns a simplified version of brand data containing only essential\ninformation: domain, title, colors, logos, and backdrops. Optimized for faster\nresponses and reduced data transfer.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "domain", - Usage: "Domain name to retrieve simplified brand data for", - Required: true, - QueryPath: "domain", - }, - &requestflag.Flag[*int64]{ - Name: "max-age-ms", - Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms) are clamped to 1 year.", - Default: requestflag.Ptr[int64](7776000000), - QueryPath: "maxAgeMs", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", - }, - &requestflag.Flag[string]{ - Name: "theme", - Usage: "Optional theme preference used when selecting brand assets.", - QueryPath: "theme", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - QueryPath: "timeoutOpts", - }, - }, - Action: handleBrandRetrieveSimplified, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, - InnerField: "behavior", - }, - }, -}) - var brandSearch = cli.Command{ Name: "search", Usage: "Search indexed brands by name or domain", @@ -258,47 +208,6 @@ func handleBrandRetrieve(ctx context.Context, cmd *cli.Command) error { }) } -func handleBrandRetrieveSimplified(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - EmptyBody, - false, - ) - if err != nil { - return err - } - - params := contextdev.BrandGetSimplifiedParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Brand.GetSimplified(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "brand retrieve-simplified", - Transform: transform, - }) -} - func handleBrandSearch(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) unusedArgs := cmd.Args().Slice() diff --git a/pkg/cmd/brand_test.go b/pkg/cmd/brand_test.go index e025d9e..77c925b 100644 --- a/pkg/cmd/brand_test.go +++ b/pkg/cmd/brand_test.go @@ -70,42 +70,6 @@ func TestBrandRetrieve(t *testing.T) { }) } -func TestBrandRetrieveSimplified(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "brand", "retrieve-simplified", - "--domain", "xxx", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--theme", "light", - "--timeout-opts", "{milliseconds: 1000, behavior: fail}", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(brandRetrieveSimplified) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "brand", "retrieve-simplified", - "--domain", "xxx", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--theme", "light", - "--timeout-opts.milliseconds", "1000", - "--timeout-opts.behavior", "fail", - ) - }) -} - func TestBrandSearch(t *testing.T) { t.Skip("Mock server tests are disabled") t.Run("regular flags", func(t *testing.T) { diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index aad5f54..bfa0122 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -98,28 +98,11 @@ func init() { Suggest: true, Commands: []*cli.Command{ &webAnswers, - &webExtract, &webExtractCompetitors, - &webExtractFonts, &webExtractStyleguide, &webScreenshot, &webSearch, &webWebCrawlMd, - &webWebScrapeBytes, - &webWebScrapeHTML, - &webWebScrapeImages, - &webWebScrapeMd, - &webWebScrapeScreenshot, - &webWebScrapeSitemap, - }, - }, - { - Name: "ai", - Category: "API RESOURCE", - Suggest: true, - Commands: []*cli.Command{ - &aiExtractProduct, - &aiExtractProducts, }, }, { @@ -128,7 +111,6 @@ func init() { Suggest: true, Commands: []*cli.Command{ &brandRetrieve, - &brandRetrieveSimplified, &brandSearch, }, }, diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 6842bd4..af76a5e 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -68,141 +68,6 @@ var webAnswers = requestflag.WithInnerFlags(cli.Command{ }, }) -var webExtract = requestflag.WithInnerFlags(cli.Command{ - Name: "extract", - Usage: "Crawl a website, use the provided JSON Schema and instructions to prioritize\nrelevant internal links, and extract structured data from the selected pages.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[map[string]any]{ - Name: "schema", - Usage: "JSON Schema for the returned data object. Image fields such as `image_urls` or `product_photos` automatically make page image references available to extraction, so product data and photos can be returned in one call. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object.", - Required: true, - BodyPath: "schema", - }, - &requestflag.Flag[string]{ - Name: "url", - Usage: "The starting website URL to crawl and extract from. Must include http:// or https://.", - Required: true, - BodyPath: "url", - }, - &requestflag.Flag[[]map[string]any]{ - Name: "action", - Usage: "Optional browser actions executed in order on the requested page after it loads, before links are discovered or additional pages are crawled. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms.", - BodyPath: "actions", - }, - &requestflag.Flag[bool]{ - Name: "fact-check", - Usage: "When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source.", - Default: false, - BodyPath: "factCheck", - }, - &requestflag.Flag[bool]{ - Name: "follow-subdomains", - Usage: "When true, follow links on subdomains of the starting URL's domain.", - Default: false, - BodyPath: "followSubdomains", - }, - &requestflag.Flag[bool]{ - Name: "include-frames", - Usage: "When true, iframe contents are included in Markdown before extraction.", - Default: false, - BodyPath: "includeFrames", - }, - &requestflag.Flag[string]{ - Name: "instructions", - Usage: "Optional extraction guidance, such as which facts to prioritize or how to interpret fields in the schema.", - BodyPath: "instructions", - }, - &requestflag.Flag[int64]{ - Name: "max-age-ms", - Usage: "Return cached scrape results if a prior scrape for the same parameters is younger than this many milliseconds. Defaults to 7 days (604800000 ms).", - Default: 604800000, - BodyPath: "maxAgeMs", - }, - &requestflag.Flag[int64]{ - Name: "max-depth", - Usage: "Optional maximum link depth from the starting URL (0 = only the starting page). If omitted, there is no crawl depth limit.", - BodyPath: "maxDepth", - }, - &requestflag.Flag[int64]{ - Name: "max-pages", - Usage: "Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5.", - Default: 5, - BodyPath: "maxPages", - }, - &requestflag.Flag[map[string]any]{ - Name: "pdf", - Default: map[string]any{"shouldParse": true}, - BodyPath: "pdf", - }, - &requestflag.Flag[bool]{ - Name: "settle-animations", - Usage: "When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.", - Default: false, - BodyPath: "settleAnimations", - }, - &requestflag.Flag[int64]{ - Name: "stop-after-ms", - Usage: "Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are provided.", - Default: 80000, - BodyPath: "stopAfterMs", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", - BodyPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - BodyPath: "timeoutOpts", - }, - &requestflag.Flag[int64]{ - Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load for each crawled page.", - BodyPath: "waitForMs", - }, - &requestflag.Flag[string]{ - Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", - Default: "disabled", - BodyPath: "zdr", - }, - }, - Action: handleWebExtract, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "pdf": { - &requestflag.InnerFlag[int64]{ - Name: "pdf.end", - Usage: "Last 1-based PDF page to parse. Must be greater than or equal to start when both are provided.", - InnerField: "end", - }, - &requestflag.InnerFlag[bool]{ - Name: "pdf.should-parse", - Usage: "When true, PDF pages are fetched and parsed. When false, PDF pages are skipped.", - InnerField: "shouldParse", - }, - &requestflag.InnerFlag[int64]{ - Name: "pdf.start", - Usage: "First 1-based PDF page to parse.", - InnerField: "start", - }, - }, - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, - InnerField: "behavior", - }, - }, -}) - var webExtractCompetitors = requestflag.WithInnerFlags(cli.Command{ Name: "extract-competitors", Usage: "Analyze a company's landing page and web search evidence to return direct\ncompetitors for the same product or market.", @@ -254,55 +119,6 @@ var webExtractCompetitors = requestflag.WithInnerFlags(cli.Command{ }, }) -var webExtractFonts = requestflag.WithInnerFlags(cli.Command{ - Name: "extract-fonts", - Usage: "Scrape font information from a website including font families, usage\nstatistics, fallbacks, and element/word counts.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "direct-url", - Usage: "A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both.", - QueryPath: "directUrl", - }, - &requestflag.Flag[string]{ - Name: "domain", - Usage: "Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both.", - QueryPath: "domain", - }, - &requestflag.Flag[*int64]{ - Name: "max-age-ms", - Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms) are clamped to 1 year.", - Default: requestflag.Ptr[int64](7776000000), - QueryPath: "maxAgeMs", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - QueryPath: "timeoutOpts", - }, - }, - Action: handleWebExtractFonts, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, - InnerField: "behavior", - }, - }, -}) - var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ Name: "extract-styleguide", Usage: "Extract a comprehensive design system from a website including colors,\ntypography, spacing, shadows, and UI components.", @@ -781,732 +597,9 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, }) -var webWebScrapeBytes = requestflag.WithInnerFlags(cli.Command{ - Name: "web-scrape-bytes", - Usage: "Downloads a resource and returns its bytes as base64. Without waitForMs, returns\nthe original HTTP response without image conversion, text extraction, or\ncharacter-encoding changes. HTTP compression is decoded before base64 encoding.\nSupply waitForMs to render HTML with JavaScript in the browser and return the\nresulting HTML as UTF-8 bytes after the wait. Non-HTML resources, including\nimages and PDFs, keep their original bytes and do not incur a browser wait.\nFollows public redirects and retries failed downloads through ISP and\nresidential proxies, with a direct fallback. When country is specified, only a\nresidential proxy in that country is used. Supply headers such as Referer for\nimages that require a referring page. Cached results are reused according to\nmaxAgeMs (default: 1 day; maximum: 30 days). Set maxAgeMs=0 to fetch fresh and\nrefresh the cache. Cache identity includes the exact URL, country, waitForMs,\nand normalized outbound headers. Credential-bearing headers and zero data\nretention bypass cache reads and writes. cache_metadata reports hit, miss, or\nzdr and the cached result age in milliseconds. Maximum decoded resource size: 20\nMiB (20971520 bytes), before base64 encoding. Successful requests cost 1 credit;\nerrors are not billed.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "url", - Usage: "Full HTTP(S) URL of the resource to download, such as an image, PDF, or page.", - Required: true, - QueryPath: "url", - }, - &requestflag.Flag[string]{ - Name: "country", - Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", - QueryPath: "country", - }, - &requestflag.Flag[map[string]any]{ - Name: "headers", - Usage: "Optional outbound HTTP headers, such as Referer, Cookie, or Authorization. Send as a JSON object or deep-object query params such as headers[Referer]=https://example.com/. Host, Content-Length, and hop-by-hop transport headers are rejected. Authorization and cookies are removed when a redirect changes origin. Credential-bearing headers bypass cache reads and writes; other headers are included in the cache key.", - QueryPath: "headers", - }, - &requestflag.Flag[*int64]{ - Name: "max-age-ms", - Usage: "Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.", - Default: requestflag.Ptr[int64](86400000), - QueryPath: "maxAgeMs", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - QueryPath: "timeoutOpts", - }, - &requestflag.Flag[*int64]{ - Name: "wait-for-ms", - Usage: "Optional browser wait time after initial page load, in milliseconds (0–30000; 0 uses 500). When supplied, HTML is rendered with JavaScript and returned as UTF-8 bytes. Other resources keep their original bytes without a browser wait. Omit to download the original HTTP response. When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", - QueryPath: "waitForMs", - }, - &requestflag.Flag[string]{ - Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", - Default: "disabled", - QueryPath: "zdr", - }, - }, - Action: handleWebWebScrapeBytes, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. This endpoint supports "fail": return 408 REQUEST_TIMEOUT without charging credits.`, - InnerField: "behavior", - }, - }, -}) - -var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ - Name: "web-scrape-html", - Usage: "Scrapes the given URL and returns the HTML content of the page. Optional\nextractRules return deterministic structured data in extracted using CSS\nselectors, attributes, lists, and nested rules, without an LLM or additional\ncredits. Rules run on the returned HTML after selector and main-content\nfiltering. Send extractRules as a JSON-encoded query parameter. The base request\ncosts 1 credit; requests with browser actions cost 2 credits. A request that\nhits its timeoutOpts.milliseconds deadline fails with 408 and is not billed,\nunless timeoutOpts.behavior=return-partial is set — then the page as rendered so\nfar is returned with `finalDOMState: \"still-loading\"` and billed at the base\ncost of 1 credit.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "url", - Usage: "Full URL to scrape (must include http:// or https:// protocol)", - Required: true, - QueryPath: "url", - }, - &requestflag.Flag[any]{ - Name: "action", - Usage: "Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions.", - QueryPath: "actions", - }, - &requestflag.Flag[string]{ - Name: "country", - Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", - QueryPath: "country", - }, - &requestflag.Flag[any]{ - Name: "exclude-selector", - Usage: `CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".`, - QueryPath: "excludeSelectors", - }, - &requestflag.Flag[map[string]any]{ - Name: "extract-rules", - Usage: `Optional CSS extraction rules applied to the returned HTML after selector and main-content filtering. Use selector strings ("h1", "a@href") or objects with selector, type (item or list), and output (text, html, @attribute, or nested rules). Text whitespace is normalized; html includes the matched element; attributes are returned as written. Missing items are null and missing lists are empty. CSS only; XPath is not supported. Maximum: 100 fields across 5 levels. Send a JSON-encoded string in the extractRules query parameter.`, - QueryPath: "extractRules", - }, - &requestflag.Flag[map[string]any]{ - Name: "headers", - Usage: "Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.", - QueryPath: "headers", - }, - &requestflag.Flag[bool]{ - Name: "include-frames", - Usage: "When true, iframes are rendered inline into the returned HTML.", - Default: false, - QueryPath: "includeFrames", - }, - &requestflag.Flag[any]{ - Name: "include-selector", - Usage: `CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]".`, - QueryPath: "includeSelectors", - }, - &requestflag.Flag[*int64]{ - Name: "max-age-ms", - Usage: "Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.", - Default: requestflag.Ptr[int64](86400000), - QueryPath: "maxAgeMs", - }, - &requestflag.Flag[map[string]any]{ - Name: "pdf", - Usage: "PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.", - Default: map[string]any{"shouldParse": true, "ocr": false}, - QueryPath: "pdf", - }, - &requestflag.Flag[bool]{ - Name: "settle-animations", - Usage: "When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.", - Default: false, - QueryPath: "settleAnimations", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - QueryPath: "timeoutOpts", - }, - &requestflag.Flag[bool]{ - Name: "use-main-content-only", - Usage: "When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable.", - Default: false, - QueryPath: "useMainContentOnly", - }, - &requestflag.Flag[*int64]{ - Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", - QueryPath: "waitForMs", - }, - &requestflag.Flag[string]{ - Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", - Default: "disabled", - QueryPath: "zdr", - }, - }, - Action: handleWebWebScrapeHTML, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "pdf": { - &requestflag.InnerFlag[int64]{ - Name: "pdf.end", - Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.", - InnerField: "end", - }, - &requestflag.InnerFlag[bool]{ - Name: "pdf.ocr", - Usage: "When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs.", - InnerField: "ocr", - }, - &requestflag.InnerFlag[bool]{ - Name: "pdf.should-parse", - Usage: "When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.", - InnerField: "shouldParse", - }, - &requestflag.InnerFlag[int64]{ - Name: "pdf.start", - Usage: "First 1-based PDF page to parse. When omitted, parsing starts at the first page.", - InnerField: "start", - }, - }, - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, - InnerField: "behavior", - }, - }, -}) - -var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ - Name: "web-scrape-images", - Usage: "Extract image assets from a web page, including standard URLs, inline SVGs, data\nURIs, responsive image sources, metadata, CSS backgrounds, video posters, and\nembeds. The base request costs 1 credit, or 2 credits with browser actions. When\nenrichment is enabled, the entire call costs 5 credits, including requests that\nalso use actions.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "url", - Usage: "Page URL to inspect. Must include http:// or https://.", - Required: true, - QueryPath: "url", - }, - &requestflag.Flag[any]{ - Name: "action", - Usage: "Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions.", - QueryPath: "actions", - }, - &requestflag.Flag[string]{ - Name: "country", - Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", - QueryPath: "country", - }, - &requestflag.Flag[bool]{ - Name: "dedupe", - Usage: "When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false.", - Default: false, - QueryPath: "dedupe", - }, - &requestflag.Flag[map[string]any]{ - Name: "enrichment", - Usage: "Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true.", - QueryPath: "enrichment", - }, - &requestflag.Flag[map[string]any]{ - Name: "headers", - Usage: "Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.", - QueryPath: "headers", - }, - &requestflag.Flag[*int64]{ - Name: "max-age-ms", - Usage: "Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days).", - Default: requestflag.Ptr[int64](86400000), - QueryPath: "maxAgeMs", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - QueryPath: "timeoutOpts", - }, - &requestflag.Flag[*int64]{ - Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", - QueryPath: "waitForMs", - }, - &requestflag.Flag[string]{ - Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", - Default: "disabled", - QueryPath: "zdr", - }, - }, - Action: handleWebWebScrapeImages, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "enrichment": { - &requestflag.InnerFlag[bool]{ - Name: "enrichment.classification", - Usage: "Classify each image by visual asset type.", - InnerField: "classification", - }, - &requestflag.InnerFlag[bool]{ - Name: "enrichment.hosted-url", - Usage: "Host materializable images on the Brand.dev CDN and return their URL and MIME type. Ignored when zero data retention is enabled.", - InnerField: "hostedUrl", - }, - &requestflag.InnerFlag[int64]{ - Name: "enrichment.max-time-per-ms", - Usage: "Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.", - InnerField: "maxTimePerMs", - }, - &requestflag.InnerFlag[bool]{ - Name: "enrichment.resolution", - Usage: "Measure image width and height when possible.", - InnerField: "resolution", - }, - }, - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, - InnerField: "behavior", - }, - }, -}) - -var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ - Name: "web-scrape-md", - Usage: "Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON\nresponses from a recognized API key; use error_code to distinguish stable\nfailure categories.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "url", - Usage: "Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol)", - Required: true, - QueryPath: "url", - }, - &requestflag.Flag[any]{ - Name: "action", - Usage: "Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions.", - QueryPath: "actions", - }, - &requestflag.Flag[string]{ - Name: "country", - Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", - QueryPath: "country", - }, - &requestflag.Flag[any]{ - Name: "exclude-selector", - Usage: `CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".`, - QueryPath: "excludeSelectors", - }, - &requestflag.Flag[map[string]any]{ - Name: "headers", - Usage: "Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.", - QueryPath: "headers", - }, - &requestflag.Flag[bool]{ - Name: "include-frames", - Usage: "When true, the contents of iframes are rendered to Markdown.", - Default: false, - QueryPath: "includeFrames", - }, - &requestflag.Flag[bool]{ - Name: "include-html", - Usage: "When true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request.", - Default: false, - QueryPath: "includeHTML", - }, - &requestflag.Flag[bool]{ - Name: "include-images", - Usage: "Include image references in Markdown output", - Default: false, - QueryPath: "includeImages", - }, - &requestflag.Flag[bool]{ - Name: "include-links", - Usage: "Preserve hyperlinks in Markdown output", - Default: true, - QueryPath: "includeLinks", - }, - &requestflag.Flag[any]{ - Name: "include-selector", - Usage: `CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]".`, - QueryPath: "includeSelectors", - }, - &requestflag.Flag[*int64]{ - Name: "max-age-ms", - Usage: "Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.", - Default: requestflag.Ptr[int64](86400000), - QueryPath: "maxAgeMs", - }, - &requestflag.Flag[map[string]any]{ - Name: "pdf", - Usage: "PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.", - Default: map[string]any{"shouldParse": true, "ocr": false}, - QueryPath: "pdf", - }, - &requestflag.Flag[bool]{ - Name: "settle-animations", - Usage: "When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.", - Default: false, - QueryPath: "settleAnimations", - }, - &requestflag.Flag[bool]{ - Name: "shorten-base64-images", - Usage: "Shorten base64-encoded image data in the Markdown output", - Default: true, - QueryPath: "shortenBase64Images", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - QueryPath: "timeoutOpts", - }, - &requestflag.Flag[bool]{ - Name: "use-main-content-only", - Usage: "Extract only the main content of the page, excluding headers, footers, sidebars, and navigation", - Default: false, - QueryPath: "useMainContentOnly", - }, - &requestflag.Flag[*int64]{ - Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", - QueryPath: "waitForMs", - }, - &requestflag.Flag[string]{ - Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", - Default: "disabled", - QueryPath: "zdr", - }, - }, - Action: handleWebWebScrapeMd, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "pdf": { - &requestflag.InnerFlag[int64]{ - Name: "pdf.end", - Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.", - InnerField: "end", - }, - &requestflag.InnerFlag[bool]{ - Name: "pdf.ocr", - Usage: "When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs.", - InnerField: "ocr", - }, - &requestflag.InnerFlag[bool]{ - Name: "pdf.should-parse", - Usage: "When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.", - InnerField: "shouldParse", - }, - &requestflag.InnerFlag[int64]{ - Name: "pdf.start", - Usage: "First 1-based PDF page to parse. When omitted, parsing starts at the first page.", - InnerField: "start", - }, - }, - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, - InnerField: "behavior", - }, - }, -}) - -var webWebScrapeScreenshot = requestflag.WithInnerFlags(cli.Command{ - Name: "web-scrape-screenshot", - Usage: "Capture the given HTTP or HTTPS URL with configurable viewport, full-page\ncapture, wait time, popup handling, theme, scroll offset, cache age, country,\nand request timeout. Defaults to a 1920x1080 viewport, a 3-second wait, and a\ncache age of 1 day. With timeoutOpts.behavior=return-partial, a screenshot of\nthe page rendered so far may be returned; inspect finalDOMState to identify an\nincomplete render. Successful requests cost 1 credit; errors are not billed.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "url", - Required: true, - QueryPath: "url", - }, - &requestflag.Flag[bool]{ - Name: "clear-popups", - Usage: "Optional parameter for comprehensive popup cleanup. If 'true', the browser dismisses detected cookie/consent UI and clears other detected obstructive popups and overlays before capture. If 'false' or not provided, this parameter requests no cleanup; handleCookiePopup can still request cookie/consent handling independently.", - Default: false, - QueryPath: "clearPopups", - }, - &requestflag.Flag[string]{ - Name: "color-scheme", - Usage: "Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances.", - QueryPath: "colorScheme", - }, - &requestflag.Flag[string]{ - Name: "country", - Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", - QueryPath: "country", - }, - &requestflag.Flag[string]{ - Name: "full-screenshot", - Usage: "Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view).", - QueryPath: "fullScreenshot", - }, - &requestflag.Flag[bool]{ - Name: "handle-cookie-popup", - Usage: "Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step.", - Default: false, - QueryPath: "handleCookiePopup", - }, - &requestflag.Flag[map[string]any]{ - Name: "headers", - Usage: "Optional outbound HTTP headers, using the same JSON object or deep-object query format as other scrape endpoints (for example headers[Authorization]=Bearer token). Headers are scoped to the target origin during capture. For domain/page requests, discovery receives no custom headers and only pages on the resolved origin are eligible. Non-empty headers bypass screenshot caching and return an in-memory data URL; no screenshot is uploaded. Empty objects behave like omitted headers.", - QueryPath: "headers", - }, - &requestflag.Flag[*int64]{ - Name: "max-age-ms", - Usage: "Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.", - Default: requestflag.Ptr[int64](86400000), - QueryPath: "maxAgeMs", - }, - &requestflag.Flag[*int64]{ - Name: "scroll-offset", - Usage: "Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000.", - QueryPath: "scrollOffset", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - QueryPath: "timeoutOpts", - }, - &requestflag.Flag[map[string]any]{ - Name: "viewport", - Usage: "Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.", - Default: map[string]any{"width": 1920, "height": 1080}, - QueryPath: "viewport", - }, - &requestflag.Flag[*int64]{ - Name: "wait-for-ms", - Usage: "Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. When combined with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.", - Default: requestflag.Ptr[int64](3000), - QueryPath: "waitForMs", - }, - &requestflag.Flag[string]{ - Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", - Default: "disabled", - QueryPath: "zdr", - }, - }, - Action: handleWebWebScrapeScreenshot, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, - InnerField: "behavior", - }, - }, - "viewport": { - &requestflag.InnerFlag[int64]{ - Name: "viewport.height", - Usage: "Viewport height in pixels.", - InnerField: "height", - }, - &requestflag.InnerFlag[int64]{ - Name: "viewport.width", - Usage: "Viewport width in pixels.", - InnerField: "width", - }, - }, -}) - -var webWebScrapeSitemap = requestflag.WithInnerFlags(cli.Command{ - Name: "web-scrape-sitemap", - Usage: "Crawl an entire website's sitemap and return all discovered page URLs. Set\n`includeSubdomains=true` to also discover public pages and sitemaps on child\nhosts such as `docs.example.com` or `brand.example.com`. Pass `search` to have\nthe discovered URLs filtered down to the pages about a phrase (for example\n`pricing and plans` or `api authentication docs`), most relevant first — a\nsearched crawl scans the whole sitemap and costs 2 credits instead of 1.", - Suggest: true, - Flags: []cli.Flag{ - &requestflag.Flag[string]{ - Name: "domain", - Usage: "Domain to build a sitemap for", - Required: true, - QueryPath: "domain", - }, - &requestflag.Flag[map[string]any]{ - Name: "headers", - Usage: "Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.", - QueryPath: "headers", - }, - &requestflag.Flag[bool]{ - Name: "include-subdomains", - Usage: "When true, discover and include public pages and sitemaps on subdomains of the requested domain. Defaults to false.", - Default: false, - QueryPath: "includeSubdomains", - }, - &requestflag.Flag[int64]{ - Name: "max-links", - Usage: "Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000.", - Default: 10000, - QueryPath: "maxLinks", - }, - &requestflag.Flag[string]{ - Name: "search", - Usage: "Optional search phrase. When provided, the crawled sitemap is filtered to the pages whose URLs are about that phrase, most relevant first, and the request costs 2 credits instead of 1.", - QueryPath: "search", - }, - &requestflag.Flag[string]{ - Name: "sitemap-url", - Usage: "Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps.", - QueryPath: "sitemapUrl", - }, - &requestflag.Flag[[]string]{ - Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", - QueryPath: "tags", - }, - &requestflag.Flag[map[string]any]{ - Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", - QueryPath: "timeoutOpts", - }, - &requestflag.Flag[string]{ - Name: "url-regex", - Usage: "Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks.", - QueryPath: "urlRegex", - }, - &requestflag.Flag[string]{ - Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", - Default: "disabled", - QueryPath: "zdr", - }, - }, - Action: handleWebWebScrapeSitemap, - HideHelpCommand: true, -}, map[string][]requestflag.HasOuterFlag{ - "timeout-opts": { - &requestflag.InnerFlag[int64]{ - Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", - InnerField: "milliseconds", - }, - &requestflag.InnerFlag[string]{ - Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, - InnerField: "behavior", - }, - }, -}) - -func handleWebAnswers(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - ApplicationJSON, - false, - ) - if err != nil { - return err - } - - params := contextdev.WebAnswersParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.Answers(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "web answers", - Transform: transform, - }) -} - -func handleWebExtract(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - ApplicationJSON, - false, - ) - if err != nil { - return err - } - - params := contextdev.WebExtractParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.Extract(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "web extract", - Transform: transform, - }) -} - -func handleWebExtractCompetitors(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() +func handleWebAnswers(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() if len(unusedArgs) > 0 { return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) @@ -1516,18 +609,18 @@ func handleWebExtractCompetitors(ctx context.Context, cmd *cli.Command) error { cmd, apiquery.NestedQueryFormatBrackets, apiquery.ArrayQueryFormatComma, - EmptyBody, + ApplicationJSON, false, ) if err != nil { return err } - params := contextdev.WebExtractCompetitorsParams{} + params := contextdev.WebAnswersParams{} var res []byte options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.ExtractCompetitors(ctx, params, options...) + _, err = client.Web.Answers(ctx, params, options...) if err != nil { return err } @@ -1540,12 +633,12 @@ func handleWebExtractCompetitors(ctx context.Context, cmd *cli.Command) error { ExplicitFormat: explicitFormat, Format: format, RawOutput: cmd.Root().Bool("raw-output"), - Title: "web extract-competitors", + Title: "web answers", Transform: transform, }) } -func handleWebExtractFonts(ctx context.Context, cmd *cli.Command) error { +func handleWebExtractCompetitors(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) unusedArgs := cmd.Args().Slice() @@ -1564,11 +657,11 @@ func handleWebExtractFonts(ctx context.Context, cmd *cli.Command) error { return err } - params := contextdev.WebExtractFontsParams{} + params := contextdev.WebExtractCompetitorsParams{} var res []byte options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.ExtractFonts(ctx, params, options...) + _, err = client.Web.ExtractCompetitors(ctx, params, options...) if err != nil { return err } @@ -1581,7 +674,7 @@ func handleWebExtractFonts(ctx context.Context, cmd *cli.Command) error { ExplicitFormat: explicitFormat, Format: format, RawOutput: cmd.Root().Bool("raw-output"), - Title: "web extract-fonts", + Title: "web extract-competitors", Transform: transform, }) } @@ -1749,249 +842,3 @@ func handleWebWebCrawlMd(ctx context.Context, cmd *cli.Command) error { Transform: transform, }) } - -func handleWebWebScrapeBytes(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - EmptyBody, - false, - ) - if err != nil { - return err - } - - params := contextdev.WebWebScrapeBytesParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.WebScrapeBytes(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "web web-scrape-bytes", - Transform: transform, - }) -} - -func handleWebWebScrapeHTML(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - EmptyBody, - false, - ) - if err != nil { - return err - } - - params := contextdev.WebWebScrapeHTMLParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.WebScrapeHTML(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "web web-scrape-html", - Transform: transform, - }) -} - -func handleWebWebScrapeImages(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - EmptyBody, - false, - ) - if err != nil { - return err - } - - params := contextdev.WebWebScrapeImagesParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.WebScrapeImages(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "web web-scrape-images", - Transform: transform, - }) -} - -func handleWebWebScrapeMd(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - EmptyBody, - false, - ) - if err != nil { - return err - } - - params := contextdev.WebWebScrapeMdParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.WebScrapeMd(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "web web-scrape-md", - Transform: transform, - }) -} - -func handleWebWebScrapeScreenshot(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - EmptyBody, - false, - ) - if err != nil { - return err - } - - params := contextdev.WebWebScrapeScreenshotParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.WebScrapeScreenshot(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "web web-scrape-screenshot", - Transform: transform, - }) -} - -func handleWebWebScrapeSitemap(ctx context.Context, cmd *cli.Command) error { - client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) - unusedArgs := cmd.Args().Slice() - - if len(unusedArgs) > 0 { - return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) - } - - options, err := flagOptions( - cmd, - apiquery.NestedQueryFormatBrackets, - apiquery.ArrayQueryFormatComma, - EmptyBody, - false, - ) - if err != nil { - return err - } - - params := contextdev.WebWebScrapeSitemapParams{} - - var res []byte - options = append(options, option.WithResponseBodyInto(&res)) - _, err = client.Web.WebScrapeSitemap(ctx, params, options...) - if err != nil { - return err - } - - obj := gjson.ParseBytes(res) - format := cmd.Root().String("format") - explicitFormat := cmd.Root().IsSet("format") - transform := cmd.Root().String("transform") - return ShowJSON(obj, ShowJSONOpts{ - ExplicitFormat: explicitFormat, - Format: format, - RawOutput: cmd.Root().Bool("raw-output"), - Title: "web web-scrape-sitemap", - Transform: transform, - }) -} diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index be8fc0c..ff88f38 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -69,108 +69,6 @@ func TestWebAnswers(t *testing.T) { }) } -func TestWebExtract(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "extract", - "--schema", "{type: bar, properties: bar, required: bar, additionalProperties: bar}", - "--url", "https://example.com", - "--action", "{do: wait, timeMs: 0}", - "--fact-check=true", - "--follow-subdomains=true", - "--include-frames=true", - "--instructions", "instructions", - "--max-age-ms", "0", - "--max-depth", "0", - "--max-pages", "1", - "--pdf", "{end: 1, shouldParse: true, start: 1}", - "--settle-animations=true", - "--stop-after-ms", "10000", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1000, behavior: fail}", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(webExtract) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "extract", - "--schema", "{type: bar, properties: bar, required: bar, additionalProperties: bar}", - "--url", "https://example.com", - "--action", "{do: wait, timeMs: 0}", - "--fact-check=true", - "--follow-subdomains=true", - "--include-frames=true", - "--instructions", "instructions", - "--max-age-ms", "0", - "--max-depth", "0", - "--max-pages", "1", - "--pdf.end", "1", - "--pdf.should-parse=true", - "--pdf.start", "1", - "--settle-animations=true", - "--stop-after-ms", "10000", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1000", - "--timeout-opts.behavior", "fail", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) - - t.Run("piping data", func(t *testing.T) { - // Test piping YAML data over stdin - pipeData := []byte("" + - "schema:\n" + - " type: bar\n" + - " properties: bar\n" + - " required: bar\n" + - " additionalProperties: bar\n" + - "url: https://example.com\n" + - "actions:\n" + - " - do: wait\n" + - " timeMs: 0\n" + - "factCheck: true\n" + - "followSubdomains: true\n" + - "includeFrames: true\n" + - "instructions: instructions\n" + - "maxAgeMs: 0\n" + - "maxDepth: 0\n" + - "maxPages: 1\n" + - "pdf:\n" + - " end: 1\n" + - " shouldParse: true\n" + - " start: 1\n" + - "settleAnimations: true\n" + - "stopAfterMs: 10000\n" + - "tags:\n" + - " - production\n" + - " - team-alpha\n" + - "timeoutOpts:\n" + - " milliseconds: 1000\n" + - " behavior: fail\n" + - "waitForMs: 0\n" + - "zdr: enabled\n") - mocktest.TestRunMockTestWithPipeAndFlags( - t, pipeData, - "--api-key", "string", - "web", "extract", - ) - }) -} - func TestWebExtractCompetitors(t *testing.T) { t.Skip("Mock server tests are disabled") t.Run("regular flags", func(t *testing.T) { @@ -207,42 +105,6 @@ func TestWebExtractCompetitors(t *testing.T) { }) } -func TestWebExtractFonts(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "extract-fonts", - "--direct-url", "https://example.com", - "--domain", "xxx", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1, behavior: fail}", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(webExtractFonts) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "extract-fonts", - "--direct-url", "https://example.com", - "--domain", "xxx", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1", - "--timeout-opts.behavior", "fail", - ) - }) -} - func TestWebExtractStyleguide(t *testing.T) { t.Skip("Mock server tests are disabled") t.Run("regular flags", func(t *testing.T) { @@ -552,325 +414,3 @@ func TestWebWebCrawlMd(t *testing.T) { ) }) } - -func TestWebWebScrapeBytes(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-bytes", - "--url", "https://example.com", - "--country", "de", - "--headers", "{foo: J!}", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1, behavior: fail}", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(webWebScrapeBytes) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-bytes", - "--url", "https://example.com", - "--country", "de", - "--headers", "{foo: J!}", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1", - "--timeout-opts.behavior", "fail", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) -} - -func TestWebWebScrapeHTML(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-html", - "--url", "https://example.com", - "--action", "[{do: wait, timeMs: 0}]", - "--country", "de", - "--exclude-selector", "[x]", - "--extract-rules", "{foo: x}", - "--headers", "{foo: J!}", - "--include-frames=true", - "--include-selector", "[x]", - "--max-age-ms", "0", - "--pdf", "{end: 1, ocr: true, shouldParse: true, start: 1}", - "--settle-animations=true", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1, behavior: fail}", - "--use-main-content-only=true", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(webWebScrapeHTML) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-html", - "--url", "https://example.com", - "--action", "[{do: wait, timeMs: 0}]", - "--country", "de", - "--exclude-selector", "[x]", - "--extract-rules", "{foo: x}", - "--headers", "{foo: J!}", - "--include-frames=true", - "--include-selector", "[x]", - "--max-age-ms", "0", - "--pdf.end", "1", - "--pdf.ocr=true", - "--pdf.should-parse=true", - "--pdf.start", "1", - "--settle-animations=true", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1", - "--timeout-opts.behavior", "fail", - "--use-main-content-only=true", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) -} - -func TestWebWebScrapeImages(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-images", - "--url", "https://example.com", - "--action", "[{do: wait, timeMs: 0}]", - "--country", "de", - "--dedupe=true", - "--enrichment", "{classification: true, hostedUrl: true, maxTimePerMs: 1, resolution: true}", - "--headers", "{foo: J!}", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1, behavior: fail}", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(webWebScrapeImages) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-images", - "--url", "https://example.com", - "--action", "[{do: wait, timeMs: 0}]", - "--country", "de", - "--dedupe=true", - "--enrichment.classification=true", - "--enrichment.hosted-url=true", - "--enrichment.max-time-per-ms", "1", - "--enrichment.resolution=true", - "--headers", "{foo: J!}", - "--max-age-ms", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1", - "--timeout-opts.behavior", "fail", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) -} - -func TestWebWebScrapeMd(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-md", - "--url", "https://example.com", - "--action", "[{do: wait, timeMs: 0}]", - "--country", "de", - "--exclude-selector", "[x]", - "--headers", "{foo: J!}", - "--include-frames=true", - "--include-html=true", - "--include-images=true", - "--include-links=true", - "--include-selector", "[x]", - "--max-age-ms", "0", - "--pdf", "{end: 1, ocr: true, shouldParse: true, start: 1}", - "--settle-animations=true", - "--shorten-base64-images=true", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1, behavior: fail}", - "--use-main-content-only=true", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(webWebScrapeMd) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-md", - "--url", "https://example.com", - "--action", "[{do: wait, timeMs: 0}]", - "--country", "de", - "--exclude-selector", "[x]", - "--headers", "{foo: J!}", - "--include-frames=true", - "--include-html=true", - "--include-images=true", - "--include-links=true", - "--include-selector", "[x]", - "--max-age-ms", "0", - "--pdf.end", "1", - "--pdf.ocr=true", - "--pdf.should-parse=true", - "--pdf.start", "1", - "--settle-animations=true", - "--shorten-base64-images=true", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1", - "--timeout-opts.behavior", "fail", - "--use-main-content-only=true", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) -} - -func TestWebWebScrapeScreenshot(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-screenshot", - "--url", "https://example.com", - "--clear-popups=true", - "--color-scheme", "light", - "--country", "de", - "--full-screenshot", "true", - "--handle-cookie-popup=true", - "--headers", "{foo: J!}", - "--max-age-ms", "0", - "--scroll-offset", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1, behavior: fail}", - "--viewport", "{height: 240, width: 240}", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(webWebScrapeScreenshot) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-screenshot", - "--url", "https://example.com", - "--clear-popups=true", - "--color-scheme", "light", - "--country", "de", - "--full-screenshot", "true", - "--handle-cookie-popup=true", - "--headers", "{foo: J!}", - "--max-age-ms", "0", - "--scroll-offset", "0", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1", - "--timeout-opts.behavior", "fail", - "--viewport.height", "240", - "--viewport.width", "240", - "--wait-for-ms", "0", - "--zdr", "enabled", - ) - }) -} - -func TestWebWebScrapeSitemap(t *testing.T) { - t.Skip("Mock server tests are disabled") - t.Run("regular flags", func(t *testing.T) { - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-sitemap", - "--domain", "xxx", - "--headers", "{foo: J!}", - "--include-subdomains=true", - "--max-links", "1", - "--search", "help center and troubleshooting articles", - "--sitemap-url", "https://example.com", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts", "{milliseconds: 1, behavior: fail}", - "--url-regex", "^https?://[^/]+/blog/", - "--zdr", "enabled", - ) - }) - - t.Run("inner flags", func(t *testing.T) { - // Check that inner flags have been set up correctly - requestflag.CheckInnerFlags(webWebScrapeSitemap) - - // Alternative argument passing style using inner flags - mocktest.TestRunMockTestWithFlags( - t, - "--api-key", "string", - "web", "web-scrape-sitemap", - "--domain", "xxx", - "--headers", "{foo: J!}", - "--include-subdomains=true", - "--max-links", "1", - "--search", "help center and troubleshooting articles", - "--sitemap-url", "https://example.com", - "--tag", "production", - "--tag", "team-alpha", - "--timeout-opts.milliseconds", "1", - "--timeout-opts.behavior", "fail", - "--url-regex", "^https?://[^/]+/blog/", - "--zdr", "enabled", - ) - }) -} From 6f9eb98e041689d98734a4962c795ba1c9a44e9f Mon Sep 17 00:00:00 2001 From: contextualbeer Date: Tue, 22 Sep 2026 08:31:52 +0200 Subject: [PATCH 029/119] release: 1.11.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 20 ++++++++++++++++++++ pkg/cmd/version.go | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index eb4e0db..caf1487 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.10.0" + ".": "1.11.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f113a4..ac3a0bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [1.11.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.10.0...v1.11.0) (2026-09-22) + + +### Features + +* **api:** enable ZDR on remaining AI endpoints via OpenAI ([#1099](https://github.com/context-dot-dev/context-dev-cli/issues/1099)) ([cd708ca](https://github.com/context-dot-dev/context-dev-cli/commit/cd708cab6ed78bd33d9d6237f09cbc38e45347d4)) +* **billing:** charge for 404s and skip fraud accounting ([#1152](https://github.com/context-dot-dev/context-dev-cli/issues/1152)) ([da081b1](https://github.com/context-dot-dev/context-dev-cli/commit/da081b109221008938d7e9665584fcbbedc3a49c)) +* **scrape:** add cache age support to byte downloads ([#1171](https://github.com/context-dot-dev/context-dev-cli/issues/1171)) ([5f66062](https://github.com/context-dot-dev/context-dev-cli/commit/5f66062092a3fa099f0cd043915e726f315c0de5)) +* **scrape:** add CSS extraction rules to HTML scraping ([#1146](https://github.com/context-dot-dev/context-dev-cli/issues/1146)) ([7312544](https://github.com/context-dot-dev/context-dev-cli/commit/7312544df2c45bcc1a83b53385349c5c0f587280)) +* **scrape:** align timeout options and public SDK methods ([#1207](https://github.com/context-dot-dev/context-dev-cli/issues/1207)) ([b022ea7](https://github.com/context-dot-dev/context-dev-cli/commit/b022ea7a62ec6e043d354c691ddaa16df07f1b2b)) +* **scrape:** support country for image scraping ([#1172](https://github.com/context-dot-dev/context-dev-cli/issues/1172)) ([5f66062](https://github.com/context-dot-dev/context-dev-cli/commit/5f66062092a3fa099f0cd043915e726f315c0de5)) +* **scrape:** support custom screenshot headers ([#1169](https://github.com/context-dot-dev/context-dev-cli/issues/1169)) ([efaf864](https://github.com/context-dot-dev/context-dev-cli/commit/efaf86495456996b4b0e7f21eb1f7608da6ff1e6)) +* **scrape:** support waitForMs for byte downloads ([#1170](https://github.com/context-dot-dev/context-dev-cli/issues/1170)) ([0d84fa4](https://github.com/context-dot-dev/context-dev-cli/commit/0d84fa4da25faa2ba9687880140bf82e6868199b)) +* **web:** add URL-based scrape screenshot endpoint ([#1150](https://github.com/context-dot-dev/context-dev-cli/issues/1150)) ([7309030](https://github.com/context-dot-dev/context-dev-cli/commit/730903032b70d9bbd6026d005946170cd79ef560)) + + +### Bug Fixes + +* **api:** lower partial scrape timeout minimum to five seconds ([#1118](https://github.com/context-dot-dev/context-dev-cli/issues/1118)) ([29338a1](https://github.com/context-dot-dev/context-dev-cli/commit/29338a15ff1b82c1c1908af5db66c6011461814d)) + ## [1.10.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.9.0...v1.10.0) (2026-09-15) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index becade7..b5f5fd1 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.10.0" // x-release-please-version +const Version = "1.11.0" // x-release-please-version From fdc7945e8c835595b721eb9d611b1c102c92ea8f Mon Sep 17 00:00:00 2001 From: contextualbeer Date: Tue, 22 Sep 2026 08:36:24 +0200 Subject: [PATCH 030/119] release: 1.12.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 111 ++++++++++++++++++++++++++++++++++ pkg/cmd/version.go | 2 +- 3 files changed, 113 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index caf1487..de0960a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.11.0" + ".": "1.12.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ac3a0bc..fe9ff30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,116 @@ # Changelog +## [1.12.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.11.0...v1.12.0) (2026-09-22) + + +### Features + +* **answers:** add live web research with fast and ultra modes ([#954](https://github.com/context-dot-dev/context-dev-cli/issues/954)) ([8f226f8](https://github.com/context-dot-dev/context-dev-cli/commit/8f226f8287e196fcd383f1bef037d804a493c222)) +* **api-keys:** enforce scoped API key permissions ([#1038](https://github.com/context-dot-dev/context-dev-cli/issues/1038)) ([f2427ba](https://github.com/context-dot-dev/context-dev-cli/commit/f2427ba6e9d7538546b0dee7b90a037c082b6d03)) +* **api:** api update ([985ccab](https://github.com/context-dot-dev/context-dev-cli/commit/985ccab2173e91b5cf40749f33133d7c92527652)) +* **api:** api update ([3583e1a](https://github.com/context-dot-dev/context-dev-cli/commit/3583e1aff934cfb1ce1bad257ffbfa262b3a8733)) +* **api:** api update ([7b5b53f](https://github.com/context-dot-dev/context-dev-cli/commit/7b5b53f167b6bf29d2c4de02f348edc2122d5e80)) +* **api:** api update ([af18337](https://github.com/context-dot-dev/context-dev-cli/commit/af1833778a6a1620a5e3f0008b7f67cd5dae53c0)) +* **api:** api update ([42b486d](https://github.com/context-dot-dev/context-dev-cli/commit/42b486d2ef88a5dff7e3217b01adae0ab433c36f)) +* **api:** api update ([22478e2](https://github.com/context-dot-dev/context-dev-cli/commit/22478e2f26fc4bcc47509a449e47a7f4e0ec8a23)) +* **api:** api update ([7e6e3b7](https://github.com/context-dot-dev/context-dev-cli/commit/7e6e3b7c6d540b53660b82ec81cf1d92fc4fe1b5)) +* **api:** api update ([eb22b56](https://github.com/context-dot-dev/context-dev-cli/commit/eb22b56ccf04e0c18195a7bc0f5289de452c2952)) +* **api:** api update ([18adfb0](https://github.com/context-dot-dev/context-dev-cli/commit/18adfb09e23af7efc8a64370e13d5cc38fe73859)) +* **api:** api update ([df232b5](https://github.com/context-dot-dev/context-dev-cli/commit/df232b58f81c68fd6a914e7fe63882a0f3de9fd4)) +* **api:** api update ([e21a8ff](https://github.com/context-dot-dev/context-dev-cli/commit/e21a8ff46d495a59b9c751965bb9d980a0765c78)) +* **api:** api update ([48a68cb](https://github.com/context-dot-dev/context-dev-cli/commit/48a68cb9ad422157ee55deef66773a161e320f44)) +* **api:** api update ([ad50292](https://github.com/context-dot-dev/context-dev-cli/commit/ad502925051676385440177ba5a4113631ff2dfa)) +* **api:** api update ([5650e87](https://github.com/context-dot-dev/context-dev-cli/commit/5650e87248bd4d1dabd6027007f510650684d511)) +* **api:** api update ([4ca42b8](https://github.com/context-dot-dev/context-dev-cli/commit/4ca42b8b8bdbe6750a50db1bc39b4ff098346f65)) +* **api:** api update ([92be0b6](https://github.com/context-dot-dev/context-dev-cli/commit/92be0b69f74d40bddb2748939d27c5b9f2660f46)) +* **api:** api update ([90cad89](https://github.com/context-dot-dev/context-dev-cli/commit/90cad89d5524f42fcd1e84e040bc19ab3e9d1052)) +* **api:** api update ([e216795](https://github.com/context-dot-dev/context-dev-cli/commit/e216795e82dfdbf993710845866636a503bda557)) +* **api:** api update ([b649e03](https://github.com/context-dot-dev/context-dev-cli/commit/b649e034740d7aae62e30bccf0446c846a39e282)) +* **api:** api update ([ccba916](https://github.com/context-dot-dev/context-dev-cli/commit/ccba91605a6095370892bec901f58a75f91a04c6)) +* **api:** api update ([b8de4ec](https://github.com/context-dot-dev/context-dev-cli/commit/b8de4ec1e8a39c97e3bbf04dd259c9fa3e8aa44f)) +* **api:** api update ([3c2c3c2](https://github.com/context-dot-dev/context-dev-cli/commit/3c2c3c2daf40ad8df4df6b9861ed88291b539f91)) +* **api:** api update ([0b487b1](https://github.com/context-dot-dev/context-dev-cli/commit/0b487b175434d6db1ce66501382164a55b68c557)) +* **api:** api update ([cd4503b](https://github.com/context-dot-dev/context-dev-cli/commit/cd4503b7722a10614512c2d1ea9c3dffc670f434)) +* **api:** api update ([af90e28](https://github.com/context-dot-dev/context-dev-cli/commit/af90e280f6fe278065c1d873be594fae7f9d61a4)) +* **api:** api update ([5f2e61b](https://github.com/context-dot-dev/context-dev-cli/commit/5f2e61b15cc331ec398111cac0d43b409826da40)) +* **api:** api update ([e21218b](https://github.com/context-dot-dev/context-dev-cli/commit/e21218b5cb90979c8a2ef32539859d671a33967a)) +* **api:** api update ([21c81e4](https://github.com/context-dot-dev/context-dev-cli/commit/21c81e4faf5385a5c02c21585524d8d04794f598)) +* **api:** api update ([0468ad1](https://github.com/context-dot-dev/context-dev-cli/commit/0468ad177e1bfb23732f4bda41ad34fb37f972b4)) +* **api:** api update ([349f90c](https://github.com/context-dot-dev/context-dev-cli/commit/349f90c23ba4ac35c8c5dee81060a495475435c3)) +* **api:** api update ([47fc775](https://github.com/context-dot-dev/context-dev-cli/commit/47fc77546b9d9979e7d14d80d0bed7a6cfaa9e44)) +* **api:** api update ([0a8b58e](https://github.com/context-dot-dev/context-dev-cli/commit/0a8b58e4e26794d3c2a67f2d4ff92a85a8396d54)) +* **api:** api update ([16201c6](https://github.com/context-dot-dev/context-dev-cli/commit/16201c67e3dd1e192a0ca50557518d4bf8314580)) +* **api:** api update ([e636b6d](https://github.com/context-dot-dev/context-dev-cli/commit/e636b6d51d9c58cfb2f0845900e22eddcd939d50)) +* **api:** api update ([e16a2a9](https://github.com/context-dot-dev/context-dev-cli/commit/e16a2a9ef5a60f1b135bc081867e7404c1e2c8f5)) +* **api:** api update ([fd7e3fe](https://github.com/context-dot-dev/context-dev-cli/commit/fd7e3fec2da55fc91c40c2e4f0e7d9247ebf5400)) +* **api:** api update ([058e8d0](https://github.com/context-dot-dev/context-dev-cli/commit/058e8d0a1dd1728ab42524cd52a39fa83c8d5aee)) +* **api:** api update ([487caec](https://github.com/context-dot-dev/context-dev-cli/commit/487caec519e5299562b2b864240395e13a8a5791)) +* **api:** api update ([40129c5](https://github.com/context-dot-dev/context-dev-cli/commit/40129c5f3a5fb562d1ef4c0a2f2ab408d0ca2732)) +* **api:** api update ([8b611d1](https://github.com/context-dot-dev/context-dev-cli/commit/8b611d174d071bd86accc7c31ce6233949247457)) +* **api:** api update ([a0e254f](https://github.com/context-dot-dev/context-dev-cli/commit/a0e254f262eb656902ba18f4894a29e19c81b3a7)) +* **api:** api update ([a9d6531](https://github.com/context-dot-dev/context-dev-cli/commit/a9d6531da6214adc7f8bd0b0e147c11b0fe9e1d1)) +* **api:** api update ([4d0ddd0](https://github.com/context-dot-dev/context-dev-cli/commit/4d0ddd0adb859f0103c397807ed41afb6190329c)) +* **api:** api update ([6a98028](https://github.com/context-dot-dev/context-dev-cli/commit/6a9802898695bda06edd6aaee2f5ce1b7d90f746)) +* **api:** api update ([6b8d1cc](https://github.com/context-dot-dev/context-dev-cli/commit/6b8d1cc9593681bdee01369a730094ebca3d6fc4)) +* **api:** api update ([1722d54](https://github.com/context-dot-dev/context-dev-cli/commit/1722d543bb09c25729bf6af74de4642c77b3b078)) +* **api:** api update ([5deab14](https://github.com/context-dot-dev/context-dev-cli/commit/5deab142468bc18e41383400e9d14ad5cc905508)) +* **api:** api update ([f0bbbf0](https://github.com/context-dot-dev/context-dev-cli/commit/f0bbbf071979c9eae27bd53804b9a0b60d32037c)) +* **api:** api update ([3a5899b](https://github.com/context-dot-dev/context-dev-cli/commit/3a5899babfedea3bed0980934c4a7c87cecb4c63)) +* **api:** api update ([17b3e2c](https://github.com/context-dot-dev/context-dev-cli/commit/17b3e2c78ef859b656f78deb7ae2b7d295865f27)) +* **api:** api update ([e9b3454](https://github.com/context-dot-dev/context-dev-cli/commit/e9b3454a43a4f9f7614a56a6039eb260b398de52)) +* **api:** api update ([d9b903c](https://github.com/context-dot-dev/context-dev-cli/commit/d9b903c39a5521064f49f658d32205f310f54e00)) +* **api:** api update ([e4387a5](https://github.com/context-dot-dev/context-dev-cli/commit/e4387a54271251c65f16cfd1dce035e177393db2)) +* **api:** api update ([f6c4de7](https://github.com/context-dot-dev/context-dev-cli/commit/f6c4de7fc399ff172e50ec287aa6302d69741c13)) +* **api:** api update ([c1a847a](https://github.com/context-dot-dev/context-dev-cli/commit/c1a847ad433d451d723b8dcd37359b1fc3dd95f2)) +* **api:** enable ZDR on remaining AI endpoints via OpenAI ([#1099](https://github.com/context-dot-dev/context-dev-cli/issues/1099)) ([cd708ca](https://github.com/context-dot-dev/context-dev-cli/commit/cd708cab6ed78bd33d9d6237f09cbc38e45347d4)) +* **api:** manual updates ([6a9b2f5](https://github.com/context-dot-dev/context-dev-cli/commit/6a9b2f59ae223e0e70e61a8e63012c8c4160a431)) +* **api:** manual updates ([35e256a](https://github.com/context-dot-dev/context-dev-cli/commit/35e256a85572f24f11f89dbc452a7fa81640cef3)) +* **api:** manual updates ([0a31daa](https://github.com/context-dot-dev/context-dev-cli/commit/0a31daa87ff77541579b3e9147c08981779c073f)) +* **api:** manual updates ([5b0ef3e](https://github.com/context-dot-dev/context-dev-cli/commit/5b0ef3ebae76534b4a1997d4e13311cc225bb555)) +* **api:** manual updates ([e02d02e](https://github.com/context-dot-dev/context-dev-cli/commit/e02d02e69c215116d5d3e1aec5cab2be279da032)) +* **api:** manual updates ([d742101](https://github.com/context-dot-dev/context-dev-cli/commit/d74210104ea1f0a693d91aa8f8b53d6ea433ec70)) +* **api:** manual updates ([1aef807](https://github.com/context-dot-dev/context-dev-cli/commit/1aef8079dd1d7f31da5c7f5e65291396c178283b)) +* **api:** manual updates ([85a84a1](https://github.com/context-dot-dev/context-dev-cli/commit/85a84a193090a6f424364c9196f7b24619953635)) +* **api:** manual updates ([d416480](https://github.com/context-dot-dev/context-dev-cli/commit/d416480c31a74e1dc682c23b5c838f8b4147b31f)) +* **api:** unify timeout configuration and return partial results ([#1030](https://github.com/context-dot-dev/context-dev-cli/issues/1030)) ([467f13a](https://github.com/context-dot-dev/context-dev-cli/commit/467f13ab47753ff0889e46d3315604841dab78d4)) +* **billing:** charge for 404s and skip fraud accounting ([#1152](https://github.com/context-dot-dev/context-dev-cli/issues/1152)) ([da081b1](https://github.com/context-dot-dev/context-dev-cli/commit/da081b109221008938d7e9665584fcbbedc3a49c)) +* initial stlc build ([5dc353c](https://github.com/context-dot-dev/context-dev-cli/commit/5dc353c8190ed4d2747a3e07c09fffb4ad7ec710)) +* **logs:** expose request log endpoints in SDKs ([#1025](https://github.com/context-dot-dev/context-dev-cli/issues/1025)) ([08ee0eb](https://github.com/context-dot-dev/context-dev-cli/commit/08ee0ebeb58a3fa865c4df7c5ba2364d2745b9ee)) +* **monitors:** add page selector filters ([#1037](https://github.com/context-dot-dev/context-dev-cli/issues/1037)) ([39ca377](https://github.com/context-dot-dev/context-dev-cli/commit/39ca377527e965766a22a5dcf583101cbffd1692)) +* **scrape:** add cache age support to byte downloads ([#1171](https://github.com/context-dot-dev/context-dev-cli/issues/1171)) ([5f66062](https://github.com/context-dot-dev/context-dev-cli/commit/5f66062092a3fa099f0cd043915e726f315c0de5)) +* **scrape:** add CSS extraction rules to HTML scraping ([#1146](https://github.com/context-dot-dev/context-dev-cli/issues/1146)) ([7312544](https://github.com/context-dot-dev/context-dev-cli/commit/7312544df2c45bcc1a83b53385349c5c0f587280)) +* **scrape:** align timeout options and public SDK methods ([#1207](https://github.com/context-dot-dev/context-dev-cli/issues/1207)) ([b022ea7](https://github.com/context-dot-dev/context-dev-cli/commit/b022ea7a62ec6e043d354c691ddaa16df07f1b2b)) +* **scrape:** support country for image scraping ([#1172](https://github.com/context-dot-dev/context-dev-cli/issues/1172)) ([5f66062](https://github.com/context-dot-dev/context-dev-cli/commit/5f66062092a3fa099f0cd043915e726f315c0de5)) +* **scrape:** support custom screenshot headers ([#1169](https://github.com/context-dot-dev/context-dev-cli/issues/1169)) ([efaf864](https://github.com/context-dot-dev/context-dev-cli/commit/efaf86495456996b4b0e7f21eb1f7608da6ff1e6)) +* **scrape:** support waitForMs for byte downloads ([#1170](https://github.com/context-dot-dev/context-dev-cli/issues/1170)) ([0d84fa4](https://github.com/context-dot-dev/context-dev-cli/commit/0d84fa4da25faa2ba9687880140bf82e6868199b)) +* **sitemap:** add subdomain discovery ([126d27d](https://github.com/context-dot-dev/context-dev-cli/commit/126d27d4684b5f3e75de83dfe32de7c34f9c5a81)) +* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([d55d529](https://github.com/context-dot-dev/context-dev-cli/commit/d55d5297e92d05dc7bc507f2ac9f3c02f1f9d178)) +* **web:** add raw bytes scraping endpoint ([#1081](https://github.com/context-dot-dev/context-dev-cli/issues/1081)) ([5d45957](https://github.com/context-dot-dev/context-dev-cli/commit/5d4595725c6a850bc9df5e265ddcd2b6eb8321eb)) +* **web:** add URL-based scrape screenshot endpoint ([#1150](https://github.com/context-dot-dev/context-dev-cli/issues/1150)) ([7309030](https://github.com/context-dot-dev/context-dev-cli/commit/730903032b70d9bbd6026d005946170cd79ef560)) +* **webhooks:** add configurable retries and manual replay ([d366bd3](https://github.com/context-dot-dev/context-dev-cli/commit/d366bd323f7875132dfe35ceb8fdfe3d92e9edaf)) +* **webhooks:** simplify delivery APIs ([7fd54b9](https://github.com/context-dot-dev/context-dev-cli/commit/7fd54b92fa451965a26df73df1ac6b4cc0d8d458)) + + +### Bug Fixes + +* **api:** guarantee search descriptions and align response types ([#1089](https://github.com/context-dot-dev/context-dev-cli/issues/1089)) ([1fc274a](https://github.com/context-dot-dev/context-dev-cli/commit/1fc274a8c9bbe1711442c49f0cef7d393318c270)) +* **api:** honour maxAgeMs=0 on brand retrieve, styleguide and fonts endpoints ([#998](https://github.com/context-dot-dev/context-dev-cli/issues/998)) ([97370fd](https://github.com/context-dot-dev/context-dev-cli/commit/97370fd41d8d503270a786dc474ffe2a84c94214)) +* **api:** lower partial scrape timeout minimum to five seconds ([#1118](https://github.com/context-dot-dev/context-dev-cli/issues/1118)) ([29338a1](https://github.com/context-dot-dev/context-dev-cli/commit/29338a15ff1b82c1c1908af5db66c6011461814d)) +* **api:** reject timeoutMS too short for waitForMs ([7e03bf3](https://github.com/context-dot-dev/context-dev-cli/commit/7e03bf3075934de07ee9364819531f14756816e5)) +* **deps:** bump context-go-sdk to v1.4.0 for Monitors support ([65efe3d](https://github.com/context-dot-dev/context-dev-cli/commit/65efe3d9954b7d31dce3fac9e4db41bc054ef499)) +* **deps:** bump context-go-sdk to v1.4.0 for Monitors support ([4d95632](https://github.com/context-dot-dev/context-dev-cli/commit/4d956323f13357bdecae14c57fa47bcf7560b1a0)) +* **openapi:** strip empty-object defaults from the generated spec ([9cb38d9](https://github.com/context-dot-dev/context-dev-cli/commit/9cb38d9e7702224885e18d5060b151d9e9d2ae8e)) +* **webhooks:** format Slack webhook notifications ([#1045](https://github.com/context-dot-dev/context-dev-cli/issues/1045)) ([d7173ff](https://github.com/context-dot-dev/context-dev-cli/commit/d7173ff5eff964c53db99e59a4da62df112bdaba)) + + +### Chores + +* configure new SDK language ([e89b37b](https://github.com/context-dot-dev/context-dev-cli/commit/e89b37b1061f3d846832b13852a6a4117c49910b)) +* **internal:** codegen related update ([87780eb](https://github.com/context-dot-dev/context-dev-cli/commit/87780eb7d4bbb0df65fde3ecfbc74bfa191c04b7)) +* **internal:** codegen related update ([3c366ea](https://github.com/context-dot-dev/context-dev-cli/commit/3c366ea25e8f6ac84cbbe835a03bf3c8294831dc)) +* release 1.10.0 ([a874a70](https://github.com/context-dot-dev/context-dev-cli/commit/a874a70ab78e646ccf82a33d670daeed84282e81)) +* update SDK settings ([2cb5f95](https://github.com/context-dot-dev/context-dev-cli/commit/2cb5f95e56c35f5bf415999f877917625025e7ef)) + ## [1.11.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.10.0...v1.11.0) (2026-09-22) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index b5f5fd1..e85eb06 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.11.0" // x-release-please-version +const Version = "1.12.0" // x-release-please-version From 91f5c3c7da36587e173d306703a69df83c19be7f Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 22 Sep 2026 09:12:19 +0000 Subject: [PATCH 031/119] Build SDK Stainless-Generated-From: c0f6bc5bc4d338a2bf75ea76cac2a604853a96c3 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1ff0b9f..198bdf0 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.18.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.20.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 0eaf1b6..bfdb6b7 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.18.0 h1:Tnej3PXGPQq5HCepw5uiyG9mYa2lEoydUnyoWTzIRj0= -github.com/context-dot-dev/context-go-sdk/v2 v2.18.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.20.0 h1:9T5bbQJuZXMq7rdRAoDAVuCKNFQnY+2btiKLBd+4pl4= +github.com/context-dot-dev/context-go-sdk/v2 v2.20.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 2ed83fb006e021cfd3117bb1c8ebd7dd6b7faca4 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 26 Sep 2026 10:02:41 +0000 Subject: [PATCH 032/119] fix(openapi): document exclusive news filters (#1265) Stainless-Generated-From: df8494bdf27e144c22906c26e4acb76ca3a8bcd0 --- pkg/cmd/news.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/news.go b/pkg/cmd/news.go index 298e93b..2ae2f9d 100644 --- a/pkg/cmd/news.go +++ b/pkg/cmd/news.go @@ -16,7 +16,7 @@ import ( var newsSearch = requestflag.WithInnerFlags(cli.Command{ Name: "search", - Usage: "Searches live and historical company news for one company, identified in\nsearchBy by name, domain, ticker (optionally disambiguated by exchange), or\nISIN. Results can be filtered by publisher domain, publisher country, article\nlanguage, article type, and published-at date, and include stable story IDs,\nsource metadata, verified entity relevance, and cursor pagination.", + Usage: "Searches live and historical company news for one company, identified in\nsearchBy by name, domain, ticker (optionally disambiguated by exchange), or\nISIN. Results can be filtered by one of publisher domain, publisher country,\narticle language, or article type, optionally combined with a published-at date\nrange, and include stable story IDs, source metadata, verified entity relevance,\nand cursor pagination.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ @@ -32,7 +32,7 @@ var newsSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[map[string]any]{ Name: "filter-by", - Usage: "Optional result filters.", + Usage: "Optional result filters. Use at most one of sourceDomain, sourceCountry, articleLanguage, or articleType. A date range may accompany that category; date.from must not exceed date.to.", BodyPath: "filterBy", }, &requestflag.Flag[int64]{ @@ -81,7 +81,7 @@ var newsSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[map[string]any]{ Name: "filter-by.date", - Usage: "Published-at window in epoch milliseconds.", + Usage: "Published-at window in epoch milliseconds. from must be before or equal to to.", InnerField: "date", }, &requestflag.InnerFlag[[]string]{ From 3fc839d159980463cf821a727458358f740a1787 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 27 Sep 2026 08:50:19 +0000 Subject: [PATCH 033/119] docs(openapi): complete concise API reference metadata (#1329) Stainless-Generated-From: e8b23b8b7a08bce62afc0ce0e4beb3bf68e3e0d6 --- go.mod | 2 +- go.sum | 4 +- pkg/cmd/batch.go | 25 ++++----- pkg/cmd/brand.go | 16 +++--- pkg/cmd/industry.go | 26 +++++----- pkg/cmd/log.go | 4 +- pkg/cmd/monitor.go | 76 +++++++++++++++------------ pkg/cmd/news.go | 4 +- pkg/cmd/news_test.go | 8 +-- pkg/cmd/parse.go | 8 +-- pkg/cmd/person.go | 29 ++++++++--- pkg/cmd/utility.go | 12 ++--- pkg/cmd/utility_test.go | 6 +-- pkg/cmd/web.go | 104 ++++++++++++++++++------------------- pkg/cmd/web_test.go | 12 ++--- pkg/cmd/webhookdelivery.go | 18 +++---- 16 files changed, 191 insertions(+), 163 deletions(-) diff --git a/go.mod b/go.mod index 198bdf0..1a7a4b3 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.20.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.21.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index bfdb6b7..a11241d 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.20.0 h1:9T5bbQJuZXMq7rdRAoDAVuCKNFQnY+2btiKLBd+4pl4= -github.com/context-dot-dev/context-go-sdk/v2 v2.20.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.21.0 h1:RyxgrE5I/5meO98tcfdtHh69ZaVLoDedsbHAmabPTHY= +github.com/context-dot-dev/context-go-sdk/v2 v2.21.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index bdd9ee3..2e6a30d 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -16,12 +16,12 @@ import ( var batchRetrieve = cli.Command{ Name: "retrieve", - Usage: "Check progress, and get download links once the batch finishes.", + Usage: "Get batch progress and result download links. Result files are deleted 7 days\nafter the batch finishes.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "batch-id", - Usage: "ID of the batch to retrieve or cancel.", + Usage: "Batch ID.", Required: true, PathParam: "batch_id", }, @@ -32,7 +32,7 @@ var batchRetrieve = cli.Command{ var batchList = cli.Command{ Name: "list", - Usage: "List your batches from newest to oldest. Filter by status or continue with a\ncursor.", + Usage: "List your batches, newest first, with optional filters.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -72,12 +72,12 @@ var batchList = cli.Command{ var batchDelete = cli.Command{ Name: "delete", - Usage: "Permanently delete a finished batch and its stored results. Active batches must\nsettle first.", + Usage: "Permanently delete a finished batch and its results. Its webhook deliveries can\nno longer be retried.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "batch-id", - Usage: "ID of the batch to retrieve or cancel.", + Usage: "Batch ID.", Required: true, PathParam: "batch_id", }, @@ -88,12 +88,12 @@ var batchDelete = cli.Command{ var batchCancel = cli.Command{ Name: "cancel", - Usage: "Stop a batch from starting new pages. In-progress pages finish, and unused\ncredits are refunded.", + Usage: "Stop a batch from starting new pages. Pages already in progress finish before\nthe batch becomes cancelled.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "batch-id", - Usage: "ID of the batch to retrieve or cancel.", + Usage: "Batch ID.", Required: true, PathParam: "batch_id", }, @@ -104,12 +104,12 @@ var batchCancel = cli.Command{ var batchGetResults = cli.Command{ Name: "get-results", - Usage: "Page through a finished batch's results as JSON instead of downloading the\nNDJSON files.", + Usage: "Page through a finished batch’s results as JSON. Results remain available for 7\ndays.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "batch-id", - Usage: "ID of the batch to retrieve or cancel.", + Usage: "Batch ID.", Required: true, PathParam: "batch_id", }, @@ -130,7 +130,7 @@ var batchGetResults = cli.Command{ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ Name: "submit", - Usage: "Scrape 25K URLs or crawl large websites asynchronously.", + Usage: "Scrape up to 25,000 URLs, or crawl a site, asynchronously. Poll the batch ID or\nreceive a webhook when it finishes.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ @@ -146,7 +146,7 @@ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[map[string]any]{ Name: "webhook", - Usage: "Completion webhook settings. Cannot be combined with webhookUrl. Omitting retry preserves legacy delivery; retry: {} opts into durable retries.", + Usage: "Where to send the batch's final-status event. Omit `retry` for one attempt; `{}` uses the default retry schedule.", BodyPath: "webhook", }, &requestflag.Flag[string]{ @@ -156,7 +156,7 @@ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "idempotency-key", - Usage: "Any string unique to this submission. Retries with the same key return the original batch.", + Usage: "Unique key per submission. Retrying with the same key and body returns the original batch; a different body returns `409`.", HeaderPath: "Idempotency-Key", }, }, @@ -166,6 +166,7 @@ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ "webhook": { &requestflag.InnerFlag[string]{ Name: "webhook.url", + Usage: "Public HTTP(S) URL that receives batch completion, failure, or cancellation events.", InnerField: "url", }, &requestflag.InnerFlag[map[string]any]{ diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index 078d18a..d1fb04a 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -16,7 +16,7 @@ import ( var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ Name: "retrieve", - Usage: "Retrieve logos, backdrops, colors, industry, description, and more. Provide\nexactly one lookup identifier in the request body: a domain, company name, email\naddress, stock ticker, transaction descriptor, or direct URL. Note:\n`by_direct_url` fetches brand data only from the provided URL — not from the\nentire internet.", + Usage: "Retrieve logos, colors, company details, and social links using one lookup\nidentifier. A direct URL limits extraction to that page.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -37,7 +37,7 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[int64]{ Name: "max-age-ms", - Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms) are clamped to 1 year.", + Usage: "Maximum age of cached brand data in ms. Defaults to 3 months; clamped to 0–1 year. `0` refreshes.", BodyPath: "maxAgeMs", }, &requestflag.Flag[bool]{ @@ -47,12 +47,12 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", BodyPath: "timeoutOpts", }, &requestflag.Flag[string]{ @@ -117,12 +117,12 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag.`, InnerField: "behavior", }, }, @@ -130,7 +130,7 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ var brandSearch = cli.Command{ Name: "search", - Usage: "Search indexed brands by name or domain", + Usage: "Find up to 10 brands by name or domain, ordered by popularity. Use the returned\ndomain to retrieve a full brand profile.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -153,7 +153,7 @@ var brandSearch = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, &requestflag.Flag[int64]{ diff --git a/pkg/cmd/industry.go b/pkg/cmd/industry.go index daec276..50e974f 100644 --- a/pkg/cmd/industry.go +++ b/pkg/cmd/industry.go @@ -16,7 +16,7 @@ import ( var industryRetrieveNaics = requestflag.WithInnerFlags(cli.Command{ Name: "retrieve-naics", - Usage: "Classify any brand into 2022 NAICS industry codes from its domain or name.", + Usage: "Classify a company into NAICS industry codes.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -39,17 +39,17 @@ var industryRetrieveNaics = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", QueryPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", Default: "disabled", QueryPath: "zdr", }, @@ -60,12 +60,12 @@ var industryRetrieveNaics = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag.`, InnerField: "behavior", }, }, @@ -73,7 +73,7 @@ var industryRetrieveNaics = requestflag.WithInnerFlags(cli.Command{ var industryRetrieveSic = requestflag.WithInnerFlags(cli.Command{ Name: "retrieve-sic", - Usage: "Classify any brand into Standard Industrial Classification (SIC) codes from its\ndomain or name. Choose between the original SIC system (`original_sic`) or the\nlatest SIC list maintained by the SEC (`latest_sec`).", + Usage: "Classify a company into SIC industry codes.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -96,23 +96,23 @@ var industryRetrieveSic = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", QueryPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "type", - Usage: "Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Industrial Classification system; `latest_sec` uses the current SIC list as published by the SEC. Defaults to `original_sic`.", + Usage: "SIC dataset: `original_sic` (1987) or `latest_sec` (current SEC list).", Default: "original_sic", QueryPath: "type", }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", Default: "disabled", QueryPath: "zdr", }, @@ -123,12 +123,12 @@ var industryRetrieveSic = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag.`, InnerField: "behavior", }, }, diff --git a/pkg/cmd/log.go b/pkg/cmd/log.go index fe695b7..7b0c9de 100644 --- a/pkg/cmd/log.go +++ b/pkg/cmd/log.go @@ -16,7 +16,7 @@ import ( var logsRetrieve = cli.Command{ Name: "retrieve", - Usage: "Get one logged API call, including its request input and response body.", + Usage: "Retrieve a request’s metadata, retained input, and response.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -32,7 +32,7 @@ var logsRetrieve = cli.Command{ var logsList = cli.Command{ Name: "list", - Usage: "List your organization's API requests, newest first. Defaults to the last 24\nhours.", + Usage: "List your organization’s request logs with filters and pagination. Logs also\ninclude batch settlements and monitor runs.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index 054d9af..c3eb822 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -16,28 +16,29 @@ import ( var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ Name: "create", - Usage: "Creates a monitor. The request body is a union of the supported target/change\ndetection combinations. The monitor runs immediately after creation to create\nits initial baseline.", + Usage: "Watch a page, URL inventory, or extracted website data on a schedule. A run\nstarts immediately to capture the baseline.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "name", + Usage: "Display name for the monitor.", Required: true, BodyPath: "name", }, &requestflag.Flag[map[string]any]{ Name: "target", - Usage: "Discriminated union describing what the monitor watches.", + Usage: "What to watch: a page, a sitemap, or data extracted from a site.", Required: true, BodyPath: "target", }, &requestflag.Flag[map[string]any]{ Name: "change-detection", - Usage: "Discriminated union describing how changes are detected.", + Usage: "How changes are judged. Defaults to `semantic` for extract targets and page targets with `instructions`, otherwise `exact`.", BodyPath: "change_detection", }, &requestflag.Flag[string]{ Name: "mode", - Usage: "Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`.", + Usage: "Always `web`. Optional.", BodyPath: "mode", }, &requestflag.Flag[map[string]any]{ @@ -47,11 +48,12 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed.", + Usage: "Labels for filtering monitors, their changes, and their usage.", BodyPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "webhook", + Usage: "Webhook destination and delivery settings. Null means no webhook is configured.", BodyPath: "webhook", }, }, @@ -66,24 +68,24 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "schedule.type", - Usage: `Allowed values: "interval".`, + Usage: "Use `interval` to run on a repeating schedule.", InnerField: "type", }, &requestflag.InnerFlag[string]{ Name: "schedule.unit", - Usage: `Allowed values: "minutes", "hours", "days".`, + Usage: "Time unit used with `frequency` to set the run interval.", InnerField: "unit", }, }, "webhook": { &requestflag.InnerFlag[string]{ Name: "webhook.url", - Usage: "Webhook URL events are delivered to. Slack incoming webhook URLs are automatically formatted as Slack messages.", + Usage: "Public HTTP(S) URL that receives events. Slack and GovSlack URLs get formatted messages.", InnerField: "url", }, &requestflag.InnerFlag[[]string]{ Name: "webhook.events", - Usage: "Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `[\"change.detected\"]` when omitted.", + Usage: "Events to deliver. Defaults to `change.detected`; `run.completed` also includes unchanged runs.", InnerField: "events", }, &requestflag.InnerFlag[map[string]any]{ @@ -93,7 +95,7 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "webhook.secret", - Usage: "Signing secret used to verify webhook authenticity. Omitted unless the API key has monitors:write permission or full access. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `\"{t}.{rawRequestBody}\"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients.", + Usage: "API-generated signing secret. Visible only with full access or `monitors:write` permission.", InnerField: "secret", }, }, @@ -101,11 +103,12 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ var monitorsRetrieve = cli.Command{ Name: "retrieve", - Usage: "Get a monitor", + Usage: "Retrieve a monitor’s configuration and current state.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "monitor-id", + Usage: "ID of the monitor.", Required: true, PathParam: "monitor_id", }, @@ -116,21 +119,23 @@ var monitorsRetrieve = cli.Command{ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ Name: "update", - Usage: "Updates a monitor. If `target` or `change_detection` changes, the monitor\ncreates a new baseline. Unsupported target/change detection combinations are\nrejected.", + Usage: "Update a monitor. Changing its target or change detection replaces the baseline\nand queues a new baseline run.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "monitor-id", + Usage: "ID of the monitor.", Required: true, PathParam: "monitor_id", }, &requestflag.Flag[map[string]any]{ Name: "change-detection", - Usage: "Discriminated union describing how changes are detected.", + Usage: "How changes are judged. Defaults to `semantic` for extract targets and page targets with `instructions`, otherwise `exact`.", BodyPath: "change_detection", }, &requestflag.Flag[string]{ Name: "name", + Usage: "Display name for the monitor.", BodyPath: "name", }, &requestflag.Flag[map[string]any]{ @@ -140,22 +145,22 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "status", - Usage: `Allowed values: "active", "paused".`, + Usage: "Set `paused` to stop scheduled runs or `active` to resume them.", BodyPath: "status", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed.", + Usage: "Labels for filtering monitors, their changes, and their usage.", BodyPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "target", - Usage: "Discriminated union describing what the monitor watches.", + Usage: "What to watch: a page, a sitemap, or data extracted from a site.", BodyPath: "target", }, &requestflag.Flag[map[string]any]{ Name: "webhook", - Usage: "Set to null to remove the webhook.", + Usage: "Set to null to remove the webhook. Changing `url` issues a new secret.", BodyPath: "webhook", }, }, @@ -170,24 +175,24 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "schedule.type", - Usage: `Allowed values: "interval".`, + Usage: "Use `interval` to run on a repeating schedule.", InnerField: "type", }, &requestflag.InnerFlag[string]{ Name: "schedule.unit", - Usage: `Allowed values: "minutes", "hours", "days".`, + Usage: "Time unit used with `frequency` to set the run interval.", InnerField: "unit", }, }, "webhook": { &requestflag.InnerFlag[string]{ Name: "webhook.url", - Usage: "Webhook URL events are delivered to. Slack incoming webhook URLs are automatically formatted as Slack messages.", + Usage: "Public HTTP(S) URL that receives events. Slack and GovSlack URLs get formatted messages.", InnerField: "url", }, &requestflag.InnerFlag[[]string]{ Name: "webhook.events", - Usage: "Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `[\"change.detected\"]` when omitted.", + Usage: "Events to deliver. Defaults to `change.detected`; `run.completed` also includes unchanged runs.", InnerField: "events", }, &requestflag.InnerFlag[map[string]any]{ @@ -197,7 +202,7 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[string]{ Name: "webhook.secret", - Usage: "Signing secret used to verify webhook authenticity. Omitted unless the API key has monitors:write permission or full access. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `\"{t}.{rawRequestBody}\"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients.", + Usage: "API-generated signing secret. Visible only with full access or `monitors:write` permission.", InnerField: "secret", }, }, @@ -205,7 +210,7 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ var monitorsList = cli.Command{ Name: "list", - Usage: "Lists monitors for the authenticated organization. Supports free-text search\n(`q` over `search_by` fields, `prefix` or `exact` via `search_type`) plus\nstatus/type/tag filters. Results are paginated via the opaque `cursor`.", + Usage: "List your monitors with optional search and filters.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -230,7 +235,7 @@ var monitorsList = cli.Command{ }, &requestflag.Flag[any]{ Name: "search-by", - Usage: "Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors.", + Usage: "Fields to search with `q`. Defaults to all fields; page and extract targets can have instructions.", QueryPath: "search_by", }, &requestflag.Flag[string]{ @@ -265,11 +270,12 @@ var monitorsList = cli.Command{ var monitorsDelete = cli.Command{ Name: "delete", - Usage: "Delete a monitor", + Usage: "Delete a monitor and stop future runs and webhook retries.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "monitor-id", + Usage: "ID of the monitor.", Required: true, PathParam: "monitor_id", }, @@ -280,7 +286,7 @@ var monitorsDelete = cli.Command{ var monitorsGetCreditUsage = cli.Command{ Name: "get-credit-usage", - Usage: "Returns credits charged per monitor over an optional [since, until] window,\nnewest spenders first.", + Usage: "Return usage per monitor, highest first, for up to the 10,000 most recent runs\nin the requested window.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[any]{ @@ -300,7 +306,7 @@ var monitorsGetCreditUsage = cli.Command{ var monitorsGetLimits = cli.Command{ Name: "get-limits", - Usage: "Returns how many monitors the account has and the maximum it allows.", + Usage: "Retrieve your organization’s monitor allowance and usage.", Suggest: true, Flags: []cli.Flag{}, Action: handleMonitorsGetLimits, @@ -309,7 +315,7 @@ var monitorsGetLimits = cli.Command{ var monitorsListAccountChanges = cli.Command{ Name: "list-account-changes", - Usage: "Returns an account-wide feed of detected changes across monitors.", + Usage: "List full change records across your monitors, newest first.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -359,7 +365,7 @@ var monitorsListAccountChanges = cli.Command{ var monitorsListAccountRuns = cli.Command{ Name: "list-account-runs", - Usage: "Returns an account-wide feed of monitor runs across all monitors.", + Usage: "List runs across your monitors, newest first.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -384,11 +390,12 @@ var monitorsListAccountRuns = cli.Command{ var monitorsListChanges = cli.Command{ Name: "list-changes", - Usage: "List changes for a monitor", + Usage: "List full change records for a monitor, newest first.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "monitor-id", + Usage: "ID of the monitor.", Required: true, PathParam: "monitor_id", }, @@ -424,11 +431,12 @@ var monitorsListChanges = cli.Command{ var monitorsListRuns = cli.Command{ Name: "list-runs", - Usage: "List monitor runs", + Usage: "List a monitor’s runs, newest first.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "monitor-id", + Usage: "ID of the monitor.", Required: true, PathParam: "monitor_id", }, @@ -454,11 +462,12 @@ var monitorsListRuns = cli.Command{ var monitorsRetrieveChange = cli.Command{ Name: "retrieve-change", - Usage: "Get a change", + Usage: "Retrieve a detected change, including its diff and available evidence.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "change-id", + Usage: "ID of the detected change.", Required: true, PathParam: "change_id", }, @@ -469,11 +478,12 @@ var monitorsRetrieveChange = cli.Command{ var monitorsRun = cli.Command{ Name: "run", - Usage: "Triggers an immediate run of the monitor outside its normal schedule. The run is\nqueued and processed asynchronously.", + Usage: "Queue a run without changing the regular schedule. Paused monitors return 409.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "monitor-id", + Usage: "ID of the monitor.", Required: true, PathParam: "monitor_id", }, diff --git a/pkg/cmd/news.go b/pkg/cmd/news.go index 2ae2f9d..df39395 100644 --- a/pkg/cmd/news.go +++ b/pkg/cmd/news.go @@ -16,7 +16,7 @@ import ( var newsSearch = requestflag.WithInnerFlags(cli.Command{ Name: "search", - Usage: "Searches live and historical company news for one company, identified in\nsearchBy by name, domain, ticker (optionally disambiguated by exchange), or\nISIN. Results can be filtered by one of publisher domain, publisher country,\narticle language, or article type, optionally combined with a published-at date\nrange, and include stable story IDs, source metadata, verified entity relevance,\nand cursor pagination.", + Usage: "Find company news by name, domain, ticker, or ISIN. Filter articles and continue\nthrough results with a cursor.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ @@ -49,7 +49,7 @@ var newsSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, }, diff --git a/pkg/cmd/news_test.go b/pkg/cmd/news_test.go index 5260a23..965d0b7 100644 --- a/pkg/cmd/news_test.go +++ b/pkg/cmd/news_test.go @@ -16,7 +16,7 @@ func TestNewsSearch(t *testing.T) { t, "--api-key", "string", "news", "search", - "--search-by", "{entity: {name: xx, type: name}, type: entity}", + "--search-by", "{entity: {domain: stripe.com, type: domain}, type: entity}", "--cursor", "cursor", "--filter-by", "{articleLanguage: [ar], articleType: [editorial], date: {from: 0, to: 0}, sourceCountry: [ae], sourceDomain: [x]}", "--limit", "1", @@ -35,7 +35,7 @@ func TestNewsSearch(t *testing.T) { t, "--api-key", "string", "news", "search", - "--search-by.entity", "{name: xx, type: name}", + "--search-by.entity", "{domain: stripe.com, type: domain}", "--search-by.type", "entity", "--cursor", "cursor", "--filter-by.article-language", "[ar]", @@ -55,8 +55,8 @@ func TestNewsSearch(t *testing.T) { pipeData := []byte("" + "searchBy:\n" + " entity:\n" + - " name: xx\n" + - " type: name\n" + + " domain: stripe.com\n" + + " type: domain\n" + " type: entity\n" + "cursor: cursor\n" + "filterBy:\n" + diff --git a/pkg/cmd/parse.go b/pkg/cmd/parse.go index 0e41787..866d2bb 100644 --- a/pkg/cmd/parse.go +++ b/pkg/cmd/parse.go @@ -18,7 +18,7 @@ import ( var parseHandle = requestflag.WithInnerFlags(cli.Command{ Name: "handle", - Usage: "Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes\ninto LLM-usable Markdown.", + Usage: "Convert uploaded file bytes into Markdown and optional HTML.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -51,7 +51,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[bool]{ Name: "ocr", - Usage: "When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs.", + Usage: "Read text from images and scanned PDF pages. PDF page ranges still apply.", Default: false, QueryPath: "ocr", }, @@ -68,7 +68,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, &requestflag.Flag[bool]{ @@ -79,7 +79,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", Default: "disabled", QueryPath: "zdr", }, diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index b5c840b..1ab9162 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -16,46 +16,52 @@ import ( var peopleEnrich = requestflag.WithInnerFlags(cli.Command{ Name: "enrich", - Usage: "Finds and normalizes the best available person candidate from additive identity\nclues, then assigns an identity match score from 0 to 100. Available on all paid\nplans. Successful requests cost 20 credits. Disposable and free email addresses\n(like gmail.com, yahoo.com) will throw a 422 error.", + Usage: "Find a person from identity clues and return their profile with a match score.\nRequires a paid plan; free or disposable email addresses return 422.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ Name: "company", + Usage: "Company context to help identify the person. Provide a name or domain.", BodyPath: "company", }, &requestflag.Flag[[]map[string]any]{ Name: "education", + Usage: "Education history to help distinguish people with similar names.", BodyPath: "education", }, &requestflag.Flag[string]{ Name: "email", + Usage: "Email address of the person to find.", BodyPath: "email", }, &requestflag.Flag[map[string]any]{ Name: "location", + Usage: "Location context to help identify the person. Provide a city, region, or country.", BodyPath: "location", }, &requestflag.Flag[map[string]any]{ Name: "name", + Usage: "Person name. Without an email or person-profile URL, provide both first and last name plus company, education, or location.", BodyPath: "name", }, &requestflag.Flag[[]string]{ Name: "social-url", + Usage: "Public profile URLs for the person. A person-profile URL can identify the person without a name.", BodyPath: "social_urls", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", BodyPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", BodyPath: "zdr", }, }, @@ -65,64 +71,75 @@ var peopleEnrich = requestflag.WithInnerFlags(cli.Command{ "company": { &requestflag.InnerFlag[string]{ Name: "company.domain", + Usage: "Website domain of a company associated with the person.", InnerField: "domain", }, &requestflag.InnerFlag[string]{ Name: "company.name", + Usage: "Name of a company associated with the person.", InnerField: "name", }, }, "education": { &requestflag.InnerFlag[string]{ Name: "education.degree", + Usage: "Degree or qualification earned.", InnerField: "degree", }, &requestflag.InnerFlag[string]{ Name: "education.field-of-study", + Usage: "Subject or major studied.", InnerField: "field_of_study", }, &requestflag.InnerFlag[int64]{ Name: "education.graduation-year", + Usage: "Four-digit graduation year.", InnerField: "graduation_year", }, &requestflag.InnerFlag[map[string]any]{ Name: "education.institution", + Usage: "School or university, identified by name or domain.", InnerField: "institution", }, }, "location": { &requestflag.InnerFlag[string]{ Name: "location.city", + Usage: "City associated with the person.", InnerField: "city", }, &requestflag.InnerFlag[string]{ Name: "location.country", + Usage: "Country associated with the person.", InnerField: "country", }, &requestflag.InnerFlag[string]{ Name: "location.region", + Usage: "State, province, or region associated with the person.", InnerField: "region", }, }, "name": { &requestflag.InnerFlag[string]{ Name: "name.first", + Usage: "First or given name.", InnerField: "first", }, &requestflag.InnerFlag[string]{ Name: "name.last", + Usage: "Last or family name.", InnerField: "last", }, }, "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag.`, InnerField: "behavior", }, }, diff --git a/pkg/cmd/utility.go b/pkg/cmd/utility.go index 9d57c63..5520fb0 100644 --- a/pkg/cmd/utility.go +++ b/pkg/cmd/utility.go @@ -16,7 +16,7 @@ import ( var utilityPrefetch = requestflag.WithInnerFlags(cli.Command{ Name: "prefetch", - Usage: "Signal that you may fetch data soon to improve latency. The type field selects\nwhat to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a\nstyleguide extraction) and identifier carries exactly one lookup key: a domain,\nor an email whose domain is extracted and validated (free email providers and\ndisposable email addresses are not allowed).", + Usage: "Queue brand or styleguide data so a later lookup can return sooner.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ @@ -27,18 +27,18 @@ var utilityPrefetch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "type", - Usage: "What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the styleguide cache.", + Usage: "Data to prefetch.", Required: true, BodyPath: "type", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", BodyPath: "timeoutOpts", }, }, @@ -48,12 +48,12 @@ var utilityPrefetch = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. This endpoint supports "fail": return 408 REQUEST_TIMEOUT without charging credits.`, + Usage: `Only "fail" is supported: return 408 at the deadline.`, InnerField: "behavior", }, }, diff --git a/pkg/cmd/utility_test.go b/pkg/cmd/utility_test.go index c7f4816..e8173be 100644 --- a/pkg/cmd/utility_test.go +++ b/pkg/cmd/utility_test.go @@ -16,7 +16,7 @@ func TestUtilityPrefetch(t *testing.T) { t, "--api-key", "string", "utility", "prefetch", - "--identifier", "{domain: xxx}", + "--identifier", "{domain: stripe.com}", "--type", "brand", "--tag", "production", "--tag", "team-alpha", @@ -33,7 +33,7 @@ func TestUtilityPrefetch(t *testing.T) { t, "--api-key", "string", "utility", "prefetch", - "--identifier", "{domain: xxx}", + "--identifier", "{domain: stripe.com}", "--type", "brand", "--tag", "production", "--tag", "team-alpha", @@ -46,7 +46,7 @@ func TestUtilityPrefetch(t *testing.T) { // Test piping YAML data over stdin pipeData := []byte("" + "identifier:\n" + - " domain: xxx\n" + + " domain: stripe.com\n" + "type: brand\n" + "tags:\n" + " - production\n" + diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index af76a5e..29592d0 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -16,38 +16,38 @@ import ( var webAnswers = requestflag.WithInnerFlags(cli.Command{ Name: "answers", - Usage: "Researches the live web and returns a sourced answer in your requested JSON\nshape. Select fast for a smaller research budget at 10 credits or ultra for\ndeeper reasoning at 100 credits. Defaults to ultra. Fast research is limited to\n30 seconds and ultra to 50 seconds; timeoutOpts.milliseconds can shorten either\ndeadline.", + Usage: "Research the web and return a sourced answer in your JSON shape. Choose `fast`\nfor a short task or `ultra` for deeper research.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "task", - Usage: `What to research and answer, in plain language. Naming a domain in the task (for example "pricing on context.dev") makes the agent read that site before it searches.`, + Usage: "Research task. Name a domain to have it read before searching.", Required: true, BodyPath: "task", }, &requestflag.Flag[map[string]any]{ Name: "json-format", - Usage: `An example object with placeholder values (for example {"pricing_page_url": "", "plans": [{"name": "", "price": 0}]}). Object keys and value types are preserved; unknown values may be null. Empty arrays accept any JSON items. Defaults to {"result": ""}. Maximum 8 levels, 500 values, and 16000 characters.`, + Usage: "Example answer object, not JSON Schema. Up to 8 levels, 500 values, and 16000 characters; unknowns may be null.", BodyPath: "json_format", }, &requestflag.Flag[string]{ Name: "mode", - Usage: "Research level: fast uses a smaller model and research budget for 10 credits; ultra uses deeper reasoning and research for 100 credits. Defaults to ultra. Only successful requests consume credits.", + Usage: "`fast` for short tasks; `ultra` for deeper research (default).", BodyPath: "mode", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", BodyPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", BodyPath: "zdr", }, }, @@ -57,12 +57,12 @@ var webAnswers = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag.`, InnerField: "behavior", }, }, @@ -87,17 +87,17 @@ var webExtractCompetitors = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", QueryPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", Default: "disabled", QueryPath: "zdr", }, @@ -108,12 +108,12 @@ var webExtractCompetitors = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag.`, InnerField: "behavior", }, }, @@ -121,7 +121,7 @@ var webExtractCompetitors = requestflag.WithInnerFlags(cli.Command{ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ Name: "extract-styleguide", - Usage: "Extract a comprehensive design system from a website including colors,\ntypography, spacing, shadows, and UI components.", + Usage: "Extract colors, typography, spacing, and component styles from a website.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -131,7 +131,7 @@ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "direct-url", - Usage: "A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both.", + Usage: "Exact URL to inspect. Provide either `domain` or `directUrl`, not both.", QueryPath: "directUrl", }, &requestflag.Flag[string]{ @@ -141,23 +141,23 @@ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[*int64]{ Name: "max-age-ms", - Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms) are clamped to 1 year.", + Usage: "Maximum age of cached brand data in ms. Defaults to 3 months; clamped to 0–1 year. `0` refreshes.", Default: requestflag.Ptr[int64](7776000000), QueryPath: "maxAgeMs", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", QueryPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", Default: "disabled", QueryPath: "zdr", }, @@ -168,12 +168,12 @@ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag. "return-partial" requires at least 5000 ms.`, InnerField: "behavior", }, }, @@ -197,7 +197,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "country", - Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", + Usage: "Fetch from this country (ISO 3166-1 alpha-2).", QueryPath: "country", }, &requestflag.Flag[string]{ @@ -244,12 +244,12 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", QueryPath: "timeoutOpts", }, &requestflag.Flag[map[string]any]{ @@ -266,7 +266,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", Default: "disabled", QueryPath: "zdr", }, @@ -277,12 +277,12 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results. "return-partial" requires milliseconds of at least 5000.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag. "return-partial" requires at least 5000 ms.`, InnerField: "behavior", }, }, @@ -302,7 +302,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ var webSearch = requestflag.WithInnerFlags(cli.Command{ Name: "search", - Usage: "Search the web and optionally scrape each result to Markdown in one round-trip.", + Usage: "Search the web and optionally return page content with each result.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -344,22 +344,22 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[bool]{ Name: "query-fanout", - Usage: "Expand the query into multiple parallel variants for broader recall.", + Usage: "Currently has no effect.", BodyPath: "queryFanout", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", BodyPath: "timeoutOpts", }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Asset uploads are skipped, so hosted image URLs are omitted. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", Default: "disabled", BodyPath: "zdr", }, @@ -405,7 +405,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[map[string]any]{ Name: "markdown-options.timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", InnerField: "timeoutOpts", }, &requestflag.InnerFlag[bool]{ @@ -422,12 +422,12 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag.`, InnerField: "behavior", }, }, @@ -435,23 +435,23 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ Name: "web-crawl-md", - Usage: "Performs a crawl starting from a given URL, extracts page content as Markdown,\nand returns results for all crawled pages.", + Usage: "Crawl a website and return page content as Markdown. Use a batch for crawls\nbeyond 500 pages.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "url", - Usage: "The starting URL for the crawl (must include http:// or https:// protocol)", + Usage: "Start URL, including `http://` or `https://`.", Required: true, BodyPath: "url", }, &requestflag.Flag[string]{ Name: "country", - Usage: "Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).", + Usage: "Fetch from this country (ISO 3166-1 alpha-2).", BodyPath: "country", }, &requestflag.Flag[[]string]{ Name: "exclude-selector", - Usage: `CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".`, + Usage: "Remove matching elements after inclusions. Exclusions take precedence.", BodyPath: "excludeSelectors", }, &requestflag.Flag[bool]{ @@ -480,12 +480,12 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "include-selector", - Usage: `CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before each crawled page is converted to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]".`, + Usage: "Keep matching HTML subtrees before converting each page to Markdown.", BodyPath: "includeSelectors", }, &requestflag.Flag[int64]{ Name: "max-age-ms", - Usage: "Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.", + Usage: "Maximum cache age in milliseconds. Defaults to 1 day; `0` fetches fresh.", Default: 86400000, BodyPath: "maxAgeMs", }, @@ -496,19 +496,19 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[int64]{ Name: "max-pages", - Usage: "Maximum number of pages to crawl. Hard cap: 500.", + Usage: "Maximum pages to crawl.", Default: 100, BodyPath: "maxPages", }, &requestflag.Flag[map[string]any]{ Name: "pdf", - Usage: "PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.", + Usage: "PDF handling. `start`/`end` limit parsing to an inclusive, 1-based page range.", Default: map[string]any{"shouldParse": true, "ocr": false}, BodyPath: "pdf", }, &requestflag.Flag[bool]{ Name: "settle-animations", - Usage: "When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.", + Usage: "Wait briefly for CSS animations and transitions to settle before reading each page.", Default: false, BodyPath: "settleAnimations", }, @@ -520,18 +520,18 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[int64]{ Name: "stop-after-ms", - Usage: "Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s).", + Usage: "Soft crawl deadline in milliseconds. Returns pages collected before the next deadline check.", Default: 80000, BodyPath: "stopAfterMs", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, &requestflag.Flag[map[string]any]{ Name: "timeout-opts", - Usage: "Optional request deadline and behavior on timeout. For GET requests, use timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded timeoutOpts object.", + Usage: "Request deadline and what to return when it passes.", BodyPath: "timeoutOpts", }, &requestflag.Flag[string]{ @@ -553,7 +553,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", Default: "disabled", BodyPath: "zdr", }, @@ -569,7 +569,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[bool]{ Name: "pdf.ocr", - Usage: "When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost.", + Usage: "Read scanned PDF pages with OCR; preserve pages that already contain text.", InnerField: "ocr", }, &requestflag.InnerFlag[bool]{ @@ -586,12 +586,12 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ "timeout-opts": { &requestflag.InnerFlag[int64]{ Name: "timeout-opts.milliseconds", - Usage: "Request deadline in milliseconds. Maximum: 300000 (5 minutes).", + Usage: "Deadline in milliseconds.", InnerField: "milliseconds", }, &requestflag.InnerFlag[string]{ Name: "timeout-opts.behavior", - Usage: `What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging credits. "return-partial" returns usable results collected so far; if none are available, the request still fails without charging credits. Partial results are not cached as complete results.`, + Usage: `"fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag.`, InnerField: "behavior", }, }, diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index ff88f38..c316bd9 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -211,7 +211,7 @@ func TestWebSearch(t *testing.T) { t, "--api-key", "string", "web", "search", - "--query", "x", + "--query", "Stripe API authentication", "--country", "af", "--exclude-domain", "string", "--freshness", "last_24_hours", @@ -235,7 +235,7 @@ func TestWebSearch(t *testing.T) { t, "--api-key", "string", "web", "search", - "--query", "x", + "--query", "Stripe API authentication", "--country", "af", "--exclude-domain", "string", "--freshness", "last_24_hours", @@ -263,7 +263,7 @@ func TestWebSearch(t *testing.T) { t.Run("piping data", func(t *testing.T) { // Test piping YAML data over stdin pipeData := []byte("" + - "query: x\n" + + "query: Stripe API authentication\n" + "country: af\n" + "excludeDomains:\n" + " - string\n" + @@ -320,7 +320,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--include-selector", "string", "--max-age-ms", "0", "--max-depth", "0", - "--max-pages", "1", + "--max-pages", "10", "--pdf", "{end: 1, ocr: true, shouldParse: true, start: 1}", "--settle-animations=true", "--shorten-base64-images=true", @@ -354,7 +354,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--include-selector", "string", "--max-age-ms", "0", "--max-depth", "0", - "--max-pages", "1", + "--max-pages", "10", "--pdf.end", "1", "--pdf.ocr=true", "--pdf.should-parse=true", @@ -388,7 +388,7 @@ func TestWebWebCrawlMd(t *testing.T) { " - string\n" + "maxAgeMs: 0\n" + "maxDepth: 0\n" + - "maxPages: 1\n" + + "maxPages: 10\n" + "pdf:\n" + " end: 1\n" + " ocr: true\n" + diff --git a/pkg/cmd/webhookdelivery.go b/pkg/cmd/webhookdelivery.go index 5922f5b..4ed29e1 100644 --- a/pkg/cmd/webhookdelivery.go +++ b/pkg/cmd/webhookdelivery.go @@ -16,7 +16,7 @@ import ( var webhooksDeliveriesRetrieve = cli.Command{ Name: "retrieve", - Usage: "Get a webhook delivery, including its status and latest attempt.", + Usage: "Retrieve a webhook delivery’s status and original payload.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -27,7 +27,7 @@ var webhooksDeliveriesRetrieve = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, }, @@ -37,7 +37,7 @@ var webhooksDeliveriesRetrieve = cli.Command{ var webhooksDeliveriesList = cli.Command{ Name: "list", - Usage: "List your batch or monitor webhook deliveries, newest first.", + Usage: "List batch and monitor webhook deliveries from the last 30 days.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -74,7 +74,7 @@ var webhooksDeliveriesList = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, &requestflag.Flag[string]{ @@ -94,7 +94,7 @@ var webhooksDeliveriesList = cli.Command{ var webhooksDeliveriesListAttempts = cli.Command{ Name: "list-attempts", - Usage: "List delivery attempts, newest first.", + Usage: "List a delivery’s attempts, newest first.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -116,7 +116,7 @@ var webhooksDeliveriesListAttempts = cli.Command{ }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50 characters.", + Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", QueryPath: "tags", }, }, @@ -126,7 +126,7 @@ var webhooksDeliveriesListAttempts = cli.Command{ var webhooksDeliveriesRetry = cli.Command{ Name: "retry", - Usage: "Retry a webhook delivery within seven days of creation.", + Usage: "Resend the original payload using the source’s current URL and secret. Available\nfor 7 days after the event.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -137,12 +137,12 @@ var webhooksDeliveriesRetry = cli.Command{ }, &requestflag.Flag[bool]{ Name: "force", - Usage: "Resend a delivery that already succeeded.", + Usage: "Resend even if the delivery already succeeded. Defaults to false.", BodyPath: "force", }, &requestflag.Flag[[]string]{ Name: "tag", - Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, &requestflag.Flag[string]{ From 89aa64eab8bd67244f8cb3c3c8a6135eec6d028b Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 27 Sep 2026 09:42:14 +0000 Subject: [PATCH 034/119] feat(answers): route people and company research with faster answers (#1336) Stainless-Generated-From: a6bae843bab75b27866f14f5a61be549e526844d --- pkg/cmd/web.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 29592d0..ed3e047 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -21,7 +21,7 @@ var webAnswers = requestflag.WithInnerFlags(cli.Command{ Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "task", - Usage: "Research task. Name a domain to have it read before searching.", + Usage: "Research task. The agent selects company/profile lookups, web searches, or page reads. Include domains or URLs to focus the research.", Required: true, BodyPath: "task", }, @@ -32,7 +32,7 @@ var webAnswers = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "mode", - Usage: "`fast` for short tasks; `ultra` for deeper research (default).", + Usage: "`fast` prioritizes speed, with extra verification for people and companies; `ultra` supports deeper research (default).", BodyPath: "mode", }, &requestflag.Flag[[]string]{ From 1cf2e4a95e62219aa6c70ceafed49d9d133ea70d Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 28 Sep 2026 05:42:20 +0000 Subject: [PATCH 035/119] feat(monitors): support browser actions on page monitors (#1365) Stainless-Generated-From: 0a4844c8613c79b71621cabb3e683a7aaf6ddc22 --- pkg/cmd/monitor_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/monitor_test.go b/pkg/cmd/monitor_test.go index 67a43ac..c784627 100644 --- a/pkg/cmd/monitor_test.go +++ b/pkg/cmd/monitor_test.go @@ -17,7 +17,7 @@ func TestMonitorsCreate(t *testing.T) { "--api-key", "string", "monitors", "create", "--name", "Acme pricing page", - "--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, + "--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--change-detection", "{type: exact}", "--mode", "web", "--schedule", "{frequency: 6, type: interval, unit: hours}", @@ -37,7 +37,7 @@ func TestMonitorsCreate(t *testing.T) { "--api-key", "string", "monitors", "create", "--name", "Acme pricing page", - "--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, + "--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--change-detection", "{type: exact}", "--mode", "web", "--schedule.frequency", "6", @@ -58,6 +58,9 @@ func TestMonitorsCreate(t *testing.T) { "target:\n" + " type: page\n" + " url: https://acme.com/pricing\n" + + " actions:\n" + + " - do: wait\n" + + " timeMs: 0\n" + " exclude_selectors:\n" + " - .carousel\n" + " - '[id^=\"TA_\"]'\n" + @@ -125,7 +128,7 @@ func TestMonitorsUpdate(t *testing.T) { "--status", "active", "--tag", "pricing", "--tag", "competitor", - "--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, + "--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed], retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", ) }) @@ -148,7 +151,7 @@ func TestMonitorsUpdate(t *testing.T) { "--status", "active", "--tag", "pricing", "--tag", "competitor", - "--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, + "--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--webhook.url", "https://example.com/webhook", "--webhook.events", "[change.detected, run.completed]", "--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}", @@ -172,6 +175,9 @@ func TestMonitorsUpdate(t *testing.T) { "target:\n" + " type: page\n" + " url: https://acme.com/pricing\n" + + " actions:\n" + + " - do: wait\n" + + " timeMs: 0\n" + " exclude_selectors:\n" + " - .carousel\n" + " - '[id^=\"TA_\"]'\n" + From b5ffb309e99c714c38946f528eccb26ed9d3f792 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 28 Sep 2026 23:26:08 +0000 Subject: [PATCH 036/119] feat(search): add highlights to web search and bill page reads per 10 results (#1387) Stainless-Generated-From: 7d693fe87de6b88c0cba43bc1c5ac60958ece31c --- pkg/cmd/web.go | 23 ++++++++++++++++++++--- pkg/cmd/web_test.go | 6 ++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index ed3e047..4635ce5 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -302,7 +302,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ var webSearch = requestflag.WithInnerFlags(cli.Command{ Name: "search", - Usage: "Search the web and optionally return page content with each result.", + Usage: "Search the web and optionally return page content or relevant passages with each\nresult.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -326,6 +326,11 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Restrict results to content published within this window.", BodyPath: "freshness", }, + &requestflag.Flag[map[string]any]{ + Name: "highlights-options", + Usage: "Passages from each result page that are relevant to the query. Pages are read with the `markdownOptions` settings.", + BodyPath: "highlightsOptions", + }, &requestflag.Flag[[]string]{ Name: "include-domain", Usage: `Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"].`, @@ -367,10 +372,22 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Action: handleWebSearch, HideHelpCommand: true, }, map[string][]requestflag.HasOuterFlag{ + "highlights-options": { + &requestflag.InnerFlag[bool]{ + Name: "highlights-options.enabled", + Usage: "Return relevant passages for each result. Adds 1 credit per 10 results.", + InnerField: "enabled", + }, + &requestflag.InnerFlag[int64]{ + Name: "highlights-options.max-characters", + Usage: "Maximum combined length of passages per result.", + InnerField: "maxCharacters", + }, + }, "markdown-options": { &requestflag.InnerFlag[bool]{ Name: "markdown-options.enabled", - Usage: "Scrape each result to Markdown. Off by default to keep search cheap and fast.", + Usage: "Scrape each result to Markdown. Adds 1 credit per 10 results.", InnerField: "enabled", }, &requestflag.InnerFlag[bool]{ @@ -390,7 +407,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[int64]{ Name: "markdown-options.max-age-ms", - Usage: "Cache TTL in ms for scraped Markdown keyed by URL + options. Default 1 day, max 30 days. Set to 0 to force a fresh scrape.", + Usage: "Cache TTL in ms for scraped Markdown keyed by URL + options. Default 15 days, max 30 days. Set to 0 to force a fresh scrape.", InnerField: "maxAgeMs", }, &requestflag.InnerFlag[map[string]any]{ diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index c316bd9..c7364db 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -215,6 +215,7 @@ func TestWebSearch(t *testing.T) { "--country", "af", "--exclude-domain", "string", "--freshness", "last_24_hours", + "--highlights-options", "{enabled: true, maxCharacters: 100}", "--include-domain", "string", "--markdown-options", "{enabled: true, includeFrames: true, includeImages: true, includeLinks: true, maxAgeMs: 0, pdf: {end: 1, shouldParse: true, start: 1}, shortenBase64Images: true, timeoutOpts: {milliseconds: 1, behavior: fail}, useMainContentOnly: true, waitForMs: 0}", "--num-results", "10", @@ -239,6 +240,8 @@ func TestWebSearch(t *testing.T) { "--country", "af", "--exclude-domain", "string", "--freshness", "last_24_hours", + "--highlights-options.enabled=true", + "--highlights-options.max-characters", "100", "--include-domain", "string", "--markdown-options.enabled=true", "--markdown-options.include-frames=true", @@ -268,6 +271,9 @@ func TestWebSearch(t *testing.T) { "excludeDomains:\n" + " - string\n" + "freshness: last_24_hours\n" + + "highlightsOptions:\n" + + " enabled: true\n" + + " maxCharacters: 100\n" + "includeDomains:\n" + " - string\n" + "markdownOptions:\n" + From 6635afc3531000dc1baab3e7633ea0010002d3e8 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 29 Sep 2026 05:21:39 +0000 Subject: [PATCH 037/119] fix(api): document search domain limits and clarify scrape parameter errors (#1388) Stainless-Generated-From: e4f66a3062aed45e61cbb72502f74861a44c22f5 --- pkg/cmd/web.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 4635ce5..a467b2d 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -318,7 +318,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "exclude-domain", - Usage: `Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"].`, + Usage: `Blocklist — drop results from these domains. Up to 100 domains. Example: ["pinterest.com", "reddit.com"].`, BodyPath: "excludeDomains", }, &requestflag.Flag[string]{ @@ -333,7 +333,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[[]string]{ Name: "include-domain", - Usage: `Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"].`, + Usage: `Allowlist — only return results from these domains. Up to 100 domains. Example: ["arxiv.org", "github.com"].`, BodyPath: "includeDomains", }, &requestflag.Flag[map[string]any]{ From 4cb3f9c58f33795255532994e6c2e48a5245164a Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 29 Sep 2026 07:13:20 +0000 Subject: [PATCH 038/119] feat(web-search): extend page cache defaults (#1408) Stainless-Generated-From: 513ed58a67cd7f746937206d8b71550605762ec8 --- pkg/cmd/web.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index a467b2d..5eb615e 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -407,7 +407,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[int64]{ Name: "markdown-options.max-age-ms", - Usage: "Cache TTL in ms for scraped Markdown keyed by URL + options. Default 15 days, max 30 days. Set to 0 to force a fresh scrape.", + Usage: "Maximum cache age in milliseconds for result page content. Defaults to 180 days (15552000000 ms) when Markdown is requested, or 365 days (31536000000 ms) when only highlights are requested. Explicit values override either default. Maximum: 365 days. Set to 0 to force a fresh scrape.", InnerField: "maxAgeMs", }, &requestflag.InnerFlag[map[string]any]{ From a3d1b5805b673c421b3e97e54d614881e214ec2d Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 29 Sep 2026 20:32:52 +0000 Subject: [PATCH 039/119] feat(scrape): default POST /web/scrape deadline to 90s (#1428) Stainless-Generated-From: 178e5697df19fe7160e38d1ee951a1fd6b607c70 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1a7a4b3..c3f0473 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.21.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.22.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index a11241d..868dd04 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.21.0 h1:RyxgrE5I/5meO98tcfdtHh69ZaVLoDedsbHAmabPTHY= -github.com/context-dot-dev/context-go-sdk/v2 v2.21.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.22.0 h1:Jb7daCPGozCILiQS73Hlg/tshotI9+oSUIyfioMIGBI= +github.com/context-dot-dev/context-go-sdk/v2 v2.22.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 022ab81fcac23c5f4c11caf68d9af2959b933ade Mon Sep 17 00:00:00 2001 From: contextualbeer Date: Tue, 29 Sep 2026 22:36:15 +0200 Subject: [PATCH 040/119] release: 1.13.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 22 ++++++++++++++++++++++ pkg/cmd/version.go | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index de0960a..f94eeca 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.12.0" + ".": "1.13.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fe9ff30..2a853b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [1.13.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.12.0...v1.13.0) (2026-09-29) + + +### Features + +* **answers:** route people and company research with faster answers ([#1336](https://github.com/context-dot-dev/context-dev-cli/issues/1336)) ([89aa64e](https://github.com/context-dot-dev/context-dev-cli/commit/89aa64eab8bd67244f8cb3c3c8a6135eec6d028b)) +* **monitors:** support browser actions on page monitors ([#1365](https://github.com/context-dot-dev/context-dev-cli/issues/1365)) ([1cf2e4a](https://github.com/context-dot-dev/context-dev-cli/commit/1cf2e4a95e62219aa6c70ceafed49d9d133ea70d)) +* **scrape:** default POST /web/scrape deadline to 90s ([#1428](https://github.com/context-dot-dev/context-dev-cli/issues/1428)) ([a3d1b58](https://github.com/context-dot-dev/context-dev-cli/commit/a3d1b5805b673c421b3e97e54d614881e214ec2d)) +* **search:** add highlights to web search and bill page reads per 10 results ([#1387](https://github.com/context-dot-dev/context-dev-cli/issues/1387)) ([b5ffb30](https://github.com/context-dot-dev/context-dev-cli/commit/b5ffb309e99c714c38946f528eccb26ed9d3f792)) +* **web-search:** extend page cache defaults ([#1408](https://github.com/context-dot-dev/context-dev-cli/issues/1408)) ([4cb3f9c](https://github.com/context-dot-dev/context-dev-cli/commit/4cb3f9c58f33795255532994e6c2e48a5245164a)) + + +### Bug Fixes + +* **api:** document search domain limits and clarify scrape parameter errors ([#1388](https://github.com/context-dot-dev/context-dev-cli/issues/1388)) ([6635afc](https://github.com/context-dot-dev/context-dev-cli/commit/6635afc3531000dc1baab3e7633ea0010002d3e8)) +* **openapi:** document exclusive news filters ([#1265](https://github.com/context-dot-dev/context-dev-cli/issues/1265)) ([2ed83fb](https://github.com/context-dot-dev/context-dev-cli/commit/2ed83fb006e021cfd3117bb1c8ebd7dd6b7faca4)) + + +### Documentation + +* **openapi:** complete concise API reference metadata ([#1329](https://github.com/context-dot-dev/context-dev-cli/issues/1329)) ([3fc839d](https://github.com/context-dot-dev/context-dev-cli/commit/3fc839d159980463cf821a727458358f740a1787)) + ## [1.12.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.11.0...v1.12.0) (2026-09-22) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index e85eb06..3852d60 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.12.0" // x-release-please-version +const Version = "1.13.0" // x-release-please-version From 9d63939d08a20d32642a84788bf47d2c971979ff Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 30 Sep 2026 07:48:35 +0000 Subject: [PATCH 041/119] fix(api): derive OpenAPI request docs from runtime Zod schemas (#1421) Stainless-Generated-From: dcaa0d58f6d6520bde41b322dbade51f950e35b7 --- pkg/cmd/batch.go | 6 ++++-- pkg/cmd/batch_test.go | 8 ++++---- pkg/cmd/brand.go | 4 ++-- pkg/cmd/parse.go | 4 ++-- pkg/cmd/web.go | 24 ++++++++++++------------ pkg/cmd/web_test.go | 24 ++++++++++++------------ pkg/cmd/webhookdelivery.go | 1 + 7 files changed, 37 insertions(+), 34 deletions(-) diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index 2e6a30d..6c295bd 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -43,6 +43,7 @@ var batchList = cli.Command{ &requestflag.Flag[int64]{ Name: "limit", Usage: "Batches per page. Defaults to 25.", + Default: 25, QueryPath: "limit", }, &requestflag.Flag[string]{ @@ -60,9 +61,9 @@ var batchList = cli.Command{ Usage: "Filter by status.", QueryPath: "status", }, - &requestflag.Flag[string]{ + &requestflag.Flag[any]{ Name: "tags", - Usage: "Comma-separated list of tags to filter by (matches batches having any of them).", + Usage: "Tags to filter by (matches batches having any of them). Pass repeated `tags` params or one comma-separated list, e.g. `tags=docs,competitor`.", QueryPath: "tags", }, }, @@ -121,6 +122,7 @@ var batchGetResults = cli.Command{ &requestflag.Flag[int64]{ Name: "limit", Usage: "Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records.", + Default: 25, QueryPath: "limit", }, }, diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index eb892b7..fe59e68 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -70,7 +70,7 @@ func TestBatchGetResults(t *testing.T) { "--api-key", "string", "batch", "get-results", "--batch-id", "batch_9f2c8a", - "--cursor", "cursor", + "--cursor", "321669910225:155771193", "--limit", "1", ) }) @@ -87,7 +87,7 @@ func TestBatchSubmit(t *testing.T) { "--tag", "docs", "--tag", "competitor", "--webhook", "{url: https://example.com, retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", - "--webhook-url", "webhookUrl", + "--webhook-url", "https://example.com", "--idempotency-key", "Idempotency-Key", ) }) @@ -106,7 +106,7 @@ func TestBatchSubmit(t *testing.T) { "--tag", "competitor", "--webhook.url", "https://example.com", "--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}", - "--webhook-url", "webhookUrl", + "--webhook-url", "https://example.com", "--idempotency-key", "Idempotency-Key", ) }) @@ -160,7 +160,7 @@ func TestBatchSubmit(t *testing.T) { " - 7200\n" + " - 21600\n" + " - 57600\n" + - "webhookUrl: webhookUrl\n") + "webhookUrl: https://example.com\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index d1fb04a..f4f4dd7 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -62,7 +62,7 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "country-gl", - Usage: "Optional country code hint (GL parameter) to specify the country when looking up by company name.", + Usage: "Two-letter ISO 3166-1 alpha-2 country code (GL parameter) used to localize search.", BodyPath: "country_gl", }, &requestflag.Flag[string]{ @@ -77,7 +77,7 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "ticker-exchange", - Usage: "Optional stock exchange for the ticker. Defaults to NASDAQ if not specified.", + Usage: "Stock exchange code.", BodyPath: "ticker_exchange", }, &requestflag.Flag[string]{ diff --git a/pkg/cmd/parse.go b/pkg/cmd/parse.go index 866d2bb..149f8b4 100644 --- a/pkg/cmd/parse.go +++ b/pkg/cmd/parse.go @@ -90,12 +90,12 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ "pdf": { &requestflag.InnerFlag[int64]{ Name: "pdf.end", - Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.", + Usage: "Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must be >= start.", InnerField: "end", }, &requestflag.InnerFlag[int64]{ Name: "pdf.start", - Usage: "First 1-based PDF page to parse. When omitted, parsing starts at the first page.", + Usage: "First 1-based PDF page to parse.", InnerField: "start", }, }, diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 5eb615e..77af98e 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -405,14 +405,14 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Keep hyperlinks in the Markdown.", InnerField: "includeLinks", }, - &requestflag.InnerFlag[int64]{ + &requestflag.InnerFlag[*int64]{ Name: "markdown-options.max-age-ms", Usage: "Maximum cache age in milliseconds for result page content. Defaults to 180 days (15552000000 ms) when Markdown is requested, or 365 days (31536000000 ms) when only highlights are requested. Explicit values override either default. Maximum: 365 days. Set to 0 to force a fresh scrape.", InnerField: "maxAgeMs", }, &requestflag.InnerFlag[map[string]any]{ Name: "markdown-options.pdf", - Usage: "PDF handling. Use start/end to bound text extraction and OCR to a page range.", + Usage: "PDF handling. `start`/`end` limit parsing to an inclusive, 1-based page range.", InnerField: "pdf", }, &requestflag.InnerFlag[bool]{ @@ -430,7 +430,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Strip nav, header, footer, and sidebar — keep only the primary article content.", InnerField: "useMainContentOnly", }, - &requestflag.InnerFlag[int64]{ + &requestflag.InnerFlag[*int64]{ Name: "markdown-options.wait-for-ms", Usage: "Extra wait after page load before rendering, in ms (0–30000). Useful for JS-heavy pages.", InnerField: "waitForMs", @@ -466,7 +466,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ Usage: "Fetch from this country (ISO 3166-1 alpha-2).", BodyPath: "country", }, - &requestflag.Flag[[]string]{ + &requestflag.Flag[any]{ Name: "exclude-selector", Usage: "Remove matching elements after inclusions. Exclusions take precedence.", BodyPath: "excludeSelectors", @@ -495,15 +495,15 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ Default: true, BodyPath: "includeLinks", }, - &requestflag.Flag[[]string]{ + &requestflag.Flag[any]{ Name: "include-selector", Usage: "Keep matching HTML subtrees before converting each page to Markdown.", BodyPath: "includeSelectors", }, - &requestflag.Flag[int64]{ + &requestflag.Flag[*int64]{ Name: "max-age-ms", Usage: "Maximum cache age in milliseconds. Defaults to 1 day; `0` fetches fresh.", - Default: 86400000, + Default: requestflag.Ptr[int64](86400000), BodyPath: "maxAgeMs", }, &requestflag.Flag[int64]{ @@ -562,10 +562,10 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ Default: false, BodyPath: "useMainContentOnly", }, - &requestflag.Flag[int64]{ + &requestflag.Flag[*int64]{ Name: "wait-for-ms", Usage: "Browser wait time in milliseconds after initial page load for each crawled page. Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds).", - Default: 3500, + Default: requestflag.Ptr[int64](3500), BodyPath: "waitForMs", }, &requestflag.Flag[string]{ @@ -581,12 +581,12 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ "pdf": { &requestflag.InnerFlag[int64]{ Name: "pdf.end", - Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.", + Usage: "Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must be >= start.", InnerField: "end", }, &requestflag.InnerFlag[bool]{ Name: "pdf.ocr", - Usage: "Read scanned PDF pages with OCR; preserve pages that already contain text.", + Usage: "Read scanned PDF pages with OCR; preserve pages that already have text.", InnerField: "ocr", }, &requestflag.InnerFlag[bool]{ @@ -596,7 +596,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.InnerFlag[int64]{ Name: "pdf.start", - Usage: "First 1-based PDF page to parse. When omitted, parsing starts at the first page.", + Usage: "First 1-based PDF page to parse.", InnerField: "start", }, }, diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index c7364db..9faec9e 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -213,10 +213,10 @@ func TestWebSearch(t *testing.T) { "web", "search", "--query", "Stripe API authentication", "--country", "af", - "--exclude-domain", "string", + "--exclude-domain", "xxx", "--freshness", "last_24_hours", "--highlights-options", "{enabled: true, maxCharacters: 100}", - "--include-domain", "string", + "--include-domain", "xxx", "--markdown-options", "{enabled: true, includeFrames: true, includeImages: true, includeLinks: true, maxAgeMs: 0, pdf: {end: 1, shouldParse: true, start: 1}, shortenBase64Images: true, timeoutOpts: {milliseconds: 1, behavior: fail}, useMainContentOnly: true, waitForMs: 0}", "--num-results", "10", "--query-fanout=true", @@ -238,11 +238,11 @@ func TestWebSearch(t *testing.T) { "web", "search", "--query", "Stripe API authentication", "--country", "af", - "--exclude-domain", "string", + "--exclude-domain", "xxx", "--freshness", "last_24_hours", "--highlights-options.enabled=true", "--highlights-options.max-characters", "100", - "--include-domain", "string", + "--include-domain", "xxx", "--markdown-options.enabled=true", "--markdown-options.include-frames=true", "--markdown-options.include-images=true", @@ -269,13 +269,13 @@ func TestWebSearch(t *testing.T) { "query: Stripe API authentication\n" + "country: af\n" + "excludeDomains:\n" + - " - string\n" + + " - xxx\n" + "freshness: last_24_hours\n" + "highlightsOptions:\n" + " enabled: true\n" + " maxCharacters: 100\n" + "includeDomains:\n" + - " - string\n" + + " - xxx\n" + "markdownOptions:\n" + " enabled: true\n" + " includeFrames: true\n" + @@ -318,12 +318,12 @@ func TestWebWebCrawlMd(t *testing.T) { "web", "web-crawl-md", "--url", "https://example.com", "--country", "de", - "--exclude-selector", "string", + "--exclude-selector", "[x]", "--follow-subdomains=true", "--include-frames=true", "--include-images=true", "--include-links=true", - "--include-selector", "string", + "--include-selector", "[x]", "--max-age-ms", "0", "--max-depth", "0", "--max-pages", "10", @@ -352,12 +352,12 @@ func TestWebWebCrawlMd(t *testing.T) { "web", "web-crawl-md", "--url", "https://example.com", "--country", "de", - "--exclude-selector", "string", + "--exclude-selector", "[x]", "--follow-subdomains=true", "--include-frames=true", "--include-images=true", "--include-links=true", - "--include-selector", "string", + "--include-selector", "[x]", "--max-age-ms", "0", "--max-depth", "0", "--max-pages", "10", @@ -385,13 +385,13 @@ func TestWebWebCrawlMd(t *testing.T) { "url: https://example.com\n" + "country: de\n" + "excludeSelectors:\n" + - " - string\n" + + " - x\n" + "followSubdomains: true\n" + "includeFrames: true\n" + "includeImages: true\n" + "includeLinks: true\n" + "includeSelectors:\n" + - " - string\n" + + " - x\n" + "maxAgeMs: 0\n" + "maxDepth: 0\n" + "maxPages: 10\n" + diff --git a/pkg/cmd/webhookdelivery.go b/pkg/cmd/webhookdelivery.go index 4ed29e1..597c9f5 100644 --- a/pkg/cmd/webhookdelivery.go +++ b/pkg/cmd/webhookdelivery.go @@ -138,6 +138,7 @@ var webhooksDeliveriesRetry = cli.Command{ &requestflag.Flag[bool]{ Name: "force", Usage: "Resend even if the delivery already succeeded. Defaults to false.", + Default: false, BodyPath: "force", }, &requestflag.Flag[[]string]{ From e857625acfcf2f73dcbac3295ae9c0bdd1f43cd3 Mon Sep 17 00:00:00 2001 From: contextualbeer Date: Wed, 30 Sep 2026 09:51:40 +0200 Subject: [PATCH 042/119] release: 1.13.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f94eeca..734ad79 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.0" + ".": "1.13.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a853b1..31e615f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.13.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.13.0...v1.13.1) (2026-09-30) + + +### Bug Fixes + +* **api:** derive OpenAPI request docs from runtime Zod schemas ([#1421](https://github.com/context-dot-dev/context-dev-cli/issues/1421)) ([9d63939](https://github.com/context-dot-dev/context-dev-cli/commit/9d63939d08a20d32642a84788bf47d2c971979ff)) + ## [1.13.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.12.0...v1.13.0) (2026-09-29) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 3852d60..69c409f 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.13.0" // x-release-please-version +const Version = "1.13.1" // x-release-please-version From 81b8d819658c58ce208b4c6cbed3886d97adb4f8 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 1 Oct 2026 00:50:10 +0000 Subject: [PATCH 043/119] Build SDK Stainless-Generated-From: df7ad849d5336f0dd4de2875dbbad4bf7132da46 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c3f0473..affc22e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.22.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.23.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 868dd04..ee8422b 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.22.0 h1:Jb7daCPGozCILiQS73Hlg/tshotI9+oSUIyfioMIGBI= -github.com/context-dot-dev/context-go-sdk/v2 v2.22.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.23.0 h1:Gv7ik4cw63+bnPm+cdHosBi6UseOKWVgWH2qjCktPac= +github.com/context-dot-dev/context-go-sdk/v2 v2.23.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 563d59d3ebc0ff8ddd40c20fac1e82b843ecf2d5 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 5 Oct 2026 15:46:35 +0000 Subject: [PATCH 044/119] feat(search): /web/search - for news results extend description with matching passages from article. Stainless-Generated-From: 886d267338f383f44126cfcf45695712cd94e784 --- pkg/cmd/web.go | 6 ++++++ pkg/cmd/web_test.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 77af98e..5e4f40d 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -316,6 +316,12 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: \"us\", \"gb\", \"de\".", BodyPath: "country", }, + &requestflag.Flag[*int64]{ + Name: "description-max-characters", + Usage: "Maximum length of each result's `description`, in characters.", + Default: nil, + BodyPath: "descriptionMaxCharacters", + }, &requestflag.Flag[[]string]{ Name: "exclude-domain", Usage: `Blocklist — drop results from these domains. Up to 100 domains. Example: ["pinterest.com", "reddit.com"].`, diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 9faec9e..1a7855e 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -213,6 +213,7 @@ func TestWebSearch(t *testing.T) { "web", "search", "--query", "Stripe API authentication", "--country", "af", + "--description-max-characters", "0", "--exclude-domain", "xxx", "--freshness", "last_24_hours", "--highlights-options", "{enabled: true, maxCharacters: 100}", @@ -238,6 +239,7 @@ func TestWebSearch(t *testing.T) { "web", "search", "--query", "Stripe API authentication", "--country", "af", + "--description-max-characters", "0", "--exclude-domain", "xxx", "--freshness", "last_24_hours", "--highlights-options.enabled=true", @@ -268,6 +270,7 @@ func TestWebSearch(t *testing.T) { pipeData := []byte("" + "query: Stripe API authentication\n" + "country: af\n" + + "descriptionMaxCharacters: 0\n" + "excludeDomains:\n" + " - xxx\n" + "freshness: last_24_hours\n" + From a63190db1976e55c6f108bf8d00aab9f5fbf9f34 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 7 Oct 2026 04:32:17 +0000 Subject: [PATCH 045/119] feat(batches): keep batch result files for 180 days (#1638) Stainless-Generated-From: 3d7a9a427a77724c7ef0197af02cdabb880f6a6b --- pkg/cmd/batch.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index 6c295bd..ed51e1f 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -16,7 +16,7 @@ import ( var batchRetrieve = cli.Command{ Name: "retrieve", - Usage: "Get batch progress and result download links. Result files are deleted 7 days\nafter the batch finishes.", + Usage: "Get batch progress and result download links. Result files are deleted 180 days\nafter the batch finishes.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -105,7 +105,7 @@ var batchCancel = cli.Command{ var batchGetResults = cli.Command{ Name: "get-results", - Usage: "Page through a finished batch’s results as JSON. Results remain available for 7\ndays.", + Usage: "Page through a finished batch’s results as JSON. Results remain available for\n180 days.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ From e044d64fa75c6fa960ea160ad261d6fd9a6574b0 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 8 Oct 2026 18:24:03 +0000 Subject: [PATCH 046/119] Build SDK Stainless-Generated-From: 505e6bb67e2fd98189970d2b2062c9221d7cc52a --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index affc22e..0f99f15 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.23.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.24.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index ee8422b..3341cf6 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.23.0 h1:Gv7ik4cw63+bnPm+cdHosBi6UseOKWVgWH2qjCktPac= -github.com/context-dot-dev/context-go-sdk/v2 v2.23.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.24.0 h1:ONvELDbl89OpYwUZ7PE2iq+AWntn36dCxV4ypL12x6s= +github.com/context-dot-dev/context-go-sdk/v2 v2.24.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 4d9adde80335dfd702a23a3c4729dca5b35d4bf9 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 8 Oct 2026 19:56:43 +0000 Subject: [PATCH 047/119] docs(sdks): lead generated READMEs with Context.dev scraping (#1669) Stainless-Generated-From: 1c665d52509fcac76bcf8cbb9e4bcdb1ce2ce723 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b36987c..17e4cb4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Context Dev CLI +# Context.dev CLI The official CLI for the [Context Dev REST API](https://docs.context.dev/). @@ -50,7 +50,7 @@ context-dev [resource] [flags...] ```sh context-dev brand retrieve \ --api-key 'My API Key' \ - --domain REPLACE_ME \ + --domain example.com \ --type by_domain ``` From d408dfc3871e492825a6fbf6998de72e2db7ddcd Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 9 Oct 2026 22:03:12 +0000 Subject: [PATCH 048/119] feat(web-search): charge markdown per delivered page (#1729) Stainless-Generated-From: 551979b2d87a6f5c5584245c0de6b76fc1ac1044 --- pkg/cmd/web.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 5e4f40d..5db57f1 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -393,7 +393,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ "markdown-options": { &requestflag.InnerFlag[bool]{ Name: "markdown-options.enabled", - Usage: "Scrape each result to Markdown. Adds 1 credit per 10 results.", + Usage: "Scrape each result to Markdown. Adds 1 credit per result with Markdown.", InnerField: "enabled", }, &requestflag.InnerFlag[bool]{ From 72e165ab9cf5a79e215c4d8f54cf4b8b181cc722 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 14 Oct 2026 12:26:10 +0000 Subject: [PATCH 049/119] Build SDK Stainless-Generated-From: 45ab0f033ffad5edd549d4765925e80295f0f231 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0f99f15..cd20238 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.24.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.25.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 3341cf6..fac1faa 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.24.0 h1:ONvELDbl89OpYwUZ7PE2iq+AWntn36dCxV4ypL12x6s= -github.com/context-dot-dev/context-go-sdk/v2 v2.24.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.25.0 h1:qUH8F3/TIqMayHT9H09ZZCLveUGUiNtHVwYtrCoaDxE= +github.com/context-dot-dev/context-go-sdk/v2 v2.25.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From fc43a74e9c16576ec16142f674813b7567ea4601 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 14 Oct 2026 20:07:13 +0000 Subject: [PATCH 050/119] feat(search): allow requesting a single result (#1880) Stainless-Generated-From: d6446b56bb42c228520da7e54b53b1218d4c42a4 --- pkg/cmd/web.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 5db57f1..8a5b024 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -349,7 +349,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[int64]{ Name: "num-results", - Usage: "Number of results to request and return (10–100). Defaults to 10.", + Usage: "Number of results to request and return (1–100). Defaults to 10.", Default: 10, BodyPath: "numResults", }, From 403f0b2c6bc0829d489f77820706306b0892d210 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 16 Oct 2026 05:05:44 +0000 Subject: [PATCH 051/119] feat(batch): support Scrape Anything batches up to 100k URLs (#1883) Stainless-Generated-From: 0b4d8ca007a3349b1c05080c46f1e8431549e770 --- pkg/cmd/batch.go | 10 ++++- pkg/cmd/batch_test.go | 95 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 85 insertions(+), 20 deletions(-) diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index ed51e1f..ac54749 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -56,6 +56,12 @@ var batchList = cli.Command{ Usage: "`prefix` for as-you-type prefix matching (default), `exact` for full-token matching.", QueryPath: "search_type", }, + &requestflag.Flag[bool]{ + Name: "should-include-unified", + Usage: "Include batches submitted with Scrape Anything formats. Defaults to false.", + Default: false, + QueryPath: "shouldIncludeUnified", + }, &requestflag.Flag[string]{ Name: "status", Usage: "Filter by status.", @@ -105,7 +111,7 @@ var batchCancel = cli.Command{ var batchGetResults = cli.Command{ Name: "get-results", - Usage: "Page through a finished batch’s results as JSON. Results remain available for\n180 days.", + Usage: "Page through a finished batch’s results as JSON. Each record contains result\nwith the same outputs and per-format errors as POST /web/scrape. Results remain\navailable for 180 days.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -132,7 +138,7 @@ var batchGetResults = cli.Command{ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ Name: "submit", - Usage: "Scrape up to 25,000 URLs, or crawl a site, asynchronously. Poll the batch ID or\nreceive a webhook when it finishes.", + Usage: "Scrape up to 100,000 URLs, or crawl a site, asynchronously using the same\nformats and scrape parameters as POST /web/scrape. Choose Markdown, HTML,\nscreenshots, images, bytes, parsed fields, products, highlights, and JSON. Poll\nthe batch ID or receive a webhook when it finishes.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index fe59e68..f8472bd 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -32,6 +32,7 @@ func TestBatchList(t *testing.T) { "--limit", "1", "--q", "batch_1a2b", "--search-type", "exact", + "--should-include-unified=true", "--status", "queued", "--tags", "docs,competitor", ) @@ -83,7 +84,7 @@ func TestBatchSubmit(t *testing.T) { t, "--api-key", "string", "batch", "submit", - "--input", "{data: {format: markdown, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], options: {country: de, excludeSelectors: [x], includeHTML: true, includeImages: true, includeLinks: true, includeSelectors: [x], maxAgeMs: 0, pdf: {end: 1, ocr: true, shouldParse: true, start: 1}, settleAnimations: true, shortenBase64Images: true, useMainContentOnly: true, waitForMs: 0}}, mode: scrape}", + "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", "--tag", "docs", "--tag", "competitor", "--webhook", "{url: https://example.com, retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", @@ -101,7 +102,7 @@ func TestBatchSubmit(t *testing.T) { t, "--api-key", "string", "batch", "submit", - "--input", "{data: {format: markdown, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], options: {country: de, excludeSelectors: [x], includeHTML: true, includeImages: true, includeLinks: true, includeSelectors: [x], maxAgeMs: 0, pdf: {end: 1, ocr: true, shouldParse: true, start: 1}, settleAnimations: true, shortenBase64Images: true, useMainContentOnly: true, waitForMs: 0}}, mode: scrape}", + "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", "--tag", "docs", "--tag", "competitor", "--webhook.url", "https://example.com", @@ -116,7 +117,16 @@ func TestBatchSubmit(t *testing.T) { pipeData := []byte("" + "input:\n" + " data:\n" + - " format: markdown\n" + + " formats:\n" + + " bytes: true\n" + + " highlights: true\n" + + " html: true\n" + + " images: true\n" + + " json: true\n" + + " markdown: true\n" + + " parse: true\n" + + " product: true\n" + + " screenshot: true\n" + " urls:\n" + " - url: https://example.com/products/anvil\n" + " itemId: sku-1\n" + @@ -126,25 +136,74 @@ func TestBatchSubmit(t *testing.T) { " itemId: sku-2\n" + " meta:\n" + " foo: bar\n" + - " options:\n" + - " country: de\n" + - " excludeSelectors:\n" + - " - x\n" + - " includeHTML: true\n" + + " highlightsParams:\n" + + " query: x\n" + + " maxCharacters: 100\n" + + " imageParams:\n" + + " dedupe: none\n" + + " enrich:\n" + + " - dimensions\n" + + " jsonParams:\n" + + " schema:\n" + + " type: bar\n" + + " properties: bar\n" + + " required: bar\n" + + " additionalProperties: bar\n" + + " instructions: instructions\n" + + " markdownParams:\n" + " includeImages: true\n" + " includeLinks: true\n" + + " inlineImages: placeholder\n" + + " maxAgeMs: 0\n" + + " parseParams:\n" + + " rules:\n" + + " title: h1\n" + + " links:\n" + + " selector: a\n" + + " output: '@href'\n" + + " type: list\n" + + " type: custom\n" + + " productParams:\n" + + " dedupeImages: true\n" + + " screenshotParams:\n" + + " area: viewport\n" + + " format: png\n" + + " sharedParams:\n" + + " actions:\n" + + " - action: Click the product details tab\n" + + " type: perform\n" + + " country: US\n" + + " dismissCookies: true\n" + + " dismissPopups: true\n" + + " excludeSelectors:\n" + + " - P\n" + + " headers:\n" + + " Accept-Language: en-US\n" + + " includeFrames: true\n" + " includeSelectors:\n" + - " - x\n" + - " maxAgeMs: 0\n" + - " pdf:\n" + - " end: 1\n" + - " ocr: true\n" + - " shouldParse: true\n" + - " start: 1\n" + + " - P\n" + + " mainContentOnly: true\n" + + " parsers:\n" + + " pdf:\n" + + " endPage: 1\n" + + " ocr: 'off'\n" + + " startPage: 1\n" + + " profile:\n" + + " profileId: prof_210b9798eb53baa4e69d31c1071cf03d\n" + + " type: existing\n" + " settleAnimations: true\n" + - " shortenBase64Images: true\n" + - " useMainContentOnly: true\n" + - " waitForMs: 0\n" + + " theme: light\n" + + " viewport:\n" + + " height: 240\n" + + " width: 240\n" + + " waitFor: 500\n" + + " tags:\n" + + " - production\n" + + " - team-alpha\n" + + " timeoutOpts:\n" + + " milliseconds: 1\n" + + " behavior: fail\n" + + " zdr: disabled\n" + " mode: scrape\n" + "tags:\n" + " - docs\n" + From 27e1555053f15ddf66de23b3058732d994eed8fd Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 16 Oct 2026 06:28:03 +0000 Subject: [PATCH 052/119] Build SDK Stainless-Generated-From: f78cac7d7ad610c7a952a2573c35b13253e9bc28 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cd20238..3eb4f63 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.25.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.26.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index fac1faa..ee3a439 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.25.0 h1:qUH8F3/TIqMayHT9H09ZZCLveUGUiNtHVwYtrCoaDxE= -github.com/context-dot-dev/context-go-sdk/v2 v2.25.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.26.0 h1:MPFpgozlEGMeLghbQf6xwx6T3yIiETbW6KbejsnsHTg= +github.com/context-dot-dev/context-go-sdk/v2 v2.26.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 90701fca61494842859958c9d33c62f6d6f495b0 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 16 Oct 2026 15:58:57 +0000 Subject: [PATCH 053/119] feat(search): add languages filter to web search (#1833) Stainless-Generated-From: 13105888483fa150eaf7eb68006c78a7bc4776cb --- pkg/cmd/news_test.go | 6 +++--- pkg/cmd/web.go | 6 ++++++ pkg/cmd/web_test.go | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/news_test.go b/pkg/cmd/news_test.go index 965d0b7..608e8fe 100644 --- a/pkg/cmd/news_test.go +++ b/pkg/cmd/news_test.go @@ -18,7 +18,7 @@ func TestNewsSearch(t *testing.T) { "news", "search", "--search-by", "{entity: {domain: stripe.com, type: domain}, type: entity}", "--cursor", "cursor", - "--filter-by", "{articleLanguage: [ar], articleType: [editorial], date: {from: 0, to: 0}, sourceCountry: [ae], sourceDomain: [x]}", + "--filter-by", "{articleLanguage: [am], articleType: [editorial], date: {from: 0, to: 0}, sourceCountry: [ae], sourceDomain: [x]}", "--limit", "1", "--sort-by", "{type: relevance}", "--tag", "production", @@ -38,7 +38,7 @@ func TestNewsSearch(t *testing.T) { "--search-by.entity", "{domain: stripe.com, type: domain}", "--search-by.type", "entity", "--cursor", "cursor", - "--filter-by.article-language", "[ar]", + "--filter-by.article-language", "[am]", "--filter-by.article-type", "[editorial]", "--filter-by.date", "{from: 0, to: 0}", "--filter-by.source-country", "[ae]", @@ -61,7 +61,7 @@ func TestNewsSearch(t *testing.T) { "cursor: cursor\n" + "filterBy:\n" + " articleLanguage:\n" + - " - ar\n" + + " - am\n" + " articleType:\n" + " - editorial\n" + " date:\n" + diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 8a5b024..4a2c766 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -342,6 +342,12 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Usage: `Allowlist — only return results from these domains. Up to 100 domains. Example: ["arxiv.org", "github.com"].`, BodyPath: "includeDomains", }, + &requestflag.Flag[any]{ + Name: "languages", + Usage: "Languages to return results in, as BCP 47 language codes such as `en` or `de`, or \"all\" for any language. Defaults to \"all\". Example: [\"en\", \"de\"].", + Default: "all", + BodyPath: "languages", + }, &requestflag.Flag[map[string]any]{ Name: "markdown-options", Usage: "Inline Markdown scraping for each result. Set `enabled: true` to activate.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 1a7855e..7188ca1 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -218,6 +218,7 @@ func TestWebSearch(t *testing.T) { "--freshness", "last_24_hours", "--highlights-options", "{enabled: true, maxCharacters: 100}", "--include-domain", "xxx", + "--languages", "all", "--markdown-options", "{enabled: true, includeFrames: true, includeImages: true, includeLinks: true, maxAgeMs: 0, pdf: {end: 1, shouldParse: true, start: 1}, shortenBase64Images: true, timeoutOpts: {milliseconds: 1, behavior: fail}, useMainContentOnly: true, waitForMs: 0}", "--num-results", "10", "--query-fanout=true", @@ -245,6 +246,7 @@ func TestWebSearch(t *testing.T) { "--highlights-options.enabled=true", "--highlights-options.max-characters", "100", "--include-domain", "xxx", + "--languages", "all", "--markdown-options.enabled=true", "--markdown-options.include-frames=true", "--markdown-options.include-images=true", @@ -279,6 +281,7 @@ func TestWebSearch(t *testing.T) { " maxCharacters: 100\n" + "includeDomains:\n" + " - xxx\n" + + "languages: all\n" + "markdownOptions:\n" + " enabled: true\n" + " includeFrames: true\n" + From 62df7fe640328a3d22cc1b9e8cf8f67dcb21dc28 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 17 Oct 2026 05:25:54 +0000 Subject: [PATCH 054/119] feat(brand): add search metadata and country and language filters (#1945) Stainless-Generated-From: 2456c3ddf6bd00a6022538875513744ea04b8811 --- pkg/cmd/brand.go | 12 +++++++++++- pkg/cmd/brand_test.go | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index f4f4dd7..0cfe782 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -130,7 +130,7 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ var brandSearch = cli.Command{ Name: "search", - Usage: "Find up to 10 brands by name or domain, ordered by popularity. Use the returned\ndomain to retrieve a full brand profile.", + Usage: "Find up to 10 brands by name or domain, ordered by popularity. Optionally filter\nby country and primary language; both filters must match when provided together.\nResults include description, country, and language when available. Use the\nreturned domain to retrieve a full brand profile.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -145,6 +145,16 @@ var brandSearch = cli.Command{ Default: true, QueryPath: "autocomplete", }, + &requestflag.Flag[string]{ + Name: "country", + Usage: "Only return brands in this country, as an uppercase ISO 3166-1 alpha-2 code such as US or GB.", + QueryPath: "country", + }, + &requestflag.Flag[string]{ + Name: "language", + Usage: "Only return brands with this primary language, such as english or french.", + QueryPath: "language", + }, &requestflag.Flag[[]string]{ Name: "query-by", Usage: "Fields to match the search term against, as a comma-separated list or repeated parameter: 'name', 'domain', or both. Defaults to both.", diff --git a/pkg/cmd/brand_test.go b/pkg/cmd/brand_test.go index 77c925b..bd9763a 100644 --- a/pkg/cmd/brand_test.go +++ b/pkg/cmd/brand_test.go @@ -79,6 +79,8 @@ func TestBrandSearch(t *testing.T) { "brand", "search", "--query", "x", "--autocomplete=true", + "--country", "US", + "--language", "afrikaans", "--query-by", "name", "--tag", "production", "--tag", "team-alpha", From 75aecb38c4b917ef1071734a178d12a45e67f8e4 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Sat, 17 Oct 2026 09:21:15 +0200 Subject: [PATCH 055/119] release: 1.14.0 (#32) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ pkg/cmd/version.go | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 734ad79..e72f113 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.1" + ".": "1.14.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 31e615f..ac75481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [1.14.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.13.1...v1.14.0) (2026-10-17) + + +### Features + +* **batches:** keep batch result files for 180 days ([#1638](https://github.com/context-dot-dev/context-dev-cli/issues/1638)) ([a63190d](https://github.com/context-dot-dev/context-dev-cli/commit/a63190db1976e55c6f108bf8d00aab9f5fbf9f34)) +* **batch:** support Scrape Anything batches up to 100k URLs ([#1883](https://github.com/context-dot-dev/context-dev-cli/issues/1883)) ([403f0b2](https://github.com/context-dot-dev/context-dev-cli/commit/403f0b2c6bc0829d489f77820706306b0892d210)) +* **brand:** add search metadata and country and language filters ([#1945](https://github.com/context-dot-dev/context-dev-cli/issues/1945)) ([62df7fe](https://github.com/context-dot-dev/context-dev-cli/commit/62df7fe640328a3d22cc1b9e8cf8f67dcb21dc28)) +* **search:** /web/search - for news results extend description with matching passages from article. ([563d59d](https://github.com/context-dot-dev/context-dev-cli/commit/563d59d3ebc0ff8ddd40c20fac1e82b843ecf2d5)) +* **search:** add languages filter to web search ([#1833](https://github.com/context-dot-dev/context-dev-cli/issues/1833)) ([90701fc](https://github.com/context-dot-dev/context-dev-cli/commit/90701fca61494842859958c9d33c62f6d6f495b0)) +* **search:** allow requesting a single result ([#1880](https://github.com/context-dot-dev/context-dev-cli/issues/1880)) ([fc43a74](https://github.com/context-dot-dev/context-dev-cli/commit/fc43a74e9c16576ec16142f674813b7567ea4601)) +* **web-search:** charge markdown per delivered page ([#1729](https://github.com/context-dot-dev/context-dev-cli/issues/1729)) ([d408dfc](https://github.com/context-dot-dev/context-dev-cli/commit/d408dfc3871e492825a6fbf6998de72e2db7ddcd)) + + +### Documentation + +* **sdks:** lead generated READMEs with Context.dev scraping ([#1669](https://github.com/context-dot-dev/context-dev-cli/issues/1669)) ([4d9adde](https://github.com/context-dot-dev/context-dev-cli/commit/4d9adde80335dfd702a23a3c4729dca5b35d4bf9)) + ## [1.13.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.13.0...v1.13.1) (2026-09-30) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 69c409f..08f607a 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.13.1" // x-release-please-version +const Version = "1.14.0" // x-release-please-version From 6b620a619625a71a111c059a305c576168a109a5 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 17 Oct 2026 12:22:23 +0000 Subject: [PATCH 056/119] Build SDK Stainless-Generated-From: 48b61d3ffea40ff787f8f80297512a696cd8f5c6 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3eb4f63..61137c9 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.26.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.27.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index ee3a439..61eb23c 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.26.0 h1:MPFpgozlEGMeLghbQf6xwx6T3yIiETbW6KbejsnsHTg= -github.com/context-dot-dev/context-go-sdk/v2 v2.26.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.27.0 h1:tnkyIYrrux+2kDwhPZF8BFN3OFGKOQwH1/YYVewqVVU= +github.com/context-dot-dev/context-go-sdk/v2 v2.27.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 28cee504b98775250d6655f3dabc413881d42fd8 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 18 Oct 2026 01:04:17 +0000 Subject: [PATCH 057/119] feat(people): allow enrichment on free plans (#1961) Stainless-Generated-From: 002aeebb8e5b22e760e22e6425f2cbf84624fe73 --- pkg/cmd/person.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index 1ab9162..6204491 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -16,7 +16,7 @@ import ( var peopleEnrich = requestflag.WithInnerFlags(cli.Command{ Name: "enrich", - Usage: "Find a person from identity clues and return their profile with a match score.\nRequires a paid plan; free or disposable email addresses return 422.", + Usage: "Find a person from identity clues and return their profile with a match score.\nAvailable on all plans; free or disposable email addresses return 422.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ From 619778cb5d72edf5b51cb42992f212654473dcee Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Sun, 18 Oct 2026 03:33:14 +0200 Subject: [PATCH 058/119] release: 1.15.0 (#37) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e72f113..7ccfe12 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.14.0" + ".": "1.15.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ac75481..fd722aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.15.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.14.0...v1.15.0) (2026-10-18) + + +### Features + +* **people:** allow enrichment on free plans ([#1961](https://github.com/context-dot-dev/context-dev-cli/issues/1961)) ([28cee50](https://github.com/context-dot-dev/context-dev-cli/commit/28cee504b98775250d6655f3dabc413881d42fd8)) + ## [1.14.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.13.1...v1.14.0) (2026-10-17) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 08f607a..8ae26c6 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.14.0" // x-release-please-version +const Version = "1.15.0" // x-release-please-version From 5e2b3f4439cef1144229ab66c92b7a171897434a Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 18 Oct 2026 06:24:53 +0000 Subject: [PATCH 059/119] Build SDK Stainless-Generated-From: 014ebaaf22a4344b5bcccb94b0ca4b13d5905ce4 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 61137c9..238fe77 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.27.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.28.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 61eb23c..e8d945d 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.27.0 h1:tnkyIYrrux+2kDwhPZF8BFN3OFGKOQwH1/YYVewqVVU= -github.com/context-dot-dev/context-go-sdk/v2 v2.27.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.28.0 h1:0UEPRMmCBNFc/FBRwflqwLPEYixTSDe7JtsUBjcN+HA= +github.com/context-dot-dev/context-go-sdk/v2 v2.28.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From d0b4bf3e7449c206664aed4717c240b2f813e13b Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 18 Oct 2026 12:23:11 +0000 Subject: [PATCH 060/119] Build SDK Stainless-Generated-From: d31e2ba8dd45092e5b1ff0204d9d2610165a1997 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 238fe77..30535a6 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.28.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.29.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index e8d945d..e333cb1 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.28.0 h1:0UEPRMmCBNFc/FBRwflqwLPEYixTSDe7JtsUBjcN+HA= -github.com/context-dot-dev/context-go-sdk/v2 v2.28.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.29.0 h1:hsUeEfCWN9zimFVYehl/4q0gG4RI0dHFS3GQ5D2OeEc= +github.com/context-dot-dev/context-go-sdk/v2 v2.29.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From b9fdc241fcf37d84f848514c5f02eee4510f7560 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 19 Oct 2026 03:58:34 +0000 Subject: [PATCH 061/119] feat(news): add natural-language search to POST /news/search (#1975) Stainless-Generated-From: 09a81533f928b3af5f40bfc94828bfeb806a9bcb --- pkg/cmd/news.go | 19 +++---------------- pkg/cmd/news_test.go | 3 +-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/pkg/cmd/news.go b/pkg/cmd/news.go index df39395..5f9e945 100644 --- a/pkg/cmd/news.go +++ b/pkg/cmd/news.go @@ -16,12 +16,12 @@ import ( var newsSearch = requestflag.WithInnerFlags(cli.Command{ Name: "search", - Usage: "Find company news by name, domain, ticker, or ISIN. Filter articles and continue\nthrough results with a cursor.", + Usage: "Find news about a company by name, domain, ticker, or ISIN, or search all news\nwith a natural-language query. Filter articles and continue through results with\na cursor.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ Name: "search-by", - Usage: "What to search for.", + Usage: "What to search for: a specific company, or a natural-language query across all news.", Required: true, BodyPath: "searchBy", }, @@ -43,8 +43,7 @@ var newsSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[map[string]any]{ Name: "sort-by", - Usage: "Result ordering. Defaults to newest.", - Default: map[string]any{"type": "newest"}, + Usage: "Result ordering. Defaults to newest for entity searches. Natural-language searches are always ordered by relevance.", BodyPath: "sortBy", }, &requestflag.Flag[[]string]{ @@ -56,18 +55,6 @@ var newsSearch = requestflag.WithInnerFlags(cli.Command{ Action: handleNewsSearch, HideHelpCommand: true, }, map[string][]requestflag.HasOuterFlag{ - "search-by": { - &requestflag.InnerFlag[map[string]any]{ - Name: "search-by.entity", - Usage: "The company to search news for, identified by name, domain, ticker, or ISIN.", - InnerField: "entity", - }, - &requestflag.InnerFlag[string]{ - Name: "search-by.type", - Usage: "How to search. Only entity search is supported.", - InnerField: "type", - }, - }, "filter-by": { &requestflag.InnerFlag[[]string]{ Name: "filter-by.article-language", diff --git a/pkg/cmd/news_test.go b/pkg/cmd/news_test.go index 608e8fe..1503922 100644 --- a/pkg/cmd/news_test.go +++ b/pkg/cmd/news_test.go @@ -35,8 +35,7 @@ func TestNewsSearch(t *testing.T) { t, "--api-key", "string", "news", "search", - "--search-by.entity", "{domain: stripe.com, type: domain}", - "--search-by.type", "entity", + "--search-by", "{entity: {domain: stripe.com, type: domain}, type: entity}", "--cursor", "cursor", "--filter-by.article-language", "[am]", "--filter-by.article-type", "[editorial]", From 50ce749d626b68ba89afef8f1dffca5ec4ca20ec Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Mon, 19 Oct 2026 06:30:30 +0200 Subject: [PATCH 062/119] release: 1.16.0 (#38) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7ccfe12..bc845f3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.0" + ".": "1.16.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fd722aa..2682085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.16.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.15.0...v1.16.0) (2026-10-19) + + +### Features + +* **news:** add natural-language search to POST /news/search ([#1975](https://github.com/context-dot-dev/context-dev-cli/issues/1975)) ([b9fdc24](https://github.com/context-dot-dev/context-dev-cli/commit/b9fdc241fcf37d84f848514c5f02eee4510f7560)) + ## [1.15.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.14.0...v1.15.0) (2026-10-18) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 8ae26c6..aed34ed 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.15.0" // x-release-please-version +const Version = "1.16.0" // x-release-please-version From 4dcf7e5e5f42b70722914d39c49633896c93df5c Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 19 Oct 2026 06:35:20 +0000 Subject: [PATCH 063/119] Build SDK Stainless-Generated-From: e385e1a370117b9cf866c0215ff8bcb6afe6621c --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 30535a6..06ca6c9 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.29.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.30.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index e333cb1..df4b9da 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.29.0 h1:hsUeEfCWN9zimFVYehl/4q0gG4RI0dHFS3GQ5D2OeEc= -github.com/context-dot-dev/context-go-sdk/v2 v2.29.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.30.0 h1:uyEAZRqLS+NOCfSrZTH0f7PJeQexqJmieFbQrFMx+iQ= +github.com/context-dot-dev/context-go-sdk/v2 v2.30.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 70096c2b04297fdf7827e4fa7d937b69dbe45878 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 19 Oct 2026 15:36:58 +0000 Subject: [PATCH 064/119] feat(crawl): add exclude URL regex to crawl and sitemap endpoints (#1982) Stainless-Generated-From: 1d0af2f2628afa39c837cb2a1d8a5837e5f0d929 --- pkg/cmd/web.go | 5 +++++ pkg/cmd/web_test.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 4a2c766..d08199e 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -483,6 +483,11 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ Usage: "Remove matching elements after inclusions. Exclusions take precedence.", BodyPath: "excludeSelectors", }, + &requestflag.Flag[string]{ + Name: "exclude-url-regex", + Usage: "RE2 regex pattern. URLs matching this pattern are never followed or scraped, even when they match urlRegex. The starting URL is always scraped.", + BodyPath: "excludeUrlRegex", + }, &requestflag.Flag[bool]{ Name: "follow-subdomains", Usage: "When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 7188ca1..cf682b7 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -325,6 +325,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--url", "https://example.com", "--country", "de", "--exclude-selector", "[x]", + "--exclude-url-regex", "/tag/|/author/", "--follow-subdomains=true", "--include-frames=true", "--include-images=true", @@ -359,6 +360,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--url", "https://example.com", "--country", "de", "--exclude-selector", "[x]", + "--exclude-url-regex", "/tag/|/author/", "--follow-subdomains=true", "--include-frames=true", "--include-images=true", @@ -392,6 +394,7 @@ func TestWebWebCrawlMd(t *testing.T) { "country: de\n" + "excludeSelectors:\n" + " - x\n" + + "excludeUrlRegex: /tag/|/author/\n" + "followSubdomains: true\n" + "includeFrames: true\n" + "includeImages: true\n" + From dc04987ac013de463814a734a4893a33439fd138 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Mon, 19 Oct 2026 18:28:57 +0200 Subject: [PATCH 065/119] release: 1.17.0 (#39) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bc845f3..6a197be 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.16.0" + ".": "1.17.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2682085..03d53e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.17.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.16.0...v1.17.0) (2026-10-19) + + +### Features + +* **crawl:** add exclude URL regex to crawl and sitemap endpoints ([#1982](https://github.com/context-dot-dev/context-dev-cli/issues/1982)) ([70096c2](https://github.com/context-dot-dev/context-dev-cli/commit/70096c2b04297fdf7827e4fa7d937b69dbe45878)) + ## [1.16.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.15.0...v1.16.0) (2026-10-19) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index aed34ed..ea8b7f7 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.16.0" // x-release-please-version +const Version = "1.17.0" // x-release-please-version From 1de4e514305a655ccf607cf0aa6deb7e6a6d78cc Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 19 Oct 2026 18:23:11 +0000 Subject: [PATCH 066/119] Build SDK Stainless-Generated-From: dd8d0b1fca58281ae9f8d830c443c4dc96dd399b --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 06ca6c9..8a19fe4 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.30.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.31.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index df4b9da..3f35472 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.30.0 h1:uyEAZRqLS+NOCfSrZTH0f7PJeQexqJmieFbQrFMx+iQ= -github.com/context-dot-dev/context-go-sdk/v2 v2.30.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.31.0 h1:QpSuRerjxteJUj8pcmGG+saFXBaZ0kPBJyVqoO+J1lg= +github.com/context-dot-dev/context-go-sdk/v2 v2.31.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 2aebf210f72f171fa351b37c2d904a42993d3a9a Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 21 Oct 2026 06:18:17 +0000 Subject: [PATCH 067/119] feat(company-search): prepare public response contract (#2021) Stainless-Generated-From: 3fa6fc3b33a55191fe34edb1ac69fd95572b9f33 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8a19fe4..742ded6 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.31.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.31.1 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 3f35472..f42b315 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.31.0 h1:QpSuRerjxteJUj8pcmGG+saFXBaZ0kPBJyVqoO+J1lg= -github.com/context-dot-dev/context-go-sdk/v2 v2.31.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.31.1 h1:5qqnR857e1KBmYG7JpPDbxtszVEXMzSIvnOlfYHivTM= +github.com/context-dot-dev/context-go-sdk/v2 v2.31.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From b9365730563183ee027bf1c004a38f394a18c2f0 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Wed, 21 Oct 2026 08:39:17 +0200 Subject: [PATCH 068/119] release: 1.18.0 (#40) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6a197be..4ce109a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.0" + ".": "1.18.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d53e9..40a8917 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.18.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.17.0...v1.18.0) (2026-10-21) + + +### Features + +* **company-search:** prepare public response contract ([#2021](https://github.com/context-dot-dev/context-dev-cli/issues/2021)) ([2aebf21](https://github.com/context-dot-dev/context-dev-cli/commit/2aebf210f72f171fa351b37c2d904a42993d3a9a)) + ## [1.17.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.16.0...v1.17.0) (2026-10-19) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index ea8b7f7..d081a7a 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.17.0" // x-release-please-version +const Version = "1.18.0" // x-release-please-version From d5a84d70c84415ceb67b3b4776b2087ca90e0841 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 21 Oct 2026 16:02:23 +0000 Subject: [PATCH 069/119] fix(openapi): document request_id and key_metadata on every response in one place (#2042) Stainless-Generated-From: 4f04f96a1d8a32215701d765b24412e81698d978 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 742ded6..a04d7b8 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.31.1 + github.com/context-dot-dev/context-go-sdk/v2 v2.31.2 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index f42b315..3def0da 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.31.1 h1:5qqnR857e1KBmYG7JpPDbxtszVEXMzSIvnOlfYHivTM= -github.com/context-dot-dev/context-go-sdk/v2 v2.31.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.31.2 h1:dtzfr/rCGhEfn3otlprf2cJZ0LqPokvouk0lrOls+SI= +github.com/context-dot-dev/context-go-sdk/v2 v2.31.2/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From c258d97b208864f688c6bfef35eff94d05989837 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Wed, 21 Oct 2026 18:26:45 +0200 Subject: [PATCH 070/119] release: 1.18.1 (#41) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4ce109a..aa06f86 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.18.0" + ".": "1.18.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 40a8917..4173bdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.18.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.18.0...v1.18.1) (2026-10-21) + + +### Bug Fixes + +* **openapi:** document request_id and key_metadata on every response in one place ([#2042](https://github.com/context-dot-dev/context-dev-cli/issues/2042)) ([d5a84d7](https://github.com/context-dot-dev/context-dev-cli/commit/d5a84d70c84415ceb67b3b4776b2087ca90e0841)) + ## [1.18.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.17.0...v1.18.0) (2026-10-21) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index d081a7a..edcb3e5 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.18.0" // x-release-please-version +const Version = "1.18.1" // x-release-please-version From f90e57beed0e8d8cde2470c8cb8297ff0c0e2422 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 21 Oct 2026 18:23:31 +0000 Subject: [PATCH 071/119] Build SDK Stainless-Generated-From: 597a66f69e9a50ae2a95039b7f4ebee950a9fcc1 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a04d7b8..0f99c9c 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.31.2 + github.com/context-dot-dev/context-go-sdk/v2 v2.31.3 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 3def0da..4ebd220 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.31.2 h1:dtzfr/rCGhEfn3otlprf2cJZ0LqPokvouk0lrOls+SI= -github.com/context-dot-dev/context-go-sdk/v2 v2.31.2/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.31.3 h1:GKW1xWJfGtqmjVidIWMLEszE5XOF7n7VWvKzxhup7kw= +github.com/context-dot-dev/context-go-sdk/v2 v2.31.3/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From fcdf0a17ac9a9ffa7fd786e1cf1ec767986183a1 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 21 Oct 2026 20:07:16 +0000 Subject: [PATCH 072/119] feat(scrape): add sourcePreference to choose between HTML conversion and published Markdown (#2010) Stainless-Generated-From: 95d1d3475e3ebdd10577b3497d9eb2b71bdc3def --- go.mod | 2 +- go.sum | 4 ++-- pkg/cmd/batch_test.go | 6 ++++-- pkg/cmd/web.go | 12 +++++++++--- pkg/cmd/web_test.go | 4 ++++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 0f99c9c..7a4eb44 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.31.3 + github.com/context-dot-dev/context-go-sdk/v2 v2.32.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 4ebd220..7fd1dd7 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.31.3 h1:GKW1xWJfGtqmjVidIWMLEszE5XOF7n7VWvKzxhup7kw= -github.com/context-dot-dev/context-go-sdk/v2 v2.31.3/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.32.0 h1:rF7kVjfdI4QsHyRuZySwllnUpdrlWqMgvk6bdR1vk0k= +github.com/context-dot-dev/context-go-sdk/v2 v2.32.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index f8472bd..0d0fcb5 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -84,7 +84,7 @@ func TestBatchSubmit(t *testing.T) { t, "--api-key", "string", "batch", "submit", - "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", + "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", "--tag", "docs", "--tag", "competitor", "--webhook", "{url: https://example.com, retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", @@ -102,7 +102,7 @@ func TestBatchSubmit(t *testing.T) { t, "--api-key", "string", "batch", "submit", - "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", + "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", "--tag", "docs", "--tag", "competitor", "--webhook.url", "https://example.com", @@ -154,6 +154,8 @@ func TestBatchSubmit(t *testing.T) { " includeImages: true\n" + " includeLinks: true\n" + " inlineImages: placeholder\n" + + " sourcePreference:\n" + + " - html-conversion\n" + " maxAgeMs: 0\n" + " parseParams:\n" + " rules:\n" + diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index d08199e..5622837 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -502,13 +502,13 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[bool]{ Name: "include-images", - Usage: "Include image references in the Markdown output", + Usage: "Include image references in the Markdown output Only applies to `html-conversion` extractions.", Default: false, BodyPath: "includeImages", }, &requestflag.Flag[bool]{ Name: "include-links", - Usage: "Preserve hyperlinks in the Markdown output", + Usage: "Preserve hyperlinks in the Markdown output Only applies to `html-conversion` extractions.", Default: true, BodyPath: "includeLinks", }, @@ -548,10 +548,16 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[bool]{ Name: "shorten-base64-images", - Usage: "Truncate base64-encoded image data in the Markdown output", + Usage: "Truncate base64-encoded image data in the Markdown output Only applies to `html-conversion` extractions.", Default: true, BodyPath: "shortenBase64Images", }, + &requestflag.Flag[[]string]{ + Name: "source-preference", + Usage: "Where the Markdown should come from, in order of preference; the first usable source wins. `html-conversion` converts the page HTML, and counts as unusable when the conversion has almost no content (under 200 characters). `markdown-direct` uses the official Markdown version the page publishes through, returned as the site serves it. Defaults to `[\"html-conversion\", \"markdown-direct\"]`. With only `markdown-direct`, a page that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed. Requests with include or exclude selectors never use `markdown-direct`, so they must include `html-conversion`.", + Default: []string{"html-conversion", "markdown-direct"}, + BodyPath: "sourcePreference", + }, &requestflag.Flag[int64]{ Name: "stop-after-ms", Usage: "Soft crawl deadline in milliseconds. Returns pages collected before the next deadline check.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index cf682b7..7bb56e9 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -337,6 +337,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--pdf", "{end: 1, ocr: true, shouldParse: true, start: 1}", "--settle-animations=true", "--shorten-base64-images=true", + "--source-preference", "html-conversion", "--stop-after-ms", "10000", "--tag", "production", "--tag", "team-alpha", @@ -375,6 +376,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--pdf.start", "1", "--settle-animations=true", "--shorten-base64-images=true", + "--source-preference", "html-conversion", "--stop-after-ms", "10000", "--tag", "production", "--tag", "team-alpha", @@ -411,6 +413,8 @@ func TestWebWebCrawlMd(t *testing.T) { " start: 1\n" + "settleAnimations: true\n" + "shortenBase64Images: true\n" + + "sourcePreference:\n" + + " - html-conversion\n" + "stopAfterMs: 10000\n" + "tags:\n" + " - production\n" + From 885cf48b66fee4edc111549014bc119a6993a083 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Wed, 21 Oct 2026 22:25:11 +0200 Subject: [PATCH 073/119] release: 1.19.0 (#42) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aa06f86..de44c40 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.18.1" + ".": "1.19.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4173bdf..cae56a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.19.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.18.1...v1.19.0) (2026-10-21) + + +### Features + +* **scrape:** add sourcePreference to choose between HTML conversion and published Markdown ([#2010](https://github.com/context-dot-dev/context-dev-cli/issues/2010)) ([fcdf0a1](https://github.com/context-dot-dev/context-dev-cli/commit/fcdf0a17ac9a9ffa7fd786e1cf1ec767986183a1)) + ## [1.18.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.18.0...v1.18.1) (2026-10-21) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index edcb3e5..0188ba4 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.18.1" // x-release-please-version +const Version = "1.19.0" // x-release-please-version From e4e8b478ad6b55fb6059f5ab1deb5b80c057e2a2 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 21 Oct 2026 21:00:08 +0000 Subject: [PATCH 074/119] docs(openapi): unify regex wording and shorten sourcePreference descriptions (#2051) Stainless-Generated-From: dd255ae9cb6e681fc7ebaadde53848bc2d9ea4e9 --- go.mod | 2 +- go.sum | 4 ++-- pkg/cmd/web.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 7a4eb44..52a3b0d 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.32.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.33.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 7fd1dd7..fa9c39f 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.32.0 h1:rF7kVjfdI4QsHyRuZySwllnUpdrlWqMgvk6bdR1vk0k= -github.com/context-dot-dev/context-go-sdk/v2 v2.32.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.33.0 h1:0Fz+wHuApoHkIVEqdRV1HRx1R1783JjG2w3h/UFL/6g= +github.com/context-dot-dev/context-go-sdk/v2 v2.33.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 5622837..8e9189e 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -485,7 +485,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "exclude-url-regex", - Usage: "RE2 regex pattern. URLs matching this pattern are never followed or scraped, even when they match urlRegex. The starting URL is always scraped.", + Usage: "Regex pattern. URLs matching this pattern are never followed or scraped, even when they match urlRegex. The starting URL is always scraped.", BodyPath: "excludeUrlRegex", }, &requestflag.Flag[bool]{ @@ -502,13 +502,13 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[bool]{ Name: "include-images", - Usage: "Include image references in the Markdown output Only applies to `html-conversion` extractions.", + Usage: "Include image references in the Markdown output (`html-conversion` only).", Default: false, BodyPath: "includeImages", }, &requestflag.Flag[bool]{ Name: "include-links", - Usage: "Preserve hyperlinks in the Markdown output Only applies to `html-conversion` extractions.", + Usage: "Preserve hyperlinks in the Markdown output (`html-conversion` only).", Default: true, BodyPath: "includeLinks", }, @@ -548,13 +548,13 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[bool]{ Name: "shorten-base64-images", - Usage: "Truncate base64-encoded image data in the Markdown output Only applies to `html-conversion` extractions.", + Usage: "Truncate base64-encoded image data in the Markdown output (`html-conversion` only).", Default: true, BodyPath: "shortenBase64Images", }, &requestflag.Flag[[]string]{ Name: "source-preference", - Usage: "Where the Markdown should come from, in order of preference; the first usable source wins. `html-conversion` converts the page HTML, and counts as unusable when the conversion has almost no content (under 200 characters). `markdown-direct` uses the official Markdown version the page publishes through, returned as the site serves it. Defaults to `[\"html-conversion\", \"markdown-direct\"]`. With only `markdown-direct`, a page that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed. Requests with include or exclude selectors never use `markdown-direct`, so they must include `html-conversion`.", + Usage: "Markdown sources in order of preference: `html-conversion` converts the page HTML, `markdown-direct` uses Markdown the site publishes.", Default: []string{"html-conversion", "markdown-direct"}, BodyPath: "sourcePreference", }, From d48c11e68ec0bfbea82dc77cb1d3e496eb5a9a89 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Wed, 21 Oct 2026 23:23:37 +0200 Subject: [PATCH 075/119] release: 1.19.1 (#43) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index de44c40..8255acf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.0" + ".": "1.19.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cae56a7..433a2f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.19.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.19.0...v1.19.1) (2026-10-21) + + +### Documentation + +* **openapi:** unify regex wording and shorten sourcePreference descriptions ([#2051](https://github.com/context-dot-dev/context-dev-cli/issues/2051)) ([e4e8b47](https://github.com/context-dot-dev/context-dev-cli/commit/e4e8b478ad6b55fb6059f5ab1deb5b80c057e2a2)) + ## [1.19.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.18.1...v1.19.0) (2026-10-21) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 0188ba4..64c9416 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.19.0" // x-release-please-version +const Version = "1.19.1" // x-release-please-version From 170ffef4a57aa86cba7b7a69b68c5edd241c4a25 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 22 Oct 2026 00:39:50 +0000 Subject: [PATCH 076/119] Build SDK Stainless-Generated-From: 7cfb730306f8ea0820fab887e901ac33f97b1731 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 52a3b0d..5f40d61 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.33.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.33.1 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index fa9c39f..b3dd16e 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.33.0 h1:0Fz+wHuApoHkIVEqdRV1HRx1R1783JjG2w3h/UFL/6g= -github.com/context-dot-dev/context-go-sdk/v2 v2.33.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.33.1 h1:w4c2NqupiQcxkOpOWVulnMlKzaCVq4akUbS5k8sWCuo= +github.com/context-dot-dev/context-go-sdk/v2 v2.33.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From a4ebbf18af3825489773684de04a2e974f4e05b5 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 23 Oct 2026 07:44:01 +0000 Subject: [PATCH 077/119] feat(people): publish people search in the API specification (#2094) Stainless-Generated-From: f926e2e509baf334f272aa099fc4de6fb8f0f389 --- .stats.yml | 2 +- pkg/cmd/cmd.go | 1 + pkg/cmd/person.go | 90 ++++++++++++++++++++++++++++++++++++++++++ pkg/cmd/person_test.go | 55 ++++++++++++++++++++++++++ 4 files changed, 147 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 58d3483..76e9cb4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 39 +configured_endpoints: 40 diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index bfa0122..1451ff2 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -181,6 +181,7 @@ func init() { Suggest: true, Commands: []*cli.Command{ &peopleEnrich, + &peopleSearch, }, }, { diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index 6204491..ccf9d8d 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -145,6 +145,55 @@ var peopleEnrich = requestflag.WithInnerFlags(cli.Command{ }, }) +var peopleSearch = requestflag.WithInnerFlags(cli.Command{ + Name: "search", + Usage: "Find people with a natural-language query.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "query", + Usage: "Describe the people to find.", + Required: true, + BodyPath: "query", + }, + &requestflag.Flag[string]{ + Name: "cursor", + Usage: "Use next_cursor with the same query and filters to fetch the next page.", + BodyPath: "cursor", + }, + &requestflag.Flag[map[string]any]{ + Name: "filters", + Usage: "Additional constraints every result must match.", + BodyPath: "filters", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Labels for filtering usage in the dashboard.", + BodyPath: "tags", + }, + }, + Action: handlePeopleSearch, + HideHelpCommand: true, +}, map[string][]requestflag.HasOuterFlag{ + "filters": { + &requestflag.InnerFlag[[]string]{ + Name: "filters.countries", + Usage: "Countries people live in as two-letter codes, such as US or GB.", + InnerField: "countries", + }, + &requestflag.InnerFlag[int64]{ + Name: "filters.years-of-experience-max", + Usage: "Maximum years of professional experience.", + InnerField: "years_of_experience_max", + }, + &requestflag.InnerFlag[int64]{ + Name: "filters.years-of-experience-min", + Usage: "Minimum years of professional experience.", + InnerField: "years_of_experience_min", + }, + }, +}) + func handlePeopleEnrich(ctx context.Context, cmd *cli.Command) error { client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) unusedArgs := cmd.Args().Slice() @@ -185,3 +234,44 @@ func handlePeopleEnrich(ctx context.Context, cmd *cli.Command) error { Transform: transform, }) } + +func handlePeopleSearch(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + ApplicationJSON, + false, + ) + if err != nil { + return err + } + + params := contextdev.PersonSearchParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.People.Search(ctx, params, options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "people search", + Transform: transform, + }) +} diff --git a/pkg/cmd/person_test.go b/pkg/cmd/person_test.go index 2279b11..66fd43e 100644 --- a/pkg/cmd/person_test.go +++ b/pkg/cmd/person_test.go @@ -96,3 +96,58 @@ func TestPeopleEnrich(t *testing.T) { ) }) } + +func TestPeopleSearch(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "people", "search", + "--query", "VPs of sales at solar companies in California", + "--cursor", "cursor", + "--filters", "{countries: [SE], years_of_experience_max: 0, years_of_experience_min: 0}", + "--tag", "production", + "--tag", "team-alpha", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(peopleSearch) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "people", "search", + "--query", "VPs of sales at solar companies in California", + "--cursor", "cursor", + "--filters.countries", "[SE]", + "--filters.years-of-experience-max", "0", + "--filters.years-of-experience-min", "0", + "--tag", "production", + "--tag", "team-alpha", + ) + }) + + t.Run("piping data", func(t *testing.T) { + // Test piping YAML data over stdin + pipeData := []byte("" + + "query: VPs of sales at solar companies in California\n" + + "cursor: cursor\n" + + "filters:\n" + + " countries:\n" + + " - SE\n" + + " years_of_experience_max: 0\n" + + " years_of_experience_min: 0\n" + + "tags:\n" + + " - production\n" + + " - team-alpha\n") + mocktest.TestRunMockTestWithPipeAndFlags( + t, pipeData, + "--api-key", "string", + "people", "search", + ) + }) +} From 81a28e41b0d14e7542896ca806b32514dd4bf5d2 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Fri, 23 Oct 2026 12:24:31 +0000 Subject: [PATCH 078/119] Build SDK Stainless-Generated-From: 73905ece00cacc730870e01ea6bad4c9025f27d0 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5f40d61..aeb5b81 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.33.1 + github.com/context-dot-dev/context-go-sdk/v2 v2.34.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index b3dd16e..c371ec0 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.33.1 h1:w4c2NqupiQcxkOpOWVulnMlKzaCVq4akUbS5k8sWCuo= -github.com/context-dot-dev/context-go-sdk/v2 v2.33.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.34.0 h1:hVEjTRNK+/Z/K4W6VJZdnzKmc+S5PbxSXDIKXGR66yw= +github.com/context-dot-dev/context-go-sdk/v2 v2.34.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 8488e641ebf83025df20118aaeefe24c911d0452 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Tue, 27 Oct 2026 00:34:54 +0100 Subject: [PATCH 079/119] release: 1.20.0 (#44) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8255acf..69eb19a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.1" + ".": "1.20.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 433a2f0..3cc442c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.20.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.19.1...v1.20.0) (2026-10-26) + + +### Features + +* **people:** publish people search in the API specification ([#2094](https://github.com/context-dot-dev/context-dev-cli/issues/2094)) ([a4ebbf1](https://github.com/context-dot-dev/context-dev-cli/commit/a4ebbf18af3825489773684de04a2e974f4e05b5)) + ## [1.19.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.19.0...v1.19.1) (2026-10-21) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 64c9416..d7b235b 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.19.1" // x-release-please-version +const Version = "1.20.0" // x-release-please-version From e1d8415b5691a7dc4c9fe9194c62a8191c30c46b Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 27 Oct 2026 12:27:36 +0000 Subject: [PATCH 080/119] Build SDK Stainless-Generated-From: 61b2f1b3677fa6ba5d6111b52ea06b3d087d5156 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index aeb5b81..43bec1d 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.34.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.35.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index c371ec0..c893055 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.34.0 h1:hVEjTRNK+/Z/K4W6VJZdnzKmc+S5PbxSXDIKXGR66yw= -github.com/context-dot-dev/context-go-sdk/v2 v2.34.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.35.0 h1:shrUQZxgbaqkrG6mU+8vFQ3LHeygdJLJVzYxQ+VEDxU= +github.com/context-dot-dev/context-go-sdk/v2 v2.35.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 519ce28caa2dbf5bb5d04578fc52412414dee232 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 27 Oct 2026 15:32:07 +0000 Subject: [PATCH 081/119] feat(people): add ultra mode to people search (#2149) Stainless-Generated-From: 67275ca8930bf6537d4e079436adb185b057e7c7 --- pkg/cmd/person.go | 10 ++++++++-- pkg/cmd/person_test.go | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index ccf9d8d..a77377d 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -152,13 +152,13 @@ var peopleSearch = requestflag.WithInnerFlags(cli.Command{ Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "query", - Usage: "Describe the people to find.", + Usage: "Describe the people to find. Up to 500 characters in `fast` mode and 5000 in `ultra` mode.", Required: true, BodyPath: "query", }, &requestflag.Flag[string]{ Name: "cursor", - Usage: "Use next_cursor with the same query and filters to fetch the next page.", + Usage: "Use next_cursor with the same query, mode and filters to fetch the next page.", BodyPath: "cursor", }, &requestflag.Flag[map[string]any]{ @@ -166,6 +166,12 @@ var peopleSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Additional constraints every result must match.", BodyPath: "filters", }, + &requestflag.Flag[string]{ + Name: "mode", + Usage: "`fast` matches people on basic criteria (e.g. their role, location or background); `ultra` plans a deeper search, judges each candidate against every criterion in the query and explains each match.", + Default: "fast", + BodyPath: "mode", + }, &requestflag.Flag[[]string]{ Name: "tag", Usage: "Labels for filtering usage in the dashboard.", diff --git a/pkg/cmd/person_test.go b/pkg/cmd/person_test.go index 66fd43e..70801e2 100644 --- a/pkg/cmd/person_test.go +++ b/pkg/cmd/person_test.go @@ -107,6 +107,7 @@ func TestPeopleSearch(t *testing.T) { "--query", "VPs of sales at solar companies in California", "--cursor", "cursor", "--filters", "{countries: [SE], years_of_experience_max: 0, years_of_experience_min: 0}", + "--mode", "fast", "--tag", "production", "--tag", "team-alpha", ) @@ -126,6 +127,7 @@ func TestPeopleSearch(t *testing.T) { "--filters.countries", "[SE]", "--filters.years-of-experience-max", "0", "--filters.years-of-experience-min", "0", + "--mode", "fast", "--tag", "production", "--tag", "team-alpha", ) @@ -141,6 +143,7 @@ func TestPeopleSearch(t *testing.T) { " - SE\n" + " years_of_experience_max: 0\n" + " years_of_experience_min: 0\n" + + "mode: fast\n" + "tags:\n" + " - production\n" + " - team-alpha\n") From 5df3c1609c4e9ee883207ecb6556de677e2b902a Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Tue, 27 Oct 2026 16:45:19 +0100 Subject: [PATCH 082/119] release: 1.21.0 (#45) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 69eb19a..ba231b0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.20.0" + ".": "1.21.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cc442c..2bad37f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.21.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.20.0...v1.21.0) (2026-10-27) + + +### Features + +* **people:** add ultra mode to people search ([#2149](https://github.com/context-dot-dev/context-dev-cli/issues/2149)) ([519ce28](https://github.com/context-dot-dev/context-dev-cli/commit/519ce28caa2dbf5bb5d04578fc52412414dee232)) + ## [1.20.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.19.1...v1.20.0) (2026-10-26) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index d7b235b..abdf8af 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.20.0" // x-release-please-version +const Version = "1.21.0" // x-release-please-version From f563f98165160efa2c77278335efc7c21dd9b00f Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 27 Oct 2026 18:19:52 +0000 Subject: [PATCH 083/119] Build SDK Stainless-Generated-From: 59bffad0b9a733868fb9e41cbb42c976b9629bf4 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 43bec1d..2674e93 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.35.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.36.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index c893055..feb764b 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.35.0 h1:shrUQZxgbaqkrG6mU+8vFQ3LHeygdJLJVzYxQ+VEDxU= -github.com/context-dot-dev/context-go-sdk/v2 v2.35.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.36.0 h1:UrJTrBEZahqq6bxy7Jli+hIGrLBz3X3Ddj9egHjqZds= +github.com/context-dot-dev/context-go-sdk/v2 v2.36.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 1486b9bbaf9b344291159d73cbb4df1d9c5f2871 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 27 Oct 2026 21:32:25 +0000 Subject: [PATCH 084/119] docs(people): note that complex ultra people searches can take up to 60 seconds (#2206) Stainless-Generated-From: 13cd9d5a53dfa53af07a19c4b492e20ef21b3f26 --- pkg/cmd/person.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index a77377d..bbb4ba6 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -168,7 +168,7 @@ var peopleSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "mode", - Usage: "`fast` matches people on basic criteria (e.g. their role, location or background); `ultra` plans a deeper search, judges each candidate against every criterion in the query and explains each match.", + Usage: "`fast` matches people on basic criteria (e.g. their role, location or background); `ultra` plans a deeper search, judges each candidate against every criterion in the query. Complex `ultra` searches can take up to 60 seconds to complete, so allow for that in your client timeout.", Default: "fast", BodyPath: "mode", }, From afbb9c2c0e45be7f9ef7e0481e5444a9dd188006 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Tue, 27 Oct 2026 22:47:19 +0100 Subject: [PATCH 085/119] release: 1.21.1 (#46) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ba231b0..9e1cded 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.21.0" + ".": "1.21.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bad37f..67718d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.21.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.21.0...v1.21.1) (2026-10-27) + + +### Documentation + +* **people:** note that complex ultra people searches can take up to 60 seconds ([#2206](https://github.com/context-dot-dev/context-dev-cli/issues/2206)) ([1486b9b](https://github.com/context-dot-dev/context-dev-cli/commit/1486b9bbaf9b344291159d73cbb4df1d9c5f2871)) + ## [1.21.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.20.0...v1.21.0) (2026-10-27) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index abdf8af..d4ed444 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.21.0" // x-release-please-version +const Version = "1.21.1" // x-release-please-version From 29fdba02207215a66d76d0455c97ea1fdaf9e867 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 27 Oct 2026 21:59:55 +0000 Subject: [PATCH 086/119] fix(people): split ultra people ranking on its strongest phrase signals (#2209) Stainless-Generated-From: c19ae0b2dca67b271cdf16a6a8dd4e90442aab99 --- go.mod | 2 +- go.sum | 4 ++-- pkg/cmd/person.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 2674e93..0837d36 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.36.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.36.1 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index feb764b..57130af 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.36.0 h1:UrJTrBEZahqq6bxy7Jli+hIGrLBz3X3Ddj9egHjqZds= -github.com/context-dot-dev/context-go-sdk/v2 v2.36.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.36.1 h1:tASIXy0SFDTW8pQt8bcsDxufwIQCxBv+WH/NeWWatwY= +github.com/context-dot-dev/context-go-sdk/v2 v2.36.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index bbb4ba6..7d8b88e 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -168,7 +168,7 @@ var peopleSearch = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "mode", - Usage: "`fast` matches people on basic criteria (e.g. their role, location or background); `ultra` plans a deeper search, judges each candidate against every criterion in the query. Complex `ultra` searches can take up to 60 seconds to complete, so allow for that in your client timeout.", + Usage: "`fast` matches people on basic criteria (e.g. their role, location or background); `ultra` plans a deeper search, judges each candidate against every criterion in the query. Complex `ultra` searches can take up to 30 seconds to complete, so allow for that in your client timeout.", Default: "fast", BodyPath: "mode", }, From 56653ad48cadf607d345179a60b08dac28b04473 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 27 Oct 2026 22:23:54 +0000 Subject: [PATCH 087/119] feat(parse): mark PDF page numbers inline in Markdown with includeNumberedPages (#2110) Stainless-Generated-From: 48fc8eb475735398832709e3d42eef72ef129e67 --- pkg/cmd/batch_test.go | 5 +++-- pkg/cmd/parse.go | 6 ++++++ pkg/cmd/parse_test.go | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index 0d0fcb5..64ddef8 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -84,7 +84,7 @@ func TestBatchSubmit(t *testing.T) { t, "--api-key", "string", "batch", "submit", - "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", + "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, includeNumberedPages: true, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", "--tag", "docs", "--tag", "competitor", "--webhook", "{url: https://example.com, retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", @@ -102,7 +102,7 @@ func TestBatchSubmit(t *testing.T) { t, "--api-key", "string", "batch", "submit", - "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", + "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, includeNumberedPages: true, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", "--tag", "docs", "--tag", "competitor", "--webhook.url", "https://example.com", @@ -188,6 +188,7 @@ func TestBatchSubmit(t *testing.T) { " parsers:\n" + " pdf:\n" + " endPage: 1\n" + + " includeNumberedPages: true\n" + " ocr: 'off'\n" + " startPage: 1\n" + " profile:\n" + diff --git a/pkg/cmd/parse.go b/pkg/cmd/parse.go index 149f8b4..bcfc0f0 100644 --- a/pkg/cmd/parse.go +++ b/pkg/cmd/parse.go @@ -49,6 +49,12 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ Default: true, QueryPath: "includeLinks", }, + &requestflag.Flag[bool]{ + Name: "include-numbered-pages", + Usage: "Start each PDF page in the Markdown with a `` line, where N is the original 1-based page number.", + Default: false, + QueryPath: "includeNumberedPages", + }, &requestflag.Flag[bool]{ Name: "ocr", Usage: "Read text from images and scanned PDF pages. PDF page ranges still apply.", diff --git a/pkg/cmd/parse_test.go b/pkg/cmd/parse_test.go index fd11604..b65aaa4 100644 --- a/pkg/cmd/parse_test.go +++ b/pkg/cmd/parse_test.go @@ -21,6 +21,7 @@ func TestParseHandle(t *testing.T) { "--extension", "txt", "--include-images=true", "--include-links=true", + "--include-numbered-pages=true", "--ocr=true", "--pdf", "{end: 1, start: 1}", "--shorten-base64-images=true", @@ -45,6 +46,7 @@ func TestParseHandle(t *testing.T) { "--extension", "txt", "--include-images=true", "--include-links=true", + "--include-numbered-pages=true", "--ocr=true", "--pdf.end", "1", "--pdf.start", "1", @@ -67,6 +69,7 @@ func TestParseHandle(t *testing.T) { "--extension", "txt", "--include-images=true", "--include-links=true", + "--include-numbered-pages=true", "--ocr=true", "--pdf", "{end: 1, start: 1}", "--shorten-base64-images=true", From 9bf817f6b7610d34e91c4545578e2087b913f804 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Tue, 27 Oct 2026 23:47:25 +0100 Subject: [PATCH 088/119] release: 1.22.0 (#47) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 12 ++++++++++++ pkg/cmd/version.go | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9e1cded..397c420 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.21.1" + ".": "1.22.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 67718d6..2a0edb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.22.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.21.1...v1.22.0) (2026-10-27) + + +### Features + +* **parse:** mark PDF page numbers inline in Markdown with includeNumberedPages ([#2110](https://github.com/context-dot-dev/context-dev-cli/issues/2110)) ([56653ad](https://github.com/context-dot-dev/context-dev-cli/commit/56653ad48cadf607d345179a60b08dac28b04473)) + + +### Bug Fixes + +* **people:** split ultra people ranking on its strongest phrase signals ([#2209](https://github.com/context-dot-dev/context-dev-cli/issues/2209)) ([29fdba0](https://github.com/context-dot-dev/context-dev-cli/commit/29fdba02207215a66d76d0455c97ea1fdaf9e867)) + ## [1.21.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.21.0...v1.21.1) (2026-10-27) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index d4ed444..116b9e5 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.21.1" // x-release-please-version +const Version = "1.22.0" // x-release-please-version From a436c52056a6d73d45af0a62677822efa36a4d29 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 28 Oct 2026 00:32:48 +0000 Subject: [PATCH 089/119] Build SDK Stainless-Generated-From: 60638bd439863fb3e76cfd4e5c71e2a4ae706d0c --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0837d36..80d6d98 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.36.1 + github.com/context-dot-dev/context-go-sdk/v2 v2.37.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 57130af..0046502 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.36.1 h1:tASIXy0SFDTW8pQt8bcsDxufwIQCxBv+WH/NeWWatwY= -github.com/context-dot-dev/context-go-sdk/v2 v2.36.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.37.0 h1:2beXquOptxYNFLKUpplW34go0PlkhXM4iAJjbe29wFY= +github.com/context-dot-dev/context-go-sdk/v2 v2.37.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From b45f902e1d99193a4f78c694934650220c246387 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 28 Oct 2026 14:20:06 +0000 Subject: [PATCH 090/119] fix(openapi): keep legacy batch inputs in the spec as deprecated (#2225) feat(access-policies): limit which websites API requests can reach (#2213) Stainless-Generated-From: 195b4c6a401e049bad28b662b4953794f01e8513 --- pkg/cmd/batch.go | 5 +++++ pkg/cmd/batch_test.go | 4 ++++ pkg/cmd/brand.go | 5 +++++ pkg/cmd/brand_test.go | 4 ++++ pkg/cmd/monitor.go | 10 ++++++++++ pkg/cmd/monitor_test.go | 8 ++++++++ pkg/cmd/news.go | 5 +++++ pkg/cmd/news_test.go | 4 ++++ pkg/cmd/utility.go | 5 +++++ pkg/cmd/utility_test.go | 4 ++++ pkg/cmd/web.go | 20 ++++++++++++++++++++ pkg/cmd/web_test.go | 14 ++++++++++++++ 12 files changed, 88 insertions(+) diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index ac54749..e53ed74 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -147,6 +147,11 @@ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ Required: true, BodyPath: "input", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply to every page. A URL must pass every policy.", + BodyPath: "policies", + }, &requestflag.Flag[[]string]{ Name: "tag", Usage: "Tags stored on the batch. Filter the batch list by them later.", diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index 64ddef8..d59f1ad 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -85,6 +85,7 @@ func TestBatchSubmit(t *testing.T) { "--api-key", "string", "batch", "submit", "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, includeNumberedPages: true, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "docs", "--tag", "competitor", "--webhook", "{url: https://example.com, retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}", @@ -103,6 +104,7 @@ func TestBatchSubmit(t *testing.T) { "--api-key", "string", "batch", "submit", "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, includeNumberedPages: true, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "docs", "--tag", "competitor", "--webhook.url", "https://example.com", @@ -208,6 +210,8 @@ func TestBatchSubmit(t *testing.T) { " behavior: fail\n" + " zdr: disabled\n" + " mode: scrape\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "tags:\n" + " - docs\n" + " - competitor\n" + diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index 0cfe782..f2d10a8 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -45,6 +45,11 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data.", BodyPath: "maxSpeed", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply. A URL must pass every policy.", + BodyPath: "policies", + }, &requestflag.Flag[[]string]{ Name: "tag", Usage: "Labels for filtering usage in the dashboard.", diff --git a/pkg/cmd/brand_test.go b/pkg/cmd/brand_test.go index bd9763a..255ed82 100644 --- a/pkg/cmd/brand_test.go +++ b/pkg/cmd/brand_test.go @@ -21,6 +21,7 @@ func TestBrandRetrieve(t *testing.T) { "--force-language", "afrikaans", "--max-age-ms", "0", "--max-speed=true", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", @@ -41,6 +42,7 @@ func TestBrandRetrieve(t *testing.T) { "--force-language", "afrikaans", "--max-age-ms", "0", "--max-speed=true", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "production", "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", @@ -56,6 +58,8 @@ func TestBrandRetrieve(t *testing.T) { "force_language: afrikaans\n" + "maxAgeMs: 0\n" + "maxSpeed: true\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "tags:\n" + " - production\n" + " - team-alpha\n" + diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index c3eb822..260e0cb 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -41,6 +41,11 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ Usage: "Always `web`. Optional.", BodyPath: "mode", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply to every run.", + BodyPath: "policies", + }, &requestflag.Flag[map[string]any]{ Name: "schedule", Usage: "Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.", @@ -138,6 +143,11 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ Usage: "Display name for the monitor.", BodyPath: "name", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply to every run. Send an empty list to remove them.", + BodyPath: "policies", + }, &requestflag.Flag[map[string]any]{ Name: "schedule", Usage: "Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.", diff --git a/pkg/cmd/monitor_test.go b/pkg/cmd/monitor_test.go index c784627..6f90c7c 100644 --- a/pkg/cmd/monitor_test.go +++ b/pkg/cmd/monitor_test.go @@ -20,6 +20,7 @@ func TestMonitorsCreate(t *testing.T) { "--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--change-detection", "{type: exact}", "--mode", "web", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--schedule", "{frequency: 6, type: interval, unit: hours}", "--tag", "pricing", "--tag", "competitor", @@ -40,6 +41,7 @@ func TestMonitorsCreate(t *testing.T) { "--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`, "--change-detection", "{type: exact}", "--mode", "web", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--schedule.frequency", "6", "--schedule.type", "interval", "--schedule.unit", "hours", @@ -73,6 +75,8 @@ func TestMonitorsCreate(t *testing.T) { "change_detection:\n" + " type: exact\n" + "mode: web\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "schedule:\n" + " frequency: 6\n" + " type: interval\n" + @@ -124,6 +128,7 @@ func TestMonitorsUpdate(t *testing.T) { "--monitor-id", "mon_123", "--change-detection", "{type: exact}", "--name", "Acme pricing monitor", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--schedule", "{frequency: 1, type: interval, unit: hours}", "--status", "active", "--tag", "pricing", @@ -145,6 +150,7 @@ func TestMonitorsUpdate(t *testing.T) { "--monitor-id", "mon_123", "--change-detection", "{type: exact}", "--name", "Acme pricing monitor", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--schedule.frequency", "1", "--schedule.type", "interval", "--schedule.unit", "hours", @@ -164,6 +170,8 @@ func TestMonitorsUpdate(t *testing.T) { "change_detection:\n" + " type: exact\n" + "name: Acme pricing monitor\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "schedule:\n" + " frequency: 1\n" + " type: interval\n" + diff --git a/pkg/cmd/news.go b/pkg/cmd/news.go index 5f9e945..f8344f5 100644 --- a/pkg/cmd/news.go +++ b/pkg/cmd/news.go @@ -41,6 +41,11 @@ var newsSearch = requestflag.WithInnerFlags(cli.Command{ Default: 10, BodyPath: "limit", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply. A URL must pass every policy.", + BodyPath: "policies", + }, &requestflag.Flag[map[string]any]{ Name: "sort-by", Usage: "Result ordering. Defaults to newest for entity searches. Natural-language searches are always ordered by relevance.", diff --git a/pkg/cmd/news_test.go b/pkg/cmd/news_test.go index 1503922..9b9cfeb 100644 --- a/pkg/cmd/news_test.go +++ b/pkg/cmd/news_test.go @@ -20,6 +20,7 @@ func TestNewsSearch(t *testing.T) { "--cursor", "cursor", "--filter-by", "{articleLanguage: [am], articleType: [editorial], date: {from: 0, to: 0}, sourceCountry: [ae], sourceDomain: [x]}", "--limit", "1", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--sort-by", "{type: relevance}", "--tag", "production", "--tag", "team-alpha", @@ -43,6 +44,7 @@ func TestNewsSearch(t *testing.T) { "--filter-by.source-country", "[ae]", "--filter-by.source-domain", "[x]", "--limit", "1", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--sort-by.type", "relevance", "--tag", "production", "--tag", "team-alpha", @@ -71,6 +73,8 @@ func TestNewsSearch(t *testing.T) { " sourceDomain:\n" + " - x\n" + "limit: 1\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "sortBy:\n" + " type: relevance\n" + "tags:\n" + diff --git a/pkg/cmd/utility.go b/pkg/cmd/utility.go index 5520fb0..9bb4f49 100644 --- a/pkg/cmd/utility.go +++ b/pkg/cmd/utility.go @@ -31,6 +31,11 @@ var utilityPrefetch = requestflag.WithInnerFlags(cli.Command{ Required: true, BodyPath: "type", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply. A URL must pass every policy.", + BodyPath: "policies", + }, &requestflag.Flag[[]string]{ Name: "tag", Usage: "Labels for filtering usage in the dashboard.", diff --git a/pkg/cmd/utility_test.go b/pkg/cmd/utility_test.go index e8173be..4067d14 100644 --- a/pkg/cmd/utility_test.go +++ b/pkg/cmd/utility_test.go @@ -18,6 +18,7 @@ func TestUtilityPrefetch(t *testing.T) { "utility", "prefetch", "--identifier", "{domain: stripe.com}", "--type", "brand", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", @@ -35,6 +36,7 @@ func TestUtilityPrefetch(t *testing.T) { "utility", "prefetch", "--identifier", "{domain: stripe.com}", "--type", "brand", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "production", "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", @@ -48,6 +50,8 @@ func TestUtilityPrefetch(t *testing.T) { "identifier:\n" + " domain: stripe.com\n" + "type: brand\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "tags:\n" + " - production\n" + " - team-alpha\n" + diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 8e9189e..383b7f9 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -35,6 +35,11 @@ var webAnswers = requestflag.WithInnerFlags(cli.Command{ Usage: "`fast` prioritizes speed, with extra verification for people and companies; `ultra` supports deeper research (default).", BodyPath: "mode", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply. A URL must pass every policy.", + BodyPath: "policies", + }, &requestflag.Flag[[]string]{ Name: "tag", Usage: "Labels for filtering usage in the dashboard.", @@ -145,6 +150,11 @@ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ Default: requestflag.Ptr[int64](7776000000), QueryPath: "maxAgeMs", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Comma-separated access policy IDs to apply. A URL must pass every policy.", + QueryPath: "policies", + }, &requestflag.Flag[[]string]{ Name: "tag", Usage: "Comma-separated labels for filtering usage, e.g. `production,team-alpha`.", @@ -359,6 +369,11 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{ Default: 10, BodyPath: "numResults", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply. A URL must pass every policy.", + BodyPath: "policies", + }, &requestflag.Flag[bool]{ Name: "query-fanout", Usage: "Currently has no effect.", @@ -540,6 +555,11 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{ Default: map[string]any{"shouldParse": true, "ocr": false}, BodyPath: "pdf", }, + &requestflag.Flag[[]string]{ + Name: "policy", + Usage: "Access policy IDs to apply. A URL must pass every policy.", + BodyPath: "policies", + }, &requestflag.Flag[bool]{ Name: "settle-animations", Usage: "Wait briefly for CSS animations and transitions to settle before reading each page.", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 7bb56e9..ebe1e72 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -19,6 +19,7 @@ func TestWebAnswers(t *testing.T) { "--task", "Find the pricing page URL and plan names for context.dev.", "--json-format", "{pricing_page_url: bar, plans: bar}", "--mode", "fast", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", @@ -38,6 +39,7 @@ func TestWebAnswers(t *testing.T) { "--task", "Find the pricing page URL and plan names for context.dev.", "--json-format", "{pricing_page_url: bar, plans: bar}", "--mode", "fast", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "production", "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", @@ -54,6 +56,8 @@ func TestWebAnswers(t *testing.T) { " pricing_page_url: bar\n" + " plans: bar\n" + "mode: fast\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "tags:\n" + " - production\n" + " - team-alpha\n" + @@ -116,6 +120,7 @@ func TestWebExtractStyleguide(t *testing.T) { "--direct-url", "https://example.com", "--domain", "xxx", "--max-age-ms", "0", + "--policy", "string", "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1, behavior: fail}", @@ -136,6 +141,7 @@ func TestWebExtractStyleguide(t *testing.T) { "--direct-url", "https://example.com", "--domain", "xxx", "--max-age-ms", "0", + "--policy", "string", "--tag", "production", "--tag", "team-alpha", "--timeout-opts.milliseconds", "1", @@ -221,6 +227,7 @@ func TestWebSearch(t *testing.T) { "--languages", "all", "--markdown-options", "{enabled: true, includeFrames: true, includeImages: true, includeLinks: true, maxAgeMs: 0, pdf: {end: 1, shouldParse: true, start: 1}, shortenBase64Images: true, timeoutOpts: {milliseconds: 1, behavior: fail}, useMainContentOnly: true, waitForMs: 0}", "--num-results", "10", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--query-fanout=true", "--tag", "production", "--tag", "team-alpha", @@ -258,6 +265,7 @@ func TestWebSearch(t *testing.T) { "--markdown-options.use-main-content-only=true", "--markdown-options.wait-for-ms", "0", "--num-results", "10", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--query-fanout=true", "--tag", "production", "--tag", "team-alpha", @@ -299,6 +307,8 @@ func TestWebSearch(t *testing.T) { " useMainContentOnly: true\n" + " waitForMs: 0\n" + "numResults: 10\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "queryFanout: true\n" + "tags:\n" + " - production\n" + @@ -335,6 +345,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--max-depth", "0", "--max-pages", "10", "--pdf", "{end: 1, ocr: true, shouldParse: true, start: 1}", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--settle-animations=true", "--shorten-base64-images=true", "--source-preference", "html-conversion", @@ -374,6 +385,7 @@ func TestWebWebCrawlMd(t *testing.T) { "--pdf.ocr=true", "--pdf.should-parse=true", "--pdf.start", "1", + "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--settle-animations=true", "--shorten-base64-images=true", "--source-preference", "html-conversion", @@ -411,6 +423,8 @@ func TestWebWebCrawlMd(t *testing.T) { " ocr: true\n" + " shouldParse: true\n" + " start: 1\n" + + "policies:\n" + + " - pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e\n" + "settleAnimations: true\n" + "shortenBase64Images: true\n" + "sourcePreference:\n" + From 8bcacae1949b95afcc1c768aacfb25836bfd4bd8 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 28 Oct 2026 15:11:31 +0000 Subject: [PATCH 091/119] fix(openapi): keep legacy batch inputs in the spec as deprecated (#2225) feat(access-policies): limit which websites API requests can reach (#2213) feat(brand): support log-free brand and styleguide requests (#2231) Stainless-Generated-From: 877ae208f4f229e77ee99db0a9bd5c63d425c0b2 --- pkg/cmd/brand.go | 5 +++++ pkg/cmd/brand_test.go | 5 ++++- pkg/cmd/web.go | 3 +-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index f2d10a8..fa3a953 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -60,6 +60,11 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ Usage: "Request deadline and what to return when it passes.", BodyPath: "timeoutOpts", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "`enabled` disables request logs, usage logs, and traces. Brand data and hosted assets may still be stored. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", + BodyPath: "zdr", + }, &requestflag.Flag[string]{ Name: "name", Usage: "Company name to retrieve brand data for (e.g., 'Apple Inc').", diff --git a/pkg/cmd/brand_test.go b/pkg/cmd/brand_test.go index 255ed82..a7f8e1a 100644 --- a/pkg/cmd/brand_test.go +++ b/pkg/cmd/brand_test.go @@ -25,6 +25,7 @@ func TestBrandRetrieve(t *testing.T) { "--tag", "production", "--tag", "team-alpha", "--timeout-opts", "{milliseconds: 1000, behavior: fail}", + "--zdr", "enabled", ) }) @@ -47,6 +48,7 @@ func TestBrandRetrieve(t *testing.T) { "--tag", "team-alpha", "--timeout-opts.milliseconds", "1000", "--timeout-opts.behavior", "fail", + "--zdr", "enabled", ) }) @@ -65,7 +67,8 @@ func TestBrandRetrieve(t *testing.T) { " - team-alpha\n" + "timeoutOpts:\n" + " milliseconds: 1000\n" + - " behavior: fail\n") + " behavior: fail\n" + + "zdr: enabled\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 383b7f9..e0b8052 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -167,8 +167,7 @@ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", - Default: "disabled", + Usage: "`enabled` disables request logs, usage logs, and traces. Brand data and hosted assets may still be stored. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", QueryPath: "zdr", }, }, From d834285939f71ee9f02a7e64f88060d7336c0327 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 28 Oct 2026 16:57:04 +0000 Subject: [PATCH 092/119] fix(openapi): keep legacy batch inputs in the spec as deprecated (#2225) feat(access-policies): limit which websites API requests can reach (#2213) feat(brand): support log-free brand and styleguide requests (#2231) fix(brand): keep metadata-only usage logs for ZDR brand requests (#2234) Stainless-Generated-From: a2113c2b1b00d1af5735be694c9bcab8620a94e1 --- pkg/cmd/brand.go | 2 +- pkg/cmd/web.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index fa3a953..9d099a5 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -62,7 +62,7 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "`enabled` disables request logs, usage logs, and traces. Brand data and hosted assets may still be stored. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", + Usage: "`enabled` disables request logs and traces and omits request and response content from usage logs. Brand data and hosted assets may still be stored. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", BodyPath: "zdr", }, &requestflag.Flag[string]{ diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index e0b8052..5cdf5e3 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -167,7 +167,7 @@ var webExtractStyleguide = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "zdr", - Usage: "`enabled` disables request logs, usage logs, and traces. Brand data and hosted assets may still be stored. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", + Usage: "`enabled` disables request logs and traces and omits request and response content from usage logs. Brand data and hosted assets may still be stored. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", QueryPath: "zdr", }, }, From de6d2cbfc75b87734e147d17054e3453eae0a9c1 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 28 Oct 2026 17:20:00 +0000 Subject: [PATCH 093/119] fix(openapi): keep legacy batch inputs in the spec as deprecated (#2225) feat(access-policies): limit which websites API requests can reach (#2213) feat(brand): support log-free brand and styleguide requests (#2231) fix(brand): keep metadata-only usage logs for ZDR brand requests (#2234) feat(monitors): add search target to watch the web for new developments (#2215) Stainless-Generated-From: 5faf577793b3ac81606761802996df688af72067 --- pkg/cmd/monitor.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index 260e0cb..0815317 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -27,13 +27,13 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[map[string]any]{ Name: "target", - Usage: "What to watch: a page, a sitemap, or data extracted from a site.", + Usage: "What to watch: a page, a sitemap, data extracted from a site, or web search results.", Required: true, BodyPath: "target", }, &requestflag.Flag[map[string]any]{ Name: "change-detection", - Usage: "How changes are judged. Defaults to `semantic` for extract targets and page targets with `instructions`, otherwise `exact`.", + Usage: "How changes are judged. Defaults to `semantic` for extract and search targets and page targets with `instructions`, otherwise `exact`.", BodyPath: "change_detection", }, &requestflag.Flag[string]{ @@ -135,7 +135,7 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[map[string]any]{ Name: "change-detection", - Usage: "How changes are judged. Defaults to `semantic` for extract targets and page targets with `instructions`, otherwise `exact`.", + Usage: "How changes are judged. Defaults to `semantic` for extract and search targets and page targets with `instructions`, otherwise `exact`.", BodyPath: "change_detection", }, &requestflag.Flag[string]{ @@ -165,7 +165,7 @@ var monitorsUpdate = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[map[string]any]{ Name: "target", - Usage: "What to watch: a page, a sitemap, or data extracted from a site.", + Usage: "What to watch: a page, a sitemap, data extracted from a site, or web search results.", BodyPath: "target", }, &requestflag.Flag[map[string]any]{ @@ -245,7 +245,7 @@ var monitorsList = cli.Command{ }, &requestflag.Flag[any]{ Name: "search-by", - Usage: "Fields to search with `q`. Defaults to all fields; page and extract targets can have instructions.", + Usage: "Fields to search with `q`. Defaults to all fields; page, extract, and search targets can have instructions, and `url` matches a search target’s query.", QueryPath: "search_by", }, &requestflag.Flag[string]{ From c2dcc15dc38348c4ce3a88796c3917374e35bef2 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Wed, 28 Oct 2026 20:17:33 +0100 Subject: [PATCH 094/119] release: 1.23.0 (#48) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 24 ++++++++++++++++++++++++ pkg/cmd/version.go | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 397c420..cdcf20e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.22.0" + ".": "1.23.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a0edb8..13b9530 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## [1.23.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.22.0...v1.23.0) (2026-10-28) + + +### Features + +* **access-policies:** limit which websites API requests can reach ([#2213](https://github.com/context-dot-dev/context-dev-cli/issues/2213)) ([de6d2cb](https://github.com/context-dot-dev/context-dev-cli/commit/de6d2cbfc75b87734e147d17054e3453eae0a9c1)) +* **access-policies:** limit which websites API requests can reach ([#2213](https://github.com/context-dot-dev/context-dev-cli/issues/2213)) ([d834285](https://github.com/context-dot-dev/context-dev-cli/commit/d834285939f71ee9f02a7e64f88060d7336c0327)) +* **access-policies:** limit which websites API requests can reach ([#2213](https://github.com/context-dot-dev/context-dev-cli/issues/2213)) ([8bcacae](https://github.com/context-dot-dev/context-dev-cli/commit/8bcacae1949b95afcc1c768aacfb25836bfd4bd8)) +* **access-policies:** limit which websites API requests can reach ([#2213](https://github.com/context-dot-dev/context-dev-cli/issues/2213)) ([b45f902](https://github.com/context-dot-dev/context-dev-cli/commit/b45f902e1d99193a4f78c694934650220c246387)) +* **brand:** support log-free brand and styleguide requests ([#2231](https://github.com/context-dot-dev/context-dev-cli/issues/2231)) ([de6d2cb](https://github.com/context-dot-dev/context-dev-cli/commit/de6d2cbfc75b87734e147d17054e3453eae0a9c1)) +* **brand:** support log-free brand and styleguide requests ([#2231](https://github.com/context-dot-dev/context-dev-cli/issues/2231)) ([d834285](https://github.com/context-dot-dev/context-dev-cli/commit/d834285939f71ee9f02a7e64f88060d7336c0327)) +* **brand:** support log-free brand and styleguide requests ([#2231](https://github.com/context-dot-dev/context-dev-cli/issues/2231)) ([8bcacae](https://github.com/context-dot-dev/context-dev-cli/commit/8bcacae1949b95afcc1c768aacfb25836bfd4bd8)) +* **monitors:** add search target to watch the web for new developments ([#2215](https://github.com/context-dot-dev/context-dev-cli/issues/2215)) ([de6d2cb](https://github.com/context-dot-dev/context-dev-cli/commit/de6d2cbfc75b87734e147d17054e3453eae0a9c1)) + + +### Bug Fixes + +* **brand:** keep metadata-only usage logs for ZDR brand requests ([#2234](https://github.com/context-dot-dev/context-dev-cli/issues/2234)) ([de6d2cb](https://github.com/context-dot-dev/context-dev-cli/commit/de6d2cbfc75b87734e147d17054e3453eae0a9c1)) +* **brand:** keep metadata-only usage logs for ZDR brand requests ([#2234](https://github.com/context-dot-dev/context-dev-cli/issues/2234)) ([d834285](https://github.com/context-dot-dev/context-dev-cli/commit/d834285939f71ee9f02a7e64f88060d7336c0327)) +* **openapi:** keep legacy batch inputs in the spec as deprecated ([#2225](https://github.com/context-dot-dev/context-dev-cli/issues/2225)) ([de6d2cb](https://github.com/context-dot-dev/context-dev-cli/commit/de6d2cbfc75b87734e147d17054e3453eae0a9c1)) +* **openapi:** keep legacy batch inputs in the spec as deprecated ([#2225](https://github.com/context-dot-dev/context-dev-cli/issues/2225)) ([d834285](https://github.com/context-dot-dev/context-dev-cli/commit/d834285939f71ee9f02a7e64f88060d7336c0327)) +* **openapi:** keep legacy batch inputs in the spec as deprecated ([#2225](https://github.com/context-dot-dev/context-dev-cli/issues/2225)) ([8bcacae](https://github.com/context-dot-dev/context-dev-cli/commit/8bcacae1949b95afcc1c768aacfb25836bfd4bd8)) +* **openapi:** keep legacy batch inputs in the spec as deprecated ([#2225](https://github.com/context-dot-dev/context-dev-cli/issues/2225)) ([b45f902](https://github.com/context-dot-dev/context-dev-cli/commit/b45f902e1d99193a4f78c694934650220c246387)) + ## [1.22.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.21.1...v1.22.0) (2026-10-27) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 116b9e5..09a939a 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.22.0" // x-release-please-version +const Version = "1.23.0" // x-release-please-version From fd190eb591c9fc1162453cbb235f52881c1250b2 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 29 Oct 2026 00:33:20 +0000 Subject: [PATCH 095/119] Build SDK Stainless-Generated-From: d8821bdaf9642034a0bf2ac6874483241acf404c --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 80d6d98..1e776ea 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.37.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.38.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 0046502..5c89e23 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.37.0 h1:2beXquOptxYNFLKUpplW34go0PlkhXM4iAJjbe29wFY= -github.com/context-dot-dev/context-go-sdk/v2 v2.37.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.38.0 h1:azGoT6BCyUp04A3PuIhupGI1hK6/7VSq3oSHzL7C91o= +github.com/context-dot-dev/context-go-sdk/v2 v2.38.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 9d9a0d73bd586e9ce7c7bcfd8090fc2f4e7066a8 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 29 Oct 2026 17:03:20 +0000 Subject: [PATCH 096/119] fix(scrape): derive the /web/scrape request spec from its zod schema (#2044) Stainless-Generated-From: c198eb1c470ca9410094c866364ea33a0de94c15 --- pkg/cmd/batch_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index d59f1ad..76ecf79 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -84,7 +84,7 @@ func TestBatchSubmit(t *testing.T) { t, "--api-key", "string", "batch", "submit", - "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, includeNumberedPages: true, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", + "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true, useAIFallback: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, includeNumberedPages: true, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "docs", "--tag", "competitor", @@ -103,7 +103,7 @@ func TestBatchSubmit(t *testing.T) { t, "--api-key", "string", "batch", "submit", - "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, includeNumberedPages: true, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", + "--input", "{data: {formats: {bytes: true, highlights: true, html: true, images: true, json: true, markdown: true, parse: true, product: true, screenshot: true}, urls: [{url: https://example.com/products/anvil, itemId: sku-1, meta: {category: bar}}, {url: https://example.com/products/hammer, itemId: sku-2, meta: {foo: bar}}], highlightsParams: {query: x, maxCharacters: 100}, imageParams: {dedupe: none, enrich: [dimensions]}, jsonParams: {schema: {type: bar, properties: bar, required: bar, additionalProperties: bar}, instructions: instructions}, markdownParams: {includeImages: true, includeLinks: true, inlineImages: placeholder, sourcePreference: [html-conversion]}, maxAgeMs: 0, parseParams: {rules: {title: h1, links: {selector: a, output: '@href', type: list}}, type: custom}, productParams: {dedupeImages: true, useAIFallback: true}, screenshotParams: {area: viewport, format: png}, sharedParams: {actions: [{action: Click the product details tab, type: perform}], country: US, dismissCookies: true, dismissPopups: true, excludeSelectors: [P], headers: {Accept-Language: en-US}, includeFrames: true, includeSelectors: [P], mainContentOnly: true, parsers: {pdf: {endPage: 1, includeNumberedPages: true, ocr: 'off', startPage: 1}}, profile: {profileId: prof_210b9798eb53baa4e69d31c1071cf03d, type: existing}, settleAnimations: true, theme: light, viewport: {height: 240, width: 240}, waitFor: 500}, tags: [production, team-alpha], timeoutOpts: {milliseconds: 1, behavior: fail}, zdr: disabled}, mode: scrape}", "--policy", "pol_3f9c2a7e5b8d4c1f9a6e0b2d7c4f8a1e", "--tag", "docs", "--tag", "competitor", @@ -169,6 +169,7 @@ func TestBatchSubmit(t *testing.T) { " type: custom\n" + " productParams:\n" + " dedupeImages: true\n" + + " useAIFallback: true\n" + " screenshotParams:\n" + " area: viewport\n" + " format: png\n" + From 9d5a95bf460ee096b843d2e92b76eec429bb8a4a Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Thu, 29 Oct 2026 18:18:24 +0100 Subject: [PATCH 097/119] release: 1.23.1 (#49) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cdcf20e..276cb37 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.23.0" + ".": "1.23.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 13b9530..e8a2d22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.23.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.23.0...v1.23.1) (2026-10-29) + + +### Bug Fixes + +* **scrape:** derive the /web/scrape request spec from its zod schema ([#2044](https://github.com/context-dot-dev/context-dev-cli/issues/2044)) ([9d9a0d7](https://github.com/context-dot-dev/context-dev-cli/commit/9d9a0d73bd586e9ce7c7bcfd8090fc2f4e7066a8)) + ## [1.23.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.22.0...v1.23.0) (2026-10-28) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 09a939a..b35d117 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.23.0" // x-release-please-version +const Version = "1.23.1" // x-release-please-version From bef280b83b438b5b545d947f317e703d36562f6e Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 29 Oct 2026 18:19:55 +0000 Subject: [PATCH 098/119] Build SDK Stainless-Generated-From: 6e1f480f2c69a45d8ea81575060c9ee2478c27c7 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1e776ea..22143b7 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.38.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.38.1 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 5c89e23..98b4736 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.38.0 h1:azGoT6BCyUp04A3PuIhupGI1hK6/7VSq3oSHzL7C91o= -github.com/context-dot-dev/context-go-sdk/v2 v2.38.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.38.1 h1:3FF+hOnJy0AEwtCwcKYL81zMIMnE0NrRbmsd+BN+i5o= +github.com/context-dot-dev/context-go-sdk/v2 v2.38.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 7603b0c50e4e5486c7046e868b854b53879baf8a Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 31 Oct 2026 00:28:19 +0000 Subject: [PATCH 099/119] Build SDK Stainless-Generated-From: 9da0ee358559ca9e94e8b76fc38a57dfa18799f7 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 22143b7..9d1f1c4 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.38.1 + github.com/context-dot-dev/context-go-sdk/v2 v2.39.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 98b4736..6436b50 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.38.1 h1:3FF+hOnJy0AEwtCwcKYL81zMIMnE0NrRbmsd+BN+i5o= -github.com/context-dot-dev/context-go-sdk/v2 v2.38.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.39.0 h1:aRzlILUwwu0498Slmm+a25h++yotfj+L3ouVUoaSIgQ= +github.com/context-dot-dev/context-go-sdk/v2 v2.39.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From cb2f07671d12c913867ef48d77409d4d59fa4507 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 1 Nov 2026 00:32:54 +0000 Subject: [PATCH 100/119] Build SDK Stainless-Generated-From: d6dbce7a6dac174521a02601dfa6c97009e1e5cb --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9d1f1c4..257e07b 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.39.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.40.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 6436b50..ec30660 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.39.0 h1:aRzlILUwwu0498Slmm+a25h++yotfj+L3ouVUoaSIgQ= -github.com/context-dot-dev/context-go-sdk/v2 v2.39.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.40.0 h1:0ZaAY0jWZyEa7xLTAZrtu6/XxjyqqHK5ZrlIiqgAR5U= +github.com/context-dot-dev/context-go-sdk/v2 v2.40.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 51ab770cb81b8e22fed2f286a31acc590bc141b5 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 2 Nov 2026 00:29:58 +0000 Subject: [PATCH 101/119] Build SDK Stainless-Generated-From: a4a578aa4659ddd79cc8eb81c314be65ce77abc2 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 257e07b..477c087 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.40.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.41.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index ec30660..3acf074 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.40.0 h1:0ZaAY0jWZyEa7xLTAZrtu6/XxjyqqHK5ZrlIiqgAR5U= -github.com/context-dot-dev/context-go-sdk/v2 v2.40.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.41.0 h1:JwWsVUTeXof8xwwrbBrEV/pLpgRpoMQem4QvMWLnCHs= +github.com/context-dot-dev/context-go-sdk/v2 v2.41.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 174adf60c3a3861198eca848995be0754d5f32da Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 2 Nov 2026 06:25:12 +0000 Subject: [PATCH 102/119] Build SDK Stainless-Generated-From: 730ade8089f7e4b8ac3a880ea336c48773ca727d --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 477c087..4122ed4 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.41.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.42.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 3acf074..bed6346 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.41.0 h1:JwWsVUTeXof8xwwrbBrEV/pLpgRpoMQem4QvMWLnCHs= -github.com/context-dot-dev/context-go-sdk/v2 v2.41.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.42.0 h1:kkfHaCLGyRZLZgcCFVtL4MD7yO/mGYLVMkcgcJBURoE= +github.com/context-dot-dev/context-go-sdk/v2 v2.42.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 3c2e33014dce8b6ba7431072444394018de0db0e Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 5 Nov 2026 02:42:29 +0000 Subject: [PATCH 103/119] feat(scrape): add Tripadvisor reviews parser (#2508) Stainless-Generated-From: 58efb3db7d5d68316bec4c64d649cf73036ac70c --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4122ed4..5293a0b 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.42.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.42.1 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index bed6346..c6044cf 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.42.0 h1:kkfHaCLGyRZLZgcCFVtL4MD7yO/mGYLVMkcgcJBURoE= -github.com/context-dot-dev/context-go-sdk/v2 v2.42.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.42.1 h1:lonTKrBLHRacGYGqof381nkufQkqIxDloESrme6mZFI= +github.com/context-dot-dev/context-go-sdk/v2 v2.42.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 8fbfbf12d1c022adeaf33ed31bb0dc67d3df2b70 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Thu, 5 Nov 2026 04:04:28 +0100 Subject: [PATCH 104/119] release: 1.24.0 (#50) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 276cb37..bfaab56 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.23.1" + ".": "1.24.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a2d22..50424ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.24.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.23.1...v1.24.0) (2026-11-05) + + +### Features + +* **scrape:** add Tripadvisor reviews parser ([#2508](https://github.com/context-dot-dev/context-dev-cli/issues/2508)) ([3c2e330](https://github.com/context-dot-dev/context-dev-cli/commit/3c2e33014dce8b6ba7431072444394018de0db0e)) + ## [1.23.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.23.0...v1.23.1) (2026-10-29) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index b35d117..badf449 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.23.1" // x-release-please-version +const Version = "1.24.0" // x-release-please-version From b38b7b09d38fec1395b36b039c8560afb5c11c14 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 5 Nov 2026 06:20:08 +0000 Subject: [PATCH 105/119] Build SDK Stainless-Generated-From: d548694c2f13983af33df874eee93cb6cb932e16 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5293a0b..65daf5f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.42.1 + github.com/context-dot-dev/context-go-sdk/v2 v2.43.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index c6044cf..ecd4f88 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.42.1 h1:lonTKrBLHRacGYGqof381nkufQkqIxDloESrme6mZFI= -github.com/context-dot-dev/context-go-sdk/v2 v2.42.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.43.0 h1:56DACEOURlvVT3ZsYiZJktjV07L7+JxUrxuJ7Qak40w= +github.com/context-dot-dev/context-go-sdk/v2 v2.43.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 177caaeff369bbf15957648f429c842207960cd5 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 5 Nov 2026 15:25:28 +0000 Subject: [PATCH 106/119] docs(logs): say that a request log appears a few seconds after the request (#2564) Stainless-Generated-From: 0e36d35c38c414205f43cb11883dd79748c5b457 --- pkg/cmd/log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/log.go b/pkg/cmd/log.go index 7b0c9de..996fb22 100644 --- a/pkg/cmd/log.go +++ b/pkg/cmd/log.go @@ -16,7 +16,7 @@ import ( var logsRetrieve = cli.Command{ Name: "retrieve", - Usage: "Retrieve a request’s metadata, retained input, and response.", + Usage: "Retrieve a request’s metadata, retained input, and response. An entry becomes\nretrievable a few seconds after its request completes, so a 404 NOT_FOUND for a\nrequest that just finished means ingestion has not caught up yet; retry after a\nfew seconds.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ From 1a8373b659b253a0adecfa96ff3361e56ace6fa9 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Thu, 5 Nov 2026 16:47:13 +0100 Subject: [PATCH 107/119] release: 1.24.1 (#51) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bfaab56..347a18e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.24.0" + ".": "1.24.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 50424ae..030021d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.24.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.24.0...v1.24.1) (2026-11-05) + + +### Documentation + +* **logs:** say that a request log appears a few seconds after the request ([#2564](https://github.com/context-dot-dev/context-dev-cli/issues/2564)) ([177caae](https://github.com/context-dot-dev/context-dev-cli/commit/177caaeff369bbf15957648f429c842207960cd5)) + ## [1.24.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.23.1...v1.24.0) (2026-11-05) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index badf449..43e97f3 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.24.0" // x-release-please-version +const Version = "1.24.1" // x-release-please-version From 7921b3d8fad1fcf1d7d77953e68a91e42d776362 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 5 Nov 2026 18:16:25 +0000 Subject: [PATCH 108/119] Build SDK Stainless-Generated-From: e79173e9186aee7b164791f4d1fec0b7d2870752 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 65daf5f..8ad923a 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.43.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.43.1 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index ecd4f88..bb779e4 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.43.0 h1:56DACEOURlvVT3ZsYiZJktjV07L7+JxUrxuJ7Qak40w= -github.com/context-dot-dev/context-go-sdk/v2 v2.43.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.43.1 h1:FbXlJYWIURpZak2yJtw9FGYFdUHuOpv2/IaPi3QWy3E= +github.com/context-dot-dev/context-go-sdk/v2 v2.43.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 140be90f1d0df87d23df1d5898dd86a9617d2eae Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 7 Nov 2026 03:10:33 +0000 Subject: [PATCH 109/119] feat(batch): accept lightweight submissions and queue pending work (#2683) Stainless-Generated-From: 1945e81b700fd8a7fc7bdfcd537dfab03de3e5c8 --- pkg/cmd/batch.go | 2 +- pkg/cmd/batch_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index e53ed74..994d103 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -138,7 +138,7 @@ var batchGetResults = cli.Command{ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ Name: "submit", - Usage: "Scrape up to 100,000 URLs, or crawl a site, asynchronously using the same\nformats and scrape parameters as POST /web/scrape. Choose Markdown, HTML,\nscreenshots, images, bytes, parsed fields, products, highlights, and JSON. Poll\nthe batch ID or receive a webhook when it finishes.", + Usage: "Scrape up to 100,000 URLs, or crawl a site, asynchronously using the same\nformats and scrape parameters as POST /web/scrape. Choose Markdown, HTML,\nscreenshots, images, bytes, parsed fields, products, highlights, and JSON.\nSubmission persists the input and returns immediately with status pending.\nOrganizations with fewer than 10 available credits and no overage are rejected\nwith 402 up front. Each organization can submit up to 1,000 batches per minute,\nindependently of its polling budget. Batches wait pending when execution\ncapacity is full. Validation, sitemap discovery, the full credit quote, and\nshard scheduling happen afterward. Poll the batch ID or receive a webhook when\nit finishes. Deferred rejections appear as status failed with a failure code and\nmessage.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index 76ecf79..224fb20 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -33,7 +33,7 @@ func TestBatchList(t *testing.T) { "--q", "batch_1a2b", "--search-type", "exact", "--should-include-unified=true", - "--status", "queued", + "--status", "pending", "--tags", "docs,competitor", ) }) From 2d755c67be33e9eb542511326b9827e227ca04eb Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Sat, 7 Nov 2026 04:32:27 +0100 Subject: [PATCH 110/119] release: 1.25.0 (#52) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 347a18e..0c0c0c3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.24.1" + ".": "1.25.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 030021d..44a9e31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.25.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.24.1...v1.25.0) (2026-11-07) + + +### Features + +* **batch:** accept lightweight submissions and queue pending work ([#2683](https://github.com/context-dot-dev/context-dev-cli/issues/2683)) ([140be90](https://github.com/context-dot-dev/context-dev-cli/commit/140be90f1d0df87d23df1d5898dd86a9617d2eae)) + ## [1.24.1](https://github.com/context-dot-dev/context-dev-cli/compare/v1.24.0...v1.24.1) (2026-11-05) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 43e97f3..480eb12 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.24.1" // x-release-please-version +const Version = "1.25.0" // x-release-please-version From 4f51b1c1ad3247d053ff1a176bda95514ff88090 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 7 Nov 2026 06:16:14 +0000 Subject: [PATCH 111/119] Build SDK Stainless-Generated-From: 6d6bb3c4f53425c83b5a285157228f836f7eb406 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8ad923a..a700f46 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.43.1 + github.com/context-dot-dev/context-go-sdk/v2 v2.44.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index bb779e4..e6a5972 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.43.1 h1:FbXlJYWIURpZak2yJtw9FGYFdUHuOpv2/IaPi3QWy3E= -github.com/context-dot-dev/context-go-sdk/v2 v2.43.1/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.44.0 h1:MgUQr5zZ8TlaDXfeoOG6UjsCCL3WK7eiSb7APuYUAQc= +github.com/context-dot-dev/context-go-sdk/v2 v2.44.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From e06a0014ce50c79ad9006c66104972323dc1d410 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 8 Nov 2026 03:18:22 +0000 Subject: [PATCH 112/119] feat(batch): raise batch submissions to 2,500 per minute per organization (#2734) Stainless-Generated-From: ae2d36c5288bbabb2ff8274a29e2932d830a01a0 --- pkg/cmd/batch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go index 994d103..d7147c1 100644 --- a/pkg/cmd/batch.go +++ b/pkg/cmd/batch.go @@ -138,7 +138,7 @@ var batchGetResults = cli.Command{ var batchSubmit = requestflag.WithInnerFlags(cli.Command{ Name: "submit", - Usage: "Scrape up to 100,000 URLs, or crawl a site, asynchronously using the same\nformats and scrape parameters as POST /web/scrape. Choose Markdown, HTML,\nscreenshots, images, bytes, parsed fields, products, highlights, and JSON.\nSubmission persists the input and returns immediately with status pending.\nOrganizations with fewer than 10 available credits and no overage are rejected\nwith 402 up front. Each organization can submit up to 1,000 batches per minute,\nindependently of its polling budget. Batches wait pending when execution\ncapacity is full. Validation, sitemap discovery, the full credit quote, and\nshard scheduling happen afterward. Poll the batch ID or receive a webhook when\nit finishes. Deferred rejections appear as status failed with a failure code and\nmessage.", + Usage: "Scrape up to 100,000 URLs, or crawl a site, asynchronously using the same\nformats and scrape parameters as POST /web/scrape. Choose Markdown, HTML,\nscreenshots, images, bytes, parsed fields, products, highlights, and JSON.\nSubmission persists the input and returns immediately with status pending.\nOrganizations with fewer than 10 available credits and no overage are rejected\nwith 402 up front. Each organization can submit up to 2,500 batches per minute,\nindependently of its polling budget. Batches wait pending when execution\ncapacity is full. Validation, sitemap discovery, the full credit quote, and\nshard scheduling happen afterward. Poll the batch ID or receive a webhook when\nit finishes. Deferred rejections appear as status failed with a failure code and\nmessage.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ From cb5d5cddcf691f9ca7ab621ffcf232d2969ebe05 Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Sun, 8 Nov 2026 04:32:30 +0100 Subject: [PATCH 113/119] release: 1.26.0 (#53) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0c0c0c3..f3dbfd2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.25.0" + ".": "1.26.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 44a9e31..532e258 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.26.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.25.0...v1.26.0) (2026-11-08) + + +### Features + +* **batch:** raise batch submissions to 2,500 per minute per organization ([#2734](https://github.com/context-dot-dev/context-dev-cli/issues/2734)) ([e06a001](https://github.com/context-dot-dev/context-dev-cli/commit/e06a0014ce50c79ad9006c66104972323dc1d410)) + ## [1.25.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.24.1...v1.25.0) (2026-11-07) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 480eb12..ef619fd 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.25.0" // x-release-please-version +const Version = "1.26.0" // x-release-please-version From e018ecac8ba99ab1bb2721f10262bba4ccba27bb Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 8 Nov 2026 06:17:22 +0000 Subject: [PATCH 114/119] Build SDK Stainless-Generated-From: f03740da083d27535e1c4aa4a5e3f7a9a473d998 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a700f46..4c6c982 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.44.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.45.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index e6a5972..ac9cd14 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.44.0 h1:MgUQr5zZ8TlaDXfeoOG6UjsCCL3WK7eiSb7APuYUAQc= -github.com/context-dot-dev/context-go-sdk/v2 v2.44.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.45.0 h1:qB8a9EhMOwzeRqwhJIfe4L924vtmMN7QF9/ajA3zexk= +github.com/context-dot-dev/context-go-sdk/v2 v2.45.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 2c4ef4b28b8b40a9f8bd079ba3bf311a71ede93c Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 9 Nov 2026 17:12:30 +0000 Subject: [PATCH 115/119] feat(parse): support WARC archives in parsing and scraping (#2761) Stainless-Generated-From: cbff604d9a9dd49f3b0ee9d1f64da1867400fc56 --- go.mod | 2 +- go.sum | 4 ++-- pkg/cmd/parse.go | 4 ++-- pkg/cmd/parse_test.go | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 4c6c982..db35aa1 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.45.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.46.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index ac9cd14..7210c51 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.45.0 h1:qB8a9EhMOwzeRqwhJIfe4L924vtmMN7QF9/ajA3zexk= -github.com/context-dot-dev/context-go-sdk/v2 v2.45.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.46.0 h1:eoNQ/cNKkDtUut9xvRbAWfFZCzLlrgbdwJlBQ+ca0N4= +github.com/context-dot-dev/context-go-sdk/v2 v2.46.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/pkg/cmd/parse.go b/pkg/cmd/parse.go index bcfc0f0..b965d54 100644 --- a/pkg/cmd/parse.go +++ b/pkg/cmd/parse.go @@ -18,7 +18,7 @@ import ( var parseHandle = requestflag.WithInnerFlags(cli.Command{ Name: "handle", - Usage: "Convert uploaded file bytes into Markdown and optional HTML.", + Usage: "Convert uploaded file bytes into Markdown and optional HTML. WARC and WARC.GZ\narchives combine HTTP response, resource, and conversion records in archive\norder. Revisit and segmented records are skipped. Decoded WARC content is\nlimited to 50 MiB.", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ @@ -34,7 +34,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ }, &requestflag.Flag[string]{ Name: "extension", - Usage: "Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.", + Usage: "Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, txt, warc, or warc.gz.", QueryPath: "extension", }, &requestflag.Flag[bool]{ diff --git a/pkg/cmd/parse_test.go b/pkg/cmd/parse_test.go index b65aaa4..47ba4ff 100644 --- a/pkg/cmd/parse_test.go +++ b/pkg/cmd/parse_test.go @@ -18,7 +18,7 @@ func TestParseHandle(t *testing.T) { "parse", "handle", "--body", mocktest.TestFile(t, "Example data"), "--client", "x", - "--extension", "txt", + "--extension", "warc", "--include-images=true", "--include-links=true", "--include-numbered-pages=true", @@ -43,7 +43,7 @@ func TestParseHandle(t *testing.T) { "parse", "handle", "--body", mocktest.TestFile(t, "Example data"), "--client", "x", - "--extension", "txt", + "--extension", "warc", "--include-images=true", "--include-links=true", "--include-numbered-pages=true", @@ -66,7 +66,7 @@ func TestParseHandle(t *testing.T) { "--api-key", "string", "parse", "handle", "--client", "x", - "--extension", "txt", + "--extension", "warc", "--include-images=true", "--include-links=true", "--include-numbered-pages=true", From f2da94d5b2786a2f9269fedccaa904c408db0d1f Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Mon, 9 Nov 2026 18:32:34 +0100 Subject: [PATCH 116/119] release: 1.27.0 (#54) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f3dbfd2..4eb8987 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.26.0" + ".": "1.27.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 532e258..10ba309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.27.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.26.0...v1.27.0) (2026-11-09) + + +### Features + +* **parse:** support WARC archives in parsing and scraping ([#2761](https://github.com/context-dot-dev/context-dev-cli/issues/2761)) ([2c4ef4b](https://github.com/context-dot-dev/context-dev-cli/commit/2c4ef4b28b8b40a9f8bd079ba3bf311a71ede93c)) + ## [1.26.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.25.0...v1.26.0) (2026-11-08) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index ef619fd..1b22491 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.26.0" // x-release-please-version +const Version = "1.27.0" // x-release-please-version From 21aa42256876fc1834a71a85bee9d3a6b68d497f Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 10 Nov 2026 00:26:37 +0000 Subject: [PATCH 117/119] Build SDK Stainless-Generated-From: a14dc104496e32fdf792a1f3e01c810645c51799 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index db35aa1..ac04565 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.6 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/x/term v0.2.1 - github.com/context-dot-dev/context-go-sdk/v2 v2.46.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.47.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 diff --git a/go.sum b/go.sum index 7210c51..23f5623 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= -github.com/context-dot-dev/context-go-sdk/v2 v2.46.0 h1:eoNQ/cNKkDtUut9xvRbAWfFZCzLlrgbdwJlBQ+ca0N4= -github.com/context-dot-dev/context-go-sdk/v2 v2.46.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.47.0 h1:WLked7GTZad5/b4s/3LIbnBQE5uiCqton132Cr+9SJM= +github.com/context-dot-dev/context-go-sdk/v2 v2.47.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From a586170472c5ba3999aa9ebbeabeff05cf9457ff Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 12 Nov 2026 06:20:34 +0000 Subject: [PATCH 118/119] feat(zdr): accept zero data retention on people search and company search (#2852) Stainless-Generated-From: 54387f75f9dd14d1db58de01943aad49ef25fcaf --- pkg/cmd/person.go | 5 +++++ pkg/cmd/person_test.go | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/person.go b/pkg/cmd/person.go index 7d8b88e..0b8cf9a 100644 --- a/pkg/cmd/person.go +++ b/pkg/cmd/person.go @@ -177,6 +177,11 @@ var peopleSearch = requestflag.WithInnerFlags(cli.Command{ Usage: "Labels for filtering usage in the dashboard.", BodyPath: "tags", }, + &requestflag.Flag[string]{ + Name: "zdr", + Usage: "`enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.", + BodyPath: "zdr", + }, }, Action: handlePeopleSearch, HideHelpCommand: true, diff --git a/pkg/cmd/person_test.go b/pkg/cmd/person_test.go index 70801e2..4018699 100644 --- a/pkg/cmd/person_test.go +++ b/pkg/cmd/person_test.go @@ -110,6 +110,7 @@ func TestPeopleSearch(t *testing.T) { "--mode", "fast", "--tag", "production", "--tag", "team-alpha", + "--zdr", "enabled", ) }) @@ -130,6 +131,7 @@ func TestPeopleSearch(t *testing.T) { "--mode", "fast", "--tag", "production", "--tag", "team-alpha", + "--zdr", "enabled", ) }) @@ -146,7 +148,8 @@ func TestPeopleSearch(t *testing.T) { "mode: fast\n" + "tags:\n" + " - production\n" + - " - team-alpha\n") + " - team-alpha\n" + + "zdr: enabled\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", From 7ce65e48b6e53eb34ba20fb8614f22464d090b2c Mon Sep 17 00:00:00 2001 From: Beer van der Drift Date: Thu, 12 Nov 2026 07:38:59 +0100 Subject: [PATCH 119/119] release: 1.28.0 (#55) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pkg/cmd/version.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4eb8987..31d8238 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.27.0" + ".": "1.28.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 10ba309..e3b3100 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.28.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.27.0...v1.28.0) (2026-11-12) + + +### Features + +* **zdr:** accept zero data retention on people search and company search ([#2852](https://github.com/context-dot-dev/context-dev-cli/issues/2852)) ([a586170](https://github.com/context-dot-dev/context-dev-cli/commit/a586170472c5ba3999aa9ebbeabeff05cf9457ff)) + ## [1.27.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.26.0...v1.27.0) (2026-11-09) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 1b22491..52f6224 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.27.0" // x-release-please-version +const Version = "1.28.0" // x-release-please-version