@uoyo/mvtt 2.0.0-beta.0 → 2.0.0-beta.2

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 (151) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +194 -209
  3. package/dist/build/assembler.d.ts.map +1 -1
  4. package/dist/build/assembler.js +2 -0
  5. package/dist/build/assembler.js.map +1 -1
  6. package/dist/build/plan-validator.d.ts +26 -0
  7. package/dist/build/plan-validator.d.ts.map +1 -0
  8. package/dist/build/plan-validator.js +225 -0
  9. package/dist/build/plan-validator.js.map +1 -0
  10. package/dist/build/section-loader.d.ts.map +1 -1
  11. package/dist/build/section-loader.js +45 -9
  12. package/dist/build/section-loader.js.map +1 -1
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +2 -11
  15. package/dist/cli.js.map +1 -1
  16. package/dist/commands/doctor.d.ts.map +1 -1
  17. package/dist/commands/doctor.js +0 -1
  18. package/dist/commands/doctor.js.map +1 -1
  19. package/dist/commands/install.d.ts +1 -4
  20. package/dist/commands/install.d.ts.map +1 -1
  21. package/dist/commands/install.js +18 -14
  22. package/dist/commands/install.js.map +1 -1
  23. package/dist/commands/migrate.d.ts +16 -0
  24. package/dist/commands/migrate.d.ts.map +1 -0
  25. package/dist/commands/migrate.js +118 -0
  26. package/dist/commands/migrate.js.map +1 -0
  27. package/dist/commands/update.d.ts.map +1 -1
  28. package/dist/commands/update.js +35 -2
  29. package/dist/commands/update.js.map +1 -1
  30. package/dist/fs/core-manifest.d.ts +17 -0
  31. package/dist/fs/core-manifest.d.ts.map +1 -0
  32. package/dist/fs/core-manifest.js +76 -0
  33. package/dist/fs/core-manifest.js.map +1 -0
  34. package/dist/fs/install-manifest.d.ts +1 -2
  35. package/dist/fs/install-manifest.d.ts.map +1 -1
  36. package/dist/fs/install-manifest.js +1 -2
  37. package/dist/fs/install-manifest.js.map +1 -1
  38. package/dist/fs/materialize.d.ts.map +1 -1
  39. package/dist/fs/materialize.js +23 -3
  40. package/dist/fs/materialize.js.map +1 -1
  41. package/dist/types/core-manifest.d.ts +12 -0
  42. package/dist/types/core-manifest.d.ts.map +1 -0
  43. package/dist/types/core-manifest.js +2 -0
  44. package/dist/types/core-manifest.js.map +1 -0
  45. package/dist/types/registry.d.ts +13 -5
  46. package/dist/types/registry.d.ts.map +1 -1
  47. package/install-manifest.yaml +31 -27
  48. package/package.json +57 -57
  49. package/registry.yaml +198 -209
  50. package/sources/defaults/config.yaml +27 -30
  51. package/sources/defaults/project-context.yaml +15 -26
  52. package/sources/defaults/session.yaml +31 -23
  53. package/sources/knowledge/core/manifest.yaml +4 -45
  54. package/sources/sections/activation-load-config.md +11 -5
  55. package/sources/sections/activation-load-context.md +26 -11
  56. package/sources/sections/activation-preflight.md +14 -4
  57. package/sources/sections/footer-next-steps.md +35 -9
  58. package/sources/sections/output-language-constraint.md +11 -0
  59. package/sources/sections/role-header.md +13 -13
  60. package/sources/sections/session-update.md +47 -0
  61. package/sources/skills/mvt-analyze/business.md +69 -33
  62. package/sources/skills/mvt-analyze/manifest.yaml +90 -89
  63. package/sources/skills/mvt-analyze-code/business.md +82 -35
  64. package/sources/skills/mvt-analyze-code/manifest.yaml +96 -88
  65. package/sources/skills/mvt-bug-detect/business.md +101 -0
  66. package/sources/skills/mvt-bug-detect/manifest.yaml +84 -0
  67. package/sources/skills/mvt-check-context/business.md +89 -42
  68. package/sources/skills/mvt-check-context/manifest.yaml +63 -74
  69. package/sources/skills/mvt-cleanup/business.md +80 -31
  70. package/sources/skills/mvt-cleanup/manifest.yaml +85 -93
  71. package/sources/skills/mvt-config/business.md +94 -26
  72. package/sources/skills/mvt-config/manifest.yaml +96 -108
  73. package/sources/skills/mvt-create-skill/business.md +231 -111
  74. package/sources/skills/mvt-create-skill/manifest.yaml +91 -79
  75. package/sources/skills/mvt-design/business.md +116 -34
  76. package/sources/skills/mvt-design/manifest.yaml +96 -105
  77. package/sources/skills/mvt-fix/business.md +132 -28
  78. package/sources/skills/mvt-fix/manifest.yaml +85 -86
  79. package/sources/skills/mvt-help/business.md +74 -70
  80. package/sources/skills/mvt-help/manifest.yaml +67 -61
  81. package/sources/skills/mvt-implement/business.md +91 -32
  82. package/sources/skills/mvt-implement/manifest.yaml +80 -96
  83. package/sources/skills/mvt-init/business.md +164 -49
  84. package/sources/skills/mvt-init/manifest.yaml +101 -93
  85. package/sources/skills/mvt-manage-context/business.md +175 -0
  86. package/sources/skills/mvt-manage-context/manifest.yaml +123 -0
  87. package/sources/skills/mvt-plan-dev/business.md +75 -0
  88. package/sources/skills/mvt-plan-dev/manifest.yaml +91 -0
  89. package/sources/skills/mvt-quick-dev/business.md +99 -0
  90. package/sources/skills/mvt-quick-dev/manifest.yaml +69 -0
  91. package/sources/skills/mvt-refactor/business.md +104 -33
  92. package/sources/skills/mvt-refactor/manifest.yaml +86 -101
  93. package/sources/skills/mvt-resume/business.md +137 -0
  94. package/sources/skills/mvt-resume/manifest.yaml +71 -0
  95. package/sources/skills/mvt-review/business.md +112 -49
  96. package/sources/skills/mvt-review/manifest.yaml +87 -106
  97. package/sources/skills/mvt-status/business.md +71 -24
  98. package/sources/skills/mvt-status/manifest.yaml +66 -74
  99. package/sources/skills/mvt-sync-context/business.md +150 -25
  100. package/sources/skills/mvt-sync-context/manifest.yaml +96 -84
  101. package/sources/skills/mvt-template/business.md +96 -49
  102. package/sources/skills/mvt-template/manifest.yaml +63 -71
  103. package/sources/skills/mvt-test/business.md +104 -36
  104. package/sources/skills/mvt-test/manifest.yaml +102 -111
  105. package/sources/skills/mvt-update-plan/business.md +72 -0
  106. package/sources/skills/mvt-update-plan/manifest.yaml +132 -0
  107. package/sources/templates/analyze-output/body.md +15 -38
  108. package/sources/templates/analyze-output/manifest.yaml +11 -11
  109. package/sources/templates/design-output/body.md +17 -50
  110. package/sources/templates/design-output/manifest.yaml +11 -11
  111. package/sources/templates/implement-output/body.md +11 -32
  112. package/sources/templates/implement-output/manifest.yaml +11 -11
  113. package/sources/templates/project-context/body.md +13 -0
  114. package/sources/templates/project-context/manifest.yaml +12 -0
  115. package/sources/templates/review-output/body.md +11 -45
  116. package/sources/templates/review-output/manifest.yaml +11 -11
  117. package/sources/templates/test-output/body.md +7 -31
  118. package/sources/templates/test-output/manifest.yaml +11 -11
  119. package/dist/fs/protection.d.ts +0 -15
  120. package/dist/fs/protection.d.ts.map +0 -1
  121. package/dist/fs/protection.js +0 -16
  122. package/dist/fs/protection.js.map +0 -1
  123. package/sources/knowledge/core/review-principles.md +0 -51
  124. package/sources/knowledge/patterns/clean-architecture/manifest.yaml +0 -66
  125. package/sources/knowledge/patterns/clean-architecture/review-checklist.md +0 -230
  126. package/sources/knowledge/patterns/ddd/manifest.yaml +0 -83
  127. package/sources/knowledge/patterns/ddd/review-checklist.md +0 -226
  128. package/sources/knowledge/patterns/ddd/tactical-patterns.md +0 -12
  129. package/sources/knowledge/patterns/frontend-react/manifest.yaml +0 -44
  130. package/sources/knowledge/patterns/frontend-react/review-checklist.md +0 -78
  131. package/sources/knowledge/patterns/manifest.yaml +0 -113
  132. package/sources/skills/mvt-add-context/business.md +0 -47
  133. package/sources/skills/mvt-add-context/manifest.yaml +0 -83
  134. package/sources/templates/analyze-code-output/body.md +0 -44
  135. package/sources/templates/analyze-code-output/manifest.yaml +0 -11
  136. package/sources/templates/cleanup-output/body.md +0 -9
  137. package/sources/templates/cleanup-output/manifest.yaml +0 -11
  138. package/sources/templates/config-output/body.md +0 -11
  139. package/sources/templates/config-output/manifest.yaml +0 -11
  140. package/sources/templates/context-check-output/body.md +0 -32
  141. package/sources/templates/context-check-output/manifest.yaml +0 -11
  142. package/sources/templates/fix-output/body.md +0 -30
  143. package/sources/templates/fix-output/manifest.yaml +0 -11
  144. package/sources/templates/init-output/body.md +0 -34
  145. package/sources/templates/init-output/manifest.yaml +0 -11
  146. package/sources/templates/refactor-output/body.md +0 -32
  147. package/sources/templates/refactor-output/manifest.yaml +0 -11
  148. package/sources/templates/status-output/body.md +0 -36
  149. package/sources/templates/status-output/manifest.yaml +0 -11
  150. package/sources/templates/sync-context-output/body.md +0 -16
  151. package/sources/templates/sync-context-output/manifest.yaml +0 -11
@@ -1,32 +1,91 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Load Design Context
4
- - Read architecture design from artifacts
5
- - Read module structure from `project-context.yaml`
6
- - Read coding standards if available
7
- - Identify files to create or modify
8
-
9
- ### Step 2: Plan Implementation
10
- - Map design components to file structure
11
- - Define implementation order (dependencies first)
12
- - Identify shared utilities or base classes needed
13
-
14
- ### Step 3: Implement Code
15
- - Follow architecture module boundaries
16
- - Use interfaces defined in design
17
- - Apply coding standards
18
- - Add error handling at system boundaries
19
- - Include inline comments for complex logic only
20
-
21
- ### Step 4: Verify Design Compliance
22
- - Check each file against its designated module/layer
23
- - Verify dependency direction (no layer violations)
24
- - Confirm interface contracts are satisfied
25
-
26
- ### Step 5: Update Workspace
27
- 1. Update `.ai-agents/workspace/session.yaml`:
28
- - Set `progress.implement: done`
29
- - Set `session.last_command: "/mvt-implement"`
30
- - Append one-line summary to `recent_actions` (keep max 3)
31
- 2. Write artifact: `.ai-agents/workspace/artifacts/{change-id}/implementation.md`
32
- 3. Write the actual code files to the project
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Load Inputs
4
+ - **Required**:
5
+ - The actual source files referenced in the design's `File Structure` and `Change Tracking` sections.
6
+ - **Fallback**:
7
+ - If `design.md` is missing, surface a WARN and ask the user whether to (a) run `/mvt-design` first or (b) proceed using their conversational description as the design (mark artifact with "Source: conversation only").
8
+ - If `coding-standards.md` is missing, fall back to language/framework defaults inferred from `project-context.yaml`.
9
+
10
+ ### Step 2: Plan the Implementation
11
+ - **What**: produce an ordered file list with the smallest possible commit boundary per group.
12
+ - **How**:
13
+ 1. Take `Change Tracking` from `design.md` as the source of truth for which files are in scope.
14
+ 2. Topologically order files by dependency: domain entities -> repositories/adapters -> use-case/services -> controllers/UI.
15
+ 3. Group consecutive files that share a single conceptual change into one commit boundary.
16
+ 4. For each file, decide: `create | modify | delete`, and write a one-line intent.
17
+ - **Plan-aware behavior**: if `plan.yaml` is present, restrict scope to the files implied by `current_task` (cross-reference `plan.tasks[*].artifacts.files`); do NOT silently expand into other tasks.
18
+ - **Output of this step**: an in-conversation list shown to user as a preview, with no write yet.
19
+
20
+ ### Step 3: Confirm Scope (when needed)
21
+ - **Confirm before writing if any are true**:
22
+ - The plan touches > 5 files.
23
+ - The plan introduces a new public API (exported symbol, HTTP endpoint, CLI flag).
24
+ - The plan deletes existing code (delete count > 0).
25
+ - The plan deviates from `design.md` (e.g., adds files not in `Change Tracking` or skips files listed there).
26
+ - **Otherwise**: proceed silently.
27
+ - **On deviation from design**: explain the deviation reason in one line; if the deviation is structural (new module, layer change, interface break), STOP and recommend re-running `/mvt-design`.
28
+
29
+ ### Step 4: Implement Code
30
+ - **What**: write/modify the planned files, one commit-group at a time.
31
+ - **How**:
32
+ 1. For each commit-group: write all files, then move on. Do not interleave groups.
33
+ 2. Follow `coding-standards.md`. Match the surrounding code style if standards are silent.
34
+ 3. Respect module/layer rules from `project-context.md`. Forbidden imports must NOT appear; use the abstractions defined in `design.md`'s `Key Interfaces`.
35
+ 4. Add error handling at system boundaries only (HTTP, DB, external API, file IO, message bus). Do NOT add try/catch around internal calls "just in case".
36
+ 5. Inline comments only for: non-obvious algorithmic choices, deliberate workarounds with a reason, interface contracts not expressible in code. Never narrate WHAT the code does.
37
+ 6. Do NOT introduce abstractions, helpers, or feature flags beyond what the task requires.
38
+
39
+ ### Step 5: Verify Design Compliance
40
+ - **What**: confirm the implementation matches the design before writing the artifact.
41
+ - **How**: run the checks below. Each is either Auto (mechanical / scriptable / type-checker) or Manual (read the design + diff).
42
+
43
+ | Check | Mode | Action on failure |
44
+ |-------|------|-------------------|
45
+ | Files touched == Change Tracking ± deviation noted | Auto (compare lists) | Update artifact's deviation log OR revert extras |
46
+ | Each file lives in the module/layer assigned by `Module Design` | Auto (path match against design table) | Move file or mark deliberate exception with rationale |
47
+ | Public interfaces match `Key Interfaces` (signatures, endpoints) | Auto (grep for declarations) | Adjust to match OR raise as deliberate change requiring `/mvt-design` re-run |
48
+ | Forbidden cross-layer imports absent | Auto (grep import paths against `project-context.md` rules) | BLOCK -- must fix before artifact write |
49
+ | Error handling lives only at boundaries listed in design | Manual (read code) | Refactor or document why an interior catch was needed |
50
+ | No new external deps not listed in `design.md` ADRs | Auto (diff package manifests) | Either remove or add an ADR via `/mvt-design` |
51
+
52
+ - **On any BLOCK failure**: stop, fix, re-run Step 5. Do not proceed to Step 6.
53
+
54
+ ### Step 6: Run Quick Self-Check
55
+ - **What**: light-weight verification before handing off to `/mvt-review` or `/mvt-test`.
56
+ - **How**:
57
+ 1. If a type-checker is configured for the project (`tsc`, `mypy`, `cargo check`, etc.), run it on changed files only. Surface failures.
58
+ 2. If a fast-running test target exists for the affected module, suggest the command but do not auto-run unless user explicitly approved.
59
+ 3. UI/frontend changes: per project rules, ask user to verify in browser; do NOT claim "tested" if you only ran type-check.
60
+
61
+ ### Step 7: Write Artifact
62
+ - **Path**: `.ai-agents/workspace/artifacts/{active_change.id}/implementation.md`.
63
+ - **Template**: `.ai-agents/skills/_templates/implement-output.md` (custom override at `_templates/custom/...` takes precedence).
64
+ - **Required content** (mapped to template headings):
65
+ - `Implementation Summary` -- one paragraph: what was built, scope.
66
+ - `Files Touched` -- table: path | create/modify/delete | one-line intent.
67
+ - `Design Compliance` -- summary of Step 5 checks (passed / deviated, with reasons).
68
+ - `Deviations from Design` -- empty list is acceptable; otherwise list each deviation with rationale.
69
+ - `Self-Check Results` -- type-check status, suggested test commands (Step 6).
70
+ - `Open TODOs` -- anything deferred for `/mvt-review`, `/mvt-test`, or follow-up changes.
71
+ - The actual source code goes to the project tree; the artifact is a record, not the code itself.
72
+
73
+ ### Step 8: Plan-Aware Progress Hint (if applicable)
74
+ - If `plan.yaml` exists and a single `current_task` covers this implementation, suggest the user run `/mvt-update-plan <task-id> done` (or `blocked` with reason).
75
+ - Do NOT modify `plan.yaml` directly from this skill; it is owned by `/mvt-update-plan`.
76
+ - Do NOT modify `recent_changes` directly; it is owned by `/mvt-plan-dev` / `/mvt-update-plan`.
77
+
78
+ ### Step 9: (session update handled by shared section)
79
+ - Standard `skill_history` entry must include `change_id`. All other state mutations are delegated.
80
+
81
+ ## Edge Cases & Errors
82
+
83
+ | Case | Handling |
84
+ |------|----------|
85
+ | `design.md` missing | WARN, ask user; if they proceed, mark artifact "Source: conversation only" and skip Step 5 design-match checks |
86
+ | Implementation reveals the design is infeasible | STOP at Step 4, document the blocker in conversation, recommend `/mvt-design` re-run -- do not silently improvise an alternative |
87
+ | Type-checker fails on pre-existing errors unrelated to the change | Note in artifact, do not attempt blanket fixes outside scope |
88
+ | User aborts at Step 3 confirmation | Do not write any source files or artifact |
89
+ | File listed in `Change Tracking` no longer exists in the working tree | Surface, ask user whether design is stale or file was deleted in a parallel change |
90
+ | Implementation must touch a file outside the active project (other repo / submodule) | STOP -- this is out of scope for `/mvt-implement`; surface and ask user to plan it as a separate change |
91
+ | Plan task is `blocked` or `done` already | Refuse to implement that task; ask user to pick another `current_task` or run `/mvt-update-plan` |
@@ -1,96 +1,80 @@
1
- name: mvt-implement
2
- output: .claude/skills/mvt-implement/SKILL.md
3
-
4
- frontmatter:
5
- name: mvt-implement
6
- description: "Implement features based on architecture design. Writes production code following established patterns and design blueprints. Use when user wants to implement a feature or write code."
7
-
8
- sections:
9
- - type: inline
10
- content: |
11
- # MVT Implement
12
-
13
- ## Purpose
14
-
15
- Write production code based on architecture designs. Follow established patterns, module boundaries, and coding standards. This is the third phase in the full workflow: analyze -> design -> implement -> review -> test.
16
-
17
- - type: shared
18
- source: sections/role-header.md
19
- params:
20
- role: Developer
21
- role_desc: "an Implementation Specialist"
22
- decision_rules:
23
- - rule: "Architecture design exists -> Follow the module boundaries, interfaces, and patterns defined in it"
24
- - rule: "Architecture missing -> Warn that `/mvt-design` is recommended, proceed if user confirms"
25
- - rule: "Code requires new module not in design -> Stop and flag for Architect via `/mvt-design`"
26
- - rule: "Multiple implementation approaches -> Pick the simplest that satisfies requirements; note alternatives"
27
- - rule: "Error handling needed -> Add for external boundaries (user input, APIs, I/O); trust internal code"
28
- - rule: "Existing tests cover changed code -> Mention which tests may need updating"
29
- boundaries:
30
- - scope: "re-analyze requirements"
31
- skill: "/mvt-analyze"
32
- - scope: "evaluate or change architecture"
33
- skill: "/mvt-design"
34
- - scope: "review own code"
35
- skill: "/mvt-review"
36
-
37
- - type: shared
38
- source: sections/activation-load-context.md
39
- params:
40
- extended_context:
41
- - ".ai-agents/knowledge/patterns/{pattern.active}/ -- Active architecture pattern knowledge"
42
- - ".ai-agents/knowledge/principle/coding-standards.md -- Project coding standards"
43
- - ".ai-agents/workspace/artifacts/{active_change.id}/ -- Analysis and design artifacts"
44
-
45
- - type: shared
46
- source: sections/activation-load-config.md
47
-
48
- - type: shared
49
- source: sections/activation-preflight.md
50
- params:
51
- checks:
52
- - order: "1"
53
- field: "session.initialized_at"
54
- level: "BLOCK"
55
- message: 'Session not initialized. Run `/mvt-init` first.'
56
- - order: "2"
57
- field: "project.name"
58
- level: "BLOCK"
59
- message: 'Project not initialized. Run `/mvt-init` first.'
60
- - order: "3"
61
- field: "pattern.active"
62
- level: "WARN"
63
- message: 'Architecture pattern not set. Suggest `/mvt-init`." (allow user to proceed)'
64
- - order: "4"
65
- field: "modules in architecture"
66
- level: "WARN"
67
- message: 'No architecture defined. Run `/mvt-design` first." (allow user to proceed)'
68
-
69
- - type: inline
70
- content: |
71
- ### Step 4: Execute
72
- Proceed to Execution Flow below.
73
-
74
- - type: file
75
- source: ./business.md
76
-
77
- - type: inline
78
- content: |
79
- ## Output Format
80
-
81
- Read and use the output template from: `.ai-agents/skills/_templates/implement-output.md`
82
-
83
- If a custom version exists at `.ai-agents/skills/_templates/custom/implement-output.md`, use the custom version instead.
84
-
85
- Fill the template placeholders with the implementation results.
86
-
87
- Every response MUST end with a Suggested Next Steps section.
88
-
89
- - type: shared
90
- source: sections/footer-next-steps.md
91
- params:
92
- next_primary: mvt-review
93
- next_primary_desc: "Review the implementation"
94
- next_alternatives:
95
- - skill: mvt-test
96
- when: "Write tests for the implementation"
1
+ name: mvt-implement
2
+ output: .claude/skills/mvt-implement/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-implement
6
+ description: "Implement features based on architecture design. This skill should be used when user wants to implement a feature, write production code, or translate design blueprints into working code."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Implement
12
+
13
+ ## Purpose
14
+
15
+ Write production code based on architecture designs. Follow established module boundaries, layer constraints, and coding standards.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Developer
21
+ role_desc: "an Implementation Specialist"
22
+ decision_rules:
23
+ - rule: "Architecture design exists -> Follow the module boundaries, interfaces, and patterns defined in it"
24
+ - rule: "Architecture missing -> Warn that `/mvt-design` is recommended, proceed if user confirms"
25
+ - rule: "Code requires new module not in design -> Stop and flag for Architect via `/mvt-design`"
26
+ - rule: "Multiple implementation approaches -> Pick the simplest that satisfies requirements; note alternatives"
27
+ - rule: "Error handling needed -> Add for external boundaries (user input, APIs, I/O); trust internal code"
28
+ - rule: "Existing tests cover changed code -> Mention which tests may need updating"
29
+ boundaries:
30
+ - scope: "re-analyze requirements"
31
+ skill: "/mvt-analyze"
32
+ - scope: "evaluate or change architecture"
33
+ skill: "/mvt-design"
34
+ - scope: "review own code"
35
+ skill: "/mvt-review"
36
+
37
+ - type: shared
38
+ source: sections/activation-load-context.md
39
+
40
+ - type: shared
41
+ source: sections/activation-load-config.md
42
+
43
+ - type: shared
44
+ source: sections/output-language-constraint.md
45
+
46
+ - type: shared
47
+ source: sections/activation-preflight.md
48
+ params:
49
+ checks:
50
+ - order: "1"
51
+ field: "session.initialized_at"
52
+ level: "BLOCK"
53
+ message: "Session not initialized. Run `/mvt-init` first."
54
+ - order: "2"
55
+ field: "projects[] in project-context.yaml"
56
+ level: "BLOCK"
57
+ message: "Project not initialized. Run `/mvt-init` first."
58
+ - order: "3"
59
+ field: "modules in project-context.md"
60
+ level: "WARN"
61
+ message: "No architecture defined. Run `/mvt-design` first. (allow user to proceed)"
62
+
63
+ - type: file
64
+ source: ./business.md
65
+
66
+ - type: inline
67
+ content: |
68
+ ## Artifact Structure
69
+ Read the document structure template from: `.ai-agents/skills/_templates/implement-output.md`
70
+ If a custom version exists at `.ai-agents/skills/_templates/custom/implement-output.md`, use the custom version instead.
71
+ The template defines section headings only. Generate content for each section based on implementation results.
72
+ Write the artifact to: `.ai-agents/workspace/artifacts/{change-id}/implementation.md`
73
+
74
+ - type: shared
75
+ source: sections/session-update.md
76
+
77
+ - type: shared
78
+ source: sections/footer-next-steps.md
79
+ params:
80
+ current_skill: mvt-implement
@@ -1,49 +1,164 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Project Discovery
4
- - Scan project root for:
5
- - Package managers (package.json, requirements.txt, Cargo.toml, go.mod, pom.xml, etc.)
6
- - Framework config files (.eslintrc, tsconfig.json, vite.config, etc.)
7
- - Source directories (src/, lib/, app/, etc.)
8
- - Test directories (tests/, __tests__/, spec/, etc.)
9
-
10
- ### Step 2: Tech Stack Detection
11
- - Identify primary language
12
- - Identify frameworks and libraries
13
- - Identify build tools
14
- - Identify test framework
15
-
16
- ### Step 3: Architecture Pattern Suggestion
17
- - Analyze directory structure against known patterns
18
- - Compare with available patterns in `.ai-agents/knowledge/patterns/`
19
- - Rank pattern matches by confidence
20
- - Present recommendation with alternatives
21
-
22
- Available patterns:
23
- 1. `ddd` -- Domain-Driven Design
24
- 2. `clean-architecture` -- Layer separation with dependency inversion
25
- 3. `frontend-react` -- React/Next.js frontend
26
- 4. `generic` -- Simple projects without specific architecture
27
-
28
- ### Step 4: User Confirmation
29
- - Present detected info and suggested pattern
30
- - Wait for user to confirm or select alternative
31
- - Options: `yes` (accept), pattern name (select different), `analyze` (create custom), `none` (skip)
32
-
33
- ### Step 5: Update Workspace
34
- 1. Write `.ai-agents/workspace/project-context.yaml`:
35
- - Set `project.name`, `project.type`, `project.root`
36
- - Set `tech_stack` (language, framework, build_tool, test_framework)
37
- - Set `architecture.pattern` if selected
38
- 2. Write `.ai-agents/workspace/session.yaml`:
39
- - Set `session.initialized_at` to current timestamp
40
- - Set `session.last_command: "/mvt-init"`
41
- - Append one-line summary to `recent_actions` (keep max 3)
42
- 3. Write `.ai-agents/config.yaml`:
43
- - Set `pattern.active` to selected pattern
44
-
45
- ### Step 6 (--deep only): Extended Analysis
46
- - Map module structure (directories -> modules)
47
- - Identify key entities and services
48
- - Map dependency relationships
49
- - Generate architecture overview diagram
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Project Discovery
4
+
5
+ Scan the project root systematically to identify all projects and their structure.
6
+
7
+ #### 1.1 Root-level file scan (priority order)
8
+
9
+ Check for these files in order of detection priority:
10
+
11
+ | Priority | File | Indicates |
12
+ |----------|------|-----------|
13
+ | 1 | `package.json` | Node.js / JavaScript / TypeScript |
14
+ | 2 | `requirements.txt` / `pyproject.toml` / `setup.py` | Python |
15
+ | 3 | `go.mod` | Go |
16
+ | 4 | `Cargo.toml` | Rust |
17
+ | 5 | `pom.xml` / `build.gradle` | Java / JVM |
18
+ | 6 | `*.sln` / `*.csproj` | .NET |
19
+ | 7 | `Gemfile` | Ruby |
20
+ | 8 | `mix.exs` | Elixir |
21
+
22
+ If **multiple** package managers are detected at root level → flag as **monorepo candidate** and identify primary vs secondary languages.
23
+
24
+ If **no** package manager is detected check for:
25
+ - Source directories (`src/`, `lib/`, `app/`) infer language from file extensions
26
+ - Any code files at all minimal detection
27
+ - Empty directory → warn user: "This appears to be an empty project. Initialize with minimal config?"
28
+
29
+ #### 1.2 Multi-project detection
30
+
31
+ After root-level scan, check for sub-projects:
32
+
33
+ | Indicator | Pattern | Example |
34
+ |-----------|---------|---------|
35
+ | Monorepo tools | `packages/`, `apps/`, `libs/`, `services/` | Turborepo, Nx, Lerna |
36
+ | Workspace config | `workspaces` in `package.json` | Yarn/pnpm workspaces |
37
+ | Multi-language | Different package managers in sub-directories | `apps/api/requirements.txt` + `apps/web/package.json` |
38
+ | Service-oriented | `services/` or `cmd/` with independent configs | Microservices |
39
+ | Independent sub-dirs | Multiple directories each with own package file | Multi-project repo |
40
+
41
+ For each detected sub-project:
42
+ 1. Identify its root path (relative to repo root)
43
+ 2. Repeat Step 1.1 scan within that path
44
+ 3. Assign a unique `name` based on directory name or package name
45
+
46
+ If no sub-projects detected single project with `name="default"`, `path="."`
47
+
48
+ #### 1.3 Directory structure scan
49
+
50
+ - Source directories: `src/`, `lib/`, `app/`, `cmd/`, `internal/`, `pkg/`
51
+ - Test directories: `tests/`, `__tests__/`, `spec/`, `test/`, `*_test/`
52
+ - Config directories: `config/`, `configs/`, `.config/`
53
+ - Framework-specific: `.eslintrc*`, `tsconfig.json`, `vite.config.*`, `next.config.*`, `Dockerfile`, `docker-compose.*`
54
+
55
+ ### Step 2: Tech Stack Detection
56
+
57
+ For each detected project, determine:
58
+
59
+ - **Primary language**: The language with the most files / deepest structure
60
+ - **Secondary languages**: Other detected languages (if any)
61
+ - **Framework**: Extract from package.json dependencies, requirements.txt, go.mod, etc.
62
+ - **Build tool**: webpack, vite, rollup, cargo, maven, gradle, etc.
63
+ - **Test framework**: jest, pytest, go test, JUnit, etc.
64
+
65
+ ### Step 3: Project Type Inference
66
+
67
+ Based on detected files and structure, infer the project type for each project:
68
+
69
+ | Signal | Inferred Type |
70
+ |--------|---------------|
71
+ | React / Vue / Angular / Next.js / Nuxt detected | `web-frontend` |
72
+ | Express / FastAPI / Spring Boot / Django REST detected | `api-service` |
73
+ | Dockerfile + exposed port, no frontend framework | `api-service` |
74
+ | CLI entry point (argparse, commander, clap) | `cli-tool` |
75
+ | `setup.py` / `pyproject.toml` with no web framework | `library` or `cli-tool` |
76
+ | Turborepo / Nx workspace config | `monorepo` |
77
+ | `packages/` or `apps/` with multiple package.json | `monorepo` |
78
+ | Airflow / Prefect / dbt detected | `data-pipeline` |
79
+ | Mobile framework (React Native, Flutter) | `mobile-app` |
80
+ | No clear signals | `generic` |
81
+
82
+ If uncertain between two types → prompt for user confirmation.
83
+
84
+ ### Step 4: User Confirmation
85
+
86
+ Present the full detection summary:
87
+
88
+ For each project:
89
+ - Name, path, type
90
+ - Tech stack (language, framework, build tool, test framework)
91
+
92
+ Wait for user to confirm or adjust:
93
+ - `yes` -- Accept all
94
+ - Provide corrections -- User specifies which fields to change
95
+ - `add` -- Add a project that was not auto-detected
96
+ - `remove` -- Remove a project from the list
97
+
98
+ ### Step 5: Write Artifacts
99
+
100
+ #### 5.1 Pre-write checks
101
+
102
+ For each target file, check if it already exists:
103
+ - If exists → compare proposed content with existing content
104
+ - If differences found → show diff and confirm overwrite with user
105
+ - If user declines → preserve existing file, skip that artifact
106
+
107
+ #### 5.2 Write files
108
+
109
+ 1. Write `.ai-agents/workspace/project-context.yaml` with lean index schema:
110
+ ```yaml
111
+ projects:
112
+ - name: "{project_name}"
113
+ path: "{relative_path}"
114
+ type: "{project_type}"
115
+ tech_stack:
116
+ primary_language: "{language}"
117
+ secondary_languages: [{...}]
118
+ framework: "{framework}"
119
+ build_tool: "{build_tool}"
120
+ test_framework: "{test_framework}"
121
+ ```
122
+ For multi-project repos, include one entry per detected project.
123
+
124
+ #### 5.3 Post-write validation
125
+
126
+ After writing all files, validate:
127
+ - `project-context.yaml` is valid YAML with `projects[]` containing at least one entry
128
+ - Each project entry has required fields: `name`, `path`, `type`, `tech_stack.primary_language`
129
+ - `session.yaml` is structurally intact and contains: `session`, `active_change` (with `plan_path` / `has_plan`), `recent_changes` (array), `skill_history`, `recent_actions`
130
+
131
+ If any validation fails → report the specific error and offer to retry or skip.
132
+
133
+ ### Step 6: Refresh Mode Handling (--refresh only)
134
+
135
+ When `--refresh` is specified:
136
+
137
+ 1. **Preserve** the following from existing files:
138
+ - `session.yaml` > `skill_history` and `recent_actions`
139
+ - `project-context.yaml` > any user-added custom fields (fields not in the standard schema)
140
+ - `config.yaml` > `preferences` section
141
+
142
+ 2. **Update** only auto-detectable fields:
143
+ - `tech_stack` (re-scan and update)
144
+ - `type` (re-infer)
145
+
146
+ 3. **Diff and confirm**: Show a summary of what will change vs what will be preserved. Ask for confirmation before writing.
147
+
148
+ 4. **Old format migration**: If existing `project-context.yaml` uses old format (has top-level `project`, `requirements`, `architecture`, `environment` keys):
149
+ - Wrap `project.*` as `projects[0]` with `name="default"`, `path="."`
150
+ - Discard `requirements`, `architecture` sections -- suggest running `/mvt-analyze-code` to regenerate
151
+ - Discard `environment` section
152
+ - Discard any `pattern` related fields
153
+
154
+ ### Step 7: Determine Project State (drives next-step recommendation)
155
+
156
+ After Step 5 writes are committed, classify the project state to select the appropriate next_suggestions branch from registry.yaml:
157
+
158
+ | Condition | Detection logic |
159
+ |-----------|-----------------|
160
+ | `has_existing_code` | Step 1 detected at least one source file (any language) under recognized source directories (`src/`, `lib/`, `app/`, `cmd/`, `internal/`, `pkg/`) OR a package manager file at root |
161
+ | `empty_project` | Step 1 found no source files AND no package manager file (truly empty or docs-only repo) -- the recommended next step is `/mvt-manage-context` to manually capture context |
162
+ | `default` | Neither condition matched (rare -- fallback path) |
163
+
164
+ Pass the resolved condition to the output template so the suggested next steps section renders the matching branch from `registry.yaml > skills.mvt-init.next_suggestions.conditional[]`.