anhedral 0.10.1 → 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 (183) hide show
  1. package/README.md +79 -124
  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 +284 -163
  9. package/dist/capabilities.d.ts +4 -4
  10. package/dist/capabilities.js +6 -2
  11. package/dist/capability-contract.d.ts +47 -0
  12. package/dist/capability-contract.js +153 -0
  13. package/dist/catalog-model.d.ts +24 -0
  14. package/dist/catalog-model.js +1 -0
  15. package/dist/catalog-registration.d.ts +16 -0
  16. package/dist/catalog-registration.js +22 -0
  17. package/dist/catalog-snapshot.d.ts +5 -0
  18. package/dist/catalog-snapshot.js +97 -0
  19. package/dist/cli-arguments.d.ts +16 -0
  20. package/dist/cli-arguments.js +115 -0
  21. package/dist/cli-output.d.ts +8 -0
  22. package/dist/cli-output.js +236 -0
  23. package/dist/cloudflare.d.ts +14 -3
  24. package/dist/cloudflare.js +196 -36
  25. package/dist/command-schema.d.ts +21 -0
  26. package/dist/command-schema.js +418 -0
  27. package/dist/delivery.d.ts +12 -5
  28. package/dist/delivery.js +173 -39
  29. package/dist/dependencies.d.ts +24 -0
  30. package/dist/dependencies.js +48 -0
  31. package/dist/dependency-patches.d.ts +7 -0
  32. package/dist/dependency-patches.js +125 -0
  33. package/dist/index.d.ts +26 -1
  34. package/dist/index.js +17 -1
  35. package/dist/inspector-model.d.ts +123 -0
  36. package/dist/inspector-model.js +1 -0
  37. package/dist/integration-service-readers.d.ts +13 -0
  38. package/dist/integration-service-readers.js +173 -0
  39. package/dist/lifecycle-model.d.ts +15 -0
  40. package/dist/lifecycle-model.js +20 -0
  41. package/dist/lifecycle.d.ts +11 -0
  42. package/dist/lifecycle.js +91 -0
  43. package/dist/mobile-delivery.d.ts +100 -0
  44. package/dist/mobile-delivery.js +319 -0
  45. package/dist/neon-service-data.d.ts +8 -0
  46. package/dist/neon-service-data.js +117 -0
  47. package/dist/platforms/mobile.js +8 -5
  48. package/dist/pnpm-policy.d.ts +2 -2
  49. package/dist/pnpm-policy.js +19 -45
  50. package/dist/project-catalog.d.ts +41 -0
  51. package/dist/project-catalog.js +288 -0
  52. package/dist/project-config.d.ts +14 -0
  53. package/dist/project-config.js +89 -0
  54. package/dist/project-inspector.d.ts +4 -0
  55. package/dist/project-inspector.js +702 -0
  56. package/dist/project-lifecycle.d.ts +25 -0
  57. package/dist/project-lifecycle.js +57 -0
  58. package/dist/project-state.d.ts +22 -1
  59. package/dist/project-state.js +361 -27
  60. package/dist/provider-auth.d.ts +41 -0
  61. package/dist/provider-auth.js +209 -0
  62. package/dist/provider-readiness.js +27 -10
  63. package/dist/providers/adapters.d.ts +17 -0
  64. package/dist/providers/adapters.js +272 -0
  65. package/dist/providers/api.d.ts +29 -0
  66. package/dist/providers/api.js +253 -0
  67. package/dist/providers/config.d.ts +15 -0
  68. package/dist/providers/config.js +182 -0
  69. package/dist/providers/definitions.d.ts +318 -0
  70. package/dist/providers/definitions.js +127 -0
  71. package/dist/providers/provision.d.ts +24 -0
  72. package/dist/providers/provision.js +76 -0
  73. package/dist/providers/receipts.d.ts +20 -0
  74. package/dist/providers/receipts.js +66 -0
  75. package/dist/providers/recovery-verification.d.ts +7 -0
  76. package/dist/providers/recovery-verification.js +112 -0
  77. package/dist/providers/recovery.d.ts +30 -0
  78. package/dist/providers/recovery.js +34 -0
  79. package/dist/providers/runtime.d.ts +10 -0
  80. package/dist/providers/runtime.js +254 -0
  81. package/dist/providers/schema.d.ts +28 -0
  82. package/dist/providers/schema.js +49 -0
  83. package/dist/providers/state.d.ts +55 -0
  84. package/dist/providers/state.js +289 -0
  85. package/dist/provision.d.ts +10 -1
  86. package/dist/provision.js +91 -4
  87. package/dist/r2-service-data.d.ts +2 -0
  88. package/dist/r2-service-data.js +136 -0
  89. package/dist/readiness.js +9 -13
  90. package/dist/registry/add.d.ts +6 -0
  91. package/dist/registry/add.js +93 -22
  92. package/dist/registry/commands.d.ts +3 -2
  93. package/dist/registry/commands.js +52 -15
  94. package/dist/registry/options.d.ts +1 -1
  95. package/dist/registry/options.js +5 -4
  96. package/dist/registry/preview.d.ts +11 -0
  97. package/dist/registry/preview.js +91 -0
  98. package/dist/registry/receipt.d.ts +1 -0
  99. package/dist/registry/receipt.js +19 -4
  100. package/dist/registry/resolve.js +5 -1
  101. package/dist/registry/usage.d.ts +10 -0
  102. package/dist/registry/usage.js +18 -37
  103. package/dist/render.d.ts +2 -0
  104. package/dist/render.js +6 -0
  105. package/dist/runtime-policy.d.ts +4 -0
  106. package/dist/runtime-policy.js +21 -0
  107. package/dist/scaffold/auth.js +3 -19
  108. package/dist/scaffold/bootstrap.js +2 -2
  109. package/dist/scaffold/compose.js +9 -3
  110. package/dist/scaffold/database.js +107 -25
  111. package/dist/scaffold/documentation.js +18 -13
  112. package/dist/scaffold/lint.d.ts +4 -0
  113. package/dist/scaffold/lint.js +56 -0
  114. package/dist/scaffold/neon-realtime.d.ts +2 -0
  115. package/dist/scaffold/neon-realtime.js +97 -0
  116. package/dist/scaffold/stack-documentation.js +1 -1
  117. package/dist/scaffold/void.d.ts +4 -0
  118. package/dist/scaffold/void.js +256 -0
  119. package/dist/scaffold/web.js +7 -1
  120. package/dist/scaffold/workspace.js +127 -25
  121. package/dist/service-deletion.d.ts +29 -0
  122. package/dist/service-deletion.js +195 -0
  123. package/dist/service-descriptor.d.ts +10 -0
  124. package/dist/service-descriptor.js +78 -0
  125. package/dist/service-model.d.ts +49 -0
  126. package/dist/service-model.js +8 -0
  127. package/dist/service-operations.d.ts +29 -0
  128. package/dist/service-operations.js +78 -0
  129. package/dist/service-readers.d.ts +8 -0
  130. package/dist/service-readers.js +247 -0
  131. package/dist/services-command.d.ts +39 -0
  132. package/dist/services-command.js +100 -0
  133. package/dist/ship.d.ts +348 -0
  134. package/dist/ship.js +237 -0
  135. package/dist/stack-registry.d.ts +4 -2
  136. package/dist/stack-registry.js +48 -12
  137. package/dist/standard.d.ts +2 -1
  138. package/dist/standard.js +33 -14
  139. package/dist/transaction.d.ts +2 -0
  140. package/dist/transaction.js +10 -0
  141. package/dist/util.js +17 -2
  142. package/dist/vercel.d.ts +5 -3
  143. package/dist/vercel.js +96 -14
  144. package/dist/version.d.ts +1 -1
  145. package/dist/version.js +1 -1
  146. package/dist/vinext.d.ts +1 -0
  147. package/dist/vinext.js +13 -1
  148. package/dist/void-execution.d.ts +10 -0
  149. package/dist/void-execution.js +94 -0
  150. package/dist/void-migrations.d.ts +6 -0
  151. package/dist/void-migrations.js +110 -0
  152. package/dist/void-state.d.ts +16 -0
  153. package/dist/void-state.js +65 -0
  154. package/dist/void.d.ts +3 -0
  155. package/dist/void.js +5 -0
  156. package/docs/cli-design.md +67 -0
  157. package/docs/delivery-workflow.md +32 -17
  158. package/docs/plugin-ui.md +102 -0
  159. package/docs/provider-configuration.md +116 -0
  160. package/docs/stack-standard.md +175 -0
  161. package/docs/void-verification.md +185 -0
  162. package/package.json +29 -23
  163. package/assets/anhedral-cli-init-technical.svg +0 -322
  164. package/assets/anhedral-cli-init.svg +0 -322
  165. package/assets/anhedral-mark.svg +0 -4
  166. package/assets/anhedral.svg +0 -4
  167. package/assets/favicon.ico +0 -0
  168. package/assets/security/LICENSES.txt +0 -63
  169. package/assets/security/audit-deps.mjs +0 -300
  170. package/assets/security/braces-regression.mjs +0 -102
  171. package/assets/security/braces@3.0.3.patch +0 -285
  172. package/assets/security/decode-uri-component@0.2.2.patch +0 -149
  173. package/assets/security/decoder-regression.mjs +0 -37
  174. package/assets/security/forge-regression.mjs +0 -46
  175. package/assets/security/manifest.json +0 -53
  176. package/assets/security/node-forge@1.4.0.patch +0 -26
  177. package/dist/managed-hosting.d.ts +0 -49
  178. package/dist/managed-hosting.js +0 -373
  179. package/dist/security-backports.d.ts +0 -3
  180. package/dist/security-backports.js +0 -26
  181. package/docs/application-stack-standard.md +0 -104
  182. package/docs/managed-hosting-architecture.md +0 -87
  183. package/docs/sponsorships.md +0 -25
@@ -6,7 +6,7 @@ export declare const CAPABILITIES: Record<StandardProduct, Capability>;
6
6
  export declare const CAPABILITY_REGISTRY: {
7
7
  schemaVersion: number;
8
8
  cliVersion: string;
9
- capabilities: Record<"realtime" | "electron" | "wxt" | "expo" | "vinext" | "next" | "workflows" | "styling" | "hono" | "neon" | "d1" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "queues" | "cron" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "basin" | "posthog", Capability>;
9
+ capabilities: Record<"next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog", Capability>;
10
10
  };
11
11
  export declare function createSetupPlan(options: StandardOptions, registry?: import("./registry/resolve.js").ResolvedStackRegistry): {
12
12
  schemaVersion: number;
@@ -15,10 +15,10 @@ export declare function createSetupPlan(options: StandardOptions, registry?: imp
15
15
  standard: string;
16
16
  root: string;
17
17
  name: string;
18
- products: ("realtime" | "electron" | "wxt" | "expo" | "vinext" | "next" | "workflows" | "styling" | "hono" | "neon" | "d1" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "queues" | "cron" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "basin" | "posthog")[];
18
+ products: ("next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog")[];
19
19
  hosting: import("./registry/types.js").Hosting;
20
20
  registry: import("./registry/resolve.js").ResolvedStackRegistry;
21
- bootstrap: ("pnpm" | "next" | "shadcn@4.21.4" | "dlx" | "init" | "--monorepo" | "--template")[];
21
+ bootstrap: ("next" | "pnpm" | "shadcn@4.21.4" | "dlx" | "init" | "--monorepo" | "--template")[];
22
22
  dryRun: boolean;
23
23
  setup: {
24
24
  tools: string[];
@@ -32,7 +32,7 @@ export declare function createSetupPlan(options: StandardOptions, registry?: imp
32
32
  credentials: readonly string[];
33
33
  resources: readonly string[];
34
34
  verify: readonly string[];
35
- id: "realtime" | "electron" | "wxt" | "expo" | "vinext" | "next" | "workflows" | "styling" | "hono" | "neon" | "d1" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "queues" | "cron" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "basin" | "posthog";
35
+ id: "next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog";
36
36
  }[];
37
37
  completion: string[];
38
38
  resourcesProvisioned: boolean;
@@ -1,3 +1,4 @@
1
+ import { usesVoidSelection } from './runtime-policy.js';
1
2
  import { resolveStackRegistry } from './registry/resolve.js';
2
3
  import { BOOTSTRAP_COMMAND } from './registry/bootstrap.js';
3
4
  import { GENERATOR_VERSION } from './version.js';
@@ -14,7 +15,7 @@ export const CAPABILITY_REGISTRY = {
14
15
  };
15
16
  const HOSTING_SETUP = {
16
17
  cloudflare: {
17
- tools: ['Cloudflare integration or API', 'Wrangler'],
18
+ tools: ['Cloudflare integration or API', 'Void', 'Wrangler'],
18
19
  access: [
19
20
  'Client-owned Cloudflare account; account ID; scoped OAuth/API access; service-compatible plan; DNS access only when needed',
20
21
  ],
@@ -27,6 +28,7 @@ const HOSTING_SETUP = {
27
28
  },
28
29
  };
29
30
  export function createSetupPlan(options, registry = resolveStackRegistry(options)) {
31
+ const voidWorkspace = usesVoidSelection(options.products, options.hosting);
30
32
  const items = new Map(registry.items.map((item) => [item.name, item]));
31
33
  const capabilities = options.products.map((id) => {
32
34
  const item = items.get(id);
@@ -61,7 +63,9 @@ export function createSetupPlan(options, registry = resolveStackRegistry(options
61
63
  tools: [
62
64
  ...new Set([
63
65
  'Git',
64
- 'Node.js 22.13+ on 22.x, or Node.js 24+ for generated workspaces',
66
+ voidWorkspace
67
+ ? 'Node.js 24.21.0+ for Void workspaces'
68
+ : 'Node.js 22.13+ on 22.x, or Node.js 24+ for generated workspaces',
65
69
  PACKAGE_MANAGER.replace('@', ' '),
66
70
  'GitHub integration or gh',
67
71
  'Fallow',
@@ -0,0 +1,47 @@
1
+ import type { StackSelection, StandardProduct } from './registry/types.js';
2
+ export type CapabilitySupport = 'implemented' | 'scaffold-only' | 'unsupported' | 'not-applicable';
3
+ export type CapabilityEvidence = 'local-contract' | 'unverified';
4
+ export interface CapabilityStage {
5
+ support: CapabilitySupport;
6
+ evidence: CapabilityEvidence;
7
+ scope: string;
8
+ }
9
+ export interface ProductCapability {
10
+ id: StandardProduct;
11
+ description: string;
12
+ targets: readonly string[];
13
+ registryDependencies: readonly string[];
14
+ selection: StackSelection;
15
+ scaffold: CapabilityStage;
16
+ provisioning: CapabilityStage;
17
+ delivery: CapabilityStage;
18
+ limits: readonly string[];
19
+ }
20
+ /** Advertises implemented scope and the evidence level separately. This catalog is
21
+ * pure metadata; consulting it never authenticates, provisions, or verifies a live account. */
22
+ export declare const CAPABILITY_CONTRACT: {
23
+ schemaVersion: number;
24
+ cliVersion: string;
25
+ mutation: boolean;
26
+ liveAcceptance: "unverified";
27
+ products: ProductCapability[];
28
+ providers: {
29
+ id: string;
30
+ managementCredential: "RESEND_API_KEY" | "STRIPE_SECRET_KEY" | "NEON_API_KEY" | "CLERK_PLATFORM_API_KEY" | "RC_API_KEY" | "SENTRY_AUTH_TOKEN" | "POSTHOG_PERSONAL_API_KEY" | "OPENAI_ADMIN_KEY";
31
+ resources: readonly ["project", "database connection"] | readonly ["application", "environment keys"] | readonly ["domain", "sending key"] | readonly ["account verification", "webhook"] | readonly ["project", "application", "SDK keys"] | readonly ["project", "DSN"] | readonly ["project", "ingestion configuration"] | readonly ["project", "service account", "runtime key"];
32
+ provisioning: CapabilityStage;
33
+ liveAcceptance: "unverified";
34
+ ownerSteps: readonly ["Choose an organization and region; approve any provider billing requirements."] | readonly ["Obtain Platform API access; configure production domains, DNS, and OAuth credentials."] | readonly ["Publish domain verification DNS records and wait for verification."] | readonly ["Complete account activation; define products, prices, and purchase behavior."] | readonly ["Configure store credentials or Stripe, products, offerings, and entitlements; verify purchases."] | readonly ["Choose organization and team access; configure source maps and application instrumentation."] | readonly ["Choose organization and region; define analytics events and consent behavior."] | readonly ["Obtain organization administration access; configure billing and application usage limits."];
35
+ }[];
36
+ hosts: {
37
+ id: string;
38
+ delivery: CapabilityStage;
39
+ liveAcceptance: "unverified";
40
+ }[];
41
+ plugin: {
42
+ id: string;
43
+ capability: CapabilityStage;
44
+ }[];
45
+ limits: string[];
46
+ };
47
+ export declare function formatCapabilityContract(): string;
@@ -0,0 +1,153 @@
1
+ import { STANDARD_PRODUCTS, getStackItem } from './stack-registry.js';
2
+ import { PROVIDER_DEFINITIONS } from './providers/definitions.js';
3
+ import { GENERATOR_VERSION } from './version.js';
4
+ const stage = (support, scope, evidence = 'local-contract') => ({ support, evidence, scope });
5
+ const none = (scope) => stage('not-applicable', scope, 'unverified');
6
+ const cloudflareResources = ['d1', 'r2', 'kv', 'queues', 'basin'];
7
+ const deploymentBindings = ['realtime', 'cron', 'workflows', 'workers-ai'];
8
+ function integration(id) {
9
+ const provider = id === 'ai-sdk' ? 'openai' : id;
10
+ return Object.hasOwn(PROVIDER_DEFINITIONS, provider)
11
+ ? provider
12
+ : undefined;
13
+ }
14
+ function productCapability(id) {
15
+ const item = getStackItem(id);
16
+ const provider = integration(id);
17
+ let provisioning = none('No separately provisioned resource.');
18
+ let delivery = none('Delivered as part of the selected application.');
19
+ const limits = [
20
+ 'Generated primitives require application feature development and acceptance checks.',
21
+ ];
22
+ if (provider) {
23
+ provisioning = stage('implemented', `Selected ${PROVIDER_DEFINITIONS[provider].resources.join(', ')} through provider APIs.`);
24
+ limits.push(...PROVIDER_DEFINITIONS[provider].ownerSteps, 'Live account permissions and provider behavior require authorized acceptance.');
25
+ }
26
+ if (cloudflareResources.includes(id)) {
27
+ provisioning = stage('implemented', id === 'basin'
28
+ ? 'Private Cloudflare stream and Worker binding.'
29
+ : 'Selected Cloudflare resource and checked Worker binding.');
30
+ limits.push('Account eligibility, quotas, and live runtime behavior require authorized acceptance.');
31
+ if (id === 'basin')
32
+ limits.push('Pipeline transforms and sinks are outside automated provisioning.');
33
+ }
34
+ if (deploymentBindings.includes(id)) {
35
+ provisioning = stage('implemented', 'Worker deployment configures the selected binding or trigger.');
36
+ limits.push('Configured bindings and triggers do not establish application behavior or execution success.');
37
+ }
38
+ if (['vinext', 'next', 'hono'].includes(id))
39
+ delivery = stage('implemented', id === 'next'
40
+ ? 'Selected Cloudflare or Vercel deployment with provider identity and source checks.'
41
+ : 'Cloudflare Worker deployment with provider identity and source checks.');
42
+ if (id === 'expo') {
43
+ delivery = stage('implemented', 'EAS build request, build receipt verification, and artifact link.');
44
+ limits.push('No store submission; signing, enrollment, device testing, and store distribution remain developer responsibilities.');
45
+ }
46
+ if (id === 'electron' || id === 'wxt') {
47
+ delivery = stage('scaffold-only', 'Generated application and local build tooling; automated distribution is unavailable.');
48
+ limits.push(id === 'electron'
49
+ ? 'Signing, notarization, installers, updates, and distribution require a separate delivery workflow.'
50
+ : 'Extension signing, store submission, review, and distribution require a separate delivery workflow.');
51
+ }
52
+ if (id === 'neon-realtime') {
53
+ provisioning = stage('scaffold-only', 'Manually enable Realtime on the intended Neon branch, configure allowed origins and supply its private secret and public URL; no automatic Realtime provisioning.', 'unverified');
54
+ limits.push('Neon Realtime is beta and does not support RLS; authenticate requests and seal only explicitly scoped, read-only application queries.', 'Keep DATABASE_URL and NEON_REALTIME_SECRET server-only; clients use the public NEON_REALTIME_URL and short-lived sealed queries.', 'The package exposes separate server/client factories and a Drizzle adapter; no arbitrary SQL endpoint or application subscription flow is generated.', 'Live subscriptions, renewal, revocation, allowed origins and cross-tenant isolation require authorized acceptance; live behavior remains unverified.');
55
+ }
56
+ if (id === 'better-auth')
57
+ limits.push('Configure private authentication secret and public origin; apply and verify database migrations and authorization rules.');
58
+ return {
59
+ id,
60
+ description: item.description,
61
+ targets: item.targets,
62
+ registryDependencies: item.registryDependencies,
63
+ selection: item.selection,
64
+ scaffold: stage('implemented', 'Bundled source recipe and stack composition.'),
65
+ provisioning,
66
+ delivery,
67
+ limits,
68
+ };
69
+ }
70
+ /** Advertises implemented scope and the evidence level separately. This catalog is
71
+ * pure metadata; consulting it never authenticates, provisions, or verifies a live account. */
72
+ export const CAPABILITY_CONTRACT = {
73
+ schemaVersion: 1,
74
+ cliVersion: GENERATOR_VERSION,
75
+ mutation: false,
76
+ liveAcceptance: 'unverified',
77
+ products: STANDARD_PRODUCTS.map(productCapability),
78
+ providers: Object.entries(PROVIDER_DEFINITIONS).map(([id, definition]) => ({
79
+ id,
80
+ managementCredential: definition.credential,
81
+ resources: definition.resources,
82
+ provisioning: stage('implemented', 'Selected resources through provider APIs; fixture-tested local contracts.'),
83
+ liveAcceptance: 'unverified',
84
+ ownerSteps: definition.ownerSteps,
85
+ })),
86
+ hosts: [
87
+ {
88
+ id: 'cloudflare',
89
+ delivery: stage('implemented', 'Provision selected resources, configure bindings/secrets, deploy Workers, inspect provider identity and source receipts.'),
90
+ liveAcceptance: 'unverified',
91
+ },
92
+ {
93
+ id: 'vercel',
94
+ delivery: stage('implemented', 'Configure the selected project environment, deploy the web app, inspect provider identity and source receipts.'),
95
+ liveAcceptance: 'unverified',
96
+ },
97
+ ],
98
+ plugin: [
99
+ {
100
+ id: 'project-inspection',
101
+ capability: stage('implemented', 'Offline versioned stack, setup prerequisites and target-specific recorded delivery evidence, shared by CLI and optional UI.'),
102
+ },
103
+ {
104
+ id: 'project-catalog',
105
+ capability: stage('implemented', 'Local projects, configuration, and recorded delivery receipts.'),
106
+ },
107
+ {
108
+ id: 'native-host-installation',
109
+ capability: stage('implemented', 'Packaged plugin and host integration.', 'unverified'),
110
+ },
111
+ {
112
+ id: 'live-analytics',
113
+ capability: stage('implemented', 'Explicit selected-resource analytics for Cloudflare Workers/D1, Vercel and PostHog; provider access and metric availability require live acceptance.'),
114
+ },
115
+ {
116
+ id: 'live-database-reader',
117
+ capability: stage('implemented', 'Explicit bounded D1 and restricted read-only Neon data reads; masked rows and schema are private app metadata.'),
118
+ },
119
+ {
120
+ id: 'live-provider-health',
121
+ capability: stage('implemented', 'Explicit resource existence, identity and recorded deployment status checks; these do not certify application health.'),
122
+ },
123
+ {
124
+ id: 'schedule-execution',
125
+ capability: stage('unsupported', 'Schedules are declared configuration; no execution-history reader is implemented.', 'unverified'),
126
+ },
127
+ ],
128
+ limits: [
129
+ 'Local contract tests are separate from live provider acceptance and completed application verification.',
130
+ 'Account selection, enrollment, billing approval, DNS ownership, and signing can require owner action.',
131
+ 'Mixed hosting is sequential; no atomic cross-provider rollback or cached phase skipping is promised.',
132
+ 'The CLI scaffolds supported primitives; customer application features remain development work.',
133
+ ],
134
+ };
135
+ export function formatCapabilityContract() {
136
+ return [
137
+ `Anhedral ${CAPABILITY_CONTRACT.cliVersion} capabilities`,
138
+ 'Evidence: local contracts; live provider acceptance remains unverified.',
139
+ '',
140
+ 'Product Provisioning Delivery',
141
+ ...CAPABILITY_CONTRACT.products.map((product) => `${product.id.padEnd(20)}${product.provisioning.support.padEnd(20)}${product.delivery.support}`),
142
+ '',
143
+ 'Providers: ' + CAPABILITY_CONTRACT.providers.map((provider) => provider.id).join(', '),
144
+ 'Expo delivery returns EAS artifacts; it does not submit to stores.',
145
+ 'Electron and WXT distribution: scaffold only.',
146
+ 'Plugin: explicit selected-resource analytics, bounded database reads and provider status checks; live acceptance remains unverified.',
147
+ 'Schedule execution history: unavailable. Resource status does not certify application health.',
148
+ '',
149
+ ...CAPABILITY_CONTRACT.limits,
150
+ '',
151
+ 'Use --json for scope, owner steps, and evidence for every capability.',
152
+ ].join('\n');
153
+ }
@@ -0,0 +1,24 @@
1
+ import type { ProjectInspection } from './inspector-model.js';
2
+ export interface ProjectSummary {
3
+ id: string;
4
+ name: string;
5
+ sourceName: string;
6
+ updatedAt: string;
7
+ products: string[];
8
+ status: 'recorded' | 'source' | 'unavailable';
9
+ message?: string;
10
+ inspection?: ProjectInspection;
11
+ }
12
+ export interface Dashboard {
13
+ projects: ProjectSummary[];
14
+ selectedId: string | null;
15
+ preferences: {
16
+ view: 'list' | 'grid';
17
+ };
18
+ }
19
+ export interface ToolArguments {
20
+ id?: string;
21
+ name?: string;
22
+ view?: 'list' | 'grid';
23
+ }
24
+ export type DashboardTool = 'list_projects' | 'get_project' | 'rename_project' | 'forget_project' | 'set_view';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ export declare function catalogDirectory(env?: NodeJS.ProcessEnv): string;
2
+ /** Every successful CLI init records a local app unless explicitly disabled.
3
+ * Registration failure never undoes generated source. */
4
+ export declare function registerGeneratedProject(root: string, env?: NodeJS.ProcessEnv): {
5
+ state: "not-enabled";
6
+ id?: undefined;
7
+ nextAction?: undefined;
8
+ } | {
9
+ state: "registered";
10
+ id: string;
11
+ nextAction?: undefined;
12
+ } | {
13
+ state: "pending";
14
+ nextAction: string;
15
+ id?: undefined;
16
+ };
@@ -0,0 +1,22 @@
1
+ import { homedir } from 'node:os';
2
+ import path from 'node:path';
3
+ import { ProjectStore } from './project-catalog.js';
4
+ export function catalogDirectory(env = process.env) {
5
+ return (env.ANHEDRAL_PLUGIN_DATA ?? path.join(homedir(), '.local', 'share', 'anhedral', 'projects'));
6
+ }
7
+ /** Every successful CLI init records a local app unless explicitly disabled.
8
+ * Registration failure never undoes generated source. */
9
+ export function registerGeneratedProject(root, env = process.env) {
10
+ const directory = catalogDirectory(env);
11
+ if (env.ANHEDRAL_DISABLE_CATALOG === '1')
12
+ return { state: 'not-enabled' };
13
+ try {
14
+ return { state: 'registered', id: new ProjectStore(directory).register(root) };
15
+ }
16
+ catch {
17
+ return {
18
+ state: 'pending',
19
+ nextAction: 'Project generated. Catalog registration could not complete; refresh or register the source after restoring catalog access.',
20
+ };
21
+ }
22
+ }
@@ -0,0 +1,5 @@
1
+ import type { ProjectSummary } from './catalog-model.js';
2
+ import type { ProjectEntry } from './project-catalog.js';
3
+ /** List views read bounded package and project configuration; detailed evidence is opt-in by ID. */
4
+ export declare function projectSnapshot(entry: ProjectEntry, detail?: boolean): ProjectSummary;
5
+ export declare function readCatalogSourceIdentity(root: string): string | undefined;
@@ -0,0 +1,97 @@
1
+ import { lstatSync, realpathSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { readBoundedFile } from './bounded-file.js';
4
+ import { readProjectConfig, projectConfigPath } from './project-config.js';
5
+ import { inspectApplication } from './project-inspector.js';
6
+ import { STANDARD_PRODUCTS } from './stack-registry.js';
7
+ import { z } from 'zod';
8
+ /** List views read bounded package and project configuration; detailed evidence is opt-in by ID. */
9
+ export function projectSnapshot(entry, detail = false) {
10
+ const summary = {
11
+ id: entry.id,
12
+ name: entry.name,
13
+ sourceName: '',
14
+ updatedAt: entry.updatedAt,
15
+ products: [],
16
+ status: 'source',
17
+ };
18
+ try {
19
+ if (realpathSync(entry.root) !== entry.root)
20
+ throw new Error();
21
+ const configuration = catalogConfiguration(entry.root);
22
+ if (entry.sourceIdentity !== sourceIdentity(configuration))
23
+ return {
24
+ ...summary,
25
+ status: 'unavailable',
26
+ message: 'This directory contains a different app. Select its new catalog entry or restore the registered source.',
27
+ };
28
+ if (realpathSync(entry.root) !== entry.root)
29
+ throw new Error();
30
+ const read = (relative) => {
31
+ const file = path.join(entry.root, relative);
32
+ if (!realpathSync(file).startsWith(entry.root + path.sep))
33
+ throw new Error();
34
+ return JSON.parse(readBoundedFile(file, 256 * 1024).toString('utf8'));
35
+ };
36
+ const manifest = read('package.json');
37
+ if (typeof manifest.name !== 'string' ||
38
+ !/^(@[a-z0-9._-]+\/)?[a-z0-9._-]+$/i.test(manifest.name) ||
39
+ manifest.name.length > 214)
40
+ throw new Error();
41
+ summary.sourceName = manifest.name;
42
+ const rawSetup = configuration?.setup;
43
+ if (rawSetup !== undefined) {
44
+ if (!rawSetup || typeof rawSetup !== 'object' || Array.isArray(rawSetup))
45
+ throw new Error();
46
+ if (Buffer.byteLength(JSON.stringify(rawSetup)) > 256 * 1024)
47
+ throw new Error();
48
+ const setup = rawSetup;
49
+ summary.products = Array.isArray(setup.products)
50
+ ? setup.products
51
+ .filter((p) => typeof p === 'string' &&
52
+ STANDARD_PRODUCTS.includes(p))
53
+ .slice(0, 100)
54
+ : [];
55
+ }
56
+ }
57
+ catch {
58
+ summary.status = 'unavailable';
59
+ summary.message =
60
+ 'Source summary is unavailable. Restore or inspect the registered source, then refresh.';
61
+ }
62
+ if (detail) {
63
+ try {
64
+ if (realpathSync(entry.root) !== entry.root)
65
+ throw new Error();
66
+ summary.inspection = inspectApplication(entry.root);
67
+ summary.status =
68
+ summary.status !== 'unavailable' &&
69
+ summary.inspection.targets.data.some((target) => target.latestAttempt || target.lastSuccessful)
70
+ ? 'recorded'
71
+ : summary.status;
72
+ }
73
+ catch {
74
+ summary.status = 'unavailable';
75
+ summary.message = 'Registered source is unavailable. Restore the directory, then refresh.';
76
+ }
77
+ }
78
+ return summary;
79
+ }
80
+ function catalogConfiguration(root) {
81
+ return lstatSync(projectConfigPath(root), { throwIfNoEntry: false })
82
+ ? readProjectConfig(root)
83
+ : null;
84
+ }
85
+ function sourceIdentity(configuration) {
86
+ if (configuration?.identity === undefined)
87
+ return undefined;
88
+ if (Buffer.byteLength(JSON.stringify(configuration.identity)) > 4096)
89
+ throw new Error('Project identity exceeds its size limit.');
90
+ return z
91
+ .object({ schemaVersion: z.literal(1), id: z.string().uuid() })
92
+ .strict()
93
+ .parse(configuration.identity).id;
94
+ }
95
+ export function readCatalogSourceIdentity(root) {
96
+ return sourceIdentity(catalogConfiguration(root));
97
+ }
@@ -0,0 +1,16 @@
1
+ export declare class CliArgumentError extends Error {
2
+ readonly nextAction: string;
3
+ readonly code: string;
4
+ constructor(message: string, nextAction: string, code?: string);
5
+ }
6
+ /** Bound typo matching so arbitrary CLI input cannot create quadratic work. */
7
+ export declare function suggest(input: string, choices: readonly string[]): string | undefined;
8
+ export declare function globalArguments(input: readonly string[]): {
9
+ args: string[];
10
+ cwd: string | undefined;
11
+ quiet: boolean;
12
+ verbose: boolean;
13
+ json: boolean;
14
+ };
15
+ export declare function validateCommand(command: string | undefined, args: readonly string[]): void;
16
+ export declare function inlineArguments(command: string | undefined, args: readonly string[]): string[];
@@ -0,0 +1,115 @@
1
+ import { COMMANDS, GLOBAL_OPTIONS, commandDefinition } from './command-schema.js';
2
+ export class CliArgumentError extends Error {
3
+ nextAction;
4
+ code;
5
+ constructor(message, nextAction, code = 'INVALID_ARGUMENT') {
6
+ super(message);
7
+ this.nextAction = nextAction;
8
+ this.code = code;
9
+ }
10
+ }
11
+ /** Bound typo matching so arbitrary CLI input cannot create quadratic work. */
12
+ export function suggest(input, choices) {
13
+ if (!input || input.length > 64)
14
+ return undefined;
15
+ const distance = (a, b) => {
16
+ let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
17
+ for (let row = 1; row <= a.length; row++) {
18
+ const current = [row];
19
+ for (let column = 1; column <= b.length; column++)
20
+ current[column] = Math.min(current[column - 1] + 1, previous[column] + 1, previous[column - 1] + (a[row - 1] === b[column - 1] ? 0 : 1));
21
+ previous = current;
22
+ }
23
+ return previous[b.length];
24
+ };
25
+ const matches = choices
26
+ .map((choice) => ({ choice, distance: distance(input, choice) }))
27
+ .sort((a, b) => a.distance - b.distance || a.choice.localeCompare(b.choice));
28
+ const best = matches[0];
29
+ if (best &&
30
+ best.distance <= (input.length > 5 ? 2 : 1) &&
31
+ (!matches[1] || best.distance < matches[1].distance))
32
+ return best.choice;
33
+ return undefined;
34
+ }
35
+ export function globalArguments(input) {
36
+ const args = [];
37
+ let cwd;
38
+ let quiet = false;
39
+ let verbose = false;
40
+ let json = false;
41
+ for (let index = 0; index < input.length; index++) {
42
+ const arg = input[index];
43
+ if (arg === '-c' || arg === '--cwd' || arg.startsWith('--cwd=')) {
44
+ const value = arg.startsWith('--cwd=') ? arg.slice(6) : input[++index];
45
+ if (!value || value.startsWith('-') || cwd !== undefined)
46
+ throw new CliArgumentError('Specify one working directory with --cwd <directory>.', 'Run anhedral --help.');
47
+ cwd = value;
48
+ }
49
+ else if (arg === '--json')
50
+ json = true;
51
+ else if (arg === '--quiet' || arg === '-q')
52
+ quiet = true;
53
+ else if (arg === '--verbose')
54
+ verbose = true;
55
+ else
56
+ args.push(arg);
57
+ }
58
+ return { args, cwd, quiet, verbose, json };
59
+ }
60
+ export function validateCommand(command, args) {
61
+ if (!command || ['--help', '-h', '--version', '-v', 'help'].includes(command))
62
+ return;
63
+ const definition = commandDefinition(command);
64
+ if (!definition) {
65
+ const recommendation = suggest(command, [...Object.keys(COMMANDS), 'help']);
66
+ const name = /^[a-z-]{1,32}$/.test(command) ? `: ${command}` : '';
67
+ throw new CliArgumentError(`Unknown command${name}.${recommendation ? ` Did you mean ${recommendation}?` : ''}`, 'Run anhedral --help.', 'UNKNOWN_COMMAND');
68
+ }
69
+ const options = [...definition.options, ...GLOBAL_OPTIONS];
70
+ const flags = options.flatMap((option) => [option.flag, ...(option.aliases ?? [])]);
71
+ const seen = new Set();
72
+ for (let index = 0; index < args.length; index++) {
73
+ const argument = args[index];
74
+ if (!argument.startsWith('-'))
75
+ continue;
76
+ const separator = argument.indexOf('=');
77
+ const flag = separator < 0 ? argument : argument.slice(0, separator);
78
+ const option = options.find((entry) => entry.flag === flag || entry.aliases?.includes(flag));
79
+ if (!option) {
80
+ const recommendation = suggest(flag, flags);
81
+ const display = /^--?[a-z-]{1,64}$/.test(flag) ? `: ${flag}` : '';
82
+ throw new CliArgumentError(`Unknown ${command} option${display}.${recommendation ? ` Did you mean ${recommendation}?` : ''}`, `Run anhedral ${command} --help.`);
83
+ }
84
+ if (seen.has(option.flag) && !option.repeatable)
85
+ throw new CliArgumentError(`Specify ${option.flag} once.`, `Run anhedral ${command} --help.`);
86
+ seen.add(option.flag);
87
+ if (separator >= 0 && !option.arity)
88
+ throw new CliArgumentError('This option does not accept an inline value.', `Run anhedral ${command} --help.`);
89
+ if (option.arity) {
90
+ const value = separator >= 0 ? argument.slice(separator + 1) : args[index + 1];
91
+ if (!value || value.startsWith('-')) {
92
+ if (option.arity === 'required' || separator >= 0)
93
+ throw new CliArgumentError(`Supply a value for ${option.flag}.`, `Run anhedral ${command} --help.`);
94
+ }
95
+ else if (separator < 0)
96
+ index++;
97
+ }
98
+ }
99
+ }
100
+ export function inlineArguments(command, args) {
101
+ const definition = commandDefinition(command);
102
+ const flags = new Set(definition?.options
103
+ .filter((option) => option.arity)
104
+ .flatMap((option) => [option.flag, ...(option.aliases ?? [])]) ?? []);
105
+ return args.flatMap((argument) => {
106
+ const separator = argument.indexOf('=');
107
+ if (separator < 0 || !flags.has(argument.slice(0, separator)))
108
+ return [argument];
109
+ const flag = argument.slice(0, separator);
110
+ const value = argument.slice(separator + 1);
111
+ if (!value || value.startsWith('-'))
112
+ throw new CliArgumentError(`Supply a value for ${flag}.`, `Run anhedral ${command} --help.`);
113
+ return [flag, value];
114
+ });
115
+ }
@@ -0,0 +1,8 @@
1
+ export interface OutputOptions {
2
+ json?: boolean;
3
+ quiet?: boolean;
4
+ }
5
+ /** Human output is an explicit summary, never a recursive dump of provider payloads. */
6
+ export declare function formatResult(command: string, value: unknown): string;
7
+ export declare function printResult(command: string, value: unknown, options?: OutputOptions): void;
8
+ export declare function printProgress(message: string, options?: OutputOptions): void;