Conversation
cf6bd6d to
42bc978
Compare
|
/snapit |
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Test the snapshot by installing your package globally: pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260915114646Caution After installing, validate the version by running |
f46d908 to
0c95979
Compare
77bfbfd to
d18e392
Compare
d18e392 to
6d61a3e
Compare
|
|
||
| static descriptionWithMarkdown = `Displays information about your theme environment, including your current store. Can also retrieve information about a specific theme. | ||
|
|
||
| Use \`--json\` for machine-readable output.` |
There was a problem hiding this comment.
I think we don't need this with the help and new instructions from the skill, I'll remove it.
6d61a3e to
cb7a4db
Compare
2eabb1e to
ba2e4d3
Compare
a70adad to
eea5b12
Compare
eea5b12 to
60623ee
Compare
f13bb3d to
f08da6c
Compare
f08da6c to
481ed4c
Compare
481ed4c to
6c8372f
Compare
| emitCommandEvent({ | ||
| type: 'diagnostic', | ||
| level: 'info', | ||
| message: `Using applicable flags from ${environmentName} environment:\n${items.join('\n')}`, |
There was a problem hiding this comment.
blocking: let's redact store-password before emitting these diagnostics too. The reporter only masks the exact password key, so an environment's storefront password is included in full in the JSON diagnostic message. theme profile --environment preview --json supports this field. The text banner already had this redaction gap, but this branch now sends the secret through the structured event channel as well. Redact both credential fields before building items, and extend the diagnostic test to check that the full storefront password never appears in emitted events.
There was a problem hiding this comment.
Both credential fields are now masked
|
|
||
| protected validateNonTTYFlags(flags: FlagOutput): void { | ||
| // Multiple environments must be validated after their configured flags are loaded. | ||
| const command = this.constructor as unknown as {multiEnvironmentsFlags?: RequiredFlags} |
There was a problem hiding this comment.
blocking: let's use an assertion-free property check instead of as unknown as {multiEnvironmentsFlags?: RequiredFlags} here. This hook only needs to know whether the constructor defines the metadata. The double assertion bypasses compiler checks and isn't needed:
const command = this.constructor
if (
'multiEnvironmentsFlags' in command &&
command.multiEnvironmentsFlags !== undefined &&
Array.isArray(flags.environment) &&
flags.environment.length > 1
) {
return
}Keep the undefined-versus-null distinction: own-runner commands without this metadata must retain parse-time validation. Don't add a default of null to the base class.
There was a problem hiding this comment.
Replaced the double assertion with the suggested property check. The undefined-versus-null distinction is preserved.
|
|
||
| await run(['--theme', '123', ...(json ? ['--json'] : [])]) | ||
|
|
||
| expect(vi.mocked(recordTiming).mock.calls).toEqual([['theme-command:info'], ['theme-command:info']]) |
There was a problem hiding this comment.
blocking: let's assert that these timings bracket the work, rather than only checking two identical calls. Moving the closing timing immediately after the opening timing still passes this test in both modes, even though the duration excludes fetching and presenting the result. Check that only the opening timing exists while the fetch is pending, then that the closing timing is recorded after presentation.
There was a problem hiding this comment.
Both modes now verify that only the opening timing exists while fetching is pending, and that presentation happens before the closing timing
| ], | ||
| }), | ||
| ) | ||
| await expect(command.run()).rejects.toThrow("Can't use `--path` flag with multiple environments.") |
There was a problem hiding this comment.
blocking: let's keep checking the branch-specific recovery advice as well as the rejection. Both modified tests now assert the same heading, so they still pass if the missing-file case tells users to edit a configuration file that does not exist. Assert the AbortError guidance for each case.
There was a problem hiding this comment.
Both cases now assert the AbortError and their specific recovery advice, using real temporary files in theme-command-environments.test.ts
Assisted-By: devx/9dd3b67e-58e9-4a01-a721-43265d02ccd2
Assisted-By: devx/9dd3b67e-58e9-4a01-a721-43265d02ccd2
Assisted-By: devx/b173c0b4-2d65-4396-a5eb-d3c4d4c3a4ff
Assisted-By: devx/0033c079-2574-4c3b-a8f1-d9a752834d90
Assisted-By: devx/1fb42754-a68b-4733-9ea3-74521b5da069
Assisted-By: devx/8b520d2e-bc34-4a3d-b5fa-748b2fff362e
6c8372f to
078784e
Compare
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/base-command.d.ts@@ -35,6 +35,7 @@ declare abstract class BaseCommand extends Command {
argv: string[];
}>;
protected environmentsFilename(): string | undefined;
+ protected validateNonTTYFlags(flags: FlagOutput): void;
protected failMissingNonTTYFlags(flags: FlagOutput, requiredFlags: string[]): void;
private failMissingNonTTYFlagRequirements;
private applicableNonTTYFlagRequirements;
|
WHY are these changes introduced?
theme info --jsonhas two established result shapes, but neither is discoverable as a command contract.Related to shop/issues-develop#23691
WHAT is this pull request doing?
Normal output remains human-readable sections:
The matching JSON output remains:
{ "store": "my-shop.myshopify.com", "development_theme_id": null, "cli_version": "3.91.0", "os": "darwin-arm64", "shell": "/bin/zsh", "node_version": "v24.15.0" }A multi-environment invocation continues to emit one existing JSON document per environment. This PR does not add a wrapper or change that public behavior.
Validate non-interactive requirements after loading each environment, so configured theme IDs work while conditional safety flags remain required. Environment notices use JSON diagnostics in JSON mode. Unsupported multiple environments and a global
--pathnow fail with a nonzero exit code; confirmation prompts use the stable command ID.How to manually test your changes?
Checklist