Skip to content

feat: per-request git-sync toggle (closes #42)#43

Merged
raiftekin merged 1 commit into
mainfrom
feat/local-hidden-requests
Apr 15, 2026
Merged

feat: per-request git-sync toggle (closes #42)#43
raiftekin merged 1 commit into
mainfrom
feat/local-hidden-requests

Conversation

@raiftekin

@raiftekin raiftekin commented Apr 15, 2026

Copy link
Copy Markdown
Member

Closes #42.

What

A per-request "sync with git: on/off" toggle. When off, the request stays on disk and in the sidebar/tabs as usual, but git won't push it to teammates. Meant for personal scratch requests — debugging calls, local-only auth probes, half-baked experiments — that you don't want to commit but also don't want to delete.

Why this approach

The issue proposed a local-only mechanism because .gitignore itself syncs to the remote, leaking the ignore list. The natural fit is .git/info/exclude: git's built-in per-clone ignore file that is never pushed. We layer on top of it rather than inventing a new config file.

How it works

Backend (apps/desktop/src/main/git.ts)

Three new helpers, all gated on "is this a git repo":

  • gitLocalHide(workspacePath, relPath) — appends the path to a managed block inside .git/info/exclude:
    # >>> scrapeman:hidden (managed — do not edit)
    /collections/users/probe.req.yaml
    # <<< scrapeman:hidden
    
    Then runs git rm --cached -- <relPath> so any previously-tracked copy leaves the index (the file on disk is untouched). Everything outside the marker block in .git/info/exclude is preserved.
  • gitLocalUnhide(workspacePath, relPath) — removes the entry from the managed block.
  • gitLocalHiddenList(workspacePath) — reads the managed block and intersects with git ls-files on those paths. Anything git is currently tracking gets dropped from the returned list and rewritten out of the exclude file. So if you git add the file in a terminal, scrapeman notices on the next refresh and the icon clears automatically. "Whatever appears in git is unhidden."

IPC wired through git:localHide, git:localUnhide, git:localHiddenList. Bridge typed in @scrapeman/shared-types.

State (store.ts)

  • hiddenRequests: Set<string> keyed by workspace-relative path.
  • loadHiddenRequests() — called on workspace open and on every tree-changed workspace-watcher event, so external git add/git rm get picked up.
  • toggleHiddenRequest(relPath) — flips state and refreshes git status.

UI

  • ui/EyeOffIcon.tsx — a small inline SVG "crossed eye" icon (no new dependency).
  • Sidebar (components/Sidebar.tsx): unsynced request rows render italic/dimmed with the icon. Right-click menu shows "Stop syncing to git" or "Start syncing to git" depending on current state. Menu entry is hidden entirely when the workspace is not a git repo.
  • TabBar (components/TabBar.tsx): the same icon + italic title appears on the tab itself when the underlying file is unsynced — so you can see at a glance that the request you're editing won't be pushed.
  • Command palette + shortcut: ⌘⇧H (Ctrl+Shift+H on Win/Linux) toggles the active tab. Both the palette entry and the keybinding only register when gitStatus.isRepo === true, so non-repo workspaces don't advertise the feature at all.

How to use

  1. Right-click any saved request in the sidebar → Stop syncing to git. An eye-off icon appears on the row and the tab; the request's row goes italic.
  2. Run git status — the file is gone from the list. Already-tracked files get removed from the index via git rm --cached (working copy preserved).
  3. To reverse: right-click → Start syncing to git, or ⌘⇧H on the active tab, or just git add <path> from a terminal (scrapeman auto-detects and clears the icon on next refresh).
  4. Non-repo workspaces never see any of this — the menu item, command, and shortcut all disappear.

Test plan

  • Open a workspace that's a git repo, create a request, right-click → Stop syncing → confirm it disappears from git status and the row goes italic with the eye-off icon
  • Open the same request in a tab → tab shows the eye-off icon and italic title
  • Press ⌘⇧H on the tab → toggles back to synced
  • git add <file> manually from a terminal while it's marked unsynced → reopen workspace or trigger a tree refresh → icon clears automatically, .git/info/exclude managed block no longer lists the path
  • Open a workspace that is NOT a git repo → confirm the sidebar context menu has no sync entry, ⌘⇧H is a no-op, and the command palette doesn't list the toggle
  • Verify nothing outside the # >>> scrapeman:hidden / # <<< scrapeman:hidden markers in .git/info/exclude is modified by hide/unhide round-trips

Mark individual requests as local-only via .git/info/exclude + git rm --cached,
so a user can keep personal scratch requests in the workspace without pushing
them to teammates. UI: sidebar + tab eye-off icon, context menu entry, and
⌘⇧H shortcut. Self-heals when a file becomes tracked externally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@raiftekin
raiftekin merged commit c24e279 into main Apr 15, 2026
3 checks passed
@raiftekin
raiftekin deleted the feat/local-hidden-requests branch April 15, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] Local not-synced Requests

1 participant