Skip to content

Commit d5b29b4

Browse files
committed
Document pre-submit workflow and local dev in AGENTS.md + docs/LOCAL_DEV.md
1 parent 3f38fd6 commit d5b29b4

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Working in Shopify CLI
2+
3+
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.
4+
5+
## Before you push: `pnpm pre-ci`
6+
7+
Run the local subset of the PR pipeline before pushing:
8+
9+
```bash
10+
pnpm pre-ci # or: dev pre-ci
11+
```
12+
13+
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`.
14+
15+
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.
16+
17+
## After changing commands, flags, or GraphQL queries: `pnpm codegen`
18+
19+
Generated files are gated in CI (`Check OCLIF manifests & readme & docs`, `Check graphql-codegen has been run`). Regenerate and commit them:
20+
21+
```bash
22+
pnpm codegen # regenerate everything
23+
pnpm codegen:check:oclif # regenerate + verify the tree is clean (as CI does)
24+
pnpm codegen:check:graphql
25+
```
26+
27+
## Linting
28+
29+
Use the repo's lint command, not `eslint` directly:
30+
31+
```bash
32+
pnpm lint # nx-driven; matches the CI "Lint" job
33+
pnpm lint:fix # auto-fix
34+
```
35+
36+
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.
37+
38+
## Tests
39+
40+
```bash
41+
pnpm test # full vitest run (single env; CI runs a node/OS matrix)
42+
pnpm vitest run path/to/file.test.ts # a single file
43+
```

docs/LOCAL_DEV.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Local development
2+
3+
How to set up and run Shopify CLI from a checkout. For the pre-submit workflow and lint/codegen guidance, see [`../AGENTS.md`](../AGENTS.md).
4+
5+
## Setup
6+
7+
```bash
8+
dev up # installs the pinned Node + pnpm, dependencies, GraphQL schemas, and Playwright
9+
```
10+
11+
`dev up` pins the same Node and pnpm versions CI uses (`dev.yml``tests-pr.yml`, enforced by `pnpm check-ci-gates`), so your local runtime matches CI.
12+
13+
## Running the CLI
14+
15+
```bash
16+
pnpm shopify <command> # builds the cli, then runs it (e.g. pnpm shopify app dev)
17+
dev shopify <command> # same, via the dev command
18+
```
19+
20+
`pnpm shopify` rebuilds the `cli` package first, so it reflects your latest changes.
21+
22+
## Local service environment
23+
24+
When developing against local services rather than production:
25+
26+
```bash
27+
SHOPIFY_SERVICE_ENV=local
28+
SHOPIFY_CLI_NEVER_USE_PARTNERS_API=1
29+
```
30+
31+
- **Admin URLs**: in local mode the CLI maps `{store}.my.shop.dev` to `admin.shop.dev/store/{store}` — see `packages/cli-kit/src/public/node/context/fqdn.ts`.
32+
- **Organization**: use organization ID `1` for local development.
33+
34+
## Theme check
35+
36+
The `theme check` command wraps [`@shopify/theme-check-node`](https://github.com/Shopify/theme-tools). Entry point: `packages/theme/src/cli/commands/theme/check.ts`.
37+
38+
## Before opening a PR
39+
40+
- Run `pnpm pre-ci` (see [`../AGENTS.md`](../AGENTS.md)).
41+
- After changing commands, flags, or GraphQL queries, run `pnpm codegen` and commit the regenerated files.
42+
- For changesets and bump types, see [`../CONTRIBUTING.md`](../CONTRIBUTING.md).

0 commit comments

Comments
 (0)