Skip to content

Commit 440e59c

Browse files
committed
chore: AI rules
1 parent 8d0a17e commit 440e59c

9 files changed

Lines changed: 1033 additions & 0 deletions
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
# GitHub Action Inputs and Configuration
7+
8+
## Action Metadata
9+
The action configuration is defined in [action.yml](mdc:action.yml) with the following key properties:
10+
- **Name**: 'SettleMint CLI Action'
11+
- **Runtime**: Node.js 20
12+
- **Main Entry**: `dist/index.js`
13+
- **Branding**: Terminal icon with blue color
14+
15+
## Required Inputs
16+
17+
### `access-token`
18+
- **Description**: SettleMint Access Token (personal or application)
19+
- **Required**: Only when not in standalone mode
20+
- **Security**: Automatically masked in outputs
21+
- **Types**:
22+
- Personal tokens: Start with `sm_pat_` → Sets `SETTLEMINT_PERSONAL_ACCESS_TOKEN`
23+
- Application tokens: Other formats → Sets `SETTLEMINT_ACCESS_TOKEN`
24+
25+
## Optional Inputs
26+
27+
### Core Configuration
28+
- **`command`**: SettleMint CLI command to execute
29+
- **`version`**: CLI version to install (default: 'latest')
30+
- **`auto-connect`**: Automatically connect to SettleMint (default: 'true')
31+
- **`instance`**: SettleMint instance URL (default: 'https://console.settlemint.com')
32+
33+
### SettleMint Resource Identifiers
34+
All of these inputs are converted to environment variables with `SETTLEMINT_` prefix:
35+
- **`workspace`** → `SETTLEMINT_WORKSPACE`
36+
- **`application`** → `SETTLEMINT_APPLICATION`
37+
- **`blockchain-network`** → `SETTLEMINT_BLOCKCHAIN_NETWORK`
38+
- **`blockchain-node`** → `SETTLEMINT_BLOCKCHAIN_NODE`
39+
- **`load-balancer`** → `SETTLEMINT_LOAD_BALANCER`
40+
- **`hasura`** → `SETTLEMINT_HASURA`
41+
- **`thegraph`** → `SETTLEMINT_THEGRAPH`
42+
- **`portal`** → `SETTLEMINT_PORTAL`
43+
- **`hd-private-key`** → `SETTLEMINT_HD_PRIVATE_KEY`
44+
- **`minio`** → `SETTLEMINT_MINIO`
45+
- **`ipfs`** → `SETTLEMINT_IPFS`
46+
- **`custom-deployment`** → `SETTLEMINT_CUSTOM_DEPLOYMENT`
47+
- **`blockscout`** → `SETTLEMINT_BLOCKSCOUT`
48+
49+
### Environment File Processing
50+
- **`dotEnvFile`**: GitHub Actions secret containing .env file content
51+
- **`dotEnvLocalFile`**: GitHub Actions secret containing .env.local file content
52+
53+
Both are processed by the `processEnvContent()` function in [src/main.ts](mdc:src/main.ts) which:
54+
- Parses key=value pairs
55+
- Removes comments and empty lines
56+
- Handles quoted values
57+
- Sanitizes input before setting environment variables
58+
59+
## Usage Patterns
60+
61+
### Basic Usage
62+
```yaml
63+
- uses: settlemint/settlemint-action@v1
64+
with:
65+
access-token: ${{ secrets.SETTLEMINT_TOKEN }}
66+
command: 'deploy --help'
67+
```
68+
69+
### With Environment Variables
70+
```yaml
71+
- uses: settlemint/settlemint-action@v1
72+
with:
73+
access-token: ${{ secrets.SETTLEMINT_TOKEN }}
74+
workspace: 'my-workspace'
75+
application: 'my-app'
76+
command: 'deploy'
77+
```
78+
79+
### With Environment Files
80+
```yaml
81+
- uses: settlemint/settlemint-action@v1
82+
with:
83+
access-token: ${{ secrets.SETTLEMINT_TOKEN }}
84+
dotEnvFile: ${{ secrets.DOT_ENV }}
85+
command: 'deploy'
86+
```
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
# Deployment and Release Process
7+
8+
## Release Strategy
9+
10+
### Versioning
11+
- **Semantic Versioning**: Follow semver (MAJOR.MINOR.PATCH)
12+
- **Current Version**: Defined in [package.json](mdc:package.json)
13+
- **Git Tags**: Each release creates a corresponding git tag
14+
- **Branch Strategy**: Releases from `main` branch
15+
16+
### Release Types
17+
- **Major**: Breaking changes to action inputs/outputs
18+
- **Minor**: New features, additional inputs, enhanced functionality
19+
- **Patch**: Bug fixes, security updates, performance improvements
20+
21+
## Build Process
22+
23+
### Pre-Release Checklist
24+
1. **Code Quality**: All linting and formatting passes
25+
2. **Tests**: 100% test suite passes with >90% coverage
26+
3. **Build**: Clean build with `npm run all`
27+
4. **Documentation**: README and examples updated
28+
5. **Security**: Security review completed
29+
30+
### Build Pipeline
31+
```bash
32+
npm run all # Complete build pipeline:
33+
# 1. npm run format - Format code with Biome
34+
# 2. npm run lint - Lint and fix issues
35+
# 3. npm run test - Run test suite
36+
# 4. npm run coverage - Generate coverage reports
37+
# 5. npm run package - Build distribution files
38+
```
39+
40+
### Distribution Files
41+
- **Main Entry**: `dist/index.js` - Bundled action entry point
42+
- **Source Maps**: `dist/index.js.map` - For debugging
43+
- **Licenses**: `dist/licenses.txt` - All dependency licenses
44+
- **Commit Requirement**: All dist files must be committed
45+
46+
## GitHub Actions Integration
47+
48+
### Action Metadata
49+
Defined in [action.yml](mdc:action.yml):
50+
- **Runtime**: `node20` - Node.js 20 runtime
51+
- **Entry Point**: `dist/index.js`
52+
- **Branding**: Terminal icon, blue color
53+
- **Inputs**: All supported action inputs with descriptions
54+
55+
### Marketplace Publishing
56+
- **Automatic**: Releases trigger marketplace updates
57+
- **Visibility**: Public action available to all GitHub users
58+
- **Categories**: Tagged with relevant marketplace categories
59+
- **Documentation**: README serves as marketplace documentation
60+
61+
## Dependency Management
62+
63+
### Renovate Configuration
64+
Configured in [.github/renovate.json](mdc:.github/renovate.json):
65+
- **Auto-merge**: Minor and patch updates
66+
- **Post-update**: Runs `npm run package` after dependency updates
67+
- **Schedule**: Regular dependency updates
68+
- **Security**: Immediate security updates
69+
70+
### Dependency Strategy
71+
- **Production Dependencies**: Minimal, security-focused
72+
- **Development Dependencies**: Latest stable versions
73+
- **Lock File**: `package-lock.json` committed for reproducible builds
74+
- **Overrides**: Security overrides for vulnerable dependencies
75+
76+
## Release Automation
77+
78+
### GitHub Workflows
79+
Located in `.github/workflows/`:
80+
- **CI/CD**: Automated testing and building
81+
- **Release**: Automated release process
82+
- **Security**: Dependency scanning and security checks
83+
84+
### Release Process
85+
1. **Version Bump**: Update version in package.json
86+
2. **Changelog**: Update CHANGELOG.md with changes
87+
3. **Build**: Run complete build pipeline
88+
4. **Commit**: Commit all changes including dist files
89+
5. **Tag**: Create git tag with version
90+
6. **Push**: Push to main branch
91+
7. **Release**: GitHub automatically creates release
92+
93+
## Quality Gates
94+
95+
### Pre-Release Validation
96+
- **Linting**: Biome linting passes
97+
- **Type Checking**: TypeScript compilation succeeds
98+
- **Testing**: All tests pass with coverage requirements
99+
- **Security**: No known vulnerabilities
100+
- **Build**: Clean build without errors
101+
102+
### Post-Release Validation
103+
- **Marketplace**: Action appears in GitHub Marketplace
104+
- **Functionality**: Basic smoke tests pass
105+
- **Documentation**: Examples work as documented
106+
- **Compatibility**: Works with supported Node.js versions
107+
108+
## Rollback Strategy
109+
110+
### Version Management
111+
- **Git Tags**: Enable easy rollback to previous versions
112+
- **Branch Protection**: Prevent direct pushes to main
113+
- **Release Notes**: Clear documentation of changes
114+
- **Breaking Changes**: Clearly marked and documented
115+
116+
### Emergency Procedures
117+
1. **Identify Issue**: Determine scope and impact
118+
2. **Quick Fix**: If possible, create hotfix
119+
3. **Rollback**: Revert to previous stable version
120+
4. **Communication**: Notify users of issues and resolution
121+
5. **Post-Mortem**: Analyze and prevent future issues
122+
123+
## Documentation Updates
124+
125+
### Release Documentation
126+
- **README**: Keep examples and usage current
127+
- **CHANGELOG**: Document all changes
128+
- **Migration Guides**: For breaking changes
129+
- **Examples**: Update workflow examples
130+
131+
### User Communication
132+
- **Release Notes**: Clear, user-focused descriptions
133+
- **Breaking Changes**: Prominent warnings and migration paths
134+
- **New Features**: Usage examples and benefits
135+
- **Bug Fixes**: Impact and resolution details
136+
137+
## Monitoring and Feedback
138+
139+
### Usage Analytics
140+
- **GitHub Insights**: Monitor action usage
141+
- **Error Tracking**: Monitor failure rates
142+
- **Performance**: Track execution times
143+
- **Feedback**: User issues and feature requests
144+
145+
### Continuous Improvement
146+
- **User Feedback**: Regular review of issues and discussions
147+
- **Performance Metrics**: Monitor and optimize execution time
148+
- **Security Updates**: Regular security reviews and updates
149+
- **Feature Development**: Based on user needs and feedback
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
# Development Guidelines
7+
8+
## Code Standards
9+
10+
### TypeScript Configuration
11+
- Use strict TypeScript settings as defined in [tsconfig.json](mdc:tsconfig.json)
12+
- Enable all strict type checking options
13+
- Target ES2022 for modern JavaScript features
14+
- Use Node.js module resolution
15+
16+
### Code Formatting and Linting
17+
- Use Biome for both formatting and linting (configured in [biome.json](mdc:biome.json))
18+
- Run `npm run format` to format code
19+
- Run `npm run lint` to lint and auto-fix issues
20+
- All code must pass linting before commits
21+
22+
### Security Best Practices
23+
- Always sanitize user inputs using the `sanitizeInput()` function in [src/main.ts](mdc:src/main.ts)
24+
- Validate command arguments to prevent injection attacks
25+
- Use `core.setSecret()` for sensitive values like tokens
26+
- Mask sensitive patterns in outputs
27+
28+
## Testing Requirements
29+
30+
### Test Structure
31+
- Tests are located in [__tests__/](mdc:__tests__)
32+
- Use Jest as the testing framework
33+
- Maintain comprehensive test coverage (aim for >90%)
34+
- Test files should mirror the source structure
35+
36+
### Test Commands
37+
- `npm test` - Run all tests
38+
- `npm run ci-test` - Run tests in CI mode
39+
- `npm run coverage` - Generate coverage reports and badges
40+
41+
### Test Guidelines
42+
- Mock external dependencies (@actions/core, @actions/exec, etc.)
43+
- Test both success and error scenarios
44+
- Validate input sanitization and security measures
45+
- Test environment variable processing
46+
47+
## Build Process
48+
49+
### Development Workflow
50+
1. Make changes to TypeScript files in `src/`
51+
2. Run `npm run format` and `npm run lint`
52+
3. Run `npm test` to ensure tests pass
53+
4. Run `npm run package` to build distribution files
54+
5. Commit both source and built files
55+
56+
### Build Commands
57+
- `npm run package` - Build distribution files using ncc
58+
- `npm run package:watch` - Build in watch mode for development
59+
- `npm run bundle` - Format and package in one command
60+
- `npm run all` - Complete build pipeline (format, lint, test, coverage, package)
61+
62+
### Distribution
63+
- Built files go in `dist/` directory
64+
- Main entry point is `dist/index.js`
65+
- Source maps and licenses are included
66+
- Always commit built files for GitHub Actions to work

0 commit comments

Comments
 (0)