@spree/cli 3.3.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,19 @@
1
1
  # Agent Instructions
2
2
 
3
+ `CLAUDE.md` only imports this file — edit this one.
4
+
3
5
  This is the Spree seller panel for this marketplace — a Vite + React app. The
4
6
  shell ships in `@spree/seller-dashboard`; this project holds your
5
7
  customizations. Sellers manage their own catalog and orders here.
6
8
 
7
9
  Full docs: https://spreecommerce.org/docs/developer/dashboard/overview
8
10
 
9
- The admin dashboard is the reference implementation: when a component is
10
- useful to both, extract it rather than copying it.
11
+ ## Running it
12
+
13
+ Start the Spree API with `spree dev` from the project root (`../..`) — it is
14
+ only ever run through the Spree CLI; see the project root's `AGENTS.md`. Then
15
+ run this app's own dev server here with `pnpm dev` (or `npm run dev`); the
16
+ Spree CLI does not start the seller panel for you.
11
17
 
12
18
  ## Imports
13
19
 
@@ -15,7 +21,7 @@ Import from `@spree/seller-dashboard` — it re-exports the framework and the de
15
21
  system, so there is no need to work out which package an export lives in.
16
22
 
17
23
  ```ts
18
- import { defineDashboardPlugin, useStore, Button, ResourceTable } from '@spree/seller-dashboard'
24
+ import { defineDashboardPlugin, sellerClient, Button, ResourceTable } from '@spree/seller-dashboard'
19
25
  ```
20
26
 
21
27
  `@spree/dashboard-core` and `@spree/dashboard-ui` stay importable for the few
@@ -30,26 +36,35 @@ uses internally.
30
36
  | Directory | Holds | Naming |
31
37
  |---|---|---|
32
38
  | `src/plugins.ts` | Registrations only: nav, slots, tables | one file |
33
- | `src/pages/` | One screen each | `brands.tsx` |
34
- | `src/hooks/` | Admin API wrappers | `use-brands.ts` |
39
+ | `src/pages/` | Larger components rendered inside slots | `payout-summary.tsx` |
40
+ | `src/hooks/` | Seller API wrappers | `use-payouts.ts` |
35
41
  | `src/tables/` | `defineTable` calls | `brands.tsx` |
36
42
  | `src/schemas/` | Zod schema + `FormValues` | `brand.ts` |
37
43
  | `src/slots/` | Widgets injected into built-in pages | `seller-payout-card.tsx` |
38
44
  | `src/locales/` | Your `admin.*` translation keys | `en.json` |
39
45
 
40
- Adding a resource touches one file in each directory. Keep `plugins.ts` a map
41
- of what exists, not an implementation.
46
+ Keep `plugins.ts` a map of what exists, not an implementation.
47
+
48
+ The seller panel does not support adding new pages yet: plugins can remove
49
+ built-in navigation entries, add widgets to the slots built-in screens expose,
50
+ and add table columns. A navigation entry pointing at a path the panel does
51
+ not have leads to a "not found" screen.
42
52
 
43
53
  ## Rules
44
54
 
45
- - **The Admin API is the only data source.** Never reach into the Rails app or
55
+ - **The Seller API is the only data source.** Never reach into the Rails app or
46
56
  import server-rendered HTML. Seller endpoints are scoped to the signed-in
47
57
  seller by the server, never by the client. A missing endpoint is added to the API first.
48
- - **Wrap API calls in a hook.** Components never call `adminClient` directly.
49
- - **Query keys are store-scoped.** Build them with `useResourceKey`; a bare
50
- `['brands']` key leaks one store's data into another after a store switch.
51
- - **Writes go through `useResourceMutation`**, which maps 422 responses onto
52
- form fields instead of firing a toast.
58
+ - **Use the Seller API, through a hook.** Hooks call `sellerClient()`;
59
+ components never call it directly. Never use `adminClient` here — it targets
60
+ the Admin API, which sellers cannot sign in to.
61
+ - **There is no store context.** The panel's tenant is the signed-in seller, so
62
+ `useStore()` throws here. Build query keys with `useResourceKey`, which scopes
63
+ them to the seller.
64
+ - **Writes go through `useResourceMutation`.** It shows a toast for network
65
+ and server failures but not for 422 validation errors — catch those in the
66
+ form's submit handler with `mapSpreeErrorsToForm`, which puts each message on
67
+ its field.
53
68
  - **Every visible string goes through i18next** — page titles, column labels,
54
69
  buttons, empty states, toasts. Never hardcode English in JSX or in a table
55
70
  definition. Add each new key to every locale file the project ships.
@@ -59,12 +74,15 @@ of what exists, not an implementation.
59
74
  walks every nested key and the SDK's object graph overflows the TypeScript
60
75
  compiler.
61
76
  - **A sortable or filterable column must be allowlisted for Ransack** on the
62
- model, or the request fails at runtime.
77
+ model, or the request fails at runtime. That change belongs to the Spree API
78
+ in `../../server/` — follow `../../server/AGENTS.md`.
63
79
  - **Destructive actions that fire straight from a click need a confirm** —
64
80
  `useConfirm()` with `variant: 'destructive'`.
65
81
 
66
82
  ## Checks
67
83
 
84
+ Run these with the project's package manager (`pnpm`, `npm run` or `yarn`):
85
+
68
86
  ```bash
69
87
  pnpm typecheck
70
88
  pnpm lint
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -3,6 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="robots" content="noindex, nofollow" />
6
7
  <title>Spree Seller Panel</title>
7
8
  </head>
8
9
  <body>
@@ -16,25 +16,28 @@
16
16
  "lint:fix": "biome check --fix ."
17
17
  },
18
18
  "dependencies": {
19
- "@spree/admin-sdk": "^1.0.0-rc.2",
20
- "@spree/seller-dashboard": "^1.0.0-rc.3",
21
- "@spree/dashboard-core": "^1.0.0-rc.3",
22
- "@spree/dashboard-ui": "^1.0.0-rc.3",
23
- "@spree/seller-sdk": "^1.0.0-rc.2",
24
- "@tanstack/react-query": "^5.100.9",
25
- "@tanstack/react-router": "^1.169.2",
26
- "react": "^19.2.6",
27
- "react-dom": "^19.2.6"
19
+ "@spree/admin-sdk": "^1.0.0-rc.6",
20
+ "@spree/dashboard-core": "^1.0.0-rc.6",
21
+ "@spree/dashboard-ui": "^1.0.0-rc.6",
22
+ "@spree/seller-dashboard": "^1.0.0-rc.7",
23
+ "@spree/seller-sdk": "^1.0.0-rc.6",
24
+ "@tanstack/react-query": "^5.104.5",
25
+ "@tanstack/react-router": "^1.170.45",
26
+ "i18next": "^26.5.3",
27
+ "react": "^19.3.1",
28
+ "react-dom": "^19.3.1",
29
+ "react-hook-form": "^7.90.0",
30
+ "react-i18next": "^17.1.0"
28
31
  },
29
32
  "devDependencies": {
30
33
  "@biomejs/biome": "^2.4.14",
31
- "@playwright/test": "^1.59.1",
34
+ "@playwright/test": "^1.64.1",
32
35
  "@types/react": "^19.2.14",
33
36
  "@types/react-dom": "^19.2.3",
34
37
  "@vitejs/plugin-react": "^6.0.1",
35
- "typescript": "~6.0.3",
36
- "vite": "^8.0.16",
37
- "vitest": "^4.1.5"
38
+ "typescript": "~7.0.2",
39
+ "vite": "^8.3.4",
40
+ "vitest": "^5.0.5"
38
41
  },
39
42
  "packageManager": "pnpm@11.13.1"
40
43
  }
@@ -7,26 +7,30 @@
7
7
  // before the panel renders.
8
8
  //
9
9
  // Keep this file a map of what you added: the registrations live here, the
10
- // implementations live in pages/, hooks/, tables/ and schemas/ — one file per
10
+ // implementations live in slots/, pages/, hooks/, tables/ and schemas/ — one file per
11
11
  // resource, the same layout the seller panel uses internally. Translations go
12
12
  // in locales/ and merge in with `i18n.addResourceBundle`.
13
13
  //
14
- // Example — add a payouts page and drop the built-in team screen:
14
+ // Example — add a card to the team screen and drop the built-in team entry
15
+ // from the navigation (the seller panel does not support new pages yet):
15
16
  //
16
17
  // import { defineDashboardPlugin } from '@spree/seller-dashboard'
17
- // import { PayoutsPage } from './pages/payouts'
18
+ // import { TeamAuditCard } from './slots/team-audit-card'
18
19
  //
19
20
  // defineDashboardPlugin({
20
- // nav: {
21
- // add: [{ key: 'payouts', label: 'Payouts', path: '/payouts', position: 300 }],
22
- // remove: ['team'],
23
- // },
21
+ // nav: { remove: ['team'] },
24
22
  // slots: {
25
23
  // 'seller.team.after': [{ id: 'audit', component: TeamAuditCard }],
26
24
  // },
27
25
  // })
28
26
  //
29
- // Slots the built-in screens expose: `seller.team.actions`, `seller.team.after`.
27
+ // Slots the built-in screens expose: `seller.team.actions`, `seller.team.after`,
28
+ // `seller.product.form_main`, `seller.product.form_sidebar`,
29
+ // `seller.product.media.form_fields`, `seller.product.media.actions`,
30
+ // `seller.product.variant.form_fields`, `seller.stock_location.form_fields`,
31
+ // `seller.package_type.form_fields`, `seller.order.form_sidebar`,
32
+ // `seller.payout.form_sidebar`, `seller.profile.form_main`,
33
+ // `seller.profile.form_sidebar`.
30
34
  //
31
35
  // `@spree/dashboard-core` and `@spree/dashboard-ui` are already installed —
32
36
  // import hooks, providers and UI primitives straight from them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spree/cli",
3
- "version": "3.3.0",
3
+ "version": "3.4.1",
4
4
  "description": "CLI for managing Spree Commerce projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,21 +32,21 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@clack/prompts": "^1.8.0",
35
- "commander": "^14.0.3",
35
+ "commander": "^15.0.0",
36
36
  "console-table-printer": "^2.15.0",
37
- "execa": "^9.6.1",
37
+ "execa": "^10.2.0",
38
38
  "picocolors": "^1.1.1"
39
39
  },
40
40
  "devDependencies": {
41
- "@changesets/changelog-github": "^0.7.0",
42
- "@changesets/cli": "^2.31.0",
43
- "@types/node": "^25.6.0",
44
- "tsup": "^8.5.1",
45
- "typescript": "^6.0.3",
46
- "vitest": "^4.1.5",
41
+ "@changesets/changelog-github": "^1.0.1",
42
+ "@changesets/cli": "^3.0.3",
43
+ "@types/node": "^26.6.5",
44
+ "tsup": "^9.0.0",
45
+ "typescript": "^7.0.2",
46
+ "vitest": "^5.0.5",
47
47
  "yaml": "^2.8.4",
48
- "@spree/sdk-core": "0.1.0",
49
- "@spree/admin-sdk": "^1.0.0-rc.2"
48
+ "@spree/admin-sdk": "^1.0.0-rc.6",
49
+ "@spree/sdk-core": "0.1.0"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=20"