|
| 1 | +# AI Automation Support |
| 2 | + |
| 3 | +This document describes the AI automation features added to quick-publish. |
| 4 | + |
| 5 | +## New CLI Options |
| 6 | + |
| 7 | +### `--dry-run` |
| 8 | +Shows what commands would be executed without actually running them. Perfect for AI agents to understand what will happen before execution. |
| 9 | + |
| 10 | +```bash |
| 11 | +# See what would happen with a patch release |
| 12 | +quick-publish --dry-run --release-type patch |
| 13 | + |
| 14 | +# Preview a custom version release |
| 15 | +quick-publish --dry-run --release-type custom --version 1.2.3 --tag beta |
| 16 | +``` |
| 17 | + |
| 18 | +### `--yes` |
| 19 | +Skips all interactive prompts and uses provided or default values. Enables fully automated execution. |
| 20 | + |
| 21 | +```bash |
| 22 | +# Automated patch release |
| 23 | +quick-publish --yes --release-type patch |
| 24 | + |
| 25 | +# Automated custom release |
| 26 | +quick-publish --yes --release-type custom --version 1.2.3 --tag latest |
| 27 | +``` |
| 28 | + |
| 29 | +### Version and Tag Options |
| 30 | + |
| 31 | +- `--release-type <type>`: `patch`, `minor`, `major`, `prerelease`, or `custom` |
| 32 | +- `--version <version>`: Custom version (required when `--release-type=custom`) |
| 33 | +- `--tag <tag>`: NPM tag (`latest`, `next`, `beta`, or custom tag name) |
| 34 | + |
| 35 | +## AI Usage Examples |
| 36 | + |
| 37 | +### 1. Preview Changes (Dry Run) |
| 38 | +```bash |
| 39 | +# AI can run this to see what would happen |
| 40 | +quick-publish --dry-run --release-type patch |
| 41 | +``` |
| 42 | + |
| 43 | +Output: |
| 44 | +``` |
| 45 | +[DRY RUN] Would select version: 0.7.2, tag: latest |
| 46 | +[DRY RUN] Would ask: Continue to publish `0.7.2` with tag `latest`? (auto-yes in automated mode) |
| 47 | +
|
| 48 | +[DRY RUN] Publish workflow for version 0.7.2 with tag latest: |
| 49 | +[DRY RUN] Would execute: npm version 0.7.2 |
| 50 | +[DRY RUN] Would execute: /path/to/conventional-changelog -p angular -r 2 -i CHANGELOG.md -s |
| 51 | +[DRY RUN] Would execute: npm publish --tag=latest |
| 52 | +[DRY RUN] Would execute: git add CHANGELOG.md |
| 53 | +[DRY RUN] Would execute: git commit -m chore%3A%20changelog%200.7.2 |
| 54 | +[DRY RUN] Would execute: git push |
| 55 | +[DRY RUN] Would execute: git push origin refs/tags/v0.7.2 |
| 56 | +
|
| 57 | +[DRY RUN] Publish workflow completed. Use --yes to execute. |
| 58 | +``` |
| 59 | + |
| 60 | +### 2. Automated Execution |
| 61 | +```bash |
| 62 | +# AI can run this after confirming with dry-run |
| 63 | +quick-publish --yes --release-type patch |
| 64 | +``` |
| 65 | + |
| 66 | +### 3. Custom Version Release |
| 67 | +```bash |
| 68 | +# For specific version requirements |
| 69 | +quick-publish --yes --release-type custom --version 1.0.0 --tag latest |
| 70 | +``` |
| 71 | + |
| 72 | +### 4. Beta Release |
| 73 | +```bash |
| 74 | +# For pre-release versions |
| 75 | +quick-publish --yes --release-type prerelease --tag beta |
| 76 | +``` |
| 77 | + |
| 78 | +## AI Workflow Recommendation |
| 79 | + |
| 80 | +1. **Analysis Phase**: AI runs with `--dry-run` to understand what will happen |
| 81 | +2. **Confirmation Phase**: AI presents the planned actions to user |
| 82 | +3. **Execution Phase**: AI runs with `--yes` and appropriate parameters |
| 83 | + |
| 84 | +```bash |
| 85 | +# Step 1: Analyze |
| 86 | +quick-publish --dry-run --release-type patch |
| 87 | + |
| 88 | +# Step 2: Execute (after user confirmation) |
| 89 | +quick-publish --yes --release-type patch |
| 90 | +``` |
| 91 | + |
| 92 | +## Error Handling |
| 93 | + |
| 94 | +- Missing `--version` with `--release-type=custom` will throw an error |
| 95 | +- Invalid release types will be rejected |
| 96 | +- All validation happens before any commands are executed |
| 97 | + |
| 98 | +## Backward Compatibility |
| 99 | + |
| 100 | +All existing functionality remains unchanged. The new options are additive and don't affect the interactive mode when not specified. |
0 commit comments