Slice 6: right-click command menu + git write actions

git boundary: Pull/Push/Commit/DiscardAll (discard is 1.4-destructive). Scanner.RefreshRepo re-scans one repo after a mutation. Service GitFetch/GitPull/GitPush/GitCommit/GitDiscard record a git-* activity event and refresh on success; service.New takes a refresh hook. HTTP POST /api/repo/git. New <repo-menu> overlay with plain-language commands (Get latest/Publish/Check for updates/Save my work/Set active/Ask Claude to switch/Copy path/Discard all changes), summoned by repo-list's repo:contextmenu. Added service test for commit/discard on a temp repo. Verified the menu live for safe commands.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 09:12:18 -04:00
parent 9d1519222c
commit 6ef1c195e3
13 changed files with 521 additions and 9 deletions
+28
View File
@@ -120,6 +120,34 @@ func (c *CLI) Fetch(ctx context.Context, dir string) error {
return err
}
// --- Mutating operations (user/Claude-initiated only; §1.3, §1.4) -----------
// Pull integrates the upstream branch (fetch + merge/ff per repo config).
func (c *CLI) Pull(ctx context.Context, dir string) (string, error) {
return c.run(ctx, dir, "pull")
}
// Push publishes the current branch to its upstream. Plain push only — never a
// forced push here (that is a §1.4 action to be added deliberately if ever).
func (c *CLI) Push(ctx context.Context, dir string) (string, error) {
return c.run(ctx, dir, "push")
}
// Commit stages every change and commits it with message.
func (c *CLI) Commit(ctx context.Context, dir, message string) (string, error) {
if _, err := c.run(ctx, dir, "add", "-A"); err != nil {
return "", err
}
return c.run(ctx, dir, "commit", "-m", message)
}
// DiscardAll hard-resets tracked files to HEAD, throwing away uncommitted
// changes. DESTRUCTIVE (§1.4): callers MUST confirm with the user first.
// Untracked files are left in place.
func (c *CLI) DiscardAll(ctx context.Context, dir string) (string, error) {
return c.run(ctx, dir, "reset", "--hard", "HEAD")
}
// Branch is a local branch and its upstream, if any.
type Branch struct {
Name string `json:"name"`