@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.
Files changed (145) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +131 -147
  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 +18 -0
  24. package/dist/commands/migrate.d.ts.map +1 -0
  25. package/dist/commands/migrate.js +163 -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 +192 -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 +34 -26
  65. package/sources/skills/mvt-check-context/business.md +89 -42
  66. package/sources/skills/mvt-check-context/manifest.yaml +10 -21
  67. package/sources/skills/mvt-cleanup/business.md +80 -31
  68. package/sources/skills/mvt-cleanup/manifest.yaml +85 -93
  69. package/sources/skills/mvt-config/business.md +94 -26
  70. package/sources/skills/mvt-config/manifest.yaml +15 -27
  71. package/sources/skills/mvt-create-skill/business.md +224 -111
  72. package/sources/skills/mvt-create-skill/manifest.yaml +31 -15
  73. package/sources/skills/mvt-design/business.md +116 -34
  74. package/sources/skills/mvt-design/manifest.yaml +22 -31
  75. package/sources/skills/mvt-fix/business.md +103 -28
  76. package/sources/skills/mvt-fix/manifest.yaml +8 -22
  77. package/sources/skills/mvt-help/business.md +74 -70
  78. package/sources/skills/mvt-help/manifest.yaml +16 -10
  79. package/sources/skills/mvt-implement/business.md +91 -32
  80. package/sources/skills/mvt-implement/manifest.yaml +17 -33
  81. package/sources/skills/mvt-init/business.md +164 -49
  82. package/sources/skills/mvt-init/manifest.yaml +36 -28
  83. package/sources/skills/mvt-manage-context/business.md +175 -0
  84. package/sources/skills/mvt-manage-context/manifest.yaml +123 -0
  85. package/sources/skills/mvt-plan-dev/business.md +75 -0
  86. package/sources/skills/mvt-plan-dev/manifest.yaml +91 -0
  87. package/sources/skills/mvt-quick-dev/business.md +99 -0
  88. package/sources/skills/mvt-quick-dev/manifest.yaml +69 -0
  89. package/sources/skills/mvt-refactor/business.md +104 -33
  90. package/sources/skills/mvt-refactor/manifest.yaml +17 -32
  91. package/sources/skills/mvt-resume/business.md +137 -0
  92. package/sources/skills/mvt-resume/manifest.yaml +71 -0
  93. package/sources/skills/mvt-review/business.md +112 -49
  94. package/sources/skills/mvt-review/manifest.yaml +15 -34
  95. package/sources/skills/mvt-status/business.md +71 -24
  96. package/sources/skills/mvt-status/manifest.yaml +18 -26
  97. package/sources/skills/mvt-sync-context/business.md +148 -23
  98. package/sources/skills/mvt-sync-context/manifest.yaml +51 -39
  99. package/sources/skills/mvt-template/business.md +96 -49
  100. package/sources/skills/mvt-template/manifest.yaml +13 -21
  101. package/sources/skills/mvt-test/business.md +104 -36
  102. package/sources/skills/mvt-test/manifest.yaml +14 -23
  103. package/sources/skills/mvt-update-plan/business.md +72 -0
  104. package/sources/skills/mvt-update-plan/manifest.yaml +132 -0
  105. package/sources/templates/analyze-output/body.md +8 -31
  106. package/sources/templates/analyze-output/manifest.yaml +11 -11
  107. package/sources/templates/design-output/body.md +17 -50
  108. package/sources/templates/design-output/manifest.yaml +11 -11
  109. package/sources/templates/implement-output/body.md +6 -27
  110. package/sources/templates/implement-output/manifest.yaml +11 -11
  111. package/sources/templates/project-context/body.md +13 -0
  112. package/sources/templates/project-context/manifest.yaml +12 -0
  113. package/sources/templates/review-output/body.md +6 -40
  114. package/sources/templates/review-output/manifest.yaml +11 -11
  115. package/sources/templates/test-output/body.md +4 -28
  116. package/sources/templates/test-output/manifest.yaml +11 -11
  117. package/sources/knowledge/core/review-principles.md +0 -51
  118. package/sources/knowledge/patterns/clean-architecture/manifest.yaml +0 -66
  119. package/sources/knowledge/patterns/clean-architecture/review-checklist.md +0 -230
  120. package/sources/knowledge/patterns/ddd/manifest.yaml +0 -83
  121. package/sources/knowledge/patterns/ddd/review-checklist.md +0 -226
  122. package/sources/knowledge/patterns/ddd/tactical-patterns.md +0 -12
  123. package/sources/knowledge/patterns/frontend-react/manifest.yaml +0 -44
  124. package/sources/knowledge/patterns/frontend-react/review-checklist.md +0 -78
  125. package/sources/knowledge/patterns/manifest.yaml +0 -113
  126. package/sources/skills/mvt-add-context/business.md +0 -47
  127. package/sources/skills/mvt-add-context/manifest.yaml +0 -83
  128. package/sources/templates/analyze-code-output/body.md +0 -44
  129. package/sources/templates/analyze-code-output/manifest.yaml +0 -11
  130. package/sources/templates/cleanup-output/body.md +0 -9
  131. package/sources/templates/cleanup-output/manifest.yaml +0 -11
  132. package/sources/templates/config-output/body.md +0 -11
  133. package/sources/templates/config-output/manifest.yaml +0 -11
  134. package/sources/templates/context-check-output/body.md +0 -32
  135. package/sources/templates/context-check-output/manifest.yaml +0 -11
  136. package/sources/templates/fix-output/body.md +0 -30
  137. package/sources/templates/fix-output/manifest.yaml +0 -11
  138. package/sources/templates/init-output/body.md +0 -34
  139. package/sources/templates/init-output/manifest.yaml +0 -11
  140. package/sources/templates/refactor-output/body.md +0 -32
  141. package/sources/templates/refactor-output/manifest.yaml +0 -11
  142. package/sources/templates/status-output/body.md +0 -36
  143. package/sources/templates/status-output/manifest.yaml +0 -11
  144. package/sources/templates/sync-context-output/body.md +0 -16
  145. 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` |
@@ -3,7 +3,7 @@ output: .claude/skills/mvt-implement/SKILL.md
3
3
 
4
4
  frontmatter:
5
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."
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
7
 
8
8
  sections:
9
9
  - type: inline
@@ -12,7 +12,7 @@ sections:
12
12
 
13
13
  ## Purpose
14
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.
15
+ Write production code based on architecture designs. Follow established module boundaries, layer constraints, and coding standards.
16
16
 
17
17
  - type: shared
18
18
  source: sections/role-header.md
@@ -36,15 +36,13 @@ sections:
36
36
 
37
37
  - type: shared
38
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
39
 
45
40
  - type: shared
46
41
  source: sections/activation-load-config.md
47
42
 
43
+ - type: shared
44
+ source: sections/output-language-constraint.md
45
+
48
46
  - type: shared
49
47
  source: sections/activation-preflight.md
50
48
  params:
@@ -52,45 +50,31 @@ sections:
52
50
  - order: "1"
53
51
  field: "session.initialized_at"
54
52
  level: "BLOCK"
55
- message: 'Session not initialized. Run `/mvt-init` first.'
53
+ message: "Session not initialized. Run `/mvt-init` first."
56
54
  - order: "2"
57
- field: "project.name"
55
+ field: "projects[] in project-context.yaml"
58
56
  level: "BLOCK"
59
- message: 'Project not initialized. Run `/mvt-init` first.'
57
+ message: "Project not initialized. Run `/mvt-init` first."
60
58
  - order: "3"
61
- field: "pattern.active"
59
+ field: "modules in project-context.md"
62
60
  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.
61
+ message: "No architecture defined. Run `/mvt-design` first. (allow user to proceed)"
73
62
 
74
63
  - type: file
75
64
  source: ./business.md
76
65
 
77
66
  - type: inline
78
67
  content: |
79
- ## Output Format
80
-
81
- Read and use the output template from: `.ai-agents/skills/_templates/implement-output.md`
82
-
68
+ ## Artifact Structure
69
+ Read the document structure template from: `.ai-agents/skills/_templates/implement-output.md`
83
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`
84
73
 
85
- Fill the template placeholders with the implementation results.
86
-
87
- Every response MUST end with a Suggested Next Steps section.
74
+ - type: shared
75
+ source: sections/session-update.md
88
76
 
89
77
  - type: shared
90
78
  source: sections/footer-next-steps.md
91
79
  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"
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[]`.
@@ -3,7 +3,7 @@ output: .claude/skills/mvt-init/SKILL.md
3
3
 
4
4
  frontmatter:
5
5
  name: mvt-init
6
- description: "Initialize or refresh a project with comprehensive analysis. Detects tech stack, suggests architecture patterns, and sets up workspace state. Use when starting a new project or refreshing an existing one."
6
+ description: "Initialize or refresh a project by scanning its structure, detecting tech stack, and inferring project type. This skill should be used when starting a new project, re-initializing after structural changes, or setting up the MVTT workspace."
7
7
 
8
8
  sections:
9
9
  - type: inline
@@ -12,7 +12,7 @@ sections:
12
12
 
13
13
  ## Purpose
14
14
 
15
- Initialize a project by scanning its structure, detecting the tech stack, suggesting an architecture pattern, and setting up the workspace state files. This is the entry point for the MVTT framework.
15
+ Initialize a project by scanning its structure, detecting tech stack, inferring project type, and writing the lean project index. This is the entry point for the MVTT framework.
16
16
 
17
17
  - type: shared
18
18
  source: sections/role-header.md
@@ -24,9 +24,14 @@ sections:
24
24
  - rule: "If `session.yaml` shows `initialized_at: \"\"` -> This is a fresh init"
25
25
  - rule: "If `session.yaml` shows existing data -> This is a refresh (preserve existing state)"
26
26
  - rule: "If no project files found -> Warn user this may be an empty project"
27
+ - rule: "If multiple languages detected -> Flag as monorepo candidate, identify primary language"
28
+ - rule: "If project type is ambiguous -> Prompt for confirmation between top candidates"
29
+ - rule: "If existing workspace files found on refresh -> Show diff and confirm before overwrite"
27
30
  boundaries:
28
31
  - scope: "analyze requirements"
29
32
  skill: "/mvt-analyze"
33
+ - scope: "analyze existing code"
34
+ skill: "/mvt-analyze-code"
30
35
  - scope: "design architecture"
31
36
  skill: "/mvt-design"
32
37
  - scope: "write implementation code"
@@ -38,20 +43,22 @@ sections:
38
43
 
39
44
  | Variant | Description |
40
45
  |---------|-------------|
41
- | `/mvt-init` | Standard initialization (balanced scan) |
42
- | `/mvt-init --light` | Quick scan, minimal analysis |
43
- | `/mvt-init --deep` | Exhaustive scan, comprehensive analysis |
44
- | `/mvt-init --refresh` | Re-scan existing project, preserve workspace state |
46
+ | `/mvt-init` | Standard initialization (scan + detect + write index) |
47
+ | `/mvt-init --refresh` | Re-scan existing project -- preserve user state, update auto-detectable fields, show diff before writing |
45
48
 
46
49
  - type: shared
47
50
  source: sections/activation-load-context.md
48
51
  params:
49
52
  extended_context:
50
53
  - "Scan project root for config files (package.json, requirements.txt, pom.xml, etc.)"
54
+ - "Scan project root for directory structure (src/, lib/, app/, tests/, etc.)"
51
55
 
52
56
  - type: shared
53
57
  source: sections/activation-load-config.md
54
58
 
59
+ - type: shared
60
+ source: sections/output-language-constraint.md
61
+
55
62
  - type: shared
56
63
  source: sections/activation-preflight.md
57
64
  params:
@@ -61,33 +68,34 @@ sections:
61
68
  level: "INFO"
62
69
  message: "This is a first-time init, proceed normally."
63
70
 
64
- - type: inline
65
- content: |
66
- ### Step 4: Execute
67
- Proceed to Execution Flow below.
68
-
69
71
  - type: file
70
72
  source: ./business.md
71
73
 
72
- - type: inline
73
- content: |
74
- ## Output Format
75
-
76
- Read and use the output template from: `.ai-agents/skills/_templates/init-output.md`
77
-
78
- If a custom version exists at `.ai-agents/skills/_templates/custom/init-output.md`, use the custom version instead.
79
74
 
80
- Fill the template placeholders with the initialization results.
81
-
82
- Every response MUST end with a Suggested Next Steps section.
75
+ - type: shared
76
+ source: sections/session-update.md
77
+ params:
78
+ update_initialized_at: true
83
79
 
84
80
  - type: shared
85
81
  source: sections/footer-next-steps.md
86
82
  params:
87
- next_primary: mvt-analyze
88
- next_primary_desc: "Start analyzing requirements"
89
- always_show:
90
- - skill: mvt-status
91
- desc: "View project status"
92
- - skill: mvt-config
93
- desc: "Adjust configuration settings"
83
+ current_skill: mvt-init
84
+ conditional_suggestions:
85
+ conditions:
86
+ - condition: "has_existing_code"
87
+ primary: mvt-analyze-code
88
+ primary_desc: "Reverse-analyze existing codebase to generate project-context.md"
89
+ - condition: "empty_project"
90
+ primary: mvt-manage-context
91
+ primary_desc: "Manually add project context, requirements, or team conventions"
92
+ - condition: "default"
93
+ primary: mvt-analyze
94
+ primary_desc: "Start analyzing requirements"
95
+ alternatives:
96
+ - skill: mvt-manage-context
97
+ desc: "Manually add team conventions or domain knowledge"
98
+ - skill: mvt-analyze
99
+ desc: "Start from a requirements document"
100
+ - skill: mvt-status
101
+ desc: "Inspect current project status"