create-claudecraft 1.0.0 → 2.0.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 (258) hide show
  1. package/README.md +43 -178
  2. package/bin/cli.js +186 -1
  3. package/dist/answers.d.ts +269 -0
  4. package/dist/answers.js +215 -0
  5. package/dist/ink-prompts.d.ts +90 -12
  6. package/dist/ink-prompts.js +371 -330
  7. package/dist/lettering.d.ts +2 -0
  8. package/dist/lettering.js +28 -0
  9. package/lib/apps.mjs +141 -0
  10. package/lib/github.mjs +24 -0
  11. package/lib/init.mjs +153 -0
  12. package/lib/ports.mjs +56 -0
  13. package/lib/scaffold.mjs +218 -0
  14. package/lib/upgrade.mjs +164 -0
  15. package/package.json +39 -33
  16. package/templates/astro/.editorconfig +15 -0
  17. package/templates/astro/.env.example +2 -0
  18. package/templates/astro/.github/workflows/ci.yml +37 -0
  19. package/templates/astro/.github/workflows/deploy.yml +46 -0
  20. package/templates/astro/.nvmrc +1 -0
  21. package/templates/astro/.prettierignore +10 -0
  22. package/templates/astro/.prettierrc.json +7 -0
  23. package/templates/astro/.vscode/extensions.json +3 -0
  24. package/templates/astro/.vscode/settings.json +12 -0
  25. package/templates/astro/AGENTS.md +100 -0
  26. package/templates/astro/README.md +42 -0
  27. package/templates/astro/_CLAUDE.md +1 -0
  28. package/templates/astro/_claude/launch.json +13 -0
  29. package/templates/astro/_claude/settings.json +22 -0
  30. package/templates/astro/_codex/environments/environment.toml +20 -0
  31. package/templates/astro/_gitignore +31 -0
  32. package/templates/astro/_npmrc +8 -0
  33. package/templates/astro/_super.engineering/config.json +8 -0
  34. package/templates/astro/_zed/tasks.json +5 -0
  35. package/templates/astro/astro.config.mjs +111 -0
  36. package/templates/astro/docs/README.md +7 -0
  37. package/templates/astro/docs/decisions.md +3 -0
  38. package/templates/astro/docs/inbox.md +7 -0
  39. package/templates/astro/docs/kit/agent-apps.md +15 -0
  40. package/templates/astro/docs/kit/analytics.md +13 -0
  41. package/templates/astro/docs/kit/deploy.md +9 -0
  42. package/templates/astro/docs/kit/images.md +10 -0
  43. package/templates/astro/docs/kit/languages.md +8 -0
  44. package/templates/astro/docs/kit/local.md +16 -0
  45. package/templates/astro/docs/kit/seo.md +15 -0
  46. package/templates/astro/docs/kit/structure.md +40 -0
  47. package/templates/astro/docs/kit/upgrade.md +19 -0
  48. package/templates/astro/functions/_middleware.js +25 -0
  49. package/templates/astro/intent.md +40 -0
  50. package/templates/astro/package.json +46 -0
  51. package/templates/astro/public/_headers +17 -0
  52. package/templates/astro/public/_routes.json +5 -0
  53. package/templates/astro/public/apple-touch-icon.png +0 -0
  54. package/templates/astro/public/favicon-16.png +0 -0
  55. package/templates/astro/public/favicon-32.png +0 -0
  56. package/templates/astro/public/favicon.ico +0 -0
  57. package/templates/astro/public/favicon.svg +4 -0
  58. package/templates/astro/public/icon-192.png +0 -0
  59. package/templates/astro/public/icon-512.png +0 -0
  60. package/templates/astro/public/og-image.png +0 -0
  61. package/templates/astro/scripts/chrome.mjs +138 -0
  62. package/templates/astro/scripts/deploy.sh +69 -0
  63. package/templates/astro/scripts/generate-icons.mjs +73 -0
  64. package/templates/astro/scripts/generate-og.mjs +66 -0
  65. package/templates/astro/scripts/lint-copy.mjs +67 -0
  66. package/templates/astro/scripts/local-domain.mjs +115 -0
  67. package/templates/astro/scripts/markdown-pages.mjs +142 -0
  68. package/templates/astro/scripts/og-template.html +73 -0
  69. package/templates/astro/scripts/shared.mjs +33 -0
  70. package/templates/astro/scripts/verify-build.mjs +283 -0
  71. package/templates/astro/scripts/verify.mjs +19 -0
  72. package/templates/astro/site.config.mjs +85 -0
  73. package/templates/astro/src/components/Analytics.astro +49 -0
  74. package/templates/astro/src/components/Consent.astro +52 -0
  75. package/templates/astro/src/components/Counter.tsx +20 -0
  76. package/templates/astro/src/data/README.md +18 -0
  77. package/templates/astro/src/dev/styleguide.astro +43 -0
  78. package/templates/astro/src/env.d.ts +1 -0
  79. package/templates/astro/src/i18n/ar.json +29 -0
  80. package/templates/astro/src/i18n/de.json +29 -0
  81. package/templates/astro/src/i18n/en.json +29 -0
  82. package/templates/astro/src/i18n/es.json +29 -0
  83. package/templates/astro/src/i18n/fr.json +29 -0
  84. package/templates/astro/src/i18n/he.json +29 -0
  85. package/templates/astro/src/i18n/hi.json +29 -0
  86. package/templates/astro/src/i18n/index.ts +80 -0
  87. package/templates/astro/src/i18n/it.json +29 -0
  88. package/templates/astro/src/i18n/ja.json +29 -0
  89. package/templates/astro/src/i18n/ko.json +29 -0
  90. package/templates/astro/src/i18n/nl.json +29 -0
  91. package/templates/astro/src/i18n/pl.json +29 -0
  92. package/templates/astro/src/i18n/pt-br.json +29 -0
  93. package/templates/astro/src/i18n/ro.json +29 -0
  94. package/templates/astro/src/i18n/ru.json +29 -0
  95. package/templates/astro/src/i18n/sv.json +29 -0
  96. package/templates/astro/src/i18n/tr.json +29 -0
  97. package/templates/astro/src/i18n/uk.json +29 -0
  98. package/templates/astro/src/i18n/zh-cn.json +29 -0
  99. package/templates/astro/src/layouts/BaseLayout.astro +205 -0
  100. package/templates/astro/src/lib/cn.ts +7 -0
  101. package/templates/astro/src/lib/consent.ts +32 -0
  102. package/templates/astro/src/lib/seo.ts +18 -0
  103. package/templates/astro/src/lib/theme.ts +5 -0
  104. package/templates/astro/src/pages/404.astro +7 -0
  105. package/templates/astro/src/pages/[...locale]/404.astro +25 -0
  106. package/templates/astro/src/pages/[...locale]/about.astro +25 -0
  107. package/templates/astro/src/pages/[...locale]/index.astro +30 -0
  108. package/templates/astro/src/pages/[...locale]/privacy.astro +28 -0
  109. package/templates/astro/src/pages/robots.txt.ts +16 -0
  110. package/templates/astro/src/pages/site.webmanifest.ts +26 -0
  111. package/templates/astro/src/styles/global.css +163 -0
  112. package/templates/astro/t3.json +22 -0
  113. package/templates/astro/tsconfig.json +13 -0
  114. package/templates/astro/wrangler.toml +8 -0
  115. package/templates/react/.editorconfig +15 -0
  116. package/templates/react/.env.example +2 -0
  117. package/templates/react/.nvmrc +1 -0
  118. package/templates/react/.prettierignore +11 -0
  119. package/templates/react/.prettierrc.json +5 -0
  120. package/templates/react/.vscode/extensions.json +3 -0
  121. package/templates/react/.vscode/settings.json +4 -0
  122. package/templates/react/AGENTS.md +64 -0
  123. package/templates/react/README.md +31 -0
  124. package/templates/react/_CLAUDE.md +1 -0
  125. package/templates/react/_claude/launch.json +13 -0
  126. package/templates/react/_claude/settings.json +21 -0
  127. package/templates/react/_codex/environments/environment.toml +20 -0
  128. package/templates/react/_gitignore +17 -0
  129. package/templates/react/_npmrc +8 -0
  130. package/templates/react/_super.engineering/config.json +8 -0
  131. package/templates/react/_zed/tasks.json +5 -0
  132. package/templates/react/docs/decisions.md +3 -0
  133. package/templates/react/docs/inbox.md +7 -0
  134. package/templates/react/index.html +14 -0
  135. package/templates/react/package.json +47 -0
  136. package/templates/react/public/favicon.svg +5 -0
  137. package/templates/react/scripts/lint-copy.mjs +46 -0
  138. package/templates/react/scripts/lint-tokens.mjs +44 -0
  139. package/templates/react/scripts/local-domain.mjs +115 -0
  140. package/templates/react/scripts/verify.mjs +20 -0
  141. package/templates/react/site.config.mjs +23 -0
  142. package/templates/react/src/App.test.tsx +15 -0
  143. package/templates/react/src/App.tsx +21 -0
  144. package/templates/react/src/components/ErrorBoundary.tsx +42 -0
  145. package/templates/react/src/components/SkipLink.tsx +10 -0
  146. package/templates/react/src/config/site.ts +5 -0
  147. package/templates/react/src/lib/cn.ts +7 -0
  148. package/templates/react/src/main.tsx +13 -0
  149. package/templates/react/src/pages/HomePage.tsx +71 -0
  150. package/templates/react/src/pages/NotFoundPage.tsx +21 -0
  151. package/templates/react/src/styles/global.css +96 -0
  152. package/templates/react/src/test-setup.ts +1 -0
  153. package/templates/react/t3.json +22 -0
  154. package/templates/{base → react}/tsconfig.json +3 -3
  155. package/templates/react/vite.config.ts +26 -0
  156. package/templates/shared/_claude/hooks/design-lint.mjs +67 -0
  157. package/templates/shared/_claude/skills/design-quality/SKILL.md +113 -0
  158. package/templates/shared/_claude/skills/design-quality/references/composition-palette.md +87 -0
  159. package/templates/shared/_claude/skills/design-quality/references/copy-tells.md +49 -0
  160. package/templates/shared/_claude/skills/design-quality/references/visual-critic.md +75 -0
  161. package/templates/shared/design.md +148 -0
  162. package/templates/shared/intent.md +28 -0
  163. package/dist/constants.d.ts +0 -71
  164. package/dist/constants.js +0 -128
  165. package/dist/index.d.ts +0 -1
  166. package/dist/index.js +0 -229
  167. package/dist/prompts.d.ts +0 -16
  168. package/dist/prompts.js +0 -434
  169. package/dist/scaffold.d.ts +0 -19
  170. package/dist/scaffold.js +0 -303
  171. package/dist/ui.d.ts +0 -27
  172. package/dist/ui.js +0 -254
  173. package/templates/app/App.tsx +0 -21
  174. package/templates/base/CLAUDE.md +0 -332
  175. package/templates/base/eslint.config.js +0 -28
  176. package/templates/base/index.html +0 -17
  177. package/templates/base/package.json +0 -43
  178. package/templates/base/postcss.config.js +0 -6
  179. package/templates/base/tailwind.config.js +0 -81
  180. package/templates/base/vite.config.ts +0 -16
  181. package/templates/commands/brainstorm.md +0 -6
  182. package/templates/commands/build.md +0 -41
  183. package/templates/commands/execute-plan.md +0 -6
  184. package/templates/commands/lint.md +0 -41
  185. package/templates/commands/ralph.md +0 -113
  186. package/templates/commands/typecheck.md +0 -44
  187. package/templates/commands/write-plan.md +0 -6
  188. package/templates/components/ErrorBoundary.tsx +0 -49
  189. package/templates/components/ui/Button.tsx +0 -60
  190. package/templates/components/ui/CodeBlock.tsx +0 -46
  191. package/templates/components/ui/CopyCommand.tsx +0 -38
  192. package/templates/components/ui/FilePreview.tsx +0 -46
  193. package/templates/components/ui/SkipLink.tsx +0 -7
  194. package/templates/components/ui/ThemeSelector.tsx +0 -41
  195. package/templates/components/ui/UICarousel.tsx +0 -309
  196. package/templates/context/ThemeContext.tsx +0 -61
  197. package/templates/homepage/HomePage.tsx +0 -534
  198. package/templates/homepage/NotFoundPage.tsx +0 -17
  199. package/templates/hooks/README.md +0 -82
  200. package/templates/hooks/check-branch.js +0 -27
  201. package/templates/hooks/typecheck-after-edit.js +0 -51
  202. package/templates/index.css +0 -67
  203. package/templates/lib/utils.ts +0 -9
  204. package/templates/main.tsx +0 -16
  205. package/templates/settings/MCP_SETUP.md +0 -76
  206. package/templates/settings/settings.json +0 -16
  207. package/templates/settings/settings.local.json +0 -37
  208. package/templates/skills/design/a11y-audit/SKILL.md +0 -173
  209. package/templates/skills/design/design-polish/SKILL.md +0 -75
  210. package/templates/skills/design/figma-to-code/SKILL.md +0 -157
  211. package/templates/skills/design/json-ld/SKILL.md +0 -125
  212. package/templates/skills/design/microcopy/SKILL.md +0 -197
  213. package/templates/skills/design/og-image/SKILL.md +0 -157
  214. package/templates/skills/design/ralph-wiggum-loops/SKILL.md +0 -299
  215. package/templates/skills/design/react-best-practices/SKILL.md +0 -106
  216. package/templates/skills/design/react-best-practices/references/react-performance-guidelines.md +0 -143
  217. package/templates/skills/design/seo-review/SKILL.md +0 -96
  218. package/templates/skills/design/sitemap-generator/SKILL.md +0 -66
  219. package/templates/skills/design/testing-patterns/SKILL.md +0 -276
  220. package/templates/skills/design/ui-skills/SKILL.md +0 -85
  221. package/templates/skills/design/visual-iteration/SKILL.md +0 -88
  222. package/templates/skills/workflow/brainstorming/SKILL.md +0 -54
  223. package/templates/skills/workflow/dispatching-parallel-agents/SKILL.md +0 -180
  224. package/templates/skills/workflow/executing-plans/SKILL.md +0 -76
  225. package/templates/skills/workflow/finishing-a-development-branch/SKILL.md +0 -200
  226. package/templates/skills/workflow/receiving-code-review/SKILL.md +0 -213
  227. package/templates/skills/workflow/requesting-code-review/SKILL.md +0 -105
  228. package/templates/skills/workflow/requesting-code-review/code-reviewer.md +0 -146
  229. package/templates/skills/workflow/subagent-driven-development/SKILL.md +0 -240
  230. package/templates/skills/workflow/subagent-driven-development/code-quality-reviewer-prompt.md +0 -20
  231. package/templates/skills/workflow/subagent-driven-development/implementer-prompt.md +0 -78
  232. package/templates/skills/workflow/subagent-driven-development/spec-reviewer-prompt.md +0 -61
  233. package/templates/skills/workflow/systematic-debugging/CREATION-LOG.md +0 -119
  234. package/templates/skills/workflow/systematic-debugging/SKILL.md +0 -296
  235. package/templates/skills/workflow/systematic-debugging/condition-based-waiting-example.ts +0 -158
  236. package/templates/skills/workflow/systematic-debugging/condition-based-waiting.md +0 -115
  237. package/templates/skills/workflow/systematic-debugging/defense-in-depth.md +0 -122
  238. package/templates/skills/workflow/systematic-debugging/find-polluter.sh +0 -63
  239. package/templates/skills/workflow/systematic-debugging/root-cause-tracing.md +0 -169
  240. package/templates/skills/workflow/systematic-debugging/test-academic.md +0 -14
  241. package/templates/skills/workflow/systematic-debugging/test-pressure-1.md +0 -58
  242. package/templates/skills/workflow/systematic-debugging/test-pressure-2.md +0 -68
  243. package/templates/skills/workflow/systematic-debugging/test-pressure-3.md +0 -69
  244. package/templates/skills/workflow/test-driven-development/SKILL.md +0 -371
  245. package/templates/skills/workflow/test-driven-development/testing-anti-patterns.md +0 -299
  246. package/templates/skills/workflow/using-git-worktrees/SKILL.md +0 -217
  247. package/templates/skills/workflow/using-superpowers/SKILL.md +0 -87
  248. package/templates/skills/workflow/verification-before-completion/SKILL.md +0 -139
  249. package/templates/skills/workflow/writing-plans/SKILL.md +0 -116
  250. package/templates/skills/workflow/writing-skills/SKILL.md +0 -655
  251. package/templates/skills/workflow/writing-skills/anthropic-best-practices.md +0 -1150
  252. package/templates/skills/workflow/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
  253. package/templates/skills/workflow/writing-skills/graphviz-conventions.dot +0 -172
  254. package/templates/skills/workflow/writing-skills/persuasion-principles.md +0 -187
  255. package/templates/skills/workflow/writing-skills/render-graphs.js +0 -168
  256. package/templates/skills/workflow/writing-skills/testing-skills-with-subagents.md +0 -384
  257. package/templates/types/index.ts +0 -17
  258. /package/templates/{vite-env.d.ts → react/src/vite-env.d.ts} +0 -0
@@ -0,0 +1,11 @@
1
+ dist
2
+ node_modules
3
+ coverage
4
+ package-lock.json
5
+ bun.lock
6
+ claudecraft.json
7
+ .claude
8
+ .codex
9
+ .zed
10
+ .super.engineering
11
+ .vscode
@@ -0,0 +1,5 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all",
4
+ "printWidth": 110
5
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["esbenp.prettier-vscode", "bradlc.vscode-tailwindcss"]
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
3
+ "editor.formatOnSave": true
4
+ }
@@ -0,0 +1,64 @@
1
+ # AGENTS.md: {{SITE_NAME}}
2
+
3
+ You are working on **{{SITE_NAME}}**, a standalone React 19 + Vite + Tailwind 4 app. This directory is the project root.
4
+
5
+ **One sentence:** {{ONE_SENTENCE}}
6
+
7
+ Read `design.md` next, then `intent.md`, then `docs/`. Do not invent features outside `intent.md`.
8
+
9
+ ## The bar
10
+
11
+ Every decision leaves three people better off: the visitor (UX), the next developer (DX), and the next agent (AX). When an option helps one and costs another, find one that helps all three or take the trade-off to the human. Keep what already works and what `docs/decisions.md` records until the human changes it.
12
+
13
+ Every word on screen does a job. Cut taglines, helper text, and secondary labels. When a screen needs them to make sense, fix the layout.
14
+
15
+ ## Copy
16
+
17
+ Write to the one reader `intent.md` names, in the words they use. Every line passes the swap test: put another product's name in place of **{{SITE_NAME}}** and the line stops being true. A line that still works for them is filler; replace it with the fact behind it.
18
+
19
+ - Headlines make the claim. Buttons and links name the action or destination.
20
+ - Errors say what happened and what to do next. Empty states say what belongs here and how to add it.
21
+ - Review copy during `/design-quality` against `.claude/skills/design-quality/references/copy-tells.md`. `npm run lint:copy` runs as part of `npm run verify`.
22
+
23
+ ## How you must work
24
+
25
+ 1. Treat `intent.md` as scope law. Confirm changes with the human before adding routes or features.
26
+ 2. Before laying out a new page or major view, run `/design-quality plan` (or read `.claude/skills/design-quality/SKILL.md` Mode A) and confirm the direction in 3–4 lines.
27
+ 3. All visual tokens live in `src/styles/global.css`. Never hardcode hex or raw Tailwind palette utilities (`text-white`, `bg-gray-900`) in components (`npm run lint:tokens` enforces this).
28
+ 4. Before claiming UI done, run `/design-quality` as a separate critique pass grounded in rendered pixels at desktop (1440px) and mobile (390px).
29
+ 5. `npm run verify` is the mechanical gate (formatting, typecheck, token lint, copy lint, tests, production build). It prints nothing when it passes. Run it before claiming done.
30
+ 6. Anything waiting on the human goes in `docs/inbox.md`. Decisions go in `docs/decisions.md`.
31
+
32
+ ## Stack locks (unless the human asks otherwise)
33
+
34
+ | Lock | Value |
35
+ | ------------ | ---------------------------------------------------------------------------------- |
36
+ | Framework | React 19 + Vite + TypeScript 5.9 (strict) |
37
+ | Routing | React Router 7 |
38
+ | CSS | Tailwind CSS 4 via `@tailwindcss/vite` (`src/styles/global.css`) |
39
+ | Icons | `lucide-react` |
40
+ | Class helper | `cn` from `@/lib/cn` (`clsx` + `tailwind-merge`) |
41
+ | Tests | Vitest + Testing Library (co-located `*.test.tsx`) |
42
+ | Format | Prettier (`format` / `format:check`) |
43
+ | Appearance | Light, plus dark following the system when `darkMode` is true in `site.config.mjs` |
44
+ | Dependencies | Exact versions in `package.json`, registry only (`.npmrc`) |
45
+
46
+ ## Commands
47
+
48
+ ```sh
49
+ npm install
50
+ npm run dev # http://{{PROJECT_NAME}}.localhost:{{DEV_PORT}}/
51
+ npm run domain # https://{{PROJECT_NAME}}.localhost/ through Caddy
52
+ npm run verify # silent gate: format:check + typecheck + lint:tokens + lint:copy + test + build
53
+ npm run build # tsc -b && vite build
54
+ npm run test # vitest run
55
+ npm run format # prettier --write .
56
+ ```
57
+
58
+ ## Do not
59
+
60
+ - Hardcode hex colors, `rgb()`, `oklch()`, or raw Tailwind color classes in components
61
+ - Use `min-h-screen` or `h-screen` (use `min-h-dvh` / `h-dvh`)
62
+ - Hide above-fold content behind initial `opacity: 0`
63
+ - Claim green without `npm run verify`
64
+ - Claim UI done without a pixel-grounded `/design-quality` pass
@@ -0,0 +1,31 @@
1
+ # {{SITE_NAME}}
2
+
3
+ {{ONE_SENTENCE}}
4
+
5
+ ## Run
6
+
7
+ ```sh
8
+ npm install
9
+ npm run dev
10
+ ```
11
+
12
+ Open `http://{{PROJECT_NAME}}.localhost:{{DEV_PORT}}/`. The port is fixed in `site.config.mjs`.
13
+
14
+ - **No port (macOS + Homebrew Caddy):** `npm run domain` registers `https://{{PROJECT_NAME}}.localhost/`. `npm run domain -- --remove` removes it.
15
+ - **Port taken:** start with `PORT=<n> npm run dev`.
16
+
17
+ ## Verify
18
+
19
+ ```sh
20
+ npm run verify
21
+ ```
22
+
23
+ Runs Prettier check, TypeScript typecheck, token literal lint, copy lint, Vitest, and production build. Silent on pass; prints the first failure cleanly.
24
+
25
+ ## Agents
26
+
27
+ Read **`AGENTS.md` → `design.md` → `intent.md` → `docs/`**.
28
+
29
+ - Run `/design-quality plan` before laying out a new page or surface.
30
+ - Run `/design-quality` (or read `.claude/skills/design-quality/SKILL.md`) before shipping UI changes.
31
+ - Pull future kit updates with `npx create-claudecraft upgrade --dry-run` / `npx create-claudecraft upgrade`.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "{{PROJECT_NAME}}",
6
+ "runtimeExecutable": "npm",
7
+ "runtimeArgs": ["run", "dev", "--", "--port", "{{DEV_PORT}}"],
8
+ "port": {{DEV_PORT}},
9
+ "autoPort": true,
10
+ "url": "http://{{PROJECT_NAME}}.localhost:{{DEV_PORT}}"
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "permissions": {
4
+ "allow": ["Bash(npm run *)", "Bash(bun run *)"],
5
+ "deny": ["Read(./.env)", "Read(./.env.local)"]
6
+ },
7
+ "hooks": {
8
+ "PostToolUse": [
9
+ {
10
+ "matcher": "Write|Edit|MultiEdit",
11
+ "hooks": [
12
+ {
13
+ "type": "command",
14
+ "command": "node .claude/hooks/design-lint.mjs",
15
+ "timeout": 5000
16
+ }
17
+ ]
18
+ }
19
+ ]
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ version = 1
2
+ name = "{{PROJECT_NAME}}"
3
+
4
+ [setup]
5
+ script = "npm install"
6
+
7
+ [[actions]]
8
+ name = "Dev"
9
+ icon = "run"
10
+ command = "npm run dev"
11
+
12
+ [[actions]]
13
+ name = "Build"
14
+ icon = "tool"
15
+ command = "npm run build"
16
+
17
+ [[actions]]
18
+ name = "Preview"
19
+ icon = "run"
20
+ command = "npm run build && npm run preview"
@@ -0,0 +1,17 @@
1
+ # Dependencies
2
+ node_modules
3
+
4
+ # Build & test output
5
+ dist
6
+ coverage
7
+ *.tsbuildinfo
8
+
9
+ # Local env & secrets
10
+ .env
11
+ .env.local
12
+ .env.*.local
13
+
14
+ # OS & editor junk
15
+ .DS_Store
16
+ *.log
17
+ .claude/settings.local.json
@@ -0,0 +1,8 @@
1
+ ; Exact versions in package.json, no ^ or ~.
2
+ save-exact=true
3
+ ; Refuse a package published in the last 2 days: a hijacked release is usually pulled by then.
4
+ ; npm ci installs from the lockfile and is never held back.
5
+ min-release-age=2
6
+ ; Dependencies come from the registry only, never a git repo or a URL.
7
+ allow-git=none
8
+ allow-remote=none
@@ -0,0 +1,8 @@
1
+ {
2
+ "setup": ["npm install"],
3
+ "run": [
4
+ { "name": "dev", "commands": ["npm run dev"], "default": true },
5
+ { "name": "build", "commands": ["npm run build"] },
6
+ { "name": "preview", "commands": ["npm run build && npm run preview"] }
7
+ ]
8
+ }
@@ -0,0 +1,5 @@
1
+ [
2
+ { "label": "dev", "command": "npm run dev", "use_new_terminal": true },
3
+ { "label": "build", "command": "npm run build" },
4
+ { "label": "preview", "command": "npm run build && npm run preview", "use_new_terminal": true }
5
+ ]
@@ -0,0 +1,3 @@
1
+ # Decisions
2
+
3
+ - {{PUBLISHED}}: Scaffolded with create-claudecraft (react). Accent: {{ACCENT_NAME}} ({{ACCENT}}). Dark mode: {{DARK_MODE}}.
@@ -0,0 +1,7 @@
1
+ # Inbox
2
+
3
+ What waits on the human, newest first, then what was delivered. Agents keep it current (`AGENTS.md` → How you must work, 9).
4
+
5
+ ## Waiting on you
6
+
7
+ ## Delivered
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en" data-theme="{{DARK_THEME_ATTR}}">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
+ <title>{{SITE_NAME}}</title>
8
+ <meta name="description" content="{{ONE_SENTENCE}}" />
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ <script type="module" src="/src/main.tsx"></script>
13
+ </body>
14
+ </html>
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "private": true,
4
+ "type": "module",
5
+ "version": "0.1.0",
6
+ "engines": {
7
+ "node": ">=22.12.0"
8
+ },
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "domain": "node scripts/local-domain.mjs",
12
+ "build": "tsc --noEmit && vite build",
13
+ "typecheck": "tsc --noEmit",
14
+ "preview": "vite preview",
15
+ "test": "vitest run",
16
+ "test:watch": "vitest",
17
+ "format": "prettier --write .",
18
+ "format:check": "prettier --check .",
19
+ "lint:tokens": "node scripts/lint-tokens.mjs",
20
+ "lint:copy": "node scripts/lint-copy.mjs",
21
+ "verify": "node scripts/verify.mjs"
22
+ },
23
+ "dependencies": {
24
+ "@fontsource/jetbrains-mono": "5.3.0",
25
+ "clsx": "2.1.1",
26
+ "lucide-react": "1.84.0",
27
+ "react": "19.3.1",
28
+ "react-dom": "19.3.1",
29
+ "react-router-dom": "7.18.7",
30
+ "tailwind-merge": "3.7.0"
31
+ },
32
+ "devDependencies": {
33
+ "@tailwindcss/vite": "4.3.4",
34
+ "@testing-library/jest-dom": "8.0.0",
35
+ "@testing-library/react": "16.3.3",
36
+ "@types/node": "26.6.6",
37
+ "@types/react": "19.3.0",
38
+ "@types/react-dom": "19.3.0",
39
+ "@vitejs/plugin-react": "6.3.0",
40
+ "jsdom": "31.0.1",
41
+ "prettier": "3.9.10",
42
+ "tailwindcss": "4.3.4",
43
+ "typescript": "5.9.3",
44
+ "vite": "8.4.0",
45
+ "vitest": "5.1.2"
46
+ }
47
+ }
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
2
+ <rect width="64" height="64" rx="14" fill="#171614" />
3
+ <rect x="16" y="16" width="32" height="32" rx="6" stroke="{{ACCENT}}" stroke-width="4" />
4
+ <circle cx="32" cy="32" r="6" fill="{{ACCENT}}" />
5
+ </svg>
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ // House copy lint on user-facing strings in src/ (design.md G15).
3
+ import { readdirSync, readFileSync } from 'node:fs';
4
+ import path from 'node:path';
5
+
6
+ const SRC = path.resolve('src');
7
+ const RULES = [
8
+ [
9
+ /\b(leverag\w*|disrupt\w*|ai-powered|game-chang\w*|unlock\w*|supercharg\w*|10x|scale yourself|seamless\w*|empower\w*|cutting-edge|best-in-class|synerg\w*)\b/i,
10
+ 'SaaS speak',
11
+ ],
12
+ [
13
+ /\b(passive income|while you sleep|financial freedom|side hustle|make money|easy money|get rich)\b/i,
14
+ 'hustle tone',
15
+ ],
16
+ [/\b(lorem|ipsum|TODO|TBD)\b/, 'placeholder text'],
17
+ ];
18
+
19
+ function walk(dir) {
20
+ const out = [];
21
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
22
+ const full = path.join(dir, entry.name);
23
+ if (entry.isDirectory()) out.push(...walk(full));
24
+ else if (/\.(?:tsx|jsx|ts)$/.test(entry.name) && !/\.(?:test|spec)\./.test(entry.name)) out.push(full);
25
+ }
26
+ return out;
27
+ }
28
+
29
+ const problems = [];
30
+ for (const file of walk(SRC)) {
31
+ const rel = path.relative(process.cwd(), file);
32
+ const lines = readFileSync(file, 'utf8').split('\n');
33
+ lines.forEach((raw, idx) => {
34
+ const line = raw.trim();
35
+ if (!line || line.startsWith('//') || line.startsWith('*') || line.startsWith('/*')) return;
36
+ for (const [pattern, label] of RULES) {
37
+ const match = line.match(pattern);
38
+ if (match) problems.push(`${rel}:${idx + 1} ${label}: "${match[0]}"`);
39
+ }
40
+ });
41
+ }
42
+
43
+ if (problems.length) {
44
+ console.error(`lint:copy failed (${problems.length}):\n${problems.map((p) => ` ${p}`).join('\n')}`);
45
+ process.exit(1);
46
+ }
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ // Deterministic token & viewport guard for React UI files (design.md G7 + G14).
3
+ // Fails on raw hex/rgb/oklch literals, raw Tailwind palette classes (text-white, bg-gray-900…),
4
+ // or h-screen / min-h-screen in src/**/*.{tsx,jsx} (excluding tests).
5
+ import { readdirSync, readFileSync } from 'node:fs';
6
+ import path from 'node:path';
7
+
8
+ const SRC = path.resolve('src');
9
+ const RAW_PALETTE =
10
+ /\b(?:bg|text|border|ring|fill|stroke|from|via|to|outline|divide|ring-offset|shadow|caret|accent|decoration)-(?:white|black|(?:slate|gray|grey|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-\d{2,3})\b/;
11
+ const RAW_HEX = /(?:className|style)\s*=\s*[^>]*#[0-9a-fA-F]{3,8}\b/;
12
+ const ARB_COLOR = /\b(?:bg|text|border|fill|stroke|from|via|to)-\[(?:#[0-9a-fA-F]{3,8}|rgb|hsl|oklch)/;
13
+ const H_SCREEN = /\b(?:min-)?h-screen\b/;
14
+
15
+ function walk(dir) {
16
+ const out = [];
17
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
18
+ const full = path.join(dir, entry.name);
19
+ if (entry.isDirectory()) out.push(...walk(full));
20
+ else if (/\.(?:tsx|jsx)$/.test(entry.name) && !/\.(?:test|spec)\./.test(entry.name)) out.push(full);
21
+ }
22
+ return out;
23
+ }
24
+
25
+ const problems = [];
26
+ for (const file of walk(SRC)) {
27
+ const rel = path.relative(process.cwd(), file);
28
+ const lines = readFileSync(file, 'utf8').split('\n');
29
+ lines.forEach((raw, idx) => {
30
+ const line = raw.trim();
31
+ if (!line || line.startsWith('//') || line.startsWith('*') || line.startsWith('/*')) return;
32
+ if (RAW_PALETTE.test(line) || RAW_HEX.test(line) || ARB_COLOR.test(line)) {
33
+ problems.push(`${rel}:${idx + 1} raw color class/hex (G7) — use tokens from src/styles/global.css`);
34
+ }
35
+ if (H_SCREEN.test(line)) {
36
+ problems.push(`${rel}:${idx + 1} use min-h-dvh / h-dvh instead of h-screen (G14)`);
37
+ }
38
+ });
39
+ }
40
+
41
+ if (problems.length) {
42
+ console.error(`lint:tokens failed (${problems.length}):\n${problems.map((p) => ` ${p}`).join('\n')}`);
43
+ process.exit(1);
44
+ }
@@ -0,0 +1,115 @@
1
+ // npm run domain: serve this site at https://<name>.localhost/ through the Homebrew Caddy.
2
+ // It writes one file, <brew prefix>/etc/caddy.d/<name>.caddy, then validates and reloads Caddy.
3
+ // Without a running brew Caddy it changes nothing. `npm run domain -- --remove` undoes it.
4
+ // A <name>.caddy that claudecraft did not write is never replaced or removed.
5
+ // The last line it prints is always the URL that works.
6
+ import { spawnSync } from 'node:child_process';
7
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
8
+ import path from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+ import { devPort } from '../site.config.mjs';
11
+
12
+ const { name } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
13
+ const pretty = `https://${name}.localhost/`;
14
+ const fallback = `http://${name}.localhost:${devPort}/`;
15
+ // Tests point CLAUDECRAFT_CADDY_DIR at a temp folder: the file is written there and no Caddy is touched.
16
+ const testDir = process.env.CLAUDECRAFT_CADDY_DIR;
17
+ // Any claudecraft site's first line, so a moved or recreated site can still replace its own file.
18
+ const GENERATED = /^# Generated by .+\/scripts\/local-domain\.mjs — do not edit by hand\.$/;
19
+
20
+ /** True when the file is missing or a claudecraft site wrote it. */
21
+ const ours = (/** @type {string} */ file) =>
22
+ !existsSync(file) || GENERATED.test(readFileSync(file, 'utf8').split('\n', 1)[0]);
23
+
24
+ /** stdout of a command, or '' when it is missing or fails. */
25
+ const output = (/** @type {string} */ command, /** @type {string[]} */ args) => {
26
+ const result = spawnSync(command, args, { encoding: 'utf8' });
27
+ return result.status === 0 ? result.stdout.trim() : '';
28
+ };
29
+
30
+ const { url, note = '', error = '' } = await run(process.argv.includes('--remove'));
31
+ if (note) console.log(note);
32
+ if (error) {
33
+ console.error(error);
34
+ process.exitCode = 1;
35
+ }
36
+ console.log(url);
37
+
38
+ /** @param {boolean} remove */
39
+ async function run(remove) {
40
+ // node --test sets NODE_TEST_CONTEXT. A test that forgot the seam must never reach the real Caddy.
41
+ if (!testDir && process.env.NODE_TEST_CONTEXT) {
42
+ return { url: fallback, error: 'Tests must set CLAUDECRAFT_CADDY_DIR. The real Caddy was not touched.' };
43
+ }
44
+ const prefix = testDir ? '' : output('brew', ['--prefix']);
45
+ if (!testDir && !(prefix && output('caddy', ['version']))) {
46
+ const setup = 'brew install caddy && brew services start caddy && caddy trust';
47
+ return { url: fallback, note: remove ? '' : `Caddy is not installed. For ${pretty}: ${setup}` };
48
+ }
49
+ const caddyDir = testDir || path.join(prefix, 'etc', 'caddy.d');
50
+ const caddyfile = path.join(prefix, 'etc', 'Caddyfile');
51
+ const site = path.join(caddyDir, `${name}.caddy`);
52
+ // Other projects keep hand-written files in the same folder.
53
+ if (!ours(site)) {
54
+ const fix = remove ? '' : ` For ${pretty}, remove that file or rename this site.`;
55
+ return { url: fallback, note: `${site} was not made by claudecraft, so it was left alone.${fix}` };
56
+ }
57
+ const live = !testDir && (await adminAnswers());
58
+
59
+ /** caddy validate|reload on the brew Caddyfile: '' when it worked, else Caddy's last log message. */
60
+ const caddy = (/** @type {string} */ command) => {
61
+ const result = spawnSync('caddy', [command, '--config', caddyfile], { encoding: 'utf8' });
62
+ if (result.status === 0) return '';
63
+ const last = (result.stderr ?? '').trim().split('\n').at(-1) || `caddy ${command} failed`;
64
+ try {
65
+ return JSON.parse(last).msg ?? last;
66
+ } catch {
67
+ return last;
68
+ }
69
+ };
70
+
71
+ if (remove) {
72
+ rmSync(site, { force: true });
73
+ const failed = live && caddy('reload');
74
+ return { url: fallback, error: failed ? `Caddy reload failed: ${failed}` : '' };
75
+ }
76
+ if (!testDir && !live) {
77
+ return { url: fallback, note: `Caddy is not running. For ${pretty}: brew services start caddy` };
78
+ }
79
+ const include = `import ${caddyDir}/*.caddy`;
80
+ if (!testDir && !readFileSync(caddyfile, 'utf8').includes(include)) {
81
+ return { url: fallback, note: `For ${pretty}, add this line to ${caddyfile}: ${include}` };
82
+ }
83
+
84
+ // Caddy listens on every interface, so the guard keeps the site on this Mac. Vite listens on
85
+ // ::1, so the upstream is localhost (never 127.0.0.1) and the port is a literal number.
86
+ mkdirSync(caddyDir, { recursive: true });
87
+ writeFileSync(
88
+ site,
89
+ `# Generated by ${fileURLToPath(import.meta.url)} — do not edit by hand.
90
+ ${name}.localhost {
91
+ \ttls internal
92
+ \t@offbox not remote_ip 127.0.0.1 ::1
93
+ \tabort @offbox
94
+ \treverse_proxy localhost:${devPort}
95
+ }
96
+ `,
97
+ );
98
+ const failed = !testDir && (caddy('validate') || caddy('reload'));
99
+ if (failed) {
100
+ rmSync(site, { force: true });
101
+ return { url: fallback, error: `Caddy refused ${site}: ${failed}` };
102
+ }
103
+ return { url: pretty };
104
+ }
105
+
106
+ /** True when the brew Caddy's admin API answers, i.e. Caddy is running. */
107
+ async function adminAnswers() {
108
+ try {
109
+ const response = await fetch('http://localhost:2019/config/', { signal: AbortSignal.timeout(2000) });
110
+ await response.body?.cancel();
111
+ return true;
112
+ } catch {
113
+ return false;
114
+ }
115
+ }
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ // npm run verify: the mechanical gate before "done" (design.md G18).
3
+ // Silent when it passes; prints the first failing step's output without ANSI noise.
4
+ import { spawnSync } from 'node:child_process';
5
+ import { stripVTControlCharacters } from 'node:util';
6
+
7
+ const env = { ...process.env, NO_COLOR: '1', FORCE_COLOR: '0', CI: '1' };
8
+ const steps = ['format:check', 'typecheck', 'lint:tokens', 'lint:copy', 'test', 'build'];
9
+
10
+ for (const script of steps) {
11
+ const run = spawnSync('npm', ['run', '--silent', script], {
12
+ env,
13
+ encoding: 'utf8',
14
+ maxBuffer: 1 << 28,
15
+ shell: process.platform === 'win32',
16
+ });
17
+ if (run.status === 0) continue;
18
+ process.stderr.write(stripVTControlCharacters(`npm run ${script} failed:\n${run.stdout}${run.stderr}`));
19
+ process.exit(run.status ?? 1);
20
+ }
@@ -0,0 +1,23 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+
3
+ /** Human-facing app name. */
4
+ // prettier-ignore
5
+ export const siteName = '{{SITE_NAME}}';
6
+
7
+ /** Short description for metadata and docs. */
8
+ // prettier-ignore
9
+ export const oneSentence = '{{ONE_SENTENCE}}';
10
+
11
+ /** The claudecraft kit version this app was made with, or last upgraded to. */
12
+ export const kit = existsSync('claudecraft.json')
13
+ ? JSON.parse(readFileSync('claudecraft.json', 'utf8')).kit
14
+ : '';
15
+
16
+ /** Dev server port, fixed per project so the local URL stays stable. PORT=<n> overrides it. */
17
+ export const devPort = {{DEV_PORT}};
18
+
19
+ /** Dark appearance that follows the visitor's system setting; false is light only. Colors: global.css. */
20
+ export const darkMode = {{DARK_MODE}};
21
+
22
+ /** ISO date the project was scaffolded. */
23
+ export const published = '{{PUBLISHED}}';
@@ -0,0 +1,15 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import { MemoryRouter } from 'react-router-dom';
3
+ import { App } from './App';
4
+ import { SITE_NAME } from '@/config/site';
5
+
6
+ describe('App', () => {
7
+ it('renders the home heading', () => {
8
+ render(
9
+ <MemoryRouter>
10
+ <App />
11
+ </MemoryRouter>,
12
+ );
13
+ expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent(SITE_NAME);
14
+ });
15
+ });
@@ -0,0 +1,21 @@
1
+ import { Route, Routes } from 'react-router-dom';
2
+ import { ErrorBoundary } from '@/components/ErrorBoundary';
3
+ import { SkipLink } from '@/components/SkipLink';
4
+ import { HomePage } from '@/pages/HomePage';
5
+ import { NotFoundPage } from '@/pages/NotFoundPage';
6
+
7
+ export function App() {
8
+ return (
9
+ <ErrorBoundary>
10
+ <SkipLink />
11
+ <main id="main">
12
+ <Routes>
13
+ <Route path="/" element={<HomePage />} />
14
+ <Route path="*" element={<NotFoundPage />} />
15
+ </Routes>
16
+ </main>
17
+ </ErrorBoundary>
18
+ );
19
+ }
20
+
21
+ export default App;
@@ -0,0 +1,42 @@
1
+ import { Component, type ErrorInfo, type ReactNode } from 'react';
2
+
3
+ interface Props {
4
+ children: ReactNode;
5
+ }
6
+
7
+ interface State {
8
+ hasError: boolean;
9
+ }
10
+
11
+ export class ErrorBoundary extends Component<Props, State> {
12
+ state: State = { hasError: false };
13
+
14
+ static getDerivedStateFromError(): State {
15
+ return { hasError: true };
16
+ }
17
+
18
+ componentDidCatch(error: Error, info: ErrorInfo) {
19
+ console.error('Unhandled render error:', error, info.componentStack);
20
+ }
21
+
22
+ render() {
23
+ if (!this.state.hasError) return this.props.children;
24
+ return (
25
+ <div className="flex min-h-dvh items-center justify-center bg-paper p-6 text-ink">
26
+ <div className="w-full max-w-md border border-rule bg-surface p-6">
27
+ <h1 className="text-lg font-bold">This view could not render</h1>
28
+ <p className="mt-2 text-sm text-muted">
29
+ Reload the page to reset local state, or inspect the browser console for the stack trace.
30
+ </p>
31
+ <button
32
+ type="button"
33
+ onClick={() => window.location.reload()}
34
+ className="mt-4 inline-flex min-h-11 items-center bg-accent px-4 py-2 text-sm font-medium text-on-accent transition-opacity hover:opacity-90"
35
+ >
36
+ Reload page
37
+ </button>
38
+ </div>
39
+ </div>
40
+ );
41
+ }
42
+ }