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
1 change: 1 addition & 0 deletions staged/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
13 changes: 8 additions & 5 deletions staged/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ All components use `var(--*)` for colors—no hardcoded values.
## Commands

```bash
just install # First-time setup (deps + git hooks)
just dev # Run with hot-reload (human runs this)
just fmt # Format all code
just build # Production build
just fmt # Auto-format all code
just lint # Clippy for Rust
just typecheck # Type check everything
just check-all # All checks before submitting
just typecheck # Type-check frontend + backend
just check-all # Format + lint + typecheck (run before pushing)
just ci # Same checks without modifying files (for CI)
just clean # Nuke all build artifacts and dependencies
```

**Note:** The human runs the dev server. Don't start it yourself.
Expand All @@ -74,8 +78,7 @@ just check-all # All checks before submitting

Before finishing work:
```bash
just fmt # Auto-format Rust + TypeScript/Svelte
just check-all # Verify everything passes
just check-all # Auto-formats, then verifies lint + types pass
```

## Git Workflow
Expand Down
68 changes: 29 additions & 39 deletions staged/justfile
Original file line number Diff line number Diff line change
@@ -1,96 +1,86 @@
# Staged - Git Diff Viewer
# Run `just install` once after cloning, then `just dev` to start.

# ============================================================================
# Development
# ============================================================================

# Run the app in development mode (optionally point to another repo)
dev repo="": _ensure-deps
dev repo="":
#!/usr/bin/env bash
set -euo pipefail

# Pick a free port so multiple worktrees can run simultaneously
VITE_PORT=$(python3 -c 'import socket; s=socket.socket(); s.bind(("",0)); print(s.getsockname()[1]); s.close()')
export VITE_PORT

# Build Tauri config with dynamic port
TAURI_CONFIG="{\"build\":{\"devUrl\":\"http://localhost:${VITE_PORT}\"}}"
# Check if we're in a worktree and generate custom icon

# In worktrees, generate a labeled icon so you can tell instances apart
if git rev-parse --is-inside-work-tree &>/dev/null; then
GIT_DIR=$(git rev-parse --git-dir)
if [[ "$GIT_DIR" == *".git/worktrees/"* ]]; then
# Get branch name and take only the last component (after final /)
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
WORKTREE_NAME="${BRANCH_NAME##*/}"
echo "Worktree detected, branch: ${BRANCH_NAME}, label: ${WORKTREE_NAME}"

# Generate dev icon with worktree label
WORKTREE_LABEL="${BRANCH_NAME##*/}"

ICON_DIR="$(pwd)/src-tauri/target/dev-icons"
mkdir -p "$ICON_DIR"
DEV_ICON="$ICON_DIR/icon.icns"

if swift scripts/generate-dev-icon.swift src-tauri/icons/icon.icns "$DEV_ICON" "$WORKTREE_NAME"; then
echo "Generated dev icon with label: ${WORKTREE_NAME}"
# Add icon override to Tauri config

if swift scripts/generate-dev-icon.swift src-tauri/icons/icon.icns "$DEV_ICON" "$WORKTREE_LABEL"; then
echo "🌳 Worktree: ${WORKTREE_LABEL}"
TAURI_CONFIG="{\"build\":{\"devUrl\":\"http://localhost:${VITE_PORT}\"},\"bundle\":{\"icon\":[\"$DEV_ICON\"]}}"
else
echo "Warning: Failed to generate dev icon, using default"
fi
fi
fi
echo "Starting dev server on port ${VITE_PORT}"

echo "Starting on port ${VITE_PORT}"
{{ if repo != "" { "export STAGED_REPO=" + repo } else { "" } }}
npx tauri dev --config "$TAURI_CONFIG"

# Build the app for production
build:
npm run tauri:build

# Run just the frontend (for quick UI iteration)
frontend:
npm run dev

# ============================================================================
# Code Quality
# ============================================================================

# Format all code (Rust + TypeScript/Svelte)
# Auto-format all code
fmt:
cd src-tauri && cargo fmt
npx prettier --write "src/**/*.{ts,svelte,css,html}"

# Check formatting without modifying files
# Verify formatting without modifying files (used by CI/hooks)
fmt-check:
cd src-tauri && cargo fmt --check
npx prettier --check "src/**/*.{ts,svelte,css,html}"

# Lint Rust code
# Lint Rust code with clippy
lint:
cd src-tauri && cargo clippy -- -D warnings

# Type check everything
# Type-check frontend (Svelte + TypeScript) and backend (Rust)
typecheck:
npm run check
cd src-tauri && cargo check

# Run all checks (format, lint, typecheck) - use before submitting work
check-all: fmt-check lint typecheck
# Format, then verify everything passes — run before pushing
check-all: fmt lint typecheck

# Verify everything without modifying files — for CI
ci: fmt-check lint typecheck

# ============================================================================
# Setup & Maintenance
# ============================================================================

# Install deps if needed (runs silently if already installed)
_ensure-deps:
@[ -d node_modules/.package-lock.json ] || npm install
@[ -d src-tauri/target/debug ] || (cd src-tauri && cargo fetch)

# Install dependencies
# First-time setup: install all dependencies and git hooks
install:
rustup default stable
npm install
lefthook install
cd src-tauri && cargo fetch
lefthook install

# Clean build artifacts
# Delete all build artifacts and dependencies
clean:
rm -rf dist
rm -rf dist node_modules
rm -rf src-tauri/target
rm -rf node_modules
12 changes: 6 additions & 6 deletions staged/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions staged/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^6.2.1",
"@tauri-apps/cli": "^2.9.6",
"@tauri-apps/cli": "^2.10.0",
"@tsconfig/svelte": "^5.0.6",
"@types/dompurify": "^3.0.5",
"@types/node": "^24.10.1",
Expand All @@ -26,9 +26,9 @@
"vite": "^7.2.4"
},
"dependencies": {
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/api": "^2.10.0",
"@tauri-apps/plugin-clipboard-manager": "^2.3.2",
"@tauri-apps/plugin-dialog": "^2.4.2",
"@tauri-apps/plugin-dialog": "^2.6.0",
"@tauri-apps/plugin-store": "^2.4.2",
"ansi-to-html": "^0.7.2",
"dompurify": "^3.3.1",
Expand Down
Loading