diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index c722119..0000000 --- a/AGENTS.md +++ /dev/null @@ -1,25 +0,0 @@ -# Repository Guidelines - -## Project Structure & Module Organization - -`src/` contains the React 19 + TypeScript frontend. `src/App.tsx` holds the main screen state, while `src/lib/api.ts` is the single wrapper layer around Tauri `invoke()` calls and `src/lib/types.ts` mirrors Rust-side models. `src-tauri/src/` contains the desktop backend: `lib.rs` registers commands, `actions.rs` handles worktree operations, `git.rs` shells out to `git`, `config.rs` manages `.grove/*.toml`, and `store.rs` persists app state. Treat `dist/` and `src-tauri/target/` as generated output. - -## Build, Test, and Development Commands - -Use `pnpm install` to install frontend dependencies. Run `pnpm tauri:dev` for the full desktop app and `pnpm build` for a frontend-only type-check and production build. Backend verification lives under Rust: `cd src-tauri && cargo test` runs unit tests, and `cd src-tauri && cargo clippy` is the preferred lint pass. These commands were validated in this checkout. - -## Coding Style & Naming Conventions - -Follow the existing style rather than introducing new patterns. TypeScript uses 2-space indentation, semicolons, PascalCase for components and types, and camelCase for functions, state, and Tauri payload fields. Keep frontend IPC definitions in `src/lib/api.ts` and shared TS shapes in `src/lib/types.ts`. Rust follows standard `rustfmt` formatting, `snake_case` names, and `#[serde(rename_all = "camelCase")]` for structs crossing the JS bridge. - -## Design System Preview - -When adjusting colors, tokens, or component styles, use `design-system.html` (project root) to visually verify changes. It imports `src/styles.css` directly via Vite. Run `pnpm tauri:dev` (port 1420), then open `http://localhost:1420/design-system.html` via Chrome DevTools MCP to preview all tokens and components live. Toggle `[data-theme="dark"]` on `` to check dark mode. - -## Testing Guidelines - -Backend tests are inline Rust unit tests placed in `mod tests` blocks inside the relevant module files such as `src-tauri/src/git.rs`, `config.rs`, and `actions.rs`. Add tests next to the behavior you change. There is currently no dedicated frontend test harness, so at minimum run `pnpm build` after UI or API changes and `cargo test` after backend edits. - -## Commit & Pull Request Guidelines - -This exported checkout does not include `.git` metadata, so local history conventions cannot be inspected directly. Use Conventional Commit style subjects in the form `: ` and keep each commit focused. Prefer prefixes such as `feat:`, `fix:`, and `chore:`; use other standard types like `docs:`, `refactor:`, `test:`, `build:`, or `ci:` when they better match the change. Keep the summary short, imperative, and specific, for example `feat: add worktree search`, `fix: handle missing repo config`, or `chore: clean up tauri logging`. PRs should explain the user-visible change, note any config or command-safety impact, link the relevant issue, and include screenshots or short recordings for UI updates. diff --git a/AGENTS.md b/AGENTS.md new file mode 120000 index 0000000..681311e --- /dev/null +++ b/AGENTS.md @@ -0,0 +1 @@ +CLAUDE.md \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md index c10b2c9..cbd0051 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -53,6 +53,7 @@ Notes: - `store.rs` — persists recent repos, PR cache, per-repo config and worktree root overrides, and default terminal as JSON to `~/.grove/store.json`. All functions (`persist`, `load_store`, `store_path`) are Tauri-independent — no `AppHandle` required. - `cli.rs` — clap-based CLI. Worktree lifecycle verbs live under `grove worktree` (`list`, `new`, `detach`, `attach`, `rm`), with hidden top-level aliases (`grove new`/`detach`/`attach`/`rm`) kept for ergonomics. `detach`/`grove worktree detach` also accepts the legacy alias `convert` (the command was first shipped as `convert`). Other groups: `grove open`, `grove hook run/list/edit`, `grove config …`, `grove cd`, `grove shell-init`. `attach` is the inverse of `detach`: it removes a linked worktree and switches the main worktree onto its branch, carrying uncommitted changes via a stash. The binary is dual-mode: CLI args → terminal mode, no args → GUI. Detected in `main.rs` before Tauri init. - `platform/` — cross-platform terminal launch abstraction (`open_terminal_at`, `open_terminal_app`) with per-OS implementations (macOS/Windows/Linux) +- `watcher.rs` — `notify`-based filesystem watcher on the repo's `.git/worktrees/` dir (falls back to `.git/` until it exists), emitting events so the frontend auto-refreshes the worktree list on external git changes. Managed in `lib.rs`; guarded against restart/event loops (#36). **IPC pattern**: Rust structs use `#[serde(rename_all = "camelCase")]`. The frontend calls `invoke("command_name", { input })` and receives camelCase JSON. When adding a new command: register in `lib.rs` `invoke_handler` macro → add TS wrapper in `api.ts` → add type in `types.ts`. @@ -84,6 +85,7 @@ All UI work **must** follow `DESIGN_SYSTEM.md`. Key rules: - `run_command_streaming` treats stderr as info-level during streaming; only escalates to error if exit code is non-zero (git writes informational messages like "Preparing worktree..." to stderr). - Split components when necessary—don’t let a single file take on too much responsibility (for example, exceeding 500 lines). This applies to both React UI components and Rust functional modules. - **Reuse `src/components/` components** — use `Input`, `Textarea`, `Select` from `FormControls.tsx` instead of native ``, `