@astrale-os/sdk 0.6.0-beta.18 → 0.6.0-beta.19
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/README.md +1 -1
- package/dist/deployment/adapter/legacy/index.d.ts +2 -2
- package/dist/deployment/adapter/legacy/prepare/context.d.ts +4 -5
- package/dist/tooling/cli/arguments.d.ts +1 -3
- package/dist/tooling/cli/arguments.js +5 -39
- package/dist/tooling/cli/bun.d.ts +0 -1
- package/dist/tooling/cli/bun.js +0 -7
- package/dist/tooling/cli/deploy-mode.d.ts +4 -4
- package/dist/tooling/cli/deploy-mode.js +2 -15
- package/dist/tooling/cli/help.js +3 -50
- package/dist/tooling/cli/index.d.ts +1 -2
- package/dist/tooling/cli/index.js +1 -2
- package/dist/tooling/cli/legacy/stable-target-adapter.d.ts +1 -1
- package/dist/tooling/cli/orchestrate.d.ts +0 -6
- package/dist/tooling/cli/orchestrate.js +0 -28
- package/package.json +2 -2
- package/dist/tooling/cli/legacy/development/candidate.d.ts +0 -25
- package/dist/tooling/cli/legacy/development/candidate.js +0 -170
- package/dist/tooling/cli/legacy/development/credential.d.ts +0 -2
- package/dist/tooling/cli/legacy/development/credential.js +0 -57
- package/dist/tooling/cli/legacy/development/deployment.d.ts +0 -10
- package/dist/tooling/cli/legacy/development/deployment.js +0 -20
- package/dist/tooling/cli/legacy/development/deprecation.d.ts +0 -11
- package/dist/tooling/cli/legacy/development/deprecation.js +0 -13
- package/dist/tooling/cli/legacy/development/develop.d.ts +0 -15
- package/dist/tooling/cli/legacy/development/develop.js +0 -142
- package/dist/tooling/cli/legacy/development/index.d.ts +0 -21
- package/dist/tooling/cli/legacy/development/index.js +0 -21
- package/dist/tooling/cli/legacy/development/lease.d.ts +0 -18
- package/dist/tooling/cli/legacy/development/lease.js +0 -163
- package/dist/tooling/cli/legacy/development/lifecycle.d.ts +0 -9
- package/dist/tooling/cli/legacy/development/lifecycle.js +0 -43
- package/dist/tooling/cli/legacy/development/project-imports.d.ts +0 -22
- package/dist/tooling/cli/legacy/development/project-imports.js +0 -39
- package/dist/tooling/cli/legacy/development/project-lock.d.ts +0 -16
- package/dist/tooling/cli/legacy/development/project-lock.js +0 -41
- package/dist/tooling/cli/legacy/development/rebuild.d.ts +0 -13
- package/dist/tooling/cli/legacy/development/rebuild.js +0 -58
- package/dist/tooling/cli/legacy/development/report.d.ts +0 -7
- package/dist/tooling/cli/legacy/development/report.js +0 -11
- package/dist/tooling/cli/legacy/development/secrets-file.d.ts +0 -2
- package/dist/tooling/cli/legacy/development/secrets-file.js +0 -33
- package/dist/tooling/cli/legacy/development/source-watch.d.ts +0 -14
- package/dist/tooling/cli/legacy/development/source-watch.js +0 -140
- package/dist/tooling/cli/legacy/development/sources.d.ts +0 -7
- package/dist/tooling/cli/legacy/development/sources.js +0 -48
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ The command covers the workspace root and its packages, pins exact versions, and
|
|
|
42
42
|
lockfile through pnpm. Use `--channel latest` to select that tag instead. Missing tags and local,
|
|
43
43
|
catalog, or aliased dependencies are left unchanged and reported; peers and overrides are not edited.
|
|
44
44
|
For an older SDK without this command, start with `pnpm dlx @astrale-os/sdk@beta upgrade`.
|
|
45
|
-
|
|
45
|
+
Run the project's checks and validate on development.
|
|
46
46
|
Nothing is committed or deployed. A Shell update also requires checking the installed Shell revision.
|
|
47
47
|
Rerunning an upgrade synchronizes installation even when the manifest versions are already current.
|
|
48
48
|
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* `placement` and `deployRelease`, which deploys one sealed release as one immutable deployment,
|
|
8
8
|
* created or reused, and installs nothing.
|
|
9
9
|
*
|
|
10
|
-
* Short-term consumers: the legacy direct-mode path (CT33), which `astrale-domain deploy`
|
|
11
|
-
*
|
|
10
|
+
* Short-term consumers: the legacy direct-mode path (CT33), which `astrale-domain deploy`
|
|
11
|
+
* runs through these operations: adapter-cloudflare direct mode (`route`,
|
|
12
12
|
* `workerName`, `identityIssuer`, `addressing`, `signingIdentity`, or no `namespace`), which serves
|
|
13
13
|
* the configurations of domains ai-gateway, closing, grc, integrations and issues (until SV15),
|
|
14
14
|
* domains organization (until it leaves direct mode, AM-147), the Services `beta` and `prod` (until
|
|
@@ -11,9 +11,8 @@ export interface PrepareContext<BuildValue extends Build = Build> {
|
|
|
11
11
|
readonly projectDir: string;
|
|
12
12
|
readonly environment: string;
|
|
13
13
|
/**
|
|
14
|
-
* Preparation purpose.
|
|
15
|
-
*
|
|
16
|
-
* release for compatibility during the beta migration.
|
|
14
|
+
* Preparation purpose. One-shot deployment prepares complete release artifacts. Omitted by
|
|
15
|
+
* older custom callers means release for compatibility during the beta migration.
|
|
17
16
|
*/
|
|
18
17
|
readonly mode?: 'release';
|
|
19
18
|
/**
|
|
@@ -27,8 +26,8 @@ export interface PrepareContext<BuildValue extends Build = Build> {
|
|
|
27
26
|
readonly runtime: ResolvedRuntimeReference;
|
|
28
27
|
/**
|
|
29
28
|
* The environment-free Bundle of the adapter's own `bundler`, which `astrale-domain deploy`
|
|
30
|
-
* always produces first so that preparation only places it. Absent
|
|
31
|
-
*
|
|
29
|
+
* always produces first so that preparation only places it. Absent for a custom caller, the
|
|
30
|
+
* adapter bundles by itself. Legacy prepare/deploy surface: deleted with it.
|
|
32
31
|
*/
|
|
33
32
|
readonly bundle?: Bundle<BuildValue>;
|
|
34
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LintReportFormat } from '../linter/index.js';
|
|
2
2
|
import { type Version } from '../../platform/versioning/index.js';
|
|
3
|
-
export declare const COMMANDS: readonly ['
|
|
3
|
+
export declare const COMMANDS: readonly ['build', 'deploy', 'diff', 'list', 'publish', 'test', 'lint', 'package', 'upgrade', 'yank'];
|
|
4
4
|
export type Command = (typeof COMMANDS)[number];
|
|
5
5
|
export interface ParsedArgs {
|
|
6
6
|
readonly command: Command;
|
|
@@ -8,9 +8,7 @@ export interface ParsedArgs {
|
|
|
8
8
|
readonly fix?: boolean;
|
|
9
9
|
readonly format?: LintReportFormat;
|
|
10
10
|
readonly identity?: string;
|
|
11
|
-
readonly credentialFile?: string;
|
|
12
11
|
readonly suite?: string;
|
|
13
|
-
readonly secretsFile?: string;
|
|
14
12
|
readonly channel?: string;
|
|
15
13
|
readonly check?: boolean;
|
|
16
14
|
readonly json?: boolean;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { isAbsolute, normalize } from 'node:path';
|
|
2
1
|
import { acceptVersion } from '../../platform/versioning/index.js';
|
|
3
2
|
import { installCommand } from '../../project/install-command.js';
|
|
4
3
|
export const COMMANDS = [
|
|
5
|
-
'dev',
|
|
6
4
|
'build',
|
|
7
5
|
'deploy',
|
|
8
6
|
'diff',
|
|
@@ -24,8 +22,6 @@ export function parseArgs(argv) {
|
|
|
24
22
|
const json = rest.includes('--json');
|
|
25
23
|
const undo = rest.includes('--undo');
|
|
26
24
|
const allowDirty = rest.includes('--allow-dirty');
|
|
27
|
-
let secretsFile;
|
|
28
|
-
let credentialFile;
|
|
29
25
|
let identity;
|
|
30
26
|
let suite;
|
|
31
27
|
let format;
|
|
@@ -34,19 +30,7 @@ export function parseArgs(argv) {
|
|
|
34
30
|
const cleaned = [];
|
|
35
31
|
for (let index = 0; index < rest.length; index += 1) {
|
|
36
32
|
const argument = rest[index];
|
|
37
|
-
if (argument === '--
|
|
38
|
-
credentialFile = absoluteFilePath('--credential-file', rest[++index]);
|
|
39
|
-
}
|
|
40
|
-
else if (argument.startsWith('--credential-file=')) {
|
|
41
|
-
credentialFile = absoluteFilePath('--credential-file', argument.slice('--credential-file='.length));
|
|
42
|
-
}
|
|
43
|
-
else if (argument === '--secrets-file') {
|
|
44
|
-
secretsFile = absoluteFilePath('--secrets-file', rest[++index]);
|
|
45
|
-
}
|
|
46
|
-
else if (argument.startsWith('--secrets-file=')) {
|
|
47
|
-
secretsFile = absoluteFilePath('--secrets-file', argument.slice('--secrets-file='.length));
|
|
48
|
-
}
|
|
49
|
-
else if (argument === '--as') {
|
|
33
|
+
if (argument === '--as') {
|
|
50
34
|
identity = requiredValue('--as', rest[++index]);
|
|
51
35
|
}
|
|
52
36
|
else if (argument.startsWith('--as=')) {
|
|
@@ -110,28 +94,20 @@ export function parseArgs(argv) {
|
|
|
110
94
|
if (format !== undefined && command !== 'lint') {
|
|
111
95
|
throw new Error('`--format` is only valid for `lint`.');
|
|
112
96
|
}
|
|
113
|
-
if (
|
|
114
|
-
throw new Error('`--credential-file` and `--secrets-file` are only valid for `dev`.');
|
|
115
|
-
}
|
|
116
|
-
if (identity !== undefined && credentialFile !== undefined) {
|
|
117
|
-
throw new Error('Choose either `--as` or `--credential-file`, not both.');
|
|
118
|
-
}
|
|
119
|
-
if (deployOnly && command !== 'dev' && command !== 'deploy')
|
|
97
|
+
if (deployOnly && command !== 'deploy')
|
|
120
98
|
refuseDeployOnly(undefined);
|
|
121
99
|
if (identity !== undefined &&
|
|
122
|
-
command !== 'dev' &&
|
|
123
100
|
command !== 'deploy' &&
|
|
124
101
|
command !== 'diff' &&
|
|
125
102
|
command !== 'list' &&
|
|
126
103
|
command !== 'publish') {
|
|
127
|
-
throw new Error('`--as` is only valid for `
|
|
104
|
+
throw new Error('`--as` is only valid for `deploy`, `diff`, `list` or `publish`.');
|
|
128
105
|
}
|
|
129
106
|
if (environment !== undefined &&
|
|
130
|
-
command !== 'dev' &&
|
|
131
107
|
command !== 'deploy' &&
|
|
132
108
|
command !== 'list' &&
|
|
133
109
|
command !== 'test') {
|
|
134
|
-
throw new Error('`--environment` is only valid for `
|
|
110
|
+
throw new Error('`--environment` is only valid for `deploy`, `list` or `test`.');
|
|
135
111
|
}
|
|
136
112
|
if (suite !== undefined && command !== 'test') {
|
|
137
113
|
throw new Error('`--suite` is only valid for `test`.');
|
|
@@ -141,12 +117,11 @@ export function parseArgs(argv) {
|
|
|
141
117
|
throw new Error('Choose either a positional Environment or `--environment`, not both.');
|
|
142
118
|
}
|
|
143
119
|
switch (command) {
|
|
144
|
-
case 'dev':
|
|
145
120
|
case 'deploy': {
|
|
146
121
|
if (positionals.length > 1) {
|
|
147
122
|
throw new Error(`\`${command}\` accepts exactly one Environment.`);
|
|
148
123
|
}
|
|
149
|
-
const env = environment ?? positionals[0]
|
|
124
|
+
const env = environment ?? positionals[0];
|
|
150
125
|
if (!env) {
|
|
151
126
|
throw new Error(`\`${command}\` requires an Environment, e.g. \`${command} development\`.`);
|
|
152
127
|
}
|
|
@@ -157,8 +132,6 @@ export function parseArgs(argv) {
|
|
|
157
132
|
env,
|
|
158
133
|
...(json ? { json: true } : {}),
|
|
159
134
|
...(identity === undefined ? {} : { identity }),
|
|
160
|
-
...(credentialFile === undefined ? {} : { credentialFile }),
|
|
161
|
-
...(secretsFile === undefined ? {} : { secretsFile }),
|
|
162
135
|
};
|
|
163
136
|
}
|
|
164
137
|
case 'list':
|
|
@@ -278,10 +251,3 @@ function requiredValue(flag, input) {
|
|
|
278
251
|
throw new Error(`${flag} needs a value.`);
|
|
279
252
|
return input;
|
|
280
253
|
}
|
|
281
|
-
function absoluteFilePath(flag, input) {
|
|
282
|
-
const value = requiredValue(flag, input);
|
|
283
|
-
if (!isAbsolute(value) || normalize(value) !== value) {
|
|
284
|
-
throw new Error(`${flag} needs a normalized absolute path, got "${value}"`);
|
|
285
|
-
}
|
|
286
|
-
return value;
|
|
287
|
-
}
|
|
@@ -10,6 +10,5 @@ export type BunOutcome = {
|
|
|
10
10
|
};
|
|
11
11
|
/** Re-enter the published executable under Bun only when authored TypeScript must be imported. */
|
|
12
12
|
export declare function runWithBun(executable: string, argv: readonly string[]): Promise<BunOutcome>;
|
|
13
|
-
export declare function isolateDevelopmentProcessGroup(argv: readonly string[], platform?: NodeJS.Platform): boolean;
|
|
14
13
|
/** Prefer the generated project's exact Bun package binary over an ambient executable or shim. */
|
|
15
14
|
export declare function resolveBunExecutable(cwd: string): string;
|
package/dist/tooling/cli/bun.js
CHANGED
|
@@ -14,10 +14,6 @@ export function runWithBun(executable, argv) {
|
|
|
14
14
|
return new Promise((resolve, reject) => {
|
|
15
15
|
const child = spawn(resolveBunExecutable(process.cwd()), [executable, ...argv], {
|
|
16
16
|
stdio: 'inherit',
|
|
17
|
-
// Keep a long-lived development runtime outside the launcher's terminal
|
|
18
|
-
// process group. The launcher receives Ctrl-C, forwards it exactly once,
|
|
19
|
-
// and remains alive until Bun finishes provider and Kernel cleanup.
|
|
20
|
-
detached: isolateDevelopmentProcessGroup(argv),
|
|
21
17
|
});
|
|
22
18
|
const handlers = FORWARDED_SIGNALS.map((signal) => [signal, () => child.kill(signal)]);
|
|
23
19
|
for (const [signal, handler] of handlers)
|
|
@@ -44,9 +40,6 @@ export function runWithBun(executable, argv) {
|
|
|
44
40
|
});
|
|
45
41
|
});
|
|
46
42
|
}
|
|
47
|
-
export function isolateDevelopmentProcessGroup(argv, platform = process.platform) {
|
|
48
|
-
return platform !== 'win32' && argv[0] === 'dev';
|
|
49
|
-
}
|
|
50
43
|
/** Prefer the generated project's exact Bun package binary over an ambient executable or shim. */
|
|
51
44
|
export function resolveBunExecutable(cwd) {
|
|
52
45
|
const projectRequire = createRequire(join(cwd, 'package.json'));
|
|
@@ -40,7 +40,7 @@ export type LegacyDirectReason =
|
|
|
40
40
|
};
|
|
41
41
|
export type CloudflareDirectParameter = 'route' | 'workerName' | 'identityIssuer' | 'addressing' | 'signingIdentity';
|
|
42
42
|
export interface DeployRefusal {
|
|
43
|
-
readonly reason: 'astrale-instance' | 'astrale-signing-identity' | 'mixed-parameters' | 'scheduled-triggers' | '
|
|
43
|
+
readonly reason: 'astrale-instance' | 'astrale-signing-identity' | 'mixed-parameters' | 'scheduled-triggers' | 'publish-legacy-direct';
|
|
44
44
|
/** The configuration or command to write instead, for the author. */
|
|
45
45
|
readonly guidance: string;
|
|
46
46
|
}
|
|
@@ -48,7 +48,7 @@ export interface DeployRefusal {
|
|
|
48
48
|
* The commands that select a deploy mode. `publish` names only an immutable deployment, so it
|
|
49
49
|
* refuses every Environment that is not canonical (CT33, R-G03).
|
|
50
50
|
*/
|
|
51
|
-
export type DeployModeCommand = 'deploy' | '
|
|
51
|
+
export type DeployModeCommand = 'deploy' | 'publish';
|
|
52
52
|
/**
|
|
53
53
|
* Select the deploy mode of one Environment (CT33). It reads the configuration and the command
|
|
54
54
|
* only, and has no effect.
|
|
@@ -58,8 +58,8 @@ export type DeployModeCommand = 'deploy' | 'dev' | 'publish';
|
|
|
58
58
|
* before any effect, since their one consumer pins an older SDK (AM-72). Otherwise the Environment
|
|
59
59
|
* is on the legacy direct-mode path when adapter-cloudflare names a direct-mode parameter or no
|
|
60
60
|
* `namespace`, or when its adapter declares no `deployRelease`. Everything else is canonical,
|
|
61
|
-
*
|
|
62
|
-
*
|
|
61
|
+
* and `publish` refuses the legacy direct-mode path: a stable target serves no release, so no
|
|
62
|
+
* version can name it.
|
|
63
63
|
*
|
|
64
64
|
* Within canonical adapter-cloudflare (with `namespace`), a direct-mode parameter is refused
|
|
65
65
|
* rather than silently selecting either mode, and so is `wrangler.triggers`: an immutable
|
|
@@ -22,8 +22,8 @@ const CLOUDFLARE_DIRECT_PARAMETERS = [
|
|
|
22
22
|
* before any effect, since their one consumer pins an older SDK (AM-72). Otherwise the Environment
|
|
23
23
|
* is on the legacy direct-mode path when adapter-cloudflare names a direct-mode parameter or no
|
|
24
24
|
* `namespace`, or when its adapter declares no `deployRelease`. Everything else is canonical,
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* and `publish` refuses the legacy direct-mode path: a stable target serves no release, so no
|
|
26
|
+
* version can name it.
|
|
27
27
|
*
|
|
28
28
|
* Within canonical adapter-cloudflare (with `namespace`), a direct-mode parameter is refused
|
|
29
29
|
* rather than silently selecting either mode, and so is `wrangler.triggers`: an immutable
|
|
@@ -94,19 +94,6 @@ export function selectDeployMode(input) {
|
|
|
94
94
|
}
|
|
95
95
|
if (reasons.length > 0)
|
|
96
96
|
return Object.freeze({ kind: 'legacy-direct', reasons: freeze(reasons) });
|
|
97
|
-
if (command === 'dev') {
|
|
98
|
-
return Object.freeze({
|
|
99
|
-
kind: 'refused',
|
|
100
|
-
refusals: freeze([
|
|
101
|
-
{
|
|
102
|
-
reason: 'development-canonical',
|
|
103
|
-
guidance: `\`astrale-domain dev\` serves only legacy direct-mode Environments, and ${environment} ` +
|
|
104
|
-
`deploys immutable deployments. Run \`astrale-domain deploy ${environment}\`, then ` +
|
|
105
|
-
`\`${installCommand()}\`.`,
|
|
106
|
-
},
|
|
107
|
-
]),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
97
|
return Object.freeze({ kind: 'canonical' });
|
|
111
98
|
}
|
|
112
99
|
/**
|
package/dist/tooling/cli/help.js
CHANGED
|
@@ -14,13 +14,12 @@ export function helpText(command) {
|
|
|
14
14
|
export const ERROR_USAGE = `Usage: astrale-domain <command> [options]
|
|
15
15
|
Run "astrale-domain --help" for available commands.
|
|
16
16
|
`;
|
|
17
|
-
const GLOBAL_HELP = `Build,
|
|
17
|
+
const GLOBAL_HELP = `Build, deploy, list, test, lint, and package Astrale Domains.
|
|
18
18
|
|
|
19
19
|
Usage:
|
|
20
20
|
astrale-domain <command> [options]
|
|
21
21
|
|
|
22
22
|
Commands:
|
|
23
|
-
dev [environment] Deprecated: use deploy, then astrale domain install.
|
|
24
23
|
build Build, verify and print the build digest.
|
|
25
24
|
deploy <environment> Deploy one Environment; never installs.
|
|
26
25
|
diff Show the changes since the published version and the minimum.
|
|
@@ -57,55 +56,9 @@ Behavior:
|
|
|
57
56
|
unchanged with a warning.
|
|
58
57
|
Local links, catalogs, aliases, peers, and overrides are not rewritten.
|
|
59
58
|
Does not load astrale.config.ts, require Bun, run project checks, commit, or deploy.
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
Review changes and run your project's checks afterwards. Failed installations leave
|
|
60
|
+
local changes available for repair.
|
|
62
61
|
For an older SDK without this command: pnpm dlx @astrale-os/sdk@beta upgrade.
|
|
63
|
-
`,
|
|
64
|
-
dev: `Build, verify, remotely deploy, and watch one Project Environment (deprecated).
|
|
65
|
-
|
|
66
|
-
Usage:
|
|
67
|
-
astrale-domain dev [environment] [options]
|
|
68
|
-
|
|
69
|
-
Deprecated:
|
|
70
|
-
Development is not a command of the deployment model. Deploy the Environment with
|
|
71
|
-
astrale-domain deploy <environment>, then install the URL it prints with
|
|
72
|
-
astrale domain install <url> --direct -i <instance>. dev keeps its behavior until
|
|
73
|
-
it is removed and warns on every run.
|
|
74
|
-
|
|
75
|
-
Arguments:
|
|
76
|
-
environment Project Environment name; defaults to development.
|
|
77
|
-
|
|
78
|
-
Options:
|
|
79
|
-
--environment <name> Select the environment without a positional argument.
|
|
80
|
-
--as <identity> Select the Astrale identity for the adapter's provider calls.
|
|
81
|
-
--credential-file <path>
|
|
82
|
-
Use one private operator credential for the adapter's provider
|
|
83
|
-
calls without exposing it in Project configuration.
|
|
84
|
-
--secrets-file <path> Load one private, absolute secrets file for this development
|
|
85
|
-
session instead of the adapter-declared secrets file.
|
|
86
|
-
-h, --help Show help for dev.
|
|
87
|
-
|
|
88
|
-
Behavior:
|
|
89
|
-
The selected Environment must exist; no other Environment is chosen as a fallback.
|
|
90
|
-
Builds and verifies the Domain, Runtime, frontend, and adapter artifact, then
|
|
91
|
-
deploys it through the selected Environment. It never starts a local Worker,
|
|
92
|
-
Vite server, or tunnel, and never installs the Domain: install the URL it prints with
|
|
93
|
-
${installCommand()}. Imported source changes
|
|
94
|
-
produce serialized remote updates; configuration changes require restarting the
|
|
95
|
-
command. It serves only legacy direct-mode Environments; an Environment that
|
|
96
|
-
deploys immutable deployments is refused.
|
|
97
|
-
A shared direct-provider target additionally requires an external single-writer
|
|
98
|
-
boundary such as a CI/CD concurrency group.
|
|
99
|
-
A credential file is admitted and read once. Its value is passed only to the
|
|
100
|
-
deployment adapter; it never enters Domain Runtime secrets or diagnostics. It is
|
|
101
|
-
currently unavailable on Windows because private no-reparse file admission is
|
|
102
|
-
absent.
|
|
103
|
-
A secrets-file override is read once, passed to the Domain runtime as secrets,
|
|
104
|
-
never mutates the authored project, and is not watched for later changes. It is
|
|
105
|
-
also unavailable on Windows because private no-reparse admission is absent.
|
|
106
|
-
|
|
107
|
-
Stopping the watcher stops only local build orchestration. The remote deployment
|
|
108
|
-
remains available.
|
|
109
62
|
`,
|
|
110
63
|
build: `Build and verify a Domain without deploying it, and print its build digest.
|
|
111
64
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@astrale-os/sdk/cli` — the `astrale-domain` CLI
|
|
3
|
-
* (
|
|
3
|
+
* (build | deploy | diff | list | publish | test | lint | package | upgrade | yank), its JSON results,
|
|
4
4
|
* the deploy mode each command selects for an Environment (CT33), and the explicit dotenv boundary.
|
|
5
|
-
* `dev` is deprecated and lives in `legacy/development/`.
|
|
6
5
|
*
|
|
7
6
|
* Node-only: the CLI imports `node:fs`/`node:module`/`node:url` and runs under
|
|
8
7
|
* Bun (it imports the project's `astrale.config.ts` directly). This subpath is
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@astrale-os/sdk/cli` — the `astrale-domain` CLI
|
|
3
|
-
* (
|
|
3
|
+
* (build | deploy | diff | list | publish | test | lint | package | upgrade | yank), its JSON results,
|
|
4
4
|
* the deploy mode each command selects for an Environment (CT33), and the explicit dotenv boundary.
|
|
5
|
-
* `dev` is deprecated and lives in `legacy/development/`.
|
|
6
5
|
*
|
|
7
6
|
* Node-only: the CLI imports `node:fs`/`node:module`/`node:url` and runs under
|
|
8
7
|
* Bun (it imports the project's `astrale.config.ts` directly). This subpath is
|
|
@@ -4,7 +4,7 @@ import type { Adapter, LegacyAdapter } from '../../../deployment/adapter/index.j
|
|
|
4
4
|
* v2 that keeps `prepare` and `deploy` for its direct-mode Environments.
|
|
5
5
|
*
|
|
6
6
|
* @deprecated Stable-target deploy path only. Replacement: `deployRelease` of adapter interface
|
|
7
|
-
* v2. Consumers: `astrale-domain deploy`
|
|
7
|
+
* v2. Consumers: `astrale-domain deploy` on the direct-mode
|
|
8
8
|
* configurations of domains ai-gateway, closing, grc, integrations and issues (until SV15), domains
|
|
9
9
|
* organization (until it leaves direct mode, AM-147), the Services `beta` and `prod` (until SV12),
|
|
10
10
|
* `development` (until SV9) and frozen `admin-beta` (until D19) environments, shell (until SH2)
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import { type ParsedArgs } from './arguments.js';
|
|
2
|
-
import { develop } from './legacy/development/index.js';
|
|
3
1
|
export declare function run(argv: readonly string[]): Promise<number>;
|
|
4
|
-
export declare function executeDevelopmentCommand(parsed: ParsedArgs, input: {
|
|
5
|
-
readonly configPath: string;
|
|
6
|
-
readonly projectDir: string;
|
|
7
|
-
}, execute?: typeof develop): Promise<number>;
|
|
@@ -10,7 +10,6 @@ import { deprecationWarnings } from './deprecations.js';
|
|
|
10
10
|
import { runDiff } from './diff/index.js';
|
|
11
11
|
import { ERROR_USAGE, helpRequest, helpText } from './help.js';
|
|
12
12
|
import { deployImmutable } from './immutable-deployment.js';
|
|
13
|
-
import { develop, developmentDeprecation } from './legacy/development/index.js';
|
|
14
13
|
import { deployStableTarget } from './legacy/stable-target-deploy.js';
|
|
15
14
|
import { listDeployments, renderDeploymentList } from './list.js';
|
|
16
15
|
import { error, info, progress, warn } from './log.js';
|
|
@@ -56,10 +55,6 @@ export async function run(argv) {
|
|
|
56
55
|
if (!process.versions.bun) {
|
|
57
56
|
throw new BunRequiredError();
|
|
58
57
|
}
|
|
59
|
-
// Under Bun, before any Project prerequisite, so a refused `dev` run still names its
|
|
60
|
-
// replacement. The Node launcher re-enters Bun through BunRequiredError, so it prints once.
|
|
61
|
-
if (parsed.command === 'dev')
|
|
62
|
-
warn(developmentDeprecation(parsed.env));
|
|
63
58
|
const projectDir = process.cwd();
|
|
64
59
|
const configPath = findConfig(projectDir);
|
|
65
60
|
if (configPath === undefined) {
|
|
@@ -71,17 +66,6 @@ export async function run(argv) {
|
|
|
71
66
|
return list(parsed, project, projectDir);
|
|
72
67
|
if (parsed.command === 'yank')
|
|
73
68
|
return yank(parsed, project);
|
|
74
|
-
if (parsed.command === 'dev') {
|
|
75
|
-
// `dev` deploys only legacy direct-mode Environments; any other is refused before any effect.
|
|
76
|
-
const mode = selectDeployMode({
|
|
77
|
-
command: 'dev',
|
|
78
|
-
environment: parsed.env,
|
|
79
|
-
definition: selectEnvironment(project, parsed.env),
|
|
80
|
-
});
|
|
81
|
-
if (refused(mode))
|
|
82
|
-
return 1;
|
|
83
|
-
return executeDevelopmentCommand(parsed, { configPath, projectDir });
|
|
84
|
-
}
|
|
85
69
|
if (parsed.command === 'publish') {
|
|
86
70
|
// A version names an immutable deployment's release: any other Environment is refused before
|
|
87
71
|
// anything is built (CT33, R-G03).
|
|
@@ -299,18 +283,6 @@ function refused(mode) {
|
|
|
299
283
|
error(refusal.guidance);
|
|
300
284
|
return true;
|
|
301
285
|
}
|
|
302
|
-
export function executeDevelopmentCommand(parsed, input, execute = develop) {
|
|
303
|
-
if (parsed.command !== 'dev')
|
|
304
|
-
throw new TypeError('Development execution requires the dev command.');
|
|
305
|
-
return execute({
|
|
306
|
-
configPath: input.configPath,
|
|
307
|
-
projectDir: input.projectDir,
|
|
308
|
-
environment: parsed.env,
|
|
309
|
-
...(parsed.identity === undefined ? {} : { identity: parsed.identity }),
|
|
310
|
-
...(parsed.credentialFile === undefined ? {} : { credentialFile: parsed.credentialFile }),
|
|
311
|
-
...(parsed.secretsFile === undefined ? {} : { secretsFile: parsed.secretsFile }),
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
286
|
/**
|
|
315
287
|
* `astrale-domain yank <version> [--undo]`: take one published version of the Project's Domain
|
|
316
288
|
* out of resolution in the Admin registry, or put it back. With `--json`, stdout carries only the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/sdk",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.19",
|
|
4
4
|
"description": "Schema-first SDK for defining, composing, and deploying Astrale domains",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
"e2e": "node __e2e__/flagship/runner.mjs",
|
|
334
334
|
"typecheck": "tsgo --noEmit && pnpm run typecheck:workers && pnpm run typecheck:specs && pnpm run typecheck:types && pnpm run typecheck:tests && pnpm run typecheck:e2e && pnpm run typecheck:knowledge",
|
|
335
335
|
"typecheck:workers": "tsgo --noEmit -p tsconfig.workers.json",
|
|
336
|
-
"typecheck:specs": "tsgo --noEmit -p src/application/query/.spec/tsconfig.json && tsgo --noEmit -p src/platform/schema/.spec/tsconfig.json && tsgo --noEmit -p src/application/mutation/.spec/tsconfig.json && tsgo --noEmit -p src/tooling/cli/.spec/tsconfig.json
|
|
336
|
+
"typecheck:specs": "tsgo --noEmit -p src/application/query/.spec/tsconfig.json && tsgo --noEmit -p src/platform/schema/.spec/tsconfig.json && tsgo --noEmit -p src/application/mutation/.spec/tsconfig.json && tsgo --noEmit -p src/tooling/cli/.spec/tsconfig.json",
|
|
337
337
|
"typecheck:types": "tsgo --noEmit -p __tests__/tsconfig.types.json",
|
|
338
338
|
"typecheck:tests": "tsgo --noEmit -p tsconfig.test.json",
|
|
339
339
|
"typecheck:e2e": "tsgo --noEmit -p __e2e__/flagship/fixtures/tsconfig.v1.json && tsgo --noEmit -p __e2e__/flagship/fixtures/tsconfig.json",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { PreparedArtifact } from '../../../../deployment/adapter/index.js';
|
|
2
|
-
import type { StableTargetAdapter } from '../stable-target-adapter.js';
|
|
3
|
-
export interface DevelopmentCandidate {
|
|
4
|
-
readonly adapter: StableTargetAdapter<object>;
|
|
5
|
-
readonly parameters: object;
|
|
6
|
-
readonly artifact: PreparedArtifact;
|
|
7
|
-
readonly secrets: Readonly<Record<string, string>>;
|
|
8
|
-
readonly sources: ReadonlySet<string>;
|
|
9
|
-
}
|
|
10
|
-
/** Rebuild one complete, isolated Environment candidate from authored sources. */
|
|
11
|
-
export declare class DevelopmentCandidateBuilder {
|
|
12
|
-
#private;
|
|
13
|
-
constructor(input: {
|
|
14
|
-
readonly configPath: string;
|
|
15
|
-
readonly projectDir: string;
|
|
16
|
-
readonly environment: string;
|
|
17
|
-
readonly runtimePath: string;
|
|
18
|
-
readonly overrideSecrets?: Readonly<Record<string, string>>;
|
|
19
|
-
});
|
|
20
|
-
prepare(signal: AbortSignal): Promise<DevelopmentCandidate>;
|
|
21
|
-
}
|
|
22
|
-
export declare function discoverRuntimePath(configPath: string): Promise<string>;
|
|
23
|
-
export declare function sameEnvironment(current: DevelopmentCandidate, candidate: DevelopmentCandidate): boolean;
|
|
24
|
-
/** Identify a rebuilt candidate that cannot change provider state. */
|
|
25
|
-
export declare function sameDeploymentCandidate(current: DevelopmentCandidate, candidate: DevelopmentCandidate): boolean;
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { mkdir, rm, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { admitRuntime, compile, resolveRuntime, runtime, verifyPreflight, } from '../../../../deployment/index.js';
|
|
6
|
-
import { admitProjectModule } from '../../../../project/index.js';
|
|
7
|
-
import { loadDeclaredSecrets } from '../../dotenv.js';
|
|
8
|
-
import { selectEnvironment } from '../../project.js';
|
|
9
|
-
import { stableTargetAdapter } from '../stable-target-adapter.js';
|
|
10
|
-
import { projectImportPlugin } from './project-imports.js';
|
|
11
|
-
import { DevelopmentSources } from './sources.js';
|
|
12
|
-
/** Rebuild one complete, isolated Environment candidate from authored sources. */
|
|
13
|
-
export class DevelopmentCandidateBuilder {
|
|
14
|
-
#configPath;
|
|
15
|
-
#projectDir;
|
|
16
|
-
#environment;
|
|
17
|
-
#runtimePath;
|
|
18
|
-
#overrideSecrets;
|
|
19
|
-
#generation = 0;
|
|
20
|
-
constructor(input) {
|
|
21
|
-
this.#configPath = input.configPath;
|
|
22
|
-
this.#projectDir = input.projectDir;
|
|
23
|
-
this.#environment = input.environment;
|
|
24
|
-
this.#runtimePath = input.runtimePath;
|
|
25
|
-
this.#overrideSecrets = input.overrideSecrets;
|
|
26
|
-
}
|
|
27
|
-
async prepare(signal) {
|
|
28
|
-
throwIfAborted(signal);
|
|
29
|
-
const directory = join(this.#projectDir, '.astrale', 'development', this.#environment, 'source', String(++this.#generation));
|
|
30
|
-
await mkdir(directory, { recursive: true });
|
|
31
|
-
const bridge = join(directory, 'bridge.ts');
|
|
32
|
-
const sources = new DevelopmentSources(this.#projectDir);
|
|
33
|
-
sources.record(join(this.#projectDir, 'package.json'));
|
|
34
|
-
const configImport = moduleSpecifier(dirname(bridge), this.#configPath);
|
|
35
|
-
const runtimeImport = moduleSpecifier(dirname(bridge), resolve(dirname(this.#configPath), this.#runtimePath));
|
|
36
|
-
await writeFile(bridge, `export { default as project } from ${JSON.stringify(configImport)}\n` +
|
|
37
|
-
`export { default as runtime } from ${JSON.stringify(runtimeImport)}\n`);
|
|
38
|
-
try {
|
|
39
|
-
const bunRuntime = bun();
|
|
40
|
-
const built = await bunRuntime.build({
|
|
41
|
-
entrypoints: [bridge],
|
|
42
|
-
outdir: directory,
|
|
43
|
-
naming: 'application.mjs',
|
|
44
|
-
target: 'bun',
|
|
45
|
-
format: 'esm',
|
|
46
|
-
packages: 'bundle',
|
|
47
|
-
plugins: [projectImportPlugin(this.#projectDir, bunRuntime)],
|
|
48
|
-
splitting: false,
|
|
49
|
-
sourcemap: 'inline',
|
|
50
|
-
metafile: true,
|
|
51
|
-
throw: false,
|
|
52
|
-
});
|
|
53
|
-
throwIfAborted(signal);
|
|
54
|
-
if (!built.success) {
|
|
55
|
-
const diagnostics = built.logs.map(({ message, position }) => position === undefined || position === null
|
|
56
|
-
? message
|
|
57
|
-
: `${relative(this.#projectDir, position.file)}:${position.line}:${position.column}: ${message}`);
|
|
58
|
-
throw new Error(['Authored Domain rebuild failed.', ...diagnostics].join('\n'));
|
|
59
|
-
}
|
|
60
|
-
const output = built.outputs.find((candidate) => candidate.path.endsWith('application.mjs'));
|
|
61
|
-
if (output === undefined)
|
|
62
|
-
throw new Error('Authored Domain rebuild produced no module.');
|
|
63
|
-
const loaded = (await import(`${pathToFileURL(output.path).href}?development=${this.#generation}`));
|
|
64
|
-
if (Object.keys(loaded).some((key) => key !== 'project' && key !== 'runtime')) {
|
|
65
|
-
throw new TypeError('Development bridge produced unexpected exports.');
|
|
66
|
-
}
|
|
67
|
-
const project = admitProjectModule({ default: loaded.project });
|
|
68
|
-
if ((project.entrypoints?.runtime ?? './runtime.ts') !== this.#runtimePath) {
|
|
69
|
-
throw new Error('Runtime entrypoint changed; restart pnpm dev to apply it.');
|
|
70
|
-
}
|
|
71
|
-
const environment = selectEnvironment(project, this.#environment);
|
|
72
|
-
const resolved = await resolveRuntime(runtime(this.#runtimePath), async (path) => {
|
|
73
|
-
if (path !== this.#runtimePath) {
|
|
74
|
-
throw new Error('Runtime entrypoint changed; restart pnpm dev to apply it.');
|
|
75
|
-
}
|
|
76
|
-
return Object.freeze({ default: loaded.runtime });
|
|
77
|
-
});
|
|
78
|
-
const build = compile(project.domain);
|
|
79
|
-
admitRuntime({ runtime: build.runtime }, resolved);
|
|
80
|
-
const adapter = stableTargetAdapter(environment.deployment.adapter);
|
|
81
|
-
const parameters = environment.deployment.parameters;
|
|
82
|
-
for (const path of Object.keys(built.metafile?.inputs ?? {}))
|
|
83
|
-
sources.record(path);
|
|
84
|
-
const source = await adapter.prepare(parameters, {
|
|
85
|
-
projectDir: this.#projectDir,
|
|
86
|
-
environment: this.#environment,
|
|
87
|
-
mode: 'release',
|
|
88
|
-
recordSource: sources.record,
|
|
89
|
-
signal,
|
|
90
|
-
build,
|
|
91
|
-
runtime: resolved,
|
|
92
|
-
});
|
|
93
|
-
const artifact = verifyPreflight({ build, runtime: resolved, source });
|
|
94
|
-
const declared = this.#overrideSecrets === undefined
|
|
95
|
-
? secretsFor(adapter, parameters, this.#projectDir, resolved.runtime)
|
|
96
|
-
: { values: this.#overrideSecrets };
|
|
97
|
-
if (declared.path !== undefined)
|
|
98
|
-
sources.record(declared.path);
|
|
99
|
-
return Object.freeze({
|
|
100
|
-
adapter,
|
|
101
|
-
parameters,
|
|
102
|
-
artifact,
|
|
103
|
-
secrets: declared.values,
|
|
104
|
-
sources: sources.snapshot(),
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
finally {
|
|
108
|
-
await rm(directory, { recursive: true, force: true });
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
export async function discoverRuntimePath(configPath) {
|
|
113
|
-
const loaded = (await import(`${pathToFileURL(configPath).href}?discover=${Date.now()}`));
|
|
114
|
-
const project = admitProjectModule(loaded);
|
|
115
|
-
return project.entrypoints?.runtime ?? './runtime.ts';
|
|
116
|
-
}
|
|
117
|
-
export function sameEnvironment(current, candidate) {
|
|
118
|
-
return (candidate.adapter.name === current.adapter.name &&
|
|
119
|
-
candidate.adapter.version === current.adapter.version &&
|
|
120
|
-
candidate.artifact.build.schema.compiled.root.origin ===
|
|
121
|
-
current.artifact.build.schema.compiled.root.origin &&
|
|
122
|
-
stable(candidate.parameters) === stable(current.parameters));
|
|
123
|
-
}
|
|
124
|
-
/** Identify a rebuilt candidate that cannot change provider state. */
|
|
125
|
-
export function sameDeploymentCandidate(current, candidate) {
|
|
126
|
-
return (sameEnvironment(current, candidate) &&
|
|
127
|
-
candidate.artifact.build.schema.compiled.root.revision ===
|
|
128
|
-
current.artifact.build.schema.compiled.root.revision &&
|
|
129
|
-
candidate.artifact.digest === current.artifact.digest &&
|
|
130
|
-
stable(candidate.secrets) === stable(current.secrets));
|
|
131
|
-
}
|
|
132
|
-
function secretsFor(adapter, parameters, projectDir, selectedRuntime) {
|
|
133
|
-
const file = adapter.secretsFile?.(parameters);
|
|
134
|
-
if (file === undefined)
|
|
135
|
-
return { values: Object.freeze({}) };
|
|
136
|
-
const path = isAbsolute(file) ? file : join(projectDir, file);
|
|
137
|
-
if (Object.keys(selectedRuntime.integrations).length === 0 && !existsSync(path)) {
|
|
138
|
-
return { values: Object.freeze({}) };
|
|
139
|
-
}
|
|
140
|
-
return { values: Object.freeze(loadDeclaredSecrets(path, file)), path };
|
|
141
|
-
}
|
|
142
|
-
function bun() {
|
|
143
|
-
const value = Reflect.get(globalThis, 'Bun');
|
|
144
|
-
if (value === undefined || typeof value.build !== 'function') {
|
|
145
|
-
throw new TypeError('Domain development requires the Bun runtime.');
|
|
146
|
-
}
|
|
147
|
-
return value;
|
|
148
|
-
}
|
|
149
|
-
function moduleSpecifier(from, target) {
|
|
150
|
-
const path = relative(from, target).split(sep).join('/');
|
|
151
|
-
return path.startsWith('.') ? path : `./${path}`;
|
|
152
|
-
}
|
|
153
|
-
function stable(input) {
|
|
154
|
-
if (input === undefined)
|
|
155
|
-
return 'undefined';
|
|
156
|
-
if (input === null || typeof input !== 'object')
|
|
157
|
-
return JSON.stringify(input);
|
|
158
|
-
if (Array.isArray(input))
|
|
159
|
-
return `[${input.map(stable).join(',')}]`;
|
|
160
|
-
const record = input;
|
|
161
|
-
return `{${Object.keys(record)
|
|
162
|
-
.sort()
|
|
163
|
-
.map((key) => `${JSON.stringify(key)}:${stable(record[key])}`)
|
|
164
|
-
.join(',')}}`;
|
|
165
|
-
}
|
|
166
|
-
function throwIfAborted(signal) {
|
|
167
|
-
if (signal.aborted) {
|
|
168
|
-
throw signal.reason instanceof Error ? signal.reason : new Error('Development interrupted.');
|
|
169
|
-
}
|
|
170
|
-
}
|