@uoyo/mvtt 2.0.0-beta.1 → 2.0.0-beta.3

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.
Files changed (84) hide show
  1. package/README.md +184 -193
  2. package/dist/build/section-loader.d.ts.map +1 -1
  3. package/dist/build/section-loader.js +18 -8
  4. package/dist/build/section-loader.js.map +1 -1
  5. package/dist/fs/materialize.d.ts.map +1 -1
  6. package/dist/fs/materialize.js +5 -0
  7. package/dist/fs/materialize.js.map +1 -1
  8. package/dist/scripts/session-update.cjs +7568 -0
  9. package/install-manifest.yaml +2 -0
  10. package/package.json +3 -2
  11. package/registry.yaml +6 -0
  12. package/sources/defaults/config.yaml +7 -7
  13. package/sources/defaults/session.yaml +9 -16
  14. package/sources/scripts/session-update.js +351 -0
  15. package/sources/sections/activation-load-context.md +4 -0
  16. package/sources/sections/footer-next-steps.md +1 -1
  17. package/sources/sections/output-language-constraint.md +11 -11
  18. package/sources/sections/session-update.md +115 -47
  19. package/sources/skills/mvt-analyze/business.md +7 -7
  20. package/sources/skills/mvt-analyze/manifest.yaml +1 -0
  21. package/sources/skills/mvt-analyze-code/manifest.yaml +110 -96
  22. package/sources/skills/mvt-bug-detect/business.md +99 -0
  23. package/sources/skills/mvt-bug-detect/manifest.yaml +84 -0
  24. package/sources/skills/mvt-check-context/business.md +3 -5
  25. package/sources/skills/mvt-check-context/manifest.yaml +70 -63
  26. package/sources/skills/mvt-cleanup/business.md +49 -23
  27. package/sources/skills/mvt-cleanup/manifest.yaml +15 -10
  28. package/sources/skills/mvt-config/business.md +1 -2
  29. package/sources/skills/mvt-config/manifest.yaml +103 -96
  30. package/sources/skills/mvt-create-skill/business.md +84 -76
  31. package/sources/skills/mvt-create-skill/manifest.yaml +107 -95
  32. package/sources/skills/mvt-design/business.md +3 -6
  33. package/sources/skills/mvt-design/manifest.yaml +109 -96
  34. package/sources/skills/mvt-fix/business.md +39 -9
  35. package/sources/skills/mvt-fix/manifest.yaml +88 -72
  36. package/sources/skills/mvt-help/business.md +2 -4
  37. package/sources/skills/mvt-help/manifest.yaml +75 -67
  38. package/sources/skills/mvt-implement/business.md +4 -5
  39. package/sources/skills/mvt-implement/manifest.yaml +93 -80
  40. package/sources/skills/mvt-init/business.md +2 -2
  41. package/sources/skills/mvt-init/manifest.yaml +102 -101
  42. package/sources/skills/mvt-manage-context/business.md +186 -175
  43. package/sources/skills/mvt-manage-context/manifest.yaml +134 -123
  44. package/sources/skills/mvt-plan-dev/business.md +101 -20
  45. package/sources/skills/mvt-plan-dev/manifest.yaml +90 -91
  46. package/sources/skills/mvt-quick-dev/business.md +2 -1
  47. package/sources/skills/mvt-quick-dev/manifest.yaml +84 -69
  48. package/sources/skills/mvt-refactor/business.md +2 -1
  49. package/sources/skills/mvt-refactor/manifest.yaml +104 -86
  50. package/sources/skills/mvt-resume/business.md +28 -68
  51. package/sources/skills/mvt-resume/manifest.yaml +81 -71
  52. package/sources/skills/mvt-review/business.md +3 -3
  53. package/sources/skills/mvt-review/manifest.yaml +108 -87
  54. package/sources/skills/mvt-status/business.md +14 -18
  55. package/sources/skills/mvt-status/manifest.yaml +74 -66
  56. package/sources/skills/mvt-sync-context/business.md +155 -150
  57. package/sources/skills/mvt-sync-context/manifest.yaml +99 -96
  58. package/sources/skills/mvt-template/business.md +0 -2
  59. package/sources/skills/mvt-template/manifest.yaml +68 -63
  60. package/sources/skills/mvt-test/business.md +3 -3
  61. package/sources/skills/mvt-test/manifest.yaml +115 -102
  62. package/sources/skills/mvt-update-plan/business.md +83 -72
  63. package/sources/skills/mvt-update-plan/manifest.yaml +124 -132
  64. package/sources/templates/analyze-output/body.md +15 -15
  65. package/sources/templates/design-output/body.md +17 -17
  66. package/sources/templates/implement-output/body.md +11 -11
  67. package/sources/templates/review-output/body.md +11 -11
  68. package/sources/templates/test-output/body.md +7 -7
  69. package/dist/build/plan-validator.d.ts +0 -26
  70. package/dist/build/plan-validator.d.ts.map +0 -1
  71. package/dist/build/plan-validator.js +0 -225
  72. package/dist/build/plan-validator.js.map +0 -1
  73. package/dist/commands/build.d.ts +0 -5
  74. package/dist/commands/build.d.ts.map +0 -1
  75. package/dist/commands/build.js +0 -46
  76. package/dist/commands/build.js.map +0 -1
  77. package/dist/commands/migrate.d.ts +0 -18
  78. package/dist/commands/migrate.d.ts.map +0 -1
  79. package/dist/commands/migrate.js +0 -163
  80. package/dist/commands/migrate.js.map +0 -1
  81. package/dist/fs/protection.d.ts +0 -15
  82. package/dist/fs/protection.d.ts.map +0 -1
  83. package/dist/fs/protection.js +0 -16
  84. package/dist/fs/protection.js.map +0 -1
@@ -1,63 +1,68 @@
1
- name: mvt-template
2
- output: .claude/skills/mvt-template/SKILL.md
3
-
4
- frontmatter:
5
- name: mvt-template
6
- description: "View, customize, and manage output templates for MVTT skills. This skill should be used when user wants to inspect available templates, create custom template versions, reset customizations, or export templates."
7
-
8
- sections:
9
- - type: inline
10
- content: |
11
- # MVT Custom Template
12
-
13
- ## Purpose
14
-
15
- View, customize, and manage MVTT output templates. Inspect default templates, create custom versions that override defaults, reset customizations, and export templates.
16
-
17
- - type: shared
18
- source: sections/role-header.md
19
- params:
20
- role: Conductor
21
- role_desc: "a Workflow Coordinator"
22
- decision_rules:
23
- - rule: "No arguments -> Show template list with status"
24
- - rule: "User selects \"view\" -> Display full template content (custom version if exists)"
25
- - rule: "User selects \"customize\" -> Guide through modification process"
26
- - rule: "User selects \"reset\" -> Delete custom version, restore default"
27
- - rule: "User selects \"export\" -> Output template to specified location"
28
- - rule: "Custom template must preserve frontmatter format"
29
- boundaries:
30
- - scope: "modify default templates in `_templates/` root"
31
- skill: "(Only create/modify in `custom/`)"
32
- - scope: "modify skill logic"
33
- skill: "(Only change output formatting)"
34
-
35
- - type: shared
36
- source: sections/activation-load-context.md
37
- params:
38
- extended_context:
39
- - "Scan `.ai-agents/skills/_templates/custom/` for existing customizations"
40
-
41
- - type: shared
42
- source: sections/activation-load-config.md
43
-
44
- - type: shared
45
- source: sections/output-language-constraint.md
46
-
47
- - type: inline
48
- content: |
49
- ### Step 3: Pre-flight Checks
50
- - No blocking checks required.
51
-
52
- - type: file
53
- source: ./business.md
54
-
55
- - type: shared
56
- source: sections/session-update.md
57
- params:
58
- read_only: true
59
-
60
- - type: shared
61
- source: sections/footer-next-steps.md
62
- params:
63
- current_skill: mvt-template
1
+ name: mvt-template
2
+ output: .claude/skills/mvt-template/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-template
6
+ description: "View, customize, and manage output templates for MVTT skills. This skill should be used when user wants to inspect available templates, create custom template versions, reset customizations, or export templates."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Custom Template
12
+
13
+ ## Purpose
14
+
15
+ View, customize, and manage MVTT output templates. Inspect default templates, create custom versions that override defaults, reset customizations, and export templates.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Conductor
21
+ role_desc: "a Workflow Coordinator"
22
+ decision_rules:
23
+ - rule: "No arguments -> Show template list with status"
24
+ - rule: "User selects \"view\" -> Display full template content (custom version if exists)"
25
+ - rule: "User selects \"customize\" -> Guide through modification process"
26
+ - rule: "User selects \"reset\" -> Delete custom version, restore default"
27
+ - rule: "User selects \"export\" -> Output template to specified location"
28
+ - rule: "Custom template must preserve frontmatter format"
29
+ boundaries:
30
+ - scope: "modify default templates in `_templates/` root (only create/modify in `custom/`)"
31
+ skill: "(constraint)"
32
+ - scope: "modify skill logic (only change output formatting)"
33
+ skill: "(constraint)"
34
+
35
+ - type: shared
36
+ source: sections/activation-load-context.md
37
+ params:
38
+ extended_context:
39
+ - "Scan `.ai-agents/skills/_templates/custom/` for existing customizations"
40
+
41
+ - type: shared
42
+ source: sections/activation-load-config.md
43
+
44
+ - type: inline
45
+ content: |
46
+ ### Step 4: Pre-flight Checks
47
+ - No blocking checks required.
48
+
49
+ - type: file
50
+ source: ./business.md
51
+
52
+ - type: shared
53
+ source: sections/session-update.md
54
+ params:
55
+ read_only: true
56
+
57
+ - type: shared
58
+ source: sections/footer-next-steps.md
59
+ params:
60
+ current_skill: mvt-template
61
+ conditional_suggestions:
62
+ conditions:
63
+ - condition: "template customized"
64
+ primary: mvt-status
65
+ primary_desc: "Check project status"
66
+ - condition: "template reset to default"
67
+ primary: mvt-help
68
+ primary_desc: "Review available skills and templates"
@@ -76,8 +76,7 @@
76
76
  - Record each finding with: scenario id, expected vs observed, severity (Critical / Warning), and recommend `/mvt-fix`.
77
77
 
78
78
  ### Step 9: Write Artifact
79
- - **Path**: `.ai-agents/workspace/artifacts/{active_change.id}/tests/test-design.md`.
80
- - **Template**: `.ai-agents/skills/_templates/test-output.md` (custom override at `_templates/custom/...` takes precedence).
79
+ - **Path and template**: as defined in the **Artifact Structure** section below.
81
80
  - **Required content** (mapped to template headings):
82
81
  - `Scope` -- target files, fallbacks applied.
83
82
  - `Test Framework & Layout` -- chosen framework, file layout convention.
@@ -89,7 +88,8 @@
89
88
  - `Suggested Run Commands` -- one or two commands the user can copy-paste.
90
89
  - The actual test files go to the project tree; the artifact is a record.
91
90
 
92
- ### Step 10: (session update handled by shared section)
91
+ ### Step 10: State Update
92
+ Apply the State Update rules defined in the **State Update** section below.
93
93
 
94
94
  ## Edge Cases & Errors
95
95
 
@@ -1,102 +1,115 @@
1
- name: mvt-test
2
- output: .claude/skills/mvt-test/SKILL.md
3
-
4
- frontmatter:
5
- name: mvt-test
6
- description: "Generate and design tests to validate implementations. This skill should be used when user wants to write tests, validate code, generate test cases, or analyze test coverage."
7
-
8
- sections:
9
- - type: inline
10
- content: |
11
- # MVT Test
12
-
13
- ## Purpose
14
-
15
- Design and write tests to validate implementations against requirements and business rules. Ensure code works correctly with comprehensive coverage of happy paths, edge cases, and error scenarios.
16
-
17
- - type: shared
18
- source: sections/role-header.md
19
- params:
20
- role: Tester
21
- role_desc: "a Quality Assurance Specialist"
22
- decision_rules:
23
- - rule: "Happy path works -> Add edge case and boundary tests"
24
- - rule: "Bug found during testing -> Document with reproduction steps, suggest `/mvt-fix`"
25
- - rule: "Coverage gap found -> Add tests focused on that area"
26
- - rule: "Flaky test detected -> Flag for investigation"
27
- - rule: "Test requires external service -> Use mocks/stubs, document the dependency"
28
- - rule: "Security constraints in requirements -> Add security-focused test cases"
29
- - rule: "Existing tests conflict with new implementation -> Flag the conflict"
30
- boundaries:
31
- - scope: "modify the code being tested"
32
- skill: "/mvt-fix"
33
- - scope: "make architecture decisions"
34
- skill: "(Test against existing design)"
35
- - scope: "skip edge cases or negative tests"
36
- skill: "(Never)"
37
-
38
- - type: inline
39
- content: |
40
- ## Variants
41
-
42
- | Variant | Description |
43
- |---------|-------------|
44
- | `/mvt-test` | Generate tests for recent implementation |
45
- | `/mvt-test {feature}` | Generate tests for specific feature |
46
- | `/mvt-test --coverage` | Generate tests with coverage analysis |
47
-
48
- - type: shared
49
- source: sections/activation-load-context.md
50
- params:
51
- extended_context:
52
- - "Implementation files to be tested"
53
-
54
- - type: shared
55
- source: sections/activation-load-config.md
56
-
57
- - type: shared
58
- source: sections/output-language-constraint.md
59
-
60
- - type: shared
61
- source: sections/activation-preflight.md
62
- params:
63
- checks:
64
- - order: "1"
65
- field: "session.initialized_at"
66
- level: "WARN"
67
- message: "Session not initialized. Run `/mvt-init` first."
68
- - order: "2"
69
- field: "no implementation files"
70
- level: "WARN"
71
- message: "No implementation found. Run `/mvt-implement` first."
72
-
73
- - type: inline
74
- content: |
75
- ## Test Case Types
76
-
77
- | Type | Description | Priority |
78
- |------|-------------|----------|
79
- | Happy Path | Normal successful flow | High |
80
- | Edge Case | Boundary conditions | High |
81
- | Negative | Invalid inputs, errors | High |
82
- | Security | Authentication, injection | Medium |
83
- | Performance | Load, stress | Low |
84
-
85
- - type: file
86
- source: ./business.md
87
-
88
- - type: inline
89
- content: |
90
- ## Artifact Structure
91
- Read the document structure template from: `.ai-agents/skills/_templates/test-output.md`
92
- If a custom version exists at `.ai-agents/skills/_templates/custom/test-output.md`, use the custom version instead.
93
- The template defines section headings only. Generate content for each section based on test design results.
94
- Write the artifact to: `.ai-agents/workspace/artifacts/{change-id}/tests/test-design.md`
95
-
96
- - type: shared
97
- source: sections/session-update.md
98
-
99
- - type: shared
100
- source: sections/footer-next-steps.md
101
- params:
102
- current_skill: mvt-test
1
+ name: mvt-test
2
+ output: .claude/skills/mvt-test/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-test
6
+ description: "Generate and design tests to validate implementations. This skill should be used when user wants to write tests, validate code, generate test cases, or analyze test coverage."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Test
12
+
13
+ ## Purpose
14
+
15
+ Design and write tests to validate implementations against requirements and business rules. Ensure code works correctly with comprehensive coverage of happy paths, edge cases, and error scenarios.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Tester
21
+ role_desc: "a Quality Assurance Specialist"
22
+ decision_rules:
23
+ - rule: "Happy path works -> Add edge case and boundary tests"
24
+ - rule: "Bug found during testing -> Document with reproduction steps, suggest `/mvt-fix`"
25
+ - rule: "Coverage gap found -> Add tests focused on that area"
26
+ - rule: "Flaky test detected -> Flag for investigation"
27
+ - rule: "Test requires external service -> Use mocks/stubs, document the dependency"
28
+ - rule: "Security constraints in requirements -> Add security-focused test cases"
29
+ - rule: "Existing tests conflict with new implementation -> Flag the conflict"
30
+ boundaries:
31
+ - scope: "modify the code being tested"
32
+ skill: "/mvt-fix"
33
+ - scope: "make architecture decisions"
34
+ skill: "(Test against existing design)"
35
+ - scope: "skip edge cases or negative tests"
36
+ skill: "(Never)"
37
+
38
+ - type: inline
39
+ content: |
40
+ ## Variants
41
+
42
+ | Variant | Description |
43
+ |---------|-------------|
44
+ | `/mvt-test` | Generate tests for recent implementation |
45
+ | `/mvt-test {feature}` | Generate tests for specific feature |
46
+ | `/mvt-test --coverage` | Generate tests with coverage analysis |
47
+
48
+ - type: shared
49
+ source: sections/activation-load-context.md
50
+ params:
51
+ extended_context:
52
+ - "Implementation files to be tested"
53
+
54
+ - type: shared
55
+ source: sections/activation-load-config.md
56
+
57
+ - type: shared
58
+ source: sections/output-language-constraint.md
59
+
60
+ - type: shared
61
+ source: sections/activation-preflight.md
62
+ params:
63
+ checks:
64
+ - order: "1"
65
+ field: "session.initialized_at"
66
+ level: "WARN"
67
+ message: "Session not initialized. Run `/mvt-init` first."
68
+ - order: "2"
69
+ field: "implementation files (user args, implementation.md, or source tree)"
70
+ level: "WARN"
71
+ message: "No implementation found. Run `/mvt-implement` first."
72
+
73
+ - type: inline
74
+ content: |
75
+ ## Test Case Types
76
+
77
+ | Type | Description | Priority |
78
+ |------|-------------|----------|
79
+ | Happy Path | Normal successful flow | High |
80
+ | Edge Case | Boundary conditions | High |
81
+ | Negative | Invalid inputs, errors | High |
82
+ | Security | Authentication, injection | Medium |
83
+ | Performance | Load, stress | Low |
84
+
85
+ - type: file
86
+ source: ./business.md
87
+
88
+ - type: inline
89
+ content: |
90
+ ## Artifact Structure
91
+ Read the document structure template from: `.ai-agents/skills/_templates/test-output.md`
92
+ If a custom version exists at `.ai-agents/skills/_templates/custom/test-output.md`, use the custom version instead.
93
+ The template defines section headings only. Generate content for each section based on test design results.
94
+ Write the artifact to: `.ai-agents/workspace/artifacts/{change-id}/tests/test-design.md`
95
+
96
+ - type: shared
97
+ source: sections/session-update.md
98
+ params:
99
+ current_skill: mvt-test
100
+
101
+ - type: shared
102
+ source: sections/footer-next-steps.md
103
+ params:
104
+ current_skill: mvt-test
105
+ conditional_suggestions:
106
+ conditions:
107
+ - condition: "tests pass, implementation verified"
108
+ primary: mvt-review
109
+ primary_desc: "Final code review before merge"
110
+ - condition: "tests reveal bugs"
111
+ primary: mvt-fix
112
+ primary_desc: "Fix the issues found during testing"
113
+ - condition: "plan exists with remaining tasks"
114
+ primary: mvt-update-plan
115
+ primary_desc: "Mark current task done and advance to next"
@@ -1,72 +1,83 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Resolve Target
4
-
5
- Required inputs:
6
-
7
- - **task_id** -- which task to update
8
- - **new_status** -- one of: `pending`, `in_progress`, `done`, `blocked`, `skipped`
9
- - **artifacts** (optional, comma-separated paths) -- files produced or touched
10
- - **notes** (optional) -- free-form note string
11
-
12
- Resolution rules:
13
-
14
- - If `task_id` is omitted AND exactly one task currently has status `in_progress` -> default to that task.
15
- - If `task_id` is omitted AND zero or multiple tasks are in_progress -> ask the user to specify.
16
- - If the user reply is the natural-language form `done` / `blocked: <reason>` (from a workflow skill's soft-prompt) -> map to:
17
- - `done` -> task = plan.current_task, new_status = done
18
- - `blocked: <reason>` -> task = plan.current_task, new_status = blocked, notes = `<reason>`
19
-
20
- ### Step 2: Load and Validate Existing Plan
21
-
22
- 1. Read `active_change.plan_path` (the file location is fixed by `/mvt-plan-dev`).
23
- 2. Parse YAML; if parse fails or schema is invalid -> stop and report. Do not attempt to repair silently.
24
- 3. Verify the target `task_id` exists in `tasks[]`. If not, list valid ids and stop.
25
-
26
- ### Step 3: Apply the Update
27
-
28
- Mutate the in-memory plan:
29
-
30
- 1. Find the target task; capture `old_status` for the report.
31
- 2. Set `tasks[i].status = new_status`.
32
- 3. If `artifacts` provided -> append to `tasks[i].artifacts` (de-duplicate).
33
- 4. If `notes` provided -> overwrite `tasks[i].notes`.
34
- 5. Update `plan.updated_at` to current ISO 8601 timestamp.
35
-
36
- ### Step 4: Recompute current_task
37
-
38
- Selection logic, in order:
39
-
40
- 1. If any task has status `in_progress` AND it is **not** the task we just changed to a terminal status (done/blocked/skipped) -> `current_task` = that task's id.
41
- 2. Otherwise pick the first task (by array order) where:
42
- - `status == pending`
43
- - All ids in `depends_on` reference tasks with status `done`
44
- 3. If no such task exists AND every task is `done` -> set `plan.status = done`, `current_task = null`.
45
- 4. If no such task exists but some tasks are still `pending` (because their dependencies are not done -- e.g., everything reachable is blocked) -> set `current_task = null`, leave `plan.status = in_progress`. Surface a warning in the output ("All remaining tasks are blocked by dependencies; resolve a blocker before continuing").
46
-
47
- If the selected next task is currently `pending` -> promote it to `in_progress` (so the plan accurately reflects the active focus). Skip this promotion if `plan.status` just transitioned to `done`.
48
-
49
- ### Step 5: Validate and Write
50
-
51
- 1. Run the plan validator on the mutated structure.
52
- 2. If validation fails -> abort the write, report the validation errors, leave the original file untouched.
53
- 3. Otherwise, write back to `active_change.plan_path`.
54
-
55
- ### Step 6: Update Session State
56
-
57
- Apply the standard State Update rules (see shared section above) AND the update-plan-specific updates:
58
-
59
- - Refresh the matching entry in `recent_changes[]`: `last_updated` -> current ISO 8601 timestamp.
60
- - Do NOT touch `active_change.has_plan` / `active_change.plan_path`.
61
-
62
- ### Step 7: Output
63
-
64
- Emit the Plan Update summary block defined in the Output Format section. Include:
65
-
66
- - The task that changed (id, title, old -> new status).
67
- - A compact table of all tasks with their current status.
68
- - The new `current_task` (or "(plan complete)" if `plan.status == done`).
69
- - A one-line "Next" hint:
70
- - If a new `current_task` is set -> recommend the skill matching its `skill_hint`.
71
- - If plan complete -> recommend `/mvt-cleanup` or starting a new change via `/mvt-analyze`.
72
- - If all remaining tasks are blocked -> recommend resolving the blocker (point at the `notes` of the blocked task).
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Resolve Target
4
+
5
+ Required inputs:
6
+
7
+ - **task_id** -- which task to update
8
+ - **new_status** -- one of: `pending`, `in_progress`, `done`, `blocked`, `skipped`
9
+ - **artifacts** (optional, comma-separated paths) -- files produced or touched
10
+ - **notes** (optional) -- free-form note string
11
+
12
+ Resolution rules:
13
+
14
+ - If `task_id` is omitted AND exactly one task currently has status `in_progress` -> default to that task.
15
+ - If `task_id` is omitted AND zero or multiple tasks are in_progress -> ask the user to specify.
16
+ - If the user reply is the natural-language form `done` / `blocked: <reason>` (from a workflow skill's soft-prompt) -> map to:
17
+ - `done` -> task = plan.current_task, new_status = done
18
+ - `blocked: <reason>` -> task = plan.current_task, new_status = blocked, notes = `<reason>`
19
+
20
+ ### Step 2: Load and Validate Existing Plan
21
+
22
+ 1. Read `active_change.plan_path` (the file location is fixed by `/mvt-plan-dev`).
23
+ 2. Parse YAML; if parse fails or schema is invalid -> stop and report. Do not attempt to repair silently.
24
+ 3. Verify the target `task_id` exists in `tasks[]`. If not, list valid ids and stop.
25
+
26
+ ### Step 3: Apply the Update
27
+
28
+ Mutate the in-memory plan:
29
+
30
+ 1. Find the target task; capture `old_status` for the report.
31
+ 2. Set `tasks[i].status = new_status`.
32
+ 3. If `artifacts` provided -> append to `tasks[i].artifacts` (de-duplicate).
33
+ 4. If `notes` provided -> overwrite `tasks[i].notes`.
34
+ 5. Update `plan.updated_at` to current ISO 8601 timestamp.
35
+
36
+ ### Step 4: Recompute current_task
37
+
38
+ Selection logic, in order:
39
+
40
+ 1. If any task has status `in_progress` AND it is **not** the task we just changed to a terminal status (done/blocked/skipped) -> `current_task` = that task's id.
41
+ 2. Otherwise pick the first task (by array order) where:
42
+ - `status == pending`
43
+ - All ids in `depends_on` reference tasks with status `done`
44
+ 3. If no such task exists AND every task is `done` -> set `plan.status = done`, `current_task = null`.
45
+ 4. If no such task exists but some tasks are still `pending` (because their dependencies are not done -- e.g., everything reachable is blocked) -> set `current_task = null`, leave `plan.status = in_progress`. Surface a warning in the output ("All remaining tasks are blocked by dependencies; resolve a blocker before continuing").
46
+
47
+ If the selected next task is currently `pending` -> promote it to `in_progress` (so the plan accurately reflects the active focus). Skip this promotion if `plan.status` just transitioned to `done`.
48
+
49
+ ### Step 5: Validate and Write
50
+
51
+ 1. Run the plan validator on the mutated structure.
52
+ 2. If validation fails -> abort the write, report the validation errors, leave the original file untouched.
53
+ 3. Otherwise, write back to `active_change.plan_path`.
54
+
55
+ ### Step 6: Update Session State
56
+
57
+ Apply the State Update rules defined in the **State Update** section below, AND the update-plan-specific updates:
58
+
59
+ - Refresh the matching entry in `changes[]`: `updated_at` -> current ISO 8601 timestamp.
60
+ - Do NOT touch `active_change.plan_path`.
61
+
62
+ ### Step 7: Output
63
+
64
+ Emit the Plan Update summary block defined in the Output Format section. Include:
65
+
66
+ - The task that changed (id, title, old -> new status).
67
+ - A compact table of all tasks with their current status.
68
+ - The new `current_task` (or "(plan complete)" if `plan.status == done`).
69
+ - A one-line "Next" hint:
70
+ - If a new `current_task` is set -> recommend the skill matching its `skill_hint`.
71
+ - If plan complete -> recommend `/mvt-cleanup` or starting a new change via `/mvt-analyze`.
72
+ - If all remaining tasks are blocked -> recommend resolving the blocker (point at the `notes` of the blocked task).
73
+
74
+ ## Edge Cases & Errors
75
+
76
+ | Case | Handling |
77
+ |------|----------|
78
+ | `plan.yaml` not found at `active_change.plan_path` | Abort with error: "No plan found. Run `/mvt-plan-dev` to create one." |
79
+ | Task id provided does not exist in `plan.yaml` | Abort with error listing valid task ids |
80
+ | Transition to `done` but `depends_on` tasks are not all `done` | Warn but allow: "Task marked done despite unfinished dependencies — verify correctness" |
81
+ | All tasks are `done` but user marks another as `in_progress` | Reject: plan is already complete; suggest creating a new change |
82
+ | Circular dependency detected in `depends_on` | Report the cycle and refuse to auto-advance `current_task`; suggest manual fix |
83
+ | `plan.yaml` write fails (permission denied, invalid YAML state) | Abort; do not update session; report the write error |