anhedral 0.1.10 → 0.4.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 (87) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/CONTRIBUTING.md +73 -0
  3. package/LICENSE +196 -17
  4. package/README.md +202 -145
  5. package/SECURITY.md +37 -0
  6. package/SKILL.md +244 -0
  7. package/bin/anhedral.js +1 -1
  8. package/dist/architecture/contributions.d.ts +28 -0
  9. package/dist/architecture/contributions.js +125 -0
  10. package/dist/architecture/index.d.ts +12 -0
  11. package/dist/architecture/index.js +6 -0
  12. package/dist/architecture/manifest.d.ts +53 -0
  13. package/dist/architecture/manifest.js +283 -0
  14. package/dist/architecture/modules.d.ts +37 -0
  15. package/dist/architecture/modules.js +184 -0
  16. package/dist/architecture/plan.d.ts +58 -0
  17. package/dist/architecture/plan.js +145 -0
  18. package/dist/architecture/templates.d.ts +10 -0
  19. package/dist/architecture/templates.js +23 -0
  20. package/dist/bin.d.ts +2 -0
  21. package/dist/bin.js +179 -0
  22. package/dist/cli.d.ts +24 -2
  23. package/dist/cli.js +189 -21
  24. package/dist/composers/root.d.ts +6 -0
  25. package/dist/composers/root.js +35 -0
  26. package/dist/dependencies.d.ts +31 -9
  27. package/dist/dependencies.js +227 -60
  28. package/dist/index.d.ts +8 -2
  29. package/dist/index.js +5 -31
  30. package/dist/print.js +15 -0
  31. package/dist/prompts.d.ts +5 -0
  32. package/dist/prompts.js +19 -0
  33. package/dist/render.d.ts +11 -0
  34. package/dist/render.js +74 -0
  35. package/dist/scaffold.d.ts +64 -12
  36. package/dist/scaffold.js +1726 -1150
  37. package/dist/template-source.d.ts +20 -0
  38. package/dist/template-source.js +180 -0
  39. package/dist/templates/api.d.ts +2 -0
  40. package/dist/templates/api.js +3122 -0
  41. package/dist/templates/assets-private-proxy.d.ts +3 -0
  42. package/dist/templates/assets-private-proxy.js +277 -0
  43. package/dist/templates/desktop.d.ts +2 -0
  44. package/dist/templates/desktop.js +639 -0
  45. package/dist/templates/electron-updater.d.ts +3 -0
  46. package/dist/templates/electron-updater.js +358 -0
  47. package/dist/templates/extension.d.ts +1 -1
  48. package/dist/templates/extension.js +322 -248
  49. package/dist/templates/mobile.d.ts +2 -0
  50. package/dist/templates/mobile.js +720 -0
  51. package/dist/templates/shared.d.ts +2 -0
  52. package/dist/templates/shared.js +520 -0
  53. package/dist/templates/web.d.ts +2 -0
  54. package/dist/templates/web.js +412 -0
  55. package/dist/toolchain.d.ts +0 -8
  56. package/dist/toolchain.js +0 -21
  57. package/dist/transaction.d.ts +22 -0
  58. package/dist/transaction.js +822 -0
  59. package/dist/ui.d.ts +33 -0
  60. package/dist/ui.js +199 -0
  61. package/dist/util.d.ts +1 -5
  62. package/dist/util.js +70 -159
  63. package/dist/version.d.ts +2 -0
  64. package/dist/version.js +2 -0
  65. package/dist/workspace-config.d.ts +11 -0
  66. package/dist/workspace-config.js +372 -0
  67. package/docs/conventions.md +92 -0
  68. package/docs/master-stack-map.md +192 -0
  69. package/docs/output-tree-contract.md +482 -0
  70. package/docs/references/manual-scaffolding.md +403 -0
  71. package/docs/references/provisioning.md +220 -0
  72. package/package.json +57 -13
  73. package/templates/api-fastify/apps/api/tsconfig.json +20 -0
  74. package/templates/catalog.json +23 -0
  75. package/templates/db-drizzle/packages/db/tsconfig.json +14 -0
  76. package/templates/desktop-electron/apps/desktop/tsconfig.json +37 -0
  77. package/templates/extension-wxt/apps/extension/tsconfig.json +41 -0
  78. package/templates/mobile-expo/apps/mobile/expo-env.d.ts +1 -0
  79. package/templates/web-next/apps/web/next-env.d.ts +6 -0
  80. package/dist/branding.d.ts +0 -5
  81. package/dist/branding.js +0 -17
  82. package/dist/commands.d.ts +0 -7
  83. package/dist/commands.js +0 -24
  84. package/dist/templates/backend.d.ts +0 -2
  85. package/dist/templates/backend.js +0 -2115
  86. package/dist/templates/frontend.d.ts +0 -2
  87. package/dist/templates/frontend.js +0 -1268
package/README.md CHANGED
@@ -1,220 +1,277 @@
1
1
  # Anhedral
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/anhedral.svg)](https://www.npmjs.com/package/anhedral)
4
- [![license](https://img.shields.io/npm/l/anhedral.svg)](./LICENSE)
5
4
  [![node](https://img.shields.io/node/v/anhedral.svg)](https://www.npmjs.com/package/anhedral)
6
5
 
7
- One command to start a production-shaped Expo, Fastify, and Chrome extension application.
6
+ Anhedral generates a complete, production-oriented TypeScript stack whose source code stays understandable and customizable.
8
7
 
9
- Anhedral is an opinionated init CLI for teams that want one stable full-stack architecture instead of a menu of half-finished choices. It generates a single pnpm monorepo with an Expo app for web/iOS/Android, a Fastify API, a WXT Chrome extension, shared packages, and deployment-ready structure for Vercel, EAS, and the Chrome Web Store.
8
+ > **Three-second version:** Start with the full TypeScript stack. Keep every escape hatch.
10
9
 
11
- ![Anhedral init CLI](docs/anhedral-cli-init.png)
10
+ Anhedral is not a new programming language and generated applications do not run inside a proprietary application framework. It assembles well-documented tools, connects their difficult integration boundaries, and leaves developers with ordinary Next.js, Expo Router, Fastify, Drizzle, Electron, and WXT projects.
12
11
 
13
- ## Quick Start
12
+ Anhedral is open source under the [Apache License 2.0](LICENSE). You may use,
13
+ modify, and distribute it subject to that license, including its notice and
14
+ redistribution requirements. Generated applications remain ordinary project
15
+ source that their developers can customize and license for their products.
16
+
17
+ ## Recommended: use the coding-agent skill
18
+
19
+ Install the Anhedral skill for Codex, Claude Code, or another compatible coding
20
+ agent:
14
21
 
15
22
  ```sh
16
- pnpm dlx anhedral@latest init
23
+ pnpm dlx skills add https://github.com/anhedral/anhedral-init --skill anhedral-init
17
24
  ```
18
25
 
19
- Or with npm:
26
+ Choose the agent and global or project scope when prompted. Then ask the agent:
20
27
 
21
- ```sh
22
- npx anhedral@latest init
28
+ ```text
29
+ Use $anhedral-init to create and provision my application.
23
30
  ```
24
31
 
25
- Use `--skip-install` when you want deterministic file generation before installing dependencies:
32
+ The skill begins by asking for the project name and whether you already own a
33
+ custom domain. It selects the CLI command with you, detects Computer Use and
34
+ subagent support, generates the project, and walks through the selected cloud
35
+ providers. It pauses for sign-in, MFA, payments, secret generation, and final
36
+ release submissions. Paste secrets directly into the instructed uncommitted
37
+ `.env` file or protected provider field—never into chat.
38
+
39
+ ## Create an application directly
40
+
41
+ Create the complete stack:
26
42
 
27
43
  ```sh
28
- pnpm dlx anhedral@latest init --skip-install
29
- pnpm install
44
+ pnpm dlx anhedral@latest new my-product
45
+ cd my-product
30
46
  ```
31
47
 
32
- ## What It Generates
48
+ The generated `README.md` contains the exact next steps for the selected stack.
49
+ For the complete stack, copy the package-local environment examples, configure
50
+ the selected managed providers—including a Neon `DATABASE_URL`—and create the
51
+ reviewed initial migration before running `pnpm dev`. Anhedral intentionally
52
+ does not generate a local Postgres substitute or pretend that production
53
+ provider credentials already exist.
54
+
55
+ With no module flags, `new` includes every supported application surface and backend capability. Generate a focused stack by naming only what the product needs:
33
56
 
34
- ```txt
35
- .
36
- ├─ Frontend/ Expo + React Native Reusables app
37
- ├─ Backend/ Fastify API
38
- ├─ Extension/ WXT Chrome extension
39
- ├─ packages/
40
- │ ├─ api-client/ shared typed API client
41
- │ ├─ config/ shared config helpers
42
- │ ├─ contracts/ shared Zod request/response contracts
43
- │ ├─ db/ Drizzle schema, Neon client, migrations
44
- │ └─ types/ shared TypeScript types
45
- ├─ PRODUCTION.md deployment checklist
46
- ├─ turbo.json workspace task graph
47
- └─ package.json root scripts
57
+ ```sh
58
+ pnpm dlx anhedral@latest new my-product --web --api --db --auth
59
+ pnpm dlx anhedral@latest new my-api --api --db
60
+ pnpm dlx anhedral@latest new my-clients --web --mobile
48
61
  ```
49
62
 
50
- The generated app is intentionally one repository. Deploy the same Git repo as two Vercel projects:
63
+ `init` generates the same workspace in the current empty directory:
51
64
 
52
- - `Frontend`: Expo web export, built with `pnpm build:web`, output to `dist`
53
- - `Backend`: Fastify API, built with `pnpm build`, entrypoint at `src/index.ts`
65
+ ```sh
66
+ mkdir my-product && cd my-product
67
+ pnpm dlx anhedral@latest init --web --api --db --auth
68
+ ```
54
69
 
55
- The same `Frontend` source is used for native iOS and Android builds through EAS. The `Extension` source builds a WXT Chrome extension ZIP for the Chrome Web Store.
70
+ Interactive terminals prompt for surfaces and capabilities. CI and coding agents should pass explicit module flags.
71
+
72
+ ## What gets generated
73
+
74
+ ```text
75
+ my-product/
76
+ ├── apps/
77
+ │ ├── web/ # Next.js App Router + source-owned shadcn/ui
78
+ │ ├── mobile/ # Expo Router + React Native Reusables
79
+ │ ├── api/ # Fastify routes, backend modules, auth, providers
80
+ │ ├── desktop/ # Electron + React
81
+ │ ├── extension/ # WXT browser extension
82
+ │ ├── assets-private-proxy/ # Cloudflare Worker for private asset delivery
83
+ │ └── desktop-updater-worker/ # private R2 Electron update delivery
84
+ ├── packages/
85
+ │ ├── contracts/ # shared Zod network contracts
86
+ │ ├── api-client/ # typed client used by every frontend
87
+ │ ├── db/ # Drizzle schema and reviewed migrations
88
+ │ └── realtime/ # Ably client when billing is selected
89
+ ├── docs/
90
+ │ ├── DEVELOPMENT.md # task-oriented feature recipes
91
+ │ └── STACK.md # tool map and official documentation
92
+ ├── README.md # first run and where-to-write-code map
93
+ ├── PRODUCTION.md # selection-specific release runbook
94
+ ├── SKILL.md # repository guidance for coding agents
95
+ ├── ANHEDRAL.md # generator and ownership notes
96
+ └── anhedral.json # modules, versions, provenance, ownership
97
+ ```
56
98
 
57
- ## Stack
99
+ Whole directories are omitted when their module is not selected. Generated documentation is selection-aware.
58
100
 
59
- Anhedral supports one carefully maintained stack:
101
+ ## Developer experience
60
102
 
61
- - Expo + React Native Reusables frontend
62
- - Fastify backend
63
- - WXT Chrome extension
64
- - Neon + Drizzle
65
- - Cloudflare R2/CDN
66
- - Clerk auth
67
- - RevenueCat + Stripe
68
- - Vercel deployment
69
- - pnpm workspaces + Turborepo
103
+ Developers use each tool normally:
70
104
 
71
- The goal is stability. The generated project avoids framework sprawl, duplicate schemas, and separate frontend/backend/extension repositories.
105
+ ```tsx
106
+ // apps/web/app/projects/page.tsx
107
+ import { ProjectList } from '@/components/projects/project-list';
72
108
 
73
- ## Why This Stack
109
+ export default function ProjectsPage() {
110
+ return <ProjectList />;
111
+ }
112
+ ```
74
113
 
75
- Anhedral is built around one idea: a startup should be able to launch every major client from one repository without committing to infrastructure that becomes expensive, fragmented, or hard to change later.
114
+ ```ts
115
+ // packages/contracts/src/app.ts
116
+ import { z } from 'zod';
76
117
 
77
- The stack is intentionally narrow:
118
+ export const ProjectSchema = z.object({ id: z.string(), name: z.string() });
119
+ export const ProjectListSchema = z.array(ProjectSchema);
120
+ ```
78
121
 
79
- | Choice | Why Anhedral uses it |
80
- | --- | --- |
81
- | Expo | One React Native codebase targets web browsers, iOS, and Android. Compared with separate web and native apps, Expo keeps product iteration faster and avoids rebuilding shared screens, auth flows, and client logic three times. |
82
- | React Native Reusables | It brings shadcn-style primitives to React Native and Expo without locking the app into a heavy design system. Compared with bespoke component scaffolds, it gives teams accessible primitives they can replace or extend as the product becomes specific. |
83
- | Fastify | Fastify is small, fast, TypeScript-friendly, and works well as a central API layer on Vercel. Compared with pushing logic into many frontend routes, serverless functions, or client SDK calls, a Fastify backend centralizes auth, billing, storage, database access, webhooks, and internal APIs in one place. |
84
- | TypeScript | The whole stack shares types, contracts, and API clients. Compared with untyped template code, this catches frontend/backend drift before deploy and makes the generated app safer to evolve. |
85
- | Zod contracts | Request and response schemas live in shared packages. Compared with duplicating interfaces across clients, Zod lets the backend validate inputs while the frontend parses responses from the same source of truth. |
86
- | Neon + Drizzle | Neon gives serverless Postgres that can start free and scale with usage; Drizzle keeps schema and queries close to TypeScript. Compared with proprietary document databases or opaque ORMs, this keeps the data layer portable, SQL-native, and easy to inspect. |
87
- | Cloudflare R2/CDN | R2 provides S3-compatible object storage without S3-style egress fees. Compared with storing files in the database or coupling uploads to one app client, signed storage routes give every client the same upload/download primitive. |
88
- | Clerk | Clerk handles modern auth across web, native, and extension clients. Compared with hand-rolled auth, it removes a high-risk surface area while still letting the backend own authorization decisions. |
89
- | RevenueCat + Stripe | RevenueCat coordinates native subscriptions and Stripe web billing behind one entitlement model. Compared with separate payment implementations per platform, the backend can ask one question: what is this user allowed to access? |
90
- | WXT | WXT gives the Chrome extension a modern TypeScript/Vite workflow and supports the Side Panel API. Compared with hand-maintained manifest scaffolds, it reduces extension build and packaging mistakes. |
91
- | Vercel | Vercel deploys the Expo web app and Fastify API from the same Git repository with separate project roots. Compared with manually wiring CI/CD early, teams get preview deployments and production deploys from normal commits. |
122
+ ```ts
123
+ // packages/db/src/app-schema.ts
124
+ import { pgTable, text } from 'drizzle-orm/pg-core';
92
125
 
93
- Every part of the stack can be started on free tiers and scales automatically as traffic grows. That matters because the first production architecture should not force a team to choose between moving quickly and being able to handle success.
126
+ export const projects = pgTable('projects', {
127
+ id: text('id').primaryKey(),
128
+ name: text('name').notNull(),
129
+ });
130
+ ```
94
131
 
95
- The bigger advantage is architectural: Anhedral creates all target clients plus one backend that can serve internal and external requests. Product logic, auth decisions, subscription entitlements, storage access, database writes, and webhooks have a central home. That helps startups avoid the common failure mode where every client invents its own rules, and the team later cannot respond quickly when the product needs to shift.
132
+ ```ts
133
+ // apps/api/src/routes/app.ts
134
+ import type { FastifyPluginAsync } from 'fastify';
135
+ import { db } from '@shared/db';
136
+ import { projects } from '@shared/db/schema';
96
137
 
97
- ## Local Development
138
+ export const appRoutes: FastifyPluginAsync = async (app) => {
139
+ app.get('/projects', async () => db.select().from(projects));
140
+ };
141
+ ```
98
142
 
99
- From the generated project root:
143
+ The convention is a conventional vertical flow, not an Anhedral DSL:
100
144
 
101
- ```sh
102
- pnpm install
103
- pnpm dev
145
+ ```text
146
+ contracts -> database/service -> Fastify route -> typed API client -> frontend
104
147
  ```
105
148
 
106
- Run one surface at a time:
107
-
108
- ```sh
109
- pnpm dev:frontend
110
- pnpm dev:backend
111
- pnpm dev:extension
149
+ - Write web product code under `apps/web` using Next.js conventions.
150
+ - Write mobile product code under `apps/mobile` using Expo Router conventions.
151
+ - Register product routes in `apps/api/src/routes/app.ts` and add server-only feature modules under `apps/api/src` using Fastify conventions.
152
+ - Write product tables in `packages/db/src/app-schema.ts` and queries under `packages/db` using Drizzle conventions.
153
+ - Share only network contracts and client-safe packages with frontends.
154
+ - Import the underlying framework directly whenever its API is the right tool.
155
+
156
+ ## The stack
157
+
158
+ | Concern | Default | Why Anhedral includes it |
159
+ | --- | --- | --- |
160
+ | Web | Next.js + Vercel | App Router, React server rendering, routing, deployment |
161
+ | Native | Expo Router | One TypeScript application for iOS and Android |
162
+ | API | Fastify | Typed validation, structured logging, plugin boundaries |
163
+ | Database | Neon + Drizzle | Managed Postgres with TypeScript schema and SQL-like queries |
164
+ | Authentication | Clerk | Connected frontend and backend identity/session flows |
165
+ | UI | shadcn/ui + React Native Reusables | Accessible source code the application owns |
166
+ | Storage | private Cloudflare R2 | Signed uploads and controlled asset delivery |
167
+ | Billing/realtime | RevenueCat + Ably | Durable entitlements and client invalidation |
168
+ | Desktop | Electron | Predictable cross-platform TypeScript desktop runtime |
169
+ | Desktop updates | electron-updater + private R2 + Worker | Signed automatic updates through a product-owned custom domain |
170
+ | Extension | WXT | Browser-extension entrypoints, builds, and packaging |
171
+ | Workspace | pnpm + Turborepo | Strict dependencies and dependency-aware tasks |
172
+
173
+ Anhedral does **not** generate or require local Postgres. Database-enabled projects use a managed Neon connection through `DATABASE_URL`; teams should use isolated Neon branches or projects for development, preview, and production.
174
+
175
+ ## Commands
176
+
177
+ ```text
178
+ anhedral new <directory> [modules...] Generate a new readable workspace
179
+ anhedral init [modules...] Generate in the current empty directory
180
+ anhedral add <module...> Add connected stack capabilities
181
+ anhedral ui add <component...> Add source-owned UI components
182
+ anhedral upgrade Transactionally upgrade a supported project
183
+ anhedral doctor Check ownership and generator drift
112
184
  ```
113
185
 
114
- Verify before deployment:
186
+ Useful examples:
115
187
 
116
188
  ```sh
117
- pnpm verify
118
- pnpm verify:frontend
119
- pnpm verify:backend
120
- pnpm verify:extension
189
+ anhedral add storage --dry-run
190
+ anhedral add desktop extension
191
+ anhedral add electron-updater
192
+ anhedral ui add button dialog
193
+ anhedral ui add data-table --target web --dry-run
194
+ anhedral upgrade --dry-run
195
+ anhedral doctor --json
121
196
  ```
122
197
 
123
- Database workflow:
198
+ `--dry-run` builds the complete plan without changing the project. `--json` emits machine-readable output. `--verbose` streams child-tool diagnostics.
199
+
200
+ Application lifecycle commands remain visible in the generated root `package.json`:
124
201
 
125
202
  ```sh
203
+ pnpm dev
204
+ pnpm dev:all
205
+ pnpm dev:web
206
+ pnpm dev:api
207
+ pnpm typecheck
208
+ pnpm verify
209
+ pnpm build
126
210
  pnpm db:generate
127
211
  pnpm db:migrate
128
212
  ```
129
213
 
130
- ## Provider Setup
214
+ `pnpm dev` starts the primary product loop: the first selected client plus the
215
+ API when present, or the API by itself for backend-only projects. In the full
216
+ stack that means web plus API. `pnpm dev:all` appears only when the project has
217
+ additional surfaces and intentionally starts all of them. Only commands
218
+ relevant to selected modules are generated.
131
219
 
132
- Generated projects include placeholder env values so the repository can be inspected before accounts are provisioned. Real auth, billing, uploads, native builds, and extension sign-in require provider keys.
220
+ ## Extensibility and ownership
133
221
 
134
- The generated `README.md` and `PRODUCTION.md` explain where every key belongs:
222
+ Anhedral owns initial assembly and safe structural additions. It does not own product architecture after generation.
135
223
 
136
- - Neon: `DATABASE_URL`
137
- - Clerk: `EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY`, `CLERK_PUBLISHABLE_KEY`, `CLERK_SECRET_KEY`, `VITE_CLERK_PUBLISHABLE_KEY`
138
- - RevenueCat + Stripe: `EXPO_PUBLIC_RC_*`, `RC_SECRET_API_KEY`, `RC_WEBHOOK_SECRET`
139
- - Cloudflare R2/CDN: `R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_BUCKET`
140
- - Vercel: two projects from the same Git repository, rooted at `Frontend` and `Backend`
141
- - EAS: native iOS and Android builds from `Frontend`
142
- - Chrome Web Store: WXT ZIP upload from `Extension/.output`
224
+ - `README.md`, `PRODUCTION.md`, application features, pages, routes, services, and domain code are developer-owned.
225
+ - Root workspace configuration is mergeable.
226
+ - Integration substrate is recorded in `anhedral.json`; `anhedral add` refuses to overwrite modified managed files.
227
+ - UI components are copied into the application so developers can edit them normally.
228
+ - Provider integrations use ordinary SDKs and configuration files with no hidden control plane.
143
229
 
144
- ## Deployment
145
-
146
- ### Vercel
147
-
148
- Import the same GitHub repository twice:
149
-
150
- | Project | Root Directory | Build Command | Output |
151
- | --- | --- | --- | --- |
152
- | Frontend | `Frontend` | `pnpm build:web` | `dist` |
153
- | Backend | `Backend` | `pnpm build` | Fastify entrypoint |
154
-
155
- Enable Vercel access to source files outside each project root so workspace packages under `packages/*` resolve during builds.
156
-
157
- ### EAS
158
-
159
- Use `Frontend` as the Expo project root:
230
+ Before a structural change:
160
231
 
161
232
  ```sh
162
- cd Frontend
163
- pnpm dlx eas-cli@latest login
164
- pnpm dlx eas-cli@latest init
165
- pnpm dlx eas-cli@latest build --platform all --profile production
166
- pnpm dlx eas-cli@latest submit --platform all --latest --profile production
233
+ anhedral doctor
234
+ anhedral add <module> --dry-run
167
235
  ```
168
236
 
169
- ### Chrome Extension
170
-
171
- ```sh
172
- pnpm extension:zip
173
- ```
174
-
175
- Upload `Extension/.output/*-chrome.zip` to the Chrome Web Store Developer Dashboard.
176
-
177
- ## Dependency Policy
237
+ When `doctor` reports that a project was generated by a supported older release, run `anhedral upgrade --dry-run`, inspect the plan, and then run `anhedral upgrade`. Version 0.4 supports transactional upgrades from 0.3 projects while preserving user-owned extension seams. If a 0.3 project changed a file that was generator-managed, the upgrade stops instead of overwriting it. Preserve the change in source control, restore that managed file to its recorded 0.3 content, run the upgrade, and then move the product behavior into the new user-owned `app.ts`, `app-schema.ts`, page, component, or `app-window.ts` seam.
178
238
 
179
- `pnpm dlx anhedral@latest init` gives users the latest published Anhedral CLI, but generated projects use the dependency manifest verified for that release.
239
+ ## Documentation contract
180
240
 
181
- Runtime dependency versions live in `src/dependencies.ts`. Generated projects also receive a `stack.json` file recording the exact stack and dependency manifest used for that init run.
241
+ Every generated project teaches both humans and coding agents how to work in it:
182
242
 
183
- This keeps generated apps reproducible while still allowing Anhedral itself to move forward quickly through verified releases.
243
+ - `README.md` answers how to run the app and where frontend/backend code goes.
244
+ - `docs/DEVELOPMENT.md` provides end-to-end feature and common-task recipes.
245
+ - `docs/STACK.md` maps generated files to each tool's official documentation.
246
+ - `SKILL.md` gives coding agents concise repository-specific workflow and safety rules.
247
+ - `PRODUCTION.md` covers only the accounts, environment, infrastructure, DNS, stores, and release steps selected for that project.
184
248
 
185
- ## Development
249
+ The generator's exact output contract is documented in [docs/output-tree-contract.md](docs/output-tree-contract.md). Contributor architecture remains available in the [source repository](https://github.com/anhedral/anhedral-init/tree/main/docs/architecture).
186
250
 
187
- Work on the CLI locally:
251
+ The complete lifecycle, runtime, cloud, command, and coding-agent topology is in
252
+ the [Anhedral master stack map](docs/master-stack-map.md).
188
253
 
189
- ```sh
190
- pnpm install
191
- pnpm build
192
- pnpm test:all
193
- ```
254
+ ## Module dependency rules
194
255
 
195
- Refresh the checked-in demo output:
256
+ Anhedral resolves integrations as a deterministic graph:
196
257
 
197
- ```sh
198
- pnpm demo:refresh
258
+ ```text
259
+ auth -> api + db
260
+ billing -> auth
261
+ storage -> auth
262
+ native-subscriptions -> mobile + billing
263
+ electron-updater -> desktop
199
264
  ```
200
265
 
201
- Validate upstream scaffold drift:
266
+ Adding a capability brings the infrastructure it actually requires. Unselected providers do not leave dead source files or environment placeholders behind.
202
267
 
203
- ```sh
204
- pnpm test:e2e:latest
205
- ```
206
-
207
- ## Release
208
-
209
- Official releases are automatic on merges to `main`. The release workflow bumps the patch version, runs the release checks, creates a release commit and tag, and publishes to npm.
268
+ ## Verification
210
269
 
211
- Manual fallback:
270
+ The generator and representative public stacks are checked with:
212
271
 
213
272
  ```sh
214
- pnpm release:check
215
- npm publish --provenance=false --ignore-scripts
273
+ pnpm typecheck
274
+ pnpm test:all
216
275
  ```
217
276
 
218
- ## License
219
-
220
- MIT
277
+ Generated workspaces include their own package-level tests, full-stack `verify` command, CI workflow, production environment validation, migration drift gate, and deployment configuration.
package/SECURITY.md ADDED
@@ -0,0 +1,37 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ Security fixes are made on the current development branch and released as a new npm version. Consumers should use the latest version published under the `latest` dist-tag.
6
+
7
+ ## Reporting a vulnerability
8
+
9
+ Do not open a public issue for a suspected vulnerability. Use GitHub's private vulnerability reporting or security-advisory flow for this repository. If repository access is unavailable, contact the package maintainers through the owner information on the [anhedral npm package](https://www.npmjs.com/package/anhedral).
10
+
11
+ Include the affected version, reproduction steps, impact, and any suggested mitigation. Please avoid accessing data that is not yours and allow maintainers time to investigate before public disclosure.
12
+
13
+ ## Supply-chain policy
14
+
15
+ - Release artifacts are built and tested in a read-only job.
16
+ - The exact tarball uploaded by CI is the artifact submitted to npm.
17
+ - npm integrity is checked before and after publication.
18
+ - npm publication uses Trusted Publishing: GitHub exchanges an OIDC identity for a short-lived credential only in the publish step of the protected `npm` environment. No npm write token is stored in GitHub.
19
+ - A Git tag and GitHub release are created only after npm confirms the expected artifact integrity.
20
+ - GitHub Actions are pinned to reviewed commit SHAs, and the release Node.js/npm packer is pinned to an exact version.
21
+ - CI queries OSV for every exact package version in `pnpm-lock.yaml` and every dependency version shipped by the generator; it fails closed if the service remains unavailable after bounded retries or reports a finding.
22
+ - Local policy scans every tracked or non-ignored working-tree text file and built `dist/` file for high-confidence credential formats. Release jobs repeat the scan against the exact gzip tarball before it crosses the publish boundary. Placeholder examples use explicit non-secret values rather than allowlisting token-shaped strings.
23
+ - Release declarations must be valid Semantic Versioning and have a matching `CHANGELOG.md` section. Local deterministic checks validate workflow policy and confirm every Renovate custom manager still extracts a maintained pin.
24
+
25
+ Generated projects pin their stable dependency manifest, explicitly allow only required dependency build scripts, and record the selected toolchain channel in `anhedral.json`. The `latest` channel is for upstream-drift testing and is not the reproducible default.
26
+
27
+ Incremental generation rejects path traversal, symbolic-link targets, unowned collisions, modified managed files, and managed-file permission drift. Transaction journals are validated before recovery, fsynced before filesystem moves, and advanced only around durable rename barriers where the host filesystem supports directory synchronization.
28
+
29
+ UI component installation is an explicit networked supply-chain operation. Anhedral pins the shadcn installer version, routes Expo only to the official HTTPS React Native Reusables registry, validates component names and target paths, and runs provider mutation inside transaction staging. Provider-generated files and dependency manifests must pass ownership checks before commit. Users should review `--dry-run` output and the resulting source diff; registry content is upstream-maintained and is not part of Anhedral's immutable bundled-template catalog.
30
+
31
+ ## Secret response
32
+
33
+ If a secret-shaped finding is real, do not merely remove it from the latest commit. Revoke or rotate the credential first, identify every log, artifact, cache, fork, and package version that may contain it, and coordinate history or artifact cleanup with the security responder. Treat false positives by changing the example to an unmistakable placeholder; do not add broad path exclusions.
34
+
35
+ Anhedral is licensed under the Apache License 2.0. Security research must still
36
+ comply with applicable law and the systems owner's authorization; the software
37
+ license does not authorize testing infrastructure or accounts you do not own.