create-stitchkit 0.6.20 → 0.6.22
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 +46 -0
- package/UPGRADING.md +27 -0
- package/package.json +6 -6
- package/template/biome.json +1 -1
- package/template/bun.lock +159 -189
- package/template/ecosystem.config.cjs +12 -2
- package/template/ecosystem.dev.config.cjs +12 -2
- package/template/package.json +8 -8
- package/template/packages/backend/package.json +1 -1
- package/template/packages/backend/src/transport/errors.ts +1 -0
- package/template/packages/config/package.json +1 -1
- package/template/packages/frontend/package.json +8 -8
- package/template/scripts/check-authored.ts +6 -1
- package/template/scripts/declaration.test.ts +31 -0
- package/template/scripts/declaration.ts +14 -1
- package/templates/agent/biome.json +1 -1
- package/templates/agent/package.json +7 -4
- package/templates/telegram-bot/biome.json +1 -1
- package/templates/telegram-bot/package.json +2 -2
|
@@ -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
|
};
|
package/template/package.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"packages/*"
|
|
8
8
|
],
|
|
9
9
|
"catalog": {
|
|
10
|
-
"stitchkit": "^0.
|
|
10
|
+
"stitchkit": "^0.124.2"
|
|
11
11
|
},
|
|
12
12
|
"overrides": {
|
|
13
|
-
"@playwright/test": "1.
|
|
14
|
-
"playwright": "1.
|
|
15
|
-
"playwright-core": "1.
|
|
13
|
+
"@playwright/test": "1.65.1",
|
|
14
|
+
"playwright": "1.65.1",
|
|
15
|
+
"playwright-core": "1.65.1",
|
|
16
16
|
"zod": "4.6.7"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
@@ -44,18 +44,18 @@
|
|
|
44
44
|
"gen:declaration": "bun scripts/declaration.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"dotenv": "^18.0.
|
|
47
|
+
"dotenv": "^18.0.10"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@app/config": "workspace:*",
|
|
51
51
|
"@app/shared": "workspace:*",
|
|
52
52
|
"@axe-core/playwright": "^4.14.0",
|
|
53
|
-
"@biomejs/biome": "2.6.
|
|
53
|
+
"@biomejs/biome": "2.6.8",
|
|
54
54
|
"@modelcontextprotocol/client": "^2.4.0",
|
|
55
|
-
"@playwright/test": "^1.
|
|
55
|
+
"@playwright/test": "^1.65.1",
|
|
56
56
|
"@types/bun": "^1.4.4",
|
|
57
57
|
"@types/node": "^26.6.6",
|
|
58
|
-
"oxc-parser": "^0.
|
|
58
|
+
"oxc-parser": "^0.159.0",
|
|
59
59
|
"socket.io-client": "^4.8.4",
|
|
60
60
|
"stitchkit": "catalog:",
|
|
61
61
|
"typescript": "^7.0.2",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"@radix-ui/react-tabs": "^1.2.1",
|
|
26
26
|
"@radix-ui/react-tooltip": "^1.4.1",
|
|
27
27
|
"@t3-oss/env-nextjs": "^0.13.11",
|
|
28
|
-
"@tabler/icons-react": "^3.
|
|
29
|
-
"@tanstack/react-query": "^5.
|
|
28
|
+
"@tabler/icons-react": "^3.52.0",
|
|
29
|
+
"@tanstack/react-query": "^5.108.0",
|
|
30
30
|
"@tanstack/react-table": "^9.3.1",
|
|
31
31
|
"@wrksz/themes": "^2.1.1",
|
|
32
32
|
"class-variance-authority": "^0.7.1",
|
|
33
33
|
"clsx": "^2.1.1",
|
|
34
34
|
"date-fns": "^4.4.0",
|
|
35
|
-
"dotenv": "^18.0.
|
|
36
|
-
"framer-motion": "^14.
|
|
37
|
-
"next": "^16.4.
|
|
38
|
-
"next-intl": "^4.
|
|
35
|
+
"dotenv": "^18.0.10",
|
|
36
|
+
"framer-motion": "^14.14.0",
|
|
37
|
+
"next": "^16.4.6",
|
|
38
|
+
"next-intl": "^4.15.1",
|
|
39
39
|
"react": "^19.3.1",
|
|
40
40
|
"react-dom": "^19.3.1",
|
|
41
41
|
"react-query-kit": "^3.4.0",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"zod": "^4.6.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@tailwindcss/postcss": "^4.3.
|
|
52
|
+
"@tailwindcss/postcss": "^4.3.5",
|
|
53
53
|
"@types/bun": "^1.4.4",
|
|
54
54
|
"@types/node": "^26.6.6",
|
|
55
55
|
"@types/react": "^19.3.0",
|
|
56
56
|
"@types/react-dom": "^19.3.0",
|
|
57
57
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
58
|
-
"tailwindcss": "^4.3.
|
|
58
|
+
"tailwindcss": "^4.3.5",
|
|
59
59
|
"tw-animate-css": "^1.4.0",
|
|
60
60
|
"typescript": "^7.0.2"
|
|
61
61
|
}
|
|
@@ -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.
|
|
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
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"catalog": {
|
|
7
|
-
"stitchkit-tui": "^0.
|
|
7
|
+
"stitchkit-tui": "^0.4.4"
|
|
8
8
|
},
|
|
9
9
|
"overrides": {
|
|
10
10
|
"zod": "4.6.7"
|
|
@@ -21,16 +21,19 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@modelcontextprotocol/server": "^2.4.0",
|
|
23
23
|
"@openrouter/ai-sdk-provider": "^3.1.0",
|
|
24
|
-
"
|
|
24
|
+
"@opentui/core": "^0.9.2",
|
|
25
|
+
"@opentui/react": "^0.9.2",
|
|
26
|
+
"ai": "^7.0.173",
|
|
27
|
+
"react": "^19.3.1",
|
|
25
28
|
"stitchkit": "link:../../../core",
|
|
26
29
|
"stitchkit-tui": "link:../../../tui",
|
|
27
30
|
"zod": "4.6.7"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
30
|
-
"@biomejs/biome": "2.6.
|
|
31
|
-
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
33
|
+
"@biomejs/biome": "2.6.8",
|
|
32
34
|
"@types/bun": "^1.4.4",
|
|
33
35
|
"@types/react": "^19.3.0",
|
|
36
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
34
37
|
"typescript": "^7.0.2"
|
|
35
38
|
},
|
|
36
39
|
"engines": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"zod": "4.6.7"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@biomejs/biome": "2.6.
|
|
26
|
-
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
25
|
+
"@biomejs/biome": "2.6.8",
|
|
27
26
|
"@types/bun": "^1.4.4",
|
|
27
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
28
28
|
"typescript": "^7.0.2"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|