anhedral 0.17.0 → 0.18.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 +11 -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/request-context.ts.txt +3 -0
- package/assets/launch/root.tsx.txt +27 -0
- package/assets/launch/router.tsx.txt +21 -0
- package/assets/launch/server.ts.txt +13 -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/event-retention.sql.txt +10 -0
- package/assets/stack/stripe.ts.txt +30 -13
- package/dist/bin.js +55 -36
- package/dist/capabilities.d.ts +1 -1
- package/dist/capability-catalog.d.ts +44 -11
- package/dist/capability-catalog.js +96 -11
- package/dist/capability-command.d.ts +2 -2
- package/dist/capability-command.js +178 -27
- package/dist/capability-editor.js +6 -5
- package/dist/capability-recipes.js +54 -6
- 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 +30 -6
- 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.d.ts +1 -0
- package/dist/command-runner.js +88 -0
- package/dist/command-schema.d.ts +16 -0
- package/dist/command-schema.js +390 -21
- package/dist/completion.d.ts +2 -0
- package/dist/completion.js +201 -0
- package/dist/composition.d.ts +35 -0
- package/dist/composition.js +28 -0
- package/dist/contracts/cli-transport.d.ts +217 -0
- package/dist/contracts/cli-transport.js +167 -0
- package/dist/contracts/deployment.d.ts +282 -0
- package/dist/contracts/deployment.js +234 -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/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 +10 -1
- package/dist/dependencies.js +18 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/launch.d.ts +21 -0
- package/dist/launch.js +250 -0
- package/dist/platform-command.d.ts +9 -0
- package/dist/platform-command.js +584 -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-source.d.ts +8 -0
- package/dist/platform-source.js +111 -0
- package/dist/platform-state.d.ts +13 -0
- package/dist/platform-state.js +207 -0
- package/dist/platforms/tanstack.d.ts +8 -0
- package/dist/platforms/tanstack.js +155 -0
- package/dist/registry/options.js +34 -31
- package/dist/registry/usage.d.ts +4 -1
- package/dist/registry/usage.js +58 -4
- package/dist/scaffold/styling.d.ts +1 -1
- package/dist/scaffold/workspace.js +11 -1
- package/dist/stack-registry.d.ts +2 -2
- package/dist/standard.js +21 -6
- package/dist/transaction.js +28 -3
- package/dist/ui-command.d.ts +4 -2
- package/dist/ui-command.js +79 -38
- package/dist/ui-project.d.ts +2 -0
- package/dist/ui-project.js +38 -8
- package/dist/util.js +40 -61
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/capabilities.md +22 -88
- package/docs/software-factory.md +169 -9
- package/docs/stack-standard.md +7 -17
- package/docs/ui.md +9 -22
- package/package.json +27 -20
- 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/bin.js
CHANGED
|
@@ -3,22 +3,53 @@ import { argv } from 'node:process';
|
|
|
3
3
|
import { runCommand } from './cli-commands.js';
|
|
4
4
|
import { STANDARD_USAGE, commandHelp } from './registry/usage.js';
|
|
5
5
|
import { GENERATOR_VERSION } from './version.js';
|
|
6
|
-
import {
|
|
6
|
+
import { describeFailure } from './cli-errors.js';
|
|
7
|
+
import { commandDefinition, GLOBAL_OPTIONS } from './command-schema.js';
|
|
7
8
|
import { CliArgumentError, globalArguments, inlineArguments, validateCommand, } from './cli-arguments.js';
|
|
8
|
-
|
|
9
|
-
let
|
|
9
|
+
const input = argv.slice(2);
|
|
10
|
+
let [command, ...args] = input;
|
|
11
|
+
const separator = input.indexOf('--');
|
|
12
|
+
let json = input.slice(0, separator < 0 ? undefined : separator).includes('--json');
|
|
13
|
+
function beforeSeparator(values) {
|
|
14
|
+
const end = values.indexOf('--');
|
|
15
|
+
return values.slice(0, end < 0 ? undefined : end);
|
|
16
|
+
}
|
|
10
17
|
function helpRequested() {
|
|
11
18
|
return ([undefined, '--help', '-h', 'help'].includes(command) ||
|
|
12
|
-
args.
|
|
13
|
-
args.includes('-h'));
|
|
19
|
+
beforeSeparator(args).some((arg) => arg === '--help' || arg === '-h'));
|
|
14
20
|
}
|
|
15
21
|
function printHelp() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
let topics = [];
|
|
23
|
+
if (command === 'help') {
|
|
24
|
+
topics = beforeSeparator(args).filter((arg) => !['--json', '--help', '-h'].includes(arg));
|
|
25
|
+
}
|
|
26
|
+
else if (command && !['--help', '-h'].includes(command)) {
|
|
27
|
+
topics = [command];
|
|
28
|
+
let definition = commandDefinition(command);
|
|
29
|
+
const options = [...(definition?.options ?? []), ...GLOBAL_OPTIONS];
|
|
30
|
+
const values = beforeSeparator(args);
|
|
31
|
+
let leafArguments = 0;
|
|
32
|
+
for (let index = 0; index < values.length; index++) {
|
|
33
|
+
const value = values[index];
|
|
34
|
+
if (value.startsWith('-')) {
|
|
35
|
+
const option = options.find((item) => item.flag === value || item.aliases?.includes(value));
|
|
36
|
+
if (option?.arity && values[index + 1] && !values[index + 1].startsWith('-'))
|
|
37
|
+
index++;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (!definition?.children) {
|
|
41
|
+
leafArguments++;
|
|
42
|
+
if (leafArguments > (definition?.positional?.max ?? 0))
|
|
43
|
+
throw new CliArgumentError('Unknown help topic.', `Run anhedral ${topics.join(' ')} --help.`);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
topics.push(value);
|
|
47
|
+
definition = definition.children[value];
|
|
48
|
+
if (!definition)
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const help = topics.length ? commandHelp(topics) : STANDARD_USAGE;
|
|
22
53
|
if (!help)
|
|
23
54
|
throw new CliArgumentError('Unknown help topic.', 'Run anhedral --help.');
|
|
24
55
|
console.log(json ? JSON.stringify({ usage: help }) : help);
|
|
@@ -32,11 +63,13 @@ function selectDirectory(directory) {
|
|
|
32
63
|
}
|
|
33
64
|
}
|
|
34
65
|
async function main() {
|
|
35
|
-
const global = globalArguments(
|
|
66
|
+
const global = globalArguments(input);
|
|
36
67
|
[command, ...args] = global.args;
|
|
37
68
|
json = global.json;
|
|
38
|
-
if (json)
|
|
39
|
-
args.
|
|
69
|
+
if (json) {
|
|
70
|
+
const end = args.indexOf('--');
|
|
71
|
+
args.splice(end < 0 ? args.length : end, 0, '--json');
|
|
72
|
+
}
|
|
40
73
|
args = inlineArguments(command, args);
|
|
41
74
|
if (helpRequested())
|
|
42
75
|
return printHelp();
|
|
@@ -51,32 +84,18 @@ async function main() {
|
|
|
51
84
|
process.env.ANHEDRAL_QUIET = '1';
|
|
52
85
|
if (global.verbose && !json && !global.quiet)
|
|
53
86
|
process.env.ANHEDRAL_VERBOSE = '1';
|
|
54
|
-
await runCommand(command, args, {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return 'POST_COMMIT_FAILED';
|
|
61
|
-
return command === 'init'
|
|
62
|
-
? 'GENERATION_FAILED'
|
|
63
|
-
: command === 'add' || command === 'stack'
|
|
64
|
-
? 'CAPABILITY_COMMAND_FAILED'
|
|
65
|
-
: command === 'ui'
|
|
66
|
-
? 'UI_COMMAND_FAILED'
|
|
67
|
-
: 'UNKNOWN_COMMAND';
|
|
87
|
+
await runCommand(command, args, {
|
|
88
|
+
json,
|
|
89
|
+
quiet: global.quiet,
|
|
90
|
+
human: global.human,
|
|
91
|
+
nonInteractive: global.nonInteractive,
|
|
92
|
+
});
|
|
68
93
|
}
|
|
69
94
|
try {
|
|
70
95
|
await main();
|
|
71
96
|
}
|
|
72
97
|
catch (error) {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const nextAction = error instanceof CliArgumentError
|
|
76
|
-
? error.nextAction
|
|
77
|
-
: `Run anhedral ${command && commandHelp(command) ? command + ' ' : ''}--help.`;
|
|
78
|
-
console.error(json
|
|
79
|
-
? JSON.stringify({ error: message, code, nextAction })
|
|
80
|
-
: `Error: ${message}\nNext: ${nextAction}`);
|
|
98
|
+
const failure = describeFailure(error, command);
|
|
99
|
+
console.error(json ? JSON.stringify(failure) : `Error: ${failure.error}\nNext: ${failure.nextAction}`);
|
|
81
100
|
process.exitCode = 1;
|
|
82
101
|
}
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare function createSetupPlan(options: StandardOptions, registry?: imp
|
|
|
4
4
|
cliVersion: string;
|
|
5
5
|
root: string;
|
|
6
6
|
name: string;
|
|
7
|
-
products: ("
|
|
7
|
+
products: ("next" | "hono" | "r2" | "styling" | "d1")[];
|
|
8
8
|
dryRun: boolean;
|
|
9
9
|
registry: import("./registry/resolve.js").ResolvedStackRegistry;
|
|
10
10
|
resourcesProvisioned: boolean;
|
|
@@ -2,13 +2,13 @@ export declare const CAPABILITIES: {
|
|
|
2
2
|
readonly hono: {
|
|
3
3
|
readonly name: "Hono backend API";
|
|
4
4
|
readonly requires: readonly [];
|
|
5
|
-
readonly targets: readonly ["apps/api"];
|
|
5
|
+
readonly targets: readonly ["apps/api/package.json", "apps/api/wrangler.jsonc", "apps/api/src/index.ts", "apps/api/src/environment.ts", "apps/api/src/capabilities.ts", "apps/api/src/custom-environment.ts"];
|
|
6
6
|
readonly configuration: readonly ["ANHEDRAL_API service binding"];
|
|
7
7
|
};
|
|
8
8
|
readonly 'database-auth': {
|
|
9
9
|
readonly name: "Drizzle / D1 / Better Auth";
|
|
10
10
|
readonly requires: readonly ["hono"];
|
|
11
|
-
readonly targets: readonly ["packages/db", "apps/api/src/auth.ts"];
|
|
11
|
+
readonly targets: readonly ["packages/db/package.json", "packages/db/src/index.ts", "packages/db/src/schema.ts", "apps/api/src/auth.ts", "apps/api/src/auth-features.ts", "apps/api/src/security.ts", "apps/api/src/auth-platform.ts", "apps/api/src/features/auth.ts", "apps/web/lib/auth-client.ts"];
|
|
12
12
|
readonly configuration: readonly ["D1 resource ID", "BETTER_AUTH_SECRET", "PUBLIC_APP_URL", "explicit auth methods", "reviewed migrations"];
|
|
13
13
|
};
|
|
14
14
|
readonly r2: {
|
|
@@ -20,37 +20,37 @@ export declare const CAPABILITIES: {
|
|
|
20
20
|
readonly stripe: {
|
|
21
21
|
readonly name: "Stripe payments";
|
|
22
22
|
readonly requires: readonly ["database-auth"];
|
|
23
|
-
readonly targets: readonly ["apps/api/src/features/stripe.ts"];
|
|
23
|
+
readonly targets: readonly ["apps/api/src/features/stripe.ts", "apps/api/src/features/entitlements.ts", "apps/api/src/entitlement-guard.ts", "apps/api/src/billing-mode.ts", "apps/api/src/billing-providers.ts", "packages/db/src/billing-schema.ts"];
|
|
24
24
|
readonly configuration: readonly ["Stripe test credentials", "allowed prices", "webhook endpoint", "billing schema migration"];
|
|
25
25
|
};
|
|
26
26
|
readonly realtime: {
|
|
27
27
|
readonly name: "Realtime events";
|
|
28
28
|
readonly requires: readonly ["database-auth"];
|
|
29
|
-
readonly targets: readonly ["apps/api/src/features/events.ts"];
|
|
29
|
+
readonly targets: readonly ["apps/api/src/features/events.ts", "packages/db/src/events-schema.ts"];
|
|
30
30
|
readonly configuration: readonly ["event schema migration"];
|
|
31
31
|
};
|
|
32
32
|
readonly rtc: {
|
|
33
33
|
readonly name: "Realtime RTC";
|
|
34
34
|
readonly requires: readonly ["database-auth"];
|
|
35
|
-
readonly targets: readonly ["apps/api/src/features/rtc.ts"];
|
|
35
|
+
readonly targets: readonly ["apps/api/src/features/rtc.ts", "packages/db/src/rtc-schema.ts"];
|
|
36
36
|
readonly configuration: readonly ["Cloudflare Realtime SFU app ID and secret"];
|
|
37
37
|
};
|
|
38
38
|
readonly ai: {
|
|
39
39
|
readonly name: "Workers AI";
|
|
40
40
|
readonly requires: readonly ["database-auth"];
|
|
41
|
-
readonly targets: readonly ["apps/api/src/features/ai.ts"];
|
|
41
|
+
readonly targets: readonly ["apps/api/src/features/ai.ts", "packages/db/src/ai-schema.ts"];
|
|
42
42
|
readonly configuration: readonly ["Workers AI binding", "explicit model selection and daily quota"];
|
|
43
43
|
};
|
|
44
44
|
readonly expo: {
|
|
45
45
|
readonly name: "Expo mobile app";
|
|
46
46
|
readonly requires: readonly ["database-auth"];
|
|
47
|
-
readonly targets: readonly ["apps/mobile"];
|
|
47
|
+
readonly targets: readonly ["apps/mobile/package.json", "apps/mobile/App.tsx", "apps/mobile/anhedral-entry.tsx", "apps/mobile/lib/auth-client.ts", "apps/mobile/components/session-controls.tsx"];
|
|
48
48
|
readonly configuration: readonly ["device-reachable API URL", "trusted native origin", "native development build"];
|
|
49
49
|
};
|
|
50
50
|
readonly 'native-ui': {
|
|
51
51
|
readonly name: "Anhedral UI for Expo";
|
|
52
52
|
readonly requires: readonly ["expo"];
|
|
53
|
-
readonly targets: readonly ["apps/mobile/components.json"];
|
|
53
|
+
readonly targets: readonly ["apps/mobile/components.json", "apps/mobile/global.css", "apps/mobile/metro.config.js", "apps/mobile/components/ui/button.tsx", "apps/mobile/components/ui/text.tsx"];
|
|
54
54
|
readonly configuration: readonly ["Android/iOS interaction validation"];
|
|
55
55
|
};
|
|
56
56
|
readonly revenuecat: {
|
|
@@ -62,22 +62,55 @@ export declare const CAPABILITIES: {
|
|
|
62
62
|
readonly wxt: {
|
|
63
63
|
readonly name: "WXT browser extension";
|
|
64
64
|
readonly requires: readonly ["database-auth"];
|
|
65
|
-
readonly targets: readonly ["apps/extension"];
|
|
65
|
+
readonly targets: readonly ["apps/extension/package.json", "apps/extension/wxt.config.ts", "apps/extension/anhedral-background.ts", "apps/extension/entrypoints/background.ts"];
|
|
66
66
|
readonly configuration: readonly ["API origin and host permissions", "extension authentication flow"];
|
|
67
67
|
};
|
|
68
68
|
readonly 'side-panel': {
|
|
69
69
|
readonly name: "Side Panel API";
|
|
70
70
|
readonly requires: readonly ["wxt"];
|
|
71
|
-
readonly targets: readonly ["apps/extension/entrypoints/sidepanel"];
|
|
71
|
+
readonly targets: readonly ["apps/extension/entrypoints/sidepanel/index.html", "apps/extension/entrypoints/sidepanel/main.tsx"];
|
|
72
72
|
readonly configuration: readonly ["Chromium side panel validation"];
|
|
73
73
|
};
|
|
74
74
|
readonly gpui: {
|
|
75
75
|
readonly name: "GPUI native desktop app";
|
|
76
76
|
readonly requires: readonly ["database-auth"];
|
|
77
|
-
readonly targets: readonly ["apps/desktop"];
|
|
77
|
+
readonly targets: readonly ["apps/desktop/package.json", "apps/desktop/Cargo.toml", "apps/desktop/src/main.rs"];
|
|
78
78
|
readonly configuration: readonly ["Rust toolchain and native platform libraries", "native account flow and distribution"];
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
export type Capability = keyof typeof CAPABILITIES;
|
|
82
82
|
export declare const CAPABILITY_IDS: Capability[];
|
|
83
83
|
export declare function capabilityOrder(requested: readonly string[], installed: readonly Capability[], includeDependencies: boolean): Capability[];
|
|
84
|
+
/** The sole active public source composition. Legacy recipes above remain library compatibility. */
|
|
85
|
+
export declare const ANHEDRAL_STACK: {
|
|
86
|
+
readonly schemaVersion: 1;
|
|
87
|
+
readonly id: "anhedral-stack";
|
|
88
|
+
readonly name: "Anhedral Stack";
|
|
89
|
+
readonly foundation: {
|
|
90
|
+
readonly id: "tanstack-start";
|
|
91
|
+
readonly name: "TanStack Start + Anhedral UI";
|
|
92
|
+
readonly targets: readonly ["apps/web/package.json", "apps/web/src/router.tsx", "apps/web/src/server.ts", "apps/web/src/routes/__root.tsx", "apps/web/src/routes/index.tsx"];
|
|
93
|
+
};
|
|
94
|
+
readonly additions: {
|
|
95
|
+
readonly backend: {
|
|
96
|
+
readonly name: "Backend";
|
|
97
|
+
readonly description: "API, database and authentication together.";
|
|
98
|
+
readonly requires: string[];
|
|
99
|
+
readonly targets: readonly ["apps/api/package.json", "apps/api/wrangler.jsonc", "apps/api/src/index.ts", "apps/api/src/environment.ts", "apps/api/src/capabilities.ts", "apps/api/src/custom-environment.ts", ...("packages/db/package.json" | "packages/db/src/index.ts" | "packages/db/src/schema.ts" | "apps/api/src/auth.ts" | "apps/api/src/auth-features.ts" | "apps/api/src/security.ts" | "apps/api/src/auth-platform.ts" | "apps/api/src/features/auth.ts" | "apps/web/src/lib/auth-client.ts")[]];
|
|
100
|
+
};
|
|
101
|
+
readonly r2: {
|
|
102
|
+
readonly name: "Private storage";
|
|
103
|
+
readonly description: "Authenticated, owner-scoped object storage.";
|
|
104
|
+
readonly requires: readonly ["backend"];
|
|
105
|
+
readonly targets: readonly ["apps/api/src/features/storage.ts"];
|
|
106
|
+
};
|
|
107
|
+
readonly stripe: {
|
|
108
|
+
readonly name: "Payments and subscriptions";
|
|
109
|
+
readonly description: "Stripe subscription and entitlement source.";
|
|
110
|
+
readonly requires: readonly ["backend"];
|
|
111
|
+
readonly targets: readonly ["apps/api/src/features/stripe.ts", "apps/api/src/features/entitlements.ts", "apps/api/src/entitlement-guard.ts", "apps/api/src/billing-mode.ts", "apps/api/src/billing-providers.ts", "packages/db/src/billing-schema.ts"];
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export type PublicStackAddition = keyof typeof ANHEDRAL_STACK.additions;
|
|
116
|
+
export declare const PUBLIC_STACK_ADDITIONS: PublicStackAddition[];
|
|
@@ -2,13 +2,30 @@ export const CAPABILITIES = {
|
|
|
2
2
|
hono: {
|
|
3
3
|
name: 'Hono backend API',
|
|
4
4
|
requires: [],
|
|
5
|
-
targets: [
|
|
5
|
+
targets: [
|
|
6
|
+
'apps/api/package.json',
|
|
7
|
+
'apps/api/wrangler.jsonc',
|
|
8
|
+
'apps/api/src/index.ts',
|
|
9
|
+
'apps/api/src/environment.ts',
|
|
10
|
+
'apps/api/src/capabilities.ts',
|
|
11
|
+
'apps/api/src/custom-environment.ts',
|
|
12
|
+
],
|
|
6
13
|
configuration: ['ANHEDRAL_API service binding'],
|
|
7
14
|
},
|
|
8
15
|
'database-auth': {
|
|
9
16
|
name: 'Drizzle / D1 / Better Auth',
|
|
10
17
|
requires: ['hono'],
|
|
11
|
-
targets: [
|
|
18
|
+
targets: [
|
|
19
|
+
'packages/db/package.json',
|
|
20
|
+
'packages/db/src/index.ts',
|
|
21
|
+
'packages/db/src/schema.ts',
|
|
22
|
+
'apps/api/src/auth.ts',
|
|
23
|
+
'apps/api/src/auth-features.ts',
|
|
24
|
+
'apps/api/src/security.ts',
|
|
25
|
+
'apps/api/src/auth-platform.ts',
|
|
26
|
+
'apps/api/src/features/auth.ts',
|
|
27
|
+
'apps/web/lib/auth-client.ts',
|
|
28
|
+
],
|
|
12
29
|
configuration: [
|
|
13
30
|
'D1 resource ID',
|
|
14
31
|
'BETTER_AUTH_SECRET',
|
|
@@ -26,7 +43,14 @@ export const CAPABILITIES = {
|
|
|
26
43
|
stripe: {
|
|
27
44
|
name: 'Stripe payments',
|
|
28
45
|
requires: ['database-auth'],
|
|
29
|
-
targets: [
|
|
46
|
+
targets: [
|
|
47
|
+
'apps/api/src/features/stripe.ts',
|
|
48
|
+
'apps/api/src/features/entitlements.ts',
|
|
49
|
+
'apps/api/src/entitlement-guard.ts',
|
|
50
|
+
'apps/api/src/billing-mode.ts',
|
|
51
|
+
'apps/api/src/billing-providers.ts',
|
|
52
|
+
'packages/db/src/billing-schema.ts',
|
|
53
|
+
],
|
|
30
54
|
configuration: [
|
|
31
55
|
'Stripe test credentials',
|
|
32
56
|
'allowed prices',
|
|
@@ -37,25 +61,31 @@ export const CAPABILITIES = {
|
|
|
37
61
|
realtime: {
|
|
38
62
|
name: 'Realtime events',
|
|
39
63
|
requires: ['database-auth'],
|
|
40
|
-
targets: ['apps/api/src/features/events.ts'],
|
|
64
|
+
targets: ['apps/api/src/features/events.ts', 'packages/db/src/events-schema.ts'],
|
|
41
65
|
configuration: ['event schema migration'],
|
|
42
66
|
},
|
|
43
67
|
rtc: {
|
|
44
68
|
name: 'Realtime RTC',
|
|
45
69
|
requires: ['database-auth'],
|
|
46
|
-
targets: ['apps/api/src/features/rtc.ts'],
|
|
70
|
+
targets: ['apps/api/src/features/rtc.ts', 'packages/db/src/rtc-schema.ts'],
|
|
47
71
|
configuration: ['Cloudflare Realtime SFU app ID and secret'],
|
|
48
72
|
},
|
|
49
73
|
ai: {
|
|
50
74
|
name: 'Workers AI',
|
|
51
75
|
requires: ['database-auth'],
|
|
52
|
-
targets: ['apps/api/src/features/ai.ts'],
|
|
76
|
+
targets: ['apps/api/src/features/ai.ts', 'packages/db/src/ai-schema.ts'],
|
|
53
77
|
configuration: ['Workers AI binding', 'explicit model selection and daily quota'],
|
|
54
78
|
},
|
|
55
79
|
expo: {
|
|
56
80
|
name: 'Expo mobile app',
|
|
57
81
|
requires: ['database-auth'],
|
|
58
|
-
targets: [
|
|
82
|
+
targets: [
|
|
83
|
+
'apps/mobile/package.json',
|
|
84
|
+
'apps/mobile/App.tsx',
|
|
85
|
+
'apps/mobile/anhedral-entry.tsx',
|
|
86
|
+
'apps/mobile/lib/auth-client.ts',
|
|
87
|
+
'apps/mobile/components/session-controls.tsx',
|
|
88
|
+
],
|
|
59
89
|
configuration: [
|
|
60
90
|
'device-reachable API URL',
|
|
61
91
|
'trusted native origin',
|
|
@@ -65,7 +95,13 @@ export const CAPABILITIES = {
|
|
|
65
95
|
'native-ui': {
|
|
66
96
|
name: 'Anhedral UI for Expo',
|
|
67
97
|
requires: ['expo'],
|
|
68
|
-
targets: [
|
|
98
|
+
targets: [
|
|
99
|
+
'apps/mobile/components.json',
|
|
100
|
+
'apps/mobile/global.css',
|
|
101
|
+
'apps/mobile/metro.config.js',
|
|
102
|
+
'apps/mobile/components/ui/button.tsx',
|
|
103
|
+
'apps/mobile/components/ui/text.tsx',
|
|
104
|
+
],
|
|
69
105
|
configuration: ['Android/iOS interaction validation'],
|
|
70
106
|
},
|
|
71
107
|
revenuecat: {
|
|
@@ -80,19 +116,27 @@ export const CAPABILITIES = {
|
|
|
80
116
|
wxt: {
|
|
81
117
|
name: 'WXT browser extension',
|
|
82
118
|
requires: ['database-auth'],
|
|
83
|
-
targets: [
|
|
119
|
+
targets: [
|
|
120
|
+
'apps/extension/package.json',
|
|
121
|
+
'apps/extension/wxt.config.ts',
|
|
122
|
+
'apps/extension/anhedral-background.ts',
|
|
123
|
+
'apps/extension/entrypoints/background.ts',
|
|
124
|
+
],
|
|
84
125
|
configuration: ['API origin and host permissions', 'extension authentication flow'],
|
|
85
126
|
},
|
|
86
127
|
'side-panel': {
|
|
87
128
|
name: 'Side Panel API',
|
|
88
129
|
requires: ['wxt'],
|
|
89
|
-
targets: [
|
|
130
|
+
targets: [
|
|
131
|
+
'apps/extension/entrypoints/sidepanel/index.html',
|
|
132
|
+
'apps/extension/entrypoints/sidepanel/main.tsx',
|
|
133
|
+
],
|
|
90
134
|
configuration: ['Chromium side panel validation'],
|
|
91
135
|
},
|
|
92
136
|
gpui: {
|
|
93
137
|
name: 'GPUI native desktop app',
|
|
94
138
|
requires: ['database-auth'],
|
|
95
|
-
targets: ['apps/desktop'],
|
|
139
|
+
targets: ['apps/desktop/package.json', 'apps/desktop/Cargo.toml', 'apps/desktop/src/main.rs'],
|
|
96
140
|
configuration: [
|
|
97
141
|
'Rust toolchain and native platform libraries',
|
|
98
142
|
'native account flow and distribution',
|
|
@@ -119,3 +163,44 @@ export function capabilityOrder(requested, installed, includeDependencies) {
|
|
|
119
163
|
visit(id);
|
|
120
164
|
return [...selected];
|
|
121
165
|
}
|
|
166
|
+
/** The sole active public source composition. Legacy recipes above remain library compatibility. */
|
|
167
|
+
export const ANHEDRAL_STACK = {
|
|
168
|
+
schemaVersion: 1,
|
|
169
|
+
id: 'anhedral-stack',
|
|
170
|
+
name: 'Anhedral Stack',
|
|
171
|
+
foundation: {
|
|
172
|
+
id: 'tanstack-start',
|
|
173
|
+
name: 'TanStack Start + Anhedral UI',
|
|
174
|
+
targets: [
|
|
175
|
+
'apps/web/package.json',
|
|
176
|
+
'apps/web/src/router.tsx',
|
|
177
|
+
'apps/web/src/server.ts',
|
|
178
|
+
'apps/web/src/routes/__root.tsx',
|
|
179
|
+
'apps/web/src/routes/index.tsx',
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
additions: {
|
|
183
|
+
backend: {
|
|
184
|
+
name: 'Backend',
|
|
185
|
+
description: 'API, database and authentication together.',
|
|
186
|
+
requires: [],
|
|
187
|
+
targets: [
|
|
188
|
+
...CAPABILITIES.hono.targets,
|
|
189
|
+
...CAPABILITIES['database-auth'].targets.map((target) => target === 'apps/web/lib/auth-client.ts' ? 'apps/web/src/lib/auth-client.ts' : target),
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
r2: {
|
|
193
|
+
name: 'Private storage',
|
|
194
|
+
description: 'Authenticated, owner-scoped object storage.',
|
|
195
|
+
requires: ['backend'],
|
|
196
|
+
targets: [...CAPABILITIES.r2.targets],
|
|
197
|
+
},
|
|
198
|
+
stripe: {
|
|
199
|
+
name: 'Payments and subscriptions',
|
|
200
|
+
description: 'Stripe subscription and entitlement source.',
|
|
201
|
+
requires: ['backend'],
|
|
202
|
+
targets: [...CAPABILITIES.stripe.targets],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
export const PUBLIC_STACK_ADDITIONS = Object.keys(ANHEDRAL_STACK.additions);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type OutputOptions } from './cli-output.js';
|
|
2
2
|
import type { StandardRunner } from './registry/types.js';
|
|
3
|
-
export declare function runCapabilityCommand(command: 'add' | 'stack', args: string[], output: OutputOptions, run?: StandardRunner): Promise<void>;
|
|
3
|
+
export declare function runCapabilityCommand(command: 'add' | 'stack', args: string[], output: OutputOptions, run?: StandardRunner, scope?: 'compatibility' | 'public'): Promise<void>;
|