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
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { lstatSync, readdirSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { lstatIfPresent } from './durable-files.js';
|
|
4
|
+
import { LOCK_FILE } from './lock.js';
|
|
5
|
+
import { JOURNAL_FILE, LOCAL_TRANSACTION_ROOT_PATTERN, TRANSACTION_DIRECTORY } from './model.js';
|
|
6
|
+
export function assertRelativePath(relativePath) {
|
|
7
|
+
const normalized = path.normalize(relativePath);
|
|
8
|
+
const rawSegments = relativePath.split(/[\\/]/);
|
|
9
|
+
if (!relativePath ||
|
|
10
|
+
relativePath.includes('\0') ||
|
|
11
|
+
relativePath.includes('\\') ||
|
|
12
|
+
path.isAbsolute(relativePath) ||
|
|
13
|
+
rawSegments.some((segment) => segment === '' || segment === '.' || segment === '..') ||
|
|
14
|
+
normalized === '.' ||
|
|
15
|
+
normalized === '..' ||
|
|
16
|
+
normalized.startsWith(`..${path.sep}`) ||
|
|
17
|
+
normalized.split(path.sep).includes('..') ||
|
|
18
|
+
rawSegments[0] === TRANSACTION_DIRECTORY ||
|
|
19
|
+
rawSegments[0] === LOCK_FILE ||
|
|
20
|
+
rawSegments[0] === JOURNAL_FILE) {
|
|
21
|
+
throw new Error(`Unsafe transaction path: ${relativePath}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function resolveTransactionPath(root, relativePath) {
|
|
25
|
+
assertRelativePath(relativePath);
|
|
26
|
+
const resolvedRoot = path.resolve(root);
|
|
27
|
+
const resolved = path.resolve(resolvedRoot, relativePath);
|
|
28
|
+
if (!resolved.startsWith(`${resolvedRoot}${path.sep}`)) {
|
|
29
|
+
throw new Error(`Unsafe transaction path: ${relativePath}`);
|
|
30
|
+
}
|
|
31
|
+
return resolved;
|
|
32
|
+
}
|
|
33
|
+
function ancestorInSet(relativePath, candidates) {
|
|
34
|
+
const segments = relativePath.split('/');
|
|
35
|
+
for (let index = 1; index < segments.length; index += 1) {
|
|
36
|
+
const ancestor = segments.slice(0, index).join('/');
|
|
37
|
+
if (candidates.has(ancestor))
|
|
38
|
+
return ancestor;
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
export function assertNoPathAncestry(paths, context) {
|
|
43
|
+
const seen = new Set();
|
|
44
|
+
const ordered = [...paths].sort((left, right) => left.split('/').length - right.split('/').length || left.localeCompare(right));
|
|
45
|
+
for (const relativePath of ordered) {
|
|
46
|
+
assertRelativePath(relativePath);
|
|
47
|
+
const ancestor = ancestorInSet(relativePath, seen);
|
|
48
|
+
if (ancestor) {
|
|
49
|
+
throw new Error(`Ambiguous transaction ${context}: ${ancestor} is an ancestor of ${relativePath}.`);
|
|
50
|
+
}
|
|
51
|
+
seen.add(relativePath);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function normalizeTransactionPaths(rawCommitPaths, rawDeletePaths) {
|
|
55
|
+
const commitPaths = [...new Set(rawCommitPaths)];
|
|
56
|
+
for (const relativePath of commitPaths)
|
|
57
|
+
assertRelativePath(relativePath);
|
|
58
|
+
assertNoPathAncestry(commitPaths, 'write paths');
|
|
59
|
+
const deleteCandidates = [...new Set(rawDeletePaths)];
|
|
60
|
+
for (const relativePath of deleteCandidates)
|
|
61
|
+
assertRelativePath(relativePath);
|
|
62
|
+
deleteCandidates.sort((left, right) => left.split('/').length - right.split('/').length || left.localeCompare(right));
|
|
63
|
+
const deleteSet = new Set();
|
|
64
|
+
const deletePaths = deleteCandidates.filter((candidate) => {
|
|
65
|
+
if (ancestorInSet(candidate, deleteSet))
|
|
66
|
+
return false;
|
|
67
|
+
deleteSet.add(candidate);
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
const deleteAncestorPaths = new Set();
|
|
71
|
+
for (const deleted of deletePaths) {
|
|
72
|
+
const segments = deleted.split('/');
|
|
73
|
+
for (let index = 1; index < segments.length; index += 1) {
|
|
74
|
+
deleteAncestorPaths.add(segments.slice(0, index).join('/'));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (const written of commitPaths) {
|
|
78
|
+
const deletedAncestor = ancestorInSet(written, deleteSet);
|
|
79
|
+
if (deleteSet.has(written) || deletedAncestor || deleteAncestorPaths.has(written)) {
|
|
80
|
+
throw new Error(`Ambiguous transaction write/delete paths include ${written}` +
|
|
81
|
+
(deletedAncestor ? ` below ${deletedAncestor}` : ''));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const uniquePaths = [...commitPaths, ...deletePaths].sort();
|
|
85
|
+
return { commitPaths, deletePaths, uniquePaths };
|
|
86
|
+
}
|
|
87
|
+
function assertExpectedTempRoot(root, candidate, kind) {
|
|
88
|
+
const resolved = path.resolve(candidate);
|
|
89
|
+
const tokenPattern = '(\\d+-[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})';
|
|
90
|
+
const localParent = path.join(path.resolve(root), TRANSACTION_DIRECTORY);
|
|
91
|
+
const localMatch = new RegExp(`^${kind}-${tokenPattern}$`, 'i').exec(path.basename(resolved));
|
|
92
|
+
if (path.dirname(resolved) === localParent && localMatch) {
|
|
93
|
+
const namespaceStat = lstatIfPresent(localParent);
|
|
94
|
+
if (namespaceStat && (namespaceStat.isSymbolicLink() || !namespaceStat.isDirectory())) {
|
|
95
|
+
throw new Error(`Unsafe reserved transaction namespace: ${localParent}`);
|
|
96
|
+
}
|
|
97
|
+
return { token: localMatch[1] };
|
|
98
|
+
}
|
|
99
|
+
throw new Error(`Unsafe transaction ${kind} root: ${candidate}`);
|
|
100
|
+
}
|
|
101
|
+
export function assertNoSymlinkComponents(root, relativePath) {
|
|
102
|
+
resolveTransactionPath(root, relativePath);
|
|
103
|
+
let cursor = path.resolve(root);
|
|
104
|
+
if (lstatIfPresent(cursor)?.isSymbolicLink()) {
|
|
105
|
+
throw new Error(`Refusing transaction root that is a symbolic link: ${root}`);
|
|
106
|
+
}
|
|
107
|
+
for (const segment of relativePath.split('/')) {
|
|
108
|
+
cursor = path.join(cursor, segment);
|
|
109
|
+
if (lstatIfPresent(cursor)?.isSymbolicLink()) {
|
|
110
|
+
throw new Error(`Refusing transaction path containing a symbolic link: ${relativePath}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export function assertNoSymlinksRecursively(target) {
|
|
115
|
+
const stat = lstatSync(target);
|
|
116
|
+
if (stat.isSymbolicLink())
|
|
117
|
+
throw new Error(`Refusing symbolic link in staged output: ${target}`);
|
|
118
|
+
if (!stat.isDirectory())
|
|
119
|
+
return;
|
|
120
|
+
for (const entry of readdirSync(target))
|
|
121
|
+
assertNoSymlinksRecursively(path.join(target, entry));
|
|
122
|
+
}
|
|
123
|
+
export function assertJournalRoots(root, backupRoot, stageRoot) {
|
|
124
|
+
const backupIdentity = assertExpectedTempRoot(root, backupRoot, 'backup');
|
|
125
|
+
const stageIdentity = assertExpectedTempRoot(root, stageRoot, 'stage');
|
|
126
|
+
if (backupIdentity.token !== stageIdentity.token) {
|
|
127
|
+
throw new Error('Transaction stage and backup roots do not share one token.');
|
|
128
|
+
}
|
|
129
|
+
for (const temporaryRoot of [backupRoot, stageRoot]) {
|
|
130
|
+
const stat = lstatIfPresent(temporaryRoot);
|
|
131
|
+
if (stat) {
|
|
132
|
+
if (stat.isSymbolicLink() || !stat.isDirectory()) {
|
|
133
|
+
throw new Error(`Unsafe transaction temporary root: ${temporaryRoot}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export function assertTransactionNamespace(transactionDirectory) {
|
|
139
|
+
const namespaceStat = lstatIfPresent(transactionDirectory);
|
|
140
|
+
if (namespaceStat && (namespaceStat.isSymbolicLink() || !namespaceStat.isDirectory())) {
|
|
141
|
+
throw new Error(`Unsafe reserved transaction namespace requires manual inspection: ${transactionDirectory}`);
|
|
142
|
+
}
|
|
143
|
+
if (!namespaceStat)
|
|
144
|
+
return;
|
|
145
|
+
for (const entry of readdirSync(transactionDirectory)) {
|
|
146
|
+
const candidate = path.join(transactionDirectory, entry);
|
|
147
|
+
const stat = lstatIfPresent(candidate);
|
|
148
|
+
if (!LOCAL_TRANSACTION_ROOT_PATTERN.test(entry) ||
|
|
149
|
+
!stat ||
|
|
150
|
+
stat.isSymbolicLink() ||
|
|
151
|
+
!stat.isDirectory()) {
|
|
152
|
+
throw new Error(`Unknown or unsafe artifact in reserved transaction namespace requires manual inspection: ${candidate}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TransactionJournal } from './model.js';
|
|
2
|
+
export declare function removeEmptyTransactionDirectory(root: string): void;
|
|
3
|
+
export declare function cleanupOrphanTransactionRoots(root: string): void;
|
|
4
|
+
export declare function restoreJournal(root: string, journal: TransactionJournal): void;
|
|
5
|
+
export declare function recoverInterruptedTransactionUnlocked(root: string): boolean;
|
|
6
|
+
/** Recover an interrupted commit while holding the same lock used by normal transactions. */
|
|
7
|
+
export declare function recoverInterruptedTransaction(root: string): boolean;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { lstatSync, mkdirSync, readdirSync, rmSync, rmdirSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { readBoundedFile } from '../bounded-file.js';
|
|
4
|
+
import { fingerprintEntry, lstatIfPresent, pathEntryExists, removeEntryDurably, renameDurably, syncDirectory, } from './durable-files.js';
|
|
5
|
+
import { removeJournal, validateJournal, writeJournal } from './journal.js';
|
|
6
|
+
import { acquireTransactionLock, releaseTransactionLock } from './lock.js';
|
|
7
|
+
import { JOURNAL_FILE, LOCAL_TRANSACTION_ROOT_PATTERN, TRANSACTION_DIRECTORY, } from './model.js';
|
|
8
|
+
import { assertNoSymlinkComponents, resolveTransactionPath } from './paths.js';
|
|
9
|
+
export function removeEmptyTransactionDirectory(root) {
|
|
10
|
+
const transactionDirectory = path.join(path.resolve(root), TRANSACTION_DIRECTORY);
|
|
11
|
+
try {
|
|
12
|
+
rmdirSync(transactionDirectory);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
const code = error.code;
|
|
16
|
+
// Preserve rejected files/symlinks and the original namespace validation error.
|
|
17
|
+
if (!['ENOENT', 'ENOTDIR', 'ENOTEMPTY', 'EEXIST'].includes(code ?? ''))
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function cleanupOrphanTransactionRoots(root) {
|
|
22
|
+
const transactionDirectory = path.join(path.resolve(root), TRANSACTION_DIRECTORY);
|
|
23
|
+
const namespaceStat = lstatIfPresent(transactionDirectory);
|
|
24
|
+
if (!namespaceStat)
|
|
25
|
+
return;
|
|
26
|
+
if (namespaceStat.isSymbolicLink() || !namespaceStat.isDirectory()) {
|
|
27
|
+
throw new Error(`Unsafe reserved transaction namespace requires manual inspection: ${transactionDirectory}`);
|
|
28
|
+
}
|
|
29
|
+
for (const entry of readdirSync(transactionDirectory)) {
|
|
30
|
+
if (!LOCAL_TRANSACTION_ROOT_PATTERN.test(entry)) {
|
|
31
|
+
throw new Error(`Unknown artifact in reserved transaction namespace requires manual inspection: ${path.join(transactionDirectory, entry)}`);
|
|
32
|
+
}
|
|
33
|
+
const candidate = path.join(transactionDirectory, entry);
|
|
34
|
+
const stat = lstatIfPresent(candidate);
|
|
35
|
+
if (!stat)
|
|
36
|
+
continue;
|
|
37
|
+
if (stat.isSymbolicLink() || !stat.isDirectory()) {
|
|
38
|
+
throw new Error(`Unsafe orphan transaction root requires manual inspection: ${candidate}`);
|
|
39
|
+
}
|
|
40
|
+
rmSync(candidate, { recursive: true });
|
|
41
|
+
}
|
|
42
|
+
removeEmptyTransactionDirectory(root);
|
|
43
|
+
}
|
|
44
|
+
function restoreInstalledEntry(root, journal, entry, target) {
|
|
45
|
+
if (entry.installed) {
|
|
46
|
+
if (pathEntryExists(target)) {
|
|
47
|
+
if (entry.installedFingerprint === null) {
|
|
48
|
+
throw new Error(`Installed transaction path has no trusted fingerprint: ${entry.relativePath}. ` +
|
|
49
|
+
'Recovery stopped without modifying it; inspect the journal, target, and backup manually.');
|
|
50
|
+
}
|
|
51
|
+
const actualFingerprint = fingerprintEntry(target);
|
|
52
|
+
if (actualFingerprint !== entry.installedFingerprint) {
|
|
53
|
+
throw new Error(`Installed transaction path changed after an interrupted commit: ${entry.relativePath}. ` +
|
|
54
|
+
'Recovery stopped without modifying it; inspect the journal, target, and backup manually.');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
removeEntryDurably(target);
|
|
58
|
+
entry.installed = false;
|
|
59
|
+
entry.installedFingerprint = null;
|
|
60
|
+
writeJournal(root, journal);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function restoreJournal(root, journal) {
|
|
64
|
+
for (const entry of [...journal.entries].reverse()) {
|
|
65
|
+
assertNoSymlinkComponents(root, entry.relativePath);
|
|
66
|
+
const target = resolveTransactionPath(root, entry.relativePath);
|
|
67
|
+
restoreInstalledEntry(root, journal, entry, target);
|
|
68
|
+
if (entry.backupPath) {
|
|
69
|
+
assertNoSymlinkComponents(journal.backupRoot, entry.relativePath);
|
|
70
|
+
if (pathEntryExists(entry.backupPath)) {
|
|
71
|
+
if (pathEntryExists(target))
|
|
72
|
+
throw new Error(`Transaction recovery target was recreated: ${entry.relativePath}. Recovery stopped without modifying it; preserve the journal, target and backup for manual inspection.`);
|
|
73
|
+
const backupFingerprint = fingerprintEntry(entry.backupPath);
|
|
74
|
+
if (entry.backupFingerprint && entry.backupFingerprint !== backupFingerprint)
|
|
75
|
+
throw new Error(`Transaction backup changed: ${entry.relativePath}. Preserve the journal and backup for manual inspection.`);
|
|
76
|
+
// Persist original identity before restore so a crash after rename can be replayed.
|
|
77
|
+
entry.backupFingerprint = backupFingerprint;
|
|
78
|
+
writeJournal(root, journal);
|
|
79
|
+
mkdirSync(path.dirname(target), { recursive: true });
|
|
80
|
+
renameDurably(entry.backupPath, target, root);
|
|
81
|
+
}
|
|
82
|
+
else if (!pathEntryExists(target) ||
|
|
83
|
+
!entry.backupFingerprint ||
|
|
84
|
+
fingerprintEntry(target) !== entry.backupFingerprint) {
|
|
85
|
+
throw new Error(`Cannot recover missing transaction backup or unverified target: ${entry.backupPath}. Recovery stopped; preserve the journal and target for manual inspection.`);
|
|
86
|
+
}
|
|
87
|
+
entry.backupPath = null;
|
|
88
|
+
delete entry.backupFingerprint;
|
|
89
|
+
writeJournal(root, journal);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (const relativePath of [...journal.createdDirectories].sort((left, right) => right.split('/').length - left.split('/').length || right.localeCompare(left))) {
|
|
93
|
+
assertNoSymlinkComponents(root, relativePath);
|
|
94
|
+
const target = resolveTransactionPath(root, relativePath);
|
|
95
|
+
try {
|
|
96
|
+
rmdirSync(target);
|
|
97
|
+
syncDirectory(path.dirname(target));
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const code = error.code;
|
|
101
|
+
if (!['ENOENT', 'ENOTEMPTY', 'EEXIST'].includes(code ?? ''))
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
removeJournal(root);
|
|
106
|
+
rmSync(journal.stageRoot, { recursive: true, force: true });
|
|
107
|
+
rmSync(journal.backupRoot, { recursive: true, force: true });
|
|
108
|
+
removeEmptyTransactionDirectory(root);
|
|
109
|
+
}
|
|
110
|
+
export function recoverInterruptedTransactionUnlocked(root) {
|
|
111
|
+
const journalPath = path.join(root, JOURNAL_FILE);
|
|
112
|
+
if (!pathEntryExists(journalPath))
|
|
113
|
+
return false;
|
|
114
|
+
if (lstatSync(journalPath).isSymbolicLink()) {
|
|
115
|
+
throw new Error(`Refusing symbolic-link transaction journal at ${journalPath}.`);
|
|
116
|
+
}
|
|
117
|
+
const journal = validateJournal(root, JSON.parse(readBoundedFile(journalPath, 16 * 1024 * 1024).toString('utf8')));
|
|
118
|
+
restoreJournal(root, journal);
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
/** Recover an interrupted commit while holding the same lock used by normal transactions. */
|
|
122
|
+
export function recoverInterruptedTransaction(root) {
|
|
123
|
+
const lock = acquireTransactionLock(root);
|
|
124
|
+
try {
|
|
125
|
+
const recovered = recoverInterruptedTransactionUnlocked(root);
|
|
126
|
+
cleanupOrphanTransactionRoots(root);
|
|
127
|
+
return recovered;
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
releaseTransactionLock(lock);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function recoverInterruptedTransaction(root: string): boolean;
|
|
1
|
+
export { recoverInterruptedTransaction } from './recovery.js';
|
|
3
2
|
/** The filesystem commit succeeded, but a follow-up action such as install failed. */
|
|
4
3
|
export declare class PostCommitError extends Error {
|
|
5
4
|
readonly committedPaths: readonly string[];
|
|
@@ -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.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
|
@@ -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,
|
|
@@ -65,7 +79,7 @@ Dispatch [CI](https://github.com/anhedral/anhedral-cli/blob/main/.github/workflo
|
|
|
65
79
|
Anhedral Stack proof and one-day measurements. Broader compatibility and generated
|
|
66
80
|
application matrices remain in [Full validation](https://github.com/anhedral/anhedral-cli/blob/main/.github/workflows/validation.yml).
|
|
67
81
|
|
|
68
|
-
`node scripts/tanstack-runtime-smoke.mjs` installs a disposable Anhedral Stack
|
|
82
|
+
`node scripts/runtime/tanstack-runtime-smoke.mjs` installs a disposable Anhedral Stack
|
|
69
83
|
application and exercises local workerd, SSR/server functions, progressive backend,
|
|
70
84
|
private storage and the generated Stripe build/migration path. The compiled web
|
|
71
85
|
and API Workers run together with the migrated local D1 state. Bundle measurements
|
|
@@ -105,6 +119,16 @@ or executable. Offline source inspection cannot attest a newly published artifac
|
|
|
105
119
|
|
|
106
120
|
## Platform CLI access and source upload
|
|
107
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
|
+
|
|
108
132
|
`login --start` prints browser approval instructions; `login --resume` redeems the
|
|
109
133
|
saved approval. Interactive `login` polls after showing the URL and confirmation
|
|
110
134
|
code. Tokens and device secrets use macOS Keychain or Linux Secret Service;
|
|
@@ -157,7 +181,7 @@ checks/builds; authored routes, router configuration and server source remain
|
|
|
157
181
|
included. Credential scanning is deliberately conservative; inspect source before uploading.
|
|
158
182
|
|
|
159
183
|
Public upload limits and message shapes live in `src/contracts`; protocol code is
|
|
160
|
-
in `src/platform
|
|
184
|
+
in `src/platform/command.ts`. The server independently authenticates the caller,
|
|
161
185
|
checks current tenant/project authority and revocation, validates source, and
|
|
162
186
|
enforces admission. Client checks and supplied IDs cannot grant access. Upload
|
|
163
187
|
does not deploy, activate providers, migrate a database or replace identities.
|
|
@@ -178,7 +202,9 @@ backend/R2/Stripe. Backend manifests preserve `better-auth-d1-v1`; web-only uses
|
|
|
178
202
|
not current public selections or hosted support.
|
|
179
203
|
Continue selecting an explicit manifest; the CLI never infers an admitted artifact
|
|
180
204
|
from locally generated source. Public plans and candidate receipts omit internal
|
|
181
|
-
registry images and build-policy digests.
|
|
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
|
|
182
208
|
privately and returns a digest over the public plan fields for client verification.
|
|
183
209
|
Previously saved plans containing internal fields require a fresh plan with `--new`.
|
|
184
210
|
Plans list runtime, source-version or lockfile mismatches and remediation. Do not
|
|
@@ -194,6 +220,10 @@ routing require `deploy plan --manifest <file> --new`. Plan/source expiry and
|
|
|
194
220
|
revocation fail closed. State under `.anhedral/platform/deployment.json` contains
|
|
195
221
|
no credentials and cannot select a network origin or change the signed-in identity.
|
|
196
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
|
+
|
|
197
227
|
`env list` returns names, types, environments and versions. `env import --environment
|
|
198
228
|
staging|production --file <path>` reads a private dotenv file; `--stdin` accepts a
|
|
199
229
|
pipe. `env set <NAME>` reads one literal value from a file or pipe. Values are
|