|
| 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