chore: record session journal - 握力环训练趣味化
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
---
|
||||
name: trellis-finish-work
|
||||
description: "Wrap up the current session: verify quality gate passed, remind user to commit, archive completed tasks, and record session progress to the developer journal. Use when done coding and ready to end the session."
|
||||
---
|
||||
|
||||
# Finish Work
|
||||
|
||||
Wrap up the current session: archive the active task (and any other completed-but-unarchived tasks the user wants to clean up) and record the session journal. Code commits are NOT done here — those happen in workflow Phase 3.4 before you invoke this command.
|
||||
|
||||
## Step 1: Survey current state
|
||||
|
||||
```bash
|
||||
python3 ./.trellis/scripts/get_context.py --mode record
|
||||
```
|
||||
|
||||
This prints:
|
||||
|
||||
- **My active tasks** — review whether any besides the current one are actually done (code merged, AC met) and should be archived this round.
|
||||
- **Git status** — quick visual on what's dirty.
|
||||
- **Recent commits** — you'll need their hashes in Step 4 for `--commit`.
|
||||
|
||||
If `--mode record` surfaces other completed tasks not tied to the current session, surface them to the user with a one-shot confirmation: "These N tasks look done — archive them too in this round? [y/N]". Default is no; the current active task is always archived in Step 3 regardless.
|
||||
|
||||
## Step 2: Sanity check — working tree must be clean
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
git status --porcelain
|
||||
```
|
||||
|
||||
Filter out paths under `.trellis/workspace/` and `.trellis/tasks/` — those are managed by `add_session.py` and `task.py archive` auto-commits and will appear dirty as part of this skill's own work.
|
||||
|
||||
If anything else is dirty (any path outside those two prefixes), **stop and bail out** with:
|
||||
|
||||
> "Working tree has uncommitted code changes. Return to workflow Phase 3.4 to commit them before running `$finish-work`."
|
||||
|
||||
Do NOT run `git commit` here. Do NOT prompt the user to commit. The user goes back to Phase 3.4 and the AI drives the batched commit there.
|
||||
|
||||
## Step 3: Archive task(s)
|
||||
|
||||
```bash
|
||||
python3 ./.trellis/scripts/task.py archive <task-name>
|
||||
```
|
||||
|
||||
At minimum: the current active task (if any). Plus any extra tasks the user confirmed in Step 1. Each archive produces a `chore(task): archive ...` commit via the script's auto-commit.
|
||||
|
||||
If there is no active task and the user did not confirm any cleanup archives, skip this step.
|
||||
|
||||
## Step 4: Record session journal
|
||||
|
||||
```bash
|
||||
python3 ./.trellis/scripts/add_session.py \
|
||||
--title "Session Title" \
|
||||
--commit "hash1,hash2" \
|
||||
--summary "Brief summary"
|
||||
```
|
||||
|
||||
Use the work-commit hashes produced in Phase 3.4 (visible in Step 1's `Recent commits` list, or via `git log --oneline`) for `--commit`. Do not include the archive commit hashes from Step 3. This produces a `chore: record journal` commit.
|
||||
|
||||
Final git log order: `<work commits from 3.4>` → `chore(task): archive ...` (one or more) → `chore: record journal`.
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
---
|
||||
name: finish-work
|
||||
description: "Pre-commit quality checklist covering lint, typecheck, tests, code-spec sync, API changes, database migrations, cross-layer verification, and manual testing. Blocks commit if infra or cross-layer specs lack executable depth. Use when code is written and tested but not yet committed, before submitting changes, or as a final review before git commit."
|
||||
---
|
||||
|
||||
# Finish Work - Pre-Commit Checklist
|
||||
|
||||
Before submitting or committing, use this checklist to ensure work completeness.
|
||||
|
||||
**Timing**: After code is written and tested, before commit
|
||||
|
||||
---
|
||||
|
||||
## Checklist
|
||||
|
||||
### 1. Code Quality
|
||||
|
||||
```bash
|
||||
# Must pass
|
||||
pnpm lint
|
||||
pnpm type-check
|
||||
pnpm test
|
||||
```
|
||||
|
||||
- [ ] `pnpm lint` passes with 0 errors?
|
||||
- [ ] `pnpm type-check` passes with no type errors?
|
||||
- [ ] Tests pass?
|
||||
- [ ] No `console.log` statements (use logger)?
|
||||
- [ ] No non-null assertions (the `x!` operator)?
|
||||
- [ ] No `any` types?
|
||||
|
||||
### 2. Code-Spec Sync
|
||||
|
||||
**Code-Spec Docs**:
|
||||
- [ ] Does `.trellis/spec/backend/` need updates?
|
||||
- New patterns, new modules, new conventions
|
||||
- [ ] Does `.trellis/spec/frontend/` need updates?
|
||||
- New components, new hooks, new patterns
|
||||
- [ ] Does `.trellis/spec/guides/` need updates?
|
||||
- New cross-layer flows, lessons from bugs
|
||||
|
||||
**Key Question**:
|
||||
> "If I fixed a bug or discovered something non-obvious, should I document it so future me (or others) won't hit the same issue?"
|
||||
|
||||
If YES -> Update the relevant code-spec doc.
|
||||
|
||||
### 2.5. Code-Spec Hard Block (Infra/Cross-Layer)
|
||||
|
||||
If this change touches infra or cross-layer contracts, this is a blocking checklist:
|
||||
|
||||
- [ ] Spec content is executable (real signatures/contracts), not principle-only text
|
||||
- [ ] Includes file path + command/API name + payload field names
|
||||
- [ ] Includes validation and error matrix
|
||||
- [ ] Includes Good/Base/Bad cases
|
||||
- [ ] Includes required tests and assertion points
|
||||
|
||||
**Block Rule**:
|
||||
If infra/cross-layer changed but the related spec is still abstract, do NOT finish. Run `$update-spec` manually first.
|
||||
|
||||
### 3. API Changes
|
||||
|
||||
If you modified API endpoints:
|
||||
|
||||
- [ ] Input schema updated?
|
||||
- [ ] Output schema updated?
|
||||
- [ ] API documentation updated?
|
||||
- [ ] Client code updated to match?
|
||||
|
||||
### 4. Database Changes
|
||||
|
||||
If you modified database schema:
|
||||
|
||||
- [ ] Migration file created?
|
||||
- [ ] Schema file updated?
|
||||
- [ ] Related queries updated?
|
||||
- [ ] Seed data updated (if applicable)?
|
||||
|
||||
### 5. Cross-Layer Verification
|
||||
|
||||
If the change spans multiple layers:
|
||||
|
||||
- [ ] Data flows correctly through all layers?
|
||||
- [ ] Error handling works at each boundary?
|
||||
- [ ] Types are consistent across layers?
|
||||
- [ ] Loading states handled?
|
||||
|
||||
### 6. Manual Testing
|
||||
|
||||
- [ ] Feature works in browser/app?
|
||||
- [ ] Edge cases tested?
|
||||
- [ ] Error states tested?
|
||||
- [ ] Works after page refresh?
|
||||
|
||||
---
|
||||
|
||||
## Quick Check Flow
|
||||
|
||||
```bash
|
||||
# 1. Code checks
|
||||
pnpm lint && pnpm type-check
|
||||
|
||||
# 2. View changes
|
||||
git status
|
||||
git diff --name-only
|
||||
|
||||
# 3. Based on changed files, check relevant items above
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Oversights
|
||||
|
||||
| Oversight | Consequence | Check |
|
||||
|-----------|-------------|-------|
|
||||
| Code-spec docs not updated | Others don't know the change | Check .trellis/spec/ |
|
||||
| Spec text is abstract only | Easy regressions in infra/cross-layer changes | Require signature/contract/matrix/cases/tests |
|
||||
| Migration not created | Schema out of sync | Check db/migrations/ |
|
||||
| Types not synced | Runtime errors | Check shared types |
|
||||
| Tests not updated | False confidence | Run full test suite |
|
||||
| Console.log left in | Noisy production logs | Search for console.log |
|
||||
|
||||
---
|
||||
|
||||
## Relationship to Other Commands
|
||||
|
||||
```
|
||||
Development Flow:
|
||||
Write code -> Test -> $finish-work -> git commit -> $record-session
|
||||
| |
|
||||
Ensure completeness Record progress
|
||||
|
||||
Debug Flow:
|
||||
Hit bug -> Fix -> $break-loop -> Knowledge capture
|
||||
|
|
||||
Deep analysis
|
||||
```
|
||||
|
||||
- `$finish-work` - Check work completeness (this skill)
|
||||
- `$record-session` - Record session and commits
|
||||
- `$break-loop` - Deep analysis after debugging
|
||||
|
||||
---
|
||||
|
||||
## Core Principle
|
||||
|
||||
> **Delivery includes not just code, but also documentation, verification, and knowledge capture.**
|
||||
|
||||
Complete work = Code + Docs + Tests + Verification
|
||||
Reference in New Issue
Block a user