anhedral 0.22.1 → 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 -53
- package/assets/contracts/environment-provenance.json +2 -2
- package/dist/cli-output.js +1 -1
- package/dist/command-schema.js +5 -1
- package/dist/composition/catalog.d.ts +2 -2
- package/dist/composition/catalog.js +2 -2
- package/dist/composition/command.js +17 -10
- package/dist/contracts/environment-file.d.ts +3 -0
- package/dist/contracts/environment-file.js +8 -5
- package/dist/dependencies.d.ts +1 -1
- package/dist/dependencies.js +1 -1
- package/dist/launch.js +3 -3
- package/dist/platform/environment.js +6 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/capabilities.md +8 -6
- package/docs/software-factory.md +4 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,74 +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
|
-
|
|
13
|
+
**Upcoming** — `pnpm dlx anhedral@latest add cross-platform` will add an Expo client with Anhedral UI.
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
anhedral init my-app
|
|
14
|
-
cd my-app
|
|
15
|
-
pnpm dev
|
|
16
|
-
```
|
|
15
|
+
## How to use
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Add services
|
|
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.
|
|
21
18
|
|
|
22
19
|
```sh
|
|
23
|
-
|
|
24
|
-
anhedral
|
|
25
|
-
|
|
26
|
-
anhedral add stripe
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
`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`.
|
|
30
|
-
|
|
31
|
-
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.
|
|
32
|
-
|
|
33
|
-
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.
|
|
34
|
-
|
|
35
|
-
## Update an existing project
|
|
36
|
-
|
|
37
|
-
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
|
|
38
23
|
|
|
39
|
-
|
|
24
|
+
# Add an API, authentication, and a database
|
|
25
|
+
pnpm dlx anhedral@latest add backend
|
|
40
26
|
|
|
41
|
-
|
|
27
|
+
# Add private file storage
|
|
28
|
+
pnpm dlx anhedral@latest add storage
|
|
42
29
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
pnpm dlx shadcn@4.22.1 add card
|
|
30
|
+
# Add subscription payments
|
|
31
|
+
pnpm dlx anhedral@latest add payment
|
|
46
32
|
```
|
|
47
33
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## Connect to Anhedral
|
|
51
|
-
|
|
52
|
-
Local generation requires no account. After browser-approved `login`, use `projects list --human` to discover projects and team IDs. Register your generated application with `projects create --name <name> --link --human`, or connect an existing project with `link --project <uuid> --team <uuid>`. `source upload --dry-run` inspects packaging without uploading; `source upload` sends a resumable immutable checkpoint.
|
|
53
|
-
|
|
54
|
-
`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)
|
|
55
35
|
|
|
56
|
-
|
|
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.
|
|
57
37
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
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.
|
|
61
|
-
|
|
62
|
-
```sh
|
|
63
|
-
anhedral completion bash > ~/.anhedral-completion.bash
|
|
64
|
-
# Or print zsh completion without changing your shell profile:
|
|
65
|
-
anhedral completion zsh
|
|
66
|
-
```
|
|
38
|
+
### Command reference
|
|
67
39
|
|
|
68
|
-
|
|
40
|
+
Use `pnpm dlx anhedral@latest <command>`. For arguments and flags, run `pnpm dlx anhedral@latest help <command>`.
|
|
69
41
|
|
|
70
|
-
|
|
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` |
|
|
71
55
|
|
|
72
|
-
|
|
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)
|
|
73
57
|
|
|
74
|
-
Apache-2.0.
|
|
58
|
+
Apache-2.0. Retain the included third-party notices when distributing generated source.
|
|
@@ -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-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.js
CHANGED
|
@@ -472,7 +472,11 @@ export const COMMANDS = {
|
|
|
472
472
|
},
|
|
473
473
|
],
|
|
474
474
|
positional: { name: 'capabilities', min: 1, max: 50, kind: 'capability' },
|
|
475
|
-
examples: [
|
|
475
|
+
examples: [
|
|
476
|
+
'add backend',
|
|
477
|
+
'add storage',
|
|
478
|
+
'add storage payment --with-dependencies --dry-run --json',
|
|
479
|
+
],
|
|
476
480
|
note: 'Adds source and local configuration only. Existing edits are preserved. No provisioning, credential installation, migration or deployment.',
|
|
477
481
|
},
|
|
478
482
|
stack: {
|
|
@@ -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'],
|
|
@@ -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,3 +1,6 @@
|
|
|
1
|
+
export declare const ENVIRONMENT_FILE_MAX_BYTES = 65536;
|
|
2
|
+
export declare class EnvironmentFileError extends Error {
|
|
3
|
+
}
|
|
1
4
|
/** Literal dotenv parsing only. Never evaluate a shell, interpolate variables,
|
|
2
5
|
* or include input values in errors. The same parser serves browser and CLI. */
|
|
3
6
|
export declare function parseEnvironmentFile(input: string): {
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
import { environmentNameSchema } from "./environment-transport.js";
|
|
3
|
+
export const ENVIRONMENT_FILE_MAX_BYTES = 65536;
|
|
4
|
+
export class EnvironmentFileError extends Error {
|
|
5
|
+
}
|
|
3
6
|
/** Literal dotenv parsing only. Never evaluate a shell, interpolate variables,
|
|
4
7
|
* or include input values in errors. The same parser serves browser and CLI. */
|
|
5
8
|
export function parseEnvironmentFile(input) {
|
|
6
9
|
if (input.includes("\0"))
|
|
7
|
-
throw new
|
|
8
|
-
if (new TextEncoder().encode(input).length >
|
|
9
|
-
throw new
|
|
10
|
+
throw new EnvironmentFileError("Environment files cannot contain NUL bytes.");
|
|
11
|
+
if (new TextEncoder().encode(input).length > ENVIRONMENT_FILE_MAX_BYTES)
|
|
12
|
+
throw new EnvironmentFileError("Environment files support at most 64 KiB.");
|
|
10
13
|
const text = input.replace(/^\uFEFF/, "").replaceAll("\r\n", "\n");
|
|
11
14
|
const entries = [];
|
|
12
15
|
const names = new Set();
|
|
13
16
|
let position = 0, line = 1;
|
|
14
17
|
const fail = (message) => {
|
|
15
|
-
throw new
|
|
18
|
+
throw new EnvironmentFileError(`Line ${line}: ${message}`);
|
|
16
19
|
};
|
|
17
20
|
const space = () => {
|
|
18
21
|
while (text[position] === " " || text[position] === "\t" || text[position] === "\r")
|
|
@@ -104,7 +107,7 @@ export function parseEnvironmentFile(input) {
|
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
if (!entries.length)
|
|
107
|
-
throw new
|
|
110
|
+
throw new EnvironmentFileError("The environment file contains no variables.");
|
|
108
111
|
return entries;
|
|
109
112
|
}
|
|
110
113
|
export function inferredEnvironmentKind(name) {
|
package/dist/dependencies.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare const STACK_DEPENDENCIES: {
|
|
|
26
26
|
readonly '@types/node': "22.20.5";
|
|
27
27
|
readonly eslint: "9.39.5";
|
|
28
28
|
readonly 'drizzle-kit': "0.31.11";
|
|
29
|
-
readonly hono: "4.13.
|
|
29
|
+
readonly hono: "4.13.18";
|
|
30
30
|
readonly '@hono/zod-openapi': "1.6.3";
|
|
31
31
|
readonly fallow: "3.34.0";
|
|
32
32
|
readonly undici: "7.30.1";
|
package/dist/dependencies.js
CHANGED
|
@@ -75,7 +75,7 @@ export const STACK_DEPENDENCIES = {
|
|
|
75
75
|
// renovate: datasource=npm depName=drizzle-kit
|
|
76
76
|
'drizzle-kit': '0.31.11',
|
|
77
77
|
// renovate: datasource=npm depName=hono
|
|
78
|
-
hono: '4.13.
|
|
78
|
+
hono: '4.13.18',
|
|
79
79
|
// renovate: datasource=npm depName=@hono/zod-openapi
|
|
80
80
|
'@hono/zod-openapi': '1.6.3',
|
|
81
81
|
// renovate: datasource=npm depName=fallow
|
package/dist/launch.js
CHANGED
|
@@ -117,9 +117,9 @@ Keep LICENSE.shadcn with the copied starter components.
|
|
|
117
117
|
## Add services progressively
|
|
118
118
|
|
|
119
119
|
Run anhedral add backend to add Hono, Drizzle/D1 and Better Auth together.
|
|
120
|
-
Then run anhedral add
|
|
120
|
+
Then run anhedral add storage for private storage, or anhedral add payment for payments.
|
|
121
121
|
Missing prerequisites stop before writes; --with-dependencies opts into them.
|
|
122
|
-
The public additions are backend,
|
|
122
|
+
The public additions are backend, storage and payment; this application is web-only.
|
|
123
123
|
|
|
124
124
|
After adding backend, copy apps/api/.dev.vars.example to apps/api/.dev.vars.
|
|
125
125
|
Set PUBLIC_APP_URL=http://localhost:3000 and generate BETTER_AUTH_SECRET with
|
|
@@ -150,7 +150,7 @@ requires its separately reviewed Anhedral Stack runtime/artifact; generation is
|
|
|
150
150
|
put(root, 'AGENTS.md', `# Anhedral Stack application
|
|
151
151
|
|
|
152
152
|
Use the single Anhedral Stack, starting with TanStack Start and source-owned shadcn UI. Add backend for Hono,
|
|
153
|
-
Drizzle/D1 and Better Auth together.
|
|
153
|
+
Drizzle/D1 and Better Auth together. Use the storage and payment additions only when required. Mobile,
|
|
154
154
|
extensions and desktop are outside launch scope.
|
|
155
155
|
|
|
156
156
|
Edit web product routes in apps/web/src/routes, API routes in apps/api/src/index.ts,
|
|
@@ -4,7 +4,7 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { commandArgumentError, commandArguments } from '../cli-arguments.js';
|
|
6
6
|
import { createReporter } from '../cli-output.js';
|
|
7
|
-
import { inferredEnvironmentKind, parseEnvironmentFile } from '../contracts/environment-file.js';
|
|
7
|
+
import { ENVIRONMENT_FILE_MAX_BYTES, inferredEnvironmentKind, parseEnvironmentFile, } from '../contracts/environment-file.js';
|
|
8
8
|
import { environmentImportReceiptSchema, environmentImportSchema, environmentMetadataSchema, environmentNameSchema, projectEnvironmentSchema, } from '../contracts/environment-transport.js';
|
|
9
9
|
import { platformFailure, readPrivate, writePrivate } from './state.js';
|
|
10
10
|
const planSchema = z
|
|
@@ -41,11 +41,11 @@ export function readEnvironmentSecret(file) {
|
|
|
41
41
|
try {
|
|
42
42
|
const info = fstatSync(descriptor);
|
|
43
43
|
if (!info.isFile() ||
|
|
44
|
-
info.size >
|
|
44
|
+
info.size > ENVIRONMENT_FILE_MAX_BYTES ||
|
|
45
45
|
(process.platform !== 'win32' &&
|
|
46
46
|
(info.uid !== process.getuid?.() || (info.mode & 0o077) !== 0)))
|
|
47
47
|
throw platformFailure('Environment input must be your regular owner-only file (mode 0600), at most 64 KiB.');
|
|
48
|
-
const data = Buffer.alloc(
|
|
48
|
+
const data = Buffer.alloc(ENVIRONMENT_FILE_MAX_BYTES + 1);
|
|
49
49
|
let length = 0;
|
|
50
50
|
while (length < data.length) {
|
|
51
51
|
const read = readSync(descriptor, data, length, data.length - length, null);
|
|
@@ -53,7 +53,7 @@ export function readEnvironmentSecret(file) {
|
|
|
53
53
|
break;
|
|
54
54
|
length += read;
|
|
55
55
|
}
|
|
56
|
-
if (length >
|
|
56
|
+
if (length > ENVIRONMENT_FILE_MAX_BYTES)
|
|
57
57
|
throw platformFailure('Environment input exceeds 64 KiB.');
|
|
58
58
|
return data.subarray(0, length);
|
|
59
59
|
}
|
|
@@ -71,7 +71,7 @@ async function stdinBytes() {
|
|
|
71
71
|
for await (const item of process.stdin) {
|
|
72
72
|
const bytes = Buffer.from(item);
|
|
73
73
|
length += bytes.length;
|
|
74
|
-
if (length >
|
|
74
|
+
if (length > ENVIRONMENT_FILE_MAX_BYTES)
|
|
75
75
|
throw platformFailure('Environment input exceeds 64 KiB.');
|
|
76
76
|
chunks.push(bytes);
|
|
77
77
|
}
|
|
@@ -129,7 +129,7 @@ export async function runEnvironmentCommand(args, output, context, request, read
|
|
|
129
129
|
const bytes = options.has('--file')
|
|
130
130
|
? readEnvironmentSecret(options.value('--file'))
|
|
131
131
|
: await readInput();
|
|
132
|
-
if (bytes.length >
|
|
132
|
+
if (bytes.length > ENVIRONMENT_FILE_MAX_BYTES)
|
|
133
133
|
throw new Error('Environment input exceeds 64 KiB.');
|
|
134
134
|
const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
135
135
|
entries = operation === 'set' ? [{ name: name, value: text }] : parseEnvironmentFile(text);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GENERATOR_VERSION = "0.
|
|
1
|
+
export declare const GENERATOR_VERSION = "0.23.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const GENERATOR_VERSION = '0.
|
|
1
|
+
export const GENERATOR_VERSION = '0.23.0';
|
package/docs/capabilities.md
CHANGED
|
@@ -7,15 +7,17 @@ anhedral init my-app
|
|
|
7
7
|
cd my-app
|
|
8
8
|
anhedral add backend --dry-run --json
|
|
9
9
|
anhedral add backend
|
|
10
|
-
anhedral add
|
|
10
|
+
anhedral add storage payment
|
|
11
11
|
anhedral stack status --json
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
| Selection | Source added
|
|
15
|
-
| --------- |
|
|
16
|
-
| `backend` | Hono API, Drizzle/D1, Better Auth and web sign-in starter
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
14
|
+
| Selection | Source added | Requires |
|
|
15
|
+
| --------- | ----------------------------------------------------------------- | ----------------------------- |
|
|
16
|
+
| `backend` | Hono API, Drizzle/D1, Better Auth and web sign-in starter | Anhedral Stack web foundation |
|
|
17
|
+
| `storage` | Cloudflare R2 binding and authenticated owner-scoped file routes | `backend` |
|
|
18
|
+
| `payment` | Stripe Checkout, signed webhooks and canonical entitlement checks | `backend` |
|
|
19
|
+
|
|
20
|
+
Use `add storage` in place of `add r2`, and `add payment` in place of `add stripe` or `add payments`. Existing projects retain the provider identifiers `r2` and `stripe` in their source manifests. The CLI recognizes these as installed storage and payment additions.
|
|
19
21
|
|
|
20
22
|
`backend` is one public selection; its provenance records the concrete Hono and database/auth capabilities. Use `--with-dependencies` to include missing prerequisites in the same planned source transaction. `stack list` describes this stack's additions. `status`/`doctor` check source completeness, not live service activation.
|
|
21
23
|
|
package/docs/software-factory.md
CHANGED
|
@@ -220,6 +220,10 @@ routing require `deploy plan --manifest <file> --new`. Plan/source expiry and
|
|
|
220
220
|
revocation fail closed. State under `.anhedral/platform/deployment.json` contains
|
|
221
221
|
no credentials and cannot select a network origin or change the signed-in identity.
|
|
222
222
|
|
|
223
|
+
The CLI imports the reviewed portable environment parser from Platform. File, stdin
|
|
224
|
+
and parser size limits share its exported constant; typed parser errors retain the
|
|
225
|
+
same value-free validation messages.
|
|
226
|
+
|
|
223
227
|
`env list` returns names, types, environments and versions. `env import --environment
|
|
224
228
|
staging|production --file <path>` reads a private dotenv file; `--stdin` accepts a
|
|
225
229
|
pipe. `env set <NAME>` reads one literal value from a file or pipe. Values are
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anhedral",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "The open-source Anhedral API client for building, configuring and deploying apps, with editable source generation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -109,14 +109,14 @@
|
|
|
109
109
|
"packageManager": "pnpm@10.34.5",
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@types/node": "20.19.43",
|
|
112
|
-
"hono": "4.13.
|
|
113
|
-
"prettier": "3.
|
|
114
|
-
"typescript": "
|
|
112
|
+
"hono": "4.13.18",
|
|
113
|
+
"prettier": "3.10.1",
|
|
114
|
+
"typescript": "6.0.3"
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
117
|
"jsonc-parser": "3.3.1",
|
|
118
118
|
"yaml": "2.9.1",
|
|
119
|
-
"zod": "4.6.
|
|
119
|
+
"zod": "4.6.7",
|
|
120
120
|
"ignore": "7.0.14"
|
|
121
121
|
}
|
|
122
122
|
}
|