procedure-cli 0.1.11 → 0.1.13
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/.claude/settings.local.json +2 -1
- package/AGENTS.md +82 -61
- package/CODE-FIXED.md +81 -0
- package/CODE-REVIEW.md +172 -0
- package/README.md +105 -69
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/steps/build-test.js +32 -3
- package/dist/steps/build-test.js.map +1 -1
- package/dist/steps/powerline.js +11 -3
- package/dist/steps/powerline.js.map +1 -1
- package/dist/steps/product-context.js +54 -19
- package/dist/steps/product-context.js.map +1 -1
- package/dist/steps/project-info.js +30 -3
- package/dist/steps/project-info.js.map +1 -1
- package/docs/PRD.md +55 -44
- package/docs/USER-STORIES.md +241 -98
- package/package.json +1 -1
- package/src/cli.tsx +13 -0
- package/src/steps/build-test.tsx +41 -6
- package/src/steps/powerline.tsx +17 -1
- package/src/steps/product-context.tsx +100 -39
- package/src/steps/project-info.tsx +57 -10
package/README.md
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
# Procedure CLI
|
|
2
2
|
|
|
3
|
-
Interactive CLI wizard that scaffolds projects with
|
|
3
|
+
Interactive CLI wizard that scaffolds new projects with a battle-tested `CLAUDE.md`, PRD, user stories, and optional tooling setup. Inspired by [Skills.sh](https://skills.sh) visual style.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Getting Started
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
mkdir my-project && cd my-project
|
|
9
|
+
npx @b3awesome/procedure
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If the directory already has files, the CLI prints a warning and continues. Existing files that would be overwritten are listed explicitly in Step 6 (Generation) before you confirm.
|
|
13
|
+
|
|
14
|
+
## What It Generates
|
|
8
15
|
|
|
9
16
|
| File | Purpose |
|
|
10
17
|
|------|---------|
|
|
11
|
-
| `CLAUDE.md` | AI-ready development guide with architecture, code style, workflow |
|
|
18
|
+
| `CLAUDE.md` | AI-ready development guide with architecture, code style, and workflow |
|
|
12
19
|
| `README.md` | Project overview with quick start, tech stack, and docs links |
|
|
13
|
-
| `docs/PRD.md` | Product Requirements Document with vision, features, tech stack |
|
|
20
|
+
| `docs/PRD.md` | Product Requirements Document with vision, features, and tech stack |
|
|
14
21
|
| `docs/USER-STORIES.md` | Gherkin-formatted acceptance criteria and user stories |
|
|
15
22
|
| `.env.example` | Environment variables template |
|
|
16
|
-
| `.gitignore` |
|
|
17
|
-
|
|
18
|
-
## Quick Start
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npx procedure-cli
|
|
22
|
-
```
|
|
23
|
+
| `.gitignore` | Language/framework-appropriate git ignore defaults |
|
|
23
24
|
|
|
24
25
|
## Visual Style
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
Catppuccin Mocha color theme with a Skills.sh-inspired vertical timeline:
|
|
27
28
|
|
|
28
29
|
```
|
|
29
30
|
█▀█ █▀█ █▀█ █▀▀ █▀▀ █▀▄ █ █ █▀█ █▀▀
|
|
@@ -32,96 +33,131 @@ Procedure CLI uses a Skills.sh / @clack/prompts-inspired vertical timeline UI:
|
|
|
32
33
|
Bootstrap any project with a battle-tested
|
|
33
34
|
CLAUDE.md, PRD, user stories, and powerline.
|
|
34
35
|
───────────────────────────────────────────
|
|
35
|
-
|
|
36
|
-
│
|
|
36
|
+
┌
|
|
37
|
+
│ ◇ Project Info
|
|
38
|
+
│ my-app — A task management tool
|
|
37
39
|
│
|
|
38
|
-
◆ Stack & Style
|
|
39
|
-
│ ❯
|
|
40
|
-
│
|
|
40
|
+
│ ◆ Stack & Style ← animated dot while active
|
|
41
|
+
│ ❯ TypeScript + Node.js — CLI tools, backend APIs, npm packages
|
|
42
|
+
│ Next.js Full-Stack — SaaS apps, marketing sites, SSR/SSG
|
|
43
|
+
│ React SPA — Dashboards, admin panels, SPAs
|
|
44
|
+
│ ↓ more
|
|
45
|
+
│ ↑↓ move, enter select
|
|
41
46
|
│
|
|
42
|
-
○ Build & Test
|
|
47
|
+
│ ○ Build & Test
|
|
43
48
|
│
|
|
44
|
-
○ Architecture
|
|
49
|
+
│ ○ Architecture
|
|
45
50
|
│
|
|
46
|
-
○ Product Context
|
|
51
|
+
│ ○ Product Context
|
|
47
52
|
│
|
|
48
|
-
○ Generation
|
|
53
|
+
│ ○ Generation
|
|
49
54
|
│
|
|
50
|
-
○
|
|
55
|
+
│ ○ Setup
|
|
56
|
+
└
|
|
51
57
|
```
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
| Indicator | Meaning |
|
|
60
|
+
|-----------|---------|
|
|
61
|
+
| `◇` (green) | Completed — summary shown on the `│` line below |
|
|
62
|
+
| `◆◈◇◈` (mauve, animated) | Active — waiting for input |
|
|
63
|
+
| `○` (dim) | Pending |
|
|
64
|
+
| `┌` / `└` | Open/close corners wrapping the full wizard flow |
|
|
65
|
+
|
|
66
|
+
## In-Step Navigation
|
|
67
|
+
|
|
68
|
+
Within any active step, you can navigate between its input fields without restarting the step:
|
|
69
|
+
|
|
70
|
+
| Key | Action |
|
|
71
|
+
|-----|--------|
|
|
72
|
+
| `Tab` | Go to the **next** field (saves current value) |
|
|
73
|
+
| `Shift+Tab` | Go to the **previous** field (restores saved value) |
|
|
74
|
+
| `Enter` | Confirm current field and advance |
|
|
75
|
+
|
|
76
|
+
`↑`/`↓` retain their original role: navigating **options within** a select or multi-select. They are never used for field-to-field navigation.
|
|
57
77
|
|
|
58
78
|
## The 7 Wizard Steps
|
|
59
79
|
|
|
60
|
-
1.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
### 1. Project Info
|
|
81
|
+
Name, description, package manager (select), license (select).
|
|
82
|
+
|
|
83
|
+
### 2. Stack & Style
|
|
84
|
+
Choose a **QuickStart preset** or configure manually:
|
|
85
|
+
|
|
86
|
+
| Preset | Best for |
|
|
87
|
+
|--------|----------|
|
|
88
|
+
| TypeScript + Node.js | CLI tools, backend APIs, npm packages |
|
|
89
|
+
| Next.js Full-Stack | SaaS apps, marketing sites, SSR/SSG |
|
|
90
|
+
| React SPA | Dashboards, admin panels, SPAs |
|
|
91
|
+
| Python + FastAPI | AI/ML backends, REST APIs, data services |
|
|
92
|
+
| Go HTTP Service | High-perf APIs, microservices |
|
|
93
|
+
| React Native + Expo | Cross-platform mobile apps |
|
|
94
|
+
| Configure manually → | Custom language, framework, and code style |
|
|
95
|
+
|
|
96
|
+
Presets auto-fill build/test/typecheck/lint/PR commands.
|
|
97
|
+
|
|
98
|
+
### 3. Build & Test
|
|
99
|
+
Build, test, typecheck, lint, and pre-PR commands — with smart defaults pre-filled when a QuickStart preset was selected.
|
|
100
|
+
|
|
101
|
+
### 4. Architecture
|
|
102
|
+
Select from 7 patterns (Monolith, MVC, Feature folders, Hexagonal, Microservices, Event-driven, Monorepo). Architecture notes are auto-generated from the chosen pattern.
|
|
103
|
+
|
|
104
|
+
### 5. Product Context
|
|
105
|
+
Problem statement, target users, tech stack (multi-select, prefilled from Step 2), core features (multi-select with custom input), non-goals.
|
|
106
|
+
|
|
107
|
+
### 6. Generation
|
|
108
|
+
Full summary of all collected inputs. Warns about any files that will be overwritten. Confirm to write files or skip.
|
|
109
|
+
|
|
110
|
+
### 7. Setup *(optional)*
|
|
111
|
+
Three independent yes/no prompts — each explained before asking:
|
|
112
|
+
|
|
113
|
+
- **Claude Powerline** — live status bar (git branch, context %, cost, active tools); runs via `npx` per session
|
|
114
|
+
- **Git repository** — `git init` + initial commit with the generated files
|
|
115
|
+
- **npm release scripts** — creates `~/bin/<project>-release` and adds `release:patch/minor/major` to `package.json`
|
|
67
116
|
|
|
68
117
|
## UI Components
|
|
69
118
|
|
|
70
119
|
| Component | File | Purpose |
|
|
71
120
|
|-----------|------|---------|
|
|
72
|
-
| Banner | `src/components/banner.tsx` | ASCII art header + tagline +
|
|
73
|
-
| Timeline | `src/components/timeline.tsx` |
|
|
74
|
-
| StepIndicator | `src/components/step-indicator.tsx` |
|
|
75
|
-
| GutterLine | `src/components/gutter-line.tsx` | `│ ` prefix wrapper
|
|
76
|
-
| GutteredSelect | `src/components/guttered-select.tsx` |
|
|
77
|
-
| GutteredMultiSelect | `src/components/guttered-select.tsx` | Multi-select with `●`/`○` toggle +
|
|
121
|
+
| Banner | `src/components/banner.tsx` | ASCII art header + tagline + divider |
|
|
122
|
+
| Timeline | `src/components/timeline.tsx` | `┌`/`└` corners, `│` gutter, step flow |
|
|
123
|
+
| StepIndicator | `src/components/step-indicator.tsx` | Animated dot + label per step |
|
|
124
|
+
| GutterLine | `src/components/gutter-line.tsx` | `│ ` prefix wrapper (Box row) |
|
|
125
|
+
| GutteredSelect | `src/components/guttered-select.tsx` | Sliding-window single-select with `│ ❯` gutter |
|
|
126
|
+
| GutteredMultiSelect | `src/components/guttered-select.tsx` | Multi-select with `●`/`○` toggle + custom input |
|
|
78
127
|
|
|
79
128
|
## Tech Stack
|
|
80
129
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
130
|
+
| Layer | Technology |
|
|
131
|
+
|-------|-----------|
|
|
132
|
+
| Language | TypeScript (strict mode, ESM) |
|
|
133
|
+
| UI Framework | Ink 6 (React for CLI) |
|
|
134
|
+
| Templating | Handlebars (`.hbs`) |
|
|
135
|
+
| AI | Vercel AI SDK 6, Z.ai (GLM), OpenAI |
|
|
136
|
+
| Build | tsc |
|
|
87
137
|
|
|
88
138
|
## Development
|
|
89
139
|
|
|
90
140
|
```bash
|
|
91
|
-
npm run dev # Run CLI
|
|
92
|
-
npm run build # Compile
|
|
141
|
+
npm run dev # Run CLI directly via tsx
|
|
142
|
+
npm run build # Compile to dist/
|
|
93
143
|
npm run typecheck # Type check only
|
|
94
|
-
npm run lint # Alias of typecheck in this repo
|
|
95
144
|
```
|
|
96
145
|
|
|
97
|
-
> **Warning:** Never run `npm run dev` from the procedure project directory — scaffolding writes to cwd and will overwrite procedure's own files. Always `cd` to a temp directory first.
|
|
146
|
+
> **Warning:** Never run `npm run dev` from the procedure project directory — scaffolding writes to `cwd` and will overwrite procedure's own files. Always `cd` to a temp directory first.
|
|
98
147
|
|
|
99
148
|
## Review & Fix Workflow
|
|
100
149
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- `CODE-REVIEW.md` — review entries (`CR-YYYYMMDD-###`)
|
|
104
|
-
- `CODE-FIXED.md` — fix entries (`CF-YYYYMMDD-###`)
|
|
105
|
-
|
|
106
|
-
Process:
|
|
107
|
-
1. Start review by reading latest `CODE-REVIEW.md` and `CODE-FIXED.md`.
|
|
108
|
-
2. Append new review findings to `CODE-REVIEW.md` only.
|
|
109
|
-
3. During implementation, write fix actions to `CODE-FIXED.md` only.
|
|
110
|
-
4. Re-review and update finding statuses in a new review entry.
|
|
111
|
-
|
|
112
|
-
Verification standard after fixes: run `npm run typecheck` and `npm run build`.
|
|
150
|
+
Two append-only logs track review/fix cycles:
|
|
113
151
|
|
|
114
|
-
|
|
152
|
+
- `CODE-REVIEW.md` — findings (`CR-YYYYMMDD-###`)
|
|
153
|
+
- `CODE-FIXED.md` — fix actions (`CF-YYYYMMDD-###`)
|
|
115
154
|
|
|
116
|
-
|
|
117
|
-
- If generation is skipped, final summary explicitly states no files were written.
|
|
118
|
-
- Git setup no longer hard-fails on empty directories; it reports a warning when nothing is committed.
|
|
119
|
-
- `docs/USER-STORIES.md` now includes fallback starter content when no stories are provided.
|
|
155
|
+
Verification standard after fixes: `npm run typecheck` + `npm run build`.
|
|
120
156
|
|
|
121
157
|
## Documentation
|
|
122
158
|
|
|
123
|
-
- [CLAUDE.md](./CLAUDE.md) —
|
|
124
|
-
- [docs/PRD.md](./docs/PRD.md) —
|
|
159
|
+
- [CLAUDE.md](./CLAUDE.md) — Development guide
|
|
160
|
+
- [docs/PRD.md](./docs/PRD.md) — Product requirements
|
|
125
161
|
- [docs/USER-STORIES.md](./docs/USER-STORIES.md) — User stories and acceptance criteria
|
|
126
162
|
- [docs/GIAI-THICH-CLAUDE-MD.md](./docs/GIAI-THICH-CLAUDE-MD.md) — 4-layer CLAUDE.md methodology (Vietnamese)
|
|
127
163
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { render } from "ink";
|
|
4
|
+
import { readdirSync } from "node:fs";
|
|
4
5
|
import App from "./app.js";
|
|
6
|
+
const entries = readdirSync(process.cwd()).filter((e) => e !== ".DS_Store");
|
|
7
|
+
if (entries.length > 0) {
|
|
8
|
+
const sample = entries.slice(0, 3).join(", ");
|
|
9
|
+
const extra = entries.length > 3 ? `, +${entries.length - 3} more` : "";
|
|
10
|
+
console.error(`\nWarning: current directory is not empty.`);
|
|
11
|
+
console.error(` Found: ${sample}${extra}`);
|
|
12
|
+
console.error(` Existing files can be overwritten during Step 6 (Generation).`);
|
|
13
|
+
console.error(` Recommended for a fresh project:`);
|
|
14
|
+
console.error(` mkdir my-project && cd my-project`);
|
|
15
|
+
console.error(` npx procedure-cli (or: npx @b3awesome/procedure)\n`);
|
|
16
|
+
}
|
|
5
17
|
render(_jsx(App, {}));
|
|
6
18
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";;AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";;AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC;AAC5E,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC5D,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACjF,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACpD,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC"}
|
package/dist/steps/build-test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Text } from "ink";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { Text, useInput } from "ink";
|
|
4
4
|
import { TextInput } from "@inkjs/ui";
|
|
5
5
|
import { GutterLine } from "../components/gutter-line.js";
|
|
6
6
|
import { C } from "../theme.js";
|
|
@@ -15,9 +15,36 @@ export default function BuildTest({ initialValues, onComplete }) {
|
|
|
15
15
|
const [fieldIndex, setFieldIndex] = useState(0);
|
|
16
16
|
const [answers, setAnswers] = useState({});
|
|
17
17
|
const [error, setError] = useState("");
|
|
18
|
+
const [liveInput, setLiveInput] = useState("");
|
|
18
19
|
const current = FIELDS[fieldIndex];
|
|
19
20
|
const preset = initialValues?.[current.key];
|
|
20
21
|
const defaultVal = preset || current.fallback;
|
|
22
|
+
// Reset live input when navigating to a different field
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setLiveInput("");
|
|
25
|
+
}, [fieldIndex]);
|
|
26
|
+
useInput((input, key) => {
|
|
27
|
+
if (key.shift && key.tab && fieldIndex > 0) {
|
|
28
|
+
setFieldIndex((f) => f - 1);
|
|
29
|
+
setError("");
|
|
30
|
+
}
|
|
31
|
+
else if (key.tab && !key.shift) {
|
|
32
|
+
const val = liveInput.trim() || answers[current.key] || defaultVal;
|
|
33
|
+
if (current.required && !val.trim()) {
|
|
34
|
+
setError(`${current.label} is required`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
setError("");
|
|
38
|
+
const next = { ...answers, [current.key]: val };
|
|
39
|
+
setAnswers(next);
|
|
40
|
+
if (fieldIndex < FIELDS.length - 1) {
|
|
41
|
+
setFieldIndex((f) => f + 1);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
onComplete(next);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
21
48
|
function handleSubmit(value) {
|
|
22
49
|
const val = value.trim() || defaultVal;
|
|
23
50
|
if (current.required && !val) {
|
|
@@ -34,6 +61,8 @@ export default function BuildTest({ initialValues, onComplete }) {
|
|
|
34
61
|
onComplete(next);
|
|
35
62
|
}
|
|
36
63
|
}
|
|
37
|
-
|
|
64
|
+
const isFirst = fieldIndex === 0;
|
|
65
|
+
const isLast = fieldIndex === FIELDS.length - 1;
|
|
66
|
+
return (_jsxs(_Fragment, { children: [FIELDS.slice(0, fieldIndex).map((f) => (_jsx(GutterLine, { children: _jsxs(Text, { color: C.overlay1, children: [f.label, ": ", answers[f.key]] }) }, f.key))), _jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: current.label }), _jsxs(Text, { color: C.overlay1, children: [" (", defaultVal, ")"] }), _jsx(Text, { bold: true, children: ": " }), _jsx(TextInput, { placeholder: defaultVal, onChange: setLiveInput, onSubmit: handleSubmit })] }), error && (_jsx(GutterLine, { children: _jsx(Text, { color: C.red, children: error }) })), _jsx(GutterLine, { children: _jsxs(Text, { color: C.overlay1, children: [!isFirst ? "Shift+Tab prev " : "", isLast ? "Tab / Enter confirm" : "Tab next Enter confirm"] }) })] }));
|
|
38
67
|
}
|
|
39
68
|
//# sourceMappingURL=build-test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-test.js","sourceRoot":"","sources":["../../src/steps/build-test.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"build-test.js","sourceRoot":"","sources":["../../src/steps/build-test.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAchC,MAAM,MAAM,GAAyE;IACnF,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1F,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,EA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CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,EAClC,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,yBAAyB,IACtD,GACI,IACZ,CACJ,CAAC;AACJ,CAAC"}
|
package/dist/steps/powerline.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { Text } from "ink";
|
|
3
|
+
import { Text, useInput } from "ink";
|
|
4
4
|
import { ConfirmInput, Spinner } from "@inkjs/ui";
|
|
5
5
|
import { GutterLine } from "../components/gutter-line.js";
|
|
6
6
|
import { setupPowerline } from "../lib/powerline.js";
|
|
@@ -14,6 +14,14 @@ export default function Powerline({ answers, onComplete }) {
|
|
|
14
14
|
const [wantRelease, setWantRelease] = useState(false);
|
|
15
15
|
const [errorMsg, setErrorMsg] = useState("");
|
|
16
16
|
const [setupResult, setSetupResult] = useState({});
|
|
17
|
+
useInput((input, key) => {
|
|
18
|
+
if (key.shift && key.tab) {
|
|
19
|
+
if (phase === "ask-git")
|
|
20
|
+
setPhase("ask-powerline");
|
|
21
|
+
else if (phase === "ask-release")
|
|
22
|
+
setPhase("ask-git");
|
|
23
|
+
}
|
|
24
|
+
}, { isActive: phase === "ask-git" || phase === "ask-release" });
|
|
17
25
|
function runSetup(powerline, git, release) {
|
|
18
26
|
setPhase("running");
|
|
19
27
|
try {
|
|
@@ -50,12 +58,12 @@ export default function Powerline({ answers, onComplete }) {
|
|
|
50
58
|
}
|
|
51
59
|
// ── Ask: Git ────────────────────────────────────────────────────────────────
|
|
52
60
|
if (phase === "ask-git") {
|
|
53
|
-
return (_jsxs(_Fragment, { children: [wantPowerline && (_jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Powerline: yes" }) })), _jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Git repository" }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Runs git init and makes an initial commit with the generated" }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "files \u2014 clean starting point for your project history." }) }), _jsx(GutterLine, { children: _jsx(Text, { children: " " }) }), _jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Initialize git repo? " }), _jsx(ConfirmInput, { onConfirm: () => { setWantGit(true); setPhase("ask-release"); }, onCancel: () => { setWantGit(false); setPhase("ask-release"); } })] })] }));
|
|
61
|
+
return (_jsxs(_Fragment, { children: [wantPowerline && (_jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Powerline: yes" }) })), _jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Git repository" }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Runs git init and makes an initial commit with the generated" }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "files \u2014 clean starting point for your project history." }) }), _jsx(GutterLine, { children: _jsx(Text, { children: " " }) }), _jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Initialize git repo? " }), _jsx(ConfirmInput, { onConfirm: () => { setWantGit(true); setPhase("ask-release"); }, onCancel: () => { setWantGit(false); setPhase("ask-release"); } })] }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev y/n answer" }) })] }));
|
|
54
62
|
}
|
|
55
63
|
// ── Ask: Release scripts ────────────────────────────────────────────────────
|
|
56
64
|
if (phase === "ask-release") {
|
|
57
65
|
const projectName = answers.projectName || "untitled";
|
|
58
|
-
return (_jsxs(_Fragment, { children: [wantPowerline && (_jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Powerline: yes" }) })), wantGit && (_jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Git: yes" }) })), _jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "npm release scripts" }) }), _jsx(GutterLine, { children: _jsxs(Text, { color: C.overlay1, children: ["Creates ~/bin/", projectName, "-release and adds release:patch /"] }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "minor / major scripts to package.json. One command to build," }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "version-bump, push tags, and publish to npm." }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Requires: npm login. Best for packages published to npm." }) }), _jsx(GutterLine, { children: _jsx(Text, { children: " " }) }), _jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Set up release scripts? " }), _jsx(ConfirmInput, { onConfirm: () => { setWantRelease(true); runSetup(wantPowerline, wantGit, true); }, onCancel: () => { setWantRelease(false); runSetup(wantPowerline, wantGit, false); } })] })] }));
|
|
66
|
+
return (_jsxs(_Fragment, { children: [wantPowerline && (_jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Powerline: yes" }) })), wantGit && (_jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Git: yes" }) })), _jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "npm release scripts" }) }), _jsx(GutterLine, { children: _jsxs(Text, { color: C.overlay1, children: ["Creates ~/bin/", projectName, "-release and adds release:patch /"] }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "minor / major scripts to package.json. One command to build," }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "version-bump, push tags, and publish to npm." }) }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Requires: npm login. Best for packages published to npm." }) }), _jsx(GutterLine, { children: _jsx(Text, { children: " " }) }), _jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Set up release scripts? " }), _jsx(ConfirmInput, { onConfirm: () => { setWantRelease(true); runSetup(wantPowerline, wantGit, true); }, onCancel: () => { setWantRelease(false); runSetup(wantPowerline, wantGit, false); } })] }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev y/n answer" }) })] }));
|
|
59
67
|
}
|
|
60
68
|
// ── Running ─────────────────────────────────────────────────────────────────
|
|
61
69
|
if (phase === "running") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerline.js","sourceRoot":"","sources":["../../src/steps/powerline.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"powerline.js","sourceRoot":"","sources":["../../src/steps/powerline.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAwBhC,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,EAAS;IAC9D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAQ,eAAe,CAAC,CAAC;IAC3D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAA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CAAC,OAAO,IAAI,CAAC,WAAW,IAAI,CAC7C,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,sCAA8B,GAC1C,CACd,EACD,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,sCAAuB,GACtC,IACZ,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Text } from "ink";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { Text, useInput } from "ink";
|
|
4
4
|
import { TextInput } from "@inkjs/ui";
|
|
5
5
|
import { GutterLine } from "../components/gutter-line.js";
|
|
6
6
|
import { GutteredMultiSelect } from "../components/guttered-select.js";
|
|
@@ -46,6 +46,7 @@ export default function ProductContext({ initialValues, onComplete }) {
|
|
|
46
46
|
const [phaseIndex, setPhaseIndex] = useState(0);
|
|
47
47
|
const [answers, setAnswers] = useState({});
|
|
48
48
|
const [error, setError] = useState("");
|
|
49
|
+
const [liveInput, setLiveInput] = useState("");
|
|
49
50
|
// Prefill tech stack from Stack & Style selections (language + framework)
|
|
50
51
|
const prefillTechStack = [];
|
|
51
52
|
if (initialValues?.language) {
|
|
@@ -59,6 +60,54 @@ export default function ProductContext({ initialValues, onComplete }) {
|
|
|
59
60
|
prefillTechStack.push(match.value);
|
|
60
61
|
}
|
|
61
62
|
const currentPhase = PHASE_ORDER[phaseIndex];
|
|
63
|
+
const isFirst = phaseIndex === 0;
|
|
64
|
+
const isLast = phaseIndex === PHASE_ORDER.length - 1;
|
|
65
|
+
// Reset live input when navigating to a different field
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
setLiveInput("");
|
|
68
|
+
}, [phaseIndex]);
|
|
69
|
+
const isMultiSelectPhase = currentPhase === "techStack" || currentPhase === "coreFeatures";
|
|
70
|
+
useInput((input, key) => {
|
|
71
|
+
if (key.shift && key.tab && phaseIndex > 0) {
|
|
72
|
+
setPhaseIndex((i) => i - 1);
|
|
73
|
+
setError("");
|
|
74
|
+
}
|
|
75
|
+
else if (key.tab && !key.shift && !isMultiSelectPhase) {
|
|
76
|
+
// Tab only advances text phases — multi-select phases use Enter to confirm
|
|
77
|
+
const required = currentPhase === "problem" || currentPhase === "users";
|
|
78
|
+
const val = liveInput.trim() || answers[currentPhase] || "";
|
|
79
|
+
if (required && !val) {
|
|
80
|
+
setError("This field is required");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
setError("");
|
|
84
|
+
const next = { ...answers, [currentPhase]: val };
|
|
85
|
+
setAnswers(next);
|
|
86
|
+
if (phaseIndex < PHASE_ORDER.length - 1) {
|
|
87
|
+
setPhaseIndex((i) => i + 1);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
finalize(next);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
function finalize(data) {
|
|
95
|
+
onComplete({
|
|
96
|
+
problem: data.problem,
|
|
97
|
+
users: data.users,
|
|
98
|
+
techStack: data.techStack,
|
|
99
|
+
coreFeatures: (data.coreFeatures || "")
|
|
100
|
+
.split(",")
|
|
101
|
+
.map((s) => s.trim())
|
|
102
|
+
.filter(Boolean),
|
|
103
|
+
nonGoals: (data.nonGoals || "")
|
|
104
|
+
.split(",")
|
|
105
|
+
.map((s) => s.trim())
|
|
106
|
+
.filter(Boolean),
|
|
107
|
+
userStories: [],
|
|
108
|
+
envVars: [],
|
|
109
|
+
});
|
|
110
|
+
}
|
|
62
111
|
function advanceToNext(key, value) {
|
|
63
112
|
const next = { ...answers, [key]: value };
|
|
64
113
|
setAnswers(next);
|
|
@@ -67,28 +116,14 @@ export default function ProductContext({ initialValues, onComplete }) {
|
|
|
67
116
|
setPhaseIndex(phaseIndex + 1);
|
|
68
117
|
}
|
|
69
118
|
else {
|
|
70
|
-
|
|
71
|
-
problem: next.problem,
|
|
72
|
-
users: next.users,
|
|
73
|
-
techStack: next.techStack,
|
|
74
|
-
coreFeatures: (next.coreFeatures || "")
|
|
75
|
-
.split(",")
|
|
76
|
-
.map((s) => s.trim())
|
|
77
|
-
.filter(Boolean),
|
|
78
|
-
nonGoals: (next.nonGoals || "")
|
|
79
|
-
.split(",")
|
|
80
|
-
.map((s) => s.trim())
|
|
81
|
-
.filter(Boolean),
|
|
82
|
-
userStories: [],
|
|
83
|
-
envVars: [],
|
|
84
|
-
});
|
|
119
|
+
finalize(next);
|
|
85
120
|
}
|
|
86
121
|
}
|
|
87
122
|
function handleTextSubmit(key, required) {
|
|
88
123
|
return (value) => {
|
|
89
124
|
const val = value.trim();
|
|
90
125
|
if (required && !val) {
|
|
91
|
-
setError(
|
|
126
|
+
setError("This field is required");
|
|
92
127
|
return;
|
|
93
128
|
}
|
|
94
129
|
advanceToNext(key, val);
|
|
@@ -105,6 +140,6 @@ export default function ProductContext({ initialValues, onComplete }) {
|
|
|
105
140
|
const usersPlaceholder = answers["problem"]
|
|
106
141
|
? `People affected by: ${answers["problem"]}`
|
|
107
142
|
: "e.g. Developers, PMs, designers...";
|
|
108
|
-
return (_jsxs(_Fragment, { children: [completedFields, currentPhase === "problem" && (_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "What problem does this solve? " }), _jsx(TextInput, { placeholder: "Describe the core problem...", onSubmit: handleTextSubmit("problem", true) })] })), currentPhase === "users" && (_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Who are the users? " }), _jsx(TextInput, { placeholder: usersPlaceholder, onSubmit: handleTextSubmit("users", true) })] })), currentPhase === "techStack" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Tech stack:" }) }), _jsx(GutteredMultiSelect, { options: TECH_STACK_OPTIONS, initialSelected: prefillTechStack, onSubmit: handleTechStackSubmit })] })), currentPhase === "coreFeatures" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Core features:" }) }), _jsx(GutteredMultiSelect, { options: CORE_FEATURE_OPTIONS, onSubmit: handleCoreFeaturesSubmit, allowCustom: true, customPlaceholder: "e.g. Export PDF, Onboarding flow..." })] })), currentPhase === "nonGoals" && (_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Non-goals (comma-separated): " }), _jsx(TextInput, { placeholder: "e.g. Mobile app, Real-time sync...", onSubmit: handleTextSubmit("nonGoals", false) })] })), error && (_jsx(GutterLine, { children: _jsx(Text, { color: C.red, children: error }) }))] }));
|
|
143
|
+
return (_jsxs(_Fragment, { children: [completedFields, currentPhase === "problem" && (_jsxs(_Fragment, { children: [_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "What problem does this solve? " }), _jsx(TextInput, { placeholder: "Describe the core problem...", onChange: setLiveInput, onSubmit: handleTextSubmit("problem", true) })] }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Tab next Enter confirm" }) })] })), currentPhase === "users" && (_jsxs(_Fragment, { children: [_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Who are the users? " }), _jsx(TextInput, { placeholder: usersPlaceholder, onChange: setLiveInput, onSubmit: handleTextSubmit("users", true) })] }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev Tab next Enter confirm" }) })] })), currentPhase === "techStack" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Tech stack:" }) }), _jsx(GutteredMultiSelect, { options: TECH_STACK_OPTIONS, initialSelected: prefillTechStack, onSubmit: handleTechStackSubmit }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev ↑↓ move Space toggle Enter confirm" }) })] })), currentPhase === "coreFeatures" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Core features:" }) }), _jsx(GutteredMultiSelect, { options: CORE_FEATURE_OPTIONS, onSubmit: handleCoreFeaturesSubmit, allowCustom: true, customPlaceholder: "e.g. Export PDF, Onboarding flow..." }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev ↑↓ move Space toggle Enter confirm" }) })] })), currentPhase === "nonGoals" && (_jsxs(_Fragment, { children: [_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Non-goals (comma-separated): " }), _jsx(TextInput, { placeholder: "e.g. Mobile app, Real-time sync...", onChange: setLiveInput, onSubmit: handleTextSubmit("nonGoals", false) })] }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev Tab / Enter confirm" }) })] })), error && (_jsx(GutterLine, { children: _jsx(Text, { color: C.red, children: error }) }))] }));
|
|
109
144
|
}
|
|
110
145
|
//# sourceMappingURL=product-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-context.js","sourceRoot":"","sources":["../../src/steps/product-context.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"product-context.js","sourceRoot":"","sources":["../../src/steps/product-context.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAShC,MAAM,oBAAoB,GAAG;IAC3B,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,yBAAyB,EAAE;IAC5F,EAAE,KAAK,EAAE,eAAe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AAC,UAAU,cACT,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,YAAG,sDAAsD,GAAQ,GAC7E,IACZ,CACJ,EAEA,YAAY,KAAK,cAAc,IAAI,CAClC,8BACE,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,IAAI,qCAAsB,GACrB,EACb,KAAC,mBAAmB,IAClB,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,wBAAwB,EAClC,WAAW,QACX,iBAAiB,EAAC,qCAAqC,GACvD,EACF,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,YAAG,sDAAsD,GAAQ,GAC7E,IACZ,CACJ,EAEA,YAAY,KAAK,UAAU,IAAI,CAC9B,8BACE,MAAC,UAAU,eACT,KAAC,IAAI,IAAC,IAAI,oDAAqC,EAC/C,KAAC,SAAS,IACR,WAAW,EAAC,oCAAoC,EAChD,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,GAC7C,IACS,EACb,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,YAAG,qCAAqC,GAAQ,GAC5D,IACZ,CACJ,EAEA,KAAK,IAAI,CACR,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,CAAC,GAAG,YAAG,KAAK,GAAQ,GACvB,CACd,IACA,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Text } from "ink";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { Text, useInput } from "ink";
|
|
4
4
|
import { TextInput } from "@inkjs/ui";
|
|
5
5
|
import { GutterLine } from "../components/gutter-line.js";
|
|
6
6
|
import { GutteredSelect } from "../components/guttered-select.js";
|
|
@@ -28,7 +28,34 @@ export default function ProjectInfo({ onComplete }) {
|
|
|
28
28
|
const [stepIndex, setStepIndex] = useState(0);
|
|
29
29
|
const [answers, setAnswers] = useState({});
|
|
30
30
|
const [error, setError] = useState("");
|
|
31
|
+
const [liveInput, setLiveInput] = useState("");
|
|
31
32
|
const currentStep = STEP_ORDER[stepIndex];
|
|
33
|
+
const isFirst = stepIndex === 0;
|
|
34
|
+
// Reset live input when navigating to a different field
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setLiveInput("");
|
|
37
|
+
}, [stepIndex]);
|
|
38
|
+
const isSelectStep = currentStep === "packageManager" || currentStep === "license";
|
|
39
|
+
useInput((input, key) => {
|
|
40
|
+
if (key.shift && key.tab && stepIndex > 0) {
|
|
41
|
+
setStepIndex((i) => i - 1);
|
|
42
|
+
setError("");
|
|
43
|
+
}
|
|
44
|
+
else if (key.tab && !key.shift && !isSelectStep) {
|
|
45
|
+
// Tab only advances text steps — select steps require an explicit Enter selection
|
|
46
|
+
const val = liveInput.trim() || answers[currentStep] || "";
|
|
47
|
+
if (!val) {
|
|
48
|
+
setError(currentStep === "projectName"
|
|
49
|
+
? "Project name is required"
|
|
50
|
+
: "Description is required");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
setError("");
|
|
54
|
+
const next = { ...answers, [currentStep]: val };
|
|
55
|
+
setAnswers(next);
|
|
56
|
+
setStepIndex((i) => i + 1);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
32
59
|
function advance(key, value) {
|
|
33
60
|
const next = { ...answers, [key]: value };
|
|
34
61
|
setAnswers(next);
|
|
@@ -57,6 +84,6 @@ export default function ProjectInfo({ onComplete }) {
|
|
|
57
84
|
}
|
|
58
85
|
// Render completed fields
|
|
59
86
|
const completed = STEP_ORDER.slice(0, stepIndex).map((key) => (_jsx(GutterLine, { children: _jsxs(Text, { color: C.overlay1, children: [key === "projectName" && `Project name: ${answers[key]}`, key === "description" && `Description: ${answers[key]}`, key === "packageManager" && `Package manager: ${answers[key]}`, key === "license" && `License: ${answers[key]}`] }) }, key)));
|
|
60
|
-
return (_jsxs(_Fragment, { children: [completed, currentStep === "projectName" && (_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Project name: " }), _jsx(TextInput, { placeholder: "...", onSubmit: handleTextSubmit })] })), currentStep === "description" && (_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "One-line description: " }), _jsx(TextInput, { placeholder: "...", onSubmit: handleTextSubmit })] })), currentStep === "packageManager" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Package manager:" }) }), _jsx(GutteredSelect, { options: PACKAGE_MANAGER_OPTIONS, onChange: handleSelectChange("packageManager") })] })), currentStep === "license" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "License:" }) }), _jsx(GutteredSelect, { options: LICENSE_OPTIONS, onChange: handleSelectChange("license") })] })), error && (_jsx(GutterLine, { children: _jsx(Text, { color: C.red, children: error }) }))] }));
|
|
87
|
+
return (_jsxs(_Fragment, { children: [completed, currentStep === "projectName" && (_jsxs(_Fragment, { children: [_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Project name: " }), _jsx(TextInput, { placeholder: "...", onChange: setLiveInput, onSubmit: handleTextSubmit })] }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Tab next Enter confirm" }) })] })), currentStep === "description" && (_jsxs(_Fragment, { children: [_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "One-line description: " }), _jsx(TextInput, { placeholder: "...", onChange: setLiveInput, onSubmit: handleTextSubmit })] }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev Tab next Enter confirm" }) })] })), currentStep === "packageManager" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Package manager:" }) }), _jsx(GutteredSelect, { options: PACKAGE_MANAGER_OPTIONS, onChange: handleSelectChange("packageManager") }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev ↑↓ move Enter select" }) })] })), currentStep === "license" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "License:" }) }), _jsx(GutteredSelect, { options: LICENSE_OPTIONS, onChange: handleSelectChange("license") }), _jsx(GutterLine, { children: _jsx(Text, { color: C.overlay1, children: "Shift+Tab prev ↑↓ move Enter select" }) })] })), error && (_jsx(GutterLine, { children: _jsx(Text, { color: C.red, children: error }) }))] }));
|
|
61
88
|
}
|
|
62
89
|
//# sourceMappingURL=project-info.js.map
|