anhedral 0.22.0 → 0.23.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.
- package/README.md +37 -51
- package/assets/contracts/deployment-provenance.json +4 -4
- package/assets/contracts/environment-provenance.json +2 -2
- package/dist/cli-commands.js +5 -17
- package/dist/cli-errors.js +1 -1
- package/dist/cli-output.js +1 -1
- package/dist/command-schema.d.ts +1 -0
- package/dist/command-schema.js +19 -1
- package/dist/completion.js +1 -1
- package/dist/{capability-catalog.d.ts → composition/catalog.d.ts} +2 -2
- package/dist/{capability-catalog.js → composition/catalog.js} +2 -2
- package/dist/{capability-command.d.ts → composition/command.d.ts} +3 -3
- package/dist/{capability-command.js → composition/command.js} +29 -22
- package/dist/{composition.d.ts → composition/composition.d.ts} +1 -1
- package/dist/{composition.js → composition/composition.js} +2 -2
- package/dist/{capability-editor.js → composition/editor.js} +1 -1
- package/dist/{capability-recipes.d.ts → composition/recipes.d.ts} +2 -2
- package/dist/{capability-recipes.js → composition/recipes.js} +7 -7
- package/dist/{capability-references.js → composition/references.js} +2 -2
- package/dist/{stack-update.d.ts → composition/update.d.ts} +3 -3
- package/dist/{stack-update.js → composition/update.js} +11 -11
- package/dist/contracts/cli-transport.d.ts +1 -1
- package/dist/contracts/deployment.d.ts +4 -65
- package/dist/contracts/deployment.js +0 -29
- package/dist/contracts/environment-file.d.ts +3 -0
- package/dist/contracts/environment-file.js +8 -5
- package/dist/contracts/production-transport.d.ts +2 -2
- package/dist/contracts/staging-transport.d.ts +2 -2
- package/dist/dependencies.d.ts +1 -1
- package/dist/dependencies.js +1 -1
- package/dist/launch.js +8 -8
- package/dist/platform/auth.d.ts +14 -0
- package/dist/platform/auth.js +62 -0
- package/dist/{platform-command.d.ts → platform/command.d.ts} +2 -2
- package/dist/platform/command.js +279 -0
- package/dist/{credential-helper.js → platform/credential-helper.js} +1 -1
- package/dist/platform/deploy.d.ts +2 -0
- package/dist/platform/deploy.js +158 -0
- package/dist/{platform-environment.d.ts → platform/environment.d.ts} +1 -1
- package/dist/{platform-environment.js → platform/environment.js} +12 -12
- package/dist/platform/http.d.ts +7 -0
- package/dist/platform/http.js +105 -0
- package/dist/{platform-operations.d.ts → platform/operations.d.ts} +1 -1
- package/dist/{platform-operations.js → platform/operations.js} +5 -5
- package/dist/platform/output.d.ts +2 -0
- package/dist/platform/output.js +79 -0
- package/dist/{platform-production.d.ts → platform/production.d.ts} +1 -1
- package/dist/{platform-production.js → platform/production.js} +4 -4
- package/dist/platform/projects.d.ts +12 -0
- package/dist/platform/projects.js +125 -0
- package/dist/{platform-source.js → platform/source.js} +7 -7
- package/dist/platform/state-schema.d.ts +25 -0
- package/dist/platform/state-schema.js +11 -0
- package/dist/{platform-state.d.ts → platform/state.d.ts} +1 -1
- package/dist/{platform-state.js → platform/state.js} +3 -4
- package/dist/platform/types.d.ts +26 -0
- package/dist/platform/upload.d.ts +2 -0
- package/dist/platform/upload.js +60 -0
- package/dist/process/runner.d.ts +1 -0
- package/dist/{command-runner.js → process/runner.js} +1 -1
- package/dist/registry/usage.d.ts +1 -0
- package/dist/{platforms → scaffold}/tanstack.d.ts +2 -2
- package/dist/{platforms → scaffold}/tanstack.js +2 -2
- package/dist/transactions/durable-files.d.ts +8 -0
- package/dist/transactions/durable-files.js +132 -0
- package/dist/transactions/journal.d.ts +4 -0
- package/dist/transactions/journal.js +141 -0
- package/dist/{transaction-lock.js → transactions/lock.js} +2 -2
- package/dist/transactions/model.d.ts +18 -0
- package/dist/transactions/model.js +4 -0
- package/dist/transactions/paths.d.ts +12 -0
- package/dist/transactions/paths.js +155 -0
- package/dist/transactions/recovery.d.ts +7 -0
- package/dist/transactions/recovery.js +132 -0
- package/dist/{transaction.d.ts → transactions/transaction.d.ts} +1 -2
- package/dist/transactions/transaction.js +179 -0
- package/dist/util.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/capabilities.md +8 -6
- package/docs/software-factory.md +36 -6
- package/package.json +22 -22
- package/dist/platform-command.js +0 -787
- package/dist/transaction.js +0 -716
- /package/dist/{capability-editor.d.ts → composition/editor.d.ts} +0 -0
- /package/dist/{capability-references.d.ts → composition/references.d.ts} +0 -0
- /package/dist/{credential-helper.d.ts → platform/credential-helper.d.ts} +0 -0
- /package/dist/{platform-source.d.ts → platform/source.d.ts} +0 -0
- /package/dist/{command-runner.d.ts → platform/types.js} +0 -0
- /package/dist/{command.d.ts → process/resolve-command.d.ts} +0 -0
- /package/dist/{command.js → process/resolve-command.js} +0 -0
- /package/dist/{transaction-lock.d.ts → transactions/lock.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,72 +1,58 @@
|
|
|
1
1
|
# Anhedral CLI
|
|
2
2
|
|
|
3
3
|
> [!WARNING]
|
|
4
|
-
> Under construction
|
|
4
|
+
> **Under heavy construction.** CLI commands and generated app code may change.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Build an app one addition at a time. Generated applications are editable source. Start with a TanStack Start web app and ShadCN components. Add a backend when you need an API, authentication, or a database. Then choose storage, payments, or both.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
<picture>
|
|
9
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/anhedral/anhedral-cli/staging/docs/assets/anhedral-stack.png">
|
|
10
|
+
<img src="https://raw.githubusercontent.com/anhedral/anhedral-cli/staging/docs/assets/anhedral-stack-light.png" alt="The CLI creates a TanStack Start web app. The optional backend supports private file storage and subscription payments. An Expo client with Anhedral UI is upcoming.">
|
|
11
|
+
</picture>
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
anhedral init my-app
|
|
12
|
-
cd my-app
|
|
13
|
-
pnpm dev
|
|
14
|
-
```
|
|
13
|
+
**Upcoming** — `pnpm dlx anhedral@latest add cross-platform` will add an Expo client with Anhedral UI.
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
## How to use
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
Start with the web app and stop at the stage you need. Storage and payments each require the backend and can be added independently.
|
|
19
18
|
|
|
20
19
|
```sh
|
|
21
|
-
|
|
22
|
-
anhedral
|
|
23
|
-
|
|
24
|
-
anhedral add stripe
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
`backend` adds Hono, Better Auth and Drizzle/D1 together in one source transaction. `r2` adds private storage; `stripe` adds subscriptions. Both require the backend. Include missing prerequisites explicitly with `anhedral add r2 stripe --with-dependencies`.
|
|
28
|
-
|
|
29
|
-
After adding backend, configure `apps/api/.dev.vars` from its example, review the initial SQL and apply it deliberately with `pnpm db:migrate --local`. The OJ development server then runs the web and auxiliary API Workers with local resources. Authentication methods start disabled and need explicit configuration. After adding Stripe, run `pnpm db:generate`, review the billing SQL and migrate before testing webhooks. Builds/startup never migrate databases or activate providers.
|
|
30
|
-
|
|
31
|
-
Use `anhedral stack list`, `status` and `doctor` to inspect the Anhedral Stack and its additions. These checks describe source completeness, not live provider readiness. Current public generation is web-only. OJ runs development and builds. Historical generators and framework aliases are removed.
|
|
32
|
-
|
|
33
|
-
## Update an existing project
|
|
34
|
-
|
|
35
|
-
Update your agent plugin through its host and select the matching published CLI version. Preview `anhedral stack update --dry-run --json`, review the returned diffs/conflicts, then apply `anhedral stack update --expect-plan <planId> --json`. Updates preserve authored source and stop on customized-file conflicts or a changed plan. They refresh generated runtime/configuration and deployment provenance without running project scripts or installing dependencies. Validate dependencies and the application separately before upload/deployment. See [the operating workflow](docs/software-factory.md).
|
|
20
|
+
# Create the web app
|
|
21
|
+
pnpm dlx anhedral@latest init my-app
|
|
22
|
+
cd my-app
|
|
36
23
|
|
|
37
|
-
|
|
24
|
+
# Add an API, authentication, and a database
|
|
25
|
+
pnpm dlx anhedral@latest add backend
|
|
38
26
|
|
|
39
|
-
|
|
27
|
+
# Add private file storage
|
|
28
|
+
pnpm dlx anhedral@latest add storage
|
|
40
29
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
pnpm dlx shadcn@4.22.1 add card
|
|
30
|
+
# Add subscription payments
|
|
31
|
+
pnpm dlx anhedral@latest add payment
|
|
44
32
|
```
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## Optional Platform access
|
|
49
|
-
|
|
50
|
-
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
|
-
|
|
52
|
-
`deploy plan --manifest <file>`, `deploy prepare` and `deploy status` submit intent and read candidate receipts. Platform independently checks current authority, exact artifacts and runtime admission. Upload/build success does not publish production. Plans report current runtime compatibility and actionable remediation; candidate preparation does not require another person to review the CLI artifact. The current manifest runtime profile is `anhedral-stack`; an application cannot approve itself for hosting.
|
|
34
|
+
Run `pnpm dev` in the project directory to start the app. If you added services, configure them first. [Service setup](docs/capabilities.md) · [Source snapshot for each stage](https://github.com/anhedral/anhedral-cli/tree/staging/examples)
|
|
53
35
|
|
|
54
|
-
|
|
36
|
+
Upgrading from 0.22.1? Replace `add r2` with `add storage` and `add stripe` with `add payment`. Existing projects keep their R2 and Stripe configuration.
|
|
55
37
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Run `anhedral --help` or `anhedral help <command>` for contextual examples. Use `--json` for machine-readable stdout, `--quiet` to suppress ordinary output, and `--non-interactive` to avoid approval polling. Platform retains compact JSON by default; `--human` selects readable summaries. Errors remain on stderr with a numeric failure status and recovery guidance.
|
|
59
|
-
|
|
60
|
-
```sh
|
|
61
|
-
anhedral completion bash > ~/.anhedral-completion.bash
|
|
62
|
-
# Or print zsh completion without changing your shell profile:
|
|
63
|
-
anhedral completion zsh
|
|
64
|
-
```
|
|
38
|
+
### Command reference
|
|
65
39
|
|
|
66
|
-
|
|
40
|
+
Use `pnpm dlx anhedral@latest <command>`. For arguments and flags, run `pnpm dlx anhedral@latest help <command>`.
|
|
67
41
|
|
|
68
|
-
|
|
42
|
+
| Task | Commands |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| Generate source | `init`, `add` |
|
|
45
|
+
| Inspect or update the stack | `stack list`, `stack status`, `stack doctor`, `stack update` |
|
|
46
|
+
| Manage your session | `login`, `whoami`, `logout` |
|
|
47
|
+
| Connect a project | `projects list`, `projects create`, `link`, `unlink` |
|
|
48
|
+
| Upload source | `source upload`, `source status` |
|
|
49
|
+
| Configure environment variables | `env list`, `env set`, `env import` |
|
|
50
|
+
| Prepare a deployment | `deploy plan`, `deploy prepare`, `deploy status` |
|
|
51
|
+
| Deploy to staging | `staging deploy`, `staging status` |
|
|
52
|
+
| Publish to production | `production deploy`, `production status` |
|
|
53
|
+
| Read runtime logs | `logs` |
|
|
54
|
+
| Get help and shell completions | `help`, `--version`, `completion bash`, `completion zsh` |
|
|
69
55
|
|
|
70
|
-
|
|
56
|
+
Use the CLI directly or through the Codex and Claude Code plugin. To host on Anhedral, sign in, link a project, upload source, and deploy. [Platform workflow](docs/software-factory.md) · [Stack reference](docs/stack-standard.md)
|
|
71
57
|
|
|
72
|
-
Apache-2.0.
|
|
58
|
+
Apache-2.0. Retain the included third-party notices when distributing generated source.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"contractVersion": 1,
|
|
3
3
|
"owner": "anhedral/platform-contracts/deployment",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"sourceRevision": "
|
|
5
|
+
"sourceRevision": "2049016a3ec30720d5bc284b6d06cd8c60ce662b",
|
|
6
6
|
"files": {
|
|
7
7
|
"cli-transport.ts": "8bd4063d358b755e72fec637d88b3587c69a6dd3f94f0583c4d676e181386064",
|
|
8
8
|
"source-profile.ts": "1426caa2675db95d249ca36bb06c039ce8382379fd33cf9cdae48d7aad2faded",
|
|
9
9
|
"source-bundle.ts": "99df4874f9337a604da544093215de24f19f136182017be15629f78b5180a52b",
|
|
10
|
-
"deployment.ts": "
|
|
11
|
-
"fixtures.json": "
|
|
12
|
-
"acceptance.mjs": "
|
|
10
|
+
"deployment.ts": "e11e5ae4b8f2f8ca71c4930cf4dab8ae33e3d66c2d86827890f8207a8268147f",
|
|
11
|
+
"fixtures.json": "9b127ee73ec726b63ae772fc0b071a8612e92219f54a84073becd8a2fa078bf3",
|
|
12
|
+
"acceptance.mjs": "f0abb2ff918fe7a448a20b43b96fb299114e7cc8b0d2debbad40ab7ff63a0d07",
|
|
13
13
|
"LICENSE": "6d89bce3e7760469015287d1b6a45d31ef7924475c9b54eabe974bcce373980b"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"contractVersion": 1,
|
|
3
3
|
"owner": "anhedral/platform-contracts/environment",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"sourceRevision": "
|
|
5
|
+
"sourceRevision": "45e3cc484dd22f97344b5954852fa682b593a99a",
|
|
6
6
|
"files": {
|
|
7
7
|
"environment-transport.ts": "833b61ecb43c2cbc86c15ed07092ddb364469681d03a23af94e805463c201940",
|
|
8
|
-
"environment-file.ts": "
|
|
8
|
+
"environment-file.ts": "43766ccf3ce52a4a59638bcf3df3fea0d1b8d505bd5a3d694040fb744701f43d",
|
|
9
9
|
"LICENSE": "6d89bce3e7760469015287d1b6a45d31ef7924475c9b54eabe974bcce373980b"
|
|
10
10
|
}
|
|
11
11
|
}
|
package/dist/cli-commands.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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);
|
package/dist/cli-errors.js
CHANGED
package/dist/cli-output.js
CHANGED
|
@@ -38,7 +38,7 @@ export function formatResult(_command, value) {
|
|
|
38
38
|
if (data.stack === 'anhedral-stack' && !data.generated)
|
|
39
39
|
return `Foundation preview for ${data.root}.\nStack: Anhedral Stack.\nNo files were written or resources provisioned.`;
|
|
40
40
|
if (data.stack === 'anhedral-stack' && data.generated)
|
|
41
|
-
return `Created ${data.root}.\nStack: Anhedral Stack.\n${data.dependenciesInstalled ? 'Run pnpm dev' : 'Run pnpm install, then pnpm dev'} in the project directory.\nAdd services when needed: anhedral add backend, then anhedral add
|
|
41
|
+
return `Created ${data.root}.\nStack: Anhedral Stack.\n${data.dependenciesInstalled ? 'Run pnpm dev' : 'Run pnpm install, then pnpm dev'} in the project directory.\nAdd services when needed: anhedral add backend, then anhedral add storage or anhedral add payment.\nReview README.md for configuration and deployment.`;
|
|
42
42
|
return (`${data.generated ? 'Created' : 'Foundation preview for'} ${data.root}.\nComponents: ${data.products.join(', ')}.\n` +
|
|
43
43
|
(data.generated
|
|
44
44
|
? 'Review README.md, then run pnpm dev in the project directory. You own development, integrations and hosting.'
|
package/dist/command-schema.d.ts
CHANGED
package/dist/command-schema.js
CHANGED
|
@@ -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: [
|
|
@@ -458,7 +472,11 @@ export const COMMANDS = {
|
|
|
458
472
|
},
|
|
459
473
|
],
|
|
460
474
|
positional: { name: 'capabilities', min: 1, max: 50, kind: 'capability' },
|
|
461
|
-
examples: [
|
|
475
|
+
examples: [
|
|
476
|
+
'add backend',
|
|
477
|
+
'add storage',
|
|
478
|
+
'add storage payment --with-dependencies --dry-run --json',
|
|
479
|
+
],
|
|
462
480
|
note: 'Adds source and local configuration only. Existing edits are preserved. No provisioning, credential installation, migration or deployment.',
|
|
463
481
|
},
|
|
464
482
|
stack: {
|
package/dist/completion.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { COMMANDS, GLOBAL_OPTIONS, commandOptions, commandTopic, } from './command-schema.js';
|
|
2
|
-
import { PUBLIC_STACK_ADDITIONS } from './
|
|
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("'", "'\"'\"'") + "'";
|
|
@@ -44,13 +44,13 @@ export declare const ANHEDRAL_STACK: {
|
|
|
44
44
|
readonly requires: string[];
|
|
45
45
|
readonly targets: readonly ["apps/api/package.json", "apps/api/wrangler.jsonc", "apps/api/src/index.ts", "apps/api/src/environment.ts", "apps/api/src/capabilities.ts", "apps/api/src/custom-environment.ts", "packages/db/package.json", "packages/db/src/index.ts", "packages/db/src/schema.ts", "apps/api/src/auth.ts", "apps/api/src/auth-features.ts", "apps/api/src/security.ts", "apps/api/src/auth-platform.ts", "apps/api/src/features/auth.ts", "apps/web/src/lib/auth-client.ts"];
|
|
46
46
|
};
|
|
47
|
-
readonly
|
|
47
|
+
readonly storage: {
|
|
48
48
|
readonly name: "Private storage";
|
|
49
49
|
readonly description: "Authenticated, owner-scoped object storage.";
|
|
50
50
|
readonly requires: readonly ["backend"];
|
|
51
51
|
readonly targets: readonly ["apps/api/src/features/storage.ts"];
|
|
52
52
|
};
|
|
53
|
-
readonly
|
|
53
|
+
readonly payment: {
|
|
54
54
|
readonly name: "Payments and subscriptions";
|
|
55
55
|
readonly description: "Stripe subscription and entitlement source.";
|
|
56
56
|
readonly requires: readonly ["backend"];
|
|
@@ -102,13 +102,13 @@ export const ANHEDRAL_STACK = {
|
|
|
102
102
|
requires: [],
|
|
103
103
|
targets: [...CAPABILITIES.hono.targets, ...CAPABILITIES['database-auth'].targets],
|
|
104
104
|
},
|
|
105
|
-
|
|
105
|
+
storage: {
|
|
106
106
|
name: 'Private storage',
|
|
107
107
|
description: 'Authenticated, owner-scoped object storage.',
|
|
108
108
|
requires: ['backend'],
|
|
109
109
|
targets: [...CAPABILITIES.r2.targets],
|
|
110
110
|
},
|
|
111
|
-
|
|
111
|
+
payment: {
|
|
112
112
|
name: 'Payments and subscriptions',
|
|
113
113
|
description: 'Stripe subscription and entitlement source.',
|
|
114
114
|
requires: ['backend'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type OutputOptions } from '
|
|
2
|
-
import { CapabilityEditor } from './
|
|
3
|
-
import type { CommandRunner } from '
|
|
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 '
|
|
4
|
-
import { createReporter } from '
|
|
5
|
-
import { ANHEDRAL_STACK, PUBLIC_STACK_ADDITIONS, CAPABILITIES, CAPABILITY_IDS, capabilityOrder, } from './
|
|
6
|
-
import { CapabilityEditor } from './
|
|
7
|
-
import { addCapabilityRecipe, composeCapabilities } from './
|
|
8
|
-
import { normalizeOjFoundation } from '
|
|
9
|
-
import { GENERATOR_VERSION } from '
|
|
10
|
-
import { PostCommitError, runStagedTransaction, recoverInterruptedTransaction, } from '
|
|
11
|
-
import { put } from '
|
|
12
|
-
import { execFile } from '
|
|
13
|
-
import { capabilityReferences } from './
|
|
14
|
-
import { configureDependencyPatches } from '
|
|
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);
|
|
@@ -47,8 +47,8 @@ export function readState(e) {
|
|
|
47
47
|
}
|
|
48
48
|
const publicGroups = {
|
|
49
49
|
backend: ['hono', 'database-auth'],
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
storage: ['r2'],
|
|
51
|
+
payment: ['stripe'],
|
|
52
52
|
};
|
|
53
53
|
function publicScopeError(command = 'add') {
|
|
54
54
|
return commandArgumentError(command, 'The CLI edits only the Anhedral Stack: TanStack Start with OJ and shadcn.');
|
|
@@ -128,9 +128,18 @@ function publicStackState(root, state) {
|
|
|
128
128
|
export async function runCapabilityCommand(command, args, output, run = execFile) {
|
|
129
129
|
const parsed = commandArguments(command, args);
|
|
130
130
|
if (command === 'add') {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
const replacements = new Map([
|
|
132
|
+
['r2', 'storage'],
|
|
133
|
+
['stripe', 'payment'],
|
|
134
|
+
['payments', 'payment'],
|
|
135
|
+
]);
|
|
136
|
+
for (const id of parsed.positional) {
|
|
137
|
+
const replacement = replacements.get(id);
|
|
138
|
+
if (replacement)
|
|
139
|
+
throw commandArgumentError('add', `Use anhedral add ${replacement} instead of anhedral add ${id}.`);
|
|
140
|
+
if (!PUBLIC_STACK_ADDITIONS.includes(id))
|
|
141
|
+
throw commandArgumentError('add', `Choose an Anhedral Stack addition: ${PUBLIC_STACK_ADDITIONS.join(', ')}.`);
|
|
142
|
+
}
|
|
134
143
|
}
|
|
135
144
|
let result;
|
|
136
145
|
if (command === 'stack') {
|
|
@@ -174,10 +183,10 @@ export async function runCapabilityCommand(command, args, output, run = execFile
|
|
|
174
183
|
if (!parsed.has('--with-dependencies') &&
|
|
175
184
|
!parsed.positional.includes('backend') &&
|
|
176
185
|
!(state.installed.includes('hono') && state.installed.includes('database-auth')) &&
|
|
177
|
-
parsed.positional.some((id) => id === '
|
|
186
|
+
parsed.positional.some((id) => id === 'storage' || id === 'payment'))
|
|
178
187
|
throw commandArgumentError('add', 'Private storage and payments require backend. Run anhedral add backend first, or explicitly use --with-dependencies.');
|
|
179
188
|
const requested = [
|
|
180
|
-
...new Set(parsed.positional.flatMap((id) =>
|
|
189
|
+
...new Set(parsed.positional.flatMap((id) => publicGroups[id])),
|
|
181
190
|
];
|
|
182
191
|
const additions = capabilityOrder(requested, state.installed, parsed.has('--with-dependencies'));
|
|
183
192
|
const installed = [...state.installed, ...additions];
|
|
@@ -208,9 +217,7 @@ export async function runCapabilityCommand(command, args, output, run = execFile
|
|
|
208
217
|
const plan = {
|
|
209
218
|
root,
|
|
210
219
|
added: PUBLIC_STACK_ADDITIONS.filter((id) => publicGroups[id].some((capability) => additions.includes(capability))),
|
|
211
|
-
alreadyInstalled: parsed.positional.filter((id) => id
|
|
212
|
-
? state.installed.includes('hono') && state.installed.includes('database-auth')
|
|
213
|
-
: state.installed.includes(id)),
|
|
220
|
+
alreadyInstalled: parsed.positional.filter((id) => publicGroups[id].every((capability) => state.installed.includes(capability))),
|
|
214
221
|
installed: PUBLIC_STACK_ADDITIONS.filter((id) => publicGroups[id].every((capability) => installed.includes(capability))),
|
|
215
222
|
files,
|
|
216
223
|
configuration: PUBLIC_STACK_ADDITIONS.filter((id) => publicGroups[id].some((capability) => additions.includes(capability))).map((id) => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { sourceCompositionSchema } from '
|
|
1
|
+
import { sourceCompositionSchema } from '../contracts/deployment.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { GENERATOR_VERSION } from '
|
|
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 '
|
|
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 './
|
|
2
|
-
import type { Capability } from './
|
|
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 './
|
|
3
|
-
import { CAPABILITY_DEPENDENCIES as P } from '
|
|
4
|
-
import { STACK_DEPENDENCIES as D } from '
|
|
5
|
-
import { resourceName } from '
|
|
6
|
-
import { composeTanstack, addTanstackAuth } from '
|
|
7
|
-
import { WEB_API_PROXY } from '
|
|
8
|
-
const template = (name) => readFileSync(new URL(
|
|
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('
|
|
5
|
-
'docs/anhedral/ui.md': readFileSync(new URL('
|
|
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 '
|
|
2
|
-
import { type OutputOptions } from '
|
|
3
|
-
import { CapabilityEditor } from './
|
|
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 '
|
|
5
|
-
import { ArtifactUnavailableError, resolvePublishedCliArtifact, isPublishedCliArtifact, } from '
|
|
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 '
|
|
8
|
-
import { CliFailure } from '
|
|
9
|
-
import { createReporter } from '
|
|
10
|
-
import { assertPublicWorkspace, projectRoot, readState } from './
|
|
11
|
-
import { CapabilityEditor, fingerprint } from './
|
|
12
|
-
import { normalizeOjFoundation } from '
|
|
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 '
|
|
15
|
-
import { runStagedTransaction } from '
|
|
16
|
-
import { put } from '
|
|
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. */
|
|
@@ -294,9 +294,9 @@ export declare const cliPreparationSchema: z.ZodObject<{
|
|
|
294
294
|
candidateId: z.ZodUUID;
|
|
295
295
|
sourceRevision: z.ZodString;
|
|
296
296
|
state: z.ZodEnum<{
|
|
297
|
+
building: "building";
|
|
297
298
|
ready: "ready";
|
|
298
299
|
failed: "failed";
|
|
299
|
-
building: "building";
|
|
300
300
|
"awaiting-runtime": "awaiting-runtime";
|
|
301
301
|
built: "built";
|
|
302
302
|
}>;
|