From df232b58f81c68fd6a914e7fe63882a0f3de9fd4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 21:18:24 +0000 Subject: [PATCH 01/12] feat(api): api update --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a5e14f2..63f9b32 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.8.0 + github.com/context-dot-dev/context-go-sdk/v2 v2.9.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 738ff27..3554fa9 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.8.0 h1:K7a/NQIXa4C3VLiF+1cCDyAMGIEnsva2CdkKaYqzC5Q= -github.com/context-dot-dev/context-go-sdk/v2 v2.8.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8= +github.com/context-dot-dev/context-go-sdk/v2 v2.9.0 h1:Lv27NRJ1PyQF9QKNjMLYvrc1uRKaBjFD3sj7YHOnGgw= +github.com/context-dot-dev/context-go-sdk/v2 v2.9.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 cf896af96f544ec110fac49559cc43957507bce3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 8 Aug 2026 06:57:09 +0000 Subject: [PATCH 02/12] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 97db86d..90b5514 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a0dda03bbb600917cfb9add468cc4c8c84351a8dbbf61644dbc353263ca1748f.yml -openapi_spec_hash: c24264f32a46d9317aac5af9d6a396f7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1c93116e47cab52ea63490f5bca186ed3acda8bbd7f0ce5a320effb9f5b72b1f.yml +openapi_spec_hash: f56204d55bd4bffb6e4d50d6a5d9471a config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From 18adfb09e23af7efc8a64370e13d5cc38fe73859 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 09:04:48 +0000 Subject: [PATCH 03/12] feat(api): api update --- .stats.yml | 4 ++-- pkg/cmd/batch_test.go | 3 ++- pkg/cmd/utility.go | 6 +++--- pkg/cmd/web.go | 6 ++++++ pkg/cmd/web_test.go | 2 ++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 90b5514..f9b95cb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1c93116e47cab52ea63490f5bca186ed3acda8bbd7f0ce5a320effb9f5b72b1f.yml -openapi_spec_hash: f56204d55bd4bffb6e4d50d6a5d9471a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7f75f39699c1298d16691b5a58b1312a229b78288fba6e2de4040ba1422e530f.yml +openapi_spec_hash: b3ad781596e4c52fde918cfaae54a5d4 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index 123f80d..bbafe6f 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -82,7 +82,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], 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: {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", "webhookUrl", @@ -109,6 +109,7 @@ func TestBatchSubmit(t *testing.T) { " country: de\n" + " excludeSelectors:\n" + " - x\n" + + " includeHTML: true\n" + " includeImages: true\n" + " includeLinks: true\n" + " includeSelectors:\n" + diff --git a/pkg/cmd/utility.go b/pkg/cmd/utility.go index 5376d1b..4173edf 100644 --- a/pkg/cmd/utility.go +++ b/pkg/cmd/utility.go @@ -16,18 +16,18 @@ import ( var utilityPrefetch = cli.Command{ Name: "prefetch", - Usage: "Signal that you may fetch brand data soon to improve latency. The type field\nselects what to prefetch (currently only 'brand') and identifier carries exactly\none lookup key: a domain, or an email whose domain is extracted and validated\n(free email providers and disposable email addresses are not allowed).", + 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, Flags: []cli.Flag{ &requestflag.Flag[map[string]any]{ Name: "identifier", - Usage: "Identifier of the brand to prefetch. Provide exactly one of domain or email.", + Usage: "Identifier of the target to prefetch. Provide exactly one of domain or email.", Required: true, BodyPath: "identifier", }, &requestflag.Flag[string]{ Name: "type", - Usage: "What to prefetch. Currently only 'brand' is supported.", + Usage: "What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the styleguide cache.", Required: true, BodyPath: "type", }, diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 04af894..4db1274 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -832,6 +832,12 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ Default: false, QueryPath: "includeFrames", }, + &requestflag.Flag[any]{ + 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[any]{ Name: "include-images", Usage: "Include image references in Markdown output", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 3505637..0c173b3 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -522,6 +522,7 @@ func TestWebWebScrapeMd(t *testing.T) { "--exclude-selector", "[x]", "--headers", "{foo: J!}", "--include-frames", "'true'", + "--include-html", "'true'", "--include-images", "'true'", "--include-links", "'true'", "--include-selector", "[x]", @@ -553,6 +554,7 @@ func TestWebWebScrapeMd(t *testing.T) { "--exclude-selector", "[x]", "--headers", "{foo: J!}", "--include-frames", "'true'", + "--include-html", "'true'", "--include-images", "'true'", "--include-links", "'true'", "--include-selector", "[x]", From f99b5a2715691e02def5faf9d9792d7094e2c5f9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2026 07:47:15 +0000 Subject: [PATCH 04/12] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f9b95cb..0829be8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7f75f39699c1298d16691b5a58b1312a229b78288fba6e2de4040ba1422e530f.yml -openapi_spec_hash: b3ad781596e4c52fde918cfaae54a5d4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5a88256ce88b7bc7854211e67446bc71bc52975a2d62263e1194bec7cf6c2f16.yml +openapi_spec_hash: f5011cea07c6c4a7d2984d6be85ffe49 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From 921e22cf045cb2c55d946166bb53c1ec0454b8a6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 09:21:28 +0000 Subject: [PATCH 05/12] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0829be8..9ed440e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5a88256ce88b7bc7854211e67446bc71bc52975a2d62263e1194bec7cf6c2f16.yml -openapi_spec_hash: f5011cea07c6c4a7d2984d6be85ffe49 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c0a0223a614d6793c76c77cb5443276adf09ffa1a4d6761aae240d30a65d71e6.yml +openapi_spec_hash: 1aa54f261fd2238035711a73618c51cd config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From fbc079409d0528530a71893db93ab734342cd8d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:44:07 +0000 Subject: [PATCH 06/12] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9ed440e..3f88b9d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c0a0223a614d6793c76c77cb5443276adf09ffa1a4d6761aae240d30a65d71e6.yml -openapi_spec_hash: 1aa54f261fd2238035711a73618c51cd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-662e436bab5a74933ca1d08ac370c34ef632285b7aec23d95b1b442b2291d589.yml +openapi_spec_hash: 34399fa7028ac361abee1a0a4f139093 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From eb22b56ccf04e0c18195a7bc0f5289de452c2952 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Aug 2026 20:44:19 +0000 Subject: [PATCH 07/12] feat(api): api update --- .stats.yml | 4 +-- pkg/cmd/batch_test.go | 6 ++-- pkg/cmd/parse.go | 10 +++---- pkg/cmd/parse_test.go | 30 +++++++++---------- pkg/cmd/web.go | 38 ++++++++++++------------ pkg/cmd/web_test.go | 68 +++++++++++++++++++++---------------------- 6 files changed, 78 insertions(+), 78 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3f88b9d..ef63af1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-662e436bab5a74933ca1d08ac370c34ef632285b7aec23d95b1b442b2291d589.yml -openapi_spec_hash: 34399fa7028ac361abee1a0a4f139093 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d31d405927ec58ac97c0a9732130aea18209c65a0f2f0a348aa91c333535305e.yml +openapi_spec_hash: 0ede81f7fd98f41bc6bbc4167300bfb9 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go index bbafe6f..82a5e97 100644 --- a/pkg/cmd/batch_test.go +++ b/pkg/cmd/batch_test.go @@ -82,7 +82,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: {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", "webhookUrl", @@ -117,8 +117,8 @@ func TestBatchSubmit(t *testing.T) { " maxAgeMs: 0\n" + " pdf:\n" + " end: 1\n" + - " ocr: 'true'\n" + - " shouldParse: 'true'\n" + + " ocr: true\n" + + " shouldParse: true\n" + " start: 1\n" + " settleAnimations: true\n" + " shortenBase64Images: true\n" + diff --git a/pkg/cmd/parse.go b/pkg/cmd/parse.go index c047893..7f53188 100644 --- a/pkg/cmd/parse.go +++ b/pkg/cmd/parse.go @@ -37,19 +37,19 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ Usage: "Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.", QueryPath: "extension", }, - &requestflag.Flag[any]{ + &requestflag.Flag[bool]{ Name: "include-images", Usage: "Include image references in Markdown output", Default: false, QueryPath: "includeImages", }, - &requestflag.Flag[any]{ + &requestflag.Flag[bool]{ Name: "include-links", Usage: "Preserve hyperlinks in Markdown output", Default: true, QueryPath: "includeLinks", }, - &requestflag.Flag[any]{ + &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.", Default: false, @@ -61,7 +61,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ Default: map[string]any{}, QueryPath: "pdf", }, - &requestflag.Flag[any]{ + &requestflag.Flag[bool]{ Name: "shorten-base64-images", Usage: "Shorten base64-encoded image data in the Markdown output", Default: true, @@ -72,7 +72,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{ 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", }, - &requestflag.Flag[any]{ + &requestflag.Flag[bool]{ Name: "use-main-content-only", Usage: "Extract only the main content from HTML-like inputs", Default: false, diff --git a/pkg/cmd/parse_test.go b/pkg/cmd/parse_test.go index 8177b5d..fd11604 100644 --- a/pkg/cmd/parse_test.go +++ b/pkg/cmd/parse_test.go @@ -19,14 +19,14 @@ func TestParseHandle(t *testing.T) { "--body", mocktest.TestFile(t, "Example data"), "--client", "x", "--extension", "txt", - "--include-images", "'true'", - "--include-links", "'true'", - "--ocr", "'true'", + "--include-images=true", + "--include-links=true", + "--ocr=true", "--pdf", "{end: 1, start: 1}", - "--shorten-base64-images", "'true'", + "--shorten-base64-images=true", "--tag", "production", "--tag", "team-alpha", - "--use-main-content-only", "'true'", + "--use-main-content-only=true", "--zdr", "enabled", ) }) @@ -43,15 +43,15 @@ func TestParseHandle(t *testing.T) { "--body", mocktest.TestFile(t, "Example data"), "--client", "x", "--extension", "txt", - "--include-images", "'true'", - "--include-links", "'true'", - "--ocr", "'true'", + "--include-images=true", + "--include-links=true", + "--ocr=true", "--pdf.end", "1", "--pdf.start", "1", - "--shorten-base64-images", "'true'", + "--shorten-base64-images=true", "--tag", "production", "--tag", "team-alpha", - "--use-main-content-only", "'true'", + "--use-main-content-only=true", "--zdr", "enabled", ) }) @@ -65,14 +65,14 @@ func TestParseHandle(t *testing.T) { "parse", "handle", "--client", "x", "--extension", "txt", - "--include-images", "'true'", - "--include-links", "'true'", - "--ocr", "'true'", + "--include-images=true", + "--include-links=true", + "--ocr=true", "--pdf", "{end: 1, start: 1}", - "--shorten-base64-images", "'true'", + "--shorten-base64-images=true", "--tag", "production", "--tag", "team-alpha", - "--use-main-content-only", "'true'", + "--use-main-content-only=true", "--zdr", "enabled", ) }) diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 4db1274..52420fa 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -265,7 +265,7 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{ 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[any]{ + &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, @@ -630,7 +630,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(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[any]{ + &requestflag.Flag[bool]{ Name: "include-frames", Usage: "When true, iframes are rendered inline into the returned HTML.", Default: false, @@ -653,7 +653,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ Default: map[string]any{"shouldParse": true, "ocr": false}, QueryPath: "pdf", }, - &requestflag.Flag[any]{ + &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, @@ -669,7 +669,7 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ 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[any]{ + &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, @@ -696,12 +696,12 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{ 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[any]{ + &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[any]{ + &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", @@ -730,7 +730,7 @@ 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[any]{ + &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, @@ -772,12 +772,12 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ HideHelpCommand: true, }, map[string][]requestflag.HasOuterFlag{ "enrichment": { - &requestflag.InnerFlag[any]{ + &requestflag.InnerFlag[bool]{ Name: "enrichment.classification", Usage: "Classify each image by visual asset type.", InnerField: "classification", }, - &requestflag.InnerFlag[any]{ + &requestflag.InnerFlag[bool]{ Name: "enrichment.hosted-url", Usage: "Host materializable images on the Brand.dev CDN and return their URL and MIME type.", InnerField: "hostedUrl", @@ -787,7 +787,7 @@ var webWebScrapeImages = requestflag.WithInnerFlags(cli.Command{ Usage: "Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.", InnerField: "maxTimePerMs", }, - &requestflag.InnerFlag[any]{ + &requestflag.InnerFlag[bool]{ Name: "enrichment.resolution", Usage: "Measure image width and height when possible.", InnerField: "resolution", @@ -826,25 +826,25 @@ var webWebScrapeMd = requestflag.WithInnerFlags(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[any]{ + &requestflag.Flag[bool]{ Name: "include-frames", Usage: "When true, the contents of iframes are rendered to Markdown.", Default: false, QueryPath: "includeFrames", }, - &requestflag.Flag[any]{ + &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[any]{ + &requestflag.Flag[bool]{ Name: "include-images", Usage: "Include image references in Markdown output", Default: false, QueryPath: "includeImages", }, - &requestflag.Flag[any]{ + &requestflag.Flag[bool]{ Name: "include-links", Usage: "Preserve hyperlinks in Markdown output", Default: true, @@ -867,13 +867,13 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ Default: map[string]any{"shouldParse": true, "ocr": false}, QueryPath: "pdf", }, - &requestflag.Flag[any]{ + &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[any]{ + &requestflag.Flag[bool]{ Name: "shorten-base64-images", Usage: "Shorten base64-encoded image data in the Markdown output", Default: true, @@ -889,7 +889,7 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ 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[any]{ + &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, @@ -916,12 +916,12 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{ 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[any]{ + &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[any]{ + &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", diff --git a/pkg/cmd/web_test.go b/pkg/cmd/web_test.go index 0c173b3..7c6cf11 100644 --- a/pkg/cmd/web_test.go +++ b/pkg/cmd/web_test.go @@ -163,7 +163,7 @@ func TestWebScreenshot(t *testing.T) { "--direct-url", "https://example.com", "--domain", "xxx", "--full-screenshot", "true", - "--handle-cookie-popup", "'true'", + "--handle-cookie-popup=true", "--max-age-ms", "0", "--page", "login", "--scroll-offset", "0", @@ -190,7 +190,7 @@ func TestWebScreenshot(t *testing.T) { "--direct-url", "https://example.com", "--domain", "xxx", "--full-screenshot", "true", - "--handle-cookie-popup", "'true'", + "--handle-cookie-popup=true", "--max-age-ms", "0", "--page", "login", "--scroll-offset", "0", @@ -417,15 +417,15 @@ func TestWebWebScrapeHTML(t *testing.T) { "--country", "de", "--exclude-selector", "[x]", "--headers", "{foo: J!}", - "--include-frames", "'true'", + "--include-frames=true", "--include-selector", "[x]", "--max-age-ms", "0", - "--pdf", "{end: 1, ocr: 'true', shouldParse: 'true', start: 1}", - "--settle-animations", "'true'", + "--pdf", "{end: 1, ocr: true, shouldParse: true, start: 1}", + "--settle-animations=true", "--tag", "production", "--tag", "team-alpha", "--timeout-ms", "1", - "--use-main-content-only", "'true'", + "--use-main-content-only=true", "--wait-for-ms", "0", "--zdr", "enabled", ) @@ -445,18 +445,18 @@ func TestWebWebScrapeHTML(t *testing.T) { "--country", "de", "--exclude-selector", "[x]", "--headers", "{foo: J!}", - "--include-frames", "'true'", + "--include-frames=true", "--include-selector", "[x]", "--max-age-ms", "0", "--pdf.end", "1", - "--pdf.ocr", "true", - "--pdf.should-parse", "true", + "--pdf.ocr=true", + "--pdf.should-parse=true", "--pdf.start", "1", - "--settle-animations", "'true'", + "--settle-animations=true", "--tag", "production", "--tag", "team-alpha", "--timeout-ms", "1", - "--use-main-content-only", "'true'", + "--use-main-content-only=true", "--wait-for-ms", "0", "--zdr", "enabled", ) @@ -472,8 +472,8 @@ func TestWebWebScrapeImages(t *testing.T) { "web", "web-scrape-images", "--url", "https://example.com", "--action", "[{do: wait, timeMs: 0}]", - "--dedupe", "'true'", - "--enrichment", "{classification: 'true', hostedUrl: 'true', maxTimePerMs: 1, resolution: 'true'}", + "--dedupe=true", + "--enrichment", "{classification: true, hostedUrl: true, maxTimePerMs: 1, resolution: true}", "--headers", "{foo: J!}", "--max-age-ms", "0", "--tag", "production", @@ -494,11 +494,11 @@ func TestWebWebScrapeImages(t *testing.T) { "web", "web-scrape-images", "--url", "https://example.com", "--action", "[{do: wait, timeMs: 0}]", - "--dedupe", "'true'", - "--enrichment.classification", "true", - "--enrichment.hosted-url", "true", + "--dedupe=true", + "--enrichment.classification=true", + "--enrichment.hosted-url=true", "--enrichment.max-time-per-ms", "1", - "--enrichment.resolution", "true", + "--enrichment.resolution=true", "--headers", "{foo: J!}", "--max-age-ms", "0", "--tag", "production", @@ -521,19 +521,19 @@ func TestWebWebScrapeMd(t *testing.T) { "--country", "de", "--exclude-selector", "[x]", "--headers", "{foo: J!}", - "--include-frames", "'true'", - "--include-html", "'true'", - "--include-images", "'true'", - "--include-links", "'true'", + "--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'", + "--pdf", "{end: 1, ocr: true, shouldParse: true, start: 1}", + "--settle-animations=true", + "--shorten-base64-images=true", "--tag", "production", "--tag", "team-alpha", "--timeout-ms", "1", - "--use-main-content-only", "'true'", + "--use-main-content-only=true", "--wait-for-ms", "0", "--zdr", "enabled", ) @@ -553,22 +553,22 @@ func TestWebWebScrapeMd(t *testing.T) { "--country", "de", "--exclude-selector", "[x]", "--headers", "{foo: J!}", - "--include-frames", "'true'", - "--include-html", "'true'", - "--include-images", "'true'", - "--include-links", "'true'", + "--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.ocr=true", + "--pdf.should-parse=true", "--pdf.start", "1", - "--settle-animations", "'true'", - "--shorten-base64-images", "'true'", + "--settle-animations=true", + "--shorten-base64-images=true", "--tag", "production", "--tag", "team-alpha", "--timeout-ms", "1", - "--use-main-content-only", "'true'", + "--use-main-content-only=true", "--wait-for-ms", "0", "--zdr", "enabled", ) From 76e57d14f55a960b18ddbe6a0eaf4e0e4c2471bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 01:59:50 +0000 Subject: [PATCH 08/12] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ef63af1..f194dd9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d31d405927ec58ac97c0a9732130aea18209c65a0f2f0a348aa91c333535305e.yml -openapi_spec_hash: 0ede81f7fd98f41bc6bbc4167300bfb9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-01745494602c4845bf7cf84a8f7449d8e53546eb096e3aa6949b89b452c5c90e.yml +openapi_spec_hash: dd4856e9595fab7a4aaa32a040c3060c config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From 01f0f2a589cc93e1a986be3b8a3e94ce6a94a0eb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 16 Aug 2026 15:49:12 +0000 Subject: [PATCH 09/12] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f194dd9..2039ac3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-01745494602c4845bf7cf84a8f7449d8e53546eb096e3aa6949b89b452c5c90e.yml -openapi_spec_hash: dd4856e9595fab7a4aaa32a040c3060c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c99300223257d60d7614e76585c62cfea40f43df0547db63c952b20c52f209f4.yml +openapi_spec_hash: 1d4e473f3c566b7a1c3def11b6d84fe0 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From 7e6e3b7c6d540b53660b82ec81cf1d92fc4fe1b5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 03:53:03 +0000 Subject: [PATCH 10/12] feat(api): api update --- .stats.yml | 4 ++-- pkg/cmd/brand.go | 22 ++++++++++++++++++++-- pkg/cmd/brand_test.go | 3 +++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2039ac3..983602e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c99300223257d60d7614e76585c62cfea40f43df0547db63c952b20c52f209f4.yml -openapi_spec_hash: 1d4e473f3c566b7a1c3def11b6d84fe0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4f279e7b1f0a52f5c917d4256e17188dfe330ddf7495146e2b1611e812605fdc.yml +openapi_spec_hash: 53a74c4cccbdec8590db38183840a446 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/pkg/cmd/brand.go b/pkg/cmd/brand.go index ba05fd9..249d26f 100644 --- a/pkg/cmd/brand.go +++ b/pkg/cmd/brand.go @@ -154,20 +154,38 @@ var brandRetrieveSimplified = cli.Command{ var brandSearch = cli.Command{ Name: "search", - Usage: "Search brands by name or domain and get back up to 10 lightweight matches\n(domain, name, logo). Name matches rank ahead of domain matches; within each\ngroup the most popular brands come first: by Tranco rank, then market cap for\nbrands outside the Tranco list, with text relevance breaking ties. Matching is\nprefix-based with no typo tolerance, so it is suited to autocomplete. Only\nbrands already in the Context.dev index are returned — use /brand/retrieve to\nfetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit\nper request on the Free and Starter plans.", + Usage: "Search indexed brands by name or domain", Suggest: true, Flags: []cli.Flag{ &requestflag.Flag[string]{ Name: "query", - Usage: "Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik').", + Usage: "Search term, matched against the fields selected by queryBy (e.g. 'nike', 'nike.com', 'nik').", Required: true, QueryPath: "query", }, + &requestflag.Flag[bool]{ + Name: "autocomplete", + Usage: "Whether the search term matches by prefix, so partial words match as they are typed (e.g. 'nik' matches Nike). Set to false to match whole words only.", + Default: true, + QueryPath: "autocomplete", + }, + &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.", + Default: []string{"name", "domain"}, + QueryPath: "queryBy", + }, &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", }, + &requestflag.Flag[int64]{ + Name: "typo-tolerance", + Usage: "Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no typo tolerance).", + Default: 0, + QueryPath: "typoTolerance", + }, }, Action: handleBrandSearch, HideHelpCommand: true, diff --git a/pkg/cmd/brand_test.go b/pkg/cmd/brand_test.go index 3a844ba..a46bd9c 100644 --- a/pkg/cmd/brand_test.go +++ b/pkg/cmd/brand_test.go @@ -71,8 +71,11 @@ func TestBrandSearch(t *testing.T) { "--api-key", "string", "brand", "search", "--query", "x", + "--autocomplete=true", + "--query-by", "name", "--tag", "production", "--tag", "team-alpha", + "--typo-tolerance", "0", ) }) } From 6a9b2f59ae223e0e70e61a8e63012c8c4160a431 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 04:30:04 +0000 Subject: [PATCH 11/12] feat(api): manual updates --- .stats.yml | 6 +- pkg/cmd/cmd.go | 8 +++ pkg/cmd/news.go | 147 +++++++++++++++++++++++++++++++++++++++++++ pkg/cmd/news_test.go | 86 +++++++++++++++++++++++++ 4 files changed, 244 insertions(+), 3 deletions(-) create mode 100644 pkg/cmd/news.go create mode 100644 pkg/cmd/news_test.go diff --git a/.stats.yml b/.stats.yml index 983602e..4b9b1cb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4f279e7b1f0a52f5c917d4256e17188dfe330ddf7495146e2b1611e812605fdc.yml +configured_endpoints: 41 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5dbe631ce516ca688273053ddcb58870561bd6dc76fa75df354c954d7af65a3c.yml openapi_spec_hash: 53a74c4cccbdec8590db38183840a446 -config_hash: 920678668dd2da6f8966fbf1b8fde4e2 +config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index c2f399f..673b8eb 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -187,6 +187,14 @@ func init() { &peopleEnrich, }, }, + { + Name: "news", + Category: "API RESOURCE", + Suggest: true, + Commands: []*cli.Command{ + &newsSearch, + }, + }, { Name: "@manpages", Usage: "Generate documentation for 'man'", diff --git a/pkg/cmd/news.go b/pkg/cmd/news.go new file mode 100644 index 0000000..e9f54cc --- /dev/null +++ b/pkg/cmd/news.go @@ -0,0 +1,147 @@ +// 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 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.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[map[string]any]{ + Name: "search-by", + Usage: "What to search for.", + Required: true, + BodyPath: "searchBy", + }, + &requestflag.Flag[*string]{ + Name: "cursor", + Usage: "Opaque next_cursor from the previous response, or null for the first page.", + BodyPath: "cursor", + }, + &requestflag.Flag[map[string]any]{ + Name: "filter-by", + Usage: "Optional result filters.", + Default: map[string]any{}, + BodyPath: "filterBy", + }, + &requestflag.Flag[int64]{ + Name: "limit", + Usage: "Maximum results to return. Defaults to 10.", + Default: 10, + BodyPath: "limit", + }, + &requestflag.Flag[map[string]any]{ + Name: "sort-by", + Usage: "Result ordering. Defaults to newest.", + Default: map[string]any{"type": "newest"}, + BodyPath: "sortBy", + }, + &requestflag.Flag[[]string]{ + Name: "tag", + Usage: "Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.", + BodyPath: "tags", + }, + }, + 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", + Usage: "Article languages to include. Up to 3.", + InnerField: "articleLanguage", + }, + &requestflag.InnerFlag[[]string]{ + Name: "filter-by.article-type", + Usage: "Article types to include. Up to 3.", + InnerField: "articleType", + }, + &requestflag.InnerFlag[map[string]any]{ + Name: "filter-by.date", + Usage: "Published-at window in epoch milliseconds.", + InnerField: "date", + }, + &requestflag.InnerFlag[[]string]{ + Name: "filter-by.source-country", + Usage: "Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3.", + InnerField: "sourceCountry", + }, + &requestflag.InnerFlag[[]string]{ + Name: "filter-by.source-domain", + Usage: "Publisher domains to include. Up to 3.", + InnerField: "sourceDomain", + }, + }, + "sort-by": { + &requestflag.InnerFlag[string]{ + Name: "sort-by.type", + Usage: "Result ordering.", + InnerField: "type", + }, + }, +}) + +func handleNewsSearch(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.NewsSearchParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.News.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: "news search", + Transform: transform, + }) +} diff --git a/pkg/cmd/news_test.go b/pkg/cmd/news_test.go new file mode 100644 index 0000000..5260a23 --- /dev/null +++ b/pkg/cmd/news_test.go @@ -0,0 +1,86 @@ +// 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 TestNewsSearch(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "news", "search", + "--search-by", "{entity: {name: xx, type: name}, type: entity}", + "--cursor", "cursor", + "--filter-by", "{articleLanguage: [ar], articleType: [editorial], date: {from: 0, to: 0}, sourceCountry: [ae], sourceDomain: [x]}", + "--limit", "1", + "--sort-by", "{type: relevance}", + "--tag", "production", + "--tag", "team-alpha", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(newsSearch) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "news", "search", + "--search-by.entity", "{name: xx, type: name}", + "--search-by.type", "entity", + "--cursor", "cursor", + "--filter-by.article-language", "[ar]", + "--filter-by.article-type", "[editorial]", + "--filter-by.date", "{from: 0, to: 0}", + "--filter-by.source-country", "[ae]", + "--filter-by.source-domain", "[x]", + "--limit", "1", + "--sort-by.type", "relevance", + "--tag", "production", + "--tag", "team-alpha", + ) + }) + + t.Run("piping data", func(t *testing.T) { + // Test piping YAML data over stdin + pipeData := []byte("" + + "searchBy:\n" + + " entity:\n" + + " name: xx\n" + + " type: name\n" + + " type: entity\n" + + "cursor: cursor\n" + + "filterBy:\n" + + " articleLanguage:\n" + + " - ar\n" + + " articleType:\n" + + " - editorial\n" + + " date:\n" + + " from: 0\n" + + " to: 0\n" + + " sourceCountry:\n" + + " - ae\n" + + " sourceDomain:\n" + + " - x\n" + + "limit: 1\n" + + "sortBy:\n" + + " type: relevance\n" + + "tags:\n" + + " - production\n" + + " - team-alpha\n") + mocktest.TestRunMockTestWithPipeAndFlags( + t, pipeData, + "--api-key", "string", + "news", "search", + ) + }) +} From b111d48940a18a06dc86f153fd8636daf119d91f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 04:30:26 +0000 Subject: [PATCH 12/12] release: 1.6.0 --- .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 fbd9082..7deae33 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.5.0" + ".": "1.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 89cdc76..6493c24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 1.6.0 (2026-08-17) + +Full Changelog: [v1.5.0...v1.6.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.5.0...v1.6.0) + +### Features + +* **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:** manual updates ([6a9b2f5](https://github.com/context-dot-dev/context-dev-cli/commit/6a9b2f59ae223e0e70e61a8e63012c8c4160a431)) + ## 1.5.0 (2026-08-07) Full Changelog: [v1.4.0...v1.5.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.4.0...v1.5.0) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index cf77cd0..855000d 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.5.0" // x-release-please-version +const Version = "1.6.0" // x-release-please-version