anhedral 0.4.1 → 0.6.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 (85) hide show
  1. package/README.md +29 -256
  2. package/assets/anhedral-cli-init-technical.svg +322 -0
  3. package/assets/anhedral-cli-init.svg +257 -173
  4. package/dist/bin.js +28 -162
  5. package/dist/dependencies.d.ts +7 -56
  6. package/dist/dependencies.js +96 -305
  7. package/dist/index.d.ts +2 -7
  8. package/dist/index.js +1 -4
  9. package/dist/{templates → platforms}/desktop.d.ts +1 -1
  10. package/dist/{templates → platforms}/desktop.js +28 -266
  11. package/dist/{templates → platforms}/extension.d.ts +1 -1
  12. package/dist/platforms/extension.js +401 -0
  13. package/dist/{templates → platforms}/mobile.d.ts +1 -1
  14. package/dist/platforms/mobile.js +232 -0
  15. package/dist/project.d.ts +4 -0
  16. package/dist/project.js +1 -0
  17. package/dist/standard-products.d.ts +2 -0
  18. package/dist/standard-products.js +6 -0
  19. package/dist/standard.d.ts +18 -0
  20. package/dist/standard.js +578 -0
  21. package/dist/version.d.ts +1 -1
  22. package/dist/version.js +1 -1
  23. package/docs/application-stack-standard.md +700 -0
  24. package/package.json +34 -49
  25. package/CHANGELOG.md +0 -132
  26. package/CONTRIBUTING.md +0 -73
  27. package/SECURITY.md +0 -37
  28. package/SKILL.md +0 -244
  29. package/assets/images/svg/ably-symbol-color.svg +0 -8
  30. package/bin/anhedral.js +0 -2
  31. package/dist/architecture/contributions.d.ts +0 -28
  32. package/dist/architecture/contributions.js +0 -125
  33. package/dist/architecture/index.d.ts +0 -12
  34. package/dist/architecture/index.js +0 -6
  35. package/dist/architecture/manifest.d.ts +0 -53
  36. package/dist/architecture/manifest.js +0 -283
  37. package/dist/architecture/modules.d.ts +0 -37
  38. package/dist/architecture/modules.js +0 -184
  39. package/dist/architecture/plan.d.ts +0 -58
  40. package/dist/architecture/plan.js +0 -145
  41. package/dist/architecture/templates.d.ts +0 -10
  42. package/dist/architecture/templates.js +0 -23
  43. package/dist/cli.d.ts +0 -32
  44. package/dist/cli.js +0 -235
  45. package/dist/composers/root.d.ts +0 -6
  46. package/dist/composers/root.js +0 -35
  47. package/dist/print.d.ts +0 -8
  48. package/dist/print.js +0 -48
  49. package/dist/prompts.d.ts +0 -5
  50. package/dist/prompts.js +0 -19
  51. package/dist/scaffold.d.ts +0 -76
  52. package/dist/scaffold.js +0 -1895
  53. package/dist/template-source.d.ts +0 -20
  54. package/dist/template-source.js +0 -180
  55. package/dist/templates/api.d.ts +0 -2
  56. package/dist/templates/api.js +0 -3122
  57. package/dist/templates/assets-private-proxy.d.ts +0 -3
  58. package/dist/templates/assets-private-proxy.js +0 -277
  59. package/dist/templates/electron-updater.d.ts +0 -3
  60. package/dist/templates/electron-updater.js +0 -358
  61. package/dist/templates/extension.js +0 -732
  62. package/dist/templates/mobile.js +0 -720
  63. package/dist/templates/shared.d.ts +0 -2
  64. package/dist/templates/shared.js +0 -520
  65. package/dist/templates/web.d.ts +0 -2
  66. package/dist/templates/web.js +0 -412
  67. package/dist/toolchain.d.ts +0 -3
  68. package/dist/toolchain.js +0 -8
  69. package/dist/ui.d.ts +0 -33
  70. package/dist/ui.js +0 -199
  71. package/dist/workspace-config.d.ts +0 -11
  72. package/dist/workspace-config.js +0 -372
  73. package/docs/conventions.md +0 -92
  74. package/docs/master-stack-map.md +0 -199
  75. package/docs/output-tree-contract.md +0 -482
  76. package/docs/references/manual-scaffolding.md +0 -403
  77. package/docs/references/provisioning.md +0 -220
  78. package/scripts/render-master-stack-map.mjs +0 -510
  79. package/templates/api-fastify/apps/api/tsconfig.json +0 -20
  80. package/templates/catalog.json +0 -23
  81. package/templates/db-drizzle/packages/db/tsconfig.json +0 -14
  82. package/templates/desktop-electron/apps/desktop/tsconfig.json +0 -37
  83. package/templates/extension-wxt/apps/extension/tsconfig.json +0 -41
  84. package/templates/mobile-expo/apps/mobile/expo-env.d.ts +0 -1
  85. package/templates/web-next/apps/web/next-env.d.ts +0 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "anhedral",
3
- "version": "0.4.1",
4
- "description": "Generate a complete, readable TypeScript product stack with Next.js, Expo, Fastify, Neon, Drizzle, Clerk, R2, Electron updates, WXT, and Vercel.",
3
+ "version": "0.6.0",
4
+ "description": "Initialize client-owned applications with shadcn, pnpm, Turborepo, and Cloudflare-first services.",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -12,28 +12,18 @@
12
12
  "types": "./dist/index.d.ts",
13
13
  "sideEffects": false,
14
14
  "bin": {
15
- "anhedral": "bin/anhedral.js"
15
+ "anhedral": "dist/bin.js"
16
16
  },
17
17
  "files": [
18
- "bin",
19
18
  "dist",
20
- "docs/conventions.md",
21
19
  "assets/anhedral-cli-init.svg",
22
- "assets/images/svg/ably-symbol-color.svg",
20
+ "assets/anhedral-cli-init-technical.svg",
23
21
  "assets/images/svg/logo-white-subtract.svg",
24
- "docs/master-stack-map.md",
25
- "docs/output-tree-contract.md",
26
- "docs/references",
27
- "scripts/render-master-stack-map.mjs",
28
- "templates",
29
- "SKILL.md",
30
- "CHANGELOG.md",
31
- "CONTRIBUTING.md",
32
22
  "LICENSE",
33
23
  "README.md",
34
- "SECURITY.md",
35
24
  "anhedral.svg",
36
- "favicon.ico"
25
+ "favicon.ico",
26
+ "docs/application-stack-standard.md"
37
27
  ],
38
28
  "homepage": "https://github.com/anhedral/anhedral-init#readme",
39
29
  "repository": {
@@ -53,7 +43,7 @@
53
43
  "scripts": {
54
44
  "scaffold": "node dist/bin.js init",
55
45
  "clean": "node scripts/clean.mjs",
56
- "build": "pnpm clean && tsc",
46
+ "build": "pnpm clean && tsc && node scripts/prepare-cli.mjs",
57
47
  "prepare": "pnpm build",
58
48
  "typecheck": "tsc --noEmit",
59
49
  "check:hygiene": "node scripts/check-source-hygiene.mjs",
@@ -61,56 +51,51 @@
61
51
  "check:release-policy": "node scripts/check-release-policy.mjs",
62
52
  "check:release-secrets": "node scripts/check-release-secrets.mjs",
63
53
  "lint": "pnpm typecheck && pnpm check:hygiene && pnpm check:release-policy",
64
- "audit:osv": "pnpm build && node scripts/audit-osv.mjs --generator",
65
- "test": "pnpm test:cli",
66
- "test:coverage": "pnpm build && c8 --all --include='dist/**/*.js' --reporter=text --reporter=json-summary --check-coverage --lines 84 --statements 84 --functions 84 --branches 80 node tests/test-cli.js",
54
+ "audit:osv": "node scripts/audit-osv.mjs",
55
+ "test": "pnpm test:unit",
67
56
  "pretest": "pnpm build",
68
57
  "prepublishOnly": "pnpm test:all",
69
- "test:cli": "node tests/test-cli.js",
70
- "test:cli:validation": "node tests/test-cli-validation.js",
71
- "test:deps": "pnpm build && node tests/test-dependency-manifest.js",
72
- "test:vercel-schema": "pnpm build && node tests/test-vercel-services-schema.js",
58
+ "test:cli:validation": "node --test tests/test-cli-validation.test.mjs",
73
59
  "test:pack": "pnpm build && node tests/test-packed-cli.js",
74
- "test:pack:exact": "node tests/test-packed-cli.js release-artifact/metadata.json",
60
+ "test:pack:exact": "node tests/test-packed-cli.js .artifacts/release/metadata.json",
75
61
  "test:packlist": "pnpm build && node tests/test-packlist.js",
76
- "test:release-tooling": "node tests/test-release-tooling.js",
77
- "test:topologies": "pnpm build && node tests/test-module-topology-invariants.js",
78
- "test:templates": "pnpm build && node tests/test-template-source.js",
79
- "pretest:e2e": "pnpm build",
80
- "test:e2e": "node tests/test-e2e-public-stacks.js",
81
- "pretest:e2e:latest": "pnpm build",
82
- "test:e2e:latest": "node tests/test-e2e-public-stacks.js --toolchain latest",
83
- "test:acceptance:desktop": "pnpm build && node tests/test-runtime-acceptance.js desktop",
84
- "test:acceptance:extension": "pnpm build && node tests/test-runtime-acceptance.js extension",
85
- "test:acceptance:mobile": "pnpm build && node tests/test-runtime-acceptance.js mobile",
86
- "test:all": "pnpm lint && pnpm check:security && pnpm audit:osv && pnpm test:coverage && pnpm test:deps && pnpm test:templates && pnpm test:vercel-schema && pnpm test:pack && pnpm test:packlist && pnpm test:e2e",
87
- "release:check": "pnpm check:release-policy && pnpm test:all && npm pack --dry-run --ignore-scripts",
88
- "release:pack": "pnpm build && node scripts/create-release-artifact.mjs && node scripts/check-release-secrets.mjs release-artifact/metadata.json",
89
- "release:artifact:verify": "node scripts/verify-release-artifact.mjs release-artifact/metadata.json && node scripts/check-release-secrets.mjs release-artifact/metadata.json",
90
- "release:artifact:smoke": "node tests/test-packed-cli.js release-artifact/metadata.json",
91
- "demo:refresh": "pnpm build && node tests/refresh-demo.js",
92
- "docs:stack-map": "node scripts/render-master-stack-map.mjs"
62
+ "test:release-tooling": "node tests/test-release-tooling.test.mjs",
63
+ "test:all": "pnpm build && pnpm lint && pnpm check:security && pnpm audit:osv && pnpm test:unit && node tests/test-packed-cli.js && node tests/test-packlist.js",
64
+ "release:check": "pnpm test:all",
65
+ "release:pack": "pnpm build && node scripts/create-release-artifact.mjs && node scripts/check-release-secrets.mjs .artifacts/release/metadata.json",
66
+ "release:artifact:verify": "node scripts/verify-release-artifact.mjs .artifacts/release/metadata.json && node scripts/check-release-secrets.mjs .artifacts/release/metadata.json",
67
+ "release:artifact:smoke": "node tests/test-packed-cli.js .artifacts/release/metadata.json",
68
+ "docs:stack-map": "node scripts/render-master-stack-map.mjs",
69
+ "docs:technical-stack-map": "node scripts/render-master-stack-map.mjs --technical",
70
+ "docs:stack-maps": "pnpm docs:stack-map && pnpm docs:technical-stack-map",
71
+ "test:standard": "pnpm build && node --test tests/test-standard.test.mjs",
72
+ "test:unit": "node --test --test-concurrency=4 --test-reporter=spec tests/*.test.mjs"
93
73
  },
94
74
  "keywords": [
95
75
  "cli",
96
76
  "scaffold",
97
77
  "typescript",
98
78
  "nextjs",
99
- "fastify",
79
+ "hono",
80
+ "cloudflare",
81
+ "opennext",
100
82
  "expo",
101
83
  "electron",
102
- "clerk",
103
- "drizzle",
104
- "neondb",
105
- "revenuecat",
106
84
  "wxt",
107
- "vercel"
85
+ "neon",
86
+ "drizzle",
87
+ "shadcn",
88
+ "turborepo"
108
89
  ],
109
90
  "license": "Apache-2.0",
110
91
  "packageManager": "pnpm@10.34.5",
92
+ "pnpm": {
93
+ "overrides": {
94
+ "brace-expansion@<=5.0.7": "5.0.8"
95
+ }
96
+ },
111
97
  "devDependencies": {
112
98
  "@types/node": "20.19.43",
113
- "c8": "11.0.0",
114
99
  "simple-icons": "16.27.0",
115
100
  "typescript": "5.9.3"
116
101
  }
package/CHANGELOG.md DELETED
@@ -1,132 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
-
7
- ## Unreleased
8
-
9
- ## 0.4.1 - 2026-07-22
10
-
11
- ### Added
12
-
13
- - Add the public launch artwork, reusable stack-map renderer, and expanded brand asset library to the repository and published package.
14
-
15
- ### Changed
16
-
17
- - Present Anhedral as a cross-platform, modular product stack that lets teams build once, ship everywhere, and scale without repeating framework setup.
18
- - Automatically create patch versions for ordinary changes merged to `main`, while preserving explicitly declared minor and major releases.
19
- - Keep project upgrades compatible across automatic patch releases and retain the supported 0.3-to-0.4 ownership migration.
20
- - Publish from the exact generated release commit and attach npm provenance now that the source repository is public.
21
-
22
- ## 0.4.0 - 2026-07-22
23
-
24
- ### Added
25
-
26
- - Add the `electron-updater` feature module, including packaged-app update checks, private R2 storage, a read-only bound Cloudflare Worker on a custom domain, ordered architecture-specific publishing commands, and a complete generated release runbook.
27
- - Make the `anhedral-init` coding-agent skill the recommended setup path, with project/domain intake, Computer Use and subagent orchestration, provider provisioning order, authentication and secret-generation stops, and verified Cloudflare/Vercel domain handoffs.
28
- - Add the canonical fixed-width master stack map to the published documentation and route the coding-agent skill through it for whole-platform planning and explanation.
29
- - Add a transactional project-upgrade path so compatible 0.3 projects can adopt 0.4 without regeneration.
30
- - Add a focused default development loop for the primary web and API surfaces, with `dev:all` available for intentionally launching every selected client.
31
-
32
- ### Changed
33
-
34
- - Make generated onboarding follow the real environment, managed-Neon, verification, and framework source layout instead of promising an unconfigured one-command boot.
35
- - Treat developer extension points as user-owned source while retaining conflict protection for generated wiring and mergeable workspace configuration.
36
- - Publish the skill's provisioning references from their canonical `docs/references` location and validate every packed local documentation link.
37
- - Upgrade GitHub artifact transfer actions to their Node.js 24-native releases and keep manual npm publication routed through the trusted-publisher workflow identity.
38
-
39
- ### Fixed
40
-
41
- - Canonicalize module ordering when an incremental feature contributes a previously absent dependency.
42
- - Attach release integrity metadata beside the npm tarball in GitHub Releases.
43
-
44
- ## 0.3.0 - 2026-07-21
45
-
46
- ### Added
47
-
48
- - Add a unified `anhedral ui add` workflow that routes DOM clients to shadcn/ui and Expo clients to React Native Reusables.
49
- - Add interactive starter-component selection after app surfaces and feature sets, with NativeWind or Uniwind selection for Expo.
50
- - Add React Native Reusables-ready Expo configuration, theme CSS, aliases, utilities, Metro integration, and portal hosting.
51
- - Add manifest schema v5 UI configuration and per-client component installation records.
52
- - Add staged provider execution, dry-run plans, duplicate-install detection, target validation, and provider routing tests.
53
- - Add `anhedral new <directory>` as the primary complete-stack creation flow while retaining `init` for an empty current directory.
54
- - Generate selection-aware `README.md`, `docs/DEVELOPMENT.md`, `docs/STACK.md`, and `SKILL.md` guidance that maps product tasks to ordinary framework source.
55
- - Publish the repository skill, manual scaffolding reference, conventions, and output-tree contract with the npm package.
56
-
57
- ### Changed
58
-
59
- - Pin the component installer to shadcn 4.13.0 and run all provider mutations inside Anhedral transaction staging.
60
- - Preserve Anhedral's exact Expo SDK dependency while resolving React Native Reusables registry dependencies before the root workspace install.
61
- - Present Anhedral as a readable TypeScript stack generator with native Next.js, Expo, Fastify, Drizzle, Electron, and WXT conventions rather than a proprietary application runtime.
62
- - Use argument-vector process execution for workspace installation instead of invoking a command through a shell.
63
- - Remove the retired one-app compiler experiment from the production CLI and package surface.
64
-
65
- ### Security
66
-
67
- - Reject symbolic-link scaffold roots before creating transaction metadata or modifying their targets.
68
- - Override vulnerable `shell-quote` and `sharp` dependency ranges in generated workspaces.
69
-
70
- ## 0.2.1 - 2026-07-16
71
-
72
- ### Added
73
-
74
- - Add integrity-checked bundled framework substrates, typed module contributions, deterministic root composers, and manifest schema v4 template provenance.
75
- - Add template tamper, symbolic-link, package-content, and contribution-composition regression tests.
76
- - Add exact-artifact portability checks at the minimum Node.js 20 and 22 releases and the pinned Node.js 24 release on macOS and Windows.
77
- - Add scheduled and release-gated Electron, WXT, and Expo native runtime acceptance lanes.
78
- - Add deterministic workflow, Renovate extraction, release declaration, registry recovery, and module-topology policy tests.
79
-
80
- ### Security
81
-
82
- - Reject altered template catalogs, mismatched substrate digests, symbolic links, forbidden generated artifacts, and oversized template trees before transactional commit.
83
- - Scan all tracked text, built output, and final package tarballs for high-confidence secret formats before publication.
84
- - Clarify that public package availability grants no installation, execution, or generated-output rights without a separate written agreement.
85
-
86
- ## 0.2.0 - 2026-07-15
87
-
88
- ### Added
89
-
90
- - Add manifest schema v3 with deterministic module dependency resolution, file ownership, hashes, modes, and an explicit toolchain channel.
91
- - Add transactional `init` and `add` operations with locking, journaling, rollback, dry-run plans, and JSON output.
92
- - Add the `anhedral doctor` command.
93
- - Add deterministic output-tree contracts for representative scaffold combinations.
94
-
95
- ### Changed
96
-
97
- - Generate only the dependencies, source files, environment keys, apps, and shared packages required by selected modules.
98
- - Align Vercel Services output with the current `services` schema and mount Fastify routes under the preserved `/api` path.
99
- - Refresh the verified Next.js, Expo, Clerk, Electron, WXT, Vite, and RevenueCat integration matrix.
100
- - Separate the side-effect-free package API from the executable CLI entry point.
101
- - Preserve user-owned documentation, workflows, package fields, and mergeable root configuration during incremental adds.
102
- - Build from a clean `dist/` directory before tests and packaging.
103
- - Publish one verified tarball and compare its integrity with npm before tagging.
104
- - Pin the release Node.js/npm packer so recovery rebuilds remain reproducible.
105
- - Install the exact release artifact and run its `.bin/anhedral` shim in package smoke tests.
106
- - Enforce an explicit npm package allowlist and artifact size policy.
107
- - Test the CLI on Node.js 20, 22, and 24 in CI.
108
- - Wire Clerk controls and token-aware API helpers into web and mobile templates, and make the desktop account action open Clerk sign-in or profile UI.
109
- - Bootstrap RevenueCat only for `native-subscriptions`, connect native purchases to the authenticated user, and expose a native paywall action.
110
- - Put pnpm overrides, build permissions, and peer policy in `pnpm-workspace.yaml`, with conflict-safe structural merges.
111
- - Keep public API GET requests simple by omitting unused platform and content-type headers.
112
- - Remove unused provider dependencies and environment placeholders from generated clients.
113
- - Wire Tailwind CSS v4 into generated web and desktop builds, including semantic shadcn color tokens.
114
- - Keep canonical module IDs and valid RFC 3986 URI schemes in generated project metadata and documentation.
115
- - Refresh generator-owned Node.js and pnpm policy during incremental adds when the recorded package manifest is unmodified.
116
-
117
- ### Removed
118
-
119
- - Remove pre-schema-v3 manifest migration, generated-layout adoption, deprecated module aliases, and duplicate `stack.json` output. Projects must be generated with the current CLI and use canonical module IDs.
120
-
121
- ### Security
122
-
123
- - Reject modified managed files and unowned path collisions before committing incremental changes.
124
- - Validate recovery journals, reject symlink traversal, and persist transaction intent before moving files.
125
- - Audit every locked CLI dependency through OSV after pnpm's retired audit endpoint became unavailable.
126
- - Make RevenueCat webhook processing fail closed and persist idempotency records when billing is selected.
127
- - Scope npm credentials to the single publish step in the protected release job.
128
- - Separate read-only release verification from npm publication and Git tag creation.
129
- - Pin GitHub Actions to verified upstream commit SHAs.
130
- - Default Fastify proxy trust to off, require an explicit bounded trusted-hop count, and minimize conditional Chrome permissions.
131
- - Reconcile exact package versions against detailed OSV advisory ranges when the batch index is over-broad.
132
- - Reject manifest-recorded directories and other non-regular paths during project health checks.
package/CONTRIBUTING.md DELETED
@@ -1,73 +0,0 @@
1
- # Contributing
2
-
3
- ## Local setup
4
-
5
- Anhedral requires Node.js 20.19+ or 22.12+ and pnpm 10.34.5.
6
-
7
- ```sh
8
- pnpm install --frozen-lockfile
9
- pnpm build
10
- pnpm lint
11
- pnpm check:security
12
- pnpm check:release-policy
13
- pnpm audit:osv
14
- pnpm test
15
- ```
16
-
17
- ## Before opening a pull request
18
-
19
- Run the checks relevant to the files you changed:
20
-
21
- ```sh
22
- pnpm typecheck
23
- pnpm test
24
- pnpm test:pack
25
- pnpm test:packlist
26
- pnpm test:release-tooling
27
- ```
28
-
29
- Changes to generated templates or dependency pins should also run:
30
-
31
- ```sh
32
- pnpm test:deps
33
- pnpm test:e2e
34
- ```
35
-
36
- The E2E test installs upstream packages in a disposable operating-system temp directory, so it requires network access and may take several minutes. It removes the workspace in a `finally` block; set `ANHEDRAL_E2E_KEEP=1` only when you intentionally need to inspect a failed or completed run.
37
-
38
- After an intentional scaffold-output change, regenerate and review the path/mode/SHA-256 contracts and generated tree documentation:
39
-
40
- ```sh
41
- pnpm build
42
- node tests/update-output-tree-contracts.js
43
- ```
44
-
45
- ## Package changes
46
-
47
- - Keep the public package allowlist narrow.
48
- - Do not commit `dist/`, tarballs, `release-artifact/`, or temporary E2E/demo workspaces.
49
- - Add or update a regression test for CLI behavior and generated configuration changes.
50
- - Keep stable toolchain commands pinned; mutable upstream versions belong only in the `latest` lane.
51
- - Run the OSV audit against a newly installed representative generated lockfile when changing framework or runtime pins.
52
-
53
- ## Ownership and required review
54
-
55
- Repository administrators must map the following roles to real maintainers in branch protection, the protected `npm` environment, private vulnerability reporting, and workflow-failure notifications:
56
-
57
- - **Generator owner:** core architecture, transactions, manifests, and generated-file ownership.
58
- - **Runtime owner:** application templates, provider integrations, and the stable dependency manifest.
59
- - **Release owner:** package metadata, CI workflows, registry publication, tags, and recovery.
60
- - **Security responder:** vulnerability intake, secret-exposure response, and supply-chain incidents.
61
-
62
- No `CODEOWNERS` file is committed until an actual GitHub user or team slug is selected. A placeholder would create false confidence without enforcing review. Require at least one appropriate owner review for generator/runtime changes and a release-owner review for `.github/workflows/`, `scripts/`, `package.json`, `renovate.json`, `SECURITY.md`, or `docs/RELEASING.md`.
63
-
64
- Scheduled Toolchain Drift failures and release-workflow failures must alert the release owner. Security-policy, secret-scan, or OSV failures must additionally alert the security responder. Configure those routes in repository notification settings and test them after changing ownership.
65
-
66
- ## Releases
67
-
68
- Do not run `npm publish` from a development checkout. Version changes are reviewed before release, and CI publishes the verified tarball. See [docs/RELEASING.md](docs/RELEASING.md).
69
-
70
- This repository and package are licensed under the Apache License 2.0. Unless
71
- explicitly stated otherwise, contributions intentionally submitted for
72
- inclusion in Anhedral are provided under the same license, as described in
73
- Section 5 of [LICENSE](LICENSE).
package/SECURITY.md DELETED
@@ -1,37 +0,0 @@
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.
package/SKILL.md DELETED
@@ -1,244 +0,0 @@
1
- ---
2
- name: anhedral-init
3
- description: Guide a user through creating, provisioning, extending, explaining, or diagnosing a complete Anhedral TypeScript stack. Use for skill-led new/init/add/ui/doctor workflows; Computer Use or subagent-assisted cloud setup; domains, DNS, Vercel, Cloudflare, Neon, Clerk, R2, billing, stores, and Electron updates; development inside a generated workspace; ownership interpretation; manual reproduction; or verification.
4
- ---
5
-
6
- # Anhedral Init
7
-
8
- Anhedral is a stack generator, not an application runtime or programming language. Generated projects use ordinary framework source and expose the complete integration code. Do not invent Anhedral-specific models, routes, queries, components, or client hooks when the selected framework already has a documented convention.
9
-
10
- For every new project or provisioning request, begin by asking for the project
11
- name and whether the user already owns a custom domain for it. Do not run init
12
- or create provider resources until those answers establish canonical names.
13
-
14
- Use Node.js 20.19+ or 22.12+ and pnpm. `new` creates a destination directory; `init` works in an empty current directory where `.git`, `.gitignore`, and `.DS_Store` are allowed.
15
-
16
- ## Choose the construction path
17
-
18
- - Use the manual path whenever the user asks to avoid the Anhedral CLI, the CLI is unavailable, or the task requires explaining/reproducing the scaffold itself.
19
- - Before creating or changing files manually, read [docs/references/manual-scaffolding.md](docs/references/manual-scaffolding.md) completely and follow its ordered procedure. Treat it as the canonical manual checklist, including its source-file matrix and feature gates.
20
- - Use the CLI path only when the user permits it. Do not silently substitute `anhedral init`, `anhedral add`, imported generator code, or a generated demo for the manual path.
21
- - For an exact-version scaffold inside the Anhedral source repository, render from the current `src/templates/*.ts`, `src/scaffold.ts`, and `src/dependencies.ts`; do not copy stale demo output. Outside that repository, implement the behavior and file contract in the manual reference and pin a mutually compatible toolchain.
22
-
23
- The manual path must leave a complete working workspace, not merely a directory tree or list of commands. Write the source, configuration, tests, environment examples, CI, deployment configuration, and database migration gate selected by the module plan. Install and verify when the environment permits it.
24
-
25
- ## Select modules
26
-
27
- Choose app surfaces from `web`, `mobile`, `api`, `desktop`, and `extension`.
28
-
29
- Choose features from `db`, `auth`, `billing`, `storage`, `native-subscriptions`, and `electron-updater`.
30
-
31
- Apply these dependency rules automatically:
32
-
33
- ```text
34
- auth -> api + db
35
- billing -> auth
36
- storage -> auth
37
- native-subscriptions -> mobile + billing
38
- electron-updater -> desktop
39
- ```
40
-
41
- With no module flags, generate the full stack.
42
-
43
- ## Master stack map
44
-
45
- Read [docs/master-stack-map.md](docs/master-stack-map.md) completely before
46
- explaining the whole platform, selecting modules for a complete product, or
47
- planning cross-provider provisioning. Treat it as the canonical map of the
48
- stack, command surface, runtime connections, agent workflow, and release path.
49
-
50
- ```text
51
- project + domain intake
52
- |
53
- v
54
- 1 select + plan -> 2 generate safely -> 3 one pnpm/Turborepo workspace
55
- |
56
- v
57
- 4 connected product capabilities -> 5 provision cloud + DNS
58
- |
59
- v
60
- 6 generated package.json commands -> 7 developer/agent/Computer Use
61
- |
62
- v
63
- 8 verify, release, and operate
64
- ```
65
-
66
- Use the full fixed-width ASCII map from the document when the user asks for the
67
- master stack map. Do not redraw it from memory or omit unselected modules when
68
- describing Anhedral's complete capability surface; mark modules as selected or
69
- unselected separately.
70
-
71
- ## Run the guided init workflow
72
-
73
- Read [docs/references/provisioning.md](docs/references/provisioning.md) completely before
74
- starting a new project or provisioning any provider. Follow its intake,
75
- capability discovery, Computer Use, subagent, authentication, secret-handling,
76
- domain, provider-order, and verification gates.
77
-
78
- The lead agent must:
79
-
80
- 1. Ask for project name and existing/custom-domain status first.
81
- 2. Discover whether Computer Use/browser control and subagents are available.
82
- 3. Resolve modules and show the user canonical project/resource names.
83
- 4. Run the explicit CLI command, then read the generated `PRODUCTION.md`.
84
- 5. Provision only selected providers, pausing for sign-in, MFA, secret
85
- generation, purchases, and final submissions exactly as the reference says.
86
- 6. Keep secrets out of chat and tool output; have the user paste them directly
87
- into uncommitted environment files and protected provider fields.
88
- 7. Verify code, cloud resources, DNS, TLS, and provider health before handoff.
89
-
90
- ## Initialize
91
-
92
- ```sh
93
- pnpm dlx anhedral@latest new my-product
94
- cd my-product
95
- ```
96
-
97
- Prefer explicit modules when the user requests a smaller stack:
98
-
99
- ```sh
100
- pnpm dlx anhedral@latest new my-product --web --api --db --auth
101
- pnpm dlx anhedral@latest new my-product --web --mobile --ui button,dialog --native-styling nativewind
102
- pnpm dlx anhedral@latest new my-api --api --skip-install
103
- ```
104
-
105
- Use the stable toolchain for normal generation. The `latest` value is retained only as a metadata compatibility channel for maintainer investigations:
106
-
107
- ```sh
108
- pnpm dlx anhedral@latest new my-product --toolchain stable
109
- pnpm dlx anhedral@latest new my-product --toolchain latest
110
- ```
111
-
112
- Both channels generate the same exact verified dependencies and integrity-checked bundled templates; `latest` only records investigation intent in `anhedral.json`. Upstream refreshes happen outside user projects and are shipped only after review and checksum verification. Neither channel invokes mutable upstream framework generators inside a user project.
113
-
114
- Do not run any command in this section during the manual path.
115
-
116
- ## Develop inside a generated project
117
-
118
- Read these files before changing product code:
119
-
120
- 1. `README.md` for the selected modules, first run, and source-location map.
121
- 2. `docs/DEVELOPMENT.md` for end-to-end feature recipes.
122
- 3. `docs/STACK.md` for responsibility boundaries and official tool documentation.
123
- 4. `PRODUCTION.md` only for provisioning, deployment, DNS, stores, or release work.
124
-
125
- Use the native source conventions:
126
-
127
- - Next.js code belongs in `apps/web/app`, `apps/web/components`, and `apps/web/lib`.
128
- - Expo Router code belongs in `apps/mobile/app` and `apps/mobile/components`.
129
- - Product Fastify route registration belongs in `apps/api/src/routes/app.ts`. Server-only feature modules live alongside the managed integrations in `apps/api/src`.
130
- - Product Zod network schemas belong in `packages/contracts/src/app.ts`.
131
- - Product client-safe HTTP methods belong in `packages/api-client/src/app.ts`.
132
- - Product Drizzle tables belong in `packages/db/src/app-schema.ts`; generate and review SQL migrations.
133
-
134
- Implement an end-to-end feature as `contracts -> database/service -> route -> API client -> frontend`. Frontends may import contracts and client-safe packages, never API services, database connections, or server environments. This stack uses managed Neon and intentionally has no local Postgres service.
135
-
136
- ## Add modules safely
137
-
138
- Run `add` only from a project containing `anhedral.json` schema v5 at the current generator version. If `doctor` identifies a supported older generator, preview and apply its transactional upgrade first:
139
-
140
- ```sh
141
- pnpm dlx anhedral@latest upgrade --dry-run
142
- pnpm dlx anhedral@latest upgrade
143
- pnpm dlx anhedral@latest add desktop extension
144
- pnpm dlx anhedral@latest add storage --dry-run
145
- ```
146
-
147
- Use `--dry-run` before a consequential add. Use `--json` when another program needs the plan; JSON failures include a stable `code` and a human-readable `error`. Use `--verbose` for interactive child-command diagnostics. Anhedral preserves recorded user-owned extension files and intentionally refuses modified managed files, symlinks, and unowned collisions; do not bypass those conflicts.
148
-
149
- For a 0.3 upgrade blocked by a modified managed file, preserve the change in source control, restore that file to its recorded 0.3 content, apply the upgrade, and port the product behavior into the corresponding 0.4 user-owned extension seam. Never approve the upgrade by rewriting manifest hashes.
150
-
151
- Require the manifest generator version to match the running CLI. Regenerate projects created by another version; do not add compatibility branches.
152
-
153
- Do not rewrite a generated project's README or custom workflows while adding modules. Preserve custom package fields and mergeable root configuration.
154
-
155
- For manual projects without a trustworthy schema-v5 `anhedral.json`, add modules with the manual reference instead. Never fabricate manifest ownership records, template provenance, UI installation records, or hashes. A manually authored workspace is valid as an application workspace but is not CLI-managed until it has been regenerated by a matching Anhedral version.
156
-
157
- ## Add UI components
158
-
159
- Use the unified UI wrapper for source-owned components:
160
-
161
- ```sh
162
- pnpm dlx anhedral@latest ui add button dialog
163
- pnpm dlx anhedral@latest ui add select --target mobile
164
- pnpm dlx anhedral@latest ui add data-table --target web --dry-run
165
- ```
166
-
167
- Anhedral routes web, desktop, and extension targets to shadcn/ui. It routes Expo mobile to React Native Reusables using the manifest's NativeWind or Uniwind selection. Omit `--target` to add the provider-specific implementation to every selected UI client. Provider writes occur in transaction staging and must pass the same ownership checks as module additions.
168
-
169
- ## Diagnose
170
-
171
- Dry-runs never perform transaction recovery. If a recovery journal is pending, rerun the original command without `--dry-run` before requesting a new preview.
172
-
173
- Check recorded files and hashes with:
174
-
175
- ```sh
176
- pnpm dlx anhedral@latest doctor
177
- pnpm dlx anhedral@latest doctor --json
178
- ```
179
-
180
- Explain that warnings can represent mergeable or user-owned drift, while modified or missing managed files make the project unhealthy.
181
-
182
- ## Configure the generated project
183
-
184
- Copy environment examples, fill only selected provider values, install, and verify:
185
-
186
- ```sh
187
- cp apps/api/.env.example apps/api/.env
188
- cp packages/db/.env.example packages/db/.env
189
- pnpm install
190
- pnpm verify
191
- ```
192
-
193
- Copy only examples that exist for the selected surfaces. Client packages use package-local runtime files (for example, copy `apps/web/.env.example` to `apps/web/.env.local` and `apps/desktop/.env.example` to `apps/desktop/.env`); the root `.env.example` is an inventory, not a runtime environment file.
194
-
195
- Common selected keys are:
196
-
197
- - Neon: `DATABASE_URL`
198
- - Clerk server: `CLERK_PUBLISHABLE_KEY`, `CLERK_SECRET_KEY`
199
- - Clerk clients: `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY`, `EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY`, `VITE_CLERK_PUBLISHABLE_KEY`
200
- - RevenueCat: `RC_WEBHOOK_SECRET`, `RC_SECRET_API_KEY`, `RC_ENTITLEMENT_ID`, `EXPO_PUBLIC_RC_*`
201
- - Ably billing synchronization: server-only `ABLY_API_KEY`; clients obtain scoped tokens from the API
202
- - R2: `BASE_URL`, `R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_BUCKET_NAME`, `R2_PREFIX=storage`, `R2_PROXY_READ_URL_TTL_SECONDS=600`; keep `CLOUDFLARE_API_TOKEN` operations/CI-only
203
- - Internal billing/storage jobs: high-entropy server-only `CRON_SECRET`
204
- - Electron updates: `DESKTOP_UPDATE_BASE_URL` in `apps/desktop/electron-builder.env`; the private R2 binding needs no credential in the packaged application
205
-
206
- Never commit real `.env` files. Keep `ANHEDRAL_DEMO=false` in production.
207
-
208
- Run only scripts present for installed modules. `pnpm dev` starts the primary
209
- product loop—web plus API when web is selected, otherwise the first selected
210
- surface. A multi-surface project also exposes `pnpm dev:all`; use it only when
211
- the user wants every selected development server. Typical focused commands
212
- include `dev:web`, `dev:mobile`, `dev:api`, `dev:desktop`, `dev:extension`,
213
- corresponding `verify:*` scripts, and database scripts for `db` projects.
214
-
215
- ## Understand deployment
216
-
217
- Treat the root `vercel.json` as the only Vercel Services configuration. It uses the current `services` schema, declares `apps/api` and `apps/web` as independent service roots, and routes `/api/(.*)` before the web catch-all. Vercel preserves the original path, so Fastify mounts its routes under `/api` locally and in deployment. Select the Services framework preset before deploying.
218
-
219
- For billing, keep Neon authoritative: RevenueCat reconciliation writes the subscription revision and realtime outbox atomically, Ably carries only per-user invalidations, and every client refetches the entitlement. Schedule the authenticated outbox flush every five minutes and verify purchase, webhook, reconnect, and foreground recovery paths.
220
-
221
- Use `apps/mobile` for EAS, `pnpm desktop:build` for a current-host Electron artifact, matching platform-specific desktop scripts in CI, and `pnpm extension:zip` for the WXT archive.
222
-
223
- For `electron-updater`, provision the generated private R2 bucket and
224
- `desktop-updater` Worker at `updates.<domain>`. Keep the Worker custom domain and
225
- `DESKTOP_UPDATE_BASE_URL` identical. Build signed artifacts on each native
226
- platform and publish artifacts before mutable channel metadata.
227
-
228
- For storage, generate `apps/assets-private-proxy` plus `cloudflare/r2-cors.template.json` and keep the R2 bucket private. The Worker must be named `assets-private-proxy`, bind the normalized `<project>-assets` bucket as `ASSETS`, disable `workers.dev`, and own `assets.<domain>` as a Worker Custom Domain. Presigned uploads continue on the R2 S3 API hostname. Root every key below `R2_PREFIX=storage`; expose only `storage/confirmed/` through the Worker and reject staging plus `generation-inputs`. Authenticated private reads must verify upload ownership and return a presigned GET URL bounded by `R2_PROXY_READ_URL_TTL_SECONDS`.
229
-
230
- When explaining domains, distinguish DNS delegation from registrar transfer. A GoDaddy registration can use Cloudflare authoritative nameservers immediately; transferring registration/billing to Cloudflare Registrar is optional and subject to eligibility locks. Keep Vercel app/API A or CNAME records DNS-only in Cloudflare, while Worker Custom Domains stay Cloudflare-managed and proxied.
231
-
232
- ## Verify outcomes
233
-
234
- After generation or repair, run the strongest practical checks:
235
-
236
- ```sh
237
- pnpm typecheck
238
- pnpm verify
239
- pnpm build
240
- ```
241
-
242
- Use `pnpm --filter ./apps/api test` when the API exists. If verification fails, report the exact package and command rather than replacing generated ownership records manually.
243
-
244
- For exact representative trees, consult `docs/output-tree-contract.md` in the Anhedral repository. During manual construction, also compare the finished workspace with the file matrix in [docs/references/manual-scaffolding.md](docs/references/manual-scaffolding.md); every selected conditional file must exist and every unselected provider integration must be absent.
@@ -1,8 +0,0 @@
1
- <svg width="78" height="64" viewBox="0 0 78 64" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M38.5717 0L6.29575 59.0738L0 54.6586L29.8639 0H38.5717ZM39.0214 0L71.2973 59.0738L77.5931 54.6586L47.7292 0H39.0214Z" fill="url(#ably-symbol-a)"/>
3
- <path d="M70.8477 59.4213L38.7966 34.3201L6.74548 59.4213L13.2865 64L38.7966 44.0294L64.3066 64L70.8477 59.4213Z" fill="url(#ably-symbol-b)"/>
4
- <defs>
5
- <linearGradient id="ably-symbol-a" x1="10.9472" y1="74.8439" x2="64.9206" y2="14.9005" gradientUnits="userSpaceOnUse"><stop stop-color="#FF5416"/><stop offset="0.461" stop-color="#FF4712"/><stop offset="1" stop-color="#FF0000"/></linearGradient>
6
- <linearGradient id="ably-symbol-b" x1="21.4169" y1="78.7187" x2="53.3166" y2="43.2904" gradientUnits="userSpaceOnUse"><stop stop-color="#FF5416"/><stop offset="0.461" stop-color="#FF4712"/><stop offset="1" stop-color="#FF0000"/></linearGradient>
7
- </defs>
8
- </svg>
package/bin/anhedral.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import '../dist/bin.js';