@kmgeon/taskflow 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +374 -0
  2. package/bin/task-mcp.mjs +19 -0
  3. package/bin/task.mjs +19 -0
  4. package/docs/clean-code.md +29 -0
  5. package/docs/git.md +36 -0
  6. package/docs/guideline.md +25 -0
  7. package/docs/security.md +32 -0
  8. package/docs/step-by-step.md +29 -0
  9. package/docs/superpowers/specs/2026-03-21-cli-advisor-design.md +383 -0
  10. package/docs/superpowers/specs/2026-03-21-init-redesign-design.md +429 -0
  11. package/docs/superpowers/specs/2026-03-21-skill-architecture-design.md +362 -0
  12. package/docs/superpowers/specs/2026-03-23-t-create-task-run-design.md +40 -0
  13. package/docs/superpowers/specs/2026-03-23-task-run-design.md +44 -0
  14. package/docs/tdd.md +41 -0
  15. package/package.json +114 -0
  16. package/src/app/(protected)/dashboard/page.tsx +7 -0
  17. package/src/app/(protected)/layout.tsx +10 -0
  18. package/src/app/api/[[...hono]]/route.ts +13 -0
  19. package/src/app/example/page.tsx +11 -0
  20. package/src/app/favicon.ico +0 -0
  21. package/src/app/globals.css +168 -0
  22. package/src/app/layout.tsx +35 -0
  23. package/src/app/page.tsx +5 -0
  24. package/src/app/providers.tsx +57 -0
  25. package/src/backend/config/index.ts +36 -0
  26. package/src/backend/hono/app.ts +32 -0
  27. package/src/backend/hono/context.ts +38 -0
  28. package/src/backend/http/response.ts +64 -0
  29. package/src/backend/middleware/context.ts +23 -0
  30. package/src/backend/middleware/error.ts +31 -0
  31. package/src/backend/middleware/supabase.ts +23 -0
  32. package/src/backend/supabase/client.ts +17 -0
  33. package/src/cli/commands/__tests__/task-commands.test.ts +170 -0
  34. package/src/cli/commands/advisor.ts +45 -0
  35. package/src/cli/commands/ask.ts +50 -0
  36. package/src/cli/commands/board.ts +72 -0
  37. package/src/cli/commands/init.ts +184 -0
  38. package/src/cli/commands/list.ts +138 -0
  39. package/src/cli/commands/run.ts +143 -0
  40. package/src/cli/commands/set-status.ts +50 -0
  41. package/src/cli/commands/show.ts +28 -0
  42. package/src/cli/commands/tree.ts +72 -0
  43. package/src/cli/index.ts +38 -0
  44. package/src/cli/lib/__tests__/formatter.test.ts +123 -0
  45. package/src/cli/lib/error-boundary.test.ts +135 -0
  46. package/src/cli/lib/error-boundary.ts +70 -0
  47. package/src/cli/lib/formatter.ts +764 -0
  48. package/src/cli/lib/trd.ts +33 -0
  49. package/src/cli/lib/validate.test.ts +89 -0
  50. package/src/cli/lib/validate.ts +43 -0
  51. package/src/cli/prompts/task-run.md +25 -0
  52. package/src/components/layout/AppLayout.tsx +15 -0
  53. package/src/components/layout/Sidebar.tsx +124 -0
  54. package/src/components/ui/accordion.tsx +58 -0
  55. package/src/components/ui/avatar.tsx +50 -0
  56. package/src/components/ui/badge.tsx +36 -0
  57. package/src/components/ui/button.tsx +56 -0
  58. package/src/components/ui/card.tsx +79 -0
  59. package/src/components/ui/checkbox.tsx +30 -0
  60. package/src/components/ui/dialog.tsx +122 -0
  61. package/src/components/ui/dropdown-menu.tsx +200 -0
  62. package/src/components/ui/file-upload.tsx +50 -0
  63. package/src/components/ui/form.tsx +179 -0
  64. package/src/components/ui/input.tsx +25 -0
  65. package/src/components/ui/label.tsx +26 -0
  66. package/src/components/ui/scroll-area.tsx +48 -0
  67. package/src/components/ui/select.tsx +160 -0
  68. package/src/components/ui/separator.tsx +31 -0
  69. package/src/components/ui/sheet.tsx +140 -0
  70. package/src/components/ui/textarea.tsx +22 -0
  71. package/src/components/ui/toast.tsx +129 -0
  72. package/src/components/ui/toaster.tsx +35 -0
  73. package/src/core/ai/claude-client.ts +79 -0
  74. package/src/core/claude-runner/flag-builder.ts +57 -0
  75. package/src/core/claude-runner/index.ts +2 -0
  76. package/src/core/claude-runner/spawner.ts +86 -0
  77. package/src/core/prd/__tests__/auto-analyzer.test.ts +35 -0
  78. package/src/core/prd/__tests__/generator.test.ts +26 -0
  79. package/src/core/prd/__tests__/scanner.test.ts +35 -0
  80. package/src/core/prd/auto-analyzer.ts +9 -0
  81. package/src/core/prd/generator.ts +8 -0
  82. package/src/core/prd/scanner.ts +117 -0
  83. package/src/core/project/__tests__/claude-setup.test.ts +133 -0
  84. package/src/core/project/__tests__/config.test.ts +30 -0
  85. package/src/core/project/__tests__/init.test.ts +37 -0
  86. package/src/core/project/__tests__/skill-setup.test.ts +62 -0
  87. package/src/core/project/claude-setup.ts +224 -0
  88. package/src/core/project/config.ts +34 -0
  89. package/src/core/project/docs-setup.ts +26 -0
  90. package/src/core/project/docs-templates.ts +205 -0
  91. package/src/core/project/init.ts +40 -0
  92. package/src/core/project/skill-setup.ts +32 -0
  93. package/src/core/project/skill-templates.ts +277 -0
  94. package/src/core/task/index.ts +16 -0
  95. package/src/core/types.ts +58 -0
  96. package/src/features/example/backend/error.ts +9 -0
  97. package/src/features/example/backend/route.ts +52 -0
  98. package/src/features/example/backend/schema.ts +25 -0
  99. package/src/features/example/backend/service.ts +73 -0
  100. package/src/features/example/components/example-status.test.tsx +97 -0
  101. package/src/features/example/components/example-status.tsx +160 -0
  102. package/src/features/example/hooks/useExampleQuery.ts +23 -0
  103. package/src/features/example/lib/dto.test.ts +57 -0
  104. package/src/features/example/lib/dto.ts +5 -0
  105. package/src/features/kanban/backend/__tests__/sse-broadcaster.test.ts +137 -0
  106. package/src/features/kanban/backend/__tests__/sse-event-format.test.ts +55 -0
  107. package/src/features/kanban/backend/route.ts +55 -0
  108. package/src/features/kanban/backend/sse-broadcaster.ts +142 -0
  109. package/src/features/kanban/backend/sse-route.ts +43 -0
  110. package/src/features/kanban/components/KanbanBoard.tsx +105 -0
  111. package/src/features/kanban/components/KanbanColumn.tsx +51 -0
  112. package/src/features/kanban/components/KanbanError.tsx +29 -0
  113. package/src/features/kanban/components/KanbanSkeleton.tsx +46 -0
  114. package/src/features/kanban/components/ProgressCard.tsx +42 -0
  115. package/src/features/kanban/components/TaskCard.tsx +76 -0
  116. package/src/features/kanban/components/__tests__/kanban-components.test.tsx +86 -0
  117. package/src/features/kanban/hooks/useTaskSse.ts +66 -0
  118. package/src/features/kanban/hooks/useTasksQuery.ts +52 -0
  119. package/src/features/kanban/lib/__tests__/kanban-utils.test.ts +97 -0
  120. package/src/features/kanban/lib/kanban-utils.ts +37 -0
  121. package/src/features/taskflow/constants.ts +54 -0
  122. package/src/features/taskflow/index.ts +27 -0
  123. package/src/features/taskflow/lib/__tests__/filter.test.ts +89 -0
  124. package/src/features/taskflow/lib/__tests__/graph.test.ts +247 -0
  125. package/src/features/taskflow/lib/__tests__/repository.test.ts +233 -0
  126. package/src/features/taskflow/lib/__tests__/serializer.test.ts +98 -0
  127. package/src/features/taskflow/lib/advisor/__tests__/advisor-integration.test.ts +98 -0
  128. package/src/features/taskflow/lib/advisor/ai-advisor.test.ts +40 -0
  129. package/src/features/taskflow/lib/advisor/ai-advisor.ts +20 -0
  130. package/src/features/taskflow/lib/advisor/context-builder.test.ts +73 -0
  131. package/src/features/taskflow/lib/advisor/context-builder.ts +151 -0
  132. package/src/features/taskflow/lib/advisor/db.test.ts +106 -0
  133. package/src/features/taskflow/lib/advisor/db.ts +185 -0
  134. package/src/features/taskflow/lib/advisor/local-summary.test.ts +53 -0
  135. package/src/features/taskflow/lib/advisor/local-summary.ts +72 -0
  136. package/src/features/taskflow/lib/advisor/prompts.ts +86 -0
  137. package/src/features/taskflow/lib/filter.ts +54 -0
  138. package/src/features/taskflow/lib/fs-utils.ts +50 -0
  139. package/src/features/taskflow/lib/graph.ts +148 -0
  140. package/src/features/taskflow/lib/index-builder.ts +42 -0
  141. package/src/features/taskflow/lib/repository.ts +168 -0
  142. package/src/features/taskflow/lib/serializer.ts +62 -0
  143. package/src/features/taskflow/lib/watcher.ts +40 -0
  144. package/src/features/taskflow/types.ts +71 -0
  145. package/src/hooks/use-toast.ts +194 -0
  146. package/src/lib/remote/api-client.ts +40 -0
  147. package/src/lib/supabase/client.ts +8 -0
  148. package/src/lib/supabase/server.ts +46 -0
  149. package/src/lib/supabase/types.ts +3 -0
  150. package/src/lib/utils.ts +6 -0
  151. package/src/mcp/index.ts +7 -0
  152. package/src/mcp/server.ts +21 -0
  153. package/src/mcp/tools/brainstorm.ts +48 -0
  154. package/src/mcp/tools/prd.ts +71 -0
  155. package/src/mcp/tools/project.ts +39 -0
  156. package/src/mcp/tools/task-status.ts +40 -0
  157. package/src/mcp/tools/task.ts +82 -0
  158. package/src/mcp/util.ts +6 -0
package/README.md ADDED
@@ -0,0 +1,374 @@
1
+ <div align="center">
2
+
3
+ # TaskFlow
4
+
5
+ ### Two commands. Idea to code.
6
+
7
+ **Document-driven vibe coding.**
8
+
9
+ [Concepts](#concepts) · [Getting Started](#getting-started) · [How It Works](#how-it-works) · [CLI Reference](#cli-reference) · [Skills](#skills) · [Architecture](#architecture)
10
+
11
+ </div>
12
+
13
+ ---
14
+
15
+ ```bash
16
+ /t-create # Tell AI what to build
17
+ task run # AI builds it
18
+ ```
19
+
20
+ That's it.
21
+
22
+ ---
23
+
24
+ ## Philosophy
25
+
26
+ **Write docs, not code.**
27
+
28
+ You describe what you want. AI brainstorms with you, writes the spec, and implements everything. Your job is to think and approve — not to type boilerplate.
29
+
30
+ Three principles:
31
+
32
+ 1. **Document-first** — Every feature starts as a TRD (Task Requirements Document). No code is written until the spec is approved. Decisions are captured in markdown, not lost in Slack threads or your head.
33
+
34
+ 2. **Automated execution** — Once a spec is approved, AI decomposes it into tasks and implements them one by one. You don't manage tickets. You don't assign priorities. The system handles it.
35
+
36
+ 3. **File-based, Git-native** — No database. No cloud dependency. Everything is markdown files in `.taskflow/`, versioned with Git. Fork it, diff it, review it — it's just text.
37
+
38
+ ```
39
+ Your idea → TRD (markdown) → Tasks (markdown) → Code (automated)
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Concepts
45
+
46
+ TaskFlow is built around four core concepts. Understanding them makes the entire system click.
47
+
48
+ ### PRD — Product Requirements Document
49
+
50
+ **What** you're building, for **whom**, and **why**.
51
+
52
+ PRD is the highest-level document. It captures the full product vision: target users, pain points, feature list, success metrics, and scope boundaries. Think of it as the "what and why" document.
53
+
54
+ ```markdown
55
+ # MyApp — PRD
56
+ ## Target Users
57
+ ## Problems & Solutions
58
+ ## Feature Requirements (Must-Have / Nice-to-Have)
59
+ ## Non-functional Requirements
60
+ ## Milestones
61
+ ```
62
+
63
+ In TaskFlow, PRDs are created interactively with the `/prd` skill and stored in `.taskflow/prd.md`. A PRD can span multiple features — it's the big picture.
64
+
65
+ ### TRD — Task Requirements Document
66
+
67
+ **How** to build a specific feature.
68
+
69
+ A TRD zooms into one feature from the PRD (or a standalone idea) and defines the technical approach. It includes architecture decisions, data models, API design, user scenarios, success criteria, and risks.
70
+
71
+ The key difference: **PRD says "we need authentication." TRD says "we'll use Supabase Auth with JWT, refresh tokens stored in httpOnly cookies, middleware on /api/* routes."**
72
+
73
+ ```markdown
74
+ # Auth System — TRD
75
+ ## Overview (chosen approach + rationale)
76
+ ## User Scenarios
77
+ ## Technical Design (architecture, data model, API, UI)
78
+ ## Dependencies
79
+ ## Success Criteria
80
+ ## Risks
81
+ ```
82
+
83
+ TRDs are created with the `/t-create` skill — which includes a brainstorming phase where AI proposes 2-3 approaches before writing. Each TRD is saved as `.taskflow/trd-{feature-name}.md`.
84
+
85
+ **One TRD = one feature = one unit of work for `task run`.**
86
+
87
+ ### Task — Implementation Unit
88
+
89
+ A single, concrete piece of work that can be completed in under 4 hours.
90
+
91
+ Tasks are auto-generated by `task run` when it decomposes a TRD. Each task has a title, description, priority, dependencies, and status. You don't create tasks manually — the system handles it.
92
+
93
+ ```yaml
94
+ # .taskflow/tasks/task-003.md
95
+ ---
96
+ id: '003'
97
+ title: Implement auth middleware
98
+ status: InProgress
99
+ priority: 9
100
+ group: auth system
101
+ dependencies:
102
+ - '001'
103
+ - '002'
104
+ ---
105
+ Create Express middleware that validates JWT tokens on /api/* routes...
106
+ ```
107
+
108
+ Task statuses: `Todo` → `InProgress` → `Done` (or `Blocked`)
109
+
110
+ ### Decompose — TRD to Tasks
111
+
112
+ The process of breaking a TRD into implementation tasks.
113
+
114
+ Decomposition happens automatically when you run `task run`. The AI reads your TRD and creates tasks that are:
115
+
116
+ - **Small** — each completable in under 4 hours
117
+ - **Ordered** — dependencies are explicit, implementation order is logical
118
+ - **Isolated** — each task has one clear purpose, testable independently
119
+ - **Grouped** — all tasks from one TRD share the same `group` name
120
+
121
+ ```
122
+ TRD: Auth System
123
+
124
+ ├── task-001: Set up Supabase Auth client (priority: 9)
125
+ ├── task-002: Create login/signup API routes (priority: 9, depends: 001)
126
+ ├── task-003: Implement auth middleware (priority: 9, depends: 001, 002)
127
+ ├── task-004: Add refresh token rotation (priority: 7, depends: 003)
128
+ └── task-005: Write auth integration tests (priority: 8, depends: 003)
129
+ ```
130
+
131
+ After decomposition, Ralph Loop implements each task sequentially — writing code, running tests, updating status — until the entire feature is done.
132
+
133
+ ---
134
+
135
+ ## Getting Started
136
+
137
+ ### Installation
138
+
139
+ ```bash
140
+ npm install @kmgeon/taskflow
141
+ ```
142
+
143
+ ### Project Setup
144
+
145
+ ```bash
146
+ task init
147
+ ```
148
+
149
+ This single command configures everything:
150
+
151
+ - `.taskflow/` — Project data (TRDs, tasks, config)
152
+ - `.claude/commands/` — Claude Code skills (symlinked for easy updates)
153
+ - `.claude/settings.local.json` — Plugins ([superpowers](https://github.com/anthropics/claude-code), [ralph-loop](https://github.com/anthropics/claude-code))
154
+ - `.mcp.json` — MCP server for task management tools
155
+ - `CLAUDE.md` — Project-level AI instructions
156
+ - `docs/` — Development guidelines (clean code, TDD, security, etc.)
157
+
158
+ Skills are installed as **symlinks** from `.claude/commands/` → `.taskflow/.claude/commands/`. This means:
159
+ - `task init` can update skill templates without overwriting your customizations
160
+ - You can edit skills in `.taskflow/.claude/commands/` and they're instantly available
161
+ - Everything stays in version control
162
+
163
+ ### First Feature
164
+
165
+ ```bash
166
+ # In Claude Code
167
+ /t-create
168
+
169
+ # In terminal
170
+ task run
171
+ ```
172
+
173
+ ---
174
+
175
+ ## How It Works
176
+
177
+ ### Step 1: `/t-create` — Define what to build
178
+
179
+ Run `/t-create` in Claude Code. The AI will guide you through a structured brainstorming process:
180
+
181
+ ```
182
+ $ /t-create
183
+
184
+ ? What do you want to build?
185
+ > User authentication with JWT and refresh tokens
186
+
187
+ ? Who uses this feature?
188
+ A. End users (login/logout)
189
+ B. Admin users (user management)
190
+ C. Both
191
+ > C
192
+
193
+ ? Any technical constraints?
194
+ > Must work with existing Supabase setup
195
+
196
+ 💡 Three approaches:
197
+
198
+ A. (Recommended) Supabase Auth native — leverage built-in auth
199
+ + Zero custom code for core auth
200
+ - Limited customization
201
+
202
+ B. Custom JWT + Supabase as DB only
203
+ + Full control
204
+ - More code to maintain
205
+
206
+ C. NextAuth.js wrapper
207
+ + Large ecosystem
208
+ - Extra dependency
209
+
210
+ ? Which approach: A
211
+
212
+ 📝 Writing TRD section by section...
213
+ ✔ Overview — approved
214
+ ✔ User Scenarios — approved
215
+ ✔ Technical Design — approved
216
+ ✔ Success Criteria — approved
217
+
218
+ ✅ TRD saved: .taskflow/trd-auth-system.md
219
+ ```
220
+
221
+ The result is a detailed, approved spec — not a vague ticket.
222
+
223
+ ### Step 2: `task run` — Build it automatically
224
+
225
+ ```
226
+ $ task run
227
+
228
+ 📋 TRD list:
229
+
230
+ 1. auth system (trd-auth-system.md)
231
+ 2. notification (trd-notification.md)
232
+
233
+ ? Select TRD to implement: 1
234
+
235
+ 🚀 "auth system" — auto-implementation started.
236
+ ✔ Ralph Loop configured.
237
+
238
+ Next: Open Claude Code. The loop will begin automatically.
239
+ Stop: /ralph-loop:cancel-ralph
240
+ ```
241
+
242
+ Ralph Loop takes over:
243
+ 1. Reads your TRD
244
+ 2. Decomposes it into implementation tasks (via MCP `create_task`)
245
+ 3. Picks the first task, sets status to `InProgress`, implements it
246
+ 4. Marks it `Done`, picks the next one
247
+ 5. Repeats until all tasks are complete
248
+
249
+ You can watch the progress:
250
+
251
+ ```
252
+ $ task list
253
+
254
+ 📋 Feature progress:
255
+
256
+ ██████░░░░ auth system 60% 3/5 · 1 in progress
257
+ ░░░░░░░░░░ notification 0% 0/3
258
+ ██████████ onboarding 100% done
259
+ ```
260
+
261
+ ---
262
+
263
+ ## CLI Reference
264
+
265
+ ### Core Workflow
266
+
267
+ | Command | Description |
268
+ |:-------------|:-----------------------------------------------------------|
269
+ | `task init` | Initialize project — installs skills, plugins, MCP config |
270
+ | `task run` | Select a TRD and auto-implement all tasks via Ralph Loop |
271
+
272
+ ### Monitoring
273
+
274
+ | Command | Description |
275
+ |:----------------------------|:---------------------------------------|
276
+ | `task list` | Feature progress by group |
277
+ | `task list --detail` | All individual tasks |
278
+ | `task list --detail <name>` | Tasks for a specific feature group |
279
+ | `task board` | Kanban board grouped by feature |
280
+ | `task board --detail` | Full kanban with all tasks |
281
+ | `task tree` | Dependency tree grouped by feature |
282
+ | `task tree --detail` | Full dependency tree |
283
+
284
+ ### Task Management
285
+
286
+ | Command | Description |
287
+ |:---------------------------------|:-------------------------|
288
+ | `task show <id>` | View task details |
289
+ | `task set-status <id> <status>` | Change task status |
290
+
291
+ ### Utilities
292
+
293
+ | Command | Description |
294
+ |:----------------|:-----------------------------|
295
+ | `task ask` | Ask AI about your project |
296
+ | `task advisor` | Manage AI advisor database |
297
+
298
+ ---
299
+
300
+ ## Skills
301
+
302
+ Skills are Claude Code slash commands that run inside your editor. Installed automatically by `task init`.
303
+
304
+ | Skill | Purpose |
305
+ |:--------------|:-----------------------------------------|
306
+ | `/t-create` | Brainstorm requirements → write TRD spec |
307
+ | `/prd` | Interactive PRD (Product Requirements) |
308
+ | `/trd` | Technical implementation plan from PRD |
309
+
310
+ Skills live in `.taskflow/.claude/commands/` and are symlinked to `.claude/commands/` so Claude Code can discover them. You can customize any skill by editing the markdown file directly.
311
+
312
+ ---
313
+
314
+ ## Architecture
315
+
316
+ ### File Structure
317
+
318
+ ```
319
+ .taskflow/
320
+ ├── config.json # Project settings
321
+ ├── trd-auth-system.md # TRD specs (one per feature)
322
+ ├── trd-notification.md
323
+ ├── tasks/
324
+ │ ├── task-001.md # Individual tasks (auto-generated)
325
+ │ ├── task-002.md
326
+ │ └── ...
327
+ ├── .claude/
328
+ │ └── commands/
329
+ │ ├── t-create.md # Skill: brainstorm + TRD
330
+ │ ├── prd.md # Skill: PRD creation
331
+ │ └── trd.md # Skill: technical plan
332
+ └── index/
333
+ └── TASKS.md # Auto-generated task index
334
+
335
+ .claude/
336
+ ├── commands/ # Symlinks → .taskflow/.claude/commands/
337
+ │ ├── t-create.md → ../../.taskflow/.claude/commands/t-create.md
338
+ │ └── ...
339
+ └── settings.local.json # Plugins: superpowers, ralph-loop
340
+
341
+ .mcp.json # MCP server config (TaskFlow tools)
342
+ CLAUDE.md # Project instructions for AI
343
+ ```
344
+
345
+ ### Data Flow
346
+
347
+ ```
348
+ /t-create (Claude Code skill)
349
+
350
+ │ writes
351
+
352
+ .taskflow/trd-*.md (spec)
353
+
354
+ │ task run reads
355
+
356
+ Ralph Loop (auto-implementation)
357
+
358
+ │ creates via MCP
359
+
360
+ .taskflow/tasks/task-*.md (tasks)
361
+
362
+ │ implements & updates status
363
+
364
+ Working code
365
+ ```
366
+
367
+ ### Plugin Integration
368
+
369
+ TaskFlow configures two Claude Code plugins at the project level:
370
+
371
+ - **[superpowers](https://github.com/anthropics/claude-code)** — Brainstorming, systematic debugging, TDD, code review workflows
372
+ - **[ralph-loop](https://github.com/anthropics/claude-code)** — Autonomous loop that repeats a prompt until completion
373
+
374
+ These are set in `.claude/settings.local.json` — project-scoped, not global.
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { dirname, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const root = resolve(__dirname, "..");
9
+ const entry = resolve(root, "src/mcp/index.ts");
10
+ const tsx = resolve(root, "node_modules/.bin/tsx");
11
+
12
+ const child = spawn(tsx, [entry], {
13
+ stdio: "inherit",
14
+ cwd: process.cwd(),
15
+ });
16
+
17
+ child.on("exit", (code) => {
18
+ process.exit(code ?? 0);
19
+ });
package/bin/task.mjs ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execFileSync } from "node:child_process";
4
+ import { dirname, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const root = resolve(__dirname, "..");
9
+ const entry = resolve(root, "src/cli/index.ts");
10
+ const tsx = resolve(root, "node_modules/.bin/tsx");
11
+
12
+ try {
13
+ execFileSync(tsx, [entry, ...process.argv.slice(2)], {
14
+ stdio: "inherit",
15
+ cwd: process.cwd(),
16
+ });
17
+ } catch (error) {
18
+ process.exitCode = error.status ?? 1;
19
+ }
@@ -0,0 +1,29 @@
1
+ # Clean Code Guidelines
2
+
3
+ ## Principles
4
+ - **Single Responsibility**: One function/module = one job
5
+ - **DRY**: Extract only when duplicated 3+ times. Premature abstraction is worse than duplication
6
+ - **KISS**: Simplest solution that works. No over-engineering
7
+ - **YAGNI**: Don't build what you don't need yet
8
+
9
+ ## Functions
10
+ - Max 20 lines per function (guideline, not hard rule)
11
+ - Max 3 parameters. Use an options object for more
12
+ - Name functions with verbs: `createTask`, `parseMarkdown`, `validateInput`
13
+ - Early return over nested conditionals
14
+
15
+ ## Error Handling
16
+ - Use custom error classes per domain (`TaskNotFoundError`, `ValidationError`)
17
+ - Let errors bubble up — catch only at boundaries (API routes, CLI commands)
18
+ - Never swallow errors silently
19
+
20
+ ## Types
21
+ - Prefer `type` over `interface` for consistency (unless extending)
22
+ - Use Zod schemas as single source of truth; derive types with `z.infer<>`
23
+ - Avoid `any` — use `unknown` and narrow
24
+
25
+ ## Code Smells to Avoid
26
+ - God files (>300 lines) — split by responsibility
27
+ - Boolean parameters — use named options or separate functions
28
+ - Magic strings/numbers — use constants or enums
29
+ - Commented-out code — delete it, git has history
package/docs/git.md ADDED
@@ -0,0 +1,36 @@
1
+ # Git Conventions
2
+
3
+ ## Branch Naming
4
+ ```
5
+ feat/{description} # New feature
6
+ fix/{description} # Bug fix
7
+ refactor/{description} # Refactoring
8
+ docs/{description} # Documentation
9
+ chore/{description} # Maintenance
10
+ ```
11
+
12
+ ## Commit Messages
13
+ Follow Conventional Commits:
14
+ ```
15
+ type(scope): description
16
+
17
+ feat(kanban): add drag-and-drop task reordering
18
+ fix(cli): handle missing config file gracefully
19
+ refactor(core): extract task validation logic
20
+ test(prd): add parser edge case coverage
21
+ ```
22
+
23
+ ### Types
24
+ - `feat` — new feature
25
+ - `fix` — bug fix
26
+ - `refactor` — code restructuring (no behavior change)
27
+ - `test` — adding/updating tests
28
+ - `docs` — documentation only
29
+ - `chore` — build, deps, config changes
30
+ - `style` — formatting (no logic change)
31
+
32
+ ## Rules
33
+ - Commit small, atomic changes
34
+ - Never commit secrets, `.env` files, or credentials
35
+ - Keep commits buildable — don't break the build mid-branch
36
+ - Squash WIP commits before PR
@@ -0,0 +1,25 @@
1
+ # Project Guideline
2
+
3
+ ## Naming Conventions
4
+ - **Files**: kebab-case (`parse-prd-flow.ts`)
5
+ - **Components**: PascalCase (`TaskCard.tsx`)
6
+ - **Functions/Variables**: camelCase
7
+ - **Types/Interfaces**: PascalCase
8
+ - **Constants**: UPPER_SNAKE_CASE
9
+ - **Test files**: `*.test.ts` or `__tests__/*.test.ts` (co-located)
10
+
11
+ ## Import Conventions
12
+ - Use path alias (`@/*` etc.) when available — avoid deep relative paths
13
+ - Group imports: external → internal → relative
14
+ - No circular imports between modules/features
15
+
16
+ ## Module Structure
17
+ - Keep modules self-contained: co-locate related code (logic, types, tests)
18
+ - Separate concerns by layer (API, UI, business logic)
19
+ - Shared code belongs in `lib/` or `utils/` — not inside a feature module
20
+
21
+ ## General Principles
22
+ - Prefer composition over inheritance
23
+ - Keep public API surface small — export only what's needed
24
+ - Avoid god files (>300 lines) — split by responsibility
25
+ - Configuration and constants belong in dedicated files, not scattered inline
@@ -0,0 +1,32 @@
1
+ # Security Guidelines
2
+
3
+ ## Authentication & Authorization
4
+ - All API routes must verify authentication
5
+ - Validate user session on every request — never trust client-side auth state
6
+ - Use row-level or resource-level access control for data isolation
7
+
8
+ ## Input Validation
9
+ - Validate ALL external input with schemas at the boundary
10
+ - Never trust query params, request bodies, or URL params directly
11
+ - Sanitize user-generated content before rendering (XSS prevention)
12
+
13
+ ## Secrets Management
14
+ - Store secrets in environment variables only
15
+ - Never commit `.env`, API keys, or credentials
16
+ - Use `.env.local` for local development (ensure it's in `.gitignore`)
17
+
18
+ ## API Security
19
+ - Use parameterized queries — never concatenate user input into queries
20
+ - Rate limit public endpoints
21
+ - Return generic error messages to clients — log details server-side
22
+
23
+ ## Dependencies
24
+ - Keep dependencies up to date
25
+ - Review new dependencies before adding (check maintenance, size, security)
26
+ - Run security audits periodically
27
+
28
+ ## What to Never Do
29
+ - Expose internal error stacks to clients
30
+ - Store passwords in plain text
31
+ - Use `eval()` or dynamic code execution with user input
32
+ - Disable strict type checks for convenience
@@ -0,0 +1,29 @@
1
+ # Step-by-Step Development Workflow
2
+
3
+ ## Before Writing Code
4
+ 1. **Understand the requirement** — Read the task/PRD thoroughly
5
+ 2. **Check existing code** — Search for related implementations before creating new ones
6
+ 3. **Plan the approach** — Identify which files to modify and what tests to write
7
+
8
+ ## Implementation Flow
9
+ 1. **Write the test** — Define expected behavior first
10
+ 2. **Write minimal code** — Just enough to pass the test
11
+ 3. **Refactor** — Clean up while tests stay green
12
+ 4. **Verify** — Run full test suite (`npm run test`)
13
+ 5. **Type check** — Run `npm run typecheck`
14
+ 6. **Lint** — Run `npm run lint`
15
+
16
+ ## PR Checklist
17
+ - [ ] Tests pass (`npm run test`)
18
+ - [ ] Type check passes (`npm run typecheck`)
19
+ - [ ] No lint errors (`npm run lint`)
20
+ - [ ] New code has test coverage
21
+ - [ ] Commit messages follow conventions
22
+ - [ ] No secrets or .env files committed
23
+
24
+ ## Debugging
25
+ 1. Read the error message carefully
26
+ 2. Reproduce the issue with a test
27
+ 3. Identify root cause (don't just patch symptoms)
28
+ 4. Fix and verify the test passes
29
+ 5. Check for similar issues elsewhere