feat/agent only command for app store requirement retrieval#7427
Closed
brandonreid wants to merge 1 commit into
Closed
feat/agent only command for app store requirement retrieval#7427brandonreid wants to merge 1 commit into
brandonreid wants to merge 1 commit into
Conversation
5dccb4c to
8987915
Compare
8987915 to
6c40d5c
Compare
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/monorail.d.ts@@ -74,6 +74,8 @@ export interface Schemas {
cmd_app_validate_valid?: Optional<boolean>;
cmd_app_validate_issue_count?: Optional<number>;
cmd_app_validate_file_count?: Optional<number>;
+ cmd_app_agent_upstream_status?: Optional<number>;
+ cmd_app_agent_response_bytes?: Optional<number>;
cmd_dev_tunnel_type?: Optional<string>;
cmd_dev_tunnel_custom_hash?: Optional<string>;
cmd_dev_urls_updated?: Optional<boolean>;
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

WHY are these changes introduced?
We're introducing a new pattern for agent-only commands in the Shopify CLI: commands that are hidden from
--helpand "did you mean" suggestions, intended to be invoked by AI coding agents when prompted by the Shopify AI Toolkit.The first command in this pattern,
app agentget-self-review-requirements, returns an AI agent a filtered set of the Shopify App Store requirements that are checkable against a developer's codebase and come with tailored agent verification guidance. The agent uses the verification guidance in each requirement to inspect the developer's codebase and report back which requirements are likely passing, likely failing, or need review, helping the developer catch issues before submitting for review.This initial implementation is simple, it requests the requirements from a dedicated page in dev docs. This is temporary. The next iteration will be retrieving the requirements directly from app store, where the authenticated request can track which app has made the request (useful as a trust signal) and filter the requirements for direct relevancy to the app's selected category (if they have declared one).
WHAT is this pull request doing?
New hidden topic + command
app:agentas a hidden oclif topic inpackages/cli/package.json. Both the topic and individual commands sethidden: true, so nothing under it appears inshopify --help, topic listings, or "did you mean" suggestions, but the command remains directly invokable when called by name.shopify app agent get-app-store-requirements, which fetches the App Store self-review requirements from dev docs (already served asContent-Type: text/markdown, no auth required) and writes the result to stdout viaoutputResult.Establishes the agent-only contract
<!-- shopify-agent: <command-id> -->so agents can verify they parsed the expected payload.shopify-agent-error: <message>line.0success,1generic failure,2not linked,3auth failure,4server unavailable.Command(notAppLinkedCommand) — the requirements page is universal, and forcing an app link would trigger a prompt that breaks agent invocation. Future agent commands should only opt into app context if their response actually depends on it.Postrun hook adjustment
app:agent:*commands fromautoUpgradeIfNeeded()inpackages/cli-kit/src/public/node/hooks/postrun.ts, alongside the existingnotificationsandupgradeexclusions. This is mainly to prevent an agent invocation of a fast metadata command from triggering a globalnpm install -g @shopify/cli@latestas a side effect, which would slow the call down by 10–30s and write spawn output to stdout/stderr.How to test your changes?
Expected: ~60KB of markdown to stdout starting with
<!-- shopify-agent: get-app-store-requirements v1 -->, followed by the live requirements from shopify.dev.Verify the agent contract
Expect: stdout ~60KB, stderr 0 bytes, first line is the sentinel.
Verify the command is hidden
Verify the error path — temporarily edit
REQUIREMENTS_URLinpackages/app/src/cli/services/agent/app-store-requirements.tsto a 404 path onshopify.dev, rebuildapp, and rerun:Expect:
exit=4, stderr starts withshopify-agent-error:, stdout empty. Revert the URL when done.Verify the postrun guard didn't over-match — on a setup where the upgrade nudge would normally fire, confirm a non-agent command still emits it on stderr:
Post-release steps
None for this PR. The command is hidden and the new namespace is unused outside of it. Once the upstream "copy-paste prompt for your agent" UI surface lands (separately, likely in the Partner Dashboard / dev.shopify.com), it will reference this command by name.
Checklist
shopifyFetchfromcli-kitwhich is already cross-platform.docs:generate(which excludeshidden: truecommands) and from thepackages/cli/README.mdregen. The agent-facing "documentation" is the markdown output itself.reportAnalyticsEventin the postrun hook still runs for agent commands (only the auto-upgrade leg is skipped), so usage ofapp:agent:*commands will show up in standard CLI analytics like any other command.