Initial commit
This commit is contained in:
496
skills/claude-code-marketplace/README.md
Normal file
496
skills/claude-code-marketplace/README.md
Normal file
@@ -0,0 +1,496 @@
|
||||
# Marketplace Management Skill
|
||||
|
||||
> **Comprehensive solution for creating, managing, and maintaining Claude Code Marketplaces**
|
||||
|
||||
## Overview
|
||||
|
||||
The Marketplace skill provides complete lifecycle management for Claude Code Marketplaces, enabling you to create, validate, deploy, and maintain marketplaces with plugins and skills.
|
||||
|
||||
## Features
|
||||
|
||||
### 🏗️ Marketplace Creation
|
||||
|
||||
- Create marketplaces from multiple templates (standard, enterprise, community, minimal)
|
||||
- Automatic directory structure generation
|
||||
- Configuration file creation with validation
|
||||
- Git repository initialization
|
||||
- Template-based file generation
|
||||
|
||||
### ✅ Validation and Testing
|
||||
|
||||
- Comprehensive marketplace structure validation
|
||||
- Plugin and skill compatibility checking
|
||||
- Configuration file validation
|
||||
- Dependency analysis
|
||||
- Security and compliance validation
|
||||
|
||||
### 🚀 Deployment and Distribution
|
||||
|
||||
- Automated deployment workflows
|
||||
- Version management and tagging
|
||||
- Release note generation
|
||||
- Git integration and push operations
|
||||
- Multiple deployment targets support
|
||||
|
||||
### 📊 Health Monitoring
|
||||
|
||||
- Marketplace health analysis
|
||||
- Performance metrics collection
|
||||
- Recommendation generation
|
||||
- Structure and configuration scoring
|
||||
- Plugin and skill usage analytics
|
||||
|
||||
### 🛠️ Management Tools
|
||||
|
||||
- Plugin addition and removal
|
||||
- Skill management and organization
|
||||
- Configuration updates
|
||||
- Batch operations support
|
||||
- Debug and troubleshooting tools
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Basic Marketplace Creation
|
||||
|
||||
```bash
|
||||
"Create a new marketplace called my-awesome-marketplace"
|
||||
```
|
||||
|
||||
### 2. Advanced Creation with Options
|
||||
|
||||
```bash
|
||||
"Create an enterprise marketplace at ./enterprise-marketplace with enterprise template and verbose output"
|
||||
```
|
||||
|
||||
### 3. Validation
|
||||
|
||||
```bash
|
||||
"Validate the marketplace at ./my-marketplace with verbose output"
|
||||
```
|
||||
|
||||
### 4. Deployment
|
||||
|
||||
```bash
|
||||
"Deploy plugins from marketplace ./my-marketplace to production environment"
|
||||
```
|
||||
|
||||
### 5. Health Analysis
|
||||
|
||||
```bash
|
||||
"Analyze marketplace health for ./my-marketplace and generate recommendations"
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
marketplace/
|
||||
├── SKILL.md # Main skill definition
|
||||
├── README.md # This file
|
||||
├── scripts/ # Helper scripts
|
||||
│ ├── marketplace-manager.js # Main management script
|
||||
│ └── ...
|
||||
├── templates/ # Marketplace templates
|
||||
│ ├── standard/ # Standard template
|
||||
│ ├── enterprise/ # Enterprise template
|
||||
│ ├── community/ # Community template
|
||||
│ └── minimal/ # Minimal template
|
||||
├── tests/ # Test suite
|
||||
│ └── marketplace.test.js
|
||||
├── examples/ # Usage examples
|
||||
└── docs/ # Additional documentation
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### Creating Marketplaces
|
||||
|
||||
#### Standard Marketplace
|
||||
|
||||
```bash
|
||||
"Create a standard marketplace called dev-tools"
|
||||
```
|
||||
|
||||
#### Enterprise Marketplace
|
||||
|
||||
```bash
|
||||
"Create an enterprise marketplace at ./company-marketplace with enterprise template and auto-validation"
|
||||
```
|
||||
|
||||
#### Community Marketplace
|
||||
|
||||
```bash
|
||||
"Create a community marketplace called open-source-tools with community template"
|
||||
```
|
||||
|
||||
### Managing Marketplaces
|
||||
|
||||
#### Validation
|
||||
|
||||
```bash
|
||||
"Validate marketplace structure and configuration at ./my-marketplace"
|
||||
```
|
||||
|
||||
#### Health Analysis
|
||||
|
||||
```bash
|
||||
"Analyze marketplace health and generate improvement recommendations for ./my-marketplace"
|
||||
```
|
||||
|
||||
#### Plugin Management
|
||||
|
||||
```bash
|
||||
"Add new plugin to marketplace ./my-marketplace and validate compatibility"
|
||||
```
|
||||
|
||||
### Deployment Operations
|
||||
|
||||
#### Standard Deployment
|
||||
|
||||
```bash
|
||||
"Deploy marketplace ./my-marketplace with patch version update"
|
||||
```
|
||||
|
||||
#### Major Release
|
||||
|
||||
```bash
|
||||
"Deploy marketplace ./my-marketplace with major version update and skip validation"
|
||||
```
|
||||
|
||||
#### Dry Run Deployment
|
||||
|
||||
```bash
|
||||
"Deploy marketplace ./my-marketplace with dry-run mode to preview changes"
|
||||
```
|
||||
|
||||
## Template Types
|
||||
|
||||
### Standard Template
|
||||
|
||||
- Complete marketplace structure
|
||||
- Essential configuration files
|
||||
- Standard validation rules
|
||||
- Community-friendly setup
|
||||
|
||||
**Use Case**: General purpose marketplaces with standard features
|
||||
|
||||
### Enterprise Template
|
||||
|
||||
- Advanced security configurations
|
||||
- Compliance frameworks (SOC2, ISO27001)
|
||||
- Multi-team support
|
||||
- Advanced monitoring and analytics
|
||||
|
||||
**Use Case**: Corporate environments with strict security and compliance requirements
|
||||
|
||||
### Community Template
|
||||
|
||||
- Open-source friendly configurations
|
||||
- Community contribution guidelines
|
||||
- Simplified validation rules
|
||||
- Public distribution setup
|
||||
|
||||
**Use Case**: Open-source projects and community-driven marketplaces
|
||||
|
||||
### Minimal Template
|
||||
|
||||
- Core marketplace structure only
|
||||
- Essential configuration files
|
||||
- Basic validation
|
||||
- Lightweight setup
|
||||
|
||||
**Use Case**: Simple marketplaces with minimal requirements
|
||||
|
||||
## Configuration
|
||||
|
||||
### Skill Parameters
|
||||
|
||||
The marketplace skill accepts the following parameters:
|
||||
|
||||
#### Required Parameters
|
||||
|
||||
- **action**: The action to perform (create, validate, deploy, update, analyze, init, template, test, list, status)
|
||||
- **target**: Target marketplace, plugin, or directory path (optional for some actions)
|
||||
|
||||
#### Optional Parameters
|
||||
|
||||
- **options**: Configuration object with the following properties:
|
||||
- **verbose** (boolean): Enable verbose output (default: false)
|
||||
- **dry_run** (boolean): Perform actions without making changes (default: false)
|
||||
- **template** (string): Template type (standard, enterprise, community, minimal)
|
||||
- **auto_validate** (boolean): Automatically validate after creation (default: true)
|
||||
- **skip_tests** (boolean): Skip test execution (default: false)
|
||||
- **force** (boolean): Force action even if validation fails (default: false)
|
||||
|
||||
### Example Configurations
|
||||
|
||||
#### Basic Creation
|
||||
|
||||
```bash
|
||||
"Create marketplace my-tools with standard template"
|
||||
```
|
||||
|
||||
#### Advanced Configuration
|
||||
|
||||
```bash
|
||||
"Create enterprise marketplace ./company-tools with enterprise template, verbose output, and auto-validation enabled"
|
||||
```
|
||||
|
||||
#### Testing and Validation
|
||||
|
||||
```bash
|
||||
"Test marketplace ./my-marketplace with comprehensive validation and skip tests if needed"
|
||||
```
|
||||
|
||||
## Development and Testing
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
cd marketplace/tests
|
||||
node marketplace.test.js
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
|
||||
The test suite covers:
|
||||
|
||||
- Marketplace creation and structure validation
|
||||
- Template functionality and configuration
|
||||
- Validation framework and error handling
|
||||
- Health analysis and metrics generation
|
||||
- Deployment workflows and version management
|
||||
|
||||
### Development Scripts
|
||||
|
||||
#### Marketplace Manager
|
||||
|
||||
```bash
|
||||
cd marketplace/scripts
|
||||
node marketplace-manager.js create test-marketplace
|
||||
node marketplace-manager.js validate ./test-marketplace
|
||||
node marketplace-manager.js analyze ./test-marketplace
|
||||
```
|
||||
|
||||
#### Validation Script
|
||||
|
||||
```bash
|
||||
cd marketplace/templates/standard/scripts
|
||||
node validate.js --verbose
|
||||
```
|
||||
|
||||
#### Deployment Script
|
||||
|
||||
```bash
|
||||
cd marketplace/templates/standard/scripts
|
||||
node deploy.js --type=patch --verbose
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Main Actions
|
||||
|
||||
#### Create
|
||||
|
||||
Creates a new marketplace from a template.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- **name**: Marketplace name (required for create action)
|
||||
- **template**: Template type (default: standard)
|
||||
- **path**: Target directory (default: ./name)
|
||||
- **auto_validate**: Validate after creation (default: true)
|
||||
|
||||
**Example**:
|
||||
|
||||
```bash
|
||||
"Create marketplace my-tools with standard template at ./my-tools"
|
||||
```
|
||||
|
||||
#### Validate
|
||||
|
||||
Validates marketplace structure and configuration.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- **target**: Marketplace path (required)
|
||||
- **verbose**: Enable detailed output
|
||||
|
||||
**Example**:
|
||||
|
||||
```bash
|
||||
"Validate marketplace at ./my-tools with verbose output"
|
||||
```
|
||||
|
||||
#### Deploy
|
||||
|
||||
Deploys marketplace plugins and updates.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- **target**: Marketplace path (required)
|
||||
- **type**: Release type (patch, minor, major)
|
||||
- **skip_validation**: Skip pre-deployment validation
|
||||
- **force**: Force deployment despite validation failures
|
||||
|
||||
**Example**:
|
||||
|
||||
```bash
|
||||
"Deploy marketplace ./my-tools with minor version update"
|
||||
```
|
||||
|
||||
#### Analyze
|
||||
|
||||
Analyzes marketplace health and generates recommendations.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- **target**: Marketplace path (required)
|
||||
|
||||
**Example**:
|
||||
|
||||
```bash
|
||||
"Analyze marketplace health for ./my-tools and generate recommendations"
|
||||
```
|
||||
|
||||
### Supporting Actions
|
||||
|
||||
#### List
|
||||
|
||||
Lists marketplace contents and status.
|
||||
|
||||
#### Status
|
||||
|
||||
Shows marketplace status and metrics.
|
||||
|
||||
#### Test
|
||||
|
||||
Runs marketplace test suite.
|
||||
|
||||
#### Template
|
||||
|
||||
Generates template files and configurations.
|
||||
|
||||
## Integration with Claude Code
|
||||
|
||||
### Installation
|
||||
|
||||
1. Copy the marketplace skill to your skills directory:
|
||||
|
||||
```bash
|
||||
cp -r marketplace ~/.claude/skills/
|
||||
```
|
||||
|
||||
2. Restart Claude Code to load the skill
|
||||
|
||||
3. The skill will be automatically available when relevant tasks are detected
|
||||
|
||||
### Usage Patterns
|
||||
|
||||
The marketplace skill automatically triggers when you use phrases like:
|
||||
|
||||
- "Create a marketplace"
|
||||
- "Validate marketplace"
|
||||
- "Deploy marketplace"
|
||||
- "Analyze marketplace health"
|
||||
- "Generate marketplace template"
|
||||
|
||||
### Configuration
|
||||
|
||||
Skill behavior can be configured through:
|
||||
|
||||
- Direct parameters in your requests
|
||||
- Default options in the skill configuration
|
||||
- Environment variables for automated workflows
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
#### Marketplace Creation Fails
|
||||
|
||||
```bash
|
||||
"Create marketplace with verbose output to see detailed error information"
|
||||
```
|
||||
|
||||
#### Validation Errors
|
||||
|
||||
```bash
|
||||
"Validate marketplace with comprehensive checks and review error messages"
|
||||
```
|
||||
|
||||
#### Deployment Issues
|
||||
|
||||
```bash
|
||||
"Deploy marketplace with dry-run mode to preview changes before deployment"
|
||||
```
|
||||
|
||||
### Debug Mode
|
||||
|
||||
Enable verbose output for detailed troubleshooting:
|
||||
|
||||
```bash
|
||||
"Create marketplace with verbose output and detailed logging"
|
||||
```
|
||||
|
||||
### Getting Help
|
||||
|
||||
1. **Check Examples**: Review the examples directory for usage patterns
|
||||
2. **Run Tests**: Execute the test suite to verify functionality
|
||||
3. **Review Documentation**: Check individual template documentation
|
||||
4. **Enable Debug Mode**: Use verbose output for detailed information
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Development
|
||||
|
||||
- Use appropriate templates for different use cases
|
||||
- Validate marketplaces before deployment
|
||||
- Test thoroughly across different environments
|
||||
- Keep documentation up to date
|
||||
|
||||
### Security
|
||||
|
||||
- Review permissions and access controls
|
||||
- Validate plugin sources and dependencies
|
||||
- Implement proper authentication and authorization
|
||||
- Follow enterprise security standards
|
||||
|
||||
### Performance
|
||||
|
||||
- Use appropriate validation levels
|
||||
- Implement caching for repeated operations
|
||||
- Monitor resource usage and bottlenecks
|
||||
- Optimize for large marketplaces
|
||||
|
||||
## Contributing
|
||||
|
||||
To contribute to the marketplace skill:
|
||||
|
||||
1. **Fork the Repository**: Create a fork of the marketplace repository
|
||||
2. **Create Feature Branch**: Use descriptive branch names
|
||||
3. **Add Tests**: Include comprehensive tests for new features
|
||||
4. **Update Documentation**: Keep documentation current
|
||||
5. **Submit Pull Request**: Provide detailed descriptions of changes
|
||||
|
||||
### Development Guidelines
|
||||
|
||||
- Follow the existing code style and structure
|
||||
- Add comprehensive error handling
|
||||
- Include verbose logging options
|
||||
- Test across different template types
|
||||
- Validate all functionality
|
||||
|
||||
## License
|
||||
|
||||
This marketplace skill is licensed under the MIT License.
|
||||
|
||||
## Support
|
||||
|
||||
- **Documentation**: Review the comprehensive guides and examples
|
||||
- **Issues**: Report bugs and feature requests through GitHub issues
|
||||
- **Community**: Join discussions in the community forums
|
||||
- **Examples**: Check the examples directory for usage patterns
|
||||
|
||||
---
|
||||
|
||||
_Generated with Claude Code Marketplace Management Skill_
|
||||
453
skills/claude-code-marketplace/SKILL.md
Normal file
453
skills/claude-code-marketplace/SKILL.md
Normal file
@@ -0,0 +1,453 @@
|
||||
---
|
||||
name: marketplace
|
||||
description: Comprehensive skill for creating, managing, and maintaining Claude Code Marketplaces including plugin development, validation, deployment, and lifecycle management
|
||||
category: development
|
||||
version: 1.0.0
|
||||
author:
|
||||
name: Claude Code Market Specialist
|
||||
email: claude@anthropic.com
|
||||
license: MIT
|
||||
repository: https://github.com/anthropics/claude-code-marketplace
|
||||
keywords: [marketplace, plugin, development, claude-code, deployment]
|
||||
|
||||
parameters:
|
||||
- name: action
|
||||
type: string
|
||||
description: The action to perform (create, validate, deploy, update, analyze)
|
||||
required: true
|
||||
validation:
|
||||
pattern: "^(create|validate|deploy|update|analyze|init|template|test|list|status)$"
|
||||
message: "Action must be one of: create, validate, deploy, update, analyze, init, template, test, list, status"
|
||||
|
||||
- name: target
|
||||
type: string
|
||||
description: Target marketplace, plugin, or directory path
|
||||
required: false
|
||||
validation:
|
||||
pattern: "^[a-zA-Z0-9._/-]+$"
|
||||
message: "Target must be a valid path or identifier"
|
||||
|
||||
- name: options
|
||||
type: object
|
||||
description: Configuration options for the specified action
|
||||
required: false
|
||||
default:
|
||||
verbose: false
|
||||
dry_run: false
|
||||
template: "standard"
|
||||
auto_validate: true
|
||||
properties:
|
||||
verbose:
|
||||
type: boolean
|
||||
description: Enable verbose output
|
||||
dry_run:
|
||||
type: boolean
|
||||
description: Perform actions without making changes
|
||||
template:
|
||||
type: string
|
||||
enum: ["standard", "enterprise", "community", "minimal"]
|
||||
description: Template type for creation
|
||||
auto_validate:
|
||||
type: boolean
|
||||
description: Automatically validate after creation
|
||||
skip_tests:
|
||||
type: boolean
|
||||
description: Skip test execution
|
||||
force:
|
||||
type: boolean
|
||||
description: Force action even if validation fails
|
||||
|
||||
allowed-tools:
|
||||
- Read
|
||||
- Write
|
||||
- Edit
|
||||
- Bash
|
||||
- Glob
|
||||
- Grep
|
||||
- WebFetch
|
||||
|
||||
triggers:
|
||||
- "create a new marketplace"
|
||||
- "validate marketplace structure"
|
||||
- "deploy marketplace plugins"
|
||||
- "update marketplace configuration"
|
||||
- "analyze marketplace health"
|
||||
- "initialize marketplace project"
|
||||
- "generate marketplace template"
|
||||
- "test marketplace plugins"
|
||||
- "list marketplace contents"
|
||||
"check marketplace status"
|
||||
|
||||
examples:
|
||||
- input: "create a new marketplace called my-awesome-marketplace"
|
||||
output: "Created marketplace 'my-awesome-marketplace' with standard template structure and configuration"
|
||||
- input: "validate the marketplace at ./my-marketplace"
|
||||
output: "Marketplace validation completed: 0 errors, 2 warnings found"
|
||||
- input: "deploy plugins from marketplace ./my-marketplace"
|
||||
output: "Successfully deployed 3 plugins from marketplace to target environment"
|
||||
- input: "analyze marketplace health for ./my-marketplace"
|
||||
output: "Marketplace health analysis: 85% score, 2 recommendations for improvement"
|
||||
|
||||
requirements:
|
||||
- "Node.js 18+ for script execution"
|
||||
- "Git for version control and marketplace management"
|
||||
- "Adequate disk space for marketplace files"
|
||||
- "Write permissions for target directories"
|
||||
|
||||
limitations:
|
||||
- "Maximum marketplace size: 100MB"
|
||||
- "Maximum plugins per marketplace: 50"
|
||||
- "Validation timeout: 5 minutes"
|
||||
- "Concurrent operations: limited to 3"
|
||||
---
|
||||
|
||||
# Marketplace Management Skill
|
||||
|
||||
## Overview
|
||||
|
||||
The Marketplace skill provides comprehensive capabilities for creating, managing, and maintaining Claude Code Marketplaces. This skill handles the entire lifecycle of marketplace development including initialization, plugin management, validation, deployment, and health monitoring.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Use this skill when you need to:
|
||||
|
||||
- Create new Claude Code marketplaces from templates
|
||||
- Validate marketplace structure and configuration
|
||||
- Deploy and manage marketplace plugins
|
||||
- Update marketplace configurations and metadata
|
||||
- Analyze marketplace health and performance
|
||||
- Generate marketplace templates and examples
|
||||
- Test marketplace functionality and compatibility
|
||||
- List and inspect marketplace contents
|
||||
- Monitor marketplace status and operations
|
||||
|
||||
## Capabilities
|
||||
|
||||
### Marketplace Creation
|
||||
|
||||
- Initialize new marketplace projects from templates
|
||||
- Generate marketplace configuration files
|
||||
- Create directory structures for different marketplace types
|
||||
- Set up validation and testing frameworks
|
||||
- Configure plugin and skill management
|
||||
|
||||
### Plugin Management
|
||||
|
||||
- Add, update, and remove plugins from marketplaces
|
||||
- Validate plugin compatibility and dependencies
|
||||
- Generate plugin metadata and manifests
|
||||
- Manage plugin versions and releases
|
||||
- Handle plugin dependencies and conflicts
|
||||
|
||||
### Validation and Testing
|
||||
|
||||
- Comprehensive marketplace structure validation
|
||||
- Plugin compatibility testing
|
||||
- Configuration file validation
|
||||
- Dependency analysis and resolution
|
||||
- Security and permission validation
|
||||
|
||||
### Deployment and Distribution
|
||||
|
||||
- Package marketplaces for distribution
|
||||
- Deploy to various environments
|
||||
- Manage marketplace versions and releases
|
||||
- Handle marketplace updates and migrations
|
||||
- Configure marketplace access and permissions
|
||||
|
||||
### Health Monitoring
|
||||
|
||||
- Analyze marketplace performance metrics
|
||||
- Monitor plugin usage and compatibility
|
||||
- Identify potential issues and recommendations
|
||||
- Generate health reports and analytics
|
||||
- Track marketplace lifecycle metrics
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### Basic Marketplace Creation
|
||||
|
||||
```bash
|
||||
"Create a new marketplace called my-awesome-marketplace"
|
||||
```
|
||||
|
||||
### Advanced Marketplace Creation with Options
|
||||
|
||||
```bash
|
||||
"Create an enterprise marketplace at ./enterprise-marketplace with enterprise template and verbose output"
|
||||
```
|
||||
|
||||
### Marketplace Validation
|
||||
|
||||
```bash
|
||||
"Validate the marketplace at ./my-marketplace with verbose output"
|
||||
```
|
||||
|
||||
### Plugin Deployment
|
||||
|
||||
```bash
|
||||
"Deploy plugins from marketplace ./my-marketplace to production environment"
|
||||
```
|
||||
|
||||
### Health Analysis
|
||||
|
||||
```bash
|
||||
"Analyze marketplace health for ./my-marketplace and generate recommendations"
|
||||
```
|
||||
|
||||
### Template Generation
|
||||
|
||||
```bash
|
||||
"Generate a community marketplace template at ./community-template"
|
||||
```
|
||||
|
||||
### Testing and Validation
|
||||
|
||||
```bash
|
||||
"Test all plugins in marketplace ./my-marketplace with comprehensive validation"
|
||||
```
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### Processing Pipeline
|
||||
|
||||
1. **Action Analysis**: Parse and validate input parameters
|
||||
2. **Target Resolution**: Identify and validate target marketplace
|
||||
3. **Template Selection**: Choose appropriate template based on requirements
|
||||
4. **Structure Generation**: Create directory structure and configuration files
|
||||
5. **Validation**: Perform comprehensive validation checks
|
||||
6. **Deployment**: Handle deployment and distribution tasks
|
||||
7. **Monitoring**: Generate health metrics and recommendations
|
||||
|
||||
### Template Types
|
||||
|
||||
#### Standard Template
|
||||
|
||||
- Basic marketplace structure
|
||||
- Essential configuration files
|
||||
- Standard validation rules
|
||||
- Community-friendly setup
|
||||
|
||||
#### Enterprise Template
|
||||
|
||||
- Advanced security configurations
|
||||
- Compliance frameworks (SOC2, ISO27001)
|
||||
- Multi-team support
|
||||
- Advanced monitoring and analytics
|
||||
|
||||
#### Community Template
|
||||
|
||||
- Open-source friendly configurations
|
||||
- Community contribution guidelines
|
||||
- Simplified validation rules
|
||||
- Public distribution setup
|
||||
|
||||
#### Minimal Template
|
||||
|
||||
- Core marketplace structure only
|
||||
- Essential configuration files
|
||||
- Basic validation
|
||||
- Lightweight setup
|
||||
|
||||
### Validation Framework
|
||||
|
||||
#### Structure Validation
|
||||
|
||||
- Directory structure verification
|
||||
- Required file presence checks
|
||||
- Naming convention compliance
|
||||
- Permission validation
|
||||
|
||||
#### Configuration Validation
|
||||
|
||||
- JSON schema validation
|
||||
- Plugin metadata verification
|
||||
- Dependency analysis
|
||||
- Security permission checks
|
||||
|
||||
#### Plugin Validation
|
||||
|
||||
- Plugin structure validation
|
||||
- Command and skill verification
|
||||
- MCP server configuration checks
|
||||
- Compatibility testing
|
||||
|
||||
### Deployment Strategies
|
||||
|
||||
#### Local Deployment
|
||||
|
||||
- File system operations
|
||||
- Local plugin installation
|
||||
- Configuration updates
|
||||
- Validation and testing
|
||||
|
||||
#### Remote Deployment
|
||||
|
||||
- Git repository management
|
||||
- Remote marketplace updates
|
||||
- Version control integration
|
||||
- Automated deployment pipelines
|
||||
|
||||
## Configuration
|
||||
|
||||
### Default Settings
|
||||
|
||||
```json
|
||||
{
|
||||
"template": "standard",
|
||||
"verbose": false,
|
||||
"dry_run": false,
|
||||
"auto_validate": true,
|
||||
"skip_tests": false,
|
||||
"force": false
|
||||
}
|
||||
```
|
||||
|
||||
### Template Configurations
|
||||
|
||||
#### Standard Template Config
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "standard-marketplace",
|
||||
"version": "1.0.0",
|
||||
"categories": ["productivity", "development"],
|
||||
"validation": "standard",
|
||||
"access": "public"
|
||||
}
|
||||
```
|
||||
|
||||
#### Enterprise Template Config
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "enterprise-marketplace",
|
||||
"version": "1.0.0",
|
||||
"categories": ["enterprise", "productivity", "development"],
|
||||
"validation": "enterprise",
|
||||
"access": "restricted",
|
||||
"compliance": ["SOC2", "ISO27001"],
|
||||
"security": "zero-trust"
|
||||
}
|
||||
```
|
||||
|
||||
## Integration
|
||||
|
||||
### Compatible File Formats
|
||||
|
||||
- JSON configuration files
|
||||
- Markdown documentation
|
||||
- YAML metadata files
|
||||
- Shell scripts for automation
|
||||
|
||||
### Output Formats
|
||||
|
||||
- Structured JSON reports
|
||||
- Markdown documentation
|
||||
- HTML health reports
|
||||
- CSV analytics data
|
||||
|
||||
### External Integrations
|
||||
|
||||
- Git repositories for version control
|
||||
- GitHub for plugin distribution
|
||||
- CI/CD pipelines for automation
|
||||
- Monitoring systems for health tracking
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **Permission Denied**: Check file and directory permissions
|
||||
2. **Invalid Template**: Verify template name and availability
|
||||
3. **Validation Failures**: Review error messages and fix structural issues
|
||||
4. **Deployment Errors**: Check network connectivity and target permissions
|
||||
5. **Plugin Conflicts**: Resolve dependency issues and version conflicts
|
||||
|
||||
### Debug Information
|
||||
|
||||
Enable verbose output to see detailed processing information:
|
||||
|
||||
```bash
|
||||
"Create marketplace with verbose output enabled"
|
||||
```
|
||||
|
||||
### Error Recovery
|
||||
|
||||
- Use dry-run mode to preview actions
|
||||
- Check validation logs for specific issues
|
||||
- Review configuration files for syntax errors
|
||||
- Verify template integrity and availability
|
||||
|
||||
## Contributing
|
||||
|
||||
To contribute to this skill:
|
||||
|
||||
1. Follow the code style guidelines in the documentation
|
||||
2. Add comprehensive tests for new features
|
||||
3. Update documentation and examples
|
||||
4. Submit pull requests with detailed descriptions
|
||||
5. Ensure all validations pass before submission
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Development Guidelines
|
||||
|
||||
- Use appropriate templates for different use cases
|
||||
- Validate marketplaces before deployment
|
||||
- Monitor marketplace health regularly
|
||||
- Keep documentation up to date
|
||||
- Test thoroughly across different environments
|
||||
|
||||
### Security Considerations
|
||||
|
||||
- Review permissions and access controls
|
||||
- Validate plugin sources and dependencies
|
||||
- Implement proper authentication and authorization
|
||||
- Regular security audits and updates
|
||||
- Follow enterprise security standards
|
||||
|
||||
### Performance Optimization
|
||||
|
||||
- Use appropriate validation levels
|
||||
- Implement caching for repeated operations
|
||||
- Optimize file operations for large marketplaces
|
||||
- Monitor resource usage and bottlenecks
|
||||
- Implement parallel processing where applicable
|
||||
|
||||
## Version History
|
||||
|
||||
### v1.0.0 (2025-11-02)
|
||||
|
||||
- Initial release with comprehensive marketplace management
|
||||
- Support for multiple template types
|
||||
- Complete validation framework
|
||||
- Deployment and health monitoring capabilities
|
||||
- Extensive documentation and examples
|
||||
|
||||
## Support and Resources
|
||||
|
||||
### Documentation
|
||||
|
||||
- Complete user guide and API reference
|
||||
- Template specifications and examples
|
||||
- Best practices and troubleshooting guides
|
||||
- Community contribution guidelines
|
||||
|
||||
### Community Resources
|
||||
|
||||
- GitHub repository for issues and contributions
|
||||
- Community Discord server for discussions
|
||||
- Stack Overflow for technical questions
|
||||
- Blog posts and tutorials for learning
|
||||
|
||||
### Professional Support
|
||||
|
||||
- Enterprise support for large-scale deployments
|
||||
- Consulting services for custom implementations
|
||||
- Training programs for teams and organizations
|
||||
- Priority support for critical issues
|
||||
|
||||
---
|
||||
|
||||
_This marketplace skill provides a comprehensive solution for Claude Code Marketplace management, supporting the entire lifecycle from creation to maintenance and monitoring._
|
||||
531
skills/claude-code-marketplace/examples/usage-examples.md
Normal file
531
skills/claude-code-marketplace/examples/usage-examples.md
Normal file
@@ -0,0 +1,531 @@
|
||||
# Marketplace Skill Usage Examples
|
||||
|
||||
> **Practical examples for using the Marketplace Management Skill**
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Basic Usage](#basic-usage)
|
||||
2. [Advanced Scenarios](#advanced-scenarios)
|
||||
3. [Enterprise Examples](#enterprise-examples)
|
||||
4. [Troubleshooting Examples](#troubleshooting-examples)
|
||||
5. [Integration Examples](#integration-examples)
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### Example 1: Creating Your First Marketplace
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Create a new marketplace called dev-tools"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Creating marketplace 'dev-tools' at ./dev-tools using standard template
|
||||
Creating directory: ./dev-tools
|
||||
Creating directory: ./dev-tools/.claude-plugin
|
||||
Creating directory: ./dev-tools/plugins
|
||||
Creating directory: ./dev-tools/skills
|
||||
Creating directory: ./dev-tools/docs
|
||||
Creating directory: ./dev-tools/scripts
|
||||
Creating directory: ./dev-tools/examples
|
||||
Generating marketplace configuration: ./dev-tools/.claude-plugin/marketplace.json
|
||||
Copying template file: README.md
|
||||
Copying template file: .claude-plugin/plugin.json
|
||||
Copying template file: docs/GUIDE.md
|
||||
Copying template file: scripts/validate.js
|
||||
Copying template file: scripts/deploy.js
|
||||
Initializing git repository in: ./dev-tools
|
||||
Marketplace 'dev-tools' created successfully
|
||||
```
|
||||
|
||||
### Example 2: Validating a Marketplace
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Validate the marketplace at ./dev-tools"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Validating marketplace at: ./dev-tools
|
||||
Validation completed: SUCCESS
|
||||
Info messages:
|
||||
Required directory found: .claude-plugin
|
||||
Required file found: .claude-plugin/marketplace.json
|
||||
Optional directory found: plugins
|
||||
Optional directory found: skills
|
||||
Optional directory found: docs
|
||||
Optional directory found: scripts
|
||||
Optional directory found: examples
|
||||
Configuration file validated successfully
|
||||
```
|
||||
|
||||
### Example 3: Analyzing Marketplace Health
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Analyze marketplace health for ./dev-tools"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Analyzing marketplace health: ./dev-tools
|
||||
Marketplace Health Analysis
|
||||
Overall Score: 85/100
|
||||
Structure: 100/100
|
||||
Configuration: 90/100
|
||||
Plugins: 70/100
|
||||
Documentation: 80/100
|
||||
Recommendations:
|
||||
- Add more plugins or fix existing plugin issues
|
||||
- Improve documentation by adding comprehensive guides and examples
|
||||
Metrics:
|
||||
plugin_count: 0
|
||||
skill_count: 0
|
||||
total_size: 15678
|
||||
last_modified: 2025-11-02T17:45:30.123Z
|
||||
```
|
||||
|
||||
## Advanced Scenarios
|
||||
|
||||
### Example 4: Creating Enterprise Marketplace
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Create an enterprise marketplace at ./company-marketplace with enterprise template, verbose output, and auto-validation"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Creating marketplace 'company-marketplace' at ./company-marketplace using enterprise template
|
||||
Creating directory: ./company-marketplace
|
||||
Creating directory: ./company-marketplace/.claude-plugin
|
||||
Creating directory: ./company-marketplace/plugins
|
||||
Creating directory: ./company-marketplace/skills
|
||||
Creating directory: ./company-marketplace/docs
|
||||
Creating directory: ./company-marketplace/tests
|
||||
Creating directory: ./company-marketplace/scripts
|
||||
Creating directory: ./company-marketplace/examples
|
||||
Generating marketplace configuration: ./company-marketplace/.claude-plugin/marketplace.json
|
||||
Copying template file: README.md
|
||||
Copying template file: .claude-plugin/plugin.json
|
||||
Copying template file: docs/ENTERPRISE.md
|
||||
Copying template file: docs/SECURITY.md
|
||||
Copying template file: scripts/validate.js
|
||||
Copying template file: scripts/deploy.js
|
||||
Copying template file: scripts/security-scan.js
|
||||
Copying template file: tests/compliance.test.js
|
||||
Initializing git repository in: ./company-marketplace
|
||||
Validating marketplace at: ./company-marketplace
|
||||
Validation completed: SUCCESS
|
||||
Marketplace 'company-marketplace' created successfully
|
||||
```
|
||||
|
||||
### Example 5: Deployment with Version Update
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Deploy marketplace ./dev-tools with minor version update and skip validation"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Deploying marketplace from: ./dev-tools
|
||||
Current version: 1.0.0
|
||||
New version: 1.1.0
|
||||
Updated marketplace version to: 1.1.0
|
||||
Release notes generated: ./dev-tools/RELEASE_NOTES.md
|
||||
Creating git tag: v1.1.0
|
||||
Git tag v1.1.0 created successfully
|
||||
Pushing to remote repository...
|
||||
Successfully pushed to remote repository
|
||||
Deployment completed successfully
|
||||
Version: 1.1.0
|
||||
Release notes: ./dev-tools/RELEASE_NOTES.md
|
||||
Git tag created and pushed
|
||||
```
|
||||
|
||||
### Example 6: Community Marketplace Creation
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Create a community marketplace called open-source-tools with community template"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Creating marketplace 'open-source-tools' at ./open-source-tools using community template
|
||||
Creating directory: ./open-source-tools
|
||||
Creating directory: ./open-source-tools/.claude-plugin
|
||||
Creating directory: ./open-source-tools/plugins
|
||||
Creating directory: ./open-source-tools/skills
|
||||
Creating directory: ./open-source-tools/docs
|
||||
Creating directory: ./open-source-tools/tests
|
||||
Creating directory: ./open-source-tools/scripts
|
||||
Creating directory: ./open-source-tools/examples
|
||||
Generating marketplace configuration: ./open-source-tools/.claude-plugin/marketplace.json
|
||||
Copying template file: README.md
|
||||
Copying template file: .claude-plugin/plugin.json
|
||||
Copying template file: docs/CONTRIBUTING.md
|
||||
Copying template file: docs/COMMUNITY.md
|
||||
Copying template file: scripts/validate.js
|
||||
Copying template file: scripts/deploy.js
|
||||
Initializing git repository in: ./open-source-tools
|
||||
Validating marketplace at: ./open-source-tools
|
||||
Validation completed: SUCCESS
|
||||
Marketplace 'open-source-tools' created successfully
|
||||
```
|
||||
|
||||
## Enterprise Examples
|
||||
|
||||
### Example 7: Enterprise Security Validation
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Validate enterprise marketplace at ./company-marketplace with comprehensive security checks"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Validating marketplace at: ./company-marketplace
|
||||
Validation completed: SUCCESS
|
||||
Info messages:
|
||||
Required directory found: .claude-plugin
|
||||
Required file found: .claude-plugin/marketplace.json
|
||||
Optional directory found: plugins
|
||||
Optional directory found: skills
|
||||
Optional directory found: docs
|
||||
Optional directory found: tests
|
||||
Optional directory found: scripts
|
||||
Optional directory found: examples
|
||||
Configuration file validated successfully
|
||||
Security configuration validated
|
||||
Compliance checks passed
|
||||
```
|
||||
|
||||
### Example 8: Batch Plugin Addition
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Add multiple plugins to enterprise marketplace ./company-marketplace: code-quality, security-scanner, deployment-tools"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Adding plugins to marketplace: ./company-marketplace
|
||||
Adding plugin: code-quality
|
||||
Creating plugin directory: ./company-marketplace/plugins/code-quality
|
||||
Generating plugin configuration
|
||||
Validating plugin structure
|
||||
Plugin validated: code-quality
|
||||
|
||||
Adding plugin: security-scanner
|
||||
Creating plugin directory: ./company-marketplace/plugins/security-scanner
|
||||
Generating plugin configuration
|
||||
Validating plugin structure
|
||||
Plugin validated: security-scanner
|
||||
|
||||
Adding plugin: deployment-tools
|
||||
Creating plugin directory: ./company-marketplace/plugins/deployment-tools
|
||||
Generating plugin configuration
|
||||
Validating plugin structure
|
||||
Plugin validated: deployment-tools
|
||||
|
||||
Updated marketplace configuration with 3 plugins
|
||||
Validating updated marketplace
|
||||
Validation completed: SUCCESS
|
||||
```
|
||||
|
||||
## Troubleshooting Examples
|
||||
|
||||
### Example 9: Debug Creation Issues
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Create marketplace debug-test with verbose output to troubleshoot creation issues"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Creating marketplace 'debug-test' at ./debug-test using standard template
|
||||
Creating directory: ./debug-test
|
||||
Creating directory: ./debug-test/.claude-plugin
|
||||
Creating directory: ./debug-test/plugins
|
||||
Creating directory: ./debug-test/skills
|
||||
Creating directory: ./debug-test/docs
|
||||
Creating directory: ./debug-test/tests
|
||||
Creating directory: ./debug-test/scripts
|
||||
Creating directory: ./debug-test/examples
|
||||
Generating marketplace configuration: ./debug-test/.claude-plugin/marketplace.json
|
||||
Copying template file: README.md
|
||||
Copying template file: .claude-plugin/plugin.json
|
||||
Copying template file: docs/GUIDE.md
|
||||
Copying template file: scripts/validate.js
|
||||
Copying template file: scripts/deploy.js
|
||||
Initializing git repository in: ./debug-test
|
||||
Validating marketplace at: ./debug-test
|
||||
Validation completed: SUCCESS
|
||||
Marketplace 'debug-test' created successfully
|
||||
```
|
||||
|
||||
### Example 10: Force Deployment Despite Validation Errors
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Deploy marketplace ./problematic-marketplace with force option to override validation failures"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Deploying marketplace from: ./problematic-marketplace
|
||||
Validating marketplace before deployment...
|
||||
Validation completed: FAILED
|
||||
Errors found: 2
|
||||
- Required configuration field missing: description
|
||||
- Invalid version format: 1.0
|
||||
|
||||
Marketplace validation failed: Required configuration field missing: description
|
||||
Proceeding with deployment despite validation failures (force mode)
|
||||
Current version: 1.0
|
||||
New version: 1.0.1
|
||||
Updated marketplace version to: 1.0.1
|
||||
Release notes generated: ./problematic-marketplace/RELEASE_NOTES.md
|
||||
Creating git tag: v1.0.1
|
||||
Git tag v1.0.1 created successfully
|
||||
Pushing to remote repository...
|
||||
Successfully pushed to remote repository
|
||||
Deployment completed successfully
|
||||
Version: 1.0.1
|
||||
Release notes: ./problematic-marketplace/RELEASE_NOTES.md
|
||||
Git tag created and pushed
|
||||
```
|
||||
|
||||
## Integration Examples
|
||||
|
||||
### Example 11: CI/CD Pipeline Integration
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Create marketplace ./ci-cd-marketplace with minimal template for automated CI/CD pipeline deployment"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Creating marketplace 'ci-cd-marketplace' at ./ci-cd-marketplace using minimal template
|
||||
Creating directory: ./ci-cd-marketplace
|
||||
Creating directory: ./ci-cd-marketplace/.claude-plugin
|
||||
Creating directory: ./ci-cd-marketplace/plugins
|
||||
Creating directory: ./ci-cd-marketplace/skills
|
||||
Creating directory: ./ci-cd-marketplace/docs
|
||||
Creating directory: ./ci-cd-marketplace/tests
|
||||
Creating directory: ./ci-cd-marketplace/scripts
|
||||
Creating directory: ./ci-cd-marketplace/examples
|
||||
Generating marketplace configuration: ./ci-cd-marketplace/.claude-plugin/marketplace.json
|
||||
Copying template file: README.md
|
||||
Copying template file: .claude-plugin/plugin.json
|
||||
Copying template file: scripts/validate.js
|
||||
Initializing git repository in: ./ci-cd-marketplace
|
||||
Validating marketplace at: ./ci-cd-marketplace
|
||||
Validation completed: SUCCESS
|
||||
Marketplace 'ci-cd-marketplace' created successfully
|
||||
```
|
||||
|
||||
### Example 12: Multi-Environment Deployment
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Deploy marketplace ./production-marketplace to production environment with major version update and comprehensive validation"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Deploying marketplace from: ./production-marketplace
|
||||
Validating marketplace before deployment...
|
||||
Validation completed: SUCCESS
|
||||
Current version: 2.1.0
|
||||
New version: 3.0.0
|
||||
Updated marketplace version to: 3.0.0
|
||||
Release notes generated: ./production-marketplace/RELEASE_NOTES.md
|
||||
Creating git tag: v3.0.0
|
||||
Git tag v3.0.0 created successfully
|
||||
Pushing to remote repository...
|
||||
Successfully pushed to remote repository
|
||||
Deployment completed successfully
|
||||
Version: 3.0.0
|
||||
Release notes: ./production-marketplace/RELEASE_NOTES.md
|
||||
Git tag created and pushed
|
||||
```
|
||||
|
||||
## Complex Workflow Examples
|
||||
|
||||
### Example 13: Complete Marketplace Lifecycle
|
||||
|
||||
**Step 1: Creation**
|
||||
|
||||
```bash
|
||||
"Create marketplace full-lifecycle-demo with enterprise template"
|
||||
```
|
||||
|
||||
**Step 2: Adding Content**
|
||||
|
||||
```bash
|
||||
"Add plugins code-formatter and test-runner to marketplace ./full-lifecycle-demo"
|
||||
```
|
||||
|
||||
**Step 3: Validation**
|
||||
|
||||
```bash
|
||||
"Validate marketplace ./full-lifecycle-demo with comprehensive checks"
|
||||
```
|
||||
|
||||
**Step 4: Health Analysis**
|
||||
|
||||
```bash
|
||||
"Analyze marketplace health for ./full-lifecycle-demo and generate improvement recommendations"
|
||||
```
|
||||
|
||||
**Step 5: Deployment**
|
||||
|
||||
```bash
|
||||
"Deploy marketplace ./full-lifecycle-demo with minor version update"
|
||||
```
|
||||
|
||||
### Example 14: Template Customization
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Create marketplace custom-template-demo with standard template and then customize validation rules to be more strict"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Creating marketplace 'custom-template-demo' at ./custom-template-demo using standard template
|
||||
[... directory creation and file copying ...]
|
||||
Marketplace 'custom-template-demo' created successfully
|
||||
|
||||
Customizing validation rules for marketplace ./custom-template-demo...
|
||||
Updated validation configuration:
|
||||
{
|
||||
"level": "strict",
|
||||
"strict": true,
|
||||
"checks": ["structure", "metadata", "plugins", "security", "documentation", "performance"]
|
||||
}
|
||||
|
||||
Validation with custom rules completed: SUCCESS
|
||||
```
|
||||
|
||||
## Error Handling Examples
|
||||
|
||||
### Example 15: Invalid Marketplace Name
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Create marketplace with invalid name containing special characters!@#$"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Error: Invalid marketplace name. Names should only contain letters, numbers, hyphens, and underscores.
|
||||
Please use a valid name like: my-marketplace or my_marketplace
|
||||
```
|
||||
|
||||
### Example 16: Non-Existent Marketplace Validation
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Validate marketplace at ./non-existent-marketplace with verbose output"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Validating marketplace at: ./non-existent-marketplace
|
||||
Validation completed: FAILED
|
||||
Errors found: 1
|
||||
- Marketplace directory does not exist
|
||||
```
|
||||
|
||||
### Example 17: Permission Issues
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Create marketplace in restricted directory /root/protected-marketplace"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Error: Permission denied when creating directory /root/protected-marketplace
|
||||
Please choose a different directory or check permissions.
|
||||
```
|
||||
|
||||
## Performance and Scaling Examples
|
||||
|
||||
### Example 18: Large Marketplace Analysis
|
||||
|
||||
**Prompt**:
|
||||
|
||||
```bash
|
||||
"Analyze performance of large marketplace ./large-enterprise-marketplace with 50+ plugins"
|
||||
```
|
||||
|
||||
**Expected Output**:
|
||||
|
||||
```
|
||||
Analyzing marketplace health: ./large-enterprise-marketplace
|
||||
Scanning 52 plugins...
|
||||
Analyzing plugin configurations...
|
||||
Validating plugin dependencies...
|
||||
Checking skill compatibility...
|
||||
Marketplace Health Analysis
|
||||
Overall Score: 78/100
|
||||
Structure: 95/100
|
||||
Configuration: 85/100
|
||||
Plugins: 72/100
|
||||
Documentation: 60/100
|
||||
Recommendations:
|
||||
- Improve documentation by adding comprehensive guides and examples
|
||||
- Optimize plugin loading order for better performance
|
||||
- Consider grouping related plugins into categories
|
||||
Metrics:
|
||||
plugin_count: 52
|
||||
skill_count: 15
|
||||
total_size: 157890
|
||||
last_modified: 2025-11-02T17:45:30.123Z
|
||||
performance_score: 72
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
_These examples demonstrate practical usage patterns for the Marketplace Management Skill. Adapt them to your specific needs and requirements._
|
||||
930
skills/claude-code-marketplace/scripts/marketplace-manager.js
Normal file
930
skills/claude-code-marketplace/scripts/marketplace-manager.js
Normal file
@@ -0,0 +1,930 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Claude Code Marketplace Manager
|
||||
* Comprehensive tool for creating, managing, and maintaining Claude Code Marketplaces
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
class MarketplaceManager {
|
||||
constructor(options = {}) {
|
||||
this.verbose = options.verbose || false;
|
||||
this.dryRun = options.dryRun || false;
|
||||
this.force = options.force || false;
|
||||
}
|
||||
|
||||
log(message, level = 'info') {
|
||||
if (this.verbose || level === 'error') {
|
||||
const timestamp = new Date().toISOString();
|
||||
console.log(`[${timestamp}] [${level.toUpperCase()}] ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute command safely using spawn
|
||||
*/
|
||||
async executeCommand(command, args = [], cwd = process.cwd()) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(command, args, {
|
||||
cwd,
|
||||
stdio: this.verbose ? 'inherit' : 'pipe',
|
||||
});
|
||||
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
|
||||
if (!this.verbose) {
|
||||
child.stdout?.on('data', data => {
|
||||
stdout += data.toString();
|
||||
});
|
||||
|
||||
child.stderr?.on('data', data => {
|
||||
stderr += data.toString();
|
||||
});
|
||||
}
|
||||
|
||||
child.on('close', code => {
|
||||
if (code === 0) {
|
||||
resolve({ stdout, stderr, code });
|
||||
} else {
|
||||
reject(new Error(`Command failed with code ${code}: ${stderr}`));
|
||||
}
|
||||
});
|
||||
|
||||
child.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new marketplace from template
|
||||
*/
|
||||
async createMarketplace(name, options = {}) {
|
||||
const template = options.template || 'standard';
|
||||
const targetPath = options.path || `./${name}`;
|
||||
|
||||
this.log(`Creating marketplace '${name}' at ${targetPath} using ${template} template`);
|
||||
|
||||
if (!this.dryRun) {
|
||||
// Create directory structure
|
||||
this.createDirectoryStructure(targetPath);
|
||||
|
||||
// Generate configuration files
|
||||
await this.generateMarketplaceConfig(targetPath, name, template);
|
||||
|
||||
// Copy template files
|
||||
await this.copyTemplateFiles(targetPath, template);
|
||||
|
||||
// Initialize git repository
|
||||
await this.initializeGitRepository(targetPath);
|
||||
|
||||
// Validate created marketplace
|
||||
if (options.autoValidate !== false) {
|
||||
await this.validateMarketplace(targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
this.log(`Marketplace '${name}' created successfully`);
|
||||
return { success: true, path: targetPath, template };
|
||||
}
|
||||
|
||||
/**
|
||||
* Create marketplace directory structure
|
||||
*/
|
||||
createDirectoryStructure(basePath) {
|
||||
const directories = [
|
||||
'.claude-plugin',
|
||||
'plugins',
|
||||
'skills',
|
||||
'docs',
|
||||
'tests',
|
||||
'scripts',
|
||||
'examples',
|
||||
];
|
||||
|
||||
directories.forEach(dir => {
|
||||
const fullPath = path.join(basePath, dir);
|
||||
this.log(`Creating directory: ${fullPath}`);
|
||||
if (!this.dryRun) {
|
||||
fs.mkdirSync(fullPath, { recursive: true });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate marketplace configuration
|
||||
*/
|
||||
async generateMarketplaceConfig(basePath, name, template) {
|
||||
const configPath = path.join(basePath, '.claude-plugin', 'marketplace.json');
|
||||
|
||||
const config = {
|
||||
name: name,
|
||||
version: '1.0.0',
|
||||
description: `${name} - Claude Code Marketplace`,
|
||||
owner: {
|
||||
name: 'Marketplace Owner',
|
||||
email: 'owner@example.com',
|
||||
},
|
||||
repository: {
|
||||
type: 'git',
|
||||
url: `https://github.com/owner/${name}.git`,
|
||||
},
|
||||
license: 'MIT',
|
||||
plugins: [],
|
||||
skills: [],
|
||||
template: template,
|
||||
created: new Date().toISOString(),
|
||||
validation: this.getValidationConfig(template),
|
||||
};
|
||||
|
||||
this.log(`Generating marketplace configuration: ${configPath}`);
|
||||
if (!this.dryRun) {
|
||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get validation configuration based on template type
|
||||
*/
|
||||
getValidationConfig(template) {
|
||||
const configs = {
|
||||
standard: {
|
||||
level: 'standard',
|
||||
strict: false,
|
||||
checks: ['structure', 'metadata', 'plugins'],
|
||||
},
|
||||
enterprise: {
|
||||
level: 'enterprise',
|
||||
strict: true,
|
||||
checks: ['structure', 'metadata', 'plugins', 'security', 'compliance'],
|
||||
},
|
||||
community: {
|
||||
level: 'community',
|
||||
strict: false,
|
||||
checks: ['structure', 'metadata', 'plugins', 'documentation'],
|
||||
},
|
||||
minimal: {
|
||||
level: 'minimal',
|
||||
strict: false,
|
||||
checks: ['structure', 'metadata'],
|
||||
},
|
||||
};
|
||||
|
||||
return configs[template] || configs.standard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy template files
|
||||
*/
|
||||
async copyTemplateFiles(targetPath, template) {
|
||||
const templateDir = path.join(__dirname, '..', 'templates', template);
|
||||
|
||||
if (!fs.existsSync(templateDir)) {
|
||||
this.log(`Template directory not found: ${templateDir}`, 'warn');
|
||||
return;
|
||||
}
|
||||
|
||||
const files = this.getTemplateFiles(template);
|
||||
|
||||
for (const file of files) {
|
||||
const sourcePath = path.join(templateDir, file);
|
||||
const targetFilePath = path.join(targetPath, file);
|
||||
|
||||
this.log(`Copying template file: ${file}`);
|
||||
if (!this.dryRun && fs.existsSync(sourcePath)) {
|
||||
// Ensure target directory exists
|
||||
const targetDir = path.dirname(targetFilePath);
|
||||
if (!fs.existsSync(targetDir)) {
|
||||
fs.mkdirSync(targetDir, { recursive: true });
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(sourcePath, 'utf8');
|
||||
fs.writeFileSync(targetFilePath, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get template file list
|
||||
*/
|
||||
getTemplateFiles(template) {
|
||||
const files = {
|
||||
standard: [
|
||||
'README.md',
|
||||
'.claude-plugin/plugin.json',
|
||||
'docs/GUIDE.md',
|
||||
'scripts/validate.js',
|
||||
'scripts/deploy.js',
|
||||
],
|
||||
enterprise: [
|
||||
'README.md',
|
||||
'.claude-plugin/plugin.json',
|
||||
'docs/ENTERPRISE.md',
|
||||
'docs/SECURITY.md',
|
||||
'scripts/validate.js',
|
||||
'scripts/deploy.js',
|
||||
'scripts/security-scan.js',
|
||||
'tests/compliance.test.js',
|
||||
],
|
||||
community: [
|
||||
'README.md',
|
||||
'.claude-plugin/plugin.json',
|
||||
'docs/CONTRIBUTING.md',
|
||||
'docs/COMMUNITY.md',
|
||||
'scripts/validate.js',
|
||||
'scripts/deploy.js',
|
||||
],
|
||||
minimal: ['README.md', '.claude-plugin/plugin.json', 'scripts/validate.js'],
|
||||
};
|
||||
|
||||
return files[template] || files.standard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize git repository
|
||||
*/
|
||||
async initializeGitRepository(basePath) {
|
||||
this.log(`Initializing git repository in: ${basePath}`);
|
||||
|
||||
if (!this.dryRun) {
|
||||
try {
|
||||
await this.executeCommand('git', ['init'], basePath);
|
||||
await this.executeCommand('git', ['add', '.'], basePath);
|
||||
await this.executeCommand(
|
||||
'git',
|
||||
['commit', '-m', 'Initial marketplace structure'],
|
||||
basePath
|
||||
);
|
||||
} catch (error) {
|
||||
this.log(`Git initialization failed: ${error.message}`, 'warn');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate marketplace structure and configuration
|
||||
*/
|
||||
async validateMarketplace(marketplacePath) {
|
||||
this.log(`Validating marketplace at: ${marketplacePath}`);
|
||||
|
||||
const results = {
|
||||
success: true,
|
||||
errors: [],
|
||||
warnings: [],
|
||||
info: [],
|
||||
};
|
||||
|
||||
// Check if marketplace exists
|
||||
if (!fs.existsSync(marketplacePath)) {
|
||||
results.errors.push('Marketplace directory does not exist');
|
||||
results.success = false;
|
||||
return results;
|
||||
}
|
||||
|
||||
// Validate directory structure
|
||||
this.validateDirectoryStructure(marketplacePath, results);
|
||||
|
||||
// Validate configuration files
|
||||
await this.validateConfiguration(marketplacePath, results);
|
||||
|
||||
// Validate plugins
|
||||
await this.validatePlugins(marketplacePath, results);
|
||||
|
||||
// Validate skills
|
||||
await this.validateSkills(marketplacePath, results);
|
||||
|
||||
// Report results
|
||||
this.reportValidationResults(results);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate marketplace directory structure
|
||||
*/
|
||||
validateDirectoryStructure(marketplacePath, results) {
|
||||
const requiredDirs = ['.claude-plugin'];
|
||||
const optionalDirs = ['plugins', 'skills', 'docs', 'tests', 'scripts', 'examples'];
|
||||
|
||||
requiredDirs.forEach(dir => {
|
||||
const dirPath = path.join(marketplacePath, dir);
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
results.errors.push(`Required directory missing: ${dir}`);
|
||||
} else {
|
||||
results.info.push(`Required directory found: ${dir}`);
|
||||
}
|
||||
});
|
||||
|
||||
optionalDirs.forEach(dir => {
|
||||
const dirPath = path.join(marketplacePath, dir);
|
||||
if (fs.existsSync(dirPath)) {
|
||||
results.info.push(`Optional directory found: ${dir}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate marketplace configuration
|
||||
*/
|
||||
async validateConfiguration(marketplacePath, results) {
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
results.errors.push('Marketplace configuration file missing: marketplace.json');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
// Validate required fields
|
||||
const requiredFields = ['name', 'version', 'description', 'owner'];
|
||||
requiredFields.forEach(field => {
|
||||
if (!config[field]) {
|
||||
results.errors.push(`Required configuration field missing: ${field}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Validate version format
|
||||
if (config.version && !this.isValidVersion(config.version)) {
|
||||
results.errors.push(`Invalid version format: ${config.version}`);
|
||||
}
|
||||
|
||||
// Validate plugins array
|
||||
if (config.plugins && !Array.isArray(config.plugins)) {
|
||||
results.errors.push('Plugins field must be an array');
|
||||
}
|
||||
|
||||
results.info.push('Configuration file validated successfully');
|
||||
} catch (error) {
|
||||
results.errors.push(`Invalid JSON in configuration file: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate plugins in marketplace
|
||||
*/
|
||||
async validatePlugins(marketplacePath, results) {
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
if (!config.plugins || config.plugins.length === 0) {
|
||||
results.warnings.push('No plugins configured in marketplace');
|
||||
return;
|
||||
}
|
||||
|
||||
const pluginsDir = path.join(marketplacePath, 'plugins');
|
||||
|
||||
for (const plugin of config.plugins) {
|
||||
if (!plugin.name) {
|
||||
results.errors.push('Plugin found without name in configuration');
|
||||
continue;
|
||||
}
|
||||
|
||||
const pluginPath = path.join(pluginsDir, plugin.name);
|
||||
if (fs.existsSync(pluginPath)) {
|
||||
await this.validatePlugin(pluginPath, plugin, results);
|
||||
} else {
|
||||
results.warnings.push(`Plugin directory not found: ${plugin.name}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
results.errors.push(`Error validating plugins: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate individual plugin
|
||||
*/
|
||||
async validatePlugin(pluginPath, pluginConfig, results) {
|
||||
const pluginJsonPath = path.join(pluginPath, '.claude-plugin', 'plugin.json');
|
||||
|
||||
if (!fs.existsSync(pluginJsonPath)) {
|
||||
results.errors.push(`Plugin configuration missing: ${pluginConfig.name}/plugin.json`);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const pluginConfig = JSON.parse(fs.readFileSync(pluginJsonPath, 'utf8'));
|
||||
|
||||
// Validate plugin structure
|
||||
const requiredFields = ['name', 'version', 'description'];
|
||||
requiredFields.forEach(field => {
|
||||
if (!pluginConfig[field]) {
|
||||
results.errors.push(`Plugin ${pluginConfig.name}: Required field missing: ${field}`);
|
||||
}
|
||||
});
|
||||
|
||||
results.info.push(`Plugin validated: ${pluginConfig.name}`);
|
||||
} catch (error) {
|
||||
results.errors.push(`Plugin ${pluginConfig.name}: Invalid configuration - ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate skills in marketplace
|
||||
*/
|
||||
async validateSkills(marketplacePath, results) {
|
||||
const skillsDir = path.join(marketplacePath, 'skills');
|
||||
|
||||
if (!fs.existsSync(skillsDir)) {
|
||||
results.warnings.push('Skills directory not found');
|
||||
return;
|
||||
}
|
||||
|
||||
const skills = fs
|
||||
.readdirSync(skillsDir, { withFileTypes: true })
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => dirent.name);
|
||||
|
||||
if (skills.length === 0) {
|
||||
results.warnings.push('No skills found in marketplace');
|
||||
return;
|
||||
}
|
||||
|
||||
for (const skill of skills) {
|
||||
await this.validateSkill(path.join(skillsDir, skill), skill, results);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate individual skill
|
||||
*/
|
||||
async validateSkill(skillPath, skillName, results) {
|
||||
const skillMdPath = path.join(skillPath, 'SKILL.md');
|
||||
|
||||
if (!fs.existsSync(skillMdPath)) {
|
||||
results.errors.push(`Skill SKILL.md missing: ${skillName}`);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const content = fs.readFileSync(skillMdPath, 'utf8');
|
||||
|
||||
// Check for required frontmatter
|
||||
if (!content.includes('---')) {
|
||||
results.errors.push(`Skill ${skillName}: Missing frontmatter`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract and validate frontmatter
|
||||
const frontmatterMatch = content.match(/^---\n(.*?)\n---/s);
|
||||
if (frontmatterMatch) {
|
||||
try {
|
||||
const frontmatter = JSON.parse(frontmatterMatch[1].replace(/(\w+):/g, '"$1":'));
|
||||
|
||||
if (!frontmatter.name) {
|
||||
results.errors.push(`Skill ${skillName}: Missing name in frontmatter`);
|
||||
}
|
||||
|
||||
if (!frontmatter.description) {
|
||||
results.warnings.push(`Skill ${skillName}: Missing description in frontmatter`);
|
||||
}
|
||||
} catch (error) {
|
||||
results.errors.push(`Skill ${skillName}: Invalid frontmatter format`);
|
||||
}
|
||||
}
|
||||
|
||||
results.info.push(`Skill validated: ${skillName}`);
|
||||
} catch (error) {
|
||||
results.errors.push(`Skill ${skillName}: Error reading file - ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deploy marketplace plugins
|
||||
*/
|
||||
async deployMarketplace(marketplacePath, options = {}) {
|
||||
this.log(`Deploying marketplace from: ${marketplacePath}`);
|
||||
|
||||
const validation = await this.validateMarketplace(marketplacePath);
|
||||
|
||||
if (!validation.success && !this.force) {
|
||||
throw new Error('Marketplace validation failed. Use --force to deploy anyway.');
|
||||
}
|
||||
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
const results = {
|
||||
deployed: [],
|
||||
failed: [],
|
||||
skipped: [],
|
||||
};
|
||||
|
||||
for (const plugin of config.plugins) {
|
||||
try {
|
||||
await this.deployPlugin(plugin, marketplacePath, options);
|
||||
results.deployed.push(plugin.name);
|
||||
this.log(`Deployed plugin: ${plugin.name}`);
|
||||
} catch (error) {
|
||||
results.failed.push({ name: plugin.name, error: error.message });
|
||||
this.log(`Failed to deploy plugin ${plugin.name}: ${error.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
this.reportDeploymentResults(results);
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deploy individual plugin
|
||||
*/
|
||||
async deployPlugin(plugin, marketplacePath, options) {
|
||||
// Implementation would depend on deployment target
|
||||
// This is a placeholder for actual deployment logic
|
||||
this.log(`Deploying plugin: ${plugin.name} (version: ${plugin.version})`);
|
||||
|
||||
if (!this.dryRun) {
|
||||
// Add actual deployment logic here
|
||||
// Could involve:
|
||||
// - Publishing to GitHub
|
||||
// - Uploading to registry
|
||||
// - Deploying to server
|
||||
// etc.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze marketplace health
|
||||
*/
|
||||
async analyzeMarketplaceHealth(marketplacePath) {
|
||||
this.log(`Analyzing marketplace health: ${marketplacePath}`);
|
||||
|
||||
const analysis = {
|
||||
overall_score: 0,
|
||||
structure_score: 0,
|
||||
configuration_score: 0,
|
||||
plugin_score: 0,
|
||||
documentation_score: 0,
|
||||
recommendations: [],
|
||||
metrics: {},
|
||||
};
|
||||
|
||||
// Structure analysis
|
||||
analysis.structure_score = this.analyzeStructure(marketplacePath);
|
||||
|
||||
// Configuration analysis
|
||||
analysis.configuration_score = await this.analyzeConfiguration(marketplacePath);
|
||||
|
||||
// Plugin analysis
|
||||
analysis.plugin_score = await this.analyzePlugins(marketplacePath);
|
||||
|
||||
// Documentation analysis
|
||||
analysis.documentation_score = await this.analyzeDocumentation(marketplacePath);
|
||||
|
||||
// Calculate overall score
|
||||
analysis.overall_score = Math.round(
|
||||
(analysis.structure_score +
|
||||
analysis.configuration_score +
|
||||
analysis.plugin_score +
|
||||
analysis.documentation_score) /
|
||||
4
|
||||
);
|
||||
|
||||
// Generate recommendations
|
||||
analysis.recommendations = this.generateRecommendations(analysis);
|
||||
|
||||
// Generate metrics
|
||||
analysis.metrics = await this.generateMetrics(marketplacePath);
|
||||
|
||||
this.reportHealthAnalysis(analysis);
|
||||
return analysis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze marketplace structure
|
||||
*/
|
||||
analyzeStructure(marketplacePath) {
|
||||
let score = 0;
|
||||
const maxScore = 100;
|
||||
|
||||
const requiredDirs = ['.claude-plugin'];
|
||||
const optionalDirs = ['plugins', 'skills', 'docs', 'tests', 'scripts'];
|
||||
|
||||
// Check required directories (40 points)
|
||||
requiredDirs.forEach(dir => {
|
||||
if (fs.existsSync(path.join(marketplacePath, dir))) {
|
||||
score += 40 / requiredDirs.length;
|
||||
}
|
||||
});
|
||||
|
||||
// Check optional directories (60 points)
|
||||
optionalDirs.forEach(dir => {
|
||||
if (fs.existsSync(path.join(marketplacePath, dir))) {
|
||||
score += 60 / optionalDirs.length;
|
||||
}
|
||||
});
|
||||
|
||||
return Math.round(score);
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze configuration
|
||||
*/
|
||||
async analyzeConfiguration(marketplacePath) {
|
||||
let score = 0;
|
||||
|
||||
try {
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
// Check required fields (50 points)
|
||||
const requiredFields = ['name', 'version', 'description', 'owner', 'license'];
|
||||
requiredFields.forEach(field => {
|
||||
if (config[field]) score += 50 / requiredFields.length;
|
||||
});
|
||||
|
||||
// Check optional but recommended fields (30 points)
|
||||
const recommendedFields = ['repository', 'keywords', 'homepage'];
|
||||
recommendedFields.forEach(field => {
|
||||
if (config[field]) score += 30 / recommendedFields.length;
|
||||
});
|
||||
|
||||
// Check plugins array (20 points)
|
||||
if (config.plugins && Array.isArray(config.plugins) && config.plugins.length > 0) {
|
||||
score += 20;
|
||||
}
|
||||
} catch (error) {
|
||||
score = 0;
|
||||
}
|
||||
|
||||
return Math.round(score);
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze plugins
|
||||
*/
|
||||
async analyzePlugins(marketplacePath) {
|
||||
let score = 0;
|
||||
|
||||
try {
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
if (!config.plugins || config.plugins.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const pluginsDir = path.join(marketplacePath, 'plugins');
|
||||
let validPlugins = 0;
|
||||
|
||||
for (const plugin of config.plugins) {
|
||||
const pluginPath = path.join(pluginsDir, plugin.name);
|
||||
if (fs.existsSync(pluginPath)) {
|
||||
validPlugins++;
|
||||
}
|
||||
}
|
||||
|
||||
score = (validPlugins / config.plugins.length) * 100;
|
||||
} catch (error) {
|
||||
score = 0;
|
||||
}
|
||||
|
||||
return Math.round(score);
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze documentation
|
||||
*/
|
||||
async analyzeDocumentation(marketplacePath) {
|
||||
let score = 0;
|
||||
|
||||
const docsDir = path.join(marketplacePath, 'docs');
|
||||
|
||||
if (!fs.existsSync(docsDir)) {
|
||||
return 20; // Basic README only
|
||||
}
|
||||
|
||||
const docFiles = fs.readdirSync(docsDir);
|
||||
|
||||
// Check for key documentation files
|
||||
const keyDocs = ['README.md', 'GUIDE.md', 'CONTRIBUTING.md'];
|
||||
keyDocs.forEach(doc => {
|
||||
if (docFiles.includes(doc)) {
|
||||
score += 80 / keyDocs.length;
|
||||
}
|
||||
});
|
||||
|
||||
// Bonus for additional documentation
|
||||
if (docFiles.length > keyDocs.length) {
|
||||
score += 20;
|
||||
}
|
||||
|
||||
return Math.round(Math.min(score, 100));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate recommendations
|
||||
*/
|
||||
generateRecommendations(analysis) {
|
||||
const recommendations = [];
|
||||
|
||||
if (analysis.structure_score < 80) {
|
||||
recommendations.push('Improve directory structure by adding missing recommended directories');
|
||||
}
|
||||
|
||||
if (analysis.configuration_score < 80) {
|
||||
recommendations.push(
|
||||
'Enhance marketplace configuration with additional metadata and information'
|
||||
);
|
||||
}
|
||||
|
||||
if (analysis.plugin_score < 80) {
|
||||
recommendations.push('Add more plugins or fix existing plugin issues');
|
||||
}
|
||||
|
||||
if (analysis.documentation_score < 80) {
|
||||
recommendations.push('Improve documentation by adding comprehensive guides and examples');
|
||||
}
|
||||
|
||||
if (analysis.overall_score >= 90) {
|
||||
recommendations.push('Excellent marketplace health! Consider sharing with the community');
|
||||
}
|
||||
|
||||
return recommendations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate marketplace metrics
|
||||
*/
|
||||
async generateMetrics(marketplacePath) {
|
||||
const metrics = {};
|
||||
|
||||
try {
|
||||
// Count plugins
|
||||
const pluginsDir = path.join(marketplacePath, 'plugins');
|
||||
if (fs.existsSync(pluginsDir)) {
|
||||
metrics.plugin_count = fs.readdirSync(pluginsDir).length;
|
||||
}
|
||||
|
||||
// Count skills
|
||||
const skillsDir = path.join(marketplacePath, 'skills');
|
||||
if (fs.existsSync(skillsDir)) {
|
||||
metrics.skill_count = fs.readdirSync(skillsDir).length;
|
||||
}
|
||||
|
||||
// Calculate total size
|
||||
metrics.total_size = this.calculateDirectorySize(marketplacePath);
|
||||
|
||||
// Get last modified
|
||||
const stats = fs.statSync(marketplacePath);
|
||||
metrics.last_modified = stats.mtime.toISOString();
|
||||
} catch (error) {
|
||||
this.log(`Error generating metrics: ${error.message}`, 'warn');
|
||||
}
|
||||
|
||||
return metrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate directory size
|
||||
*/
|
||||
calculateDirectorySize(dirPath) {
|
||||
let totalSize = 0;
|
||||
|
||||
try {
|
||||
const files = fs.readdirSync(dirPath);
|
||||
|
||||
for (const file of files) {
|
||||
const filePath = path.join(dirPath, file);
|
||||
const stats = fs.statSync(filePath);
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
totalSize += this.calculateDirectorySize(filePath);
|
||||
} else {
|
||||
totalSize += stats.size;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.log(`Error calculating size for ${dirPath}: ${error.message}`, 'warn');
|
||||
}
|
||||
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report validation results
|
||||
*/
|
||||
reportValidationResults(results) {
|
||||
this.log(`Validation completed: ${results.success ? 'SUCCESS' : 'FAILED'}`);
|
||||
|
||||
if (results.errors.length > 0) {
|
||||
this.log(`Errors found: ${results.errors.length}`, 'error');
|
||||
results.errors.forEach(error => this.log(` - ${error}`, 'error'));
|
||||
}
|
||||
|
||||
if (results.warnings.length > 0) {
|
||||
this.log(`Warnings found: ${results.warnings.length}`, 'warn');
|
||||
results.warnings.forEach(warning => this.log(` - ${warning}`, 'warn'));
|
||||
}
|
||||
|
||||
if (results.info.length > 0 && this.verbose) {
|
||||
this.log(`Info messages: ${results.info.length}`);
|
||||
results.info.forEach(info => this.log(` - ${info}`));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Report deployment results
|
||||
*/
|
||||
reportDeploymentResults(results) {
|
||||
this.log(`Deployment completed`);
|
||||
this.log(`Deployed: ${results.deployed.length}`);
|
||||
this.log(`Failed: ${results.failed.length}`);
|
||||
this.log(`Skipped: ${results.skipped.length}`);
|
||||
|
||||
if (results.failed.length > 0) {
|
||||
results.failed.forEach(failure => {
|
||||
this.log(`Failed to deploy ${failure.name}: ${failure.error}`, 'error');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Report health analysis
|
||||
*/
|
||||
reportHealthAnalysis(analysis) {
|
||||
this.log(`Marketplace Health Analysis`);
|
||||
this.log(`Overall Score: ${analysis.overall_score}/100`);
|
||||
this.log(`Structure: ${analysis.structure_score}/100`);
|
||||
this.log(`Configuration: ${analysis.configuration_score}/100`);
|
||||
this.log(`Plugins: ${analysis.plugin_score}/100`);
|
||||
this.log(`Documentation: ${analysis.documentation_score}/100`);
|
||||
|
||||
if (analysis.recommendations.length > 0) {
|
||||
this.log(`Recommendations:`);
|
||||
analysis.recommendations.forEach(rec => this.log(` - ${rec}`));
|
||||
}
|
||||
|
||||
this.log(`Metrics:`, 'info');
|
||||
Object.entries(analysis.metrics).forEach(([key, value]) => {
|
||||
this.log(` ${key}: ${value}`, 'info');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if version string is valid
|
||||
*/
|
||||
isValidVersion(version) {
|
||||
return /^\d+\.\d+\.\d+(-.*)?$/.test(version);
|
||||
}
|
||||
}
|
||||
|
||||
// CLI interface
|
||||
if (require.main === module) {
|
||||
const args = process.argv.slice(2);
|
||||
const options = {
|
||||
verbose: args.includes('--verbose'),
|
||||
dryRun: args.includes('--dry-run'),
|
||||
force: args.includes('--force'),
|
||||
};
|
||||
|
||||
const manager = new MarketplaceManager(options);
|
||||
|
||||
// Parse command
|
||||
const command = args[0];
|
||||
|
||||
switch (command) {
|
||||
case 'create':
|
||||
const name = args[1];
|
||||
if (!name) {
|
||||
console.error('Error: Marketplace name required');
|
||||
process.exit(1);
|
||||
}
|
||||
manager.createMarketplace(name, options);
|
||||
break;
|
||||
|
||||
case 'validate':
|
||||
const marketplacePath = args[1] || './';
|
||||
manager.validateMarketplace(marketplacePath);
|
||||
break;
|
||||
|
||||
case 'deploy':
|
||||
const deployPath = args[1] || './';
|
||||
manager.deployMarketplace(deployPath, options);
|
||||
break;
|
||||
|
||||
case 'analyze':
|
||||
const analyzePath = args[1] || './';
|
||||
manager.analyzeMarketplaceHealth(analyzePath);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('Usage: node marketplace-manager.js <command> [options]');
|
||||
console.log('Commands: create, validate, deploy, analyze');
|
||||
console.log('Options: --verbose, --dry-run, --force');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MarketplaceManager;
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "[marketplace-name]",
|
||||
"version": "1.0.0",
|
||||
"description": "[Marketplace description]",
|
||||
"author": {
|
||||
"name": "[Author Name]",
|
||||
"email": "[author@example.com]",
|
||||
"url": "https://github.com/[username]"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/[username]/[marketplace-name].git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": ["claude-code", "marketplace", "plugins", "skills"],
|
||||
"homepage": "https://github.com/[username]/[marketplace-name]#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/[username]/[marketplace-name]/issues"
|
||||
},
|
||||
"engines": {
|
||||
"claude-code": ">=1.0.0"
|
||||
},
|
||||
"categories": ["productivity", "development"],
|
||||
"permissions": {
|
||||
"tools": ["Read", "Write", "Bash", "WebFetch"],
|
||||
"domains": ["github.com", "docs.claude.com"],
|
||||
"fileSystem": {
|
||||
"allowedPaths": ["./workspace", "/tmp"],
|
||||
"deniedPaths": ["/etc", "/usr/bin"]
|
||||
}
|
||||
},
|
||||
"commands": [
|
||||
{
|
||||
"name": "[command-name]",
|
||||
"description": "[Command description]",
|
||||
"usage": "/[command-name] [options]",
|
||||
"examples": ["/[command-name] --help", "/[command-name] input.txt output.txt"]
|
||||
}
|
||||
],
|
||||
"skills": [
|
||||
{
|
||||
"name": "[skill-name]",
|
||||
"description": "[Skill description]",
|
||||
"category": "development"
|
||||
}
|
||||
]
|
||||
}
|
||||
104
skills/claude-code-marketplace/templates/standard/README.md
Normal file
104
skills/claude-code-marketplace/templates/standard/README.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# [Marketplace Name]
|
||||
|
||||
> **Description**: [Brief description of your marketplace]
|
||||
|
||||
## Overview
|
||||
|
||||
This marketplace provides a curated collection of Claude Code plugins and skills for [specific purpose or domain].
|
||||
|
||||
## Installation
|
||||
|
||||
Add this marketplace to Claude Code:
|
||||
|
||||
```bash
|
||||
/plugin marketplace add [repository-url]
|
||||
```
|
||||
|
||||
## Available Plugins
|
||||
|
||||
### [Plugin Name]
|
||||
|
||||
- **Description**: [Brief description]
|
||||
- **Version**: [version]
|
||||
- **Usage**: `/[command-name] [options]`
|
||||
|
||||
## Available Skills
|
||||
|
||||
### [Skill Name]
|
||||
|
||||
- **Description**: [Brief description]
|
||||
- **Category**: [category]
|
||||
- **Usage**: [trigger phrase or usage pattern]
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Install the marketplace:
|
||||
|
||||
```bash
|
||||
/plugin marketplace add [repository-url]
|
||||
```
|
||||
|
||||
2. Browse available plugins:
|
||||
|
||||
```bash
|
||||
/plugin
|
||||
```
|
||||
|
||||
3. Install desired plugins:
|
||||
```bash
|
||||
/plugin install [plugin-name]@[marketplace-name]
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Adding Plugins
|
||||
|
||||
1. Create plugin directory in `plugins/`
|
||||
2. Add plugin configuration to marketplace.json
|
||||
3. Test plugin locally
|
||||
4. Submit pull request
|
||||
|
||||
### Adding Skills
|
||||
|
||||
1. Create skill directory in `skills/`
|
||||
2. Add skill documentation and examples
|
||||
3. Test skill functionality
|
||||
4. Update marketplace configuration
|
||||
|
||||
## Validation
|
||||
|
||||
Validate marketplace structure:
|
||||
|
||||
```bash
|
||||
node scripts/validate.js
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
Deploy marketplace changes:
|
||||
|
||||
```bash
|
||||
node scripts/deploy.js
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork the repository
|
||||
2. Create feature branch
|
||||
3. Add your plugin or skill
|
||||
4. Ensure all validations pass
|
||||
5. Submit pull request
|
||||
|
||||
## License
|
||||
|
||||
This marketplace is licensed under the [License Type] License.
|
||||
|
||||
## Support
|
||||
|
||||
- **Issues**: [GitHub Issues URL]
|
||||
- **Discussions**: [GitHub Discussions URL]
|
||||
- **Documentation**: [Documentation URL]
|
||||
|
||||
---
|
||||
|
||||
_Generated with Claude Code Marketplace Manager_
|
||||
343
skills/claude-code-marketplace/templates/standard/docs/GUIDE.md
Normal file
343
skills/claude-code-marketplace/templates/standard/docs/GUIDE.md
Normal file
@@ -0,0 +1,343 @@
|
||||
# [Marketplace Name] - User Guide
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Installation](#installation)
|
||||
2. [Getting Started](#getting-started)
|
||||
3. [Available Plugins](#available-plugins)
|
||||
4. [Available Skills](#available-skills)
|
||||
5. [Usage Examples](#usage-examples)
|
||||
6. [Configuration](#configuration)
|
||||
7. [Troubleshooting](#troubleshooting)
|
||||
|
||||
## Installation
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Claude Code Pro subscription
|
||||
- Git installed and configured
|
||||
- Node.js 18+ (for development)
|
||||
|
||||
### Adding the Marketplace
|
||||
|
||||
1. Add the marketplace to Claude Code:
|
||||
|
||||
```bash
|
||||
/plugin marketplace add [repository-url]
|
||||
```
|
||||
|
||||
2. Verify installation:
|
||||
```bash
|
||||
/plugin marketplace list
|
||||
```
|
||||
|
||||
### Installing Plugins
|
||||
|
||||
Browse available plugins:
|
||||
|
||||
```bash
|
||||
/plugin
|
||||
```
|
||||
|
||||
Install specific plugin:
|
||||
|
||||
```bash
|
||||
/plugin install [plugin-name]@[marketplace-name]
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
### First Steps
|
||||
|
||||
1. **Install Core Plugins**: Start with essential plugins for your workflow
|
||||
2. **Explore Skills**: Test different skills to understand their capabilities
|
||||
3. **Configure Settings**: Adjust plugin settings according to your needs
|
||||
4. **Read Documentation**: Review individual plugin and skill documentation
|
||||
|
||||
### Basic Workflow
|
||||
|
||||
```bash
|
||||
# 1. List available tools
|
||||
/help
|
||||
|
||||
# 2. Use a command from installed plugin
|
||||
/[plugin-command] [options]
|
||||
|
||||
# 3. Use a skill directly
|
||||
"Perform task using [skill-name]"
|
||||
|
||||
# 4. Check plugin status
|
||||
/plugin info [plugin-name]
|
||||
```
|
||||
|
||||
## Available Plugins
|
||||
|
||||
### [Plugin Name 1]
|
||||
|
||||
**Description**: [Detailed description]
|
||||
|
||||
**Commands**:
|
||||
|
||||
- `[command-1]`: [Description]
|
||||
- `[command-2]`: [Description]
|
||||
|
||||
**Examples**:
|
||||
|
||||
```bash
|
||||
/[command-1] --option value
|
||||
/[command-2] input.txt
|
||||
```
|
||||
|
||||
### [Plugin Name 2]
|
||||
|
||||
**Description**: [Detailed description]
|
||||
|
||||
**Commands**:
|
||||
|
||||
- `[command-1]`: [Description]
|
||||
- `[command-2]`: [Description]
|
||||
|
||||
**Examples**:
|
||||
|
||||
```bash
|
||||
/[command-1] --option value
|
||||
/[command-2] input.txt
|
||||
```
|
||||
|
||||
## Available Skills
|
||||
|
||||
### [Skill Name 1]
|
||||
|
||||
**Category**: [category]
|
||||
|
||||
**Description**: [Detailed description]
|
||||
|
||||
**When to Use**: [Usage scenarios]
|
||||
|
||||
**Examples**:
|
||||
|
||||
```bash
|
||||
"Use [skill-name] to [perform task]"
|
||||
"Process this file using [skill-name]"
|
||||
```
|
||||
|
||||
### [Skill Name 2]
|
||||
|
||||
**Category**: [category]
|
||||
|
||||
**Description**: [Detailed description]
|
||||
|
||||
**When to Use**: [Usage scenarios]
|
||||
|
||||
**Examples**:
|
||||
|
||||
```bash
|
||||
"Use [skill-name] to [perform task]"
|
||||
"Process this file using [skill-name]"
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### Example 1: [Task Name]
|
||||
|
||||
```bash
|
||||
# Step 1: Install required plugin
|
||||
/plugin install [plugin-name]@[marketplace-name]
|
||||
|
||||
# Step 2: Use the command
|
||||
/[command] [options] [input]
|
||||
|
||||
# Step 3: Use supporting skill
|
||||
"Complete the task using [skill-name]"
|
||||
```
|
||||
|
||||
### Example 2: [Task Name]
|
||||
|
||||
```bash
|
||||
# Step 1: Install multiple plugins
|
||||
/plugin install [plugin-1]@[marketplace-name]
|
||||
/plugin install [plugin-2]@[marketplace-name]
|
||||
|
||||
# Step 2: Combine commands
|
||||
/[command-1] [options]
|
||||
/[command-2] [options]
|
||||
|
||||
# Step 3: Use skill for final processing
|
||||
"Process results using [skill-name]"
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Plugin Settings
|
||||
|
||||
Most plugins support configuration through settings files or command-line options.
|
||||
|
||||
#### Configuration File Location
|
||||
|
||||
- **Global**: `~/.claude/settings.json`
|
||||
- **Project**: `.claude/settings.json`
|
||||
|
||||
#### Example Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": {
|
||||
"[plugin-name]": {
|
||||
"option1": "value1",
|
||||
"option2": "value2"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Skill Configuration
|
||||
|
||||
Skills can be configured through their SKILL.md files or at runtime.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
#### Plugin Installation Fails
|
||||
|
||||
**Problem**: Plugin won't install or shows errors
|
||||
|
||||
**Solution**:
|
||||
|
||||
```bash
|
||||
# Check marketplace connection
|
||||
/plugin marketplace list
|
||||
|
||||
# Update marketplace
|
||||
/plugin marketplace update [marketplace-name]
|
||||
|
||||
# Try alternative installation
|
||||
/plugin install [plugin-name]@[marketplace-name] --force
|
||||
```
|
||||
|
||||
#### Commands Not Available
|
||||
|
||||
**Problem**: Installed plugin commands don't appear in `/help`
|
||||
|
||||
**Solution**:
|
||||
|
||||
```bash
|
||||
# Check plugin status
|
||||
/plugin info [plugin-name]
|
||||
|
||||
# Restart Claude Code
|
||||
# Exit and restart Claude Code
|
||||
|
||||
# Verify installation
|
||||
/plugin list
|
||||
```
|
||||
|
||||
#### Skills Not Loading
|
||||
|
||||
**Problem**: Skills don't trigger or work correctly
|
||||
|
||||
**Solution**:
|
||||
|
||||
```bash
|
||||
# Check skill availability
|
||||
/skill-list
|
||||
|
||||
# Test skill manually
|
||||
"Test [skill-name] functionality"
|
||||
|
||||
# Check skill configuration
|
||||
/skill-info [skill-name]
|
||||
```
|
||||
|
||||
### Getting Help
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. **Check Documentation**: Review individual plugin/skill documentation
|
||||
2. **Search Issues**: Look for similar issues in GitHub repository
|
||||
3. **Ask Community**: Post questions in discussions or issues
|
||||
4. **Report Bugs**: Create detailed issue reports with reproduction steps
|
||||
|
||||
### Debug Mode
|
||||
|
||||
Enable debug mode for troubleshooting:
|
||||
|
||||
```bash
|
||||
claude --debug
|
||||
claude --verbose
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Plugin Usage
|
||||
|
||||
1. **Start Small**: Begin with essential plugins
|
||||
2. **Read Documentation**: Understand plugin capabilities before use
|
||||
3. **Test Incrementally**: Test plugins with small tasks first
|
||||
4. **Monitor Performance**: Watch for performance impacts
|
||||
|
||||
### Skill Usage
|
||||
|
||||
1. **Be Specific**: Provide clear instructions and context
|
||||
2. **Use Examples**: Include example inputs when asking for help
|
||||
3. **Iterate**: Refine requests based on results
|
||||
4. **Provide Feedback**: Report issues and suggest improvements
|
||||
|
||||
### Workspace Management
|
||||
|
||||
1. **Organize Projects**: Use dedicated directories for different projects
|
||||
2. **Clean Regularly**: Remove unused plugins and skills
|
||||
3. **Backup Configuration**: Save your settings and preferences
|
||||
4. **Update Regularly**: Keep plugins and marketplace updated
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Custom Workflows
|
||||
|
||||
Combine multiple plugins and skills for complex workflows:
|
||||
|
||||
```bash
|
||||
# Example: Document processing workflow
|
||||
/[plugin-1] extract-text document.pdf
|
||||
"Analyze extracted text using [skill-name]"
|
||||
/[plugin-2] format-output --type markdown
|
||||
```
|
||||
|
||||
### Script Integration
|
||||
|
||||
Integrate with external scripts and automation:
|
||||
|
||||
```bash
|
||||
# Example: Batch processing
|
||||
for file in *.txt; do
|
||||
claude "Process $file using [skill-name]"
|
||||
done
|
||||
```
|
||||
|
||||
### API Integration
|
||||
|
||||
Some plugins support API integration for external services:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": {
|
||||
"[plugin-name]": {
|
||||
"api_key": "your-api-key",
|
||||
"endpoint": "https://api.example.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Resources
|
||||
|
||||
- **Official Documentation**: [Link to docs]
|
||||
- **Community Forum**: [Link to forum]
|
||||
- **GitHub Repository**: [Link to repo]
|
||||
- **Video Tutorials**: [Link to videos]
|
||||
|
||||
---
|
||||
|
||||
_Last updated: [Date]_
|
||||
@@ -0,0 +1,352 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Marketplace Deployment Script
|
||||
* Handles deployment of marketplace plugins and updates
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
class MarketplaceDeployer {
|
||||
constructor(options = {}) {
|
||||
this.verbose = options.verbose || false;
|
||||
this.dryRun = options.dryRun || false;
|
||||
this.force = options.force || false;
|
||||
}
|
||||
|
||||
log(message, level = 'info') {
|
||||
if (this.verbose || level === 'error') {
|
||||
const timestamp = new Date().toISOString();
|
||||
console.log(`[${timestamp}] [${level.toUpperCase()}] ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute command safely
|
||||
*/
|
||||
async executeCommand(command, args = [], cwd = process.cwd()) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(command, args, {
|
||||
cwd,
|
||||
stdio: this.verbose ? 'inherit' : 'pipe',
|
||||
});
|
||||
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
|
||||
if (!this.verbose) {
|
||||
child.stdout?.on('data', data => {
|
||||
stdout += data.toString();
|
||||
});
|
||||
|
||||
child.stderr?.on('data', data => {
|
||||
stderr += data.toString();
|
||||
});
|
||||
}
|
||||
|
||||
child.on('close', code => {
|
||||
if (code === 0) {
|
||||
resolve({ stdout, stderr, code });
|
||||
} else {
|
||||
reject(new Error(`Command failed with code ${code}: ${stderr}`));
|
||||
}
|
||||
});
|
||||
|
||||
child.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate marketplace before deployment
|
||||
*/
|
||||
async validateBeforeDeploy(marketplacePath) {
|
||||
this.log('Validating marketplace before deployment...');
|
||||
|
||||
const validatorPath = path.join(__dirname, 'validate.js');
|
||||
|
||||
try {
|
||||
await this.executeCommand('node', [validatorPath, '--verbose'], marketplacePath);
|
||||
this.log('Marketplace validation passed');
|
||||
return true;
|
||||
} catch (error) {
|
||||
this.log(`Marketplace validation failed: ${error.message}`, 'error');
|
||||
|
||||
if (!this.force) {
|
||||
throw new Error('Deployment aborted due to validation failures. Use --force to override.');
|
||||
}
|
||||
|
||||
this.log('Proceeding with deployment despite validation failures (force mode)', 'warn');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current version from marketplace configuration
|
||||
*/
|
||||
getCurrentVersion(marketplacePath) {
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
throw new Error('Marketplace configuration not found');
|
||||
}
|
||||
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
return config.version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment version based on release type
|
||||
*/
|
||||
incrementVersion(version, type = 'patch') {
|
||||
const parts = version.split('.');
|
||||
|
||||
if (parts.length !== 3) {
|
||||
throw new Error(`Invalid version format: ${version}`);
|
||||
}
|
||||
|
||||
const [major, minor, patch] = parts.map(p => parseInt(p, 10));
|
||||
|
||||
switch (type) {
|
||||
case 'major':
|
||||
return `${major + 1}.0.0`;
|
||||
case 'minor':
|
||||
return `${major}.${minor + 1}.0`;
|
||||
case 'patch':
|
||||
return `${major}.${minor}.${patch + 1}`;
|
||||
default:
|
||||
throw new Error(`Invalid release type: ${type}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update marketplace version
|
||||
*/
|
||||
updateVersion(marketplacePath, newVersion) {
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
config.version = newVersion;
|
||||
config.updated = new Date().toISOString();
|
||||
|
||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||
this.log(`Updated marketplace version to: ${newVersion}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create git tag for release
|
||||
*/
|
||||
async createGitTag(marketplacePath, version) {
|
||||
this.log(`Creating git tag: v${version}`);
|
||||
|
||||
if (!this.dryRun) {
|
||||
try {
|
||||
await this.executeCommand('git', ['add', '.'], marketplacePath);
|
||||
await this.executeCommand('git', ['commit', '-m', `Release v${version}`], marketplacePath);
|
||||
await this.executeCommand(
|
||||
'git',
|
||||
['tag', `-a`, `v${version}`, '-m', `Release v${version}`],
|
||||
marketplacePath
|
||||
);
|
||||
this.log(`Git tag v${version} created successfully`);
|
||||
} catch (error) {
|
||||
this.log(`Failed to create git tag: ${error.message}`, 'error');
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
this.log(`[DRY RUN] Would create git tag: v${version}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Push to remote repository
|
||||
*/
|
||||
async pushToRemote(marketplacePath, version) {
|
||||
this.log('Pushing to remote repository...');
|
||||
|
||||
if (!this.dryRun) {
|
||||
try {
|
||||
await this.executeCommand('git', ['push', 'origin', 'main'], marketplacePath);
|
||||
await this.executeCommand('git', ['push', 'origin', `v${version}`], marketplacePath);
|
||||
this.log('Successfully pushed to remote repository');
|
||||
} catch (error) {
|
||||
this.log(`Failed to push to remote: ${error.message}`, 'error');
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
this.log('[DRY RUN] Would push to remote repository');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate release notes
|
||||
*/
|
||||
generateReleaseNotes(marketplacePath, version) {
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
const notes = [
|
||||
`# Release ${version}`,
|
||||
'',
|
||||
`## Changes`,
|
||||
'',
|
||||
`### Marketplace`,
|
||||
`- Updated marketplace configuration`,
|
||||
`- Version bump to ${version}`,
|
||||
'',
|
||||
`### Plugins`,
|
||||
`${config.plugins.length} plugins included`,
|
||||
'',
|
||||
`### Skills`,
|
||||
`${config.skills.length} skills included`,
|
||||
'',
|
||||
`## Installation`,
|
||||
'```bash',
|
||||
`/plugin marketplace add [repository-url]`,
|
||||
'```',
|
||||
'',
|
||||
`## Verification`,
|
||||
'```bash',
|
||||
`/plugin marketplace list`,
|
||||
`/plugin install [plugin-name]@[marketplace-name]`,
|
||||
'```',
|
||||
'',
|
||||
`---`,
|
||||
`*Released on ${new Date().toISOString().split('T')[0]}*`,
|
||||
];
|
||||
|
||||
const notesPath = path.join(marketplacePath, 'RELEASE_NOTES.md');
|
||||
fs.writeFileSync(notesPath, notes.join('\n'));
|
||||
|
||||
this.log(`Release notes generated: ${notesPath}`);
|
||||
return notesPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deploy marketplace
|
||||
*/
|
||||
async deploy(marketplacePath = './', options = {}) {
|
||||
const releaseType = options.type || 'patch';
|
||||
const skipValidation = options.skipValidation || false;
|
||||
const skipGit = options.skipGit || false;
|
||||
|
||||
console.log(`Starting marketplace deployment for: ${marketplacePath}`);
|
||||
console.log(`Release type: ${releaseType}`);
|
||||
console.log('='.repeat(50));
|
||||
|
||||
try {
|
||||
// Validate marketplace unless skipped
|
||||
if (!skipValidation) {
|
||||
await this.validateBeforeDeploy(marketplacePath);
|
||||
}
|
||||
|
||||
// Get current version
|
||||
const currentVersion = this.getCurrentVersion(marketplacePath);
|
||||
this.log(`Current version: ${currentVersion}`);
|
||||
|
||||
// Calculate new version
|
||||
const newVersion = this.incrementVersion(currentVersion, releaseType);
|
||||
this.log(`New version: ${newVersion}`);
|
||||
|
||||
// Update version in configuration
|
||||
this.updateVersion(marketplacePath, newVersion);
|
||||
|
||||
// Generate release notes
|
||||
const notesPath = this.generateReleaseNotes(marketplacePath, newVersion);
|
||||
|
||||
// Git operations unless skipped
|
||||
if (!skipGit) {
|
||||
await this.createGitTag(marketplacePath, newVersion);
|
||||
await this.pushToRemote(marketplacePath, newVersion);
|
||||
}
|
||||
|
||||
console.log('='.repeat(50));
|
||||
console.log('✅ Deployment completed successfully');
|
||||
console.log(`Version: ${newVersion}`);
|
||||
console.log(`Release notes: ${notesPath}`);
|
||||
|
||||
if (!skipGit) {
|
||||
console.log('Git tag created and pushed');
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
version: newVersion,
|
||||
notesPath,
|
||||
skipped: { validation: skipValidation, git: skipGit },
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('❌ Deployment failed:', error.message);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deploy individual plugin
|
||||
*/
|
||||
async deployPlugin(pluginPath, options = {}) {
|
||||
this.log(`Deploying plugin: ${pluginPath}`);
|
||||
|
||||
// Validate plugin structure
|
||||
const pluginJsonPath = path.join(pluginPath, '.claude-plugin', 'plugin.json');
|
||||
if (!fs.existsSync(pluginJsonPath)) {
|
||||
throw new Error('Plugin configuration not found');
|
||||
}
|
||||
|
||||
const pluginConfig = JSON.parse(fs.readFileSync(pluginJsonPath, 'utf8'));
|
||||
this.log(`Plugin: ${pluginConfig.name} v${pluginConfig.version}`);
|
||||
|
||||
// Implementation would depend on deployment target
|
||||
// This is a placeholder for actual plugin deployment logic
|
||||
|
||||
if (!this.dryRun) {
|
||||
// Add actual plugin deployment logic here
|
||||
// Could involve:
|
||||
// - Publishing to npm registry
|
||||
// - Creating GitHub release
|
||||
// - Uploading to plugin registry
|
||||
// etc.
|
||||
}
|
||||
|
||||
this.log(`Plugin deployment completed: ${pluginConfig.name}`);
|
||||
return { success: true, plugin: pluginConfig.name };
|
||||
}
|
||||
}
|
||||
|
||||
// CLI interface
|
||||
if (require.main === module) {
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const options = {
|
||||
verbose: args.includes('--verbose'),
|
||||
dryRun: args.includes('--dry-run'),
|
||||
force: args.includes('--force'),
|
||||
type: 'patch',
|
||||
skipValidation: args.includes('--skip-validation'),
|
||||
skipGit: args.includes('--skip-git'),
|
||||
};
|
||||
|
||||
// Parse release type
|
||||
const typeIndex = args.findIndex(arg => arg.startsWith('--type='));
|
||||
if (typeIndex !== -1) {
|
||||
options.type = args[typeIndex].split('=')[1];
|
||||
}
|
||||
|
||||
const marketplacePath = args.find(arg => !arg.startsWith('--')) || './';
|
||||
const deployer = new MarketplaceDeployer(options);
|
||||
|
||||
deployer
|
||||
.deploy(marketplacePath, options)
|
||||
.then(result => {
|
||||
console.log('\nDeployment summary:', result);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('\nDeployment failed:', error.message);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = MarketplaceDeployer;
|
||||
@@ -0,0 +1,391 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Marketplace Validation Script
|
||||
* Validates marketplace structure, configuration, and content
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
class MarketplaceValidator {
|
||||
constructor() {
|
||||
this.errors = [];
|
||||
this.warnings = [];
|
||||
this.info = [];
|
||||
}
|
||||
|
||||
log(message, type = 'info') {
|
||||
this[type].push(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate marketplace directory structure
|
||||
*/
|
||||
validateStructure(marketplacePath) {
|
||||
console.log('Validating marketplace structure...');
|
||||
|
||||
const requiredDirs = ['.claude-plugin'];
|
||||
const requiredFiles = ['.claude-plugin/marketplace.json'];
|
||||
const optionalDirs = ['plugins', 'skills', 'docs', 'tests', 'scripts', 'examples'];
|
||||
|
||||
// Check required directories
|
||||
requiredDirs.forEach(dir => {
|
||||
const dirPath = path.join(marketplacePath, dir);
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
this.log(`Required directory missing: ${dir}`, 'errors');
|
||||
} else {
|
||||
this.log(`Required directory found: ${dir}`, 'info');
|
||||
}
|
||||
});
|
||||
|
||||
// Check required files
|
||||
requiredFiles.forEach(file => {
|
||||
const filePath = path.join(marketplacePath, file);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
this.log(`Required file missing: ${file}`, 'errors');
|
||||
} else {
|
||||
this.log(`Required file found: ${file}`, 'info');
|
||||
}
|
||||
});
|
||||
|
||||
// Check optional directories
|
||||
optionalDirs.forEach(dir => {
|
||||
const dirPath = path.join(marketplacePath, dir);
|
||||
if (fs.existsSync(dirPath)) {
|
||||
this.log(`Optional directory found: ${dir}`, 'info');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate marketplace configuration
|
||||
*/
|
||||
validateConfiguration(marketplacePath) {
|
||||
console.log('Validating marketplace configuration...');
|
||||
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
this.log('Marketplace configuration file missing', 'errors');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
// Validate required fields
|
||||
const requiredFields = ['name', 'version', 'description', 'owner'];
|
||||
requiredFields.forEach(field => {
|
||||
if (!config[field]) {
|
||||
this.log(`Required configuration field missing: ${field}`, 'errors');
|
||||
} else {
|
||||
this.log(`Required field found: ${field}`, 'info');
|
||||
}
|
||||
});
|
||||
|
||||
// Validate version format
|
||||
if (config.version && !this.isValidVersion(config.version)) {
|
||||
this.log(`Invalid version format: ${config.version}`, 'errors');
|
||||
}
|
||||
|
||||
// Validate plugins array
|
||||
if (config.plugins) {
|
||||
if (!Array.isArray(config.plugins)) {
|
||||
this.log('Plugins field must be an array', 'errors');
|
||||
} else {
|
||||
this.log(`Found ${config.plugins.length} plugins in configuration`, 'info');
|
||||
}
|
||||
}
|
||||
|
||||
// Validate skills array
|
||||
if (config.skills) {
|
||||
if (!Array.isArray(config.skills)) {
|
||||
this.log('Skills field must be an array', 'errors');
|
||||
} else {
|
||||
this.log(`Found ${config.skills.length} skills in configuration`, 'info');
|
||||
}
|
||||
}
|
||||
|
||||
// Validate owner object
|
||||
if (config.owner) {
|
||||
const ownerFields = ['name', 'email'];
|
||||
ownerFields.forEach(field => {
|
||||
if (config.owner[field]) {
|
||||
this.log(`Owner ${field} found: ${config.owner[field]}`, 'info');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.log('Configuration file structure validated', 'info');
|
||||
} catch (error) {
|
||||
this.log(`Invalid JSON in configuration file: ${error.message}`, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate plugins
|
||||
*/
|
||||
validatePlugins(marketplacePath) {
|
||||
console.log('Validating plugins...');
|
||||
|
||||
const configPath = path.join(marketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
this.log('Cannot validate plugins - configuration file missing', 'warnings');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
if (!config.plugins || config.plugins.length === 0) {
|
||||
this.log('No plugins configured in marketplace', 'warnings');
|
||||
return;
|
||||
}
|
||||
|
||||
const pluginsDir = path.join(marketplacePath, 'plugins');
|
||||
|
||||
if (!fs.existsSync(pluginsDir)) {
|
||||
this.log('Plugins directory not found', 'warnings');
|
||||
return;
|
||||
}
|
||||
|
||||
for (const plugin of config.plugins) {
|
||||
this.validatePlugin(plugin, pluginsDir);
|
||||
}
|
||||
} catch (error) {
|
||||
this.log(`Error validating plugins: ${error.message}`, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate individual plugin
|
||||
*/
|
||||
validatePlugin(plugin, pluginsDir) {
|
||||
if (!plugin.name) {
|
||||
this.log('Plugin found without name in configuration', 'errors');
|
||||
return;
|
||||
}
|
||||
|
||||
const pluginPath = path.join(pluginsDir, plugin.name);
|
||||
if (!fs.existsSync(pluginPath)) {
|
||||
this.log(`Plugin directory not found: ${plugin.name}`, 'warnings');
|
||||
return;
|
||||
}
|
||||
|
||||
const pluginJsonPath = path.join(pluginPath, '.claude-plugin', 'plugin.json');
|
||||
if (!fs.existsSync(pluginJsonPath)) {
|
||||
this.log(`Plugin configuration missing: ${plugin.name}/plugin.json`, 'errors');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const pluginConfig = JSON.parse(fs.readFileSync(pluginJsonPath, 'utf8'));
|
||||
|
||||
// Validate plugin structure
|
||||
const requiredFields = ['name', 'version', 'description'];
|
||||
requiredFields.forEach(field => {
|
||||
if (!pluginConfig[field]) {
|
||||
this.log(`Plugin ${plugin.name}: Required field missing: ${field}`, 'errors');
|
||||
}
|
||||
});
|
||||
|
||||
this.log(`Plugin validated: ${plugin.name}`, 'info');
|
||||
} catch (error) {
|
||||
this.log(`Plugin ${plugin.name}: Invalid configuration - ${error.message}`, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate skills
|
||||
*/
|
||||
validateSkills(marketplacePath) {
|
||||
console.log('Validating skills...');
|
||||
|
||||
const skillsDir = path.join(marketplacePath, 'skills');
|
||||
|
||||
if (!fs.existsSync(skillsDir)) {
|
||||
this.log('Skills directory not found', 'warnings');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const skills = fs
|
||||
.readdirSync(skillsDir, { withFileTypes: true })
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => dirent.name);
|
||||
|
||||
if (skills.length === 0) {
|
||||
this.log('No skills found in marketplace', 'warnings');
|
||||
return;
|
||||
}
|
||||
|
||||
for (const skill of skills) {
|
||||
this.validateSkill(path.join(skillsDir, skill), skill);
|
||||
}
|
||||
} catch (error) {
|
||||
this.log(`Error validating skills: ${error.message}`, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate individual skill
|
||||
*/
|
||||
validateSkill(skillPath, skillName) {
|
||||
const skillMdPath = path.join(skillPath, 'SKILL.md');
|
||||
|
||||
if (!fs.existsSync(skillMdPath)) {
|
||||
this.log(`Skill SKILL.md missing: ${skillName}`, 'errors');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const content = fs.readFileSync(skillMdPath, 'utf8');
|
||||
|
||||
// Check for required frontmatter
|
||||
if (!content.includes('---')) {
|
||||
this.log(`Skill ${skillName}: Missing frontmatter`, 'errors');
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract and validate frontmatter
|
||||
const frontmatterMatch = content.match(/^---\n(.*?)\n---/s);
|
||||
if (frontmatterMatch) {
|
||||
try {
|
||||
const frontmatter = JSON.parse(frontmatterMatch[1].replace(/(\w+):/g, '"$1":'));
|
||||
|
||||
if (!frontmatter.name) {
|
||||
this.log(`Skill ${skillName}: Missing name in frontmatter`, 'errors');
|
||||
}
|
||||
|
||||
if (!frontmatter.description) {
|
||||
this.log(`Skill ${skillName}: Missing description in frontmatter`, 'warnings');
|
||||
}
|
||||
} catch (error) {
|
||||
this.log(`Skill ${skillName}: Invalid frontmatter format`, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
this.log(`Skill validated: ${skillName}`, 'info');
|
||||
} catch (error) {
|
||||
this.log(`Skill ${skillName}: Error reading file - ${error.message}`, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate documentation
|
||||
*/
|
||||
validateDocumentation(marketplacePath) {
|
||||
console.log('Validating documentation...');
|
||||
|
||||
const docsDir = path.join(marketplacePath, 'docs');
|
||||
|
||||
if (!fs.existsSync(docsDir)) {
|
||||
this.log('Documentation directory not found', 'warnings');
|
||||
return;
|
||||
}
|
||||
|
||||
const requiredDocs = ['README.md'];
|
||||
const recommendedDocs = ['GUIDE.md', 'CONTRIBUTING.md'];
|
||||
|
||||
// Check required documentation
|
||||
requiredDocs.forEach(doc => {
|
||||
const docPath = path.join(marketplacePath, doc);
|
||||
if (fs.existsSync(docPath)) {
|
||||
this.log(`Required documentation found: ${doc}`, 'info');
|
||||
} else {
|
||||
this.log(`Required documentation missing: ${doc}`, 'errors');
|
||||
}
|
||||
});
|
||||
|
||||
// Check recommended documentation
|
||||
recommendedDocs.forEach(doc => {
|
||||
const docPath = path.join(docsDir, doc);
|
||||
if (fs.existsSync(docPath)) {
|
||||
this.log(`Recommended documentation found: ${doc}`, 'info');
|
||||
} else {
|
||||
this.log(`Recommended documentation missing: ${doc}`, 'warnings');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if version string is valid
|
||||
*/
|
||||
isValidVersion(version) {
|
||||
return /^\d+\.\d+\.\d+(-.*)?$/.test(version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run complete validation
|
||||
*/
|
||||
async validate(marketplacePath = './') {
|
||||
console.log(`Starting marketplace validation for: ${marketplacePath}`);
|
||||
console.log('='.repeat(50));
|
||||
|
||||
// Check if marketplace exists
|
||||
if (!fs.existsSync(marketplacePath)) {
|
||||
console.error('Error: Marketplace directory does not exist');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Run all validations
|
||||
this.validateStructure(marketplacePath);
|
||||
this.validateConfiguration(marketplacePath);
|
||||
this.validatePlugins(marketplacePath);
|
||||
this.validateSkills(marketplacePath);
|
||||
this.validateDocumentation(marketplacePath);
|
||||
|
||||
// Report results
|
||||
console.log('='.repeat(50));
|
||||
console.log('Validation Results:');
|
||||
console.log(`Errors: ${this.errors.length}`);
|
||||
console.log(`Warnings: ${this.warnings.length}`);
|
||||
console.log(`Info: ${this.info.length}`);
|
||||
|
||||
if (this.errors.length > 0) {
|
||||
console.log('\nErrors:');
|
||||
this.errors.forEach(error => console.log(` ❌ ${error}`));
|
||||
}
|
||||
|
||||
if (this.warnings.length > 0) {
|
||||
console.log('\nWarnings:');
|
||||
this.warnings.forEach(warning => console.log(` ⚠️ ${warning}`));
|
||||
}
|
||||
|
||||
if (this.verbose && this.info.length > 0) {
|
||||
console.log('\nInfo:');
|
||||
this.info.forEach(info => console.log(` ℹ️ ${info}`));
|
||||
}
|
||||
|
||||
// Exit with appropriate code
|
||||
if (this.errors.length > 0) {
|
||||
console.log('\n❌ Validation failed with errors');
|
||||
process.exit(1);
|
||||
} else if (this.warnings.length > 0) {
|
||||
console.log('\n⚠️ Validation completed with warnings');
|
||||
process.exit(2);
|
||||
} else {
|
||||
console.log('\n✅ Validation passed successfully');
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CLI interface
|
||||
if (require.main === module) {
|
||||
const args = process.argv.slice(2);
|
||||
const marketplacePath = args[0] || './';
|
||||
const validator = new MarketplaceValidator();
|
||||
|
||||
// Check for verbose flag
|
||||
validator.verbose = args.includes('--verbose');
|
||||
|
||||
validator.validate(marketplacePath).catch(error => {
|
||||
console.error('Validation error:', error.message);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = MarketplaceValidator;
|
||||
484
skills/claude-code-marketplace/tests/marketplace.test.js
Normal file
484
skills/claude-code-marketplace/tests/marketplace.test.js
Normal file
@@ -0,0 +1,484 @@
|
||||
/**
|
||||
* Marketplace Test Suite
|
||||
* Comprehensive testing for marketplace functionality
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const MarketplaceManager = require('../scripts/marketplace-manager');
|
||||
|
||||
class MarketplaceTester {
|
||||
constructor() {
|
||||
this.testResults = {
|
||||
passed: 0,
|
||||
failed: 0,
|
||||
skipped: 0,
|
||||
total: 0,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a test case
|
||||
*/
|
||||
async runTest(testName, testFunction) {
|
||||
this.testResults.total++;
|
||||
console.log(`\n🧪 Running test: ${testName}`);
|
||||
|
||||
try {
|
||||
await testFunction();
|
||||
this.testResults.passed++;
|
||||
console.log(`✅ ${testName} - PASSED`);
|
||||
} catch (error) {
|
||||
this.testResults.failed++;
|
||||
console.log(`❌ ${testName} - FAILED`);
|
||||
console.log(` Error: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert a condition
|
||||
*/
|
||||
assert(condition, message) {
|
||||
if (!condition) {
|
||||
throw new Error(message || 'Assertion failed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that a file exists
|
||||
*/
|
||||
assertFileExists(filePath, message) {
|
||||
const exists = fs.existsSync(filePath);
|
||||
this.assert(exists, message || `File should exist: ${filePath}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that a directory exists
|
||||
*/
|
||||
assertDirExists(dirPath, message) {
|
||||
const exists = fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory();
|
||||
this.assert(exists, message || `Directory should exist: ${dirPath}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert JSON validity
|
||||
*/
|
||||
assertValidJson(jsonString, message) {
|
||||
try {
|
||||
JSON.parse(jsonString);
|
||||
} catch (error) {
|
||||
throw new Error(message || `Invalid JSON: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test marketplace creation
|
||||
*/
|
||||
async testMarketplaceCreation() {
|
||||
const testMarketplacePath = './test-marketplace';
|
||||
const manager = new MarketplaceManager({ dryRun: false });
|
||||
|
||||
// Clean up any existing test marketplace
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
try {
|
||||
// Create marketplace
|
||||
const result = await manager.createMarketplace('test-marketplace', {
|
||||
template: 'standard',
|
||||
path: testMarketplacePath,
|
||||
autoValidate: false,
|
||||
});
|
||||
|
||||
// Test marketplace structure
|
||||
this.assertDirExists(testMarketplacePath, 'Marketplace directory should be created');
|
||||
this.assertDirExists(
|
||||
path.join(testMarketplacePath, '.claude-plugin'),
|
||||
'Claude plugin directory should exist'
|
||||
);
|
||||
this.assertDirExists(
|
||||
path.join(testMarketplacePath, 'plugins'),
|
||||
'Plugins directory should exist'
|
||||
);
|
||||
this.assertDirExists(
|
||||
path.join(testMarketplacePath, 'skills'),
|
||||
'Skills directory should exist'
|
||||
);
|
||||
this.assertDirExists(path.join(testMarketplacePath, 'docs'), 'Docs directory should exist');
|
||||
this.assertDirExists(
|
||||
path.join(testMarketplacePath, 'scripts'),
|
||||
'Scripts directory should exist'
|
||||
);
|
||||
|
||||
// Test configuration files
|
||||
this.assertFileExists(
|
||||
path.join(testMarketplacePath, '.claude-plugin', 'marketplace.json'),
|
||||
'Marketplace configuration should exist'
|
||||
);
|
||||
|
||||
// Test marketplace.json content
|
||||
const configContent = fs.readFileSync(
|
||||
path.join(testMarketplacePath, '.claude-plugin', 'marketplace.json'),
|
||||
'utf8'
|
||||
);
|
||||
this.assertValidJson(configContent, 'Marketplace configuration should be valid JSON');
|
||||
|
||||
const config = JSON.parse(configContent);
|
||||
this.assert(config.name === 'test-marketplace', 'Marketplace name should be set correctly');
|
||||
this.assert(config.version === '1.0.0', 'Marketplace version should be 1.0.0');
|
||||
this.assert(config.description, 'Marketplace should have a description');
|
||||
this.assert(config.owner, 'Marketplace should have owner information');
|
||||
this.assert(Array.isArray(config.plugins), 'Plugins should be an array');
|
||||
this.assert(Array.isArray(config.skills), 'Skills should be an array');
|
||||
|
||||
// Test template files
|
||||
this.assertFileExists(
|
||||
path.join(testMarketplacePath, 'README.md'),
|
||||
'README.md should be created from template'
|
||||
);
|
||||
|
||||
this.assertFileExists(
|
||||
path.join(testMarketplacePath, 'scripts', 'validate.js'),
|
||||
'Validation script should be created from template'
|
||||
);
|
||||
|
||||
this.assertFileExists(
|
||||
path.join(testMarketplacePath, 'scripts', 'deploy.js'),
|
||||
'Deployment script should be created from template'
|
||||
);
|
||||
} finally {
|
||||
// Clean up test marketplace
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test marketplace validation
|
||||
*/
|
||||
async testMarketplaceValidation() {
|
||||
const testMarketplacePath = './test-validation-marketplace';
|
||||
const manager = new MarketplaceManager({ dryRun: false });
|
||||
|
||||
// Clean up any existing test marketplace
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
try {
|
||||
// Create marketplace for testing
|
||||
await manager.createMarketplace('test-validation-marketplace', {
|
||||
template: 'minimal',
|
||||
path: testMarketplacePath,
|
||||
autoValidate: false,
|
||||
});
|
||||
|
||||
// Test validation of valid marketplace
|
||||
const validationResult = await manager.validateMarketplace(testMarketplacePath);
|
||||
this.assert(validationResult, 'Validation should return a result object');
|
||||
this.assert(
|
||||
typeof validationResult.success === 'boolean',
|
||||
'Validation result should have success property'
|
||||
);
|
||||
this.assert(
|
||||
Array.isArray(validationResult.errors),
|
||||
'Validation result should have errors array'
|
||||
);
|
||||
this.assert(
|
||||
Array.isArray(validationResult.warnings),
|
||||
'Validation result should have warnings array'
|
||||
);
|
||||
this.assert(Array.isArray(validationResult.info), 'Validation result should have info array');
|
||||
|
||||
// Test validation of non-existent marketplace
|
||||
const nonExistentResult = await manager.validateMarketplace('./non-existent-marketplace');
|
||||
this.assert(
|
||||
!nonExistentResult.success,
|
||||
'Validation should fail for non-existent marketplace'
|
||||
);
|
||||
this.assert(
|
||||
nonExistentResult.errors.length > 0,
|
||||
'Validation should have errors for non-existent marketplace'
|
||||
);
|
||||
|
||||
// Test validation with invalid configuration
|
||||
const configPath = path.join(testMarketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
const originalConfig = fs.readFileSync(configPath, 'utf8');
|
||||
|
||||
// Write invalid JSON
|
||||
fs.writeFileSync(configPath, '{ invalid json }');
|
||||
const invalidConfigResult = await manager.validateMarketplace(testMarketplacePath);
|
||||
this.assert(!invalidConfigResult.success, 'Validation should fail for invalid JSON');
|
||||
this.assert(
|
||||
invalidConfigResult.errors.some(err => err.includes('Invalid JSON')),
|
||||
'Validation should report JSON error'
|
||||
);
|
||||
|
||||
// Restore valid configuration
|
||||
fs.writeFileSync(configPath, originalConfig);
|
||||
} finally {
|
||||
// Clean up test marketplace
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test template types
|
||||
*/
|
||||
async testTemplateTypes() {
|
||||
const templates = ['standard', 'minimal', 'community', 'enterprise'];
|
||||
const manager = new MarketplaceManager({ dryRun: false });
|
||||
|
||||
for (const template of templates) {
|
||||
const testMarketplacePath = `./test-${template}-marketplace`;
|
||||
|
||||
// Clean up any existing test marketplace
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
try {
|
||||
// Create marketplace with specific template
|
||||
await manager.createMarketplace(`test-${template}`, {
|
||||
template: template,
|
||||
path: testMarketplacePath,
|
||||
autoValidate: false,
|
||||
});
|
||||
|
||||
// Test template-specific files
|
||||
const configPath = path.join(testMarketplacePath, '.claude-plugin', 'marketplace.json');
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
this.assert(config.template === template, `Template should be set to ${template}`);
|
||||
|
||||
// Test template-specific validation config
|
||||
this.assert(config.validation, 'Marketplace should have validation configuration');
|
||||
this.assert(config.validation.level, 'Validation should have a level');
|
||||
|
||||
// Template-specific checks
|
||||
switch (template) {
|
||||
case 'enterprise':
|
||||
this.assert(
|
||||
config.validation.checks.includes('security'),
|
||||
'Enterprise template should include security checks'
|
||||
);
|
||||
this.assert(
|
||||
config.validation.checks.includes('compliance'),
|
||||
'Enterprise template should include compliance checks'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'community':
|
||||
this.assert(
|
||||
config.validation.checks.includes('documentation'),
|
||||
'Community template should include documentation checks'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'minimal':
|
||||
this.assert(
|
||||
config.validation.checks.length <= 2,
|
||||
'Minimal template should have minimal validation checks'
|
||||
);
|
||||
break;
|
||||
}
|
||||
} finally {
|
||||
// Clean up test marketplace
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test health analysis
|
||||
*/
|
||||
async testHealthAnalysis() {
|
||||
const testMarketplacePath = './test-health-marketplace';
|
||||
const manager = new MarketplaceManager({ dryRun: false });
|
||||
|
||||
// Clean up any existing test marketplace
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
try {
|
||||
// Create marketplace
|
||||
await manager.createMarketplace('test-health-marketplace', {
|
||||
template: 'standard',
|
||||
path: testMarketplacePath,
|
||||
autoValidate: false,
|
||||
});
|
||||
|
||||
// Test health analysis
|
||||
const healthAnalysis = await manager.analyzeMarketplaceHealth(testMarketplacePath);
|
||||
|
||||
this.assert(healthAnalysis, 'Health analysis should return a result object');
|
||||
this.assert(
|
||||
typeof healthAnalysis.overall_score === 'number',
|
||||
'Overall score should be a number'
|
||||
);
|
||||
this.assert(
|
||||
healthAnalysis.overall_score >= 0 && healthAnalysis.overall_score <= 100,
|
||||
'Overall score should be between 0 and 100'
|
||||
);
|
||||
|
||||
this.assert(
|
||||
typeof healthAnalysis.structure_score === 'number',
|
||||
'Structure score should be a number'
|
||||
);
|
||||
this.assert(
|
||||
typeof healthAnalysis.configuration_score === 'number',
|
||||
'Configuration score should be a number'
|
||||
);
|
||||
this.assert(
|
||||
typeof healthAnalysis.plugin_score === 'number',
|
||||
'Plugin score should be a number'
|
||||
);
|
||||
this.assert(
|
||||
typeof healthAnalysis.documentation_score === 'number',
|
||||
'Documentation score should be a number'
|
||||
);
|
||||
|
||||
this.assert(
|
||||
Array.isArray(healthAnalysis.recommendations),
|
||||
'Recommendations should be an array'
|
||||
);
|
||||
this.assert(typeof healthAnalysis.metrics === 'object', 'Metrics should be an object');
|
||||
|
||||
// Test metrics
|
||||
this.assert(
|
||||
typeof healthAnalysis.metrics.plugin_count === 'number',
|
||||
'Plugin count should be a number'
|
||||
);
|
||||
this.assert(
|
||||
typeof healthAnalysis.metrics.skill_count === 'number',
|
||||
'Skill count should be a number'
|
||||
);
|
||||
this.assert(
|
||||
typeof healthAnalysis.metrics.total_size === 'number',
|
||||
'Total size should be a number'
|
||||
);
|
||||
} finally {
|
||||
// Clean up test marketplace
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test error handling
|
||||
*/
|
||||
async testErrorHandling() {
|
||||
const manager = new MarketplaceManager({ dryRun: false });
|
||||
|
||||
// Test creation with invalid name
|
||||
try {
|
||||
await manager.createMarketplace('', { path: './test-invalid' });
|
||||
this.assert(false, 'Should throw error for empty marketplace name');
|
||||
} catch (error) {
|
||||
this.assert(error.message.includes('name'), 'Error should mention name issue');
|
||||
}
|
||||
|
||||
// Test validation of non-existent path
|
||||
const nonExistentResult = await manager.validateMarketplace('./definitely-does-not-exist');
|
||||
this.assert(!nonExistentResult.success, 'Validation should fail for non-existent path');
|
||||
this.assert(nonExistentResult.errors.length > 0, 'Should have errors for non-existent path');
|
||||
|
||||
// Test deployment without plugins
|
||||
const testMarketplacePath = './test-deploy-marketplace';
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
try {
|
||||
await manager.createMarketplace('test-deploy', {
|
||||
template: 'minimal',
|
||||
path: testMarketplacePath,
|
||||
autoValidate: false,
|
||||
});
|
||||
|
||||
// Try to deploy (should work but with warnings)
|
||||
const deployResult = await manager.deployMarketplace(testMarketplacePath);
|
||||
this.assert(deployResult, 'Deployment should return a result object');
|
||||
this.assert(Array.isArray(deployResult.deployed), 'Should have deployed array');
|
||||
this.assert(Array.isArray(deployResult.failed), 'Should have failed array');
|
||||
this.assert(Array.isArray(deployResult.skipped), 'Should have skipped array');
|
||||
} finally {
|
||||
if (fs.existsSync(testMarketplacePath)) {
|
||||
fs.rmSync(testMarketplacePath, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run all tests
|
||||
*/
|
||||
async runAllTests() {
|
||||
console.log('🚀 Starting Marketplace Test Suite');
|
||||
console.log('='.repeat(50));
|
||||
|
||||
await this.runTest('Marketplace Creation', () => this.testMarketplaceCreation());
|
||||
await this.runTest('Marketplace Validation', () => this.testMarketplaceValidation());
|
||||
await this.runTest('Template Types', () => this.testTemplateTypes());
|
||||
await this.runTest('Health Analysis', () => this.testHealthAnalysis());
|
||||
await this.runTest('Error Handling', () => this.testErrorHandling());
|
||||
|
||||
// Print summary
|
||||
console.log('\n' + '='.repeat(50));
|
||||
console.log('📊 Test Results Summary:');
|
||||
console.log(`Total tests: ${this.testResults.total}`);
|
||||
console.log(`Passed: ${this.testResults.passed} ✅`);
|
||||
console.log(`Failed: ${this.testResults.failed} ❌`);
|
||||
console.log(`Skipped: ${this.testResults.skipped} ⏭️`);
|
||||
|
||||
if (this.testResults.failed === 0) {
|
||||
console.log('\n🎉 All tests passed! Marketplace functionality is working correctly.');
|
||||
process.exit(0);
|
||||
} else {
|
||||
console.log(
|
||||
`\n💥 ${this.testResults.failed} test(s) failed. Please review the errors above.`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CLI interface
|
||||
if (require.main === module) {
|
||||
const tester = new MarketplaceTester();
|
||||
|
||||
// Parse command line arguments
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
if (args.includes('--help') || args.includes('-h')) {
|
||||
console.log('Marketplace Test Suite');
|
||||
console.log('');
|
||||
console.log('Usage: node marketplace.test.js [options]');
|
||||
console.log('');
|
||||
console.log('Options:');
|
||||
console.log(' --help, -h Show this help message');
|
||||
console.log(' --verbose, -v Enable verbose output');
|
||||
console.log('');
|
||||
console.log('Tests:');
|
||||
console.log(' - Marketplace creation');
|
||||
console.log(' - Marketplace validation');
|
||||
console.log(' - Template types');
|
||||
console.log(' - Health analysis');
|
||||
console.log(' - Error handling');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Run tests
|
||||
tester.runAllTests().catch(error => {
|
||||
console.error('Test suite failed:', error.message);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = MarketplaceTester;
|
||||
Reference in New Issue
Block a user