[READ-ONLY] Mirror of https://github.com/just-cameron/tangled-cli. Automation-first CLI for Tangled.org

Fix pull/issue records: repo fields are bare DIDs, not AT-URIs; pulls use rounds #23

Open cameron.stream
targeting main
Open opened by and assigned to cameron.stream
targeting main

Refreshed the vendored lexicons from tangled.org/core and found two real bugs: every pull/issue record this CLI wrote was invisible on tangled.org's own appview, even though it wrote successfully and this CLI's own read paths (via constellation) could see it fine.

The bugs #

  1. sh.tangled.repo.pull's target.repo/source.repo and sh.tangled.repo.issue's repo are lexicon format 'did' — a bare DID, never an AT-URI. This CLI populated them with an AT-URI instead, built via buildRepoAtUri, which for the common Tangled stable-DID-remote case fetched https://tangled.org/<did> and regex-scraped an AT-URI out of the page HTML. Fragile, and observed in the wild to sometimes pick up an unrelated AT-URI embedded on the page (e.g. the logged-in viewer's own account) instead of the repo's.
  2. sh.tangled.repo.pull replaced its flat patchBlob field with a required rounds: [{createdAt, patchBlob}] array; this CLI still wrote the old flat shape.

The fix #

  • buildRepoAtUri -> resolveRepoDid (src/utils/at-uri.ts): for stable-DID remotes, the DID in the remote URL already is the repo's own DID — returned directly, no network call. For owner/name remotes, resolves the owner to a DID, lists their sh.tangled.repo records, and matches by name or, when that field is unset (several real repos are identified purely by rkey), by the record's own rkey. Prefers that record's own repoDid field over the owner DID. Deletes the HTML-scraping fallback entirely.
  • createPull writes rounds: [{createdAt, patchBlob}] and target.repo as the resolved DID; also sets target.repoDid (not in the published lexicon, but present on every appview-indexed record observed in the wild).
  • source.repo/source.sha dropped from what gets written: source.repo is for cross-repo (fork) pulls this CLI doesn't create; sha was never in the lexicon and wasn't read back anywhere.
  • issues-api.ts's repo field gets the same bare-DID fix.

Also #

  • Adds tang pr delete <pr-id>: there was no way to remove a botched pull request record via the CLI at all. Author-only, confirms unless --yes.
  • Disconnects this fork from markbennett.ca/tangled-cli: package.json renamed to an unscoped, private 'tangled-cli' (no npm-registry claim), repository URL points at this fork, and the 'source' field (Tangled's fork-parent pointer) is removed from this repo's own sh.tangled.repo record.

Checks #

bun run typecheck, bun run test (330 passing), bun run lint:fix, bun run build all clean. Verified against a real repo (misaligned): pull records now match the exact shape of a known-good, appview-rendered reference PR byte-for-byte.

This pull request has no versions submitted yet.