anhedral 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/assets/contracts/deployment-provenance.json +5 -5
- package/assets/launch/router.tsx.txt +1 -0
- package/dist/cli-commands.js +5 -17
- package/dist/cli-errors.js +1 -1
- package/dist/command-schema.d.ts +1 -0
- package/dist/command-schema.js +14 -0
- package/dist/completion.js +1 -1
- package/dist/{capability-command.d.ts → composition/command.d.ts} +3 -3
- package/dist/{capability-command.js → composition/command.js} +12 -12
- 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 -8
- package/dist/contracts/cli-transport.js +0 -11
- package/dist/contracts/deployment.d.ts +4 -65
- package/dist/contracts/deployment.js +9 -60
- package/dist/contracts/production-transport.d.ts +2 -2
- package/dist/contracts/staging-transport.d.ts +2 -2
- package/dist/launch.js +5 -5
- 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} +7 -7
- 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/software-factory.md +45 -8
- package/package.json +19 -19
- package/dist/platform-command.js +0 -787
- package/dist/transaction.js +0 -716
- /package/dist/{capability-catalog.d.ts → composition/catalog.d.ts} +0 -0
- /package/dist/{capability-catalog.js → composition/catalog.js} +0 -0
- /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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { cpSync, lstatSync, mkdirSync, rmSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fingerprintEntry, pathEntryExists, renameDurably, syncEntryRecursively, } from './durable-files.js';
|
|
5
|
+
import { removeJournal, writeJournal } from './journal.js';
|
|
6
|
+
import { acquireTransactionLock, releaseTransactionLock } from './lock.js';
|
|
7
|
+
import { JOURNAL_FILE, JOURNAL_VERSION, TRANSACTION_DIRECTORY, } from './model.js';
|
|
8
|
+
import { assertNoSymlinkComponents, assertNoSymlinksRecursively, assertRelativePath, assertTransactionNamespace, normalizeTransactionPaths, resolveTransactionPath, } from './paths.js';
|
|
9
|
+
import { cleanupOrphanTransactionRoots, recoverInterruptedTransactionUnlocked, removeEmptyTransactionDirectory, restoreJournal, } from './recovery.js';
|
|
10
|
+
export { recoverInterruptedTransaction } from './recovery.js';
|
|
11
|
+
/** The filesystem commit succeeded, but a follow-up action such as install failed. */
|
|
12
|
+
export class PostCommitError extends Error {
|
|
13
|
+
committedPaths;
|
|
14
|
+
constructor(committedPaths, cause) {
|
|
15
|
+
const causeMessage = cause instanceof Error ? cause.message : String(cause);
|
|
16
|
+
super(`Changes were committed successfully, but the post-commit action failed: ${causeMessage}. ` +
|
|
17
|
+
'The generated files were kept; resolve the failure and rerun the post-commit command.', { cause });
|
|
18
|
+
this.name = 'PostCommitError';
|
|
19
|
+
this.committedPaths = Object.freeze([...committedPaths]);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function seedTransaction(root, stageRoot, seedPaths) {
|
|
23
|
+
for (const relativePath of seedPaths) {
|
|
24
|
+
assertRelativePath(relativePath);
|
|
25
|
+
assertNoSymlinkComponents(root, relativePath);
|
|
26
|
+
const source = resolveTransactionPath(root, relativePath);
|
|
27
|
+
if (!pathEntryExists(source))
|
|
28
|
+
continue;
|
|
29
|
+
assertNoSymlinksRecursively(source);
|
|
30
|
+
const target = resolveTransactionPath(stageRoot, relativePath);
|
|
31
|
+
mkdirSync(path.dirname(target), { recursive: true });
|
|
32
|
+
cpSync(source, target, { recursive: true, preserveTimestamps: true });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function ensureTransactionParents(root, entry, journal, createdDirectorySet) {
|
|
36
|
+
const segments = entry.relativePath.split('/').slice(0, -1);
|
|
37
|
+
let cursor = root;
|
|
38
|
+
let relativeDirectory = '';
|
|
39
|
+
const missingDirectories = [];
|
|
40
|
+
for (const segment of segments) {
|
|
41
|
+
cursor = path.join(cursor, segment);
|
|
42
|
+
relativeDirectory = relativeDirectory ? `${relativeDirectory}/${segment}` : segment;
|
|
43
|
+
if (!pathEntryExists(cursor))
|
|
44
|
+
missingDirectories.push(relativeDirectory);
|
|
45
|
+
else if (!lstatSync(cursor).isDirectory()) {
|
|
46
|
+
throw new Error(`Transaction parent is not a directory: ${relativeDirectory}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const newDirectories = missingDirectories.filter((directory) => !createdDirectorySet.has(directory));
|
|
50
|
+
if (newDirectories.length > 0) {
|
|
51
|
+
journal.createdDirectories.push(...newDirectories);
|
|
52
|
+
for (const directory of newDirectories)
|
|
53
|
+
createdDirectorySet.add(directory);
|
|
54
|
+
writeJournal(root, journal);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function commitJournal(root, journal, deletePaths) {
|
|
58
|
+
const { stageRoot, backupRoot } = journal;
|
|
59
|
+
const createdDirectorySet = new Set(journal.createdDirectories);
|
|
60
|
+
for (const entry of journal.entries) {
|
|
61
|
+
const source = resolveTransactionPath(stageRoot, entry.relativePath);
|
|
62
|
+
const deleting = deletePaths.has(entry.relativePath);
|
|
63
|
+
if (!deleting && !pathEntryExists(source)) {
|
|
64
|
+
throw new Error(`Staged output is missing declared path: ${entry.relativePath}`);
|
|
65
|
+
}
|
|
66
|
+
if (deleting && pathEntryExists(source))
|
|
67
|
+
throw new Error(`Deleted transaction path still exists in staging: ${entry.relativePath}`);
|
|
68
|
+
assertNoSymlinkComponents(root, entry.relativePath);
|
|
69
|
+
if (!deleting) {
|
|
70
|
+
assertNoSymlinksRecursively(source);
|
|
71
|
+
syncEntryRecursively(source);
|
|
72
|
+
}
|
|
73
|
+
const target = resolveTransactionPath(root, entry.relativePath);
|
|
74
|
+
if (pathEntryExists(target)) {
|
|
75
|
+
const backup = resolveTransactionPath(backupRoot, entry.relativePath);
|
|
76
|
+
mkdirSync(path.dirname(backup), { recursive: true });
|
|
77
|
+
entry.backupPath = backup;
|
|
78
|
+
entry.backupFingerprint = fingerprintEntry(target);
|
|
79
|
+
writeJournal(root, journal);
|
|
80
|
+
renameDurably(target, backup, root);
|
|
81
|
+
}
|
|
82
|
+
if (!deleting) {
|
|
83
|
+
ensureTransactionParents(root, entry, journal, createdDirectorySet);
|
|
84
|
+
mkdirSync(path.dirname(target), { recursive: true });
|
|
85
|
+
entry.installedFingerprint = fingerprintEntry(source);
|
|
86
|
+
entry.installed = true;
|
|
87
|
+
writeJournal(root, journal);
|
|
88
|
+
renameDurably(source, target, root);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Build changes away from the destination and install only the declared paths.
|
|
94
|
+
* Every replaced path is journaled first, so errors and later invocations can
|
|
95
|
+
* restore the original workspace.
|
|
96
|
+
*/
|
|
97
|
+
export async function runStagedTransaction(root, options) {
|
|
98
|
+
const lock = acquireTransactionLock(root);
|
|
99
|
+
const token = `${process.pid}-${randomUUID()}`;
|
|
100
|
+
const transactionDirectory = path.join(path.resolve(root), TRANSACTION_DIRECTORY);
|
|
101
|
+
const stageRoot = path.join(transactionDirectory, `stage-${token}`);
|
|
102
|
+
const backupRoot = path.join(transactionDirectory, `backup-${token}`);
|
|
103
|
+
let namespaceValidated = false;
|
|
104
|
+
try {
|
|
105
|
+
if (options.dryRun && pathEntryExists(path.join(root, JOURNAL_FILE))) {
|
|
106
|
+
throw new Error('Dry-run cannot recover an interrupted transaction. Re-run the original command without --dry-run first.');
|
|
107
|
+
}
|
|
108
|
+
if (options.recover === false && pathEntryExists(path.join(root, JOURNAL_FILE)))
|
|
109
|
+
throw new Error('An interrupted transaction requires recovery before this operation.');
|
|
110
|
+
recoverInterruptedTransactionUnlocked(root);
|
|
111
|
+
if (!options.dryRun)
|
|
112
|
+
cleanupOrphanTransactionRoots(root);
|
|
113
|
+
if ((await options.prepare?.()) === false)
|
|
114
|
+
return Object.freeze([]);
|
|
115
|
+
assertTransactionNamespace(transactionDirectory);
|
|
116
|
+
namespaceValidated = true;
|
|
117
|
+
mkdirSync(stageRoot, { recursive: true, mode: 0o700 });
|
|
118
|
+
mkdirSync(backupRoot, { recursive: true, mode: 0o700 });
|
|
119
|
+
seedTransaction(root, stageRoot, options.seedPaths ?? []);
|
|
120
|
+
await options.build(stageRoot);
|
|
121
|
+
const normalizedPaths = normalizeTransactionPaths(options.commitPaths, options.deletePaths ?? []);
|
|
122
|
+
const deletePaths = new Set(normalizedPaths.deletePaths);
|
|
123
|
+
const uniquePaths = normalizedPaths.uniquePaths;
|
|
124
|
+
options.onPlan?.(Object.freeze([...uniquePaths]));
|
|
125
|
+
if (options.dryRun)
|
|
126
|
+
return Object.freeze(uniquePaths);
|
|
127
|
+
const journal = {
|
|
128
|
+
version: JOURNAL_VERSION,
|
|
129
|
+
backupRoot,
|
|
130
|
+
stageRoot,
|
|
131
|
+
createdDirectories: [],
|
|
132
|
+
entries: uniquePaths.map((relativePath) => {
|
|
133
|
+
assertRelativePath(relativePath);
|
|
134
|
+
return { relativePath, backupPath: null, installed: false, installedFingerprint: null };
|
|
135
|
+
}),
|
|
136
|
+
};
|
|
137
|
+
writeJournal(root, journal);
|
|
138
|
+
try {
|
|
139
|
+
commitJournal(root, journal, deletePaths);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
restoreJournal(root, journal);
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
removeJournal(root);
|
|
146
|
+
rmSync(stageRoot, { recursive: true, force: true });
|
|
147
|
+
rmSync(backupRoot, { recursive: true, force: true });
|
|
148
|
+
removeEmptyTransactionDirectory(root);
|
|
149
|
+
try {
|
|
150
|
+
await options.afterCommit?.();
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
throw new PostCommitError(uniquePaths, error);
|
|
154
|
+
}
|
|
155
|
+
return Object.freeze(uniquePaths);
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
try {
|
|
159
|
+
if (namespaceValidated && !pathEntryExists(path.join(root, JOURNAL_FILE))) {
|
|
160
|
+
rmSync(stageRoot, { recursive: true, force: true });
|
|
161
|
+
rmSync(backupRoot, { recursive: true, force: true });
|
|
162
|
+
removeEmptyTransactionDirectory(root);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
releaseTransactionLock(lock);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Serialize short source updates with generation/add transactions as well as other writers. */
|
|
171
|
+
export function withSourceWriteLock(root, write) {
|
|
172
|
+
const lock = acquireTransactionLock(root);
|
|
173
|
+
try {
|
|
174
|
+
return write();
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
releaseTransactionLock(lock);
|
|
178
|
+
}
|
|
179
|
+
}
|
package/dist/util.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readBoundedFile } from './bounded-file.js';
|
|
|
3
3
|
import { mkdtempSync, rmSync } from 'node:fs';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { resolveCommand } from './command.js';
|
|
6
|
+
import { resolveCommand } from './process/resolve-command.js';
|
|
7
7
|
import { spawnSync } from 'node:child_process';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
const FAILURE_TAIL_BYTES = 128 * 1024;
|
|
@@ -67,7 +67,7 @@ export function execFile(executable, args, cwd) {
|
|
|
67
67
|
if (Buffer.byteLength(bytes) > 1024 * 1024)
|
|
68
68
|
throw Error('Command configuration exceeds its bound.');
|
|
69
69
|
writeFileSync(configuration, bytes, { flag: 'wx', mode: 0o600 });
|
|
70
|
-
const wrapper = spawnSync(process.execPath, [fileURLToPath(new URL('./
|
|
70
|
+
const wrapper = spawnSync(process.execPath, [fileURLToPath(new URL('./process/runner.js', import.meta.url)), configuration, resultFile], {
|
|
71
71
|
cwd,
|
|
72
72
|
shell: false,
|
|
73
73
|
stdio: verbose ? 'inherit' : 'ignore',
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GENERATOR_VERSION = "0.
|
|
1
|
+
export declare const GENERATOR_VERSION = "0.22.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const GENERATOR_VERSION = '0.
|
|
1
|
+
export const GENERATOR_VERSION = '0.22.1';
|
package/docs/software-factory.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
# Anhedral
|
|
1
|
+
# Anhedral CLI workflow
|
|
2
2
|
|
|
3
|
-
The Anhedral
|
|
3
|
+
The public CLI connects people and agents to the Anhedral API for project management, source uploads, environment configuration, deployment and runtime logs. Codex and Claude Code skills guide the same CLI commands. Platform owns authentication, authorization and provider operations.
|
|
4
|
+
|
|
5
|
+
The CLI also generates the Anhedral Stack with one web foundation and progressive backend/storage/payment additions. Local source generation works without a Platform account.
|
|
4
6
|
|
|
5
7
|
1. Preview an empty destination with `anhedral init my-app --dry-run --json`, then
|
|
6
8
|
run `anhedral init my-app` and `pnpm dev` inside it.
|
|
@@ -11,6 +13,18 @@ The Anhedral Stack has one current web foundation and progressive backend/storag
|
|
|
11
13
|
behavior before deployment. Source installation is not provider activation.
|
|
12
14
|
4. Choose or extend [web UI](ui.md), implement features and run consumer checks.
|
|
13
15
|
|
|
16
|
+
## Source ownership
|
|
17
|
+
|
|
18
|
+
`src/platform/` owns the thin authenticated API client; `src/composition/` owns
|
|
19
|
+
progressive source additions and updates. Foundation generation lives in
|
|
20
|
+
`src/scaffold/` with the launch entrypoint. `src/transactions/` owns journaled
|
|
21
|
+
source writes and durable filesystem operations; `src/process/` owns child-process
|
|
22
|
+
execution. Portable contracts remain in `src/contracts/`. Internal moves update
|
|
23
|
+
`scripts/checks/public-package-policy.json` and packed-artifact tests together; public
|
|
24
|
+
package exports and CLI commands stay stable. Tooling is grouped under
|
|
25
|
+
`scripts/build`, `checks`, `contracts`, `plugin`, `release`, `runtime` and `security`;
|
|
26
|
+
root script helpers are shared infrastructure for those owners.
|
|
27
|
+
|
|
14
28
|
## Evidence-driven maintenance
|
|
15
29
|
|
|
16
30
|
Inspect current Git state and preserve unrelated work. Verify runtime entrypoints,
|
|
@@ -42,7 +56,7 @@ without recursive submodules; publishing rejects calls from another repository.
|
|
|
42
56
|
These checks do not make a submodule a security sandbox: review tracked files,
|
|
43
57
|
package contents, inherited environment and publication authority independently.
|
|
44
58
|
|
|
45
|
-
The reviewed public module inventory in `scripts/public-package-policy.json` and
|
|
59
|
+
The reviewed public module inventory in `scripts/checks/public-package-policy.json` and
|
|
46
60
|
`pnpm check:boundaries` constrain compilation and package preparation; an unexpected
|
|
47
61
|
dist module or private import requires explicit review. Portable contracts are
|
|
48
62
|
synced only from a reviewed, licensed Platform projection with exact provenance,
|
|
@@ -54,13 +68,18 @@ explicit review failure, not a clean secret scan.
|
|
|
54
68
|
|
|
55
69
|
## Runtime verification
|
|
56
70
|
|
|
71
|
+
For local development, `pnpm test` builds once and runs unit tests; `pnpm lint`
|
|
72
|
+
checks source without emitting a build. `pnpm release:check` builds and type-checks
|
|
73
|
+
once, then runs the full source, security, advisory, unit, patch and package checks.
|
|
74
|
+
Use `pnpm release:pack` when preparing a standalone release artifact; it builds fresh.
|
|
75
|
+
|
|
57
76
|
Routine CI compiles the CLI once and runs fast source/security checks and selected
|
|
58
77
|
contract tests. Generated applications are not installed or built in that path.
|
|
59
78
|
Dispatch [CI](https://github.com/anhedral/anhedral-cli/blob/main/.github/workflows/ci.yml) with `runtime_proof` enabled for the
|
|
60
79
|
Anhedral Stack proof and one-day measurements. Broader compatibility and generated
|
|
61
80
|
application matrices remain in [Full validation](https://github.com/anhedral/anhedral-cli/blob/main/.github/workflows/validation.yml).
|
|
62
81
|
|
|
63
|
-
`node scripts/tanstack-runtime-smoke.mjs` installs a disposable Anhedral Stack
|
|
82
|
+
`node scripts/runtime/tanstack-runtime-smoke.mjs` installs a disposable Anhedral Stack
|
|
64
83
|
application and exercises local workerd, SSR/server functions, progressive backend,
|
|
65
84
|
private storage and the generated Stripe build/migration path. The compiled web
|
|
66
85
|
and API Workers run together with the migrated local D1 state. Bundle measurements
|
|
@@ -69,6 +88,9 @@ isolated local data, never a configured database or live payment provider. Prese
|
|
|
69
88
|
passed and failed evidence. Tests are not provider deployment acceptance. Run
|
|
70
89
|
`node tests/test-generated-config-lint.mjs <installed-workspace>` to exercise the
|
|
71
90
|
generated web ESLint policy; runtime proof checks both web-only and composed source.
|
|
91
|
+
`node tests/test-generated-router.mjs <installed-workspace>` temporarily replaces
|
|
92
|
+
the example route, runs the generated web typecheck and restores the route. The
|
|
93
|
+
router imports its own Start augmentation so ordinary page edits remain type-safe.
|
|
72
94
|
|
|
73
95
|
Backend server entries call TanStack’s `createStartHandler(defaultStreamHandler)` directly so request-local API bindings survive OJ compilation. Source additions repair the exact previous owned adapter and preserve customer edits.
|
|
74
96
|
|
|
@@ -97,6 +119,16 @@ or executable. Offline source inspection cannot attest a newly published artifac
|
|
|
97
119
|
|
|
98
120
|
## Platform CLI access and source upload
|
|
99
121
|
|
|
122
|
+
The supported external API is `/api/cli/v1` at the explicit Platform origin,
|
|
123
|
+
defaulting to `https://platform.anhedral.com`. Requests carry
|
|
124
|
+
`x-anhedral-cli-protocol: 1`; authenticated requests use a browser-approved bearer
|
|
125
|
+
token. `x-anhedral-team` selects a team but never grants membership or project
|
|
126
|
+
access. Versioned wire schemas live in `src/contracts/cli-transport.ts` and the
|
|
127
|
+
adjacent environment, staging, production and runtime-log transport modules.
|
|
128
|
+
Internal browser and service routes are not part of this external contract.
|
|
129
|
+
`https://api.internal` in generated application templates is a synthetic
|
|
130
|
+
service-binding URL for the customer's backend, not an Anhedral service endpoint.
|
|
131
|
+
|
|
100
132
|
`login --start` prints browser approval instructions; `login --resume` redeems the
|
|
101
133
|
saved approval. Interactive `login` polls after showing the URL and confirmation
|
|
102
134
|
code. Tokens and device secrets use macOS Keychain or Linux Secret Service;
|
|
@@ -149,7 +181,7 @@ checks/builds; authored routes, router configuration and server source remain
|
|
|
149
181
|
included. Credential scanning is deliberately conservative; inspect source before uploading.
|
|
150
182
|
|
|
151
183
|
Public upload limits and message shapes live in `src/contracts`; protocol code is
|
|
152
|
-
in `src/platform
|
|
184
|
+
in `src/platform/command.ts`. The server independently authenticates the caller,
|
|
153
185
|
checks current tenant/project authority and revocation, validates source, and
|
|
154
186
|
enforces admission. Client checks and supplied IDs cannot grant access. Upload
|
|
155
187
|
does not deploy, activate providers, migrate a database or replace identities.
|
|
@@ -169,9 +201,14 @@ backend/R2/Stripe. Backend manifests preserve `better-auth-d1-v1`; web-only uses
|
|
|
169
201
|
`none`. Broader retained capability/protocol values are compatibility implementation,
|
|
170
202
|
not current public selections or hosted support.
|
|
171
203
|
Continue selecting an explicit manifest; the CLI never infers an admitted artifact
|
|
172
|
-
from locally generated source.
|
|
173
|
-
|
|
174
|
-
|
|
204
|
+
from locally generated source. Public plans and candidate receipts omit internal
|
|
205
|
+
registry images and build-policy digests. The public deployment module exports
|
|
206
|
+
customer manifests and receipts; internal deployment plan/source schemas belong
|
|
207
|
+
to Platform and are not public CLI exports. Platform retains these admission details
|
|
208
|
+
privately and returns a digest over the public plan fields for client verification.
|
|
209
|
+
Previously saved plans containing internal fields require a fresh plan with `--new`.
|
|
210
|
+
Plans list runtime, source-version or lockfile mismatches and remediation. Do not
|
|
211
|
+
relabel source provenance to clear a mismatch.
|
|
175
212
|
|
|
176
213
|
`deploy prepare` reserves an immutable candidate. `deploy status` reads
|
|
177
214
|
`awaiting-runtime`, `building`, `built`, `ready` or `failed`. A built candidate grants no
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anhedral",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.22.1",
|
|
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": {
|
|
7
7
|
".": {
|
|
@@ -57,16 +57,16 @@
|
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"scaffold": "node dist/bin.js init",
|
|
60
|
-
"clean": "node scripts/clean.mjs",
|
|
61
|
-
"build": "node scripts/standalone-checkout.mjs && pnpm clean && tsc && node scripts/prepare-cli.mjs",
|
|
60
|
+
"clean": "node scripts/build/clean.mjs",
|
|
61
|
+
"build": "node scripts/checks/standalone-checkout.mjs && pnpm clean && tsc && node scripts/build/prepare-cli.mjs",
|
|
62
62
|
"prepare": "pnpm build",
|
|
63
63
|
"typecheck": "tsc --noEmit",
|
|
64
|
-
"check:hygiene": "node scripts/check-source-hygiene.mjs && node scripts/check-environment-contract.mjs && node scripts/check-operations-contract.mjs",
|
|
65
|
-
"check:security": "node scripts/check-security-policy.mjs",
|
|
66
|
-
"check:release-policy": "node scripts/check-release-policy.mjs",
|
|
67
|
-
"check:release-secrets": "node scripts/check-release-secrets.mjs",
|
|
64
|
+
"check:hygiene": "node scripts/checks/check-source-hygiene.mjs && node scripts/contracts/check-environment-contract.mjs && node scripts/contracts/check-operations-contract.mjs",
|
|
65
|
+
"check:security": "node scripts/security/check-security-policy.mjs",
|
|
66
|
+
"check:release-policy": "node scripts/release/check-release-policy.mjs",
|
|
67
|
+
"check:release-secrets": "node scripts/release/check-release-secrets.mjs",
|
|
68
68
|
"lint": "pnpm typecheck && pnpm format:check && pnpm check:hygiene && pnpm check:release-policy && pnpm check:boundaries",
|
|
69
|
-
"audit:osv": "node scripts/audit-osv.mjs",
|
|
69
|
+
"audit:osv": "node scripts/security/audit-osv.mjs",
|
|
70
70
|
"test": "pnpm test:unit",
|
|
71
71
|
"pretest": "pnpm build",
|
|
72
72
|
"prepublishOnly": "pnpm test:all",
|
|
@@ -75,21 +75,21 @@
|
|
|
75
75
|
"test:pack:exact": "node tests/test-packed-cli.js .artifacts/release/metadata.json",
|
|
76
76
|
"test:packlist": "pnpm build && node tests/test-packlist.js",
|
|
77
77
|
"test:release-tooling": "node tests/test-release-tooling.test.mjs",
|
|
78
|
-
"test:all": "pnpm build && pnpm
|
|
78
|
+
"test:all": "pnpm build && pnpm format:check && pnpm check:hygiene && pnpm check:release-policy && pnpm check:boundaries && pnpm check:security && pnpm audit:osv && pnpm test:unit && pnpm test:patch && node tests/test-packed-cli.js && node tests/test-packlist.js",
|
|
79
79
|
"release:check": "pnpm test:all",
|
|
80
|
-
"release:pack": "pnpm build && pnpm plugin:build && node scripts/create-release-artifact.mjs && node scripts/check-release-secrets.mjs .artifacts/release/metadata.json",
|
|
81
|
-
"release:artifact:verify": "node scripts/verify-release-artifact.mjs .artifacts/release/metadata.json && node scripts/check-release-secrets.mjs .artifacts/release/metadata.json",
|
|
80
|
+
"release:pack": "pnpm build && pnpm plugin:build && node scripts/release/create-release-artifact.mjs && node scripts/release/check-release-secrets.mjs .artifacts/release/metadata.json",
|
|
81
|
+
"release:artifact:verify": "node scripts/release/verify-release-artifact.mjs .artifacts/release/metadata.json && node scripts/release/check-release-secrets.mjs .artifacts/release/metadata.json",
|
|
82
82
|
"release:artifact:smoke": "node tests/test-packed-cli.js .artifacts/release/metadata.json",
|
|
83
83
|
"test:unit": "node --test --test-concurrency=4 --test-reporter=spec tests/*.test.mjs",
|
|
84
84
|
"test:integration": "pnpm build && node tests/test-generated-apps.mjs",
|
|
85
|
-
"format": "prettier --write src scripts tests \"assets/patches/*.mjs\" assets/ui assets/security && node scripts/stack-template-format.mjs --write",
|
|
86
|
-
"format:check": "prettier --check src scripts tests \"assets/patches/*.mjs\" assets/ui assets/security && node scripts/stack-template-format.mjs",
|
|
87
|
-
"plugin:build": "node scripts/check-plugin.mjs",
|
|
88
|
-
"plugin:check": "node scripts/check-plugin.mjs",
|
|
85
|
+
"format": "prettier --write src scripts tests \"assets/patches/*.mjs\" assets/ui assets/security && node scripts/build/stack-template-format.mjs --write",
|
|
86
|
+
"format:check": "prettier --check src scripts tests \"assets/patches/*.mjs\" assets/ui assets/security && node scripts/build/stack-template-format.mjs",
|
|
87
|
+
"plugin:build": "node scripts/plugin/check-plugin.mjs",
|
|
88
|
+
"plugin:check": "node scripts/plugin/check-plugin.mjs",
|
|
89
89
|
"test:patch": "node tests/test-braces-install.mjs && node tests/test-forge-install.mjs",
|
|
90
|
-
"check:boundaries": "node scripts/repository-boundaries.mjs",
|
|
91
|
-
"test:tanstack-runtime": "pnpm build && node scripts/tanstack-runtime-smoke.mjs",
|
|
92
|
-
"check:standalone": "node scripts/standalone-checkout.mjs"
|
|
90
|
+
"check:boundaries": "node scripts/checks/repository-boundaries.mjs",
|
|
91
|
+
"test:tanstack-runtime": "pnpm build && node scripts/runtime/tanstack-runtime-smoke.mjs",
|
|
92
|
+
"check:standalone": "node scripts/checks/standalone-checkout.mjs"
|
|
93
93
|
},
|
|
94
94
|
"keywords": [
|
|
95
95
|
"cli",
|