From 87780eb7d4bbb0df65fde3ecfbc74bfa191c04b7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Jul 2026 02:03:34 +0000 Subject: [PATCH 1/7] chore(internal): codegen related update --- go.mod | 2 -- go.sum | 5 ----- 2 files changed, 7 deletions(-) diff --git a/go.mod b/go.mod index a000854..05dad28 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ 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.4.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 @@ -38,7 +37,6 @@ require ( github.com/rivo/uniseg v0.4.7 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/sjson v1.2.5 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect golang.org/x/sync v0.15.0 // indirect golang.org/x/text v0.3.8 // indirect diff --git a/go.sum b/go.sum index e9ff7cd..4b63f4b 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,6 @@ 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.4.0 h1:mehuyGuUzgflR7rQpSlPaH7lNj2A8hdtf1+WG4U4h1I= -github.com/context-dot-dev/context-go-sdk/v2 v2.4.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= @@ -57,7 +55,6 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -65,8 +62,6 @@ github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JT github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= -github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/urfave/cli-docs/v3 v3.0.0-alpha6 h1:w/l/N0xw1rO/aHRIGXJ0lDwwYFOzilup1qGvIytP3BI= github.com/urfave/cli-docs/v3 v3.0.0-alpha6/go.mod h1:p7Z4lg8FSTrPB9GTaNyTrK3ygffHZcK3w0cU2VE+mzU= github.com/urfave/cli/v3 v3.3.2 h1:BYFVnhhZ8RqT38DxEYVFPPmGFTEf7tJwySTXsVRrS/o= From 0b487b175434d6db1ce66501382164a55b68c557 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Jul 2026 04:09:54 +0000 Subject: [PATCH 2/7] feat(api): api update --- go.mod | 2 ++ go.sum | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/go.mod b/go.mod index 05dad28..12f3f67 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +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.5.0 github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 @@ -37,6 +38,7 @@ require ( github.com/rivo/uniseg v0.4.7 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/sjson v1.2.5 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect golang.org/x/sync v0.15.0 // indirect golang.org/x/text v0.3.8 // indirect diff --git a/go.sum b/go.sum index 4b63f4b..2e31ee8 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +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.5.0 h1:FK79MDMznyABXAUjRGO44Xmvl6Bi0nz1HBSlwYyMU6U= +github.com/context-dot-dev/context-go-sdk/v2 v2.5.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= @@ -55,6 +57,7 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -62,6 +65,8 @@ github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JT github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/urfave/cli-docs/v3 v3.0.0-alpha6 h1:w/l/N0xw1rO/aHRIGXJ0lDwwYFOzilup1qGvIytP3BI= github.com/urfave/cli-docs/v3 v3.0.0-alpha6/go.mod h1:p7Z4lg8FSTrPB9GTaNyTrK3ygffHZcK3w0cU2VE+mzU= github.com/urfave/cli/v3 v3.3.2 h1:BYFVnhhZ8RqT38DxEYVFPPmGFTEf7tJwySTXsVRrS/o= From 3c2c3c2daf40ad8df4df6b9861ed88291b539f91 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:12:58 +0000 Subject: [PATCH 3/7] feat(api): api update --- .stats.yml | 4 ++-- pkg/cmd/monitor.go | 22 ++++++++++------------ pkg/cmd/monitor_test.go | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0ac1eb3..6da4682 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-242450ea46eb8c3e843fd6c4bf87e73192b5f62f6da697cd091d13c6aa7a991b.yml -openapi_spec_hash: c1c561976de1abcacede71fd5ab9b3d9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2bf2b44f6593c44b2948683469bbb2b09cd8e90c97b12057fac6220cf0d2eee7.yml +openapi_spec_hash: ae8b5109ec997cac8d3e6ec96040f6c8 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index 1842db3..fac0f1c 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -19,34 +19,32 @@ var monitorsCreate = requestflag.WithInnerFlags(cli.Command{ 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.", Suggest: true, Flags: []cli.Flag{ - &requestflag.Flag[map[string]any]{ - Name: "change-detection", - Usage: "Discriminated union describing how changes are detected.", - Required: true, - BodyPath: "change_detection", - }, &requestflag.Flag[string]{ Name: "name", Required: true, BodyPath: "name", }, - &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.", - Required: true, - BodyPath: "schedule", - }, &requestflag.Flag[map[string]any]{ Name: "target", Usage: "Discriminated union describing what the monitor watches.", Required: true, BodyPath: "target", }, + &requestflag.Flag[map[string]any]{ + Name: "change-detection", + Usage: "Discriminated union describing how changes are detected.", + 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`.", BodyPath: "mode", }, + &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.", + BodyPath: "schedule", + }, &requestflag.Flag[[]string]{ Name: "tag", Usage: "User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed.", diff --git a/pkg/cmd/monitor_test.go b/pkg/cmd/monitor_test.go index 40e2c3c..ddfa7fb 100644 --- a/pkg/cmd/monitor_test.go +++ b/pkg/cmd/monitor_test.go @@ -16,11 +16,11 @@ func TestMonitorsCreate(t *testing.T) { t, "--api-key", "string", "monitors", "create", - "--change-detection", "{type: exact}", "--name", "Acme pricing page", - "--schedule", "{frequency: 6, type: interval, unit: hours}", "--target", "{type: page, url: https://acme.com/pricing, normalize_whitespace: true}", + "--change-detection", "{type: exact}", "--mode", "web", + "--schedule", "{frequency: 6, type: interval, unit: hours}", "--tag", "pricing", "--tag", "competitor", "--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed]}", @@ -36,13 +36,13 @@ func TestMonitorsCreate(t *testing.T) { t, "--api-key", "string", "monitors", "create", - "--change-detection", "{type: exact}", "--name", "Acme pricing page", + "--target", "{type: page, url: https://acme.com/pricing, normalize_whitespace: true}", + "--change-detection", "{type: exact}", + "--mode", "web", "--schedule.frequency", "6", "--schedule.type", "interval", "--schedule.unit", "hours", - "--target", "{type: page, url: https://acme.com/pricing, normalize_whitespace: true}", - "--mode", "web", "--tag", "pricing", "--tag", "competitor", "--webhook.url", "https://example.com/webhook", @@ -53,18 +53,18 @@ func TestMonitorsCreate(t *testing.T) { t.Run("piping data", func(t *testing.T) { // Test piping YAML data over stdin pipeData := []byte("" + - "change_detection:\n" + - " type: exact\n" + "name: Acme pricing page\n" + - "schedule:\n" + - " frequency: 6\n" + - " type: interval\n" + - " unit: hours\n" + "target:\n" + " type: page\n" + " url: https://acme.com/pricing\n" + " normalize_whitespace: true\n" + + "change_detection:\n" + + " type: exact\n" + "mode: web\n" + + "schedule:\n" + + " frequency: 6\n" + + " type: interval\n" + + " unit: hours\n" + "tags:\n" + " - pricing\n" + " - competitor\n" + From b8de4ec1e8a39c97e3bbf04dd259c9fa3e8aa44f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 06:43:28 +0000 Subject: [PATCH 4/7] feat(api): api update --- .stats.yml | 4 ++-- pkg/cmd/monitor_test.go | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6da4682..3f4cd2e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2bf2b44f6593c44b2948683469bbb2b09cd8e90c97b12057fac6220cf0d2eee7.yml -openapi_spec_hash: ae8b5109ec997cac8d3e6ec96040f6c8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-91f4286859fc23813c5255b877395c87dd81520c3913fdfdae3cfa343e1a4873.yml +openapi_spec_hash: 71746b5b65f20617ee021e071d5f7f92 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/pkg/cmd/monitor_test.go b/pkg/cmd/monitor_test.go index ddfa7fb..983650e 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, normalize_whitespace: true}", + "--target", "{type: page, url: https://acme.com/pricing, 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, normalize_whitespace: true}", + "--target", "{type: page, url: https://acme.com/pricing, 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", @@ -57,6 +57,9 @@ func TestMonitorsCreate(t *testing.T) { "target:\n" + " type: page\n" + " url: https://acme.com/pricing\n" + + " instructions: >-\n" + + " Report pricing or plan availability changes. Ignore counters, timestamps,\n" + + " testimonials, and navigation.\n" + " normalize_whitespace: true\n" + "change_detection:\n" + " type: exact\n" + @@ -107,7 +110,7 @@ func TestMonitorsUpdate(t *testing.T) { "--status", "active", "--tag", "pricing", "--tag", "competitor", - "--target", "{type: page, url: https://acme.com/pricing, normalize_whitespace: true}", + "--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]}", ) }) @@ -130,7 +133,7 @@ func TestMonitorsUpdate(t *testing.T) { "--status", "active", "--tag", "pricing", "--tag", "competitor", - "--target", "{type: page, url: https://acme.com/pricing, normalize_whitespace: true}", + "--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]", ) @@ -153,6 +156,9 @@ func TestMonitorsUpdate(t *testing.T) { "target:\n" + " type: page\n" + " url: https://acme.com/pricing\n" + + " instructions: >-\n" + + " Report pricing or plan availability changes. Ignore counters, timestamps,\n" + + " testimonials, and navigation.\n" + " normalize_whitespace: true\n" + "webhook:\n" + " url: https://example.com/webhook\n" + From cd614ef874d215798009a6c66a96420b3f7590ff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 07:19:05 +0000 Subject: [PATCH 5/7] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3f4cd2e..6183d03 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-91f4286859fc23813c5255b877395c87dd81520c3913fdfdae3cfa343e1a4873.yml -openapi_spec_hash: 71746b5b65f20617ee021e071d5f7f92 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9ee1d9a454772b4cd978d5e0ad8ead21d732fa559686130daf0540084b5f6be5.yml +openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 From 5b0ef3ebae76534b4a1997d4e13311cc225bb555 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 07:57:46 +0000 Subject: [PATCH 6/7] feat(api): manual updates --- .stats.yml | 6 +- pkg/cmd/batch.go | 381 ++++++++++++++++++++++++++++++++++++++++++ pkg/cmd/batch_test.go | 117 +++++++++++++ pkg/cmd/cmd.go | 12 ++ 4 files changed, 513 insertions(+), 3 deletions(-) create mode 100644 pkg/cmd/batch.go create mode 100644 pkg/cmd/batch_test.go diff --git a/.stats.yml b/.stats.yml index 6183d03..a173ebe 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9ee1d9a454772b4cd978d5e0ad8ead21d732fa559686130daf0540084b5f6be5.yml +configured_endpoints: 37 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6dfc33639ef5ad1fd0fa05f9f00fcdd59940188ef625252c6ee9db85c6f8fc59.yml openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02 -config_hash: 70e7e80b5e87f94981bee396c6cd41e8 +config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/pkg/cmd/batch.go b/pkg/cmd/batch.go new file mode 100644 index 0000000..8da539c --- /dev/null +++ b/pkg/cmd/batch.go @@ -0,0 +1,381 @@ +// 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 batchRetrieve = cli.Command{ + Name: "retrieve", + Usage: "Check progress and get download links when the batch finishes. Also returns the\nrejected-URL list and webhook signing secret from submission, so nothing is lost\nif the submit response was dropped.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "batch-id", + Usage: "ID of the batch to retrieve or cancel.", + Required: true, + PathParam: "batch_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: handleBatchRetrieve, + HideHelpCommand: true, +} + +var batchList = cli.Command{ + Name: "list", + Usage: "List your batches from newest to oldest. Filter by status or continue with a\ncursor.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "cursor", + Usage: "Cursor from the previous page.", + QueryPath: "cursor", + }, + &requestflag.Flag[int64]{ + Name: "limit", + Usage: "Batches per page. Defaults to 25.", + QueryPath: "limit", + }, + &requestflag.Flag[string]{ + Name: "status", + Usage: "Filter by status.", + 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: handleBatchList, + HideHelpCommand: true, +} + +var batchCancel = cli.Command{ + Name: "cancel", + Usage: "Stop a batch from starting new pages. In-progress pages finish, and unused\ncredits are refunded.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "batch-id", + Usage: "ID of the batch to retrieve or cancel.", + Required: true, + PathParam: "batch_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: handleBatchCancel, + HideHelpCommand: true, +} + +var batchGetResults = cli.Command{ + Name: "get-results", + Usage: "Page through the result records of a finished batch as JSON, in the same order\nas the downloadable result files. Use this instead of downloading and parsing\nthe NDJSON files yourself.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "batch-id", + Usage: "ID of the batch to retrieve or cancel.", + Required: true, + PathParam: "batch_id", + }, + &requestflag.Flag[string]{ + Name: "cursor", + Usage: "next_cursor from the previous page.", + QueryPath: "cursor", + }, + &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.", + 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: handleBatchGetResults, + HideHelpCommand: true, +} + +var batchSubmit = requestflag.WithInnerFlags(cli.Command{ + Name: "submit", + Usage: "Retrieve and normalize a person profile from identifiers.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[map[string]any]{ + Name: "identifiers", + Usage: "Known identifiers for the person. At least one identifier is required.", + Required: true, + BodyPath: "identifiers", + }, + &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: handleBatchSubmit, + HideHelpCommand: true, +}, map[string][]requestflag.HasOuterFlag{ + "identifiers": { + &requestflag.InnerFlag[string]{ + Name: "identifiers.linkedin-url", + Usage: "LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/.", + InnerField: "linkedinUrl", + }, + }, +}) + +func handleBatchRetrieve(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("batch-id") && len(unusedArgs) > 0 { + cmd.Set("batch-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.BatchGetParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Batch.Get( + ctx, + cmd.Value("batch-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: "batch retrieve", + Transform: transform, + }) +} + +func handleBatchList(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.BatchListParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Batch.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: "batch list", + Transform: transform, + }) +} + +func handleBatchCancel(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("batch-id") && len(unusedArgs) > 0 { + cmd.Set("batch-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.BatchCancelParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Batch.Cancel( + ctx, + cmd.Value("batch-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: "batch cancel", + Transform: transform, + }) +} + +func handleBatchGetResults(ctx context.Context, cmd *cli.Command) error { + client := contextdev.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("batch-id") && len(unusedArgs) > 0 { + cmd.Set("batch-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.BatchGetResultsParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Batch.GetResults( + ctx, + cmd.Value("batch-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: "batch get-results", + Transform: transform, + }) +} + +func handleBatchSubmit(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.BatchSubmitParams{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Batch.Submit(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: "batch submit", + Transform: transform, + }) +} diff --git a/pkg/cmd/batch_test.go b/pkg/cmd/batch_test.go new file mode 100644 index 0000000..84173a8 --- /dev/null +++ b/pkg/cmd/batch_test.go @@ -0,0 +1,117 @@ +// 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 TestBatchRetrieve(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "batch", "retrieve", + "--batch-id", "batch_9f2c8a", + "--tag", "production", + "--tag", "team-alpha", + ) + }) +} + +func TestBatchList(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "batch", "list", + "--cursor", "cursor", + "--limit", "1", + "--status", "queued", + "--tag", "production", + "--tag", "team-alpha", + ) + }) +} + +func TestBatchCancel(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "batch", "cancel", + "--batch-id", "batch_9f2c8a", + "--tag", "production", + "--tag", "team-alpha", + ) + }) +} + +func TestBatchGetResults(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "batch", "get-results", + "--batch-id", "batch_9f2c8a", + "--cursor", "cursor", + "--limit", "1", + "--tag", "production", + "--tag", "team-alpha", + ) + }) +} + +func TestBatchSubmit(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "batch", "submit", + "--identifiers", "{linkedinUrl: https://www.linkedin.com/in/yahia-bakour/}", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-ms", "1000", + ) + }) + + 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", + "--identifiers.linkedin-url", "https://www.linkedin.com/in/yahia-bakour/", + "--tag", "production", + "--tag", "team-alpha", + "--timeout-ms", "1000", + ) + }) + + t.Run("piping data", func(t *testing.T) { + // Test piping YAML data over stdin + pipeData := []byte("" + + "identifiers:\n" + + " linkedinUrl: https://www.linkedin.com/in/yahia-bakour/\n" + + "tags:\n" + + " - production\n" + + " - team-alpha\n" + + "timeoutMS: 1000\n") + mocktest.TestRunMockTestWithPipeAndFlags( + t, pipeData, + "--api-key", "string", + "batch", "submit", + ) + }) +} diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index c17a6f6..a90d921 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -165,6 +165,18 @@ func init() { &monitorsRun, }, }, + { + Name: "batch", + Category: "API RESOURCE", + Suggest: true, + Commands: []*cli.Command{ + &batchRetrieve, + &batchList, + &batchCancel, + &batchGetResults, + &batchSubmit, + }, + }, { Name: "@manpages", Usage: "Generate documentation for 'man'", From 3bc06459d977a08fd1238f6a82fd10af1bf6f6ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 07:58:07 +0000 Subject: [PATCH 7/7] release: 1.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 16 ++++++++++++++++ pkg/cmd/version.go | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2601677..d0ab664 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.0" + ".": "1.2.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fdf7d1e..ccd08dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 1.2.0 (2026-07-30) + +Full Changelog: [v1.1.0...v1.2.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.1.0...v1.2.0) + +### Features + +* **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:** manual updates ([5b0ef3e](https://github.com/context-dot-dev/context-dev-cli/commit/5b0ef3ebae76534b4a1997d4e13311cc225bb555)) + + +### Chores + +* **internal:** codegen related update ([87780eb](https://github.com/context-dot-dev/context-dev-cli/commit/87780eb7d4bbb0df65fde3ecfbc74bfa191c04b7)) + ## 1.1.0 (2026-07-22) Full Changelog: [v1.0.0...v1.1.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.0.0...v1.1.0) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index a47345e..a9464c4 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "1.1.0" // x-release-please-version +const Version = "1.2.0" // x-release-please-version