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/index.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import pc from 'picocolors';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { renderHeader, renderManifest, renderMiniHeader, renderProgress, renderProgressFooter, renderComplete, renderError, renderInitComplete, } from './ui.js';
|
|
5
|
-
import { runInkPrompts, runInkInitPrompts } from './ink-prompts.js';
|
|
6
|
-
import { scaffold, initExisting } from './scaffold.js';
|
|
7
|
-
import { ERRORS, DEFAULT_THEME, DEFAULT_PORT, ASSETS, SKILLS, VERSION } from './constants.js';
|
|
8
|
-
async function main() {
|
|
9
|
-
// Parse args
|
|
10
|
-
const args = process.argv.slice(2);
|
|
11
|
-
const projectName = args.find((a) => !a.startsWith('-'));
|
|
12
|
-
const skipPrompts = args.includes('--yes') || args.includes('-y');
|
|
13
|
-
const noGit = args.includes('--no-git');
|
|
14
|
-
const noInstall = args.includes('--no-install');
|
|
15
|
-
const showHelp = args.includes('--help') || args.includes('-h') || args.includes('/help');
|
|
16
|
-
const showVersion = args.includes('--version') || args.includes('-v') || args.includes('/version');
|
|
17
|
-
const initMode = args.includes('--init') || args.includes('-i') || args.includes('/init');
|
|
18
|
-
if (showVersion) {
|
|
19
|
-
console.log(VERSION);
|
|
20
|
-
process.exit(0);
|
|
21
|
-
}
|
|
22
|
-
if (showHelp) {
|
|
23
|
-
console.log(`
|
|
24
|
-
${pc.bold('create-claudecraft')} - Designer-first boilerplate for Claude Code
|
|
25
|
-
|
|
26
|
-
${pc.bold('Usage:')}
|
|
27
|
-
bun create claudecraft [project-name] [options]
|
|
28
|
-
|
|
29
|
-
${pc.bold('Options:')}
|
|
30
|
-
--yes, -y Skip prompts, use defaults
|
|
31
|
-
--init, -i Add skills to existing project (no scaffold)
|
|
32
|
-
--no-git Skip git initialization
|
|
33
|
-
--no-install Skip dependency installation
|
|
34
|
-
--help, -h Show this help
|
|
35
|
-
--version, -v Show version
|
|
36
|
-
|
|
37
|
-
${pc.bold('Slash Commands:')}
|
|
38
|
-
/help Same as --help
|
|
39
|
-
/init Same as --init
|
|
40
|
-
/version Same as --version
|
|
41
|
-
|
|
42
|
-
${pc.bold('Examples:')}
|
|
43
|
-
${pc.dim('# New project')}
|
|
44
|
-
bun create claudecraft my-app
|
|
45
|
-
bun create claudecraft my-app --yes
|
|
46
|
-
|
|
47
|
-
${pc.dim('# Existing project (run from project root)')}
|
|
48
|
-
bunx create-claudecraft --init
|
|
49
|
-
bunx create-claudecraft --init --yes
|
|
50
|
-
|
|
51
|
-
${pc.bold('Figma Integration:')}
|
|
52
|
-
After setup, connect Figma MCP:
|
|
53
|
-
claude mcp add --transport http figma https://mcp.figma.com/mcp
|
|
54
|
-
`);
|
|
55
|
-
process.exit(0);
|
|
56
|
-
}
|
|
57
|
-
// Init mode: add to existing project
|
|
58
|
-
if (initMode) {
|
|
59
|
-
await runInitMode(skipPrompts);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
// Get user choices
|
|
63
|
-
let choices;
|
|
64
|
-
if (skipPrompts) {
|
|
65
|
-
// Show header only for non-interactive mode
|
|
66
|
-
console.clear();
|
|
67
|
-
console.log(renderHeader());
|
|
68
|
-
console.log(renderManifest());
|
|
69
|
-
choices = {
|
|
70
|
-
projectName: projectName || 'claudecraft-app',
|
|
71
|
-
bundle: 'everything',
|
|
72
|
-
selectedSkills: SKILLS.map((s) => s.name),
|
|
73
|
-
includeHomepage: true,
|
|
74
|
-
initGit: !noGit,
|
|
75
|
-
};
|
|
76
|
-
console.log(pc.dim(` Using defaults: ${choices.projectName}, all skills, homepage, git init`));
|
|
77
|
-
console.log('');
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
const result = await runInkPrompts(projectName);
|
|
81
|
-
if (!result)
|
|
82
|
-
process.exit(0);
|
|
83
|
-
choices = result;
|
|
84
|
-
}
|
|
85
|
-
// Override git if --no-git flag
|
|
86
|
-
if (noGit)
|
|
87
|
-
choices.initGit = false;
|
|
88
|
-
// Progress state
|
|
89
|
-
const progressState = {
|
|
90
|
-
scaffolding: { name: 'scaffolding', progress: 0, status: 'queued', detail: '' },
|
|
91
|
-
dependencies: { name: 'dependencies', progress: 0, status: 'queued', detail: '' },
|
|
92
|
-
'git init': { name: 'git init', progress: 0, status: 'queued', detail: '' },
|
|
93
|
-
};
|
|
94
|
-
let startTime = Date.now();
|
|
95
|
-
const updateProgress = (task, progress, detail) => {
|
|
96
|
-
progressState[task] = {
|
|
97
|
-
name: task,
|
|
98
|
-
progress,
|
|
99
|
-
status: progress >= 100 ? 'done' : 'active',
|
|
100
|
-
time: progress >= 100 ? `${((Date.now() - startTime) / 1000).toFixed(1)}s` : undefined,
|
|
101
|
-
detail: detail || '',
|
|
102
|
-
};
|
|
103
|
-
// Mark previous tasks as done
|
|
104
|
-
const tasks = Object.keys(progressState);
|
|
105
|
-
const currentIndex = tasks.indexOf(task);
|
|
106
|
-
for (let i = 0; i < currentIndex; i++) {
|
|
107
|
-
if (progressState[tasks[i]].status !== 'done') {
|
|
108
|
-
progressState[tasks[i]].status = 'done';
|
|
109
|
-
progressState[tasks[i]].progress = 100;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Re-render progress
|
|
113
|
-
console.clear();
|
|
114
|
-
console.log(renderMiniHeader());
|
|
115
|
-
console.log('');
|
|
116
|
-
console.log(renderProgress([
|
|
117
|
-
progressState['scaffolding'],
|
|
118
|
-
progressState['dependencies'],
|
|
119
|
-
progressState['git init'],
|
|
120
|
-
]));
|
|
121
|
-
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
122
|
-
console.log(renderProgressFooter(`${elapsed}s`, ''));
|
|
123
|
-
};
|
|
124
|
-
try {
|
|
125
|
-
startTime = Date.now();
|
|
126
|
-
const result = await scaffold(choices, updateProgress);
|
|
127
|
-
// Final output
|
|
128
|
-
console.clear();
|
|
129
|
-
console.log(renderMiniHeader());
|
|
130
|
-
console.log(renderComplete(choices.projectName, {
|
|
131
|
-
files: result.files,
|
|
132
|
-
skills: result.skills,
|
|
133
|
-
commands: result.commands,
|
|
134
|
-
themes: ASSETS.themes,
|
|
135
|
-
time: result.time,
|
|
136
|
-
deps: result.deps,
|
|
137
|
-
disk: result.disk,
|
|
138
|
-
theme: DEFAULT_THEME,
|
|
139
|
-
port: DEFAULT_PORT,
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
catch (err) {
|
|
143
|
-
const error = err;
|
|
144
|
-
if (error.message.startsWith('DIR_EXISTS:')) {
|
|
145
|
-
const name = error.message.split(':')[1];
|
|
146
|
-
const { title, body } = ERRORS.dirExists(name);
|
|
147
|
-
console.log(renderError(title, body));
|
|
148
|
-
}
|
|
149
|
-
else if (error.message === 'INSTALL_FAILED') {
|
|
150
|
-
const { title, body } = ERRORS.network();
|
|
151
|
-
console.log(renderError(title, body));
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
console.log(renderError('Unexpected error', error.message));
|
|
155
|
-
}
|
|
156
|
-
process.exit(1);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async function runInitMode(skipPrompts) {
|
|
160
|
-
// Check if we're in a project directory
|
|
161
|
-
const cwd = process.cwd();
|
|
162
|
-
const pkgPath = path.join(cwd, 'package.json');
|
|
163
|
-
if (!fs.existsSync(pkgPath)) {
|
|
164
|
-
const { title, body } = ERRORS.noProject();
|
|
165
|
-
console.log(renderError(title, body));
|
|
166
|
-
process.exit(1);
|
|
167
|
-
}
|
|
168
|
-
// Check if .claude already exists
|
|
169
|
-
const claudeDir = path.join(cwd, '.claude');
|
|
170
|
-
const alreadyInit = fs.existsSync(claudeDir);
|
|
171
|
-
// Show warning if .claude already exists (for --yes mode)
|
|
172
|
-
if (alreadyInit && skipPrompts) {
|
|
173
|
-
console.log(pc.yellow(' ⚠ .claude/ exists - will merge, not overwrite'));
|
|
174
|
-
}
|
|
175
|
-
// Get choices
|
|
176
|
-
let choices;
|
|
177
|
-
if (skipPrompts) {
|
|
178
|
-
choices = {
|
|
179
|
-
selectedSkills: SKILLS.map((s) => s.name),
|
|
180
|
-
};
|
|
181
|
-
console.log(pc.dim(` Using defaults: all ${SKILLS.length} skills`));
|
|
182
|
-
console.log('');
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
const result = await runInkInitPrompts();
|
|
186
|
-
if (!result)
|
|
187
|
-
process.exit(0);
|
|
188
|
-
choices = result;
|
|
189
|
-
}
|
|
190
|
-
// Progress state (simpler for init)
|
|
191
|
-
const progressState = {
|
|
192
|
-
scaffolding: { name: 'scaffolding', progress: 0, status: 'queued', detail: '' },
|
|
193
|
-
};
|
|
194
|
-
let startTime = Date.now();
|
|
195
|
-
const updateProgress = (task, progress, detail) => {
|
|
196
|
-
progressState[task] = {
|
|
197
|
-
name: task,
|
|
198
|
-
progress,
|
|
199
|
-
status: progress >= 100 ? 'done' : 'active',
|
|
200
|
-
time: progress >= 100 ? `${((Date.now() - startTime) / 1000).toFixed(1)}s` : undefined,
|
|
201
|
-
detail: detail || '',
|
|
202
|
-
};
|
|
203
|
-
console.clear();
|
|
204
|
-
console.log(renderMiniHeader());
|
|
205
|
-
console.log('');
|
|
206
|
-
console.log(renderProgress([progressState['scaffolding']]));
|
|
207
|
-
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
208
|
-
console.log(renderProgressFooter(`${elapsed}s`, ''));
|
|
209
|
-
};
|
|
210
|
-
try {
|
|
211
|
-
startTime = Date.now();
|
|
212
|
-
const result = await initExisting(choices, updateProgress);
|
|
213
|
-
// Final output
|
|
214
|
-
console.clear();
|
|
215
|
-
console.log(renderMiniHeader());
|
|
216
|
-
console.log(renderInitComplete({
|
|
217
|
-
files: result.files,
|
|
218
|
-
skills: result.skills,
|
|
219
|
-
commands: result.commands,
|
|
220
|
-
time: result.time,
|
|
221
|
-
}));
|
|
222
|
-
}
|
|
223
|
-
catch (err) {
|
|
224
|
-
const error = err;
|
|
225
|
-
console.log(renderError('Init failed', error.message));
|
|
226
|
-
process.exit(1);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
main().catch(console.error);
|
package/dist/prompts.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface UserChoices {
|
|
2
|
-
projectName: string;
|
|
3
|
-
bundle: 'everything' | 'designer' | 'workflow' | 'custom';
|
|
4
|
-
selectedSkills: string[];
|
|
5
|
-
includeHomepage: boolean;
|
|
6
|
-
initGit: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface InitChoices {
|
|
9
|
-
selectedSkills: string[];
|
|
10
|
-
}
|
|
11
|
-
export declare function runPrompts(defaultName?: string): Promise<UserChoices | null>;
|
|
12
|
-
/**
|
|
13
|
-
* Prompts for --init mode (existing project)
|
|
14
|
-
* Only asks about skills selection
|
|
15
|
-
*/
|
|
16
|
-
export declare function runInitPrompts(): Promise<InitChoices | null>;
|