mustard-claude 2.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.
- package/README.md +198 -0
- package/bin/mustard.js +5 -0
- package/dist/analyzers/llm.d.ts +13 -0
- package/dist/analyzers/llm.js +339 -0
- package/dist/analyzers/llm.js.map +1 -0
- package/dist/analyzers/semantic.d.ts +13 -0
- package/dist/analyzers/semantic.js +215 -0
- package/dist/analyzers/semantic.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +42 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.js +377 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/sync.d.ts +5 -0
- package/dist/commands/sync.js +235 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/update.d.ts +8 -0
- package/dist/commands/update.js +237 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/generators/claude-md-llm.d.ts +5 -0
- package/dist/generators/claude-md-llm.js +101 -0
- package/dist/generators/claude-md-llm.js.map +1 -0
- package/dist/generators/claude-md-template.d.ts +5 -0
- package/dist/generators/claude-md-template.js +273 -0
- package/dist/generators/claude-md-template.js.map +1 -0
- package/dist/generators/commands.d.ts +17 -0
- package/dist/generators/commands.js +845 -0
- package/dist/generators/commands.js.map +1 -0
- package/dist/generators/context.d.ts +11 -0
- package/dist/generators/context.js +621 -0
- package/dist/generators/context.js.map +1 -0
- package/dist/generators/hooks.d.ts +5 -0
- package/dist/generators/hooks.js +128 -0
- package/dist/generators/hooks.js.map +1 -0
- package/dist/generators/index.d.ts +11 -0
- package/dist/generators/index.js +541 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/prompts.d.ts +13 -0
- package/dist/generators/prompts.js +579 -0
- package/dist/generators/prompts.js.map +1 -0
- package/dist/generators/registry.d.ts +5 -0
- package/dist/generators/registry.js +93 -0
- package/dist/generators/registry.js.map +1 -0
- package/dist/scanners/dependencies.d.ts +7 -0
- package/dist/scanners/dependencies.js +195 -0
- package/dist/scanners/dependencies.js.map +1 -0
- package/dist/scanners/index.d.ts +6 -0
- package/dist/scanners/index.js +37 -0
- package/dist/scanners/index.js.map +1 -0
- package/dist/scanners/samples.d.ts +8 -0
- package/dist/scanners/samples.js +193 -0
- package/dist/scanners/samples.js.map +1 -0
- package/dist/scanners/stack.d.ts +5 -0
- package/dist/scanners/stack.js +294 -0
- package/dist/scanners/stack.js.map +1 -0
- package/dist/scanners/structure.d.ts +5 -0
- package/dist/scanners/structure.js +274 -0
- package/dist/scanners/structure.js.map +1 -0
- package/dist/services/grepai.d.ts +25 -0
- package/dist/services/grepai.js +89 -0
- package/dist/services/grepai.js.map +1 -0
- package/dist/services/ollama.d.ts +22 -0
- package/dist/services/ollama.js +86 -0
- package/dist/services/ollama.js.map +1 -0
- package/dist/services/package-manager.d.ts +95 -0
- package/dist/services/package-manager.js +164 -0
- package/dist/services/package-manager.js.map +1 -0
- package/dist/types.d.ts +233 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import { getRunCommand, getInstallCommand } from '../services/package-manager.js';
|
|
2
|
+
/**
|
|
3
|
+
* Mustard commands subfolder
|
|
4
|
+
* Commands generated by Mustard go in commands/mustard/
|
|
5
|
+
* User-created commands go directly in commands/
|
|
6
|
+
*/
|
|
7
|
+
export const MUSTARD_COMMANDS_FOLDER = 'mustard';
|
|
8
|
+
/**
|
|
9
|
+
* Command prefix for Mustard commands
|
|
10
|
+
*/
|
|
11
|
+
export const MUSTARD_COMMAND_PREFIX = 'mtd';
|
|
12
|
+
/**
|
|
13
|
+
* Generate command files
|
|
14
|
+
* All generated commands go in the mustard/ subfolder
|
|
15
|
+
* Pattern: mtd-{category}-{action}
|
|
16
|
+
*/
|
|
17
|
+
export function generateCommands(projectInfo) {
|
|
18
|
+
const commands = {
|
|
19
|
+
// Pipeline commands
|
|
20
|
+
'mtd-pipeline-feature': generatePipelineFeatureCommand(projectInfo),
|
|
21
|
+
'mtd-pipeline-bugfix': generatePipelineBugfixCommand(projectInfo),
|
|
22
|
+
'mtd-pipeline-approve': generatePipelineApproveCommand(),
|
|
23
|
+
'mtd-pipeline-complete': generatePipelineCompleteCommand(),
|
|
24
|
+
'mtd-pipeline-resume': generatePipelineResumeCommand(),
|
|
25
|
+
// Git commands
|
|
26
|
+
'mtd-git-commit': generateGitCommitCommand(),
|
|
27
|
+
'mtd-git-push': generateGitPushCommand(),
|
|
28
|
+
'mtd-git-merge': generateGitMergeCommand(),
|
|
29
|
+
// Validate commands
|
|
30
|
+
'mtd-validate-build': generateValidateBuildCommand(projectInfo),
|
|
31
|
+
'mtd-validate-status': generateValidateStatusCommand(projectInfo),
|
|
32
|
+
// Sync commands
|
|
33
|
+
'mtd-sync-registry': generateSyncRegistryCommand(),
|
|
34
|
+
'mtd-sync-dependencies': generateSyncDependenciesCommand(projectInfo),
|
|
35
|
+
'mtd-sync-context': generateSyncContextCommand(),
|
|
36
|
+
// Report commands
|
|
37
|
+
'mtd-report-daily': generateReportDailyCommand(),
|
|
38
|
+
'mtd-report-weekly': generateReportWeeklyCommand(),
|
|
39
|
+
// Scan commands
|
|
40
|
+
'mtd-scan-project': generateScanProjectCommand(),
|
|
41
|
+
// Task commands (L0 Universal Delegation)
|
|
42
|
+
'mtd-task-analyze': generateTaskAnalyzeCommand(),
|
|
43
|
+
'mtd-task-review': generateTaskReviewCommand(),
|
|
44
|
+
'mtd-task-refactor': generateTaskRefactorCommand(),
|
|
45
|
+
'mtd-task-docs': generateTaskDocsCommand()
|
|
46
|
+
};
|
|
47
|
+
return commands;
|
|
48
|
+
}
|
|
49
|
+
// ============== Pipeline Commands ==============
|
|
50
|
+
function generatePipelineFeatureCommand(projectInfo) {
|
|
51
|
+
return `# /mtd-pipeline-feature - Feature Pipeline
|
|
52
|
+
|
|
53
|
+
## Trigger
|
|
54
|
+
|
|
55
|
+
\`/mtd-pipeline-feature <feature-name>\`
|
|
56
|
+
|
|
57
|
+
## Description
|
|
58
|
+
|
|
59
|
+
Starts the full pipeline to implement a new feature.
|
|
60
|
+
|
|
61
|
+
## Flow
|
|
62
|
+
|
|
63
|
+
1. **EXPLORE**
|
|
64
|
+
- Use Task(Explore) to analyze requirements
|
|
65
|
+
- Map related existing files
|
|
66
|
+
- Identify patterns to follow
|
|
67
|
+
|
|
68
|
+
2. **SPEC**
|
|
69
|
+
- Create spec at \`spec/active/{name}/spec.md\`
|
|
70
|
+
- List files to create/modify
|
|
71
|
+
- Define implementation checklist
|
|
72
|
+
|
|
73
|
+
3. **APPROVE**
|
|
74
|
+
- Present spec to user
|
|
75
|
+
- Wait for /mtd-pipeline-approve or feedback
|
|
76
|
+
|
|
77
|
+
4. **IMPLEMENT**
|
|
78
|
+
- Delegate to specialized agents
|
|
79
|
+
- Backend → Frontend → Database (order as needed)
|
|
80
|
+
|
|
81
|
+
5. **REVIEW**
|
|
82
|
+
- Validate implementation
|
|
83
|
+
- Verify checklist
|
|
84
|
+
|
|
85
|
+
6. **COMPLETE**
|
|
86
|
+
- Update entity-registry if needed
|
|
87
|
+
- Move spec to completed/
|
|
88
|
+
|
|
89
|
+
## Example
|
|
90
|
+
|
|
91
|
+
\`\`\`
|
|
92
|
+
User: /mtd-pipeline-feature add-partner-email-field
|
|
93
|
+
|
|
94
|
+
Claude:
|
|
95
|
+
1. Explores codebase to understand Partner
|
|
96
|
+
2. Creates spec with implementation plan
|
|
97
|
+
3. Presents spec for approval
|
|
98
|
+
4. (after /mtd-pipeline-approve) Implements Database → Backend → Frontend
|
|
99
|
+
5. Validates and completes
|
|
100
|
+
\`\`\`
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
function generatePipelineBugfixCommand(projectInfo) {
|
|
104
|
+
return `# /mtd-pipeline-bugfix - Bug Fix Pipeline
|
|
105
|
+
|
|
106
|
+
## Trigger
|
|
107
|
+
|
|
108
|
+
\`/mtd-pipeline-bugfix <error-description>\`
|
|
109
|
+
|
|
110
|
+
## Description
|
|
111
|
+
|
|
112
|
+
Starts the pipeline to diagnose and fix a bug.
|
|
113
|
+
|
|
114
|
+
## Flow
|
|
115
|
+
|
|
116
|
+
1. **DIAGNOSE**
|
|
117
|
+
- Use grepai to search related code
|
|
118
|
+
- Identify root cause
|
|
119
|
+
- Document findings
|
|
120
|
+
|
|
121
|
+
2. **SPEC**
|
|
122
|
+
- Create spec at \`spec/active/{name}/spec.md\`
|
|
123
|
+
- Describe root cause
|
|
124
|
+
- Propose fix
|
|
125
|
+
|
|
126
|
+
3. **APPROVE**
|
|
127
|
+
- Present diagnosis to user
|
|
128
|
+
- Wait for /mtd-pipeline-approve
|
|
129
|
+
|
|
130
|
+
4. **FIX**
|
|
131
|
+
- Apply minimal fix
|
|
132
|
+
- Do not make unrelated changes
|
|
133
|
+
|
|
134
|
+
5. **VALIDATE**
|
|
135
|
+
- Verify bug is fixed
|
|
136
|
+
- Verify nothing broke
|
|
137
|
+
|
|
138
|
+
6. **COMPLETE**
|
|
139
|
+
- Document solution
|
|
140
|
+
- Move spec to completed/
|
|
141
|
+
|
|
142
|
+
## Example
|
|
143
|
+
|
|
144
|
+
\`\`\`
|
|
145
|
+
User: /mtd-pipeline-bugfix error saving contract
|
|
146
|
+
|
|
147
|
+
Claude:
|
|
148
|
+
1. Uses grepai to find save code
|
|
149
|
+
2. Identifies root cause
|
|
150
|
+
3. Presents diagnosis
|
|
151
|
+
4. (after /mtd-pipeline-approve) Fixes
|
|
152
|
+
5. Validates and completes
|
|
153
|
+
\`\`\`
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
function generatePipelineApproveCommand() {
|
|
157
|
+
return `# /mtd-pipeline-approve - Approve Spec
|
|
158
|
+
|
|
159
|
+
## Trigger
|
|
160
|
+
|
|
161
|
+
\`/mtd-pipeline-approve\`
|
|
162
|
+
|
|
163
|
+
## Description
|
|
164
|
+
|
|
165
|
+
Approves the current spec and enables the implementation phase.
|
|
166
|
+
|
|
167
|
+
## Prerequisites
|
|
168
|
+
|
|
169
|
+
- Active pipeline (created via /mtd-pipeline-feature or /mtd-pipeline-bugfix)
|
|
170
|
+
- Spec presented awaiting approval
|
|
171
|
+
|
|
172
|
+
## Action
|
|
173
|
+
|
|
174
|
+
1. Marks pipeline as "approved"
|
|
175
|
+
2. Enables implementation start
|
|
176
|
+
3. Claude proceeds automatically
|
|
177
|
+
|
|
178
|
+
## Alternative Flow
|
|
179
|
+
|
|
180
|
+
If the spec is not satisfactory, the user can:
|
|
181
|
+
- Give text feedback for adjustments
|
|
182
|
+
- Use /mtd-pipeline-complete to cancel
|
|
183
|
+
|
|
184
|
+
\`\`\`
|
|
185
|
+
User: /mtd-pipeline-approve
|
|
186
|
+
|
|
187
|
+
Claude: ✅ Spec approved! Starting implementation...
|
|
188
|
+
\`\`\`
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
function generatePipelineCompleteCommand() {
|
|
192
|
+
return `# /mtd-pipeline-complete - Finalize Pipeline
|
|
193
|
+
|
|
194
|
+
## Trigger
|
|
195
|
+
|
|
196
|
+
\`/mtd-pipeline-complete\`
|
|
197
|
+
|
|
198
|
+
## Description
|
|
199
|
+
|
|
200
|
+
Finalizes the current pipeline, either completing or canceling.
|
|
201
|
+
|
|
202
|
+
## Action
|
|
203
|
+
|
|
204
|
+
1. Moves spec from \`spec/active/\` to \`spec/completed/\`
|
|
205
|
+
2. Updates entity-registry if needed
|
|
206
|
+
3. Clears pipeline state
|
|
207
|
+
|
|
208
|
+
## When to Use
|
|
209
|
+
|
|
210
|
+
- After successful implementation and review
|
|
211
|
+
- To cancel an ongoing pipeline
|
|
212
|
+
- To force close if something went wrong
|
|
213
|
+
|
|
214
|
+
\`\`\`
|
|
215
|
+
User: /mtd-pipeline-complete
|
|
216
|
+
|
|
217
|
+
Claude: ✅ Pipeline finalized!
|
|
218
|
+
Spec moved to spec/completed/{name}/
|
|
219
|
+
Entity registry updated.
|
|
220
|
+
\`\`\`
|
|
221
|
+
`;
|
|
222
|
+
}
|
|
223
|
+
function generatePipelineResumeCommand() {
|
|
224
|
+
return `# /mtd-pipeline-resume - Resume Pipeline
|
|
225
|
+
|
|
226
|
+
## Trigger
|
|
227
|
+
|
|
228
|
+
\`/mtd-pipeline-resume\`
|
|
229
|
+
|
|
230
|
+
## Description
|
|
231
|
+
|
|
232
|
+
Resumes a pipeline that was interrupted.
|
|
233
|
+
|
|
234
|
+
## Action
|
|
235
|
+
|
|
236
|
+
1. Finds active pipeline
|
|
237
|
+
2. Identifies last completed phase
|
|
238
|
+
3. Continues from where it stopped
|
|
239
|
+
|
|
240
|
+
## When to Use
|
|
241
|
+
|
|
242
|
+
- After restarting Claude session
|
|
243
|
+
- After accidental interruption
|
|
244
|
+
- To continue work from another session
|
|
245
|
+
|
|
246
|
+
\`\`\`
|
|
247
|
+
User: /mtd-pipeline-resume
|
|
248
|
+
|
|
249
|
+
Claude: 🔄 Resuming pipeline "add-email-partner"
|
|
250
|
+
Last phase: IMPLEMENT
|
|
251
|
+
Continuing with Backend...
|
|
252
|
+
\`\`\`
|
|
253
|
+
`;
|
|
254
|
+
}
|
|
255
|
+
// ============== Git Commands ==============
|
|
256
|
+
function generateGitCommitCommand() {
|
|
257
|
+
return `# /mtd-git-commit - Simple Commit
|
|
258
|
+
|
|
259
|
+
## Trigger
|
|
260
|
+
|
|
261
|
+
\`/mtd-git-commit\`
|
|
262
|
+
|
|
263
|
+
## Description
|
|
264
|
+
|
|
265
|
+
Creates a commit with current changes.
|
|
266
|
+
|
|
267
|
+
## Action
|
|
268
|
+
|
|
269
|
+
1. Runs \`git status\` to see changes
|
|
270
|
+
2. Runs \`git diff\` to analyze content
|
|
271
|
+
3. Generates commit message based on changes
|
|
272
|
+
4. Runs \`git add\` + \`git commit\`
|
|
273
|
+
|
|
274
|
+
## Message Format
|
|
275
|
+
|
|
276
|
+
\`\`\`
|
|
277
|
+
<type>: <short description>
|
|
278
|
+
|
|
279
|
+
<detailed description if needed>
|
|
280
|
+
|
|
281
|
+
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
282
|
+
\`\`\`
|
|
283
|
+
|
|
284
|
+
Types: feat, fix, refactor, docs, chore, test
|
|
285
|
+
`;
|
|
286
|
+
}
|
|
287
|
+
function generateGitPushCommand() {
|
|
288
|
+
return `# /mtd-git-push - Commit and Push
|
|
289
|
+
|
|
290
|
+
## Trigger
|
|
291
|
+
|
|
292
|
+
\`/mtd-git-push\`
|
|
293
|
+
|
|
294
|
+
## Description
|
|
295
|
+
|
|
296
|
+
Creates commit and pushes to remote.
|
|
297
|
+
|
|
298
|
+
## Action
|
|
299
|
+
|
|
300
|
+
1. Same process as /mtd-git-commit
|
|
301
|
+
2. Adds \`git push\` at the end
|
|
302
|
+
|
|
303
|
+
## Cautions
|
|
304
|
+
|
|
305
|
+
- Checks if branch has remote configured
|
|
306
|
+
- Uses \`git push -u origin <branch>\` if needed
|
|
307
|
+
`;
|
|
308
|
+
}
|
|
309
|
+
function generateGitMergeCommand() {
|
|
310
|
+
return `# /mtd-git-merge - Merge to Main
|
|
311
|
+
|
|
312
|
+
## Trigger
|
|
313
|
+
|
|
314
|
+
\`/mtd-git-merge\`
|
|
315
|
+
|
|
316
|
+
## Description
|
|
317
|
+
|
|
318
|
+
Merges current branch to main/master.
|
|
319
|
+
|
|
320
|
+
## Action
|
|
321
|
+
|
|
322
|
+
1. Checks for uncommitted changes
|
|
323
|
+
2. Switches to main branch
|
|
324
|
+
3. Pulls latest changes
|
|
325
|
+
4. Merges feature branch
|
|
326
|
+
5. Pushes to remote
|
|
327
|
+
|
|
328
|
+
## Cautions
|
|
329
|
+
|
|
330
|
+
- Will abort if there are merge conflicts
|
|
331
|
+
- Requires clean working directory
|
|
332
|
+
`;
|
|
333
|
+
}
|
|
334
|
+
// ============== Validate Commands ==============
|
|
335
|
+
function generateValidateBuildCommand(projectInfo) {
|
|
336
|
+
const hasNode = projectInfo.stacks.some(s => ['react', 'nextjs', 'node'].includes(s.name));
|
|
337
|
+
const hasDotnet = projectInfo.stacks.some(s => s.name === 'dotnet');
|
|
338
|
+
const pm = projectInfo.packageManager ?? 'npm';
|
|
339
|
+
const steps = [];
|
|
340
|
+
if (hasDotnet) {
|
|
341
|
+
steps.push('- `dotnet build` - Verifies .NET compiles');
|
|
342
|
+
}
|
|
343
|
+
if (hasNode) {
|
|
344
|
+
steps.push(`- \`${getRunCommand(pm, 'typecheck')}\` - Verifies TypeScript types`);
|
|
345
|
+
steps.push(`- \`${getRunCommand(pm, 'lint')}\` - Verifies linting (if available)`);
|
|
346
|
+
}
|
|
347
|
+
return `# /mtd-validate-build - Build Validation
|
|
348
|
+
|
|
349
|
+
## Trigger
|
|
350
|
+
|
|
351
|
+
\`/mtd-validate-build\`
|
|
352
|
+
|
|
353
|
+
## Description
|
|
354
|
+
|
|
355
|
+
Runs build and type-check validations.
|
|
356
|
+
|
|
357
|
+
## Actions
|
|
358
|
+
|
|
359
|
+
${steps.join('\n') || '- Verify project compilation'}
|
|
360
|
+
|
|
361
|
+
## Result
|
|
362
|
+
|
|
363
|
+
- ✅ **Success** - Project compiles and passes type-check
|
|
364
|
+
- ❌ **Failure** - Lists errors found
|
|
365
|
+
`;
|
|
366
|
+
}
|
|
367
|
+
function generateValidateStatusCommand(projectInfo) {
|
|
368
|
+
return `# /mtd-validate-status - Consolidated Status
|
|
369
|
+
|
|
370
|
+
## Trigger
|
|
371
|
+
|
|
372
|
+
\`/mtd-validate-status\`
|
|
373
|
+
|
|
374
|
+
## Description
|
|
375
|
+
|
|
376
|
+
Shows consolidated project status.
|
|
377
|
+
|
|
378
|
+
## Information
|
|
379
|
+
|
|
380
|
+
1. **Git Status**
|
|
381
|
+
- Current branch
|
|
382
|
+
- Modified files
|
|
383
|
+
- Commits pending push
|
|
384
|
+
|
|
385
|
+
2. **Pipeline**
|
|
386
|
+
- Active pipeline (if any)
|
|
387
|
+
- Current phase
|
|
388
|
+
|
|
389
|
+
3. **Build**
|
|
390
|
+
- Last validation result
|
|
391
|
+
|
|
392
|
+
4. **Entity Registry**
|
|
393
|
+
- Number of entities
|
|
394
|
+
- Last update
|
|
395
|
+
`;
|
|
396
|
+
}
|
|
397
|
+
// ============== Sync Commands ==============
|
|
398
|
+
function generateSyncRegistryCommand() {
|
|
399
|
+
return `# /mtd-sync-registry - Update Entity Registry
|
|
400
|
+
|
|
401
|
+
## Trigger
|
|
402
|
+
|
|
403
|
+
\`/mtd-sync-registry\`
|
|
404
|
+
|
|
405
|
+
## Description
|
|
406
|
+
|
|
407
|
+
Scans the project and updates entity-registry.json.
|
|
408
|
+
|
|
409
|
+
## Action
|
|
410
|
+
|
|
411
|
+
1. Searches database schemas (Drizzle, Prisma, etc)
|
|
412
|
+
2. Searches backend entities (.NET, Node, etc)
|
|
413
|
+
3. Updates \`.claude/entity-registry.json\`
|
|
414
|
+
|
|
415
|
+
## When to Use
|
|
416
|
+
|
|
417
|
+
- After creating new entity
|
|
418
|
+
- After importing existing code
|
|
419
|
+
- To sync after manual changes
|
|
420
|
+
`;
|
|
421
|
+
}
|
|
422
|
+
function generateSyncDependenciesCommand(projectInfo) {
|
|
423
|
+
const pm = projectInfo.packageManager ?? 'npm';
|
|
424
|
+
const hasDotnet = projectInfo.stacks.some(s => s.name === 'dotnet');
|
|
425
|
+
return `# /mtd-sync-dependencies - Install Dependencies
|
|
426
|
+
|
|
427
|
+
## Trigger
|
|
428
|
+
|
|
429
|
+
\`/mtd-sync-dependencies\`
|
|
430
|
+
|
|
431
|
+
## Description
|
|
432
|
+
|
|
433
|
+
Installs dependencies for all projects.
|
|
434
|
+
|
|
435
|
+
## Actions
|
|
436
|
+
|
|
437
|
+
${hasDotnet ? '- `dotnet restore` - Restores NuGet packages\n' : ''}- \`${getInstallCommand(pm)}\` - Installs Node dependencies
|
|
438
|
+
|
|
439
|
+
## Subprojects
|
|
440
|
+
|
|
441
|
+
If monorepo, runs in all configured subprojects.
|
|
442
|
+
`;
|
|
443
|
+
}
|
|
444
|
+
function generateSyncContextCommand() {
|
|
445
|
+
return `# /mtd-sync-context - Load Project Context
|
|
446
|
+
|
|
447
|
+
## Trigger
|
|
448
|
+
|
|
449
|
+
\`/mtd-sync-context\`
|
|
450
|
+
\`/mtd-sync-context --refresh\`
|
|
451
|
+
|
|
452
|
+
## Description
|
|
453
|
+
|
|
454
|
+
Discovers and caches project context for faster implementations.
|
|
455
|
+
|
|
456
|
+
## What It Does
|
|
457
|
+
|
|
458
|
+
1. Reads \`.claude/context/*.md\` for user-provided context
|
|
459
|
+
2. Reads \`.claude/CLAUDE.md\` for project rules and conventions
|
|
460
|
+
3. Reads \`.claude/entity-registry.json\` for entity mappings
|
|
461
|
+
4. Uses grepai to discover code patterns (services, repos, components)
|
|
462
|
+
5. Stores all in memory MCP as entities
|
|
463
|
+
|
|
464
|
+
## When It Runs
|
|
465
|
+
|
|
466
|
+
- **Automatically** at the start of /mtd-pipeline-feature or /mtd-pipeline-bugfix (if context is missing or stale)
|
|
467
|
+
- **Manually** when you run /mtd-sync-context
|
|
468
|
+
- **Force refresh** with /mtd-sync-context --refresh
|
|
469
|
+
|
|
470
|
+
## Context Sources
|
|
471
|
+
|
|
472
|
+
| Source | Entity Type | Content |
|
|
473
|
+
|--------|-------------|---------|
|
|
474
|
+
| \`.claude/context/*.md\` | \`UserContext:*\` | User-provided specs, tips, examples |
|
|
475
|
+
| \`.claude/CLAUDE.md\` | \`ProjectContext\` | Stacks, naming, conventions |
|
|
476
|
+
| \`.claude/entity-registry.json\` | \`EntityRegistry\` | Entity mappings |
|
|
477
|
+
| \`.claude/core/enforcement.md\` | \`EnforcementRules\` | L0-L9 rules |
|
|
478
|
+
| grepai discovery | \`CodePattern:*\` | Services, repos, components |
|
|
479
|
+
|
|
480
|
+
## Output
|
|
481
|
+
|
|
482
|
+
\`\`\`
|
|
483
|
+
✅ Context loaded successfully
|
|
484
|
+
|
|
485
|
+
Project Context:
|
|
486
|
+
- Type: monorepo
|
|
487
|
+
- Stacks: dotnet:9.0, react:19.x
|
|
488
|
+
|
|
489
|
+
User Context (3 files):
|
|
490
|
+
- architecture.md
|
|
491
|
+
- business-rules.md
|
|
492
|
+
- tips.md
|
|
493
|
+
|
|
494
|
+
Code Patterns:
|
|
495
|
+
- service (Backend/Services/ContractService.cs)
|
|
496
|
+
- repository (Backend/Repositories/ContractRepository.cs)
|
|
497
|
+
\`\`\`
|
|
498
|
+
|
|
499
|
+
## Context Refresh Strategy
|
|
500
|
+
|
|
501
|
+
| Trigger | Action |
|
|
502
|
+
|---------|--------|
|
|
503
|
+
| Context > 24h old | Auto-refresh on /mtd-pipeline-feature or /mtd-pipeline-bugfix |
|
|
504
|
+
| \`/mtd-sync-context --refresh\` | Force full refresh |
|
|
505
|
+
| \`/mtd-sync-registry\` | Refresh only EntityRegistry |
|
|
506
|
+
|
|
507
|
+
## See Also
|
|
508
|
+
|
|
509
|
+
- [context/README.md](../context/README.md) - How to create context files
|
|
510
|
+
- [/mtd-pipeline-feature](./mtd-pipeline-feature.md) - Feature pipeline (auto-loads context)
|
|
511
|
+
- [/mtd-pipeline-bugfix](./mtd-pipeline-bugfix.md) - Bugfix pipeline (auto-loads context)
|
|
512
|
+
`;
|
|
513
|
+
}
|
|
514
|
+
// ============== Report Commands ==============
|
|
515
|
+
function generateReportDailyCommand() {
|
|
516
|
+
return `# /mtd-report-daily - Daily Report
|
|
517
|
+
|
|
518
|
+
## Trigger
|
|
519
|
+
|
|
520
|
+
\`/mtd-report-daily\`
|
|
521
|
+
|
|
522
|
+
## Description
|
|
523
|
+
|
|
524
|
+
Generates a daily progress report.
|
|
525
|
+
|
|
526
|
+
## Content
|
|
527
|
+
|
|
528
|
+
1. **Commits Today**
|
|
529
|
+
- List of commits made
|
|
530
|
+
- Files changed
|
|
531
|
+
|
|
532
|
+
2. **Pipeline Activity**
|
|
533
|
+
- Features started/completed
|
|
534
|
+
- Bugs fixed
|
|
535
|
+
|
|
536
|
+
3. **Pending Items**
|
|
537
|
+
- Open pipelines
|
|
538
|
+
- Uncommitted changes
|
|
539
|
+
|
|
540
|
+
## Output Format
|
|
541
|
+
|
|
542
|
+
Markdown report suitable for sharing or documentation.
|
|
543
|
+
`;
|
|
544
|
+
}
|
|
545
|
+
function generateReportWeeklyCommand() {
|
|
546
|
+
return `# /mtd-report-weekly - Weekly Report
|
|
547
|
+
|
|
548
|
+
## Trigger
|
|
549
|
+
|
|
550
|
+
\`/mtd-report-weekly\`
|
|
551
|
+
|
|
552
|
+
## Description
|
|
553
|
+
|
|
554
|
+
Generates a weekly progress report.
|
|
555
|
+
|
|
556
|
+
## Content
|
|
557
|
+
|
|
558
|
+
1. **Week Summary**
|
|
559
|
+
- Total commits
|
|
560
|
+
- Features completed
|
|
561
|
+
- Bugs fixed
|
|
562
|
+
|
|
563
|
+
2. **Entity Changes**
|
|
564
|
+
- New entities created
|
|
565
|
+
- Entities modified
|
|
566
|
+
|
|
567
|
+
3. **Code Metrics**
|
|
568
|
+
- Lines added/removed
|
|
569
|
+
- Files changed
|
|
570
|
+
|
|
571
|
+
## Output Format
|
|
572
|
+
|
|
573
|
+
Markdown report suitable for team updates.
|
|
574
|
+
`;
|
|
575
|
+
}
|
|
576
|
+
// ============== Scan Commands ==============
|
|
577
|
+
function generateScanProjectCommand() {
|
|
578
|
+
return `# /mtd-scan-project - Scan Project
|
|
579
|
+
|
|
580
|
+
## Trigger
|
|
581
|
+
|
|
582
|
+
\`/mtd-scan-project\`
|
|
583
|
+
|
|
584
|
+
## Description
|
|
585
|
+
|
|
586
|
+
Scans the project structure and updates detection.
|
|
587
|
+
|
|
588
|
+
## Action
|
|
589
|
+
|
|
590
|
+
1. Detects technology stacks
|
|
591
|
+
2. Maps folder structure
|
|
592
|
+
3. Identifies naming conventions
|
|
593
|
+
4. Updates project state
|
|
594
|
+
|
|
595
|
+
## When to Use
|
|
596
|
+
|
|
597
|
+
- After major structural changes
|
|
598
|
+
- When adding new technology
|
|
599
|
+
- To refresh project detection
|
|
600
|
+
`;
|
|
601
|
+
}
|
|
602
|
+
// ============== Task Commands (L0 Universal Delegation) ==============
|
|
603
|
+
function generateTaskAnalyzeCommand() {
|
|
604
|
+
return `# /mtd-task-analyze - Code Analysis
|
|
605
|
+
|
|
606
|
+
> Analyzes code in a **separate Task context** (L0 Universal Delegation).
|
|
607
|
+
|
|
608
|
+
## Trigger
|
|
609
|
+
|
|
610
|
+
\`/mtd-task-analyze <scope>\`
|
|
611
|
+
|
|
612
|
+
## Description
|
|
613
|
+
|
|
614
|
+
Analyzes code in a separate Task(Explore) context.
|
|
615
|
+
Use for any code exploration that doesn't fit feature/bugfix pipelines.
|
|
616
|
+
|
|
617
|
+
## L0 Enforcement
|
|
618
|
+
|
|
619
|
+
**CRITICAL**: This command enforces L0 Universal Delegation:
|
|
620
|
+
- Parent context does NOT read code
|
|
621
|
+
- Parent context ONLY coordinates and presents results
|
|
622
|
+
- ALL analysis happens in Task(Explore) context
|
|
623
|
+
|
|
624
|
+
## Flow
|
|
625
|
+
|
|
626
|
+
1. **DELEGATE** 🔍
|
|
627
|
+
- Create Task(Explore) with analysis scope
|
|
628
|
+
- Never analyze directly in parent context
|
|
629
|
+
|
|
630
|
+
2. **REPORT**
|
|
631
|
+
- Present findings to user
|
|
632
|
+
|
|
633
|
+
## Implementation
|
|
634
|
+
|
|
635
|
+
\`\`\`javascript
|
|
636
|
+
Task({
|
|
637
|
+
subagent_type: "Explore",
|
|
638
|
+
model: "haiku",
|
|
639
|
+
description: \`🔍 Analyze: \${scope}\`,
|
|
640
|
+
prompt: \`
|
|
641
|
+
# 🔍 CODE ANALYSIS TASK
|
|
642
|
+
## Scope: \${scope}
|
|
643
|
+
## Instructions
|
|
644
|
+
1. Use grepai_search for semantic search
|
|
645
|
+
2. Read relevant files
|
|
646
|
+
3. Document patterns found
|
|
647
|
+
4. Report findings clearly
|
|
648
|
+
\`
|
|
649
|
+
})
|
|
650
|
+
\`\`\`
|
|
651
|
+
|
|
652
|
+
## Examples
|
|
653
|
+
|
|
654
|
+
\`\`\`bash
|
|
655
|
+
/mtd-task-analyze authentication flow
|
|
656
|
+
/mtd-task-analyze "database schema"
|
|
657
|
+
/mtd-task-analyze error handling patterns
|
|
658
|
+
\`\`\`
|
|
659
|
+
`;
|
|
660
|
+
}
|
|
661
|
+
function generateTaskReviewCommand() {
|
|
662
|
+
return `# /mtd-task-review - Code Review
|
|
663
|
+
|
|
664
|
+
> Performs code review in a **separate Task context** (L0 Universal Delegation).
|
|
665
|
+
|
|
666
|
+
## Trigger
|
|
667
|
+
|
|
668
|
+
\`/mtd-task-review <scope>\`
|
|
669
|
+
|
|
670
|
+
## Description
|
|
671
|
+
|
|
672
|
+
Reviews code quality in a separate Task(general-purpose) context.
|
|
673
|
+
Use for QA, SOLID validation, security checks.
|
|
674
|
+
|
|
675
|
+
## L0 Enforcement
|
|
676
|
+
|
|
677
|
+
**CRITICAL**: This command enforces L0 Universal Delegation:
|
|
678
|
+
- Parent context does NOT read code
|
|
679
|
+
- Parent context ONLY coordinates and presents results
|
|
680
|
+
- ALL review happens in Task(general-purpose) context
|
|
681
|
+
|
|
682
|
+
## Flow
|
|
683
|
+
|
|
684
|
+
1. **DELEGATE** 🔎
|
|
685
|
+
- Create Task(general-purpose) with review prompt
|
|
686
|
+
- Never review directly in parent context
|
|
687
|
+
|
|
688
|
+
2. **REPORT**
|
|
689
|
+
- Present findings with severity levels
|
|
690
|
+
|
|
691
|
+
## Implementation
|
|
692
|
+
|
|
693
|
+
\`\`\`javascript
|
|
694
|
+
Task({
|
|
695
|
+
subagent_type: "general-purpose",
|
|
696
|
+
model: "opus",
|
|
697
|
+
description: \`🔎 Review: \${scope}\`,
|
|
698
|
+
prompt: \`
|
|
699
|
+
# 🔎 CODE REVIEW TASK
|
|
700
|
+
## Scope: \${scope}
|
|
701
|
+
## Checklist
|
|
702
|
+
- [ ] SOLID principles
|
|
703
|
+
- [ ] Error handling
|
|
704
|
+
- [ ] Security concerns
|
|
705
|
+
- [ ] Performance issues
|
|
706
|
+
## Output: [Severity] File:Line - Issue - Suggestion
|
|
707
|
+
\`
|
|
708
|
+
})
|
|
709
|
+
\`\`\`
|
|
710
|
+
|
|
711
|
+
## Examples
|
|
712
|
+
|
|
713
|
+
\`\`\`bash
|
|
714
|
+
/mtd-task-review src/services/payment
|
|
715
|
+
/mtd-task-review "Contract entity"
|
|
716
|
+
/mtd-task-review "security in auth module"
|
|
717
|
+
\`\`\`
|
|
718
|
+
`;
|
|
719
|
+
}
|
|
720
|
+
function generateTaskRefactorCommand() {
|
|
721
|
+
return `# /mtd-task-refactor - Code Refactoring
|
|
722
|
+
|
|
723
|
+
> Refactors code in **separate Task contexts** (L0 Universal Delegation).
|
|
724
|
+
|
|
725
|
+
## Trigger
|
|
726
|
+
|
|
727
|
+
\`/mtd-task-refactor <scope>\`
|
|
728
|
+
|
|
729
|
+
## Description
|
|
730
|
+
|
|
731
|
+
Refactors code using Plan → Approve → Implement flow.
|
|
732
|
+
Uses separate Task contexts for planning and execution.
|
|
733
|
+
|
|
734
|
+
## L0 Enforcement
|
|
735
|
+
|
|
736
|
+
**CRITICAL**: This command enforces L0 Universal Delegation:
|
|
737
|
+
- Parent context does NOT read code
|
|
738
|
+
- Parent context does NOT plan or implement
|
|
739
|
+
- ALL work happens in Task(Plan) and Task(general-purpose) contexts
|
|
740
|
+
|
|
741
|
+
## Flow
|
|
742
|
+
|
|
743
|
+
1. **PLAN** 📋
|
|
744
|
+
- Create Task(Plan) to analyze scope
|
|
745
|
+
- Propose refactoring strategy
|
|
746
|
+
|
|
747
|
+
2. **APPROVE**
|
|
748
|
+
- Present plan to user
|
|
749
|
+
- Wait for approval
|
|
750
|
+
|
|
751
|
+
3. **IMPLEMENT** ⚙️
|
|
752
|
+
- Create Task(general-purpose) to execute
|
|
753
|
+
- Apply changes incrementally
|
|
754
|
+
|
|
755
|
+
4. **VALIDATE**
|
|
756
|
+
- Run build/tests
|
|
757
|
+
|
|
758
|
+
## Implementation
|
|
759
|
+
|
|
760
|
+
\`\`\`javascript
|
|
761
|
+
// Phase 1: Plan
|
|
762
|
+
Task({
|
|
763
|
+
subagent_type: "Plan",
|
|
764
|
+
model: "sonnet",
|
|
765
|
+
description: \`📋 Plan refactor: \${scope}\`,
|
|
766
|
+
prompt: \`# Plan refactoring for \${scope}...\`
|
|
767
|
+
})
|
|
768
|
+
|
|
769
|
+
// Phase 2: Execute (after approval)
|
|
770
|
+
Task({
|
|
771
|
+
subagent_type: "general-purpose",
|
|
772
|
+
model: "opus",
|
|
773
|
+
description: \`⚙️ Execute refactor: \${scope}\`,
|
|
774
|
+
prompt: \`# Execute approved plan...\`
|
|
775
|
+
})
|
|
776
|
+
\`\`\`
|
|
777
|
+
|
|
778
|
+
## Examples
|
|
779
|
+
|
|
780
|
+
\`\`\`bash
|
|
781
|
+
/mtd-task-refactor "extract PaymentService"
|
|
782
|
+
/mtd-task-refactor "rename User to Account"
|
|
783
|
+
/mtd-task-refactor "split large component"
|
|
784
|
+
\`\`\`
|
|
785
|
+
`;
|
|
786
|
+
}
|
|
787
|
+
function generateTaskDocsCommand() {
|
|
788
|
+
return `# /mtd-task-docs - Documentation Generation
|
|
789
|
+
|
|
790
|
+
> Generates documentation in a **separate Task context** (L0 Universal Delegation).
|
|
791
|
+
|
|
792
|
+
## Trigger
|
|
793
|
+
|
|
794
|
+
\`/mtd-task-docs <scope>\`
|
|
795
|
+
|
|
796
|
+
## Description
|
|
797
|
+
|
|
798
|
+
Generates documentation in a separate Task(general-purpose) context.
|
|
799
|
+
Use for API docs, README updates, or technical documentation.
|
|
800
|
+
|
|
801
|
+
## L0 Enforcement
|
|
802
|
+
|
|
803
|
+
**CRITICAL**: This command enforces L0 Universal Delegation:
|
|
804
|
+
- Parent context does NOT read code
|
|
805
|
+
- Parent context does NOT generate documentation
|
|
806
|
+
- ALL work happens in Task(general-purpose) context
|
|
807
|
+
|
|
808
|
+
## Flow
|
|
809
|
+
|
|
810
|
+
1. **DELEGATE** 📊
|
|
811
|
+
- Create Task(general-purpose) with docs prompt
|
|
812
|
+
- Never generate docs in parent context
|
|
813
|
+
|
|
814
|
+
2. **PRESENT**
|
|
815
|
+
- Show generated documentation
|
|
816
|
+
- Ask for approval before saving
|
|
817
|
+
|
|
818
|
+
## Implementation
|
|
819
|
+
|
|
820
|
+
\`\`\`javascript
|
|
821
|
+
Task({
|
|
822
|
+
subagent_type: "general-purpose",
|
|
823
|
+
model: "sonnet",
|
|
824
|
+
description: \`📊 Docs: \${scope}\`,
|
|
825
|
+
prompt: \`
|
|
826
|
+
# 📊 DOCUMENTATION TASK
|
|
827
|
+
## Scope: \${scope}
|
|
828
|
+
## Instructions
|
|
829
|
+
1. Use grepai to find relevant code
|
|
830
|
+
2. Generate appropriate documentation
|
|
831
|
+
3. Indicate where to save
|
|
832
|
+
\`
|
|
833
|
+
})
|
|
834
|
+
\`\`\`
|
|
835
|
+
|
|
836
|
+
## Examples
|
|
837
|
+
|
|
838
|
+
\`\`\`bash
|
|
839
|
+
/mtd-task-docs "API endpoints"
|
|
840
|
+
/mtd-task-docs "Contract entity"
|
|
841
|
+
/mtd-task-docs "update README"
|
|
842
|
+
\`\`\`
|
|
843
|
+
`;
|
|
844
|
+
}
|
|
845
|
+
//# sourceMappingURL=commands.js.map
|