anhedral 0.13.0 → 0.15.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 +35 -232
- package/assets/patches/audit-deps.mjs +12 -2
- package/assets/ui/LICENSE.shadcn +21 -0
- package/assets/ui/UPSTREAM.json +33 -0
- package/assets/ui/native/button.tsx +85 -0
- package/assets/ui/native/card.tsx +33 -0
- package/assets/ui/native/dialog.tsx +75 -0
- package/assets/ui/native/input.tsx +27 -0
- package/assets/ui/native/label.tsx +4 -0
- package/assets/ui/native/layout.tsx +26 -0
- package/assets/ui/native/text.tsx +20 -0
- package/assets/ui/native/theme-switcher.tsx +22 -0
- package/assets/ui/theme-storage.ts +25 -0
- package/assets/ui/theme.tsx +66 -0
- package/assets/ui/web/button.tsx +59 -0
- package/assets/ui/web/input.tsx +21 -0
- package/assets/ui/web/label.tsx +19 -0
- package/dist/capabilities.d.ts +5 -5
- package/dist/capabilities.js +3 -21
- package/dist/capability-contract.d.ts +3 -3
- package/dist/capability-contract.js +11 -50
- package/dist/cli-delivery.d.ts +1 -1
- package/dist/cli-delivery.js +5 -65
- package/dist/cli-output.js +3 -3
- package/dist/command-schema.js +35 -86
- package/dist/delivery-evidence.d.ts +1 -1
- package/dist/delivery-evidence.js +7 -36
- package/dist/delivery.d.ts +2 -8
- package/dist/delivery.js +20 -101
- package/dist/dependencies.d.ts +6 -57
- package/dist/dependencies.js +54 -188
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -4
- package/dist/inspector-model.d.ts +2 -2
- package/dist/integration-service-readers.d.ts +1 -2
- package/dist/integration-service-readers.js +3 -84
- package/dist/lifecycle-model.d.ts +1 -1
- package/dist/lifecycle-model.js +1 -1
- package/dist/mobile-delivery.d.ts +1 -1
- package/dist/mobile-delivery.js +4 -0
- package/dist/platforms/mobile.js +30 -121
- package/dist/platforms/web.d.ts +3 -0
- package/dist/platforms/web.js +299 -0
- package/dist/project-config.d.ts +1 -1
- package/dist/project-config.js +0 -1
- package/dist/project-inspector.js +5 -36
- package/dist/project-state.d.ts +1 -3
- package/dist/project-state.js +2 -85
- package/dist/provider-auth.js +3 -38
- package/dist/provider-readiness.d.ts +1 -1
- package/dist/provider-readiness.js +5 -24
- package/dist/providers/adapters.js +0 -175
- package/dist/providers/api.d.ts +1 -1
- package/dist/providers/api.js +3 -3
- package/dist/providers/config.js +2 -48
- package/dist/providers/definitions.d.ts +1 -204
- package/dist/providers/definitions.js +0 -85
- package/dist/providers/provision.d.ts +1 -1
- package/dist/providers/receipts.js +1 -11
- package/dist/providers/recovery-verification.js +1 -61
- package/dist/providers/runtime.js +4 -35
- package/dist/providers/state.js +1 -7
- package/dist/provision.d.ts +5 -13
- package/dist/provision.js +4 -80
- package/dist/readiness.d.ts +1 -1
- package/dist/readiness.js +3 -8
- package/dist/registry/add.js +10 -70
- package/dist/registry/bootstrap.d.ts +3 -2
- package/dist/registry/bootstrap.js +4 -13
- package/dist/registry/commands.js +8 -10
- package/dist/registry/context.js +0 -1
- package/dist/registry/options.js +8 -38
- package/dist/registry/resolve.d.ts +3 -4
- package/dist/registry/resolve.js +26 -108
- package/dist/registry/types.d.ts +1 -7
- package/dist/registry/usage.js +2 -2
- package/dist/runtime-policy.d.ts +0 -2
- package/dist/runtime-policy.js +0 -16
- package/dist/scaffold/auth.d.ts +1 -2
- package/dist/scaffold/auth.js +55 -130
- package/dist/scaffold/backend.d.ts +0 -4
- package/dist/scaffold/backend.js +1 -186
- package/dist/scaffold/billing-schema.d.ts +1 -1
- package/dist/scaffold/billing-schema.js +4 -4
- package/dist/scaffold/billing.js +11 -19
- package/dist/scaffold/bootstrap.d.ts +2 -3
- package/dist/scaffold/bootstrap.js +37 -43
- package/dist/scaffold/compose.js +2 -14
- package/dist/scaffold/database.d.ts +1 -1
- package/dist/scaffold/database.js +18 -126
- package/dist/scaffold/documentation.d.ts +0 -1
- package/dist/scaffold/documentation.js +22 -86
- package/dist/scaffold/expo-auth.js +33 -22
- package/dist/scaffold/expo-billing.js +17 -52
- package/dist/scaffold/expo-runtime.d.ts +2 -2
- package/dist/scaffold/expo-runtime.js +6 -97
- package/dist/scaffold/integrations.d.ts +1 -3
- package/dist/scaffold/integrations.js +9 -10
- package/dist/scaffold/managed-email.d.ts +3 -0
- package/dist/scaffold/managed-email.js +47 -0
- package/dist/scaffold/native-ui.d.ts +2 -0
- package/dist/scaffold/native-ui.js +69 -0
- package/dist/scaffold/password-reset.d.ts +1 -0
- package/dist/scaffold/password-reset.js +99 -0
- package/dist/scaffold/private-files.d.ts +2 -0
- package/dist/scaffold/private-files.js +78 -0
- package/dist/scaffold/stack-documentation.d.ts +0 -1
- package/dist/scaffold/stack-documentation.js +3 -49
- package/dist/scaffold/styling.d.ts +1 -1
- package/dist/scaffold/styling.js +20 -28
- package/dist/scaffold/web-billing.d.ts +2 -0
- package/dist/scaffold/web-billing.js +48 -0
- package/dist/scaffold/workspace.js +53 -194
- package/dist/service-deletion.js +1 -1
- package/dist/service-descriptor.js +5 -12
- package/dist/service-model.d.ts +1 -1
- package/dist/service-operations.js +2 -32
- package/dist/service-readers.js +1 -32
- package/dist/services-command.d.ts +1 -1
- package/dist/services-command.js +3 -9
- package/dist/ship.d.ts +3 -316
- package/dist/ship.js +10 -142
- package/dist/stack-registry.d.ts +2 -52
- package/dist/stack-registry.js +55 -403
- package/dist/standard.js +7 -14
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +23 -122
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
- package/docs/software-factory.md +24 -557
- package/docs/stack-standard.md +47 -294
- package/docs/verification.md +320 -0
- package/package.json +20 -22
- package/dist/neon-service-data.d.ts +0 -8
- package/dist/neon-service-data.js +0 -117
- package/dist/platforms/desktop.d.ts +0 -2
- package/dist/platforms/desktop.js +0 -415
- package/dist/platforms/extension.d.ts +0 -2
- package/dist/platforms/extension.js +0 -328
- package/dist/registry/presets.d.ts +0 -4
- package/dist/registry/presets.js +0 -41
- package/dist/scaffold/cloudflare-services.d.ts +0 -8
- package/dist/scaffold/cloudflare-services.js +0 -198
- package/dist/scaffold/lint.d.ts +0 -4
- package/dist/scaffold/lint.js +0 -56
- package/dist/scaffold/neon-realtime.d.ts +0 -2
- package/dist/scaffold/neon-realtime.js +0 -97
- package/dist/scaffold/services.d.ts +0 -5
- package/dist/scaffold/services.js +0 -108
- package/dist/scaffold/stream.d.ts +0 -2
- package/dist/scaffold/stream.js +0 -114
- package/dist/scaffold/void.d.ts +0 -4
- package/dist/scaffold/void.js +0 -264
- package/dist/scaffold/web.d.ts +0 -2
- package/dist/scaffold/web.js +0 -130
- package/dist/vercel-project.d.ts +0 -101
- package/dist/vercel-project.js +0 -305
- package/dist/vercel.d.ts +0 -67
- package/dist/vercel.js +0 -581
- package/dist/vinext.d.ts +0 -2
- package/dist/vinext.js +0 -86
- package/dist/void-execution.d.ts +0 -10
- package/dist/void-execution.js +0 -94
- package/dist/void-migrations.d.ts +0 -6
- package/dist/void-migrations.js +0 -110
- package/dist/void-state.d.ts +0 -16
- package/dist/void-state.js +0 -65
- package/dist/void.d.ts +0 -3
- package/dist/void.js +0 -5
package/dist/project-state.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface ApplicationProject {
|
|
|
9
9
|
name: string;
|
|
10
10
|
ownership: 'customer';
|
|
11
11
|
provider: 'cloudflare';
|
|
12
|
-
deliveryEngine: '
|
|
12
|
+
deliveryEngine: 'wrangler';
|
|
13
13
|
accountId: string | null;
|
|
14
14
|
audience: 'unconfigured' | 'public' | 'private';
|
|
15
15
|
access?: {
|
|
@@ -20,8 +20,6 @@ export interface ApplicationProject {
|
|
|
20
20
|
export type DeliveryRunner = (command: string, args: string[], cwd: string, env: NodeJS.ProcessEnv, input?: string) => Promise<string>;
|
|
21
21
|
export declare function atomicJson(file: string, value: unknown): void;
|
|
22
22
|
export declare function configurationFile(directory: string): string;
|
|
23
|
-
export declare function usesVoid(project: ApplicationProject): boolean;
|
|
24
|
-
export declare function resolveVoidCloudflareConfig(authored: Record<string, unknown>, lock: Record<string, unknown>): Record<string, unknown>;
|
|
25
23
|
export declare function readConfig(directory: string): Record<string, unknown>;
|
|
26
24
|
export declare function targetDirectory(root: string, target: DeploymentTarget): string;
|
|
27
25
|
export declare function registerApplication(root: string, extendTargets?: boolean): ApplicationProject;
|
package/dist/project-state.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { hasProjectSection, readProjectSection, writeProjectSection } from './project-config.js';
|
|
2
|
-
import { isDeepStrictEqual } from 'node:util';
|
|
3
2
|
import { randomUUID } from 'node:crypto';
|
|
4
3
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
5
4
|
import { existsSync, lstatSync, fstatSync, openSync, closeSync, unlinkSync, rmdirSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
@@ -27,90 +26,11 @@ export function configurationFile(directory) {
|
|
|
27
26
|
const canonical = path.join(directory, 'anhedral.cloudflare.json');
|
|
28
27
|
return existsSync(canonical) ? canonical : path.join(directory, 'wrangler.jsonc');
|
|
29
28
|
}
|
|
30
|
-
export function usesVoid(project) {
|
|
31
|
-
return project.deliveryEngine === 'void';
|
|
32
|
-
}
|
|
33
|
-
function mergeVoidConfig(previous, resolved, authored) {
|
|
34
|
-
if (isDeepStrictEqual(previous, authored))
|
|
35
|
-
return resolved;
|
|
36
|
-
if (Array.isArray(previous) && Array.isArray(resolved) && Array.isArray(authored)) {
|
|
37
|
-
const identity = (value) => {
|
|
38
|
-
if (value && typeof value === 'object')
|
|
39
|
-
for (const key of ['binding', 'name', 'tag', 'class_name', 'pattern', 'route']) {
|
|
40
|
-
const item = value[key];
|
|
41
|
-
if (typeof item === 'string')
|
|
42
|
-
return `${key}:${item}`;
|
|
43
|
-
}
|
|
44
|
-
return JSON.stringify(value);
|
|
45
|
-
};
|
|
46
|
-
return [
|
|
47
|
-
...authored.map((item) => {
|
|
48
|
-
const before = previous.find((entry) => identity(entry) === identity(item));
|
|
49
|
-
const after = resolved.find((entry) => identity(entry) === identity(item));
|
|
50
|
-
return before !== undefined && after !== undefined
|
|
51
|
-
? mergeVoidConfig(before, after, item)
|
|
52
|
-
: item;
|
|
53
|
-
}),
|
|
54
|
-
...resolved.filter((item) => !previous.some((entry) => identity(entry) === identity(item)) &&
|
|
55
|
-
!authored.some((entry) => identity(entry) === identity(item))),
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
const object = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
59
|
-
if (object(previous) && object(resolved) && object(authored)) {
|
|
60
|
-
const result = {};
|
|
61
|
-
for (const key of new Set([
|
|
62
|
-
...Object.keys(previous),
|
|
63
|
-
...Object.keys(resolved),
|
|
64
|
-
...Object.keys(authored),
|
|
65
|
-
])) {
|
|
66
|
-
if (key in authored)
|
|
67
|
-
Object.defineProperty(result, key, {
|
|
68
|
-
value: mergeVoidConfig(previous[key], resolved[key], authored[key]),
|
|
69
|
-
enumerable: true,
|
|
70
|
-
});
|
|
71
|
-
else if (!(key in previous) && key in resolved)
|
|
72
|
-
Object.defineProperty(result, key, { value: resolved[key], enumerable: true });
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
return authored;
|
|
77
|
-
}
|
|
78
|
-
export function resolveVoidCloudflareConfig(authored, lock) {
|
|
79
|
-
const value = structuredClone(authored);
|
|
80
|
-
if (lock.version !== 1 ||
|
|
81
|
-
!lock.source ||
|
|
82
|
-
typeof lock.source !== 'object' ||
|
|
83
|
-
Array.isArray(lock.source) ||
|
|
84
|
-
!lock.resolved ||
|
|
85
|
-
typeof lock.resolved !== 'object' ||
|
|
86
|
-
Array.isArray(lock.resolved) ||
|
|
87
|
-
typeof lock.text !== 'string')
|
|
88
|
-
throw new Error('Invalid pinned Void resource lock.');
|
|
89
|
-
// The generated Void configuration omits resource-ID scaffolding placeholders.
|
|
90
|
-
// Match that authored input when applying Void's resolved resource identities.
|
|
91
|
-
for (const [field, key] of [
|
|
92
|
-
['d1_databases', 'database_id'],
|
|
93
|
-
['kv_namespaces', 'id'],
|
|
94
|
-
['pipelines', 'stream'],
|
|
95
|
-
]) {
|
|
96
|
-
if (Array.isArray(value[field]))
|
|
97
|
-
for (const entry of value[field]) {
|
|
98
|
-
if (entry && typeof entry[key] === 'string' && entry[key].startsWith('REPLACE_WITH_'))
|
|
99
|
-
delete entry[key];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return mergeVoidConfig(lock.source, lock.resolved, value);
|
|
103
|
-
}
|
|
104
29
|
export function readConfig(directory) {
|
|
105
30
|
const errors = [];
|
|
106
31
|
const value = parse(readFileSync(configurationFile(directory), 'utf8'), errors);
|
|
107
32
|
if (errors.length || !value || typeof value !== 'object' || Array.isArray(value))
|
|
108
33
|
throw new Error('Invalid Wrangler JSONC configuration.');
|
|
109
|
-
const lockFile = path.join(directory, 'void.lock.json');
|
|
110
|
-
if (existsSync(path.join(directory, 'anhedral.cloudflare.json')) && existsSync(lockFile)) {
|
|
111
|
-
const lock = JSON.parse(readFileSync(lockFile, 'utf8'));
|
|
112
|
-
return resolveVoidCloudflareConfig(value, lock);
|
|
113
|
-
}
|
|
114
34
|
return value;
|
|
115
35
|
}
|
|
116
36
|
export function targetDirectory(root, target) {
|
|
@@ -141,10 +61,7 @@ export function registerApplication(root, extendTargets = false) {
|
|
|
141
61
|
const rank = (id) => (id === 'web' ? 2 : id === 'mobile' ? 1 : 0);
|
|
142
62
|
return rank(a.id) - rank(b.id) || a.id.localeCompare(b.id);
|
|
143
63
|
});
|
|
144
|
-
const selectedEngine =
|
|
145
|
-
targets.every((target) => existsSync(path.join(root, target.directory, 'void.config.ts')))
|
|
146
|
-
? 'void'
|
|
147
|
-
: 'wrangler';
|
|
64
|
+
const selectedEngine = 'wrangler';
|
|
148
65
|
if (existing) {
|
|
149
66
|
if (existing.targets.some((target) => !targets.some((candidate) => candidate.id === target.id &&
|
|
150
67
|
candidate.directory === target.directory &&
|
|
@@ -185,7 +102,7 @@ export function readApplication(root) {
|
|
|
185
102
|
!/^[a-f0-9-]{36}$/i.test(project.id) ||
|
|
186
103
|
project.ownership !== 'customer' ||
|
|
187
104
|
project.provider !== 'cloudflare' ||
|
|
188
|
-
|
|
105
|
+
project.deliveryEngine !== 'wrangler' ||
|
|
189
106
|
!(project.accountId === null || accountPattern.test(project.accountId)) ||
|
|
190
107
|
!['unconfigured', 'public', 'private'].includes(project.audience) ||
|
|
191
108
|
!Array.isArray(project.targets))
|
package/dist/provider-auth.js
CHANGED
|
@@ -1,46 +1,20 @@
|
|
|
1
|
-
import { EAS_CLI_VERSION, STACK_DEPENDENCIES
|
|
1
|
+
import { EAS_CLI_VERSION, STACK_DEPENDENCIES } from './dependencies.js';
|
|
2
2
|
import { realpathSync } from 'node:fs';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { readProjectSection } from './project-config.js';
|
|
5
5
|
import { validateSetupPlan } from './readiness.js';
|
|
6
6
|
import { resolveCommand } from './command.js';
|
|
7
7
|
import { defaultRunner } from './project-state.js';
|
|
8
|
-
import { providerConfiguration } from './providers/config.js';
|
|
9
8
|
import { INTEGRATION_PROVIDERS, PROVIDER_DEFINITIONS, } from './providers/definitions.js';
|
|
10
9
|
/** Deployment access is separate from application-user authentication. */
|
|
11
10
|
export const PROVIDER_AUTH = [
|
|
12
11
|
{
|
|
13
12
|
id: 'cloudflare',
|
|
14
|
-
products: [
|
|
15
|
-
'expo',
|
|
16
|
-
'analytics-engine',
|
|
17
|
-
'images',
|
|
18
|
-
'realtimekit',
|
|
19
|
-
'video',
|
|
20
|
-
'stream',
|
|
21
|
-
'vinext',
|
|
22
|
-
'hono',
|
|
23
|
-
'd1',
|
|
24
|
-
'r2',
|
|
25
|
-
'kv',
|
|
26
|
-
'realtime',
|
|
27
|
-
'queues',
|
|
28
|
-
'cron',
|
|
29
|
-
'workflows',
|
|
30
|
-
'workers-ai',
|
|
31
|
-
'basin',
|
|
32
|
-
],
|
|
13
|
+
products: ['expo', 'hono', 'd1', 'r2'],
|
|
33
14
|
login: ['pnpm', 'dlx', `wrangler@${STACK_DEPENDENCIES.wrangler}`, 'login'],
|
|
34
15
|
identity: ['pnpm', 'dlx', `wrangler@${STACK_DEPENDENCIES.wrangler}`, 'whoami', '--json'],
|
|
35
16
|
setup: 'Select and connect the intended Cloudflare account before shipping.',
|
|
36
17
|
},
|
|
37
|
-
{
|
|
38
|
-
id: 'vercel',
|
|
39
|
-
products: [],
|
|
40
|
-
login: ['pnpm', 'dlx', `vercel@${VERCEL_CLI_VERSION}`, 'login'],
|
|
41
|
-
identity: ['pnpm', 'dlx', `vercel@${VERCEL_CLI_VERSION}`, 'whoami'],
|
|
42
|
-
setup: 'Connect the intended Vercel team and project before shipping.',
|
|
43
|
-
},
|
|
44
18
|
...INTEGRATION_PROVIDERS.map((id) => {
|
|
45
19
|
const definition = PROVIDER_DEFINITIONS[id];
|
|
46
20
|
const { auth } = definition;
|
|
@@ -87,11 +61,7 @@ export function requiredProviders(root) {
|
|
|
87
61
|
throw new Error('A valid Anhedral setup plan is required before authentication.');
|
|
88
62
|
}
|
|
89
63
|
validateSetupPlan(plan);
|
|
90
|
-
const providers = PROVIDER_AUTH.filter((provider) => provider.products.some((product) => plan.products.includes(product))
|
|
91
|
-
(provider.id === 'cloudflare' &&
|
|
92
|
-
plan.products.includes('next') &&
|
|
93
|
-
plan.hosting === 'cloudflare') ||
|
|
94
|
-
(provider.id === 'vercel' && plan.products.includes('next') && plan.hosting === 'vercel'));
|
|
64
|
+
const providers = PROVIDER_AUTH.filter((provider) => provider.products.some((product) => plan.products.includes(product)));
|
|
95
65
|
return providers;
|
|
96
66
|
}
|
|
97
67
|
async function login(command, root) {
|
|
@@ -113,7 +83,6 @@ export async function authenticateProviders(root, options = {}, run = defaultRun
|
|
|
113
83
|
if (options.provider && !required.some((item) => item.id === options.provider))
|
|
114
84
|
throw new Error('Requested provider is not required by this project.');
|
|
115
85
|
const selected = required.filter((item) => !options.provider || item.id === options.provider);
|
|
116
|
-
const configuration = providerConfiguration(root);
|
|
117
86
|
const checks = [];
|
|
118
87
|
for (const provider of selected) {
|
|
119
88
|
let state = 'unverified';
|
|
@@ -171,10 +140,6 @@ export async function authenticateProviders(root, options = {}, run = defaultRun
|
|
|
171
140
|
endpoint = provider.runtime.endpoint;
|
|
172
141
|
credentialAccess = 'runtime';
|
|
173
142
|
}
|
|
174
|
-
if (provider.regionalEndpoints) {
|
|
175
|
-
const region = configuration.providers.posthog?.region;
|
|
176
|
-
endpoint = region ? provider.regionalEndpoints[region] : undefined;
|
|
177
|
-
}
|
|
178
143
|
if (!credential)
|
|
179
144
|
state = 'missing';
|
|
180
145
|
else if (endpoint) {
|
|
@@ -9,7 +9,7 @@ export declare function inspectProviderReadiness(root: string, run?: DeliveryRun
|
|
|
9
9
|
}[];
|
|
10
10
|
prerequisitesReady: boolean;
|
|
11
11
|
providers: {
|
|
12
|
-
provider: "
|
|
12
|
+
provider: "cloudflare";
|
|
13
13
|
connection: "verified" | "blocked";
|
|
14
14
|
deployment: "active-recorded" | "unverified";
|
|
15
15
|
nextAction?: string;
|
|
@@ -2,9 +2,7 @@ import { hasProjectSection, readProjectSection } from './project-config.js';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { inspectProject } from './readiness.js';
|
|
4
4
|
import { defaultRunner } from './project-state.js';
|
|
5
|
-
import { vercelApplicationStatus } from './vercel.js';
|
|
6
5
|
import { applicationStatus } from './delivery.js';
|
|
7
|
-
import { supportsVoidRuntime, VOID_VERSION } from './void.js';
|
|
8
6
|
import { supportsWorkspaceRuntime } from './runtime-policy.js';
|
|
9
7
|
import { PACKAGE_MANAGER } from './dependencies.js';
|
|
10
8
|
/** Explicit opt-in: checks local tools and existing provider context without setup or deployment. */
|
|
@@ -27,26 +25,11 @@ export async function inspectProviderReadiness(root, run = defaultRunner) {
|
|
|
27
25
|
checks.push({ id, ok: false, detail, nextAction });
|
|
28
26
|
}
|
|
29
27
|
};
|
|
30
|
-
let voidTargets = [];
|
|
31
|
-
try {
|
|
32
|
-
const manifest = readProjectSection(root, 'cloudflare');
|
|
33
|
-
if (manifest.deliveryEngine === 'void' && Array.isArray(manifest.targets))
|
|
34
|
-
voidTargets = manifest.targets.filter((target) => typeof target.directory === 'string' && /^apps\/[a-z0-9-]+$/.test(target.directory));
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
// Provider readiness below reports invalid or unconfigured manifests.
|
|
38
|
-
}
|
|
39
28
|
checks.push({
|
|
40
29
|
id: 'node',
|
|
41
|
-
ok:
|
|
42
|
-
|
|
43
|
-
: supportsWorkspaceRuntime(process.versions.node),
|
|
44
|
-
detail: voidTargets.length
|
|
45
|
-
? 'Void applications require Node.js 24.21.0 or newer.'
|
|
46
|
-
: 'Generated workspaces require Node 22.13+ on 22.x, or Node 24+.',
|
|
30
|
+
ok: supportsWorkspaceRuntime(process.versions.node),
|
|
31
|
+
detail: 'Generated workspaces require Node 22.13+ on 22.x, or Node 24+.',
|
|
47
32
|
});
|
|
48
|
-
for (const target of voidTargets)
|
|
49
|
-
await check(`void:${target.directory}`, async () => (await run('pnpm', ['exec', 'void', '--version'], path.join(root, target.directory), environment)).trim() === VOID_VERSION, `Pinned Void ${VOID_VERSION} is available in ${target.directory}`, 'Install the committed workspace lockfile and the pinned Void version.');
|
|
50
33
|
await check('pnpm', async () => (await run('pnpm', ['--version'], root, environment)).trim() ===
|
|
51
34
|
PACKAGE_MANAGER.slice('pnpm@'.length), `${PACKAGE_MANAGER} is available`, `Install ${PACKAGE_MANAGER} before operating this workspace.`);
|
|
52
35
|
await check('git', async () => (await run('git', ['--version'], root, environment)).startsWith('git version '), 'Git is available', 'Install Git.');
|
|
@@ -58,17 +41,15 @@ export async function inspectProviderReadiness(root, run = defaultRunner) {
|
|
|
58
41
|
return typeof user.login === 'string' && /^[a-zA-Z0-9-]+$/.test(user.login);
|
|
59
42
|
}, 'GitHub CLI can identify its authenticated account', 'Complete gh auth login locally for the intended GitHub account.');
|
|
60
43
|
const providers = [];
|
|
61
|
-
for (const provider of ['
|
|
44
|
+
for (const provider of ['cloudflare']) {
|
|
62
45
|
try {
|
|
63
46
|
if (!hasProjectSection(root, provider))
|
|
64
47
|
continue;
|
|
65
48
|
const manifest = readProjectSection(root, provider);
|
|
66
|
-
const connected =
|
|
49
|
+
const connected = manifest.accountId;
|
|
67
50
|
if (!connected || manifest.audience === 'unconfigured')
|
|
68
51
|
throw new Error('unconfigured');
|
|
69
|
-
const status =
|
|
70
|
-
? await vercelApplicationStatus(root, true, run)
|
|
71
|
-
: await applicationStatus(root, true, run);
|
|
52
|
+
const status = await applicationStatus(root, true, run);
|
|
72
53
|
const active = 'activeRecordedVersion' in status
|
|
73
54
|
? status.activeRecordedVersion === true
|
|
74
55
|
: status.provider.length > 0 &&
|
|
@@ -8,106 +8,6 @@ function same(value, expected, description) {
|
|
|
8
8
|
if (value !== expected)
|
|
9
9
|
throw new Error(`Provider ${description} differs from the selected configuration.`);
|
|
10
10
|
}
|
|
11
|
-
async function neon(context) {
|
|
12
|
-
const { settings: config, api } = context;
|
|
13
|
-
let id = setting(config, 'projectId');
|
|
14
|
-
if (!id) {
|
|
15
|
-
const response = await create(context, 'project', '/api/v2/projects', {
|
|
16
|
-
project: {
|
|
17
|
-
name: setting(config, 'name'),
|
|
18
|
-
org_id: setting(config, 'organizationId'),
|
|
19
|
-
region_id: setting(config, 'region'),
|
|
20
|
-
default_branch: {
|
|
21
|
-
name: 'main',
|
|
22
|
-
database_name: setting(config, 'database'),
|
|
23
|
-
role_name: setting(config, 'role'),
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
id = resourceId(object(response.project).id);
|
|
28
|
-
}
|
|
29
|
-
id = resourceId(id);
|
|
30
|
-
const project = object(object(await api(`/api/v2/projects/${id}`)).project);
|
|
31
|
-
same(project.org_id, setting(config, 'organizationId'), 'Neon organization');
|
|
32
|
-
if (project.suspended === true)
|
|
33
|
-
throw new Error('Neon project is suspended.');
|
|
34
|
-
const operations = list(object(await api(`/api/v2/projects/${id}/operations`)).operations);
|
|
35
|
-
if (operations.some((operation) => !['finished', 'skipped'].includes(String(operation.status))))
|
|
36
|
-
return result({ project: id }, {}, ['Neon operations are pending or failed. Inspect the project, then run ship again.'], false);
|
|
37
|
-
const query = new URLSearchParams({
|
|
38
|
-
database_name: setting(config, 'database'),
|
|
39
|
-
role_name: setting(config, 'role'),
|
|
40
|
-
pooled: 'true',
|
|
41
|
-
});
|
|
42
|
-
const uri = text(object(await api(`/api/v2/projects/${id}/connection_uri?${query}`)).uri);
|
|
43
|
-
const parsed = new URL(uri);
|
|
44
|
-
if (!['postgres:', 'postgresql:'].includes(parsed.protocol) ||
|
|
45
|
-
!parsed.hostname.endsWith('.neon.tech'))
|
|
46
|
-
throw new Error('Neon returned an unexpected database connection.');
|
|
47
|
-
return result({ project: id }, { DATABASE_URL: uri }, [
|
|
48
|
-
'Configure DATABASE_URL_UNPOOLED with the intended direct migration connection in ignored packages/db/.env; runtime provisioning does not configure migration credentials.',
|
|
49
|
-
'Run pnpm db:generate, review the SQL, then run pnpm db:migrate against the intended database before testing authentication or application data.',
|
|
50
|
-
]);
|
|
51
|
-
}
|
|
52
|
-
async function clerk(context) {
|
|
53
|
-
const { settings: config, api } = context;
|
|
54
|
-
const principal = object(await api('/v1/platform/me'));
|
|
55
|
-
same(principal.subject, setting(config, 'workspaceId'), 'Clerk workspace');
|
|
56
|
-
let id = setting(config, 'applicationId');
|
|
57
|
-
if (!id)
|
|
58
|
-
id = resourceId((await create(context, 'application', '/v1/platform/applications', {
|
|
59
|
-
name: setting(config, 'name'),
|
|
60
|
-
environment_types: [setting(config, 'environment')],
|
|
61
|
-
})).application_id);
|
|
62
|
-
id = resourceId(id);
|
|
63
|
-
const application = object(await api(`/v1/platform/applications/${id}?include_secret_keys=true`));
|
|
64
|
-
same(application.application_id, id, 'Clerk application');
|
|
65
|
-
const instances = list(application.instances).filter((instance) => instance.environment_type === config.environment);
|
|
66
|
-
if (instances.length !== 1)
|
|
67
|
-
throw new Error('Clerk did not return exactly one selected environment.');
|
|
68
|
-
const instance = instances[0];
|
|
69
|
-
const publishable = text(instance.publishable_key);
|
|
70
|
-
const secret = text(instance.secret_key);
|
|
71
|
-
const mode = config.environment === 'production' ? 'live' : 'test';
|
|
72
|
-
if (!publishable.startsWith(`pk_${mode}_`) || !secret.startsWith(`sk_${mode}_`))
|
|
73
|
-
throw new Error('Clerk keys do not match the selected environment.');
|
|
74
|
-
return result({ application: id, instance: resourceId(instance.instance_id) }, {
|
|
75
|
-
CLERK_SECRET_KEY: secret,
|
|
76
|
-
CLERK_PUBLISHABLE_KEY: publishable,
|
|
77
|
-
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: publishable,
|
|
78
|
-
}, config.environment === 'production'
|
|
79
|
-
? ['Verify the production Clerk domain, DNS and enabled OAuth providers before delivery.']
|
|
80
|
-
: []);
|
|
81
|
-
}
|
|
82
|
-
async function resend(context) {
|
|
83
|
-
const { settings: config, api } = context;
|
|
84
|
-
let id = setting(config, 'domainId');
|
|
85
|
-
if (!id)
|
|
86
|
-
id = resourceId((await create(context, 'domain', '/domains', {
|
|
87
|
-
name: setting(config, 'domain'),
|
|
88
|
-
...(setting(config, 'region') ? { region: config.region } : {}),
|
|
89
|
-
})).id);
|
|
90
|
-
id = resourceId(id);
|
|
91
|
-
let domain = object(await api(`/domains/${id}`));
|
|
92
|
-
same(domain.name, setting(config, 'domain'), 'Resend domain');
|
|
93
|
-
if (domain.status !== 'verified') {
|
|
94
|
-
await api(`/domains/${id}/verify`, 'POST');
|
|
95
|
-
domain = object(await api(`/domains/${id}`));
|
|
96
|
-
}
|
|
97
|
-
if (domain.status !== 'verified') {
|
|
98
|
-
const records = list(domain.records).map((record) => `${text(record.type)} ${text(record.name)} ${text(record.value)}${record.priority === undefined ? '' : ` (priority ${Number(record.priority)})`}`);
|
|
99
|
-
return result({ domain: id }, {}, ['Publish the Resend DNS records, wait for verification, then run ship again.', ...records], false);
|
|
100
|
-
}
|
|
101
|
-
const key = await create(context, 'sending-key', '/api-keys', {
|
|
102
|
-
name: `anhedral-${id}`.slice(0, 50),
|
|
103
|
-
permission: 'sending_access',
|
|
104
|
-
domain_id: id,
|
|
105
|
-
});
|
|
106
|
-
const keys = object(await api('/api-keys'));
|
|
107
|
-
if (keys.has_more === true || !list(keys.data).some((entry) => entry.id === key.id))
|
|
108
|
-
throw new Error('Resend did not confirm the recorded sending key; inspect key access before configuring runtime.');
|
|
109
|
-
return result({ domain: id, sendingKey: resourceId(key.id) }, { RESEND_API_KEY: text(key.token) });
|
|
110
|
-
}
|
|
111
11
|
async function stripe(context) {
|
|
112
12
|
const { settings: config, api, environment } = context;
|
|
113
13
|
const account = object(await api('/v1/account'));
|
|
@@ -142,75 +42,6 @@ async function stripe(context) {
|
|
|
142
42
|
? ['Complete Stripe account activation before accepting live payments.']
|
|
143
43
|
: []);
|
|
144
44
|
}
|
|
145
|
-
async function sentry(context) {
|
|
146
|
-
const { settings: config, api } = context;
|
|
147
|
-
const organization = resourceId(config.organization);
|
|
148
|
-
const team = resourceId(config.team);
|
|
149
|
-
const slug = resourceId(config.project);
|
|
150
|
-
const projects = list(await api(`/api/0/teams/${organization}/${team}/projects/`));
|
|
151
|
-
const matching = projects.filter((project) => project.slug === slug);
|
|
152
|
-
if (matching.length > 1)
|
|
153
|
-
throw new Error('Sentry project selection is ambiguous.');
|
|
154
|
-
if (!matching.length)
|
|
155
|
-
await create(context, 'project', `/api/0/teams/${organization}/${team}/projects/`, {
|
|
156
|
-
name: setting(config, 'name') || slug,
|
|
157
|
-
slug,
|
|
158
|
-
platform: config.platform,
|
|
159
|
-
default_rules: false,
|
|
160
|
-
});
|
|
161
|
-
const project = object(await api(`/api/0/projects/${organization}/${slug}/`));
|
|
162
|
-
same(object(project.organization).slug, organization, 'Sentry organization');
|
|
163
|
-
same(project.platform, setting(config, 'platform'), 'Sentry platform');
|
|
164
|
-
if (!list(project.teams).some((entry) => entry.slug === team))
|
|
165
|
-
throw new Error('Sentry project belongs to a different team.');
|
|
166
|
-
let keys = list(await api(`/api/0/projects/${organization}/${slug}/keys/`)).filter((key) => key.isActive === true);
|
|
167
|
-
if (!keys.length) {
|
|
168
|
-
await create(context, 'client-key', `/api/0/projects/${organization}/${slug}/keys/`, {
|
|
169
|
-
name: 'Anhedral',
|
|
170
|
-
});
|
|
171
|
-
keys = list(await api(`/api/0/projects/${organization}/${slug}/keys/`)).filter((key) => key.isActive === true);
|
|
172
|
-
}
|
|
173
|
-
if (keys.length !== 1)
|
|
174
|
-
throw new Error('Select exactly one active Sentry client key before configuring.');
|
|
175
|
-
const dsn = text(object(keys[0].dsn).public);
|
|
176
|
-
if (new URL(dsn).protocol !== 'https:')
|
|
177
|
-
throw new Error('Sentry DSN must use HTTPS.');
|
|
178
|
-
return result({ project: resourceId(project.id) }, { SENTRY_DSN: dsn });
|
|
179
|
-
}
|
|
180
|
-
async function posthog(context) {
|
|
181
|
-
const { settings: config, api } = context;
|
|
182
|
-
const organization = resourceId(config.organizationId);
|
|
183
|
-
let id = setting(config, 'projectId');
|
|
184
|
-
if (!id)
|
|
185
|
-
id = resourceId((await create(context, 'project', `/api/organizations/${organization}/projects/`, {
|
|
186
|
-
name: config.name,
|
|
187
|
-
})).id);
|
|
188
|
-
id = resourceId(id);
|
|
189
|
-
const project = object(await api(`/api/organizations/${organization}/projects/${id}/`));
|
|
190
|
-
same(resourceId(project.id), id, 'PostHog project');
|
|
191
|
-
same(project.organization, organization, 'PostHog organization');
|
|
192
|
-
return result({ project: id }, {
|
|
193
|
-
POSTHOG_API_KEY: text(project.api_token),
|
|
194
|
-
POSTHOG_HOST: config.region === 'eu' ? 'https://eu.i.posthog.com' : 'https://us.i.posthog.com',
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
async function openai(context) {
|
|
198
|
-
const { settings: config, api } = context;
|
|
199
|
-
let id = setting(config, 'projectId');
|
|
200
|
-
if (!id)
|
|
201
|
-
id = resourceId((await create(context, 'project', '/v1/organization/projects', { name: config.name })).id);
|
|
202
|
-
id = resourceId(id);
|
|
203
|
-
const project = object(await api(`/v1/organization/projects/${id}`));
|
|
204
|
-
same(project.id, id, 'OpenAI project');
|
|
205
|
-
if (project.status !== 'active')
|
|
206
|
-
throw new Error('OpenAI project is not active.');
|
|
207
|
-
const account = await create(context, 'service-account', `/v1/organization/projects/${id}/service_accounts`, { name: config.serviceAccountName });
|
|
208
|
-
const accountId = resourceId(account.id);
|
|
209
|
-
const current = object(await api(`/v1/organization/projects/${id}/service_accounts/${accountId}`));
|
|
210
|
-
same(current.id, accountId, 'OpenAI service account');
|
|
211
|
-
same(current.name, setting(config, 'serviceAccountName'), 'OpenAI service account name');
|
|
212
|
-
return result({ project: id, serviceAccount: accountId }, { OPENAI_API_KEY: text(object(account.api_key).value) });
|
|
213
|
-
}
|
|
214
45
|
async function revenuecat(context) {
|
|
215
46
|
const { settings: config, api } = context;
|
|
216
47
|
let id = setting(config, 'projectId');
|
|
@@ -267,12 +98,6 @@ async function revenuecat(context) {
|
|
|
267
98
|
]);
|
|
268
99
|
}
|
|
269
100
|
export const PROVIDER_ADAPTERS = {
|
|
270
|
-
neon,
|
|
271
|
-
clerk,
|
|
272
|
-
resend,
|
|
273
101
|
stripe,
|
|
274
102
|
revenuecat,
|
|
275
|
-
sentry,
|
|
276
|
-
posthog,
|
|
277
|
-
openai,
|
|
278
103
|
};
|
package/dist/providers/api.d.ts
CHANGED
|
@@ -26,4 +26,4 @@ export interface ProviderRetryOptions {
|
|
|
26
26
|
}
|
|
27
27
|
/** Fixed origins, bounded reads and sanitized errors keep management keys out of output.
|
|
28
28
|
* Only GET requests retry transient failures; unknown mutation outcomes never replay. */
|
|
29
|
-
export declare function providerApi(id: IntegrationProvider,
|
|
29
|
+
export declare function providerApi(id: IntegrationProvider, _settings: ProviderSettings, environment: NodeJS.ProcessEnv, send: typeof fetch, options?: ProviderRetryOptions): ApiRequest;
|
package/dist/providers/api.js
CHANGED
|
@@ -153,13 +153,13 @@ function requestedDelay(value, maximum) {
|
|
|
153
153
|
}
|
|
154
154
|
/** Fixed origins, bounded reads and sanitized errors keep management keys out of output.
|
|
155
155
|
* Only GET requests retry transient failures; unknown mutation outcomes never replay. */
|
|
156
|
-
export function providerApi(id,
|
|
156
|
+
export function providerApi(id, _settings, environment, send, options = {}) {
|
|
157
157
|
const token = environment[CREDENTIALS[id]];
|
|
158
158
|
if (!token || /[^\x21-\x7e]/.test(token))
|
|
159
159
|
throw new Error(`${id}: supply ${CREDENTIALS[id]}.`);
|
|
160
160
|
const policy = retryPolicy(options);
|
|
161
161
|
const definition = PROVIDER_DEFINITIONS[id];
|
|
162
|
-
const origin = definition.
|
|
162
|
+
const origin = definition.origin;
|
|
163
163
|
return async (route, method = 'GET', body, operation) => {
|
|
164
164
|
if (!route.startsWith('/') ||
|
|
165
165
|
route.startsWith('//') ||
|
|
@@ -192,7 +192,7 @@ export function providerApi(id, settings, environment, send, options = {}) {
|
|
|
192
192
|
headers['Content-Type'] = 'application/json';
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
if (operation &&
|
|
195
|
+
if (operation && id === 'stripe')
|
|
196
196
|
headers['Idempotency-Key'] = operation;
|
|
197
197
|
const started = performance.now();
|
|
198
198
|
const attempts = method === 'GET' ? policy.maxAttempts : 1;
|
package/dist/providers/config.js
CHANGED
|
@@ -93,24 +93,6 @@ export function providerRequirements(id, config) {
|
|
|
93
93
|
need('name');
|
|
94
94
|
};
|
|
95
95
|
switch (id) {
|
|
96
|
-
case 'neon':
|
|
97
|
-
existingOrNew();
|
|
98
|
-
need('organizationId');
|
|
99
|
-
need('database');
|
|
100
|
-
need('role');
|
|
101
|
-
if (!setting(config, 'projectId'))
|
|
102
|
-
need('region');
|
|
103
|
-
break;
|
|
104
|
-
case 'clerk':
|
|
105
|
-
need('workspaceId');
|
|
106
|
-
if (!setting(config, 'applicationId'))
|
|
107
|
-
need('name');
|
|
108
|
-
if (!['development', 'production'].includes(setting(config, 'environment')))
|
|
109
|
-
missing.push('environment');
|
|
110
|
-
break;
|
|
111
|
-
case 'resend':
|
|
112
|
-
need('domain');
|
|
113
|
-
break;
|
|
114
96
|
case 'stripe':
|
|
115
97
|
need('accountId');
|
|
116
98
|
if (!['test', 'live'].includes(setting(config, 'mode')))
|
|
@@ -132,51 +114,23 @@ export function providerRequirements(id, config) {
|
|
|
132
114
|
].some((key) => setting(config, key)))
|
|
133
115
|
missing.push('store app identifiers or a connected stripeAccountId');
|
|
134
116
|
break;
|
|
135
|
-
case 'sentry':
|
|
136
|
-
need('organization');
|
|
137
|
-
need('team');
|
|
138
|
-
need('project');
|
|
139
|
-
need('platform');
|
|
140
|
-
break;
|
|
141
|
-
case 'posthog':
|
|
142
|
-
existingOrNew();
|
|
143
|
-
need('organizationId');
|
|
144
|
-
if (!['us', 'eu'].includes(setting(config, 'region')))
|
|
145
|
-
missing.push('region');
|
|
146
|
-
break;
|
|
147
|
-
case 'openai':
|
|
148
|
-
existingOrNew();
|
|
149
|
-
need('serviceAccountName');
|
|
150
|
-
break;
|
|
151
117
|
}
|
|
152
118
|
return missing;
|
|
153
119
|
}
|
|
154
120
|
export function selectedIntegrations(root) {
|
|
155
121
|
const setup = readProjectSection(root, 'setup');
|
|
156
122
|
validateSetupPlan(setup);
|
|
157
|
-
return INTEGRATION_PROVIDERS.filter((id) => setup.products.includes(id)
|
|
123
|
+
return INTEGRATION_PROVIDERS.filter((id) => setup.products.includes(id));
|
|
158
124
|
}
|
|
159
125
|
export function providerConfigurationTemplate(products, name) {
|
|
160
126
|
const templates = {
|
|
161
|
-
neon: { name, organizationId: '', region: '', database: 'app', role: 'app_owner' },
|
|
162
|
-
clerk: { name, workspaceId: '', environment: 'development' },
|
|
163
|
-
resend: { domain: '' },
|
|
164
127
|
stripe: { accountId: '', mode: 'test' },
|
|
165
128
|
revenuecat: products.includes('expo')
|
|
166
129
|
? { name, bundleId: '', packageName: '' }
|
|
167
130
|
: { name, stripeAccountId: '' },
|
|
168
|
-
sentry: {
|
|
169
|
-
name,
|
|
170
|
-
organization: '',
|
|
171
|
-
team: '',
|
|
172
|
-
project: name,
|
|
173
|
-
platform: products.includes('next') || products.includes('vinext') ? 'javascript-nextjs' : 'node',
|
|
174
|
-
},
|
|
175
|
-
posthog: { name, organizationId: '', region: '' },
|
|
176
|
-
openai: { name, serviceAccountName: 'anhedral-runtime' },
|
|
177
131
|
};
|
|
178
132
|
return {
|
|
179
133
|
schemaVersion: 1,
|
|
180
|
-
providers: Object.fromEntries(INTEGRATION_PROVIDERS.filter((id) => products.includes(id)
|
|
134
|
+
providers: Object.fromEntries(INTEGRATION_PROVIDERS.filter((id) => products.includes(id)).map((id) => [id, templates[id]])),
|
|
181
135
|
};
|
|
182
136
|
}
|