-
Notifications
You must be signed in to change notification settings - Fork 272
Add shopify doc fetch command to download MD doc from shopify.dev
#7766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7a5afb9
Add `shopify fetch` command to download docs from shopify.dev
nelsonwittwer 9c1ad16
Address review: rename command to fetch-doc, use allowed-hosts list
nelsonwittwer cdb9ed8
Update e2e command-tree snapshot for fetch-doc
nelsonwittwer 10c0323
Clarify search and fetch-doc command descriptions
nelsonwittwer b787dd0
Note in fetch-doc description that shopify.dev serves Markdown for ev…
nelsonwittwer 011f152
Add global flags (--verbose, --no-color) to fetch-doc and search
nelsonwittwer 28c3bc1
Add --output flag and drop --content-type from fetch-doc
nelsonwittwer ce73b7b
Move `fetch-doc` into the `doc` namespace as `doc fetch`
nelsonwittwer 69f857d
Send X-Shopify-Surface: cli header from doc fetch
nelsonwittwer 5aea093
Use a --url flag for doc fetch instead of a positional arg
nelsonwittwer fbeae30
Regenerate doc fetch docs
isaacroldan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
30
docs-shopify.dev/commands/interfaces/doc-fetch.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'?: '' | ||
|
|
||
| /** | ||
| * 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'?: '' | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.