100 lines
3.0 KiB
Markdown
100 lines
3.0 KiB
Markdown
# Phase 4
|
|
|
|
## Step 1 — Deep codebase analysis
|
|
|
|
Use the Agent tool with `model: "haiku"` and `subagent_type: "Explore"` with thoroughness "very thorough" to:
|
|
- Map every file that will be created or modified
|
|
- Identify dependency order between changes
|
|
- Find existing test patterns
|
|
- Note migration requirements
|
|
|
|
## Step 2 — Create plan
|
|
|
|
Use the Agent tool with `model: "opus"` and `subagent_type: "general-purpose"` to design the implementation plan based on:
|
|
- The feature description from the `<!-- status:ready -->` comment
|
|
- Full Q&A history from all session comments
|
|
- Codebase exploration results
|
|
- The project's existing patterns (DDD layers, aggregate repos, hand-written SQL, Watermill messaging, etc.)
|
|
|
|
The plan must produce content for three wiki page types (see `templates/` for format):
|
|
|
|
### Feature page content
|
|
- Problem summary
|
|
- Design decisions
|
|
- Task dependency graph (ASCII)
|
|
- Tasks table with IDs and titles
|
|
|
|
### Sub-task pages content (one per task: T01, T02, ...)
|
|
- Description of what the task accomplishes
|
|
- Files created/modified
|
|
- Dependencies and parallel tasks
|
|
- Detailed changes with code sketches
|
|
|
|
## Step 3 — Clone/pull wiki repo
|
|
|
|
Follow `references/wiki-git.md` setup instructions:
|
|
|
|
```bash
|
|
set -a; source .claude/.env; set +a
|
|
WIKI_URL="https://${GITEA_USER}:${GITEA_ACCESS_TOKEN}@${GITEA_HOST#https://}/${owner}/${repo}.wiki.git"
|
|
|
|
if [ -d .wiki/.git ]; then
|
|
git -C .wiki pull --rebase
|
|
else
|
|
git clone "$WIKI_URL" .wiki 2>/dev/null || {
|
|
mkdir -p .wiki && git -C .wiki init && git -C .wiki remote add origin "$WIKI_URL"
|
|
}
|
|
fi
|
|
```
|
|
|
|
## Step 4 — Write wiki pages
|
|
|
|
Wiki page naming:
|
|
- **Feature page**: `feature-<issue_number>-<slug>.md` where `<slug>` is kebab-case issue title (max 40 chars)
|
|
- **Sub-task pages**: `feature-<issue_number>-<slug>-t<NN>.md` (e.g. `feature-12-user-auth-t01.md`)
|
|
|
|
Write all pages as markdown files in `.wiki/` using the Write tool:
|
|
- Feature page from `templates/feature.md`
|
|
- Each sub-task page from `templates/subtask.md`
|
|
|
|
## Step 5 — Update Home wiki page
|
|
|
|
If `.wiki/Home.md` does not exist, create it using `templates/readme.md` format with the current feature as the first row.
|
|
|
|
If it exists, read it and append a new row for this feature to the table.
|
|
|
|
Feature table row format:
|
|
```
|
|
| <issue_number> | [<title>](<issue_url>) | Planning | [Wiki](<feature_wiki_url>) |
|
|
```
|
|
|
|
## Step 6 — Publish wiki
|
|
|
|
Commit and push all pages atomically:
|
|
|
|
```bash
|
|
git -C .wiki add -A
|
|
git -C .wiki commit -m "feat(wiki): publish plan for issue #${issue_number}"
|
|
git -C .wiki push -u origin main
|
|
```
|
|
|
|
## Step 7 — Post plan link as comment
|
|
|
|
Construct wiki URLs: `https://$GITEA_HOST/$owner/$repo/wiki/<page-name>` (page-name = filename without `.md`).
|
|
|
|
Post a comment on the issue via `mcp__gitea__create_issue_comment` (or `tea` fallback):
|
|
|
|
```markdown
|
|
<!-- mpns-feature-bot -->
|
|
# Implementation Plan
|
|
|
|
Published to wiki: [<feature-page-name>](<feature-wiki-url>)
|
|
|
|
## Tasks
|
|
- [ ] T01: [<task title>](<t01-wiki-url>)
|
|
- [ ] T02: [<task title>](<t02-wiki-url>)
|
|
...
|
|
```
|
|
|
|
Tell the user: "Implementation plan published to wiki. Link posted on the issue."
|