Skip to content

Commit becf83f

Browse files
authored
Implement Phase 1: core CLI with exercises, templates, sessions, and history (#1)
1 parent 8a1eca3 commit becf83f

25 files changed

Lines changed: 3289 additions & 10 deletions

.claude/skills/create-pr.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
description: Create a pull request with a concise description. Use when ready to submit changes for review.
3+
---
4+
5+
# Create PR
6+
7+
Create a pull request for the current branch.
8+
9+
## Prerequisites
10+
11+
1. All changes committed
12+
2. Branch pushed to remote
13+
3. Validation passing (`bun run validate`)
14+
15+
## Steps
16+
17+
1. Ensure clean state and validation passes:
18+
```bash
19+
git status
20+
bun run validate
21+
```
22+
23+
2. Push branch if needed:
24+
```bash
25+
git push -u origin HEAD
26+
```
27+
28+
3. Create PR with gh CLI:
29+
```bash
30+
gh pr create --title "Brief title" --body "## Summary
31+
- Change 1
32+
- Change 2"
33+
```
34+
35+
## PR Description Format
36+
37+
Keep it concise:
38+
39+
```markdown
40+
## Summary
41+
- 1-3 bullet points describing what changed and why
42+
43+
## Test Plan
44+
- How the changes were verified
45+
```
46+
47+
## Notes
48+
49+
- Title should be brief and descriptive (imperative mood)
50+
- Body should focus on "why" not "what" (code shows the what)
51+
- Link to issues if applicable: `Fixes #123`

.claude/skills/release.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
description: Cut a new version release. Use when ready to publish a new version.
3+
---
4+
5+
# Release
6+
7+
Create a new release by tagging a version.
8+
9+
## Prerequisites
10+
11+
1. All changes committed and pushed
12+
2. CI passing on main branch
13+
3. Version bump in package.json (if needed)
14+
15+
## Steps
16+
17+
1. Ensure clean state:
18+
```bash
19+
git status
20+
git pull origin main
21+
```
22+
23+
2. Update version in package.json if needed:
24+
```bash
25+
# Edit package.json version field
26+
bun run validate
27+
git add package.json
28+
git commit -m "Bump version to X.Y.Z"
29+
git push
30+
```
31+
32+
3. Create and push tag:
33+
```bash
34+
git tag v0.X.Y
35+
git push origin v0.X.Y
36+
```
37+
38+
4. The release workflow will automatically:
39+
- Build binaries for all platforms (linux, darwin, windows - x64 and arm64)
40+
- Create GitHub release with artifacts
41+
- Generate checksums
42+
43+
## Version Guidelines
44+
45+
- **Patch** (0.0.X): Bug fixes, minor changes
46+
- **Minor** (0.X.0): New features, backwards compatible
47+
- **Major** (X.0.0): Breaking changes
48+
49+
## Notes
50+
51+
- Tags must start with `v` (e.g., `v0.1.0`)
52+
- Release notes are auto-generated from commits
53+
- Binaries available via `install.sh` after release

.claude/skills/test.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
description: Run targeted tests based on changed files. Use after making code changes to verify they work.
3+
---
4+
5+
# Test
6+
7+
Run tests for the workout CLI.
8+
9+
## Commands
10+
11+
| Command | What it runs |
12+
|---------|--------------|
13+
| `bun run test` | All tests once |
14+
| `bun run test:watch` | Tests in watch mode |
15+
16+
## Test Location
17+
18+
- `test/*.test.ts` - All tests
19+
20+
## Steps
21+
22+
1. Check what changed:
23+
```bash
24+
git diff --name-only HEAD
25+
```
26+
27+
2. Run tests:
28+
```bash
29+
bun run test
30+
```
31+
32+
3. For specific test file:
33+
```bash
34+
bun run test test/exercises.test.ts
35+
```
36+
37+
## Notes
38+
39+
- Tests use vitest
40+
- Focus on functionality, not coverage metrics
41+
- Keep output concise - only report failures in detail

.claude/skills/validate.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
description: Run full validation (lint, format, typecheck, tests, build). Use before committing or after changes.
3+
---
4+
5+
# Validate
6+
7+
Run the full validation suite to ensure code quality.
8+
9+
## Command
10+
11+
```bash
12+
bun run validate
13+
```
14+
15+
This runs:
16+
1. `oxlint` - Linting with type-aware rules
17+
2. `oxfmt --check` - Format verification
18+
3. `tsc --noEmit` - Type checking
19+
4. `vitest run` - Unit tests
20+
5. `tsc` - Build
21+
22+
## When to Use
23+
24+
- Before committing changes
25+
- After making significant changes
26+
- When CI fails and you need to reproduce locally
27+
28+
## Expected Output
29+
30+
All checks should pass with no errors. If any step fails, fix the issues before proceeding.

.github/workflows/ci.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ jobs:
1616
with:
1717
bun-version: latest
1818

19+
- name: Cache bun dependencies
20+
uses: actions/cache@v4
21+
with:
22+
path: |
23+
~/.bun/install/cache
24+
node_modules
25+
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock', 'package.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-bun-
28+
1929
- name: Install dependencies
2030
run: bun install
2131

@@ -32,4 +42,26 @@ jobs:
3242
run: bun run test
3343

3444
- name: Build
35-
run: bun run build:ts
45+
run: bun run build
46+
47+
binary:
48+
runs-on: ubuntu-latest
49+
needs: validate
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- uses: oven-sh/setup-bun@v2
54+
with:
55+
bun-version: latest
56+
57+
- name: Install dependencies
58+
run: bun install
59+
60+
- name: Compile binary
61+
run: bun run build:bin
62+
63+
- name: Test binary runs
64+
run: |
65+
./dist/workout --version
66+
./dist/workout --help
67+
./dist/workout exercises list | head -5

.github/workflows/release.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
binaries:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
include:
14+
- target: bun-linux-x64
15+
name: linux-x64
16+
archive: tar.gz
17+
- target: bun-linux-arm64
18+
name: linux-arm64
19+
archive: tar.gz
20+
- target: bun-darwin-x64
21+
name: darwin-x64
22+
archive: tar.gz
23+
- target: bun-darwin-arm64
24+
name: darwin-arm64
25+
archive: tar.gz
26+
- target: bun-windows-x64
27+
name: windows-x64
28+
archive: zip
29+
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up Bun
36+
uses: oven-sh/setup-bun@v2
37+
with:
38+
bun-version: latest
39+
40+
- name: Install dependencies
41+
run: bun install
42+
43+
- name: Set version from tag
44+
id: version
45+
run: |
46+
VERSION=${GITHUB_REF#refs/tags/v}
47+
echo "version=$VERSION" >> $GITHUB_OUTPUT
48+
49+
- name: Compile binary
50+
run: |
51+
mkdir -p dist-binaries
52+
BINARY_NAME="workout"
53+
if [[ "${{ matrix.name }}" == windows-* ]]; then
54+
BINARY_NAME="workout.exe"
55+
fi
56+
bun build ./src/index.ts --compile --target=${{ matrix.target }} --minify --outfile=dist-binaries/$BINARY_NAME
57+
58+
- name: Create archive
59+
run: |
60+
VERSION=${{ steps.version.outputs.version }}
61+
ARCHIVE_DIR="workout-${VERSION}-${{ matrix.name }}"
62+
mkdir -p "$ARCHIVE_DIR"
63+
64+
if [[ "${{ matrix.name }}" == windows-* ]]; then
65+
cp dist-binaries/workout.exe "$ARCHIVE_DIR/"
66+
else
67+
cp dist-binaries/workout "$ARCHIVE_DIR/"
68+
fi
69+
70+
if [[ "${{ matrix.archive }}" == "tar.gz" ]]; then
71+
tar -czvf "dist-binaries/workout-${VERSION}-${{ matrix.name }}.tar.gz" "$ARCHIVE_DIR"
72+
else
73+
zip -r "dist-binaries/workout-${VERSION}-${{ matrix.name }}.zip" "$ARCHIVE_DIR"
74+
fi
75+
76+
- name: Upload artifact
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: binary-${{ matrix.name }}
80+
path: dist-binaries/workout-*.*
81+
retention-days: 1
82+
83+
release:
84+
needs: binaries
85+
runs-on: ubuntu-latest
86+
permissions:
87+
contents: write
88+
89+
steps:
90+
- name: Download all artifacts
91+
uses: actions/download-artifact@v4
92+
with:
93+
path: dist-binaries
94+
pattern: binary-*
95+
merge-multiple: true
96+
97+
- name: Generate checksums
98+
run: |
99+
cd dist-binaries
100+
sha256sum workout-*.tar.gz workout-*.zip > checksums.txt
101+
cat checksums.txt
102+
103+
- name: Upload to GitHub Release
104+
uses: softprops/action-gh-release@v2
105+
with:
106+
files: |
107+
dist-binaries/*.tar.gz
108+
dist-binaries/*.zip
109+
dist-binaries/checksums.txt
110+
fail_on_unmatched_files: true
111+
generate_release_notes: true

AGENTS.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Agent Instructions
2+
3+
## Skills
4+
5+
Use the `skill` tool for common workflows:
6+
7+
| Skill | When to use |
8+
|-------|-------------|
9+
| `validate` | Before committing, after changes, to verify code quality |
10+
| `test` | To run targeted tests for your changes |
11+
| `create-pr` | To create a pull request with concise description |
12+
| `release` | To cut a new version release |
13+
14+
## Architecture
15+
16+
Workout CLI is a command-line tool for tracking workouts, managing exercises, and querying training history.
17+
18+
- **Runtime**: Bun (not Node.js)
19+
- **Language**: TypeScript with ES modules, strict mode
20+
- **CLI**: Commander.js for command parsing
21+
- **Storage**: JSON files in `~/.workout/`
22+
- **Validation**: Zod schemas
23+
24+
## Project Structure
25+
26+
```
27+
src/
28+
├── index.ts # CLI entry point
29+
├── commands/ # Command implementations
30+
├── data/ # Storage and data access
31+
├── types.ts # Zod schemas and types
32+
└── exercises.ts # Pre-populated exercise library
33+
test/
34+
└── *.test.ts # Vitest tests
35+
```
36+
37+
## Code Style
38+
39+
- Fight entropy - leave the codebase better than you found it
40+
- Prefer simpler solutions where it reasonably makes sense
41+
- Minimal dependencies
42+
- Early returns, fail fast
43+
- TypeScript strict mode
44+
- No comments in code (self-documenting)
45+
46+
## Testing Philosophy
47+
48+
- Focus on functionality testing, not coverage metrics
49+
- Test behavior, not implementation details
50+
- Write tests for commands and data operations
51+
- Don't chase vanity metrics
52+
53+
## Constraints
54+
55+
- No skipping failing tests
56+
- Run `bun run validate` before committing
57+
- Pre-commit hooks run linting and tests automatically

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

0 commit comments

Comments
 (0)