create-substrat 0.8.5 → 0.9.0
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.
- package/index.js +9 -20
- package/package.json +1 -1
- package/template/AGENTS.md +18 -3
- package/template/src/manifest.ts +2 -2
- package/template/src/provision.ts +5 -0
package/index.js
CHANGED
|
@@ -36,11 +36,11 @@ const TEMPLATE = join(HERE, 'template');
|
|
|
36
36
|
// The runtime packages release together off one version line (the changesets `fixed`
|
|
37
37
|
// group), so one constant is right for all of them. Engines do NOT share a line —
|
|
38
38
|
// each versions on its own, so one pin per engine, deliberately.
|
|
39
|
-
const SUBSTRAT = '^0.
|
|
40
|
-
const ENGINE_WORKORDER = '^0.10.
|
|
41
|
-
const ENGINE_INVOICING = '^0.9.
|
|
42
|
-
const BOUNDARY_LINT = '^0.
|
|
43
|
-
const DEV_ISSUER = '^0.1.
|
|
39
|
+
const SUBSTRAT = '^0.99.0';
|
|
40
|
+
const ENGINE_WORKORDER = '^0.10.7';
|
|
41
|
+
const ENGINE_INVOICING = '^0.9.15';
|
|
42
|
+
const BOUNDARY_LINT = '^0.4.2';
|
|
43
|
+
const DEV_ISSUER = '^0.1.14';
|
|
44
44
|
|
|
45
45
|
const DOCS = 'https://substrat.net';
|
|
46
46
|
|
|
@@ -101,21 +101,10 @@ function packageJson(name) {
|
|
|
101
101
|
{ binding: 'CONFIG', class: 'ConfigDO' },
|
|
102
102
|
],
|
|
103
103
|
},
|
|
104
|
-
//
|
|
105
|
-
// (`SHOP_ENV`),
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
key: 'SHOP_NAME',
|
|
110
|
-
label: 'Workshop name',
|
|
111
|
-
description: 'The workshop name shown to customers. Set per install.',
|
|
112
|
-
placeholder: 'Söder Cykel & Service',
|
|
113
|
-
default: 'Substrat Bike Shop',
|
|
114
|
-
required: false,
|
|
115
|
-
secret: false,
|
|
116
|
-
group: 'General',
|
|
117
|
-
},
|
|
118
|
-
],
|
|
104
|
+
// No envSpec copy here (#1206): the declared per-instance settings live in
|
|
105
|
+
// src/manifest.ts (`SHOP_ENV`), re-exported as `envSpec` from the permissions
|
|
106
|
+
// entry — `substrat push` reads them off that same import. The dashboard
|
|
107
|
+
// renders its Settings form from what the push uploads.
|
|
119
108
|
devServers: DEV_SERVERS,
|
|
120
109
|
},
|
|
121
110
|
scripts: {
|
package/package.json
CHANGED
package/template/AGENTS.md
CHANGED
|
@@ -87,9 +87,9 @@ dashboard reports `delivered: false`, and the app never sees it. That includes t
|
|
|
87
87
|
back through `resolveScopedEnvSpec` (`instanceConfig`). Read settings that way and
|
|
88
88
|
never off `env` directly: an `envSpec` default rides as a worker binding shared by
|
|
89
89
|
every install of one serving script, so `env.FOO` is the same string for every
|
|
90
|
-
tenant no matter what any of them saved. Declare a setting in
|
|
91
|
-
`src/manifest.ts` (`SHOP_ENV`)
|
|
92
|
-
push`
|
|
90
|
+
tenant no matter what any of them saved. Declare a setting once, in
|
|
91
|
+
`src/manifest.ts` (`SHOP_ENV`) — `src/provision.ts` re-exports it as `envSpec`,
|
|
92
|
+
which is what `substrat push` uploads; package.json carries no copy.
|
|
93
93
|
|
|
94
94
|
## The rules (non-negotiable)
|
|
95
95
|
|
|
@@ -223,6 +223,21 @@ vertical done, boot the server and drive the real flow over HTTP as two personas
|
|
|
223
223
|
should succeed and one who should be denied — and confirm the denial arrives as a denial
|
|
224
224
|
(not a generic error).
|
|
225
225
|
|
|
226
|
+
## When it breaks — symptom → fix
|
|
227
|
+
|
|
228
|
+
Six failures that have each cost someone a day. What makes them expensive is that none of
|
|
229
|
+
them names its own cause: the symptom points somewhere other than the fix, so an agent
|
|
230
|
+
debugging from first principles walks away from the answer.
|
|
231
|
+
|
|
232
|
+
| Symptom | Fix |
|
|
233
|
+
|---|---|
|
|
234
|
+
| `expected a Zod schema` at runtime, pointing nowhere useful | Two copies of Zod. Never add `zod` to `package.json` — import `z` from `@substrat-run/contracts`, so the schema you build and the one the host validates with are the same class. |
|
|
235
|
+
| Killing the dev server kills unrelated ones too | `pkill -f 'tsx src/server.ts'` matches every Substrat project running on the machine, not just yours. Kill by port instead: `kill $(lsof -ti :<port>)`. |
|
|
236
|
+
| Green locally, red in CI, with nothing in the diff that explains it | A warm build output hides it. Delete `dist`, reinstall from the lockfile (`--frozen-lockfile`), and re-run the gates before believing a local green. |
|
|
237
|
+
| Green test suite, broken app | The scenario calls operations directly and never reaches `server.ts`, its routes, or the principal picker. Boot the server and drive the flow over HTTP as two personas — one who should succeed and one who should be denied. |
|
|
238
|
+
| Permission denied after you widened a role | Roles are projected into a scope when that scope is provisioned, from `ROLES` in `src/provision.ts`. An existing scope keeps the projection it was born with — re-provision it (or re-seed onto a fresh data directory), then present the permission diff below. |
|
|
239
|
+
| `pnpm install` dies compiling `better-sqlite3` | Take `better-sqlite3` out of `pnpm.onlyBuiltDependencies`. Since 13.x it ships prebuilt binaries and no install script, but it still ships a `binding.gyp` — so an allowlist entry makes pnpm run a `node-gyp rebuild` that nothing here needs. |
|
|
240
|
+
|
|
226
241
|
## Two human checkpoints — you may never self-approve
|
|
227
242
|
|
|
228
243
|
Present these and stop:
|
package/template/src/manifest.ts
CHANGED
|
@@ -29,8 +29,8 @@ export const SHOP_PERM = {
|
|
|
29
29
|
* value one tenant saved for one install — a spec `default` rides as a worker binding
|
|
30
30
|
* shared by every install of the serving script.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* The single declaration (#1206): `src/provision.ts` re-exports this as `envSpec`, which
|
|
33
|
+
* is what `substrat push` uploads — package.json carries no copy.
|
|
34
34
|
*/
|
|
35
35
|
export const SHOP_ENV: EnvVarSpec[] = [
|
|
36
36
|
{
|
|
@@ -8,6 +8,11 @@ import { invoicingModule, INVOICING_PERM as INV } from '@substrat-run/engine-inv
|
|
|
8
8
|
import { bikeShopModule } from './module.js';
|
|
9
9
|
import { SHOP_PERM } from './manifest.js';
|
|
10
10
|
|
|
11
|
+
// The manifest's config surface rides the same import `substrat push` already makes for
|
|
12
|
+
// `permissions` (#1206): this export is what the push uploads, so `src/manifest.ts` is the
|
|
13
|
+
// single envSpec declaration and package.json carries no copy.
|
|
14
|
+
export { SHOP_ENV as envSpec } from './manifest.js';
|
|
15
|
+
|
|
11
16
|
// ============================================================================
|
|
12
17
|
// The vertical's PROVISIONING surface — everything a deployment needs to know
|
|
13
18
|
// about modules, roles and grant shapes, with NO node imports. Split from
|