Skip to content

Commit cea4ee0

Browse files
committed
Integrate DX docs into existing docs/ tree and CI skills
- AGENTS.md becomes a thin router into docs/ and .agents/skills - Move local-service-dev facts to docs/cli/local-development.md (indexed) - Fold pre-ci/codegen/check-ci-gates into get-started + CI contracts doc - Reconcile pnpm pre-ci (full parity) with cli-pre-submit-ci minimal-derived default - Remove orphan docs/LOCAL_DEV.md
1 parent f91c09d commit cea4ee0

7 files changed

Lines changed: 44 additions & 80 deletions

File tree

.agents/skills/_shared/shopify-cli-ci-repo-contracts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ For normal PR CI work, start with `.github/workflows/tests-pr.yml`.
2525
- Generated outputs are often part of the required change set when a workflow step verifies cleanliness after regeneration.
2626
- `dev.yml` is a useful local workflow entrypoint, but workflow YAML is the source of truth for what CI actually enforces.
2727

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+
2834
## Gotchas
2935

3036
- Do not guess from a check name alone when the workflow or job definition is available.

.agents/skills/cli-pre-submit-ci/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ If the diff clearly maps to a narrow family, keep the investigation narrow.
3535
|---|---|
3636
| 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 |
3737
| 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 |
3939
| user asks what to commit or stage | reproduce the relevant generator/check path, then inspect git status and diffs |
4040
| user explicitly asks to run checks | run the minimal derived set, not the whole world |
4141

@@ -75,7 +75,7 @@ After any generator, freshness check, or lightweight sanity pass:
7575

7676
## Gotchas
7777

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.
7979
- `dev.yml` is a useful local entrypoint, but workflow YAML is the source of truth for what CI enforces.
8080
- Broad generated diffs are not automatically wrong; distinguish required churn from suspicious churn.
8181
- Do not stop at “run this command.” Explain what likely needs staging.

AGENTS.md

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,19 @@ See @.cursor/rules/docs.mdc for Shopify CLI architecture and conventions.
33

44
# Working in Shopify CLI
55

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.
77

8-
## Before you push: `pnpm pre-ci`
8+
## Before you push
99

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.
1113

12-
```bash
13-
pnpm pre-ci # or: dev pre-ci
14-
```
14+
## Key docs
1515

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)
18+
- [ESLint rules](./docs/cli/eslint-rules.md)
19+
- [Testing strategy](./docs/cli/testing-strategy.md)
20+
- [Cross-OS compatibility](./docs/cli/cross-os-compatibility.md)
21+
- [Changesets and versioning](./CONTRIBUTING.md)

docs/LOCAL_DEV.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The Shopify CLI is a tool for merchants, partners, and developers to interact wi
1111
The list below contains valuable resources for people interested in contributing to the CLI project in this repository.
1212

1313
* [Get started](./cli/get-started.md)
14+
* [Local development against services](./cli/local-development.md)
1415
* [Architecture](./cli/architecture.md)
1516
* [Conventions](./cli/conventions.md)
1617
* [Performance](./cli/performance.md)

docs/cli/get-started.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,10 @@ Besides the scripts for building and running the CLIs, there are others that mig
7272
- `pnpm lint:fix`: Runs ESLint and Prettier checks for all the packages and fixes the fixable issues.
7373
- `pnpm type-check`: Type-checks all the packagesusing the Typescript `tsc` tool.
7474
- `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.
7580

7681
All the packages in the repository contain the above scripts so they can be executed too for an individual package.

docs/cli/local-development.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Local development against services
2+
3+
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

Comments
 (0)