claudeforge 0.1.7

Create new projects optimized for Claude Code
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
# Spec 020: GitHub Actions Workflows

## Feature Summary

This feature adds comprehensive GitHub Actions workflows for the ClaudeForge project, providing automated testing, code quality checks, and release management. The workflows will ensure code quality, run tests across multiple platforms, and automate the release process for distributing the CLI tool.

The implementation includes:
- Continuous Integration (CI) workflow for testing and quality checks
- Release workflow for building and distributing binaries
- Security scanning and dependency auditing
- Cross-platform testing (Linux, macOS, Windows)
- Automated changelog generation and GitHub releases

## Goals & Requirements

### Functional Requirements
- **CI Pipeline**: Automated testing on every pull request and push to main
- **Multi-platform Support**: Test and build on Linux, macOS, and Windows
- **Code Quality**: Automated formatting checks, linting, and security scanning
- **Release Automation**: Automated binary builds and GitHub releases
- **Caching**: Efficient build times using dependency caching
- **Security**: Automated dependency auditing and vulnerability scanning

### Non-functional Requirements
- **Performance**: CI runs should complete within 10 minutes
- **Reliability**: Workflows should be stable and not prone to flaky failures
- **Maintainability**: Clear workflow structure and documentation
- **Security**: Secure handling of tokens and release assets

### Success Criteria
- All tests pass on supported platforms
- Code quality checks enforce project standards
- Releases are automatically created with proper versioning
- Security vulnerabilities are detected and reported
- Build artifacts are properly signed and distributed

## API/Interface Design

### Workflow Triggers
```yaml
# CI Workflow triggers
on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

# Release Workflow triggers
on:
  push:
    tags: ['v*']
  workflow_dispatch:
    inputs:
      version:
        description: 'Version to release'
        required: true
        type: string
```

### Workflow Outputs
- **CI**: Test results, code coverage, quality metrics
- **Release**: Binary artifacts, checksums, release notes
- **Security**: Vulnerability reports, dependency updates

### Matrix Strategy
```yaml
strategy:
  matrix:
    os: [ubuntu-latest, macos-latest, windows-latest]
    rust: [stable, beta]
    exclude:
      - os: windows-latest
        rust: beta
```

## File and Package Structure

### Workflow Files
```
.github/
├── workflows/
│   ├── ci.yml                 # Main CI workflow
│   ├── release.yml            # Release workflow
│   ├── security.yml           # Security scanning
│   └── dependabot.yml         # Dependency updates
├── actions/
│   ├── setup-rust/            # Custom Rust setup action
│   └── release-utils/         # Release utilities
└── SECURITY.md                # Security policy
```

### Build Artifacts Structure
```
target/
├── release/
│   ├── claudeforge            # Linux binary
│   ├── claudeforge.exe        # Windows binary
│   └── claudeforge-macos      # macOS binary
└── artifacts/
    ├── checksums.txt          # SHA256 checksums
    ├── signatures.asc         # GPG signatures
    └── release-notes.md       # Generated release notes
```

## Implementation Details

### CI Workflow (`ci.yml`)
```yaml
name: CI

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable, beta]
        exclude:
          - os: windows-latest
            rust: beta
    
    steps:
    - uses: actions/checkout@v4
    
    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable
      with:
        toolchain: ${{ matrix.rust }}
        components: rustfmt, clippy
    
    - name: Cache dependencies
      uses: actions/cache@v4
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target/
        key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
    
    - name: Run tests
      run: cargo test --all-features
    
    - name: Run clippy
      run: cargo clippy --all-targets --all-features -- -D warnings
    
    - name: Check formatting
      run: cargo fmt --all -- --check
```

### Release Workflow (`release.yml`)
```yaml
name: Release

on:
  push:
    tags: ['v*']
  workflow_dispatch:
    inputs:
      version:
        description: 'Version to release'
        required: true
        type: string

jobs:
  create-release:
    name: Create Release
    runs-on: ubuntu-latest
    outputs:
      upload_url: ${{ steps.create_release.outputs.upload_url }}
    
    steps:
    - uses: actions/checkout@v4
    
    - name: Generate release notes
      id: release_notes
      run: |
        # Generate changelog from git history
        echo "## Changes" > release_notes.md
        git log --oneline --format="- %s" $(git describe --tags --abbrev=0)..HEAD >> release_notes.md
    
    - name: Create Release
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}
        body_path: release_notes.md
        draft: false
        prerelease: false

  build-release:
    name: Build Release
    needs: create-release
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            binary: claudeforge
          - os: macos-latest
            target: x86_64-apple-darwin
            binary: claudeforge
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            binary: claudeforge.exe
    
    steps:
    - uses: actions/checkout@v4
    
    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable
      with:
        target: ${{ matrix.target }}
    
    - name: Build release binary
      run: cargo build --release --target ${{ matrix.target }}
    
    - name: Create archive
      run: |
        mkdir -p release
        cp target/${{ matrix.target }}/release/${{ matrix.binary }} release/
        cp README.md LICENSE release/
        tar -czf claudeforge-${{ matrix.target }}.tar.gz -C release .
    
    - name: Upload Release Asset
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ needs.create-release.outputs.upload_url }}
        asset_path: ./claudeforge-${{ matrix.target }}.tar.gz
        asset_name: claudeforge-${{ matrix.target }}.tar.gz
        asset_content_type: application/gzip
```

### Security Workflow (`security.yml`)
```yaml
name: Security

on:
  schedule:
    - cron: '0 2 * * 1'  # Weekly on Monday
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  audit:
    name: Security Audit
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v4
    
    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable
    
    - name: Install cargo-audit
      run: cargo install cargo-audit
    
    - name: Run security audit
      run: cargo audit
    
    - name: Run cargo deny
      run: |
        cargo install cargo-deny
        cargo deny check
```

## Testing Strategy

### CI Testing
- **Unit Tests**: Run all unit tests with `cargo test`
- **Integration Tests**: Execute integration test suite
- **Property Tests**: Run property-based tests if present
- **Multi-platform**: Test on Linux, macOS, and Windows
- **Multiple Rust Versions**: Test on stable and beta

### Release Testing
- **Build Verification**: Ensure binaries build successfully
- **Smoke Tests**: Basic functionality tests on built binaries
- **Archive Integrity**: Verify release archives are properly formed
- **Checksum Validation**: Generate and verify checksums

### Security Testing
- **Dependency Auditing**: Check for known vulnerabilities
- **License Compliance**: Verify license compatibility
- **Supply Chain**: Validate dependency sources

## Edge Cases & Error Handling

### CI Failures
- **Flaky Tests**: Implement retry mechanisms for unstable tests
- **Build Failures**: Clear error reporting and artifact preservation
- **Network Issues**: Robust caching and retry strategies
- **Platform Differences**: Handle platform-specific test variations

### Release Failures
- **Build Errors**: Fail fast with clear error messages
- **Upload Failures**: Implement retry mechanisms for asset uploads
- **Version Conflicts**: Detect and handle version mismatches
- **Incomplete Releases**: Rollback mechanisms for partial failures

### Security Issues
- **Vulnerability Detection**: Automated alerts and PR creation
- **License Violations**: Block builds with incompatible licenses
- **Supply Chain Attacks**: Verification of dependency integrity

## Dependencies

### GitHub Actions
- `actions/checkout@v4`: Repository checkout
- `dtolnay/rust-toolchain@stable`: Rust toolchain setup
- `actions/cache@v4`: Dependency caching
- `actions/create-release@v1`: Release creation
- `actions/upload-release-asset@v1`: Asset uploads

### Rust Tools
- `cargo-audit`: Security auditing
- `cargo-deny`: License and dependency checking
- `cargo-tarpaulin`: Code coverage (optional)
- `cargo-release`: Release management (optional)

### External Services
- GitHub API: Release management
- Dependabot: Automated dependency updates
- Security advisories: Vulnerability notifications

## Configuration

### Environment Variables
```yaml
env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0
  RUSTFLAGS: "-Dwarnings"
  RUST_BACKTRACE: 1
```

### Secrets Required
- `GITHUB_TOKEN`: Automatic releases and API access
- `CARGO_REGISTRY_TOKEN`: Crates.io publishing (optional)
- `GPG_PRIVATE_KEY`: Binary signing (optional)

### Dependabot Configuration
```yaml
# .github/dependabot.yml
version: 2
updates:
  - package-ecosystem: "cargo"
    directory: "/"
    schedule:
      interval: "weekly"
    open-pull-requests-limit: 10
```

## Documentation

### Workflow Documentation
- README updates with CI/CD status badges
- Contributing guidelines for PR requirements
- Release process documentation
- Security policy and vulnerability reporting

### Status Badges
```markdown
[![CI](https://github.com/iepathos/claudeforge/workflows/CI/badge.svg)](https://github.com/iepathos/claudeforge/actions)
[![Release](https://github.com/iepathos/claudeforge/workflows/Release/badge.svg)](https://github.com/iepathos/claudeforge/releases)
[![Security](https://github.com/iepathos/claudeforge/workflows/Security/badge.svg)](https://github.com/iepathos/claudeforge/actions)
```

### Integration with Justfile
Update Justfile to include local CI simulation:
```just
# Run CI checks locally
ci-local: fmt-check lint test doc-check
    cargo audit
    @echo "Local CI simulation completed!"
```

## Implementation Steps

1. **Create `.github/workflows/` directory structure**
2. **Implement CI workflow with basic testing**
3. **Add code quality checks (formatting, linting)**
4. **Implement security scanning workflow**
5. **Create release workflow with cross-platform builds**
6. **Add caching for improved performance**
7. **Configure Dependabot for automated updates**
8. **Add documentation and status badges**
9. **Test workflows with sample releases**
10. **Optimize and refine based on initial runs**

## Security Considerations

- **Token Management**: Use least-privilege access tokens
- **Dependency Scanning**: Regular automated security audits
- **Supply Chain Security**: Verify action and dependency integrity
- **Secret Handling**: Proper secret management and rotation
- **Branch Protection**: Enforce CI requirements before merging

## Performance Optimizations

- **Caching Strategy**: Aggressive caching of Rust dependencies
- **Parallel Jobs**: Maximize concurrent job execution
- **Incremental Builds**: Use incremental compilation where possible
- **Target Optimization**: Build only necessary targets
- **Artifact Management**: Efficient artifact storage and retrieval