anhedral 0.11.2 → 0.13.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/README.md +171 -18
- package/dist/bin.js +48 -493
- package/dist/capabilities.d.ts +3 -3
- package/dist/capability-contract.js +16 -1
- package/dist/cli-arguments.d.ts +8 -0
- package/dist/cli-arguments.js +32 -0
- package/dist/cli-commands.d.ts +3 -0
- package/dist/cli-commands.js +114 -0
- package/dist/cli-delivery.d.ts +3 -0
- package/dist/cli-delivery.js +172 -0
- package/dist/cli-output.js +231 -205
- package/dist/command-schema.js +8 -2
- package/dist/command.js +9 -11
- package/dist/delivery-evidence.d.ts +62 -0
- package/dist/delivery-evidence.js +186 -0
- package/dist/delivery.d.ts +3 -40
- package/dist/delivery.js +7 -182
- package/dist/dependencies.d.ts +7 -1
- package/dist/dependencies.js +15 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mobile-delivery.d.ts +21 -44
- package/dist/mobile-delivery.js +127 -80
- package/dist/platforms/mobile.d.ts +1 -1
- package/dist/platforms/mobile.js +44 -3
- package/dist/project-state.js +4 -1
- package/dist/provider-auth.js +9 -3
- package/dist/providers/adapters.js +9 -3
- package/dist/providers/runtime.js +11 -0
- package/dist/readiness.js +4 -2
- package/dist/registry/add.js +40 -7
- package/dist/registry/options.js +12 -0
- package/dist/registry/presets.d.ts +4 -0
- package/dist/registry/presets.js +41 -0
- package/dist/registry/resolve.d.ts +3 -1
- package/dist/registry/resolve.js +40 -14
- package/dist/registry/types.d.ts +1 -0
- package/dist/registry/usage.js +1 -1
- package/dist/runtime-policy.js +4 -1
- package/dist/scaffold/api.js +10 -2
- package/dist/scaffold/auth.d.ts +1 -1
- package/dist/scaffold/auth.js +22 -6
- package/dist/scaffold/backend.d.ts +6 -0
- package/dist/scaffold/backend.js +224 -0
- package/dist/scaffold/billing-config.d.ts +1 -0
- package/dist/scaffold/billing-config.js +73 -0
- package/dist/scaffold/billing-contracts.d.ts +2 -0
- package/dist/scaffold/billing-contracts.js +48 -0
- package/dist/scaffold/billing-providers.d.ts +1 -0
- package/dist/scaffold/billing-providers.js +249 -0
- package/dist/scaffold/billing-schema.d.ts +1 -0
- package/dist/scaffold/billing-schema.js +34 -0
- package/dist/scaffold/billing-security.d.ts +1 -0
- package/dist/scaffold/billing-security.js +46 -0
- package/dist/scaffold/billing-server.d.ts +1 -0
- package/dist/scaffold/billing-server.js +139 -0
- package/dist/scaffold/billing-store.d.ts +1 -0
- package/dist/scaffold/billing-store.js +72 -0
- package/dist/scaffold/billing.d.ts +2 -0
- package/dist/scaffold/billing.js +216 -0
- package/dist/scaffold/cloudflare-services.d.ts +8 -0
- package/dist/scaffold/cloudflare-services.js +198 -0
- package/dist/scaffold/compose.js +2 -0
- package/dist/scaffold/database.js +19 -2
- package/dist/scaffold/documentation.js +11 -6
- package/dist/scaffold/expo-auth.d.ts +3 -0
- package/dist/scaffold/expo-auth.js +192 -0
- package/dist/scaffold/expo-billing.d.ts +3 -0
- package/dist/scaffold/expo-billing.js +292 -0
- package/dist/scaffold/expo-runtime.d.ts +3 -0
- package/dist/scaffold/expo-runtime.js +134 -0
- package/dist/scaffold/integrations.d.ts +2 -1
- package/dist/scaffold/integrations.js +7 -2
- package/dist/scaffold/stream.d.ts +2 -0
- package/dist/scaffold/stream.js +114 -0
- package/dist/scaffold/void.js +13 -5
- package/dist/scaffold/web.js +2 -0
- package/dist/scaffold/workspace.js +6 -1
- package/dist/service-readers.js +1 -1
- package/dist/services-command.js +8 -6
- package/dist/ship.d.ts +15 -15
- package/dist/ship.js +3 -1
- package/dist/stack-registry.d.ts +13 -2
- package/dist/stack-registry.js +152 -16
- package/dist/transaction-lock.d.ts +15 -0
- package/dist/transaction-lock.js +227 -0
- package/dist/transaction.js +2 -208
- package/dist/vercel-project.d.ts +101 -0
- package/dist/vercel-project.js +305 -0
- package/dist/vercel.d.ts +3 -36
- package/dist/vercel.js +3 -300
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +122 -0
- package/docs/software-factory.md +402 -7
- package/docs/stack-standard.md +226 -49
- package/docs/verification.md +557 -0
- package/package.json +7 -7
- package/docs/cli-design.md +0 -67
- package/docs/plugin-ui.md +0 -102
- package/docs/provider-configuration.md +0 -116
- package/docs/void-verification.md +0 -185
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { projectConfigPath } from './project-config.js';
|
|
5
|
+
import { cloudflareRequest } from './cloudflare.js';
|
|
6
|
+
import { configurationFile, usesVoid, defaultRunner, environment, readApplication, readConfig, targetDirectory, } from './project-state.js';
|
|
7
|
+
const stateDirectory = '.anhedral';
|
|
8
|
+
export function history(root, project) {
|
|
9
|
+
const file = path.join(root, stateDirectory, 'releases.json');
|
|
10
|
+
if (!existsSync(file))
|
|
11
|
+
return { schemaVersion: 1, projectId: project.id, releases: [] };
|
|
12
|
+
const value = JSON.parse(readFileSync(file, 'utf8'));
|
|
13
|
+
if (value.schemaVersion !== 1 || value.projectId !== project.id || !Array.isArray(value.releases))
|
|
14
|
+
throw new Error('Release history belongs to a different or unsupported project.');
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
export function checkTargets(root, project, allowResourcePlaceholders = false) {
|
|
18
|
+
if (!project.targets.length)
|
|
19
|
+
throw new Error('No Cloudflare targets; native applications require their platform delivery tools.');
|
|
20
|
+
for (const target of project.targets) {
|
|
21
|
+
const directory = targetDirectory(root, target);
|
|
22
|
+
const config = readConfig(directory);
|
|
23
|
+
if (config.name !== target.workerName ||
|
|
24
|
+
(config.env && Object.keys(config.env).length))
|
|
25
|
+
throw new Error('Worker name or environment changed; reconcile the application manifest before shipping.');
|
|
26
|
+
if (config.account_id && config.account_id !== project.accountId)
|
|
27
|
+
throw new Error('Wrangler configuration account conflicts with the registered account.');
|
|
28
|
+
const pending = structuredClone(config);
|
|
29
|
+
if (allowResourcePlaceholders) {
|
|
30
|
+
for (const [field, id] of [
|
|
31
|
+
['d1_databases', 'database_id'],
|
|
32
|
+
['kv_namespaces', 'id'],
|
|
33
|
+
['pipelines', 'stream'],
|
|
34
|
+
]) {
|
|
35
|
+
const entries = pending[field];
|
|
36
|
+
if (Array.isArray(entries))
|
|
37
|
+
for (const entry of entries) {
|
|
38
|
+
if (entry && typeof entry[id] === 'string' && entry[id].startsWith('REPLACE_WITH_'))
|
|
39
|
+
entry[id] = 'pending-resource';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (/REPLACE_WITH_|YOUR_[A-Z_]+/.test(allowResourcePlaceholders || usesVoid(project)
|
|
44
|
+
? JSON.stringify(pending)
|
|
45
|
+
: readFileSync(configurationFile(directory), 'utf8')))
|
|
46
|
+
throw new Error('Configure selected resources before shipping; placeholder bindings remain.');
|
|
47
|
+
const pkg = JSON.parse(readFileSync(path.join(directory, 'package.json'), 'utf8'));
|
|
48
|
+
if (typeof pkg.scripts?.deploy !== 'string')
|
|
49
|
+
throw new Error('Deployment target has no deploy script.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function configurationFingerprint(root, project) {
|
|
53
|
+
const hash = createHash('sha256').update(readFileSync(projectConfigPath(root)));
|
|
54
|
+
for (const target of project.targets) {
|
|
55
|
+
const directory = targetDirectory(root, target);
|
|
56
|
+
hash.update(readFileSync(configurationFile(directory)));
|
|
57
|
+
if (usesVoid(project))
|
|
58
|
+
for (const name of ['void.config.ts', 'env.ts']) {
|
|
59
|
+
const file = path.join(directory, name);
|
|
60
|
+
hash.update(name).update(existsSync(file) ? readFileSync(file) : '<absent>');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return hash.digest('hex');
|
|
64
|
+
}
|
|
65
|
+
export function planDelivery(root, allowResourcePlaceholders = false) {
|
|
66
|
+
const project = readApplication(root);
|
|
67
|
+
checkTargets(root, project, allowResourcePlaceholders);
|
|
68
|
+
if (usesVoid(project)) {
|
|
69
|
+
const owners = project.targets.filter((target) => {
|
|
70
|
+
// Ownership is authored. Void may add a conventional migrations_dir to
|
|
71
|
+
// resolved consumer locks; those consumers must not become migration owners.
|
|
72
|
+
const config = JSON.parse(readFileSync(configurationFile(targetDirectory(root, target)), 'utf8'));
|
|
73
|
+
return (Array.isArray(config.d1_databases) &&
|
|
74
|
+
config.d1_databases.some((database) => database?.migrations_dir));
|
|
75
|
+
});
|
|
76
|
+
if (owners.length > 1)
|
|
77
|
+
throw new Error('Void delivery requires one D1 migration owner; other server targets must consume the shared database without deployment migrations.');
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
project,
|
|
81
|
+
checks: [['pnpm', 'run', 'check']],
|
|
82
|
+
deployments: project.targets.map((target) => ({
|
|
83
|
+
target: target.id,
|
|
84
|
+
directory: target.directory,
|
|
85
|
+
command: usesVoid(project)
|
|
86
|
+
? ['pnpm', 'exec', 'void', 'deploy', '--platform', 'cloudflare']
|
|
87
|
+
: ['pnpm', 'run', 'deploy'],
|
|
88
|
+
})),
|
|
89
|
+
resourcesProvisioned: false,
|
|
90
|
+
audience: project.audience,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export function parseDeploymentOutput(source, target) {
|
|
94
|
+
const entries = source
|
|
95
|
+
.split('\n')
|
|
96
|
+
.filter((line) => line.trim())
|
|
97
|
+
.map((line) => JSON.parse(line));
|
|
98
|
+
const deploy = entries.findLast((entry) => entry.type === 'deploy' && entry.version === 1 && entry.worker_name === target.workerName);
|
|
99
|
+
if (!deploy || typeof deploy.version_id !== 'string' || !deploy.version_id)
|
|
100
|
+
throw new Error('No matching structured Wrangler deployment receipt. Deployment may have occurred; inspect provider status before retrying.');
|
|
101
|
+
const urls = Array.isArray(deploy.targets)
|
|
102
|
+
? deploy.targets.filter((url) => {
|
|
103
|
+
if (typeof url !== 'string')
|
|
104
|
+
return false;
|
|
105
|
+
try {
|
|
106
|
+
const value = new URL(url);
|
|
107
|
+
return value.protocol === 'https:' && !value.username && !value.password;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
: [];
|
|
114
|
+
return { target: target.id, versionId: deploy.version_id, urls, providerConfirmed: false };
|
|
115
|
+
}
|
|
116
|
+
export function activeVersions(value) {
|
|
117
|
+
if (!value || typeof value !== 'object')
|
|
118
|
+
return [];
|
|
119
|
+
const record = value;
|
|
120
|
+
// Read only the active deployment's versions, never arbitrary historical IDs.
|
|
121
|
+
if (!Array.isArray(record.versions))
|
|
122
|
+
throw new Error('Unsupported provider deployment status; active versions are missing.');
|
|
123
|
+
const versions = record.versions
|
|
124
|
+
.map((entry) => {
|
|
125
|
+
if (!entry || typeof entry !== 'object')
|
|
126
|
+
throw new Error('Invalid provider version.');
|
|
127
|
+
const item = entry;
|
|
128
|
+
if (typeof item.version_id !== 'string' ||
|
|
129
|
+
!item.version_id ||
|
|
130
|
+
typeof item.percentage !== 'number' ||
|
|
131
|
+
!Number.isFinite(item.percentage) ||
|
|
132
|
+
item.percentage < 0 ||
|
|
133
|
+
item.percentage > 100)
|
|
134
|
+
throw new Error('Invalid provider traffic allocation.');
|
|
135
|
+
return { versionId: item.version_id, percentage: item.percentage };
|
|
136
|
+
})
|
|
137
|
+
.filter((entry) => entry.percentage > 0);
|
|
138
|
+
if (new Set(versions.map((entry) => entry.versionId)).size !== versions.length ||
|
|
139
|
+
Math.abs(versions.reduce((sum, entry) => sum + entry.percentage, 0) - 100) > 0.001)
|
|
140
|
+
throw new Error('Invalid provider traffic allocation.');
|
|
141
|
+
return versions;
|
|
142
|
+
}
|
|
143
|
+
export async function providerStatus(root, project, target, run, request) {
|
|
144
|
+
if (!usesVoid(project))
|
|
145
|
+
return JSON.parse(await run('pnpm', ['exec', 'wrangler', 'deployments', 'status', '--json'], targetDirectory(root, target), environment(project)));
|
|
146
|
+
const api = request ??
|
|
147
|
+
(await cloudflareRequest(project, targetDirectory(root, target), run, environment(project)));
|
|
148
|
+
const result = (await api('GET', `/workers/scripts/${encodeURIComponent(target.workerName)}/deployments`)).result;
|
|
149
|
+
if (!Array.isArray(result?.deployments) || !result.deployments.length)
|
|
150
|
+
throw new Error('No active Cloudflare deployment evidence.');
|
|
151
|
+
return result.deployments[0];
|
|
152
|
+
}
|
|
153
|
+
export function fullyActive(versions, versionId) {
|
|
154
|
+
return (versions.length === 1 && versions[0].versionId === versionId && versions[0].percentage === 100);
|
|
155
|
+
}
|
|
156
|
+
export function describeArchitecture(root, project) {
|
|
157
|
+
return project.targets.map((target) => {
|
|
158
|
+
const config = readConfig(targetDirectory(root, target));
|
|
159
|
+
const bindings = [];
|
|
160
|
+
for (const kind of [
|
|
161
|
+
'd1_databases',
|
|
162
|
+
'r2_buckets',
|
|
163
|
+
'kv_namespaces',
|
|
164
|
+
'hyperdrive',
|
|
165
|
+
'services',
|
|
166
|
+
'workflows',
|
|
167
|
+
]) {
|
|
168
|
+
const entries = config[kind];
|
|
169
|
+
if (Array.isArray(entries))
|
|
170
|
+
for (const entry of entries)
|
|
171
|
+
if (typeof entry?.binding === 'string')
|
|
172
|
+
bindings.push({ kind, binding: entry.binding });
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
target: target.id,
|
|
176
|
+
workerName: target.workerName,
|
|
177
|
+
directory: target.directory,
|
|
178
|
+
bindings,
|
|
179
|
+
scheduled: typeof config.triggers === 'object' &&
|
|
180
|
+
config.triggers !== null &&
|
|
181
|
+
Array.isArray(config.triggers.crons)
|
|
182
|
+
? config.triggers.crons.filter((cron) => typeof cron === 'string')
|
|
183
|
+
: [],
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
}
|
package/dist/delivery.d.ts
CHANGED
|
@@ -1,48 +1,11 @@
|
|
|
1
|
+
import { type Release, type ActiveVersion } from './delivery-evidence.js';
|
|
2
|
+
export { planDelivery, parseDeploymentOutput } from './delivery-evidence.js';
|
|
3
|
+
export type { Release } from './delivery-evidence.js';
|
|
1
4
|
import { type CloudflareRequest } from './cloudflare.js';
|
|
2
5
|
import { type ApplicationProject } from './project-state.js';
|
|
3
6
|
export { registerApplication, readApplication, defaultRunner, environment, targetDirectory, } from './project-state.js';
|
|
4
7
|
export type { ApplicationProject, DeploymentTarget, DeliveryRunner } from './project-state.js';
|
|
5
|
-
import type { DeploymentTarget } from './project-state.js';
|
|
6
|
-
interface TargetRelease {
|
|
7
|
-
target: string;
|
|
8
|
-
versionId: string;
|
|
9
|
-
urls: string[];
|
|
10
|
-
providerConfirmed: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface Release {
|
|
13
|
-
id: string;
|
|
14
|
-
commit: string;
|
|
15
|
-
startedAt: string;
|
|
16
|
-
finishedAt?: string;
|
|
17
|
-
state: 'running' | 'checked' | 'deployed' | 'configuration-required' | 'failed';
|
|
18
|
-
targets: TargetRelease[];
|
|
19
|
-
failure?: string;
|
|
20
|
-
configurationChanges?: string[];
|
|
21
|
-
operation?: 'ship' | 'rollback';
|
|
22
|
-
restoredReleaseId?: string;
|
|
23
|
-
verification?: {
|
|
24
|
-
state: 'passed' | 'failed';
|
|
25
|
-
checkedAt: string;
|
|
26
|
-
command: 'pnpm run test:live';
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
8
|
export declare function connectApplication(root: string, accountId: string | undefined, audience: 'public' | 'private' | undefined, run?: import("./project-state.js").DeliveryRunner, emails?: string[]): Promise<ApplicationProject>;
|
|
30
|
-
export declare function planDelivery(root: string, allowResourcePlaceholders?: boolean): {
|
|
31
|
-
project: ApplicationProject;
|
|
32
|
-
checks: string[][];
|
|
33
|
-
deployments: {
|
|
34
|
-
target: string;
|
|
35
|
-
directory: string;
|
|
36
|
-
command: string[];
|
|
37
|
-
}[];
|
|
38
|
-
resourcesProvisioned: boolean;
|
|
39
|
-
audience: "unconfigured" | "public" | "private";
|
|
40
|
-
};
|
|
41
|
-
export declare function parseDeploymentOutput(source: string, target: DeploymentTarget): TargetRelease;
|
|
42
|
-
interface ActiveVersion {
|
|
43
|
-
versionId: string;
|
|
44
|
-
percentage: number;
|
|
45
|
-
}
|
|
46
9
|
export declare function shipApplication(root: string, run?: import("./project-state.js").DeliveryRunner, suppliedRequest?: CloudflareRequest, options?: {
|
|
47
10
|
voidLogsDirectory?: string;
|
|
48
11
|
}): Promise<{
|
package/dist/delivery.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { history, checkTargets, configurationFingerprint, planDelivery, parseDeploymentOutput, activeVersions, providerStatus, fullyActive, describeArchitecture, } from './delivery-evidence.js';
|
|
2
|
+
export { planDelivery, parseDeploymentOutput } from './delivery-evidence.js';
|
|
1
3
|
import { projectConfigPath, writeProjectSection } from './project-config.js';
|
|
2
4
|
import { deployVoidTarget, rollbackVoidTarget } from './void-execution.js';
|
|
3
5
|
import { voidLogSnapshot, readVoidDeploymentReceipt } from './void-state.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
+
import { randomUUID } from 'node:crypto';
|
|
7
|
+
import { mkdirSync, readFileSync, realpathSync, rmSync } from 'node:fs';
|
|
6
8
|
import { tmpdir } from 'node:os';
|
|
7
9
|
import path from 'node:path';
|
|
8
10
|
import { writeManagementOverview } from './management.js';
|
|
@@ -63,185 +65,6 @@ export async function connectApplication(root, accountId, audience, run = defaul
|
|
|
63
65
|
return connected;
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
|
-
function history(root, project) {
|
|
67
|
-
const file = path.join(root, stateDirectory, 'releases.json');
|
|
68
|
-
if (!existsSync(file))
|
|
69
|
-
return { schemaVersion: 1, projectId: project.id, releases: [] };
|
|
70
|
-
const value = JSON.parse(readFileSync(file, 'utf8'));
|
|
71
|
-
if (value.schemaVersion !== 1 || value.projectId !== project.id || !Array.isArray(value.releases))
|
|
72
|
-
throw new Error('Release history belongs to a different or unsupported project.');
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
function checkTargets(root, project, allowResourcePlaceholders = false) {
|
|
76
|
-
if (!project.targets.length)
|
|
77
|
-
throw new Error('No Cloudflare targets; native applications require their platform delivery tools.');
|
|
78
|
-
for (const target of project.targets) {
|
|
79
|
-
const directory = targetDirectory(root, target);
|
|
80
|
-
const config = readConfig(directory);
|
|
81
|
-
if (config.name !== target.workerName ||
|
|
82
|
-
(config.env && Object.keys(config.env).length))
|
|
83
|
-
throw new Error('Worker name or environment changed; reconcile the application manifest before shipping.');
|
|
84
|
-
if (config.account_id && config.account_id !== project.accountId)
|
|
85
|
-
throw new Error('Wrangler configuration account conflicts with the registered account.');
|
|
86
|
-
const pending = structuredClone(config);
|
|
87
|
-
if (allowResourcePlaceholders) {
|
|
88
|
-
for (const [field, id] of [
|
|
89
|
-
['d1_databases', 'database_id'],
|
|
90
|
-
['kv_namespaces', 'id'],
|
|
91
|
-
['pipelines', 'stream'],
|
|
92
|
-
]) {
|
|
93
|
-
const entries = pending[field];
|
|
94
|
-
if (Array.isArray(entries))
|
|
95
|
-
for (const entry of entries) {
|
|
96
|
-
if (entry && typeof entry[id] === 'string' && entry[id].startsWith('REPLACE_WITH_'))
|
|
97
|
-
entry[id] = 'pending-resource';
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (/REPLACE_WITH_|YOUR_[A-Z_]+/.test(allowResourcePlaceholders || usesVoid(project)
|
|
102
|
-
? JSON.stringify(pending)
|
|
103
|
-
: readFileSync(configurationFile(directory), 'utf8')))
|
|
104
|
-
throw new Error('Configure selected resources before shipping; placeholder bindings remain.');
|
|
105
|
-
const pkg = JSON.parse(readFileSync(path.join(directory, 'package.json'), 'utf8'));
|
|
106
|
-
if (typeof pkg.scripts?.deploy !== 'string')
|
|
107
|
-
throw new Error('Deployment target has no deploy script.');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function configurationFingerprint(root, project) {
|
|
111
|
-
const hash = createHash('sha256').update(readFileSync(projectConfigPath(root)));
|
|
112
|
-
for (const target of project.targets) {
|
|
113
|
-
const directory = targetDirectory(root, target);
|
|
114
|
-
hash.update(readFileSync(configurationFile(directory)));
|
|
115
|
-
if (usesVoid(project))
|
|
116
|
-
for (const name of ['void.config.ts', 'env.ts']) {
|
|
117
|
-
const file = path.join(directory, name);
|
|
118
|
-
hash.update(name).update(existsSync(file) ? readFileSync(file) : '<absent>');
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return hash.digest('hex');
|
|
122
|
-
}
|
|
123
|
-
export function planDelivery(root, allowResourcePlaceholders = false) {
|
|
124
|
-
const project = readApplication(root);
|
|
125
|
-
checkTargets(root, project, allowResourcePlaceholders);
|
|
126
|
-
if (usesVoid(project)) {
|
|
127
|
-
const owners = project.targets.filter((target) => {
|
|
128
|
-
// Ownership is authored. Void may add a conventional migrations_dir to
|
|
129
|
-
// resolved consumer locks; those consumers must not become migration owners.
|
|
130
|
-
const config = JSON.parse(readFileSync(configurationFile(targetDirectory(root, target)), 'utf8'));
|
|
131
|
-
return (Array.isArray(config.d1_databases) &&
|
|
132
|
-
config.d1_databases.some((database) => database?.migrations_dir));
|
|
133
|
-
});
|
|
134
|
-
if (owners.length > 1)
|
|
135
|
-
throw new Error('Void delivery requires one D1 migration owner; other server targets must consume the shared database without deployment migrations.');
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
project,
|
|
139
|
-
checks: [['pnpm', 'run', 'check']],
|
|
140
|
-
deployments: project.targets.map((target) => ({
|
|
141
|
-
target: target.id,
|
|
142
|
-
directory: target.directory,
|
|
143
|
-
command: usesVoid(project)
|
|
144
|
-
? ['pnpm', 'exec', 'void', 'deploy', '--platform', 'cloudflare']
|
|
145
|
-
: ['pnpm', 'run', 'deploy'],
|
|
146
|
-
})),
|
|
147
|
-
resourcesProvisioned: false,
|
|
148
|
-
audience: project.audience,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
export function parseDeploymentOutput(source, target) {
|
|
152
|
-
const entries = source
|
|
153
|
-
.split('\n')
|
|
154
|
-
.filter((line) => line.trim())
|
|
155
|
-
.map((line) => JSON.parse(line));
|
|
156
|
-
const deploy = entries.findLast((entry) => entry.type === 'deploy' && entry.version === 1 && entry.worker_name === target.workerName);
|
|
157
|
-
if (!deploy || typeof deploy.version_id !== 'string' || !deploy.version_id)
|
|
158
|
-
throw new Error('No matching structured Wrangler deployment receipt. Deployment may have occurred; inspect provider status before retrying.');
|
|
159
|
-
const urls = Array.isArray(deploy.targets)
|
|
160
|
-
? deploy.targets.filter((url) => {
|
|
161
|
-
if (typeof url !== 'string')
|
|
162
|
-
return false;
|
|
163
|
-
try {
|
|
164
|
-
const value = new URL(url);
|
|
165
|
-
return value.protocol === 'https:' && !value.username && !value.password;
|
|
166
|
-
}
|
|
167
|
-
catch {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
: [];
|
|
172
|
-
return { target: target.id, versionId: deploy.version_id, urls, providerConfirmed: false };
|
|
173
|
-
}
|
|
174
|
-
function activeVersions(value) {
|
|
175
|
-
if (!value || typeof value !== 'object')
|
|
176
|
-
return [];
|
|
177
|
-
const record = value;
|
|
178
|
-
// Read only the active deployment's versions, never arbitrary historical IDs.
|
|
179
|
-
if (!Array.isArray(record.versions))
|
|
180
|
-
throw new Error('Unsupported provider deployment status; active versions are missing.');
|
|
181
|
-
const versions = record.versions
|
|
182
|
-
.map((entry) => {
|
|
183
|
-
if (!entry || typeof entry !== 'object')
|
|
184
|
-
throw new Error('Invalid provider version.');
|
|
185
|
-
const item = entry;
|
|
186
|
-
if (typeof item.version_id !== 'string' ||
|
|
187
|
-
!item.version_id ||
|
|
188
|
-
typeof item.percentage !== 'number' ||
|
|
189
|
-
!Number.isFinite(item.percentage) ||
|
|
190
|
-
item.percentage < 0 ||
|
|
191
|
-
item.percentage > 100)
|
|
192
|
-
throw new Error('Invalid provider traffic allocation.');
|
|
193
|
-
return { versionId: item.version_id, percentage: item.percentage };
|
|
194
|
-
})
|
|
195
|
-
.filter((entry) => entry.percentage > 0);
|
|
196
|
-
if (new Set(versions.map((entry) => entry.versionId)).size !== versions.length ||
|
|
197
|
-
Math.abs(versions.reduce((sum, entry) => sum + entry.percentage, 0) - 100) > 0.001)
|
|
198
|
-
throw new Error('Invalid provider traffic allocation.');
|
|
199
|
-
return versions;
|
|
200
|
-
}
|
|
201
|
-
async function providerStatus(root, project, target, run, request) {
|
|
202
|
-
if (!usesVoid(project))
|
|
203
|
-
return JSON.parse(await run('pnpm', ['exec', 'wrangler', 'deployments', 'status', '--json'], targetDirectory(root, target), environment(project)));
|
|
204
|
-
const api = request ??
|
|
205
|
-
(await cloudflareRequest(project, targetDirectory(root, target), run, environment(project)));
|
|
206
|
-
const result = (await api('GET', `/workers/scripts/${encodeURIComponent(target.workerName)}/deployments`)).result;
|
|
207
|
-
if (!Array.isArray(result?.deployments) || !result.deployments.length)
|
|
208
|
-
throw new Error('No active Cloudflare deployment evidence.');
|
|
209
|
-
return result.deployments[0];
|
|
210
|
-
}
|
|
211
|
-
function fullyActive(versions, versionId) {
|
|
212
|
-
return (versions.length === 1 && versions[0].versionId === versionId && versions[0].percentage === 100);
|
|
213
|
-
}
|
|
214
|
-
function describeArchitecture(root, project) {
|
|
215
|
-
return project.targets.map((target) => {
|
|
216
|
-
const config = readConfig(targetDirectory(root, target));
|
|
217
|
-
const bindings = [];
|
|
218
|
-
for (const kind of [
|
|
219
|
-
'd1_databases',
|
|
220
|
-
'r2_buckets',
|
|
221
|
-
'kv_namespaces',
|
|
222
|
-
'hyperdrive',
|
|
223
|
-
'services',
|
|
224
|
-
'workflows',
|
|
225
|
-
]) {
|
|
226
|
-
const entries = config[kind];
|
|
227
|
-
if (Array.isArray(entries))
|
|
228
|
-
for (const entry of entries)
|
|
229
|
-
if (typeof entry?.binding === 'string')
|
|
230
|
-
bindings.push({ kind, binding: entry.binding });
|
|
231
|
-
}
|
|
232
|
-
return {
|
|
233
|
-
target: target.id,
|
|
234
|
-
workerName: target.workerName,
|
|
235
|
-
directory: target.directory,
|
|
236
|
-
bindings,
|
|
237
|
-
scheduled: typeof config.triggers === 'object' &&
|
|
238
|
-
config.triggers !== null &&
|
|
239
|
-
Array.isArray(config.triggers.crons)
|
|
240
|
-
? config.triggers.crons.filter((cron) => typeof cron === 'string')
|
|
241
|
-
: [],
|
|
242
|
-
};
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
68
|
export async function shipApplication(root, run = defaultRunner, suppliedRequest, options = {}) {
|
|
246
69
|
root = realpathSync(root);
|
|
247
70
|
const registered = readApplication(root);
|
|
@@ -464,7 +287,9 @@ export async function verifyApplication(root, run = defaultRunner) {
|
|
|
464
287
|
throw new Error('Live verification requires a fully active recorded release.');
|
|
465
288
|
const project = snapshot.project;
|
|
466
289
|
const env = environment(project);
|
|
467
|
-
const primary = release.targets.find((target) => target.target === 'web') ??
|
|
290
|
+
const primary = release.targets.find((target) => target.target === 'web') ??
|
|
291
|
+
release.targets.find((target) => target.target === 'mobile') ??
|
|
292
|
+
release.targets.at(-1);
|
|
468
293
|
if (!primary?.urls.length)
|
|
469
294
|
throw new Error('No recorded application URL for live verification.');
|
|
470
295
|
const pkg = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8'));
|
package/dist/dependencies.d.ts
CHANGED
|
@@ -10,16 +10,21 @@ export declare const MOBILE_NATIVEWIND_DEPENDENCIES: DependencyGroup;
|
|
|
10
10
|
export declare const WORKSPACE_NODE_ENGINE = "^22.13.0 || >=24.0.0";
|
|
11
11
|
export declare const PACKAGE_MANAGER = "pnpm@10.34.5";
|
|
12
12
|
export declare const EAS_CLI_VERSION = "21.0.1";
|
|
13
|
+
export declare const VERCEL_CLI_VERSION = "62.7.0";
|
|
13
14
|
export declare const SHADCN_VERSION = "4.21.4";
|
|
14
15
|
export declare const NEXT_VERCEL_VERSION = "16.4.0";
|
|
15
16
|
export declare const NEXT_OPENNEXT_VERSION = "16.3.8";
|
|
16
17
|
export declare const STACK_DEPENDENCIES: {
|
|
18
|
+
readonly zod: "4.6.6";
|
|
17
19
|
readonly '@typescript-eslint/parser': "8.71.2";
|
|
18
20
|
readonly '@typescript-eslint/eslint-plugin': "8.71.2";
|
|
19
21
|
readonly '@next/eslint-plugin-next': "16.4.2";
|
|
20
22
|
readonly turbo: "2.11.7";
|
|
21
23
|
readonly tsx: "4.23.15";
|
|
22
24
|
readonly 'better-auth': "1.7.7";
|
|
25
|
+
readonly '@better-auth/expo': "1.7.7";
|
|
26
|
+
readonly 'expo-secure-store': "57.0.4";
|
|
27
|
+
readonly 'expo-network': "57.0.2";
|
|
23
28
|
readonly '@better-auth/drizzle-adapter': "1.7.7";
|
|
24
29
|
readonly '@neondatabase/serverless': "1.2.0";
|
|
25
30
|
readonly '@neon/realtime': "0.1.0";
|
|
@@ -41,7 +46,8 @@ export declare const STACK_DEPENDENCIES: {
|
|
|
41
46
|
readonly ai: "6.0.303";
|
|
42
47
|
readonly '@ai-sdk/openai': "3.0.125";
|
|
43
48
|
readonly resend: "6.32.1";
|
|
44
|
-
readonly
|
|
49
|
+
readonly 'react-native-purchases': "10.14.0";
|
|
50
|
+
readonly stripe: "23.0.0";
|
|
45
51
|
readonly 'posthog-node': "5.55.2";
|
|
46
52
|
};
|
|
47
53
|
/** Vinext's RSC/React versions form a separately verified compatibility group. */
|
package/dist/dependencies.js
CHANGED
|
@@ -77,6 +77,8 @@ export const MOBILE_APP_DEPENDENCIES = {
|
|
|
77
77
|
clsx: '2.1.1',
|
|
78
78
|
// renovate: datasource=npm depName=expo
|
|
79
79
|
expo: '57.0.8',
|
|
80
|
+
// renovate: datasource=npm depName=expo-dev-client
|
|
81
|
+
'expo-dev-client': '57.0.20',
|
|
80
82
|
// renovate: datasource=npm depName=expo-linking
|
|
81
83
|
'expo-linking': '57.0.4',
|
|
82
84
|
// renovate: datasource=npm depName=expo-router
|
|
@@ -135,6 +137,8 @@ export const WORKSPACE_NODE_ENGINE = '^22.13.0 || >=24.0.0';
|
|
|
135
137
|
export const PACKAGE_MANAGER = 'pnpm@10.34.5';
|
|
136
138
|
// renovate: datasource=npm depName=eas-cli
|
|
137
139
|
export const EAS_CLI_VERSION = '21.0.1';
|
|
140
|
+
// renovate: datasource=npm depName=vercel
|
|
141
|
+
export const VERCEL_CLI_VERSION = '62.7.0';
|
|
138
142
|
// renovate: datasource=npm depName=shadcn
|
|
139
143
|
export const SHADCN_VERSION = '4.21.4';
|
|
140
144
|
// renovate: datasource=npm depName=next
|
|
@@ -142,6 +146,8 @@ export const NEXT_VERCEL_VERSION = '16.4.0';
|
|
|
142
146
|
// renovate: datasource=npm depName=next
|
|
143
147
|
export const NEXT_OPENNEXT_VERSION = '16.3.8';
|
|
144
148
|
export const STACK_DEPENDENCIES = {
|
|
149
|
+
// renovate: datasource=npm depName=zod
|
|
150
|
+
zod: '4.6.6',
|
|
145
151
|
// renovate: datasource=npm depName=@typescript-eslint/parser
|
|
146
152
|
'@typescript-eslint/parser': '8.71.2',
|
|
147
153
|
// renovate: datasource=npm depName=@typescript-eslint/eslint-plugin
|
|
@@ -154,6 +160,12 @@ export const STACK_DEPENDENCIES = {
|
|
|
154
160
|
tsx: '4.23.15',
|
|
155
161
|
// renovate: datasource=npm depName=better-auth
|
|
156
162
|
'better-auth': '1.7.7',
|
|
163
|
+
// renovate: datasource=npm depName=@better-auth/expo
|
|
164
|
+
'@better-auth/expo': '1.7.7',
|
|
165
|
+
// renovate: datasource=npm depName=expo-secure-store
|
|
166
|
+
'expo-secure-store': '57.0.4',
|
|
167
|
+
// renovate: datasource=npm depName=expo-network
|
|
168
|
+
'expo-network': '57.0.2',
|
|
157
169
|
// renovate: datasource=npm depName=@better-auth/drizzle-adapter
|
|
158
170
|
'@better-auth/drizzle-adapter': '1.7.7',
|
|
159
171
|
// renovate: datasource=npm depName=@neondatabase/serverless
|
|
@@ -196,8 +208,10 @@ export const STACK_DEPENDENCIES = {
|
|
|
196
208
|
'@ai-sdk/openai': '3.0.125',
|
|
197
209
|
// renovate: datasource=npm depName=resend
|
|
198
210
|
resend: '6.32.1',
|
|
211
|
+
// renovate: datasource=npm depName=react-native-purchases
|
|
212
|
+
'react-native-purchases': '10.14.0',
|
|
199
213
|
// renovate: datasource=npm depName=stripe
|
|
200
|
-
stripe: '
|
|
214
|
+
stripe: '23.0.0',
|
|
201
215
|
// renovate: datasource=npm depName=posthog-node
|
|
202
216
|
'posthog-node': '5.55.2',
|
|
203
217
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -44,3 +44,4 @@ export { inspectApplication } from './project-inspector.js';
|
|
|
44
44
|
export type { ProjectInspection } from './inspector-model.js';
|
|
45
45
|
export { PROJECT_CONFIG_FILE, readProjectConfig, readProjectSection, writeProjectSection, hasProjectSection, } from './project-config.js';
|
|
46
46
|
export type { ProjectConfig, ProjectSection } from './project-config.js';
|
|
47
|
+
export { FULL_PRODUCT } from './registry/presets.js';
|
package/dist/index.js
CHANGED
|
@@ -28,3 +28,4 @@ export { CAPABILITY_CONTRACT, formatCapabilityContract } from './capability-cont
|
|
|
28
28
|
export { recoverDeliveryLock } from './project-state.js';
|
|
29
29
|
export { inspectApplication } from './project-inspector.js';
|
|
30
30
|
export { PROJECT_CONFIG_FILE, readProjectConfig, readProjectSection, writeProjectSection, hasProjectSection, } from './project-config.js';
|
|
31
|
+
export { FULL_PRODUCT } from './registry/presets.js';
|
|
@@ -6,20 +6,35 @@ export interface MobileBuildOptions {
|
|
|
6
6
|
}
|
|
7
7
|
/** EAS builds produce artifacts; store submission is a separate user action. */
|
|
8
8
|
export declare function buildMobileApplication(root: string, options: MobileBuildOptions, run?: DeliveryRunner): Promise<{
|
|
9
|
+
state: string;
|
|
10
|
+
deployed: boolean;
|
|
11
|
+
storeSubmission: boolean;
|
|
12
|
+
nextAction: string;
|
|
13
|
+
} | {
|
|
14
|
+
schemaVersion: number;
|
|
15
|
+
projectId: string;
|
|
16
|
+
owner: string;
|
|
17
|
+
slug: string;
|
|
18
|
+
recordedAt: string;
|
|
19
|
+
buildPageUrl: string;
|
|
9
20
|
commit: string;
|
|
10
21
|
platform: "android" | "ios";
|
|
11
22
|
profile: string;
|
|
12
|
-
buildId:
|
|
23
|
+
buildId: string;
|
|
13
24
|
downloadUrl: string;
|
|
14
25
|
state: string;
|
|
15
26
|
storeSubmission: boolean;
|
|
16
27
|
artifact: string;
|
|
17
|
-
|
|
28
|
+
} | {
|
|
18
29
|
schemaVersion: number;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
state: string;
|
|
31
|
+
buildId: string;
|
|
32
|
+
buildPageUrl: string;
|
|
33
|
+
commit: string;
|
|
34
|
+
platform: "android" | "ios";
|
|
35
|
+
profile: string;
|
|
36
|
+
storeSubmission: boolean;
|
|
37
|
+
nextAction: string;
|
|
23
38
|
} | {
|
|
24
39
|
platform: "android" | "ios";
|
|
25
40
|
profile: string;
|
|
@@ -39,11 +54,6 @@ export declare function buildMobileApplication(root: string, options: MobileBuil
|
|
|
39
54
|
};
|
|
40
55
|
state?: undefined;
|
|
41
56
|
deployed?: undefined;
|
|
42
|
-
nextAction?: undefined;
|
|
43
|
-
schemaVersion?: undefined;
|
|
44
|
-
buildId?: undefined;
|
|
45
|
-
buildPageUrl?: undefined;
|
|
46
|
-
commit?: undefined;
|
|
47
57
|
} | {
|
|
48
58
|
state: string;
|
|
49
59
|
deployed: boolean;
|
|
@@ -64,37 +74,4 @@ export declare function buildMobileApplication(root: string, options: MobileBuil
|
|
|
64
74
|
profile?: undefined;
|
|
65
75
|
command?: undefined;
|
|
66
76
|
mutation?: undefined;
|
|
67
|
-
nextAction?: undefined;
|
|
68
|
-
schemaVersion?: undefined;
|
|
69
|
-
buildId?: undefined;
|
|
70
|
-
buildPageUrl?: undefined;
|
|
71
|
-
commit?: undefined;
|
|
72
|
-
} | {
|
|
73
|
-
state: string;
|
|
74
|
-
deployed: boolean;
|
|
75
|
-
storeSubmission: boolean;
|
|
76
|
-
nextAction: string;
|
|
77
|
-
platform?: undefined;
|
|
78
|
-
profile?: undefined;
|
|
79
|
-
command?: undefined;
|
|
80
|
-
mutation?: undefined;
|
|
81
|
-
integrations?: undefined;
|
|
82
|
-
schemaVersion?: undefined;
|
|
83
|
-
buildId?: undefined;
|
|
84
|
-
buildPageUrl?: undefined;
|
|
85
|
-
commit?: undefined;
|
|
86
|
-
} | {
|
|
87
|
-
schemaVersion: number;
|
|
88
|
-
state: string;
|
|
89
|
-
buildId: any;
|
|
90
|
-
buildPageUrl: string;
|
|
91
|
-
commit: string;
|
|
92
|
-
platform: "android" | "ios";
|
|
93
|
-
profile: string;
|
|
94
|
-
storeSubmission: boolean;
|
|
95
|
-
nextAction: string;
|
|
96
|
-
command?: undefined;
|
|
97
|
-
mutation?: undefined;
|
|
98
|
-
integrations?: undefined;
|
|
99
|
-
deployed?: undefined;
|
|
100
77
|
}>;
|