mirror of
https://github.com/pnpm/action-setup.git
synced 2026-03-04 08:01:02 +08:00
* chore: add alignment standards for github config - Add .nvmrc file with Node.js 22 - Add PR template for consistent pull requests - Add issue templates for bug reports, feature requests, and tasks - Add standard labels via gh CLI (type, priority, status, area labels) * fix: resolve form-data security vulnerability Add pnpm override to force form-data>=4.0.4 which fixes GHSA-fjxv-7rqg-78g4 (unsafe random function for boundary). * chore: add .claude/settings.local.json to gitignore * feat: Add claude commands * fix: update pnpm version to 10.27.0 (valid release) * fix: update pnpm version from 9 to 10 in all workflows Update all workflow files to use pnpm version 10 to match the packageManager field in package.json (pnpm@10.27.0). This fixes the CI failure caused by version mismatch: - pr-check.yml: version 9 → 10, matrix 9.15.5 → 10.27.0 - build-and-test.yml: version 9 → 10 - security.yml: version 9 → 10 - test.yaml: all version references updated to 10.27.0 * fix: remove packageManager field to allow testing multiple pnpm versions The action tests multiple pnpm versions (9.x and 10.x). Having a packageManager field in package.json causes version mismatch errors when the workflow specifies a different version than packageManager. * fix: use exact pnpm version 10.27.0 in workflows The action validates that the version specified in workflows must match the packageManager field in package.json exactly. Update from version: 10 to version: 10.27.0 to match pnpm@10.27.0. * fix: use local action in ci.yml with explicit version Since packageManager was removed from package.json to allow testing multiple pnpm versions, ci.yml must now specify the version explicitly. Changed from using released @v4.0.0 to using ./ (local action) to test the current code. * fix: rename claude commands to use Windows-compatible filenames Windows doesn't allow colons in filenames. Changed from using colons (agents:action.md) to hyphens (agents-action.md) for cross-platform compatibility.
212 lines
3.5 KiB
Markdown
212 lines
3.5 KiB
Markdown
# Quick: Fix
|
|
|
|
Automatically fix common code quality issues.
|
|
|
|
## What This Does
|
|
|
|
Runs automated fixes for linting, formatting, and other auto-correctable issues in the action codebase.
|
|
|
|
## Fixes Applied
|
|
|
|
### 1. Code Formatting
|
|
|
|
If Prettier is configured:
|
|
```bash
|
|
pnpm exec prettier --write "src/**/*.ts"
|
|
```
|
|
|
|
Fixes:
|
|
- Indentation
|
|
- Semicolons
|
|
- Quotes
|
|
- Line length
|
|
- Trailing commas
|
|
|
|
### 2. Import Organization
|
|
|
|
If available:
|
|
```bash
|
|
pnpm exec organize-imports-cli "src/**/*.ts"
|
|
```
|
|
|
|
Fixes:
|
|
- Unused imports
|
|
- Import order
|
|
- Missing imports
|
|
|
|
### 3. Lint Auto-Fix
|
|
|
|
If ESLint is configured:
|
|
```bash
|
|
pnpm exec eslint --fix "src/**/*.ts"
|
|
```
|
|
|
|
Fixes:
|
|
- Code style issues
|
|
- Simple violations
|
|
- Formatting issues
|
|
|
|
### 4. Build Artifacts
|
|
|
|
Regenerate distribution files:
|
|
```bash
|
|
pnpm run build
|
|
```
|
|
|
|
Updates:
|
|
- dist/index.js
|
|
- Type declarations
|
|
- Bundled output
|
|
|
|
## Usage
|
|
|
|
Just ask:
|
|
- "Fix code issues"
|
|
- "Auto-fix the code"
|
|
- "Clean up the codebase"
|
|
|
|
## Output Format
|
|
|
|
```
|
|
=== Auto-Fix Results ===
|
|
|
|
[✓] Formatting: 5 files formatted
|
|
[✓] Imports: 3 files updated
|
|
[✓] Lint: 12 issues fixed
|
|
[✓] Build: dist/index.js updated
|
|
|
|
All auto-fixes applied successfully!
|
|
```
|
|
|
|
## What Gets Fixed
|
|
|
|
### Auto-Fixable Issues
|
|
|
|
- Formatting inconsistencies
|
|
- Missing semicolons
|
|
- Quote style (single vs double)
|
|
- Indentation
|
|
- Trailing whitespace
|
|
- Import ordering
|
|
- Unused imports
|
|
- Simple lint violations
|
|
|
|
### Not Auto-Fixable
|
|
|
|
- Type errors
|
|
- Logic bugs
|
|
- Test failures
|
|
- Breaking changes
|
|
- Security issues
|
|
|
|
## After Running Fix
|
|
|
|
1. **Review changes**
|
|
```bash
|
|
git diff
|
|
```
|
|
|
|
2. **Run checks**
|
|
```bash
|
|
quick:check
|
|
```
|
|
|
|
3. **Run tests**
|
|
```bash
|
|
pnpm test
|
|
```
|
|
|
|
4. **Commit if satisfied**
|
|
```bash
|
|
git add .
|
|
git commit -m "fix: auto-fix code quality issues"
|
|
```
|
|
|
|
## Manual Fixes Required
|
|
|
|
If auto-fix reports issues it can't fix:
|
|
|
|
### TypeScript Errors
|
|
- Review tsc output
|
|
- Fix type issues manually
|
|
- Consult TypeScript docs
|
|
|
|
### Test Failures
|
|
- Debug failing tests
|
|
- Fix implementation
|
|
- Update test expectations
|
|
|
|
### Complex Lint Issues
|
|
- Review ESLint output
|
|
- Fix violations manually
|
|
- Add eslint-disable if justified
|
|
|
|
## Configuration Files
|
|
|
|
This command respects:
|
|
- `.prettierrc` - Formatting rules
|
|
- `.eslintrc` - Lint rules
|
|
- `tsconfig.json` - TypeScript config
|
|
|
|
## Safety
|
|
|
|
Auto-fix is safe because:
|
|
- Only applies approved transformations
|
|
- Doesn't change logic
|
|
- Can be reviewed in git diff
|
|
- Can be reverted if needed
|
|
|
|
## When to Use
|
|
|
|
Good times to use quick:fix:
|
|
- After code review
|
|
- Before committing
|
|
- After merge conflicts
|
|
- When onboarding code
|
|
- After dependency updates
|
|
|
|
## Implementation
|
|
|
|
This command runs:
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
echo "=== Auto-Fix Results ==="
|
|
echo ""
|
|
|
|
# Check if prettier exists
|
|
if command -v prettier &> /dev/null; then
|
|
echo -n "[...] Formatting: "
|
|
FILES=$(pnpm exec prettier --write "src/**/*.ts" 2>&1 | grep -c "^" || echo "0")
|
|
echo "✓ $FILES files formatted"
|
|
fi
|
|
|
|
# Check if eslint exists
|
|
if [ -f ".eslintrc" ] || [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ]; then
|
|
echo -n "[...] Lint: "
|
|
pnpm exec eslint --fix "src/**/*.ts" 2>&1 | grep -o "[0-9]* problems" || echo "✓ All issues fixed"
|
|
fi
|
|
|
|
# Rebuild
|
|
echo -n "[...] Build: "
|
|
if pnpm run build > /dev/null 2>&1; then
|
|
echo "✓ dist/index.js updated"
|
|
else
|
|
echo "✗ Build failed"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Auto-fixes applied!"
|
|
echo "Run 'git diff' to review changes"
|
|
```
|
|
|
|
## Recommendations
|
|
|
|
After auto-fix:
|
|
1. Review all changes carefully
|
|
2. Run quality checks (quick:check)
|
|
3. Run tests (quick:test)
|
|
4. Commit with descriptive message
|