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
5 changes: 5 additions & 0 deletions .changeset/add-doc-fetch-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli': minor
---

Add `shopify doc fetch` to download Markdown documents from shopify.dev.
30 changes: 30 additions & 0 deletions docs-shopify.dev/commands/interfaces/doc-fetch.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This is an autogenerated file. Don't edit this file manually.
/**
* The following flags are available for the `doc fetch` command:
* @publicDocs
*/
export interface docfetch {
/**
* Disable color output.
* @environment SHOPIFY_FLAG_NO_COLOR
*/
'--no-color'?: ''
Comment thread
nelsonwittwer marked this conversation as resolved.

/**
* Write the document to this file path instead of printing it to stdout.
* @environment SHOPIFY_FLAG_OUTPUT
*/
'--output <value>'?: string

/**
* The shopify.dev URL to fetch.
* @environment SHOPIFY_FLAG_URL
*/
'--url <value>': string

/**
* Increase the verbosity of the output.
* @environment SHOPIFY_FLAG_VERBOSE
*/
'--verbose'?: ''
}
10 changes: 10 additions & 0 deletions docs-shopify.dev/commands/interfaces/search.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,15 @@
* @publicDocs
*/
export interface search {
/**
* Disable color output.
* @environment SHOPIFY_FLAG_NO_COLOR
*/
'--no-color'?: ''

/**
* Increase the verbosity of the output.
* @environment SHOPIFY_FLAG_VERBOSE
*/
'--verbose'?: ''
}
69 changes: 67 additions & 2 deletions docs-shopify.dev/generated/generated_docs_data_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2742,6 +2742,52 @@
"value": "export interface configautoupgradestatus {\n\n}"
}
},
"docfetch": {
"docs-shopify.dev/commands/interfaces/doc-fetch.interface.ts": {
"filePath": "docs-shopify.dev/commands/interfaces/doc-fetch.interface.ts",
"name": "docfetch",
"description": "The following flags are available for the `doc fetch` command:",
"isPublicDocs": true,
"members": [
{
"filePath": "docs-shopify.dev/commands/interfaces/doc-fetch.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--no-color",
"value": "''",
"description": "Disable color output.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_NO_COLOR"
},
{
"filePath": "docs-shopify.dev/commands/interfaces/doc-fetch.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--output <value>",
"value": "string",
"description": "Write the document to this file path instead of printing it to stdout.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_OUTPUT"
},
{
"filePath": "docs-shopify.dev/commands/interfaces/doc-fetch.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--url <value>",
"value": "string",
"description": "The shopify.dev URL to fetch.",
"environmentValue": "SHOPIFY_FLAG_URL"
},
{
"filePath": "docs-shopify.dev/commands/interfaces/doc-fetch.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--verbose",
"value": "''",
"description": "Increase the verbosity of the output.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_VERBOSE"
}
],
"value": "export interface docfetch {\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Write the document to this file path instead of printing it to stdout.\n * @environment SHOPIFY_FLAG_OUTPUT\n */\n '--output <value>'?: string\n\n /**\n * The shopify.dev URL to fetch.\n * @environment SHOPIFY_FLAG_URL\n */\n '--url <value>': string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
}
},
"docsearch": {
"docs-shopify.dev/commands/interfaces/doc-search.interface.ts": {
"filePath": "docs-shopify.dev/commands/interfaces/doc-search.interface.ts",
Expand Down Expand Up @@ -4181,8 +4227,27 @@
"name": "search",
"description": "The following flags are available for the `search` command:",
"isPublicDocs": true,
"members": [],
"value": "export interface search {\n\n}"
"members": [
{
"filePath": "docs-shopify.dev/commands/interfaces/search.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--no-color",
"value": "''",
"description": "Disable color output.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_NO_COLOR"
},
{
"filePath": "docs-shopify.dev/commands/interfaces/search.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--verbose",
"value": "''",
"description": "Increase the verbosity of the output.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_VERBOSE"
}
],
"value": "export interface search {\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
}
},
"storeauth": {
Expand Down
40 changes: 38 additions & 2 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* [`shopify config autoupgrade off`](#shopify-config-autoupgrade-off)
* [`shopify config autoupgrade on`](#shopify-config-autoupgrade-on)
* [`shopify config autoupgrade status`](#shopify-config-autoupgrade-status)
* [`shopify doc fetch`](#shopify-doc-fetch)
* [`shopify doc search`](#shopify-doc-search)
* [`shopify help [command] [flags]`](#shopify-help-command-flags)
* [`shopify hydrogen build`](#shopify-hydrogen-build)
Expand Down Expand Up @@ -1214,6 +1215,35 @@ DESCRIPTION
Run `shopify config autoupgrade on` or `shopify config autoupgrade off` to configure it.
```

## `shopify doc fetch`

Download a complete document from shopify.dev. Every page on shopify.dev has a Markdown version, and that is what this tool returns. Use this to pull an entire document verbatim — for example, a set of instructions an agent follows like a centrally-served skill. For finding the relevant pieces of content across shopify.dev instead, use `doc search`.

```
USAGE
$ shopify doc fetch --url <value> [--no-color] [--output <value>] [--verbose]

FLAGS
--no-color [env: SHOPIFY_FLAG_NO_COLOR] Disable color output.
--output=<value> [env: SHOPIFY_FLAG_OUTPUT] Write the document to this file path instead of printing it to stdout.
--url=<value> (required) [env: SHOPIFY_FLAG_URL] The shopify.dev URL to fetch.
--verbose [env: SHOPIFY_FLAG_VERBOSE] Increase the verbosity of the output.

DESCRIPTION
Download a complete document from shopify.dev. Every page on shopify.dev has a Markdown version, and that is what this
tool returns. Use this to pull an entire document verbatim — for example, a set of instructions an agent follows like
a centrally-served skill. For finding the relevant pieces of content across shopify.dev instead, use `doc search`.

EXAMPLES
# fetch the Markdown version of a Shopify.dev page

$ shopify doc fetch --url https://shopify.dev/docs/api/shopify-cli

# save the document to a file instead of printing it

$ shopify doc fetch --url https://shopify.dev/docs/api/shopify-cli --output docs/shopify-cli.md
```

## `shopify doc search`

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`.
Expand Down Expand Up @@ -2114,14 +2144,20 @@ DESCRIPTION

## `shopify search [query]`

Starts a search on shopify.dev.
Search shopify.dev for the most relevant content matching a query. Best for 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`.

```
USAGE
$ shopify search [query]

FLAGS
--no-color [env: SHOPIFY_FLAG_NO_COLOR] Disable color output.
--verbose [env: SHOPIFY_FLAG_VERBOSE] Increase the verbosity of the output.

DESCRIPTION
Starts a search on shopify.dev.
Search shopify.dev for the most relevant content matching a query. Best for 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`.

EXAMPLES
# open the search modal on Shopify.dev
Expand Down
73 changes: 72 additions & 1 deletion packages/cli/oclif.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3435,6 +3435,61 @@
"strict": true,
"summary": "Watch and prints out changes to an app."
},
"doc:fetch": {
"aliases": [
],
"args": {
},
"description": "Download a complete document from shopify.dev. Every page on shopify.dev has a Markdown version, and that is what this tool returns. Use this to pull an entire document verbatim — for example, a set of instructions an agent follows like a centrally-served skill. For finding the relevant pieces of content across shopify.dev instead, use `doc search`.",
"enableJsonFlag": false,
"examples": [
"# fetch the Markdown version of a Shopify.dev page\nshopify doc fetch --url https://shopify.dev/docs/api/shopify-cli",
"# save the document to a file instead of printing it\nshopify doc fetch --url https://shopify.dev/docs/api/shopify-cli --output docs/shopify-cli.md"
],
"flags": {
"no-color": {
"allowNo": false,
"description": "Disable color output.",
"env": "SHOPIFY_FLAG_NO_COLOR",
"hidden": false,
"name": "no-color",
"type": "boolean"
},
"output": {
"description": "Write the document to this file path instead of printing it to stdout.",
"env": "SHOPIFY_FLAG_OUTPUT",
"hasDynamicHelp": false,
"multiple": false,
"name": "output",
"type": "option"
},
"url": {
"description": "The shopify.dev URL to fetch.",
"env": "SHOPIFY_FLAG_URL",
"hasDynamicHelp": false,
"multiple": false,
"name": "url",
"required": true,
"type": "option"
},
"verbose": {
"allowNo": false,
"description": "Increase the verbosity of the output.",
"env": "SHOPIFY_FLAG_VERBOSE",
"hidden": false,
"name": "verbose",
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hiddenAliases": [
],
"id": "doc:fetch",
"pluginAlias": "@shopify/cli",
"pluginName": "@shopify/cli",
"pluginType": "core",
"strict": true
},
"doc:search": {
"aliases": [
],
Expand Down Expand Up @@ -5725,12 +5780,28 @@
"name": "query"
}
},
"description": "Starts a search on shopify.dev.",
"description": "Search shopify.dev for the most relevant content matching a query. Best for 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`.",
"enableJsonFlag": false,
"examples": [
"# open the search modal on Shopify.dev\n shopify search\n\n # search for a term on Shopify.dev\n shopify search <query>\n\n # search for a phrase on Shopify.dev\n shopify search \"<a search query separated by spaces>\"\n "
],
"flags": {
"no-color": {
"allowNo": false,
"description": "Disable color output.",
"env": "SHOPIFY_FLAG_NO_COLOR",
"hidden": false,
"name": "no-color",
"type": "boolean"
},
"verbose": {
"allowNo": false,
"description": "Increase the verbosity of the output.",
"env": "SHOPIFY_FLAG_VERBOSE",
"hidden": false,
"name": "verbose",
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hiddenAliases": [
Expand Down
34 changes: 34 additions & 0 deletions packages/cli/src/cli/commands/doc/fetch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {docFetchService} from '../../services/commands/doc/fetch.js'
import Command from '@shopify/cli-kit/node/base-command'
import {globalFlags} from '@shopify/cli-kit/node/cli'
import {Flags} from '@oclif/core'

export default class DocFetch extends Command {
static description =
'Download a complete document from shopify.dev. Every page on shopify.dev has a Markdown version, and that is what this tool returns. Use this to pull an entire document verbatim — for example, a set of instructions an agent follows like a centrally-served skill. For finding the relevant pieces of content across shopify.dev instead, use `doc search`.'

static examples = [
`# fetch the Markdown version of a Shopify.dev page
shopify doc fetch --url https://shopify.dev/docs/api/shopify-cli`,
`# save the document to a file instead of printing it
shopify doc fetch --url https://shopify.dev/docs/api/shopify-cli --output docs/shopify-cli.md`,
]

static flags = {
...globalFlags,
url: Flags.string({
description: 'The shopify.dev URL to fetch.',
env: 'SHOPIFY_FLAG_URL',
required: true,
}),
output: Flags.string({
description: 'Write the document to this file path instead of printing it to stdout.',
env: 'SHOPIFY_FLAG_OUTPUT',
}),
}

async run(): Promise<void> {
const {flags} = await this.parse(DocFetch)
await docFetchService(flags.url, flags.output)
}
}
8 changes: 7 additions & 1 deletion packages/cli/src/cli/commands/search.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {searchService} from '../services/commands/search.js'
import Command from '@shopify/cli-kit/node/base-command'
import {globalFlags} from '@shopify/cli-kit/node/cli'
import {Args} from '@oclif/core'

export default class Search extends Command {
static description = 'Starts a search on shopify.dev.'
static description =
'Search shopify.dev for the most relevant content matching a query. Best for 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`.'

static usage = `search [query]`

Expand All @@ -23,6 +25,10 @@ export default class Search extends Command {
query: Args.string(),
}

static flags = {
...globalFlags,
}

async run(): Promise<void> {
const {args} = await this.parse(Search)
await searchService(args.query)
Expand Down
Loading
Loading