vika-cli 1.0.5

Generate TypeScript types, Zod schemas, and Fetch-based API clients from OpenAPI/Swagger specifications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
# Release Process

This document describes the complete release process for vika-cli, from version bumping to publishing binaries.

## Table of Contents

- [Prerequisites]#prerequisites
- [Release Methods]#release-methods
- [Step-by-Step Release Process]#step-by-step-release-process
- [Post-Release Checklist]#post-release-checklist
- [Troubleshooting]#troubleshooting
- [Quick Reference]#quick-reference
- [Support]#support

## Prerequisites

### Required Tools

1. **cargo-release** (recommended):
   ```bash
   cargo install cargo-release
   ```

2. **Git** with proper authentication:
   - SSH keys configured for GitHub
   - Or GitHub CLI (`gh`) authenticated

3. **GitHub Access**:
   - Push access to repository
   - Permission to create tags and releases

### Pre-Release Checks

Before starting a release, ensure:

- [ ] All tests pass: `cargo test`
- [ ] Code is formatted: `cargo fmt --check`
- [ ] No clippy warnings: `cargo clippy --all-targets --all-features -- -D warnings`
- [ ] CHANGELOG.md is up to date with all changes
- [ ] Documentation is current
- [ ] No uncommitted changes (or use `--allow-dirty` if needed)

## Release Methods

### Method 1: cargo-release (Recommended)

**Full automation** - handles everything from version bump to tag creation.

#### Usage

```bash
# Preview what will change (always do this first!)
cargo release --dry-run patch   # or minor, major

# Execute the release
cargo release patch              # 1.0.0 -> 1.0.1
cargo release minor              # 1.0.0 -> 1.1.0
cargo release major              # 1.0.0 -> 2.0.0
```

#### What cargo-release Does

1. **Pre-release checks**:
   - Runs `cargo test --all-features`
   - Runs `cargo clippy --all-targets --all-features -- -D warnings`
   - Checks `cargo fmt --check`

2. **Version bumping**:
   - Updates `version` in `Cargo.toml`
   - Updates `CHANGELOG.md` (if configured)

3. **Committing**:
   - Creates commit with message: `chore: release vika-cli <version>`

4. **Tagging**:
   - Creates tag: `v<version>`
   - Tag message: `Release vika-cli <version>`

5. **Pushing**:
   - Pushes commits and tags to remote

6. **GitHub Actions**:
   - Automatically triggered by tag push
   - Builds binaries for all platforms
   - Creates GitHub Release

#### Advanced Options

```bash
# Skip pre-release checks (not recommended)
cargo release patch --no-verify

# Allow dirty working directory
cargo release patch --allow-dirty

# Don't push (just create tag locally)
cargo release patch --no-push

# Custom version
cargo release 1.2.3

# Preview only
cargo release --dry-run patch
```

### Method 2: Manual Process

For complete manual control over the process.

1. **Update version in Cargo.toml**:
   ```toml
   version = "1.0.1"
   ```

2. **Update CHANGELOG.md**:
   - Move items from `[Unreleased]` to new version section
   - Add actual changes
   - Add release date

3. **Commit changes**:
   ```bash
   git add Cargo.toml CHANGELOG.md
   git commit -m "chore: release v1.0.1"
   ```

4. **Create and push tag**:
   ```bash
   git tag -a v1.0.1 -m "Release v1.0.1"
   git push origin main
   git push origin v1.0.1
   ```

4. **GitHub Actions** will automatically:
   - Build binaries
   - Create GitHub Release

### Method 3: Fully Manual

For complete control.

1. **Update version in Cargo.toml**:
   ```toml
   version = "1.0.1"
   ```

2. **Update CHANGELOG.md**:
   ```markdown
   ## [1.0.1] - 2025-01-22
   
   ### Fixed
   - Fixed issue with circular dependency detection
   - Improved error messages for invalid schemas
   ```

3. **Run pre-release checks**:
   ```bash
   cargo test
   cargo clippy --all-targets --all-features -- -D warnings
   cargo fmt --check
   ```

4. **Commit and tag**:
   ```bash
   git add Cargo.toml CHANGELOG.md
   git commit -m "chore: release v1.0.1"
   git tag -a v1.0.1 -m "Release v1.0.1"
   git push origin main
   git push origin v1.0.1
   ```

## Step-by-Step Release Process

### Standard Release Workflow

1. **Prepare for release**:
   ```bash
   # Ensure you're on main branch
   git checkout main
   git pull origin main
   
   # Run all checks
   cargo test
   cargo clippy --all-targets --all-features -- -D warnings
   cargo fmt --check
   ```

2. **Determine version bump**:
   - **Patch** (1.0.0 → 1.0.1): Bug fixes, small improvements
   - **Minor** (1.0.0 → 1.1.0): New features, backward-compatible
   - **Major** (1.0.0 → 2.0.0): Breaking changes

3. **Update CHANGELOG.md** (if using manual method):
   - Move items from `[Unreleased]` to new version section
   - Ensure all changes are documented
   - Add release date

4. **Execute release**:
   ```bash
   # Using cargo-release (recommended)
   cargo release --dry-run patch  # Preview first!
   cargo release patch
   ```

5. **Verify release**:
   - Check GitHub Actions workflow completed
   - Verify binaries are uploaded
   - Check GitHub Release was created
   - Test installation from release

6. **Post-release tasks** (see below)

### Pre-Release Checklist

- [ ] All features are complete and tested
- [ ] All tests pass (`cargo test`)
- [ ] No clippy warnings (`cargo clippy --all-targets --all-features -- -D warnings`)
- [ ] Code is formatted (`cargo fmt --check`)
- [ ] CHANGELOG.md is updated with all changes
- [ ] README.md is up to date
- [ ] Documentation is current
- [ ] Version number is correct
- [ ] Git working directory is clean (or use `--allow-dirty`)

### Version Bump Guidelines

#### Patch Release (1.0.0 → 1.0.1)

Use for:
- Bug fixes
- Performance improvements
- Documentation updates
- Dependency updates
- Small internal improvements

Example:
```bash
cargo release patch
```

#### Minor Release (1.0.0 → 1.1.0)

Use for:
- New features
- New generation options
- Backward-compatible API additions
- New configuration options

Example:
```bash
cargo release minor
```

#### Major Release (1.0.0 → 2.0.0)

Use for:
- Breaking changes to generated code format
- CLI interface changes
- Breaking configuration changes
- Removal of features

Example:
```bash
cargo release major
```

## Post-Release Checklist

After the release is complete:

- [ ] Verify GitHub Release was created
- [ ] Check all platform binaries are present:
  - [ ] Linux (x86_64)
  - [ ] macOS Intel (x86_64)
  - [ ] macOS ARM (arm64)
  - [ ] Windows (x86_64)
- [ ] Verify checksums are included
- [ ] Test installation from release:
  ```bash
  # Test install script
  curl -fsSL https://github.com/MahdiZarrinkolah/vika-cli/releases/latest/download/install.sh | sh
  ```
- [ ] Announce release (if desired):
  - GitHub Discussions
  - Twitter/X
  - Project website
- [ ] Monitor for issues
- [ ] Update any external documentation

## Automated Release Workflow

### GitHub Actions Workflow

When you push a tag matching `v*`:

**Release Workflow** (`.github/workflows/release.yml`):
- Triggers automatically when you push a tag (e.g., `v1.0.1`)
- Builds binaries for all platforms (Linux, macOS, Windows)
- Generates checksums for all binaries
- Creates GitHub Release
- Uploads all artifacts

### Workflow Diagram

```
Developer
   │
   ├─> cargo release patch
   │   │
   │   ├─> Run tests & checks
   │   ├─> Bump version
   │   ├─> Update changelog
   │   ├─> Create commit
   │   ├─> Create tag
   │   └─> Push to GitHub
   │
   └─> GitHub Actions
       ├─> Build binaries (all platforms)
       ├─> Generate checksums
       ├─> Create GitHub Release
       └─> Upload artifacts
```

## Troubleshooting

### Common Issues

#### Release Fails: Tests Don't Pass

```bash
# Fix tests first
cargo test
# Fix any failing tests
# Then retry release
cargo release patch
```

#### Release Fails: Clippy Warnings

```bash
# Fix clippy warnings
cargo clippy --all-targets --all-features -- -D warnings
# Fix warnings
# Then retry release
cargo release patch
```

#### Release Fails: Uncommitted Changes

```bash
# Option 1: Commit changes
git add .
git commit -m "fix: ..."
cargo release patch

# Option 2: Allow dirty (not recommended)
cargo release patch --allow-dirty
```

#### Tag Already Exists

```bash
# Delete local tag
git tag -d v1.0.1

# Delete remote tag
git push origin :refs/tags/v1.0.1

# Retry release
cargo release patch
```

#### GitHub Actions Fails

1. Check workflow logs in GitHub Actions
2. Common issues:
   - Build failures (check Rust version compatibility)
   - Missing secrets (check repository settings)
   - Network issues (retry workflow)

#### Version Mismatch

Ensure `Cargo.toml` version matches Git tag:
- `Cargo.toml`: `version = "1.0.1"`
- Git tag: `v1.0.1`

If mismatch:
```bash
# Fix version in Cargo.toml
# Then create tag manually
git tag -a v1.0.1 -m "Release v1.0.1"
git push origin v1.0.1
```

## Publishing to Crates.io

When ready to publish to crates.io:

1. **Update `.cargo-release.toml`**:
   ```toml
   publish = true
   ```

2. **Ensure you have crates.io access**:
   ```bash
   cargo login <your-token>
   ```

3. **Release**:
   ```bash
   cargo release patch
   ```

   This will:
   - Bump version
   - Create tag
   - Publish to crates.io
   - Push to GitHub

## Release Notes Template

When creating a GitHub Release, use this template:

```markdown
## Changes

See [CHANGELOG.md](https://github.com/MahdiZarrinkolah/vika-cli/blob/main/CHANGELOG.md) for details.

## Installation

### macOS / Linux
```bash
curl -fsSL https://github.com/MahdiZarrinkolah/vika-cli/releases/latest/download/install.sh | sh
```

### Windows (PowerShell)
```powershell
irm https://github.com/MahdiZarrinkolah/vika-cli/releases/latest/download/install.ps1 | iex
```

### Cargo
```bash
cargo install vika-cli
```

## What's Changed

- Feature 1
- Feature 2
- Bug fix 1
- Bug fix 2
```

## Quick Reference

### Common Commands

```bash
# Preview release
cargo release --dry-run patch

# Release patch version
cargo release patch

# Release minor version
cargo release minor

# Release major version
cargo release major

# Custom version
cargo release 1.2.3

# Skip checks (not recommended)
cargo release patch --no-verify

# Allow dirty working directory
cargo release patch --allow-dirty

# Don't push (local only)
cargo release patch --no-push
```

## Quick Reference

For a quick overview of the release process:

### Using cargo-release

```bash
# Install cargo-release
cargo install cargo-release

# Preview what will change
cargo release --dry-run patch

# Release (bumps version, updates changelog, creates tag)
cargo release patch
```

### Manual Process

1. **Update version in Cargo.toml**:
   ```toml
   version = "1.1.0"
   ```

2. **Update CHANGELOG.md**:
   - Move items from `[Unreleased]` to new version section
   - Add release date

3. **Commit and tag**:
   ```bash
   git add Cargo.toml CHANGELOG.md
   git commit -m "chore: release v1.1.0"
   git tag v1.1.0
   git push origin main --tags
   ```

### Automated Release Workflow

When you push a tag matching `v*`:
1. GitHub Actions automatically builds binaries for all platforms
2. Creates a GitHub Release with binaries and checksums
3. Release notes are generated from CHANGELOG.md

### Conventional Commits (Optional)

For even more automation, you can use conventional commits:
- `feat:` → minor version bump
- `fix:` → patch version bump  
- `BREAKING CHANGE:` → major version bump

Then use `cargo-release` with `auto-version = "auto"` to automatically determine the version bump from commit messages.

### GitHub Actions Automation

The `.github/workflows/release.yml` workflow automatically:
- Builds binaries for all platforms when you push a tag
- Generates checksums
- Creates GitHub Release with all artifacts

Use `cargo release patch` to create the tag - GitHub Actions handles the rest automatically!

## Support

For issues or questions about the release process:
- Open an issue on GitHub
- Check [docs/development/release-setup.md]docs/development/release-setup.md for detailed setup instructions
- Review [docs/development/release-quick-start.md]docs/development/release-quick-start.md for a quick reference