Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.3.0"
".": "1.4.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 37
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-758c3a2fbd5b7be61c8e6e0ad2e6a5ec30695747bb675960d888c497647d13d7.yml
openapi_spec_hash: 00002d90bde02f67e174368ae470c597
config_hash: 2bea1743c84d63bd61f8501a6ea63065
configured_endpoints: 38
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-155e4761d62255841349c0f8a01b0a9c463ea1d1f2d6c4fd8d1a75c8bef6f226.yml
openapi_spec_hash: ab91f77e7c9d992400cbc7fc8a9e76c1
config_hash: bff282047fafdad771fb7ec685f56944
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.4.0 (2026-08-05)

Full Changelog: [v1.3.0...v1.4.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.3.0...v1.4.0)

### Features

* **api:** api update ([90cad89](https://github.com/context-dot-dev/context-dev-cli/commit/90cad89d5524f42fcd1e84e040bc19ab3e9d1052))
* **api:** manual updates ([0a31daa](https://github.com/context-dot-dev/context-dev-cli/commit/0a31daa87ff77541579b3e9147c08981779c073f))

## 1.3.0 (2026-08-01)

Full Changelog: [v1.2.0...v1.3.0](https://github.com/context-dot-dev/context-dev-cli/compare/v1.2.0...v1.3.0)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.0
github.com/context-dot-dev/context-go-sdk/v2 v2.7.0
github.com/goccy/go-yaml v1.18.0
github.com/itchyny/json2yaml v0.1.4
github.com/muesli/reflow v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.0 h1:Ek9DAp3uuXNZRKojMOf4Y6I11PHnXuQQFtvT4vi0BDE=
github.com/context-dot-dev/context-go-sdk/v2 v2.6.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8=
github.com/context-dot-dev/context-go-sdk/v2 v2.7.0 h1:zc4xevss1ms1jge3wTn0qgynanmORhvFJav8eLfaiIY=
github.com/context-dot-dev/context-go-sdk/v2 v2.7.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=
Expand Down
62 changes: 62 additions & 0 deletions pkg/cmd/brand.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,27 @@
HideHelpCommand: true,
}

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), most popular 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.",
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').",
Required: true,
QueryPath: "query",
},
&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: handleBrandSearch,
HideHelpCommand: true,
}

func handleBrandRetrieve(ctx context.Context, cmd *cli.Command) error {
client := contextdev.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
Expand Down Expand Up @@ -233,3 +254,44 @@
Transform: transform,
})
}

func handleBrandSearch(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.BrandSearchParams{}

Check failure on line 277 in pkg/cmd/brand.go

View workflow job for this annotation

GitHub Actions / test

undefined: contextdev.BrandSearchParams

Check failure on line 277 in pkg/cmd/brand.go

View workflow job for this annotation

GitHub Actions / lint

undefined: contextdev.BrandSearchParams

var res []byte
options = append(options, option.WithResponseBodyInto(&res))
_, err = client.Brand.Search(ctx, params, options...)

Check failure on line 281 in pkg/cmd/brand.go

View workflow job for this annotation

GitHub Actions / test

client.Brand.Search undefined (type contextdev.BrandService has no field or method Search)

Check failure on line 281 in pkg/cmd/brand.go

View workflow job for this annotation

GitHub Actions / lint

client.Brand.Search undefined (type contextdev.BrandService has no field or method Search)
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 search",
Transform: transform,
})
}
14 changes: 14 additions & 0 deletions pkg/cmd/brand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,17 @@ func TestBrandRetrieveSimplified(t *testing.T) {
)
})
}

func TestBrandSearch(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", "search",
"--query", "x",
"--tag", "production",
"--tag", "team-alpha",
)
})
}
1 change: 1 addition & 0 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func init() {
Commands: []*cli.Command{
&brandRetrieve,
&brandRetrieveSimplified,
&brandSearch,
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package cmd

const Version = "1.3.0" // x-release-please-version
const Version = "1.4.0" // x-release-please-version
Loading