feat(cli): add machine-readable CLI help, recommendation, and configuration flows
This commit is contained in:
@@ -56,6 +56,9 @@ Create standardized commits with AI-powered suggestions that automatically handl
|
||||
# Interactive commit with AI recommendations
|
||||
gitzone commit
|
||||
|
||||
# Read-only recommendation for agents and scripts
|
||||
gitzone commit recommend --json
|
||||
|
||||
# Auto-accept AI recommendations (skipped for BREAKING CHANGEs)
|
||||
gitzone commit -y
|
||||
|
||||
@@ -65,14 +68,15 @@ gitzone commit -ypbr
|
||||
|
||||
**Flags:**
|
||||
|
||||
| Flag | Long Form | Description |
|
||||
|------|-----------|-------------|
|
||||
| `-y` | `--yes` | Auto-accept AI recommendations |
|
||||
| `-p` | `--push` | Push to remote after commit |
|
||||
| `-t` | `--test` | Run tests before committing |
|
||||
| `-b` | `--build` | Build after commit, verify clean tree |
|
||||
| `-r` | `--release` | Publish to configured npm registries |
|
||||
| | `--format` | Run format before committing |
|
||||
| Flag | Long Form | Description |
|
||||
| ---- | ----------- | ---------------------------------------- |
|
||||
| `-y` | `--yes` | Auto-accept AI recommendations |
|
||||
| `-p` | `--push` | Push to remote after commit |
|
||||
| `-t` | `--test` | Run tests before committing |
|
||||
| `-b` | `--build` | Build after commit, verify clean tree |
|
||||
| `-r` | `--release` | Publish to configured npm registries |
|
||||
| | `--format` | Run format before committing |
|
||||
| | `--json` | Emit JSON for `gitzone commit recommend` |
|
||||
|
||||
**Workflow steps:**
|
||||
|
||||
@@ -94,6 +98,9 @@ Automatically format and standardize your entire codebase. **Dry-run by default*
|
||||
# Preview what would change (default behavior)
|
||||
gitzone format
|
||||
|
||||
# Emit a machine-readable plan
|
||||
gitzone format plan --json
|
||||
|
||||
# Apply changes
|
||||
gitzone format --write
|
||||
|
||||
@@ -109,22 +116,22 @@ gitzone format --verbose
|
||||
|
||||
**Flags:**
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--write` / `-w` | Apply changes (default is dry-run) |
|
||||
| `--yes` | Auto-approve without interactive confirmation |
|
||||
| `--plan-only` | Only show what would be done |
|
||||
| `--save-plan <file>` | Save the format plan to a file |
|
||||
| `--from-plan <file>` | Load and execute a saved plan |
|
||||
| `--detailed` | Show detailed stats and save report |
|
||||
| `--parallel` / `--no-parallel` | Toggle parallel execution |
|
||||
| `--verbose` | Enable verbose logging |
|
||||
| `--diff` | Show file diffs |
|
||||
| Flag | Description |
|
||||
| -------------------- | --------------------------------------------- |
|
||||
| `--write` / `-w` | Apply changes (default is dry-run) |
|
||||
| `--yes` | Auto-approve without interactive confirmation |
|
||||
| `--plan-only` | Only show what would be done |
|
||||
| `--save-plan <file>` | Save the format plan to a file |
|
||||
| `--from-plan <file>` | Load and execute a saved plan |
|
||||
| `--detailed` | Show detailed stats and save report |
|
||||
| `--verbose` | Enable verbose logging |
|
||||
| `--diff` | Show file diffs |
|
||||
| `--json` | Emit a read-only format plan as JSON |
|
||||
|
||||
**Formatters (executed in order):**
|
||||
|
||||
1. 🧹 **Cleanup** — removes obsolete files (yarn.lock, package-lock.json, tslint.json, etc.)
|
||||
2. ⚙️ **Npmextra** — formats and standardizes `npmextra.json`
|
||||
2. ⚙️ **Smartconfig** — formats and standardizes `.smartconfig.json`
|
||||
3. 📜 **License** — ensures proper licensing and checks dependency licenses
|
||||
4. 📦 **Package.json** — standardizes package configuration
|
||||
5. 📋 **Templates** — applies project template updates
|
||||
@@ -144,18 +151,21 @@ gitzone services [command]
|
||||
|
||||
**Commands:**
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `start [service]` | Start services (`mongo`\|`s3`\|`elasticsearch`\|`all`) |
|
||||
| `stop [service]` | Stop services |
|
||||
| `restart [service]` | Restart services |
|
||||
| `status` | Show current service status |
|
||||
| `config` | Display configuration details |
|
||||
| `compass` | Get MongoDB Compass connection string with network IP |
|
||||
| `logs [service] [lines]` | View service logs (default: 20 lines) |
|
||||
| `reconfigure` | Reassign ports and restart all services |
|
||||
| `remove` | Remove containers (preserves data) |
|
||||
| `clean` | Remove containers AND data (⚠️ destructive) |
|
||||
| Command | Description |
|
||||
| ------------------------ | ------------------------------------------------------ |
|
||||
| `start [service]` | Start services (`mongo`\|`s3`\|`elasticsearch`\|`all`) |
|
||||
| `stop [service]` | Stop services |
|
||||
| `restart [service]` | Restart services |
|
||||
| `status` | Show current service status |
|
||||
| `config` | Display configuration details |
|
||||
| `set <csv>` | Set enabled services without prompts |
|
||||
| `enable <service...>` | Enable one or more services |
|
||||
| `disable <service...>` | Disable one or more services |
|
||||
| `compass` | Get MongoDB Compass connection string with network IP |
|
||||
| `logs [service] [lines]` | View service logs (default: 20 lines) |
|
||||
| `reconfigure` | Reassign ports and restart all services |
|
||||
| `remove` | Remove containers (preserves data) |
|
||||
| `clean` | Remove containers AND data (⚠️ destructive) |
|
||||
|
||||
**Service aliases:**
|
||||
|
||||
@@ -195,6 +205,9 @@ gitzone services cleanup -g
|
||||
# Start all services for your project
|
||||
gitzone services start
|
||||
|
||||
# Configure enabled services without prompts
|
||||
gitzone services set mongodb,minio
|
||||
|
||||
# Check what's running
|
||||
gitzone services status
|
||||
|
||||
@@ -217,18 +230,21 @@ Manage release registries and commit settings:
|
||||
gitzone config [subcommand]
|
||||
```
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `show` | Display current release config (registries, access level) |
|
||||
| `add [url]` | Add a registry URL (default: `https://registry.npmjs.org`) |
|
||||
| `remove [url]` | Remove a registry URL (interactive selection if no URL) |
|
||||
| `clear` | Clear all registries (with confirmation) |
|
||||
| `access [public\|private]` | Set npm access level for publishing |
|
||||
| `commit alwaysTest [true\|false]` | Always run tests before commit |
|
||||
| `commit alwaysBuild [true\|false]` | Always build after commit |
|
||||
| `services` | Configure which services are enabled |
|
||||
| Command | Description |
|
||||
| ---------------------------------- | ---------------------------------------------------------- |
|
||||
| `show` | Display current release config (registries, access level) |
|
||||
| `get <path>` | Read a single value from `@git.zone/cli` |
|
||||
| `set <path> <value>` | Write a single value to `@git.zone/cli` |
|
||||
| `unset <path>` | Remove a single value from `@git.zone/cli` |
|
||||
| `add [url]` | Add a registry URL (default: `https://registry.npmjs.org`) |
|
||||
| `remove [url]` | Remove a registry URL (interactive selection if no URL) |
|
||||
| `clear` | Clear all registries (with confirmation) |
|
||||
| `access [public\|private]` | Set npm access level for publishing |
|
||||
| `commit alwaysTest [true\|false]` | Always run tests before commit |
|
||||
| `commit alwaysBuild [true\|false]` | Always build after commit |
|
||||
| `services` | Configure which services are enabled |
|
||||
|
||||
Configuration is stored in `npmextra.json` under the `@git.zone/cli` key.
|
||||
Configuration is stored in `.smartconfig.json` under the `@git.zone/cli` key.
|
||||
|
||||
### 📦 Project Templates
|
||||
|
||||
@@ -323,44 +339,33 @@ gitzone helpers shortid
|
||||
|
||||
## 📋 Configuration
|
||||
|
||||
### npmextra.json
|
||||
### .smartconfig.json
|
||||
|
||||
Customize gitzone behavior through `npmextra.json`:
|
||||
Customize gitzone behavior through `.smartconfig.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"cli": {
|
||||
"interactive": true,
|
||||
"output": "human",
|
||||
"checkUpdates": true
|
||||
},
|
||||
"release": {
|
||||
"registries": [
|
||||
"https://registry.npmjs.org"
|
||||
],
|
||||
"registries": ["https://registry.npmjs.org"],
|
||||
"accessLevel": "public"
|
||||
},
|
||||
"commit": {
|
||||
"alwaysTest": false,
|
||||
"alwaysBuild": false
|
||||
}
|
||||
},
|
||||
"gitzone": {
|
||||
},
|
||||
"format": {
|
||||
"interactive": true,
|
||||
"parallel": true,
|
||||
"showStats": true,
|
||||
"cache": {
|
||||
"enabled": true,
|
||||
"clean": true
|
||||
},
|
||||
"modules": {
|
||||
"skip": ["prettier"],
|
||||
"only": [],
|
||||
"order": []
|
||||
},
|
||||
"licenses": {
|
||||
"allowed": ["MIT", "Apache-2.0"],
|
||||
"exceptions": {
|
||||
"some-package": "GPL-3.0"
|
||||
}
|
||||
"only": []
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -408,6 +413,23 @@ gitzone services stop
|
||||
gitzone commit -ytbpr
|
||||
```
|
||||
|
||||
### Agent-Friendly Inspection
|
||||
|
||||
```bash
|
||||
# Top-level machine-readable help
|
||||
gitzone help config --json
|
||||
|
||||
# Read-only commit recommendation
|
||||
gitzone commit recommend --json
|
||||
|
||||
# Read-only format plan
|
||||
gitzone format plan --json
|
||||
|
||||
# Read or change config without prompts
|
||||
gitzone config get release.accessLevel
|
||||
gitzone config set cli.interactive false
|
||||
```
|
||||
|
||||
### Multi-Repository Management
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user