You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/skills/_shared/shopify-cli-ci-repo-contracts.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,12 @@ For normal PR CI work, start with `.github/workflows/tests-pr.yml`.
25
25
- Generated outputs are often part of the required change set when a workflow step verifies cleanliness after regeneration.
26
26
-`dev.yml` is a useful local workflow entrypoint, but workflow YAML is the source of truth for what CI actually enforces.
27
27
28
+
## Local pre-submit tooling
29
+
30
+
-`pnpm pre-ci` runs the local subset of PR gates at full CI parity (type-check, lint, build, knip, codegen freshness, unit tests). It is heavier than routine work needs; prefer the minimal diff-derived set below, and reach for `pre-ci` when the user wants full confidence before a high-risk push.
31
+
- Codegen freshness is single-sourced in `package.json`: `pnpm codegen` regenerates all generated files; `pnpm codegen:check:graphql` / `:oclif` regenerate and assert a clean tree. The workflow's `graphql-schema` and `oclif-checks` jobs call these scripts, so local and CI cannot drift.
32
+
-`bin/ci-gates.js` is the source of truth mapping each `tests-pr.yml` job to a `pre-ci` command or a `ci-only` reason. `pnpm check-ci-gates` (CI job `CI gate manifest`) fails if a workflow job is unclassified or if the Node/pnpm versions in `dev.yml` and `tests-pr.yml` disagree.
33
+
28
34
## Gotchas
29
35
30
36
- Do not guess from a check name alone when the workflow or job definition is available.
Copy file name to clipboardExpand all lines: .agents/skills/cli-pre-submit-ci/SKILL.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ If the diff clearly maps to a narrow family, keep the investigation narrow.
35
35
|---|---|
36
36
| docs/config/wiring only, with no obvious workflow-enforced generator family |**stop there unless contradicted**: run lightweight sanity checks only (`git diff --check`, validate changed symlink targets, validate local markdown links if relevant); do not full-read large workflow/script files |
37
37
| user is at PR time (`submit`, `open`, `update`, `restack`) | advisory mode: suggest minimal checks, staging needs, and likely CI risk; ask before running anything substantial |
38
-
| user asks what to run before push | recommend the minimal high-signal checks implied by the workflow |
38
+
| user asks what to run before push | recommend the minimal high-signal checks implied by the workflow; mention `pnpm pre-ci` as the full-parity option for a high-risk push|
39
39
| user asks what to commit or stage | reproduce the relevant generator/check path, then inspect git status and diffs |
40
40
| user explicitly asks to run checks | run the minimal derived set, not the whole world |
41
41
@@ -75,7 +75,7 @@ After any generator, freshness check, or lightweight sanity pass:
75
75
76
76
## Gotchas
77
77
78
-
- At PR time, do **not** automatically run the full workflow-equivalent validation set unless the user asks.
78
+
- At PR time, do **not** automatically run the full workflow-equivalent validation set unless the user asks.`pnpm pre-ci` is that full set — offer it for high-risk pushes, but default to the minimal derived checks.
79
79
-`dev.yml` is a useful local entrypoint, but workflow YAML is the source of truth for what CI enforces.
80
80
- Broad generated diffs are not automatically wrong; distinguish required churn from suspicious churn.
81
81
- Do not stop at “run this command.” Explain what likely needs staging.
Copy file name to clipboardExpand all lines: AGENTS.md
+12-37Lines changed: 12 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,44 +3,19 @@ See @.cursor/rules/docs.mdc for Shopify CLI architecture and conventions.
3
3
4
4
# Working in Shopify CLI
5
5
6
-
Guidance for contributors and coding agents to get a change green in CI with the fewest round-trips. See [`CONTRIBUTING.md`](./CONTRIBUTING.md)for changesets/versioning and [`docs/LOCAL_DEV.md`](./docs/LOCAL_DEV.md) for running the CLI locally.
6
+
Entry point for contributors and coding agents. Canonical docs live under [`docs/`](./docs/README.md)and agent skills under [`.agents/skills/`](./.agents/skills); this file routes to them rather than restating them.
7
7
8
-
## Before you push: `pnpm pre-ci`
8
+
## Before you push
9
9
10
-
Run the local subset of the PR pipeline before pushing:
10
+
- Derive the minimal checks for your diff with the [`cli-pre-submit-ci`](./.agents/skills/cli-pre-submit-ci/SKILL.md) skill. For full local CI parity (slower), run `pnpm pre-ci`.
11
+
- After changing commands, flags, or GraphQL queries, run `pnpm codegen` and commit the regenerated files.
12
+
-`pnpm check-ci-gates` keeps the local gate list ([`bin/ci-gates.js`](./bin/ci-gates.js)) and pinned tool versions in sync with the workflow.
11
13
12
-
```bash
13
-
pnpm pre-ci # or: dev pre-ci
14
-
```
14
+
## Key docs
15
15
16
-
It runs, in CI-parity order: `type-check`, `lint`, `build`, `knip`, the graphql and OCLIF/docs codegen freshness checks, and unit tests — and prints which CI-only gates it skips (e2e, type-diff, breaking-change detection) and why. It mirrors CI's full targets, so green locally implies green in CI; it is slower than the affected-only `dev check`.
17
-
18
-
The gate list lives in [`bin/ci-gates.js`](./bin/ci-gates.js) and is kept in sync with `.github/workflows/tests-pr.yml` by `pnpm check-ci-gates` (enforced by the `CI gate manifest` CI job). When you add or change a CI gate, update that manifest.
19
-
20
-
## After changing commands, flags, or GraphQL queries: `pnpm codegen`
21
-
22
-
Generated files are gated in CI (`Check OCLIF manifests & readme & docs`, `Check graphql-codegen has been run`). Regenerate and commit them:
23
-
24
-
```bash
25
-
pnpm codegen # regenerate everything
26
-
pnpm codegen:check:oclif # regenerate + verify the tree is clean (as CI does)
27
-
pnpm codegen:check:graphql
28
-
```
29
-
30
-
## Linting
31
-
32
-
Use the repo's lint command, not `eslint` directly:
33
-
34
-
```bash
35
-
pnpm lint # nx-driven; matches the CI "Lint" job
36
-
pnpm lint:fix # auto-fix
37
-
```
38
-
39
-
Invoking `eslint <file>` directly can report problems CI does not enforce (and CI lints project sources, not root `bin/` scripts). Repo-specific lint conventions are implemented in [`packages/eslint-plugin-cli/rules/`](./packages/eslint-plugin-cli/rules) (for example, `no-vi-manual-mock-clear` — Vitest resets mocks automatically, so do not clear them by hand). Check there when a rule is unfamiliar rather than guessing.
40
-
41
-
## Tests
42
-
43
-
```bash
44
-
pnpm test# full vitest run (single env; CI runs a node/OS matrix)
45
-
pnpm vitest run path/to/file.test.ts # a single file
46
-
```
16
+
-[Get started / setup and scripts](./docs/cli/get-started.md)
17
+
-[Local development against services](./docs/cli/local-development.md)
Copy file name to clipboardExpand all lines: docs/cli/get-started.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,5 +72,10 @@ Besides the scripts for building and running the CLIs, there are others that mig
72
72
-`pnpm lint:fix`: Runs ESLint and Prettier checks for all the packages and fixes the fixable issues.
73
73
-`pnpm type-check`: Type-checks all the packagesusing the Typescript `tsc` tool.
74
74
-`pnpm clean`: Removes the `dist` directory from all the packages.
75
+
-`pnpm pre-ci`: Runs the local subset of PR CI gates (type-check, lint, build, knip, codegen freshness, unit tests) at full parity with CI. Slower, for a high-risk push; for routine PRs derive the minimal checks for your diff (see the `cli-pre-submit-ci` agent skill).
76
+
-`pnpm codegen`: Regenerates all generated files (GraphQL types, OCLIF manifests, README, docs). Run after changing commands, flags, or queries, and commit the result.
77
+
-`pnpm check-ci-gates`: Verifies the local CI-gate manifest stays in sync with the GitHub Actions workflow.
78
+
79
+
Prefer these scripts over invoking `eslint`/`prettier`/`tsc` directly: CI runs them through Nx over package sources, not over root `bin/` scripts.
75
80
76
81
All the packages in the repository contain the above scripts so they can be executed too for an individual package.
Most contributions run against production Shopify services. When developing against a local services stack, the CLI changes behavior based on the service environment.
4
+
5
+
## Service environment
6
+
7
+
-`SHOPIFY_SERVICE_ENV=local`
8
+
-`SHOPIFY_CLI_NEVER_USE_PARTNERS_API=1`
9
+
10
+
In local mode the CLI maps a store's `{store}.my.shop.dev` host to `admin.shop.dev/store/{store}` — see `packages/cli-kit/src/public/node/context/fqdn.ts`.
11
+
12
+
## Running the CLI
13
+
14
+
See [Get started](./get-started.md) for building and running the CLI (`pnpm shopify <command>`) and the available scripts.
15
+
16
+
## Before opening a PR
17
+
18
+
Derive the minimal pre-submit checks for your diff (see the `cli-pre-submit-ci` agent skill), or run `pnpm pre-ci` for full local CI parity. After changing commands, flags, or GraphQL queries, run `pnpm codegen` and commit the regenerated files.
0 commit comments