You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a lightweight docs drift checker and wire it into CI as an early gate plus husky pre-commit.
Also refresh README and copilot instructions to remove stale wording and strengthen source-of-truth guidance.
- If an interaction depends on visual state (hover-only controls, transient overlays), add or use a dedicated test ID before introducing brittle structural selectors.
99
103
-**If a needed `data-testid` does not exist in the UI source, add it.** Never work around a missing test ID with fragile structural selectors — add the `data-testid` attribute to the component/template and use it in the test.
100
104
105
+
## E2E Failure Triage Protocol (Required)
106
+
107
+
When debugging a flaky or platform-specific E2E failure, follow this order exactly.
108
+
109
+
1. Reproduce locally with the narrowest failing scope (single spec or test name).
110
+
2. Classify the failure as one of: deterministic logic bug, timing/timeout issue, state reset leak, or platform-only behavior.
111
+
3. Validate reset assumptions first (workspace cleanup, config DB reset, `sg_workspace_hint` clear, verified reload).
112
+
4. If Windows-only, inspect path format and shell semantics before raising timeouts.
113
+
5. Apply the smallest fix that addresses root cause; avoid masking deterministic failures with broad timeout increases.
114
+
6. Re-run only the affected spec first, then re-run the required E2E gate.
115
+
116
+
### Timeout Budget Policy (Required)
117
+
118
+
- Keep Playwright per-test timeout and helper timeouts aligned; do not change one without auditing the other.
119
+
- For CI reliability updates, document why each timeout changed and which operation consumed the budget.
120
+
- Increase timeouts only when evidence shows slow-environment variance; if failure is deterministic, fix behavior instead.
121
+
- When a timeout is increased, include before/after values in the commit message or PR notes.
122
+
101
123
## Workspace Layout (User Projects)
102
124
103
125
SproutGit manages user repos in a prescribed directory layout:
@@ -114,6 +136,8 @@ SproutGit manages user repos in a prescribed directory layout:
114
136
115
137
## Rust Backend (`src-tauri/src/lib.rs`)
116
138
139
+
`src-tauri/src/lib.rs` is the source of truth for registered Tauri commands via `tauri::generate_handler![]`.
@@ -381,7 +416,10 @@ When adding or changing **any** git or system interaction, follow all rules belo
381
416
-**Option-boundary safety**: For commands that accept untrusted values, use argument boundaries (for example `--` when supported) to prevent option smuggling.
382
417
-**System command registry**: Route all git/system process execution through registered helpers (`GitAction` / `SystemAction`) so behavior is auditable and testable.
383
418
-**Cross-platform compatibility**: Assume macOS, Linux, and Windows on every change. Avoid OS-specific shell utilities unless a platform-specific fallback exists.
419
+
-**Cross-platform subprocess checklist**: For any subprocess-env, hook, or shell-adjacent change, verify quoting, path semantics, and command behavior for bash/zsh and PowerShell (`pwsh` + Windows PowerShell compatibility where relevant).
384
420
-**Path handling**: Use `Path`/`PathBuf` and platform-aware path/env separators. Do not hardcode `:` as PATH separator.
421
+
-**Path canonicalization on Windows**: `std::fs::canonicalize()` returns `\\?\`-prefixed extended-length paths on Windows (e.g. `\\?\D:\...`). Always chain `strip_win_prefix()` from `crate::git::helpers` immediately after any `canonicalize()` call. This applies to paths stored in SQLite, set as subprocess env vars, or passed to shell scripts — not just paths serialised to the frontend. Git for Windows tolerates extended-length paths silently, but PowerShell cmdlets (e.g. `Join-Path`) reject them with cryptic errors.
422
+
-**Single-source normalization rule**: Path normalization logic must live in shared helpers, not duplicated at call sites. When introducing a new canonicalization/normalization path, reuse existing helper functions or add one shared helper first.
385
423
-**Path serialization — frontend-bound values**: Any `Path`/`PathBuf` value serialised in a Tauri command response (struct fields, `Ok(...)` return values) **must** be converted with `path_to_frontend()` from `crate::git::helpers`, not with `to_string_lossy()`. Git always outputs forward slashes on every OS; using the same convention prevents frontend path-comparison mismatches on Windows. Paths passed as arguments to git/system commands should stay as native OS paths via `to_string_lossy()` directly.
386
424
-**Least privilege and clear errors**: Fail closed on invalid input and return clear, user-safe error messages.
387
425
@@ -419,6 +457,29 @@ cargo test --lib # Run unit tests
419
457
- ✅ `cargo test --lib` passes (all tests)
420
458
- ✅ Code is formatted (`cargo fmt` and `pnpm run format`)
421
459
460
+
## Prompt Improvement Loop (Required)
461
+
462
+
After resolving a CI failure or production bug, update these instructions in the same PR when a reusable lesson exists.
463
+
464
+
- Add one durable guardrail: an invariant, checklist item, or triage step.
465
+
- Prefer operational rules over narrative explanation.
466
+
- If no user-facing behavior changed, still capture the prevention rule.
467
+
468
+
## Documentation Drift Prevention (Required)
469
+
470
+
When editing or relying on documentation in this repository:
471
+
472
+
- Treat `README.md`, `.github/copilot-instructions.md`, `src-tauri/src/lib.rs`, `src/lib/sproutgit.ts`, and `package.json` as a consistency set.
473
+
- If a command, script, route, or API wrapper changes in code, update the corresponding docs in the same change.
474
+
- Prefer representative command/API summaries plus explicit source-of-truth links over exhaustive static lists that quickly drift.
475
+
- Remove placeholders and stale claims (for example, outdated URLs or deleted files) immediately when discovered.
476
+
477
+
Quick verification command before commit:
478
+
479
+
```bash
480
+
rg -n "project\.json|YOUR_USERNAME|once CI is set up" README.md .github/copilot-instructions.md
@@ -693,3 +754,4 @@ The `Spinner.svelte` component supports:
693
754
- SQLite + SeaORM (`sqlx-sqlite`) integer decode: avoid `u64` in `FromQueryResult` structs; use `i64` for `INTEGER` columns (timestamps included)
694
755
- Svelte 5 `class:` directive with Tailwind arbitrary values (e.g., `class:bg-[var(--x)]/10={cond}`) works but looks odd
695
756
- Window overflow: parent containers must be `flex flex-col overflow-hidden` for child `flex-1 overflow-auto` to scroll properly
757
+
-**Windows `\\?\` paths in PowerShell**: If a path produced by `canonicalize()` is set as a subprocess env var and consumed by PowerShell, `Join-Path` will fail with "Cannot process argument because the value of argument 'drive' is null". The env var is non-null so a `if (-not $var)` guard won't catch it — the crash happens on the next line that uses the path. Always apply `strip_win_prefix` before passing any path into a hook or child process environment.
Copy file name to clipboardExpand all lines: README.md
+20-5Lines changed: 20 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@
13
13
<palign="center">
14
14
<ahref="#features">Features</a> •
15
15
<ahref="#workflow-policy">Workflow Policy</a> •
16
+
<ahref="#documentation">Documentation</a> •
16
17
<ahref="#screenshots">Screenshots</a> •
17
18
<ahref="#installation">Installation</a> •
18
19
<ahref="#development">Development</a> •
@@ -82,6 +83,14 @@ No conflicts, no stash juggling, no waiting. Each agent works independently on i
82
83
- Branch/worktree binding and lifecycle rules: [docs/branch-worktree-policy.md](docs/branch-worktree-policy.md)
83
84
- Workspace hook model and trigger behavior: [docs/worktree-hooks.md](docs/worktree-hooks.md)
84
85
86
+
## Documentation
87
+
88
+
- Start at [docs/index.md](docs/index.md) for the maintained documentation entry point
89
+
- Product scope and priorities: [docs/requirements.md](docs/requirements.md)
90
+
- Architecture and backend command patterns: [docs/architecture.md](docs/architecture.md)
91
+
- Security posture and hardening decisions: [docs/security-audit.md](docs/security-audit.md)
92
+
- E2E process and adapter behavior: [docs/e2e-test-process.md](docs/e2e-test-process.md), [docs/tauri-playwright-adapter-cheatsheet.md](docs/tauri-playwright-adapter-cheatsheet.md)
93
+
85
94
## Workspace Hooks
86
95
87
96
SproutGit supports workspace-scoped lifecycle hooks stored in `.sproutgit/state.db`.
@@ -157,7 +166,7 @@ SproutGit builds this orchestration layer on top of native Git primitives so wor
157
166
158
167
### Download
159
168
160
-
Pre-built binaries will be available on the [Releases](../../releases) page once CI is set up.
169
+
Pre-built binaries are published on the [Releases](../../releases) page when a release is cut.
161
170
162
171
### Build from source
163
172
@@ -172,7 +181,7 @@ Pre-built binaries will be available on the [Releases](../../releases) page once
0 commit comments