anhedral 0.17.0 → 0.19.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 +33 -68
- package/assets/contracts/LICENSE +201 -0
- package/assets/contracts/LICENSE.environment +201 -0
- package/assets/contracts/LICENSE.operations +201 -0
- package/assets/contracts/deployment-provenance.json +15 -0
- package/assets/contracts/environment-provenance.json +11 -0
- package/assets/contracts/operations-provenance.json +12 -0
- package/assets/launch/application.server.ts.txt +13 -0
- package/assets/launch/auth-client.ts.txt +4 -0
- package/assets/launch/home.tsx.txt +20 -0
- package/assets/launch/minimal-application.server.ts.txt +5 -0
- package/assets/launch/minimal-server.ts.txt +7 -0
- package/assets/launch/oj/OJ.LICENSE +21 -0
- package/assets/launch/oj/run.mjs +82 -0
- package/assets/launch/oj/runtime.json +21 -0
- package/assets/launch/request-context.ts.txt +3 -0
- package/assets/launch/root.tsx.txt +26 -0
- package/assets/launch/router.tsx.txt +21 -0
- package/assets/launch/server.ts.txt +15 -0
- package/assets/launch/sign-in.tsx.txt +53 -0
- package/assets/launch/styles.css.txt +19 -0
- package/assets/security/credential-patterns.d.mts +3 -0
- package/assets/security/credential-patterns.mjs +59 -0
- package/assets/stack/api-index.ts.txt +6 -1
- package/assets/stack/stripe.ts.txt +30 -13
- package/assets/ui/catalog.json +36 -324
- package/dist/{platforms/web.d.ts → api-proxy.d.ts} +1 -3
- package/dist/api-proxy.js +48 -0
- package/dist/bin.js +55 -36
- package/dist/capability-catalog.d.ts +36 -57
- package/dist/capability-catalog.js +65 -67
- package/dist/capability-command.d.ts +3 -3
- package/dist/capability-command.js +146 -59
- package/dist/capability-editor.js +6 -5
- package/dist/capability-recipes.js +9 -296
- package/dist/cli-arguments.d.ts +2 -0
- package/dist/cli-arguments.js +101 -50
- package/dist/cli-commands.d.ts +1 -1
- package/dist/cli-commands.js +31 -5
- package/dist/cli-errors.d.ts +18 -0
- package/dist/cli-errors.js +63 -0
- package/dist/cli-output.d.ts +22 -0
- package/dist/cli-output.js +42 -7
- package/dist/command-runner.js +88 -0
- package/dist/command-schema.d.ts +16 -0
- package/dist/command-schema.js +496 -21
- package/dist/command-types.d.ts +1 -0
- package/dist/command-types.js +1 -0
- package/dist/completion.d.ts +2 -0
- package/dist/completion.js +201 -0
- package/dist/composition.d.ts +25 -0
- package/dist/composition.js +28 -0
- package/dist/contracts/cli-transport.d.ts +316 -0
- package/dist/contracts/cli-transport.js +236 -0
- package/dist/contracts/deployment.d.ts +233 -0
- package/dist/contracts/deployment.js +198 -0
- package/dist/contracts/environment-file.d.ts +7 -0
- package/dist/contracts/environment-file.js +112 -0
- package/dist/contracts/environment-transport.d.ts +79 -0
- package/dist/contracts/environment-transport.js +110 -0
- package/dist/contracts/production-transport.d.ts +71 -0
- package/dist/contracts/production-transport.js +56 -0
- package/dist/contracts/runtime-logs-transport.d.ts +127 -0
- package/dist/contracts/runtime-logs-transport.js +50 -0
- package/dist/contracts/source-bundle.d.ts +11 -0
- package/dist/contracts/source-bundle.js +197 -0
- package/dist/contracts/source-profile.d.ts +4 -0
- package/dist/contracts/source-profile.js +5 -0
- package/dist/contracts/staging-transport.d.ts +79 -0
- package/dist/contracts/staging-transport.js +43 -0
- package/dist/dependencies.d.ts +9 -27
- package/dist/dependencies.js +19 -66
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/launch.d.ts +27 -0
- package/dist/launch.js +262 -0
- package/dist/platform-command.d.ts +9 -0
- package/dist/platform-command.js +787 -0
- package/dist/platform-environment.d.ts +18 -0
- package/dist/platform-environment.js +257 -0
- package/dist/platform-operations.d.ts +26 -0
- package/dist/platform-operations.js +155 -0
- package/dist/platform-production.d.ts +16 -0
- package/dist/platform-production.js +135 -0
- package/dist/platform-source.d.ts +8 -0
- package/dist/platform-source.js +111 -0
- package/dist/platform-state.d.ts +15 -0
- package/dist/platform-state.js +229 -0
- package/dist/platforms/tanstack.d.ts +10 -0
- package/dist/platforms/tanstack.js +248 -0
- package/dist/registry/usage.d.ts +4 -1
- package/dist/registry/usage.js +59 -4
- package/dist/scaffold/bootstrap.d.ts +3 -3
- package/dist/scaffold/styling.d.ts +3 -2
- package/dist/transaction.js +28 -3
- package/dist/ui-catalog.d.ts +3 -5
- package/dist/ui-catalog.js +8 -24
- package/dist/ui-command.d.ts +3 -1
- package/dist/ui-command.js +74 -72
- package/dist/ui-project.d.ts +4 -2
- package/dist/ui-project.js +40 -38
- package/dist/util.js +40 -61
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/capabilities.md +23 -89
- package/docs/software-factory.md +208 -9
- package/docs/stack-standard.md +7 -17
- package/docs/ui.md +9 -22
- package/package.json +26 -22
- package/assets/stack/ai-schema.ts.txt +0 -5
- package/assets/stack/ai.ts.txt +0 -30
- package/assets/stack/desktop.rs.txt +0 -21
- package/assets/stack/events-schema.ts.txt +0 -12
- package/assets/stack/events.ts.txt +0 -59
- package/assets/stack/mobile-auth.ts.txt +0 -25
- package/assets/stack/mobile-billing.tsx.txt +0 -63
- package/assets/stack/mobile-session.tsx.txt +0 -83
- package/assets/stack/native-button.tsx.txt +0 -108
- package/assets/stack/native-global.css.txt +0 -4
- package/assets/stack/native-lib-utils.ts.txt +0 -5
- package/assets/stack/native-metro.config.js.txt +0 -6
- package/assets/stack/native-nativewind-env.d.ts.txt +0 -1
- package/assets/stack/native-tailwind.config.js.txt +0 -73
- package/assets/stack/native-text.tsx.txt +0 -89
- package/assets/stack/purchases.ts.txt +0 -65
- package/assets/stack/revenuecat.ts.txt +0 -88
- package/assets/stack/rtc-schema.ts.txt +0 -10
- package/assets/stack/rtc.ts.txt +0 -122
- package/assets/stack/web-sign-in.tsx.txt +0 -51
- package/dist/capabilities.d.ts +0 -11
- package/dist/capabilities.js +0 -14
- package/dist/dependency-order.d.ts +0 -2
- package/dist/dependency-order.js +0 -24
- package/dist/platforms/lint.d.ts +0 -1
- package/dist/platforms/lint.js +0 -5
- package/dist/platforms/web.js +0 -251
- package/dist/project-config.d.ts +0 -3
- package/dist/project-config.js +0 -16
- package/dist/registry/context.d.ts +0 -3
- package/dist/registry/context.js +0 -20
- package/dist/registry/options.d.ts +0 -2
- package/dist/registry/options.js +0 -44
- package/dist/registry/resolve.d.ts +0 -11
- package/dist/registry/resolve.js +0 -46
- package/dist/registry/types.d.ts +0 -60
- package/dist/scaffold/api.d.ts +0 -2
- package/dist/scaffold/api.js +0 -38
- package/dist/scaffold/backend.d.ts +0 -2
- package/dist/scaffold/backend.js +0 -36
- package/dist/scaffold/compose.d.ts +0 -4
- package/dist/scaffold/compose.js +0 -30
- package/dist/scaffold/database.d.ts +0 -2
- package/dist/scaffold/database.js +0 -41
- package/dist/scaffold/documentation.d.ts +0 -2
- package/dist/scaffold/documentation.js +0 -71
- package/dist/scaffold/environment.d.ts +0 -4
- package/dist/scaffold/environment.js +0 -22
- package/dist/scaffold/stack-documentation.d.ts +0 -2
- package/dist/scaffold/stack-documentation.js +0 -6
- package/dist/scaffold/storage.d.ts +0 -2
- package/dist/scaffold/storage.js +0 -21
- package/dist/scaffold/workspace.d.ts +0 -3
- package/dist/scaffold/workspace.js +0 -131
- package/dist/stack-registry.d.ts +0 -35
- package/dist/stack-registry.js +0 -189
- package/dist/standard.d.ts +0 -8
- package/dist/standard.js +0 -94
- package/dist/workspace-graph.d.ts +0 -7
- package/dist/workspace-graph.js +0 -74
- package/docs/anhedral-stack.md +0 -12
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
- package/docs/native-ui.md +0 -47
- /package/dist/{registry/types.js → command-runner.d.ts} +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { COMMANDS, GLOBAL_OPTIONS, commandOptions, commandTopic, } from './command-schema.js';
|
|
2
|
+
import { PUBLIC_STACK_ADDITIONS } from './capability-catalog.js';
|
|
3
|
+
import { UI_CATALOG } from './ui-catalog.js';
|
|
4
|
+
/** Quote data for shell source. Completion never evaluates user input. */
|
|
5
|
+
function quote(value) {
|
|
6
|
+
return "'" + value.replaceAll("'", "'\"'\"'") + "'";
|
|
7
|
+
}
|
|
8
|
+
function words(values) {
|
|
9
|
+
return values.map(quote).join(' ');
|
|
10
|
+
}
|
|
11
|
+
function nodes() {
|
|
12
|
+
const result = [];
|
|
13
|
+
function visit(topic, definition) {
|
|
14
|
+
result.push([topic.join(' '), commandTopic(topic)]);
|
|
15
|
+
for (const [child, entry] of Object.entries(definition.children ?? {}))
|
|
16
|
+
visit([...topic, child], entry);
|
|
17
|
+
}
|
|
18
|
+
for (const [name, definition] of Object.entries(COMMANDS))
|
|
19
|
+
visit([name], definition);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
function choices(definition) {
|
|
23
|
+
if (definition.children)
|
|
24
|
+
return Object.keys(definition.children);
|
|
25
|
+
const positional = definition.positional;
|
|
26
|
+
if (positional?.kind === 'capability')
|
|
27
|
+
return PUBLIC_STACK_ADDITIONS;
|
|
28
|
+
if (positional?.kind === 'component')
|
|
29
|
+
return UI_CATALOG.components.filter((entry) => entry.web).map((entry) => entry.name);
|
|
30
|
+
return positional?.choices ?? [];
|
|
31
|
+
}
|
|
32
|
+
function optionCase(context, option) {
|
|
33
|
+
const patterns = [option.flag, ...(option.aliases ?? [])]
|
|
34
|
+
.map((flag) => quote(`${context}:${flag}`))
|
|
35
|
+
.join('|');
|
|
36
|
+
return ` ${patterns}) _known=1; _canonical=${quote(option.flag)}; _arity=${option.arity ? 1 : 0}; _kind=${quote(option.kind ?? '')}; _choices=(${words(option.choices ?? [])});;`;
|
|
37
|
+
}
|
|
38
|
+
function tables() {
|
|
39
|
+
const entries = nodes();
|
|
40
|
+
const all = [['', undefined], ...entries];
|
|
41
|
+
const lookup = all.flatMap(([context]) => {
|
|
42
|
+
const options = context ? commandOptions(context.split(' ')[0]) : GLOBAL_OPTIONS;
|
|
43
|
+
return options.map((option) => optionCase(context, option));
|
|
44
|
+
});
|
|
45
|
+
const transition = entries.map(([context]) => {
|
|
46
|
+
const parts = context.split(' '), child = parts.pop();
|
|
47
|
+
return ` ${quote(`${parts.join(' ')}:${child}`)}) _context=${quote(context)}; _positions=0; return 0;;\n ${quote(`${parts.length ? 'help ' + parts.join(' ') : 'help'}:${child}`)}) _context=${quote('help ' + context)}; _positions=0; return 0;;`;
|
|
48
|
+
});
|
|
49
|
+
const positional = entries.map(([context, definition]) => {
|
|
50
|
+
const max = definition.children ? 1 : (definition.positional?.max ?? 0);
|
|
51
|
+
return ` ${quote(context)}) _candidates=(${words(choices(definition))}); _kind=${quote(definition.positional?.kind ?? '')}; _max=${max};;`;
|
|
52
|
+
});
|
|
53
|
+
const flags = all.map(([context, definition]) => {
|
|
54
|
+
const options = [...(definition?.options ?? []), ...GLOBAL_OPTIONS];
|
|
55
|
+
const assignments = options
|
|
56
|
+
.filter((option) => !option.hidden)
|
|
57
|
+
.map((option) => {
|
|
58
|
+
const exclude = new Set(option.repeatable ? [] : [option.flag]);
|
|
59
|
+
for (const conflict of definition?.conflicts ?? [])
|
|
60
|
+
if (conflict.includes(option.flag))
|
|
61
|
+
for (const flag of conflict)
|
|
62
|
+
exclude.add(flag);
|
|
63
|
+
if (option.flag === '--json')
|
|
64
|
+
exclude.add('--human');
|
|
65
|
+
if (option.flag === '--human')
|
|
66
|
+
exclude.add('--json');
|
|
67
|
+
const condition = [...exclude]
|
|
68
|
+
.map((flag) => `[[ " $_seen " != *${quote(' ' + flag + ' ')}* ]]`)
|
|
69
|
+
.join(' && ');
|
|
70
|
+
const assignment = `_candidates+=(${words([option.flag, ...(option.aliases ?? [])])})`;
|
|
71
|
+
return ` ${condition ? `if ${condition}; then ${assignment}; fi` : assignment}`;
|
|
72
|
+
});
|
|
73
|
+
return ` ${quote(context)})\n${assignments.join('\n')}\n ;;`;
|
|
74
|
+
});
|
|
75
|
+
return `_anhedral_option() {
|
|
76
|
+
_known=0; _arity=0; _kind=''; _choices=(); _canonical=''
|
|
77
|
+
case "$1:$2" in
|
|
78
|
+
${lookup.join('\n')}
|
|
79
|
+
esac
|
|
80
|
+
}
|
|
81
|
+
_anhedral_transition() {
|
|
82
|
+
case "$_context:$1" in
|
|
83
|
+
':help') _context='help'; _positions=0; return 0;;
|
|
84
|
+
${transition.join('\n')}
|
|
85
|
+
esac
|
|
86
|
+
return 1
|
|
87
|
+
}
|
|
88
|
+
_anhedral_node() {
|
|
89
|
+
_candidates=(); _kind=''; _max=0
|
|
90
|
+
case "$1" in
|
|
91
|
+
''|'help') _candidates=(${words([...Object.keys(COMMANDS), 'help'])}); _max=1;;
|
|
92
|
+
${positional.join('\n')}
|
|
93
|
+
esac
|
|
94
|
+
}
|
|
95
|
+
_anhedral_flags() {
|
|
96
|
+
_candidates=(); _kind=''
|
|
97
|
+
case "$1" in
|
|
98
|
+
${flags.join('\n')}
|
|
99
|
+
esac
|
|
100
|
+
}
|
|
101
|
+
_anhedral_prepare() {
|
|
102
|
+
_needle="$1"; shift
|
|
103
|
+
_context=''; _pending=''; _pending_context=''; _seen=''; _positions=0; _end=0
|
|
104
|
+
_prefix=''; _used_values=()
|
|
105
|
+
local word flag
|
|
106
|
+
for word in "$@"; do
|
|
107
|
+
if [[ -n "$_pending" ]]; then
|
|
108
|
+
if [[ "$word" = '=' ]]; then continue; fi
|
|
109
|
+
_pending=''; continue
|
|
110
|
+
fi
|
|
111
|
+
if [[ "$_end" = 0 && "$word" = '--' ]]; then _end=1; continue; fi
|
|
112
|
+
if [[ "$_end" = 0 && "$word" = -* ]]; then
|
|
113
|
+
flag="\${word%%=*}"
|
|
114
|
+
_anhedral_option "$_context" "$flag"
|
|
115
|
+
if [[ "$_known" = 1 ]]; then
|
|
116
|
+
_seen="$_seen $_canonical"
|
|
117
|
+
if [[ "$_arity" = 1 && "$word" != *=* ]]; then
|
|
118
|
+
_pending="$flag"; _pending_context="$_context"
|
|
119
|
+
fi
|
|
120
|
+
fi
|
|
121
|
+
continue
|
|
122
|
+
fi
|
|
123
|
+
if ! _anhedral_transition "$word"; then
|
|
124
|
+
_positions=$((_positions + 1)); _used_values+=("$word")
|
|
125
|
+
fi
|
|
126
|
+
done
|
|
127
|
+
if [[ -n "$_pending" ]]; then
|
|
128
|
+
[[ "$_needle" = '=' ]] && _needle=''
|
|
129
|
+
_anhedral_option "$_pending_context" "$_pending"
|
|
130
|
+
_candidates=("\${_choices[@]}")
|
|
131
|
+
return
|
|
132
|
+
fi
|
|
133
|
+
if [[ "$_end" = 0 && "$_needle" = --*=* ]]; then
|
|
134
|
+
flag="\${_needle%%=*}"
|
|
135
|
+
_anhedral_option "$_context" "$flag"
|
|
136
|
+
if [[ "$_known" = 1 && "$_arity" = 1 ]]; then
|
|
137
|
+
_prefix="$flag="; _needle="\${_needle#*=}"; _candidates=("\${_choices[@]}"); return
|
|
138
|
+
fi
|
|
139
|
+
fi
|
|
140
|
+
if [[ "$_end" = 0 && "$_needle" = -* ]]; then
|
|
141
|
+
_anhedral_flags "$_context"
|
|
142
|
+
if [[ -z "$_context" ]]; then _candidates+=('--version' '-v'); fi
|
|
143
|
+
return
|
|
144
|
+
fi
|
|
145
|
+
local topic="\${_context#help }"
|
|
146
|
+
_anhedral_node "$topic"
|
|
147
|
+
if [[ "$_positions" -ge "$_max" ]]; then _candidates=(); _kind=''; fi
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
}
|
|
151
|
+
const locals = ` local _context _pending _pending_context _seen _positions _end _prefix _needle
|
|
152
|
+
local _known _arity _kind _canonical _max candidate used duplicate
|
|
153
|
+
local -a _candidates _choices _used_values`;
|
|
154
|
+
/** Generate static completion source; no shell profiles, network or resource discovery. */
|
|
155
|
+
export function completionScript(shell) {
|
|
156
|
+
const header = `# Anhedral ${shell} completion. Source this file after shell completion initialization.\n`;
|
|
157
|
+
if (shell === 'bash')
|
|
158
|
+
return (header +
|
|
159
|
+
tables() +
|
|
160
|
+
`_anhedral() {
|
|
161
|
+
${locals}
|
|
162
|
+
COMPREPLY=()
|
|
163
|
+
_anhedral_prepare "\${COMP_WORDS[COMP_CWORD]}" "\${COMP_WORDS[@]:1:COMP_CWORD-1}"
|
|
164
|
+
if [[ "$_kind" = 'file' || "$_kind" = 'directory' ]]; then
|
|
165
|
+
local mode='-f'
|
|
166
|
+
[[ "$_kind" = 'directory' ]] && mode='-d'
|
|
167
|
+
while IFS= read -r candidate; do COMPREPLY+=("$_prefix$candidate"); done < <(compgen "$mode" -- "$_needle")
|
|
168
|
+
else
|
|
169
|
+
for candidate in "\${_candidates[@]}"; do
|
|
170
|
+
duplicate=0
|
|
171
|
+
for used in "\${_used_values[@]}"; do [[ "$used" = "$candidate" ]] && duplicate=1; done
|
|
172
|
+
if [[ "$duplicate" = 0 && "$candidate" = "$_needle"* ]]; then COMPREPLY+=("$_prefix$candidate"); fi
|
|
173
|
+
done
|
|
174
|
+
fi
|
|
175
|
+
}
|
|
176
|
+
complete -o filenames -F _anhedral anhedral
|
|
177
|
+
`);
|
|
178
|
+
return (header +
|
|
179
|
+
tables() +
|
|
180
|
+
`_anhedral() {
|
|
181
|
+
${locals}
|
|
182
|
+
local -a prior
|
|
183
|
+
local i
|
|
184
|
+
for ((i=2; i<CURRENT; i++)); do prior+=("\${words[i]}"); done
|
|
185
|
+
_anhedral_prepare "\${words[CURRENT]}" "\${prior[@]}"
|
|
186
|
+
if [[ "$_kind" = 'file' || "$_kind" = 'directory' ]]; then
|
|
187
|
+
local PREFIX="$_needle"
|
|
188
|
+
if [[ "$_kind" = 'directory' ]]; then _files -/ -P "$_prefix"; else _files -P "$_prefix"; fi
|
|
189
|
+
else
|
|
190
|
+
local -a matches
|
|
191
|
+
for candidate in "\${_candidates[@]}"; do
|
|
192
|
+
duplicate=0
|
|
193
|
+
for used in "\${_used_values[@]}"; do [[ "$used" = "$candidate" ]] && duplicate=1; done
|
|
194
|
+
[[ "$duplicate" = 0 && "$candidate" = "$_needle"* ]] && matches+=("$_prefix$candidate")
|
|
195
|
+
done
|
|
196
|
+
compadd -a matches
|
|
197
|
+
fi
|
|
198
|
+
}
|
|
199
|
+
compdef _anhedral anhedral
|
|
200
|
+
`);
|
|
201
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Capability } from './capability-catalog.js';
|
|
3
|
+
export declare const launchCompositionSchema: z.ZodObject<{
|
|
4
|
+
generatorVersion: z.ZodNullable<z.ZodString>;
|
|
5
|
+
identity: z.ZodEnum<{
|
|
6
|
+
none: "none";
|
|
7
|
+
"better-auth-d1-v1": "better-auth-d1-v1";
|
|
8
|
+
}>;
|
|
9
|
+
capabilities: z.ZodRecord<z.ZodEnum<{
|
|
10
|
+
hono: "hono";
|
|
11
|
+
"database-auth": "database-auth";
|
|
12
|
+
r2: "r2";
|
|
13
|
+
stripe: "stripe";
|
|
14
|
+
}> & z.core.$partial, z.ZodNullable<z.ZodString>>;
|
|
15
|
+
contractVersion: z.ZodLiteral<2>;
|
|
16
|
+
foundation: z.ZodLiteral<"tanstack-start">;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
/** Local source provenance is never a hosting receipt or a provider activation claim. */
|
|
19
|
+
export declare function composeSourceProvenance(previous: unknown, installed: readonly Capability[], additions: readonly Capability[]): {
|
|
20
|
+
generatorVersion: string | null;
|
|
21
|
+
identity: "none" | "better-auth-d1-v1";
|
|
22
|
+
capabilities: Partial<Record<"hono" | "database-auth" | "r2" | "stripe", string | null>>;
|
|
23
|
+
contractVersion: 2;
|
|
24
|
+
foundation: "tanstack-start";
|
|
25
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { sourceCompositionSchema } from './contracts/deployment.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { GENERATOR_VERSION } from './version.js';
|
|
4
|
+
// Narrow the shared source contract for the launch generator; runtime admission remains server-owned.
|
|
5
|
+
export const launchCompositionSchema = sourceCompositionSchema.safeExtend({
|
|
6
|
+
contractVersion: z.literal(2),
|
|
7
|
+
foundation: z.literal('tanstack-start'),
|
|
8
|
+
});
|
|
9
|
+
const compositionSchema = launchCompositionSchema;
|
|
10
|
+
/** Local source provenance is never a hosting receipt or a provider activation claim. */
|
|
11
|
+
export function composeSourceProvenance(previous, installed, additions) {
|
|
12
|
+
const old = compositionSchema.parse(previous);
|
|
13
|
+
if (old && Object.keys(old.capabilities).some((id) => !installed.includes(id)))
|
|
14
|
+
throw Error('Composition provenance disagrees with installed source; reconcile anhedral.json.');
|
|
15
|
+
const identity = installed.includes('database-auth') ? 'better-auth-d1-v1' : 'none';
|
|
16
|
+
if (old && old.identity !== 'none' && old.identity !== identity)
|
|
17
|
+
throw Error('Preserve existing application identity; an explicit adapter is required.');
|
|
18
|
+
return compositionSchema.parse({
|
|
19
|
+
contractVersion: 2,
|
|
20
|
+
foundation: 'tanstack-start',
|
|
21
|
+
generatorVersion: GENERATOR_VERSION,
|
|
22
|
+
identity,
|
|
23
|
+
capabilities: Object.fromEntries(installed.map((id) => [
|
|
24
|
+
id,
|
|
25
|
+
additions.includes(id) ? GENERATOR_VERSION : old.capabilities[id],
|
|
26
|
+
])),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CLI_CLIENT_ID = "anhedral-cli";
|
|
3
|
+
export declare const SOURCE_LIMITS: {
|
|
4
|
+
readonly bytes: number;
|
|
5
|
+
readonly archiveBytes: number;
|
|
6
|
+
readonly files: 2000;
|
|
7
|
+
readonly chunkBytes: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const uploadExcluded: RegExp;
|
|
10
|
+
export declare const uploadSecret: RegExp;
|
|
11
|
+
export declare const sourceHashSchema: z.ZodString;
|
|
12
|
+
export declare const cliDeviceSchema: z.ZodObject<{
|
|
13
|
+
device_code: z.ZodString;
|
|
14
|
+
user_code: z.ZodString;
|
|
15
|
+
verification_uri: z.ZodURL;
|
|
16
|
+
verification_uri_complete: z.ZodURL;
|
|
17
|
+
expires_in: z.ZodNumber;
|
|
18
|
+
interval: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const cliLoginSchema: z.ZodObject<{
|
|
21
|
+
protocol: z.ZodLiteral<1>;
|
|
22
|
+
token: z.ZodString;
|
|
23
|
+
expiresAt: z.ZodISODateTime;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export declare const cliLinkSchema: z.ZodObject<{
|
|
26
|
+
protocol: z.ZodLiteral<1>;
|
|
27
|
+
projectId: z.ZodUUID;
|
|
28
|
+
teamId: z.ZodUUID;
|
|
29
|
+
principalId: z.ZodUUID;
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
/** Metadata-only project management; creation never initializes or provisions source.
|
|
33
|
+
* Pure factories keep unused wire schemas outside the immutable build-tool artifact. */
|
|
34
|
+
export declare const cliProjectListQuerySchema: z.ZodObject<{
|
|
35
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
36
|
+
cursor: z.ZodOptional<z.ZodUUID>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
export declare const cliProjectCreateInputSchema: z.ZodObject<{
|
|
39
|
+
protocol: z.ZodLiteral<1>;
|
|
40
|
+
requestId: z.ZodUUID;
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
summary: z.ZodDefault<z.ZodString>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export declare const cliProjectSchema: z.ZodObject<{
|
|
45
|
+
projectId: z.ZodUUID;
|
|
46
|
+
teamId: z.ZodUUID;
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
slug: z.ZodString;
|
|
49
|
+
canLink: z.ZodBoolean;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export declare const cliProjectListSchema: z.ZodObject<{
|
|
52
|
+
protocol: z.ZodLiteral<1>;
|
|
53
|
+
principalId: z.ZodUUID;
|
|
54
|
+
team: z.ZodNullable<z.ZodObject<{
|
|
55
|
+
id: z.ZodUUID;
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
availableTeams: z.ZodArray<z.ZodObject<{
|
|
59
|
+
id: z.ZodUUID;
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
}, z.core.$strict>>;
|
|
62
|
+
teamsTruncated: z.ZodBoolean;
|
|
63
|
+
projects: z.ZodArray<z.ZodObject<{
|
|
64
|
+
projectId: z.ZodUUID;
|
|
65
|
+
teamId: z.ZodUUID;
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
slug: z.ZodString;
|
|
68
|
+
canLink: z.ZodBoolean;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
nextCursor: z.ZodNullable<z.ZodUUID>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export declare const cliProjectCreateReceiptSchema: z.ZodObject<{
|
|
73
|
+
projectId: z.ZodUUID;
|
|
74
|
+
teamId: z.ZodUUID;
|
|
75
|
+
name: z.ZodString;
|
|
76
|
+
slug: z.ZodString;
|
|
77
|
+
canLink: z.ZodBoolean;
|
|
78
|
+
protocol: z.ZodLiteral<1>;
|
|
79
|
+
requestId: z.ZodUUID;
|
|
80
|
+
principalId: z.ZodUUID;
|
|
81
|
+
summary: z.ZodString;
|
|
82
|
+
initialization: z.ZodLiteral<"source-upload">;
|
|
83
|
+
}, z.core.$strict>;
|
|
84
|
+
export declare const sourceUploadInputSchema: z.ZodObject<{
|
|
85
|
+
protocol: z.ZodLiteral<1>;
|
|
86
|
+
requestId: z.ZodUUID;
|
|
87
|
+
projectId: z.ZodUUID;
|
|
88
|
+
teamId: z.ZodUUID;
|
|
89
|
+
archiveDigest: z.ZodString;
|
|
90
|
+
archiveBytes: z.ZodNumber;
|
|
91
|
+
inventoryDigest: z.ZodString;
|
|
92
|
+
cliVersion: z.ZodString;
|
|
93
|
+
chunks: z.ZodArray<z.ZodString>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
export declare const sourceUploadReceiptSchema: z.ZodObject<{
|
|
96
|
+
protocol: z.ZodLiteral<1>;
|
|
97
|
+
id: z.ZodUUID;
|
|
98
|
+
requestId: z.ZodUUID;
|
|
99
|
+
projectId: z.ZodUUID;
|
|
100
|
+
archiveDigest: z.ZodString;
|
|
101
|
+
inventoryDigest: z.ZodString;
|
|
102
|
+
received: z.ZodArray<z.ZodNumber>;
|
|
103
|
+
state: z.ZodEnum<{
|
|
104
|
+
uploading: "uploading";
|
|
105
|
+
cancelled: "cancelled";
|
|
106
|
+
sealed: "sealed";
|
|
107
|
+
}>;
|
|
108
|
+
expiresAt: z.ZodISODateTime;
|
|
109
|
+
sourceRevision: z.ZodNullable<z.ZodString>;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
export type SourceUploadInput = z.infer<typeof sourceUploadInputSchema>;
|
|
112
|
+
/** High-confidence credential material must not enter a source checkpoint. */
|
|
113
|
+
export declare function sourceContainsCredential(bytes: Uint8Array): boolean;
|
|
114
|
+
/** Planning reserves source only. It cannot grant a runtime, preview or deployment. */
|
|
115
|
+
export declare const cliPlanInputSchema: z.ZodObject<{
|
|
116
|
+
protocol: z.ZodLiteral<1>;
|
|
117
|
+
requestId: z.ZodUUID;
|
|
118
|
+
uploadId: z.ZodUUID;
|
|
119
|
+
manifest: z.ZodObject<{
|
|
120
|
+
contractVersion: z.ZodLiteral<1>;
|
|
121
|
+
foundation: z.ZodLiteral<"tanstack-start">;
|
|
122
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
123
|
+
hono: "hono";
|
|
124
|
+
"database-auth": "database-auth";
|
|
125
|
+
r2: "r2";
|
|
126
|
+
stripe: "stripe";
|
|
127
|
+
}>>;
|
|
128
|
+
identity: z.ZodEnum<{
|
|
129
|
+
none: "none";
|
|
130
|
+
"better-auth-d1-v1": "better-auth-d1-v1";
|
|
131
|
+
}>;
|
|
132
|
+
cliArtifact: z.ZodObject<{
|
|
133
|
+
version: z.ZodString;
|
|
134
|
+
sourceRevision: z.ZodString;
|
|
135
|
+
packageIntegrity: z.ZodString;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
intent: z.ZodObject<{
|
|
138
|
+
contractVersion: z.ZodLiteral<1>;
|
|
139
|
+
runtimeProfile: z.ZodLiteral<"anhedral-stack">;
|
|
140
|
+
environment: z.ZodEnum<{
|
|
141
|
+
production: "production";
|
|
142
|
+
preview: "preview";
|
|
143
|
+
}>;
|
|
144
|
+
visibility: z.ZodEnum<{
|
|
145
|
+
protected: "protected";
|
|
146
|
+
public: "public";
|
|
147
|
+
}>;
|
|
148
|
+
}, z.core.$strict>;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
}, z.core.$strict>;
|
|
151
|
+
export declare const cliPlanBlockerSchema: z.ZodEnum<{
|
|
152
|
+
HOSTED_ADMISSION_DISABLED: "HOSTED_ADMISSION_DISABLED";
|
|
153
|
+
ARTIFACT_UNREVIEWED: "ARTIFACT_UNREVIEWED";
|
|
154
|
+
CONFIGURATION_UNVERIFIED: "CONFIGURATION_UNVERIFIED";
|
|
155
|
+
RUNTIME_UNAVAILABLE: "RUNTIME_UNAVAILABLE";
|
|
156
|
+
ARTIFACT_MISMATCH: "ARTIFACT_MISMATCH";
|
|
157
|
+
SOURCE_VERSION_MISMATCH: "SOURCE_VERSION_MISMATCH";
|
|
158
|
+
DEPENDENCY_LOCK_MISMATCH: "DEPENDENCY_LOCK_MISMATCH";
|
|
159
|
+
}>;
|
|
160
|
+
export declare const cliPlanAdmissionSchema: z.ZodObject<{
|
|
161
|
+
version: z.ZodLiteral<1>;
|
|
162
|
+
expectedCliArtifact: z.ZodNullable<z.ZodObject<{
|
|
163
|
+
version: z.ZodString;
|
|
164
|
+
sourceRevision: z.ZodString;
|
|
165
|
+
packageIntegrity: z.ZodString;
|
|
166
|
+
}, z.core.$strict>>;
|
|
167
|
+
supportedCompositions: z.ZodArray<z.ZodObject<{
|
|
168
|
+
dependencyLockDigest: z.ZodString;
|
|
169
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
170
|
+
hono: "hono";
|
|
171
|
+
"database-auth": "database-auth";
|
|
172
|
+
r2: "r2";
|
|
173
|
+
stripe: "stripe";
|
|
174
|
+
}>>;
|
|
175
|
+
}, z.core.$strict>>;
|
|
176
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
177
|
+
code: z.ZodEnum<{
|
|
178
|
+
HOSTED_ADMISSION_DISABLED: "HOSTED_ADMISSION_DISABLED";
|
|
179
|
+
ARTIFACT_UNREVIEWED: "ARTIFACT_UNREVIEWED";
|
|
180
|
+
CONFIGURATION_UNVERIFIED: "CONFIGURATION_UNVERIFIED";
|
|
181
|
+
RUNTIME_UNAVAILABLE: "RUNTIME_UNAVAILABLE";
|
|
182
|
+
ARTIFACT_MISMATCH: "ARTIFACT_MISMATCH";
|
|
183
|
+
SOURCE_VERSION_MISMATCH: "SOURCE_VERSION_MISMATCH";
|
|
184
|
+
DEPENDENCY_LOCK_MISMATCH: "DEPENDENCY_LOCK_MISMATCH";
|
|
185
|
+
}>;
|
|
186
|
+
message: z.ZodString;
|
|
187
|
+
action: z.ZodString;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
export declare const cliPlanSchema: z.ZodObject<{
|
|
191
|
+
protocol: z.ZodLiteral<1>;
|
|
192
|
+
id: z.ZodUUID;
|
|
193
|
+
requestId: z.ZodUUID;
|
|
194
|
+
projectId: z.ZodUUID;
|
|
195
|
+
uploadId: z.ZodUUID;
|
|
196
|
+
digest: z.ZodString;
|
|
197
|
+
manifest: z.ZodObject<{
|
|
198
|
+
contractVersion: z.ZodLiteral<1>;
|
|
199
|
+
foundation: z.ZodLiteral<"tanstack-start">;
|
|
200
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
201
|
+
hono: "hono";
|
|
202
|
+
"database-auth": "database-auth";
|
|
203
|
+
r2: "r2";
|
|
204
|
+
stripe: "stripe";
|
|
205
|
+
}>>;
|
|
206
|
+
identity: z.ZodEnum<{
|
|
207
|
+
none: "none";
|
|
208
|
+
"better-auth-d1-v1": "better-auth-d1-v1";
|
|
209
|
+
}>;
|
|
210
|
+
cliArtifact: z.ZodObject<{
|
|
211
|
+
version: z.ZodString;
|
|
212
|
+
sourceRevision: z.ZodString;
|
|
213
|
+
packageIntegrity: z.ZodString;
|
|
214
|
+
}, z.core.$strict>;
|
|
215
|
+
intent: z.ZodObject<{
|
|
216
|
+
contractVersion: z.ZodLiteral<1>;
|
|
217
|
+
runtimeProfile: z.ZodLiteral<"anhedral-stack">;
|
|
218
|
+
environment: z.ZodEnum<{
|
|
219
|
+
production: "production";
|
|
220
|
+
preview: "preview";
|
|
221
|
+
}>;
|
|
222
|
+
visibility: z.ZodEnum<{
|
|
223
|
+
protected: "protected";
|
|
224
|
+
public: "public";
|
|
225
|
+
}>;
|
|
226
|
+
}, z.core.$strict>;
|
|
227
|
+
}, z.core.$strict>;
|
|
228
|
+
sourceRevision: z.ZodString;
|
|
229
|
+
inventoryDigest: z.ZodString;
|
|
230
|
+
lockDigest: z.ZodString;
|
|
231
|
+
routing: z.ZodObject<{
|
|
232
|
+
generation: z.ZodNumber;
|
|
233
|
+
activeReleaseId: z.ZodNullable<z.ZodUUID>;
|
|
234
|
+
desiredReleaseId: z.ZodNullable<z.ZodUUID>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
routingRevision: z.ZodString;
|
|
237
|
+
expectedGeneration: z.ZodNumber;
|
|
238
|
+
policyDigest: z.ZodString;
|
|
239
|
+
migrationDigests: z.ZodArray<z.ZodString>;
|
|
240
|
+
expiresAt: z.ZodISODateTime;
|
|
241
|
+
runtimeImage: z.ZodNullable<z.ZodString>;
|
|
242
|
+
configurationRevision: z.ZodNull;
|
|
243
|
+
artifactVerified: z.ZodBoolean;
|
|
244
|
+
hostedAdmission: z.ZodBoolean;
|
|
245
|
+
identityAction: z.ZodLiteral<"preserve">;
|
|
246
|
+
blockers: z.ZodArray<z.ZodEnum<{
|
|
247
|
+
HOSTED_ADMISSION_DISABLED: "HOSTED_ADMISSION_DISABLED";
|
|
248
|
+
ARTIFACT_UNREVIEWED: "ARTIFACT_UNREVIEWED";
|
|
249
|
+
CONFIGURATION_UNVERIFIED: "CONFIGURATION_UNVERIFIED";
|
|
250
|
+
RUNTIME_UNAVAILABLE: "RUNTIME_UNAVAILABLE";
|
|
251
|
+
ARTIFACT_MISMATCH: "ARTIFACT_MISMATCH";
|
|
252
|
+
SOURCE_VERSION_MISMATCH: "SOURCE_VERSION_MISMATCH";
|
|
253
|
+
DEPENDENCY_LOCK_MISMATCH: "DEPENDENCY_LOCK_MISMATCH";
|
|
254
|
+
}>>;
|
|
255
|
+
admission: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
version: z.ZodLiteral<1>;
|
|
257
|
+
expectedCliArtifact: z.ZodNullable<z.ZodObject<{
|
|
258
|
+
version: z.ZodString;
|
|
259
|
+
sourceRevision: z.ZodString;
|
|
260
|
+
packageIntegrity: z.ZodString;
|
|
261
|
+
}, z.core.$strict>>;
|
|
262
|
+
supportedCompositions: z.ZodArray<z.ZodObject<{
|
|
263
|
+
dependencyLockDigest: z.ZodString;
|
|
264
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
265
|
+
hono: "hono";
|
|
266
|
+
"database-auth": "database-auth";
|
|
267
|
+
r2: "r2";
|
|
268
|
+
stripe: "stripe";
|
|
269
|
+
}>>;
|
|
270
|
+
}, z.core.$strict>>;
|
|
271
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
272
|
+
code: z.ZodEnum<{
|
|
273
|
+
HOSTED_ADMISSION_DISABLED: "HOSTED_ADMISSION_DISABLED";
|
|
274
|
+
ARTIFACT_UNREVIEWED: "ARTIFACT_UNREVIEWED";
|
|
275
|
+
CONFIGURATION_UNVERIFIED: "CONFIGURATION_UNVERIFIED";
|
|
276
|
+
RUNTIME_UNAVAILABLE: "RUNTIME_UNAVAILABLE";
|
|
277
|
+
ARTIFACT_MISMATCH: "ARTIFACT_MISMATCH";
|
|
278
|
+
SOURCE_VERSION_MISMATCH: "SOURCE_VERSION_MISMATCH";
|
|
279
|
+
DEPENDENCY_LOCK_MISMATCH: "DEPENDENCY_LOCK_MISMATCH";
|
|
280
|
+
}>;
|
|
281
|
+
message: z.ZodString;
|
|
282
|
+
action: z.ZodString;
|
|
283
|
+
}, z.core.$strict>>;
|
|
284
|
+
}, z.core.$strict>>;
|
|
285
|
+
}, z.core.$strict>;
|
|
286
|
+
export declare const cliPrepareInputSchema: z.ZodObject<{
|
|
287
|
+
protocol: z.ZodLiteral<1>;
|
|
288
|
+
requestId: z.ZodUUID;
|
|
289
|
+
planId: z.ZodUUID;
|
|
290
|
+
planDigest: z.ZodString;
|
|
291
|
+
}, z.core.$strict>;
|
|
292
|
+
export declare const cliPreparationSchema: z.ZodObject<{
|
|
293
|
+
protocol: z.ZodLiteral<1>;
|
|
294
|
+
planId: z.ZodUUID;
|
|
295
|
+
planDigest: z.ZodString;
|
|
296
|
+
candidateId: z.ZodUUID;
|
|
297
|
+
sourceRevision: z.ZodString;
|
|
298
|
+
state: z.ZodEnum<{
|
|
299
|
+
ready: "ready";
|
|
300
|
+
failed: "failed";
|
|
301
|
+
building: "building";
|
|
302
|
+
"awaiting-runtime": "awaiting-runtime";
|
|
303
|
+
built: "built";
|
|
304
|
+
}>;
|
|
305
|
+
buildDigest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
306
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
307
|
+
admission: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
308
|
+
policyDigest: z.ZodString;
|
|
309
|
+
image: z.ZodString;
|
|
310
|
+
scope: z.ZodLiteral<"candidate-workspace">;
|
|
311
|
+
}, z.core.$strict>>>;
|
|
312
|
+
hostedAdmission: z.ZodBoolean;
|
|
313
|
+
identityAction: z.ZodLiteral<"preserve">;
|
|
314
|
+
}, z.core.$strict>;
|
|
315
|
+
/** Canonical JSON for immutable plan and request digests across SQL JSONB and clients. */
|
|
316
|
+
export declare function canonicalCliJson(value: unknown): string;
|