create-stitchkit 0.6.20 → 0.6.21

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/CHANGELOG.md CHANGED
@@ -12,6 +12,24 @@ step is overwritten by the next release.
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [0.6.21] - 2026-11-09
16
+
17
+ ### Changed
18
+
19
+ - Generated projects resolve stitchkit 0.121.0. The agent starter's coding tools bound
20
+ `search_files`, `glob` and `list_directory` work and report its coverage, and `run_command`
21
+ refuses a missing, file or symlink `cwd` in words; a project that reads exact tool outputs or
22
+ builds a complete `AgentCodingToolLimits` value follows the stitchkit 0.121.0 migration.
23
+
24
+ ### Fixed
25
+
26
+ - A repeated `bun run dev` applies a changed `.env` to roles that are already running. PM2 keeps
27
+ the CLI environment a role first started with and applies only an app's `env` block on
28
+ `startOrReload --update-env`, so the generated supervision files now pass every variable
29
+ `project.json` declares through each role's `env`; a value injected by the deployment still
30
+ wins over the file, and `NODE_ENV` stays the file's run mode. Existing projects adopt it by the
31
+ [migration](./UPGRADING.md#supervision-passes-declared-environment).
32
+
15
33
  ## [0.6.20] - 2026-11-05
16
34
 
17
35
  ### Changed
package/UPGRADING.md CHANGED
@@ -60,6 +60,22 @@ the first scaffolder release with a migration channel of its own.
60
60
 
61
61
  ---
62
62
 
63
+ ## Released migration: 0.6.21
64
+
65
+ ### supervision passes declared environment
66
+
67
+ Additive, and worth taking: without it a changed `.env` stays stale in a running role until
68
+ `pm2 delete`.
69
+
70
+ 1. In `scripts/declaration.ts`, after the `config({ path: … })` call that `renderEcosystem`
71
+ emits, emit a `declared` object built from `declaration.env.variables` — each declared name
72
+ with its current value from the process environment, values that are absent left out — and
73
+ render each role's `env` as `{ ...declared, NODE_ENV: '<mode>' }`.
74
+ 2. In `scripts/check-authored.ts`, add `ecosystem.config.cjs` and `ecosystem.dev.config.cjs` to
75
+ the environment boundaries: they pass only names the environment schema declares.
76
+ 3. Run `bun run gen:declaration`, then `bun run dev`. Check with `pm2 env <role>` that a value
77
+ changed in `.env` arrives without `pm2 delete`.
78
+
63
79
  ## Released migration: 0.6.1
64
80
 
65
81
  ### Canonical query client factory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-stitchkit",
3
- "version": "0.6.20",
3
+ "version": "0.6.21",
4
4
  "description": "Create a production-shaped Stitchkit application",
5
5
  "license": "MIT",
6
6
  "author": "Max Listov <maxlistov@gmail.com>",
@@ -85,7 +85,7 @@
85
85
  "@types/react": "^19.3.0",
86
86
  "ai": "^7.0.162",
87
87
  "react": "^19.3.1",
88
- "stitchkit": "0.120.0",
88
+ "stitchkit": "0.121.0",
89
89
  "typescript": "^7.0.2"
90
90
  },
91
91
  "engines": {
package/template/bun.lock CHANGED
@@ -145,7 +145,7 @@
145
145
  "zod": "4.6.7",
146
146
  },
147
147
  "catalog": {
148
- "stitchkit": "^0.120.0",
148
+ "stitchkit": "^0.121.0",
149
149
  },
150
150
  "packages": {
151
151
  "@ai-sdk/gateway": ["@ai-sdk/gateway@4.0.135", "", { "dependencies": { "@ai-sdk/provider": "4.0.35", "@ai-sdk/provider-utils": "5.0.74", "@vercel/oidc": "3.2.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-gnMpZP42WIhy24fpnbbtV7SBqEhYY8ZSMsfgoNRh5r41D1HwnJTm1k7d4uYSIpiaEb5J8IPTHVSzwgWmGoSFEA=="],
@@ -1126,7 +1126,7 @@
1126
1126
 
1127
1127
  "std-env": ["std-env@3.10.0", "", {}, "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg=="],
1128
1128
 
1129
- "stitchkit": ["stitchkit@0.120.0", "", { "dependencies": { "ky": "^2.2.0" }, "peerDependencies": { "@modelcontextprotocol/ext-apps": "^1.7.2 || ^2.0.0", "@modelcontextprotocol/server": "^2.0.0", "@openrouter/ai-sdk-provider": "^3.1.0", "@opentelemetry/api": "^1.9.0", "@socket.io/bun-engine": "^0.1.2", "@socket.io/component-emitter": "^3.1.2", "@tanstack/react-query": ">=5", "@types/bun": "^1.4.2", "ai": "^7.0.107", "google-auth-library": "^11.1.0", "grammy": "^1.46.0", "maxmind": "^5.0.7", "react": ">=18", "react-query-kit": "^3.3.3", "socket.io": "^4.8.3", "socket.io-client": "^4.8.3", "srvx": "^0.12.5 || ^1.0.5", "web-vitals": "^6.2.3", "zod": "^4.6.5" }, "optionalPeers": ["@modelcontextprotocol/ext-apps", "@modelcontextprotocol/server", "@openrouter/ai-sdk-provider", "@opentelemetry/api", "@socket.io/bun-engine", "@socket.io/component-emitter", "@tanstack/react-query", "@types/bun", "ai", "google-auth-library", "grammy", "maxmind", "react", "react-query-kit", "socket.io", "socket.io-client", "srvx", "web-vitals"], "bin": { "stitchkit": "dist/entrypoints/bin/upgrade-cli.js" } }, "sha512-wJa0FjgpNT9jABxTEzJkiOesldv6piRwt8Ge6KzH6HsH/M1rmNr4+D/QUVhwCKnlbhYd5zA8lRvsA1x/3A76ug=="],
1129
+ "stitchkit": ["stitchkit@0.121.0", "", { "dependencies": { "ky": "^2.2.0" }, "peerDependencies": { "@modelcontextprotocol/ext-apps": "^1.7.2 || ^2.0.0", "@modelcontextprotocol/server": "^2.0.0", "@openrouter/ai-sdk-provider": "^3.1.0", "@opentelemetry/api": "^1.9.0", "@socket.io/bun-engine": "^0.1.2", "@socket.io/component-emitter": "^3.1.2", "@tanstack/react-query": ">=5", "@types/bun": "^1.4.2", "ai": "^7.0.107", "google-auth-library": "^11.1.0", "grammy": "^1.46.0", "maxmind": "^5.0.7", "react": ">=18", "react-query-kit": "^3.3.3", "socket.io": "^4.8.3", "socket.io-client": "^4.8.3", "srvx": "^0.12.5 || ^1.0.5", "web-vitals": "^6.2.3", "zod": "^4.6.5" }, "optionalPeers": ["@modelcontextprotocol/ext-apps", "@modelcontextprotocol/server", "@openrouter/ai-sdk-provider", "@opentelemetry/api", "@socket.io/bun-engine", "@socket.io/component-emitter", "@tanstack/react-query", "@types/bun", "ai", "google-auth-library", "grammy", "maxmind", "react", "react-query-kit", "socket.io", "socket.io-client", "srvx", "web-vitals"], "bin": { "stitchkit": "dist/entrypoints/bin/upgrade-cli.js" } }, "sha512-8O+u91ZrwBoYFBpCaYp8OXa5a7CO7KI/VFUVZZiLqkqkvwy+3DN99GPh22x92UzWn8HzkwQ1O37Y3uHYpccd0A=="],
1130
1130
 
1131
1131
  "stringify-entities": ["stringify-entities@4.0.4", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="],
1132
1132
 
@@ -14,6 +14,16 @@ const declaration = require('./project.json');
14
14
  // the place.
15
15
  config({ path: path.join(__dirname, '.env'), quiet: true });
16
16
 
17
+ // PM2 applies an app's `env` block on every start and reload, but not the CLI
18
+ // environment it saw when the role first started: every declared variable goes
19
+ // through `env`, so a changed `.env` or deployment value reaches a running role
20
+ // on the next `bun run dev` without `pm2 delete`.
21
+ const declared = Object.fromEntries(
22
+ declaration.env.variables
23
+ .map(({ name }) => [name, process.env[name]])
24
+ .filter(([, value]) => value !== undefined),
25
+ );
26
+
17
27
  module.exports = {
18
28
  apps: [
19
29
  {
@@ -33,7 +43,7 @@ module.exports = {
33
43
  autorestart: true,
34
44
  // >= this role's full shutdown budget of 25000ms.
35
45
  kill_timeout: 30000,
36
- env: { NODE_ENV: 'production' },
46
+ env: { ...declared, NODE_ENV: 'production' },
37
47
  },
38
48
  {
39
49
  name: `${declaration.identity.slug}-web`,
@@ -52,7 +62,7 @@ module.exports = {
52
62
  autorestart: true,
53
63
  // >= this role's full shutdown budget of 15000ms.
54
64
  kill_timeout: 30000,
55
- env: { NODE_ENV: 'production' },
65
+ env: { ...declared, NODE_ENV: 'production' },
56
66
  },
57
67
  ],
58
68
  };
@@ -14,6 +14,16 @@ const declaration = require('./project.json');
14
14
  // the place.
15
15
  config({ path: path.join(__dirname, '.env'), quiet: true });
16
16
 
17
+ // PM2 applies an app's `env` block on every start and reload, but not the CLI
18
+ // environment it saw when the role first started: every declared variable goes
19
+ // through `env`, so a changed `.env` or deployment value reaches a running role
20
+ // on the next `bun run dev` without `pm2 delete`.
21
+ const declared = Object.fromEntries(
22
+ declaration.env.variables
23
+ .map(({ name }) => [name, process.env[name]])
24
+ .filter(([, value]) => value !== undefined),
25
+ );
26
+
17
27
  module.exports = {
18
28
  apps: [
19
29
  {
@@ -33,7 +43,7 @@ module.exports = {
33
43
  autorestart: true,
34
44
  // >= this role's full shutdown budget of 25000ms.
35
45
  kill_timeout: 30000,
36
- env: { NODE_ENV: 'development' },
46
+ env: { ...declared, NODE_ENV: 'development' },
37
47
  },
38
48
  {
39
49
  name: `${declaration.identity.slug}-web-dev`,
@@ -52,7 +62,7 @@ module.exports = {
52
62
  autorestart: true,
53
63
  // >= this role's full shutdown budget of 15000ms.
54
64
  kill_timeout: 30000,
55
- env: { NODE_ENV: 'development' },
65
+ env: { ...declared, NODE_ENV: 'development' },
56
66
  },
57
67
  ],
58
68
  };
@@ -7,7 +7,7 @@
7
7
  "packages/*"
8
8
  ],
9
9
  "catalog": {
10
- "stitchkit": "^0.120.0"
10
+ "stitchkit": "^0.121.0"
11
11
  },
12
12
  "overrides": {
13
13
  "@playwright/test": "1.64.1",
@@ -9,11 +9,16 @@ const processEnvMarker = ['process', 'env'].join('.');
9
9
  const replacedThemePackage = ['next', 'themes'].join('-');
10
10
  const generatedDirectories = new Set(['.git', '.next', 'dist', 'node_modules']);
11
11
  // Roles read their own validated bindings; supervision passes no environment
12
- // values in argv. Only runtime and tooling schemas are environment boundaries.
12
+ // values in argv. Runtime and tooling schemas are environment boundaries, and so
13
+ // are the generated supervision files: PM2 applies only an app's \`env\` block on
14
+ // reload, so they hand each role the variables \`project.json\` declares — names
15
+ // derived from the one environment schema, never a value of their own.
13
16
  const processEnvBoundaries = new Set([
14
17
  'packages/frontend/src/env.ts',
15
18
  'packages/config/src/server.ts',
16
19
  'scripts/tooling-env.ts',
20
+ 'ecosystem.config.cjs',
21
+ 'ecosystem.dev.config.cjs',
17
22
  ]);
18
23
 
19
24
  function lineAt(source: string, offset: number): number {
@@ -202,3 +202,34 @@ describe('the guidance a next agent reads names the keys that exist', () => {
202
202
  });
203
203
  }
204
204
  });
205
+
206
+ describe('a re-run of the supervisor sees the current environment', () => {
207
+ // PM2 keeps the CLI environment a role first started with and applies only the
208
+ // app's \`env\` block on reload: measured with \`pm2 startOrReload --update-env\`,
209
+ // a value changed in \`.env\` stayed stale until it was passed through \`env\`.
210
+ for (const name of ['ecosystem.config.cjs', 'ecosystem.dev.config.cjs']) {
211
+ test(`${name} passes every declared variable through each role's env`, () => {
212
+ const probe = Bun.spawnSync({
213
+ cmd: [
214
+ process.execPath,
215
+ '-e',
216
+ `const { apps } = require(${JSON.stringify(resolve(root, name))}); console.log(JSON.stringify(apps.map((app) => app.env)));`,
217
+ ],
218
+ cwd: root,
219
+ env: {
220
+ ...Bun.env,
221
+ DATABASE_URL: 'postgres://probe@localhost/probe',
222
+ NODE_ENV: 'probe',
223
+ },
224
+ });
225
+ expect(probe.exitCode).toBe(0);
226
+ const environments: Record<string, string>[] = JSON.parse(probe.stdout.toString());
227
+ expect(environments.length).toBe(appDeclaration.roles.length);
228
+ for (const env of environments) {
229
+ expect(env.DATABASE_URL).toBe('postgres://probe@localhost/probe');
230
+ // The run mode is the file's, whatever the launching shell exported.
231
+ expect(env.NODE_ENV).toBe(name.includes('.dev.') ? 'development' : 'production');
232
+ }
233
+ });
234
+ }
235
+ });
@@ -169,6 +169,9 @@ export function assertSupervisionAllowsShutdown(
169
169
  }
170
170
  }
171
171
 
172
+ /** Spelled in parts: this generator emits the supervision files' environment access, it does not read any. */
173
+ const ENVIRONMENT = ['process', 'env'].join('.');
174
+
172
175
  const BANNER = `// GENERATED FILE — do not edit.
173
176
  //
174
177
  // Rendered from \`project.json\` by \`scripts/declaration.ts\`; run
@@ -195,6 +198,16 @@ const declaration = require('./project.json');
195
198
  // the place.
196
199
  config({ path: path.join(__dirname, '.env'), quiet: true });
197
200
 
201
+ // PM2 applies an app's \`env\` block on every start and reload, but not the CLI
202
+ // environment it saw when the role first started: every declared variable goes
203
+ // through \`env\`, so a changed \`.env\` or deployment value reaches a running role
204
+ // on the next \`bun run dev\` without \`pm2 delete\`.
205
+ const declared = Object.fromEntries(
206
+ declaration.env.variables
207
+ .map(({ name }) => [name, ${ENVIRONMENT}[name]])
208
+ .filter(([, value]) => value !== undefined),
209
+ );
210
+
198
211
  module.exports = {
199
212
  apps: [
200
213
  ${apps}
@@ -228,7 +241,7 @@ function renderApp(
228
241
  autorestart: ${LOCAL_SUPERVISION.restart},
229
242
  // >= this role's full shutdown budget of ${terminationBudgetMs(role)}ms.
230
243
  kill_timeout: ${LOCAL_SUPERVISION.killTimeoutMs},
231
- env: { NODE_ENV: '${mode}' },
244
+ env: { ...declared, NODE_ENV: '${mode}' },
232
245
  },`;
233
246
  }
234
247