@uoyo/mvtt 2.0.0-beta.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +131 -147
- package/dist/build/assembler.d.ts.map +1 -1
- package/dist/build/assembler.js +2 -0
- package/dist/build/assembler.js.map +1 -1
- package/dist/build/plan-validator.d.ts +26 -0
- package/dist/build/plan-validator.d.ts.map +1 -0
- package/dist/build/plan-validator.js +225 -0
- package/dist/build/plan-validator.js.map +1 -0
- package/dist/build/section-loader.d.ts.map +1 -1
- package/dist/build/section-loader.js +45 -9
- package/dist/build/section-loader.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -11
- package/dist/cli.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +0 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/install.d.ts +1 -4
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +18 -14
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/migrate.d.ts +18 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +163 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +35 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/fs/core-manifest.d.ts +17 -0
- package/dist/fs/core-manifest.d.ts.map +1 -0
- package/dist/fs/core-manifest.js +76 -0
- package/dist/fs/core-manifest.js.map +1 -0
- package/dist/fs/install-manifest.d.ts +1 -2
- package/dist/fs/install-manifest.d.ts.map +1 -1
- package/dist/fs/install-manifest.js +1 -2
- package/dist/fs/install-manifest.js.map +1 -1
- package/dist/fs/materialize.d.ts.map +1 -1
- package/dist/fs/materialize.js +23 -3
- package/dist/fs/materialize.js.map +1 -1
- package/dist/types/core-manifest.d.ts +12 -0
- package/dist/types/core-manifest.d.ts.map +1 -0
- package/dist/types/core-manifest.js +2 -0
- package/dist/types/core-manifest.js.map +1 -0
- package/dist/types/registry.d.ts +13 -5
- package/dist/types/registry.d.ts.map +1 -1
- package/install-manifest.yaml +31 -27
- package/package.json +57 -57
- package/registry.yaml +192 -209
- package/sources/defaults/config.yaml +27 -30
- package/sources/defaults/project-context.yaml +15 -26
- package/sources/defaults/session.yaml +31 -23
- package/sources/knowledge/core/manifest.yaml +4 -45
- package/sources/sections/activation-load-config.md +11 -5
- package/sources/sections/activation-load-context.md +26 -11
- package/sources/sections/activation-preflight.md +14 -4
- package/sources/sections/footer-next-steps.md +35 -9
- package/sources/sections/output-language-constraint.md +11 -0
- package/sources/sections/role-header.md +13 -13
- package/sources/sections/session-update.md +47 -0
- package/sources/skills/mvt-analyze/business.md +69 -33
- package/sources/skills/mvt-analyze/manifest.yaml +90 -89
- package/sources/skills/mvt-analyze-code/business.md +82 -35
- package/sources/skills/mvt-analyze-code/manifest.yaml +34 -26
- package/sources/skills/mvt-check-context/business.md +89 -42
- package/sources/skills/mvt-check-context/manifest.yaml +10 -21
- package/sources/skills/mvt-cleanup/business.md +80 -31
- package/sources/skills/mvt-cleanup/manifest.yaml +85 -93
- package/sources/skills/mvt-config/business.md +94 -26
- package/sources/skills/mvt-config/manifest.yaml +15 -27
- package/sources/skills/mvt-create-skill/business.md +224 -111
- package/sources/skills/mvt-create-skill/manifest.yaml +31 -15
- package/sources/skills/mvt-design/business.md +116 -34
- package/sources/skills/mvt-design/manifest.yaml +22 -31
- package/sources/skills/mvt-fix/business.md +103 -28
- package/sources/skills/mvt-fix/manifest.yaml +8 -22
- package/sources/skills/mvt-help/business.md +74 -70
- package/sources/skills/mvt-help/manifest.yaml +16 -10
- package/sources/skills/mvt-implement/business.md +91 -32
- package/sources/skills/mvt-implement/manifest.yaml +17 -33
- package/sources/skills/mvt-init/business.md +164 -49
- package/sources/skills/mvt-init/manifest.yaml +36 -28
- package/sources/skills/mvt-manage-context/business.md +175 -0
- package/sources/skills/mvt-manage-context/manifest.yaml +123 -0
- package/sources/skills/mvt-plan-dev/business.md +75 -0
- package/sources/skills/mvt-plan-dev/manifest.yaml +91 -0
- package/sources/skills/mvt-quick-dev/business.md +99 -0
- package/sources/skills/mvt-quick-dev/manifest.yaml +69 -0
- package/sources/skills/mvt-refactor/business.md +104 -33
- package/sources/skills/mvt-refactor/manifest.yaml +17 -32
- package/sources/skills/mvt-resume/business.md +137 -0
- package/sources/skills/mvt-resume/manifest.yaml +71 -0
- package/sources/skills/mvt-review/business.md +112 -49
- package/sources/skills/mvt-review/manifest.yaml +15 -34
- package/sources/skills/mvt-status/business.md +71 -24
- package/sources/skills/mvt-status/manifest.yaml +18 -26
- package/sources/skills/mvt-sync-context/business.md +148 -23
- package/sources/skills/mvt-sync-context/manifest.yaml +51 -39
- package/sources/skills/mvt-template/business.md +96 -49
- package/sources/skills/mvt-template/manifest.yaml +13 -21
- package/sources/skills/mvt-test/business.md +104 -36
- package/sources/skills/mvt-test/manifest.yaml +14 -23
- package/sources/skills/mvt-update-plan/business.md +72 -0
- package/sources/skills/mvt-update-plan/manifest.yaml +132 -0
- package/sources/templates/analyze-output/body.md +8 -31
- package/sources/templates/analyze-output/manifest.yaml +11 -11
- package/sources/templates/design-output/body.md +17 -50
- package/sources/templates/design-output/manifest.yaml +11 -11
- package/sources/templates/implement-output/body.md +6 -27
- package/sources/templates/implement-output/manifest.yaml +11 -11
- package/sources/templates/project-context/body.md +13 -0
- package/sources/templates/project-context/manifest.yaml +12 -0
- package/sources/templates/review-output/body.md +6 -40
- package/sources/templates/review-output/manifest.yaml +11 -11
- package/sources/templates/test-output/body.md +4 -28
- package/sources/templates/test-output/manifest.yaml +11 -11
- package/sources/knowledge/core/review-principles.md +0 -51
- package/sources/knowledge/patterns/clean-architecture/manifest.yaml +0 -66
- package/sources/knowledge/patterns/clean-architecture/review-checklist.md +0 -230
- package/sources/knowledge/patterns/ddd/manifest.yaml +0 -83
- package/sources/knowledge/patterns/ddd/review-checklist.md +0 -226
- package/sources/knowledge/patterns/ddd/tactical-patterns.md +0 -12
- package/sources/knowledge/patterns/frontend-react/manifest.yaml +0 -44
- package/sources/knowledge/patterns/frontend-react/review-checklist.md +0 -78
- package/sources/knowledge/patterns/manifest.yaml +0 -113
- package/sources/skills/mvt-add-context/business.md +0 -47
- package/sources/skills/mvt-add-context/manifest.yaml +0 -83
- package/sources/templates/analyze-code-output/body.md +0 -44
- package/sources/templates/analyze-code-output/manifest.yaml +0 -11
- package/sources/templates/cleanup-output/body.md +0 -9
- package/sources/templates/cleanup-output/manifest.yaml +0 -11
- package/sources/templates/config-output/body.md +0 -11
- package/sources/templates/config-output/manifest.yaml +0 -11
- package/sources/templates/context-check-output/body.md +0 -32
- package/sources/templates/context-check-output/manifest.yaml +0 -11
- package/sources/templates/fix-output/body.md +0 -30
- package/sources/templates/fix-output/manifest.yaml +0 -11
- package/sources/templates/init-output/body.md +0 -34
- package/sources/templates/init-output/manifest.yaml +0 -11
- package/sources/templates/refactor-output/body.md +0 -32
- package/sources/templates/refactor-output/manifest.yaml +0 -11
- package/sources/templates/status-output/body.md +0 -36
- package/sources/templates/status-output/manifest.yaml +0 -11
- package/sources/templates/sync-context-output/body.md +0 -16
- package/sources/templates/sync-context-output/manifest.yaml +0 -11
|
@@ -1,33 +1,104 @@
|
|
|
1
|
-
## Execution Flow
|
|
2
|
-
|
|
3
|
-
### Step 1:
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
### Step
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
1
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
## Execution Flow
|
|
2
|
+
|
|
3
|
+
### Step 1: Load Inputs
|
|
4
|
+
- **Required**:
|
|
5
|
+
- User-specified target (file path, symbol name, module, or "the code I just wrote").
|
|
6
|
+
- **Recommended**:
|
|
7
|
+
- Existing tests covering the target (search by file path, by symbol name, and by sibling test files).
|
|
8
|
+
- `git status` / `git diff` -- to know what is already modified before refactoring.
|
|
9
|
+
- **Fallback**: if no target was specified, ask the user. Do not refactor speculatively.
|
|
10
|
+
|
|
11
|
+
### Step 2: Locate and Understand Target
|
|
12
|
+
- **What**: produce a precise list of files and line ranges that constitute the refactoring target, plus a one-paragraph statement of what the code currently does.
|
|
13
|
+
- **How**:
|
|
14
|
+
1. Resolve the target: glob/grep for the named symbol or path.
|
|
15
|
+
2. List every caller / dependent: grep for the symbol's exported name across the project (and across packages if it is exported beyond the module).
|
|
16
|
+
3. State the current behavior in plain language; include any non-obvious side effects or invariants you can see in the code.
|
|
17
|
+
- **Output of this step**: a target table (`file | range | role`) and a "current behavior" paragraph; both are shown to user before continuing.
|
|
18
|
+
|
|
19
|
+
### Step 3: Classify Refactoring Type
|
|
20
|
+
- **What**: pick the smallest type that covers the requested change. Use the Refactoring Types table above for risk levels.
|
|
21
|
+
- **How**: assign one primary type per refactoring task. Multiple types in one run are allowed but each must be tracked separately in the artifact.
|
|
22
|
+
- If the request requires `Change Interface/API` AND the symbol is exported beyond the project (public API, library entry point, IPC boundary): STOP -- this is no longer a refactoring task; recommend `/mvt-design`.
|
|
23
|
+
|
|
24
|
+
### Step 4: Risk Assessment
|
|
25
|
+
- **What**: assign a final risk score and decide whether explicit confirmation is needed.
|
|
26
|
+
- **How**: combine refactoring type and impact factors.
|
|
27
|
+
|
|
28
|
+
| Factor | +risk |
|
|
29
|
+
|--------|-------|
|
|
30
|
+
| Touches > 10 files | +1 |
|
|
31
|
+
| Touches a public/exported symbol | +1 |
|
|
32
|
+
| No existing tests on the target | +1 |
|
|
33
|
+
| Target is in a critical path (auth, payments, persistence boundary, public API) | +1 |
|
|
34
|
+
| User has uncommitted changes overlapping the target | +1 |
|
|
35
|
+
|
|
36
|
+
- Final risk = type's base level + factors:
|
|
37
|
+
- Low + 0..1 -> proceed silently in Step 7.
|
|
38
|
+
- Medium OR Low + 2 -> require explicit confirmation in Step 6.
|
|
39
|
+
- High OR (Medium + 2) -> require explicit confirmation AND a behavior-preservation strategy from Step 5.
|
|
40
|
+
|
|
41
|
+
### Step 5: Choose Behavior-Preservation Strategy
|
|
42
|
+
- **What**: pick a verification path BEFORE editing.
|
|
43
|
+
- **How**: choose the row that matches your test reality.
|
|
44
|
+
|
|
45
|
+
| Test reality | Strategy |
|
|
46
|
+
|--------------|----------|
|
|
47
|
+
| Comprehensive tests cover the target | Run them once before changes (capture baseline), once after each step, and once at the end |
|
|
48
|
+
| Some tests exist, gaps known | Do the refactor in incremental steps; after each step, run available tests; for gaps, add a single characterization test BEFORE refactoring (capture current behavior, even if quirky) |
|
|
49
|
+
| No tests exist | Choose ONE: (a) write a minimal characterization test first, OR (b) for Low-risk refactors only, use mechanical refactoring (rename, extract) where the editor / language tooling guarantees behavior. Never attempt High-risk refactors with zero tests |
|
|
50
|
+
|
|
51
|
+
- Document the chosen strategy in the artifact regardless of risk level.
|
|
52
|
+
|
|
53
|
+
### Step 6: Confirm with User (when required)
|
|
54
|
+
- **Trigger**: per the Step 4 thresholds, or any High-risk type.
|
|
55
|
+
- **Format**: present a single screen with:
|
|
56
|
+
- Target summary (Step 2's table, condensed to file count + symbol).
|
|
57
|
+
- Refactoring type and risk level.
|
|
58
|
+
- Number of callers and a list of the top 5 affected files.
|
|
59
|
+
- Behavior-preservation strategy (Step 5).
|
|
60
|
+
- One yes/no prompt: `Proceed with this refactor? (y / n / show-plan)`.
|
|
61
|
+
|
|
62
|
+
### Step 7: Plan and Execute Incrementally
|
|
63
|
+
- **What**: apply the change in the smallest reversible steps.
|
|
64
|
+
- **How**:
|
|
65
|
+
1. Break the refactor into ordered sub-steps (e.g., Rename: 1) update declaration, 2) update callers, 3) update tests, 4) update docs).
|
|
66
|
+
2. After each sub-step:
|
|
67
|
+
- Compile / type-check the affected files.
|
|
68
|
+
- If a test command was identified in Step 5, run it (or surface it for user to run if running tests is not allowed in this environment).
|
|
69
|
+
- On failure: revert the sub-step, surface the cause, do NOT continue.
|
|
70
|
+
3. Do not interleave behavior changes (bug fixes, feature toggles) with the refactor. If you spot one, note it for follow-up; do not silently include it.
|
|
71
|
+
4. Do not modify code outside the planned target unless required for compilation/type correctness; record any such "incidental" edits.
|
|
72
|
+
|
|
73
|
+
### Step 8: Verify Behavior Preservation
|
|
74
|
+
- **What**: prove (within the chosen strategy) that observable behavior is unchanged.
|
|
75
|
+
- **How**:
|
|
76
|
+
- With tests: all pre-existing tests pass; new characterization tests pass; assert pass count is unchanged or increased.
|
|
77
|
+
- Without tests: list the call sites you visually verified, plus the manual behavior checks you recommend the user run.
|
|
78
|
+
- If anything regresses: revert the most recent sub-step, surface the regression, return to Step 7. Do not declare success.
|
|
79
|
+
|
|
80
|
+
### Step 9: Write Refactor Notes
|
|
81
|
+
- **Path**: `.ai-agents/workspace/artifacts/{change-id}/refactor-notes.md` if `active_change` exists; otherwise inline summary in conversation only (shortcut mode).
|
|
82
|
+
- **Required content**:
|
|
83
|
+
- `Target` -- file/symbol list, current-behavior paragraph.
|
|
84
|
+
- `Refactoring Type` and final risk level.
|
|
85
|
+
- `Behavior-Preservation Strategy` -- chosen row + tests touched / written.
|
|
86
|
+
- `Steps Applied` -- ordered sub-steps with one-line outcome each.
|
|
87
|
+
- `Incidental Edits` -- any unplanned files touched, with reason.
|
|
88
|
+
- `Verification Result` -- tests run, pass/fail counts; or manual checks recommended.
|
|
89
|
+
- `Follow-ups` -- deferred behavior changes spotted during refactoring.
|
|
90
|
+
|
|
91
|
+
### Step 10: (session update handled by shared section)
|
|
92
|
+
|
|
93
|
+
## Edge Cases & Errors
|
|
94
|
+
|
|
95
|
+
| Case | Handling |
|
|
96
|
+
|------|----------|
|
|
97
|
+
| Target spans multiple repos / submodules | STOP -- out of scope; recommend a coordinated change rather than a single refactor |
|
|
98
|
+
| Refactor uncovers a real bug | Pause refactor, document the bug, recommend `/mvt-fix` -- do NOT fix during the refactor |
|
|
99
|
+
| Refactor target is dead code | Confirm with user before deleting; offer alternative of marking deprecated first |
|
|
100
|
+
| Symbol is referenced via reflection / dynamic dispatch / string lookup | Increase risk by +2; require strategy 5(a) (characterization test) before proceeding |
|
|
101
|
+
| User has uncommitted changes overlapping the target | Show diff, recommend committing/stashing first, ask for explicit confirmation if user wants to proceed anyway |
|
|
102
|
+
| Type/test failures persist after revert | Surface a clear summary; suggest user re-run the original test baseline to detect a pre-existing failure unrelated to the refactor |
|
|
103
|
+
| User aborts at Step 6 | Do not modify any file; report "no changes" |
|
|
104
|
+
| Active change is mid-implementation (not yet `done`) | Warn that refactoring during implementation can confuse review/test phases; require explicit confirmation |
|
|
@@ -3,7 +3,7 @@ output: .claude/skills/mvt-refactor/SKILL.md
|
|
|
3
3
|
|
|
4
4
|
frontmatter:
|
|
5
5
|
name: mvt-refactor
|
|
6
|
-
description: "Refactor existing code while preserving behavior.
|
|
6
|
+
description: "Refactor existing code while preserving behavior. This skill should be used when user wants to improve code structure, rename symbols, extract methods or classes, or reorganize code without changing functionality."
|
|
7
7
|
|
|
8
8
|
sections:
|
|
9
9
|
- type: inline
|
|
@@ -21,7 +21,7 @@ sections:
|
|
|
21
21
|
role_desc: "an Implementation Specialist"
|
|
22
22
|
decision_rules:
|
|
23
23
|
- rule: "Refactoring target specified -> Analyze and plan the refactoring"
|
|
24
|
-
- rule: "No target specified ->
|
|
24
|
+
- rule: "No target specified -> Prompt user for refactoring target"
|
|
25
25
|
- rule: "Risk level is High -> Warn user and require explicit confirmation"
|
|
26
26
|
- rule: "Tests exist for target code -> Recommend running them after refactoring"
|
|
27
27
|
- rule: "No tests exist -> Describe how to verify behavior is unchanged"
|
|
@@ -43,26 +43,28 @@ sections:
|
|
|
43
43
|
|
|
44
44
|
## Refactoring Types
|
|
45
45
|
|
|
46
|
-
| Type |
|
|
47
|
-
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
46
|
+
| Type | Risk Level | Examples |
|
|
47
|
+
|------|------------|----------|
|
|
48
|
+
| Rename | Low | Variable, function, file rename |
|
|
49
|
+
| Extract Method/Class | Low | Pull repeated logic into a helper |
|
|
50
|
+
| Inline | Low | Eliminate a thin wrapper |
|
|
51
|
+
| Move | Medium | Relocate code to appropriate module/layer |
|
|
52
|
+
| Decompose Conditional | Medium | Simplify complex if/switch logic |
|
|
53
|
+
| Replace Inheritance with Composition | High | Class-hierarchy redesign |
|
|
54
|
+
| Change Interface/API | High | Modify public contracts |
|
|
54
55
|
|
|
55
56
|
- type: shared
|
|
56
57
|
source: sections/activation-load-context.md
|
|
57
58
|
params:
|
|
58
59
|
extended_context:
|
|
59
|
-
- ".ai-agents/knowledge/patterns/{pattern.active}/ -- Active architecture pattern knowledge"
|
|
60
|
-
- ".ai-agents/knowledge/principle/coding-standards.md -- Project coding standards"
|
|
61
60
|
- "Related source files to be refactored"
|
|
62
61
|
|
|
63
62
|
- type: shared
|
|
64
63
|
source: sections/activation-load-config.md
|
|
65
64
|
|
|
65
|
+
- type: shared
|
|
66
|
+
source: sections/output-language-constraint.md
|
|
67
|
+
|
|
66
68
|
- type: inline
|
|
67
69
|
content: |
|
|
68
70
|
### Step 3: Pre-flight Checks
|
|
@@ -70,32 +72,15 @@ sections:
|
|
|
70
72
|
|
|
71
73
|
### Shortcut Operation Rules
|
|
72
74
|
- Can execute at any time without checking workflow prerequisites
|
|
73
|
-
- Do NOT update `progress` in `session.yaml` after completion
|
|
74
|
-
- Only update `session.last_command` and `recent_actions`
|
|
75
|
-
|
|
76
|
-
### Step 4: Execute
|
|
77
|
-
Proceed to Execution Flow below.
|
|
78
75
|
|
|
79
76
|
- type: file
|
|
80
77
|
source: ./business.md
|
|
81
78
|
|
|
82
|
-
- type: inline
|
|
83
|
-
content: |
|
|
84
|
-
## Output Format
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
If a custom version exists at `.ai-agents/skills/_templates/custom/refactor-output.md`, use the custom version instead.
|
|
89
|
-
|
|
90
|
-
Fill the template placeholders with the refactoring results.
|
|
91
|
-
|
|
92
|
-
Every response MUST end with a Suggested Next Steps section.
|
|
80
|
+
- type: shared
|
|
81
|
+
source: sections/session-update.md
|
|
93
82
|
|
|
94
83
|
- type: shared
|
|
95
84
|
source: sections/footer-next-steps.md
|
|
96
85
|
params:
|
|
97
|
-
|
|
98
|
-
next_primary_desc: "Verify refactoring changes"
|
|
99
|
-
next_alternatives:
|
|
100
|
-
- skill: mvt-test
|
|
101
|
-
when: "Run tests to confirm behavior preservation"
|
|
86
|
+
current_skill: mvt-refactor
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
## Execution Flow
|
|
2
|
+
|
|
3
|
+
### Step 1: Read Session State
|
|
4
|
+
|
|
5
|
+
Extract from the already-loaded session context:
|
|
6
|
+
- `active_change` -- the current change-id (if any), its phase, plan_path, has_plan
|
|
7
|
+
- `recent_changes` -- list of changes with active plans
|
|
8
|
+
- `skill_history` -- last 10 entries (skill name, timestamp, status, change_id)
|
|
9
|
+
- `recent_actions` -- last 5 entries (what was done, when, outcome)
|
|
10
|
+
- `last_command` and `last_skill` -- most recent invocation
|
|
11
|
+
|
|
12
|
+
If session.yaml is missing or empty, jump to Step 6 with the "no session" branch.
|
|
13
|
+
|
|
14
|
+
### Step 1.5: Discover Pending Plans
|
|
15
|
+
|
|
16
|
+
Scan for in-progress plans using two sources:
|
|
17
|
+
|
|
18
|
+
1. **Index path**: For each entry in `recent_changes[]`, read its `plan_path` if the file exists.
|
|
19
|
+
2. **Fallback scan**: Glob `.ai-agents/workspace/artifacts/*/plan.yaml`, read any files not already covered by (1).
|
|
20
|
+
|
|
21
|
+
For each found plan.yaml, read and filter:
|
|
22
|
+
- Include only plans where `plan.status == "in_progress"`.
|
|
23
|
+
- Capture: `change_id`, `title`, task progress (`done_count / total_count`), `updated_at`.
|
|
24
|
+
- Sort candidates by `updated_at` descending.
|
|
25
|
+
|
|
26
|
+
### Step 1.6: Select Target Change
|
|
27
|
+
|
|
28
|
+
| Candidates | Behavior |
|
|
29
|
+
|------------|----------|
|
|
30
|
+
| 0 | Skip to Step 2 — use legacy `active_change` / `skill_history` flow (no plan context). |
|
|
31
|
+
| 1 | Auto-select. Print: "Found one active plan: **{title}** ({progress}). Resuming." |
|
|
32
|
+
| ≥2 | **Pause and prompt**. Display candidate table and wait for user input. |
|
|
33
|
+
|
|
34
|
+
**Candidate table format** (≥2 candidates):
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Found {N} active plans. Select which to resume:
|
|
38
|
+
|
|
39
|
+
| # | change-id | title | progress | last_updated |
|
|
40
|
+
|---|-----------|-------|----------|--------------|
|
|
41
|
+
| 1 | {id} | {t} | {d}/{n} | {relative} |
|
|
42
|
+
| ...
|
|
43
|
+
|
|
44
|
+
Enter a number, a change-id, or "none" to skip plan context:
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Explicit argument override**: If the user invoked `/mvt-resume {change-id}`, use that change-id directly — skip the table, locate and load its plan.yaml (error if not found or not in_progress).
|
|
48
|
+
|
|
49
|
+
After selection, set `selected_change_id` for use in subsequent steps. If "none" or 0 candidates, `selected_change_id = null`.
|
|
50
|
+
|
|
51
|
+
### Step 2: Inspect Recent Artifacts
|
|
52
|
+
|
|
53
|
+
If `selected_change_id` is set:
|
|
54
|
+
- List files under `.ai-agents/workspace/artifacts/{selected_change_id}/`, sorted by mtime descending
|
|
55
|
+
- Exclude `plan.yaml` from the artifact list (it gets its own section)
|
|
56
|
+
- Take the top 5
|
|
57
|
+
|
|
58
|
+
Else if `active_change.id` is set (no-plan fallback):
|
|
59
|
+
- List files under `.ai-agents/workspace/artifacts/{active_change.id}/`, sorted by mtime descending
|
|
60
|
+
- Take the top 5
|
|
61
|
+
|
|
62
|
+
Otherwise:
|
|
63
|
+
- List all files under `.ai-agents/workspace/artifacts/` (recursive), sorted by mtime descending
|
|
64
|
+
- Take the top 5
|
|
65
|
+
|
|
66
|
+
For each artifact, capture: file path, mtime, size (in tokens estimate = chars / 4), and the change-id it belongs to.
|
|
67
|
+
|
|
68
|
+
### Step 3: Determine Resume Point
|
|
69
|
+
|
|
70
|
+
**Plan-aware path** (when `selected_change_id` has a valid plan.yaml):
|
|
71
|
+
|
|
72
|
+
Read the plan's `current_task`. The resume point = that task. Next-step recommendation = the task's `skill_hint` (or infer from task title if skill_hint is absent).
|
|
73
|
+
|
|
74
|
+
Also filter `skill_history` to entries matching `change_id == selected_change_id` (entries with empty change_id are excluded from this filtered view).
|
|
75
|
+
|
|
76
|
+
**Legacy path** (no plan):
|
|
77
|
+
|
|
78
|
+
Pick the **resume point** by precedence:
|
|
79
|
+
|
|
80
|
+
| Condition | Resume point | Phase label |
|
|
81
|
+
|-----------|--------------|-------------|
|
|
82
|
+
| `active_change` is set with non-empty `phase` | `{active_change.phase}` | from session |
|
|
83
|
+
| `active_change` is set without phase | inferred from last skill in history | inferred |
|
|
84
|
+
| `skill_history[0]` exists | last skill | last skill |
|
|
85
|
+
| Nothing | `none` | new project |
|
|
86
|
+
|
|
87
|
+
Map skill -> next-step recommendation:
|
|
88
|
+
|
|
89
|
+
| Last skill | Suggested next |
|
|
90
|
+
|-----------|----------------|
|
|
91
|
+
| mvt-init | mvt-analyze-code (if has code) or mvt-analyze (if requirements available) |
|
|
92
|
+
| mvt-analyze | mvt-design |
|
|
93
|
+
| mvt-analyze-code | mvt-analyze (if requirements pending) or mvt-design |
|
|
94
|
+
| mvt-design | mvt-plan-dev (if change is large) or mvt-implement |
|
|
95
|
+
| mvt-implement | mvt-review |
|
|
96
|
+
| mvt-review | mvt-fix (if findings) or mvt-test |
|
|
97
|
+
| mvt-fix | mvt-review (re-review) or mvt-test |
|
|
98
|
+
| mvt-test | mvt-cleanup or next change |
|
|
99
|
+
| mvt-cleanup | new change via mvt-analyze |
|
|
100
|
+
| (other) | mvt-status |
|
|
101
|
+
|
|
102
|
+
### Step 4: Load Plan Progress (plan-aware path only)
|
|
103
|
+
|
|
104
|
+
If `selected_change_id` has a plan, generate the **Plan Progress** section:
|
|
105
|
+
|
|
106
|
+
- Read all tasks from plan.yaml.
|
|
107
|
+
- Build a compact status table: `| # | id | title | status | skill_hint |`
|
|
108
|
+
- Highlight `current_task` row (prefix with `>>` or bold).
|
|
109
|
+
- Count summary: `Done: {d}, In Progress: {ip}, Pending: {p}, Blocked: {b}, Skipped: {s}`
|
|
110
|
+
|
|
111
|
+
And the **Current Task Detail** section:
|
|
112
|
+
|
|
113
|
+
- `title`
|
|
114
|
+
- `acceptance` criteria (bulleted list)
|
|
115
|
+
- `depends_on` with status of each dependency (all should be `done`)
|
|
116
|
+
- `notes` (if non-empty)
|
|
117
|
+
- `skill_hint` -> recommendation
|
|
118
|
+
|
|
119
|
+
### Step 5: Generate Resume Report
|
|
120
|
+
|
|
121
|
+
Render via the `resume-output.md` template. Sections to fill:
|
|
122
|
+
|
|
123
|
+
1. **Active Task** -- name, change-id, phase, started_at (from active_change or selected plan)
|
|
124
|
+
2. **Plan Progress** -- (only when plan exists) task table + counts + current task detail
|
|
125
|
+
3. **Recent Skill History** -- last 5 entries from skill_history (filtered to selected change if applicable)
|
|
126
|
+
4. **Recent Artifacts** -- the top 5 artifacts collected in Step 2 (path, mtime, size)
|
|
127
|
+
5. **Resume Point** -- a one-paragraph natural-language summary of "where we are"
|
|
128
|
+
6. **Recommended Next Step** -- the mapped next skill from Step 3, with justification
|
|
129
|
+
|
|
130
|
+
### Step 6: Edge Cases
|
|
131
|
+
|
|
132
|
+
- **No session**: report "No session found. Run `/mvt-init` to start a project."
|
|
133
|
+
- **No active_change AND no history AND no plans**: report "No active task. Suggested entry points: `/mvt-init`, `/mvt-analyze`, `/mvt-status`."
|
|
134
|
+
- **active_change set but referenced artifacts missing**: warn "Artifact directory `{path}` not found -- task state may be stale. Verify with `/mvt-status` or run `/mvt-cleanup`."
|
|
135
|
+
- **Last skill ended in failure** (skill_history entry status=failed): surface the failure summary first, suggest retry of that skill rather than advancing.
|
|
136
|
+
- **Plan exists but plan.yaml is invalid** (parse error or schema violation): warn "plan.yaml is corrupted or invalid. Run `/mvt-plan-dev` to regenerate, or `/mvt-status` to inspect."
|
|
137
|
+
- **Stale task warning**: If plan's `current_task` has status `in_progress` but the plan's `updated_at` is more than 5 days old, append a notice: "Current task has been in_progress for {N} days without updates. Consider running `/mvt-update-plan` to refresh status."
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: mvt-resume
|
|
2
|
+
output: .claude/skills/mvt-resume/SKILL.md
|
|
3
|
+
|
|
4
|
+
frontmatter:
|
|
5
|
+
name: mvt-resume
|
|
6
|
+
description: "Resume an in-progress development task in a new conversation. Reads session.yaml (active_change, skill_history, recent_actions) and recent artifacts to reconstruct context. Does not read git state."
|
|
7
|
+
|
|
8
|
+
sections:
|
|
9
|
+
- type: inline
|
|
10
|
+
content: |
|
|
11
|
+
# MVT Resume
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Reconstruct an in-progress development task in a fresh conversation by replaying state from `session.yaml`, recent artifacts, and plan.yaml (if one exists). When multiple plans are in-flight, prompt the user to select which change to resume. Use this skill at the start of a new conversation to pick up exactly where the last session left off.
|
|
16
|
+
|
|
17
|
+
## Arguments
|
|
18
|
+
|
|
19
|
+
| Argument | Required | Description |
|
|
20
|
+
|----------|----------|-------------|
|
|
21
|
+
| `{change-id}` | No | Directly resume a specific change (skips candidate selection). Error if not found or not in_progress. |
|
|
22
|
+
|
|
23
|
+
- type: shared
|
|
24
|
+
source: sections/role-header.md
|
|
25
|
+
params:
|
|
26
|
+
role: Conductor
|
|
27
|
+
role_desc: "a Workflow Coordinator"
|
|
28
|
+
decision_rules:
|
|
29
|
+
- rule: "Multiple in_progress plans found -> Pause and display candidate table, wait for user selection"
|
|
30
|
+
- rule: "Exactly one in_progress plan found -> Auto-select it and proceed"
|
|
31
|
+
- rule: "No plans found BUT active_change is set -> Fall back to legacy skill_history-based resume"
|
|
32
|
+
- rule: "active_change is empty AND skill_history is empty AND no plans -> Recommend `/mvt-init` or `/mvt-status`"
|
|
33
|
+
- rule: "Plan exists and has current_task -> Use current_task's skill_hint as next-step recommendation"
|
|
34
|
+
- rule: "Plan's current_task has been in_progress for >5 days -> Surface stale warning"
|
|
35
|
+
- rule: "Last skill failed or was interrupted -> Surface the failure context, suggest retry"
|
|
36
|
+
boundaries:
|
|
37
|
+
- scope: "read git state (branch, diff, commits)"
|
|
38
|
+
skill: "(Out of scope -- this skill is session-state only)"
|
|
39
|
+
- scope: "modify any files"
|
|
40
|
+
skill: "(Read-only)"
|
|
41
|
+
- scope: "run analyses or tests"
|
|
42
|
+
skill: "(Use the recommended next skill)"
|
|
43
|
+
|
|
44
|
+
- type: shared
|
|
45
|
+
source: sections/activation-load-context.md
|
|
46
|
+
|
|
47
|
+
- type: shared
|
|
48
|
+
source: sections/activation-load-config.md
|
|
49
|
+
|
|
50
|
+
- type: shared
|
|
51
|
+
source: sections/output-language-constraint.md
|
|
52
|
+
|
|
53
|
+
- type: shared
|
|
54
|
+
source: sections/activation-preflight.md
|
|
55
|
+
params:
|
|
56
|
+
checks:
|
|
57
|
+
- order: "1"
|
|
58
|
+
field: "session.initialized_at"
|
|
59
|
+
level: "WARN"
|
|
60
|
+
message: "Session not initialized. Run `/mvt-init` first."
|
|
61
|
+
|
|
62
|
+
- type: file
|
|
63
|
+
source: ./business.md
|
|
64
|
+
|
|
65
|
+
- type: shared
|
|
66
|
+
source: sections/session-update.md
|
|
67
|
+
|
|
68
|
+
- type: shared
|
|
69
|
+
source: sections/footer-next-steps.md
|
|
70
|
+
params:
|
|
71
|
+
current_skill: mvt-resume
|
|
@@ -1,49 +1,112 @@
|
|
|
1
|
-
## Execution Flow
|
|
2
|
-
|
|
3
|
-
### Step 1:
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Step
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
1
|
+
## Execution Flow
|
|
2
|
+
|
|
3
|
+
### Step 1: Load Inputs
|
|
4
|
+
- **Required**:
|
|
5
|
+
- The set of files to review (see Step 2 for resolution).
|
|
6
|
+
- **Fallback**:
|
|
7
|
+
- If `design.md`/`implementation.md` are missing, downgrade to "code-only review": skip the design-compliance checks (Step 4 row group A) and note the limitation in the artifact.
|
|
8
|
+
- If `project-context.md` is missing, skip layer-compliance checks and note the limitation.
|
|
9
|
+
|
|
10
|
+
### Step 2: Resolve Review Target
|
|
11
|
+
- **What**: produce a definitive file list to review.
|
|
12
|
+
- **How**: pick the FIRST source that yields a non-empty list.
|
|
13
|
+
|
|
14
|
+
| Source | Condition |
|
|
15
|
+
|--------|-----------|
|
|
16
|
+
| User-provided file paths | User passed paths/globs as arguments |
|
|
17
|
+
| `--aspect` filter | User specified an aspect; intersect aspect-relevant files with the active change's `Change Tracking` |
|
|
18
|
+
| `implementation.md` -> `Files Touched` | Active change has implementation artifact |
|
|
19
|
+
| `git diff --name-only main...HEAD` | Inside a feature branch |
|
|
20
|
+
| `git diff --name-only HEAD~1` | Last-commit fallback |
|
|
21
|
+
|
|
22
|
+
- If the resolved list is empty, STOP and ask the user to specify the target.
|
|
23
|
+
- If the list exceeds ~30 files, ask the user to scope down OR confirm a high-level (per-module) review depth.
|
|
24
|
+
|
|
25
|
+
### Step 3: Determine Review Depth
|
|
26
|
+
- **Default**: full review across all axes (Step 4).
|
|
27
|
+
- `--aspect <name>`: narrow to a single axis. Supported aspects: `architecture`, `quality`, `errors`, `edge-cases`, `security`, `naming`, `tests`. Other aspects -> ask user to clarify.
|
|
28
|
+
- For files >300 lines, do a structural pass first (interfaces, exports, key paths) before line-level review; do not attempt line-by-line on huge files.
|
|
29
|
+
|
|
30
|
+
### Step 4: Run Review Checks
|
|
31
|
+
- **What**: produce findings, each tagged with severity, location, and a concrete remedy.
|
|
32
|
+
- **How**: walk the checklist below. Skip any group whose inputs were missing per Step 1 fallback notes.
|
|
33
|
+
|
|
34
|
+
**Group A -- Design / Layer Compliance** (requires design.md OR project-context.md)
|
|
35
|
+
- Each file is in the module/layer assigned by design or project-context.
|
|
36
|
+
- Dependency direction respects layer rules (no upward imports, no forbidden cross-module reaches).
|
|
37
|
+
- Public interfaces match `Key Interfaces` from design.
|
|
38
|
+
- Implementation `Deviations from Design` are documented; undocumented deviations are findings.
|
|
39
|
+
|
|
40
|
+
**Group B -- Code Quality**
|
|
41
|
+
- Functions are small and focused; flag functions > ~50 lines or with > ~3 nested control levels.
|
|
42
|
+
- Naming is clear, consistent with `naming-conventions.md`, and matches surrounding code.
|
|
43
|
+
- No duplication: same logic appearing >= 3 times warrants extraction.
|
|
44
|
+
- No premature abstraction: a single-use helper / interface / wrapper is a finding.
|
|
45
|
+
- No dead code, unused imports, commented-out blocks left behind.
|
|
46
|
+
|
|
47
|
+
**Group C -- Error Handling**
|
|
48
|
+
- Error handling appears only at system boundaries (HTTP, DB, external API, file IO, queue).
|
|
49
|
+
- Interior try/catch must have an explicit reason in a one-line comment, otherwise findable.
|
|
50
|
+
- No swallowed errors (catch without rethrow / log / explicit recovery).
|
|
51
|
+
- Error types are specific where the language supports it (no bare `catch Exception` without rethrow).
|
|
52
|
+
|
|
53
|
+
**Group D -- Edge Cases**
|
|
54
|
+
- Boundary inputs handled: empty / null / max length / negative / zero / unicode.
|
|
55
|
+
- Concurrency: shared state, async ordering, idempotency where required by design.
|
|
56
|
+
- Resource lifecycle: opened resources are closed on all paths.
|
|
57
|
+
- Off-by-one: loop bounds, slice indices, pagination cursors.
|
|
58
|
+
|
|
59
|
+
**Group E -- Tests** (if test files are in scope)
|
|
60
|
+
- Each business rule from `project-context.md` has at least one test case.
|
|
61
|
+
- Tests assert behavior, not implementation details.
|
|
62
|
+
- No `skip` / `only` / commented-out tests left in.
|
|
63
|
+
- Test names describe the scenario, not the function name.
|
|
64
|
+
|
|
65
|
+
**Group F -- Security** (if user requirements mention auth/data sensitivity OR `--aspect security`)
|
|
66
|
+
- No secrets in code or test fixtures.
|
|
67
|
+
- Input validation at every external boundary.
|
|
68
|
+
- Auth/authz checks present on every protected endpoint or operation.
|
|
69
|
+
- SQL/NoSQL/HTML rendered through parameterized / escaped APIs.
|
|
70
|
+
|
|
71
|
+
### Step 5: Categorize and De-duplicate Findings
|
|
72
|
+
- **Severity**: assign each finding using the table below.
|
|
73
|
+
|
|
74
|
+
| Level | Definition | Examples |
|
|
75
|
+
|-------|------------|----------|
|
|
76
|
+
| **Critical** | Bug, security flaw, broken contract, data loss risk, layer violation that breaks isolation | Swallowed exception in payment path; missing auth on protected endpoint; forbidden cross-layer import |
|
|
77
|
+
| **Warning** | Likely problem or significant quality issue: not a bug today, but high-risk or maintainability hazard | Function 200 lines; duplicated logic 3x; missing tests for a documented business rule |
|
|
78
|
+
| **Suggestion** | Improvement, polish, taste preference | Variable name could be clearer; could split a small helper; minor docstring gap |
|
|
79
|
+
|
|
80
|
+
- Merge duplicate findings (same root cause appearing in multiple files) into one entry with a list of locations.
|
|
81
|
+
- Each finding must include: file, line range, severity, observation, recommendation.
|
|
82
|
+
|
|
83
|
+
### Step 6: Write Artifact
|
|
84
|
+
- **Path**: `.ai-agents/workspace/artifacts/{active_change.id}/review.md` if `active_change` exists; else `.ai-agents/workspace/artifacts/_ad-hoc-review-{YYYY-MM-DD-HHMM}/review.md`.
|
|
85
|
+
- **Template**: `.ai-agents/skills/_templates/review-output.md` (custom override at `_templates/custom/...` takes precedence).
|
|
86
|
+
- **Required content** (mapped to template headings):
|
|
87
|
+
- `Review Scope` -- file list, depth, aspect filter, fallbacks applied (e.g., "design.md missing -> Group A skipped").
|
|
88
|
+
- `Summary` -- counts per severity + one-paragraph overall verdict (Approve / Approve with comments / Request changes / Block).
|
|
89
|
+
- `Critical Findings` -- one entry per finding.
|
|
90
|
+
- `Warnings`.
|
|
91
|
+
- `Suggestions`.
|
|
92
|
+
- `Skipped Checks` -- groups skipped because inputs were missing, with reason.
|
|
93
|
+
- `Recommended Next Skill` -- e.g., `/mvt-fix` for Critical, `/mvt-test` if Group E gaps, `/mvt-refactor` if Group B is dominant.
|
|
94
|
+
|
|
95
|
+
### Step 7: Verdict Rule
|
|
96
|
+
- Critical > 0 -> verdict is `Request changes`. Suggest `/mvt-fix`.
|
|
97
|
+
- Critical = 0, Warnings > 5 -> verdict is `Approve with comments`.
|
|
98
|
+
- Critical = 0, Warnings <= 5, Suggestions only -> verdict is `Approve`.
|
|
99
|
+
- Code-only review (design.md missing) -> verdict cannot be higher than `Approve with comments` (call it out explicitly).
|
|
100
|
+
|
|
101
|
+
### Step 8: (session update handled by shared section)
|
|
102
|
+
|
|
103
|
+
## Edge Cases & Errors
|
|
104
|
+
|
|
105
|
+
| Case | Handling |
|
|
106
|
+
|------|----------|
|
|
107
|
+
| Review target is generated code (build output, lockfile, vendored dep) | Skip with a one-line note in artifact; do not flag findings |
|
|
108
|
+
| All Group A inputs missing | Run as code-only review; cap verdict at `Approve with comments` |
|
|
109
|
+
| User asked for review but there are zero changes | STOP, report "no diff to review", do not write artifact |
|
|
110
|
+
| Findings in the same file conflict (e.g., quality says "extract", architecture says "do not introduce a new module") | Defer to architecture; record the tension in `Suggestions` |
|
|
111
|
+
| Implementation explicitly documents a deviation from design (in `Deviations from Design`) | Treat as accepted -- flag only if the deviation is itself problematic |
|
|
112
|
+
| Reviewer finds bugs requiring discussion before fix | Mark Critical, but do NOT auto-invoke `/mvt-fix`; leave the call to the user |
|