anhedral 0.12.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.
Files changed (184) hide show
  1. package/README.md +35 -172
  2. package/assets/patches/audit-deps.mjs +12 -2
  3. package/assets/ui/LICENSE.shadcn +21 -0
  4. package/assets/ui/UPSTREAM.json +33 -0
  5. package/assets/ui/native/button.tsx +85 -0
  6. package/assets/ui/native/card.tsx +33 -0
  7. package/assets/ui/native/dialog.tsx +75 -0
  8. package/assets/ui/native/input.tsx +27 -0
  9. package/assets/ui/native/label.tsx +4 -0
  10. package/assets/ui/native/layout.tsx +26 -0
  11. package/assets/ui/native/text.tsx +20 -0
  12. package/assets/ui/native/theme-switcher.tsx +22 -0
  13. package/assets/ui/theme-storage.ts +25 -0
  14. package/assets/ui/theme.tsx +66 -0
  15. package/assets/ui/web/button.tsx +59 -0
  16. package/assets/ui/web/input.tsx +21 -0
  17. package/assets/ui/web/label.tsx +19 -0
  18. package/dist/capabilities.d.ts +5 -5
  19. package/dist/capabilities.js +3 -21
  20. package/dist/capability-contract.d.ts +3 -3
  21. package/dist/capability-contract.js +11 -39
  22. package/dist/cli-delivery.d.ts +1 -1
  23. package/dist/cli-delivery.js +5 -65
  24. package/dist/cli-output.js +3 -3
  25. package/dist/command-schema.js +35 -80
  26. package/dist/command.js +9 -11
  27. package/dist/delivery-evidence.d.ts +1 -1
  28. package/dist/delivery-evidence.js +7 -36
  29. package/dist/delivery.d.ts +2 -8
  30. package/dist/delivery.js +23 -102
  31. package/dist/dependencies.d.ts +12 -58
  32. package/dist/dependencies.js +67 -189
  33. package/dist/index.d.ts +1 -3
  34. package/dist/index.js +1 -3
  35. package/dist/inspector-model.d.ts +2 -2
  36. package/dist/integration-service-readers.d.ts +1 -2
  37. package/dist/integration-service-readers.js +3 -84
  38. package/dist/lifecycle-model.d.ts +1 -1
  39. package/dist/lifecycle-model.js +1 -1
  40. package/dist/mobile-delivery.d.ts +1 -1
  41. package/dist/mobile-delivery.js +4 -0
  42. package/dist/platforms/mobile.d.ts +1 -1
  43. package/dist/platforms/mobile.js +64 -114
  44. package/dist/platforms/web.d.ts +3 -0
  45. package/dist/platforms/web.js +299 -0
  46. package/dist/project-config.d.ts +1 -1
  47. package/dist/project-config.js +0 -1
  48. package/dist/project-inspector.js +5 -36
  49. package/dist/project-state.d.ts +1 -3
  50. package/dist/project-state.js +6 -86
  51. package/dist/provider-auth.js +3 -32
  52. package/dist/provider-readiness.d.ts +1 -1
  53. package/dist/provider-readiness.js +5 -24
  54. package/dist/providers/adapters.js +9 -178
  55. package/dist/providers/api.d.ts +1 -1
  56. package/dist/providers/api.js +3 -3
  57. package/dist/providers/config.js +2 -48
  58. package/dist/providers/definitions.d.ts +1 -204
  59. package/dist/providers/definitions.js +0 -85
  60. package/dist/providers/provision.d.ts +1 -1
  61. package/dist/providers/receipts.js +1 -11
  62. package/dist/providers/recovery-verification.js +1 -61
  63. package/dist/providers/runtime.js +15 -35
  64. package/dist/providers/state.js +1 -7
  65. package/dist/provision.d.ts +5 -13
  66. package/dist/provision.js +4 -80
  67. package/dist/readiness.d.ts +1 -1
  68. package/dist/readiness.js +3 -6
  69. package/dist/registry/add.js +11 -38
  70. package/dist/registry/bootstrap.d.ts +3 -2
  71. package/dist/registry/bootstrap.js +4 -13
  72. package/dist/registry/commands.js +8 -10
  73. package/dist/registry/context.js +0 -1
  74. package/dist/registry/options.js +8 -26
  75. package/dist/registry/resolve.d.ts +3 -2
  76. package/dist/registry/resolve.js +26 -82
  77. package/dist/registry/types.d.ts +2 -7
  78. package/dist/registry/usage.js +2 -2
  79. package/dist/runtime-policy.d.ts +0 -2
  80. package/dist/runtime-policy.js +0 -13
  81. package/dist/scaffold/api.js +10 -2
  82. package/dist/scaffold/auth.d.ts +1 -2
  83. package/dist/scaffold/auth.js +57 -116
  84. package/dist/scaffold/backend.d.ts +2 -0
  85. package/dist/scaffold/backend.js +39 -0
  86. package/dist/scaffold/billing-config.d.ts +1 -0
  87. package/dist/scaffold/billing-config.js +73 -0
  88. package/dist/scaffold/billing-contracts.d.ts +2 -0
  89. package/dist/scaffold/billing-contracts.js +48 -0
  90. package/dist/scaffold/billing-providers.d.ts +1 -0
  91. package/dist/scaffold/billing-providers.js +249 -0
  92. package/dist/scaffold/billing-schema.d.ts +1 -0
  93. package/dist/scaffold/billing-schema.js +34 -0
  94. package/dist/scaffold/billing-security.d.ts +1 -0
  95. package/dist/scaffold/billing-security.js +46 -0
  96. package/dist/scaffold/billing-server.d.ts +1 -0
  97. package/dist/scaffold/billing-server.js +139 -0
  98. package/dist/scaffold/billing-store.d.ts +1 -0
  99. package/dist/scaffold/billing-store.js +72 -0
  100. package/dist/scaffold/billing.d.ts +2 -0
  101. package/dist/scaffold/billing.js +208 -0
  102. package/dist/scaffold/bootstrap.d.ts +2 -3
  103. package/dist/scaffold/bootstrap.js +37 -43
  104. package/dist/scaffold/compose.js +2 -12
  105. package/dist/scaffold/database.d.ts +1 -1
  106. package/dist/scaffold/database.js +20 -111
  107. package/dist/scaffold/documentation.d.ts +0 -1
  108. package/dist/scaffold/documentation.js +22 -82
  109. package/dist/scaffold/expo-auth.d.ts +3 -0
  110. package/dist/scaffold/expo-auth.js +203 -0
  111. package/dist/scaffold/expo-billing.d.ts +3 -0
  112. package/dist/scaffold/expo-billing.js +257 -0
  113. package/dist/scaffold/expo-runtime.d.ts +3 -0
  114. package/dist/scaffold/expo-runtime.js +43 -0
  115. package/dist/scaffold/integrations.d.ts +1 -2
  116. package/dist/scaffold/integrations.js +9 -5
  117. package/dist/scaffold/managed-email.d.ts +3 -0
  118. package/dist/scaffold/managed-email.js +47 -0
  119. package/dist/scaffold/native-ui.d.ts +2 -0
  120. package/dist/scaffold/native-ui.js +69 -0
  121. package/dist/scaffold/password-reset.d.ts +1 -0
  122. package/dist/scaffold/password-reset.js +99 -0
  123. package/dist/scaffold/private-files.d.ts +2 -0
  124. package/dist/scaffold/private-files.js +78 -0
  125. package/dist/scaffold/stack-documentation.d.ts +0 -1
  126. package/dist/scaffold/stack-documentation.js +3 -49
  127. package/dist/scaffold/styling.d.ts +1 -1
  128. package/dist/scaffold/styling.js +20 -28
  129. package/dist/scaffold/web-billing.d.ts +2 -0
  130. package/dist/scaffold/web-billing.js +48 -0
  131. package/dist/scaffold/workspace.js +53 -189
  132. package/dist/service-deletion.js +1 -1
  133. package/dist/service-descriptor.js +5 -12
  134. package/dist/service-model.d.ts +1 -1
  135. package/dist/service-operations.js +2 -32
  136. package/dist/service-readers.js +1 -32
  137. package/dist/services-command.d.ts +1 -1
  138. package/dist/services-command.js +3 -9
  139. package/dist/ship.d.ts +3 -316
  140. package/dist/ship.js +13 -143
  141. package/dist/stack-registry.d.ts +2 -43
  142. package/dist/stack-registry.js +80 -308
  143. package/dist/standard.js +7 -14
  144. package/dist/version.d.ts +1 -1
  145. package/dist/version.js +1 -1
  146. package/docs/anhedral-stack.md +23 -0
  147. package/docs/assets/anhedral-stack-light.png +0 -0
  148. package/docs/assets/anhedral-stack.png +0 -0
  149. package/docs/software-factory.md +25 -499
  150. package/docs/stack-standard.md +48 -226
  151. package/docs/verification.md +433 -0
  152. package/package.json +22 -21
  153. package/dist/neon-service-data.d.ts +0 -8
  154. package/dist/neon-service-data.js +0 -117
  155. package/dist/platforms/desktop.d.ts +0 -2
  156. package/dist/platforms/desktop.js +0 -415
  157. package/dist/platforms/extension.d.ts +0 -2
  158. package/dist/platforms/extension.js +0 -328
  159. package/dist/scaffold/lint.d.ts +0 -4
  160. package/dist/scaffold/lint.js +0 -56
  161. package/dist/scaffold/neon-realtime.d.ts +0 -2
  162. package/dist/scaffold/neon-realtime.js +0 -97
  163. package/dist/scaffold/services.d.ts +0 -5
  164. package/dist/scaffold/services.js +0 -108
  165. package/dist/scaffold/stream.d.ts +0 -2
  166. package/dist/scaffold/stream.js +0 -114
  167. package/dist/scaffold/void.d.ts +0 -4
  168. package/dist/scaffold/void.js +0 -256
  169. package/dist/scaffold/web.d.ts +0 -2
  170. package/dist/scaffold/web.js +0 -128
  171. package/dist/vercel-project.d.ts +0 -101
  172. package/dist/vercel-project.js +0 -305
  173. package/dist/vercel.d.ts +0 -67
  174. package/dist/vercel.js +0 -581
  175. package/dist/vinext.d.ts +0 -2
  176. package/dist/vinext.js +0 -86
  177. package/dist/void-execution.d.ts +0 -10
  178. package/dist/void-execution.js +0 -94
  179. package/dist/void-migrations.d.ts +0 -6
  180. package/dist/void-migrations.js +0 -110
  181. package/dist/void-state.d.ts +0 -16
  182. package/dist/void-state.js +0 -65
  183. package/dist/void.d.ts +0 -3
  184. package/dist/void.js +0 -5
@@ -1,233 +1,101 @@
1
1
  import { readProjectSection, writeProjectSection, hasProjectSection } from '../project-config.js';
2
- import { STACK_DEPENDENCIES, WORKSPACE_NODE_ENGINE, SECURITY_OVERRIDE_DEPENDENCIES, GLOB_10_OVERRIDE_VERSION, GLOB_11_OVERRIDE_VERSION, BRACE_EXPANSION_1_OVERRIDE_VERSION, BRACE_EXPANSION_2_OVERRIDE_VERSION, BRACE_EXPANSION_5_OVERRIDE_VERSION, } from '../dependencies.js';
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, readJson, patchPackage, } from './files.js';
12
- import { writeSetupDocumentation, workerBuildSuffix } from './documentation.js';
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
- 'npm_execpath',
77
- ...registry.items.flatMap((item) => item.environment),
78
- ]),
79
- ].sort();
80
- turbo.tasks = {
81
- ...turbo.tasks,
82
- dev: { ...turbo.tasks.dev, cache: false, persistent: true },
83
- lint: { ...turbo.tasks.lint, dependsOn: ['^lint'] },
84
- typecheck: { ...turbo.tasks.typecheck, dependsOn: ['^typecheck'] },
85
- test: { dependsOn: ['^build'], outputs: ['coverage/**'] },
86
- 'db:generate': { cache: false },
87
- 'db:migrate': {
88
- cache: false,
89
- passThroughEnv: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
90
- },
91
- build: {
92
- ...turbo.tasks.build,
93
- dependsOn: [...new Set(['^build', ...(turbo.tasks.build?.dependsOn ?? [])])],
94
- outputs: [
95
- '.next/**',
96
- '!.next/cache/**',
97
- '!.next/dev/**',
98
- '.open-next/**',
99
- 'dist/**',
100
- '.output/**',
101
- ],
102
- },
103
- };
104
- json(root, 'turbo.json', turbo);
105
- }
106
12
  export function writeStandardRoot(root, options, registry, updating = false) {
107
- const has = (value) => options.products.includes(value);
108
- const existing = readJson(root, 'package.json');
109
13
  patchPackage(root, 'package.json', {
110
14
  name: options.name,
111
15
  private: true,
112
16
  packageManager: PACKAGE_MANAGER,
113
- engines: {
114
- node: usesVoidSelection(options.products, options.hosting)
115
- ? VOID_NODE_ENGINE
116
- : WORKSPACE_NODE_ENGINE,
117
- },
17
+ engines: { node: WORKSPACE_NODE_ENGINE },
118
18
  scripts: {
119
19
  dev: 'turbo dev',
120
- build: 'turbo build',
121
- ...((has('next') || has('vinext')) && options.hosting === 'cloudflare'
122
- ? { 'build:worker': 'pnpm --dir apps/web run build:worker' }
123
- : {}),
20
+ build: 'turbo build --concurrency=1',
124
21
  lint: 'turbo lint',
125
22
  typecheck: 'turbo typecheck',
126
23
  test: 'turbo test',
127
- ...(has('neon') || has('d1')
128
- ? {
129
- 'db:generate': 'turbo run db:generate --filter=@workspace/db',
130
- 'db:migrate': 'turbo run db:migrate --filter=@workspace/db',
131
- }
132
- : {}),
24
+ 'db:generate': 'turbo run db:generate --filter=@workspace/db',
25
+ 'db:migrate': 'turbo run db:migrate --filter=@workspace/db',
133
26
  audit: 'node scripts/audit.mjs',
134
27
  'audit:full': 'fallow --fail-on-issues',
135
28
  'audit:deps': 'node scripts/audit-deps.mjs',
136
- check: `pnpm lint && pnpm typecheck && pnpm run audit && pnpm audit:deps && pnpm test && pnpm build${workerBuildSuffix(options)}`,
137
- },
138
- devDependencies: { turbo: STACK_DEPENDENCIES['turbo'], fallow: STACK_DEPENDENCIES['fallow'] },
139
- // Upstream starter lockfiles can retain vulnerable transitive versions. Keep fixes within compatible majors.
140
- pnpm: {
141
- ...existing.pnpm,
142
- overrides: { ...existing.pnpm?.overrides, ...securityOverrides(options) },
29
+ check: 'pnpm lint && pnpm typecheck && pnpm run audit && pnpm audit:deps && pnpm test && pnpm build',
143
30
  },
31
+ devDependencies: { turbo: STACK_DEPENDENCIES.turbo, fallow: STACK_DEPENDENCIES.fallow },
144
32
  });
145
33
  writeDependencyAudit(root, updating);
146
34
  put(root, 'scripts/audit.mjs', `import { spawnSync } from 'node:child_process';
147
- const base = process.env.AUDIT_BASE;
148
- const hasBase = base || ['origin/main', 'main'].find((ref) => spawnSync('git', ['rev-parse', '--verify', ref], { stdio: 'ignore' }).status === 0);
149
- const args = hasBase ? ['exec', 'fallow', 'audit', '--base', hasBase] : ['exec', 'fallow', '--fail-on-issues'];
150
35
  const entry = process.env.npm_execpath;
151
36
  if (!entry) throw new Error('Run this check through pnpm run audit.');
152
- const result = spawnSync(process.execPath, [entry, ...args], { stdio: 'inherit', shell: false });
37
+ const result = spawnSync(process.execPath, [entry, 'exec', 'fallow', '--fail-on-issues'], { stdio: 'inherit', shell: false });
153
38
  if (result.error) throw result.error;
154
39
  process.exitCode = result.status ?? 1;
155
40
  `);
156
41
  json(root, '.fallowrc.json', {
157
- // Void loads these contracts outside the JavaScript import graph. Declare
158
- // them as roots so their application dependencies remain fully audited.
159
- entry: [
160
- 'apps/*/void.config.ts',
161
- 'apps/*/env.ts',
162
- 'apps/*/src/void-entry.ts',
163
- 'apps/*/crons/**/*.{ts,mts,js,mjs}',
164
- ...(has('electron') ? ['apps/desktop/src/main/preload.cts'] : []),
165
- ],
166
- // Expo web export and NativeWind load these runtime dependencies dynamically.
167
- ...(has('expo')
168
- ? {
169
- ignoreDependencies: [
170
- 'react-native-web',
171
- 'react-native-css-interop',
172
- 'react-native-reanimated',
173
- 'react-native-worklets',
174
- ],
175
- }
176
- : {}),
42
+ publicPackages: ['@workspace/native-ui'],
43
+ ignoreDependencies: ['react-native-reanimated', 'react-native-worklets'],
177
44
  ignorePatterns: [
178
- // Maintained bundled tooling is regression-tested in the CLI repository;
179
- // app audits cover customer code without re-auditing vendored CLI helpers.
180
45
  'scripts/audit.mjs',
181
46
  'scripts/audit-deps.mjs',
182
- 'scripts/void-migrations.mjs',
183
- 'scripts/prepare-void-migrations.mjs',
184
- '**/next-env.d.ts',
185
- '**/.next/**',
186
- '**/.open-next/**',
187
- '**/.vinext/**',
188
47
  '**/.wrangler/**',
189
48
  '**/dist/**',
49
+ '**/.next/**',
50
+ '**/.open-next/**',
190
51
  '**/worker-configuration.d.ts',
191
- '**/cloudflare-env.d.ts',
192
52
  ],
193
53
  });
194
- writeTurboConfiguration(root, registry);
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
+ });
195
76
  setPnpmPolicy(root, {
196
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
+ },
197
85
  sharedWorkspaceLockfile: true,
198
86
  allowBuilds: undefined,
199
- onlyBuiltDependencies: [
200
- 'esbuild',
201
- 'sharp',
202
- 'unrs-resolver',
203
- 'workerd',
204
- ...(has('electron') ? ['electron'] : []),
205
- ],
87
+ onlyBuiltDependencies: ['esbuild', 'sharp', 'unrs-resolver', 'workerd'],
206
88
  });
207
- // Upstream app/package lockfiles would create competing dependency authorities.
208
- if (!updating) {
209
- for (const parent of ['apps', 'packages']) {
210
- const directory = path.join(root, parent);
211
- if (!existsSync(directory))
212
- continue;
213
- for (const entry of readdirSync(directory, { withFileTypes: true })) {
214
- if (!entry.isDirectory())
215
- continue;
216
- for (const lock of ['pnpm-lock.yaml', 'package-lock.json', 'yarn.lock'])
217
- rmSync(path.join(directory, entry.name, lock), { force: true });
218
- }
219
- }
220
- for (const lock of ['package-lock.json', 'yarn.lock'])
221
- rmSync(path.join(root, lock), { force: true });
222
- }
223
89
  appendGitignore(root, [
224
90
  'node_modules/',
91
+ 'dist/',
92
+ '.output/',
93
+ '.next/',
225
94
  '.open-next/',
226
- '.vinext/',
95
+ '*.tsbuildinfo',
96
+ '.turbo/',
97
+ '.expo/',
227
98
  '.wrangler/',
228
- '.void/',
229
- '.void-wrangler.jsonc',
230
- '/apps/*/db/migrations/',
231
99
  '.dev.vars',
232
100
  '.dev.vars.*',
233
101
  '!.dev.vars.example',
@@ -237,6 +105,7 @@ process.exitCode = result.status ?? 1;
237
105
  '.fallow/',
238
106
  '.anhedral/',
239
107
  '.anhedral-audit-report.json',
108
+ 'worker-configuration.d.ts',
240
109
  ]);
241
110
  writeEnvironmentExample(root, registry);
242
111
  writeStackDocumentation(root, registry);
@@ -244,13 +113,8 @@ process.exitCode = result.status ?? 1;
244
113
  schemaVersion: 1,
245
114
  standard: 'anhedral-application-stack',
246
115
  products: options.products,
247
- hosting: has('next') || has('vinext') ? options.hosting : null,
248
- bootstrap: updating
249
- ? readProjectSection(root, 'standard').bootstrap
250
- : {
251
- command: BOOTSTRAP_COMMAND.join(' '),
252
- upstreamPackageManager: existing.packageManager,
253
- },
116
+ hosting: 'cloudflare',
117
+ bootstrap: { command: 'anhedral init', source: 'bundled' },
254
118
  status: 'starter',
255
119
  resourcesProvisioned: false,
256
120
  });
@@ -29,7 +29,7 @@ function fingerprint(root, service) {
29
29
  }));
30
30
  }
31
31
  async function assertDeletionScope(root, service, request) {
32
- if (!['d1', 'kv'].includes(service.kind) ||
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
- (['r2', 'queue'].includes(resource.kind) && binding.resourceId === resource.name))))
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 === 'kv' || kind === 'r2',
76
- delete: kind === 'd1' || kind === 'kv',
68
+ data: kind === 'd1' || kind === 'r2',
69
+ delete: kind === 'd1',
77
70
  };
78
71
  }
@@ -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' | 'kv' | 'r2' | 'queue';
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, posthogServiceMetrics, } from './integration-service-readers.js';
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: service.kind === 'kv' ? ['keys'] : await listServiceTables(service, request) };
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),
@@ -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' ||
@@ -5,7 +5,7 @@ export declare function runServiceCommand(root: string, input: string[]): Promis
5
5
  } | {
6
6
  services: ({
7
7
  key: string;
8
- provider: string;
8
+ provider: keyof import("./index.js").ProviderSettingsById;
9
9
  capabilities: {
10
10
  status: boolean;
11
11
  metrics: boolean;
@@ -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', 'vercel', 'expo'].includes(provider.id))
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: service.provider === 'posthog',
40
- data: service.provider === 'neon',
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
  }