feat(gittree): shared-worktree-safe commit via private GIT_INDEX_FILE #93

Closed
opened 2026-06-07 04:07:39 +00:00 by coilysiren · 1 comment
Owner

Extraction candidate from the coily cmd/coily/ generic-code audit (2026-06-06). Source pinned at coily commit c7c17cb (canonical: forgejo.coilysiren.me/coilyco-bridge/coily). cli-guard is mid-refactor, so the "suggested home" below is the pre-refactor package layout - land this in whatever the post-refactor equivalent is, not necessarily the named package. The durable principle: the classifiers / argv-transforms are generic and move; the policy decisions and message copy stay in coily.

Source: cmd/coily/git_commit.go - runGitCommit + helpers, uses a private GIT_INDEX_FILE. Depends only on cli-guard/shell + verb. Notably already free of coily/Kai paths (only coily git commit:/coily#7 appear, in error strings).

What it does: a concurrency-safe commit. Requires -m/-F plus an explicit -- <paths>, commits the worktree content of exactly those paths against a private GIT_INDEX_FILE seeded from HEAD, refuses the editor, then best-effort resyncs the shared index. Lets concurrent sessions sharing one working tree commit without crossing each other's messages or staged content.

Generic core (lift this): the private-index commit technique, the argv split at --, message-source/editor detection, and gitArgv assembly - all pure git mechanics.

Consumer seam to parameterize: error-message branding (coily git commit: prefix, coily#7 refs) -> caller-supplied prefix/template. The cli.Command wiring stays in coily; runGitCommit core + helpers become a SafeCommit-style primitive.

Suggested home (pre-refactor): extend gittree.

Done when:

  • generic logic lives in cli-guard with zero coily/Kai/Forgejo identifiers or defaults
  • behavior-covered tests (table tests where the source has them)
  • godoc-current.txt regenerated (scripts/check-godoc-current.sh --update)
  • coily migrated onto the extracted API, its local copy deleted, make test green both sides
  • closes this issue

Why it matters: shared-worktree concurrency is a real hazard for any multi-session guarded CLI - this is exactly the hardened primitive cli-guard exists to centralize.

> Extraction candidate from the coily `cmd/coily/` generic-code audit (2026-06-06). Source pinned at coily commit `c7c17cb` (canonical: `forgejo.coilysiren.me/coilyco-bridge/coily`). **cli-guard is mid-refactor**, so the "suggested home" below is the pre-refactor package layout - land this in whatever the post-refactor equivalent is, not necessarily the named package. The durable principle: **the classifiers / argv-transforms are generic and move; the policy decisions and message copy stay in coily.** **Source:** `cmd/coily/git_commit.go` - `runGitCommit` + helpers, uses a private `GIT_INDEX_FILE`. Depends only on `cli-guard/shell` + `verb`. Notably already free of coily/Kai paths (only `coily git commit:`/coily#7 appear, in error strings). **What it does:** a concurrency-safe commit. Requires `-m/-F` plus an explicit `-- <paths>`, commits the worktree content of exactly those paths against a private `GIT_INDEX_FILE` seeded from HEAD, refuses the editor, then best-effort resyncs the shared index. Lets concurrent sessions sharing one working tree commit without crossing each other's messages or staged content. **Generic core (lift this):** the private-index commit technique, the argv split at `--`, message-source/editor detection, and `gitArgv` assembly - all pure git mechanics. **Consumer seam to parameterize:** error-message branding (`coily git commit:` prefix, coily#7 refs) -> caller-supplied prefix/template. The `cli.Command` wiring stays in coily; `runGitCommit` core + helpers become a `SafeCommit`-style primitive. **Suggested home (pre-refactor):** extend `gittree`. **Done when:** - [ ] generic logic lives in cli-guard with zero coily/Kai/Forgejo identifiers or defaults - [ ] behavior-covered tests (table tests where the source has them) - [ ] `godoc-current.txt` regenerated (`scripts/check-godoc-current.sh --update`) - [ ] coily migrated onto the extracted API, its local copy deleted, `make test` green both sides - [ ] `closes` this issue **Why it matters:** shared-worktree concurrency is a real hazard for any multi-session guarded CLI - this is exactly the hardened primitive cli-guard exists to centralize.
Author
Owner

Backlog burndown 2026-06-17: closing low-priority (P3/P4) to bring the open count to a manageable level. Nothing lost — reopen if this resurfaces. Batch tag: burndown-2026-06.

Backlog burndown 2026-06-17: closing low-priority (P3/P4) to bring the open count to a manageable level. Nothing lost — reopen if this resurfaces. Batch tag: `burndown-2026-06`.
coilysiren 2026-06-17 08:23:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/cli-guard#93
No description provided.