diff --git a/template/.claude/hooks/post-edit-markdown.sh b/template/.claude/hooks/post-edit-markdown.sh index bb52109..1e85513 100755 --- a/template/.claude/hooks/post-edit-markdown.sh +++ b/template/.claude/hooks/post-edit-markdown.sh @@ -49,17 +49,24 @@ if echo "$FILE_PATH" | grep -qE '(^|/)docs/'; then exit 0 fi +# Files under tasks_summary/ are allowed (SDLC workflow summaries) +if echo "$FILE_PATH" | grep -qE '(^|/)tasks_summary/'; then + exit 0 +fi + # ── Violation ────────────────────────────────────────────────────────────── echo "┌─ Markdown placement violation: $FILE_PATH" echo "│" echo "│ RULE: Markdown files produced during agent workflows or analysis" -echo "│ MUST be written inside the docs/ folder." +echo "│ MUST be written inside the docs/ or tasks_summary/ folder." echo "│" echo "│ Allowed exceptions:" -echo "│ • README.md (anywhere)" -echo "│ • CLAUDE.md (anywhere)" +echo "│ • README.md (anywhere)" +echo "│ • CLAUDE.md (anywhere)" +echo "│ • docs/** (any depth)" +echo "│ • tasks_summary/** (SDLC workflow summaries)" echo "│" -echo "│ Action required: delete this file and recreate it under docs/." +echo "│ Action required: delete this file and recreate it under docs/ or tasks_summary/." echo "└─" exit 0 diff --git a/template/.claude/hooks/pre-write-doc-file-warning.sh b/template/.claude/hooks/pre-write-doc-file-warning.sh index 997663b..ca7e82b 100755 --- a/template/.claude/hooks/pre-write-doc-file-warning.sh +++ b/template/.claude/hooks/pre-write-doc-file-warning.sh @@ -50,18 +50,26 @@ if echo "$FILE_PATH" | grep -qE '(^|/)docs/'; then exit 0 fi +# Files under tasks_summary/ are allowed (SDLC workflow summaries) +if echo "$FILE_PATH" | grep -qE '(^|/)tasks_summary/'; then + echo "$INPUT" + exit 0 +fi + # ── Violation — block the write ─────────────────────────────────────────────── echo "┌─ BLOCKED: Markdown placement violation" >&2 echo "│" >&2 echo "│ Attempted path: $FILE_PATH" >&2 echo "│" >&2 echo "│ RULE: Markdown files produced during workflows or analysis must" >&2 -echo "│ be written inside the docs/ folder." >&2 +echo "│ be written inside the docs/ or tasks_summary/ folder." >&2 echo "│" >&2 echo "│ Allowed exceptions:" >&2 -echo "│ • README.md — anywhere" >&2 -echo "│ • CLAUDE.md — anywhere" >&2 +echo "│ • README.md — anywhere" >&2 +echo "│ • CLAUDE.md — anywhere" >&2 +echo "│ • docs/** — any depth" >&2 +echo "│ • tasks_summary/** — SDLC workflow summaries" >&2 echo "│" >&2 -echo "│ Action: recreate the file under docs/ — e.g. docs/$(basename "$FILE_PATH")" >&2 +echo "│ Action: recreate the file under docs/ or tasks_summary/" >&2 echo "└─" >&2 exit 2 diff --git a/template/.claude/skills/sdlc-workflow/SKILL.md b/template/.claude/skills/sdlc-workflow/SKILL.md index ea87ecf..d243800 100644 --- a/template/.claude/skills/sdlc-workflow/SKILL.md +++ b/template/.claude/skills/sdlc-workflow/SKILL.md @@ -31,7 +31,7 @@ current, `○` for upcoming. ``` ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -SDLC ○DESIGN ○RED ○GREEN ○REFACTOR ○QUALITY ○SECURE ○DOCS ○COMMIT ○PR +SDLC ○DESIGN ○RED ○GREEN ○REFACTOR ○QUALITY ○SECURE ○DOCS ○COMMIT ○PR ○SUMMARY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ``` @@ -54,6 +54,7 @@ Stage Name Model Execution Sub-skills 6 DOCUMENTATION Haiku Agent (parallel) python-docstrings, markdown 7 COMMIT + CHANGELOG Haiku Agent (sequential) (inline guidance) 8 PULL REQUEST Haiku Agent (sequential) prepare_pr + 9 SUMMARY Haiku Agent (sequential) (task_summary_template.md) ``` Conditional stages (2.5, 3.5) only activate when flagged in task YAML. @@ -68,9 +69,10 @@ Conditional stages (2.5, 3.5) only activate when flagged in task YAML. 3. Run `just preflight TASK_ID` to execute pre-flight checks. 4. This project uses `just test` for tests and `just ci` for full CI. 5. Explore the codebase: `pyproject.toml`, `conftest.py`, existing tests, target modules. -6. Create `task_channel/task_TASK_ID/` directory for persistent artifacts. +6. Create `tasks_summary/` directory if it does not exist (`mkdir -p tasks_summary`). 7. Output: requirement summary, acceptance criteria list, files that will change. -8. Get user approval before proceeding. + +Proceed automatically to Stage 0.5. --- @@ -95,8 +97,7 @@ Gate: all pre-flight checks pass. No user approval needed. - Name: `test__when_` - Structure: AAA (Arrange-Act-Assert) - Every test file must set `pytestmark = pytest.mark.` at module level. -4. Show draft to user, wait for approval. -5. Write the test file(s). +4. Write the test file(s). 6. Run `just test`. Classify the failure: | Failure type | Meaning | Action | @@ -121,8 +122,7 @@ Do not proceed until RED is confirmed for all acceptance criteria. - Include type annotations on all public functions. - If logging is involved, follow the structlog guidelines in `CLAUDE.md` (see "Structured logging" and "Mandatory `logging_manager` usage" sections). -2. Show draft, wait for approval. -3. Write implementation. +2. Write implementation. 4. Run `just test`. All tests must pass. 5. Check coverage: `just coverage`. New code should be fully covered. - If coverage below 85%, write targeted tests for the uncovered lines @@ -256,6 +256,39 @@ Report: PR URL and title. --- +## Stage 9 — SUMMARY: Write task summary + +**Model:** Haiku (Agent call, sequential after stage 8) + +``` +Using the task_summary_template.md from .claude/skills/sdlc-workflow/assets/templates/task_summary_template.md: + +1. Create the tasks_summary/ directory if it does not already exist: + mkdir -p tasks_summary + +2. Collect the following values from pipeline outputs: + - task_id, title, type, status, owner from the task YAML + - target_branch from `git branch --show-current` + - commit_hash from `git log -1 --format=%h` + - pr_url from Stage 8 output + - date: today's date (ISO 8601) + - stage-by-stage results: test counts, coverage %, lint/type/security findings, refactor changes + +3. Fill every {{placeholder}} in the template with the collected values. + +4. Write the completed document to: + tasks_summary/TASK_ID_summary.md + where TASK_ID is the actual task ID from the YAML. + +5. Print the path of the written file. + +Report: path of written summary file. +``` + +Gate: file exists at `tasks_summary/TASK_ID_summary.md`. + +--- + ## Error handling | Stage | On failure | @@ -265,6 +298,7 @@ Report: PR URL and title. | 4-6 (parallel) | Each retries up to 3 times independently. Others continue. | | 7 (COMMIT) | CI fix loop, max 3 iterations. Then stop + report. | | 8 (PR) | Report error. Provide PR body for manual creation. | +| 9 (SUMMARY) | Log warning. Do not fail the pipeline — PR is already merged. | --- @@ -296,6 +330,7 @@ When TASK.md has several acceptance criteria: | Definition of Ready validator | [scripts/validate_dor.py](scripts/validate_dor.py) | | Task YAML starter template | [assets/templates/task_template.yaml](assets/templates/task_template.yaml) | | Task summary starter template | [assets/templates/task_summary_template.md](assets/templates/task_summary_template.md) | +| Task summary output location | `tasks_summary/TASK_ID_summary.md` (repo root) | ## Support scripts diff --git a/template/{% if include_git_cliff %}cliff.toml{% endif %}.jinja b/template/{% if include_git_cliff %}cliff.toml{% endif %}.jinja index c137944..d764d91 100644 --- a/template/{% if include_git_cliff %}cliff.toml{% endif %}.jinja +++ b/template/{% if include_git_cliff %}cliff.toml{% endif %}.jinja @@ -55,8 +55,8 @@ sort_commits = "newest" # Clean commit messages commit_preprocessors = [ -{ pattern = "\(#[0-9]+\)", replace = "" }, # remove PR numbers -{ pattern = "\s+", replace = " " }, # normalize whitespace +{ pattern = "\\(#[0-9]+\\)", replace = "" }, # remove PR numbers +{ pattern = "\\s+", replace = " " }, # normalize whitespace ] # ----------------------