anhedral 0.21.0 → 0.22.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 (87) hide show
  1. package/README.md +4 -2
  2. package/assets/contracts/deployment-provenance.json +5 -5
  3. package/assets/launch/router.tsx.txt +1 -0
  4. package/dist/cli-commands.js +5 -17
  5. package/dist/cli-errors.js +1 -1
  6. package/dist/command-schema.d.ts +1 -0
  7. package/dist/command-schema.js +14 -0
  8. package/dist/completion.js +1 -1
  9. package/dist/{capability-command.d.ts → composition/command.d.ts} +3 -3
  10. package/dist/{capability-command.js → composition/command.js} +12 -12
  11. package/dist/{composition.d.ts → composition/composition.d.ts} +1 -1
  12. package/dist/{composition.js → composition/composition.js} +2 -2
  13. package/dist/{capability-editor.js → composition/editor.js} +1 -1
  14. package/dist/{capability-recipes.d.ts → composition/recipes.d.ts} +2 -2
  15. package/dist/{capability-recipes.js → composition/recipes.js} +7 -7
  16. package/dist/{capability-references.js → composition/references.js} +2 -2
  17. package/dist/{stack-update.d.ts → composition/update.d.ts} +3 -3
  18. package/dist/{stack-update.js → composition/update.js} +11 -11
  19. package/dist/contracts/cli-transport.d.ts +1 -8
  20. package/dist/contracts/cli-transport.js +0 -11
  21. package/dist/contracts/deployment.d.ts +4 -65
  22. package/dist/contracts/deployment.js +9 -60
  23. package/dist/contracts/production-transport.d.ts +2 -2
  24. package/dist/contracts/staging-transport.d.ts +2 -2
  25. package/dist/launch.js +5 -5
  26. package/dist/platform/auth.d.ts +14 -0
  27. package/dist/platform/auth.js +62 -0
  28. package/dist/{platform-command.d.ts → platform/command.d.ts} +2 -2
  29. package/dist/platform/command.js +279 -0
  30. package/dist/{credential-helper.js → platform/credential-helper.js} +1 -1
  31. package/dist/platform/deploy.d.ts +2 -0
  32. package/dist/platform/deploy.js +158 -0
  33. package/dist/{platform-environment.d.ts → platform/environment.d.ts} +1 -1
  34. package/dist/{platform-environment.js → platform/environment.js} +7 -7
  35. package/dist/platform/http.d.ts +7 -0
  36. package/dist/platform/http.js +105 -0
  37. package/dist/{platform-operations.d.ts → platform/operations.d.ts} +1 -1
  38. package/dist/{platform-operations.js → platform/operations.js} +5 -5
  39. package/dist/platform/output.d.ts +2 -0
  40. package/dist/platform/output.js +79 -0
  41. package/dist/{platform-production.d.ts → platform/production.d.ts} +1 -1
  42. package/dist/{platform-production.js → platform/production.js} +4 -4
  43. package/dist/platform/projects.d.ts +12 -0
  44. package/dist/platform/projects.js +125 -0
  45. package/dist/{platform-source.js → platform/source.js} +7 -7
  46. package/dist/platform/state-schema.d.ts +25 -0
  47. package/dist/platform/state-schema.js +11 -0
  48. package/dist/{platform-state.d.ts → platform/state.d.ts} +1 -1
  49. package/dist/{platform-state.js → platform/state.js} +3 -4
  50. package/dist/platform/types.d.ts +26 -0
  51. package/dist/platform/upload.d.ts +2 -0
  52. package/dist/platform/upload.js +60 -0
  53. package/dist/process/runner.d.ts +1 -0
  54. package/dist/{command-runner.js → process/runner.js} +1 -1
  55. package/dist/registry/usage.d.ts +1 -0
  56. package/dist/{platforms → scaffold}/tanstack.d.ts +2 -2
  57. package/dist/{platforms → scaffold}/tanstack.js +2 -2
  58. package/dist/transactions/durable-files.d.ts +8 -0
  59. package/dist/transactions/durable-files.js +132 -0
  60. package/dist/transactions/journal.d.ts +4 -0
  61. package/dist/transactions/journal.js +141 -0
  62. package/dist/{transaction-lock.js → transactions/lock.js} +2 -2
  63. package/dist/transactions/model.d.ts +18 -0
  64. package/dist/transactions/model.js +4 -0
  65. package/dist/transactions/paths.d.ts +12 -0
  66. package/dist/transactions/paths.js +155 -0
  67. package/dist/transactions/recovery.d.ts +7 -0
  68. package/dist/transactions/recovery.js +132 -0
  69. package/dist/{transaction.d.ts → transactions/transaction.d.ts} +1 -2
  70. package/dist/transactions/transaction.js +179 -0
  71. package/dist/util.js +2 -2
  72. package/dist/version.d.ts +1 -1
  73. package/dist/version.js +1 -1
  74. package/docs/software-factory.md +45 -8
  75. package/package.json +19 -19
  76. package/dist/platform-command.js +0 -787
  77. package/dist/transaction.js +0 -716
  78. /package/dist/{capability-catalog.d.ts → composition/catalog.d.ts} +0 -0
  79. /package/dist/{capability-catalog.js → composition/catalog.js} +0 -0
  80. /package/dist/{capability-editor.d.ts → composition/editor.d.ts} +0 -0
  81. /package/dist/{capability-references.d.ts → composition/references.d.ts} +0 -0
  82. /package/dist/{credential-helper.d.ts → platform/credential-helper.d.ts} +0 -0
  83. /package/dist/{platform-source.d.ts → platform/source.d.ts} +0 -0
  84. /package/dist/{command-runner.d.ts → platform/types.js} +0 -0
  85. /package/dist/{command.d.ts → process/resolve-command.d.ts} +0 -0
  86. /package/dist/{command.js → process/resolve-command.js} +0 -0
  87. /package/dist/{transaction-lock.d.ts → transactions/lock.d.ts} +0 -0
package/README.md CHANGED
@@ -3,7 +3,9 @@
3
3
  > [!WARNING]
4
4
  > Under construction. Commands, generated source and managed integration are evolving.
5
5
 
6
- Generate the **Anhedral Stack** as editable source. Start with web UI, then add the backend, private storage and payments when needed. There is one current stack and one CLI generator; no stack selector or separate public stack registry is required.
6
+ The open-source CLI for building and managing apps through the **Anhedral API**. Use it directly or through the Codex and Claude Code plugin to create projects, upload source, configure environments, deploy apps and read runtime logs.
7
+
8
+ The plugin guides an agent through CLI commands so you can describe what you want to build in conversation. Platform enforces account, project and deployment permissions. The CLI also generates the **Anhedral Stack** as editable source, starting with web UI and adding backend, storage and payments when needed. Local source generation requires no account.
7
9
 
8
10
  ## Start
9
11
 
@@ -45,7 +47,7 @@ pnpm dlx shadcn@4.22.1 add card
45
47
 
46
48
  Review diffs and preserve local edits and required upstream notices. The generated `LICENSE.shadcn` accompanies the bundled starter source. See [web UI](docs/ui.md).
47
49
 
48
- ## Optional Platform access
50
+ ## Connect to Anhedral
49
51
 
50
52
  Local generation requires no account. After browser-approved `login`, use `projects list --human` to discover projects and team IDs. Register your generated application with `projects create --name <name> --link --human`, or connect an existing project with `link --project <uuid> --team <uuid>`. `source upload --dry-run` inspects packaging without uploading; `source upload` sends a resumable immutable checkpoint.
51
53
 
@@ -2,14 +2,14 @@
2
2
  "contractVersion": 1,
3
3
  "owner": "anhedral/platform-contracts/deployment",
4
4
  "license": "Apache-2.0",
5
- "sourceRevision": "63682e8ec510a984bfa14c02839b466a612dfc93",
5
+ "sourceRevision": "2049016a3ec30720d5bc284b6d06cd8c60ce662b",
6
6
  "files": {
7
- "cli-transport.ts": "0a20f25e6aa975aaa862531bda5e7318c7469b635c9261a878895e45b68724a8",
7
+ "cli-transport.ts": "8bd4063d358b755e72fec637d88b3587c69a6dd3f94f0583c4d676e181386064",
8
8
  "source-profile.ts": "1426caa2675db95d249ca36bb06c039ce8382379fd33cf9cdae48d7aad2faded",
9
9
  "source-bundle.ts": "99df4874f9337a604da544093215de24f19f136182017be15629f78b5180a52b",
10
- "deployment.ts": "dbcb2b80129345a54e8cef340a48ffeadff662c903185ae5f6ac1120ced776df",
11
- "fixtures.json": "2dfc70a23c5f60c293f2594263b8f5177b369f162026c323004ff5482f40f154",
12
- "acceptance.mjs": "66605b98f1a606ae41df35b5e715e8626e760be351ee21c90cc9358a44b8b58a",
10
+ "deployment.ts": "e11e5ae4b8f2f8ca71c4930cf4dab8ae33e3d66c2d86827890f8207a8268147f",
11
+ "fixtures.json": "9b127ee73ec726b63ae772fc0b071a8612e92219f54a84073becd8a2fa078bf3",
12
+ "acceptance.mjs": "f0abb2ff918fe7a448a20b43b96fb299114e7cc8b0d2debbad40ab7ff63a0d07",
13
13
  "LICENSE": "6d89bce3e7760469015287d1b6a45d31ef7924475c9b54eabe974bcce373980b"
14
14
  }
15
15
  }
@@ -1,3 +1,4 @@
1
+ import type {} from '@tanstack/react-start';
1
2
  import { createRouter } from '@tanstack/react-router';
2
3
  import { routeTree } from './routeTree.gen';
3
4
  import type { ApplicationContext } from './lib/request-context';
@@ -1,6 +1,7 @@
1
- import { runPlatformCommand } from './platform-command.js';
2
- import { runStackUpdate } from './stack-update.js';
3
- import { runCapabilityCommand } from './capability-command.js';
1
+ import { commandDefinition } from './command-schema.js';
2
+ import { runPlatformCommand } from './platform/command.js';
3
+ import { runStackUpdate } from './composition/update.js';
4
+ import { runCapabilityCommand } from './composition/command.js';
4
5
  import { commandArgumentError } from './cli-arguments.js';
5
6
  import { createReporter } from './cli-output.js';
6
7
  import { scaffoldLaunchProject, parseAnhedralStackOptions } from './launch.js';
@@ -14,20 +15,7 @@ export async function runCommand(command, args, output) {
14
15
  createReporter(output, () => script.trimEnd()).result({ shell, script });
15
16
  return;
16
17
  }
17
- if ([
18
- 'login',
19
- 'logout',
20
- 'whoami',
21
- 'projects',
22
- 'link',
23
- 'unlink',
24
- 'source',
25
- 'deploy',
26
- 'env',
27
- 'staging',
28
- 'production',
29
- 'logs',
30
- ].includes(command))
18
+ if (commandDefinition(command)?.owner === 'platform')
31
19
  return runPlatformCommand(command, args, output);
32
20
  if (command === 'stack' && commandArguments('stack', args).positional[0] === 'update')
33
21
  return runStackUpdate(args, output);
@@ -1,5 +1,5 @@
1
1
  import { CliArgumentError } from './cli-arguments.js';
2
- import { PostCommitError } from './transaction.js';
2
+ import { PostCommitError } from './transactions/transaction.js';
3
3
  export class CliFailure extends Error {
4
4
  code;
5
5
  nextAction;
@@ -18,6 +18,7 @@ export interface CommandPositional {
18
18
  choices?: readonly string[];
19
19
  }
20
20
  export interface CommandDefinition {
21
+ owner?: 'platform';
21
22
  description: string;
22
23
  usage: string;
23
24
  options: readonly CommandOption[];
@@ -154,6 +154,7 @@ export const COMMANDS = {
154
154
  note: 'Prints the script only; never edits your shell profile or contacts Platform.',
155
155
  },
156
156
  login: {
157
+ owner: 'platform',
157
158
  description: 'Approve a short-lived CLI session in your browser.',
158
159
  usage: 'login [--start|--resume]',
159
160
  options: [
@@ -166,6 +167,7 @@ export const COMMANDS = {
166
167
  note: 'Device secrets and API tokens stay in your credential store. Server CLI access must be configured.',
167
168
  },
168
169
  logout: {
170
+ owner: 'platform',
169
171
  description: 'Revoke this CLI session.',
170
172
  usage: 'logout',
171
173
  options: PLATFORM_OPTIONS,
@@ -173,6 +175,7 @@ export const COMMANDS = {
173
175
  note: 'Revokes server access before clearing local credentials.',
174
176
  },
175
177
  whoami: {
178
+ owner: 'platform',
176
179
  description: 'Show the current CLI identity.',
177
180
  usage: 'whoami',
178
181
  options: [
@@ -185,6 +188,7 @@ export const COMMANDS = {
185
188
  examples: ['whoami --json', 'whoami --context --human'],
186
189
  },
187
190
  projects: {
191
+ owner: 'platform',
188
192
  description: 'List or create Platform projects.',
189
193
  usage: 'projects <list|create> [options]',
190
194
  options: PROJECT_OPTIONS,
@@ -209,6 +213,7 @@ export const COMMANDS = {
209
213
  examples: ['projects list', 'projects create --name "My app"'],
210
214
  },
211
215
  link: {
216
+ owner: 'platform',
212
217
  description: 'Link this workspace to an existing project.',
213
218
  usage: 'link --project <uuid> --team <uuid>',
214
219
  options: [
@@ -220,12 +225,14 @@ export const COMMANDS = {
220
225
  note: 'Requires current project build access. Existing application identities are preserved.',
221
226
  },
222
227
  unlink: {
228
+ owner: 'platform',
223
229
  description: 'Remove the local project link.',
224
230
  usage: 'unlink',
225
231
  options: PLATFORM_OPTIONS,
226
232
  examples: ['unlink'],
227
233
  },
228
234
  deploy: {
235
+ owner: 'platform',
229
236
  description: 'Plan deployment and reserve a candidate from sealed source.',
230
237
  usage: 'deploy <plan|prepare|status> [options]',
231
238
  options: [
@@ -279,6 +286,7 @@ export const COMMANDS = {
279
286
  note: 'Preparation reserves a candidate; server policy controls build admission. No preview or deployment is activated.',
280
287
  },
281
288
  env: {
289
+ owner: 'platform',
282
290
  description: 'Manage project configuration and write-only secrets through Platform.',
283
291
  usage: 'env <list|import|set> [options]',
284
292
  options: ENVIRONMENT_OPTIONS,
@@ -311,6 +319,7 @@ export const COMMANDS = {
311
319
  note: 'Values never appear in output or retry state. Platform enforces project roles and production approvals; saving configuration does not change an existing deployment.',
312
320
  },
313
321
  staging: {
322
+ owner: 'platform',
314
323
  description: 'Manage persistent staging deployments for the linked project.',
315
324
  usage: 'staging <status|deploy> [options]',
316
325
  options: STAGING_OPTIONS,
@@ -324,6 +333,7 @@ export const COMMANDS = {
324
333
  examples: ['staging status --json'],
325
334
  },
326
335
  deploy: {
336
+ owner: 'platform',
327
337
  description: 'Deploy a ready candidate to staging.',
328
338
  usage: 'staging deploy --candidate <uuid> [--new]',
329
339
  options: STAGING_OPTIONS,
@@ -335,6 +345,7 @@ export const COMMANDS = {
335
345
  note: 'Retried requests retain the same identity and generation. Configuration is frozen for each new staging deployment; production approval stays in Platform.',
336
346
  },
337
347
  production: {
348
+ owner: 'platform',
338
349
  description: 'Deploy a ready candidate with your current production permissions.',
339
350
  usage: 'production <status|deploy> [options]',
340
351
  options: PRODUCTION_OPTIONS,
@@ -348,6 +359,7 @@ export const COMMANDS = {
348
359
  examples: ['production status --json'],
349
360
  },
350
361
  deploy: {
362
+ owner: 'platform',
351
363
  description: 'Request production publication of a ready candidate.',
352
364
  usage: 'production deploy --candidate <uuid> --name <slug> [--new]',
353
365
  options: PRODUCTION_OPTIONS,
@@ -359,6 +371,7 @@ export const COMMANDS = {
359
371
  note: 'Platform checks current production permissions and freezes configuration. Self-service teams need no second approver; an explicitly required independent review remains enforced.',
360
372
  },
361
373
  logs: {
374
+ owner: 'platform',
362
375
  description: 'Read redacted runtime logs for the linked project.',
363
376
  usage: 'logs [options]',
364
377
  positional: { name: 'arguments', min: 0, max: 0 },
@@ -418,6 +431,7 @@ export const COMMANDS = {
418
431
  note: 'Runtime collection is best effort and reports unavailable coverage and dropped events. Retention is seven days; source/build logs remain separate.',
419
432
  },
420
433
  source: {
434
+ owner: 'platform',
421
435
  description: 'Upload an immutable source checkpoint with resumable chunks.',
422
436
  usage: 'source <upload|status> [options]',
423
437
  options: [
@@ -1,5 +1,5 @@
1
1
  import { COMMANDS, GLOBAL_OPTIONS, commandOptions, commandTopic, } from './command-schema.js';
2
- import { PUBLIC_STACK_ADDITIONS } from './capability-catalog.js';
2
+ import { PUBLIC_STACK_ADDITIONS } from './composition/catalog.js';
3
3
  /** Quote data for shell source. Completion never evaluates user input. */
4
4
  function quote(value) {
5
5
  return "'" + value.replaceAll("'", "'\"'\"'") + "'";
@@ -1,6 +1,6 @@
1
- import { type OutputOptions } from './cli-output.js';
2
- import { CapabilityEditor } from './capability-editor.js';
3
- import type { CommandRunner } from './command-types.js';
1
+ import { type OutputOptions } from '../cli-output.js';
2
+ import { CapabilityEditor } from './editor.js';
3
+ import type { CommandRunner } from '../command-types.js';
4
4
  export declare function projectRoot(cwd: string, allowRecovery?: boolean): string;
5
5
  export declare function readState(e: CapabilityEditor): {
6
6
  installed: ("hono" | "database-auth" | "r2" | "stripe")[];
@@ -1,17 +1,17 @@
1
1
  import { existsSync, realpathSync, statSync, chmodSync } from 'node:fs';
2
2
  import path from 'node:path';
3
- import { commandArguments, commandArgumentError } from './cli-arguments.js';
4
- import { createReporter } from './cli-output.js';
5
- import { ANHEDRAL_STACK, PUBLIC_STACK_ADDITIONS, CAPABILITIES, CAPABILITY_IDS, capabilityOrder, } from './capability-catalog.js';
6
- import { CapabilityEditor } from './capability-editor.js';
7
- import { addCapabilityRecipe, composeCapabilities } from './capability-recipes.js';
8
- import { normalizeOjFoundation } from './platforms/tanstack.js';
9
- import { GENERATOR_VERSION } from './version.js';
10
- import { PostCommitError, runStagedTransaction, recoverInterruptedTransaction, } from './transaction.js';
11
- import { put } from './scaffold/files.js';
12
- import { execFile } from './util.js';
13
- import { capabilityReferences } from './capability-references.js';
14
- import { configureDependencyPatches } from './dependency-patches.js';
3
+ import { commandArguments, commandArgumentError } from '../cli-arguments.js';
4
+ import { createReporter } from '../cli-output.js';
5
+ import { ANHEDRAL_STACK, PUBLIC_STACK_ADDITIONS, CAPABILITIES, CAPABILITY_IDS, capabilityOrder, } from './catalog.js';
6
+ import { CapabilityEditor } from './editor.js';
7
+ import { addCapabilityRecipe, composeCapabilities } from './recipes.js';
8
+ import { normalizeOjFoundation } from '../scaffold/tanstack.js';
9
+ import { GENERATOR_VERSION } from '../version.js';
10
+ import { PostCommitError, runStagedTransaction, recoverInterruptedTransaction, } from '../transactions/transaction.js';
11
+ import { put } from '../scaffold/files.js';
12
+ import { execFile } from '../util.js';
13
+ import { capabilityReferences } from './references.js';
14
+ import { configureDependencyPatches } from '../dependency-patches.js';
15
15
  import { composeSourceProvenance } from './composition.js';
16
16
  export function projectRoot(cwd, allowRecovery = false) {
17
17
  let root = realpathSync(cwd);
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { Capability } from './capability-catalog.js';
2
+ import type { Capability } from './catalog.js';
3
3
  export declare const launchCompositionSchema: z.ZodObject<{
4
4
  generatorVersion: z.ZodNullable<z.ZodString>;
5
5
  identity: z.ZodEnum<{
@@ -1,6 +1,6 @@
1
- import { sourceCompositionSchema } from './contracts/deployment.js';
1
+ import { sourceCompositionSchema } from '../contracts/deployment.js';
2
2
  import { z } from 'zod';
3
- import { GENERATOR_VERSION } from './version.js';
3
+ import { GENERATOR_VERSION } from '../version.js';
4
4
  // Narrow the shared source contract for the launch generator; runtime admission remains server-owned.
5
5
  export const launchCompositionSchema = sourceCompositionSchema.safeExtend({
6
6
  contractVersion: z.literal(2),
@@ -1,4 +1,4 @@
1
- import { readBoundedFile, MAX_PROJECT_JSON_BYTES } from './bounded-file.js';
1
+ import { readBoundedFile, MAX_PROJECT_JSON_BYTES } from '../bounded-file.js';
2
2
  import { createHash } from 'node:crypto';
3
3
  import { existsSync, lstatSync } from 'node:fs';
4
4
  import path from 'node:path';
@@ -1,4 +1,4 @@
1
- import { CapabilityEditor } from './capability-editor.js';
2
- import type { Capability } from './capability-catalog.js';
1
+ import { CapabilityEditor } from './editor.js';
2
+ import type { Capability } from './catalog.js';
3
3
  export declare function addCapabilityRecipe(e: CapabilityEditor, id: Capability, name: string): void;
4
4
  export declare function composeCapabilities(e: CapabilityEditor, installed: Capability[]): void;
@@ -1,11 +1,11 @@
1
1
  import { readFileSync } from 'node:fs';
2
- import { CapabilityEditor } from './capability-editor.js';
3
- import { CAPABILITY_DEPENDENCIES as P } from './dependencies.js';
4
- import { STACK_DEPENDENCIES as D } from './dependencies.js';
5
- import { resourceName } from './render.js';
6
- import { composeTanstack, addTanstackAuth } from './platforms/tanstack.js';
7
- import { WEB_API_PROXY } from './api-proxy.js';
8
- const template = (name) => readFileSync(new URL(`../assets/stack/${name}`, import.meta.url), 'utf8');
2
+ import { CapabilityEditor } from './editor.js';
3
+ import { CAPABILITY_DEPENDENCIES as P } from '../dependencies.js';
4
+ import { STACK_DEPENDENCIES as D } from '../dependencies.js';
5
+ import { resourceName } from '../render.js';
6
+ import { composeTanstack, addTanstackAuth } from '../scaffold/tanstack.js';
7
+ import { WEB_API_PROXY } from '../api-proxy.js';
8
+ const template = (name) => readFileSync(new URL(`../../assets/stack/${name}`, import.meta.url), 'utf8');
9
9
  const json = (value) => JSON.stringify(value, null, 2) + '\n';
10
10
  function dependency(e, app, dependencies) {
11
11
  e.merge(`${app}/package.json`, 'dependencies', dependencies);
@@ -1,7 +1,7 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  export function capabilityReferences() {
3
3
  return {
4
- 'docs/anhedral/capabilities.md': readFileSync(new URL('../docs/capabilities.md', import.meta.url), 'utf8'),
5
- 'docs/anhedral/ui.md': readFileSync(new URL('../docs/ui.md', import.meta.url), 'utf8'),
4
+ 'docs/anhedral/capabilities.md': readFileSync(new URL('../../docs/capabilities.md', import.meta.url), 'utf8'),
5
+ 'docs/anhedral/ui.md': readFileSync(new URL('../../docs/ui.md', import.meta.url), 'utf8'),
6
6
  };
7
7
  }
@@ -1,6 +1,6 @@
1
- import { resolvePublishedCliArtifact, type PublishedCliArtifact } from './release-artifact.js';
2
- import { type OutputOptions } from './cli-output.js';
3
- import { CapabilityEditor } from './capability-editor.js';
1
+ import { resolvePublishedCliArtifact, type PublishedCliArtifact } from '../release-artifact.js';
2
+ import { type OutputOptions } from '../cli-output.js';
3
+ import { CapabilityEditor } from './editor.js';
4
4
  /** One exact replacement hunk without unchanged project configuration context. */
5
5
  export declare function updateDiff(file: string, before: string | null, after: string): string;
6
6
  export declare function planStackUpdate(root: string, artifact?: PublishedCliArtifact): {
@@ -1,19 +1,19 @@
1
1
  import { chmodSync, existsSync, statSync } from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { isDeepStrictEqual, stripVTControlCharacters } from 'node:util';
4
- import { deploymentManifestSchema } from './contracts/deployment.js';
5
- import { ArtifactUnavailableError, resolvePublishedCliArtifact, isPublishedCliArtifact, } from './release-artifact.js';
4
+ import { deploymentManifestSchema } from '../contracts/deployment.js';
5
+ import { ArtifactUnavailableError, resolvePublishedCliArtifact, isPublishedCliArtifact, } from '../release-artifact.js';
6
6
  import { isMap, parseDocument } from 'yaml';
7
- import { commandArgumentError, commandArguments } from './cli-arguments.js';
8
- import { CliFailure } from './cli-errors.js';
9
- import { createReporter } from './cli-output.js';
10
- import { assertPublicWorkspace, projectRoot, readState } from './capability-command.js';
11
- import { CapabilityEditor, fingerprint } from './capability-editor.js';
12
- import { normalizeOjFoundation } from './platforms/tanstack.js';
7
+ import { commandArgumentError, commandArguments } from '../cli-arguments.js';
8
+ import { CliFailure } from '../cli-errors.js';
9
+ import { createReporter } from '../cli-output.js';
10
+ import { assertPublicWorkspace, projectRoot, readState } from './command.js';
11
+ import { CapabilityEditor, fingerprint } from './editor.js';
12
+ import { normalizeOjFoundation } from '../scaffold/tanstack.js';
13
13
  import { composeSourceProvenance } from './composition.js';
14
- import { GENERATOR_VERSION } from './version.js';
15
- import { runStagedTransaction } from './transaction.js';
16
- import { put } from './scaffold/files.js';
14
+ import { GENERATOR_VERSION } from '../version.js';
15
+ import { runStagedTransaction } from '../transactions/transaction.js';
16
+ import { put } from '../scaffold/files.js';
17
17
  const MAX_UPDATE_BYTES = 256 * 1024;
18
18
  const MAX_UPDATE_FILES = 32;
19
19
  /** One exact replacement hunk without unchanged project configuration context. */
@@ -235,10 +235,8 @@ export declare const cliPlanSchema: z.ZodObject<{
235
235
  }, z.core.$strict>;
236
236
  routingRevision: z.ZodString;
237
237
  expectedGeneration: z.ZodNumber;
238
- policyDigest: z.ZodString;
239
238
  migrationDigests: z.ZodArray<z.ZodString>;
240
239
  expiresAt: z.ZodISODateTime;
241
- runtimeImage: z.ZodNullable<z.ZodString>;
242
240
  configurationRevision: z.ZodNull;
243
241
  artifactVerified: z.ZodBoolean;
244
242
  hostedAdmission: z.ZodBoolean;
@@ -296,19 +294,14 @@ export declare const cliPreparationSchema: z.ZodObject<{
296
294
  candidateId: z.ZodUUID;
297
295
  sourceRevision: z.ZodString;
298
296
  state: z.ZodEnum<{
297
+ building: "building";
299
298
  ready: "ready";
300
299
  failed: "failed";
301
- building: "building";
302
300
  "awaiting-runtime": "awaiting-runtime";
303
301
  built: "built";
304
302
  }>;
305
303
  buildDigest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
306
304
  error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
307
- admission: z.ZodOptional<z.ZodNullable<z.ZodObject<{
308
- policyDigest: z.ZodString;
309
- image: z.ZodString;
310
- scope: z.ZodLiteral<"candidate-workspace">;
311
- }, z.core.$strict>>>;
312
305
  hostedAdmission: z.ZodBoolean;
313
306
  identityAction: z.ZodLiteral<"preserve">;
314
307
  }, z.core.$strict>;
@@ -179,10 +179,8 @@ export const cliPlanSchema = z
179
179
  .strict(),
180
180
  routingRevision: sourceHashSchema,
181
181
  expectedGeneration: z.number().int().nonnegative(),
182
- policyDigest: sourceHashSchema,
183
182
  migrationDigests: z.array(sourceHashSchema).max(100),
184
183
  expiresAt: z.iso.datetime(),
185
- runtimeImage: z.string().max(256).nullable(),
186
184
  configurationRevision: z.null(),
187
185
  artifactVerified: z.boolean(),
188
186
  hostedAdmission: z.boolean(),
@@ -210,15 +208,6 @@ export const cliPreparationSchema = z
210
208
  state: z.enum(["awaiting-runtime", "building", "built", "ready", "failed"]),
211
209
  buildDigest: sourceHashSchema.nullable().optional(),
212
210
  error: z.string().max(300).nullable().optional(),
213
- admission: z
214
- .object({
215
- policyDigest: sourceHashSchema,
216
- image: z.string().regex(/^registry\.[a-z0-9.-]+\/[a-zA-Z0-9/_.-]+@sha256:[a-f0-9]{64}$/),
217
- scope: z.literal("candidate-workspace"),
218
- })
219
- .strict()
220
- .nullable()
221
- .optional(),
222
211
  hostedAdmission: z.boolean(),
223
212
  identityAction: z.literal("preserve"),
224
213
  })
@@ -76,65 +76,6 @@ export declare const deploymentManifestSchema: z.ZodObject<{
76
76
  }>;
77
77
  }, z.core.$strict>;
78
78
  }, z.core.$strict>;
79
- export declare const deploymentSourceSchema: z.ZodObject<{
80
- inventoryVersion: z.ZodLiteral<2>;
81
- inventoryProfile: z.ZodString;
82
- sourceDigest: z.ZodString;
83
- lockfileDigest: z.ZodString;
84
- manifestDigest: z.ZodString;
85
- }, z.core.$strict>;
86
- export declare const deploymentPlanSchema: z.ZodObject<{
87
- contractVersion: z.ZodLiteral<1>;
88
- requestId: z.ZodUUID;
89
- projectId: z.ZodUUID;
90
- manifest: z.ZodObject<{
91
- contractVersion: z.ZodLiteral<1>;
92
- foundation: z.ZodLiteral<"tanstack-start">;
93
- capabilities: z.ZodArray<z.ZodEnum<{
94
- hono: "hono";
95
- "database-auth": "database-auth";
96
- r2: "r2";
97
- stripe: "stripe";
98
- }>>;
99
- identity: z.ZodEnum<{
100
- none: "none";
101
- "better-auth-d1-v1": "better-auth-d1-v1";
102
- }>;
103
- cliArtifact: z.ZodObject<{
104
- version: z.ZodString;
105
- sourceRevision: z.ZodString;
106
- packageIntegrity: z.ZodString;
107
- }, z.core.$strict>;
108
- intent: z.ZodObject<{
109
- contractVersion: z.ZodLiteral<1>;
110
- runtimeProfile: z.ZodLiteral<"anhedral-stack">;
111
- environment: z.ZodEnum<{
112
- production: "production";
113
- preview: "preview";
114
- }>;
115
- visibility: z.ZodEnum<{
116
- protected: "protected";
117
- public: "public";
118
- }>;
119
- }, z.core.$strict>;
120
- }, z.core.$strict>;
121
- source: z.ZodObject<{
122
- inventoryVersion: z.ZodLiteral<2>;
123
- inventoryProfile: z.ZodString;
124
- sourceDigest: z.ZodString;
125
- lockfileDigest: z.ZodString;
126
- manifestDigest: z.ZodString;
127
- }, z.core.$strict>;
128
- policyDigest: z.ZodString;
129
- runtimeImage: z.ZodString;
130
- configurationRevision: z.ZodString;
131
- expectedGeneration: z.ZodNumber;
132
- migrationDigests: z.ZodArray<z.ZodString>;
133
- requiredAuthority: z.ZodEnum<{
134
- preview: "preview";
135
- "production-approval": "production-approval";
136
- }>;
137
- }, z.core.$strict>;
138
79
  export declare const deploymentErrorSchema: z.ZodObject<{
139
80
  code: z.ZodEnum<{
140
81
  INVALID_MANIFEST: "INVALID_MANIFEST";
@@ -156,13 +97,13 @@ export declare const deploymentEventSchema: z.ZodObject<{
156
97
  sequence: z.ZodNumber;
157
98
  state: z.ZodEnum<{
158
99
  queued: "queued";
159
- preparing: "preparing";
160
- ready: "ready";
161
- failed: "failed";
162
100
  uploading: "uploading";
163
101
  building: "building";
102
+ preparing: "preparing";
164
103
  verifying: "verifying";
165
104
  "awaiting-approval": "awaiting-approval";
105
+ ready: "ready";
106
+ failed: "failed";
166
107
  cancelled: "cancelled";
167
108
  }>;
168
109
  occurredAt: z.ZodISODateTime;
@@ -174,9 +115,9 @@ export declare const deploymentResultSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
174
115
  status: z.ZodLiteral<"pending">;
175
116
  state: z.ZodEnum<{
176
117
  queued: "queued";
177
- preparing: "preparing";
178
118
  uploading: "uploading";
179
119
  building: "building";
120
+ preparing: "preparing";
180
121
  verifying: "verifying";
181
122
  "awaiting-approval": "awaiting-approval";
182
123
  }>;
@@ -223,8 +164,6 @@ export declare const deploymentResultSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
223
164
  requestId: z.ZodUUID;
224
165
  }, z.core.$strict>], "status">;
225
166
  export type DeploymentManifest = z.infer<typeof deploymentManifestSchema>;
226
- export type DeploymentPlan = z.infer<typeof deploymentPlanSchema>;
227
- export type DeploymentSource = z.infer<typeof deploymentSourceSchema>;
228
167
  export type DeploymentIntent = z.infer<typeof deploymentIntentSchema>;
229
168
  export type DeploymentEvent = z.infer<typeof deploymentEventSchema>;
230
169
  export type DeploymentResult = z.infer<typeof deploymentResultSchema>;
@@ -47,34 +47,18 @@ export const deploymentManifestSchema = z
47
47
  .strict()
48
48
  .superRefine((value, ctx) => {
49
49
  const selected = new Set(value.capabilities);
50
- const tanstack = value.foundation === "tanstack-start";
51
- if (tanstack !== (value.intent.runtimeProfile === "anhedral-stack"))
50
+ if (selected.has("hono") !== selected.has("database-auth"))
52
51
  ctx.addIssue({
53
52
  code: "custom",
54
- path: ["intent", "runtimeProfile"],
55
- message: "Anhedral Stack source requires the anhedral-stack runtime profile.",
53
+ path: ["capabilities"],
54
+ message: "Anhedral Stack hosting requires Hono and database-auth together.",
55
+ });
56
+ if (value.identity !== (selected.has("database-auth") ? "better-auth-d1-v1" : "none"))
57
+ ctx.addIssue({
58
+ code: "custom",
59
+ path: ["identity"],
60
+ message: "Anhedral Stack hosting preserves standalone Better Auth/D1 identity.",
56
61
  });
57
- if (tanstack) {
58
- for (const id of value.capabilities)
59
- if (!["hono", "database-auth", "r2", "stripe"].includes(id))
60
- ctx.addIssue({
61
- code: "custom",
62
- path: ["capabilities"],
63
- message: `${id} is outside the Anhedral Stack hosting contract.`,
64
- });
65
- if (selected.has("hono") !== selected.has("database-auth"))
66
- ctx.addIssue({
67
- code: "custom",
68
- path: ["capabilities"],
69
- message: "Anhedral Stack hosting requires Hono and database-auth together.",
70
- });
71
- if (value.identity !== (selected.has("database-auth") ? "better-auth-d1-v1" : "none"))
72
- ctx.addIssue({
73
- code: "custom",
74
- path: ["identity"],
75
- message: "Anhedral Stack hosting preserves standalone Better Auth/D1 identity.",
76
- });
77
- }
78
62
  const prerequisites = {
79
63
  "database-auth": ["hono"],
80
64
  r2: ["database-auth"],
@@ -88,42 +72,7 @@ export const deploymentManifestSchema = z
88
72
  path: ["capabilities"],
89
73
  message: `${id} requires ${parent}.`,
90
74
  });
91
- if (selected.has("database-auth") !== (value.identity !== "none"))
92
- ctx.addIssue({
93
- code: "custom",
94
- path: ["identity"],
95
- message: "Identity must match database-auth source.",
96
- });
97
75
  });
98
- export const deploymentSourceSchema = z
99
- .object({
100
- inventoryVersion: z.literal(2),
101
- inventoryProfile: z.string().min(1).max(100),
102
- sourceDigest: deploymentDigestSchema,
103
- lockfileDigest: deploymentDigestSchema,
104
- manifestDigest: deploymentDigestSchema,
105
- })
106
- .strict();
107
- const runtimeImageSchema = z
108
- .string()
109
- .regex(/^registry\.[a-z0-9.-]+\/[a-zA-Z0-9/_.-]+@sha256:[a-f0-9]{64}$/);
110
- export const deploymentPlanSchema = z
111
- .object({
112
- contractVersion: z.literal(1),
113
- requestId: z.uuid(),
114
- projectId: z.uuid(),
115
- manifest: deploymentManifestSchema,
116
- source: deploymentSourceSchema,
117
- policyDigest: deploymentDigestSchema,
118
- runtimeImage: runtimeImageSchema,
119
- configurationRevision: deploymentDigestSchema,
120
- expectedGeneration: z.number().int().nonnegative(),
121
- migrationDigests: z.array(deploymentDigestSchema).max(100),
122
- requiredAuthority: z.enum(["preview", "production-approval"]),
123
- })
124
- .strict()
125
- .refine((plan) => plan.requiredAuthority ===
126
- (plan.manifest.intent.environment === "production" ? "production-approval" : "preview"), "Production requires exact-candidate approval.");
127
76
  export const deploymentErrorSchema = z
128
77
  .object({
129
78
  code: z.enum([
@@ -32,9 +32,9 @@ export declare const productionDeploymentSchema: z.ZodObject<{
32
32
  queued: "queued";
33
33
  preparing: "preparing";
34
34
  ready: "ready";
35
- published: "published";
36
35
  failed: "failed";
37
36
  superseded: "superseded";
37
+ published: "published";
38
38
  }>;
39
39
  sourceRevision: z.ZodString;
40
40
  createdAt: z.ZodString;
@@ -57,9 +57,9 @@ export declare const productionStateSchema: z.ZodObject<{
57
57
  queued: "queued";
58
58
  preparing: "preparing";
59
59
  ready: "ready";
60
- published: "published";
61
60
  failed: "failed";
62
61
  superseded: "superseded";
62
+ published: "published";
63
63
  }>;
64
64
  sourceRevision: z.ZodString;
65
65
  createdAt: z.ZodString;