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.
- package/README.md +43 -178
- package/bin/cli.js +186 -1
- package/dist/answers.d.ts +269 -0
- package/dist/answers.js +215 -0
- package/dist/ink-prompts.d.ts +90 -12
- package/dist/ink-prompts.js +371 -330
- package/dist/lettering.d.ts +2 -0
- package/dist/lettering.js +28 -0
- package/lib/apps.mjs +141 -0
- package/lib/github.mjs +24 -0
- package/lib/init.mjs +153 -0
- package/lib/ports.mjs +56 -0
- package/lib/scaffold.mjs +218 -0
- package/lib/upgrade.mjs +164 -0
- package/package.json +39 -33
- package/templates/astro/.editorconfig +15 -0
- package/templates/astro/.env.example +2 -0
- package/templates/astro/.github/workflows/ci.yml +37 -0
- package/templates/astro/.github/workflows/deploy.yml +46 -0
- package/templates/astro/.nvmrc +1 -0
- package/templates/astro/.prettierignore +10 -0
- package/templates/astro/.prettierrc.json +7 -0
- package/templates/astro/.vscode/extensions.json +3 -0
- package/templates/astro/.vscode/settings.json +12 -0
- package/templates/astro/AGENTS.md +100 -0
- package/templates/astro/README.md +42 -0
- package/templates/astro/_CLAUDE.md +1 -0
- package/templates/astro/_claude/launch.json +13 -0
- package/templates/astro/_claude/settings.json +22 -0
- package/templates/astro/_codex/environments/environment.toml +20 -0
- package/templates/astro/_gitignore +31 -0
- package/templates/astro/_npmrc +8 -0
- package/templates/astro/_super.engineering/config.json +8 -0
- package/templates/astro/_zed/tasks.json +5 -0
- package/templates/astro/astro.config.mjs +111 -0
- package/templates/astro/docs/README.md +7 -0
- package/templates/astro/docs/decisions.md +3 -0
- package/templates/astro/docs/inbox.md +7 -0
- package/templates/astro/docs/kit/agent-apps.md +15 -0
- package/templates/astro/docs/kit/analytics.md +13 -0
- package/templates/astro/docs/kit/deploy.md +9 -0
- package/templates/astro/docs/kit/images.md +10 -0
- package/templates/astro/docs/kit/languages.md +8 -0
- package/templates/astro/docs/kit/local.md +16 -0
- package/templates/astro/docs/kit/seo.md +15 -0
- package/templates/astro/docs/kit/structure.md +40 -0
- package/templates/astro/docs/kit/upgrade.md +19 -0
- package/templates/astro/functions/_middleware.js +25 -0
- package/templates/astro/intent.md +40 -0
- package/templates/astro/package.json +46 -0
- package/templates/astro/public/_headers +17 -0
- package/templates/astro/public/_routes.json +5 -0
- package/templates/astro/public/apple-touch-icon.png +0 -0
- package/templates/astro/public/favicon-16.png +0 -0
- package/templates/astro/public/favicon-32.png +0 -0
- package/templates/astro/public/favicon.ico +0 -0
- package/templates/astro/public/favicon.svg +4 -0
- package/templates/astro/public/icon-192.png +0 -0
- package/templates/astro/public/icon-512.png +0 -0
- package/templates/astro/public/og-image.png +0 -0
- package/templates/astro/scripts/chrome.mjs +138 -0
- package/templates/astro/scripts/deploy.sh +69 -0
- package/templates/astro/scripts/generate-icons.mjs +73 -0
- package/templates/astro/scripts/generate-og.mjs +66 -0
- package/templates/astro/scripts/lint-copy.mjs +67 -0
- package/templates/astro/scripts/local-domain.mjs +115 -0
- package/templates/astro/scripts/markdown-pages.mjs +142 -0
- package/templates/astro/scripts/og-template.html +73 -0
- package/templates/astro/scripts/shared.mjs +33 -0
- package/templates/astro/scripts/verify-build.mjs +283 -0
- package/templates/astro/scripts/verify.mjs +19 -0
- package/templates/astro/site.config.mjs +85 -0
- package/templates/astro/src/components/Analytics.astro +49 -0
- package/templates/astro/src/components/Consent.astro +52 -0
- package/templates/astro/src/components/Counter.tsx +20 -0
- package/templates/astro/src/data/README.md +18 -0
- package/templates/astro/src/dev/styleguide.astro +43 -0
- package/templates/astro/src/env.d.ts +1 -0
- package/templates/astro/src/i18n/ar.json +29 -0
- package/templates/astro/src/i18n/de.json +29 -0
- package/templates/astro/src/i18n/en.json +29 -0
- package/templates/astro/src/i18n/es.json +29 -0
- package/templates/astro/src/i18n/fr.json +29 -0
- package/templates/astro/src/i18n/he.json +29 -0
- package/templates/astro/src/i18n/hi.json +29 -0
- package/templates/astro/src/i18n/index.ts +80 -0
- package/templates/astro/src/i18n/it.json +29 -0
- package/templates/astro/src/i18n/ja.json +29 -0
- package/templates/astro/src/i18n/ko.json +29 -0
- package/templates/astro/src/i18n/nl.json +29 -0
- package/templates/astro/src/i18n/pl.json +29 -0
- package/templates/astro/src/i18n/pt-br.json +29 -0
- package/templates/astro/src/i18n/ro.json +29 -0
- package/templates/astro/src/i18n/ru.json +29 -0
- package/templates/astro/src/i18n/sv.json +29 -0
- package/templates/astro/src/i18n/tr.json +29 -0
- package/templates/astro/src/i18n/uk.json +29 -0
- package/templates/astro/src/i18n/zh-cn.json +29 -0
- package/templates/astro/src/layouts/BaseLayout.astro +205 -0
- package/templates/astro/src/lib/cn.ts +7 -0
- package/templates/astro/src/lib/consent.ts +32 -0
- package/templates/astro/src/lib/seo.ts +18 -0
- package/templates/astro/src/lib/theme.ts +5 -0
- package/templates/astro/src/pages/404.astro +7 -0
- package/templates/astro/src/pages/[...locale]/404.astro +25 -0
- package/templates/astro/src/pages/[...locale]/about.astro +25 -0
- package/templates/astro/src/pages/[...locale]/index.astro +30 -0
- package/templates/astro/src/pages/[...locale]/privacy.astro +28 -0
- package/templates/astro/src/pages/robots.txt.ts +16 -0
- package/templates/astro/src/pages/site.webmanifest.ts +26 -0
- package/templates/astro/src/styles/global.css +163 -0
- package/templates/astro/t3.json +22 -0
- package/templates/astro/tsconfig.json +13 -0
- package/templates/astro/wrangler.toml +8 -0
- package/templates/react/.editorconfig +15 -0
- package/templates/react/.env.example +2 -0
- package/templates/react/.nvmrc +1 -0
- package/templates/react/.prettierignore +11 -0
- package/templates/react/.prettierrc.json +5 -0
- package/templates/react/.vscode/extensions.json +3 -0
- package/templates/react/.vscode/settings.json +4 -0
- package/templates/react/AGENTS.md +64 -0
- package/templates/react/README.md +31 -0
- package/templates/react/_CLAUDE.md +1 -0
- package/templates/react/_claude/launch.json +13 -0
- package/templates/react/_claude/settings.json +21 -0
- package/templates/react/_codex/environments/environment.toml +20 -0
- package/templates/react/_gitignore +17 -0
- package/templates/react/_npmrc +8 -0
- package/templates/react/_super.engineering/config.json +8 -0
- package/templates/react/_zed/tasks.json +5 -0
- package/templates/react/docs/decisions.md +3 -0
- package/templates/react/docs/inbox.md +7 -0
- package/templates/react/index.html +14 -0
- package/templates/react/package.json +47 -0
- package/templates/react/public/favicon.svg +5 -0
- package/templates/react/scripts/lint-copy.mjs +46 -0
- package/templates/react/scripts/lint-tokens.mjs +44 -0
- package/templates/react/scripts/local-domain.mjs +115 -0
- package/templates/react/scripts/verify.mjs +20 -0
- package/templates/react/site.config.mjs +23 -0
- package/templates/react/src/App.test.tsx +15 -0
- package/templates/react/src/App.tsx +21 -0
- package/templates/react/src/components/ErrorBoundary.tsx +42 -0
- package/templates/react/src/components/SkipLink.tsx +10 -0
- package/templates/react/src/config/site.ts +5 -0
- package/templates/react/src/lib/cn.ts +7 -0
- package/templates/react/src/main.tsx +13 -0
- package/templates/react/src/pages/HomePage.tsx +71 -0
- package/templates/react/src/pages/NotFoundPage.tsx +21 -0
- package/templates/react/src/styles/global.css +96 -0
- package/templates/react/src/test-setup.ts +1 -0
- package/templates/react/t3.json +22 -0
- package/templates/{base → react}/tsconfig.json +3 -3
- package/templates/react/vite.config.ts +26 -0
- package/templates/shared/_claude/hooks/design-lint.mjs +67 -0
- package/templates/shared/_claude/skills/design-quality/SKILL.md +113 -0
- package/templates/shared/_claude/skills/design-quality/references/composition-palette.md +87 -0
- package/templates/shared/_claude/skills/design-quality/references/copy-tells.md +49 -0
- package/templates/shared/_claude/skills/design-quality/references/visual-critic.md +75 -0
- package/templates/shared/design.md +148 -0
- package/templates/shared/intent.md +28 -0
- package/dist/constants.d.ts +0 -71
- package/dist/constants.js +0 -128
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -229
- package/dist/prompts.d.ts +0 -16
- package/dist/prompts.js +0 -434
- package/dist/scaffold.d.ts +0 -19
- package/dist/scaffold.js +0 -303
- package/dist/ui.d.ts +0 -27
- package/dist/ui.js +0 -254
- package/templates/app/App.tsx +0 -21
- package/templates/base/CLAUDE.md +0 -332
- package/templates/base/eslint.config.js +0 -28
- package/templates/base/index.html +0 -17
- package/templates/base/package.json +0 -43
- package/templates/base/postcss.config.js +0 -6
- package/templates/base/tailwind.config.js +0 -81
- package/templates/base/vite.config.ts +0 -16
- package/templates/commands/brainstorm.md +0 -6
- package/templates/commands/build.md +0 -41
- package/templates/commands/execute-plan.md +0 -6
- package/templates/commands/lint.md +0 -41
- package/templates/commands/ralph.md +0 -113
- package/templates/commands/typecheck.md +0 -44
- package/templates/commands/write-plan.md +0 -6
- package/templates/components/ErrorBoundary.tsx +0 -49
- package/templates/components/ui/Button.tsx +0 -60
- package/templates/components/ui/CodeBlock.tsx +0 -46
- package/templates/components/ui/CopyCommand.tsx +0 -38
- package/templates/components/ui/FilePreview.tsx +0 -46
- package/templates/components/ui/SkipLink.tsx +0 -7
- package/templates/components/ui/ThemeSelector.tsx +0 -41
- package/templates/components/ui/UICarousel.tsx +0 -309
- package/templates/context/ThemeContext.tsx +0 -61
- package/templates/homepage/HomePage.tsx +0 -534
- package/templates/homepage/NotFoundPage.tsx +0 -17
- package/templates/hooks/README.md +0 -82
- package/templates/hooks/check-branch.js +0 -27
- package/templates/hooks/typecheck-after-edit.js +0 -51
- package/templates/index.css +0 -67
- package/templates/lib/utils.ts +0 -9
- package/templates/main.tsx +0 -16
- package/templates/settings/MCP_SETUP.md +0 -76
- package/templates/settings/settings.json +0 -16
- package/templates/settings/settings.local.json +0 -37
- package/templates/skills/design/a11y-audit/SKILL.md +0 -173
- package/templates/skills/design/design-polish/SKILL.md +0 -75
- package/templates/skills/design/figma-to-code/SKILL.md +0 -157
- package/templates/skills/design/json-ld/SKILL.md +0 -125
- package/templates/skills/design/microcopy/SKILL.md +0 -197
- package/templates/skills/design/og-image/SKILL.md +0 -157
- package/templates/skills/design/ralph-wiggum-loops/SKILL.md +0 -299
- package/templates/skills/design/react-best-practices/SKILL.md +0 -106
- package/templates/skills/design/react-best-practices/references/react-performance-guidelines.md +0 -143
- package/templates/skills/design/seo-review/SKILL.md +0 -96
- package/templates/skills/design/sitemap-generator/SKILL.md +0 -66
- package/templates/skills/design/testing-patterns/SKILL.md +0 -276
- package/templates/skills/design/ui-skills/SKILL.md +0 -85
- package/templates/skills/design/visual-iteration/SKILL.md +0 -88
- package/templates/skills/workflow/brainstorming/SKILL.md +0 -54
- package/templates/skills/workflow/dispatching-parallel-agents/SKILL.md +0 -180
- package/templates/skills/workflow/executing-plans/SKILL.md +0 -76
- package/templates/skills/workflow/finishing-a-development-branch/SKILL.md +0 -200
- package/templates/skills/workflow/receiving-code-review/SKILL.md +0 -213
- package/templates/skills/workflow/requesting-code-review/SKILL.md +0 -105
- package/templates/skills/workflow/requesting-code-review/code-reviewer.md +0 -146
- package/templates/skills/workflow/subagent-driven-development/SKILL.md +0 -240
- package/templates/skills/workflow/subagent-driven-development/code-quality-reviewer-prompt.md +0 -20
- package/templates/skills/workflow/subagent-driven-development/implementer-prompt.md +0 -78
- package/templates/skills/workflow/subagent-driven-development/spec-reviewer-prompt.md +0 -61
- package/templates/skills/workflow/systematic-debugging/CREATION-LOG.md +0 -119
- package/templates/skills/workflow/systematic-debugging/SKILL.md +0 -296
- package/templates/skills/workflow/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/templates/skills/workflow/systematic-debugging/condition-based-waiting.md +0 -115
- package/templates/skills/workflow/systematic-debugging/defense-in-depth.md +0 -122
- package/templates/skills/workflow/systematic-debugging/find-polluter.sh +0 -63
- package/templates/skills/workflow/systematic-debugging/root-cause-tracing.md +0 -169
- package/templates/skills/workflow/systematic-debugging/test-academic.md +0 -14
- package/templates/skills/workflow/systematic-debugging/test-pressure-1.md +0 -58
- package/templates/skills/workflow/systematic-debugging/test-pressure-2.md +0 -68
- package/templates/skills/workflow/systematic-debugging/test-pressure-3.md +0 -69
- package/templates/skills/workflow/test-driven-development/SKILL.md +0 -371
- package/templates/skills/workflow/test-driven-development/testing-anti-patterns.md +0 -299
- package/templates/skills/workflow/using-git-worktrees/SKILL.md +0 -217
- package/templates/skills/workflow/using-superpowers/SKILL.md +0 -87
- package/templates/skills/workflow/verification-before-completion/SKILL.md +0 -139
- package/templates/skills/workflow/writing-plans/SKILL.md +0 -116
- package/templates/skills/workflow/writing-skills/SKILL.md +0 -655
- package/templates/skills/workflow/writing-skills/anthropic-best-practices.md +0 -1150
- package/templates/skills/workflow/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/templates/skills/workflow/writing-skills/graphviz-conventions.dot +0 -172
- package/templates/skills/workflow/writing-skills/persuasion-principles.md +0 -187
- package/templates/skills/workflow/writing-skills/render-graphs.js +0 -168
- package/templates/skills/workflow/writing-skills/testing-skills-with-subagents.md +0 -384
- package/templates/types/index.ts +0 -17
- /package/templates/{vite-env.d.ts → react/src/vite-env.d.ts} +0 -0
package/dist/ink-prompts.js
CHANGED
|
@@ -1,363 +1,404 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
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
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
107
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
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 [
|
|
173
|
-
const [
|
|
174
|
-
const [
|
|
175
|
-
|
|
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 [
|
|
178
|
-
const [
|
|
179
|
-
const [
|
|
180
|
-
const [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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
|
-
|
|
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
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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
|
|
396
|
+
export function runInkPrompts(defaultName, defaultTemplate, apps = [], github = false) {
|
|
354
397
|
return new Promise((resolve) => {
|
|
355
|
-
const { unmount, waitUntilExit } = render(_jsx(
|
|
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
|
}
|