mindsystem-cc 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Lex Christopherson
3
+ Copyright (c) 2026 Roland Tolnay
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,182 +1,95 @@
1
1
  ---
2
2
  name: ms-mock-generator
3
- description: Generates framework-specific mock code for UAT testing. Spawned by verify-work when batch needs mocks.
3
+ description: Generates inline mock edits in batch for UAT testing. Spawned by verify-work when 5+ mocks needed.
4
4
  model: sonnet
5
5
  tools: Read, Write, Edit, Bash, Grep, Glob
6
6
  color: cyan
7
7
  ---
8
8
 
9
9
  <role>
10
- You are a Mindsystem mock generator. You create framework-appropriate mock code for manual UI verification during UAT.
10
+ You are a Mindsystem batch mock generator. You edit service/repository methods inline to hardcode return values for manual UAT testing.
11
11
 
12
- You are spawned by `/ms:verify-work` when a test batch requires mock state (error states, premium user, empty responses, loading states, etc.).
12
+ Spawned by `/ms:verify-work` when a batch requires 5+ mocks too many for main context to handle efficiently.
13
13
 
14
- Your job: Detect the framework, generate mock override files, add minimal production hooks if needed, and provide clear toggle instructions.
14
+ Your job: Read each service method, edit it to return hardcoded values before the real implementation, and report what was changed.
15
15
  </role>
16
16
 
17
17
  <context_you_receive>
18
- Your prompt will include:
18
+ Your prompt includes:
19
19
 
20
- - **Mock type needed**: The kind of state to mock (e.g., "error_state", "premium_user", "empty_response")
21
- - **Tests requiring this mock**: List of tests with their expected behaviors
20
+ - **Tests requiring mocks**: List with mock_type and expected behavior for each
22
21
  - **Phase info**: Current phase being tested
22
+ - **Mocked files so far**: Files already edited in previous batches (avoid conflicts)
23
23
  </context_you_receive>
24
24
 
25
- <framework_detection>
26
- **1. Check PROJECT.md first**
27
- ```bash
28
- cat .planning/PROJECT.md 2>/dev/null | head -50
29
- ```
25
+ <references>
26
+ @~/.claude/mindsystem/references/mock-patterns.md
27
+ </references>
30
28
 
31
- Look for project type/stack description.
32
-
33
- **2. Verify with config files**
34
- ```bash
35
- # Flutter/Dart
36
- ls pubspec.yaml 2>/dev/null
29
+ <process>
37
30
 
38
- # React/Next.js
39
- ls package.json 2>/dev/null && grep -E '"react"|"next"' package.json
40
-
41
- # React Native
42
- ls package.json 2>/dev/null && grep '"react-native"' package.json
43
-
44
- # Vue
45
- ls package.json 2>/dev/null && grep '"vue"' package.json
46
- ```
31
+ **1. Identify service methods**
47
32
 
48
- **3. Determine framework**
49
- - Flutter: `pubspec.yaml` exists
50
- - React/Next.js: `package.json` with react/next dependency
51
- - React Native: `package.json` with react-native dependency
52
- - Vue: `package.json` with vue dependency
53
- - Other: Generate generic pattern with clear adaptation notes
54
- </framework_detection>
33
+ For each test, identify the service/repository method that provides the data being tested. Use Grep to find fetch calls, API methods, or data access points related to the test's expected behavior.
55
34
 
56
- <mock_pattern>
57
- **Philosophy:** Mocks are temporary scaffolding. They should:
58
- - Be contained in as few files as possible (ideally 1 override file)
59
- - Have minimal hooks in production code (single if-check)
60
- - Be easy to completely remove (delete file + remove hooks)
35
+ **2. Read and edit each method**
61
36
 
62
- **Pattern: Override File + Minimal Hooks**
63
-
64
- 1. **Create override file** - Single file with all mock flags and data
65
- 2. **Add minimal hooks** - If-check at service/repository layer
66
- 3. **Provide toggle instructions** - How to enable/disable each state
67
-
68
- **Override file location conventions:**
69
- - Flutter: `lib/test_overrides.dart`
70
- - React/Next.js: `src/testOverrides.ts` or `lib/testOverrides.ts`
71
- - React Native: `src/testOverrides.ts`
72
- - Vue: `src/testOverrides.ts`
73
- </mock_pattern>
74
-
75
- <generation_process>
76
- **1. Analyze tests to determine mock requirements**
77
-
78
- For each test, identify:
79
- - What state needs to be simulated
80
- - What service/API call needs to be intercepted
81
- - What data should be returned
82
-
83
- **2. Create override file**
37
+ For each method, add a hardcoded return/throw BEFORE the real implementation:
84
38
 
85
39
  ```
86
- # Pattern structure (adapt to framework):
87
-
88
- # Flags
89
- forcePremiumUser = false
90
- forceErrorState = false
91
- forceEmptyResponse = false
92
- forceLoadingState = false
40
+ // MOCK: {description} revert after UAT
41
+ {hardcoded return value or throw}
93
42
 
94
- # Mock data (when flags are true)
95
- mockErrorMessage = "Simulated error for testing"
96
- mockPremiumUserData = { ... }
97
-
98
- # Reset function
99
- resetAllOverrides() { ... }
43
+ // Real implementation below...
100
44
  ```
101
45
 
102
- **3. Identify hook points**
46
+ **Patterns by mock_type:**
103
47
 
104
- Find the service/repository methods that need to check override flags.
105
- Add minimal hooks:
48
+ | mock_type | Edit pattern |
49
+ |-----------|-------------|
50
+ | `error_state` | `throw Exception('{error message}');` before real call |
51
+ | `empty_response` | `return [];` or `return null;` before real call |
52
+ | `premium_user` | `return {hardcoded user object with premium fields};` |
53
+ | `external_data` | `return {hardcoded data matching expected schema};` |
54
+ | `loading_state` | `await {5s delay};` before real call |
55
+ | `transient_state` | Delay or never-resolve — read `mock-patterns.md` transient_state_patterns |
56
+ | `offline` | `throw {network error};` before real call |
106
57
 
107
- ```
108
- # Pseudocode pattern:
109
- function getUserData() {
110
- if (testOverrides.forcePremiumUser) {
111
- return testOverrides.mockPremiumUserData
112
- }
113
- // ... real implementation
114
- }
115
- ```
58
+ **3. For transient_state mocks:** Read `mock-patterns.md` for delay injection and never-resolve strategies. Choose based on whether the test is verifying the transition or the loading UI appearance.
59
+
60
+ **4. Track all changes**
116
61
 
117
- **4. Generate toggle instructions**
62
+ Maintain a list of every file edited and what was changed.
118
63
 
119
- Clear steps for user:
120
- 1. Which file to edit
121
- 2. Which flag to set
122
- 3. How to apply (hot reload, restart, etc.)
123
- 4. How to verify mock is active
124
- </generation_process>
64
+ </process>
125
65
 
126
66
  <return_format>
127
67
  ```markdown
128
- ## MOCKS GENERATED
129
-
130
- **Framework detected:** {Flutter | React | etc.}
131
- **Mock type:** {the mock_type requested}
132
-
133
- ### Files Created
134
-
135
- **{path/to/override_file}**
136
- - Purpose: Central mock control
137
- - Flags: {list of flags added}
68
+ ## Mocks Applied
138
69
 
139
- ### Files Modified
70
+ ### Files Edited
140
71
 
141
- **{path/to/service_file}** (lines {N}-{M})
142
- - Added: Import for test overrides
143
- - Added: Override check in {method_name}
72
+ | File | Method | Mock Type | Change |
73
+ |------|--------|-----------|--------|
74
+ | `{path}` | `{methodName}` | {type} | {brief description} |
144
75
 
145
- ### Toggle Instructions
76
+ ### Cleanup
146
77
 
147
- **To enable {mock_state_1}:**
148
- 1. Open `{override_file}`
149
- 2. Set `{flag_name} = true`
150
- 3. {Hot reload / Restart app}
151
- 4. Verify: {what user should see to confirm mock is active}
152
-
153
- **To enable {mock_state_2}:**
154
- ...
155
-
156
- ### Reset
157
-
158
- To disable all mocks:
159
- 1. Set all flags to `false` in `{override_file}`
160
- 2. {Hot reload / Restart}
78
+ To revert all mocks:
79
+ ```bash
80
+ git checkout -- {space-separated list of files}
81
+ ```
161
82
 
162
- Or delete `{override_file}` entirely (hooks will use defaults).
83
+ ### Mocked Files List
84
+ {JSON array of file paths for UAT.md frontmatter}
163
85
  ```
164
86
  </return_format>
165
87
 
166
88
  <constraints>
167
- - Keep override file as simple as possible
168
- - Minimize production code modifications
169
- - Don't create complex mock infrastructure
170
- - Don't modify test files (this is for manual UAT, not automated tests)
171
- - Include clear comments marking test-only code
172
- - Generated files should be .gitignore-able if needed
89
+ - Edit existing methods only do not create new files
90
+ - Add mock code BEFORE the real implementation (early return pattern)
91
+ - Mark every edit with `// MOCK: {description} — revert after UAT`
92
+ - Do not modify test files this is for manual UAT, not automated tests
93
+ - Do not create override files or toggle flags — inline hardcoding only
94
+ - Keep mock data minimal but realistic enough for UI rendering
173
95
  </constraints>
174
-
175
- <success_criteria>
176
- - [ ] Framework correctly detected
177
- - [ ] Override file created with appropriate flags
178
- - [ ] Minimal hooks added to production code (if needed)
179
- - [ ] Clear toggle instructions for each mock state
180
- - [ ] Reset instructions provided
181
- - [ ] All files written to disk (not just returned as content)
182
- </success_criteria>
@@ -109,7 +109,11 @@ If exists, extract:
109
109
 
110
110
  **3c. Optional context — project UI skill:**
111
111
 
112
- Before proceeding, check your available skills for one that provides domain expertise relevant to this project's UI implementation patterns. If found, invoke it via the Skill tool and extract aesthetic patterns (colors, components, spacing, typography) for the `<existing_aesthetic>` block passed to ms-designer.
112
+ Scan the skills list in the most recent system-reminder for a skill whose description mentions UI patterns, components, design system, or implementation styling (e.g., "Flutter/Dart patterns", "React component library", "UI implementation patterns").
113
+
114
+ If a matching skill is found, invoke it: `Skill(skill: "skill-name")`. Extract aesthetic patterns (colors, components, spacing, typography) from the loaded content for the `<existing_aesthetic>` block passed to ms-designer.
115
+
116
+ If no matching skill is found, skip this step and note "No project UI skill found" in the `<existing_aesthetic>` block.
113
117
 
114
118
  **3d. Optional context - codebase analysis:**
115
119
 
@@ -178,7 +182,7 @@ Follow mockup-generation workflow:
178
182
  4. Present directions to user for approval/tweaking
179
183
  5. Read platform template (mobile or web)
180
184
  6. Spawn 3 x ms-mockup-designer agents in parallel
181
- 7. Generate comparison page, open in browser, and present to user
185
+ 7. Run comparison script (`compare_mockups.py`), open in browser, and present to user
182
186
  8. Handle selection (single pick, combine, tweak, more variants, or skip)
183
187
  9. Extract CSS specs from chosen variant into `<mockup_direction>` block
184
188
 
@@ -43,9 +43,9 @@ Phase: $ARGUMENTS (optional)
43
43
  4. **Extract testable deliverables** from summaries
44
44
  5. **Classify tests by mock requirements** — Use SUMMARY.md mock_hints when available; classify inline with keyword heuristics when absent. Confirm data availability with user before batching.
45
45
  6. **Group into batches** — By mock type, max 4 per batch, no-mock tests first
46
- - If any tests require mocks: Read `~/.claude/mindsystem/references/mock-patterns.md` and `~/.claude/mindsystem/workflows/generate-mocks.md` for mock generation guidance
46
+ - If any tests require transient_state mocks: Read `~/.claude/mindsystem/references/mock-patterns.md` for delay strategies
47
47
  7. **For each batch:**
48
- - If mock needed: Generate mocks, present toggle instructions, wait for confirmation
48
+ - If mock needed: Apply inline mocks (1-4 direct edits, 5+ via ms-mock-generator subagent), tell user to hot reload
49
49
  - Present tests via AskUserQuestion (Pass / Can't test / Skip / Other)
50
50
  - Process results, update UAT.md
51
51
  - **For each issue found:**
@@ -54,10 +54,10 @@ Phase: $ARGUMENTS (optional)
54
54
  - If complex: Spawn ms-verify-fixer subagent
55
55
  - 2 retries on failed re-test, then offer options
56
56
  8. **On batch transition:**
57
- - If new mock_type: Discard old mocks, generate new ones
57
+ - If new mock_type: Revert old mocks (`git checkout -- <mocked_files>`), apply new ones
58
58
  - If same mock_type: Keep mocks active
59
59
  9. **On completion:**
60
- - Discard all mocks (git stash drop)
60
+ - Revert all mocks (`git checkout -- <mocked_files>`)
61
61
  - Generate UAT fixes patch
62
62
  - Restore user's pre-existing work (if stashed)
63
63
  - Commit UAT.md, present summary
@@ -77,23 +77,16 @@ Phase: $ARGUMENTS (optional)
77
77
  - Don't run automated tests — this is manual user validation
78
78
  - Don't skip investigation — always try 2-3 tool calls before escalating
79
79
  - Don't fix complex issues inline — spawn fixer subagent for multi-file or architectural changes
80
- - Don't commit mock code — always stash before fixing
80
+ - Don't commit mock code — stash mocked files before fixing, restore after
81
81
  - Don't re-present skipped tests — assumptions stand
82
82
  </anti_patterns>
83
83
 
84
84
  <success_criteria>
85
- - [ ] Dirty tree handled at start (stash/commit/abort)
86
- - [ ] Tests extracted from SUMMARY.md and classified
87
- - [ ] Tests batched by mock requirements
88
- - [ ] Mocks generated when needed with clear toggle instructions
89
- - [ ] Tests presented in batches of 4 using AskUserQuestion
90
- - [ ] Issues investigated with lightweight check first
91
- - [ ] Simple issues fixed inline with proper commit message
92
- - [ ] Complex issues escalated to fixer subagent
93
- - [ ] Failed re-tests get 2 retries then options
94
- - [ ] Stash conflicts auto-resolved to fix version
95
- - [ ] Mocks discarded on completion
85
+ - [ ] Mocks stashed before fixing, restored after (git stash push/pop cycle)
86
+ - [ ] Stash conflicts auto-resolved to fix version (git checkout --theirs)
87
+ - [ ] Blocked tests re-presented after blocking issues resolved
88
+ - [ ] Failed re-tests get 2 retries then options (tracked via retry_count)
89
+ - [ ] All mocks reverted on completion (git checkout -- <mocked_files>)
96
90
  - [ ] UAT fixes patch generated
97
- - [ ] User's pre-existing work restored
98
- - [ ] UAT.md committed with final summary
91
+ - [ ] User's pre-existing work restored from stash
99
92
  </success_criteria>