anhedral 0.11.0 → 0.11.1

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 (148) hide show
  1. package/README.md +73 -157
  2. package/assets/patches/LICENSE.braces +21 -0
  3. package/assets/patches/LICENSE.node-forge +50 -0
  4. package/assets/patches/audit-deps.mjs +167 -0
  5. package/assets/patches/braces@3.0.3.patch +127 -0
  6. package/assets/patches/node-forge@1.4.0.patch +41 -0
  7. package/dist/auth-schema.js +3 -3
  8. package/dist/bin.js +15 -11
  9. package/dist/capabilities.d.ts +4 -4
  10. package/dist/capabilities.js +6 -2
  11. package/dist/capability-contract.js +22 -5
  12. package/dist/catalog-model.d.ts +24 -0
  13. package/dist/catalog-model.js +1 -0
  14. package/dist/catalog-registration.d.ts +16 -0
  15. package/dist/catalog-registration.js +22 -0
  16. package/dist/catalog-snapshot.d.ts +5 -0
  17. package/dist/catalog-snapshot.js +97 -0
  18. package/dist/cli-arguments.js +1 -1
  19. package/dist/cli-output.js +27 -2
  20. package/dist/cloudflare.d.ts +7 -1
  21. package/dist/cloudflare.js +36 -6
  22. package/dist/command-schema.js +49 -5
  23. package/dist/delivery.d.ts +10 -3
  24. package/dist/delivery.js +154 -37
  25. package/dist/dependencies.d.ts +24 -0
  26. package/dist/dependencies.js +48 -0
  27. package/dist/dependency-patches.d.ts +7 -0
  28. package/dist/dependency-patches.js +125 -0
  29. package/dist/index.d.ts +3 -0
  30. package/dist/index.js +2 -0
  31. package/dist/inspector-model.d.ts +9 -1
  32. package/dist/integration-service-readers.d.ts +13 -0
  33. package/dist/integration-service-readers.js +173 -0
  34. package/dist/lifecycle.d.ts +0 -1
  35. package/dist/lifecycle.js +0 -1
  36. package/dist/neon-service-data.d.ts +8 -0
  37. package/dist/neon-service-data.js +117 -0
  38. package/dist/pnpm-policy.d.ts +2 -2
  39. package/dist/pnpm-policy.js +19 -45
  40. package/dist/project-catalog.d.ts +41 -0
  41. package/dist/project-catalog.js +288 -0
  42. package/dist/project-config.d.ts +14 -0
  43. package/dist/project-config.js +89 -0
  44. package/dist/project-inspector.js +73 -17
  45. package/dist/project-lifecycle.d.ts +25 -0
  46. package/dist/project-lifecycle.js +57 -0
  47. package/dist/project-state.d.ts +5 -1
  48. package/dist/project-state.js +122 -16
  49. package/dist/provider-auth.js +2 -3
  50. package/dist/provider-readiness.js +27 -10
  51. package/dist/providers/adapters.js +4 -1
  52. package/dist/providers/api.d.ts +1 -0
  53. package/dist/providers/api.js +1 -0
  54. package/dist/providers/config.js +6 -8
  55. package/dist/providers/provision.js +1 -1
  56. package/dist/providers/recovery.d.ts +1 -1
  57. package/dist/providers/runtime.d.ts +1 -1
  58. package/dist/providers/runtime.js +46 -23
  59. package/dist/providers/state.d.ts +1 -2
  60. package/dist/providers/state.js +14 -54
  61. package/dist/provision.d.ts +9 -0
  62. package/dist/provision.js +30 -1
  63. package/dist/r2-service-data.d.ts +2 -0
  64. package/dist/r2-service-data.js +136 -0
  65. package/dist/readiness.js +9 -13
  66. package/dist/registry/add.js +64 -21
  67. package/dist/registry/commands.js +7 -9
  68. package/dist/registry/options.d.ts +1 -1
  69. package/dist/registry/options.js +4 -4
  70. package/dist/registry/receipt.d.ts +1 -0
  71. package/dist/registry/receipt.js +19 -4
  72. package/dist/registry/resolve.js +5 -1
  73. package/dist/registry/usage.js +1 -5
  74. package/dist/render.d.ts +2 -0
  75. package/dist/render.js +6 -0
  76. package/dist/runtime-policy.d.ts +4 -0
  77. package/dist/runtime-policy.js +21 -0
  78. package/dist/scaffold/bootstrap.js +2 -2
  79. package/dist/scaffold/compose.js +9 -3
  80. package/dist/scaffold/database.js +107 -25
  81. package/dist/scaffold/documentation.js +18 -13
  82. package/dist/scaffold/lint.d.ts +4 -0
  83. package/dist/scaffold/lint.js +56 -0
  84. package/dist/scaffold/neon-realtime.d.ts +2 -0
  85. package/dist/scaffold/neon-realtime.js +97 -0
  86. package/dist/scaffold/stack-documentation.js +1 -1
  87. package/dist/scaffold/void.d.ts +4 -0
  88. package/dist/scaffold/void.js +256 -0
  89. package/dist/scaffold/web.js +7 -1
  90. package/dist/scaffold/workspace.js +120 -29
  91. package/dist/service-deletion.d.ts +29 -0
  92. package/dist/service-deletion.js +195 -0
  93. package/dist/service-descriptor.d.ts +10 -0
  94. package/dist/service-descriptor.js +78 -0
  95. package/dist/service-model.d.ts +49 -0
  96. package/dist/service-model.js +8 -0
  97. package/dist/service-operations.d.ts +29 -0
  98. package/dist/service-operations.js +78 -0
  99. package/dist/service-readers.d.ts +8 -0
  100. package/dist/service-readers.js +247 -0
  101. package/dist/services-command.d.ts +39 -0
  102. package/dist/services-command.js +100 -0
  103. package/dist/ship.d.ts +36 -8
  104. package/dist/ship.js +39 -13
  105. package/dist/stack-registry.d.ts +4 -2
  106. package/dist/stack-registry.js +41 -11
  107. package/dist/standard.js +23 -4
  108. package/dist/transaction.d.ts +2 -0
  109. package/dist/transaction.js +10 -0
  110. package/dist/util.js +17 -2
  111. package/dist/vercel.d.ts +2 -0
  112. package/dist/vercel.js +69 -13
  113. package/dist/version.d.ts +1 -1
  114. package/dist/version.js +1 -1
  115. package/dist/vinext.d.ts +1 -0
  116. package/dist/vinext.js +13 -1
  117. package/dist/void-execution.d.ts +10 -0
  118. package/dist/void-execution.js +94 -0
  119. package/dist/void-migrations.d.ts +6 -0
  120. package/dist/void-migrations.js +110 -0
  121. package/dist/void-state.d.ts +16 -0
  122. package/dist/void-state.js +65 -0
  123. package/dist/void.d.ts +3 -0
  124. package/dist/void.js +5 -0
  125. package/docs/cli-design.md +2 -2
  126. package/docs/delivery-workflow.md +8 -7
  127. package/docs/plugin-ui.md +51 -10
  128. package/docs/provider-configuration.md +10 -11
  129. package/docs/stack-standard.md +175 -0
  130. package/docs/void-verification.md +185 -0
  131. package/package.json +22 -20
  132. package/assets/anhedral-mark.svg +0 -4
  133. package/assets/anhedral-stack-technical.svg +0 -322
  134. package/assets/anhedral-stack.svg +0 -322
  135. package/assets/anhedral.svg +0 -4
  136. package/assets/favicon.ico +0 -0
  137. package/assets/security/LICENSES.txt +0 -63
  138. package/assets/security/audit-deps.mjs +0 -300
  139. package/assets/security/braces-regression.mjs +0 -102
  140. package/assets/security/braces@3.0.3.patch +0 -285
  141. package/assets/security/decode-uri-component@0.2.2.patch +0 -149
  142. package/assets/security/decoder-regression.mjs +0 -37
  143. package/assets/security/forge-regression.mjs +0 -46
  144. package/assets/security/manifest.json +0 -53
  145. package/assets/security/node-forge@1.4.0.patch +0 -26
  146. package/dist/security-backports.d.ts +0 -3
  147. package/dist/security-backports.js +0 -26
  148. package/docs/application-stack-standard.md +0 -75
@@ -1,2 +1,3 @@
1
1
  export declare function sourceFiles(root: string): Map<string, string>;
2
+ export declare function configurationFingerprints(root: string): Record<string, string>;
2
3
  export declare function recordScaffoldFiles(root: string): void;
@@ -1,7 +1,7 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { readFileSync, readdirSync } from 'node:fs';
3
3
  import path from 'node:path';
4
- import { json, readJson } from '../scaffold/files.js';
4
+ import { PROJECT_CONFIG_FILE, readProjectConfig, readProjectSection, writeProjectSection, } from '../project-config.js';
5
5
  const excluded = new Set([
6
6
  '.pnpm-store',
7
7
  '.artifacts',
@@ -10,6 +10,9 @@ const excluded = new Set([
10
10
  '.next',
11
11
  '.open-next',
12
12
  '.wrangler',
13
+ '.void',
14
+ '.vinext',
15
+ '.void-wrangler.jsonc',
13
16
  '.turbo',
14
17
  'dist',
15
18
  '.output',
@@ -19,7 +22,7 @@ const excluded = new Set([
19
22
  '.anhedral-audit-report.json',
20
23
  '.anhedral.lock',
21
24
  '.anhedral-txn',
22
- 'anhedral.registry.json',
25
+ PROJECT_CONFIG_FILE,
23
26
  ]);
24
27
  export function sourceFiles(root) {
25
28
  const files = new Map();
@@ -28,6 +31,9 @@ export function sourceFiles(root) {
28
31
  if (excluded.has(entry.name))
29
32
  continue;
30
33
  const relative = directory ? `${directory}/${entry.name}` : entry.name;
34
+ // Deployment mirrors are disposable; reviewed SQL lives in packages/db/drizzle.
35
+ if (/^apps\/[^/]+\/db\/migrations$/.test(relative))
36
+ continue;
31
37
  // Local credentials are never seeded into an addition transaction or fingerprint receipt.
32
38
  if (/^(?:\.env|\.dev\.vars)(?:\.|$)/.test(entry.name) && !entry.name.endsWith('.example'))
33
39
  continue;
@@ -44,10 +50,19 @@ export function sourceFiles(root) {
44
50
  visit('');
45
51
  return files;
46
52
  }
53
+ export function configurationFingerprints(root) {
54
+ return Object.fromEntries(Object.entries(readProjectConfig(root))
55
+ .filter(([section]) => !['schemaVersion', 'registry'].includes(section))
56
+ .map(([section, value]) => [
57
+ section,
58
+ createHash('sha256').update(JSON.stringify(value)).digest('hex'),
59
+ ]));
60
+ }
47
61
  export function recordScaffoldFiles(root) {
48
- const receipt = readJson(root, 'anhedral.registry.json');
49
- json(root, 'anhedral.registry.json', {
62
+ const receipt = readProjectSection(root, 'registry');
63
+ writeProjectSection(root, 'registry', {
50
64
  ...receipt,
51
65
  files: Object.fromEntries(sourceFiles(root)),
66
+ configuration: configurationFingerprints(root),
52
67
  });
53
68
  }
@@ -34,7 +34,11 @@ export function resolveStandardProducts(selected, hosting, hostingSpecified) {
34
34
  getStackDefinition(id);
35
35
  if (![...selected].some((id) => getStackDefinition(id).type === 'application'))
36
36
  selected.add(hosting === 'vercel' ? 'next' : 'vinext');
37
- for (const id of selected) {
37
+ // Resolve single-provider defaults before alternatives (e.g. Realtime's Neon
38
+ // before Better Auth chooses a database), independently of CLI flag order.
39
+ const defaults = [...selected].sort((left, right) => (getStackDefinition(left).selection.requiresAny?.length ?? 0) -
40
+ (getStackDefinition(right).selection.requiresAny?.length ?? 0) || left.localeCompare(right));
41
+ for (const id of defaults) {
38
42
  const definition = getStackDefinition(id);
39
43
  const alternatives = definition.selection.requiresAny ?? [];
40
44
  if (definition.fallbackDependency &&
@@ -7,10 +7,6 @@ export const COMMAND_HELP = Object.fromEntries(Object.entries(COMMANDS).map(([na
7
7
  const primary = ['init', 'auth', 'ship', 'add', 'registry', 'inspect', 'doctor', 'connect'];
8
8
  const common = GLOBAL_OPTIONS.map(optionHelp);
9
9
  export function commandHelp(command) {
10
- if (command === 'new')
11
- return commandHelp('init')
12
- ?.replace('Usage: anhedral init', 'Usage: anhedral new')
13
- .concat('\nCompatibility alias: new requires a destination directory.\n');
14
10
  const entry = COMMAND_HELP[command];
15
11
  if (!entry)
16
12
  return undefined;
@@ -19,4 +15,4 @@ export function commandHelp(command) {
19
15
  export const STANDARD_USAGE = `Anhedral\nScaffold source, authenticate your providers, and ship your selected stack.\n\nUsage: anhedral <command> [options]\n\nStart here:\n${primary.map((name) => ` ${name.padEnd(12)}${COMMAND_HELP[name].description}`).join('\n')}\n\nDelivery tools:\n${Object.entries(COMMAND_HELP)
20
16
  .filter(([name]) => !primary.includes(name))
21
17
  .map(([name, entry]) => ` ${name.padEnd(12)}${entry.description}`)
22
- .join('\n')}\n\nDefault: Vinext on Cloudflare Workers, from the official shadcn pnpm/Turborepo monorepo.\nExamples:\n anhedral init client-app\n anhedral auth client-app\n anhedral ship client-app --dry-run\n\nUse anhedral <command> --help for options and examples.\nUse anhedral help <command> for the same focused help.\nGlobal options:\n${common.map((option) => ` ${option}`).join('\n')}\n -v, --version Show the CLI version.\n\nnew remains a compatibility alias for init with an explicit destination.\n`;
18
+ .join('\n')}\n\nDefault: Vinext on Cloudflare Workers, from the official shadcn pnpm/Turborepo monorepo.\nExamples:\n anhedral init client-app\n anhedral auth client-app\n anhedral ship client-app --dry-run\n\nUse anhedral <command> --help for options and examples.\nUse anhedral help <command> for the same focused help.\nGlobal options:\n${common.map((option) => ` ${option}`).join('\n')}\n -v, --version Show the CLI version.\n`;
package/dist/render.d.ts CHANGED
@@ -8,5 +8,7 @@ export declare function markdownHeading(value: string): string;
8
8
  export declare function packageNameFromText(value: string): string;
9
9
  export declare function childPackageName(projectName: string, suffix: string): string;
10
10
  export declare function identifierSegment(value: string): string;
11
+ /** Provider identity is separate from the npm package/directory name. */
12
+ export declare function providerProjectName(value: string): string;
11
13
  /** Keep provider resource names within the shared Workers/R2/Queues naming limits. */
12
14
  export declare function resourceName(projectName: string, suffix: string): string;
package/dist/render.js CHANGED
@@ -72,6 +72,12 @@ export function identifierSegment(value) {
72
72
  .replace(/^-+|-+$/g, '');
73
73
  return segment || 'app';
74
74
  }
75
+ /** Provider identity is separate from the npm package/directory name. */
76
+ export function providerProjectName(value) {
77
+ const normalized = identifierSegment(value);
78
+ const digest = createHash('sha256').update(value).digest('hex').slice(0, 8);
79
+ return compactPackageSegment(normalized === value ? normalized : `${normalized}-${digest}`, 63);
80
+ }
75
81
  /** Keep provider resource names within the shared Workers/R2/Queues naming limits. */
76
82
  export function resourceName(projectName, suffix) {
77
83
  const segment = identifierSegment(projectName);
@@ -0,0 +1,4 @@
1
+ /** Runtime policy shared by generation, setup guidance, and diagnostics. */
2
+ export declare function supportsWorkspaceRuntime(version: string): boolean;
3
+ export declare function supportsVoidRuntime(version: string): boolean;
4
+ export declare function usesVoidSelection(products: readonly string[], hosting: string): boolean;
@@ -0,0 +1,21 @@
1
+ /** Runtime policy shared by generation, setup guidance, and diagnostics. */
2
+ export function supportsWorkspaceRuntime(version) {
3
+ const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
4
+ if (!match)
5
+ return false;
6
+ const [major, minor] = match.slice(1).map(Number);
7
+ return (major === 22 && minor >= 13) || major >= 24;
8
+ }
9
+ export function supportsVoidRuntime(version) {
10
+ const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
11
+ if (!match)
12
+ return false;
13
+ const [major, minor] = match.slice(1).map(Number);
14
+ return major > 24 || (major === 24 && minor >= 21);
15
+ }
16
+ export function usesVoidSelection(products, hosting) {
17
+ return (!(products.includes('next') && hosting === 'cloudflare') &&
18
+ !products.includes('queues') &&
19
+ !products.includes('basin') &&
20
+ products.some((product) => ['vinext', 'hono', 'realtime', 'cron', 'workflows'].includes(product)));
21
+ }
@@ -2,6 +2,7 @@ import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync } from
2
2
  import path from 'node:path';
3
3
  import { execFile, appendGitignore } from '../util.js';
4
4
  import { bootstrapArguments } from '../registry/bootstrap.js';
5
+ import { supportsWorkspaceRuntime } from '../runtime-policy.js';
5
6
  export function assertBootstrapPlatform(run, platform = process.platform) {
6
7
  if (platform === 'win32' && run === execFile)
7
8
  throw new Error('Native Windows initialization is blocked because the upstream shadcn monorepo bootstrap writes component files outside the project. Run Anhedral inside WSL. Planning and doctor remain available on Windows.');
@@ -10,8 +11,7 @@ export function assertBootstrapPlatform(run, platform = process.platform) {
10
11
  export function assertWorkspaceRuntime(run, version = process.versions.node) {
11
12
  if (run !== execFile)
12
13
  return;
13
- const [major, minor] = version.split('.').map(Number);
14
- if (!((major === 22 && minor >= 13) || major >= 24))
14
+ if (!supportsWorkspaceRuntime(version))
15
15
  throw new Error('Generated workspaces require Node.js 22.13+ on the 22.x line or Node.js 24+. Planning and doctor remain available on older CLI-supported versions.');
16
16
  }
17
17
  export function bootstrapWorkspace(root, name, run, webOnly = false) {
@@ -1,10 +1,12 @@
1
+ import { writeProjectSection } from '../project-config.js';
1
2
  import { existsSync, rmSync } from 'node:fs';
2
3
  import path from 'node:path';
3
4
  import { installStackItem } from '../stack-registry.js';
4
5
  import { createRecipeContext } from '../registry/context.js';
5
6
  import { inspectWorkspaceGraph } from '../workspace-graph.js';
6
7
  import { writeStandardRoot } from './workspace.js';
7
- import { json } from './files.js';
8
+ import { normalizeSharedLint } from './lint.js';
9
+ import { configureVoidDelivery } from './void.js';
8
10
  /** Only used in a fresh staged workspace. Existing applications are never overlaid. */
9
11
  export async function composeStack(root, options, registry) {
10
12
  const context = createRecipeContext(root, options);
@@ -18,14 +20,18 @@ export async function composeStack(root, options, registry) {
18
20
  if (item.installer === 'recipe')
19
21
  await installStackItem(item, context);
20
22
  }
23
+ normalizeSharedLint(root);
21
24
  writeStandardRoot(root, options, registry);
25
+ configureVoidDelivery(root);
22
26
  for (const item of registry.items) {
23
27
  for (const target of item.targets) {
24
- if (!existsSync(path.join(root, target)))
28
+ if (!existsSync(path.join(root, target)) &&
29
+ !(target.endsWith('/wrangler.jsonc') &&
30
+ existsSync(path.join(root, target.replace('/wrangler.jsonc', '/anhedral.cloudflare.json')))))
25
31
  throw new Error(`Registry target missing: ${item.name} -> ${target}.`);
26
32
  }
27
33
  }
28
- json(root, 'anhedral.registry.json', {
34
+ writeProjectSection(root, 'registry', {
29
35
  ...registry,
30
36
  status: 'scaffolded',
31
37
  workspaces: inspectWorkspaceGraph(root),
@@ -1,13 +1,16 @@
1
1
  import { writeEnvironmentFile } from './environment.js';
2
2
  import { STACK_DEPENDENCIES } from '../dependencies.js';
3
- import { put, patchPackage, sharedPackage } from './files.js';
3
+ import { put, patchPackage, readJson, json, sharedPackage } from './files.js';
4
4
  export function scaffoldDatabase({ root, options, runtimeApp, has }) {
5
- sharedPackage(root, 'db', has('neon')
5
+ const app = `apps/${runtimeApp}`;
6
+ const postgres = has('neon');
7
+ const directory = 'packages/db';
8
+ sharedPackage(root, 'db', postgres
6
9
  ? `import { drizzle } from 'drizzle-orm/neon-http';
7
10
  import { neon } from '@neondatabase/serverless';
8
11
  import * as schema from './schema';
9
12
  export function createDatabase(connectionString: string) {
10
- // HTTP supports independent queries and batches; choose a reviewed WebSocket adapter for interactive transactions.
13
+ // HTTP supports independent queries and batches; migrations use a separate transactional connection.
11
14
  return drizzle(neon(connectionString), { schema });
12
15
  }
13
16
  `
@@ -16,34 +19,113 @@ import * as schema from './schema';
16
19
  export function createDatabase(binding: Parameters<typeof drizzle>[0]) { return drizzle(binding, { schema }); }
17
20
  `, {
18
21
  'drizzle-orm': STACK_DEPENDENCIES['drizzle-orm'],
19
- ...(has('neon')
22
+ ...(postgres
20
23
  ? { '@neondatabase/serverless': STACK_DEPENDENCIES['@neondatabase/serverless'] }
21
24
  : {}),
22
25
  });
23
- if (has('neon')) {
24
- const native = runtimeApp === 'web' && options.hosting === 'vercel';
25
- writeEnvironmentFile(root, `apps/${runtimeApp}/${native ? '.env.example' : '.dev.vars.example'}`, { DATABASE_URL: '' });
26
- writeEnvironmentFile(root, 'packages/db/.env.example', { DATABASE_URL: '' });
27
- if (!native)
28
- put(root, `apps/${runtimeApp}/${runtimeApp === 'api' ? 'src/' : ''}database-secrets.d.ts`, runtimeApp === 'api'
29
- ? 'interface Env { DATABASE_URL: string }\n'
30
- : 'declare namespace Cloudflare { interface Env { DATABASE_URL: string } }\n');
31
- }
32
- put(root, 'packages/db/src/schema.ts', '// Define product tables here; generate and review SQL before migration.\nexport {};\n');
33
- put(root, 'packages/db/drizzle.config.ts', has('neon')
34
- ? `import { existsSync } from 'node:fs';
26
+ put(root, `${directory}/src/schema.ts`, '// Define product tables here; generate and review SQL before migration.\nexport {};\n');
27
+ put(root, `${directory}/drizzle/.gitkeep`, '');
28
+ if (postgres)
29
+ put(root, `${directory}/migration-environment.ts`, `import { existsSync } from 'node:fs';
35
30
  import { loadEnvFile } from 'node:process';
31
+ import { fileURLToPath } from 'node:url';
32
+ const root = new URL('./', import.meta.url);
33
+ export function migrationEnvironment() {
34
+ // Existing process values win; local overrides precede shared defaults.
35
+ for (const name of ['.env.local', '.env']) {
36
+ const file = fileURLToPath(new URL(name, root));
37
+ if (existsSync(file)) loadEnvFile(file);
38
+ }
39
+ return { root, connectionString: process.env.DATABASE_URL_UNPOOLED };
40
+ }
41
+ `);
42
+ put(root, `${directory}/drizzle.config.ts`, postgres
43
+ ? `import { relative } from 'node:path';
44
+ import { fileURLToPath } from 'node:url';
45
+ import { defineConfig } from 'drizzle-kit';
46
+ import { migrationEnvironment } from './migration-environment';
47
+ const { root, connectionString: url } = migrationEnvironment();
48
+ export default defineConfig({
49
+ dialect: 'postgresql',
50
+ schema: fileURLToPath(new URL('./src/schema.ts', root)),
51
+ out: relative(process.cwd(), fileURLToPath(new URL('./drizzle/', root))),
52
+ ...(url ? { dbCredentials: { url } } : {}),
53
+ });
54
+ `
55
+ : `import { fileURLToPath } from 'node:url';
56
+ import { relative } from 'node:path';
36
57
  import { defineConfig } from 'drizzle-kit';
37
-
38
- if (existsSync('.env')) loadEnvFile('.env');
39
-
40
- export default defineConfig({ dialect: 'postgresql', schema: './src/schema.ts', out: './migrations', dbCredentials: { url: process.env.DATABASE_URL! } });
58
+ export default defineConfig({
59
+ dialect: 'sqlite',
60
+ schema: fileURLToPath(new URL('./src/schema.ts', import.meta.url)),
61
+ out: relative(process.cwd(), fileURLToPath(new URL('./drizzle/', import.meta.url))),
62
+ });
63
+ `);
64
+ put(root, `${directory}/src/migrate.ts`, postgres
65
+ ? `import { fileURLToPath } from 'node:url';
66
+ import { Pool, neonConfig } from '@neondatabase/serverless';
67
+ import { drizzle } from 'drizzle-orm/neon-serverless';
68
+ import { migrate } from 'drizzle-orm/neon-serverless/migrator';
69
+ import { migrationEnvironment } from '../migration-environment';
70
+ const { root, connectionString } = migrationEnvironment();
71
+ if (!connectionString) throw new Error('Configure DATABASE_URL_UNPOOLED for the intended migration branch and role.');
72
+ let url: URL;
73
+ try { url = new URL(connectionString); } catch { throw new Error('Configure a valid direct PostgreSQL migration URL.'); }
74
+ if (!['postgres:', 'postgresql:'].includes(url.protocol) || url.hostname.includes('-pooler.'))
75
+ throw new Error('Migrations require a direct PostgreSQL connection.');
76
+ neonConfig.webSocketConstructor = WebSocket;
77
+ const pool = new Pool({ connectionString });
78
+ try {
79
+ await migrate(drizzle(pool), { migrationsFolder: fileURLToPath(new URL('drizzle/', root)) });
80
+ } catch {
81
+ throw new Error('Database migration failed. Inspect the selected branch and migration history before retrying.');
82
+ } finally {
83
+ await pool.end();
84
+ }
41
85
  `
42
- : `import { defineConfig } from 'drizzle-kit';
43
- export default defineConfig({ dialect: 'sqlite', schema: './src/schema.ts', out: './migrations' });
86
+ : `import { spawnSync } from 'node:child_process';
87
+ import { fileURLToPath } from 'node:url';
88
+ const args = process.argv.slice(2);
89
+ if (args.length > 1 || args.some((arg) => !['--local', '--remote'].includes(arg)))
90
+ throw new Error('Usage: pnpm db:migrate [--local|--remote] (defaults to local).');
91
+ const pnpm = process.env.npm_execpath;
92
+ if (!pnpm) throw new Error('Run migrations through pnpm db:migrate.');
93
+ const root = fileURLToPath(new URL('../../../apps/${runtimeApp}/', import.meta.url));
94
+ const result = spawnSync(process.execPath, [pnpm, 'exec', 'wrangler', 'd1', 'migrations', 'apply', 'DB',
95
+ args[0] ?? '--local', '--config', fileURLToPath(new URL('../../../apps/${runtimeApp}/wrangler.jsonc', import.meta.url)),
96
+ ], { cwd: root, stdio: 'inherit', shell: false });
97
+ if (result.error) throw result.error;
98
+ process.exitCode = result.status ?? 1;
44
99
  `);
45
- patchPackage(root, 'packages/db/package.json', {
46
- devDependencies: { 'drizzle-kit': STACK_DEPENDENCIES['drizzle-kit'] },
47
- scripts: { 'db:generate': 'drizzle-kit generate' },
100
+ patchPackage(root, `${directory}/package.json`, {
101
+ exports: { '.': './src/index.ts', './schema': './src/schema.ts' },
102
+ dependencies: {
103
+ 'drizzle-orm': STACK_DEPENDENCIES['drizzle-orm'],
104
+ ...(postgres
105
+ ? { '@neondatabase/serverless': STACK_DEPENDENCIES['@neondatabase/serverless'] }
106
+ : {}),
107
+ },
108
+ devDependencies: {
109
+ 'drizzle-kit': STACK_DEPENDENCIES['drizzle-kit'],
110
+ tsx: STACK_DEPENDENCIES['tsx'],
111
+ ...(!postgres ? { wrangler: STACK_DEPENDENCIES['wrangler'] } : {}),
112
+ },
113
+ scripts: { 'db:generate': 'drizzle-kit generate', 'db:migrate': 'tsx src/migrate.ts' },
48
114
  });
115
+ const tsconfig = readJson(root, `${directory}/tsconfig.json`);
116
+ tsconfig.include = [...new Set([...(tsconfig.include ?? []), 'drizzle.config.ts'])];
117
+ json(root, `${directory}/tsconfig.json`, tsconfig);
118
+ // Consumers such as Better Auth add their direct workspace dependency when
119
+ // they generate imports. Selecting a database alone creates reusable tooling.
120
+ if (postgres) {
121
+ const native = runtimeApp === 'web' && options.hosting === 'vercel';
122
+ writeEnvironmentFile(root, `${app}/${native ? '.env.example' : '.dev.vars.example'}`, {
123
+ DATABASE_URL: '',
124
+ });
125
+ writeEnvironmentFile(root, `${directory}/.env.example`, { DATABASE_URL_UNPOOLED: '' });
126
+ if (!native)
127
+ put(root, `${app}/${runtimeApp === 'api' ? 'src/' : ''}database-secrets.d.ts`, runtimeApp === 'api'
128
+ ? 'interface Env { DATABASE_URL: string }\n'
129
+ : 'declare namespace Cloudflare { interface Env { DATABASE_URL: string } }\n');
130
+ }
49
131
  }
@@ -1,3 +1,4 @@
1
+ import { usesVoidSelection } from '../runtime-policy.js';
1
2
  import { markdownHeading } from '../render.js';
2
3
  import { existsSync, readFileSync } from 'node:fs';
3
4
  import path from 'node:path';
@@ -10,51 +11,55 @@ export function workerBuildSuffix(options) {
10
11
  export function writeSetupDocumentation(root, options) {
11
12
  const has = (product) => options.products.includes(product);
12
13
  const agentsFile = path.join(root, 'AGENTS.md');
13
- const workerSelected = options.products.some((product) => ['vinext', 'hono', 'realtime', 'queues', 'cron', 'workflows'].includes(product)) ||
14
- (has('next') && options.hosting === 'cloudflare');
14
+ const voidSelected = usesVoidSelection(options.products, options.hosting);
15
15
  const existingAgents = existsSync(agentsFile) && (has('next') || has('vinext'))
16
16
  ? readFileSync(agentsFile, 'utf8') + '\n'
17
17
  : '';
18
18
  put(root, 'AGENTS.md', existingAgents +
19
19
  `# Anhedral delivery standard
20
20
 
21
- Keep accounts, source, infrastructure, billing, and recovery client-owned. Use the available developer tools and the selected platforms’ native toolchains for implementation and verification. Use provider plugins, APIs/MCP and CLIs for operations; Wrangler handles Cloudflare project commands.
21
+ Keep accounts, source, infrastructure, billing, and recovery client-owned. Use the available developer tools and the selected platforms’ native toolchains for implementation and verification. Use provider plugins, APIs/MCP and CLIs for operations; Void owns Cloudflare provisioning and deployment for supported selections; Anhedral owns composition, customer ownership and verification. Explicit OpenNext, queue/DLQ and Basin selections use Wrangler delivery.
22
22
 
23
23
  Vinext on Cloudflare Workers by default; native Next.js on Vercel is an explicit option. Free-to-start where suitable, within provider eligibility and limits. Respect the existing account, budget, audience and release authorization. Request only missing approval for paid activation, material spending, architecture changes or release. Do not deploy or activate providers as part of initialization.
24
24
 
25
- Add apps and shared packages only when needed. All services belong in apps/*, reusable code in packages/*. Shared styling is named styling. Keep secrets and privileged integrations out of client bundles. Use Clerk, Better Auth, or no auth according to project needs. Protect product routes explicitly and implement resource authorization.
25
+ Use pnpm workspaces and Turborepo with one root pnpm-lock.yaml. Add apps and shared packages only when needed. All services belong in apps/*, reusable code in packages/*. Shared styling is named styling. Keep secrets and privileged integrations out of client bundles. Use Clerk, Better Auth, or no auth according to project needs. Protect product routes explicitly and implement resource authorization.
26
26
 
27
- Use private R2 Worker bindings. KV is eventually consistent configuration/cache, never transactional authority. Neon uses Drizzle and direct serverless HTTP with a server-only DATABASE_URL. HTTP supports independent queries and batches; interactive transactions require a reviewed WebSocket or PostgreSQL adapter. Define job retries, concurrency, idempotency and failure handling. Review SQL migrations before applying them.
27
+ Use private R2 Worker bindings. KV is eventually consistent configuration/cache, never transactional authority. Neon uses Drizzle and direct serverless HTTP with a server-only DATABASE_URL. HTTP supports independent queries and batches; interactive transactions require a reviewed WebSocket or PostgreSQL adapter. Define job retries, concurrency, idempotency and failure handling. Keep database factories and schemas in packages/db/src, SQL and metadata in packages/db/drizzle, and migration configuration in packages/db/drizzle.config.ts. Only server packages import @workspace/db; clients use API contracts and endpoints. Review generated SQL before deployment. One server target owns deployment migrations; other server targets only consume the database. Manual migration tasks are uncached and never part of builds or startup. Review SQL migrations before applying them.
28
+
29
+ ${has('neon-realtime') ? 'Neon Realtime uses separate @workspace/neon-realtime/server and /client exports; follow packages/neon-realtime/README.md. Enable the intended branch and exact allowed origins manually. Keep DATABASE_URL and NEON_REALTIME_SECRET server-only; pass the public NEON_REALTIME_URL to clients through framework-specific public configuration. Authenticate query sealing, derive user/tenant scope from verified identity and implement bounded read-only queries, renewal and cross-tenant checks. Neon Realtime is beta without RLS; no arbitrary SQL endpoint, automatic Realtime provisioning or verified product flow is generated.\n' : ''}
28
30
 
29
31
  Developer tooling includes Cloudflare’s security-audit skill (https://github.com/cloudflare/security-audit-skill) for repository security reviews.
30
32
 
31
33
  For new projects, guide GitHub sign-in and the user's Git identity. Review files and secret ignores, commit the initial source, then use anhedral repository --create for a private repository under the authenticated user. Preserve existing origins and visibility; use an explicitly selected organization when requested. Connect Vercel with --git and verify actual GitHub installation access. For Git delivery, commit and push reviewed changes, wait for production, then use anhedral adopt and anhedral verify. Adoption checks exact repository, production branch and commit without uploading again. Use anhedral ship only for an explicit CLI delivery. Recover a fresh clone with anhedral recover; rerun product verification because prior test evidence is not recovered. Use anhedral doctor --providers to inspect installed tools and recorded provider context.
32
34
 
33
- Consult docs/stack.md for the current generated options, targets and setup requirements. Maintain docs/architecture.md with selected components, rationale, alternatives, data/access boundaries, and a diagram of actual connections. Maintain docs/verification.md with product acceptance criteria, exercised flows, evidence, and blockers. Generated setup is a starter, not implemented product behavior.
35
+ Keep project identity, setup, registry, provider settings and selected hosting configuration in the single root anhedral.json. Consult docs/stack.md for the current generated options, targets and setup requirements. Maintain docs/architecture.md with selected components, rationale, alternatives, data/access boundaries, and a diagram of actual connections. Maintain docs/verification.md with product acceptance criteria, exercised flows, evidence, and blockers. Generated setup is a starter, not implemented product behavior.
34
36
 
35
- Run pnpm check. Use pnpm exec fallow during development and pnpm exec fallow audit for changes. Fix legitimate findings; use narrow documented exceptions. Verify real UI flows with Computer Use and Control Chrome, plus relevant integrations, native apps/simulators, and deployed previews. Carry an authorized build-and-ship request through deployment and live verification; ask only for authorization that is still missing.
37
+ Run pnpm check. Starters contain no application tests yet: add workspace tests and a meaningful root test:live script before claiming product verification. Use pnpm exec fallow during development and pnpm exec fallow audit for changes. Fix legitimate findings; use narrow documented exceptions. Verify real UI flows with Computer Use and Control Chrome, plus relevant integrations, native apps/simulators, and deployed previews. Carry an authorized build-and-ship request through deployment and live verification; ask only for authorization that is still missing.
36
38
  `);
37
39
  put(root, 'README.md', `# ${markdownHeading(options.name)}
38
40
 
39
41
  Initialized from the official shadcn pnpm/Turborepo monorepo, with the Anhedral Application Stack & Delivery Standard.
40
42
 
41
- Initial selection: ${options.products.join(', ')}. Current selections and additions are recorded in anhedral.setup.json, anhedral.registry.json and [docs/stack.md](docs/stack.md). ${has('vinext') ? 'Vinext App Router on Cloudflare Workers.' : has('next') ? `Next.js hosting: ${options.hosting === 'cloudflare' ? 'Cloudflare Workers + OpenNext' : 'Vercel (native Next.js default)'}.` : ''}
43
+ Initial selection: ${options.products.join(', ')}. Project configuration is recorded in anhedral.json: identity, setup, standard, registry, providers, and the selected cloudflare/vercel hosting sections. Current selections and additions are summarized in [docs/stack.md](docs/stack.md). ${has('vinext') ? 'Vinext App Router on Cloudflare Workers.' : has('next') ? `Next.js hosting: ${options.hosting === 'cloudflare' ? 'Cloudflare Workers + OpenNext' : 'Vercel (native Next.js default)'}.` : ''}
42
44
 
43
45
  Run pnpm install, commit pnpm-lock.yaml, then pnpm dev. Run pnpm check for lint, types, Fallow audit, tests and build. Without a Git comparison base, audit runs the full Fallow gate. Add meaningful product tests and integration checks as behavior is implemented. The tests task runs only workspaces that define tests; init does not claim product verification.
44
46
 
45
- ${has('next') && options.hosting === 'vercel' ? 'Native Next.js uses customer-owned Vercel. Connect with the intended scope and personal/commercial use before shipping. Default to private all-deployment protection unless public access was requested; verify protection before linking Git or uploading code. Run anhedral doctor --providers for prerequisites and recorded provider context. Configure server secrets in that project; use cache components, partial prefetching, Link navigation and Suspense deliberately. ' : ''}${workerSelected ? 'Cloudflare bindings contain REPLACE_WITH_* IDs. Reconcile resources in the client account and generate Worker types before development. Workers expose local dev and explicit deploy scripts. ' : ''}${has('vinext') ? 'Build with pnpm build, then pnpm --dir apps/web preview to exercise the production Worker. Vinext provides a Next-compatible API surface; native Next.js is an explicit framework option. ' : ''}${has('next') && options.hosting === 'cloudflare' ? 'Use the web preview script to exercise the actual OpenNext Worker runtime. ' : ''}Initialization does not provision infrastructure or deploy.
47
+ ${has('next') && options.hosting === 'vercel' ? 'Native Next.js uses customer-owned Vercel. Connect with the intended scope and personal/commercial use before shipping. Default to private all-deployment protection unless public access was requested; verify protection before linking Git or uploading code. Run anhedral doctor --providers for prerequisites and recorded provider context. Configure server secrets in that project; use cache components, partial prefetching, Link navigation and Suspense deliberately. ' : ''}${voidSelected ? 'Void owns provisioning and publication in the customer account. Keep explicit resources in anhedral.cloudflare.json and configuration in void.config.ts; commit void.lock.json after provisioning and serialize initial deployment across apps. Generated .void/ and .void-wrangler.jsonc are ignored. Copy each app’s env.example to its .env for local tooling; production server secrets use void secret with values passed via stdin. Local dotenv files remain private and untracked; they are not bundled into source or client assets. Supply public VITE_* values for Vite clients through the build environment. Vinext loads the app .env for local builds and maps NEXT_PUBLIC_* values into client bundles; supply those values in the production build environment. Generate Worker types before development. ' : ''}${has('vinext') ? 'Build with pnpm build, then pnpm --dir apps/web preview to exercise the production Worker. Vinext provides a Next-compatible API surface; native Next.js is an explicit framework option. ' : ''}${has('next') && options.hosting === 'cloudflare' ? 'Use the web preview script to exercise the actual OpenNext Worker runtime. ' : ''}Initialization does not provision infrastructure or deploy.
46
48
 
47
- Security gate: pnpm audit:deps audits all dependencies and retains the original report. Reviewed backports in scripts/security are accepted only after patch hashes, installed package hashes and regression checks match. Unremediated high/critical advisories, incomplete reports and modified patches remain blocking; lower-severity findings remain visible in the report.
49
+ Security gate: pnpm audit:deps preserves the standard pnpm audit JSON in .anhedral-audit-report.json and blocks high or critical findings except the two exact verified braces/node-forge mitigations. Resolve findings through compatible upstream dependency updates. If the lock contains braces@3.0.3, Anhedral supplies a temporary exact-version pnpm patch in patches/ and records it in pnpm-workspace.yaml. It bounds nesting to 100 and rejects cyclic AST traversal; commit the patch and updated lock. When node-forge@1.4.0 occurs, a second exact patch fixes RSA DigestAlgorithm/NULL validation in the Node source and both shipped browser bundles. Only GHSA-vfj7-8cjw-p6xm for patched braces@3.0.3 and GHSA-86w9-cpqp-85rv for patched node-forge@1.4.0 can pass after verifying the exact advisory and version, effective pnpm patch map, and patch SHA-256. Runtime regressions across the affected entrypoints run in the Anhedral CLI repository tests. Upstream findings stay visible; missing or altered patch configuration and unrelated high/critical findings block delivery.
48
50
 
49
51
  ${has('next') && options.hosting === 'cloudflare' ? 'OpenNext is configured without a provisioned incremental-cache bucket. Choose and configure a cache adapter before using ISR or cache features that require shared persistence.\n' : ''}
50
- ${has('neon') ? 'Configure server-only DATABASE_URL for the intended Neon branch and role. Direct HTTP needs no Hyperdrive or connection cleanup. Review migrations and authorization; interactive transactions require a reviewed WebSocket or PostgreSQL adapter.\n' : ''}
52
+ ${has('neon') ? 'Configure DATABASE_URL_UNPOOLED separately in packages/db/.env for transactional migrations on the intended branch. Configure server-only DATABASE_URL for the intended Neon branch and role. Direct HTTP needs no Hyperdrive or connection cleanup. Review migrations and authorization; interactive transactions require a reviewed WebSocket or PostgreSQL adapter.\n' : ''}
53
+ ${has('neon') || has('d1') ? 'packages/db/src owns the reusable database factory, schema and migration entry point. Generated SQL lives in packages/db/drizzle; the config resolves paths from its own directory. Run pnpm db:generate, review SQL, then pnpm db:migrate. These tasks are uncached and separate from application builds. D1 defaults to local; pass -- --remote explicitly for the selected Worker database. Browser and native interfaces use an API, never database credentials.\n' : ''}
51
54
  ${has('better-auth') ? 'Core Better Auth tables are included in the Drizzle schema. Review and apply migrations before using /api/auth. Configure BETTER_AUTH_SECRET, BETTER_AUTH_URL and trusted origins for the correct environment.\n' : ''}
52
55
  ${has('clerk') ? `${has('next') || has('vinext') ? 'The web starter includes ClerkProvider, middleware and sign-in/sign-up pages. Configure NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and server-only CLERK_SECRET_KEY. ' : ''}${has('hono') ? 'packages/auth exports a Clerk request authentication helper. Configure its server secret and publishable key, supply explicit authorized origins, and wire it into product routes; the API health route remains public. ' : ''}Authentication does not establish resource authorization.\n` : ''}
53
56
  ${has('r2') ? 'FILES is a private R2 binding. Implement authentication and file-level authorization before exposing file routes. Clients never receive R2 credentials.\n' : ''}
57
+ ${has('neon-realtime') ? 'Neon Realtime is an optional beta live SQL foundation, separate from Durable Object rooms. Read [packages/neon-realtime/README.md](packages/neon-realtime/README.md) for the server/client factories and Drizzle adapter. Manually enable the intended branch, configure exact allowed origins and set server-only NEON_REALTIME_SECRET with DATABASE_URL; NEON_REALTIME_URL is public client transport configuration. Authenticate sealing requests and scope every query to verified user/tenant access. Implement subscriptions, authorized renewal and isolation tests; RLS, automatic Realtime provisioning and a public SQL endpoint are not provided. Live behavior remains unverified.\n' : ''}
54
58
  ${has('realtime') ? 'Durable Object rooms support hibernating WebSockets; the public entrypoint remains disabled until room authorization and short-lived tickets are implemented.\n' : ''}
55
59
  ${has('queues') ? 'Queue processing retries unimplemented jobs and uses a dead-letter queue. Add product processing and transactional idempotency before acknowledging messages.\n' : ''}
56
60
  ${has('basin') ? 'Basin uses a Pipelines stream binding. Configure its stream, sink, R2/catalog and SQL in client-owned infrastructure; it is distinct from operational logs.\n' : ''}
57
- Provider packages are SDK factories or integration boundaries, not finished business features. Connect only needed packages to server entrypoints. Billing needs verified webhooks and idempotent consumption; RevenueCat adds cross-store entitlement configuration. Local data needs a platform-specific SQLite/filesystem adapter. Sentry needs a platform SDK and runtime initialization. Native auth and subscriptions need platform-specific setup.
61
+ ${has('neon') ? 'Neon provisioning configures the server runtime DATABASE_URL only. Set a separate direct DATABASE_URL_UNPOOLED in ignored packages/db/.env for the intended migration database and role. Run pnpm db:generate, review SQL, then pnpm db:migrate before testing authentication or application data.\n' : ''}
62
+ The root pnpm test command runs workspace test tasks; no application tests or test:live script are generated. Implement them for the product before verification.\n\nProvider packages are SDK factories or integration boundaries, not finished business features. Connect only needed packages to server entrypoints. Billing needs verified webhooks and idempotent consumption; RevenueCat adds cross-store entitlement configuration. Local data needs a platform-specific SQLite/filesystem adapter. Sentry needs a platform SDK and runtime initialization. Native auth and subscriptions need platform-specific setup.
58
63
 
59
64
  When the product needs a domain, purchase it in the client's GoDaddy account, then add its zone to the client's Cloudflare account and configure Cloudflare nameservers. The client retains registration, renewal, billing and recovery ownership. Verify DNS records and zone activation before connecting application domains and mail. Inbound mail uses Cloudflare Email Routing. Outbound business and application mail defaults to Cloudflare Email Sending; Resend is an alternative when selected. Configure the selected mail provider before use; init does not provision domains or mail services. GitHub Actions runs PR checks and never deploys automatically. Respect existing authorization; request only missing approval for paid activation, material spending, architecture changes or release.
60
65
  `);
@@ -77,7 +82,7 @@ jobs:
77
82
  - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271
78
83
  - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38
79
84
  with:
80
- node-version: '22'
85
+ node-version: '${voidSelected ? '24.21.0' : '22'}'
81
86
  cache: pnpm
82
87
  - run: pnpm install --frozen-lockfile
83
88
  - run: pnpm lint && pnpm typecheck && pnpm audit:deps
@@ -0,0 +1,4 @@
1
+ /** Fresh bootstrap only: framework-specific lint tooling belongs to its app. */
2
+ export declare function normalizeSharedLint(root: string): void;
3
+ /** Keep the starter's React/TypeScript rules and add the web app's Next API rules. */
4
+ export declare function writeWebLint(root: string): void;
@@ -0,0 +1,56 @@
1
+ import { existsSync, rmSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { json, put, readJson } from './files.js';
4
+ /** Fresh bootstrap only: framework-specific lint tooling belongs to its app. */
5
+ export function normalizeSharedLint(root) {
6
+ const file = 'packages/eslint-config/package.json';
7
+ if (!existsSync(path.join(root, file)))
8
+ return;
9
+ const manifest = readJson(root, file);
10
+ for (const group of [
11
+ 'dependencies',
12
+ 'devDependencies',
13
+ 'peerDependencies',
14
+ 'optionalDependencies',
15
+ ]) {
16
+ const dependencies = manifest[group];
17
+ if (dependencies && typeof dependencies === 'object' && !Array.isArray(dependencies))
18
+ delete dependencies['@next/eslint-plugin-next'];
19
+ }
20
+ if (manifest.exports && typeof manifest.exports === 'object' && !Array.isArray(manifest.exports))
21
+ delete manifest.exports['./next-js'];
22
+ json(root, file, manifest);
23
+ rmSync(path.join(root, 'packages/eslint-config/next.js'), { force: true });
24
+ }
25
+ /** Keep the starter's React/TypeScript rules and add the web app's Next API rules. */
26
+ export function writeWebLint(root) {
27
+ put(root, 'apps/web/eslint.config.js', `import { globalIgnores } from 'eslint/config';
28
+ import pluginNext from '@next/eslint-plugin-next';
29
+ import typescriptParser from '@typescript-eslint/parser';
30
+ import typescriptPlugin from '@typescript-eslint/eslint-plugin';
31
+ import { config as reactConfig } from '@workspace/eslint-config/react-internal';
32
+
33
+ export default [
34
+ ...reactConfig,
35
+ {
36
+ files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
37
+ languageOptions: { parser: typescriptParser, parserOptions: { ecmaFeatures: { jsx: true } } },
38
+ plugins: { '@typescript-eslint': typescriptPlugin },
39
+ rules: { 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': 'error' },
40
+ },
41
+ {
42
+ files: ['**/*.{ts,tsx}'],
43
+ // TypeScript checks undefined names; ESLint's core rule cannot model types.
44
+ rules: { 'no-undef': 'off' },
45
+ },
46
+ globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts', '.open-next/**', '.wrangler/**', '.void/**', 'dist/**', 'cloudflare-env.d.ts']),
47
+ {
48
+ plugins: { '@next/next': pluginNext },
49
+ rules: {
50
+ ...pluginNext.configs.recommended.rules,
51
+ ...pluginNext.configs['core-web-vitals'].rules,
52
+ },
53
+ },
54
+ ];
55
+ `);
56
+ }
@@ -0,0 +1,2 @@
1
+ import type { RecipeContext } from '../registry/types.js';
2
+ export declare function scaffoldNeonRealtime({ root, options, runtimeApp }: RecipeContext): void;