anhedral 0.17.0 → 0.18.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 (105) hide show
  1. package/README.md +33 -68
  2. package/assets/contracts/LICENSE +201 -0
  3. package/assets/contracts/LICENSE.environment +201 -0
  4. package/assets/contracts/LICENSE.operations +201 -0
  5. package/assets/contracts/deployment-provenance.json +15 -0
  6. package/assets/contracts/environment-provenance.json +11 -0
  7. package/assets/contracts/operations-provenance.json +11 -0
  8. package/assets/launch/application.server.ts.txt +13 -0
  9. package/assets/launch/auth-client.ts.txt +4 -0
  10. package/assets/launch/home.tsx.txt +20 -0
  11. package/assets/launch/minimal-application.server.ts.txt +5 -0
  12. package/assets/launch/minimal-server.ts.txt +7 -0
  13. package/assets/launch/request-context.ts.txt +3 -0
  14. package/assets/launch/root.tsx.txt +27 -0
  15. package/assets/launch/router.tsx.txt +21 -0
  16. package/assets/launch/server.ts.txt +13 -0
  17. package/assets/launch/sign-in.tsx.txt +53 -0
  18. package/assets/launch/styles.css.txt +19 -0
  19. package/assets/security/credential-patterns.d.mts +3 -0
  20. package/assets/security/credential-patterns.mjs +59 -0
  21. package/assets/stack/api-index.ts.txt +6 -1
  22. package/assets/stack/event-retention.sql.txt +10 -0
  23. package/assets/stack/stripe.ts.txt +30 -13
  24. package/dist/bin.js +55 -36
  25. package/dist/capabilities.d.ts +1 -1
  26. package/dist/capability-catalog.d.ts +44 -11
  27. package/dist/capability-catalog.js +96 -11
  28. package/dist/capability-command.d.ts +2 -2
  29. package/dist/capability-command.js +178 -27
  30. package/dist/capability-editor.js +6 -5
  31. package/dist/capability-recipes.js +54 -6
  32. package/dist/cli-arguments.d.ts +2 -0
  33. package/dist/cli-arguments.js +101 -50
  34. package/dist/cli-commands.d.ts +1 -1
  35. package/dist/cli-commands.js +30 -6
  36. package/dist/cli-errors.d.ts +18 -0
  37. package/dist/cli-errors.js +63 -0
  38. package/dist/cli-output.d.ts +22 -0
  39. package/dist/cli-output.js +42 -7
  40. package/dist/command-runner.d.ts +1 -0
  41. package/dist/command-runner.js +88 -0
  42. package/dist/command-schema.d.ts +16 -0
  43. package/dist/command-schema.js +390 -21
  44. package/dist/completion.d.ts +2 -0
  45. package/dist/completion.js +201 -0
  46. package/dist/composition.d.ts +35 -0
  47. package/dist/composition.js +28 -0
  48. package/dist/contracts/cli-transport.d.ts +217 -0
  49. package/dist/contracts/cli-transport.js +167 -0
  50. package/dist/contracts/deployment.d.ts +282 -0
  51. package/dist/contracts/deployment.js +234 -0
  52. package/dist/contracts/environment-file.d.ts +7 -0
  53. package/dist/contracts/environment-file.js +112 -0
  54. package/dist/contracts/environment-transport.d.ts +79 -0
  55. package/dist/contracts/environment-transport.js +110 -0
  56. package/dist/contracts/runtime-logs-transport.d.ts +127 -0
  57. package/dist/contracts/runtime-logs-transport.js +50 -0
  58. package/dist/contracts/source-bundle.d.ts +11 -0
  59. package/dist/contracts/source-bundle.js +197 -0
  60. package/dist/contracts/source-profile.d.ts +4 -0
  61. package/dist/contracts/source-profile.js +5 -0
  62. package/dist/contracts/staging-transport.d.ts +79 -0
  63. package/dist/contracts/staging-transport.js +43 -0
  64. package/dist/dependencies.d.ts +10 -1
  65. package/dist/dependencies.js +18 -1
  66. package/dist/index.d.ts +6 -0
  67. package/dist/index.js +4 -0
  68. package/dist/launch.d.ts +21 -0
  69. package/dist/launch.js +250 -0
  70. package/dist/platform-command.d.ts +9 -0
  71. package/dist/platform-command.js +584 -0
  72. package/dist/platform-environment.d.ts +18 -0
  73. package/dist/platform-environment.js +257 -0
  74. package/dist/platform-operations.d.ts +26 -0
  75. package/dist/platform-operations.js +155 -0
  76. package/dist/platform-source.d.ts +8 -0
  77. package/dist/platform-source.js +111 -0
  78. package/dist/platform-state.d.ts +13 -0
  79. package/dist/platform-state.js +207 -0
  80. package/dist/platforms/tanstack.d.ts +8 -0
  81. package/dist/platforms/tanstack.js +155 -0
  82. package/dist/registry/options.js +34 -31
  83. package/dist/registry/usage.d.ts +4 -1
  84. package/dist/registry/usage.js +58 -4
  85. package/dist/scaffold/styling.d.ts +1 -1
  86. package/dist/scaffold/workspace.js +11 -1
  87. package/dist/stack-registry.d.ts +2 -2
  88. package/dist/standard.js +21 -6
  89. package/dist/transaction.js +28 -3
  90. package/dist/ui-command.d.ts +4 -2
  91. package/dist/ui-command.js +79 -38
  92. package/dist/ui-project.d.ts +2 -0
  93. package/dist/ui-project.js +38 -8
  94. package/dist/util.js +40 -61
  95. package/dist/version.d.ts +1 -1
  96. package/dist/version.js +1 -1
  97. package/docs/capabilities.md +22 -88
  98. package/docs/software-factory.md +169 -9
  99. package/docs/stack-standard.md +7 -17
  100. package/docs/ui.md +9 -22
  101. package/package.json +27 -20
  102. package/docs/anhedral-stack.md +0 -12
  103. package/docs/assets/anhedral-stack-light.png +0 -0
  104. package/docs/assets/anhedral-stack.png +0 -0
  105. package/docs/native-ui.md +0 -47
@@ -0,0 +1,43 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from "zod";
3
+ const digest = z.string().regex(/^[a-f0-9]{64}$/);
4
+ export const stagingCreateSchema = z
5
+ .object({
6
+ requestId: z.uuid(),
7
+ candidateId: z.uuid(),
8
+ expectedGeneration: z.number().int().nonnegative(),
9
+ })
10
+ .strict();
11
+ export const stagingConfigurationSchema = z
12
+ .object({ snapshotId: z.uuid(), digest, environment: z.literal("staging") })
13
+ .strict();
14
+ export const stagingDeploymentSchema = z.object({
15
+ id: z.uuid(),
16
+ developmentId: z.uuid(),
17
+ candidateId: z.uuid(),
18
+ generation: z.number().int().positive(),
19
+ status: z.enum(["queued", "preparing", "ready", "deployed", "failed", "superseded"]),
20
+ summary: z.string().max(2000).nullable(),
21
+ sourceRevision: digest,
22
+ configuration: stagingConfigurationSchema,
23
+ createdAt: z.string(),
24
+ updatedAt: z.string(),
25
+ });
26
+ export const stagingStateSchema = z.object({
27
+ enabled: z.boolean().optional(),
28
+ canDeploy: z.boolean(),
29
+ generation: z.number().int().nonnegative(),
30
+ activeDeploymentId: z.uuid().nullable(),
31
+ desiredDeploymentId: z.uuid().nullable(),
32
+ deployments: z.array(stagingDeploymentSchema).max(30),
33
+ });
34
+ export const stagingCreateReceiptSchema = z
35
+ .object({
36
+ id: z.uuid(),
37
+ developmentId: z.uuid(),
38
+ candidateId: z.uuid(),
39
+ requestId: z.uuid(),
40
+ generation: z.number().int().positive(),
41
+ configuration: stagingConfigurationSchema,
42
+ })
43
+ .strict();
@@ -3,7 +3,16 @@ export interface DependencyGroup {
3
3
  devDependencies?: Record<string, string>;
4
4
  }
5
5
  export declare const WEB_DEPENDENCIES: DependencyGroup;
6
- export declare const OPENNEXT_GLOB_VERSION = "10.5.0";
6
+ export declare const ANHEDRAL_STACK_DEPENDENCIES: {
7
+ readonly '@tanstack/react-start': "1.169.4";
8
+ readonly '@tanstack/react-router': "1.170.46";
9
+ readonly '@cloudflare/vite-plugin': "1.67.0";
10
+ readonly '@tanstack/router-cli': "1.167.46";
11
+ readonly '@vitejs/plugin-react': "6.2.1";
12
+ readonly vite: "8.3.5";
13
+ readonly wrangler: "4.156.1";
14
+ };
15
+ export declare const OPENNEXT_GLOB_VERSION = "14.0.2";
7
16
  export declare const WORKSPACE_NODE_ENGINE = "^22.13.0 || >=24.0.0";
8
17
  export declare const PACKAGE_MANAGER = "pnpm@10.34.5";
9
18
  export declare const STACK_DEPENDENCIES: {
@@ -40,8 +40,25 @@ export const WEB_DEPENDENCIES = {
40
40
  wrangler: '4.151.0',
41
41
  },
42
42
  };
43
+ // Current Anhedral Stack framework/build tooling; legacy generators retain their own pins.
44
+ export const ANHEDRAL_STACK_DEPENDENCIES = {
45
+ // renovate: datasource=npm depName=@tanstack/react-start
46
+ '@tanstack/react-start': '1.169.4',
47
+ // renovate: datasource=npm depName=@tanstack/react-router
48
+ '@tanstack/react-router': '1.170.46',
49
+ // renovate: datasource=npm depName=@cloudflare/vite-plugin
50
+ '@cloudflare/vite-plugin': '1.67.0',
51
+ // renovate: datasource=npm depName=@tanstack/router-cli
52
+ '@tanstack/router-cli': '1.167.46',
53
+ // renovate: datasource=npm depName=@vitejs/plugin-react
54
+ '@vitejs/plugin-react': '6.2.1',
55
+ // renovate: datasource=npm depName=vite
56
+ vite: '8.3.5',
57
+ // renovate: datasource=npm depName=wrangler
58
+ wrangler: '4.156.1',
59
+ };
43
60
  // renovate: datasource=npm depName=glob
44
- export const OPENNEXT_GLOB_VERSION = '10.5.0';
61
+ export const OPENNEXT_GLOB_VERSION = '14.0.2';
45
62
  export const WORKSPACE_NODE_ENGINE = '^22.13.0 || >=24.0.0';
46
63
  export const PACKAGE_MANAGER = 'pnpm@10.34.5';
47
64
  export const STACK_DEPENDENCIES = {
package/dist/index.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ /** The Anhedral Stack: one web foundation with progressive backend, storage and payments. */
2
+ export { scaffoldLaunchProject as scaffoldAnhedralStack } from './launch.js';
3
+ export type { LaunchOptions as AnhedralStackOptions } from './launch.js';
4
+ export { parseAnhedralStackOptions as parseInitOptions } from './launch.js';
5
+ /** @deprecated Retained SDK compatibility. Use scaffoldAnhedralStack and parseInitOptions. */
1
6
  export { parseStandardOptions, scaffoldStandardProject, STANDARD_PRODUCTS, STANDARD_USAGE, } from './standard.js';
7
+ /** @deprecated Retained SDK compatibility. Use AnhedralStackOptions for new apps. */
2
8
  export type { StandardOptions, StandardProduct, StandardRunner } from './standard.js';
3
9
  export { GENERATOR_VERSION } from './version.js';
package/dist/index.js CHANGED
@@ -1,2 +1,6 @@
1
+ /** The Anhedral Stack: one web foundation with progressive backend, storage and payments. */
2
+ export { scaffoldLaunchProject as scaffoldAnhedralStack } from './launch.js';
3
+ export { parseAnhedralStackOptions as parseInitOptions } from './launch.js';
4
+ /** @deprecated Retained SDK compatibility. Use scaffoldAnhedralStack and parseInitOptions. */
1
5
  export { parseStandardOptions, scaffoldStandardProject, STANDARD_PRODUCTS, STANDARD_USAGE, } from './standard.js';
2
6
  export { GENERATOR_VERSION } from './version.js';
@@ -0,0 +1,21 @@
1
+ import { type OutputOptions } from './cli-output.js';
2
+ import type { StandardOptions, StandardRunner } from './registry/types.js';
3
+ export type LaunchOptions = Pick<StandardOptions, 'root' | 'name' | 'skipInstall' | 'dryRun' | 'json' | 'initializeGit'>;
4
+ /** One stack, with directory/install options only; no legacy product selections. */
5
+ export declare function parseAnhedralStackOptions(args: readonly string[]): LaunchOptions;
6
+ export declare function launchPlan(options: LaunchOptions): {
7
+ schemaVersion: number;
8
+ cliVersion: string;
9
+ root: string;
10
+ name: string;
11
+ products: string[];
12
+ stack: string;
13
+ foundation: string;
14
+ capabilities: ("hono" | "database-auth" | "r2" | "stripe" | "realtime" | "rtc" | "ai" | "expo" | "native-ui" | "revenuecat" | "wxt" | "side-panel" | "gpui")[];
15
+ targets: string[];
16
+ dryRun: boolean;
17
+ resourcesProvisioned: boolean;
18
+ hostedAdmission: string;
19
+ };
20
+ /** Fresh directories only; source commit and installation retain the existing recovery contract. */
21
+ export declare function scaffoldLaunchProject(options: LaunchOptions, run?: StandardRunner, output?: OutputOptions): Promise<void>;
package/dist/launch.js ADDED
@@ -0,0 +1,250 @@
1
+ import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, rmdirSync } from 'node:fs';
2
+ import { randomUUID } from 'node:crypto';
3
+ import { spawnSync } from 'node:child_process';
4
+ import path from 'node:path';
5
+ import { scaffoldTanstack } from './platforms/tanstack.js';
6
+ import { bootstrapWorkspace, assertWorkspaceRuntime } from './scaffold/bootstrap.js';
7
+ import { scaffoldStyling } from './scaffold/styling.js';
8
+ import { json, put, sharedPackage } from './scaffold/files.js';
9
+ import { CapabilityEditor } from './capability-editor.js';
10
+ import { addCapabilityRecipe, composeCapabilities } from './capability-recipes.js';
11
+ import { launchCompositionSchema } from './composition.js';
12
+ import { runStagedTransaction } from './transaction.js';
13
+ import { configureDependencyPatches, writeDependencyAudit } from './dependency-patches.js';
14
+ import { setPnpmPolicy } from './pnpm-policy.js';
15
+ import { GENERATOR_VERSION } from './version.js';
16
+ import { PACKAGE_MANAGER, STACK_DEPENDENCIES, WORKSPACE_NODE_ENGINE } from './dependencies.js';
17
+ import { execFile, appendGitignore } from './util.js';
18
+ import { printProgress, printResult } from './cli-output.js';
19
+ import { parseStandardOptions } from './registry/options.js';
20
+ /** One stack, with directory/install options only; no legacy product selections. */
21
+ export function parseAnhedralStackOptions(args) {
22
+ const { root, name, skipInstall, dryRun, json, initializeGit } = parseStandardOptions(args);
23
+ return { root, name, skipInstall, dryRun, json, initializeGit };
24
+ }
25
+ const launchCapabilities = [];
26
+ function rootFiles(root, name) {
27
+ json(root, 'package.json', {
28
+ name,
29
+ private: true,
30
+ packageManager: PACKAGE_MANAGER,
31
+ engines: { node: WORKSPACE_NODE_ENGINE },
32
+ scripts: {
33
+ dev: 'pnpm --filter @workspace/web dev',
34
+ build: 'turbo build --concurrency=1',
35
+ lint: 'turbo lint',
36
+ typecheck: 'turbo typecheck',
37
+ test: 'turbo test',
38
+ check: 'pnpm lint && pnpm typecheck && pnpm test && pnpm build',
39
+ 'audit:deps': 'node scripts/audit-deps.mjs',
40
+ },
41
+ devDependencies: { turbo: STACK_DEPENDENCIES.turbo },
42
+ });
43
+ json(root, 'turbo.json', {
44
+ $schema: 'https://turborepo.com/schema.json',
45
+ globalDependencies: ['**/.dev.vars', '**/.dev.vars.*', '**/.env', '**/.env.*'],
46
+ tasks: {
47
+ build: { dependsOn: ['^build'], outputs: ['dist/**'] },
48
+ lint: { dependsOn: ['^lint'] },
49
+ typecheck: {
50
+ dependsOn: ['^typecheck'],
51
+ outputs: ['worker-configuration.d.ts', 'src/routeTree.gen.ts'],
52
+ },
53
+ test: { dependsOn: ['^build'], outputs: ['coverage/**'] },
54
+ },
55
+ });
56
+ setPnpmPolicy(root, {
57
+ packages: ['apps/*', 'packages/*'],
58
+ sharedWorkspaceLockfile: true,
59
+ onlyBuiltDependencies: ['esbuild', 'workerd'],
60
+ });
61
+ json(root, 'anhedral.json', {
62
+ schemaVersion: 1,
63
+ identity: { schemaVersion: 1, id: randomUUID() },
64
+ setup: {
65
+ schemaVersion: 1,
66
+ cliVersion: GENERATOR_VERSION,
67
+ stack: 'anhedral-stack',
68
+ resourcesProvisioned: false,
69
+ },
70
+ standard: {
71
+ schemaVersion: 1,
72
+ standard: 'anhedral-stack',
73
+ hosting: 'cloudflare',
74
+ resourcesProvisioned: false,
75
+ },
76
+ composition: launchCompositionSchema.parse({
77
+ contractVersion: 2,
78
+ foundation: 'tanstack-start',
79
+ generatorVersion: GENERATOR_VERSION,
80
+ identity: 'none',
81
+ capabilities: Object.fromEntries(launchCapabilities.map((id) => [id, GENERATOR_VERSION])),
82
+ }),
83
+ });
84
+ appendGitignore(root, 'node_modules/\ndist/\n.turbo/\n.wrangler/\n.tanstack/\n*.tsbuildinfo\nworker-configuration.d.ts\n.dev.vars\n.dev.vars.*\n!.dev.vars.example\n.env\n.env.*\n!.env.example\n.anhedral/\n'
85
+ .trim()
86
+ .split('\n'));
87
+ writeDependencyAudit(root);
88
+ }
89
+ function documentation(root, name) {
90
+ put(root, 'README.md', `# ${name}
91
+
92
+ Anhedral Stack: web UI powered by TanStack Start server rendering/server functions
93
+ and source-owned shadcn Anhedral UI.
94
+ Only the web application is created initially. No backend or provider is provisioned.
95
+
96
+ ## Develop
97
+
98
+ Use the Node/pnpm versions in package.json. Run pnpm install if generation skipped
99
+ installation, then pnpm dev and open http://localhost:3000. Run pnpm check and
100
+ pnpm audit:deps before deployment. Editable routes live in apps/web/src/routes.
101
+ Use anhedral ui add card --web for more shadcn components; preserve local edits.
102
+
103
+ ## Add services progressively
104
+
105
+ Run anhedral add backend to add Hono, Drizzle/D1 and Better Auth together.
106
+ Then run anhedral add r2 for private storage, or anhedral add stripe for payments.
107
+ Missing prerequisites stop before writes; --with-dependencies opts into them.
108
+ The public additions are backend, r2 and stripe; this application is web-only.
109
+
110
+ After adding backend, copy apps/api/.dev.vars.example to apps/api/.dev.vars.
111
+ Set PUBLIC_APP_URL=http://localhost:3000 and generate BETTER_AUTH_SECRET with
112
+ \`node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"\`.
113
+ Auth methods start disabled. Deliberately enable chosen methods in
114
+ apps/api/src/auth-features.ts after configuring email/credentials and policies.
115
+ Run pnpm db:migrate --local explicitly to initialize the isolated local D1 database,
116
+ then pnpm dev. Vite runs the web and auxiliary API Workers with shared local
117
+ persistence. Remote bindings are disabled for local development.
118
+
119
+ R2 routes enforce authenticated owner access. Stripe adds schema and source only:
120
+ run pnpm db:generate, review the SQL, then deliberately apply the local migration
121
+ before exercising subscription/webhook flows. Configure Stripe test credentials,
122
+ allowed prices and signed webhooks; activation and live payments are separate.
123
+
124
+ ## Ownership and deployment
125
+
126
+ Hono owns data, identity and private storage. Web server functions call its scoped
127
+ service binding, never import another application's source or provider credentials.
128
+ Custom API routes belong in apps/api/src/index.ts; schema/migrations in packages/db.
129
+ Composition adapters are fingerprinted and customized files are never overwritten.
130
+
131
+ Builds/startup never migrate databases. Provision D1/R2 only when selected and
132
+ configure environment-specific resources/secrets separately. pnpm build emits web
133
+ and selected API Worker artifacts under apps/web/dist. Anhedral Platform admission
134
+ requires its separately reviewed Anhedral Stack runtime/artifact; generation is not activation.
135
+ `);
136
+ put(root, 'AGENTS.md', `# Anhedral Stack application
137
+
138
+ Use the single Anhedral Stack, starting with TanStack Start and source-owned shadcn UI. Add backend for Hono,
139
+ Drizzle/D1 and Better Auth together. Add r2 and stripe only when required. Mobile,
140
+ extensions and desktop are outside launch scope.
141
+
142
+ Edit web product routes in apps/web/src/routes, API routes in apps/api/src/index.ts,
143
+ and database schema in packages/db/src. Preserve customized composition adapters,
144
+ semantic UI tokens and attribution. No cross-application source imports.
145
+ Web server functions receive scoped API bindings through request context; keep
146
+ identity, database/storage access and secrets inside Hono. Auth methods require
147
+ explicit activation. Run pnpm check and pnpm audit:deps. Never migrate a configured
148
+ database in builds/tests/startup; apply reviewed SQL deliberately to isolated fixtures.
149
+ `);
150
+ }
151
+ export function launchPlan(options) {
152
+ return {
153
+ schemaVersion: 1,
154
+ cliVersion: GENERATOR_VERSION,
155
+ root: options.root,
156
+ name: options.name,
157
+ products: ['tanstack-start', ...launchCapabilities],
158
+ stack: 'anhedral-stack',
159
+ foundation: 'tanstack-start',
160
+ capabilities: [...launchCapabilities],
161
+ targets: ['apps/web'],
162
+ dryRun: options.dryRun,
163
+ resourcesProvisioned: false,
164
+ hostedAdmission: 'not evaluated',
165
+ };
166
+ }
167
+ /** Fresh directories only; source commit and installation retain the existing recovery contract. */
168
+ export async function scaffoldLaunchProject(options, run = execFile, output = {}) {
169
+ const root = options.root;
170
+ const info = lstatSync(root, { throwIfNoEntry: false });
171
+ if (info && (info.isSymbolicLink() || !info.isDirectory()))
172
+ throw Error('Destination must be a real directory.');
173
+ const plan = launchPlan(options);
174
+ const display = { ...output, json: options.json };
175
+ const assertEmpty = (recovery = false) => {
176
+ if (!existsSync(root))
177
+ return;
178
+ const allowed = [
179
+ '.git',
180
+ '.gitignore',
181
+ ...(recovery ? ['.anhedral.lock', '.anhedral-txn', '.anhedral-journal.json'] : []),
182
+ ];
183
+ const extra = readdirSync(root).find((name) => !allowed.includes(name));
184
+ if (extra)
185
+ throw Error(`Destination must be empty (apart from .git/.gitignore): ${extra}`);
186
+ };
187
+ if (options.dryRun) {
188
+ assertEmpty();
189
+ printResult('init', plan, display);
190
+ return;
191
+ }
192
+ assertWorkspaceRuntime(run);
193
+ const created = !info;
194
+ if (created)
195
+ mkdirSync(root, { recursive: true });
196
+ try {
197
+ const commitPaths = [];
198
+ await runStagedTransaction(root, {
199
+ commitPaths,
200
+ seedPaths: existsSync(path.join(root, '.gitignore')) ? ['.gitignore'] : [],
201
+ prepare: () => assertEmpty(true),
202
+ build: async (stage) => {
203
+ printProgress('Creating the Anhedral Stack…', display);
204
+ bootstrapWorkspace(stage, options.name, run);
205
+ rootFiles(stage, options.name);
206
+ sharedPackage(stage, 'styling', "export { light, dark, spacing } from './tokens.cjs';\n", {});
207
+ scaffoldStyling({ root: stage });
208
+ scaffoldTanstack(stage, options.name);
209
+ const editor = new CapabilityEditor(stage, {});
210
+ const installed = [];
211
+ for (const capability of installed)
212
+ addCapabilityRecipe(editor, capability, options.name);
213
+ composeCapabilities(editor, installed);
214
+ editor.set('anhedral.json', ['capabilities'], {
215
+ schemaVersion: 1,
216
+ installed,
217
+ managedFiles: editor.managed,
218
+ resourcesProvisionedByCli: false,
219
+ });
220
+ for (const [file, source] of editor.writes)
221
+ put(stage, file, source);
222
+ documentation(stage, options.name);
223
+ if (!options.skipInstall) {
224
+ printProgress('Resolving Anhedral Stack dependencies…', display);
225
+ run('pnpm', ['install', '--lockfile-only', '--no-frozen-lockfile'], stage);
226
+ if (configureDependencyPatches(stage))
227
+ run('pnpm', ['install', '--lockfile-only', '--no-frozen-lockfile'], stage);
228
+ }
229
+ commitPaths.push(...readdirSync(stage).filter((name) => name !== 'node_modules'));
230
+ },
231
+ afterCommit: () => {
232
+ if (options.initializeGit) {
233
+ const checkout = spawnSync('git', ['rev-parse', '--show-toplevel'], {
234
+ cwd: root,
235
+ encoding: 'utf8',
236
+ });
237
+ if (checkout.status !== 0 || realpathSync(checkout.stdout.trim()) !== realpathSync(root))
238
+ run('git', ['init'], root);
239
+ }
240
+ if (!options.skipInstall)
241
+ run('pnpm', ['install', '--frozen-lockfile'], root);
242
+ },
243
+ });
244
+ printResult('init', { ...plan, generated: true, dependenciesInstalled: !options.skipInstall }, display);
245
+ }
246
+ finally {
247
+ if (created && existsSync(root) && readdirSync(root).length === 0)
248
+ rmdirSync(root);
249
+ }
250
+ }
@@ -0,0 +1,9 @@
1
+ import { type OutputOptions } from './cli-output.js';
2
+ import { type SecretStore } from './platform-state.js';
3
+ interface PlatformDependencies {
4
+ store?: SecretStore;
5
+ fetch?: typeof fetch;
6
+ sleep?: (ms: number) => Promise<void>;
7
+ }
8
+ export declare function runPlatformCommand(command: string, args: string[], output: OutputOptions, dependencies?: PlatformDependencies): Promise<void>;
9
+ export {};