feinai 0.5.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/CHANGELOG.md +41 -0
- package/README.md +230 -0
- package/package.json +60 -0
- package/skills/feinai-dispatch/SKILL.md +233 -0
- package/skills/feinai-implement/SKILL.md +133 -0
- package/skills/feinai-sdd/SKILL.md +291 -0
- package/skills/feinai-write-spec/SKILL.md +178 -0
- package/skills/feinai-write-tasks/SKILL.md +183 -0
- package/src/agents-status.ts +26 -0
- package/src/cli.ts +885 -0
- package/src/dashboard.html +1701 -0
- package/src/dashboard.ts +3 -0
- package/src/db.ts +221 -0
- package/src/format.ts +166 -0
- package/src/opengit.sh +117 -0
- package/src/server.ts +749 -0
- package/src/specs.ts +289 -0
- package/src/sqlite-adapter.ts +130 -0
- package/src/tasks.ts +415 -0
- package/src/worktree-status.ts +97 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feinai-implement
|
|
3
|
+
description: Use when a feinai task needs to be executed. Claims one pending task from tasca, implements it in an isolated worktree, runs quality gates, and pushes to main. Designed to be dispatched by feinai-dispatch or run standalone for a single task.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# feinai-implement
|
|
7
|
+
|
|
8
|
+
Claim one pending task from tasca, implement it in an isolated worktree, run quality gates, push to main.
|
|
9
|
+
|
|
10
|
+
## Preconditions
|
|
11
|
+
|
|
12
|
+
1. `feinai status` succeeds and there is at least one pending task
|
|
13
|
+
2. Current working directory is a clean git repo
|
|
14
|
+
3. `feinai git status` works (feinai git is bundled with tasca — no separate setup needed)
|
|
15
|
+
|
|
16
|
+
If any fails: stop and report. Do not improvise.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## AL ARRANCAR
|
|
21
|
+
|
|
22
|
+
1. `feinai list --pending --json` — encontrá la primera tarea disponible (sin blockers pendientes)
|
|
23
|
+
2. Si no hay ninguna → respondé "No hay tareas pendientes" y pará
|
|
24
|
+
3. `feinai take <TASK-ID> --owner implement-agent` — tomala atómicamente
|
|
25
|
+
4. Si la tarea tiene `spec_id` → `feinai spec content <SPEC-ID>` para contexto
|
|
26
|
+
5. Si la tarea tiene `blocked_by` con tareas no completadas → soltá con `feinai release <TASK-ID>` y pará
|
|
27
|
+
|
|
28
|
+
Leé `AGENTS.md` del proyecto para arquitectura y convenciones del proyecto específico.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Ejecutar la tarea
|
|
33
|
+
|
|
34
|
+
**Paso 1 — Worktree aislado:**
|
|
35
|
+
```bash
|
|
36
|
+
feinai git worktree add .worktrees/<TASK-ID> origin/main
|
|
37
|
+
cd .worktrees/<TASK-ID>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Paso 2 — Setup del worktree:**
|
|
41
|
+
Instalá dependencias si el proyecto las requiere. Consultá `AGENTS.md` del proyecto para el comando exacto.
|
|
42
|
+
|
|
43
|
+
**Paso 3 — Leer antes de escribir:**
|
|
44
|
+
- La descripción completa de la tarea (`feinai show <TASK-ID>`)
|
|
45
|
+
- Los archivos que vas a tocar — léelos antes de editarlos
|
|
46
|
+
- Si hay un **Workplan** en la descripción → ejecutá esos pasos en ese orden exacto
|
|
47
|
+
|
|
48
|
+
**Paso 4 — Implementar:**
|
|
49
|
+
Exactamente lo que dice la tarea. Ni más ni menos.
|
|
50
|
+
- No toques archivos fuera del scope de la tarea
|
|
51
|
+
- Si un archivo "a crear" ya existe → extendelo en lugar de sobrescribirlo si ya tiene contenido válido
|
|
52
|
+
|
|
53
|
+
**Paso 5 — Commit:**
|
|
54
|
+
Un commit por tarea. Conventional commits:
|
|
55
|
+
```
|
|
56
|
+
feat(scope): descripción concisa
|
|
57
|
+
```
|
|
58
|
+
Tipos: `feat`, `fix`, `refactor`, `test`, `chore`.
|
|
59
|
+
|
|
60
|
+
**Paso 6 — Quality gates:**
|
|
61
|
+
Corré los gates definidos en la tarea (`quality_gates`). Si la tarea no los especifica, consultá `AGENTS.md` del proyecto para los gates por defecto.
|
|
62
|
+
|
|
63
|
+
**Paso 7 — Cerrar:**
|
|
64
|
+
|
|
65
|
+
Gates pasan:
|
|
66
|
+
```bash
|
|
67
|
+
# Desde el worktree:
|
|
68
|
+
feinai git push origin HEAD:main
|
|
69
|
+
|
|
70
|
+
# Desde la raíz del repo:
|
|
71
|
+
feinai git worktree remove .worktrees/<TASK-ID>
|
|
72
|
+
feinai git complete
|
|
73
|
+
|
|
74
|
+
feinai done <TASK-ID> --result "gates ✓"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Gates fallan → seguí "Si algo falla".
|
|
78
|
+
|
|
79
|
+
**Done = 3 hechos observables:**
|
|
80
|
+
1. Quality gates pasan sin errores
|
|
81
|
+
2. Los archivos de la tarea existen con contenido correcto
|
|
82
|
+
3. Commit limpio en `main` y tarea en estado `completed` en tasca
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Si algo falla
|
|
87
|
+
|
|
88
|
+
Gates fallan, push falla, o error en cualquier paso:
|
|
89
|
+
|
|
90
|
+
1. **No limpies el worktree**
|
|
91
|
+
2. Push a rama backup:
|
|
92
|
+
```bash
|
|
93
|
+
feinai git push origin HEAD:backup/<TASK-ID>
|
|
94
|
+
```
|
|
95
|
+
3. Marcá la tarea como fallida:
|
|
96
|
+
```bash
|
|
97
|
+
feinai fail <TASK-ID> --error "<comando exacto + output relevante>"
|
|
98
|
+
```
|
|
99
|
+
4. Dejá el worktree intacto para recuperación manual
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Git — `feinai git` exclusivamente
|
|
104
|
+
|
|
105
|
+
`git` y `gh` están bloqueados. Usá `feinai git` para todo — es opengit bundleado con tasca.
|
|
106
|
+
|
|
107
|
+
**Permitido:**
|
|
108
|
+
- `feinai git worktree add/list/lock/unlock`
|
|
109
|
+
- `feinai git add`, `commit`, `push`, `status`, `diff`, `log`, `show`
|
|
110
|
+
- `feinai git complete` — sincroniza main local tras push (solo desde raíz del repo)
|
|
111
|
+
|
|
112
|
+
**Prohibido:**
|
|
113
|
+
- `feinai git branch`, `checkout`, `switch` — nunca cambiar branches
|
|
114
|
+
- `feinai git merge`, `rebase`, `reset`, `cherry-pick`
|
|
115
|
+
- `feinai git fetch`, `pull`, `remote`, `clone`
|
|
116
|
+
- `feinai git stash`, `tag`
|
|
117
|
+
- `feinai git worktree remove` — solo tras push exitoso
|
|
118
|
+
|
|
119
|
+
Si `feinai git` falla → **STOP**. No reintentes, no uses `git`. Reportá al usuario.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Reglas absolutas
|
|
124
|
+
|
|
125
|
+
**No modifiques:**
|
|
126
|
+
- `AGENTS.md`, `CLAUDE.md`
|
|
127
|
+
- Archivos de configuración de CI/CD, infra, o secretos (`.env`, `.env.*`)
|
|
128
|
+
- La DB de tasca directamente
|
|
129
|
+
|
|
130
|
+
**Código:**
|
|
131
|
+
- Sin `any` sin comentario justificado en la misma línea
|
|
132
|
+
- Si un test falla: corregí el test O la implementación. Nunca silencies, skipees, ni agregues workarounds para que el gate "pase"
|
|
133
|
+
- Si no es obvio cuál es la causa → **STOP**, reportá al usuario con el comando exacto y el output completo
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feinai-sdd
|
|
3
|
+
description: Use when working in spec-driven development (SDD) workflows that involve brainstorming, writing-plans, or subagent-driven-development AND the project has a `.tasca/tasca.db` file. Replaces creating markdown files in `docs/superpowers/specs/` and `docs/superpowers/plans/` with atomic `feinai` CLI calls, keeping state queryable, race-free, and audit-logged. Also use when the user asks to create a spec, add a task, claim work, or mark progress, in a project that uses tasca.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tasca SDD integration
|
|
7
|
+
|
|
8
|
+
`feinai` is a CLI + local SQLite database for managing specs, plans, and tasks in
|
|
9
|
+
SDD workflows. When a project has `.tasca/tasca.db`, you should write to that
|
|
10
|
+
database instead of producing markdown files under `docs/superpowers/`.
|
|
11
|
+
|
|
12
|
+
This skill extends superpowers — it does not replace it. You still follow the
|
|
13
|
+
SDD process (brainstorming → writing-plans → subagent-driven-development); you
|
|
14
|
+
just change *where the artifacts get stored*.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## When to use this skill
|
|
19
|
+
|
|
20
|
+
Invoke when **all** of the following are true:
|
|
21
|
+
|
|
22
|
+
1. The project has a `.tasca/tasca.db` file (walk up the directory tree from
|
|
23
|
+
the current working directory; tasca uses the same discovery pattern as git).
|
|
24
|
+
Check with: `feinai status` (exit code 0 = tasca is set up).
|
|
25
|
+
2. You are about to:
|
|
26
|
+
- Write a spec via the `brainstorming` skill, OR
|
|
27
|
+
- Write a plan via the `writing-plans` skill, OR
|
|
28
|
+
- Execute tasks via `subagent-driven-development` or `executing-plans`, OR
|
|
29
|
+
- The user explicitly mentions creating/claiming/marking tasks or specs.
|
|
30
|
+
|
|
31
|
+
If `.tasca/tasca.db` does not exist, skip this skill — let superpowers do its
|
|
32
|
+
normal markdown-based flow.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Detection (do this first)
|
|
37
|
+
|
|
38
|
+
Before any spec / plan / task write, run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
feinai status 2>/dev/null
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- Exit code 0: tasca is active in this project → use this skill.
|
|
45
|
+
- Exit code 2: `No .tasca/tasca.db found` → fall back to vanilla superpowers
|
|
46
|
+
(or ask the user `feinai init` if it seems intended).
|
|
47
|
+
- Command not found: tasca is not installed. Tell the user and stop.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Phase 1 — Brainstorming → `feinai spec add`
|
|
52
|
+
|
|
53
|
+
When `brainstorming` would write to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`,
|
|
54
|
+
instead create a spec entry in feinai with the same content.
|
|
55
|
+
|
|
56
|
+
**Spec ID convention:** `SPEC-NNN` where `NNN` is the next free integer.
|
|
57
|
+
Find the next number with:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
feinai spec list --json | jq -r '.[].numero' | sort -n | tail -1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
(or just inspect the list — the next number is `max + 1`.)
|
|
64
|
+
|
|
65
|
+
### Pattern — create the spec
|
|
66
|
+
|
|
67
|
+
Use stdin for the markdown content to avoid quoting issues:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
feinai spec add SPEC-042 "Short title" --stdin <<'FEINAI_EOF'
|
|
71
|
+
# SPEC-042: Short title
|
|
72
|
+
|
|
73
|
+
## Goal
|
|
74
|
+
One sentence describing what this builds.
|
|
75
|
+
|
|
76
|
+
## Architecture
|
|
77
|
+
2-3 sentences about approach.
|
|
78
|
+
|
|
79
|
+
## Components
|
|
80
|
+
- ...
|
|
81
|
+
|
|
82
|
+
## Tests
|
|
83
|
+
- ...
|
|
84
|
+
FEINAI_EOF
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### What replaces what
|
|
88
|
+
|
|
89
|
+
| Superpowers step | tasca equivalent |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `Write(docs/superpowers/specs/YYYY-MM-DD-X-design.md, ...)` | `feinai spec add SPEC-NNN "title" --stdin <<<` content |
|
|
92
|
+
| Spec self-review (re-read the markdown) | `feinai spec content SPEC-NNN` (returns the markdown) |
|
|
93
|
+
| User reviews written spec | Same — but they can also use `feinai server` and open the dashboard |
|
|
94
|
+
| Refining the spec | `feinai spec set-content SPEC-NNN --stdin <<<` updated content |
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Phase 2 — Writing-plans → `feinai plan add` + `feinai add`
|
|
99
|
+
|
|
100
|
+
When `writing-plans` would write a plan file with checkbox tasks, do **two**
|
|
101
|
+
things in feinai:
|
|
102
|
+
|
|
103
|
+
1. **Store the plan markdown** for the human/agent reference.
|
|
104
|
+
2. **Create individual tasks** as structured rows so subagents can claim them.
|
|
105
|
+
|
|
106
|
+
### Pattern — store the plan
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
feinai plan add SPEC-042 --stdin <<'FEINAI_EOF'
|
|
110
|
+
# Implementation plan for SPEC-042
|
|
111
|
+
|
|
112
|
+
## Architecture
|
|
113
|
+
...
|
|
114
|
+
|
|
115
|
+
## Task breakdown
|
|
116
|
+
- TASK-042-A: schema (touches packages/auth)
|
|
117
|
+
- TASK-042-B: routes (depends on A)
|
|
118
|
+
- TASK-042-C: tests (depends on A, B)
|
|
119
|
+
FEINAI_EOF
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Plans are versioned automatically; `feinai plan add` always creates a new
|
|
123
|
+
version (`v1`, `v2`, ...). Use this when refining a plan after review.
|
|
124
|
+
|
|
125
|
+
### Pattern — create each task
|
|
126
|
+
|
|
127
|
+
For every numbered task in the plan, create a row. Pass the task's workplan
|
|
128
|
+
markdown as `--desc`:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
feinai add TASK-042-A "Create auth schema" \
|
|
132
|
+
--spec SPEC-042 \
|
|
133
|
+
--desc "Define Drizzle schema for users table with email, password_hash, refresh_token columns. See specs/042-auth for column types." \
|
|
134
|
+
--package "@app/auth" \
|
|
135
|
+
--gate "pnpm --filter @app/auth typecheck" \
|
|
136
|
+
--gate "pnpm --filter @app/auth test -- --run"
|
|
137
|
+
|
|
138
|
+
feinai add TASK-042-B "Add auth routes" \
|
|
139
|
+
--spec SPEC-042 \
|
|
140
|
+
--desc "POST /auth/login, POST /auth/refresh, POST /auth/logout. Validate via TypeBox." \
|
|
141
|
+
--package "@app/auth" \
|
|
142
|
+
--gate "pnpm --filter @app/auth typecheck" \
|
|
143
|
+
--gate "pnpm --filter @app/auth test -- --run" \
|
|
144
|
+
--blocked-by TASK-042-A
|
|
145
|
+
|
|
146
|
+
feinai add TASK-042-C "Integration tests" \
|
|
147
|
+
--spec SPEC-042 \
|
|
148
|
+
--desc "End-to-end flow: register → login → refresh → logout." \
|
|
149
|
+
--package "@app/auth" \
|
|
150
|
+
--gate "pnpm --filter @app/auth test -- --run" \
|
|
151
|
+
--blocked-by TASK-042-A \
|
|
152
|
+
--blocked-by TASK-042-B
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Why each task lives in feinai instead of a checkbox in markdown
|
|
156
|
+
|
|
157
|
+
A subagent claiming `TASK-042-A` calls `feinai take TASK-042-A` and gets, in a
|
|
158
|
+
single response, the full payload: `description` (workplan), `quality_gates`,
|
|
159
|
+
`packages`, `blocked_by`. **The subagent never has to read the plan markdown.**
|
|
160
|
+
|
|
161
|
+
This is the single biggest token saving and the strongest correctness
|
|
162
|
+
guarantee from using tasca: each subagent's context contains exactly the task
|
|
163
|
+
it's executing, nothing else.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Phase 3 — Subagent-driven-development → `feinai take` + `feinai done`
|
|
168
|
+
|
|
169
|
+
When dispatching subagents, instruct each one to:
|
|
170
|
+
|
|
171
|
+
1. Call `feinai take TASK-XXX` to atomically claim the task.
|
|
172
|
+
2. Use the returned JSON for everything it needs:
|
|
173
|
+
- `description` — workplan
|
|
174
|
+
- `packages` — what to touch
|
|
175
|
+
- `quality_gates` — what to verify
|
|
176
|
+
- `spec_id` — context if needed (`feinai spec content SPEC-XXX`)
|
|
177
|
+
3. Run the gates and write the code.
|
|
178
|
+
4. Call `feinai done TASK-XXX --result "typecheck ✓ lint ✓ test ✓"` (or
|
|
179
|
+
`feinai fail TASK-XXX --error "..."` if gates fail).
|
|
180
|
+
|
|
181
|
+
### Subagent prompt template
|
|
182
|
+
|
|
183
|
+
When you dispatch a subagent for a task, include this in its prompt:
|
|
184
|
+
|
|
185
|
+
> Your task is `TASK-XXX`. Begin by running `feinai take TASK-XXX`. The command
|
|
186
|
+
> returns a JSON object with the full task description, packages to touch, and
|
|
187
|
+
> quality gates to run. Use only that payload — do not read the plan markdown.
|
|
188
|
+
>
|
|
189
|
+
> When you finish the implementation and the quality gates pass, run
|
|
190
|
+
> `feinai done TASK-XXX --result "<gates summary>"`. If the gates fail and you
|
|
191
|
+
> cannot resolve, run `feinai fail TASK-XXX --error "<short reason>"` and stop.
|
|
192
|
+
>
|
|
193
|
+
> You are operating in a worktree at `<path>`. Do not switch branches.
|
|
194
|
+
|
|
195
|
+
### Choosing the next task
|
|
196
|
+
|
|
197
|
+
To find the next task that is **pending** and has no unresolved blockers:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
feinai list --pending --json
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
In JSON output, filter for tasks whose `blocked_by` array is empty or whose
|
|
204
|
+
blockers are all `completed`. Then `feinai take <id>`.
|
|
205
|
+
|
|
206
|
+
Atomic `take` means: if you and another agent both call `feinai take TASK-X` at
|
|
207
|
+
the same time, exactly one of you gets the task and the other gets an error.
|
|
208
|
+
You can dispatch parallel subagents safely.
|
|
209
|
+
|
|
210
|
+
### Marking the spec done
|
|
211
|
+
|
|
212
|
+
When all tasks for a spec are `completed`, mark the spec done:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
feinai spec done SPEC-042 --pr 123 --merged 2026-06-05
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Visibility for the human
|
|
221
|
+
|
|
222
|
+
The user can watch progress live by running `feinai server` in another terminal
|
|
223
|
+
and opening `http://127.0.0.1:8272` in a browser. The dashboard streams events
|
|
224
|
+
via SSE, so they see takes / dones / fails as they happen.
|
|
225
|
+
|
|
226
|
+
If you anticipate the user will want to monitor a long-running multi-task
|
|
227
|
+
workflow, suggest this once at the start of the session.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Common pitfalls
|
|
232
|
+
|
|
233
|
+
### ❌ Don't read the plan markdown to find tasks
|
|
234
|
+
|
|
235
|
+
If you've created tasks via `feinai add`, **never** re-read the plan to figure
|
|
236
|
+
out what to do next. Use `feinai list --pending --json`. The plan is the
|
|
237
|
+
human-readable rationale; the tasks are the executable state.
|
|
238
|
+
|
|
239
|
+
### ❌ Don't create `docs/superpowers/specs/*.md` files
|
|
240
|
+
|
|
241
|
+
If tasca is active, those files become a source of drift. The spec lives in
|
|
242
|
+
the database. If you need to publish the spec elsewhere (PR description, wiki,
|
|
243
|
+
etc.), export it on demand: `feinai spec content SPEC-X > /tmp/spec.md`.
|
|
244
|
+
|
|
245
|
+
### ❌ Don't skip `feinai take` and just read the task
|
|
246
|
+
|
|
247
|
+
`feinai show TASK-X` is read-only and does **not** claim the task. Two
|
|
248
|
+
subagents that both `show` then act will collide. Always `feinai take`.
|
|
249
|
+
|
|
250
|
+
### ❌ Don't try to write to the SQLite file directly
|
|
251
|
+
|
|
252
|
+
The CLI handles concurrency, audit logging, and validation. Direct SQL
|
|
253
|
+
mutations bypass the events table and leave the audit log incomplete.
|
|
254
|
+
|
|
255
|
+
### ✅ Do set `FEINA_USER` for explicit subagent identity
|
|
256
|
+
|
|
257
|
+
When dispatching a subagent, pass `FEINA_USER=subagent-N` in its environment
|
|
258
|
+
so the audit log distinguishes which subagent did what. Otherwise the actor
|
|
259
|
+
field will read `bun:<pid>:<user>` for everyone.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Quick reference
|
|
264
|
+
|
|
265
|
+
| Need | Command |
|
|
266
|
+
|---|---|
|
|
267
|
+
| Is tasca set up here? | `feinai status` |
|
|
268
|
+
| Next pending task | `feinai list --pending --json` |
|
|
269
|
+
| Claim a task atomically | `feinai take TASK-X` |
|
|
270
|
+
| Read a spec | `feinai spec content SPEC-X` |
|
|
271
|
+
| Read the latest plan | `feinai plan show SPEC-X` |
|
|
272
|
+
| Create spec from stdin | `feinai spec add SPEC-X "title" --stdin <<<` markdown |
|
|
273
|
+
| Update spec content | `feinai spec set-content SPEC-X --stdin <<<` markdown |
|
|
274
|
+
| Add a plan version | `feinai plan add SPEC-X --stdin <<<` markdown |
|
|
275
|
+
| Create task | `feinai add TASK-X "subject" --spec SPEC-X --desc "..." --gate "..." --package "..." [--blocked-by TASK-Y]` |
|
|
276
|
+
| Mark task done | `feinai done TASK-X --result "..."` |
|
|
277
|
+
| Mark task failed | `feinai fail TASK-X --error "..."` |
|
|
278
|
+
| Mark spec done | `feinai spec done SPEC-X --pr N --merged DATE` |
|
|
279
|
+
| Live dashboard | `feinai server` then open `http://127.0.0.1:8272` |
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Relationship to superpowers skills
|
|
284
|
+
|
|
285
|
+
This skill is **additive**. The superpowers skills (`brainstorming`,
|
|
286
|
+
`writing-plans`, `subagent-driven-development`, etc.) still run; they still
|
|
287
|
+
own the process. tasca only changes the storage of the artifacts they produce.
|
|
288
|
+
|
|
289
|
+
If you start brainstorming and discover the project has no tasca DB, fall back
|
|
290
|
+
to the normal superpowers behavior (markdown files). Do not silently switch
|
|
291
|
+
storage strategy mid-project.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feinai-write-spec
|
|
3
|
+
description: Use when the user wants to design a new feature, refactor, or change in a project that has `.tasca/tasca.db`. Writes a complete spec + plan into tasca in a single session. Replaces `brainstorming` + `writing-plans` from superpowers when feinai is active. Reads project context (CLAUDE.md, ARCHITECTURE.md, README.md), asks clarifying questions only when context has gaps, and produces spec+plan atomically with one `feinai spec add` + one `feinai plan add`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# feinai-write-spec
|
|
7
|
+
|
|
8
|
+
Write a spec + plan for a feature in one session. Output goes to tasca, not markdown files.
|
|
9
|
+
|
|
10
|
+
## Preconditions
|
|
11
|
+
|
|
12
|
+
Run `feinai status` (exit 0 = tasca is active). If not active, stop and ask the
|
|
13
|
+
user if they want `feinai init` or to fall back to vanilla superpowers.
|
|
14
|
+
|
|
15
|
+
## The flow — three entry modes
|
|
16
|
+
|
|
17
|
+
Decide which entry mode applies BEFORE doing anything else. Ask the user only if ambiguous.
|
|
18
|
+
|
|
19
|
+
### Mode A — User has a clear idea
|
|
20
|
+
"Add X feature to do Y." → proceed to **Phase 2** directly.
|
|
21
|
+
|
|
22
|
+
### Mode B — User has no idea yet
|
|
23
|
+
"What should we build next?" → propose 2–4 candidate features derived from
|
|
24
|
+
BACKLOG.md, recent commits, or the project's stated goals. User picks one.
|
|
25
|
+
→ proceed to **Phase 2**.
|
|
26
|
+
|
|
27
|
+
### Mode C — User gives a tiny idea
|
|
28
|
+
"Add a search bar." → BEFORE expanding, ask: *"Quick scope check: do you want this
|
|
29
|
+
as a minimal change (just the input + endpoint call) or shall I think wider
|
|
30
|
+
(filters, debounce, empty states, mobile UX)?"* User picks. → proceed to **Phase 2**.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Phase 1 — Load project context
|
|
35
|
+
|
|
36
|
+
Read **in this order, stop early if enough**:
|
|
37
|
+
|
|
38
|
+
1. `CLAUDE.md` (root) — already in your context normally
|
|
39
|
+
2. `.claude/ARCHITECTURE.md` or `ARCHITECTURE.md` (root)
|
|
40
|
+
3. `README.md`
|
|
41
|
+
4. `decisions/` directory (just file names, read only if a name matches the topic)
|
|
42
|
+
|
|
43
|
+
If none exist or context is **insufficient or contradictory** for the spec at hand:
|
|
44
|
+
|
|
45
|
+
- **Ask the user** with a short, targeted questionnaire (3–6 questions max)
|
|
46
|
+
- Do not invent or assume. Do not guess architecture.
|
|
47
|
+
- If you have permission, offer to write/update `ARCHITECTURE.md` after the spec is done — but **only ask permission once**, not per file.
|
|
48
|
+
|
|
49
|
+
Keep this phase tight — every read costs tokens. Stop as soon as you can write the spec accurately.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Phase 2 — Draft and write the spec
|
|
54
|
+
|
|
55
|
+
**Spec answers: what and why.** Not how.
|
|
56
|
+
|
|
57
|
+
Required sections:
|
|
58
|
+
- **Goal** — one sentence
|
|
59
|
+
- **Problem / motivation** — why this exists
|
|
60
|
+
- **Scope** — what's in, what's out
|
|
61
|
+
- **Contracts** — API shapes, data model changes, UI invariants (whichever apply)
|
|
62
|
+
- **Tests required** — the behavioral cases that must pass
|
|
63
|
+
|
|
64
|
+
**Pick the next SPEC ID:**
|
|
65
|
+
```bash
|
|
66
|
+
feinai spec list --json | jq -r '.[].id' | grep -oE 'SPEC-[0-9]+' | sort -V | tail -1
|
|
67
|
+
# next = max + 1, or follow project convention if user gave one
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Write it atomically:**
|
|
71
|
+
```bash
|
|
72
|
+
feinai spec add SPEC-NNN "Short title" --stdin <<'FEINAI_EOF'
|
|
73
|
+
# SPEC-NNN: Short title
|
|
74
|
+
|
|
75
|
+
## Goal
|
|
76
|
+
...
|
|
77
|
+
|
|
78
|
+
## Problem
|
|
79
|
+
...
|
|
80
|
+
|
|
81
|
+
## Scope
|
|
82
|
+
- In: ...
|
|
83
|
+
- Out: ...
|
|
84
|
+
|
|
85
|
+
## Contracts
|
|
86
|
+
...
|
|
87
|
+
|
|
88
|
+
## Tests required
|
|
89
|
+
- ...
|
|
90
|
+
FEINAI_EOF
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Phase 3 — Draft and write the plan
|
|
96
|
+
|
|
97
|
+
**Plan answers: how.** Architecture decisions, file map, dependencies.
|
|
98
|
+
|
|
99
|
+
Required sections:
|
|
100
|
+
- **Architecture overview** — 2–4 sentences
|
|
101
|
+
- **Files to touch** — explicit list
|
|
102
|
+
- **Task breakdown preview** — high-level (the actual tasks are written by `feinai-write-tasks`)
|
|
103
|
+
- **Quality gates** — the commands that prove correctness
|
|
104
|
+
|
|
105
|
+
**Write the plan:**
|
|
106
|
+
```bash
|
|
107
|
+
feinai plan add SPEC-NNN --stdin <<'FEINAI_EOF'
|
|
108
|
+
# Plan v1 — SPEC-NNN: Title
|
|
109
|
+
|
|
110
|
+
## Architecture overview
|
|
111
|
+
...
|
|
112
|
+
|
|
113
|
+
## Files to touch
|
|
114
|
+
- packages/X/...
|
|
115
|
+
- packages/Y/...
|
|
116
|
+
|
|
117
|
+
## Task breakdown preview
|
|
118
|
+
- TASK-NNN-A: <what>
|
|
119
|
+
- TASK-NNN-B: <what> (blocked by A)
|
|
120
|
+
- ...
|
|
121
|
+
|
|
122
|
+
## Quality gates
|
|
123
|
+
pnpm --filter @X typecheck
|
|
124
|
+
pnpm --filter @X test -- --run
|
|
125
|
+
FEINAI_EOF
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Phase 4 — Hand off
|
|
131
|
+
|
|
132
|
+
Tell the user:
|
|
133
|
+
> Spec + plan written: SPEC-NNN. View with `feinai spec show SPEC-NNN --full`.
|
|
134
|
+
> Next step: run `/feinai-write-tasks SPEC-NNN` to break it down into executable tasks.
|
|
135
|
+
|
|
136
|
+
Do NOT create tasks here. That's `feinai-write-tasks`. One responsibility per skill.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Key questions to ask (during, only if needed)
|
|
141
|
+
|
|
142
|
+
These come up mid-session. Ask them inline, one at a time, brief:
|
|
143
|
+
|
|
144
|
+
- Ambiguity in scope: *"Do we include X in this spec or punt to a follow-up?"*
|
|
145
|
+
- Missing architecture decision: *"This needs a choice between A and B. Default is A unless you say otherwise."*
|
|
146
|
+
- Architecture gap: *"ARCHITECTURE.md doesn't cover X. Want me to add a note after the spec is done?"*
|
|
147
|
+
|
|
148
|
+
**Do not batch questions.** Ask one, get answer, move on. Most specs need 0–2 questions.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## What NOT to do
|
|
153
|
+
|
|
154
|
+
- ❌ Write `docs/superpowers/specs/*.md` files — spec lives in feinai
|
|
155
|
+
- ❌ Create tasks in this skill — that's `feinai-write-tasks`
|
|
156
|
+
- ❌ Invent architecture if `ARCHITECTURE.md` is silent — ask the user
|
|
157
|
+
- ❌ Write spec content that is actually a plan (HOW). Keep them separated.
|
|
158
|
+
- ❌ Ask the user to confirm before writing — write the spec, then they review with `feinai spec show`
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Subagent isolation
|
|
163
|
+
|
|
164
|
+
If you delegate the spec drafting to a subagent (e.g. for parallel research),
|
|
165
|
+
the subagent must NOT use this skill — it has no context. Hand it concrete
|
|
166
|
+
findings and let it return text; you write to tasca yourself.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Quick reference
|
|
171
|
+
|
|
172
|
+
| Need | Command |
|
|
173
|
+
|---|---|
|
|
174
|
+
| Next free SPEC ID | `feinai spec list --json \| jq -r '.[].id'` |
|
|
175
|
+
| Write spec | `feinai spec add SPEC-N "title" --stdin <<<` content |
|
|
176
|
+
| Update spec content | `feinai spec set-content SPEC-N --stdin <<<` content |
|
|
177
|
+
| Write plan | `feinai plan add SPEC-N --stdin <<<` content |
|
|
178
|
+
| Show spec+plan together | `feinai spec show SPEC-N --full` |
|