Skip to content

Commit 550fbb3

Browse files
Nelson Wittwerclaude
andcommitted
Use a --query flag for doc search instead of a positional arg
Per the CLI design guidelines: flags make intent explicit, don't rely on order, and are easier to evolve. Regenerated manifest + README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 23df9a2 commit 550fbb3

3 files changed

Lines changed: 27 additions & 31 deletions

File tree

packages/cli/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* [`shopify config autoupgrade off`](#shopify-config-autoupgrade-off)
4040
* [`shopify config autoupgrade on`](#shopify-config-autoupgrade-on)
4141
* [`shopify config autoupgrade status`](#shopify-config-autoupgrade-status)
42-
* [`shopify doc search <query>`](#shopify-doc-search-query)
42+
* [`shopify doc search`](#shopify-doc-search)
4343
* [`shopify help [command] [flags]`](#shopify-help-command-flags)
4444
* [`shopify hydrogen build`](#shopify-hydrogen-build)
4545
* [`shopify hydrogen check RESOURCE`](#shopify-hydrogen-check-resource)
@@ -1214,23 +1214,21 @@ DESCRIPTION
12141214
Run `shopify config autoupgrade on` or `shopify config autoupgrade off` to configure it.
12151215
```
12161216

1217-
## `shopify doc search <query>`
1217+
## `shopify doc search`
12181218

12191219
Query the shopify.dev vector store and print the most relevant documentation chunks as JSON. Best for programmatic discovery — surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`.
12201220

12211221
```
12221222
USAGE
1223-
$ shopify doc search <query>
1224-
1225-
ARGUMENTS
1226-
QUERY The search query.
1223+
$ shopify doc search --query <value> [--api-name <value>] [--api-version <value>] [--no-color] [--verbose]
12271224
12281225
FLAGS
12291226
--api-name=<value> [env: SHOPIFY_FLAG_API_NAME] Limit results to a specific API (for example: admin, storefront,
12301227
hydrogen, functions). Unrecognized values are ignored.
12311228
--api-version=<value> [env: SHOPIFY_FLAG_API_VERSION] Limit results to a specific API version (for example: 2025-10,
12321229
latest, current).
12331230
--no-color [env: SHOPIFY_FLAG_NO_COLOR] Disable color output.
1231+
--query=<value> (required) [env: SHOPIFY_FLAG_QUERY] The search query.
12341232
--verbose [env: SHOPIFY_FLAG_VERBOSE] Increase the verbosity of the output.
12351233
12361234
DESCRIPTION
@@ -1240,9 +1238,9 @@ DESCRIPTION
12401238
12411239
EXAMPLES
12421240
# search shopify.dev for a topic
1243-
shopify doc search "subscribe to webhooks"
1241+
shopify doc search --query "subscribe to webhooks"
12441242
# narrow the search to a specific API and version
1245-
shopify doc search "create a product" --api-name admin --api-version latest
1243+
shopify doc search --query "create a product" --api-name admin --api-version latest
12461244
```
12471245

12481246
## `shopify help [command] [flags]`

packages/cli/oclif.manifest.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3439,16 +3439,11 @@
34393439
"aliases": [
34403440
],
34413441
"args": {
3442-
"query": {
3443-
"description": "The search query.",
3444-
"name": "query",
3445-
"required": true
3446-
}
34473442
},
34483443
"description": "Query the shopify.dev vector store and print the most relevant documentation chunks as JSON. Best for programmatic discovery — surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`.",
34493444
"enableJsonFlag": false,
34503445
"examples": [
3451-
"# search shopify.dev for a topic\n shopify doc search \"subscribe to webhooks\"\n\n # narrow the search to a specific API and version\n shopify doc search \"create a product\" --api-name admin --api-version latest\n "
3446+
"# search shopify.dev for a topic\n shopify doc search --query \"subscribe to webhooks\"\n\n # narrow the search to a specific API and version\n shopify doc search --query \"create a product\" --api-name admin --api-version latest\n "
34523447
],
34533448
"flags": {
34543449
"api-name": {
@@ -3475,6 +3470,15 @@
34753470
"name": "no-color",
34763471
"type": "boolean"
34773472
},
3473+
"query": {
3474+
"description": "The search query.",
3475+
"env": "SHOPIFY_FLAG_QUERY",
3476+
"hasDynamicHelp": false,
3477+
"multiple": false,
3478+
"name": "query",
3479+
"required": true,
3480+
"type": "option"
3481+
},
34783482
"verbose": {
34793483
"allowNo": false,
34803484
"description": "Increase the verbosity of the output.",
@@ -3491,8 +3495,7 @@
34913495
"pluginAlias": "@shopify/cli",
34923496
"pluginName": "@shopify/cli",
34933497
"pluginType": "core",
3494-
"strict": true,
3495-
"usage": "doc search <query>"
3498+
"strict": true
34963499
},
34973500
"docs:generate": {
34983501
"aliases": [
Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
import {docSearchService} from '../../services/commands/doc/search.js'
22
import Command from '@shopify/cli-kit/node/base-command'
33
import {globalFlags} from '@shopify/cli-kit/node/cli'
4-
import {Args, Flags} from '@oclif/core'
4+
import {Flags} from '@oclif/core'
55

66
export default class DocSearch extends Command {
77
static description =
88
'Query the shopify.dev vector store and print the most relevant documentation chunks as JSON. Best for programmatic discovery — surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`.'
99

10-
static usage = `doc search <query>`
11-
1210
static examples = [
1311
`# search shopify.dev for a topic
14-
shopify doc search "subscribe to webhooks"
12+
shopify doc search --query "subscribe to webhooks"
1513
1614
# narrow the search to a specific API and version
17-
shopify doc search "create a product" --api-name admin --api-version latest
15+
shopify doc search --query "create a product" --api-name admin --api-version latest
1816
`,
1917
]
2018

21-
static args = {
22-
query: Args.string({
23-
name: 'query',
24-
required: true,
25-
description: 'The search query.',
26-
}),
27-
}
28-
2919
static flags = {
3020
...globalFlags,
21+
query: Flags.string({
22+
description: 'The search query.',
23+
env: 'SHOPIFY_FLAG_QUERY',
24+
required: true,
25+
}),
3126
'api-name': Flags.string({
3227
description:
3328
'Limit results to a specific API (for example: admin, storefront, hydrogen, functions). Unrecognized values are ignored.',
@@ -40,7 +35,7 @@ export default class DocSearch extends Command {
4035
}
4136

4237
async run(): Promise<void> {
43-
const {args, flags} = await this.parse(DocSearch)
44-
await docSearchService(args.query, flags['api-name'], flags['api-version'])
38+
const {flags} = await this.parse(DocSearch)
39+
await docSearchService(flags.query, flags['api-name'], flags['api-version'])
4540
}
4641
}

0 commit comments

Comments
 (0)