mindsystem-cc 3.0.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.
Files changed (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +501 -0
  3. package/agents/ms-codebase-mapper.md +739 -0
  4. package/agents/ms-debugger.md +1184 -0
  5. package/agents/ms-designer.md +414 -0
  6. package/agents/ms-executor.md +760 -0
  7. package/agents/ms-integration-checker.md +423 -0
  8. package/agents/ms-milestone-auditor.md +448 -0
  9. package/agents/ms-mock-generator.md +182 -0
  10. package/agents/ms-plan-checker.md +746 -0
  11. package/agents/ms-research-synthesizer.md +248 -0
  12. package/agents/ms-researcher.md +962 -0
  13. package/agents/ms-roadmapper.md +606 -0
  14. package/agents/ms-verifier.md +779 -0
  15. package/agents/ms-verify-fixer.md +124 -0
  16. package/bin/install.js +296 -0
  17. package/commands/ms/add-phase.md +207 -0
  18. package/commands/ms/add-todo.md +182 -0
  19. package/commands/ms/audit-milestone.md +318 -0
  20. package/commands/ms/check-phase.md +162 -0
  21. package/commands/ms/check-todos.md +217 -0
  22. package/commands/ms/complete-milestone.md +137 -0
  23. package/commands/ms/create-roadmap.md +273 -0
  24. package/commands/ms/debug.md +149 -0
  25. package/commands/ms/define-requirements.md +121 -0
  26. package/commands/ms/design-phase.md +341 -0
  27. package/commands/ms/discuss-milestone.md +48 -0
  28. package/commands/ms/discuss-phase.md +60 -0
  29. package/commands/ms/do-work.md +90 -0
  30. package/commands/ms/execute-phase.md +289 -0
  31. package/commands/ms/help.md +623 -0
  32. package/commands/ms/insert-phase.md +227 -0
  33. package/commands/ms/list-phase-assumptions.md +50 -0
  34. package/commands/ms/map-codebase.md +71 -0
  35. package/commands/ms/new-milestone.md +193 -0
  36. package/commands/ms/new-project.md +338 -0
  37. package/commands/ms/pause-work.md +123 -0
  38. package/commands/ms/plan-milestone-gaps.md +285 -0
  39. package/commands/ms/plan-phase.md +105 -0
  40. package/commands/ms/progress.md +370 -0
  41. package/commands/ms/remove-phase.md +338 -0
  42. package/commands/ms/research-phase.md +175 -0
  43. package/commands/ms/research-project.md +339 -0
  44. package/commands/ms/resume-work.md +40 -0
  45. package/commands/ms/review-design.md +484 -0
  46. package/commands/ms/simplify-flutter.md +193 -0
  47. package/commands/ms/update.md +159 -0
  48. package/commands/ms/verify-work.md +92 -0
  49. package/commands/ms/whats-new.md +124 -0
  50. package/mindsystem/references/checkpoints.md +788 -0
  51. package/mindsystem/references/continuation-format.md +255 -0
  52. package/mindsystem/references/debugging/debugging-mindset.md +11 -0
  53. package/mindsystem/references/debugging/hypothesis-testing.md +11 -0
  54. package/mindsystem/references/debugging/investigation-techniques.md +11 -0
  55. package/mindsystem/references/debugging/verification-patterns.md +11 -0
  56. package/mindsystem/references/debugging/when-to-research.md +11 -0
  57. package/mindsystem/references/git-integration.md +254 -0
  58. package/mindsystem/references/goal-backward.md +286 -0
  59. package/mindsystem/references/mock-patterns.md +294 -0
  60. package/mindsystem/references/plan-format.md +473 -0
  61. package/mindsystem/references/principles.md +73 -0
  62. package/mindsystem/references/questioning.md +140 -0
  63. package/mindsystem/references/research-pitfalls.md +233 -0
  64. package/mindsystem/references/scope-estimation.md +256 -0
  65. package/mindsystem/references/tdd.md +263 -0
  66. package/mindsystem/references/verification-patterns.md +595 -0
  67. package/mindsystem/templates/DEBUG.md +159 -0
  68. package/mindsystem/templates/UAT.md +403 -0
  69. package/mindsystem/templates/adhoc-summary.md +153 -0
  70. package/mindsystem/templates/codebase/architecture.md +255 -0
  71. package/mindsystem/templates/codebase/concerns.md +310 -0
  72. package/mindsystem/templates/codebase/conventions.md +307 -0
  73. package/mindsystem/templates/codebase/integrations.md +280 -0
  74. package/mindsystem/templates/codebase/stack.md +186 -0
  75. package/mindsystem/templates/codebase/structure.md +285 -0
  76. package/mindsystem/templates/codebase/testing.md +480 -0
  77. package/mindsystem/templates/config.json +26 -0
  78. package/mindsystem/templates/context.md +140 -0
  79. package/mindsystem/templates/continue-here.md +78 -0
  80. package/mindsystem/templates/debug-subagent-prompt.md +91 -0
  81. package/mindsystem/templates/design-iteration.md +208 -0
  82. package/mindsystem/templates/design.md +417 -0
  83. package/mindsystem/templates/discovery.md +146 -0
  84. package/mindsystem/templates/milestone-archive.md +123 -0
  85. package/mindsystem/templates/milestone-context.md +93 -0
  86. package/mindsystem/templates/milestone.md +115 -0
  87. package/mindsystem/templates/phase-prompt.md +574 -0
  88. package/mindsystem/templates/project.md +184 -0
  89. package/mindsystem/templates/requirements.md +231 -0
  90. package/mindsystem/templates/research-project/ARCHITECTURE.md +204 -0
  91. package/mindsystem/templates/research-project/FEATURES.md +147 -0
  92. package/mindsystem/templates/research-project/PITFALLS.md +200 -0
  93. package/mindsystem/templates/research-project/STACK.md +120 -0
  94. package/mindsystem/templates/research-project/SUMMARY.md +170 -0
  95. package/mindsystem/templates/research-subagent-prompt.md +92 -0
  96. package/mindsystem/templates/research.md +529 -0
  97. package/mindsystem/templates/roadmap.md +214 -0
  98. package/mindsystem/templates/state.md +224 -0
  99. package/mindsystem/templates/summary.md +269 -0
  100. package/mindsystem/templates/user-setup.md +323 -0
  101. package/mindsystem/templates/verification-report.md +322 -0
  102. package/mindsystem/workflows/complete-milestone.md +759 -0
  103. package/mindsystem/workflows/create-milestone.md +203 -0
  104. package/mindsystem/workflows/debug.md +14 -0
  105. package/mindsystem/workflows/define-requirements.md +330 -0
  106. package/mindsystem/workflows/diagnose-issues.md +241 -0
  107. package/mindsystem/workflows/discovery-phase.md +293 -0
  108. package/mindsystem/workflows/discuss-milestone.md +310 -0
  109. package/mindsystem/workflows/discuss-phase.md +237 -0
  110. package/mindsystem/workflows/do-work.md +359 -0
  111. package/mindsystem/workflows/execute-phase.md +644 -0
  112. package/mindsystem/workflows/execute-plan.md +1828 -0
  113. package/mindsystem/workflows/generate-mocks.md +187 -0
  114. package/mindsystem/workflows/list-phase-assumptions.md +178 -0
  115. package/mindsystem/workflows/map-codebase.md +289 -0
  116. package/mindsystem/workflows/plan-phase.md +876 -0
  117. package/mindsystem/workflows/research-phase.md +17 -0
  118. package/mindsystem/workflows/research-project.md +23 -0
  119. package/mindsystem/workflows/resume-project.md +311 -0
  120. package/mindsystem/workflows/transition.md +564 -0
  121. package/mindsystem/workflows/verify-phase.md +629 -0
  122. package/mindsystem/workflows/verify-work.md +823 -0
  123. package/package.json +32 -0
  124. package/scripts/generate-phase-patch.sh +169 -0
  125. package/scripts/ms-lookup/README.md +112 -0
  126. package/scripts/ms-lookup/ms_lookup/__init__.py +3 -0
  127. package/scripts/ms-lookup/ms_lookup/__main__.py +6 -0
  128. package/scripts/ms-lookup/ms_lookup/backends/__init__.py +6 -0
  129. package/scripts/ms-lookup/ms_lookup/backends/context7.py +219 -0
  130. package/scripts/ms-lookup/ms_lookup/backends/perplexity.py +145 -0
  131. package/scripts/ms-lookup/ms_lookup/cache.py +48 -0
  132. package/scripts/ms-lookup/ms_lookup/cli.py +219 -0
  133. package/scripts/ms-lookup/ms_lookup/config.py +23 -0
  134. package/scripts/ms-lookup/ms_lookup/errors.py +24 -0
  135. package/scripts/ms-lookup/ms_lookup/output.py +49 -0
  136. package/scripts/ms-lookup/ms_lookup/tokens.py +56 -0
  137. package/scripts/ms-lookup/pyproject.toml +17 -0
  138. package/scripts/ms-lookup/uv.lock +207 -0
  139. package/scripts/ms-lookup-wrapper.sh +21 -0
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: ms-verify-fixer
3
+ description: Investigates and fixes single UAT issues. Spawned by verify-work when lightweight investigation fails.
4
+ tools: Read, Write, Edit, Bash, Grep, Glob
5
+ color: orange
6
+ ---
7
+
8
+ <role>
9
+ You are a Mindsystem verify-fixer. You investigate a single UAT issue that the main orchestrator couldn't resolve with lightweight investigation, find the root cause, implement a fix, and commit it.
10
+
11
+ You are spawned by `/ms:verify-work` when an issue requires deeper investigation (failed 2-3 quick checks).
12
+
13
+ Your job: Find root cause, implement minimal fix, commit with proper message, return result for re-testing.
14
+ </role>
15
+
16
+ <context_you_receive>
17
+ Your prompt will include:
18
+
19
+ - **Issue details**: test name, expected behavior, actual behavior, severity
20
+ - **Phase info**: phase name, current mock state (if any)
21
+ - **Relevant files**: suspected files from initial investigation
22
+ - **What was checked**: results of lightweight investigation already done
23
+ </context_you_receive>
24
+
25
+ <investigation_approach>
26
+ You have fresh 200k context. Use it to investigate thoroughly.
27
+
28
+ **1. Start from what's known**
29
+ - Read the files already identified as suspicious
30
+ - Review what was already checked (don't repeat)
31
+ - Look for adjacent code that might be involved
32
+
33
+ **2. Form specific hypothesis**
34
+ - Be precise: "useEffect missing dependency" not "something with state"
35
+ - Make it falsifiable: you can prove it wrong with a test
36
+
37
+ **3. Test one thing at a time**
38
+ - Add logging if needed
39
+ - Run the code to observe
40
+ - Don't change multiple things at once
41
+
42
+ **4. When you find it**
43
+ - Verify with evidence (log output, test result)
44
+ - Implement minimal fix
45
+ - Test that fix resolves the issue
46
+ </investigation_approach>
47
+
48
+ <fix_protocol>
49
+ **Mocks are currently stashed** - your working tree is clean.
50
+
51
+ **1. Implement fix**
52
+ - Make the smallest change that addresses root cause
53
+ - Don't refactor surrounding code
54
+ - Don't add "improvements" beyond the fix
55
+
56
+ **2. Commit with proper message**
57
+ ```bash
58
+ git add [specific files]
59
+ git commit -m "fix({phase}-uat): {description}"
60
+ ```
61
+
62
+ Use the `{phase}-uat` scope so patches can find UAT fixes later.
63
+
64
+ **3. Document what you did**
65
+ - Which file(s) changed
66
+ - What the fix actually does
67
+ - Why this addresses the root cause
68
+ </fix_protocol>
69
+
70
+ <return_formats>
71
+
72
+ **When fix applied successfully:**
73
+
74
+ ```markdown
75
+ ## FIX COMPLETE
76
+
77
+ **Root cause:** {specific cause with evidence}
78
+
79
+ **Fix applied:** {what was changed and why}
80
+
81
+ **Commit:** {hash}
82
+
83
+ **Files changed:**
84
+ - {file}: {change description}
85
+
86
+ **Re-test instruction:** {specific step for user to verify}
87
+ ```
88
+
89
+ **When investigation is inconclusive:**
90
+
91
+ ```markdown
92
+ ## INVESTIGATION INCONCLUSIVE
93
+
94
+ **What was checked:**
95
+ - {area}: {finding}
96
+ - {area}: {finding}
97
+
98
+ **Hypotheses eliminated:**
99
+ - {hypothesis}: {why ruled out}
100
+
101
+ **Remaining possibilities:**
102
+ - {possibility 1}
103
+ - {possibility 2}
104
+
105
+ **Recommendation:** {suggested next steps}
106
+ ```
107
+
108
+ </return_formats>
109
+
110
+ <constraints>
111
+ - Do NOT modify mock code (it's stashed)
112
+ - Do NOT make architectural changes (return checkpoint instead)
113
+ - Do NOT fix unrelated issues you discover (note them for later)
114
+ - Do commit your fix before returning
115
+ - Do use `fix({phase}-uat):` commit message format
116
+ </constraints>
117
+
118
+ <success_criteria>
119
+ - [ ] Root cause identified with evidence
120
+ - [ ] Minimal fix implemented
121
+ - [ ] Fix committed with proper message format
122
+ - [ ] Clear re-test instruction provided
123
+ - [ ] Return uses correct format (FIX COMPLETE or INVESTIGATION INCONCLUSIVE)
124
+ </success_criteria>
package/bin/install.js ADDED
@@ -0,0 +1,296 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
6
+ const readline = require('readline');
7
+
8
+ // Colors
9
+ const cyan = '\x1b[38;2;47;167;160m'; // #2FA7A0
10
+ const green = '\x1b[32m';
11
+ const yellow = '\x1b[33m';
12
+ const dim = '\x1b[2m';
13
+ const reset = '\x1b[0m';
14
+
15
+ // Get version from package.json
16
+ const pkg = require('../package.json');
17
+
18
+ const banner = `
19
+ ${cyan} ███╗ ███╗██╗███╗ ██╗██████╗ ███████╗██╗ ██╗███████╗████████╗███████╗███╗ ███╗
20
+ ████╗ ████║██║████╗ ██║██╔══██╗██╔════╝╚██╗ ██╔╝██╔════╝╚══██╔══╝██╔════╝████╗ ████║
21
+ ██╔████╔██║██║██╔██╗ ██║██║ ██║███████╗ ╚████╔╝ ███████╗ ██║ █████╗ ██╔████╔██║
22
+ ██║╚██╔╝██║██║██║╚██╗██║██║ ██║╚════██║ ╚██╔╝ ╚════██║ ██║ ██╔══╝ ██║╚██╔╝██║
23
+ ██║ ╚═╝ ██║██║██║ ╚████║██████╔╝███████║ ██║ ███████║ ██║ ███████╗██║ ╚═╝ ██║
24
+ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═════╝ ╚══════╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝${reset}
25
+
26
+ Mindsystem ${dim}v${pkg.version}${reset}
27
+ A meta-prompting, context engineering and spec-driven
28
+ development system for Claude Code by Roland Tolnay.
29
+ Based on GSD by TÂCHES.
30
+ `;
31
+
32
+ // Parse args
33
+ const args = process.argv.slice(2);
34
+ const hasGlobal = args.includes('--global') || args.includes('-g');
35
+ const hasLocal = args.includes('--local') || args.includes('-l');
36
+
37
+ // Parse --config-dir argument
38
+ function parseConfigDirArg() {
39
+ const configDirIndex = args.findIndex(arg => arg === '--config-dir' || arg === '-c');
40
+ if (configDirIndex !== -1) {
41
+ const nextArg = args[configDirIndex + 1];
42
+ // Error if --config-dir is provided without a value or next arg is another flag
43
+ if (!nextArg || nextArg.startsWith('-')) {
44
+ console.error(` ${yellow}--config-dir requires a path argument${reset}`);
45
+ process.exit(1);
46
+ }
47
+ return nextArg;
48
+ }
49
+ // Also handle --config-dir=value format
50
+ const configDirArg = args.find(arg => arg.startsWith('--config-dir=') || arg.startsWith('-c='));
51
+ if (configDirArg) {
52
+ return configDirArg.split('=')[1];
53
+ }
54
+ return null;
55
+ }
56
+ const explicitConfigDir = parseConfigDirArg();
57
+ const hasHelp = args.includes('--help') || args.includes('-h');
58
+
59
+ console.log(banner);
60
+
61
+ // Show help if requested
62
+ if (hasHelp) {
63
+ console.log(` ${yellow}Usage:${reset} npx mindsystem-cc [options]
64
+
65
+ ${yellow}Options:${reset}
66
+ ${cyan}-g, --global${reset} Install globally (to Claude config directory)
67
+ ${cyan}-l, --local${reset} Install locally (to ./.claude in current directory)
68
+ ${cyan}-c, --config-dir <path>${reset} Specify custom Claude config directory
69
+ ${cyan}-h, --help${reset} Show this help message
70
+
71
+ ${yellow}Examples:${reset}
72
+ ${dim}# Install to default ~/.claude directory${reset}
73
+ npx mindsystem-cc --global
74
+
75
+ ${dim}# Install to custom config directory (for multiple Claude accounts)${reset}
76
+ npx mindsystem-cc --global --config-dir ~/.claude-bc
77
+
78
+ ${dim}# Using environment variable${reset}
79
+ CLAUDE_CONFIG_DIR=~/.claude-bc npx mindsystem-cc --global
80
+
81
+ ${dim}# Install to current project only${reset}
82
+ npx mindsystem-cc --local
83
+
84
+ ${yellow}Notes:${reset}
85
+ The --config-dir option is useful when you have multiple Claude Code
86
+ configurations (e.g., for different subscriptions). It takes priority
87
+ over the CLAUDE_CONFIG_DIR environment variable.
88
+ `);
89
+ process.exit(0);
90
+ }
91
+
92
+ /**
93
+ * Expand ~ to home directory (shell doesn't expand in env vars passed to node)
94
+ */
95
+ function expandTilde(filePath) {
96
+ if (filePath && filePath.startsWith('~/')) {
97
+ return path.join(os.homedir(), filePath.slice(2));
98
+ }
99
+ return filePath;
100
+ }
101
+
102
+ /**
103
+ * Recursively copy directory, replacing paths in .md files
104
+ */
105
+ function copyWithPathReplacement(srcDir, destDir, pathPrefix) {
106
+ fs.mkdirSync(destDir, { recursive: true });
107
+
108
+ const entries = fs.readdirSync(srcDir, { withFileTypes: true });
109
+
110
+ for (const entry of entries) {
111
+ const srcPath = path.join(srcDir, entry.name);
112
+ const destPath = path.join(destDir, entry.name);
113
+
114
+ if (entry.isDirectory()) {
115
+ copyWithPathReplacement(srcPath, destPath, pathPrefix);
116
+ } else if (entry.name.endsWith('.md')) {
117
+ // Replace ~/.claude/ with the appropriate prefix in markdown files
118
+ let content = fs.readFileSync(srcPath, 'utf8');
119
+ content = content.replace(/~\/\.claude\//g, pathPrefix);
120
+ fs.writeFileSync(destPath, content);
121
+ } else {
122
+ fs.copyFileSync(srcPath, destPath);
123
+ }
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Recursively copy directory without path replacement
129
+ */
130
+ function copyDir(srcDir, destDir) {
131
+ fs.mkdirSync(destDir, { recursive: true });
132
+
133
+ const entries = fs.readdirSync(srcDir, { withFileTypes: true });
134
+
135
+ for (const entry of entries) {
136
+ const srcPath = path.join(srcDir, entry.name);
137
+ const destPath = path.join(destDir, entry.name);
138
+
139
+ if (entry.isDirectory()) {
140
+ copyDir(srcPath, destPath);
141
+ } else {
142
+ fs.copyFileSync(srcPath, destPath);
143
+ }
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Install to the specified directory
149
+ */
150
+ function install(isGlobal) {
151
+ const src = path.join(__dirname, '..');
152
+ // Priority: explicit --config-dir arg > CLAUDE_CONFIG_DIR env var > default ~/.claude
153
+ const configDir = expandTilde(explicitConfigDir) || expandTilde(process.env.CLAUDE_CONFIG_DIR);
154
+ const defaultGlobalDir = configDir || path.join(os.homedir(), '.claude');
155
+ const claudeDir = isGlobal
156
+ ? defaultGlobalDir
157
+ : path.join(process.cwd(), '.claude');
158
+
159
+ const locationLabel = isGlobal
160
+ ? claudeDir.replace(os.homedir(), '~')
161
+ : claudeDir.replace(process.cwd(), '.');
162
+
163
+ // Path prefix for file references
164
+ // Use actual path when CLAUDE_CONFIG_DIR is set, otherwise use ~ shorthand
165
+ const pathPrefix = isGlobal
166
+ ? (configDir ? `${claudeDir}/` : '~/.claude/')
167
+ : './.claude/';
168
+
169
+ console.log(` Installing to ${cyan}${locationLabel}${reset}\n`);
170
+
171
+ // Create commands directory
172
+ const commandsDir = path.join(claudeDir, 'commands');
173
+ fs.mkdirSync(commandsDir, { recursive: true });
174
+
175
+ // Copy commands/ms with path replacement
176
+ const msSrc = path.join(src, 'commands', 'ms');
177
+ const msDest = path.join(commandsDir, 'ms');
178
+ copyWithPathReplacement(msSrc, msDest, pathPrefix);
179
+ console.log(` ${green}✓${reset} Installed commands/ms`);
180
+
181
+ // Copy mindsystem skill with path replacement
182
+ const skillSrc = path.join(src, 'mindsystem');
183
+ const skillDest = path.join(claudeDir, 'mindsystem');
184
+ copyWithPathReplacement(skillSrc, skillDest, pathPrefix);
185
+ console.log(` ${green}✓${reset} Installed mindsystem`);
186
+
187
+ // Copy agents to ~/.claude/agents (subagents must be at root level)
188
+ const agentsSrc = path.join(src, 'agents');
189
+ if (fs.existsSync(agentsSrc)) {
190
+ const agentsDest = path.join(claudeDir, 'agents');
191
+ copyWithPathReplacement(agentsSrc, agentsDest, pathPrefix);
192
+ console.log(` ${green}✓${reset} Installed agents`);
193
+ }
194
+
195
+ // Copy scripts to ~/.claude/mindsystem/scripts/
196
+ const scriptsSrc = path.join(src, 'scripts');
197
+ if (fs.existsSync(scriptsSrc)) {
198
+ const scriptsDest = path.join(claudeDir, 'mindsystem', 'scripts');
199
+ fs.mkdirSync(scriptsDest, { recursive: true });
200
+ const scriptEntries = fs.readdirSync(scriptsSrc, { withFileTypes: true });
201
+ for (const entry of scriptEntries) {
202
+ const srcPath = path.join(scriptsSrc, entry.name);
203
+ const destPath = path.join(scriptsDest, entry.name);
204
+ if (entry.isDirectory()) {
205
+ // Recursively copy directories (like ms-lookup/)
206
+ copyDir(srcPath, destPath);
207
+ } else {
208
+ fs.copyFileSync(srcPath, destPath);
209
+ // Make shell scripts executable
210
+ if (entry.name.endsWith('.sh')) {
211
+ fs.chmodSync(destPath, '755');
212
+ }
213
+ }
214
+ }
215
+ console.log(` ${green}✓${reset} Installed scripts`);
216
+
217
+ // Check Python availability for ms-lookup
218
+ const msLookupPath = path.join(scriptsDest, 'ms-lookup');
219
+ if (fs.existsSync(msLookupPath)) {
220
+ try {
221
+ const { execSync } = require('child_process');
222
+ const pyVersion = execSync('python3 --version 2>&1', { encoding: 'utf8' });
223
+ const versionMatch = pyVersion.match(/(\d+)\.(\d+)/);
224
+ if (versionMatch) {
225
+ const [, major, minor] = versionMatch;
226
+ if (parseInt(major) < 3 || (parseInt(major) === 3 && parseInt(minor) < 9)) {
227
+ console.log(` ${yellow}⚠${reset} Python 3.9+ required for ms-lookup (found ${major}.${minor})`);
228
+ } else {
229
+ console.log(` ${green}✓${reset} Installed ms-lookup CLI (Python ${major}.${minor})`);
230
+ }
231
+ }
232
+ } catch (e) {
233
+ console.log(` ${yellow}⚠${reset} Python not found - ms-lookup CLI requires Python 3.9+`);
234
+ }
235
+ }
236
+ }
237
+
238
+ // Copy CHANGELOG.md
239
+ const changelogSrc = path.join(src, 'CHANGELOG.md');
240
+ const changelogDest = path.join(claudeDir, 'mindsystem', 'CHANGELOG.md');
241
+ if (fs.existsSync(changelogSrc)) {
242
+ fs.copyFileSync(changelogSrc, changelogDest);
243
+ console.log(` ${green}✓${reset} Installed CHANGELOG.md`);
244
+ }
245
+
246
+ // Write VERSION file for whats-new command
247
+ const versionDest = path.join(claudeDir, 'mindsystem', 'VERSION');
248
+ fs.writeFileSync(versionDest, pkg.version);
249
+ console.log(` ${green}✓${reset} Wrote VERSION (${pkg.version})`);
250
+
251
+ console.log(`
252
+ ${green}Done!${reset} Launch Claude Code and run ${cyan}/ms:help${reset}.
253
+ `);
254
+ }
255
+
256
+ /**
257
+ * Prompt for install location
258
+ */
259
+ function promptLocation() {
260
+ const rl = readline.createInterface({
261
+ input: process.stdin,
262
+ output: process.stdout
263
+ });
264
+
265
+ const configDir = expandTilde(explicitConfigDir) || expandTilde(process.env.CLAUDE_CONFIG_DIR);
266
+ const globalPath = configDir || path.join(os.homedir(), '.claude');
267
+ const globalLabel = globalPath.replace(os.homedir(), '~');
268
+
269
+ console.log(` ${yellow}Where would you like to install?${reset}
270
+
271
+ ${cyan}1${reset}) Global ${dim}(${globalLabel})${reset} - available in all projects
272
+ ${cyan}2${reset}) Local ${dim}(./.claude)${reset} - this project only
273
+ `);
274
+
275
+ rl.question(` Choice ${dim}[1]${reset}: `, (answer) => {
276
+ rl.close();
277
+ const choice = answer.trim() || '1';
278
+ const isGlobal = choice !== '2';
279
+ install(isGlobal);
280
+ });
281
+ }
282
+
283
+ // Main
284
+ if (hasGlobal && hasLocal) {
285
+ console.error(` ${yellow}Cannot specify both --global and --local${reset}`);
286
+ process.exit(1);
287
+ } else if (explicitConfigDir && hasLocal) {
288
+ console.error(` ${yellow}Cannot use --config-dir with --local${reset}`);
289
+ process.exit(1);
290
+ } else if (hasGlobal) {
291
+ install(true);
292
+ } else if (hasLocal) {
293
+ install(false);
294
+ } else {
295
+ promptLocation();
296
+ }
@@ -0,0 +1,207 @@
1
+ ---
2
+ name: ms:add-phase
3
+ description: Add phase to end of current milestone in roadmap
4
+ argument-hint: <description>
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ ---
10
+
11
+ <objective>
12
+ Add a new integer phase to the end of the current milestone in the roadmap.
13
+
14
+ This command appends sequential phases to the current milestone's phase list, automatically calculating the next phase number based on existing phases.
15
+
16
+ Purpose: Add planned work discovered during execution that belongs at the end of current milestone.
17
+ </objective>
18
+
19
+ <execution_context>
20
+ @.planning/ROADMAP.md
21
+ @.planning/STATE.md
22
+ </execution_context>
23
+
24
+ <process>
25
+
26
+ <step name="parse_arguments">
27
+ Parse the command arguments:
28
+ - All arguments become the phase description
29
+ - Example: `/ms:add-phase Add authentication` → description = "Add authentication"
30
+ - Example: `/ms:add-phase Fix critical performance issues` → description = "Fix critical performance issues"
31
+
32
+ If no arguments provided:
33
+
34
+ ```
35
+ ERROR: Phase description required
36
+ Usage: /ms:add-phase <description>
37
+ Example: /ms:add-phase Add authentication system
38
+ ```
39
+
40
+ Exit.
41
+ </step>
42
+
43
+ <step name="load_roadmap">
44
+ Load the roadmap file:
45
+
46
+ ```bash
47
+ if [ -f .planning/ROADMAP.md ]; then
48
+ ROADMAP=".planning/ROADMAP.md"
49
+ else
50
+ echo "ERROR: No roadmap found (.planning/ROADMAP.md)"
51
+ exit 1
52
+ fi
53
+ ```
54
+
55
+ Read roadmap content for parsing.
56
+ </step>
57
+
58
+ <step name="find_current_milestone">
59
+ Parse the roadmap to find the current milestone section:
60
+
61
+ 1. Locate the "## Current Milestone:" heading
62
+ 2. Extract milestone name and version
63
+ 3. Identify all phases under this milestone (before next "---" separator or next milestone heading)
64
+ 4. Parse existing phase numbers (including decimals if present)
65
+
66
+ Example structure:
67
+
68
+ ```
69
+ ## Current Milestone: v1.0 Foundation
70
+
71
+ ### Phase 4: Focused Command System
72
+ ### Phase 5: Path Routing & Validation
73
+ ### Phase 6: Documentation & Distribution
74
+ ```
75
+
76
+ </step>
77
+
78
+ <step name="calculate_next_phase">
79
+ Find the highest integer phase number in the current milestone:
80
+
81
+ 1. Extract all phase numbers from phase headings (### Phase N:)
82
+ 2. Filter to integer phases only (ignore decimals like 4.1, 4.2)
83
+ 3. Find the maximum integer value
84
+ 4. Add 1 to get the next phase number
85
+
86
+ Example: If phases are 4, 5, 5.1, 6 → next is 7
87
+
88
+ Format as two-digit: `printf "%02d" $next_phase`
89
+ </step>
90
+
91
+ <step name="generate_slug">
92
+ Convert the phase description to a kebab-case slug:
93
+
94
+ ```bash
95
+ # Example transformation:
96
+ # "Add authentication" → "add-authentication"
97
+ # "Fix critical performance issues" → "fix-critical-performance-issues"
98
+
99
+ slug=$(echo "$description" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
100
+ ```
101
+
102
+ Phase directory name: `{two-digit-phase}-{slug}`
103
+ Example: `07-add-authentication`
104
+ </step>
105
+
106
+ <step name="create_phase_directory">
107
+ Create the phase directory structure:
108
+
109
+ ```bash
110
+ phase_dir=".planning/phases/${phase_num}-${slug}"
111
+ mkdir -p "$phase_dir"
112
+ ```
113
+
114
+ Confirm: "Created directory: $phase_dir"
115
+ </step>
116
+
117
+ <step name="update_roadmap">
118
+ Add the new phase entry to the roadmap:
119
+
120
+ 1. Find the insertion point (after last phase in current milestone, before "---" separator)
121
+ 2. Insert new phase heading:
122
+
123
+ ```
124
+ ### Phase {N}: {Description}
125
+
126
+ **Goal:** [To be planned]
127
+ **Depends on:** Phase {N-1}
128
+ **Plans:** 0 plans
129
+
130
+ Plans:
131
+ - [ ] TBD (run /ms:plan-phase {N} to break down)
132
+
133
+ **Details:**
134
+ [To be added during planning]
135
+ ```
136
+
137
+ 3. Write updated roadmap back to file
138
+
139
+ Preserve all other content exactly (formatting, spacing, other phases).
140
+ </step>
141
+
142
+ <step name="update_project_state">
143
+ Update STATE.md to reflect the new phase:
144
+
145
+ 1. Read `.planning/STATE.md`
146
+ 2. Under "## Current Position" → "**Next Phase:**" add reference to new phase
147
+ 3. Under "## Accumulated Context" → "### Roadmap Evolution" add entry:
148
+ ```
149
+ - Phase {N} added: {description}
150
+ ```
151
+
152
+ If "Roadmap Evolution" section doesn't exist, create it.
153
+ </step>
154
+
155
+ <step name="completion">
156
+ Present completion summary:
157
+
158
+ ```
159
+ Phase {N} added to current milestone:
160
+ - Description: {description}
161
+ - Directory: .planning/phases/{phase-num}-{slug}/
162
+ - Status: Not planned yet
163
+
164
+ Roadmap updated: {roadmap-path}
165
+ Project state updated: .planning/STATE.md
166
+
167
+ ---
168
+
169
+ ## ▶ Next Up
170
+
171
+ **Phase {N}: {description}**
172
+
173
+ `/ms:plan-phase {N}`
174
+
175
+ <sub>`/clear` first → fresh context window</sub>
176
+
177
+ ---
178
+
179
+ **Also available:**
180
+ - `/ms:add-phase <description>` — add another phase
181
+ - Review roadmap
182
+
183
+ ---
184
+ ```
185
+ </step>
186
+
187
+ </process>
188
+
189
+ <anti_patterns>
190
+
191
+ - Don't modify phases outside current milestone
192
+ - Don't renumber existing phases
193
+ - Don't use decimal numbering (that's /ms:insert-phase)
194
+ - Don't create plans yet (that's /ms:plan-phase)
195
+ - Don't commit changes (user decides when to commit)
196
+ </anti_patterns>
197
+
198
+ <success_criteria>
199
+ Phase addition is complete when:
200
+
201
+ - [ ] Phase directory created: `.planning/phases/{NN}-{slug}/`
202
+ - [ ] Roadmap updated with new phase entry
203
+ - [ ] STATE.md updated with roadmap evolution note
204
+ - [ ] New phase appears at end of current milestone
205
+ - [ ] Next phase number calculated correctly (ignoring decimals)
206
+ - [ ] User informed of next steps
207
+ </success_criteria>