Skip to content

Commit b453feb

Browse files
committed
Add Justfile with development task recipes
1 parent 1d7d72e commit b453feb

File tree

2 files changed

+198
-2
lines changed

2 files changed

+198
-2
lines changed

AGENTS.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,26 @@
22

33
**IMPORTANT**: When you're on Windows, prefer powershell (pwsh) over bash if possible!
44

5-
**IMPORTANT**: before you do anything else, run the `peas prime` command and heed its output.
5+
**IMPORTANT**: before you do anything else, run the `peas prime` command (or `just prime`) and heed its output.
6+
7+
**IMPORTANT**: This project uses `just` for task automation. Always prefer `just` recipes over manual commands when available. Run `just` to see all available tasks.
8+
9+
## Common Tasks with Just
10+
11+
Use these `just` recipes for common development tasks:
12+
13+
- **Development workflow**: `just dev` - lints (includes formatting), and tests
14+
- **Build**: `just build` or `just build-release`
15+
- **Test**: `just test` or `just test-verbose`
16+
- **Lint**: `just lint` (formats and runs clippy) or `just fix` (auto-fixes)
17+
- **Full CI check**: `just ci` - runs all checks that CI would run
18+
- **Version bump**: `just version-patch`, `just version-minor`, or `just version-major`
19+
- **Release**: `just release "Release message"` - commits, tags, and pushes
20+
- **Documentation**: `just doc` - generates and opens docs
21+
- **Peas operations**: `just prime`, `just list`, `just tui`, etc.
22+
23+
Run `just --list` to see all available tasks.
624

725
## Commit Messages
826

9-
When making a commit, include the relevant bean IDs in the commit message.
27+
When making a commit, include the relevant pea IDs in the commit message (e.g., peas-abc12).

Justfile

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Justfile for peas development
2+
# Install just: https://github.com/casey/just
3+
4+
# Default recipe - show available commands
5+
default:
6+
@just --list
7+
8+
# Build the project in debug mode
9+
build:
10+
cargo build
11+
12+
# Build the project in release mode
13+
build-release:
14+
cargo build --release
15+
16+
# Run all tests
17+
test:
18+
cargo test
19+
20+
# Run tests with output
21+
test-verbose:
22+
cargo test -- --nocapture
23+
24+
# Format code and run linter (checks formatting and runs clippy)
25+
lint:
26+
cargo fmt
27+
cargo clippy -- -D warnings
28+
29+
# Auto-fix issues (fixes clippy issues, then formats)
30+
fix:
31+
cargo clippy --fix --allow-dirty --allow-staged
32+
cargo fmt
33+
34+
# Run all checks (lint includes fmt, so just lint + test)
35+
check: lint test
36+
37+
# Clean build artifacts
38+
clean:
39+
cargo clean
40+
41+
# Install peas locally
42+
install:
43+
cargo install --path .
44+
45+
# Run the TUI
46+
tui:
47+
cargo run --release -- tui
48+
49+
# Prime - show agent instructions
50+
prime:
51+
cargo run -- prime
52+
53+
# List all peas
54+
list:
55+
cargo run -- list
56+
57+
# Show pea by ID
58+
show id:
59+
cargo run -- show {{ id }}
60+
61+
# Create a new pea
62+
create title type="task" status="todo":
63+
cargo run -- create "{{ title }}" --type {{ type }} --status {{ status }}
64+
65+
# Search peas
66+
search query:
67+
cargo run -- search "{{ query }}"
68+
69+
# Generate documentation
70+
doc:
71+
cargo doc --no-deps --open
72+
73+
# Run cargo publish dry-run to verify package
74+
publish-check:
75+
cargo publish --dry-run
76+
77+
# Bump version to patch (0.1.x)
78+
version-patch:
79+
#!/usr/bin/env bash
80+
set -euo pipefail
81+
current=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
82+
echo "Current version: $current"
83+
major=$(echo $current | cut -d. -f1)
84+
minor=$(echo $current | cut -d. -f2)
85+
patch=$(echo $current | cut -d. -f3)
86+
new_patch=$((patch + 1))
87+
new_version="$major.$minor.$new_patch"
88+
echo "New version: $new_version"
89+
sed -i.bak "s/^version = \"$current\"/version = \"$new_version\"/" Cargo.toml
90+
rm Cargo.toml.bak
91+
echo "Version bumped to $new_version"
92+
93+
# Bump version to minor (0.x.0)
94+
version-minor:
95+
#!/usr/bin/env bash
96+
set -euo pipefail
97+
current=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
98+
echo "Current version: $current"
99+
major=$(echo $current | cut -d. -f1)
100+
minor=$(echo $current | cut -d. -f2)
101+
new_minor=$((minor + 1))
102+
new_version="$major.$new_minor.0"
103+
echo "New version: $new_version"
104+
sed -i.bak "s/^version = \"$current\"/version = \"$new_version\"/" Cargo.toml
105+
rm Cargo.toml.bak
106+
echo "Version bumped to $new_version"
107+
108+
# Bump version to major (x.0.0)
109+
version-major:
110+
#!/usr/bin/env bash
111+
set -euo pipefail
112+
current=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
113+
echo "Current version: $current"
114+
major=$(echo $current | cut -d. -f1)
115+
new_major=$((major + 1))
116+
new_version="$new_major.0.0"
117+
echo "New version: $new_version"
118+
sed -i.bak "s/^version = \"$current\"/version = \"$new_version\"/" Cargo.toml
119+
rm Cargo.toml.bak
120+
echo "Version bumped to $new_version"
121+
122+
# Tag and push a release (use after version bump)
123+
release message="Release":
124+
#!/usr/bin/env bash
125+
set -euo pipefail
126+
version=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
127+
echo "Creating release for version $version"
128+
git add Cargo.toml Cargo.lock
129+
git commit -m "{{ message }} v$version"
130+
git tag "v$version"
131+
git push origin main
132+
git push origin "v$version"
133+
echo "Released v$version"
134+
135+
# Start GraphQL server
136+
serve port="4000":
137+
cargo run -- serve --port {{ port }}
138+
139+
# Watch for changes and run tests
140+
watch:
141+
cargo watch -x test
142+
143+
# Watch for changes and run clippy
144+
watch-lint:
145+
cargo watch -x "clippy -- -D warnings"
146+
147+
# Generate a code coverage report (requires cargo-tarpaulin)
148+
coverage:
149+
cargo tarpaulin --out Html --output-dir coverage
150+
151+
# Run benchmark tests (if any)
152+
bench:
153+
cargo bench
154+
155+
# Update dependencies
156+
update:
157+
cargo update
158+
159+
# Check for outdated dependencies
160+
outdated:
161+
cargo outdated
162+
163+
# Security audit (requires cargo-audit)
164+
audit:
165+
cargo audit
166+
167+
# Show current version
168+
version:
169+
@grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2
170+
171+
# Full CI check (what CI would run)
172+
ci: lint test
173+
cargo build --release
174+
cargo publish --dry-run
175+
176+
# Development workflow - lint (includes format) and test
177+
dev: lint test
178+
@echo "✓ All checks passed"

0 commit comments

Comments
 (0)