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
|
@@ -1,238 +1,101 @@
|
|
|
1
1
|
import { readProjectSection, writeProjectSection, hasProjectSection } from '../project-config.js';
|
|
2
|
-
import { STACK_DEPENDENCIES, WORKSPACE_NODE_ENGINE,
|
|
2
|
+
import { OPENNEXT_GLOB_VERSION, STACK_DEPENDENCIES, WORKSPACE_NODE_ENGINE, PACKAGE_MANAGER, } from '../dependencies.js';
|
|
3
3
|
import { writeDependencyAudit } from '../dependency-patches.js';
|
|
4
|
-
import { usesVoidSelection } from '../runtime-policy.js';
|
|
5
|
-
import { VOID_NODE_ENGINE } from '../void.js';
|
|
6
4
|
import { setPnpmPolicy } from '../pnpm-policy.js';
|
|
7
|
-
import { BOOTSTRAP_COMMAND } from '../registry/bootstrap.js';
|
|
8
5
|
import { appendGitignore } from '../util.js';
|
|
9
|
-
import { PACKAGE_MANAGER } from '../dependencies.js';
|
|
10
6
|
import { createSetupPlan } from '../capabilities.js';
|
|
11
|
-
import { json, put,
|
|
12
|
-
import { writeSetupDocumentation
|
|
7
|
+
import { json, put, patchPackage } from './files.js';
|
|
8
|
+
import { writeSetupDocumentation } from './documentation.js';
|
|
13
9
|
import { writeStackDocumentation } from './stack-documentation.js';
|
|
14
10
|
import { writeEnvironmentExample } from './environment.js';
|
|
15
11
|
import { providerConfigurationTemplate } from '../providers/config.js';
|
|
16
|
-
import { existsSync, readdirSync, rmSync } from 'node:fs';
|
|
17
|
-
import path from 'node:path';
|
|
18
|
-
function securityOverrides(options) {
|
|
19
|
-
const has = (value) => options.products.includes(value);
|
|
20
|
-
return {
|
|
21
|
-
...(has('wxt')
|
|
22
|
-
? {
|
|
23
|
-
'@wxt-dev/module-react>@vitejs/plugin-react': SECURITY_OVERRIDE_DEPENDENCIES['@vitejs/plugin-react'],
|
|
24
|
-
}
|
|
25
|
-
: {}),
|
|
26
|
-
...(has('next') || has('vinext')
|
|
27
|
-
? { 'sharp@<0.35.5': SECURITY_OVERRIDE_DEPENDENCIES.sharp }
|
|
28
|
-
: {}),
|
|
29
|
-
...(options.products.some((product) => ['vinext', 'next', 'expo', 'electron', 'wxt', 'neon', 'd1'].includes(product))
|
|
30
|
-
? { 'source-map-js@<1.2.2': SECURITY_OVERRIDE_DEPENDENCIES['source-map-js'] }
|
|
31
|
-
: {}),
|
|
32
|
-
...(has('next') && options.hosting === 'cloudflare'
|
|
33
|
-
? {
|
|
34
|
-
'glob@>=10.2.0 <10.5.0': GLOB_10_OVERRIDE_VERSION,
|
|
35
|
-
'glob@>=11.0.0 <11.1.0': GLOB_11_OVERRIDE_VERSION,
|
|
36
|
-
}
|
|
37
|
-
: {}),
|
|
38
|
-
...(has('wxt')
|
|
39
|
-
? {
|
|
40
|
-
'shell-quote@<1.12.0': SECURITY_OVERRIDE_DEPENDENCIES['shell-quote'],
|
|
41
|
-
'tmp@<0.2.7': SECURITY_OVERRIDE_DEPENDENCIES.tmp,
|
|
42
|
-
'adm-zip@<0.6.1': SECURITY_OVERRIDE_DEPENDENCIES['adm-zip'],
|
|
43
|
-
}
|
|
44
|
-
: {}),
|
|
45
|
-
'baseline-browser-mapping@<2.11.0': SECURITY_OVERRIDE_DEPENDENCIES['baseline-browser-mapping'],
|
|
46
|
-
'browserslist@<4.28.7': SECURITY_OVERRIDE_DEPENDENCIES.browserslist,
|
|
47
|
-
...(((has('next') || has('vinext')) && options.hosting === 'cloudflare') ||
|
|
48
|
-
has('hono') ||
|
|
49
|
-
has('electron') ||
|
|
50
|
-
has('wxt')
|
|
51
|
-
? { 'esbuild@<0.25.0': SECURITY_OVERRIDE_DEPENDENCIES.esbuild }
|
|
52
|
-
: {}),
|
|
53
|
-
'brace-expansion@<2': BRACE_EXPANSION_1_OVERRIDE_VERSION,
|
|
54
|
-
'brace-expansion@>=2 <3': BRACE_EXPANSION_2_OVERRIDE_VERSION,
|
|
55
|
-
'brace-expansion@>=4 <5.0.12': BRACE_EXPANSION_5_OVERRIDE_VERSION,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function writeTurboConfiguration(root, registry) {
|
|
59
|
-
const turbo = existsSync(path.join(root, 'turbo.json'))
|
|
60
|
-
? readJson(root, 'turbo.json')
|
|
61
|
-
: { tasks: {} };
|
|
62
|
-
turbo.$schema = 'https://turbo.build/schema.json';
|
|
63
|
-
turbo.globalDependencies = [
|
|
64
|
-
...new Set([
|
|
65
|
-
...(turbo.globalDependencies ?? []),
|
|
66
|
-
'**/.env',
|
|
67
|
-
'**/.env.*',
|
|
68
|
-
'**/.dev.vars',
|
|
69
|
-
'**/.dev.vars.*',
|
|
70
|
-
]),
|
|
71
|
-
];
|
|
72
|
-
turbo.globalEnv = [
|
|
73
|
-
...new Set([
|
|
74
|
-
...(turbo.globalEnv ?? []),
|
|
75
|
-
'VOID_CLOUDFLARE_DEPLOY_BUILD',
|
|
76
|
-
...(registry.items.some(({ name }) => name === 'expo') ? ['EXPO_PUBLIC_API_URL'] : []),
|
|
77
|
-
...(registry.items.some(({ name }) => name === 'next') &&
|
|
78
|
-
registry.items.some(({ name }) => name === 'hono')
|
|
79
|
-
? ['API_URL', 'API_ACCESS_CLIENT_ID', 'API_ACCESS_CLIENT_SECRET']
|
|
80
|
-
: []),
|
|
81
|
-
'npm_execpath',
|
|
82
|
-
...registry.items.flatMap((item) => item.environment),
|
|
83
|
-
]),
|
|
84
|
-
].sort();
|
|
85
|
-
turbo.tasks = {
|
|
86
|
-
...turbo.tasks,
|
|
87
|
-
dev: { ...turbo.tasks.dev, cache: false, persistent: true },
|
|
88
|
-
lint: { ...turbo.tasks.lint, dependsOn: ['^lint'] },
|
|
89
|
-
typecheck: { ...turbo.tasks.typecheck, dependsOn: ['^typecheck'] },
|
|
90
|
-
test: { dependsOn: ['^build'], outputs: ['coverage/**'] },
|
|
91
|
-
'db:generate': { cache: false },
|
|
92
|
-
'db:migrate': {
|
|
93
|
-
cache: false,
|
|
94
|
-
passThroughEnv: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
|
|
95
|
-
},
|
|
96
|
-
build: {
|
|
97
|
-
...turbo.tasks.build,
|
|
98
|
-
dependsOn: [...new Set(['^build', ...(turbo.tasks.build?.dependsOn ?? [])])],
|
|
99
|
-
outputs: [
|
|
100
|
-
'.next/**',
|
|
101
|
-
'!.next/cache/**',
|
|
102
|
-
'!.next/dev/**',
|
|
103
|
-
'.open-next/**',
|
|
104
|
-
'dist/**',
|
|
105
|
-
'.output/**',
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
json(root, 'turbo.json', turbo);
|
|
110
|
-
}
|
|
111
12
|
export function writeStandardRoot(root, options, registry, updating = false) {
|
|
112
|
-
const has = (value) => options.products.includes(value);
|
|
113
|
-
const existing = readJson(root, 'package.json');
|
|
114
13
|
patchPackage(root, 'package.json', {
|
|
115
14
|
name: options.name,
|
|
116
15
|
private: true,
|
|
117
16
|
packageManager: PACKAGE_MANAGER,
|
|
118
|
-
engines: {
|
|
119
|
-
node: usesVoidSelection(options.products, options.hosting)
|
|
120
|
-
? VOID_NODE_ENGINE
|
|
121
|
-
: WORKSPACE_NODE_ENGINE,
|
|
122
|
-
},
|
|
17
|
+
engines: { node: WORKSPACE_NODE_ENGINE },
|
|
123
18
|
scripts: {
|
|
124
19
|
dev: 'turbo dev',
|
|
125
|
-
build: 'turbo build',
|
|
126
|
-
...((has('next') || has('vinext')) && options.hosting === 'cloudflare'
|
|
127
|
-
? { 'build:worker': 'pnpm --dir apps/web run build:worker' }
|
|
128
|
-
: {}),
|
|
20
|
+
build: 'turbo build --concurrency=1',
|
|
129
21
|
lint: 'turbo lint',
|
|
130
22
|
typecheck: 'turbo typecheck',
|
|
131
23
|
test: 'turbo test',
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
'db:generate': 'turbo run db:generate --filter=@workspace/db',
|
|
135
|
-
'db:migrate': 'turbo run db:migrate --filter=@workspace/db',
|
|
136
|
-
}
|
|
137
|
-
: {}),
|
|
24
|
+
'db:generate': 'turbo run db:generate --filter=@workspace/db',
|
|
25
|
+
'db:migrate': 'turbo run db:migrate --filter=@workspace/db',
|
|
138
26
|
audit: 'node scripts/audit.mjs',
|
|
139
27
|
'audit:full': 'fallow --fail-on-issues',
|
|
140
28
|
'audit:deps': 'node scripts/audit-deps.mjs',
|
|
141
|
-
check:
|
|
142
|
-
},
|
|
143
|
-
devDependencies: { turbo: STACK_DEPENDENCIES['turbo'], fallow: STACK_DEPENDENCIES['fallow'] },
|
|
144
|
-
// Upstream starter lockfiles can retain vulnerable transitive versions. Keep fixes within compatible majors.
|
|
145
|
-
pnpm: {
|
|
146
|
-
...existing.pnpm,
|
|
147
|
-
overrides: { ...existing.pnpm?.overrides, ...securityOverrides(options) },
|
|
29
|
+
check: 'pnpm lint && pnpm typecheck && pnpm run audit && pnpm audit:deps && pnpm test && pnpm build',
|
|
148
30
|
},
|
|
31
|
+
devDependencies: { turbo: STACK_DEPENDENCIES.turbo, fallow: STACK_DEPENDENCIES.fallow },
|
|
149
32
|
});
|
|
150
33
|
writeDependencyAudit(root, updating);
|
|
151
34
|
put(root, 'scripts/audit.mjs', `import { spawnSync } from 'node:child_process';
|
|
152
|
-
const base = process.env.AUDIT_BASE;
|
|
153
|
-
const hasBase = base || ['origin/main', 'main'].find((ref) => spawnSync('git', ['rev-parse', '--verify', ref], { stdio: 'ignore' }).status === 0);
|
|
154
|
-
const args = hasBase ? ['exec', 'fallow', 'audit', '--base', hasBase] : ['exec', 'fallow', '--fail-on-issues'];
|
|
155
35
|
const entry = process.env.npm_execpath;
|
|
156
36
|
if (!entry) throw new Error('Run this check through pnpm run audit.');
|
|
157
|
-
const result = spawnSync(process.execPath, [entry,
|
|
37
|
+
const result = spawnSync(process.execPath, [entry, 'exec', 'fallow', '--fail-on-issues'], { stdio: 'inherit', shell: false });
|
|
158
38
|
if (result.error) throw result.error;
|
|
159
39
|
process.exitCode = result.status ?? 1;
|
|
160
40
|
`);
|
|
161
41
|
json(root, '.fallowrc.json', {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
entry: [
|
|
165
|
-
'apps/*/void.config.ts',
|
|
166
|
-
'apps/*/env.ts',
|
|
167
|
-
'apps/*/src/void-entry.ts',
|
|
168
|
-
'apps/*/crons/**/*.{ts,mts,js,mjs}',
|
|
169
|
-
...(has('electron') ? ['apps/desktop/src/main/preload.cts'] : []),
|
|
170
|
-
],
|
|
171
|
-
// Expo web export and NativeWind load these runtime dependencies dynamically.
|
|
172
|
-
...(has('expo')
|
|
173
|
-
? {
|
|
174
|
-
ignoreDependencies: [
|
|
175
|
-
'react-native-web',
|
|
176
|
-
'react-native-css-interop',
|
|
177
|
-
'react-native-reanimated',
|
|
178
|
-
'react-native-worklets',
|
|
179
|
-
],
|
|
180
|
-
}
|
|
181
|
-
: {}),
|
|
42
|
+
publicPackages: ['@workspace/native-ui'],
|
|
43
|
+
ignoreDependencies: ['react-native-reanimated', 'react-native-worklets'],
|
|
182
44
|
ignorePatterns: [
|
|
183
|
-
// Maintained bundled tooling is regression-tested in the CLI repository;
|
|
184
|
-
// app audits cover customer code without re-auditing vendored CLI helpers.
|
|
185
45
|
'scripts/audit.mjs',
|
|
186
46
|
'scripts/audit-deps.mjs',
|
|
187
|
-
'scripts/void-migrations.mjs',
|
|
188
|
-
'scripts/prepare-void-migrations.mjs',
|
|
189
|
-
'**/next-env.d.ts',
|
|
190
|
-
'**/.next/**',
|
|
191
|
-
'**/.open-next/**',
|
|
192
|
-
'**/.vinext/**',
|
|
193
47
|
'**/.wrangler/**',
|
|
194
48
|
'**/dist/**',
|
|
49
|
+
'**/.next/**',
|
|
50
|
+
'**/.open-next/**',
|
|
195
51
|
'**/worker-configuration.d.ts',
|
|
196
|
-
'**/cloudflare-env.d.ts',
|
|
197
52
|
],
|
|
198
53
|
});
|
|
199
|
-
|
|
54
|
+
json(root, 'turbo.json', {
|
|
55
|
+
$schema: 'https://turbo.build/schema.json',
|
|
56
|
+
globalDependencies: ['**/.env', '**/.env.*', '**/.dev.vars', '**/.dev.vars.*'],
|
|
57
|
+
globalEnv: [
|
|
58
|
+
...new Set(['npm_execpath', ...registry.items.flatMap((item) => item.environment)]),
|
|
59
|
+
].sort(),
|
|
60
|
+
tasks: {
|
|
61
|
+
dev: { cache: false, persistent: true },
|
|
62
|
+
lint: { dependsOn: ['^lint'] },
|
|
63
|
+
typecheck: { dependsOn: ['^typecheck'] },
|
|
64
|
+
test: { dependsOn: ['^build'], outputs: ['coverage/**'] },
|
|
65
|
+
'db:generate': { cache: false },
|
|
66
|
+
'db:migrate': {
|
|
67
|
+
cache: false,
|
|
68
|
+
passThroughEnv: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
|
|
69
|
+
},
|
|
70
|
+
build: {
|
|
71
|
+
dependsOn: ['^build'],
|
|
72
|
+
outputs: ['dist/**', '.open-next/**', '.next/**', '!.next/cache/**'],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
200
76
|
setPnpmPolicy(root, {
|
|
201
77
|
...(!updating ? { packages: ['apps/*', 'packages/*'] } : {}),
|
|
78
|
+
// OpenNext's node-minify dependency pins the vulnerable glob CLI.
|
|
79
|
+
overrides: {
|
|
80
|
+
'@node-minify/core>glob': OPENNEXT_GLOB_VERSION,
|
|
81
|
+
// Expo CLI's two schema consumers use APIs supported by the patched Zod release.
|
|
82
|
+
'@expo/cli>zod': STACK_DEPENDENCIES.zod,
|
|
83
|
+
'miniflare>undici': STACK_DEPENDENCIES.undici,
|
|
84
|
+
},
|
|
202
85
|
sharedWorkspaceLockfile: true,
|
|
203
86
|
allowBuilds: undefined,
|
|
204
|
-
onlyBuiltDependencies: [
|
|
205
|
-
'esbuild',
|
|
206
|
-
'sharp',
|
|
207
|
-
'unrs-resolver',
|
|
208
|
-
'workerd',
|
|
209
|
-
...(has('electron') ? ['electron'] : []),
|
|
210
|
-
],
|
|
87
|
+
onlyBuiltDependencies: ['esbuild', 'sharp', 'unrs-resolver', 'workerd'],
|
|
211
88
|
});
|
|
212
|
-
// Upstream app/package lockfiles would create competing dependency authorities.
|
|
213
|
-
if (!updating) {
|
|
214
|
-
for (const parent of ['apps', 'packages']) {
|
|
215
|
-
const directory = path.join(root, parent);
|
|
216
|
-
if (!existsSync(directory))
|
|
217
|
-
continue;
|
|
218
|
-
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
219
|
-
if (!entry.isDirectory())
|
|
220
|
-
continue;
|
|
221
|
-
for (const lock of ['pnpm-lock.yaml', 'package-lock.json', 'yarn.lock'])
|
|
222
|
-
rmSync(path.join(directory, entry.name, lock), { force: true });
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
for (const lock of ['package-lock.json', 'yarn.lock'])
|
|
226
|
-
rmSync(path.join(root, lock), { force: true });
|
|
227
|
-
}
|
|
228
89
|
appendGitignore(root, [
|
|
229
90
|
'node_modules/',
|
|
91
|
+
'dist/',
|
|
92
|
+
'.output/',
|
|
93
|
+
'.next/',
|
|
230
94
|
'.open-next/',
|
|
231
|
-
'
|
|
95
|
+
'*.tsbuildinfo',
|
|
96
|
+
'.turbo/',
|
|
97
|
+
'.expo/',
|
|
232
98
|
'.wrangler/',
|
|
233
|
-
'.void/',
|
|
234
|
-
'.void-wrangler.jsonc',
|
|
235
|
-
'/apps/*/db/migrations/',
|
|
236
99
|
'.dev.vars',
|
|
237
100
|
'.dev.vars.*',
|
|
238
101
|
'!.dev.vars.example',
|
|
@@ -242,6 +105,7 @@ process.exitCode = result.status ?? 1;
|
|
|
242
105
|
'.fallow/',
|
|
243
106
|
'.anhedral/',
|
|
244
107
|
'.anhedral-audit-report.json',
|
|
108
|
+
'worker-configuration.d.ts',
|
|
245
109
|
]);
|
|
246
110
|
writeEnvironmentExample(root, registry);
|
|
247
111
|
writeStackDocumentation(root, registry);
|
|
@@ -249,13 +113,8 @@ process.exitCode = result.status ?? 1;
|
|
|
249
113
|
schemaVersion: 1,
|
|
250
114
|
standard: 'anhedral-application-stack',
|
|
251
115
|
products: options.products,
|
|
252
|
-
hosting:
|
|
253
|
-
bootstrap:
|
|
254
|
-
? readProjectSection(root, 'standard').bootstrap
|
|
255
|
-
: {
|
|
256
|
-
command: BOOTSTRAP_COMMAND.join(' '),
|
|
257
|
-
upstreamPackageManager: existing.packageManager,
|
|
258
|
-
},
|
|
116
|
+
hosting: 'cloudflare',
|
|
117
|
+
bootstrap: { command: 'anhedral init', source: 'bundled' },
|
|
259
118
|
status: 'starter',
|
|
260
119
|
resourcesProvisioned: false,
|
|
261
120
|
});
|
package/dist/service-deletion.js
CHANGED
|
@@ -29,7 +29,7 @@ function fingerprint(root, service) {
|
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
31
|
async function assertDeletionScope(root, service, request) {
|
|
32
|
-
if (
|
|
32
|
+
if (service.kind !== 'd1' ||
|
|
33
33
|
service.ownership !== 'created' ||
|
|
34
34
|
!service.name ||
|
|
35
35
|
service.applications.length > 1)
|
|
@@ -2,16 +2,13 @@ import { inspectApplication } from './project-inspector.js';
|
|
|
2
2
|
import { readApplication } from './project-state.js';
|
|
3
3
|
const kinds = {
|
|
4
4
|
D1: 'd1',
|
|
5
|
-
KV: 'kv',
|
|
6
5
|
R2: 'r2',
|
|
7
|
-
'Queue producer': 'queue',
|
|
8
|
-
'Queue consumer': 'queue',
|
|
9
6
|
};
|
|
10
7
|
export function unboundResourceSelectors(inspection) {
|
|
11
8
|
return inspection.cloudflareResources.data
|
|
12
9
|
.filter((resource) => !inspection.configuration.data.bindings.some((binding) => kinds[binding.kind] === resource.kind &&
|
|
13
10
|
(binding.resourceId === resource.id ||
|
|
14
|
-
(
|
|
11
|
+
(resource.kind === 'r2' && binding.resourceId === resource.name))))
|
|
15
12
|
.map((resource) => `receipt:${resource.kind}:${resource.id}`);
|
|
16
13
|
}
|
|
17
14
|
export function resolveService(root, key) {
|
|
@@ -41,14 +38,10 @@ export function resolveService(root, key) {
|
|
|
41
38
|
const record = inspection.cloudflareResources.data.find((item) => key === `receipt:${item.kind}:${item.id}`);
|
|
42
39
|
const kind = binding ? kinds[binding.kind] : record?.kind;
|
|
43
40
|
const id = binding?.resourceId ?? record?.id;
|
|
44
|
-
if (!kind ||
|
|
45
|
-
!['d1', 'kv', 'r2', 'queue'].includes(kind) ||
|
|
46
|
-
!id ||
|
|
47
|
-
!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,254}$/.test(id))
|
|
41
|
+
if (!kind || !['d1', 'r2'].includes(kind) || !id || !/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,254}$/.test(id))
|
|
48
42
|
throw new Error('This service has no supported provider resource identity.');
|
|
49
43
|
const receipt = record ??
|
|
50
|
-
inspection.cloudflareResources.data.find((item) => item.kind === kind &&
|
|
51
|
-
(item.id === id || (['r2', 'queue'].includes(kind) && item.name === id)));
|
|
44
|
+
inspection.cloudflareResources.data.find((item) => item.kind === kind && (item.id === id || (kind === 'r2' && item.name === id)));
|
|
52
45
|
const references = inspection.configuration.data.bindings.filter((item) => kinds[item.kind] === kind &&
|
|
53
46
|
(item.resourceId === id ||
|
|
54
47
|
(receipt && [receipt.name, receipt.id].includes(item.resourceId ?? ''))));
|
|
@@ -72,7 +65,7 @@ export function serviceCapabilities(kind) {
|
|
|
72
65
|
return {
|
|
73
66
|
status: true,
|
|
74
67
|
metrics: kind === 'd1' || kind === 'worker',
|
|
75
|
-
data: kind === 'd1' || kind === '
|
|
76
|
-
delete: kind === 'd1'
|
|
68
|
+
data: kind === 'd1' || kind === 'r2',
|
|
69
|
+
delete: kind === 'd1',
|
|
77
70
|
};
|
|
78
71
|
}
|
package/dist/service-model.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const SERVICE_TOOL_ACTIONS: {
|
|
|
7
7
|
readonly delete_service: "delete";
|
|
8
8
|
};
|
|
9
9
|
export type ServiceAction = (typeof SERVICE_TOOL_ACTIONS)[keyof typeof SERVICE_TOOL_ACTIONS];
|
|
10
|
-
export type ServiceKind = 'worker' | 'd1' | '
|
|
10
|
+
export type ServiceKind = 'worker' | 'd1' | 'r2';
|
|
11
11
|
export interface ServiceDescriptor {
|
|
12
12
|
key: string;
|
|
13
13
|
kind: ServiceKind;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { resolveIntegrationService, integrationRequest, observeIntegrationService,
|
|
2
|
-
import { neonReadConnection, listNeonTables, browseNeonData } from './neon-service-data.js';
|
|
3
|
-
import { vercelApplicationStatus, vercelServiceMetrics } from './vercel.js';
|
|
1
|
+
import { resolveIntegrationService, integrationRequest, observeIntegrationService, } from './integration-service-readers.js';
|
|
4
2
|
import { browseR2Objects } from './r2-service-data.js';
|
|
5
|
-
import { inspectApplication } from './project-inspector.js';
|
|
6
3
|
import { readApplication, defaultRunner, targetDirectory } from './project-state.js';
|
|
7
4
|
import { cloudflareRequest } from './cloudflare.js';
|
|
8
5
|
import { resolveService } from './service-descriptor.js';
|
|
@@ -11,7 +8,6 @@ const requestFor = async (root, analytics) => {
|
|
|
11
8
|
const project = readApplication(root);
|
|
12
9
|
return cloudflareRequest(project, targetDirectory(root, project.targets[0]), defaultRunner, { ...process.env, ANHEDRAL_COMMAND_TIMEOUT_MS: '10000' }, { analytics, timeoutMs: 10000 });
|
|
13
10
|
};
|
|
14
|
-
const vercelRunner = (command, args, cwd, env, input) => defaultRunner(command, args, cwd, { ...env, ANHEDRAL_COMMAND_TIMEOUT_MS: '30000' }, input);
|
|
15
11
|
/** Shared operations; transports decide how private results are presented. */
|
|
16
12
|
export async function serviceOperation(root, action, key, options = {}, context = {}) {
|
|
17
13
|
if (key.startsWith('provider:') || key.startsWith('integration:')) {
|
|
@@ -19,34 +15,8 @@ export async function serviceOperation(root, action, key, options = {}, context
|
|
|
19
15
|
const api = integrationRequest(service);
|
|
20
16
|
if (action === 'status')
|
|
21
17
|
return { status: await observeIntegrationService(service, api) };
|
|
22
|
-
if (action === 'metrics')
|
|
23
|
-
return { metrics: await posthogServiceMetrics(service, api, options.hours ?? 24) };
|
|
24
|
-
if (action === 'tables' && service.provider === 'neon')
|
|
25
|
-
return { tables: await listNeonTables(await neonReadConnection(service, api)) };
|
|
26
|
-
if (action === 'data' && service.provider === 'neon')
|
|
27
|
-
return {
|
|
28
|
-
data: await browseNeonData(await neonReadConnection(service, api), options.table ?? '', options.offset ?? 0),
|
|
29
|
-
};
|
|
30
18
|
throw new Error('This integration does not support that operation.');
|
|
31
19
|
}
|
|
32
|
-
if (key.startsWith('target:vercel:')) {
|
|
33
|
-
if (!inspectApplication(root).targets.data.some((target) => key === `target:${target.provider}:${target.id}` && target.provider === 'vercel'))
|
|
34
|
-
throw new Error('Choose a validated Vercel target.');
|
|
35
|
-
if (action === 'metrics')
|
|
36
|
-
return { metrics: await vercelServiceMetrics(root, options.hours ?? 24, vercelRunner) };
|
|
37
|
-
if (action !== 'status')
|
|
38
|
-
throw new Error('Unsupported Vercel operation.');
|
|
39
|
-
const status = await vercelApplicationStatus(root, true, vercelRunner);
|
|
40
|
-
return {
|
|
41
|
-
status: {
|
|
42
|
-
state: 'available',
|
|
43
|
-
fetchedAt: new Date().toISOString(),
|
|
44
|
-
message: status.activeRecordedVersion
|
|
45
|
-
? 'Provider confirmed the recorded deployment is active. Application health is separate.'
|
|
46
|
-
: 'Provider project verified. The recorded deployment is not confirmed active.',
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
20
|
const service = resolveService(root, key);
|
|
51
21
|
if (service.kind === 'r2' && action === 'tables')
|
|
52
22
|
return { tables: ['objects'] };
|
|
@@ -61,7 +31,7 @@ export async function serviceOperation(root, action, key, options = {}, context
|
|
|
61
31
|
if (action === 'metrics')
|
|
62
32
|
return { metrics: await readServiceMetrics(service, request, options.hours ?? 24) };
|
|
63
33
|
if (action === 'tables')
|
|
64
|
-
return { tables:
|
|
34
|
+
return { tables: await listServiceTables(service, request) };
|
|
65
35
|
if (action === 'data')
|
|
66
36
|
return {
|
|
67
37
|
data: await browseServiceData(service, request, options.table ?? '', options.offset ?? 0, 25, options.cursor),
|
package/dist/service-readers.js
CHANGED
|
@@ -3,9 +3,7 @@ export const serviceEndpoint = (service) => {
|
|
|
3
3
|
const id = encodeURIComponent(service.kind === 'r2' ? (service.name ?? service.id) : service.id);
|
|
4
4
|
return {
|
|
5
5
|
d1: `/d1/database/${id}`,
|
|
6
|
-
kv: `/storage/kv/namespaces/${id}`,
|
|
7
6
|
r2: `/r2/buckets/${id}`,
|
|
8
|
-
queue: `/queues/${id}`,
|
|
9
7
|
worker: `/workers/scripts/${id}/settings`,
|
|
10
8
|
}[service.kind];
|
|
11
9
|
};
|
|
@@ -18,13 +16,7 @@ export async function observeService(service, request) {
|
|
|
18
16
|
const fetchedAt = new Date().toISOString();
|
|
19
17
|
try {
|
|
20
18
|
const value = record((await request('GET', serviceEndpoint(service))).result);
|
|
21
|
-
const id = service.kind === 'd1'
|
|
22
|
-
? value.uuid
|
|
23
|
-
: service.kind === 'kv'
|
|
24
|
-
? value.id
|
|
25
|
-
: service.kind === 'queue'
|
|
26
|
-
? value.queue_id
|
|
27
|
-
: undefined;
|
|
19
|
+
const id = service.kind === 'd1' ? value.uuid : undefined;
|
|
28
20
|
if (service.kind !== 'worker' && service.kind !== 'r2' && id !== service.id)
|
|
29
21
|
throw new Error('Provider resource identity differs from the source.');
|
|
30
22
|
const name = value.name ?? value.title ?? value.queue_name;
|
|
@@ -100,29 +92,6 @@ export async function browseServiceData(service, request, table, offset = 0, lim
|
|
|
100
92
|
throw new Error('Choose a bounded data page.');
|
|
101
93
|
if (cursor !== undefined && (cursor.length > 4096 || /[\x00-\x1f\x7f]/.test(cursor)))
|
|
102
94
|
throw new Error('Choose a bounded metadata cursor.');
|
|
103
|
-
if (service.kind === 'kv') {
|
|
104
|
-
if (offset !== 0 || table !== 'keys')
|
|
105
|
-
throw new Error('KV metadata uses cursors; key values are not read.');
|
|
106
|
-
const query = new URLSearchParams({ limit: String(limit), ...(cursor ? { cursor } : {}) });
|
|
107
|
-
const response = await request('GET', `${serviceEndpoint(service)}/keys?${query}`);
|
|
108
|
-
if (!Array.isArray(response.result) || response.result.length > limit)
|
|
109
|
-
throw new Error('Unsupported KV metadata.');
|
|
110
|
-
return {
|
|
111
|
-
fetchedAt: new Date().toISOString(),
|
|
112
|
-
columns: ['Key', 'Expiration'],
|
|
113
|
-
rows: response.result.map((item) => {
|
|
114
|
-
const key = record(item);
|
|
115
|
-
return [
|
|
116
|
-
typeof key.name === 'string' ? key.name.slice(0, 256) : null,
|
|
117
|
-
typeof key.expiration === 'number' ? key.expiration : null,
|
|
118
|
-
];
|
|
119
|
-
}),
|
|
120
|
-
offset,
|
|
121
|
-
hasMore: Boolean(response.result_info?.cursor),
|
|
122
|
-
...(response.result_info?.cursor ? { nextCursor: response.result_info.cursor } : {}),
|
|
123
|
-
masked: true,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
95
|
if (cursor !== undefined)
|
|
127
96
|
throw new Error('Database pages use offsets, not metadata cursors.');
|
|
128
97
|
if (service.kind !== 'd1' ||
|
package/dist/services-command.js
CHANGED
|
@@ -19,7 +19,7 @@ export async function runServiceCommand(root, input) {
|
|
|
19
19
|
const inspection = inspectApplication(root);
|
|
20
20
|
const keys = [
|
|
21
21
|
...inspection.setupProviders.data
|
|
22
|
-
.filter((provider) => !['cloudflare', '
|
|
22
|
+
.filter((provider) => !['cloudflare', 'expo'].includes(provider.id))
|
|
23
23
|
.map((provider) => `provider:${provider.id}`),
|
|
24
24
|
...inspection.integrations.data.flatMap((provider) => provider.operations.map((operation) => `integration:${provider.provider}:${operation.operation}`)),
|
|
25
25
|
...inspection.targets.data.map((target) => `target:${target.provider}:${target.id}`),
|
|
@@ -36,18 +36,12 @@ export async function runServiceCommand(root, input) {
|
|
|
36
36
|
provider: service.provider,
|
|
37
37
|
capabilities: {
|
|
38
38
|
status: true,
|
|
39
|
-
metrics:
|
|
40
|
-
data:
|
|
39
|
+
metrics: false,
|
|
40
|
+
data: false,
|
|
41
41
|
delete: false,
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
if (key.startsWith('target:vercel:'))
|
|
46
|
-
return {
|
|
47
|
-
key,
|
|
48
|
-
provider: 'vercel',
|
|
49
|
-
capabilities: { status: true, metrics: true, data: false, delete: false },
|
|
50
|
-
};
|
|
51
45
|
const service = resolveService(root, key);
|
|
52
46
|
return { ...service, capabilities: serviceCapabilities(service.kind) };
|
|
53
47
|
}
|