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 #
sh.tangled.repo.pull'starget.repo/source.repoandsh.tangled.repo.issue'srepoare lexicon format 'did' — a bare DID, never an AT-URI. This CLI populated them with an AT-URI instead, built viabuildRepoAtUri, which for the common Tangled stable-DID-remote case fetchedhttps://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.sh.tangled.repo.pullreplaced its flatpatchBlobfield with a requiredrounds: [{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 theirsh.tangled.reporecords, and matches bynameor, when that field is unset (several real repos are identified purely by rkey), by the record's own rkey. Prefers that record's ownrepoDidfield over the owner DID. Deletes the HTML-scraping fallback entirely.createPullwritesrounds: [{createdAt, patchBlob}]andtarget.repoas the resolved DID; also setstarget.repoDid(not in the published lexicon, but present on every appview-indexed record observed in the wild).source.repo/source.shadropped from what gets written:source.repois for cross-repo (fork) pulls this CLI doesn't create;shawas never in the lexicon and wasn't read back anywhere.issues-api.ts'srepofield 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.