@meltstudio/meltctl 1.4.0 → 1.6.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 CHANGED
@@ -43,14 +43,20 @@ After running `meltctl project init`, you get these commands in Cursor:
43
43
  ### Initialize a New Project
44
44
 
45
45
  ```bash
46
+ # Auto-detect shell type
46
47
  meltctl project init
48
+
49
+ # Specify shell type explicitly
50
+ meltctl project init --shell sh # for bash/zsh
51
+ meltctl project init --shell ps # for PowerShell
47
52
  ```
48
53
 
49
54
  This command:
50
- - Creates necessary directories
51
- - Installs Cursor command templates
55
+ - Creates necessary directories using bundled templates
56
+ - Installs Cursor command templates from organized template files
52
57
  - Sets up project structure for AI-assisted development
53
58
  - Supports both shell (sh/bash/zsh) and PowerShell environments
59
+ - Uses fs-extra for robust file operations and template copying
54
60
 
55
61
  ### Update Project (Coming Soon)
56
62
 
@@ -60,29 +66,6 @@ meltctl project update
60
66
 
61
67
  Updates your project templates to the latest version.
62
68
 
63
- ## 💡 Example Workflow
64
-
65
- 1. **Plan Your Feature**
66
- ```
67
- # In Cursor, use:
68
- /melt-plan
69
- ```
70
-
71
- 2. **Generate Tests**
72
- ```
73
- /melt-test-plan
74
- ```
75
-
76
- 3. **Implement**
77
- ```
78
- /melt-implement
79
- ```
80
-
81
- 4. **Create PR**
82
- ```
83
- /melt-pr
84
- ```
85
-
86
69
  ## 🛠️ Requirements
87
70
 
88
71
  - Node.js 22+ (works with Node.js 18+ but 22+ recommended)
@@ -128,22 +111,20 @@ This tool is part of the Melt Development Process. For issues or contributions:
128
111
  - [GitHub Repository](https://github.com/MeltStudio/melt-development-prompts)
129
112
  - [Report Issues](https://github.com/MeltStudio/melt-development-prompts/issues)
130
113
 
131
- ## 📦 What's Included
114
+ ## 🏛️ Template Architecture
132
115
 
133
- - Domain-driven development templates
134
- - React 2025 patterns and standards
135
- - TypeScript strict mode configurations
136
- - Comprehensive testing strategies
137
- - Accessibility compliance checks
138
- - Performance optimization patterns
116
+ The CLI uses a bundled template system organized in:
139
117
 
140
- ## ⚡ Benefits
118
+ ```
119
+ packages/cli/templates/
120
+ ├── cursor-commands/ # All 8 Cursor AI command templates
121
+ ├── melt-memory/ # Project context templates with dynamic timestamps
122
+ └── melt-scripts/ # Utility scripts for sh and PowerShell
123
+ ├── sh/ # Bash/zsh utility scripts
124
+ └── ps/ # PowerShell utility scripts
125
+ ```
141
126
 
142
- - **40% faster development** with AI assistance
143
- - **Consistent code quality** across teams
144
- - **Built-in best practices** and standards
145
- - **Systematic debugging** approach
146
- - **Streamlined PR process**
127
+ Templates support dynamic content replacement (like timestamps) and are copied to your project during initialization.
147
128
 
148
129
  ## 📄 License
149
130
 
@@ -1,6 +1,5 @@
1
1
  interface InitOptions {
2
- shell?: 'sh' | 'ps';
3
- force?: boolean;
2
+ shell?: 'sh' | 'ps' | 'auto';
4
3
  }
5
4
  export declare function initCommand(options?: InitOptions): Promise<void>;
6
5
  export {};
@@ -1,6 +1,7 @@
1
1
  import { intro, outro, select, confirm, spinner } from '@clack/prompts';
2
2
  import chalk from 'chalk';
3
- import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
3
+ import { existsSync, readFileSync } from 'fs';
4
+ import fs from 'fs-extra';
4
5
  import { join, dirname } from 'path';
5
6
  import { platform } from 'os';
6
7
  import { fileURLToPath } from 'url';
@@ -19,7 +20,7 @@ export async function initCommand(options = {}) {
19
20
  existingPaths.push('.cursor/commands/');
20
21
  if (existsSync(meltDir))
21
22
  existingPaths.push('.melt/');
22
- if (existingPaths.length > 0 && !options.force) {
23
+ if (existingPaths.length > 0) {
23
24
  console.log(chalk.yellow('⚠️ The following directories already exist:'));
24
25
  existingPaths.forEach(path => console.log(` • ${path}`));
25
26
  console.log();
@@ -33,21 +34,26 @@ export async function initCommand(options = {}) {
33
34
  }
34
35
  // Shell selection (explicit, auto-detect, or interactive)
35
36
  let selectedShell;
36
- if (options.shell) {
37
+ if (options.shell && options.shell !== 'auto') {
37
38
  selectedShell = options.shell;
38
39
  }
39
40
  else {
40
41
  // Auto-detect based on platform
41
42
  const defaultShell = platform() === 'win32' ? 'ps' : 'sh';
42
- // Interactive selection with default
43
- selectedShell = (await select({
44
- message: 'Choose script type:',
45
- options: [
46
- { value: 'sh', label: SHELL_CHOICES.sh, hint: defaultShell === 'sh' ? 'default' : '' },
47
- { value: 'ps', label: SHELL_CHOICES.ps, hint: defaultShell === 'ps' ? 'default' : '' },
48
- ],
49
- initialValue: defaultShell,
50
- }));
43
+ if (options.shell === 'auto') {
44
+ selectedShell = defaultShell;
45
+ }
46
+ else {
47
+ // Interactive selection with default
48
+ selectedShell = (await select({
49
+ message: 'Choose script type:',
50
+ options: [
51
+ { value: 'sh', label: SHELL_CHOICES.sh, hint: defaultShell === 'sh' ? 'default' : '' },
52
+ { value: 'ps', label: SHELL_CHOICES.ps, hint: defaultShell === 'ps' ? 'default' : '' },
53
+ ],
54
+ initialValue: defaultShell,
55
+ }));
56
+ }
51
57
  }
52
58
  console.log(chalk.cyan(`Selected shell: ${SHELL_CHOICES[selectedShell]}`));
53
59
  console.log();
@@ -105,565 +111,49 @@ function createDirectoryStructure(baseDir, shell) {
105
111
  ];
106
112
  dirs.forEach(dir => {
107
113
  const fullPath = join(baseDir, dir);
108
- mkdirSync(fullPath, { recursive: true });
114
+ fs.ensureDirSync(fullPath);
109
115
  });
110
116
  }
111
117
  async function copyTemplates(baseDir, shell) {
112
- // For now, we'll create basic templates inline
113
- // TODO: Copy from bundled templates directory
114
- const cursorCommands = {
115
- 'melt-plan.md': getPlanTemplate(),
116
- 'melt-test-plan.md': getTestPlanTemplate(),
117
- 'melt-docs.md': getDocsTemplate(),
118
- 'melt-implement.md': getImplementTemplate(),
119
- 'melt-pr.md': getPrTemplate(),
120
- 'melt-review.md': getReviewTemplate(),
121
- 'melt-complete.md': getCompleteTemplate(),
122
- 'melt-debug.md': getDebugTemplate(),
123
- };
124
- for (const [filename, content] of Object.entries(cursorCommands)) {
125
- const filePath = join(baseDir, '.cursor', 'commands', filename);
126
- writeFileSync(filePath, content, 'utf8');
118
+ const __filename = fileURLToPath(import.meta.url);
119
+ const __dirname = dirname(__filename);
120
+ // In dist, we need to go back to the CLI package root and find templates (from dist/commands/project to CLI root)
121
+ const templatesDir = join(__dirname, '../../../templates');
122
+ // Copy cursor commands
123
+ const cursorCommandsTemplateDir = join(templatesDir, 'cursor-commands');
124
+ const cursorCommandsDestDir = join(baseDir, '.cursor', 'commands');
125
+ if (existsSync(cursorCommandsTemplateDir)) {
126
+ fs.copySync(cursorCommandsTemplateDir, cursorCommandsDestDir);
127
+ }
128
+ // Create initial context file from template
129
+ const contextTemplatePath = join(templatesDir, 'melt-memory', 'context.md');
130
+ const contextDestPath = join(baseDir, '.melt', 'memory', 'context.md');
131
+ if (existsSync(contextTemplatePath)) {
132
+ let contextContent = readFileSync(contextTemplatePath, 'utf8');
133
+ // Replace timestamp placeholders
134
+ const timestamp = new Date().toISOString();
135
+ contextContent = contextContent.replace(/{{timestamp}}/g, timestamp);
136
+ fs.writeFileSync(contextDestPath, contextContent, 'utf8');
127
137
  }
128
- // Create initial context file
129
- const contextPath = join(baseDir, '.melt', 'memory', 'context.md');
130
- writeFileSync(contextPath, getInitialContext(), 'utf8');
131
- // Create basic shell utility (cross-platform)
138
+ // Copy shell script from template
132
139
  const scriptExt = shell === 'ps' ? 'ps1' : 'sh';
133
- const scriptPath = join(baseDir, '.melt', 'scripts', shell, `common.${scriptExt}`);
134
- const scriptContent = shell === 'ps' ? getPowerShellCommon() : getBashCommon();
135
- writeFileSync(scriptPath, scriptContent, 'utf8');
140
+ const scriptTemplatePath = join(templatesDir, 'melt-scripts', shell, `common.${scriptExt}`);
141
+ const scriptDestPath = join(baseDir, '.melt', 'scripts', shell, `common.${scriptExt}`);
142
+ if (existsSync(scriptTemplatePath)) {
143
+ fs.copySync(scriptTemplatePath, scriptDestPath);
144
+ }
136
145
  }
137
146
  function createVersionFile(meltDir) {
138
147
  const __filename = fileURLToPath(import.meta.url);
139
148
  const __dirname = dirname(__filename);
140
- const packageJson = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf8'));
149
+ // In dist, we need to go back to the CLI package root (from dist/commands/project to CLI root)
150
+ const packageJsonPath = join(__dirname, '../../../package.json');
151
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
141
152
  const versionData = {
142
153
  cliVersion: packageJson.version,
143
154
  initialized: new Date().toISOString(),
144
155
  lastUpdate: new Date().toISOString(),
145
156
  };
146
157
  const versionPath = join(meltDir, 'version.json');
147
- writeFileSync(versionPath, JSON.stringify(versionData, null, 2), 'utf8');
148
- }
149
- // Template content functions
150
- function getImplementTemplate() {
151
- return `---
152
- description: Execute implementation using Melt development standards and domain-driven architecture
153
- ---
154
-
155
- You are implementing a feature following Melt's domain-driven development process. Follow these steps:
156
-
157
- 1. **Load Context**:
158
- - Read \`.melt/memory/context.md\` for project context and requirements
159
- - Check \`.melt/outputs/plans/\` for any existing implementation plans
160
- - Review relevant domain structure in \`src/domains/\` if it exists
161
-
162
- 2. **Architecture Compliance**:
163
- - Follow React 2025 standards (functional components, hooks, TypeScript strict)
164
- - Use domain-driven design with clear separation of concerns
165
- - Implement server components by default, client components when needed
166
- - Use Zod for all data validation
167
- - Follow Tailwind CSS for styling
168
-
169
- 3. **Implementation Process**:
170
- - Create/update domain structures under \`src/domains/[domain]/\`
171
- - Implement components in \`src/domains/[domain]/components/\`
172
- - Add business logic in \`src/domains/[domain]/hooks/\` and \`src/domains/[domain]/services/\`
173
- - Create types in \`src/domains/[domain]/types/\`
174
- - Add tests in \`src/domains/[domain]/__tests__/\`
175
-
176
- 4. **Quality Standards**:
177
- - Ensure 80% test coverage minimum
178
- - Use TypeScript strict mode
179
- - Add proper JSDoc documentation
180
- - Follow atomic commit principles
181
- - No debugging code in commits
182
-
183
- 5. **Documentation**:
184
- - Update \`.melt/memory/context.md\` with implementation details
185
- - Save implementation notes to \`.melt/outputs/implementations/[timestamp].md\`
186
- - Update relevant README files if needed
187
-
188
- 6. **Testing**:
189
- - Write unit tests for all business logic
190
- - Add integration tests for complex workflows
191
- - Ensure all tests pass before completing
192
-
193
- Remember: Focus on clean, maintainable code that follows our established patterns and domain boundaries.`;
194
- }
195
- function getPlanTemplate() {
196
- return `---
197
- description: Create implementation plan following Melt's domain-driven architecture standards
198
- ---
199
-
200
- Create a comprehensive implementation plan for the requested feature. Follow these steps:
201
-
202
- 1. **Analyze Requirements**:
203
- - Read \`.melt/memory/context.md\` for project context and constraints
204
- - Identify the target domain(s) this feature belongs to
205
- - Determine integration points with existing domains
206
-
207
- 2. **Architecture Planning**:
208
- - Design domain structure following our patterns:
209
- \`\`\`
210
- src/domains/[domain]/
211
- ├── components/ # React components
212
- ├── hooks/ # Custom hooks for business logic
213
- ├── services/ # API calls and external integrations
214
- ├── types/ # TypeScript types and Zod schemas
215
- ├── utils/ # Domain-specific utilities
216
- └── __tests__/ # Domain tests
217
- \`\`\`
218
- - Plan component hierarchy and state management
219
- - Design data flow and API integration points
220
-
221
- 3. **Technical Decisions**:
222
- - Choose appropriate React patterns (server vs client components)
223
- - Plan Zod schemas for data validation
224
- - Design TypeScript interfaces and types
225
- - Plan testing strategy (unit, integration, e2e)
226
-
227
- 4. **Implementation Strategy**:
228
- - Break down into atomic, testable units
229
- - Identify dependencies and execution order
230
- - Plan for error handling and edge cases
231
- - Consider accessibility and performance requirements
232
-
233
- 5. **Create Detailed Plan**:
234
- - List specific files to create/modify
235
- - Define component interfaces and props
236
- - Specify API endpoints and data contracts
237
- - Plan test cases and coverage targets
238
-
239
- 6. **Save Planning Output**:
240
- - Save comprehensive plan to \`.melt/outputs/plans/[timestamp]-plan.md\`
241
- - Update \`.melt/memory/context.md\` with planning decisions
242
- - Create task breakdown for implementation
243
-
244
- Focus on maintainable, testable code that follows our domain-driven architecture principles.`;
245
- }
246
- function getReviewTemplate() {
247
- return `---
248
- description: Review code following Melt's quality standards and architecture compliance
249
- ---
250
-
251
- Perform a comprehensive code review following Melt's standards:
252
-
253
- 1. **Architecture Review**:
254
- - Verify domain-driven design compliance
255
- - Check proper separation of concerns
256
- - Validate component placement within domain structure
257
- - Review data flow and state management patterns
258
-
259
- 2. **Code Quality**:
260
- - TypeScript strict mode compliance
261
- - Proper error handling and edge cases
262
- - Performance considerations (memo, useMemo, useCallback)
263
- - Accessibility compliance (ARIA, semantic HTML)
264
-
265
- 3. **Testing Coverage**:
266
- - Unit tests for business logic (80% minimum)
267
- - Integration tests for complex workflows
268
- - Test quality and maintainability
269
- - Mock strategies and test isolation
270
-
271
- 4. **Documentation**:
272
- - JSDoc comments for public APIs
273
- - README updates for new features
274
- - Architecture decision records when applicable
275
- - Code comments for complex business logic
276
-
277
- 5. **Security & Best Practices**:
278
- - Input validation with Zod schemas
279
- - XSS prevention in dynamic content
280
- - Proper authentication/authorization patterns
281
- - Environment variable usage
282
-
283
- 6. **Review Output**:
284
- - Document findings in \`.melt/outputs/reviews/[timestamp]-review.md\`
285
- - Categorize issues by severity (critical, major, minor)
286
- - Provide specific recommendations and examples
287
- - Update \`.melt/memory/context.md\` with lessons learned
288
-
289
- Focus on constructive feedback that improves code quality and team knowledge.`;
290
- }
291
- function getDebugTemplate() {
292
- return `---
293
- description: Debug issues using systematic approach and Melt development patterns
294
- ---
295
-
296
- Debug the issue systematically following our structured approach:
297
-
298
- 1. **Issue Analysis**:
299
- - Document the problem clearly in \`.melt/memory/context.md\`
300
- - Identify affected domains and components
301
- - Gather error messages, stack traces, and reproduction steps
302
- - Check recent changes in \`.melt/outputs/implementations/\`
303
-
304
- 2. **Domain-Specific Debugging**:
305
- - Review component hierarchy and props flow
306
- - Check custom hooks for state management issues
307
- - Validate service layer API calls and data transformation
308
- - Examine TypeScript types and Zod schema validation
309
-
310
- 3. **Tool-Assisted Debugging**:
311
- - Use React DevTools for component inspection
312
- - Leverage TypeScript compiler for type checking
313
- - Check browser console for runtime errors
314
- - Use network tab for API debugging
315
-
316
- 4. **Testing & Validation**:
317
- - Run existing tests to identify regression
318
- - Write minimal reproduction test case
319
- - Check test coverage for the affected area
320
- - Validate fix with comprehensive testing
321
-
322
- 5. **Root Cause Analysis**:
323
- - Document the underlying cause
324
- - Identify if it's architectural, implementation, or configuration
325
- - Check if similar issues exist elsewhere
326
- - Plan preventive measures
327
-
328
- 6. **Resolution Documentation**:
329
- - Save debug session to \`.melt/outputs/implementations/[timestamp]-debug.md\`
330
- - Update context with lessons learned
331
- - Document any architectural improvements needed
332
- - Share findings with team if applicable
333
-
334
- Remember: Focus on understanding the problem deeply before implementing solutions.`;
335
- }
336
- function getInitialContext() {
337
- return `# Project Context
338
-
339
- ## Project Overview
340
- This project uses Melt's development standards with domain-driven architecture.
341
-
342
- ## Architecture Principles
343
- - **Domain-Driven Design**: Code organized by business domains
344
- - **React 2025 Standards**: Functional components, hooks, TypeScript strict
345
- - **Type Safety**: Zod schemas for runtime validation
346
- - **Testing**: 80% coverage minimum with comprehensive test strategies
347
-
348
- ## Development Workflow
349
- 1. **Plan**: Create implementation plans in \`.melt/outputs/plans/\`
350
- 2. **Implement**: Follow domain architecture patterns
351
- 3. **Review**: Ensure quality and compliance
352
- 4. **Debug**: Systematic problem-solving approach
353
-
354
- ## Current Status
355
- - Initialized: ${new Date().toISOString()}
356
- - Last Updated: ${new Date().toISOString()}
357
-
358
- ## Notes
359
- Update this file as the project evolves to maintain context for AI assistants and team members.
360
- `;
361
- }
362
- function getBashCommon() {
363
- return `#!/usr/bin/env bash
364
- # Common utilities for Melt development workflow
365
-
366
- # Get project root directory
367
- get_project_root() {
368
- git rev-parse --show-toplevel 2>/dev/null || pwd
369
- }
370
-
371
- # Get current timestamp for file naming
372
- get_timestamp() {
373
- date '+%Y%m%d-%H%M%S'
374
- }
375
-
376
- # Check if .melt directory exists
377
- check_melt_workspace() {
378
- if [[ ! -d ".melt" ]]; then
379
- echo "ERROR: .melt workspace not found. Run 'meltctl project init' first."
380
- exit 1
381
- fi
382
- }
383
-
384
- # Create output file with timestamp
385
- create_output_file() {
386
- local category="$1"
387
- local name="$2"
388
- local timestamp=$(get_timestamp)
389
- local filename="\${timestamp}-\${name}.md"
390
- local filepath=".melt/outputs/\${category}/\${filename}"
391
-
392
- mkdir -p ".melt/outputs/\${category}"
393
- echo "$filepath"
394
- }
395
-
396
- # Update context file with new information
397
- update_context() {
398
- local message="$1"
399
- local timestamp=$(date -Iseconds)
400
-
401
- echo "## Update: $timestamp" >> .melt/memory/context.md
402
- echo "$message" >> .melt/memory/context.md
403
- echo "" >> .melt/memory/context.md
404
- }
405
-
406
- echo "Melt development utilities loaded."
407
- `;
408
- }
409
- function getPowerShellCommon() {
410
- return `#!/usr/bin/env pwsh
411
- # Common utilities for Melt development workflow
412
-
413
- function Get-ProjectRoot {
414
- try {
415
- git rev-parse --show-toplevel
416
- }
417
- catch {
418
- Get-Location
419
- }
420
- }
421
-
422
- function Get-Timestamp {
423
- Get-Date -Format "yyyyMMdd-HHmmss"
424
- }
425
-
426
- function Test-MeltWorkspace {
427
- if (-not (Test-Path ".melt" -PathType Container)) {
428
- Write-Error "ERROR: .melt workspace not found. Run 'meltctl project init' first."
429
- exit 1
430
- }
431
- }
432
-
433
- function New-OutputFile {
434
- param(
435
- [string]$Category,
436
- [string]$Name
437
- )
438
-
439
- $timestamp = Get-Timestamp
440
- $filename = "$timestamp-$Name.md"
441
- $filepath = ".melt/outputs/$Category/$filename"
442
-
443
- New-Item -Path ".melt/outputs/$Category" -ItemType Directory -Force | Out-Null
444
- return $filepath
445
- }
446
-
447
- function Update-Context {
448
- param([string]$Message)
449
-
450
- $timestamp = Get-Date -Format "yyyy-MM-ddTHH:mm:ssK"
451
-
452
- Add-Content -Path ".melt/memory/context.md" -Value "## Update: $timestamp"
453
- Add-Content -Path ".melt/memory/context.md" -Value $Message
454
- Add-Content -Path ".melt/memory/context.md" -Value ""
455
- }
456
-
457
- Write-Output "Melt development utilities loaded."
458
- `;
459
- }
460
- function getTestPlanTemplate() {
461
- return `---
462
- description: Generate comprehensive test strategy and test files based on implementation plan
463
- ---
464
-
465
- Create a comprehensive testing strategy and generate test files following Melt's testing standards:
466
-
467
- 1. **Load Implementation Context**:
468
- - Read \`.melt/outputs/plans/\` for the current implementation plan
469
- - Review \`.melt/memory/context.md\` for project testing patterns
470
- - Analyze existing test files in \`src/domains/[domain]/__tests__/\`
471
-
472
- 2. **Test Strategy Design**:
473
- - **Unit Tests**: Test individual components, hooks, and utilities
474
- - **Integration Tests**: Test component interactions and data flow
475
- - **API Tests**: Test service layer and external integrations
476
- - **Accessibility Tests**: Ensure WCAG compliance
477
- - **Performance Tests**: Validate rendering and interaction performance
478
-
479
- 3. **Test File Generation**:
480
- - Create test files following domain structure:
481
- \`\`\`
482
- src/domains/[domain]/__tests__/
483
- ├── components/ # Component tests
484
- ├── hooks/ # Hook tests
485
- ├── services/ # Service/API tests
486
- └── utils/ # Utility function tests
487
- \`\`\`
488
- - Use React Testing Library for component tests
489
- - Use @testing-library/react-hooks for hook tests
490
- - Mock external dependencies appropriately
491
-
492
- 4. **Testing Patterns**:
493
- - Follow TDD approach - write tests before implementation
494
- - Test behavior, not implementation details
495
- - Use meaningful test descriptions and organize with describe blocks
496
- - Include edge cases and error scenarios
497
- - Ensure accessibility testing with @testing-library/jest-dom
498
-
499
- 5. **Test Coverage Strategy**:
500
- - Target 80% minimum coverage for new code
501
- - Focus on critical business logic and user flows
502
- - Test error handling and edge cases
503
- - Validate prop types and component contracts
504
-
505
- 6. **Save Test Plan**:
506
- - Document test strategy in \`.melt/outputs/plans/[timestamp]-test-plan.md\`
507
- - Create test files in appropriate domain directories
508
- - Update \`.melt/memory/context.md\` with testing decisions
509
-
510
- Focus on creating comprehensive, maintainable tests that validate both functionality and user experience.`;
511
- }
512
- function getDocsTemplate() {
513
- return `---
514
- description: Update project documentation and README based on implementation changes
515
- ---
516
-
517
- Update project documentation to reflect implementation changes and maintain accuracy:
518
-
519
- 1. **Analyze Changes**:
520
- - Review recent implementation in \`.melt/outputs/implementations/\`
521
- - Check \`.melt/outputs/plans/\` for planned changes
522
- - Identify new features, APIs, or architectural changes
523
- - Review \`.melt/memory/context.md\` for context
524
-
525
- 2. **Documentation Updates**:
526
- - **README.md**: Update installation, usage, and examples
527
- - **API Documentation**: Document new endpoints or changed interfaces
528
- - **Component Documentation**: Add JSDoc comments and usage examples
529
- - **Architecture Docs**: Update domain structure if changed
530
- - **Deployment Docs**: Update if new environment variables or configs added
531
-
532
- 3. **Documentation Patterns**:
533
- - Use clear, concise language focused on developers
534
- - Include code examples for new features
535
- - Document breaking changes and migration steps
536
- - Add troubleshooting sections for common issues
537
- - Include links to relevant domain documentation
538
-
539
- 4. **Code Documentation**:
540
- - Add/update JSDoc comments for public APIs
541
- - Document complex business logic with inline comments
542
- - Update TypeScript interfaces with proper descriptions
543
- - Ensure prop types are documented for components
544
-
545
- 5. **Validation**:
546
- - Verify all links work correctly
547
- - Test code examples to ensure they're accurate
548
- - Check that documentation matches actual implementation
549
- - Ensure consistent formatting and style
550
-
551
- 6. **Save Documentation Updates**:
552
- - Update relevant documentation files
553
- - Save documentation notes to \`.melt/outputs/implementations/[timestamp]-docs.md\`
554
- - Update \`.melt/memory/context.md\` with documentation decisions
555
-
556
- Focus on keeping documentation current, accurate, and developer-focused.`;
557
- }
558
- function getPrTemplate() {
559
- return `---
560
- description: Create comprehensive pull request with proper description and metadata
561
- ---
562
-
563
- Create a detailed pull request following Melt's standards for code review and deployment:
564
-
565
- 1. **Gather Context**:
566
- - Read \`.melt/outputs/plans/\` for implementation plan details
567
- - Review \`.melt/outputs/implementations/\` for implementation notes
568
- - Check \`.melt/memory/context.md\` for project context
569
- - Identify related Linear story and RFC references
570
-
571
- 2. **PR Description Structure**:
572
- - **Summary**: Brief description of what was implemented
573
- - **Changes**: Bulleted list of specific changes made
574
- - **Testing**: How the changes were tested (unit, integration, manual)
575
- - **Screenshots**: For UI changes, include before/after images
576
- - **Linear Story**: Link to Linear story and requirements
577
- - **RFC Reference**: Link to relevant RFC section if applicable
578
-
579
- 3. **PR Metadata**:
580
- - Add appropriate labels (feature, bugfix, docs, etc.)
581
- - Assign reviewers based on affected domains
582
- - Set milestone if applicable
583
- - Link to related issues or PRs
584
-
585
- 4. **Code Review Preparation**:
586
- - Ensure all tests pass
587
- - Run linting and type checking
588
- - Verify accessibility compliance
589
- - Check performance impact
590
- - Validate security considerations
591
-
592
- 5. **Deployment Readiness**:
593
- - Document any environment variable changes
594
- - Note database migration requirements
595
- - Include feature flag configurations
596
- - Specify rollback procedures if needed
597
-
598
- 6. **Quality Checklist**:
599
- - [ ] Code follows domain architecture patterns
600
- - [ ] Tests have adequate coverage (80%+)
601
- - [ ] Documentation updated
602
- - [ ] No debugging code committed
603
- - [ ] TypeScript strict mode compliance
604
- - [ ] Performance considerations addressed
605
-
606
- 7. **Save PR Information**:
607
- - Create PR with comprehensive description
608
- - Save PR details to \`.melt/outputs/implementations/[timestamp]-pr.md\`
609
- - Update \`.melt/memory/context.md\` with PR status
610
-
611
- Focus on clear communication and thorough preparation for efficient code review.`;
612
- }
613
- function getCompleteTemplate() {
614
- return `---
615
- description: Complete story implementation, handle deployment, and update Linear status
616
- ---
617
-
618
- Complete the story implementation and handle all post-development tasks:
619
-
620
- 1. **Verify Completion**:
621
- - Read \`.melt/outputs/plans/\` to check all planned tasks completed
622
- - Review \`.melt/outputs/implementations/\` for implementation status
623
- - Ensure all tests pass and coverage targets met
624
- - Verify documentation is updated and accurate
625
-
626
- 2. **Linear Story Update**:
627
- - Update Linear story status to "Ready for Review" or "Complete"
628
- - Add implementation notes and links to PR
629
- - Update story with actual effort vs. estimated effort
630
- - Link any follow-up stories or technical debt identified
631
-
632
- 3. **Deployment Process**:
633
- - Verify PR is approved and merged
634
- - Monitor deployment pipeline for success
635
- - Validate feature works in staging/production
636
- - Check monitoring and logging for any issues
637
-
638
- 4. **Feature Validation**:
639
- - Test feature functionality end-to-end
640
- - Verify acceptance criteria are fully met
641
- - Check performance metrics if applicable
642
- - Validate accessibility compliance
643
-
644
- 5. **Documentation & Handoff**:
645
- - Ensure user-facing documentation is updated
646
- - Share feature with stakeholders if needed
647
- - Document any lessons learned or technical debt
648
- - Update architectural decision records if applicable
649
-
650
- 6. **Cleanup Tasks**:
651
- - Remove feature flags if no longer needed
652
- - Archive implementation planning materials
653
- - Update project roadmap or backlog
654
- - Share knowledge with team members
655
-
656
- 7. **Post-Completion Analysis**:
657
- - Document actual vs. estimated effort
658
- - Note any process improvements identified
659
- - Record architectural patterns that worked well
660
- - Identify any technical debt for future sprints
661
-
662
- 8. **Save Completion Records**:
663
- - Update Linear story with final status and notes
664
- - Save completion summary to \`.melt/outputs/implementations/[timestamp]-complete.md\`
665
- - Update \`.melt/memory/context.md\` with completion details
666
- - Archive relevant planning and implementation files
667
-
668
- Focus on thorough validation and knowledge capture for continuous improvement.`;
158
+ fs.writeFileSync(versionPath, JSON.stringify(versionData, null, 2), 'utf8');
669
159
  }
package/dist/index.js CHANGED
@@ -21,7 +21,15 @@ const projectCommand = program
21
21
  projectCommand
22
22
  .command('init')
23
23
  .description('Initialize project with Melt development tools')
24
- .action(initCommand);
24
+ .option('--shell <type>', 'specify shell type (sh|ps)', 'auto')
25
+ .action(options => {
26
+ // Validate shell option
27
+ const validShells = ['sh', 'ps', 'auto'];
28
+ const shell = validShells.includes(options.shell)
29
+ ? options.shell
30
+ : 'auto';
31
+ return initCommand({ shell });
32
+ });
25
33
  projectCommand
26
34
  .command('update')
27
35
  .description('Update project configurations to latest version')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meltstudio/meltctl",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "CLI tool for Melt development process automation - initialize and update project configurations",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "scripts": {
21
21
  "build": "tsc",
22
- "dev": "tsx watch src/index.ts",
22
+ "dev": "tsx src/index.ts",
23
23
  "start": "node dist/index.js",
24
24
  "clean": "rm -rf dist",
25
25
  "lint": "eslint src/**/*.ts",
@@ -0,0 +1,55 @@
1
+ ---
2
+ description: Complete story implementation, handle deployment, and update Linear status
3
+ ---
4
+
5
+ Complete the story implementation and handle all post-development tasks:
6
+
7
+ 1. **Verify Completion**:
8
+ - Read `.melt/outputs/plans/` to check all planned tasks completed
9
+ - Review `.melt/outputs/implementations/` for implementation status
10
+ - Ensure all tests pass and coverage targets met
11
+ - Verify documentation is updated and accurate
12
+
13
+ 2. **Linear Story Update**:
14
+ - Update Linear story status to "Ready for Review" or "Complete"
15
+ - Add implementation notes and links to PR
16
+ - Update story with actual effort vs. estimated effort
17
+ - Link any follow-up stories or technical debt identified
18
+
19
+ 3. **Deployment Process**:
20
+ - Verify PR is approved and merged
21
+ - Monitor deployment pipeline for success
22
+ - Validate feature works in staging/production
23
+ - Check monitoring and logging for any issues
24
+
25
+ 4. **Feature Validation**:
26
+ - Test feature functionality end-to-end
27
+ - Verify acceptance criteria are fully met
28
+ - Check performance metrics if applicable
29
+ - Validate accessibility compliance
30
+
31
+ 5. **Documentation & Handoff**:
32
+ - Ensure user-facing documentation is updated
33
+ - Share feature with stakeholders if needed
34
+ - Document any lessons learned or technical debt
35
+ - Update architectural decision records if applicable
36
+
37
+ 6. **Cleanup Tasks**:
38
+ - Remove feature flags if no longer needed
39
+ - Archive implementation planning materials
40
+ - Update project roadmap or backlog
41
+ - Share knowledge with team members
42
+
43
+ 7. **Post-Completion Analysis**:
44
+ - Document actual vs. estimated effort
45
+ - Note any process improvements identified
46
+ - Record architectural patterns that worked well
47
+ - Identify any technical debt for future sprints
48
+
49
+ 8. **Save Completion Records**:
50
+ - Update Linear story with final status and notes
51
+ - Save completion summary to `.melt/outputs/implementations/[timestamp]-complete.md`
52
+ - Update `.melt/memory/context.md` with completion details
53
+ - Archive relevant planning and implementation files
54
+
55
+ Focus on thorough validation and knowledge capture for continuous improvement.
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: Update project documentation and README based on implementation changes
3
+ ---
4
+
5
+ Update project documentation to reflect implementation changes and maintain accuracy:
6
+
7
+ 1. **Analyze Changes**:
8
+ - Review recent implementation in `.melt/outputs/implementations/`
9
+ - Check `.melt/outputs/plans/` for planned changes
10
+ - Identify new features, APIs, or architectural changes
11
+ - Review `.melt/memory/context.md` for context
12
+
13
+ 2. **Documentation Updates**:
14
+ - **README.md**: Update installation, usage, and examples
15
+ - **API Documentation**: Document new endpoints or changed interfaces
16
+ - **Component Documentation**: Add JSDoc comments and usage examples
17
+ - **Architecture Docs**: Update domain structure if changed
18
+ - **Deployment Docs**: Update if new environment variables or configs added
19
+
20
+ 3. **Documentation Patterns**:
21
+ - Use clear, concise language focused on developers
22
+ - Include code examples for new features
23
+ - Document breaking changes and migration steps
24
+ - Add troubleshooting sections for common issues
25
+ - Include links to relevant domain documentation
26
+
27
+ 4. **Code Documentation**:
28
+ - Add/update JSDoc comments for public APIs
29
+ - Document complex business logic with inline comments
30
+ - Update TypeScript interfaces with proper descriptions
31
+ - Ensure prop types are documented for components
32
+
33
+ 5. **Validation**:
34
+ - Verify all links work correctly
35
+ - Test code examples to ensure they're accurate
36
+ - Check that documentation matches actual implementation
37
+ - Ensure consistent formatting and style
38
+
39
+ 6. **Save Documentation Updates**:
40
+ - Update relevant documentation files
41
+ - Save documentation notes to `.melt/outputs/implementations/[timestamp]-docs.md`
42
+ - Update `.melt/memory/context.md` with documentation decisions
43
+
44
+ Focus on keeping documentation current, accurate, and developer-focused.
@@ -0,0 +1,53 @@
1
+ ---
2
+ description: Create comprehensive pull request with proper description and metadata
3
+ ---
4
+
5
+ Create a detailed pull request following Melt's standards for code review and deployment:
6
+
7
+ 1. **Gather Context**:
8
+ - Read `.melt/outputs/plans/` for implementation plan details
9
+ - Review `.melt/outputs/implementations/` for implementation notes
10
+ - Check `.melt/memory/context.md` for project context
11
+ - Identify related Linear story and RFC references
12
+
13
+ 2. **PR Description Structure**:
14
+ - **Summary**: Brief description of what was implemented
15
+ - **Changes**: Bulleted list of specific changes made
16
+ - **Testing**: How the changes were tested (unit, integration, manual)
17
+ - **Screenshots**: For UI changes, include before/after images
18
+ - **Linear Story**: Link to Linear story and requirements
19
+ - **RFC Reference**: Link to relevant RFC section if applicable
20
+
21
+ 3. **PR Metadata**:
22
+ - Add appropriate labels (feature, bugfix, docs, etc.)
23
+ - Assign reviewers based on affected domains
24
+ - Set milestone if applicable
25
+ - Link to related issues or PRs
26
+
27
+ 4. **Code Review Preparation**:
28
+ - Ensure all tests pass
29
+ - Run linting and type checking
30
+ - Verify accessibility compliance
31
+ - Check performance impact
32
+ - Validate security considerations
33
+
34
+ 5. **Deployment Readiness**:
35
+ - Document any environment variable changes
36
+ - Note database migration requirements
37
+ - Include feature flag configurations
38
+ - Specify rollback procedures if needed
39
+
40
+ 6. **Quality Checklist**:
41
+ - [ ] Code follows domain architecture patterns
42
+ - [ ] Tests have adequate coverage (80%+)
43
+ - [ ] Documentation updated
44
+ - [ ] No debugging code committed
45
+ - [ ] TypeScript strict mode compliance
46
+ - [ ] Performance considerations addressed
47
+
48
+ 7. **Save PR Information**:
49
+ - Create PR with comprehensive description
50
+ - Save PR details to `.melt/outputs/implementations/[timestamp]-pr.md`
51
+ - Update `.melt/memory/context.md` with PR status
52
+
53
+ Focus on clear communication and thorough preparation for efficient code review.
@@ -0,0 +1,50 @@
1
+ ---
2
+ description: Generate comprehensive test strategy and test files based on implementation plan
3
+ ---
4
+
5
+ Create a comprehensive testing strategy and generate test files following Melt's testing standards:
6
+
7
+ 1. **Load Implementation Context**:
8
+ - Read `.melt/outputs/plans/` for the current implementation plan
9
+ - Review `.melt/memory/context.md` for project testing patterns
10
+ - Analyze existing test files in `src/domains/[domain]/__tests__/`
11
+
12
+ 2. **Test Strategy Design**:
13
+ - **Unit Tests**: Test individual components, hooks, and utilities
14
+ - **Integration Tests**: Test component interactions and data flow
15
+ - **API Tests**: Test service layer and external integrations
16
+ - **Accessibility Tests**: Ensure WCAG compliance
17
+ - **Performance Tests**: Validate rendering and interaction performance
18
+
19
+ 3. **Test File Generation**:
20
+ - Create test files following domain structure:
21
+ ```
22
+ src/domains/[domain]/__tests__/
23
+ ├── components/ # Component tests
24
+ ├── hooks/ # Hook tests
25
+ ├── services/ # Service/API tests
26
+ └── utils/ # Utility function tests
27
+ ```
28
+ - Use React Testing Library for component tests
29
+ - Use @testing-library/react-hooks for hook tests
30
+ - Mock external dependencies appropriately
31
+
32
+ 4. **Testing Patterns**:
33
+ - Follow TDD approach - write tests before implementation
34
+ - Test behavior, not implementation details
35
+ - Use meaningful test descriptions and organize with describe blocks
36
+ - Include edge cases and error scenarios
37
+ - Ensure accessibility testing with @testing-library/jest-dom
38
+
39
+ 5. **Test Coverage Strategy**:
40
+ - Target 80% minimum coverage for new code
41
+ - Focus on critical business logic and user flows
42
+ - Test error handling and edge cases
43
+ - Validate prop types and component contracts
44
+
45
+ 6. **Save Test Plan**:
46
+ - Document test strategy in `.melt/outputs/plans/[timestamp]-test-plan.md`
47
+ - Create test files in appropriate domain directories
48
+ - Update `.melt/memory/context.md` with testing decisions
49
+
50
+ Focus on creating comprehensive, maintainable tests that validate both functionality and user experience.
@@ -0,0 +1,23 @@
1
+ # Project Context
2
+
3
+ ## Project Overview
4
+ This project uses Melt's development standards with domain-driven architecture.
5
+
6
+ ## Architecture Principles
7
+ - **Domain-Driven Design**: Code organized by business domains
8
+ - **React 2025 Standards**: Functional components, hooks, TypeScript strict
9
+ - **Type Safety**: Zod schemas for runtime validation
10
+ - **Testing**: 80% coverage minimum with comprehensive test strategies
11
+
12
+ ## Development Workflow
13
+ 1. **Plan**: Create implementation plans in `.melt/outputs/plans/`
14
+ 2. **Implement**: Follow domain architecture patterns
15
+ 3. **Review**: Ensure quality and compliance
16
+ 4. **Debug**: Systematic problem-solving approach
17
+
18
+ ## Current Status
19
+ - Initialized: {{timestamp}}
20
+ - Last Updated: {{timestamp}}
21
+
22
+ ## Notes
23
+ Update this file as the project evolves to maintain context for AI assistants and team members.
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env pwsh
2
+ # Common utilities for Melt development workflow
3
+
4
+ function Get-ProjectRoot {
5
+ try {
6
+ git rev-parse --show-toplevel
7
+ }
8
+ catch {
9
+ Get-Location
10
+ }
11
+ }
12
+
13
+ function Get-Timestamp {
14
+ Get-Date -Format "yyyyMMdd-HHmmss"
15
+ }
16
+
17
+ function Test-MeltWorkspace {
18
+ if (-not (Test-Path ".melt" -PathType Container)) {
19
+ Write-Error "ERROR: .melt workspace not found. Run 'meltctl project init' first."
20
+ exit 1
21
+ }
22
+ }
23
+
24
+ function New-OutputFile {
25
+ param(
26
+ [string]$Category,
27
+ [string]$Name
28
+ )
29
+
30
+ $timestamp = Get-Timestamp
31
+ $filename = "$timestamp-$Name.md"
32
+ $filepath = ".melt/outputs/$Category/$filename"
33
+
34
+ New-Item -Path ".melt/outputs/$Category" -ItemType Directory -Force | Out-Null
35
+ return $filepath
36
+ }
37
+
38
+ function Update-Context {
39
+ param([string]$Message)
40
+
41
+ $timestamp = Get-Date -Format "yyyy-MM-ddTHH:mm:ssK"
42
+
43
+ Add-Content -Path ".melt/memory/context.md" -Value "## Update: $timestamp"
44
+ Add-Content -Path ".melt/memory/context.md" -Value $Message
45
+ Add-Content -Path ".melt/memory/context.md" -Value ""
46
+ }
47
+
48
+ Write-Output "Melt development utilities loaded."
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # Common utilities for Melt development workflow
3
+
4
+ # Get project root directory
5
+ get_project_root() {
6
+ git rev-parse --show-toplevel 2>/dev/null || pwd
7
+ }
8
+
9
+ # Get current timestamp for file naming
10
+ get_timestamp() {
11
+ date '+%Y%m%d-%H%M%S'
12
+ }
13
+
14
+ # Check if .melt directory exists
15
+ check_melt_workspace() {
16
+ if [[ ! -d ".melt" ]]; then
17
+ echo "ERROR: .melt workspace not found. Run 'meltctl project init' first."
18
+ exit 1
19
+ fi
20
+ }
21
+
22
+ # Create output file with timestamp
23
+ create_output_file() {
24
+ local category="$1"
25
+ local name="$2"
26
+ local timestamp=$(get_timestamp)
27
+ local filename="${timestamp}-${name}.md"
28
+ local filepath=".melt/outputs/${category}/${filename}"
29
+
30
+ mkdir -p ".melt/outputs/${category}"
31
+ echo "$filepath"
32
+ }
33
+
34
+ # Update context file with new information
35
+ update_context() {
36
+ local message="$1"
37
+ local timestamp=$(date -Iseconds)
38
+
39
+ echo "## Update: $timestamp" >> .melt/memory/context.md
40
+ echo "$message" >> .melt/memory/context.md
41
+ echo "" >> .melt/memory/context.md
42
+ }
43
+
44
+ echo "Melt development utilities loaded."
@@ -1,49 +0,0 @@
1
- ---
2
- description: Create implementation plan following Melt's domain-driven architecture standards
3
- ---
4
-
5
- Create a comprehensive implementation plan for the requested feature. Follow these steps:
6
-
7
- 1. **Analyze Requirements**:
8
- - Read `.melt/memory/context.md` for project context and constraints
9
- - Identify the target domain(s) this feature belongs to
10
- - Determine integration points with existing domains
11
-
12
- 2. **Architecture Planning**:
13
- - Design domain structure following our patterns:
14
- ```
15
- src/domains/[domain]/
16
- ├── components/ # React components
17
- ├── hooks/ # Custom hooks for business logic
18
- ├── services/ # API calls and external integrations
19
- ├── types/ # TypeScript types and Zod schemas
20
- ├── utils/ # Domain-specific utilities
21
- └── __tests__/ # Domain tests
22
- ```
23
- - Plan component hierarchy and state management
24
- - Design data flow and API integration points
25
-
26
- 3. **Technical Decisions**:
27
- - Choose appropriate React patterns (server vs client components)
28
- - Plan Zod schemas for data validation
29
- - Design TypeScript interfaces and types
30
- - Plan testing strategy (unit, integration, e2e)
31
-
32
- 4. **Implementation Strategy**:
33
- - Break down into atomic, testable units
34
- - Identify dependencies and execution order
35
- - Plan for error handling and edge cases
36
- - Consider accessibility and performance requirements
37
-
38
- 5. **Create Detailed Plan**:
39
- - List specific files to create/modify
40
- - Define component interfaces and props
41
- - Specify API endpoints and data contracts
42
- - Plan test cases and coverage targets
43
-
44
- 6. **Save Planning Output**:
45
- - Save comprehensive plan to `.melt/outputs/plans/[timestamp]-plan.md`
46
- - Update `.melt/memory/context.md` with planning decisions
47
- - Create task breakdown for implementation
48
-
49
- Focus on maintainable, testable code that follows our domain-driven architecture principles.