anhedral 0.18.0 → 0.20.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.
Files changed (128) hide show
  1. package/README.md +10 -6
  2. package/assets/contracts/deployment-provenance.json +6 -6
  3. package/assets/contracts/operations-provenance.json +2 -1
  4. package/assets/launch/oj/OJ.LICENSE +21 -0
  5. package/assets/launch/oj/run.mjs +82 -0
  6. package/assets/launch/oj/runtime.json +21 -0
  7. package/assets/launch/root.tsx.txt +1 -2
  8. package/assets/launch/server.ts.txt +4 -2
  9. package/assets/ui/catalog.json +36 -324
  10. package/dist/{platforms/web.d.ts → api-proxy.d.ts} +1 -3
  11. package/dist/api-proxy.js +48 -0
  12. package/dist/capability-catalog.d.ts +3 -57
  13. package/dist/capability-catalog.js +3 -90
  14. package/dist/capability-command.d.ts +10 -2
  15. package/dist/capability-command.js +35 -99
  16. package/dist/capability-editor.js +21 -1
  17. package/dist/capability-recipes.js +8 -343
  18. package/dist/cli-commands.js +6 -1
  19. package/dist/command-schema.js +141 -2
  20. package/dist/command-types.d.ts +1 -0
  21. package/dist/composition.d.ts +4 -14
  22. package/dist/composition.js +6 -6
  23. package/dist/contracts/cli-transport.d.ts +139 -40
  24. package/dist/contracts/cli-transport.js +96 -27
  25. package/dist/contracts/deployment.d.ts +7 -56
  26. package/dist/contracts/deployment.js +9 -45
  27. package/dist/contracts/production-transport.d.ts +71 -0
  28. package/dist/contracts/production-transport.js +56 -0
  29. package/dist/contracts/source-profile.js +1 -1
  30. package/dist/contracts/staging-transport.d.ts +2 -2
  31. package/dist/credential-helper.d.ts +2 -0
  32. package/dist/credential-helper.js +44 -0
  33. package/dist/dependencies.d.ts +0 -27
  34. package/dist/dependencies.js +3 -67
  35. package/dist/index.d.ts +0 -4
  36. package/dist/index.js +0 -2
  37. package/dist/launch.d.ts +11 -5
  38. package/dist/launch.js +21 -9
  39. package/dist/platform-command.js +245 -42
  40. package/dist/platform-production.d.ts +16 -0
  41. package/dist/platform-production.js +135 -0
  42. package/dist/platform-state.d.ts +4 -1
  43. package/dist/platform-state.js +28 -5
  44. package/dist/platforms/tanstack.d.ts +2 -0
  45. package/dist/platforms/tanstack.js +113 -20
  46. package/dist/registry/usage.js +3 -1
  47. package/dist/release-artifact.d.ts +18 -0
  48. package/dist/release-artifact.js +169 -0
  49. package/dist/scaffold/bootstrap.d.ts +3 -3
  50. package/dist/scaffold/styling.d.ts +3 -2
  51. package/dist/stack-update.d.ts +39 -0
  52. package/dist/stack-update.js +346 -0
  53. package/dist/transaction.d.ts +1 -0
  54. package/dist/transaction.js +2 -0
  55. package/dist/ui-catalog.d.ts +3 -5
  56. package/dist/ui-catalog.js +8 -24
  57. package/dist/ui-command.d.ts +1 -1
  58. package/dist/ui-command.js +18 -57
  59. package/dist/ui-project.d.ts +2 -2
  60. package/dist/ui-project.js +8 -36
  61. package/dist/version.d.ts +1 -1
  62. package/dist/version.js +1 -1
  63. package/docs/capabilities.md +7 -7
  64. package/docs/software-factory.md +83 -16
  65. package/docs/stack-standard.md +1 -1
  66. package/package.json +1 -4
  67. package/assets/stack/ai-schema.ts.txt +0 -5
  68. package/assets/stack/ai.ts.txt +0 -30
  69. package/assets/stack/desktop.rs.txt +0 -21
  70. package/assets/stack/event-retention.sql.txt +0 -10
  71. package/assets/stack/events-schema.ts.txt +0 -12
  72. package/assets/stack/events.ts.txt +0 -59
  73. package/assets/stack/mobile-auth.ts.txt +0 -25
  74. package/assets/stack/mobile-billing.tsx.txt +0 -63
  75. package/assets/stack/mobile-session.tsx.txt +0 -83
  76. package/assets/stack/native-button.tsx.txt +0 -108
  77. package/assets/stack/native-global.css.txt +0 -4
  78. package/assets/stack/native-lib-utils.ts.txt +0 -5
  79. package/assets/stack/native-metro.config.js.txt +0 -6
  80. package/assets/stack/native-nativewind-env.d.ts.txt +0 -1
  81. package/assets/stack/native-tailwind.config.js.txt +0 -73
  82. package/assets/stack/native-text.tsx.txt +0 -89
  83. package/assets/stack/purchases.ts.txt +0 -65
  84. package/assets/stack/revenuecat.ts.txt +0 -88
  85. package/assets/stack/rtc-schema.ts.txt +0 -10
  86. package/assets/stack/rtc.ts.txt +0 -122
  87. package/assets/stack/web-sign-in.tsx.txt +0 -51
  88. package/dist/capabilities.d.ts +0 -11
  89. package/dist/capabilities.js +0 -14
  90. package/dist/dependency-order.d.ts +0 -2
  91. package/dist/dependency-order.js +0 -24
  92. package/dist/platforms/lint.d.ts +0 -1
  93. package/dist/platforms/lint.js +0 -5
  94. package/dist/platforms/web.js +0 -251
  95. package/dist/project-config.d.ts +0 -3
  96. package/dist/project-config.js +0 -16
  97. package/dist/registry/context.d.ts +0 -3
  98. package/dist/registry/context.js +0 -20
  99. package/dist/registry/options.d.ts +0 -2
  100. package/dist/registry/options.js +0 -47
  101. package/dist/registry/resolve.d.ts +0 -11
  102. package/dist/registry/resolve.js +0 -46
  103. package/dist/registry/types.d.ts +0 -60
  104. package/dist/scaffold/api.d.ts +0 -2
  105. package/dist/scaffold/api.js +0 -38
  106. package/dist/scaffold/backend.d.ts +0 -2
  107. package/dist/scaffold/backend.js +0 -36
  108. package/dist/scaffold/compose.d.ts +0 -4
  109. package/dist/scaffold/compose.js +0 -30
  110. package/dist/scaffold/database.d.ts +0 -2
  111. package/dist/scaffold/database.js +0 -41
  112. package/dist/scaffold/documentation.d.ts +0 -2
  113. package/dist/scaffold/documentation.js +0 -71
  114. package/dist/scaffold/environment.d.ts +0 -4
  115. package/dist/scaffold/environment.js +0 -22
  116. package/dist/scaffold/stack-documentation.d.ts +0 -2
  117. package/dist/scaffold/stack-documentation.js +0 -6
  118. package/dist/scaffold/storage.d.ts +0 -2
  119. package/dist/scaffold/storage.js +0 -21
  120. package/dist/scaffold/workspace.d.ts +0 -3
  121. package/dist/scaffold/workspace.js +0 -141
  122. package/dist/stack-registry.d.ts +0 -35
  123. package/dist/stack-registry.js +0 -189
  124. package/dist/standard.d.ts +0 -8
  125. package/dist/standard.js +0 -109
  126. package/dist/workspace-graph.d.ts +0 -7
  127. package/dist/workspace-graph.js +0 -74
  128. /package/dist/{registry/types.js → command-types.js} +0 -0
@@ -15,10 +15,8 @@ export function detectUiTargets(cwd, selector) {
15
15
  return;
16
16
  const manifest = readUiJson(file);
17
17
  const dependencies = { ...manifest.devDependencies, ...manifest.dependencies };
18
- if (dependencies.next || dependencies['@tanstack/react-start'])
18
+ if (dependencies['@tanstack/react-start'])
19
19
  targets.push({ root: directory, platform: 'web', manifest });
20
- if (dependencies.expo)
21
- targets.push({ root: directory, platform: 'native', manifest });
22
20
  }
23
21
  for (;;) {
24
22
  inspect(root);
@@ -34,14 +32,14 @@ export function detectUiTargets(cwd, selector) {
34
32
  break;
35
33
  root = parent;
36
34
  }
37
- if (selector && selector !== 'all')
35
+ if (selector)
38
36
  targets = targets.filter((target) => target.platform === selector);
39
37
  if (!targets.length)
40
- throw Error('No matching Next.js, TanStack Start or Expo application found. Use --cwd to select an application.');
41
- if (targets.length > 1 && selector !== 'all')
42
- throw Error('Multiple UI applications found. Select --web, --native, --all, or use --cwd for one application.');
38
+ throw Error('No Anhedral Stack TanStack Start application found. Use --cwd to select apps/web.');
39
+ if (targets.length > 1)
40
+ throw Error('Multiple web applications found. Use --cwd to select apps/web.');
43
41
  if (new Set(targets.map((target) => target.root)).size !== targets.length)
44
- throw Error('Web and native UI must use separate application directories.');
42
+ throw Error('UI application directories must be distinct.');
45
43
  return targets;
46
44
  }
47
45
  export function inspectUiTarget(target) {
@@ -55,36 +53,13 @@ export function inspectUiTarget(target) {
55
53
  const marker = path.join(target.root, '.anhedral-ui.json');
56
54
  if (existsSync(marker) && readUiJson(marker).platform !== target.platform)
57
55
  issues.push('Existing Anhedral UI configuration targets another platform.');
58
- if (target.platform === 'native') {
59
- const dependencies = { ...target.manifest.devDependencies, ...target.manifest.dependencies };
60
- for (const dependency of [
61
- 'class-variance-authority',
62
- 'clsx',
63
- 'tailwind-merge',
64
- 'tailwindcss-animate',
65
- '@rn-primitives/portal',
66
- ])
67
- if (!dependencies[dependency])
68
- issues.push(`Missing RNR baseline dependency: ${dependency}. Complete the upstream setup first.`);
69
- if (!/^\D*4\./.test(dependencies.nativewind ?? ''))
70
- issues.push('Set up NativeWind 4 using the RNR manual guide before native UI installation.');
71
- if (!['metro.config.js', 'metro.config.cjs', 'metro.config.ts'].some((name) => existsSync(path.join(target.root, name))))
72
- issues.push('Missing Metro configuration. Complete the upstream NativeWind setup first.');
73
- if (config?.rsc)
74
- issues.push('Native components.json must set rsc to false.');
75
- }
76
56
  return {
77
57
  root: target.root,
78
58
  platform: target.platform,
79
59
  configurationReady: issues.length === 0,
80
60
  issues,
81
61
  runtimeAcceptance: 'not evaluated',
82
- guide: target.platform === 'native'
83
- ? 'https://reactnativereusables.com/docs/installation/manual'
84
- : target.manifest.dependencies?.['@tanstack/react-start'] ||
85
- target.manifest.devDependencies?.['@tanstack/react-start']
86
- ? 'https://ui.shadcn.com/docs/installation/tanstack'
87
- : 'https://ui.shadcn.com/docs/installation/next',
62
+ guide: 'https://ui.shadcn.com/docs/installation/tanstack',
88
63
  };
89
64
  }
90
65
  /** Check CLI-owned destinations before upstream or attribution writes. */
@@ -122,15 +97,12 @@ export function initializeUiMetadata(root, platform) {
122
97
  schemaVersion: 1,
123
98
  platform,
124
99
  catalogRevision: UI_CATALOG.revision,
125
- nativeStyling: platform === 'native' ? UI_CATALOG.nativeStyling : undefined,
126
100
  sourceOwned: true,
127
101
  automaticUpdates: false,
128
102
  }, null, 2) + '\n', { flag: 'wx' });
129
103
  const licenses = path.join(root, 'ANHEDRAL_UI_LICENSES');
130
104
  mkdirSync(licenses, { recursive: true });
131
- for (const name of platform === 'native'
132
- ? ['LICENSE.react-native-reusables', 'LICENSE.shadcn']
133
- : ['LICENSE.shadcn']) {
105
+ for (const name of ['LICENSE.shadcn']) {
134
106
  const destination = path.join(licenses, name);
135
107
  if (!existsSync(destination))
136
108
  writeFileSync(destination, readFileSync(new URL(`../assets/ui/${name}`, import.meta.url)), {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const GENERATOR_VERSION = "0.18.0";
1
+ export declare const GENERATOR_VERSION = "0.20.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const GENERATOR_VERSION = '0.18.0';
1
+ export const GENERATOR_VERSION = '0.20.0';
@@ -11,21 +11,21 @@ anhedral add r2 stripe
11
11
  anhedral stack status --json
12
12
  ```
13
13
 
14
- | Selection | Source added | Requires |
15
- | --- | --- | --- |
16
- | `backend` | Hono API, Drizzle/D1, Better Auth and web sign-in starter | Anhedral Stack web foundation |
17
- | `r2` | Private storage binding and authenticated owner-scoped file routes | `backend` |
18
- | `stripe` | Subscription Checkout, signed webhooks and canonical entitlement checks | `backend` |
14
+ | Selection | Source added | Requires |
15
+ | --------- | ----------------------------------------------------------------------- | ----------------------------- |
16
+ | `backend` | Hono API, Drizzle/D1, Better Auth and web sign-in starter | Anhedral Stack web foundation |
17
+ | `r2` | Private storage binding and authenticated owner-scoped file routes | `backend` |
18
+ | `stripe` | Subscription Checkout, signed webhooks and canonical entitlement checks | `backend` |
19
19
 
20
20
  `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
21
 
22
22
  ## Source protection
23
23
 
24
- Additions never reinitialize an application. They plan all selected changes before writing, reject collisions and preserve unrelated JSON/JSONC settings. Composition adapters are fingerprinted in `anhedral.json`; modified adapters require reconciliation instead of silent replacement. Add product routes in `apps/api/src/index.ts`, custom types in `custom-environment.ts`, and auth method configuration in `auth-features.ts`/`auth.ts`.
24
+ Adding a capability also upgrades a canonical earlier TanStack Start foundation to the pinned OJ launchers and runtime helpers in the same source transaction, including when that capability is already installed. The exact earlier canonical document also receives the OJ-compatible side-effect CSS import; safe customized documents stay untouched, while edited documents retaining the earlier stylesheet URL import require reconciliation. Customized launchers or generated configuration require reconciliation before any writes. Additions never reinitialize an application. They plan all selected changes before writing, reject collisions and preserve unrelated JSON/JSONC settings. Composition adapters are fingerprinted in `anhedral.json`; modified adapters require reconciliation instead of silent replacement. Add product routes in `apps/api/src/index.ts`, custom types in `custom-environment.ts`, and auth method configuration in `auth-features.ts`/`auth.ts`.
25
25
 
26
26
  Journaled transactions preserve recovery evidence and refuse ambiguous recreated files. Dependency installation follows source commit; a post-commit install failure keeps source for repair/retry. Reviewed dependency patches precede the frozen install. `--skip-install` writes source only. `--dry-run` performs no writes or network requests. Repeating an addition preserves source; normal installation may still retry dependencies.
27
27
 
28
- There is no implicit capability removal or resource/data deletion. Existing applications retain their source and identity. Legacy generators and broader recipe implementations are retained for compatibility and recovery, not exposed as current stack options.
28
+ There is no implicit capability removal or resource/data deletion. Existing applications retain their source and identity. Only the OJ/TanStack Start foundation and these three additions are supported.
29
29
 
30
30
  ## Local setup and validation
31
31
 
@@ -25,7 +25,7 @@ with revision, checks, failures and remaining gaps. Keep raw reports in ignored
25
25
  `.artifacts/`. Historical notes are not current instructions.
26
26
 
27
27
  Canonical docs live in `docs/`; `pnpm build` refreshes bundled plugin references.
28
- Current generated app guidance lives in `src/launch.ts`; retained compatibility generators have their own source guidance. Preserve shipped
28
+ Current generated app guidance lives in `src/launch.ts`. OJ runs development and builds for the single TanStack Start foundation. Preserve shipped
29
29
  reference paths, source-generation safety, dependency patch gates, UI provenance,
30
30
  licenses and exact-artifact packaging. A build does not publish npm or update an
31
31
  installed plugin. See [Contributing](https://github.com/anhedral/anhedral-cli/blob/main/.github/CONTRIBUTING.md)
@@ -48,7 +48,7 @@ dist module or private import requires explicit review. Portable contracts are
48
48
  synced only from a reviewed, licensed Platform projection with exact provenance,
49
49
  never as a build side effect. Local credential scanning additionally retains the
50
50
  CLI's stricter source-upload policy. Plugin packaging accepts its explicit reviewed
51
- MCP-inclusive file set, refuses linked distribution roots and verifies the bounded
51
+ skills-only file set, refuses linked distribution roots and verifies the bounded
52
52
  publisher archive format before npm publication. Oversized unscanned text is an
53
53
  explicit review failure, not a clean secret scan.
54
54
 
@@ -62,17 +62,48 @@ application matrices remain in [Full validation](https://github.com/anhedral/anh
62
62
 
63
63
  `node scripts/tanstack-runtime-smoke.mjs` installs a disposable Anhedral Stack
64
64
  application and exercises local workerd, SSR/server functions, progressive backend,
65
- private storage and the generated Stripe build/migration path. It uses isolated
66
- local data, never a configured database or live payment provider. Retained
67
- Next/OpenNext proof commands cover compatibility code only; they are not another
68
- public stack. Preserve source/tool/lock identities and distinguish prepared,
69
- passed and failed evidence. Tests are not provider deployment acceptance.
65
+ private storage and the generated Stripe build/migration path. The compiled web
66
+ and API Workers run together with the migrated local D1 state. Bundle measurements
67
+ follow OJ’s emitted Worker configuration and count its runtime modules. It uses
68
+ isolated local data, never a configured database or live payment provider. Preserve source/tool/lock identities and distinguish prepared,
69
+ passed and failed evidence. Tests are not provider deployment acceptance. Run
70
+ `node tests/test-generated-config-lint.mjs <installed-workspace>` to exercise the
71
+ generated web ESLint policy; runtime proof checks both web-only and composed source.
72
+
73
+ Backend server entries call TanStack’s `createStartHandler(defaultStreamHandler)` directly so request-local API bindings survive OJ compilation. Source additions repair the exact previous owned adapter and preserve customer edits.
74
+
75
+ OJ dev commands attach an explicit host value with `--host=<hostname>`, as required by the pinned runtime. Generated workspaces explicitly allow dependency build scripts only for esbuild and workerd through the pnpm `allowBuilds` map. This keeps installation noninteractive under the pinned pnpm release and pnpm11 without allowing arbitrary dependency scripts.
76
+
77
+ ## Updating existing source
78
+
79
+ Plugin updates refresh agent guidance; select its matching published CLI separately.
80
+ Use the host's configured marketplace: Codex refreshes its marketplace with
81
+ `codex plugin marketplace upgrade <marketplace>` and installs the refreshed
82
+ `codex plugin add anhedral@<marketplace>`; Claude Code uses
83
+ `claude plugin marketplace update <marketplace>` and
84
+ `claude plugin update anhedral@<marketplace>`. Verify the installed manifest version
85
+ and reload/restart the host when required before relying on its new guidance.
86
+ Run `stack update --dry-run --json`, inspect the bounded file diffs and conflicts,
87
+ then apply `stack update --expect-plan <planId> --json`. The plan binds source
88
+ preimages, target generator and resolved release artifact. Changed plans and
89
+ customized generated files stop the update; authored routes and assets remain
90
+ owned by the application. This operation uses the existing journaled transaction
91
+ without installing dependencies or running project scripts. Resolve source
92
+ conflicts before another preview, then install dependencies and run application
93
+ checks/build separately. It never changes authentication or deployment authority.
94
+ Official release metadata and npm integrity establish deployment provenance;
95
+ project-supplied metadata cannot select another registry, credential destination
96
+ or executable. Offline source inspection cannot attest a newly published artifact.
70
97
 
71
98
  ## Platform CLI access and source upload
72
99
 
73
100
  `login --start` prints browser approval instructions; `login --resume` redeems the
74
101
  saved approval. Interactive `login` polls after showing the URL and confirmation
75
102
  code. Tokens and device secrets use macOS Keychain or Linux Secret Service;
103
+ Linux selects a validated root-owned system helper without searching project
104
+ `PATH`. `ANHEDRAL_CLI_SECRET_TOOL_PATH` can select an absolute trusted system
105
+ installation; its executable and path ownership/permissions are validated.
106
+ Untrusted or unavailable helpers fail closed.
76
107
  `--credential-file <path>` explicitly selects an owner-only file. Credential
77
108
  storage is currently unsupported on Windows. Credentials are
78
109
  bound to the explicit `--api-url` origin (HTTPS, with literal loopback for fixtures).
@@ -86,6 +117,24 @@ JSON is unchanged and context inspection never creates a project or starts login
86
117
  Explicit `--api-url` and `--credential-file` select the origin/store; saved state
87
118
  cannot override either. API access must be separately enabled by Platform operators.
88
119
 
120
+ After generating source, run `projects list --human` to discover the selected
121
+ team's projects and accessible team IDs. Use `--team <uuid>` to select another
122
+ team and `--cursor <uuid>` for the next page. `projects create --name <name>
123
+ --link --human` registers a new Platform project and links the current directory;
124
+ omit `--link` to register it without changing local context. `--summary <text>`
125
+ is optional. Creation registers existing source for upload; it does not generate
126
+ another application or start a deployment. `projects create --dry-run` validates
127
+ the proposed input locally without authentication or network access.
128
+
129
+ Creation saves its request identity under `.anhedral/platform/` before sending
130
+ it. Repeat the same command after interruption to recover the same project;
131
+ changed input, identity or team requires review and an explicit `--new` request.
132
+ `--link` refuses a different existing local link. Init's source identity remains
133
+ unchanged. Platform checks current team membership and project permissions.
134
+ Project creation, linking and unlinking share a workspace lock. After a process
135
+ crash, inspect `.anhedral/platform/project-operation.lock` and remove only that
136
+ lock after confirming no project operation is running; preserve the request journal.
137
+
89
138
  `link --project <uuid> --team <uuid>` checks current build authority and saves an
90
139
  origin/principal-bound link under ignored `.anhedral/platform/`. `unlink` removes
91
140
  that local link. `source upload --dry-run` inspects packaging; `source upload`
@@ -111,8 +160,8 @@ of subsequent local edits. The manifest follows Platform's `deploymentManifestSc
111
160
  in `src/contracts/deployment.ts`; it must match the archive's recorded composition,
112
161
  capabilities, CLI version and existing standalone identity. Runtime-profile admission is server-owned. Staged server sources include Hono/D1
113
162
  and web candidates; source support does not establish a deployed cohort or provider readiness. Plans bind source/lockfile/migrations,
114
- routing state, principal epoch and project authority. Artifact provenance and
115
- runtime configuration remain explicitly unverified; null receipts are not approval.
163
+ routing state, principal epoch and project authority. Signed plans report current artifact, source-version and dependency-lock compatibility.
164
+ A null project configuration revision means deployment has not yet captured its environment snapshot; it is not a request to find an operator approver.
116
165
  Anhedral Stack source composition version 2 records framework foundation
117
166
  `tanstack-start`; the public runtime profile is `anhedral-stack`. Its five compositions are
118
167
  web-only, backend (`hono` plus `database-auth`), backend/R2, backend/Stripe and
@@ -122,7 +171,7 @@ not current public selections or hosted support.
122
171
  Continue selecting an explicit manifest; the CLI never infers an admitted artifact
123
172
  from locally generated source. Native candidate receipts name an immutable registry
124
173
  image with `scope: candidate-workspace`; legacy isolated-build receipts remain valid.
125
- Both describe build admission, not production approval.
174
+ Both describe automatic build compatibility, not a requirement for a human artifact approver. Plans list exact runtime, source-version or lockfile mismatches and remediation. Do not relabel source provenance to clear a mismatch.
126
175
 
127
176
  `deploy prepare` reserves an immutable candidate. `deploy status` reads
128
177
  `awaiting-runtime`, `building`, `built`, `ready` or `failed`. A built candidate grants no
@@ -154,17 +203,35 @@ retains one generation-bound request across retries. `--new` starts another
154
203
  deployment after reviewing the current state. Saved receipts must match their
155
204
  project, candidate, request and generation before replay. CLI runtime admission remains a
156
205
  separate server gate; a built source upload alone is not a ready candidate.
206
+ `production status` reads current production generation, deployment history and approval policy. `production deploy --candidate <uuid> --name <slug>` freezes production configuration and publishes through the signed-in user's existing production permissions. Self-service teams need no second approver; an explicit independent-review policy remains enforced. Lost responses reuse the saved request and generation; use `--new` only for another candidate, name or deliberate deployment.
207
+
157
208
  `logs` reads bounded, redacted runtime events, defaulting to staging. Select
158
209
  production explicitly with `--environment production`; filter by deployment,
159
210
  level, source or range, and pass `--cursor` for the next page. Coverage, dropped
160
211
  events and seven-day retention are part of the response.
161
212
 
162
- The plugin includes source skills plus one remote MCP connection at
163
- `https://platform.anhedral.com/api/mcp`. OAuth consent grants scoped project
164
- access; CLI credentials are separate. Secret imports initiated through ChatGPT
165
- open a secure browser form rather than accepting values as tool arguments.
166
- The plugin packages no executable server, credential or authorization header. Its root `mcp.json` uses the [official remote OAuth declaration](https://developers.openai.com/plugins/build/plugins#bundled-mcp-servers-and-lifecycle-hooks), DCR and read-only default scopes; write access requires additional consent.
167
- Server features remain unavailable until their operator-controlled gates are enabled.
213
+ The plugin contains CLI usage instructions only. It registers no MCP server, remote
214
+ app, OAuth connection or executable hook, and it does not bundle a CLI runtime.
215
+ Users run the reviewed CLI version in a host terminal; managed project operations
216
+ use the separately configured CLI client described above. Packaging admits only
217
+ reviewed skills, references, assets and host manifests, and rejects connection files
218
+ or executable declarations. `tests/test-plugin-codex.test.mjs` installs the exact
219
+ archive in an isolated Codex home and verifies both skills with no MCP, app or hook
220
+ registration when Codex is available (`ANHEDRAL_CODEX_BIN` overrides the binary).
221
+ `ANHEDRAL_CLAUDE_BIN` selects an explicitly installed Claude validator; use a current
222
+ version supporting `plugin validate --strict`. Installed older validators fail the
223
+ gate rather than silently dropping strict validation.
224
+
225
+ One distribution directory, `plugin/`, serves Codex and Claude Code. Codex reads
226
+ `plugin.json` and `skills/*/agents/openai.yaml`; Claude Code reads
227
+ `.claude-plugin/plugin.json` and the same `skills/*/SKILL.md`. Packaging validates
228
+ both manifests against one release identity. Root `.claude-plugin/marketplace.json`
229
+ is the Claude marketplace; add it with `claude plugin marketplace add
230
+ anhedral/anhedral-cli`, then install `anhedral@anhedral`. The existing pinned tag
231
+ predates the Claude files and this cleanup; a coordinated versioned release is
232
+ required before those changes are installable from the public marketplace. Local
233
+ review uses `claude plugin validate --strict plugin`, `claude --plugin-dir plugin`
234
+ and a temporary Codex marketplace, without account connection.
168
235
 
169
236
  The CLI and plugin share one release version. Build prepares the
170
237
  marketplace pointer to that version's immutable `plugin-v<version>` tag; it does
@@ -8,4 +8,4 @@ When selected, Hono owns privileged business/auth/data/storage operations. Web s
8
8
 
9
9
  Auth methods and payment providers require explicit activation. Apply reviewed migrations separately from builds/startup. Source-owned UI preserves semantic tokens, consumer edits and upstream licensing; see [UI ownership](ui.md).
10
10
 
11
- Recorded source provenance is not a hosting receipt. Runtime profile `anhedral-stack` identifies the current deployment contract; exact artifact/runtime policy, current authority and production approval still apply. Retained historical wire values and programmatic generators exist only for compatibility, not additional public stacks. Existing applications and runtime pins are not silently migrated.
11
+ Recorded source provenance is not a hosting receipt. Runtime profile `anhedral-stack` identifies the current deployment contract; exact artifact/runtime policy, current authority and production approval still apply. Legacy generators, framework aliases and compatibility stack selection are removed. OJ is pinned by the generated runtime manifest.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anhedral",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Generate the Anhedral Stack as editable source: start with web UI, then add backend, storage and payments.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -74,7 +74,6 @@
74
74
  "pretest": "pnpm build",
75
75
  "prepublishOnly": "pnpm test:all",
76
76
  "test:cli:validation": "node --test tests/test-cli-validation.test.mjs",
77
- "test:contracts:types": "node tests/test-generated-contracts-types.mjs",
78
77
  "test:pack": "pnpm build && node tests/test-packed-cli.js",
79
78
  "test:pack:exact": "node tests/test-packed-cli.js .artifacts/release/metadata.json",
80
79
  "test:packlist": "pnpm build && node tests/test-packlist.js",
@@ -84,7 +83,6 @@
84
83
  "release:pack": "pnpm build && pnpm plugin:build && node scripts/create-release-artifact.mjs && node scripts/check-release-secrets.mjs .artifacts/release/metadata.json",
85
84
  "release:artifact:verify": "node scripts/verify-release-artifact.mjs .artifacts/release/metadata.json && node scripts/check-release-secrets.mjs .artifacts/release/metadata.json",
86
85
  "release:artifact:smoke": "node tests/test-packed-cli.js .artifacts/release/metadata.json",
87
- "test:standard": "pnpm build && node --test tests/test-standard.test.mjs",
88
86
  "test:unit": "node --test --test-concurrency=4 --test-reporter=spec tests/*.test.mjs",
89
87
  "test:integration": "pnpm build && node tests/test-generated-apps.mjs",
90
88
  "format": "prettier --write src scripts tests \"assets/patches/*.mjs\" assets/ui assets/security && node scripts/stack-template-format.mjs --write",
@@ -92,7 +90,6 @@
92
90
  "plugin:build": "node scripts/check-plugin.mjs",
93
91
  "plugin:check": "node scripts/check-plugin.mjs",
94
92
  "test:patch": "node tests/test-braces-install.mjs && node tests/test-forge-install.mjs",
95
- "test:next-runtime": "pnpm build && node scripts/next-runtime-smoke.mjs",
96
93
  "check:boundaries": "node scripts/repository-boundaries.mjs",
97
94
  "test:tanstack-runtime": "pnpm build && node scripts/tanstack-runtime-smoke.mjs",
98
95
  "check:standalone": "node scripts/standalone-checkout.mjs"
@@ -1,5 +0,0 @@
1
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
- export const aiUsage = sqliteTable('ai_usage', {
3
- id: text('id').primaryKey(),
4
- count: integer('count').notNull(),
5
- });
@@ -1,30 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { z } from 'zod';
3
- import { requireSession } from '../security';
4
- import type { AppEnv } from '../environment';
5
- export const aiRoutes = new Hono<AppEnv>();
6
- const configuration = z.object({
7
- AI_MODEL: z.string().min(1),
8
- AI_DAILY_LIMIT: z.coerce.number().int().min(1).max(1000),
9
- });
10
- const input = z.object({ prompt: z.string().trim().min(1).max(4000) });
11
- aiRoutes.post('/ai/generate', requireSession, async (c) => {
12
- const config = configuration.safeParse(c.env);
13
- if (!config.success)
14
- return c.json({ error: 'Choose a model and a daily limit from 1 to 1000' }, 503);
15
- const body = input.safeParse(await c.req.json().catch(() => null));
16
- if (!body.success) return c.json({ error: 'Prompt must contain 1–4000 characters' }, 400);
17
- const key = c.get('userId') + ':' + new Date().toISOString().slice(0, 10);
18
- const quota = await c.env.DB.prepare(
19
- 'INSERT INTO ai_usage(id,count) VALUES (?,1) ON CONFLICT(id) DO UPDATE SET count = count + 1 WHERE count < ? RETURNING count',
20
- )
21
- .bind(key, config.data.AI_DAILY_LIMIT)
22
- .first();
23
- if (!quota) return c.json({ error: 'Daily AI limit reached' }, 429);
24
- // Failed provider calls consume quota as well; retrying cannot bypass the limit.
25
- const result = await c.env.AI.run(config.data.AI_MODEL as Parameters<Ai['run']>[0], {
26
- messages: [{ role: 'user', content: body.data.prompt }],
27
- max_tokens: 512,
28
- });
29
- return c.json({ result });
30
- });
@@ -1,21 +0,0 @@
1
- use gpui::{App, Application, Context, Window, WindowOptions, div, prelude::*};
2
-
3
- struct Desktop;
4
- impl Render for Desktop {
5
- fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
6
- div()
7
- .flex()
8
- .flex_col()
9
- .p_8()
10
- .gap_4()
11
- .child("Your native application")
12
- .child("Configure an authenticated backend client for your product.")
13
- }
14
- }
15
- fn main() {
16
- Application::new().run(|cx: &mut App| {
17
- cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Desktop))
18
- .expect("Open application window");
19
- cx.activate(true);
20
- });
21
- }
@@ -1,10 +0,0 @@
1
- -- Private event-feed consumer example, never a migration or scheduled CLI task.
2
- -- Review the owner and cutoff against the active replay window before executing.
3
- -- Delete at most 100 expired rows belonging to the selected authenticated owner.
4
- DELETE FROM application_event
5
- WHERE id IN (
6
- SELECT id FROM application_event
7
- WHERE user_id = ? AND created_at < ?
8
- ORDER BY created_at, id
9
- LIMIT 100
10
- );
@@ -1,12 +0,0 @@
1
- import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
2
- export const applicationEvent = sqliteTable(
3
- 'application_event',
4
- {
5
- id: text('id').primaryKey(),
6
- userId: text('user_id').notNull(),
7
- topic: text('topic').notNull(),
8
- data: text('data').notNull(),
9
- createdAt: integer('created_at').notNull(),
10
- },
11
- (t) => [index('application_event_user_time').on(t.userId, t.createdAt)],
12
- );
@@ -1,59 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { streamSSE } from 'hono/streaming';
3
- import { z } from 'zod';
4
- import { requireSession } from '../security';
5
- import type { AppEnv } from '../environment';
6
- export const eventRoutes = new Hono<AppEnv>();
7
- const input = z.object({
8
- topic: z.string().regex(/^[a-zA-Z0-9._-]{1,80}$/),
9
- data: z.unknown().optional(),
10
- });
11
- function eventCursor(header: string | undefined) {
12
- if (!header) return { since: Date.now(), afterId: '' };
13
- const match = /^(\d+):([a-f0-9-]{36})$/.exec(header);
14
- if (!match) return null;
15
- const since = Number(match[1]);
16
- if (!Number.isSafeInteger(since)) return null;
17
- return { since, afterId: match[2] };
18
- }
19
- eventRoutes.use('/events', requireSession);
20
- eventRoutes.post('/events', async (c) => {
21
- const body = input.safeParse(await c.req.json().catch(() => null));
22
- if (!body.success) return c.json({ error: 'Invalid event' }, 400);
23
- const data = JSON.stringify(body.data.data ?? null);
24
- if (new TextEncoder().encode(data).byteLength > 8192)
25
- return c.json({ error: 'Event too large' }, 413);
26
- const id = crypto.randomUUID();
27
- // Allocate a strictly increasing owner cursor atomically, including equal-ms writes.
28
- await c.env.DB.prepare(
29
- 'INSERT INTO application_event(id,user_id,topic,data,created_at) SELECT ?,?,?,?,MAX(?,COALESCE((SELECT MAX(created_at)+1 FROM application_event WHERE user_id=?),0))',
30
- )
31
- .bind(id, c.get('userId'), body.data.topic, data, Date.now(), c.get('userId'))
32
- .run();
33
- return c.json({ id }, 201);
34
- });
35
- eventRoutes.get('/events', (c) => {
36
- const userId = c.get('userId');
37
- const cursor = eventCursor(c.req.header('last-event-id'));
38
- if (!cursor) return c.json({ error: 'Invalid event cursor' }, 400);
39
- return streamSSE(c, async (stream) => {
40
- for (let tick = 0; tick < 30 && !stream.aborted; tick++) {
41
- const rows = await c.env.DB.prepare(
42
- 'SELECT id,topic,data,created_at FROM application_event WHERE user_id = ? AND (created_at > ? OR (created_at = ? AND id > ?)) ORDER BY created_at,id LIMIT 100',
43
- )
44
- .bind(userId, cursor.since, cursor.since, cursor.afterId)
45
- .all<{ id: string; topic: string; data: string; created_at: number }>();
46
- for (const row of rows.results) {
47
- await stream.writeSSE({
48
- id: row.created_at + ':' + row.id,
49
- event: row.topic,
50
- data: row.data,
51
- });
52
- cursor.since = row.created_at;
53
- cursor.afterId = row.id;
54
- }
55
- await stream.writeSSE({ event: 'heartbeat', data: '{}' });
56
- await stream.sleep(1000);
57
- }
58
- });
59
- });
@@ -1,25 +0,0 @@
1
- import { createAuthClient } from 'better-auth/react';
2
- import { expoClient } from '@better-auth/expo/client';
3
- import * as SecureStore from 'expo-secure-store';
4
- const configured = process.env.EXPO_PUBLIC_API_URL;
5
- const baseURL = configured || 'http://127.0.0.1:8787';
6
- if (configured && !__DEV__ && !configured.startsWith('https://'))
7
- throw Error('Production API connections require HTTPS');
8
- export const authClient = createAuthClient({
9
- baseURL,
10
- plugins: [expoClient({ scheme: __SCHEME__, storagePrefix: __SCHEME__, storage: SecureStore })],
11
- });
12
- export async function apiRequest(route: string, init: RequestInit = {}) {
13
- if (!/^\/[a-zA-Z0-9/_?=&%.-]*$/.test(route)) throw Error('Choose an application API path');
14
- const headers = new Headers(init.headers);
15
- headers.delete('authorization');
16
- headers.delete('origin');
17
- const cookie = await authClient.getCookie();
18
- if (cookie) headers.set('cookie', cookie);
19
- headers.set('expo-origin', __SCHEME__ + '://');
20
- return fetch(baseURL.replace(/\/$/, '') + '/api' + route, {
21
- ...init,
22
- headers,
23
- redirect: 'error',
24
- });
25
- }
@@ -1,63 +0,0 @@
1
- import { useState } from 'react';
2
- import { View, Text } from 'react-native';
3
- import { type PurchasesPackage } from 'react-native-purchases';
4
- import {
5
- connectPurchases,
6
- purchase,
7
- restorePurchases,
8
- manageSubscriptions,
9
- } from '../lib/purchases';
10
- import { ActionButton } from './action-button';
11
- export function BillingControls() {
12
- const [packages, setPackages] = useState<PurchasesPackage[]>([]);
13
- const [message, setMessage] = useState('');
14
- const [busy, setBusy] = useState(false);
15
- async function action(work: () => Promise<unknown>) {
16
- setBusy(true);
17
- try {
18
- await work();
19
- setMessage('Subscription updated.');
20
- } catch {
21
- setMessage('Purchase service is unavailable or the action was cancelled.');
22
- } finally {
23
- setBusy(false);
24
- }
25
- }
26
- return (
27
- <View style={{ padding: 16, gap: 8 }}>
28
- <ActionButton
29
- label="View subscriptions"
30
- disabled={busy}
31
- onPress={() =>
32
- void action(async () => {
33
- const offerings = await connectPurchases();
34
- setPackages(
35
- (offerings.current?.availablePackages ?? []).filter(
36
- (value) => value.product.subscriptionPeriod !== null,
37
- ),
38
- );
39
- })
40
- }
41
- />
42
- {packages.map((value) => (
43
- <ActionButton
44
- key={value.identifier}
45
- label={value.product.title + ' ' + value.product.priceString}
46
- disabled={busy}
47
- onPress={() => void action(() => purchase(value))}
48
- />
49
- ))}
50
- <ActionButton
51
- label="Restore purchases"
52
- disabled={busy}
53
- onPress={() => void action(restorePurchases)}
54
- />
55
- <ActionButton
56
- label="Manage subscriptions"
57
- disabled={busy}
58
- onPress={() => void action(manageSubscriptions)}
59
- />
60
- <Text accessibilityLiveRegion="polite">{message}</Text>
61
- </View>
62
- );
63
- }