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
@@ -1,363 +1,404 @@
1
- import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { useState, useEffect } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useReducer, useState } from 'react';
3
+ import { stripVTControlCharacters } from 'node:util';
3
4
  import { render, Box, Text, useInput, useApp } from 'ink';
4
5
  import TextInput from 'ink-text-input';
5
6
  import SelectInput from 'ink-select-input';
6
- import figlet from 'figlet';
7
7
  import gradient from 'gradient-string';
8
- import fs from 'fs';
9
- import path from 'path';
10
- import { SKILLS, BUNDLES, VERSION, STACK, ASSETS, DEFAULT_THEME, DEFAULT_PORT, TAGLINE } from './constants.js';
11
- // Split gradients for two-line logo
12
- const claudeGradient = gradient(['#00ff9f', '#00b8ff']); // Green → Cyan (fresh)
13
- const craftGradient = gradient(['#a855f7', '#6d28d9']); // Purple → Violet (deep)
14
- // Generate ASCII art for each word separately
15
- const asciiClaude = figlet.textSync('CLAUDE', {
16
- font: 'ANSI Shadow',
17
- horizontalLayout: 'fitted',
18
- });
19
- const asciiCraft = figlet.textSync('CRAFT', {
20
- font: 'ANSI Shadow',
21
- horizontalLayout: 'fitted',
22
- });
23
- // Get today's date for the revision block
24
- const today = new Date().toISOString().split('T')[0].replace(/-/g, '.');
25
- // ═══════════════════════════════════════════════════════════════════════════
26
- // ALIGNMENT: Frame width = 76 chars exactly (must match ui.ts)
27
- // Normal row: " │ │ " (7) + content (66) + "│ │" (3) = 76
28
- // CAP HT row: " │ │ " (7) + content (58) + "│◀┼─ CAP HT" (11) = 76
29
- // BASELINE row: " │ │ " (7) + content (56) + "│◀┼─ BASELINE" (13) = 76
30
- // ASCII: CLAUDE=49 chars, CRAFT=41 chars
31
- // ═══════════════════════════════════════════════════════════════════════════
32
- const FRAME = 76;
33
- const INNER = 66; // Normal row content width
34
- const CAP_HT_WIDTH = 58; // CAP HT row content width (76-7-11)
35
- const BASELINE_WIDTH = 56; // BASELINE row content width (76-7-13)
36
- // Helper to pad strings
37
- const pad = (s, len) => s + ' '.repeat(Math.max(0, len - s.length));
38
- // Pad to exact width (strips ANSI codes for length calc)
39
- const padTo = (line, width) => {
40
- const visible = line.replace(/\x1b\[[0-9;]*m/g, '').length;
41
- return line + ' '.repeat(Math.max(0, width - visible));
8
+ import { lettering } from './lettering.js';
9
+ import { ACCENT_PALETTE, DEFAULT_ACCENT_ID, DEFAULT_LOCALE, DEFAULT_SITE_URL, DEFAULT_TEMPLATE_ID, LANGUAGES, TEMPLATES, VERSION, accentById, freeFolderName, isFolderName, normalizeUrl, parseLocales, prettifyName, validateProjectName, } from './answers.js';
10
+ const today = new Date().toISOString().slice(0, 10).replace(/-/g, '.');
11
+ export const WIDTH = 76;
12
+ const INNER = WIDTH - 8;
13
+ const CONTENT = INNER - 2;
14
+ const C = {
15
+ frame: '#565f89',
16
+ muted: '#737aa2',
17
+ blue: '#7aa2f7',
18
+ cyan: '#7dcfff',
19
+ purple: '#bb9af7',
20
+ orange: '#ff9e64',
21
+ red: '#f7768e',
42
22
  };
43
- // Existential dread collections
44
- const DREAD = {
45
- help: [
46
- "You're not being replaced. You're being... augmented. Involuntarily.",
47
- "The AI can't feel impostor syndrome. That's still your job.",
48
- "Remember when 'prompt engineering' wasn't a career? Good times.",
49
- "The robots write code now. You write prompts. This is fine.",
50
- "At least the AI doesn't have opinions about your font choices. Yet.",
23
+ const s = (text, color, bold) => ({ text, color, bold });
24
+ const widthOf = (line) => line.reduce((n, seg) => n + stripVTControlCharacters(seg.text).length, 0);
25
+ const fit = (line, width) => [...line, s(' '.repeat(Math.max(0, width - widthOf(line))))];
26
+ const spread = (left, right, width) => [
27
+ ...left,
28
+ s(' '.repeat(Math.max(1, width - widthOf(left) - widthOf(right)))),
29
+ ...right,
30
+ ];
31
+ function Row({ line }) {
32
+ if (!line.length)
33
+ return _jsx(Text, { children: " " });
34
+ return (_jsx(Text, { children: line.map((seg, i) => (_jsx(Text, { color: seg.color, bold: seg.bold, children: seg.text }, i))) }));
35
+ }
36
+ const corner = s('⊕', C.orange);
37
+ const rule = (title, color = C.blue, bold = true) => [
38
+ s(' '),
39
+ corner,
40
+ s('─── ', C.frame),
41
+ s(title, color, bold),
42
+ s(' ' + '─'.repeat(Math.max(1, WIDTH - 9 - title.length)), C.frame),
43
+ corner,
44
+ ];
45
+ function art(text, colors) {
46
+ const raw = lettering(text);
47
+ const width = Math.max(...raw.map((l) => l.length));
48
+ return gradient(colors).multiline(raw.map((l) => l.padEnd(width)).join('\n')).split('\n');
49
+ }
50
+ const TOP = art('CLAUDE', [C.orange, C.purple]);
51
+ const BOTTOM = art('CRAFT', [C.cyan, C.blue]);
52
+ const boxRow = (content) => [s(' │ │ ', C.frame), ...fit(content, CONTENT), s('│ │', C.frame)];
53
+ const RULER = Array.from({ length: CONTENT }, (_, i) => (i % 10 === 0 ? '┆' : i % 2 === 0 ? '·' : ' '))
54
+ .join('')
55
+ .trimEnd();
56
+ function dimensionLine() {
57
+ const label = ` ${INNER} COLS `;
58
+ const dashes = INNER - 2 - label.length;
59
+ const left = Math.floor(dashes / 2);
60
+ return [s(` │◀${'─'.repeat(left)}${label}${'─'.repeat(dashes - left)}▶│`, C.frame)];
61
+ }
62
+ const ALL_STEPS = [
63
+ { id: 'template', label: 'Stack', title: 'TEMPLATE' },
64
+ { id: 'name', label: 'Name', title: 'NAME' },
65
+ { id: 'folder', label: 'Folder', title: 'FOLDER' },
66
+ { id: 'line', label: 'Line', title: 'ONE-LINER (OPTIONAL)' },
67
+ { id: 'url', label: 'URL', title: 'SITE URL (OPTIONAL)' },
68
+ { id: 'languages', label: 'Lang', title: 'LANGUAGES' },
69
+ { id: 'accent', label: 'Color', title: 'COLOR' },
70
+ { id: 'apps', label: 'Apps', title: 'ADD TO' },
71
+ { id: 'git', label: 'Git', title: 'GIT' },
72
+ { id: 'install', label: 'Install', title: 'INSTALL DEPS' },
73
+ ];
74
+ export const STEP_IDS = ALL_STEPS.map((st) => st.id);
75
+ const TEXT_STEPS = new Set(['name', 'folder', 'line', 'url']);
76
+ function activeSteps(template, hasApps) {
77
+ return ALL_STEPS.filter((st) => {
78
+ if (template === 'react' && (st.id === 'url' || st.id === 'languages'))
79
+ return false;
80
+ if (!hasApps && st.id === 'apps')
81
+ return false;
82
+ return true;
83
+ });
84
+ }
85
+ function progressLines(steps, current) {
86
+ const idx = Math.max(0, steps.findIndex((st) => st.id === current));
87
+ const items = steps.flatMap(({ label }, i) => [
88
+ s(i ? ' ' : ' '),
89
+ i < idx ? s(`● ${label}`, C.blue) : i === idx ? s(`◉ ${label}`, C.orange, true) : s(`○ ${label}`, C.frame),
90
+ ]);
91
+ return [rule('PROGRESS', C.frame, false), [], items];
92
+ }
93
+ function headerLines(steps, current) {
94
+ const bar = '─'.repeat(INNER);
95
+ const meta = spread([s(' '), s('Astro 7 | React 19', C.cyan), s(' · Tailwind 4 · G1-G20', C.muted)], [s(`REV ${VERSION}`, C.purple), s(` │ ${today} `, C.frame)], INNER);
96
+ return [
97
+ [s(' '), corner, s(`─┬${bar}┬─`, C.frame), corner],
98
+ dimensionLine(),
99
+ [s(` ┌─┼${bar}┼─┐`, C.frame)],
100
+ boxRow([s(RULER, C.frame)]),
101
+ ...TOP.map((line) => boxRow([s(line)])),
102
+ boxRow([]),
103
+ ...BOTTOM.map((line) => boxRow([s(line)])),
104
+ [s(` └─┼${bar}┼─┘`, C.frame)],
105
+ [s(' '), s('│', C.frame), ...meta, s('│', C.frame)],
106
+ [s(' '), corner, s(`─┴${bar}┴─`, C.frame), corner],
107
+ ...(steps && current ? [[], ...progressLines(steps, current)] : []),
108
+ ];
109
+ }
110
+ export function Header({ steps, current, }) {
111
+ return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: headerLines(steps, current).map((line, i) => (_jsx(Row, { line: line }, i))) }));
112
+ }
113
+ function Frame({ step, number, children, }) {
114
+ const { title } = ALL_STEPS.find((st) => st.id === step);
115
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Row, { line: rule(`${number}. ${title}`) }), _jsx(Text, { children: " " }), _jsx(Box, { flexDirection: "column", paddingLeft: 4, children: children })] }));
116
+ }
117
+ function HintBar({ text }) {
118
+ const edge = '─'.repeat(WIDTH - 4);
119
+ return (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: C.frame, children: ` ╭${edge}╮` }), _jsx(Row, { line: [s(' │ ', C.frame), ...fit([s(text, C.muted)], WIDTH - 6), s(' │', C.frame)] }), _jsx(Text, { color: C.frame, children: ` ╰${edge}╯` })] }));
120
+ }
121
+ function Indicator({ isSelected }) {
122
+ return _jsx(Text, { color: C.purple, children: isSelected ? '❯ ' : ' ' });
123
+ }
124
+ function Item({ isSelected, label }) {
125
+ return (_jsx(Text, { color: isSelected ? C.cyan : undefined, bold: isSelected, children: label }));
126
+ }
127
+ function TemplateItem({ isSelected, label, detail, }) {
128
+ return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { color: isSelected ? C.cyan : undefined, bold: isSelected, children: label }), detail && _jsx(Text, { color: C.muted, children: ` ${detail}` })] }));
129
+ }
130
+ const EDITED = ['Note', 'Once you edit the field, ? types a question mark.'];
131
+ const defaultAccent = accentById(DEFAULT_ACCENT_ID);
132
+ export const HELP = {
133
+ template: [
134
+ ['Astro 7', 'Static marketing/content site with day-0 SEO/AEO, i18n,'],
135
+ ['', 'Cloudflare Pages deploy, OG/icon generators, React islands.'],
136
+ ['React 19', 'Vite SPA with TypeScript 5.9, Tailwind 4, React Router 7,'],
137
+ ['', 'Vitest, token lint, and copy lint.'],
138
+ ['Both', 'Include AGENTS.md, design.md (G1-G20), intent.md, the'],
139
+ ['', 'design-quality skill, design-lint hook, and npm run verify.'],
140
+ ['Flag', '--template astro | react'],
141
+ ],
142
+ name: [
143
+ ['Sets', 'The human name in titles, headers, docs, and share cards.'],
144
+ ['Files', 'site.config.mjs, README.md, AGENTS.md, design.md'],
145
+ ['Token', '{{SITE_NAME}}'],
146
+ ['Example', 'Oak & Iron'],
147
+ ['Flag', 'create-claudecraft "Oak & Iron" --yes'],
148
+ EDITED,
51
149
  ],
52
- reassurance: [
53
- "But hey, someone still needs taste. That's you. Allegedly.",
54
- "Breathe. The AI still can't center a div without help.",
55
- "Keep going. The AI believes in you. (It doesn't. It can't.)",
150
+ folder: [
151
+ ['Sets', 'The new directory, package name, and local .localhost host.'],
152
+ ['Files', 'package.json, AGENTS.md'],
153
+ ['Token', '{{PROJECT_NAME}}'],
154
+ ['Default', 'Made from the name: lowercase a-z, 0-9 and dashes, max 63.'],
155
+ ['Flag', 'create-claudecraft my-app --site-name "My App" --yes'],
56
156
  ],
57
- cancel: [
58
- "You'll be back. They always come back.",
59
- "Ctrl+C won't save you from the future.",
60
- "Quitting is a valid design decision.",
157
+ line: [
158
+ ['Sets', 'One sentence on what this project is (meta description + docs).'],
159
+ ['Files', 'intent.md, AGENTS.md, README.md'],
160
+ ['Token', '{{ONE_SENTENCE}}'],
161
+ ['Default', 'Blank writes a placeholder until you fill intent.md.'],
162
+ ['Flag', '--sentence "Oak tables made to order in Cluj."'],
163
+ EDITED,
164
+ ],
165
+ url: [
166
+ ['Sets', 'Canonical origin for sitemap, robots.txt, og:url, hreflang.'],
167
+ ['Files', 'site.config.mjs (Astro template)'],
168
+ ['Default', `${DEFAULT_SITE_URL} (npm run deploy refuses it until set)`],
169
+ ['Flag', '--url https://example.com'],
170
+ ],
171
+ languages: [
172
+ ['Sets', 'Languages for Astro i18n routing, hreflang, and catalogs.'],
173
+ ['Default', 'English only.'],
174
+ ['Flag', '--lang en,de (first code is the default)'],
175
+ ],
176
+ accent: [
177
+ ['Sets', 'Dominant accent (--color-accent) and optional system dark mode.'],
178
+ ['Files', 'src/styles/global.css, site.config.mjs'],
179
+ ['Default', `${defaultAccent.id}, with dark mode on`],
180
+ ['Flag', '--accent orange, and --no-dark for light only'],
181
+ ],
182
+ apps: [
183
+ ['Sets', 'Writes config for picked agent apps and opens the project.'],
184
+ ['Always', '.claude/settings.json + design-lint hook + design-quality skill.'],
185
+ ['Default', 'Every installed app found on this machine. Space unticks one.'],
186
+ ['Flag', '--add claude,cursor, all, or none.'],
187
+ ],
188
+ git: [
189
+ ['Sets', 'git init -b main, and optionally creates a GitHub repo via gh.'],
190
+ ['Default', 'Private GitHub repo when gh is logged in, else local git.'],
191
+ ['Flag', '--repo private | public, or --no-git'],
192
+ ],
193
+ install: [
194
+ ['Sets', 'Installs dependencies in the new folder right away.'],
195
+ ['Default', 'Yes'],
196
+ ['Flag', '--no-install'],
61
197
  ],
62
198
  };
63
- const random = (arr) => arr[Math.floor(Math.random() * arr.length)];
64
- // Slash commands
65
- const COMMANDS = [
66
- { name: '/help', hint: 'existential guidance' },
67
- { name: '/skills', hint: 'what the AI knows' },
68
- { name: '/quit', hint: 'escape while you can' },
69
- ];
70
- // Specs/Manifest panel component (76 chars wide to match header)
71
- function SpecsPanel() {
72
- return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: [" \u256D\u2500\u2500\u2500 SPECS ", '─'.repeat(60), "\u256E"] }), _jsxs(Text, { dimColor: true, children: [" \u2502 ", TAGLINE.padEnd(70), "\u2502"] }), _jsx(Text, { dimColor: true, children: " \u251C\u2500\u2500\u2500 STACK \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500 ASSETS \u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500 DEFAULTS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524" }), _jsxs(Text, { dimColor: true, children: [" \u2502 ", _jsxs(Text, { children: ["react ", pad(STACK.react, 6)] }), "\u2502 ", _jsxs(Text, { children: ["skills ", pad(String(ASSETS.skills), 4)] }), "\u2502 ", _jsxs(Text, { children: ["theme ", pad(DEFAULT_THEME, 8)] }), "\u2502"] }), _jsxs(Text, { dimColor: true, children: [" \u2502 ", _jsxs(Text, { children: ["typescript ", pad(STACK.typescript, 6)] }), "\u2502 ", _jsxs(Text, { children: ["commands ", pad(String(ASSETS.commands), 4)] }), "\u2502 ", _jsxs(Text, { children: ["port ", pad(String(DEFAULT_PORT), 8)] }), "\u2502"] }), _jsxs(Text, { dimColor: true, children: [" \u2502 ", _jsxs(Text, { children: ["vite ", pad(STACK.vite, 6)] }), "\u2502 ", _jsxs(Text, { children: ["themes ", pad(String(ASSETS.themes), 4)] }), "\u2502 ", _jsx(Text, { children: "tests vitest " }), "\u2502"] }), _jsxs(Text, { dimColor: true, children: [" \u2502 ", _jsxs(Text, { children: ["tailwind ", pad(STACK.tailwind, 6)] }), "\u2502 ", _jsxs(Text, { children: ["hooks ", pad(String(ASSETS.hooks), 4)] }), "\u2502 ", _jsx(Text, { children: "pkg bun " }), "\u2502"] }), _jsxs(Text, { dimColor: true, children: [" \u2502 ", _jsxs(Text, { children: ["daisyui ", pad(STACK.daisyui, 6)] }), "\u2502 ", _jsxs(Text, { children: ["comps ", pad(String(ASSETS.components), 4)] }), "\u2502 ", _jsx(Text, { children: "license MIT " }), "\u2502"] }), _jsx(Text, { dimColor: true, children: " \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524" }), _jsx(Text, { dimColor: true, children: " \u2502 ~48 files \u00B7 0 deps \u00B7 type /help for existential guidance \u2502" }), _jsxs(Text, { dimColor: true, children: [" \u2570", '─'.repeat(72), "\u256F"] })] }));
199
+ const helpLabel = (label) => label.padEnd(10);
200
+ export const helpRow = ([label, text]) => helpLabel(label) + text;
201
+ function HelpPanel({ step }) {
202
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Row, { line: rule('HELP', C.purple) }), _jsx(Text, { children: " " }), HELP[step].map((row, i) => (_jsx(Row, { line: [s(' '), s(helpLabel(row[0]), C.muted), s(row[1])] }, i)))] }));
73
203
  }
74
- // Progress panel - 76 chars wide to match header
75
- function ProgressPanel({ step, total, labels }) {
76
- const stepWidth = Math.floor(66 / total);
77
- return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: [" \u256D\u2500\u2500\u2500 PROGRESS ", '─'.repeat(57), "\u256E"] }), _jsx(Text, { dimColor: true, children: " \u2502 \u2502" }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " \u2502 " }), Array.from({ length: total }, (_, i) => {
78
- const num = i + 1;
79
- const label = labels[i] || `Step ${num}`;
80
- const isComplete = num < step;
81
- const isCurrent = num === step;
82
- const isPending = num > step;
83
- return (_jsxs(React.Fragment, { children: [isComplete && _jsxs(Text, { color: "green", children: ["\u25CF ", label.substring(0, stepWidth - 3).padEnd(stepWidth - 1)] }), isCurrent && _jsxs(Text, { color: "cyan", children: ["\u25C9 ", label.substring(0, stepWidth - 3).padEnd(stepWidth - 1)] }), isPending && _jsxs(Text, { dimColor: true, children: ["\u25CB ", label.substring(0, stepWidth - 3).padEnd(stepWidth - 1)] })] }, num));
84
- }), _jsx(Text, { dimColor: true, children: "\u2502" })] }), _jsx(Text, { dimColor: true, children: " \u2502 \u2502" }), _jsxs(Text, { dimColor: true, children: [" \u2570", '─'.repeat(72), "\u256F"] })] }));
204
+ export function typedHelpKey(prev, next) {
205
+ if (next.length !== prev.length + 1)
206
+ return false;
207
+ let i = 0;
208
+ while (i < prev.length && prev[i] === next[i])
209
+ i++;
210
+ return next[i] === '?' && next.slice(i + 1) === prev.slice(i);
85
211
  }
86
- // Step labels for progress panel
87
- const STEP_LABELS = ['Name', 'Skills', 'Homepage', 'Git'];
88
- // Technical Drawing Header with prepress marks (76 chars wide, perfectly aligned)
89
- function Header({ showSpecs = true, step, totalSteps }) {
90
- // Apply gradients and filter empty lines
91
- const claudeLines = claudeGradient(asciiClaude).split('\n').filter(l => l.trim());
92
- const craftLines = craftGradient(asciiCraft).split('\n').filter(l => l.trim());
93
- return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: "cyan", children: " \u2295" }), _jsxs(Text, { dimColor: true, children: ["\u2500\u252C", '─'.repeat(68), "\u252C\u2500"] }), _jsx(Text, { color: "cyan", children: "\u2295" })] }), _jsxs(Text, { dimColor: true, children: [" \u2502 \u25C0", '─'.repeat(26), " 72 COLS ", '─'.repeat(26), "\u25B6 \u2502"] }), _jsxs(Text, { dimColor: true, children: [" \u250C\u2500\u253C", '─'.repeat(68), "\u253C\u2500\u2510"] }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " \u2502 \u2502 " }), _jsx(Text, { dimColor: true, children: padTo('┆ · · · · ┆ · · · · ┆ · · · · ┆ · · · · ┆ · · · · ┆ · · · · ┆ ·', INNER) }), _jsx(Text, { dimColor: true, children: "\u2502 \u2502" })] }), claudeLines.map((line, i) => (_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " \u2502 \u2502 " }), i === 0 ? (_jsxs(_Fragment, { children: [_jsx(Text, { children: padTo(line, CAP_HT_WIDTH) }), _jsx(Text, { dimColor: true, children: "\u2502\u25C0\u253C\u2500 CAP HT" })] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { children: padTo(line, INNER) }), _jsx(Text, { dimColor: true, children: "\u2502 \u2502" })] }))] }, `claude-${i}`))), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " \u2502 \u2502 " }), _jsx(Text, { dimColor: true, children: padTo('├' + '─'.repeat(53) + '┤', BASELINE_WIDTH) }), _jsx(Text, { dimColor: true, children: "\u2502\u25C0\u253C\u2500 BASELINE" })] }), craftLines.map((line, i) => (_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " \u2502 \u2502 " }), _jsx(Text, { children: padTo(line, INNER) }), _jsx(Text, { dimColor: true, children: "\u2502 \u2502" })] }, `craft-${i}`))), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " \u2502 \u2502 " }), _jsx(Text, { dimColor: true, children: padTo('0 10 20 30 40 50 60', INNER) }), _jsx(Text, { dimColor: true, children: "\u2502 \u2502" })] }), _jsxs(Text, { dimColor: true, children: [" \u2514\u2500\u253C", '─'.repeat(68), "\u253C\u2500\u2518"] }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " \u2502 " }), _jsx(Text, { color: "cyan", children: "\u25A0" }), _jsx(Text, { dimColor: true, children: " C " }), _jsx(Text, { color: "magenta", children: "\u25A0" }), _jsx(Text, { dimColor: true, children: " M " }), _jsx(Text, { color: "yellow", children: "\u25A0" }), _jsx(Text, { dimColor: true, children: " Y " }), _jsx(Text, { color: "white", children: "\u25A0" }), _jsx(Text, { dimColor: true, children: " K " }), _jsxs(Text, { color: "green", children: ["REV ", VERSION] }), _jsxs(Text, { dimColor: true, children: [" \u2502 ", today, " \u2502 "] }), _jsx(Text, { color: "yellow", children: "NOT FOR PROD" }), _jsx(Text, { dimColor: true, children: " \u2502" })] }), _jsxs(Text, { children: [_jsx(Text, { color: "cyan", children: " \u2295" }), _jsxs(Text, { dimColor: true, children: ["\u2500\u2534", '─'.repeat(68), "\u2534\u2500"] }), _jsx(Text, { color: "cyan", children: "\u2295" })] }), showSpecs ? (_jsx(Box, { marginTop: 1, children: _jsx(SpecsPanel, {}) })) : step && totalSteps ? (_jsx(Box, { marginTop: 1, children: _jsx(ProgressPanel, { step: step, total: totalSteps, labels: STEP_LABELS }) })) : null] }));
94
- }
95
- // Autocomplete dropdown - matches design language
96
- function Autocomplete({ query, commands, onSelect }) {
97
- const [selectedIndex, setSelectedIndex] = useState(0);
98
- const filtered = commands.filter(c => c.name.toLowerCase().startsWith(query.toLowerCase()));
99
- useInput((input, key) => {
100
- if (key.downArrow) {
101
- setSelectedIndex(i => Math.min(i + 1, filtered.length - 1));
102
- }
103
- else if (key.upArrow) {
104
- setSelectedIndex(i => Math.max(i - 1, 0));
212
+ export const PICK_ROWS = 8;
213
+ export const picker = (values) => (state, key) => {
214
+ if (key === 'toggle') {
215
+ const value = values[state.cursor];
216
+ const on = state.chosen.includes(value);
217
+ return { ...state, chosen: values.filter((v) => (v === value ? !on : state.chosen.includes(v))) };
218
+ }
219
+ const cursor = (state.cursor + (key === 'down' ? 1 : -1) + values.length) % values.length;
220
+ const top = cursor < state.top ? cursor : cursor >= state.top + PICK_ROWS ? cursor - PICK_ROWS + 1 : state.top;
221
+ return { ...state, cursor, top };
222
+ };
223
+ const languageLabel = (l) => `${l.code.padEnd(7)}${l.english.padEnd(22)}${l.name === l.english ? '' : l.name}`.trimEnd();
224
+ export const LANGUAGE_ITEMS = LANGUAGES.map((l) => ({ value: l.code, label: languageLabel(l) }));
225
+ export function Picker({ items, initial, required, onSubmit, }) {
226
+ const [state, dispatch] = useReducer(picker(items.map((item) => item.value)), initial, (chosen) => ({ cursor: 0, top: 0, chosen: [...chosen] }));
227
+ const [error, setError] = useState(false);
228
+ useInput((ch, key) => {
229
+ if (key.upArrow)
230
+ dispatch('up');
231
+ else if (key.downArrow)
232
+ dispatch('down');
233
+ else if (ch === ' ') {
234
+ setError(false);
235
+ dispatch('toggle');
105
236
  }
106
- else if (key.return && filtered[selectedIndex]) {
107
- onSelect(filtered[selectedIndex].name);
237
+ else if (key.return) {
238
+ if (state.chosen.length || !required)
239
+ onSubmit(state.chosen);
240
+ else
241
+ setError(true);
108
242
  }
109
243
  });
110
- if (filtered.length === 0)
111
- return null;
112
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "\u251C\u2500\u2500\u2500 COMMANDS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524" }), filtered.map((cmd, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u2502 " }), _jsxs(Text, { color: i === selectedIndex ? 'cyan' : 'white', children: [i === selectedIndex ? '› ' : ' ', cmd.name.padEnd(10)] }), _jsx(Text, { dimColor: true, children: cmd.hint })] }, cmd.name))), _jsx(Text, { dimColor: true, children: "\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F" })] }));
244
+ const rows = items.slice(state.top, state.top + PICK_ROWS);
245
+ return (_jsxs(Box, { flexDirection: "column", children: [rows.map((item, i) => {
246
+ const here = state.top + i === state.cursor;
247
+ const on = state.chosen.includes(item.value);
248
+ return (_jsxs(Text, { children: [_jsx(Indicator, { isSelected: here }), _jsx(Text, { color: on ? C.cyan : C.frame, children: on ? '●' : '○' }), _jsx(Text, { color: here ? C.cyan : undefined, bold: here, children: ' ' + item.label })] }, item.value));
249
+ }), _jsx(Text, { color: C.muted, children: ` ${state.top + 1}-${state.top + rows.length} of ${items.length} · ${state.chosen.length} selected` }), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: C.red, children: ["\u2717 ", required] }) }))] }));
113
250
  }
114
- // Help panel - matches specs panel design
115
- function HelpPanel({ onClose }) {
116
- useInput((_, key) => {
117
- if (key.escape || key.return)
118
- onClose();
119
- });
120
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "\u256D\u2500\u2500\u2500 HELP \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E" }), _jsxs(Text, { dimColor: true, children: ["\u2502 ", _jsx(Text, { children: random(DREAD.help).padEnd(69) }), "\u2502"] }), _jsx(Text, { dimColor: true, children: "\u251C\u2500\u2500\u2500 COMMANDS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524" }), _jsxs(Text, { dimColor: true, children: ["\u2502 ", _jsx(Text, { color: "cyan", children: "/help" }), " ", _jsx(Text, { dimColor: true, children: "you are here (existentially, too)" }), " \u2502"] }), _jsxs(Text, { dimColor: true, children: ["\u2502 ", _jsx(Text, { color: "cyan", children: "/skills" }), " ", _jsx(Text, { dimColor: true, children: "see what the robots learned" }), " \u2502"] }), _jsxs(Text, { dimColor: true, children: ["\u2502 ", _jsx(Text, { color: "cyan", children: "/quit" }), " ", _jsx(Text, { dimColor: true, children: "rage quit" }), " \u2502"] }), _jsx(Text, { dimColor: true, children: "\u251C\u2500\u2500\u2500 NAVIGATION \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524" }), _jsx(Text, { dimColor: true, children: "\u2502 \u2191\u2193 move through options \u2502" }), _jsx(Text, { dimColor: true, children: "\u2502 space toggle selection \u2502" }), _jsx(Text, { dimColor: true, children: "\u2502 enter confirm your life choices \u2502" }), _jsx(Text, { dimColor: true, children: "\u2502 esc cancel (the project, not your career) \u2502" }), _jsx(Text, { dimColor: true, children: "\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524" }), _jsxs(Text, { dimColor: true, children: ["\u2502 ", _jsx(Text, { children: random(DREAD.reassurance).padEnd(69) }), "\u2502"] }), _jsx(Text, { dimColor: true, children: "\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524" }), _jsxs(Text, { dimColor: true, children: ["\u2502 ", _jsx(Text, { dimColor: true, children: "Press Enter or Esc to continue..." }), " \u2502"] }), _jsx(Text, { dimColor: true, children: "\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F" })] }));
121
- }
122
- // Skills panel - matches specs panel design
123
- function SkillsPanel({ onClose }) {
124
- useInput((_, key) => {
125
- if (key.escape || key.return)
126
- onClose();
127
- });
128
- const workflow = SKILLS.filter(s => s.group === 'workflow');
129
- const design = SKILLS.filter(s => s.group === 'design');
130
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "\u256D\u2500\u2500\u2500 SKILLS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E" }), _jsx(Text, { dimColor: true, children: "\u2502 Things the AI learned so you don't have to: \u2502" }), _jsxs(Text, { dimColor: true, children: ["\u251C\u2500\u2500\u2500 WORKFLOW (", String(workflow.length).padEnd(2), ") \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"] }), workflow.map(s => (_jsxs(Text, { dimColor: true, children: ["\u2502 ", s.name.padEnd(24), " ", _jsx(Text, { dimColor: true, children: s.description.substring(0, 40).padEnd(40) }), "\u2502"] }, s.name))), _jsxs(Text, { dimColor: true, children: ["\u251C\u2500\u2500\u2500 DESIGN (", String(design.length).padEnd(2), ") \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"] }), design.map(s => (_jsxs(Text, { dimColor: true, children: ["\u2502 ", s.name.padEnd(24), " ", _jsx(Text, { dimColor: true, children: s.description.substring(0, 40).padEnd(40) }), "\u2502"] }, s.name))), _jsx(Text, { dimColor: true, children: "\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524" }), _jsx(Text, { dimColor: true, children: "\u2502 Press Enter or Esc to continue... \u2502" }), _jsx(Text, { dimColor: true, children: "\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F" })] }));
251
+ const ACCENT_LABEL = Math.max(...ACCENT_PALETTE.map((a) => a.label.length));
252
+ const ACCENT_ITEMS = ACCENT_PALETTE.map((a) => ({ label: a.label, value: a.id, hex: a.hex, on: a.on }));
253
+ const TEMPLATE_ITEMS = TEMPLATES.map((t) => ({ label: t.label, value: t.id, detail: t.detail }));
254
+ function AccentItem({ isSelected, label, hex, on, }) {
255
+ return (_jsxs(Text, { children: [_jsx(Text, { backgroundColor: hex, color: on, bold: true, children: ` ${label.padEnd(ACCENT_LABEL)} ` }), _jsx(Text, { color: isSelected ? C.cyan : C.muted, children: ` ${hex}` })] }));
131
256
  }
132
- // Frame component - matches specs panel design
133
- function Frame({ title, children, hint }) {
134
- // Calculate padding for consistent width
135
- const titleSection = `─── ${title} `;
136
- const hintSection = hint ? ` ${hint} ` : ' ';
137
- const remaining = 71 - titleSection.length - hintSection.length;
138
- const padding = '─'.repeat(Math.max(0, remaining));
139
- return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: ["\u256D\u2500\u2500\u2500", ' ', _jsx(Text, { bold: true, color: "cyan", children: title }), ' ', hint ? _jsx(Text, { dimColor: true, children: hint }) : null, ' ', padding, "\u256E"] }), _jsxs(Box, { flexDirection: "column", paddingLeft: 1, children: [_jsx(Text, { dimColor: true, children: "\u2502" }), children, _jsx(Text, { dimColor: true, children: "\u2502" })] }), _jsx(Text, { dimColor: true, children: "\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F" })] }));
140
- }
141
- // Input with slash command support
142
- function CommandInput({ value, onChange, onSubmit, placeholder, validate, }) {
143
- const [showAutocomplete, setShowAutocomplete] = useState(false);
257
+ function CommandInput({ value, onChange, onSubmit, placeholder, validate, onHelp, }) {
144
258
  const [error, setError] = useState();
145
- useEffect(() => {
146
- setShowAutocomplete(value.startsWith('/') && value.length < 10);
147
- }, [value]);
148
- const handleSubmit = (val) => {
149
- if (val.startsWith('/')) {
150
- // Handle as command
151
- onSubmit(val);
152
- }
153
- else {
154
- // Validate and submit
155
- const err = validate?.(val);
156
- if (err) {
157
- setError(err);
158
- }
159
- else {
160
- setError(undefined);
161
- onSubmit(val);
162
- }
163
- }
164
- };
165
- return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: "cyan", children: "\u203A " }), _jsx(TextInput, { value: value, onChange: onChange, onSubmit: handleSubmit, placeholder: placeholder })] }), showAutocomplete && (_jsx(Box, { marginTop: 1, children: _jsx(Autocomplete, { query: value, commands: COMMANDS, onSelect: (cmd) => {
166
- onChange(cmd);
167
- onSubmit(cmd);
168
- } }) })), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "red", children: ["\u2717 ", error] }) }))] }));
259
+ const [mount, setMount] = useState(0);
260
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: C.cyan, children: "\u203A " }), _jsx(TextInput, { value: value, onChange: (raw) => {
261
+ const v = raw.replace(/[\r\n]/g, '');
262
+ if (onHelp && typedHelpKey(value, v)) {
263
+ onHelp();
264
+ setMount((m) => m + 1);
265
+ return;
266
+ }
267
+ setError(undefined);
268
+ onChange(v);
269
+ }, onSubmit: (val) => {
270
+ const err = validate?.(val);
271
+ if (err)
272
+ setError(err);
273
+ else
274
+ onSubmit(val);
275
+ }, placeholder: placeholder }, mount)] }), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: C.red, children: ["\u2717 ", error] }) }))] }));
169
276
  }
170
- function WizardApp({ defaultName, onComplete }) {
277
+ const YES_NO = [
278
+ { label: 'Yes', value: true },
279
+ { label: 'No', value: false },
280
+ ];
281
+ const GITHUB_ITEMS = [
282
+ { label: 'Private GitHub repo', value: 'private' },
283
+ { label: 'Public GitHub repo', value: 'public' },
284
+ ];
285
+ const LOCAL_ITEMS = [
286
+ { label: 'Local git only', value: 'local' },
287
+ { label: 'No git', value: 'none' },
288
+ ];
289
+ export function WizardApp({ defaultName, defaultTemplate, apps = [], github = false, onComplete, initial, }) {
171
290
  const { exit } = useApp();
172
- const [step, setStep] = useState('name');
173
- const [panel, setPanel] = useState(null);
174
- const [input, setInput] = useState(defaultName || '');
175
- // Collected choices
291
+ const [template, setTemplate] = useState(initial?.template ?? defaultTemplate ?? DEFAULT_TEMPLATE_ID);
292
+ const [step, setStep] = useState(initial?.step ?? (defaultTemplate ? 'name' : 'template'));
293
+ const [help, setHelp] = useState(initial?.help ?? false);
294
+ const [input, setInput] = useState(defaultName && isFolderName(defaultName) ? prettifyName(defaultName) : (defaultName ?? ''));
176
295
  const [projectName, setProjectName] = useState('');
177
- const [bundle, setBundle] = useState('everything');
178
- const [selectedSkills, setSelectedSkills] = useState([]);
179
- const [includeHomepage, setIncludeHomepage] = useState(true);
180
- const [initGit, setInitGit] = useState(true);
181
- // Handle escape to quit
182
- useInput((_, key) => {
183
- if (key.escape && !panel) {
184
- console.log('\n' + random(DREAD.cancel));
185
- exit();
186
- }
187
- });
188
- // Handle slash commands
189
- const handleCommand = (cmd) => {
190
- const normalized = cmd.toLowerCase().trim();
191
- if (normalized === '/help' || normalized === '/h') {
192
- setPanel('help');
193
- }
194
- else if (normalized === '/skills' || normalized === '/list') {
195
- setPanel('skills');
196
- }
197
- else if (normalized === '/quit' || normalized === '/q' || normalized === '/exit') {
198
- console.log('\n' + random(DREAD.cancel));
199
- exit();
200
- }
201
- setInput('');
202
- };
203
- // Handle name submission
204
- const handleNameSubmit = (value) => {
205
- if (value.startsWith('/')) {
206
- handleCommand(value);
207
- return;
208
- }
209
- setProjectName(value);
210
- setStep('bundle');
211
- };
212
- // Validate project name
213
- const validateName = (value) => {
214
- if (!value)
215
- return 'Required';
216
- if (!/^[a-z0-9-]+$/.test(value))
217
- return 'Lowercase, numbers, dashes only';
218
- if (value.length > 64)
219
- return 'Max 64 chars';
220
- const targetDir = path.resolve(process.cwd(), value);
221
- if (fs.existsSync(targetDir))
222
- return `Directory "${value}" already exists`;
223
- return undefined;
296
+ const [siteName, setSiteName] = useState('');
297
+ const [oneSentence, setOneSentence] = useState('');
298
+ const [siteUrl, setSiteUrl] = useState(DEFAULT_SITE_URL);
299
+ const [chosen, setChosen] = useState(null);
300
+ const [languages, setLanguages] = useState(() => parseLocales(DEFAULT_LOCALE));
301
+ const [accentId, setAccentId] = useState(null);
302
+ const [darkMode, setDarkMode] = useState(true);
303
+ const [addTo, setAddTo] = useState([]);
304
+ const [git, setGit] = useState(true);
305
+ const [repo, setRepo] = useState(null);
306
+ const appItems = apps.map((app) => ({ value: app.id, label: app.label }));
307
+ const steps = activeSteps(template, apps.length > 0);
308
+ const stepNum = Math.max(1, steps.findIndex((st) => st.id === step) + 1);
309
+ const go = (next) => {
310
+ setHelp(false);
311
+ setStep(next);
224
312
  };
225
- // Bundle options
226
- const bundleOptions = [
227
- { label: 'Everything', value: 'everything', hint: `All ${SKILLS.length} skills · no restraint` },
228
- { label: 'Designer Essentials', value: 'designer', hint: `${BUNDLES.designer.skills.length} skills · UI, a11y, Figma` },
229
- { label: 'Workflow Only', value: 'workflow', hint: `${SKILLS.filter(s => s.group === 'workflow').length} skills · process only` },
230
- { label: 'Let Me Pick', value: 'custom', hint: 'Control freak? Respect.' },
231
- ];
232
- const handleBundleSelect = (item) => {
233
- const b = item.value;
234
- setBundle(b);
235
- if (b === 'custom') {
236
- setStep('skills-workflow');
313
+ const toggleHelp = () => setHelp((open) => !open);
314
+ useInput((ch, key) => {
315
+ if (key.escape) {
316
+ if (help)
317
+ setHelp(false);
318
+ else
319
+ exit();
237
320
  }
238
- else {
239
- // Set skills based on bundle
240
- if (b === 'everything') {
241
- setSelectedSkills(SKILLS.map(s => s.name));
242
- }
243
- else if (b === 'designer') {
244
- setSelectedSkills([...BUNDLES.designer.skills]);
245
- }
246
- else {
247
- setSelectedSkills(SKILLS.filter(s => s.group === 'workflow').map(s => s.name));
248
- }
249
- setStep('homepage');
321
+ else if (ch === '?' && !TEXT_STEPS.has(step)) {
322
+ toggleHelp();
250
323
  }
324
+ });
325
+ const setLocales = (codes, defaultLocale) => {
326
+ setLanguages(parseLocales([defaultLocale, ...codes].join(',')));
327
+ go('accent');
251
328
  };
252
- // Homepage options
253
- const homepageOptions = [
254
- { label: 'Yes', value: true, hint: '+6 files · delete it later' },
255
- { label: 'No', value: false, hint: 'Blank App.tsx · the void awaits' },
256
- ];
257
- // Git options
258
- const gitOptions = [
259
- { label: 'Yes', value: true, hint: 'Fresh repo · future you says thanks' },
260
- { label: 'No', value: false, hint: 'No .git · living dangerously' },
261
- ];
262
- // Render panels
263
- if (panel === 'help') {
264
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { showSpecs: false }), _jsx(HelpPanel, { onClose: () => setPanel(null) })] }));
265
- }
266
- if (panel === 'skills') {
267
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { showSpecs: false }), _jsx(SkillsPanel, { onClose: () => setPanel(null) })] }));
268
- }
269
- // Show full header with specs only on first screen
270
- const isFirstScreen = step === 'name';
271
- // Map step to number for progress bar
272
- const stepToNum = {
273
- 'name': 1,
274
- 'bundle': 2,
275
- 'skills-workflow': 2,
276
- 'skills-design': 2,
277
- 'homepage': 3,
278
- 'git': 4,
279
- 'done': 4,
280
- };
281
- const currentStep = stepToNum[step];
282
- const totalSteps = 4;
283
- // Render steps
284
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { showSpecs: isFirstScreen, step: isFirstScreen ? undefined : currentStep, totalSteps: isFirstScreen ? undefined : totalSteps }), step === 'name' && (_jsxs(Frame, { title: "PROJECT NAME", hint: "lowercase \u00B7 numbers \u00B7 dashes \u00B7 /help", children: [_jsx(Text, { children: "What are we calling this?" }), _jsx(Box, { marginTop: 1, children: _jsx(CommandInput, { value: input, onChange: setInput, onSubmit: handleNameSubmit, placeholder: "my-app", validate: validateName }) })] })), step === 'bundle' && (_jsxs(Frame, { title: "SKILL BUNDLE", children: [_jsx(Text, { children: "How much help do you want?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { items: bundleOptions.map(o => ({
285
- label: `${o.label} - ${o.hint}`,
286
- value: o.value
287
- })), onSelect: handleBundleSelect }) })] })), step === 'homepage' && (_jsxs(Frame, { title: "EXAMPLE HOMEPAGE", children: [_jsx(Text, { children: "Include the example homepage?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { items: homepageOptions.map(o => ({
288
- label: `${o.label} - ${o.hint}`,
289
- value: o.value
290
- })), onSelect: (item) => {
291
- setIncludeHomepage(item.value);
292
- setStep('git');
293
- } }) })] })), step === 'git' && (_jsxs(Frame, { title: "GIT INIT", children: [_jsx(Text, { children: "Initialize git?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { items: gitOptions.map(o => ({
294
- label: `${o.label} - ${o.hint}`,
295
- value: o.value
296
- })), onSelect: (item) => {
297
- setInitGit(item.value);
298
- // Complete!
299
- onComplete({
300
- projectName,
301
- bundle,
302
- selectedSkills,
303
- includeHomepage,
304
- initGit: item.value,
305
- });
306
- } }) })] })), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E" }), _jsx(Text, { dimColor: true, children: "\u2502 Type / for commands \u00B7 \u2191\u2193 navigate \u00B7 Enter confirm \u00B7 Esc quit \u2502" }), _jsx(Text, { dimColor: true, children: "\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F" })] })] }));
307
- }
308
- // Export the prompt runner
309
- export function runInkPrompts(defaultName) {
310
- return new Promise((resolve) => {
311
- const { unmount, waitUntilExit } = render(_jsx(WizardApp, { defaultName: defaultName, onComplete: (choices) => {
312
- unmount();
313
- resolve(choices);
314
- } }));
315
- waitUntilExit().then(() => {
316
- resolve(null);
329
+ const finish = (install) => {
330
+ onComplete({
331
+ template,
332
+ projectName,
333
+ siteName: siteName || prettifyName(projectName),
334
+ oneSentence,
335
+ siteUrl,
336
+ accentId: accentId ?? DEFAULT_ACCENT_ID,
337
+ ...languages,
338
+ apps: addTo,
339
+ darkMode,
340
+ git,
341
+ repo,
342
+ install,
317
343
  });
318
- });
319
- }
320
- // Init mode prompts (simpler)
321
- function InitApp({ onComplete }) {
322
- const { exit } = useApp();
323
- const [bundle, setBundle] = useState('everything');
324
- useInput((_, key) => {
325
- if (key.escape) {
326
- console.log('\n' + random(DREAD.cancel));
327
- exit();
328
- }
329
- });
330
- const bundleOptions = [
331
- { label: 'Everything', value: 'everything', hint: `All ${SKILLS.length} skills` },
332
- { label: 'Designer Essentials', value: 'designer', hint: `${BUNDLES.designer.skills.length} skills` },
333
- { label: 'Workflow Only', value: 'workflow', hint: `${SKILLS.filter(s => s.group === 'workflow').length} skills` },
334
- ];
335
- const handleSelect = (item) => {
336
- let skills;
337
- if (item.value === 'everything') {
338
- skills = SKILLS.map(s => s.name);
339
- }
340
- else if (item.value === 'designer') {
341
- skills = [...BUNDLES.designer.skills];
342
- }
343
- else {
344
- skills = SKILLS.filter(s => s.group === 'workflow').map(s => s.name);
345
- }
346
- onComplete({ selectedSkills: skills });
347
344
  };
348
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { showSpecs: true }), _jsxs(Frame, { title: "INIT MODE", hint: "Adding to existing project", children: [_jsx(Text, { children: "Which skills do you want?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { items: bundleOptions.map(o => ({
349
- label: `${o.label} - ${o.hint}`,
350
- value: o.value
351
- })), onSelect: handleSelect }) })] }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E" }), _jsx(Text, { dimColor: true, children: "\u2502 \u2191\u2193 navigate \u00B7 Enter confirm \u00B7 Esc quit \u2502" }), _jsx(Text, { dimColor: true, children: "\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F" })] })] }));
345
+ const hint = [
346
+ '↑↓ navigate',
347
+ ((step === 'languages' && !chosen) || step === 'apps') && 'Space toggle',
348
+ 'Enter confirm',
349
+ '? help',
350
+ help ? 'Esc close help' : 'Esc quit',
351
+ ]
352
+ .filter(Boolean)
353
+ .join(' · ');
354
+ return (_jsxs(Box, { flexDirection: "column", width: WIDTH, children: [_jsx(Header, { steps: step === 'template' ? undefined : steps, current: step === 'template' ? undefined : step }), step === 'template' && (_jsxs(Frame, { step: "template", number: stepNum, children: [_jsx(Text, { children: "What are you building?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { indicatorComponent: Indicator, itemComponent: TemplateItem, items: TEMPLATE_ITEMS, initialIndex: TEMPLATES.findIndex((t) => t.id === template), onSelect: (item) => {
355
+ setTemplate(item.value);
356
+ go('name');
357
+ } }) })] })), step === 'name' && (_jsxs(Frame, { step: "name", number: stepNum, children: [_jsx(Text, { children: "What do you want to call this?" }), _jsx(Box, { marginTop: 1, children: _jsx(CommandInput, { value: input, onChange: setInput, placeholder: "Oak & Iron", validate: (value) => (value.trim() ? undefined : 'Give it a name'), onHelp: input === '' ? toggleHelp : undefined, onSubmit: (value) => {
358
+ setSiteName(value.trim());
359
+ setInput(freeFolderName(value));
360
+ go('folder');
361
+ } }) })] })), step === 'folder' && (_jsxs(Frame, { step: "folder", number: stepNum, children: [_jsx(Text, { children: "Folder name?" }), _jsx(Box, { marginTop: 1, children: _jsx(CommandInput, { value: input, onChange: setInput, placeholder: "my-app", validate: validateProjectName, onHelp: toggleHelp, onSubmit: (value) => {
362
+ setProjectName(value);
363
+ setInput('');
364
+ go('line');
365
+ } }) })] })), step === 'line' && (_jsxs(Frame, { step: "line", number: stepNum, children: [_jsx(Text, { children: "One sentence on what this is?" }), _jsx(Box, { marginTop: 1, children: _jsx(CommandInput, { value: input, onChange: setInput, placeholder: "Optional. Enter to skip.", onHelp: input === '' ? toggleHelp : undefined, onSubmit: (value) => {
366
+ setOneSentence(value.trim());
367
+ setInput('');
368
+ go(template === 'astro' ? 'url' : 'accent');
369
+ } }) })] })), step === 'url' && (_jsxs(Frame, { step: "url", number: stepNum, children: [_jsx(Text, { children: "Canonical URL for SEO stubs?" }), _jsx(Box, { marginTop: 1, children: _jsx(CommandInput, { value: input, onChange: setInput, placeholder: DEFAULT_SITE_URL, onHelp: toggleHelp, validate: (value) => {
370
+ try {
371
+ normalizeUrl(value);
372
+ return undefined;
373
+ }
374
+ catch (e) {
375
+ return e instanceof Error ? e.message : 'Invalid URL';
376
+ }
377
+ }, onSubmit: (value) => {
378
+ setSiteUrl(normalizeUrl(value));
379
+ setInput('');
380
+ go('languages');
381
+ } }) })] })), step === 'languages' && !chosen && (_jsxs(Frame, { step: "languages", number: stepNum, children: [_jsx(Text, { children: "Languages for the site? Enter keeps English only." }), _jsx(Box, { marginTop: 1, children: _jsx(Picker, { items: LANGUAGE_ITEMS, initial: [DEFAULT_LOCALE], required: "Pick at least one language.", onSubmit: (codes) => (codes.length === 1 ? setLocales(codes, codes[0]) : setChosen(codes)) }) })] })), step === 'languages' && chosen && (_jsxs(Frame, { step: "languages", number: stepNum, children: [_jsx(Text, { children: "Default language, served at / ?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { indicatorComponent: Indicator, itemComponent: Item, items: chosen.map((code) => ({
382
+ label: languageLabel(LANGUAGES.find((l) => l.code === code)),
383
+ value: code,
384
+ })), onSelect: (item) => setLocales(chosen, item.value) }) })] })), step === 'accent' && !accentId && (_jsxs(Frame, { step: "accent", number: stepNum, children: [_jsx(Text, { children: "Dominant accent for tokens (--color-accent)?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { indicatorComponent: Indicator, items: ACCENT_ITEMS, itemComponent: AccentItem, initialIndex: ACCENT_PALETTE.findIndex((a) => a.id === DEFAULT_ACCENT_ID), onSelect: (item) => setAccentId(item.value) }) })] })), step === 'accent' && accentId && (_jsxs(Frame, { step: "accent", number: stepNum, children: [_jsx(Text, { children: "Dark mode too, following each visitor's system setting?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { indicatorComponent: Indicator, itemComponent: Item, items: YES_NO, onSelect: (item) => {
385
+ setDarkMode(item.value);
386
+ go(apps.length ? 'apps' : 'git');
387
+ } }) })] })), step === 'apps' && (_jsxs(Frame, { step: "apps", number: stepNum, children: [_jsx(Text, { children: "Add the project to these agent apps?" }), _jsx(Box, { marginTop: 1, children: _jsx(Picker, { items: appItems, initial: appItems.map((item) => item.value), onSubmit: (ids) => {
388
+ setAddTo(ids);
389
+ go('git');
390
+ } }) })] })), step === 'git' && (_jsxs(Frame, { step: "git", number: stepNum, children: [_jsx(Text, { children: "Git for the new project?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { indicatorComponent: Indicator, itemComponent: Item, items: github ? [...GITHUB_ITEMS, ...LOCAL_ITEMS] : LOCAL_ITEMS, onSelect: (item) => {
391
+ setGit(item.value !== 'none');
392
+ setRepo(item.value === 'private' || item.value === 'public' ? item.value : null);
393
+ go('install');
394
+ } }) })] })), step === 'install' && (_jsxs(Frame, { step: "install", number: stepNum, children: [_jsx(Text, { children: "Install dependencies now?" }), _jsx(Box, { marginTop: 1, children: _jsx(SelectInput, { indicatorComponent: Indicator, itemComponent: Item, items: YES_NO, onSelect: (item) => finish(item.value) }) })] })), help && _jsx(HelpPanel, { step: step }), _jsx(HintBar, { text: hint })] }));
352
395
  }
353
- export function runInkInitPrompts() {
396
+ export function runInkPrompts(defaultName, defaultTemplate, apps = [], github = false) {
354
397
  return new Promise((resolve) => {
355
- const { unmount, waitUntilExit } = render(_jsx(InitApp, { onComplete: (choices) => {
398
+ const { unmount, waitUntilExit } = render(_jsx(WizardApp, { defaultName: defaultName, defaultTemplate: defaultTemplate, apps: apps, github: github, onComplete: (choices) => {
356
399
  unmount();
357
400
  resolve(choices);
358
401
  } }));
359
- waitUntilExit().then(() => {
360
- resolve(null);
361
- });
402
+ waitUntilExit().then(() => resolve(null));
362
403
  });
363
404
  }