anhedral 0.11.2 → 0.13.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 (102) hide show
  1. package/README.md +171 -18
  2. package/dist/bin.js +48 -493
  3. package/dist/capabilities.d.ts +3 -3
  4. package/dist/capability-contract.js +16 -1
  5. package/dist/cli-arguments.d.ts +8 -0
  6. package/dist/cli-arguments.js +32 -0
  7. package/dist/cli-commands.d.ts +3 -0
  8. package/dist/cli-commands.js +114 -0
  9. package/dist/cli-delivery.d.ts +3 -0
  10. package/dist/cli-delivery.js +172 -0
  11. package/dist/cli-output.js +231 -205
  12. package/dist/command-schema.js +8 -2
  13. package/dist/command.js +9 -11
  14. package/dist/delivery-evidence.d.ts +62 -0
  15. package/dist/delivery-evidence.js +186 -0
  16. package/dist/delivery.d.ts +3 -40
  17. package/dist/delivery.js +7 -182
  18. package/dist/dependencies.d.ts +7 -1
  19. package/dist/dependencies.js +15 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +1 -0
  22. package/dist/mobile-delivery.d.ts +21 -44
  23. package/dist/mobile-delivery.js +127 -80
  24. package/dist/platforms/mobile.d.ts +1 -1
  25. package/dist/platforms/mobile.js +44 -3
  26. package/dist/project-state.js +4 -1
  27. package/dist/provider-auth.js +9 -3
  28. package/dist/providers/adapters.js +9 -3
  29. package/dist/providers/runtime.js +11 -0
  30. package/dist/readiness.js +4 -2
  31. package/dist/registry/add.js +40 -7
  32. package/dist/registry/options.js +12 -0
  33. package/dist/registry/presets.d.ts +4 -0
  34. package/dist/registry/presets.js +41 -0
  35. package/dist/registry/resolve.d.ts +3 -1
  36. package/dist/registry/resolve.js +40 -14
  37. package/dist/registry/types.d.ts +1 -0
  38. package/dist/registry/usage.js +1 -1
  39. package/dist/runtime-policy.js +4 -1
  40. package/dist/scaffold/api.js +10 -2
  41. package/dist/scaffold/auth.d.ts +1 -1
  42. package/dist/scaffold/auth.js +22 -6
  43. package/dist/scaffold/backend.d.ts +6 -0
  44. package/dist/scaffold/backend.js +224 -0
  45. package/dist/scaffold/billing-config.d.ts +1 -0
  46. package/dist/scaffold/billing-config.js +73 -0
  47. package/dist/scaffold/billing-contracts.d.ts +2 -0
  48. package/dist/scaffold/billing-contracts.js +48 -0
  49. package/dist/scaffold/billing-providers.d.ts +1 -0
  50. package/dist/scaffold/billing-providers.js +249 -0
  51. package/dist/scaffold/billing-schema.d.ts +1 -0
  52. package/dist/scaffold/billing-schema.js +34 -0
  53. package/dist/scaffold/billing-security.d.ts +1 -0
  54. package/dist/scaffold/billing-security.js +46 -0
  55. package/dist/scaffold/billing-server.d.ts +1 -0
  56. package/dist/scaffold/billing-server.js +139 -0
  57. package/dist/scaffold/billing-store.d.ts +1 -0
  58. package/dist/scaffold/billing-store.js +72 -0
  59. package/dist/scaffold/billing.d.ts +2 -0
  60. package/dist/scaffold/billing.js +216 -0
  61. package/dist/scaffold/cloudflare-services.d.ts +8 -0
  62. package/dist/scaffold/cloudflare-services.js +198 -0
  63. package/dist/scaffold/compose.js +2 -0
  64. package/dist/scaffold/database.js +19 -2
  65. package/dist/scaffold/documentation.js +11 -6
  66. package/dist/scaffold/expo-auth.d.ts +3 -0
  67. package/dist/scaffold/expo-auth.js +192 -0
  68. package/dist/scaffold/expo-billing.d.ts +3 -0
  69. package/dist/scaffold/expo-billing.js +292 -0
  70. package/dist/scaffold/expo-runtime.d.ts +3 -0
  71. package/dist/scaffold/expo-runtime.js +134 -0
  72. package/dist/scaffold/integrations.d.ts +2 -1
  73. package/dist/scaffold/integrations.js +7 -2
  74. package/dist/scaffold/stream.d.ts +2 -0
  75. package/dist/scaffold/stream.js +114 -0
  76. package/dist/scaffold/void.js +13 -5
  77. package/dist/scaffold/web.js +2 -0
  78. package/dist/scaffold/workspace.js +6 -1
  79. package/dist/service-readers.js +1 -1
  80. package/dist/services-command.js +8 -6
  81. package/dist/ship.d.ts +15 -15
  82. package/dist/ship.js +3 -1
  83. package/dist/stack-registry.d.ts +13 -2
  84. package/dist/stack-registry.js +152 -16
  85. package/dist/transaction-lock.d.ts +15 -0
  86. package/dist/transaction-lock.js +227 -0
  87. package/dist/transaction.js +2 -208
  88. package/dist/vercel-project.d.ts +101 -0
  89. package/dist/vercel-project.js +305 -0
  90. package/dist/vercel.d.ts +3 -36
  91. package/dist/vercel.js +3 -300
  92. package/dist/version.d.ts +1 -1
  93. package/dist/version.js +1 -1
  94. package/docs/anhedral-stack.md +122 -0
  95. package/docs/software-factory.md +402 -7
  96. package/docs/stack-standard.md +226 -49
  97. package/docs/verification.md +557 -0
  98. package/package.json +7 -7
  99. package/docs/cli-design.md +0 -67
  100. package/docs/plugin-ui.md +0 -102
  101. package/docs/provider-configuration.md +0 -116
  102. package/docs/void-verification.md +0 -185
@@ -7,221 +7,247 @@ const names = (value) => Array.isArray(value)
7
7
  .map(string)
8
8
  .join(', ')
9
9
  : '';
10
- /** Human output is an explicit summary, never a recursive dump of provider payloads. */
11
- export function formatResult(command, value) {
12
- const data = record(value);
13
- const lines = [];
14
- const next = (action) => {
15
- if (string(action))
16
- lines.push(`Next: ${string(action)}`);
17
- };
18
- if (command === 'init') {
19
- lines.push(data.generated ? `Created ${string(data.root)}.` : `Stack preview for ${string(data.root)}.`, `Stack: ${names(data.products)}.`, `Hosting: ${string(data.hosting)}.`, '');
20
- const catalog = record(data.catalog);
21
- if (catalog.state === 'registered')
22
- lines.push('Registered in your local Anhedral dashboard.');
23
- if (catalog.state === 'pending')
24
- next(catalog.nextAction);
25
- if (data.generated)
26
- lines.push('Review the generated source and provider settings in anhedral.json (providers).', 'In the project directory, start development with pnpm dev. Run pnpm check before delivery.', 'Next: anhedral auth, then connect the intended hosting account and preview anhedral ship --dry-run.');
27
- else
28
- lines.push('No files, provider resources or deployments were created.');
10
+ function next(lines, action) {
11
+ if (string(action))
12
+ lines.push(`Next: ${string(action)}`);
13
+ }
14
+ function formatInit(data, lines) {
15
+ lines.push(data.generated ? `Created ${string(data.root)}.` : `Stack preview for ${string(data.root)}.`, `Stack: ${names(data.products)}.`, `Hosting: ${string(data.hosting)}.`, '');
16
+ const catalog = record(data.catalog);
17
+ if (catalog.state === 'registered')
18
+ lines.push('Registered in your local Anhedral dashboard.');
19
+ if (catalog.state === 'pending')
20
+ next(lines, catalog.nextAction);
21
+ if (data.generated)
22
+ lines.push('Review the generated source and provider settings in anhedral.json (providers).', 'In the project directory, start development with pnpm dev. Run pnpm check before delivery.', 'Next: anhedral auth, then connect the intended hosting account and preview anhedral ship --dry-run.');
23
+ else
24
+ lines.push('No files, provider resources or deployments were created.');
25
+ }
26
+ function formatServices(data, lines, value) {
27
+ if (Array.isArray(data.services)) {
28
+ lines.push(`${data.services.length} local service entries.`);
29
+ for (const service of entries(data.services))
30
+ lines.push(` ${string(service.key)}${service.state ? ` — ${string(service.state)}` : ''}`);
29
31
  }
30
- else if (command === 'services') {
31
- if (Array.isArray(data.services)) {
32
- lines.push(`${data.services.length} local service entries.`);
33
- for (const service of entries(data.services))
34
- lines.push(` ${string(service.key)}${service.state ? ` — ${string(service.state)}` : ''}`);
35
- }
36
- else if (Array.isArray(data.points)) {
37
- lines.push(`Analytics: ${string(data.source)}.`, `Window: ${string(data.start)} to ${string(data.end)} (UTC).`, `${data.points.length} provider data points.`, 'Use --json for the complete aggregate values.');
38
- }
39
- else if (Array.isArray(data.rows)) {
40
- lines.push(`Read ${data.rows.length} rows.`, `Private data${data.masked ? '; sensitive fields are masked' : ''}. Use --json to inspect values.`);
41
- }
42
- else if (string(data.token)) {
43
- lines.push(`Deletion plan: ${string(data.kind)} ${string(data.name)}.`, string(data.impact), `Affected apps: ${names(data.applications) || 'None recorded'}.`, `Expires: ${string(data.expiresAt)}.`, 'Use --json for the single-use confirmation token; deleting requires the exact resource name.');
44
- }
45
- else if (Array.isArray(value))
46
- lines.push(`Tables: ${names(value) || 'None'}.`);
47
- else
48
- lines.push(`Service: ${string(data.state) || 'Checked'}.`, string(data.message));
32
+ else if (Array.isArray(data.points)) {
33
+ lines.push(`Analytics: ${string(data.source)}.`, `Window: ${string(data.start)} to ${string(data.end)} (UTC).`, `${data.points.length} provider data points.`, 'Use --json for the complete aggregate values.');
49
34
  }
50
- else if (command === 'add') {
51
- lines.push(data.dryRun ? 'Addition preview.' : 'Stack parts added.', names(data.items) ? `Parts: ${names(data.items)}.` : 'No new stack parts.', `Project: ${string(data.root)}.`);
52
- const files = Array.isArray(data.files) ? data.files : [];
53
- if (files.length)
54
- lines.push('', ...files.map((file) => ` ${string(file)}`));
55
- if (data.filesChecked === false)
56
- lines.push('Source files were not checked: this selection needs the networked web bootstrap.');
57
- if (names(data.conflicts))
58
- lines.push(`Conflicts: ${names(data.conflicts)}.`);
59
- for (const preview of entries(data.previews))
60
- lines.push('', string(preview.path), string(preview.unavailable ?? preview.diff ?? preview.content));
61
- if (data.dryRun)
62
- lines.push('', 'No application files were changed.');
63
- else
64
- next('Run anhedral doctor and review the selected services’ setup requirements.');
35
+ else if (Array.isArray(data.rows)) {
36
+ lines.push(`Read ${data.rows.length} rows.`, `Private data${data.masked ? '; sensitive fields are masked' : ''}. Use --json to inspect values.`);
65
37
  }
66
- else if (command === 'inspect') {
67
- lines.push(`Project: ${string(data.name) || 'Name unavailable'}.`, 'Local recorded evidence; authentication and live provider status are not checked.');
68
- const selection = record(record(data.selection).data);
69
- lines.push(`Stack: ${names(selection.products) || 'Unavailable'}.`);
70
- for (const target of entries(record(data.targets).data)) {
71
- const latest = record(target.latestAttempt), successful = record(target.lastSuccessful);
72
- lines.push(` ${string(target.application)} — ${string(target.provider)} (${string(target.delivery)})`);
73
- if (string(latest.state))
74
- lines.push(` Latest recorded target result: ${string(latest.state)}.`);
75
- if (string(latest.operationState))
76
- lines.push(` Overall attempt: ${string(latest.operationState)}.`);
77
- if (string(successful.id))
78
- lines.push(` Last recorded success: ${string(successful.id)}.`);
79
- if (string(target.error))
80
- lines.push(` ${string(target.error)}`);
81
- }
82
- for (const check of entries(record(record(data.readiness).data).checks))
83
- lines.push(` ${check.ok ? 'pass' : 'fail'} ${string(check.id)} — ${string(check.detail)}`);
84
- for (const key of [
85
- 'selection',
86
- 'workspaces',
87
- 'configuration',
88
- 'targets',
89
- 'setupProviders',
90
- 'integrations',
91
- 'cloudflareResources',
92
- 'readiness',
93
- 'operation',
94
- ]) {
95
- const section = record(data[key]);
96
- if (section.state === 'unavailable')
97
- lines.push(`${key}: ${string(section.error) || 'Unavailable'}.`);
98
- }
99
- next('Use --json for target-specific records. Review local checks, then explicitly run auth or ship when intended.');
38
+ else if (string(data.token)) {
39
+ lines.push(`Deletion plan: ${string(data.kind)} ${string(data.name)}.`, string(data.impact), `Affected apps: ${names(data.applications) || 'None recorded'}.`, `Expires: ${string(data.expiresAt)}.`, 'Use --json for the single-use confirmation token; deleting requires the exact resource name.');
100
40
  }
101
- else if (command === 'auth') {
102
- const checks = entries(data.checks);
103
- lines.push(checks.length ? 'Provider authentication' : 'This stack requires no provider authentication.');
104
- for (const check of checks) {
105
- lines.push(` ${string(check.provider).padEnd(12)}${string(check.state)}${string(check.access) && check.access !== 'none' ? ` (${string(check.access)} access)` : ''}`);
106
- if (check.state !== 'verified' || check.access === 'runtime')
107
- next(check.nextAction);
108
- }
109
- if (checks.length && string(data.note))
110
- lines.push(string(data.note));
111
- if (checks.length)
112
- next(data.authenticated
113
- ? 'Complete provider settings, connect the intended hosting account, then run anhedral ship --dry-run.'
114
- : 'Resolve the reported access checks, then repeat anhedral auth --status.');
41
+ else if (Array.isArray(value))
42
+ lines.push(`Tables: ${names(value) || 'None'}.`);
43
+ else
44
+ lines.push(`Service: ${string(data.state) || 'Checked'}.`, string(data.message));
45
+ }
46
+ function formatAdd(data, lines) {
47
+ lines.push(data.dryRun ? 'Addition preview.' : 'Stack parts added.', names(data.items) ? `Parts: ${names(data.items)}.` : 'No new stack parts.', `Project: ${string(data.root)}.`);
48
+ const files = Array.isArray(data.files) ? data.files : [];
49
+ if (files.length)
50
+ lines.push('', ...files.map((file) => ` ${string(file)}`));
51
+ if (data.filesChecked === false)
52
+ lines.push('Source files were not checked: this selection needs the networked web bootstrap.');
53
+ if (names(data.conflicts))
54
+ lines.push(`Conflicts: ${names(data.conflicts)}.`);
55
+ for (const preview of entries(data.previews))
56
+ lines.push('', string(preview.path), string(preview.unavailable ?? preview.diff ?? preview.content));
57
+ if (data.dryRun)
58
+ lines.push('', 'No application files were changed.');
59
+ else
60
+ next(lines, 'Run anhedral doctor and review the selected services’ setup requirements.');
61
+ }
62
+ function formatInspect(data, lines) {
63
+ lines.push(`Project: ${string(data.name) || 'Name unavailable'}.`, 'Local recorded evidence; authentication and live provider status are not checked.');
64
+ const selection = record(record(data.selection).data);
65
+ lines.push(`Stack: ${names(selection.products) || 'Unavailable'}.`);
66
+ for (const target of entries(record(data.targets).data)) {
67
+ const latest = record(target.latestAttempt), successful = record(target.lastSuccessful);
68
+ lines.push(` ${string(target.application)} — ${string(target.provider)} (${string(target.delivery)})`);
69
+ if (string(latest.state))
70
+ lines.push(` Latest recorded target result: ${string(latest.state)}.`);
71
+ if (string(latest.operationState))
72
+ lines.push(` Overall attempt: ${string(latest.operationState)}.`);
73
+ if (string(successful.id))
74
+ lines.push(` Last recorded success: ${string(successful.id)}.`);
75
+ if (string(target.error))
76
+ lines.push(` ${string(target.error)}`);
115
77
  }
116
- else if (command === 'integrations') {
117
- lines.push(data.recovered
118
- ? 'Integration resource reconciled.'
119
- : 'Integration receipts (recorded locally).');
120
- for (const provider of entries(data.providers)) {
121
- lines.push(` ${string(provider.provider)}`);
122
- for (const operation of entries(provider.operations))
123
- lines.push(` ${string(operation.operation)}: ${string(operation.status)}`);
124
- }
125
- if (string(data.operation))
126
- lines.push(`Operation: ${string(data.operation)}`);
127
- next(data.nextAction ??
128
- 'Use --json to inspect the resource IDs and safe recovery descriptors. Unknown operations must be verified before retrying.');
78
+ for (const check of entries(record(record(data.readiness).data).checks))
79
+ lines.push(` ${check.ok ? 'pass' : 'fail'} ${string(check.id)} — ${string(check.detail)}`);
80
+ for (const key of [
81
+ 'selection',
82
+ 'workspaces',
83
+ 'configuration',
84
+ 'targets',
85
+ 'setupProviders',
86
+ 'integrations',
87
+ 'cloudflareResources',
88
+ 'readiness',
89
+ 'operation',
90
+ ]) {
91
+ const section = record(data[key]);
92
+ if (section.state === 'unavailable')
93
+ lines.push(`${key}: ${string(section.error) || 'Unavailable'}.`);
129
94
  }
130
- else if (command === 'registry') {
131
- lines.push(`${string(data.name)} (${string(data.type)})`, string(data.description));
132
- if (names(data.targets))
133
- lines.push(`Files: ${names(data.targets)}`);
134
- if (names(data.registryDependencies))
135
- lines.push(`Requires: ${names(data.registryDependencies)}`);
136
- const setup = record(data.setup);
137
- for (const key of ['access', 'credentials', 'resources', 'verify'])
138
- if (names(setup[key]))
139
- lines.push(`${key}: ${names(setup[key])}`);
140
- next(`Inspect anhedral add ${string(data.name)} --dry-run in your project.`);
95
+ next(lines, 'Use --json for target-specific records. Review local checks, then explicitly run auth or ship when intended.');
96
+ }
97
+ function formatAuth(data, lines) {
98
+ const checks = entries(data.checks);
99
+ lines.push(checks.length ? 'Provider authentication' : 'This stack requires no provider authentication.');
100
+ for (const check of checks) {
101
+ lines.push(` ${string(check.provider).padEnd(12)}${string(check.state)}${string(check.access) && check.access !== 'none' ? ` (${string(check.access)} access)` : ''}`);
102
+ if (check.state !== 'verified' || check.access === 'runtime')
103
+ next(lines, check.nextAction);
141
104
  }
142
- else if (command === 'doctor') {
143
- const local = record(data.local);
144
- const checks = entries(data.checks ?? local.checks);
145
- lines.push(data.localReady ? 'Local project checks passed.' : 'Local project checks need attention.');
146
- for (const check of checks) {
147
- lines.push(` ${check.ok ? 'pass' : 'fail'} ${string(check.id)}${string(check.detail) ? ` — ${string(check.detail)}` : ''}`);
148
- if (check.ok === false)
149
- next(check.nextAction);
150
- }
151
- if (data.providerVerification)
152
- lines.push(`Provider evidence: ${string(data.providerVerification)}.`);
153
- for (const check of entries(data.prerequisiteChecks)) {
154
- lines.push(` ${check.ok ? 'pass' : 'fail'} ${string(check.id)} — ${string(check.detail)}`);
155
- if (check.ok === false)
156
- next(check.nextAction);
157
- }
158
- lines.push('Local readiness does not certify production behavior.');
105
+ if (checks.length && string(data.note))
106
+ lines.push(string(data.note));
107
+ if (checks.length)
108
+ next(lines, data.authenticated
109
+ ? 'Complete provider settings, connect the intended hosting account, then run anhedral ship --dry-run.'
110
+ : 'Resolve the reported access checks, then repeat anhedral auth --status.');
111
+ }
112
+ function formatIntegrations(data, lines) {
113
+ lines.push(data.recovered
114
+ ? 'Integration resource reconciled.'
115
+ : 'Integration receipts (recorded locally).');
116
+ for (const provider of entries(data.providers)) {
117
+ lines.push(` ${string(provider.provider)}`);
118
+ for (const operation of entries(provider.operations))
119
+ lines.push(` ${string(operation.operation)}: ${string(operation.status)}`);
159
120
  }
160
- else {
161
- const project = record(data.project);
162
- const release = record(data.release);
163
- const state = string(data.state ?? release.state);
164
- lines.push(data.mutation === false
165
- ? `${command}: preview only.`
166
- : `${command}${state ? `: ${state}` : ': completed'}.`);
167
- if (string(project.name))
168
- lines.push(`Project: ${string(project.name)} (${string(project.provider)}).`);
169
- if (string(release.id))
170
- lines.push(`Release: ${string(release.id)}`);
171
- if (string(data.buildId))
172
- lines.push(`Build: ${string(data.buildId)} (${string(data.platform)}, ${string(data.profile)}).`);
173
- if (string(data.evidence))
174
- lines.push(`Evidence: ${string(data.evidence)}.`);
175
- if (typeof data.activeRecordedVersion === 'boolean')
176
- lines.push(`Recorded production version: ${data.activeRecordedVersion ? 'active' : 'not confirmed'}.`);
177
- for (const target of entries(data.provider))
178
- lines.push(` ${string(target.target)}: ${target.activeRecordedVersion === true ? 'recorded version active' : 'recorded version not confirmed'}`);
179
- const repository = record(data.repository);
180
- if (string(repository.nameWithOwner))
181
- lines.push(`Repository: ${string(repository.nameWithOwner)}`);
182
- if (string(data.branch))
183
- lines.push(`Branch: ${string(data.branch)}`);
184
- for (const resource of entries(record(data.provisioning ?? data).resources))
185
- lines.push(` ${string(resource.kind)} ${string(resource.name)}${string(resource.target) ? ` (${string(resource.target)})` : ''}`);
186
- for (const key of ['downloadUrl', 'buildPageUrl', 'managementFile', 'file'])
187
- if (string(data[key]))
188
- lines.push(`${key}: ${string(data[key])}`);
189
- if (string(release.url))
190
- lines.push(`URL: ${string(release.url)}`);
191
- const integration = record(data.integrations);
192
- for (const provider of entries(integration.providers)) {
193
- lines.push(` ${string(provider.provider)}${names(provider.missing) ? `: missing ${names(provider.missing)}` : ': configuration selected'}`);
194
- }
195
- for (const provider of entries(integration.results)) {
196
- lines.push(` ${string(provider.provider)}: ${provider.ready ? 'configured' : 'setup pending'}`);
197
- for (const action of Array.isArray(provider.nextActions) ? provider.nextActions : [])
198
- next(action);
199
- }
200
- if (data.productVerification)
201
- lines.push(`Product verification: ${string(data.productVerification)}.`);
202
- const operation = record(data.operation);
203
- if (string(operation.state)) {
204
- lines.push(`Operation: ${string(operation.state)} (recorded locally).`);
205
- for (const phase of entries(operation.phases))
206
- lines.push(` ${string(phase.name)}: ${string(phase.state)}`);
207
- }
208
- for (const target of entries(data.targets)) {
209
- if (string(target.provider)) {
210
- const result = record(target.result);
211
- const release = record(result.release);
212
- lines.push(` ${string(target.provider)}: ${string(target.state ?? result.state ?? release.state) || 'planned'}`);
213
- }
121
+ if (string(data.operation))
122
+ lines.push(`Operation: ${string(data.operation)}`);
123
+ next(lines, data.nextAction ??
124
+ 'Use --json to inspect the resource IDs and safe recovery descriptors. Unknown operations must be verified before retrying.');
125
+ }
126
+ function formatRegistry(data, lines) {
127
+ lines.push(`${string(data.name)} (${string(data.type)})`, string(data.description));
128
+ if (names(data.targets))
129
+ lines.push(`Files: ${names(data.targets)}`);
130
+ if (names(data.registryDependencies))
131
+ lines.push(`Requires: ${names(data.registryDependencies)}`);
132
+ const setup = record(data.setup);
133
+ for (const key of ['access', 'credentials', 'resources', 'verify'])
134
+ if (names(setup[key]))
135
+ lines.push(`${key}: ${names(setup[key])}`);
136
+ next(lines, `Inspect anhedral add ${string(data.name)} --dry-run in your project.`);
137
+ }
138
+ function formatDoctor(data, lines) {
139
+ const local = record(data.local);
140
+ const checks = entries(data.checks ?? local.checks);
141
+ lines.push(data.localReady ? 'Local project checks passed.' : 'Local project checks need attention.');
142
+ for (const check of checks) {
143
+ lines.push(` ${check.ok ? 'pass' : 'fail'} ${string(check.id)}${string(check.detail) ? ` — ${string(check.detail)}` : ''}`);
144
+ if (check.ok === false)
145
+ next(lines, check.nextAction);
146
+ }
147
+ if (data.providerVerification)
148
+ lines.push(`Provider evidence: ${string(data.providerVerification)}.`);
149
+ for (const check of entries(data.prerequisiteChecks)) {
150
+ lines.push(` ${check.ok ? 'pass' : 'fail'} ${string(check.id)} — ${string(check.detail)}`);
151
+ if (check.ok === false)
152
+ next(lines, check.nextAction);
153
+ }
154
+ lines.push('Local readiness does not certify production behavior.');
155
+ }
156
+ function formatDeliveryHeader(data, lines, command) {
157
+ const project = record(data.project);
158
+ const release = record(data.release);
159
+ const state = string(data.state ?? release.state);
160
+ lines.push(data.mutation === false
161
+ ? `${command}: preview only.`
162
+ : `${command}${state ? `: ${state}` : ': completed'}.`);
163
+ if (string(project.name))
164
+ lines.push(`Project: ${string(project.name)} (${string(project.provider)}).`);
165
+ if (string(release.id))
166
+ lines.push(`Release: ${string(release.id)}`);
167
+ if (string(data.buildId))
168
+ lines.push(`Build: ${string(data.buildId)} (${string(data.platform)}, ${string(data.profile)}).`);
169
+ if (string(data.evidence))
170
+ lines.push(`Evidence: ${string(data.evidence)}.`);
171
+ if (typeof data.activeRecordedVersion === 'boolean')
172
+ lines.push(`Recorded production version: ${data.activeRecordedVersion ? 'active' : 'not confirmed'}.`);
173
+ for (const target of entries(data.provider))
174
+ lines.push(` ${string(target.target)}: ${target.activeRecordedVersion === true ? 'recorded version active' : 'recorded version not confirmed'}`);
175
+ }
176
+ function formatDeliveryResources(data, lines) {
177
+ const release = record(data.release);
178
+ const repository = record(data.repository);
179
+ if (string(repository.nameWithOwner))
180
+ lines.push(`Repository: ${string(repository.nameWithOwner)}`);
181
+ if (string(data.branch))
182
+ lines.push(`Branch: ${string(data.branch)}`);
183
+ for (const resource of entries(record(data.provisioning ?? data).resources))
184
+ lines.push(` ${string(resource.kind)} ${string(resource.name)}${string(resource.target) ? ` (${string(resource.target)})` : ''}`);
185
+ for (const key of ['downloadUrl', 'buildPageUrl', 'managementFile', 'file'])
186
+ if (string(data[key]))
187
+ lines.push(`${key}: ${string(data[key])}`);
188
+ if (string(release.url))
189
+ lines.push(`URL: ${string(release.url)}`);
190
+ }
191
+ function formatDeliveryIntegrations(data, lines) {
192
+ const integration = record(data.integrations);
193
+ for (const provider of entries(integration.providers)) {
194
+ lines.push(` ${string(provider.provider)}${names(provider.missing) ? `: missing ${names(provider.missing)}` : ': configuration selected'}`);
195
+ }
196
+ for (const provider of entries(integration.results)) {
197
+ lines.push(` ${string(provider.provider)}: ${provider.ready ? 'configured' : 'setup pending'}`);
198
+ for (const action of Array.isArray(provider.nextActions) ? provider.nextActions : [])
199
+ next(lines, action);
200
+ }
201
+ }
202
+ function formatDeliveryOperation(data, lines) {
203
+ const operation = record(data.operation);
204
+ if (string(operation.state)) {
205
+ lines.push(`Operation: ${string(operation.state)} (recorded locally).`);
206
+ for (const phase of entries(operation.phases))
207
+ lines.push(` ${string(phase.name)}: ${string(phase.state)}`);
208
+ }
209
+ for (const target of entries(data.targets)) {
210
+ if (string(target.provider)) {
211
+ const result = record(target.result);
212
+ const release = record(result.release);
213
+ lines.push(` ${string(target.provider)}: ${string(target.state ?? result.state ?? release.state) || 'planned'}`);
214
214
  }
215
- next(data.nextAction);
216
- if (data.mutation === false)
217
- lines.push('No provider resources or deployments were changed.');
218
- else if (!data.nextAction && command === 'ship' && state === 'deployed')
219
- next('Run anhedral verify to exercise the application’s configured acceptance checks.');
220
- else if (!data.nextAction && command === 'connect')
221
- next('Review and commit the connection manifest, then run anhedral ship --dry-run.');
222
- if (!state && !data.nextAction && !Object.keys(project).length)
223
- lines.push('Use --json for the complete recorded evidence.');
224
215
  }
216
+ }
217
+ function formatDelivery(data, lines, _value, command) {
218
+ const project = record(data.project);
219
+ const state = string(data.state ?? record(data.release).state);
220
+ formatDeliveryHeader(data, lines, command);
221
+ formatDeliveryResources(data, lines);
222
+ formatDeliveryIntegrations(data, lines);
223
+ if (data.productVerification)
224
+ lines.push(`Product verification: ${string(data.productVerification)}.`);
225
+ formatDeliveryOperation(data, lines);
226
+ next(lines, data.nextAction);
227
+ if (data.mutation === false)
228
+ lines.push('No provider resources or deployments were changed.');
229
+ else if (!data.nextAction && command === 'ship' && state === 'deployed')
230
+ next(lines, 'Run anhedral verify to exercise the application’s configured acceptance checks.');
231
+ else if (!data.nextAction && command === 'connect')
232
+ next(lines, 'Review and commit the connection manifest, then run anhedral ship --dry-run.');
233
+ if (!state && !data.nextAction && !Object.keys(project).length)
234
+ lines.push('Use --json for the complete recorded evidence.');
235
+ }
236
+ const formatters = {
237
+ init: formatInit,
238
+ services: formatServices,
239
+ add: formatAdd,
240
+ inspect: formatInspect,
241
+ auth: formatAuth,
242
+ integrations: formatIntegrations,
243
+ registry: formatRegistry,
244
+ doctor: formatDoctor,
245
+ };
246
+ /** Human output is an explicit summary, never a recursive dump of provider payloads. */
247
+ export function formatResult(command, value) {
248
+ const lines = [];
249
+ const format = Object.hasOwn(formatters, command) ? formatters[command] : formatDelivery;
250
+ format(record(value), lines, value, command);
225
251
  return lines.join('\n').trimEnd();
226
252
  }
227
253
  export function printResult(command, value, options = {}) {
@@ -118,6 +118,12 @@ export const COMMANDS = {
118
118
  description: `Include ${name}.`,
119
119
  hidden: true,
120
120
  })),
121
+ {
122
+ flag: '--preset',
123
+ description: 'Start minimal or select the complete compatible product stack.',
124
+ value: 'minimal|full-product',
125
+ arity: 'required',
126
+ },
121
127
  {
122
128
  flag: '--hosting',
123
129
  description: 'Select web hosting.',
@@ -134,10 +140,10 @@ export const COMMANDS = {
134
140
  ],
135
141
  examples: [
136
142
  'init client-app',
137
- 'init mobile-app --expo',
143
+ 'init product --preset full-product --dry-run',
138
144
  'init product --next --hono --neon --clerk --dry-run',
139
145
  ],
140
- note: `Default: Vinext on Cloudflare Workers, using the official shadcn pnpm/Turborepo monorepo.\nProducts: ${STANDARD_PRODUCTS.join(', ')}\nOnly bundled options are supported. --all is intentionally unsupported.`,
146
+ note: `Default: minimal Expo web/iOS/Android app on Cloudflare; no API, auth, database or paid integrations. Add capabilities with resolved dependencies, or use --preset full-product.\nProducts: ${STANDARD_PRODUCTS.join(', ')}\nOnly bundled options are supported. --all is intentionally unsupported.`,
141
147
  },
142
148
  auth: {
143
149
  description: 'Check or guide authentication for the selected providers.',
package/dist/command.js CHANGED
@@ -5,21 +5,19 @@ export function resolveCommand(command, args, platform = process.platform, searc
5
5
  if (platform !== 'win32' || !['pnpm', 'pnpm.cmd'].includes(command))
6
6
  return { command, args: [...args] };
7
7
  const directories = searchPath.split(';').filter(Boolean);
8
- const executable = directories
9
- .map((directory) => path.join(directory, 'pnpm.exe'))
10
- .find(existsSync);
11
- if (executable)
12
- return { command: executable, args: [...args] };
13
8
  const entries = [
14
9
  'node_modules/pnpm/bin/pnpm.cjs',
15
10
  'node_modules/corepack/dist/pnpm.js',
16
11
  'pnpm.cjs',
17
12
  '../pnpm/bin/pnpm.cjs',
18
13
  ];
19
- const entry = directories
20
- .flatMap((directory) => entries.map((file) => path.join(directory, file)))
21
- .find(existsSync);
22
- if (!entry)
23
- throw new Error('Cannot locate a direct pnpm entry point. Install pnpm or enable Corepack.');
24
- return { command: process.execPath, args: [entry, ...args] };
14
+ for (const directory of directories) {
15
+ const executable = path.join(directory, 'pnpm.exe');
16
+ if (existsSync(executable))
17
+ return { command: executable, args: [...args] };
18
+ const entry = entries.map((file) => path.join(directory, file)).find(existsSync);
19
+ if (entry)
20
+ return { command: process.execPath, args: [entry, ...args] };
21
+ }
22
+ throw new Error('Cannot locate a direct pnpm entry point. Install pnpm or enable Corepack.');
25
23
  }
@@ -0,0 +1,62 @@
1
+ import { type CloudflareRequest } from './cloudflare.js';
2
+ import { defaultRunner, type ApplicationProject, type DeploymentTarget } from './project-state.js';
3
+ export interface TargetRelease {
4
+ target: string;
5
+ versionId: string;
6
+ urls: string[];
7
+ providerConfirmed: boolean;
8
+ }
9
+ export interface Release {
10
+ id: string;
11
+ commit: string;
12
+ startedAt: string;
13
+ finishedAt?: string;
14
+ state: 'running' | 'checked' | 'deployed' | 'configuration-required' | 'failed';
15
+ targets: TargetRelease[];
16
+ failure?: string;
17
+ configurationChanges?: string[];
18
+ operation?: 'ship' | 'rollback';
19
+ restoredReleaseId?: string;
20
+ verification?: {
21
+ state: 'passed' | 'failed';
22
+ checkedAt: string;
23
+ command: 'pnpm run test:live';
24
+ };
25
+ }
26
+ export interface ReleaseHistory {
27
+ schemaVersion: 1;
28
+ projectId: string;
29
+ releases: Release[];
30
+ }
31
+ export declare function history(root: string, project: ApplicationProject): ReleaseHistory;
32
+ export declare function checkTargets(root: string, project: ApplicationProject, allowResourcePlaceholders?: boolean): void;
33
+ export declare function configurationFingerprint(root: string, project: ApplicationProject): string;
34
+ export declare function planDelivery(root: string, allowResourcePlaceholders?: boolean): {
35
+ project: ApplicationProject;
36
+ checks: string[][];
37
+ deployments: {
38
+ target: string;
39
+ directory: string;
40
+ command: string[];
41
+ }[];
42
+ resourcesProvisioned: boolean;
43
+ audience: "unconfigured" | "public" | "private";
44
+ };
45
+ export declare function parseDeploymentOutput(source: string, target: DeploymentTarget): TargetRelease;
46
+ export interface ActiveVersion {
47
+ versionId: string;
48
+ percentage: number;
49
+ }
50
+ export declare function activeVersions(value: unknown): ActiveVersion[];
51
+ export declare function providerStatus(root: string, project: ApplicationProject, target: DeploymentTarget, run: typeof defaultRunner, request?: CloudflareRequest): Promise<unknown>;
52
+ export declare function fullyActive(versions: ActiveVersion[], versionId: string): boolean;
53
+ export declare function describeArchitecture(root: string, project: ApplicationProject): {
54
+ target: string;
55
+ workerName: string;
56
+ directory: string;
57
+ bindings: {
58
+ kind: string;
59
+ binding: string;
60
+ }[];
61
+ scheduled: string[];
62
+ }[];