Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .claude/skills/create-pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
description: Create a pull request with a concise description. Use when ready to submit changes for review.
---

# Create PR

Create a pull request for the current branch.

## Prerequisites

1. All changes committed
2. Branch pushed to remote
3. Validation passing (`bun run validate`)

## Steps

1. Ensure clean state and validation passes:
```bash
git status
bun run validate
```

2. Push branch if needed:
```bash
git push -u origin HEAD
```

3. Create PR with gh CLI:
```bash
gh pr create --title "Brief title" --body "## Summary
- Change 1
- Change 2"
```

## PR Description Format

Keep it concise:

```markdown
## Summary
- 1-3 bullet points describing what changed and why

## Test Plan
- How the changes were verified
```

## Notes

- Title should be brief and descriptive (imperative mood)
- Body should focus on "why" not "what" (code shows the what)
- Link to issues if applicable: `Fixes #123`
53 changes: 53 additions & 0 deletions .claude/skills/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
description: Cut a new version release. Use when ready to publish a new version.
---

# Release

Create a new release by tagging a version.

## Prerequisites

1. All changes committed and pushed
2. CI passing on main branch
3. Version bump in package.json (if needed)

## Steps

1. Ensure clean state:
```bash
git status
git pull origin main
```

2. Update version in package.json if needed:
```bash
# Edit package.json version field
bun run validate
git add package.json
git commit -m "Bump version to X.Y.Z"
git push
```

3. Create and push tag:
```bash
git tag v0.X.Y
git push origin v0.X.Y
```

4. The release workflow will automatically:
- Build binaries for all platforms (linux, darwin, windows - x64 and arm64)
- Create GitHub release with artifacts
- Generate checksums

## Version Guidelines

- **Patch** (0.0.X): Bug fixes, minor changes
- **Minor** (0.X.0): New features, backwards compatible
- **Major** (X.0.0): Breaking changes

## Notes

- Tags must start with `v` (e.g., `v0.1.0`)
- Release notes are auto-generated from commits
- Binaries available via `install.sh` after release
41 changes: 41 additions & 0 deletions .claude/skills/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
description: Run targeted tests based on changed files. Use after making code changes to verify they work.
---

# Test

Run tests for the workout CLI.

## Commands

| Command | What it runs |
|---------|--------------|
| `bun run test` | All tests once |
| `bun run test:watch` | Tests in watch mode |

## Test Location

- `test/*.test.ts` - All tests

## Steps

1. Check what changed:
```bash
git diff --name-only HEAD
```

2. Run tests:
```bash
bun run test
```

3. For specific test file:
```bash
bun run test test/exercises.test.ts
```

## Notes

- Tests use vitest
- Focus on functionality, not coverage metrics
- Keep output concise - only report failures in detail
30 changes: 30 additions & 0 deletions .claude/skills/validate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
description: Run full validation (lint, format, typecheck, tests, build). Use before committing or after changes.
---

# Validate

Run the full validation suite to ensure code quality.

## Command

```bash
bun run validate
```

This runs:
1. `oxlint` - Linting with type-aware rules
2. `oxfmt --check` - Format verification
3. `tsc --noEmit` - Type checking
4. `vitest run` - Unit tests
5. `tsc` - Build

## When to Use

- Before committing changes
- After making significant changes
- When CI fails and you need to reproduce locally

## Expected Output

All checks should pass with no errors. If any step fails, fix the issues before proceeding.
34 changes: 33 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ jobs:
with:
bun-version: latest

- name: Cache bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock', 'package.json') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install

Expand All @@ -32,4 +42,26 @@ jobs:
run: bun run test

- name: Build
run: bun run build:ts
run: bun run build

binary:
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Compile binary
run: bun run build:bin

- name: Test binary runs
run: |
./dist/workout --version
./dist/workout --help
./dist/workout exercises list | head -5
111 changes: 111 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
binaries:
strategy:
fail-fast: false
matrix:
include:
- target: bun-linux-x64
name: linux-x64
archive: tar.gz
- target: bun-linux-arm64
name: linux-arm64
archive: tar.gz
- target: bun-darwin-x64
name: darwin-x64
archive: tar.gz
- target: bun-darwin-arm64
name: darwin-arm64
archive: tar.gz
- target: bun-windows-x64
name: windows-x64
archive: zip

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Set version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Compile binary
run: |
mkdir -p dist-binaries
BINARY_NAME="workout"
if [[ "${{ matrix.name }}" == windows-* ]]; then
BINARY_NAME="workout.exe"
fi
bun build ./src/index.ts --compile --target=${{ matrix.target }} --minify --outfile=dist-binaries/$BINARY_NAME

- name: Create archive
run: |
VERSION=${{ steps.version.outputs.version }}
ARCHIVE_DIR="workout-${VERSION}-${{ matrix.name }}"
mkdir -p "$ARCHIVE_DIR"

if [[ "${{ matrix.name }}" == windows-* ]]; then
cp dist-binaries/workout.exe "$ARCHIVE_DIR/"
else
cp dist-binaries/workout "$ARCHIVE_DIR/"
fi

if [[ "${{ matrix.archive }}" == "tar.gz" ]]; then
tar -czvf "dist-binaries/workout-${VERSION}-${{ matrix.name }}.tar.gz" "$ARCHIVE_DIR"
else
zip -r "dist-binaries/workout-${VERSION}-${{ matrix.name }}.zip" "$ARCHIVE_DIR"
fi

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.name }}
path: dist-binaries/workout-*.*
retention-days: 1

release:
needs: binaries
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist-binaries
pattern: binary-*
merge-multiple: true

- name: Generate checksums
run: |
cd dist-binaries
sha256sum workout-*.tar.gz workout-*.zip > checksums.txt
cat checksums.txt

- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist-binaries/*.tar.gz
dist-binaries/*.zip
dist-binaries/checksums.txt
fail_on_unmatched_files: true
generate_release_notes: true
57 changes: 57 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Agent Instructions

## Skills

Use the `skill` tool for common workflows:

| Skill | When to use |
|-------|-------------|
| `validate` | Before committing, after changes, to verify code quality |
| `test` | To run targeted tests for your changes |
| `create-pr` | To create a pull request with concise description |
| `release` | To cut a new version release |

## Architecture

Workout CLI is a command-line tool for tracking workouts, managing exercises, and querying training history.

- **Runtime**: Bun (not Node.js)
- **Language**: TypeScript with ES modules, strict mode
- **CLI**: Commander.js for command parsing
- **Storage**: JSON files in `~/.workout/`
- **Validation**: Zod schemas

## Project Structure

```
src/
├── index.ts # CLI entry point
├── commands/ # Command implementations
├── data/ # Storage and data access
├── types.ts # Zod schemas and types
└── exercises.ts # Pre-populated exercise library
test/
└── *.test.ts # Vitest tests
```

## Code Style

- Fight entropy - leave the codebase better than you found it
- Prefer simpler solutions where it reasonably makes sense
- Minimal dependencies
- Early returns, fail fast
- TypeScript strict mode
- No comments in code (self-documenting)

## Testing Philosophy

- Focus on functionality testing, not coverage metrics
- Test behavior, not implementation details
- Write tests for commands and data operations
- Don't chase vanity metrics

## Constraints

- No skipping failing tests
- Run `bun run validate` before committing
- Pre-commit hooks run linting and tests automatically
1 change: 1 addition & 0 deletions CLAUDE.md
Loading