Skip to content

feat(cli): add gander new, gander edit, and share write-back - #149

Draft
scott wants to merge 3 commits into
mainfrom
cursor/new-edit-sync-dad7
Draft

scott wants to merge 3 commits into
mainfrom
cursor/new-edit-sync-dad7

Conversation

@scott

@scott scott commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #148

Summary

Adds the three entry points from #148 and writes share saves back to a watched local file.

  • gander new filename.md creates that markdown file, shares it, watches it, and opens the web editor.
  • gander new prompts for a file name on a terminal, then does the same.
  • gander edit filename.md shares an existing file (if needed), watches it, and opens the web editor.

gander new and gander edit open {shareURL}/edit (trailing slashes stripped, and /edit is not appended twice). gander share and gander watch still open the reader URL. --silent still skips the browser. The stored share URL stays the reader path.

Disk → share is unchanged: gander watch / gander share --watch still PUT /api/shares/{uuid} with content only. A returned version is sent on the next sync.

Share → disk follows gandermd #181 (cursor/watch-writeback-chips-093a):

  • POST /api/shares/{uuid}/watch/sync with JSON {"file_hash","version","content?"}. file_hash is the SHA-256 hex of the local file bytes. version is the acked share version. content is included only after the previous response set need_content: true.
  • The response is long-poll JSON {"op":"ok"|"write","version","content?","force?","need_content?"}.
  • On op: "write", the client writes content to the local file (a local edit made during the poll is kept unless force is true) and then POST /api/shares/{uuid}/watch/ack with {"file_hash","version"} (204).
  • On need_content: true, the client posts sync again with the local file content.
  • If the server has no write-back route (404/405), the watch keeps pushing disk changes and stops asking.

Help, the man page, shell completions, and the README list the commands.

Testing

  • go test ./...
  • go vet ./...
  • CGO_ENABLED=0 go build -o /tmp/gander .
  • mandoc -Tlint man/man1/gander.1
Open in Web Open in Cursor 

cursoragent and others added 3 commits October 25, 2026 06:35
Create a markdown file with gander new, and open an existing one with
gander edit. While a local file is watched, share saves are written
back through watch/sync and watch/ack.

Co-authored-by: Scott Miller <scott.miller.utah@gmail.com>
POST /watch/sync and /watch/ack now match gandermd #181: file_hash,
version, optional content, and op ok|write with need_content and force.

Co-authored-by: Scott Miller <scott.miller.utah@gmail.com>
gander edit and gander new open {shareURL}/edit. gander share and
gander watch still open the reader, and --silent still skips the browser.

Co-authored-by: Scott Miller <scott.miller.utah@gmail.com>
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.

Bring shared MD edit and new-file creation into the gander CLI

2 participants