@astrale-os/sdk 0.1.6 → 0.1.8
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/dist/cli/bin.d.ts +7 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +15 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/dotenv.d.ts +13 -0
- package/dist/cli/dotenv.d.ts.map +1 -0
- package/dist/cli/dotenv.js +46 -0
- package/dist/cli/dotenv.js.map +1 -0
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/run.d.ts +84 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +603 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/spec.d.ts +19 -0
- package/dist/cli/spec.d.ts.map +1 -0
- package/dist/cli/spec.js +31 -0
- package/dist/cli/spec.js.map +1 -0
- package/dist/config/adapter.d.ts +140 -0
- package/dist/config/adapter.d.ts.map +1 -0
- package/dist/config/adapter.js +40 -0
- package/dist/config/adapter.js.map +1 -0
- package/dist/config/define-domain.d.ts +112 -0
- package/dist/config/define-domain.d.ts.map +1 -0
- package/dist/config/define-domain.js +98 -0
- package/dist/config/define-domain.js.map +1 -0
- package/dist/config/deploy.d.ts +28 -0
- package/dist/config/deploy.d.ts.map +1 -0
- package/dist/config/deploy.js +24 -0
- package/dist/config/deploy.js.map +1 -0
- package/dist/config/index.d.ts +21 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +18 -0
- package/dist/config/index.js.map +1 -0
- package/dist/define/remote-function.d.ts +19 -11
- package/dist/define/remote-function.d.ts.map +1 -1
- package/dist/define/remote-function.js.map +1 -1
- package/dist/dispatch/call-remote.d.ts +7 -3
- package/dist/dispatch/call-remote.d.ts.map +1 -1
- package/dist/dispatch/call-remote.js.map +1 -1
- package/dist/dispatch/dispatcher.d.ts.map +1 -1
- package/dist/dispatch/dispatcher.js +8 -4
- package/dist/dispatch/dispatcher.js.map +1 -1
- package/dist/dispatch/index.d.ts +1 -1
- package/dist/dispatch/index.d.ts.map +1 -1
- package/dist/dispatch/index.js.map +1 -1
- package/dist/dispatch/self.d.ts +46 -10
- package/dist/dispatch/self.d.ts.map +1 -1
- package/dist/dispatch/self.js +65 -8
- package/dist/dispatch/self.js.map +1 -1
- package/dist/domain/define.d.ts +3 -3
- package/dist/domain/define.js +3 -3
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/method/class.d.ts.map +1 -1
- package/dist/method/class.js.map +1 -1
- package/dist/method/context.d.ts +32 -7
- package/dist/method/context.d.ts.map +1 -1
- package/dist/method/index.d.ts +1 -1
- package/dist/method/index.d.ts.map +1 -1
- package/dist/method/single.d.ts +16 -11
- package/dist/method/single.d.ts.map +1 -1
- package/dist/method/single.js.map +1 -1
- package/dist/server/domain-entry.d.ts +67 -0
- package/dist/server/domain-entry.d.ts.map +1 -0
- package/dist/server/domain-entry.js +58 -0
- package/dist/server/domain-entry.js.map +1 -0
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/worker-entry.d.ts +80 -5
- package/dist/server/worker-entry.d.ts.map +1 -1
- package/dist/server/worker-entry.js +105 -24
- package/dist/server/worker-entry.js.map +1 -1
- package/package.json +12 -3
- package/src/cli/bin.ts +15 -0
- package/src/cli/dotenv.ts +45 -0
- package/src/cli/index.ts +15 -0
- package/src/cli/run.ts +710 -0
- package/src/cli/spec.ts +42 -0
- package/src/config/adapter.ts +172 -0
- package/src/config/define-domain.ts +218 -0
- package/src/config/deploy.ts +35 -0
- package/src/config/index.ts +31 -0
- package/src/define/remote-function.ts +42 -13
- package/src/dispatch/call-remote.ts +7 -2
- package/src/dispatch/dispatcher.ts +8 -4
- package/src/dispatch/index.ts +1 -1
- package/src/dispatch/self.ts +96 -10
- package/src/domain/define.ts +3 -3
- package/src/index.ts +25 -4
- package/src/method/class.ts +4 -3
- package/src/method/context.ts +38 -7
- package/src/method/index.ts +1 -1
- package/src/method/single.ts +30 -11
- package/src/server/domain-entry.ts +113 -0
- package/src/server/index.ts +3 -1
- package/src/server/worker-entry.ts +128 -24
package/dist/cli/run.js
ADDED
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `astrale-domain` CLI — dev | build | deploy | publish.
|
|
3
|
+
*
|
|
4
|
+
* Thin by design: it reads `astrale.config.ts`, resolves `envs[<env>] → params`
|
|
5
|
+
* via the adapter, loads the env's secrets file, then drives `adapter.watch`
|
|
6
|
+
* (dev) or `adapter.deploy` (build+ship). It prints the resulting URL and the
|
|
7
|
+
* exact `astrale domain install <url> --direct` line. It boots no kernel and knows
|
|
8
|
+
* nothing provider-specific — that all lives in the adapter.
|
|
9
|
+
*
|
|
10
|
+
* The diagnostic spec (`.astrale/spec.json`) is written AFTER watch/deploy
|
|
11
|
+
* returns, at the live URL: the install graph (and therefore `schemaHash`)
|
|
12
|
+
* embeds `binding.remoteUrl`s derived from the serving URL, so a spec built at
|
|
13
|
+
* a guessed URL would carry a hash that never matches the worker's `/meta`.
|
|
14
|
+
* Only `astrale-domain build` (no URL exists yet) uses an explicit placeholder
|
|
15
|
+
* and says so.
|
|
16
|
+
*
|
|
17
|
+
* astrale-domain dev # = deploy dev --watch
|
|
18
|
+
* astrale-domain prod # = deploy prod
|
|
19
|
+
* astrale-domain deploy <env> # any env key
|
|
20
|
+
* astrale-domain build # rebuild spec only (placeholder URL)
|
|
21
|
+
* astrale-domain publish [env] # register the deployed URL in the admin catalog (NO deploy)
|
|
22
|
+
*
|
|
23
|
+
* `publish` registers a domain's ALREADY-deployed URL in the admin catalog by
|
|
24
|
+
* SHELLING OUT to the operator CLI (`astrale domain publish --origin --name
|
|
25
|
+
* --public-url`); it does NOT deploy — run `prod` / `deploy <env>` first, or use
|
|
26
|
+
* `deploy --publish` to deploy AND register in one step. Standalone publish
|
|
27
|
+
* defaults the registered address to `https://<origin>` (what every fleet domain
|
|
28
|
+
* serves at); pass `--public-url` for workers.dev / split-host deploys. Auth
|
|
29
|
+
* lives entirely in the operator CLI — this build tool never touches
|
|
30
|
+
* credentials. Requires `astrale` on PATH (the same CLI the deploy footer
|
|
31
|
+
* already points you at for `domain install`).
|
|
32
|
+
*/
|
|
33
|
+
import { spawn } from 'node:child_process';
|
|
34
|
+
import { existsSync, readFileSync, watch as watchFs } from 'node:fs';
|
|
35
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
36
|
+
import { createRequire } from 'node:module';
|
|
37
|
+
import { basename, dirname, isAbsolute, join } from 'node:path';
|
|
38
|
+
import { pathToFileURL } from 'node:url';
|
|
39
|
+
import { loadDotenvFile } from './dotenv';
|
|
40
|
+
import { buildProjectSpec } from './spec';
|
|
41
|
+
const CONFIG_NAMES = ['astrale.config.ts', 'astrale.config.js', 'astrale.config.mjs'];
|
|
42
|
+
export async function run(argv) {
|
|
43
|
+
// `--help` anywhere prints usage — previously `prod --help` IGNORED the
|
|
44
|
+
// flag and started a real deploy (observed in an external test run).
|
|
45
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
46
|
+
printUsage();
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
let parsed;
|
|
50
|
+
try {
|
|
51
|
+
parsed = parseArgs(argv);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
printUsage(err.message);
|
|
55
|
+
return 2;
|
|
56
|
+
}
|
|
57
|
+
// The CLI imports the project's TypeScript modules (astrale.config.ts, the ★
|
|
58
|
+
// files) directly — that requires a TS-native runtime. Fail with the remedy
|
|
59
|
+
// instead of a cryptic ERR_UNKNOWN_FILE_EXTENSION deep in `import()`.
|
|
60
|
+
if (!process.versions.bun) {
|
|
61
|
+
error('astrale-domain requires Bun (it imports your astrale.config.ts directly). ' +
|
|
62
|
+
'Install it from https://bun.sh, then re-run.');
|
|
63
|
+
return 1;
|
|
64
|
+
}
|
|
65
|
+
const projectDir = process.cwd();
|
|
66
|
+
const configPath = findConfig(projectDir);
|
|
67
|
+
if (!configPath) {
|
|
68
|
+
error(`No astrale.config.ts found in ${projectDir}. Run this from a domain project root.`);
|
|
69
|
+
return 1;
|
|
70
|
+
}
|
|
71
|
+
let def;
|
|
72
|
+
try {
|
|
73
|
+
def = await loadConfig(configPath);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
// Adapter-swap papercut: editing the `adapter:` call without the import
|
|
77
|
+
// (or vice versa) surfaces as a bare ReferenceError. Name the real fix.
|
|
78
|
+
const m = err instanceof Error ? /^(\w+) is not defined/.exec(err.message) : null;
|
|
79
|
+
if (m) {
|
|
80
|
+
error(`astrale.config.ts references \`${m[1]}\` but never imports it.\n` +
|
|
81
|
+
` If you swapped adapters (cloudflare ⇄ astrale), update BOTH lines:\n` +
|
|
82
|
+
` import { ${m[1]} } from '@astrale-os/adapter-cloudflare'\n` +
|
|
83
|
+
` adapter: ${m[1]}({ ... })`);
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
throw err;
|
|
87
|
+
}
|
|
88
|
+
const specPath = join(projectDir, '.astrale', 'spec.json');
|
|
89
|
+
if (parsed.command === 'build') {
|
|
90
|
+
// Spec-only: no adapter params, no secrets, no deploy → no real URL.
|
|
91
|
+
// Build at an explicit placeholder and say so: the schemaHash of this
|
|
92
|
+
// spec will NOT match a live worker's /meta (the install graph embeds
|
|
93
|
+
// URL-derived bindings).
|
|
94
|
+
const placeholderUrl = `https://${def.origin}`;
|
|
95
|
+
try {
|
|
96
|
+
await writeSpec({ projectDir, specPath, def, url: placeholderUrl });
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
error(`Spec build failed: ${err.message}`);
|
|
100
|
+
return 1;
|
|
101
|
+
}
|
|
102
|
+
info(`Built spec → ${rel(projectDir, specPath)} (origin: ${def.origin})`);
|
|
103
|
+
info(`note: built at placeholder ${placeholderUrl} — its schemaHash differs from a deployed worker.`);
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
if (parsed.command === 'publish') {
|
|
107
|
+
// Register the already-deployed URL in the admin catalog — NO deploy. The
|
|
108
|
+
// public address defaults to `https://<origin>` (the canonical custom-domain
|
|
109
|
+
// prod URL — what every fleet domain serves at); `--public-url` overrides it
|
|
110
|
+
// for workers.dev / split-host deploys. No adapter, secrets, or params: this
|
|
111
|
+
// only points the registry at an address the author already deployed.
|
|
112
|
+
const pkg = readPackageMeta(projectDir);
|
|
113
|
+
const name = parsed.name ?? def.origin.split('.')[0] ?? def.origin;
|
|
114
|
+
const url = parsed.publicUrl ?? `https://${def.origin}`;
|
|
115
|
+
info(`registering ${def.origin} → ${url} in the admin catalog (no deploy)`);
|
|
116
|
+
return await publishToAdmin({
|
|
117
|
+
origin: def.origin,
|
|
118
|
+
name,
|
|
119
|
+
url,
|
|
120
|
+
...(pkg.description ? { description: pkg.description } : {}),
|
|
121
|
+
...(parsed.installByDefault ? { installByDefault: true } : {}),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const adapter = def.adapter;
|
|
125
|
+
// CLI param overrides — applied over the env's params here AND re-applied by
|
|
126
|
+
// the config hot-regen path, which re-resolves `adapter.params` from the
|
|
127
|
+
// fresh config (without them, the first config edit would silently drop the
|
|
128
|
+
// flags — e.g. lose the `--host`-pinned WORKER_URL and drift the iss).
|
|
129
|
+
const paramOverrides = {};
|
|
130
|
+
// CLI port override beats the env's configured port (both adapters read
|
|
131
|
+
// `params.port` in watch).
|
|
132
|
+
if (parsed.command === 'dev' && parsed.port !== undefined)
|
|
133
|
+
paramOverrides.port = parsed.port;
|
|
134
|
+
// `--host <public-url>`: off-localhost dev (sandbox preview, tunnel). The
|
|
135
|
+
// adapter binds 0.0.0.0 and pins WORKER_URL so the worker's per-request-Host
|
|
136
|
+
// identity doesn't drift to the proxy's internal hostname.
|
|
137
|
+
if (parsed.command === 'dev' && parsed.host !== undefined)
|
|
138
|
+
paramOverrides.host = parsed.host;
|
|
139
|
+
const params = { ...adapter.params(parsed.env), ...paramOverrides };
|
|
140
|
+
const domain = toDomainInfo(def);
|
|
141
|
+
// The client SPA is a DECLARED binding (`defineDomain({ client })`), not a
|
|
142
|
+
// folder we sniff for: its presence + source dir come from the definition.
|
|
143
|
+
const clientDir = def.client ? join(projectDir, def.client.dir) : undefined;
|
|
144
|
+
const secrets = loadSecrets(adapter, params, projectDir);
|
|
145
|
+
if (parsed.command === 'dev' || (parsed.command === 'deploy' && parsed.watch)) {
|
|
146
|
+
return runWatch({
|
|
147
|
+
adapter,
|
|
148
|
+
params,
|
|
149
|
+
paramOverrides,
|
|
150
|
+
projectDir,
|
|
151
|
+
specPath,
|
|
152
|
+
clientDir,
|
|
153
|
+
secrets,
|
|
154
|
+
domain,
|
|
155
|
+
env: parsed.env,
|
|
156
|
+
def,
|
|
157
|
+
configPath,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// deploy (no watch)
|
|
161
|
+
const result = await adapter.deploy(params, {
|
|
162
|
+
projectDir,
|
|
163
|
+
specPath,
|
|
164
|
+
secrets,
|
|
165
|
+
...(clientDir ? { clientDir } : {}),
|
|
166
|
+
domain,
|
|
167
|
+
env: parsed.env,
|
|
168
|
+
});
|
|
169
|
+
await writeSpecBestEffort({ projectDir, specPath, def, url: result.url });
|
|
170
|
+
printDeployed(result, def);
|
|
171
|
+
if (parsed.publish) {
|
|
172
|
+
const pkg = readPackageMeta(projectDir);
|
|
173
|
+
// The registry `name` is a short catalog slug, distinct from the FQDN-like
|
|
174
|
+
// `origin` AND from the npm package name (`@scope/…` for a published domain —
|
|
175
|
+
// illegal as a catalog slug). Default to the origin's first label (the fleet
|
|
176
|
+
// convention, e.g. `ai-gateway`); `--name` overrides.
|
|
177
|
+
const name = parsed.name ?? def.origin.split('.')[0] ?? def.origin;
|
|
178
|
+
return await publishToAdmin({
|
|
179
|
+
origin: def.origin,
|
|
180
|
+
name,
|
|
181
|
+
url: result.url,
|
|
182
|
+
...(pkg.description ? { description: pkg.description } : {}),
|
|
183
|
+
...(parsed.installByDefault ? { installByDefault: true } : {}),
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return 0;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Register the just-deployed URL in the admin catalog by shelling out to the
|
|
190
|
+
* operator CLI (`astrale domain publish`). Deliberately a subprocess, not a
|
|
191
|
+
* library call: all credential/admin-target resolution lives in `@astrale-os/
|
|
192
|
+
* astrale` and we don't want it (or a kernel client) pulled into this build
|
|
193
|
+
* tool — we only own the fresh URL. A missing `astrale` is reported with the
|
|
194
|
+
* exact line to run by hand, so a deploy that already succeeded isn't a dead end.
|
|
195
|
+
*/
|
|
196
|
+
async function publishToAdmin(args) {
|
|
197
|
+
// `--public-url`, not `--url`: the operator CLI reserves `--url` for kernel
|
|
198
|
+
// targeting, so the domain's public address rides its own flag.
|
|
199
|
+
const cliArgs = [
|
|
200
|
+
'domain',
|
|
201
|
+
'publish',
|
|
202
|
+
'--origin',
|
|
203
|
+
args.origin,
|
|
204
|
+
'--name',
|
|
205
|
+
args.name,
|
|
206
|
+
'--public-url',
|
|
207
|
+
args.url,
|
|
208
|
+
];
|
|
209
|
+
if (args.description)
|
|
210
|
+
cliArgs.push('--description', args.description);
|
|
211
|
+
if (args.installByDefault)
|
|
212
|
+
cliArgs.push('--install-by-default');
|
|
213
|
+
info(`publishing to the admin catalog → astrale ${cliArgs.join(' ')}`);
|
|
214
|
+
return await new Promise((resolveCode) => {
|
|
215
|
+
const child = spawn('astrale', cliArgs, { stdio: 'inherit' });
|
|
216
|
+
child.on('error', (err) => {
|
|
217
|
+
if (err.code === 'ENOENT') {
|
|
218
|
+
error(`\`astrale\` CLI not found on PATH. The deploy succeeded — publish it by hand:\n` +
|
|
219
|
+
` astrale ${cliArgs.join(' ')}`);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
error(`failed to run \`astrale domain publish\`: ${err.message}`);
|
|
223
|
+
}
|
|
224
|
+
resolveCode(1);
|
|
225
|
+
});
|
|
226
|
+
child.on('exit', (code) => resolveCode(code ?? 1));
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/** Best-effort read of the project's package.json `name`/`description` (publish defaults). */
|
|
230
|
+
function readPackageMeta(projectDir) {
|
|
231
|
+
try {
|
|
232
|
+
const pkg = JSON.parse(readFileSync(join(projectDir, 'package.json'), 'utf8'));
|
|
233
|
+
return { name: pkg.name, description: pkg.description };
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
return {};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async function runWatch(args) {
|
|
240
|
+
const { adapter, params, projectDir, specPath, clientDir, secrets, domain, env, def } = args;
|
|
241
|
+
let reloads = 0;
|
|
242
|
+
const onReload = () => {
|
|
243
|
+
reloads += 1;
|
|
244
|
+
info(`↻ reloaded (#${reloads}) — same URL, no reinstall needed for handler edits`);
|
|
245
|
+
};
|
|
246
|
+
const handle = await adapter.watch(params, {
|
|
247
|
+
projectDir,
|
|
248
|
+
specPath,
|
|
249
|
+
...(clientDir ? { clientDir } : {}),
|
|
250
|
+
secrets,
|
|
251
|
+
domain,
|
|
252
|
+
env,
|
|
253
|
+
onReload,
|
|
254
|
+
});
|
|
255
|
+
await writeSpecBestEffort({ projectDir, specPath, def, url: handle.url });
|
|
256
|
+
printDevReady(handle.url, domain);
|
|
257
|
+
const stopConfigWatch = watchConfigForRegen({
|
|
258
|
+
configPath: args.configPath,
|
|
259
|
+
initial: def,
|
|
260
|
+
env,
|
|
261
|
+
paramOverrides: args.paramOverrides,
|
|
262
|
+
projectDir,
|
|
263
|
+
specPath,
|
|
264
|
+
...(clientDir ? { clientDir } : {}),
|
|
265
|
+
url: handle.url,
|
|
266
|
+
onReload,
|
|
267
|
+
});
|
|
268
|
+
await new Promise((resolveStop) => {
|
|
269
|
+
const stop = () => {
|
|
270
|
+
stopConfigWatch();
|
|
271
|
+
void handle.stop().finally(resolveStop);
|
|
272
|
+
};
|
|
273
|
+
process.on('SIGINT', stop);
|
|
274
|
+
process.on('SIGTERM', stop);
|
|
275
|
+
});
|
|
276
|
+
return 0;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Watch `astrale.config.ts` while `dev` runs: on change, re-import the config
|
|
280
|
+
* (cache-busted), re-resolve env params + secrets, and re-run the adapter's
|
|
281
|
+
* codegen via `adapter.regenerate` — the running dev server (e.g. `wrangler
|
|
282
|
+
* dev`, which watches its generated config + entry) reloads them itself, so a
|
|
283
|
+
* config edit lands without restarting the CLI.
|
|
284
|
+
*
|
|
285
|
+
* Watches the config's DIRECTORY, not the file: editors save via atomic
|
|
286
|
+
* rename, which silently kills an inode-bound watch.
|
|
287
|
+
*
|
|
288
|
+
* Deliberate limits, surfaced to the user instead of half-applied:
|
|
289
|
+
* • origin / adapter changes re-key the worker's identity → restart;
|
|
290
|
+
* • a mid-edit broken config (syntax error, bad env) warns and keeps the
|
|
291
|
+
* previous generation running;
|
|
292
|
+
* • modules the config IMPORTS (e.g. the schema) stay module-cached — only
|
|
293
|
+
* the config file itself is re-evaluated, which covers everything
|
|
294
|
+
* `defineDomain` owns (vars, requires, postInstall, wrangler overlay…).
|
|
295
|
+
*/
|
|
296
|
+
export function watchConfigForRegen(args) {
|
|
297
|
+
let running = false;
|
|
298
|
+
let pending = false;
|
|
299
|
+
let stopped = false;
|
|
300
|
+
let timer;
|
|
301
|
+
async function regen() {
|
|
302
|
+
if (stopped)
|
|
303
|
+
return;
|
|
304
|
+
if (running) {
|
|
305
|
+
pending = true;
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
running = true;
|
|
309
|
+
try {
|
|
310
|
+
const def = await loadConfig(args.configPath, { fresh: true });
|
|
311
|
+
if (def.origin !== args.initial.origin || def.adapter.name !== args.initial.adapter.name) {
|
|
312
|
+
warn(`astrale.config.ts: \`origin\` or adapter changed — that re-keys the worker's ` +
|
|
313
|
+
`identity; restart \`astrale-domain dev\` to apply.`);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const adapter = def.adapter;
|
|
317
|
+
if (!adapter.regenerate) {
|
|
318
|
+
warn(`astrale.config.ts changed, but the "${adapter.name}" adapter has no \`regenerate\` — ` +
|
|
319
|
+
`restart \`astrale-domain dev\` to apply.`);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const params = {
|
|
323
|
+
...adapter.params(args.env),
|
|
324
|
+
...args.paramOverrides,
|
|
325
|
+
};
|
|
326
|
+
const domain = toDomainInfo(def);
|
|
327
|
+
await adapter.regenerate(params, {
|
|
328
|
+
projectDir: args.projectDir,
|
|
329
|
+
specPath: args.specPath,
|
|
330
|
+
...(args.clientDir ? { clientDir: args.clientDir } : {}),
|
|
331
|
+
secrets: loadSecrets(adapter, params, args.projectDir),
|
|
332
|
+
domain,
|
|
333
|
+
env: args.env,
|
|
334
|
+
onReload: args.onReload,
|
|
335
|
+
});
|
|
336
|
+
await writeSpecBestEffort({
|
|
337
|
+
projectDir: args.projectDir,
|
|
338
|
+
specPath: args.specPath,
|
|
339
|
+
def,
|
|
340
|
+
url: args.url,
|
|
341
|
+
});
|
|
342
|
+
info(`↻ astrale.config.ts changed — codegen regenerated, the dev server reloads it ` +
|
|
343
|
+
`(a port / workerName / remote change still needs a restart)`);
|
|
344
|
+
}
|
|
345
|
+
catch (err) {
|
|
346
|
+
warn(`astrale.config.ts changed but reloading it failed (previous config stays live): ` +
|
|
347
|
+
`${err.message}`);
|
|
348
|
+
}
|
|
349
|
+
finally {
|
|
350
|
+
running = false;
|
|
351
|
+
if (pending && !stopped) {
|
|
352
|
+
pending = false;
|
|
353
|
+
void regen();
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const configFile = basename(args.configPath);
|
|
358
|
+
const watcher = watchFs(dirname(args.configPath), (_event, file) => {
|
|
359
|
+
if (file && file !== configFile)
|
|
360
|
+
return;
|
|
361
|
+
clearTimeout(timer);
|
|
362
|
+
// Debounce: editors fire several fs events per save (write + rename).
|
|
363
|
+
timer = setTimeout(() => void regen(), 200);
|
|
364
|
+
});
|
|
365
|
+
return () => {
|
|
366
|
+
stopped = true;
|
|
367
|
+
clearTimeout(timer);
|
|
368
|
+
watcher.close();
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
// ── spec ─────────────────────────────────────────────────────────────────
|
|
372
|
+
async function writeSpec(args) {
|
|
373
|
+
const { wire, schemaHash } = await buildProjectSpec(args.def, args.url);
|
|
374
|
+
await mkdir(dirname(args.specPath), { recursive: true });
|
|
375
|
+
await writeFile(args.specPath, JSON.stringify({ ...wire, schemaHash }, null, 2));
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Diagnostic-spec write for dev/deploy: best-effort — the worker builds the
|
|
379
|
+
* live install bundle itself, so a malformed project still runs/deploys; we
|
|
380
|
+
* warn and continue.
|
|
381
|
+
*/
|
|
382
|
+
async function writeSpecBestEffort(args) {
|
|
383
|
+
try {
|
|
384
|
+
await writeSpec(args);
|
|
385
|
+
}
|
|
386
|
+
catch (err) {
|
|
387
|
+
const msg = err.message;
|
|
388
|
+
warn(`(non-fatal) skipped the local diagnostic spec — the worker builds the real one: ${msg}`);
|
|
389
|
+
if (msg.includes('MISSING_DEF')) {
|
|
390
|
+
warn(` MISSING_DEF here usually means TWO copies of @astrale-os/kernel-core are loaded ` +
|
|
391
|
+
`(linked dev deps). Try \`pnpm dedupe\`; the deploy itself is unaffected.`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
// ── helpers ────────────────────────────────────────────────────────────────
|
|
396
|
+
function loadSecrets(adapter, params, projectDir) {
|
|
397
|
+
const file = adapter.secretsFile?.(params);
|
|
398
|
+
if (!file)
|
|
399
|
+
return {};
|
|
400
|
+
const abs = isAbsolute(file) ? file : join(projectDir, file);
|
|
401
|
+
return loadDotenvFile(abs);
|
|
402
|
+
}
|
|
403
|
+
function findConfig(dir) {
|
|
404
|
+
for (const name of CONFIG_NAMES) {
|
|
405
|
+
const candidate = join(dir, name);
|
|
406
|
+
if (existsSync(candidate))
|
|
407
|
+
return candidate;
|
|
408
|
+
}
|
|
409
|
+
return undefined;
|
|
410
|
+
}
|
|
411
|
+
function toDomainInfo(def) {
|
|
412
|
+
return {
|
|
413
|
+
origin: def.origin,
|
|
414
|
+
requires: def.requires,
|
|
415
|
+
...(def.postInstall ? { postInstall: def.postInstall } : {}),
|
|
416
|
+
// Presence comes from the definition the author wired — never a folder probe.
|
|
417
|
+
hasViews: def.views !== undefined,
|
|
418
|
+
hasFunctions: def.functions !== undefined,
|
|
419
|
+
hasClient: def.client !== undefined,
|
|
420
|
+
hasDeps: def.deps !== undefined,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
async function loadConfig(path, opts) {
|
|
424
|
+
// Re-importing an EDITED file: Bun's ESM registry is keyed by path and never
|
|
425
|
+
// re-reads the source — a `?reload=N` query re-EVALUATES but serves the
|
|
426
|
+
// CACHED (stale) source. Bun unifies that registry with `require.cache`, so
|
|
427
|
+
// deleting the entry forces a fresh read on the next import (the CLI is
|
|
428
|
+
// Bun-gated, see `run()`). Modules the config itself imports stay cached —
|
|
429
|
+
// the documented hot-regen limit.
|
|
430
|
+
if (opts?.fresh)
|
|
431
|
+
delete createRequire(import.meta.url).cache[path];
|
|
432
|
+
const mod = (await import(pathToFileURL(path).href));
|
|
433
|
+
const def = mod.default;
|
|
434
|
+
if (!def || typeof def !== 'object' || !('adapter' in def) || !('origin' in def)) {
|
|
435
|
+
throw new Error(`${path} must \`export default deploy(domain, adapter)\` from '@astrale-os/sdk' ` +
|
|
436
|
+
`(where \`domain\` is a \`defineDomain({ ... })\` from your domain.ts).`);
|
|
437
|
+
}
|
|
438
|
+
return def;
|
|
439
|
+
}
|
|
440
|
+
/** Require a plausible public URL for `--host`; default the scheme to https. */
|
|
441
|
+
function normalizeHost(raw) {
|
|
442
|
+
if (!raw || raw.startsWith('-'))
|
|
443
|
+
throw new Error(`--host needs a public URL, got "${raw ?? ''}"`);
|
|
444
|
+
const url = /^https?:\/\//.test(raw) ? raw : `https://${raw}`;
|
|
445
|
+
try {
|
|
446
|
+
return new URL(url).origin;
|
|
447
|
+
}
|
|
448
|
+
catch {
|
|
449
|
+
throw new Error(`--host needs a valid URL, got "${raw}"`);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
export function parseArgs(argv) {
|
|
453
|
+
const [cmd, ...rest] = argv;
|
|
454
|
+
const watch = rest.includes('--watch');
|
|
455
|
+
// Tail-flag (deploy/prod/publish): register the deployed URL in the admin
|
|
456
|
+
// catalog after a successful deploy. The `publish` command implies it.
|
|
457
|
+
const publish = rest.includes('--publish');
|
|
458
|
+
const installByDefault = rest.includes('--install-by-default');
|
|
459
|
+
// `--port <n>` / `--port=<n>`: consume the flag AND its value so neither
|
|
460
|
+
// leaks into the positionals (a bare `8788` would be read as the env name).
|
|
461
|
+
let port;
|
|
462
|
+
let host;
|
|
463
|
+
let name;
|
|
464
|
+
let publicUrl;
|
|
465
|
+
const cleaned = [];
|
|
466
|
+
for (let i = 0; i < rest.length; i++) {
|
|
467
|
+
const a = rest[i];
|
|
468
|
+
if (a === '--port') {
|
|
469
|
+
const v = rest[++i];
|
|
470
|
+
port = Number(v);
|
|
471
|
+
if (!Number.isInteger(port) || port <= 0)
|
|
472
|
+
throw new Error(`--port needs a port number, got "${v}"`);
|
|
473
|
+
}
|
|
474
|
+
else if (a.startsWith('--port=')) {
|
|
475
|
+
port = Number(a.slice('--port='.length));
|
|
476
|
+
if (!Number.isInteger(port) || port <= 0)
|
|
477
|
+
throw new Error(`--port needs a port number, got "${a}"`);
|
|
478
|
+
}
|
|
479
|
+
else if (a === '--host') {
|
|
480
|
+
host = normalizeHost(rest[++i]);
|
|
481
|
+
}
|
|
482
|
+
else if (a.startsWith('--host=')) {
|
|
483
|
+
host = normalizeHost(a.slice('--host='.length));
|
|
484
|
+
}
|
|
485
|
+
else if (a === '--name') {
|
|
486
|
+
name = rest[++i];
|
|
487
|
+
if (!name)
|
|
488
|
+
throw new Error('--name needs a value (the registry slug to publish under)');
|
|
489
|
+
}
|
|
490
|
+
else if (a.startsWith('--name=')) {
|
|
491
|
+
name = a.slice('--name='.length);
|
|
492
|
+
}
|
|
493
|
+
else if (a === '--public-url') {
|
|
494
|
+
publicUrl = rest[++i];
|
|
495
|
+
if (!publicUrl)
|
|
496
|
+
throw new Error('--public-url needs a value (the address the catalog points at)');
|
|
497
|
+
}
|
|
498
|
+
else if (a.startsWith('--public-url=')) {
|
|
499
|
+
publicUrl = a.slice('--public-url='.length);
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
cleaned.push(a);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
const positionals = cleaned.filter((a) => !a.startsWith('-'));
|
|
506
|
+
// Publish-related fields shared by deploy/prod/publish (publish itself is
|
|
507
|
+
// gated per-command: opt-in via `--publish`, always-on for `publish`).
|
|
508
|
+
const pub = {
|
|
509
|
+
...(name !== undefined ? { name } : {}),
|
|
510
|
+
...(installByDefault ? { installByDefault } : {}),
|
|
511
|
+
};
|
|
512
|
+
switch (cmd) {
|
|
513
|
+
case 'dev':
|
|
514
|
+
return {
|
|
515
|
+
command: 'dev',
|
|
516
|
+
env: positionals[0] ?? 'dev',
|
|
517
|
+
watch: true,
|
|
518
|
+
...(port !== undefined ? { port } : {}),
|
|
519
|
+
...(host !== undefined ? { host } : {}),
|
|
520
|
+
};
|
|
521
|
+
case 'prod':
|
|
522
|
+
return { command: 'deploy', env: 'prod', watch, ...(publish ? { publish } : {}), ...pub };
|
|
523
|
+
case 'deploy': {
|
|
524
|
+
const env = positionals[0];
|
|
525
|
+
if (!env)
|
|
526
|
+
throw new Error('`deploy` requires an env key, e.g. `deploy prod`.');
|
|
527
|
+
return { command: 'deploy', env, watch, ...(publish ? { publish } : {}), ...pub };
|
|
528
|
+
}
|
|
529
|
+
case 'publish':
|
|
530
|
+
// Register the ALREADY-deployed URL in the admin catalog — NO deploy.
|
|
531
|
+
// (Use `deploy [env] --publish` to deploy AND register in one step.) The
|
|
532
|
+
// public address defaults to `https://<origin>`; `--public-url` overrides.
|
|
533
|
+
return {
|
|
534
|
+
command: 'publish',
|
|
535
|
+
env: positionals[0] ?? 'prod',
|
|
536
|
+
watch: false,
|
|
537
|
+
...pub,
|
|
538
|
+
...(publicUrl !== undefined ? { publicUrl } : {}),
|
|
539
|
+
};
|
|
540
|
+
case 'build':
|
|
541
|
+
// Spec-only — no env resolution happens on this path.
|
|
542
|
+
return { command: 'build', env: 'dev', watch: false };
|
|
543
|
+
default:
|
|
544
|
+
throw new Error(cmd ? `Unknown command "${cmd}".` : 'Missing command.');
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function rel(from, to) {
|
|
548
|
+
return to.startsWith(from) ? `.${to.slice(from.length)}` : to;
|
|
549
|
+
}
|
|
550
|
+
// ── output ───────────────────────────────────────────────────────────────
|
|
551
|
+
const GREEN = '\x1b[32m';
|
|
552
|
+
const DIM = '\x1b[2m';
|
|
553
|
+
const BOLD = '\x1b[1m';
|
|
554
|
+
const YELLOW = '\x1b[33m';
|
|
555
|
+
const RED = '\x1b[31m';
|
|
556
|
+
const RESET = '\x1b[0m';
|
|
557
|
+
function info(msg) {
|
|
558
|
+
process.stdout.write(`${DIM}›${RESET} ${msg}\n`);
|
|
559
|
+
}
|
|
560
|
+
function warn(msg) {
|
|
561
|
+
process.stderr.write(`${YELLOW}!${RESET} ${msg}\n`);
|
|
562
|
+
}
|
|
563
|
+
function error(msg) {
|
|
564
|
+
process.stderr.write(`${RED}✗${RESET} ${msg}\n`);
|
|
565
|
+
}
|
|
566
|
+
function printDevReady(url, domain) {
|
|
567
|
+
process.stdout.write(`\n${GREEN}✓${RESET} ${BOLD}${domain.origin}${RESET} running (dev, hot-reload)\n` +
|
|
568
|
+
` ${BOLD}URL${RESET} ${GREEN}${url}${RESET}\n` +
|
|
569
|
+
` ${DIM}install on an instance:${RESET}\n` +
|
|
570
|
+
` ${BOLD}astrale domain install ${url} --direct${RESET}\n` +
|
|
571
|
+
` ${DIM}edit a handler → reloads at the same URL. edit the schema → reinstall.${RESET}\n\n`);
|
|
572
|
+
}
|
|
573
|
+
function printDeployed(result, def) {
|
|
574
|
+
// Adapters that already completed the install (managed deploys) supply
|
|
575
|
+
// their own next-steps; the default hint would tell the user to redo it.
|
|
576
|
+
const footer = result.nextSteps !== undefined
|
|
577
|
+
? result.nextSteps === ''
|
|
578
|
+
? ''
|
|
579
|
+
: `${result.nextSteps}\n`
|
|
580
|
+
: ` ${DIM}install on an instance:${RESET}\n` +
|
|
581
|
+
` ${BOLD}astrale domain install ${result.url} --direct${RESET}\n`;
|
|
582
|
+
process.stdout.write(`\n${GREEN}✓${RESET} ${BOLD}${def.origin}${RESET} deployed\n` +
|
|
583
|
+
` ${BOLD}URL${RESET} ${GREEN}${result.url}${RESET}\n` +
|
|
584
|
+
footer +
|
|
585
|
+
`\n`);
|
|
586
|
+
}
|
|
587
|
+
function printUsage(msg) {
|
|
588
|
+
if (msg)
|
|
589
|
+
error(msg);
|
|
590
|
+
process.stderr.write(`\nUsage:\n` +
|
|
591
|
+
` astrale-domain dev # deploy dev --watch (hot-reload, prints URL)\n` +
|
|
592
|
+
` astrale-domain prod # deploy prod\n` +
|
|
593
|
+
` astrale-domain deploy <env> # deploy any env key (--watch optional)\n` +
|
|
594
|
+
` astrale-domain publish [env] # register the already-deployed URL in the admin catalog (NO deploy)\n` +
|
|
595
|
+
` astrale-domain build # rebuild the diagnostic spec only\n` +
|
|
596
|
+
`\nFlags:\n` +
|
|
597
|
+
` --publish # on deploy/prod: ALSO register the deployed URL (deploy + register)\n` +
|
|
598
|
+
` --name <slug> # registry name to publish under (default: the origin's first label)\n` +
|
|
599
|
+
` --public-url <url> # (publish) address the catalog points at (default: https://<origin>)\n` +
|
|
600
|
+
` --install-by-default # mark the published domain for install on every new instance\n` +
|
|
601
|
+
`\n publish shells out to \`astrale domain publish\` (needs \`astrale\` on PATH).\n\n`);
|
|
602
|
+
}
|
|
603
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAKxC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAEzC,MAAM,YAAY,GAAG,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,CAAA;AAoBrF,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAuB;IAC/C,wEAAwE;IACxE,qEAAqE;IACrE,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,UAAU,EAAE,CAAA;QACZ,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,MAAkB,CAAA;IACtB,IAAI,CAAC;QACH,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC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,0BAA0B,KAAK,IAAI;YAC3C,SAAS,IAAI,0BAA0B,MAAM,CAAC,GAAG,YAAY,KAAK,IAAI,CAAA;IAC5E,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,KAAK,KAAK,IAAI,KAAK,IAAI,IAAI,GAAG,GAAG,CAAC,MAAM,GAAG,KAAK,aAAa;QAC3D,KAAK,IAAI,MAAM,KAAK,KAAK,KAAK,GAAG,MAAM,CAAC,GAAG,GAAG,KAAK,IAAI;QACvD,MAAM;QACN,IAAI,CACP,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAC,GAAY;IAC9B,IAAI,GAAG;QAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,YAAY;QACV,oFAAoF;QACpF,oDAAoD;QACpD,8EAA8E;QAC9E,2GAA2G;QAC3G,yEAAyE;QACzE,YAAY;QACZ,2GAA2G;QAC3G,2GAA2G;QAC3G,4GAA4G;QAC5G,oGAAoG;QACpG,uFAAuF,CAC1F,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a diagnostic spec (wire graph + schema hash) from the project's
|
|
3
|
+
* `defineDomain` definition. This mirrors what the codegen'd worker assembles —
|
|
4
|
+
* but only for inspection / `/meta` provenance. The live install bundle is
|
|
5
|
+
* always produced by the worker at request time, so a failure here is non-fatal
|
|
6
|
+
* for dev/deploy (the CLI logs and continues) and fatal only for
|
|
7
|
+
* `astrale-domain build`, where the spec IS the product.
|
|
8
|
+
*
|
|
9
|
+
* The modules (`schema` / `methods` / `views` / `functions`) come straight off
|
|
10
|
+
* the definition — the SAME values the author wired into `defineDomain`, which
|
|
11
|
+
* the adapter codegen also assembles. One source, no second filesystem probe to
|
|
12
|
+
* drift from it.
|
|
13
|
+
*/
|
|
14
|
+
import type { DomainDefinition } from '../config/define-domain';
|
|
15
|
+
export declare function buildProjectSpec(def: DomainDefinition, url: string): Promise<{
|
|
16
|
+
wire: Record<string, unknown>;
|
|
17
|
+
schemaHash: string;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/cli/spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAK/D,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,gBAAgB,EACrB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAehE"}
|