Skip to content

Feature/dependency validation#53

Merged
YagoBorba merged 4 commits into
developfrom
feature/dependency-validation
Sep 11, 2025
Merged

Feature/dependency validation#53
YagoBorba merged 4 commits into
developfrom
feature/dependency-validation

Conversation

@YagoBorba

Copy link
Copy Markdown
Owner

📋 Description

This PR implements a comprehensive dependency validation system for StackCode that prevents crashes when required tools are missing during project initialization. The system validates dependencies before attempting installation, provides clear installation guidance, and allows graceful continuation when tools are unavailable.

🔗 Related Issue

Fixes #(issue) - ENOENT spawn errors when running npx stc init for Go, PHP, React/Vue.js stacks

🧪 Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 📝 Documentation update
  • 🧹 Code cleanup

📝 How Has This Been Tested?

  • Unit tests pass
  • Manual testing completed - tested with missing Go, PHP, and Maven tools
  • CI/CD pipeline passes
  • Tested dependency validation for all supported stacks
  • Verified graceful handling when tools are missing

📷 Screenshots (if applicable)

N/A - CLI tool with terminal output

✅ Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

🔄 Dependencies

No new external dependencies added. Uses existing Node.js built-in modules.

📚 Additional Notes

Key Features Implemented:

  • 🔍 Dependency Validation System: Pre-validates required tools before installation
  • 🛠️ Cross-platform Support: Uses which/where commands for tool detection
  • 📖 Installation Guidance: Provides localized installation instructions
  • 🌐 Multi-language Support: Added validation messages in English and Portuguese
  • Graceful Handling: Allows project creation even with missing optional tools
  • 📚 Comprehensive Documentation: Updated all relevant docs with validation workflow

Technical Implementation:

  • Added isCommandAvailable(), getStackDependencies(), and validateStackDependencies() functions
  • Integrated validation into CLI init command with user-friendly prompts
  • Added comprehensive JSDoc documentation across the codebase
  • Updated architecture and contributing documentation

Stack Support:

  • Go (go command)
  • PHP (composer, php commands)
  • Java (mvn, java commands)
  • Python (pip, python commands)
  • Node.js ecosystems (npm command)

The system now provides intelligent dependency validation that enhances user experience and prevents crashes during project initialization.

- Implement isCommandAvailable function to check if commands are in PATH
- Add getStackDependencies mapping for each stack
- Create validateStackDependencies for complete validation
- Integrate validation in init command before dependency installation
- Add i18n messages for warnings and installation instructions
- Handle errors gracefully when dependencies are missing
- Allow user to continue even without installed dependencies

Fixes crashes with 'spawn ENOENT' when tools like go, composer, mvn were not installed.
- Add comprehensive dependency validation section to ARCHITECTURE.md
- Update STACKS.md with validation overview and dependency table
- Enhance CONTRIBUTING.md with validation requirements for new stacks
- Update README.md to highlight intelligent dependency validation
- Add API documentation for new validation functions in core README
- Update Portuguese documentation (pt-BR/STACKS.md)
- Include validation workflow diagrams and examples

Documents the new system that validates required tools before project creation,
provides installation guidance, and allows graceful continuation when dependencies are missing.
- Add JSDoc documentation to core utility functions in packages/core/src/utils.ts
- Add class and method docstrings to CLI commands in packages/cli/src/commands/init.ts
- Add comprehensive documentation to VSCode extension commands and providers
- Add docstrings to GitMonitor class for repository detection and Git workflow
- Add documentation to DashboardProvider for webview interface management
- Standardize documentation format using English JSDoc conventions
- Improve code maintainability and developer experience with clear API documentation

Enhances codebase professionalism with comprehensive inline documentation
that explains the purpose and usage of key functions and classes.
- Add validateStackDependencies mock to CLI init test suite
- Configure mock to return valid dependencies state for test scenarios
- Fix failing test that was missing the new validation function
- Apply code formatting with Prettier on Portuguese documentation

Ensures all tests pass and maintains code quality standards.
@YagoBorba YagoBorba merged commit fcdf48f into develop Sep 11, 2025
4 checks passed
@YagoBorba YagoBorba deleted the feature/dependency-validation branch September 11, 2025 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant