85 lines
4.3 KiB
Markdown
85 lines
4.3 KiB
Markdown
---
|
||
name: fea
|
||
description: Issue-driven feature planning workflow via Gitea. Reads issue as prompt, discusses requirements via issue comments, publishes implementation plan to wiki. Triggered with /fea owner/repo#number.
|
||
user-invocable: true
|
||
argument-hint: <owner/repo#issue-number>
|
||
---
|
||
|
||
# Issue-Driven Feature Planning Skill
|
||
|
||
You orchestrate a multi-phase feature planning workflow using Gitea issues and wiki. The argument `$ARGUMENTS` is in the format `owner/repo#number` (e.g. `pushok/mpns#12`).
|
||
|
||
Read `.claude/skills/fea/references/gitea-dto.md` before every invocation — it defines which fields to extract from Gitea responses and how to classify comments.
|
||
Read `.claude/skills/fea/references/auth.md` for credential setup — agents must authenticate themselves using project-level `.claude/.env`.
|
||
Read `.claude/skills/fea/references/tea-cli.md` when MCP tools fail — `tea` CLI is the fallback for all Gitea operations.
|
||
Read `.claude/skills/fea/references/wiki-git.md` for wiki operations — wiki is a git repo cloned into `.wiki/` subfolder.
|
||
|
||
## Argument Parsing
|
||
|
||
Parse `$ARGUMENTS` into three variables:
|
||
- `owner` — everything before `/`
|
||
- `repo` — between `/` and `#`
|
||
- `issue_number` — after `#` (integer)
|
||
|
||
If parsing fails, tell the user: "Expected format: `/fea owner/repo#12`"
|
||
|
||
## Authentication
|
||
|
||
Before any Gitea operation, ensure credentials are available:
|
||
|
||
1. Check for `.claude/.env` — if missing, create it with empty values (see `references/auth.md`), add to `.gitignore`, tell user to fill in credentials, and **stop**
|
||
2. Load credentials: `set -a; source .claude/.env; set +a` — if any value is empty, tell user to fill in `.claude/.env` and **stop**
|
||
3. Verify `tea` login exists: `tea login list` — if not, run `tea login add` per `references/auth.md`
|
||
|
||
## Context Loading
|
||
|
||
Every invocation starts by loading context:
|
||
|
||
1. **Fetch issue** via `mcp__gitea__get_issue_by_index` with `owner`, `repo`, `index=issue_number`
|
||
- If MCP fails, fallback: `tea api GET /repos/$owner/$repo/issues/$issue_number`
|
||
2. **Fetch comments** via `mcp__gitea__get_issue_comments_by_index` with `owner`, `repo`, `index=issue_number`
|
||
- If MCP fails, fallback: `tea api GET /repos/$owner/$repo/issues/$issue_number/comments`
|
||
3. **Extract fields** per `references/gitea-dto.md` — discard everything else
|
||
4. **Classify comments** into bot vs user per `references/gitea-dto.md` rules
|
||
|
||
The issue `title` + `body` is the feature prompt (replaces the old `prompt.md`).
|
||
|
||
## Phase Detection
|
||
|
||
Detect the current phase from the comment history:
|
||
|
||
1. **No bot comments at all** → Phase 1: Explore & Ask
|
||
2. **Latest bot comment has `### Questions`, no user comment posted after it** → Phase 2: Waiting for answers
|
||
3. **Latest bot comment has `### Questions`, user comment exists after it** → Phase 3: Process answers
|
||
4. **Latest bot comment has `<!-- status:ready -->`, no plan-published marker** → Phase 4: Generate plan
|
||
5. **Bot comment with `# Implementation Plan` exists** → Done: tell user the plan is already published, show the wiki link
|
||
|
||
## Phase 1: Explore & Ask
|
||
Issue understanding phase described at:
|
||
- `references/phases/phase1-understanding.md`
|
||
|
||
## Phase 2: Waiting for Answers
|
||
|
||
The latest bot comment has questions but no user reply after it. Tell the user:
|
||
"Waiting for your answers on the issue. Reply to the questions comment and re-run `/fea $ARGUMENTS`."
|
||
|
||
## Phase 3: Process Answers
|
||
Conversation reconstruction analyzing and responce phase described at:
|
||
- `references/phases/phase3-conversation.md`
|
||
|
||
## Phase 4: Generate Plan
|
||
Feature planning:
|
||
- `references/phases/phase4-planning.md`
|
||
|
||
## Important Rules
|
||
|
||
- ALWAYS read `references/gitea-dto.md` and extract only listed fields — do not pass raw Gitea JSON to agents
|
||
- Bot comments MUST start with `<!-- mpns-feature-bot -->` on the very first line
|
||
- Session numbering: count existing bot Q&A comments to determine next session number
|
||
- Questions should be thoughtful and specific — 3–7 per session
|
||
- Use Russian where the issue is written in Russian
|
||
- Each session should make meaningful progress toward clarity
|
||
- Wiki pages are written as markdown files in `.wiki/` and published via git push (see `references/wiki-git.md`)
|
||
- Never post duplicate bot comments — check existing comments before posting
|
||
- When posting markdown in comments, ensure code blocks and formatting render correctly on Gitea
|