create-substrat 0.5.0 → 0.6.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/dev-servers.js +29 -0
- package/index.js +6 -1
- package/package.json +2 -1
- package/template/.claude/launch.json +15 -0
package/dev-servers.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dev servers a scaffolded vertical runs — declared once, client-neutrally.
|
|
3
|
+
*
|
|
4
|
+
* `.claude/launch.json` is a Claude Desktop **adapter**: it lets the agent start
|
|
5
|
+
* the server, open it in the Browser pane, and verify its own changes. Under
|
|
6
|
+
* design/agent-surface.md §3 an adapter may route, describe and trigger but may
|
|
7
|
+
* never *hold* substance — so the topology lives here, in the `substrat` block of
|
|
8
|
+
* package.json that `substrat push` and the SessionStart hook already read, and
|
|
9
|
+
* the client file is emitted from it (`pnpm lint:launch`, guarded in CI).
|
|
10
|
+
*
|
|
11
|
+
* A port is deliberately NOT a field. `portEnv` + `portFrom` say *where* the port
|
|
12
|
+
* is bound; the number is read out of that file. Otherwise the declaration becomes
|
|
13
|
+
* a second copy of a number whose first copy is the one that actually runs, and
|
|
14
|
+
* with `autoPort: false` a stale copy is a hard boot failure — for an agent, mid
|
|
15
|
+
* session, which is the worst possible audience for it.
|
|
16
|
+
*
|
|
17
|
+
* @typedef {object} DevServer
|
|
18
|
+
* @property {string} name Entry name. Mirrors the `-n` label of the `dev` script.
|
|
19
|
+
* @property {string} run pnpm script to run. With `dir`, the script in that subdir.
|
|
20
|
+
* @property {string} [dir] Subdirectory of the project (a Vite app), if any.
|
|
21
|
+
* @property {string} portEnv The env var that moves this port (`PORT`, `WEB_PORT`, …).
|
|
22
|
+
* @property {string} portFrom Project-relative file binding it: `process.env.<portEnv> ?? N`.
|
|
23
|
+
* @property {Record<string,string>} [env] Env the `dev` script sets for this process.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** The template ships one process: the Hono API. There is no web app to scaffold yet. */
|
|
27
|
+
export const DEV_SERVERS = [
|
|
28
|
+
{ name: 'api', run: 'server', portEnv: 'PORT', portFrom: 'src/server.ts' },
|
|
29
|
+
];
|
package/index.js
CHANGED
|
@@ -16,6 +16,8 @@ import { cpSync, existsSync, mkdirSync, readdirSync, writeFileSync } from 'node:
|
|
|
16
16
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
17
17
|
import { fileURLToPath } from 'node:url';
|
|
18
18
|
|
|
19
|
+
import { DEV_SERVERS } from './dev-servers.js';
|
|
20
|
+
|
|
19
21
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
20
22
|
const TEMPLATE = join(HERE, 'template');
|
|
21
23
|
|
|
@@ -73,7 +75,9 @@ function packageJson(name) {
|
|
|
73
75
|
// What `substrat push` reads: the permission surface (the registry the
|
|
74
76
|
// promotion checkpoint diffs) and the runtime needs the deploy config is
|
|
75
77
|
// derived from — you never author wrangler config (src/worker.ts is the
|
|
76
|
-
// entry; ScopeDO is the store it exports).
|
|
78
|
+
// entry; ScopeDO is the store it exports). Also the client-neutral home of
|
|
79
|
+
// the dev topology `.claude/launch.json` is emitted from — see
|
|
80
|
+
// dev-servers.js for why the port is read from the code and never declared.
|
|
77
81
|
substrat: {
|
|
78
82
|
permissions: 'src/provision.ts',
|
|
79
83
|
runtimeNeeds: {
|
|
@@ -84,6 +88,7 @@ function packageJson(name) {
|
|
|
84
88
|
{ binding: 'SWEEPER', class: 'SweeperDO' },
|
|
85
89
|
],
|
|
86
90
|
},
|
|
91
|
+
devServers: DEV_SERVERS,
|
|
87
92
|
},
|
|
88
93
|
scripts: {
|
|
89
94
|
dev: 'tsx watch src/server.ts',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-substrat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Scaffold a Substrat vertical — `npm create substrat <dir>`.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"index.js",
|
|
27
|
+
"dev-servers.js",
|
|
27
28
|
"template"
|
|
28
29
|
],
|
|
29
30
|
"engines": {
|