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,164 @@
1
+ // `create-claudecraft upgrade`: 3-way merge kit changes since the project was scaffolded.
2
+ import { existsSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync } from 'node:fs';
3
+ import { mkdir, rm, writeFile } from 'node:fs/promises';
4
+ import { spawnSync } from 'node:child_process';
5
+ import { tmpdir } from 'node:os';
6
+ import path from 'node:path';
7
+ import { DEFAULT_TEMPLATE_ID, SHARED_TEMPLATE_DIR, templateDirFor } from '../dist/answers.js';
8
+ import { KIT, STAMP, kitVersion, render, writeStamp } from './scaffold.mjs';
9
+
10
+ const LOCKFILES = new Set(['package-lock.json', 'bun.lock', 'pnpm-lock.yaml', 'yarn.lock']);
11
+
12
+ const git = (cwd, args, options = {}) => spawnSync('git', args, { cwd, encoding: 'utf8', ...options });
13
+
14
+ const files = (root, dir = '') =>
15
+ readdirSync(path.join(root, dir), { withFileTypes: true }).flatMap((entry) => {
16
+ const file = path.join(dir, entry.name);
17
+ return entry.isDirectory() ? files(root, file) : [file];
18
+ });
19
+
20
+ const read = (file) => (existsSync(file) ? readFileSync(file) : null);
21
+ const same = (a, b) => (a === null || b === null ? a === b : a.equals(b));
22
+
23
+ export function templateAt(commit, templateId, into) {
24
+ const sharedRel = path.relative(KIT, SHARED_TEMPLATE_DIR);
25
+ const templateRel = path.relative(KIT, templateDirFor(templateId));
26
+ const archive = git(KIT, ['archive', commit, sharedRel, templateRel], {
27
+ encoding: 'buffer',
28
+ maxBuffer: 1 << 30,
29
+ });
30
+ if (archive.status !== 0) {
31
+ throw new Error(`The kit has no commit ${commit}. Update the kit and run upgrade again.`);
32
+ }
33
+ const untar = spawnSync('tar', ['-x', '-C', into], { input: archive.stdout });
34
+ if (untar.status !== 0) throw new Error(`Could not unpack the kit at ${commit}.`);
35
+ return {
36
+ shared: path.join(into, sharedRel),
37
+ template: path.join(into, templateRel),
38
+ };
39
+ }
40
+
41
+ export async function upgrade(site, { dryRun = false, base, template } = {}) {
42
+ const stampFile = path.join(site, STAMP);
43
+ if (!existsSync(stampFile)) {
44
+ throw new Error(`No ${STAMP} here. Run create-claudecraft upgrade inside a scaffolded project root.`);
45
+ }
46
+ const stamp = JSON.parse(readFileSync(stampFile, 'utf8'));
47
+ const templateId = stamp.answers?.template ?? DEFAULT_TEMPLATE_ID;
48
+
49
+ if (!dryRun) {
50
+ const status = git(site, ['status', '--porcelain']);
51
+ if (status.status !== 0) {
52
+ throw new Error('This project is not a git repo. Run git init and commit first so upgrade can be undone.');
53
+ }
54
+ const dirty = status.stdout.split('\n').filter((line) => line && !line.endsWith(STAMP));
55
+ if (dirty.length) {
56
+ throw new Error('Commit or stash your changes first so the upgrade is one reviewable diff.');
57
+ }
58
+ }
59
+ if (!base && !stamp.commit) {
60
+ throw new Error(`${STAMP} has no kit commit, so the base kit cannot be rebuilt.`);
61
+ }
62
+
63
+ const i18n = path.join(site, 'src', 'i18n');
64
+ const locales = existsSync(i18n)
65
+ ? readdirSync(i18n)
66
+ .filter((name) => name.endsWith('.json'))
67
+ .map((name) => path.basename(name, '.json'))
68
+ : stamp.answers.locales;
69
+ const shape = { ...stamp, answers: { ...stamp.answers, template: templateId, locales } };
70
+
71
+ const top = git(site, ['rev-parse', '--show-toplevel']);
72
+ const nested = top.status === 0 && path.relative(top.stdout.trim(), realpathSync(site)) !== '';
73
+ const work = mkdtempSync(path.join(tmpdir(), 'claudecraft-upgrade-'));
74
+ const result = { added: [], updated: [], merged: [], removed: [], conflicts: [], kept: [] };
75
+
76
+ try {
77
+ const was = path.join(work, 'was');
78
+ const now = path.join(work, 'now');
79
+ await mkdir(was);
80
+ await mkdir(now);
81
+ const oldSources = base ?? templateAt(stamp.commit, templateId, mkdtempSync(path.join(work, 'kit-')));
82
+ const newSources = template ?? { shared: SHARED_TEMPLATE_DIR, template: templateDirFor(templateId) };
83
+ await render(oldSources, was, shape);
84
+ await render(newSources, now, shape);
85
+
86
+ const write = async (file, body) => {
87
+ if (dryRun) return;
88
+ await mkdir(path.dirname(path.join(site, file)), { recursive: true });
89
+ await writeFile(path.join(site, file), body);
90
+ };
91
+
92
+ for (const file of [...new Set([...files(was), ...files(now)])].sort()) {
93
+ const old = read(path.join(was, file));
94
+ const kit = read(path.join(now, file));
95
+ const mine = read(path.join(site, file));
96
+ if (same(old, kit) || same(mine, kit)) continue;
97
+ if (nested && file.startsWith(`.github${path.sep}`)) {
98
+ result.kept.push(file);
99
+ continue;
100
+ }
101
+
102
+ if (kit === null) {
103
+ if (mine === null) continue;
104
+ if (!same(mine, old)) result.kept.push(file);
105
+ else {
106
+ if (!dryRun) await rm(path.join(site, file));
107
+ result.removed.push(file);
108
+ }
109
+ } else if (mine === null) {
110
+ if (old !== null) result.kept.push(file);
111
+ else {
112
+ await write(file, kit);
113
+ result.added.push(file);
114
+ }
115
+ } else if (same(mine, old)) {
116
+ await write(file, kit);
117
+ result.updated.push(file);
118
+ } else if (LOCKFILES.has(file)) {
119
+ result.kept.push(file);
120
+ } else {
121
+ const empty = path.join(work, 'empty');
122
+ if (old === null) await writeFile(empty, '');
123
+ const merge = git(
124
+ site,
125
+ ['merge-file', '-p', '-L', 'project', '-L', 'kit before', '-L', 'kit now'].concat(
126
+ path.join(site, file),
127
+ old === null ? empty : path.join(was, file),
128
+ path.join(now, file),
129
+ ),
130
+ { encoding: 'buffer', maxBuffer: 1 << 30 },
131
+ );
132
+ if (merge.status === null || merge.status > 127) result.kept.push(file);
133
+ else {
134
+ await write(file, merge.stdout);
135
+ result[merge.status === 0 ? 'merged' : 'conflicts'].push(file);
136
+ }
137
+ }
138
+ }
139
+ if (!dryRun) await writeStamp(site, { ...stamp, ...kitVersion() });
140
+ } finally {
141
+ rmSync(work, { recursive: true, force: true });
142
+ }
143
+ return result;
144
+ }
145
+
146
+ export function summary(result, { dryRun = false } = {}) {
147
+ const changed = ['added', 'updated', 'merged', 'removed', 'conflicts'].flatMap((kind) => result[kind]);
148
+ if (!changed.length && !result.kept.length) return 'Already current with the kit.';
149
+ const line = (label, list) => (list.length ? [`${label} ${list.length}: ${list.join(', ')}`] : []);
150
+ const next = [];
151
+ if (result.conflicts.length) next.push('Resolve the <<<<<<< markers in the conflicted files.');
152
+ if (changed.includes('package.json')) next.push('Run npm install.');
153
+ if (changed.length) next.push('Run npm run verify, read git diff, then commit.');
154
+ return [
155
+ ...(dryRun ? ['Dry run, nothing written.'] : []),
156
+ ...line('Added', result.added),
157
+ ...line('Updated', result.updated),
158
+ ...line('Merged with your changes', result.merged),
159
+ ...line('Removed', result.removed),
160
+ ...line('Conflicts', result.conflicts),
161
+ ...line('Left as yours (compare with the kit by hand)', result.kept),
162
+ ...(dryRun ? [] : next),
163
+ ].join('\n');
164
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-claudecraft",
3
- "version": "1.0.0",
4
- "description": "Designer-first boilerplate for Claude Code. 27 skills, 7 commands, 32 themes. The robots are here.",
3
+ "version": "2.0.0",
4
+ "description": "Design-first starter & guardrails for coding agents. Astro 7 or React 19, Tailwind 4 tokens, and pixel-grounded G1–G20 design quality.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "create-claudecraft": "./bin/cli.js"
@@ -9,32 +9,43 @@
9
9
  "files": [
10
10
  "bin",
11
11
  "dist",
12
+ "lib",
12
13
  "templates",
13
- "README.md"
14
+ "!templates/astro/node_modules",
15
+ "!templates/astro/dist",
16
+ "!templates/astro/.astro",
17
+ "!templates/astro/.env",
18
+ "!templates/astro/.dev.vars",
19
+ "!templates/astro/.wrangler",
20
+ "!templates/react/node_modules",
21
+ "!templates/react/dist",
22
+ "!templates/react/.env",
23
+ "!templates/react/.env.local",
24
+ "README.md",
25
+ "LICENSE"
14
26
  ],
15
27
  "scripts": {
16
28
  "build": "tsc",
17
- "dev": "tsc --watch",
29
+ "prepare": "tsc",
18
30
  "start": "node bin/cli.js",
19
- "prepublishOnly": "npm run build"
31
+ "test": "npm run build && node --test test/*.test.mjs",
32
+ "prepublishOnly": "npm test"
20
33
  },
21
34
  "keywords": [
22
- "claude",
35
+ "claudecraft",
23
36
  "claude-code",
24
- "ai",
25
- "boilerplate",
37
+ "codex",
38
+ "cursor",
39
+ "agents",
40
+ "design-quality",
41
+ "astro",
26
42
  "react",
43
+ "vite",
27
44
  "typescript",
28
45
  "tailwind",
29
- "daisyui",
46
+ "boilerplate",
30
47
  "create",
31
- "cli",
32
- "designer",
33
- "vite",
34
- "bun",
35
- "anthropic",
36
- "skills",
37
- "agents"
48
+ "cli"
38
49
  ],
39
50
  "author": {
40
51
  "name": "Radu Ceuca",
@@ -51,24 +62,19 @@
51
62
  },
52
63
  "homepage": "https://claudecraft.dev",
53
64
  "engines": {
54
- "node": ">=18.0.0"
55
- },
56
- "devDependencies": {
57
- "@types/figlet": "^1.5.8",
58
- "@types/fs-extra": "^11.0.4",
59
- "@types/gradient-string": "^1.1.6",
60
- "@types/node": "^20.11.0",
61
- "typescript": "^5.3.3"
65
+ "node": ">=22.12.0"
62
66
  },
63
67
  "dependencies": {
64
- "@clack/prompts": "^0.7.0",
65
- "figlet": "^1.7.0",
66
- "fs-extra": "^11.2.0",
67
- "gradient-string": "^2.0.2",
68
- "ink": "^6.6.0",
69
- "ink-select-input": "^6.2.0",
70
- "ink-text-input": "^6.0.0",
71
- "picocolors": "^1.0.0",
72
- "react": "^19.2.3"
68
+ "gradient-string": "3.0.0",
69
+ "ink": "8.0.0",
70
+ "ink-select-input": "6.2.0",
71
+ "ink-text-input": "6.0.0",
72
+ "react": "19.3.1"
73
+ },
74
+ "devDependencies": {
75
+ "@types/gradient-string": "1.1.6",
76
+ "@types/node": "26.6.6",
77
+ "@types/react": "19.3.0",
78
+ "typescript": "5.9.3"
73
79
  }
74
80
  }
@@ -0,0 +1,15 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ indent_style = space
8
+ indent_size = 2
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.md]
12
+ trim_trailing_whitespace = false
13
+
14
+ [*.{svg,png,ico,webp}]
15
+ insert_final_newline = false
@@ -0,0 +1,2 @@
1
+ SITE_URL=https://example.com/
2
+ SITE_NAME=My Site
@@ -0,0 +1,37 @@
1
+ # Every push and PR: the same gate as `npm run verify`, and a scan of the whole history for
2
+ # committed secrets (gitleaks, default rules). Both jobs run without secrets: deploy.yml holds them.
3
+ name: CI
4
+
5
+ on:
6
+ push:
7
+ branches: [main]
8
+ pull_request:
9
+
10
+ concurrency:
11
+ group: ci-${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ build:
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 15
18
+ env:
19
+ SITE_URL: http://localhost:4321/
20
+ SITE_NAME: CI
21
+ steps:
22
+ - uses: actions/checkout@v7
23
+ - uses: actions/setup-node@v7
24
+ with:
25
+ node-version-file: '.nvmrc'
26
+ cache: npm
27
+ - run: npm ci
28
+ - run: npm run verify
29
+
30
+ secrets:
31
+ runs-on: ubuntu-latest
32
+ timeout-minutes: 5
33
+ steps:
34
+ - uses: actions/checkout@v7
35
+ with:
36
+ fetch-depth: 0
37
+ - run: docker run --rm -v "$PWD:/repo" ghcr.io/gitleaks/gitleaks:v8.30.1 git /repo --redact --no-banner
@@ -0,0 +1,46 @@
1
+ # Deploys the site to Cloudflare Pages on every push to main, once the repository has:
2
+ # secrets CLOUDFLARE_API_TOKEN (Account → Cloudflare Pages → Edit) and CLOUDFLARE_ACCOUNT_ID
3
+ # variable SITE_URL, the public origin, e.g. https://example.com
4
+ # Until all three exist the run passes and says it skipped. scripts/deploy.sh does the work: it
5
+ # builds, runs every check and uploads, and a failed check stops the deploy.
6
+ # To deploy by hand only, delete this file.
7
+ name: Deploy
8
+
9
+ on:
10
+ push:
11
+ branches: [main]
12
+ workflow_dispatch:
13
+
14
+ concurrency:
15
+ group: deploy
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ deploy:
20
+ runs-on: ubuntu-latest
21
+ timeout-minutes: 15
22
+ env:
23
+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
24
+ CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
25
+ SITE_URL: ${{ vars.SITE_URL }}
26
+ steps:
27
+ - id: ready
28
+ run: |
29
+ if [ -n "$CLOUDFLARE_API_TOKEN" ] && [ -n "$CLOUDFLARE_ACCOUNT_ID" ] && [ -n "$SITE_URL" ]; then
30
+ echo "go=true" >>"$GITHUB_OUTPUT"
31
+ else
32
+ echo "::notice::Deploy skipped: set the secrets CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID and the variable SITE_URL."
33
+ fi
34
+ - if: steps.ready.outputs.go == 'true'
35
+ uses: actions/checkout@v7
36
+ with:
37
+ fetch-depth: 0 # dateModified is the last commit's date
38
+ - if: steps.ready.outputs.go == 'true'
39
+ uses: actions/setup-node@v7
40
+ with:
41
+ node-version-file: '.nvmrc'
42
+ cache: npm
43
+ - if: steps.ready.outputs.go == 'true'
44
+ run: npm ci
45
+ - if: steps.ready.outputs.go == 'true'
46
+ run: npm run deploy
@@ -0,0 +1 @@
1
+ 22
@@ -0,0 +1,10 @@
1
+ node_modules
2
+ dist
3
+ .astro
4
+ package-lock.json
5
+ *.md
6
+ public
7
+ .cache
8
+ claudecraft.json
9
+ .claude/settings.local.json
10
+ .impeccable
@@ -0,0 +1,7 @@
1
+ {
2
+ "plugins": ["prettier-plugin-astro"],
3
+ "singleQuote": true,
4
+ "trailingComma": "all",
5
+ "printWidth": 110,
6
+ "overrides": [{ "files": "*.astro", "options": { "parser": "astro" } }]
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["astro-build.astro-vscode", "bradlc.vscode-tailwindcss", "esbenp.prettier-vscode"]
3
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "typescript.tsdk": "node_modules/typescript/lib",
3
+ "editor.formatOnSave": true,
4
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
5
+ "files.associations": { "*.css": "tailwindcss" },
6
+ "[astro]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
7
+ "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
8
+ "[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
9
+ "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
10
+ "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
11
+ "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }
12
+ }
@@ -0,0 +1,100 @@
1
+ # AGENTS.md: {{SITE_NAME}}
2
+
3
+ You are working on **{{SITE_NAME}}**, a standalone Astro site. 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
+ This holds wherever you design: pages in `src/`, or artboards in Paper, Figma or another canvas. Read `design.md` and the tokens in `src/styles/global.css` before the first artboard, and build with them.
16
+
17
+ ## Copy
18
+
19
+ Write to the one reader `intent.md` names, in the words they use. Every line passes the swap test: put another business'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: the number, the place, the name, the price, the date.
20
+
21
+ - Headlines make the claim. The visitor gets the point from the headline alone.
22
+ - Buttons and links say the action or the destination: "Book a table for Friday", "See the 2026 prices".
23
+ - Errors say what happened and what to do next. Empty states say what goes here and how to add it.
24
+ - One idea per sentence, verbs doing the work. Three adjectives in a row are one unproven claim; keep one and prove it.
25
+ - Read it aloud and cut every word that changes nothing.
26
+
27
+ Review copy as part of `/design-quality` (see `.claude/skills/design-quality/references/copy-tells.md`). `scripts/lint-copy.mjs` also runs automatically on `npm run build`.
28
+
29
+ ## How you must work
30
+
31
+ 1. Treat `intent.md` as scope law. Change it with the human before adding routes or features.
32
+ 2. Porting a brief from `docs/`: scope into `intent.md`; the one sentence into `description` in every `src/i18n/<code>.json` (find the old one with `grep -rlF '<old sentence>' --exclude-dir=node_modules --exclude-dir=dist .`); brand into `design.md` and `src/styles/global.css`; numbers into `src/data/`; then `npm run generate:og` and `npm run generate:icons`. Log what you decided in `docs/decisions.md`.
33
+ 3. Brand token values live in `src/styles/global.css`. Gates in `design.md` are law.
34
+ 4. Before claiming UI done: `/design-quality`, all gates PASS.
35
+ 5. Homepage content must work with JavaScript off. Islands are optional.
36
+ 6. Sourced numbers for tools/calculators live in `src/data/`, not hard-coded in JSX.
37
+ 7. Preserve the day-0 SEO/AEO, language and share stubs. Extend them.
38
+ 8. `npm run verify` is the gate: formatting, then the build with every check. It prints nothing when it passes. Run it before claiming done.
39
+ 9. Anything that waits on the human goes in `docs/inbox.md` under "Waiting on you": the question, your recommendation, where to look. A finished deliverable gets a line under "Delivered". When they rule, log it in `docs/decisions.md` and remove the item.
40
+
41
+ ## Stack locks (unless the user asks otherwise)
42
+
43
+ | Lock | Value |
44
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | Framework | Astro 7 · `output: 'static'` |
46
+ | Trailing slash | `'always'` |
47
+ | CSS | Tailwind 4 via `@tailwindcss/vite` |
48
+ | React | Islands only; small typed props |
49
+ | Host | **Cloudflare Pages**, Direct Upload of `dist/` |
50
+ | Adapter | **No** `@astrojs/cloudflare` / SSR unless explicitly asked |
51
+ | Functions | One: `functions/_middleware.js` answers `Accept: text/markdown` with the page's `index.md` twin. Pages stay static files; `_routes.json` keeps assets off it. Try it with `npx wrangler pages dev dist` after a build |
52
+ | Dependencies | Exact versions, from the registry only, at least 2 days old (`.npmrc`): no `^` / `~`, no casual bumps |
53
+ | Appearance | Light, plus a dark appearance that follows the visitor's system when `darkMode` is true in `site.config.mjs`. Dark tokens sit next to the light ones in `src/styles/global.css`; `dark:` utilities follow the same switch |
54
+ | Class helpers | `clsx` + `tailwind-merge` via `src/lib/cn.ts` |
55
+ | Format | Prettier + `prettier-plugin-astro` (`format` / `format:check`) |
56
+ | Copy lint | `RULES` in `scripts/lint-copy.mjs`, run on built markdown, llms.txt and `src/i18n` |
57
+ | Analytics | Off until an ID is set in `analytics` (`site.config.mjs`): Google Analytics, Microsoft Clarity. Any ID turns on the cookie question (`docs/kit/analytics.md`) |
58
+ | Service worker | **No** by default |
59
+
60
+ ## Commands
61
+
62
+ ```sh
63
+ npm install
64
+ npm run dev # http://{{PROJECT_NAME}}.localhost:{{DEV_PORT}}/, and /dev/styleguide/
65
+ npm run domain # https://{{PROJECT_NAME}}.localhost/ through Caddy
66
+ npm run verify # the gate: format:check + build, silent when it passes
67
+ npm run build # astro check + build + markdown-pages + lint-copy + verify-build
68
+ npm run format # prettier --write
69
+ npm run format:check
70
+ npm run lint:copy # needs a prior build (reads dist/)
71
+ npm run generate:og # public/og-image.png from scripts/og-template.html
72
+ npm run generate:icons # PNG + ICO icons from public/favicon.svg
73
+ npm run deploy -- https://your-domain # build + upload
74
+ ```
75
+
76
+ ## Kit reference
77
+
78
+ Read the file when its case comes up. Each is the single place for its topic.
79
+
80
+ | Read | When |
81
+ | ------------------------ | ------------------------------------------------------------------------------------------ |
82
+ | `docs/kit/structure.md` | Finding where something lives, or adding a file |
83
+ | `docs/kit/languages.md` | Adding a page, a string or a language |
84
+ | `docs/kit/seo.md` | Touching `<head>`, JSON-LD, sitemap, robots, `llms.txt` or the markdown twins |
85
+ | `docs/kit/images.md` | Share card, icons, any rendered picture |
86
+ | `docs/kit/analytics.md` | Setting an analytics ID, the cookie question, `/privacy/` |
87
+ | `docs/kit/deploy.md` | Deploying, or anything in `scripts/deploy.sh` and `.github/workflows/` |
88
+ | `docs/kit/local.md` | The dev server will not start, the port, `npm run domain` |
89
+ | `docs/kit/agent-apps.md` | An agent app's config file or permissions |
90
+ | `docs/kit/upgrade.md` | Taking a newer kit into this site (`npx create-claudecraft upgrade`), and `src/dev/` pages |
91
+
92
+ ## Do not
93
+
94
+ - Flip to SSR “just for forms”
95
+ - Add a second `/*` in `_headers`
96
+ - Ship relative `og:image` URLs
97
+ - Add a service worker unless the human asks
98
+ - Bump dependency major/minor without asking
99
+ - Push to `main` without the human's go-ahead: it deploys
100
+ - Claim green without `npm run verify`
@@ -0,0 +1,42 @@
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 `devPort` in `site.config.mjs`, fixed for this site.
13
+
14
+ - **No port:** `https://{{PROJECT_NAME}}.localhost/`, through Homebrew Caddy. `npm run domain` writes the generated `$(brew --prefix)/etc/caddy.d/{{PROJECT_NAME}}.caddy`, reloads Caddy and prints the URL that works. claudecraft already ran it once if Caddy was running. Without a running Caddy it changes nothing and prints the setup step. It never replaces or removes a `{{PROJECT_NAME}}.caddy` that claudecraft did not write. Only this Mac can open the address. `npm run domain -- --remove` takes it away.
15
+ - **Certificate warning:** run `caddy trust` once.
16
+ - **Port taken:** dev stops with `Port {{DEV_PORT}} is taken`. Stop the other server, or start this one with `PORT=<n> npm run dev`.
17
+ - **Safari on macOS 15 or older:** use `http://localhost:{{DEV_PORT}}/`.
18
+
19
+ ## Assets
20
+
21
+ ```sh
22
+ npm run generate:og # public/og-image.png (1200×630)
23
+ npm run generate:icons # favicons + apple-touch + PWA icons
24
+ ```
25
+
26
+ Both need Google Chrome or Chromium.
27
+
28
+ ## Ship (Cloudflare Pages)
29
+
30
+ ```sh
31
+ npm run deploy -- https://your-domain
32
+ ```
33
+
34
+ Direct Upload of `dist/`, no SSR adapter. What it checks first is at the top of `scripts/deploy.sh`.
35
+
36
+ A push to `main` deploys by itself once the GitHub repository has the secrets `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` and the variable `SITE_URL` (`.github/workflows/deploy.yml`). Until then the run skips. Delete the workflow to deploy by hand only.
37
+
38
+ ## Agents
39
+
40
+ Read **`AGENTS.md` → `design.md` → `intent.md` → `docs/`**. `docs/kit/agent-apps.md` lists the app config files in this folder and what Claude Code may run.
41
+
42
+ Run `/design-quality plan` before laying out new pages, and `/design-quality` (or read `.claude/skills/design-quality/SKILL.md`) before shipping UI changes.
@@ -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,22 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "permissions": {
4
+ "allow": ["Bash(npm run *)", "Bash(bun run *)"],
5
+ "ask": ["Bash(npm run deploy)", "Bash(npm run deploy *)", "Bash(npx wrangler *)"],
6
+ "deny": ["Read(./.env)", "Read(./.dev.vars)"]
7
+ },
8
+ "hooks": {
9
+ "PostToolUse": [
10
+ {
11
+ "matcher": "Write|Edit|MultiEdit",
12
+ "hooks": [
13
+ {
14
+ "type": "command",
15
+ "command": "node .claude/hooks/design-lint.mjs",
16
+ "timeout": 5000
17
+ }
18
+ ]
19
+ }
20
+ ]
21
+ }
22
+ }
@@ -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,31 @@
1
+ # build / deps
2
+ node_modules/
3
+ dist/
4
+ .astro/
5
+ node_modules/.vite/
6
+ node_modules/.vite-build/
7
+
8
+ # env
9
+ .env
10
+ .env.*
11
+ !.env.example
12
+
13
+ # Cloudflare / Wrangler
14
+ .wrangler/
15
+ .dev.vars
16
+
17
+ # test / coverage
18
+ coverage/
19
+
20
+ # OS / editor junk (keep .vscode/ recommendations committed)
21
+ .DS_Store
22
+ *.log
23
+ .idea/
24
+ *.swp
25
+ *.swo
26
+
27
+ # misc local
28
+ .cache/
29
+ .impeccable/
30
+ .vercel/
31
+ .turbo/