chore(claude): add YouTrack command suite
Port create-defect, create-story, estimate-issues, fix-defect, implement-feature and split-story commands, adapted for the Angular frontend (npm build/test, prettier gates, NCWF routing). implement-feature now walks subtasks, respects blocked-by, and reports cross-project (NCS/NCI) tasks. Ignore .claude/worktrees. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
# Create Defect in YouTrack
|
||||
|
||||
Automated defect creation workflow. Topic/hint: `$ARGUMENTS`
|
||||
|
||||
This is the **NowChess-Frontend** repo (Angular 20 / TypeScript). Defects raised
|
||||
here usually belong to project `NCWF`, but routing in Step 5 still applies.
|
||||
|
||||
## Step 1 — Gather Context
|
||||
|
||||
Use `AskUserQuestion` tool to ask the user (max 4 questions at once):
|
||||
|
||||
1. **Component** — Where does the bug occur? (e.g. a component, service, route/page, model, styling, API integration)
|
||||
2. **What breaks** — What is the actual (broken) behavior?
|
||||
3. **Expected** — What should happen instead?
|
||||
4. **Reproducibility** — Is it always reproducible? Any known trigger conditions? (route, viewport, browser)
|
||||
|
||||
If `$ARGUMENTS` already answers some of these, skip those questions.
|
||||
|
||||
## Step 2 — Research (if needed)
|
||||
|
||||
If the bug involves component logic, a service, or routing:
|
||||
- Search repo for relevant code (`Grep`/`Bash`) under `src/app/{components,services,models,core,pages}`.
|
||||
- Check `.spec.ts` files for existing coverage of the broken area.
|
||||
- Do NOT guess at root cause. Surface findings before drafting.
|
||||
|
||||
## Step 3 — Draft Defect
|
||||
|
||||
Compose the full defect report using this template:
|
||||
|
||||
```
|
||||
Summary
|
||||
|
||||
[One-sentence description of what is broken.]
|
||||
|
||||
|
||||
Steps to Reproduce
|
||||
|
||||
1. Step one
|
||||
2. Step two
|
||||
3. Step three
|
||||
|
||||
|
||||
Expected Behavior
|
||||
|
||||
[What should happen.]
|
||||
|
||||
|
||||
Actual Behavior
|
||||
|
||||
[What actually happens.]
|
||||
|
||||
|
||||
Environment / Notes
|
||||
|
||||
[Any relevant context: route/URL, viewport, browser, console errors, API payloads — only if applicable.]
|
||||
```
|
||||
|
||||
Rules:
|
||||
- Steps must be minimal and reproducible.
|
||||
- Expected vs actual: concrete and unambiguous.
|
||||
- Omit "Environment / Notes" section if not relevant.
|
||||
|
||||
## Step 4 — Clarify
|
||||
|
||||
Show the draft to the user.
|
||||
**Use `AskUserQuestion` tool to ask:**
|
||||
- Are steps to reproduce complete and accurate?
|
||||
- Severity: Blocker / Critical / Major / Minor / Trivial?
|
||||
- Any related tickets or recent changes to link?
|
||||
|
||||
Incorporate feedback. Repeat until user approves.
|
||||
|
||||
## Step 5 — Determine Project
|
||||
|
||||
> **Project routing rules (always apply these):**
|
||||
> - Frontend code (UI, UX, web app, components, services) → `NCWF`
|
||||
> - Backend code (game engine, bots, API, services, coordinator) → `NCS`
|
||||
> - Infrastructure (Kubernetes, pipelines, CI/CD, DB setup, cloud infra) → `NCI`
|
||||
|
||||
- Frontend / UI / UX → project: `NCWF` (default for this repo)
|
||||
- Backend / coordinator / systems / bot / engine → project: `NCS`
|
||||
- Kubernetes, pipelines, CI/CD, infrastructure → project: `NCI`
|
||||
|
||||
If ambiguous, ask the user.
|
||||
|
||||
## Step 6 — Create Issue
|
||||
|
||||
Call `mcp__youtrack__create_issue` with:
|
||||
- `project`: determined in Step 5
|
||||
- `summary`: concise title describing what is broken (≤72 chars, sentence case)
|
||||
- `description`: full formatted defect report from Step 3 (Markdown)
|
||||
- `type`: `Bug`
|
||||
|
||||
## Step 7 — Report
|
||||
|
||||
Display the created issue ID and URL.
|
||||
Ask if a linked investigation or fix task is needed.
|
||||
@@ -0,0 +1,114 @@
|
||||
# Create User Story in YouTrack
|
||||
|
||||
Automated user-story creation workflow. Topic/hint: `$ARGUMENTS`
|
||||
|
||||
This is the **NowChess-Frontend** repo (Angular 20 / TypeScript). Stories raised
|
||||
here usually belong to project `NCWF`, but routing in Step 5 still applies.
|
||||
|
||||
## Step 1 — Gather Context
|
||||
|
||||
Use `AskUserQuestion` tool to ask the user (max 4 questions at once):
|
||||
|
||||
1. **Domain** — Is this frontend (UI/UX) work, or does it touch backend/infrastructure?
|
||||
2. **User type** — Who is the actor? (e.g. player, spectator, admin, anonymous visitor)
|
||||
3. **Action** — What should the user be able to do?
|
||||
4. **Goal/value** — Why? What outcome does it enable?
|
||||
|
||||
If `$ARGUMENTS` already answers some of these, skip those questions.
|
||||
|
||||
## Step 2 — Research (if needed)
|
||||
|
||||
If the topic involves unfamiliar UI flows, component structure, or technical constraints:
|
||||
- Search the repo for relevant code under `src/app/` (use `Grep`/`Bash`).
|
||||
- Use `WebSearch` if the topic involves Angular APIs, external standards or protocols.
|
||||
- Do NOT guess. Surface findings before drafting.
|
||||
|
||||
## Step 3 — Draft Story
|
||||
|
||||
Compose the full story using this template:
|
||||
|
||||
```
|
||||
As a [type of user]
|
||||
I want to [perform an action]
|
||||
So that [achieve a goal or value]
|
||||
|
||||
|
||||
Description
|
||||
|
||||
[Additional context or business logic for this story.]
|
||||
|
||||
|
||||
Acceptance Criteria
|
||||
|
||||
[List the specific, measurable criteria that define when this story is done:]
|
||||
|
||||
- Criterion 1
|
||||
- Criterion 2
|
||||
- Criterion 3
|
||||
|
||||
|
||||
Implementation Notes
|
||||
|
||||
[Technical notes, component/service references, design refs, or constraints.]
|
||||
```
|
||||
|
||||
Rules:
|
||||
- User story line: plain English, present tense, from user's perspective.
|
||||
- Acceptance criteria: testable, unambiguous, one condition each.
|
||||
- Implementation notes: optional — only include if there are known constraints, related tickets, or design refs.
|
||||
|
||||
## Step 4 — Clarify Acceptance Criteria
|
||||
|
||||
Show the draft to the user.
|
||||
**Use `AskUserQuestion` tool to ask:**
|
||||
- Are the acceptance criteria complete and correct?
|
||||
- Any implementation constraints to add?
|
||||
- Priority (if known)?
|
||||
|
||||
Incorporate feedback. Repeat until user approves.
|
||||
|
||||
## Step 5 — Determine Project
|
||||
|
||||
> **Project routing rules (always apply these):**
|
||||
> - Frontend code (UI, UX, web app, components, services) → `NCWF`
|
||||
> - Backend code (game engine, bots, API, services, coordinator) → `NCS`
|
||||
> - Infrastructure (Kubernetes, pipelines, CI/CD, DB setup, cloud infra) → `NCI`
|
||||
|
||||
- Frontend / UI / UX → project: `NCWF` (default for this repo)
|
||||
- Backend / coordinator / systems / bot / engine → project: `NCS`
|
||||
- Kubernetes, pipelines, CI/CD, infrastructure → project: `NCI`
|
||||
|
||||
If still ambiguous, ask the user.
|
||||
|
||||
## Step 6 — Create Issue
|
||||
|
||||
Call `mcp__youtrack__create_issue` with:
|
||||
- `project`: determined in Step 5
|
||||
- `summary`: concise title derived from the "I want to" clause (≤72 chars, sentence case)
|
||||
- `description`: full formatted story from Step 3 (Markdown)
|
||||
- `type`: `Feature` (or `Task` if purely technical with no user-facing value)
|
||||
|
||||
## Step 7 — Link Issues
|
||||
|
||||
After creation, ask the user (use `AskUserQuestion` if interactive, otherwise infer from context):
|
||||
|
||||
> Are there related issues to link? (skip if none)
|
||||
|
||||
Collect any issue IDs the user mentions. For each, determine the correct relation and call `mcp__youtrack__link_issues`:
|
||||
|
||||
| Situation | Relation to use |
|
||||
|-----------|----------------|
|
||||
| This story must be done before another | `blocks` |
|
||||
| Another story must be done before this | `is blocked by` |
|
||||
| Stories share domain or are related | `relates to` |
|
||||
| This is a child of an epic/story | `subtask of` |
|
||||
| This is a parent grouping subtasks | `parent for` |
|
||||
| This depends on another ticket's output | `depends on` |
|
||||
|
||||
If the user mentions an issue in the story description or implementation notes (e.g. "see NCS-42", "after NCWF-12 is done"), auto-detect and suggest linking it — confirm before creating the link.
|
||||
|
||||
## Step 8 — Report
|
||||
|
||||
Display the created issue ID and URL.
|
||||
List any links created (relation type + linked issue ID).
|
||||
Ask if a linked sub-task or implementation ticket is needed.
|
||||
@@ -0,0 +1,92 @@
|
||||
# Estimate Issue Time in YouTrack
|
||||
|
||||
Sprint planning time estimator. Issue ID or empty for full current sprint: `$ARGUMENTS`
|
||||
|
||||
This is the **NowChess-Frontend** repo. Sprint mode defaults to project `NCWF`.
|
||||
|
||||
## Step 1 — Determine Scope
|
||||
|
||||
**Single-issue mode** (`$ARGUMENTS` set):
|
||||
- Call `mcp__youtrack__get_issue` on `$ARGUMENTS`.
|
||||
- Proceed with that issue only.
|
||||
|
||||
**Sprint mode** (`$ARGUMENTS` empty):
|
||||
- Call `mcp__youtrack__search_issues` with query `project: NCWF Sprints: {current sprint} #Unresolved`.
|
||||
- If query returns 0 results, use `AskUserQuestion` to ask for the sprint name, then retry with `project: NCWF Sprints: {name}`.
|
||||
- Collect all returned issues.
|
||||
|
||||
## Step 2 — Build Issue Tree
|
||||
|
||||
For each top-level issue from Step 1:
|
||||
1. Fetch full details via `mcp__youtrack__get_issue`: summary, description, acceptance criteria, Type, existing `Zeitschätzung`, linked issues.
|
||||
2. Identify subtasks from links with relation `subtask of` (i.e. issues where the fetched issue is the parent).
|
||||
3. Recursively fetch subtasks until all leaves are known.
|
||||
4. Group into tree: Epic → Story → Task/Subtask.
|
||||
|
||||
**Leaf node** = issue with no subtask children.
|
||||
**Parent node** = issue that has at least one subtask child.
|
||||
|
||||
## Step 3 — Estimate Leaf Nodes
|
||||
|
||||
For each leaf node:
|
||||
1. Read: summary, description, acceptance criteria, implementation notes.
|
||||
2. If scope is unclear, search codebase (`Grep`/`Bash`) under `src/app/` for related files to gauge complexity.
|
||||
3. Assign estimate using this scale:
|
||||
|
||||
| Size | Criteria | Estimate |
|
||||
|------|----------|----------|
|
||||
| Trivial | Style tweak, copy change, 1-file tweak | 30m |
|
||||
| Small | 1–3 files, single component/service, no unknowns | 1h–2h |
|
||||
| Medium | 3–6 files, new component + service wiring, some design | 3h–5h |
|
||||
| Large | 6+ files, cross-feature, non-trivial state/routing | 1d–2d |
|
||||
| XL | New feature area, major refactor, research spike | 3d–5d |
|
||||
|
||||
4. Record: estimate + one-line reasoning.
|
||||
5. Skip leaf if it already has `Zeitschätzung` set — note it as pre-estimated.
|
||||
|
||||
## Step 4 — Roll Up for Display
|
||||
|
||||
YouTrack auto-sums `Zeitschätzung` from subtasks up to parents — **do not write estimates to parent nodes**.
|
||||
|
||||
Compute display-only rolled-up totals:
|
||||
- Parent total = sum of all descendant leaf estimates (including pre-estimated ones).
|
||||
- Flag any branch where some leaves are missing estimates (partial roll-up).
|
||||
|
||||
## Step 5 — Show Summary + Confirm
|
||||
|
||||
Display full tree with estimates. Format:
|
||||
|
||||
```
|
||||
Epic NCWF-10: Board UI overhaul [4h 30m] ← rolled up
|
||||
Story NCWF-11: Drag-and-drop pieces [2h 30m] ← rolled up
|
||||
Task NCWF-12: Add drag directive 1h 30m ← leaf (new)
|
||||
Task NCWF-13: Add component specs 1h ← leaf (new)
|
||||
Story NCWF-14: Move-list panel [2h] ← rolled up
|
||||
Task NCWF-15: Render SAN move list 2h ← leaf (pre-set, skipped)
|
||||
```
|
||||
|
||||
Legend: `[X]` = display-only roll-up (not written). Plain = will be written to YouTrack.
|
||||
|
||||
If sprint mode, show grand total at bottom:
|
||||
```
|
||||
Sprint total: Xd Yh Zm (N issues, M leaves to update)
|
||||
```
|
||||
|
||||
**Use `AskUserQuestion` tool:**
|
||||
- Does the breakdown look right?
|
||||
- Any estimates to adjust before writing to YouTrack?
|
||||
|
||||
Incorporate all feedback before proceeding.
|
||||
|
||||
## Step 6 — Write Estimates
|
||||
|
||||
On user approval, write estimates **only to leaf nodes** (bottom-up order):
|
||||
- For each leaf with a new estimate, call `mcp__youtrack__update_issue` with field `Zeitschätzung` = approved estimate.
|
||||
- YouTrack period format: `"30m"`, `"1h 30m"`, `"1d"`, `"2d 4h"`.
|
||||
- Skip leaves already pre-estimated.
|
||||
|
||||
## Step 7 — Report
|
||||
|
||||
List all updated issues with set estimates.
|
||||
Show final rolled-up totals per Epic/Story (read back from YouTrack via `mcp__youtrack__get_issue` if needed).
|
||||
In sprint mode, show total sprint estimate.
|
||||
@@ -0,0 +1,143 @@
|
||||
# Fix Defect from YouTrack
|
||||
|
||||
Automated defect-fix workflow. Ticket ID: `$ARGUMENTS`
|
||||
|
||||
This is the **NowChess-Frontend** repo (Angular 20 / TypeScript). Gates:
|
||||
- Build: `npm run build`
|
||||
- Test: `npm test -- --watch=false --browsers=ChromeHeadless`
|
||||
- Format: `npx prettier --write .` (check with `npx prettier --check .`)
|
||||
|
||||
## Step 1 — Fetch Ticket
|
||||
|
||||
Call `mcp__youtrack__get_issue` with ID `$ARGUMENTS`.
|
||||
Extract and display: summary, description, steps to reproduce, Priority, Subsystem.
|
||||
|
||||
## Step 2 — Create Worktree
|
||||
|
||||
Derive branch name from ticket:
|
||||
- `type` from YouTrack issue type: `bug` → `fix`, `feature`/`task` → `feat`, `refactor` → `refactor`, else `chore`
|
||||
- `scope` from affected area (kebab-case, omit if unclear)
|
||||
- `description` from ticket summary: lowercase, kebab-case, max 40 chars, drop articles
|
||||
|
||||
Branch format: `<type>/<ticket-id>-<description>`
|
||||
Example: `fix/NCWF-123-board-flip-resets-selection`
|
||||
|
||||
Call `EnterWorktree` with that branch name.
|
||||
All subsequent file work happens inside this worktree.
|
||||
|
||||
## Step 3 — Identify Root Cause (read-only)
|
||||
|
||||
1. Run `npm run build` — capture all errors and warnings.
|
||||
2. Run `npm test -- --watch=false --browsers=ChromeHeadless` — capture all failures.
|
||||
3. Spawn `cavecrew-investigator` with: ticket description + build/test output → locate root cause (files, line numbers, what's wrong).
|
||||
4. **If anything is ambiguous (reproduction unclear, scope uncertain, conflicting signals), use `AskUserQuestion` tool to ask — max 4 questions at once.**
|
||||
5. **Report findings to user. No file writes yet. Wait for acknowledgement before continuing.**
|
||||
|
||||
## Step 3b — Complexity Assessment + Subtasks
|
||||
|
||||
After root cause confirmed, assess scope:
|
||||
|
||||
**Simple** (1–2 files, single concern, < 1 hour estimated): proceed directly to Step 4.
|
||||
|
||||
**Complex** (3+ files, multiple concerns, or estimated > 1 hour): create subtasks before coding.
|
||||
|
||||
To create subtasks:
|
||||
1. Break fix into discrete, independently-completable tasks (e.g. "Fix selection state in BoardComponent", "Add spec for flip behaviour", "Update GameService move stream").
|
||||
2. For each subtask call `mcp__youtrack__create_issue` with:
|
||||
- `project`: based on subtask content — do **not** inherit from parent. Frontend/UI → `NCWF`; backend code → `NCS`; Kubernetes/pipelines/CI-CD/infrastructure → `NCI`. If ambiguous, ask user.
|
||||
- `summary`: concise action-oriented title
|
||||
- `type`: `Task`
|
||||
- `description`: what to do and why
|
||||
3. Call `mcp__youtrack__link_issues` to link each subtask to `$ARGUMENTS` with relation `subtask of`.
|
||||
4. Check if the ticket description or comments mention other issue IDs. For each mentioned ID, suggest a link and confirm with user:
|
||||
- Fix depends on another fix finishing first → `is blocked by`
|
||||
- This fix blocks another ticket → `blocks`
|
||||
- Logically related but independent → `relates to`
|
||||
5. List created subtask IDs and any additional links to user.
|
||||
|
||||
Then proceed to Step 4, implementing subtasks in order.
|
||||
|
||||
## Step 4 — Fix
|
||||
|
||||
1. Implement fix (use the `general-purpose` agent for non-trivial multi-file changes; inline edits for small ones).
|
||||
2. Run `npm run build` — must be green.
|
||||
3. Run `npm test -- --watch=false --browsers=ChromeHeadless` — must be green (add new specs for new behaviour; do not modify existing specs unless requirements changed).
|
||||
4. Run `npx prettier --write .` — **blocking, foreground only**. Wait for completion before continuing.
|
||||
5. Run `npx prettier --check .` — **blocking, foreground only** (never `run_in_background`). Wait for exit code 0. Must be green.
|
||||
- If it fails, fix all issues and re-run until exit code 0.
|
||||
- **Do NOT proceed to Step 5 until the build, tests and format check all pass.**
|
||||
If any step fails, iterate until all pass.
|
||||
|
||||
## Step 5 — Review
|
||||
|
||||
Spawn `cavecrew-reviewer` on the full diff.
|
||||
Display findings grouped by severity.
|
||||
|
||||
## Step 5b — Apply Review Findings
|
||||
|
||||
If the review produced any findings (any severity):
|
||||
1. Implement all agreed fixes.
|
||||
2. Run `npm run build` — must be green.
|
||||
3. Run `npm test -- --watch=false --browsers=ChromeHeadless` — must be green.
|
||||
4. Run `npx prettier --write .` then `npx prettier --check .` — **blocking, foreground only**. Wait for exit code 0.
|
||||
5. Re-spawn `cavecrew-reviewer` on the updated diff to confirm all findings are resolved.
|
||||
|
||||
Repeat until review is clean or user explicitly accepts remaining findings.
|
||||
|
||||
## Step 6 — Confirm + Push
|
||||
|
||||
Show summary: ticket, branch, files changed, review findings.
|
||||
**Use `AskUserQuestion` tool to ask for explicit approval before pushing.** Include any open questions about commit message scope or body if unclear.
|
||||
|
||||
On approval, commit following Conventional Commits:
|
||||
|
||||
```
|
||||
<type>(<scope>): <short description, imperative, ≤50 chars>
|
||||
|
||||
<optional body: what changed and why, wrap at 72 chars>
|
||||
|
||||
Closes $ARGUMENTS
|
||||
https://knockoutwhist.youtrack.cloud/issue/$ARGUMENTS
|
||||
```
|
||||
|
||||
- `type`: same as branch type (`fix`, `feat`, `refactor`, `chore`, etc.)
|
||||
- `scope`: affected area (`ui`, `components`, `services`, `models`, `core`, `routing`, `pages`, `styles`)
|
||||
- Subject: imperative mood, no period, lowercase
|
||||
- Footer `Closes $ARGUMENTS` and ticket URL always present
|
||||
|
||||
Push branch to remote.
|
||||
|
||||
## Step 7 — Comment on Ticket
|
||||
|
||||
After successful push, call `mcp__youtrack__add_issue_comment` on `$ARGUMENTS` with:
|
||||
|
||||
```
|
||||
Branch `<branch-name>` pushed.
|
||||
|
||||
<one-sentence summary of what was changed and why>
|
||||
|
||||
Files changed:
|
||||
- <file1>
|
||||
- <file2>
|
||||
```
|
||||
|
||||
## Step 7b — Additional Links
|
||||
|
||||
After commenting, ask the user if `$ARGUMENTS` should be linked to any other issues not already linked:
|
||||
|
||||
| Situation | Relation |
|
||||
|-----------|---------|
|
||||
| This fix blocks another open ticket | `blocks` |
|
||||
| Another ticket must ship first | `is blocked by` |
|
||||
| Related defect or story | `relates to` |
|
||||
| Duplicate of another defect | `duplicates` |
|
||||
|
||||
Scan the ticket description and comments for any issue IDs that were mentioned but not yet linked. Suggest those automatically.
|
||||
|
||||
Call `mcp__youtrack__link_issues` for each confirmed link.
|
||||
|
||||
## Step 8 — Cleanup
|
||||
|
||||
Call `ExitWorktree` with `discard_changes: true` to delete the worktree.
|
||||
(Branch was pushed in step 6 — commits are safe on remote; `discard_changes: true` bypasses the local-ahead guard.)
|
||||
Report: branch pushed, ticket commented, links created, worktree deleted, done.
|
||||
@@ -0,0 +1,159 @@
|
||||
# Implement Feature from YouTrack
|
||||
|
||||
Automated feature-implementation workflow. Ticket ID: `$ARGUMENTS`
|
||||
|
||||
This is the **NowChess-Frontend** repo (Angular 20 / TypeScript). In-project =
|
||||
`NCWF`. Gates:
|
||||
- Build: `npm run build`
|
||||
- Test: `npm test -- --watch=false --browsers=ChromeHeadless`
|
||||
- Format: `npx prettier --write .` (check with `npx prettier --check .`)
|
||||
|
||||
This workflow implements the given ticket **and all of its subtasks**, while
|
||||
respecting `blocked by` dependencies. Tasks that live in other projects
|
||||
(`NCS`, `NCI`, or any project other than `NCWF`) are never edited here — they
|
||||
are collected and reported at the end with a ready-to-run prompt.
|
||||
|
||||
## Step 1 — Fetch Ticket + Build Task Tree
|
||||
|
||||
1. Call `mcp__youtrack__get_issue` with ID `$ARGUMENTS`.
|
||||
2. Extract and display: summary, description, acceptance criteria, Priority, Subsystem, and the **issue links**.
|
||||
3. From the links, build the task tree:
|
||||
- **Subtasks** = issues linked as `subtask of` / `parent for` (children of `$ARGUMENTS`). Recurse: fetch each subtask with `get_issue` and collect its subtasks too.
|
||||
- **Blocked-by** = for every task in the tree, record issues linked as `is blocked by`.
|
||||
4. Classify each task by project (the prefix before the dash in the issue ID):
|
||||
- **In-project** = `NCWF`.
|
||||
- **Out-of-project** = `NCS`, `NCI`, or any other prefix. These are **never implemented here**.
|
||||
5. Display the full tree: root, subtasks (nested), and for each its blockers + project tag.
|
||||
|
||||
## Step 2 — Resolve Implementation Order
|
||||
|
||||
1. Filter to **in-project (`NCWF`), not-yet-resolved** tasks only (root + subtasks). Out-of-project tasks are excluded from implementation.
|
||||
2. Topologically sort by `blocked by`: a task is only implementable once all its in-project blockers are resolved.
|
||||
3. A task is **blocked** (cannot start) if any blocker is:
|
||||
- an in-project task that is not yet resolved in this run, **or**
|
||||
- an out-of-project task (`NCS`/`NCI`/etc.) — these can't be resolved here.
|
||||
4. Produce two lists:
|
||||
- **Implementable order** — `NCWF` tasks, dependency-sorted.
|
||||
- **Blocked tasks** — with the blocker(s) that stop them.
|
||||
5. **Report both lists to the user.** Wait for acknowledgement before continuing.
|
||||
|
||||
## Step 3 — Create Worktree
|
||||
|
||||
Derive branch name from the root ticket `$ARGUMENTS`:
|
||||
- `type` from YouTrack issue type: `feature`/`task` → `feat`, `refactor` → `refactor`, `bug` → `fix`, else `chore`
|
||||
- `scope` from affected area (kebab-case, omit if unclear)
|
||||
- `description` from ticket summary: lowercase, kebab-case, max 40 chars, drop articles
|
||||
|
||||
Branch format: `<type>/<ticket-id>-<description>`
|
||||
Example: `feat/NCWF-456-add-board-theme-selector`
|
||||
|
||||
Call `EnterWorktree` with that branch name.
|
||||
All subsequent file work happens inside this worktree. All implementable
|
||||
tasks (root + subtasks) are implemented on this one branch.
|
||||
|
||||
## Step 4 — Understand Requirements (read-only)
|
||||
|
||||
1. Run `npm run build` — confirm baseline is green.
|
||||
2. Run `npm test -- --watch=false --browsers=ChromeHeadless` — confirm baseline is green.
|
||||
3. For the root + each implementable subtask, spawn `cavecrew-investigator` with: that task's description + acceptance criteria → locate affected files under `src/app/`, relevant components/services/models, routes, integration touch-points.
|
||||
4. **If anything is ambiguous (scope unclear, acceptance criteria missing, design decisions needed), use `AskUserQuestion` tool to ask — max 4 questions at once.**
|
||||
5. **Report plan to user: per task — what will be added/changed, which files, which areas. No file writes yet. Wait for acknowledgement before continuing.**
|
||||
|
||||
## Step 5 — Implement (per task, in dependency order)
|
||||
|
||||
For each task in the implementable order from Step 2, do the following before moving to the next:
|
||||
|
||||
1. Implement task (use the `general-purpose` agent for non-trivial multi-file changes; inline edits for small ones).
|
||||
2. Run `npm run build` — must be green.
|
||||
3. Run `npm test -- --watch=false --browsers=ChromeHeadless` — must be green (add new specs for new behaviour; do not modify existing specs unless requirements changed).
|
||||
4. Run `npx prettier --write .` — **blocking, foreground only**. Wait for completion before continuing.
|
||||
5. Run `npx prettier --check .` — **blocking, foreground only** (never `run_in_background`). Wait for exit code 0. Must be green.
|
||||
- If it fails, fix all issues and re-run until exit code 0.
|
||||
- **Do NOT proceed to the next task until build, tests and format check all pass.**
|
||||
|
||||
If any step fails, iterate until all pass. Once a task is fully green it counts
|
||||
as **resolved** for the purpose of unblocking later tasks — re-check Step 2's
|
||||
blocked list: any task whose blockers are now all resolved becomes implementable.
|
||||
|
||||
## Step 6 — Review
|
||||
|
||||
Spawn `cavecrew-reviewer` on the full diff (covering all implemented tasks).
|
||||
Display findings grouped by severity.
|
||||
|
||||
## Step 6b — Apply Review Findings
|
||||
|
||||
If the review produced any findings (any severity):
|
||||
1. Implement all agreed fixes.
|
||||
2. Run `npm run build` — must be green.
|
||||
3. Run `npm test -- --watch=false --browsers=ChromeHeadless` — must be green.
|
||||
4. Run `npx prettier --write .` then `npx prettier --check .` — **blocking, foreground only**. Wait for exit code 0.
|
||||
5. Re-spawn `cavecrew-reviewer` on the updated diff to confirm all findings are resolved.
|
||||
|
||||
Repeat until review is clean or user explicitly accepts remaining findings.
|
||||
|
||||
## Step 7 — Confirm + Push
|
||||
|
||||
Show summary: root ticket, implemented subtasks, branch, files changed, review findings.
|
||||
**Use `AskUserQuestion` tool to ask for explicit approval before pushing.** Include any open questions about commit message scope or body if unclear.
|
||||
|
||||
On approval, commit following Conventional Commits:
|
||||
|
||||
```
|
||||
<type>(<scope>): <short description, imperative, ≤50 chars>
|
||||
|
||||
<optional body: what changed and why, wrap at 72 chars>
|
||||
|
||||
Closes $ARGUMENTS
|
||||
<also list Closes <ID> for each implemented subtask>
|
||||
https://knockoutwhist.youtrack.cloud/issue/$ARGUMENTS
|
||||
```
|
||||
|
||||
- `type`: same as branch type (`feat`, `refactor`, `chore`, etc.)
|
||||
- `scope`: affected area (`ui`, `components`, `services`, `models`, `core`, `routing`, `pages`, `styles`)
|
||||
- Subject: imperative mood, no period, lowercase
|
||||
- Footer `Closes <ID>` for the root and every resolved subtask, plus the root ticket URL.
|
||||
|
||||
Push branch to remote.
|
||||
|
||||
## Step 8 — Comment on Tickets
|
||||
|
||||
After successful push, call `mcp__youtrack__add_issue_comment` on `$ARGUMENTS` **and on each implemented subtask** with:
|
||||
|
||||
```
|
||||
Branch `<branch-name>` pushed.
|
||||
|
||||
<one-sentence summary of what was added and why>
|
||||
|
||||
Files changed:
|
||||
- <file1>
|
||||
- <file2>
|
||||
```
|
||||
|
||||
## Step 9 — Cleanup
|
||||
|
||||
Call `ExitWorktree` with `discard_changes: true` to delete the worktree.
|
||||
(Branch was pushed in step 7 — commits are safe on remote; `discard_changes: true` bypasses the local-ahead guard.)
|
||||
|
||||
## Step 10 — Report Blocked + Cross-Project Tasks
|
||||
|
||||
Final report to the user, in two sections:
|
||||
|
||||
### Blocked in-project tasks
|
||||
List any `NCWF` tasks that could **not** be implemented, with the blocker(s)
|
||||
that stopped them. (These can be re-run with this command once blockers clear.)
|
||||
|
||||
### Cross-project tasks (NCS / NCI / other)
|
||||
For every out-of-project task discovered in the tree (whether it was a subtask
|
||||
or a blocker), output one entry:
|
||||
|
||||
```
|
||||
- <ID> [<PROJECT>]: <summary>
|
||||
Prompt: /implement-feature <ID>
|
||||
```
|
||||
|
||||
Where `Prompt` is a short, copy-pasteable instruction to implement that task in
|
||||
its own project — e.g. the ticket ID plus a one-line description of what the
|
||||
other project needs to do so this project's blocked tasks can proceed.
|
||||
|
||||
End with: branch pushed, tickets commented, worktree deleted, plus the counts of
|
||||
implemented / blocked / cross-project tasks.
|
||||
@@ -0,0 +1,111 @@
|
||||
# Split Story into Subtasks in YouTrack
|
||||
|
||||
Split a user story into smaller, implementable subtasks. Story ID: `$ARGUMENTS`
|
||||
|
||||
This is the **NowChess-Frontend** repo. Frontend subtasks route to `NCWF`.
|
||||
|
||||
## Step 1 — Fetch Story
|
||||
|
||||
Call `mcp__youtrack__get_issue` with ID `$ARGUMENTS`.
|
||||
Extract and display: summary, description, acceptance criteria, implementation notes.
|
||||
|
||||
## Step 2 — Research (if needed)
|
||||
|
||||
If the story involves unfamiliar UI flows or technical constraints:
|
||||
- Search repo for relevant code under `src/app/` (`Grep`/`Bash`).
|
||||
- Use `WebSearch` for Angular APIs, external standards or protocols.
|
||||
- Do NOT guess. Surface findings before proposing splits.
|
||||
|
||||
## Step 3 — Propose Split
|
||||
|
||||
Analyse the story and propose a set of subtasks. Rules:
|
||||
- Each subtask = one unit of work, completable independently or in sequence.
|
||||
- No subtask should exceed ~2 days of work.
|
||||
- Name subtasks in imperative mood (e.g. "Add board theme service", "Render theme picker component").
|
||||
- Cover the full scope of the parent story — no gaps.
|
||||
|
||||
Show proposed subtask list to user (titles only) and ask:
|
||||
**Use `AskUserQuestion` tool:**
|
||||
- Does the split look right?
|
||||
- Any subtasks to add, remove, or merge?
|
||||
- Should any subtask be assigned to a specific person?
|
||||
|
||||
Incorporate feedback. Repeat until user approves the list.
|
||||
|
||||
## Step 4 — Draft Each Subtask
|
||||
|
||||
For each approved subtask, compose description using this template:
|
||||
|
||||
```
|
||||
[Brief description of what needs to be done for this subtask.]
|
||||
|
||||
|
||||
Steps / Tasks
|
||||
|
||||
- Task 1
|
||||
- Task 2
|
||||
- Task 3
|
||||
|
||||
|
||||
Definition of Done
|
||||
|
||||
What must be true for this subtask to be considered complete:
|
||||
|
||||
- Code implemented
|
||||
- Specs passing
|
||||
- Reviewed and merged
|
||||
```
|
||||
|
||||
Rules:
|
||||
- Steps/Tasks: concrete, ordered where order matters.
|
||||
- Definition of Done: adjust per subtask — not all subtasks need the same criteria (e.g. a research spike has different DoD than an implementation task).
|
||||
- Keep description short — one paragraph max.
|
||||
|
||||
## Step 5 — Determine Project per Subtask
|
||||
|
||||
Assign each subtask's project based on its content — do **not** inherit blindly from parent:
|
||||
|
||||
- Frontend code (UI, UX, web app, components, services) → `NCWF`
|
||||
- Backend code (game engine, bots, API, services, coordinator) → `NCS`
|
||||
- Kubernetes, pipelines, CI/CD, DB setup, infrastructure → `NCI`
|
||||
|
||||
If a subtask's project is ambiguous, ask the user before creating it.
|
||||
|
||||
## Step 6 — Create Subtasks
|
||||
|
||||
For each subtask call `mcp__youtrack__create_issue` with:
|
||||
- `project`: from Step 5
|
||||
- `summary`: subtask title (≤72 chars, sentence case)
|
||||
- `description`: full formatted description from Step 4 (Markdown)
|
||||
- `type`: `Task`
|
||||
|
||||
Then call `mcp__youtrack__link_issues` to link each created subtask to `$ARGUMENTS` with relation `subtask of`.
|
||||
|
||||
## Step 6b — Inter-Subtask Links
|
||||
|
||||
If subtasks must be done in sequence (one depends on output of another), add ordering links:
|
||||
- For each dependency pair call `mcp__youtrack__link_issues` with relation `is blocked by` (subtask B is blocked by subtask A).
|
||||
|
||||
Ask the user to confirm sequencing before adding these links:
|
||||
|
||||
> Do any subtasks have ordering dependencies? (e.g. "Add theme service must come before Render theme picker")
|
||||
|
||||
## Step 6c — External Links
|
||||
|
||||
Scan `$ARGUMENTS` description and implementation notes for any referenced issue IDs not already linked. For each:
|
||||
|
||||
| Situation | Relation |
|
||||
|-----------|---------|
|
||||
| Parent story blocks another epic/story | `blocks` |
|
||||
| Story depends on another epic completing | `is blocked by` |
|
||||
| Related story in same domain | `relates to` |
|
||||
| This story duplicates or supersedes | `duplicates` |
|
||||
|
||||
Suggest links to the user and call `mcp__youtrack__link_issues` on confirmation.
|
||||
|
||||
## Step 7 — Report
|
||||
|
||||
List all created subtask IDs and summaries.
|
||||
List all links created (subtask-of, blocking chains, external).
|
||||
Display parent story link.
|
||||
Ask if any subtask needs further splitting.
|
||||
@@ -37,3 +37,7 @@ __screenshots__/
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Claude Code
|
||||
/.claude/settings.local.json
|
||||
/.claude/worktrees/
|
||||
|
||||
Reference in New Issue
Block a user