Add basecamp files replace: publish a new version of an uploaded file

Merged
JE
4mo ago
+873-7

Closes #404 — the write half of the upload-versions story. #622's files versions reads the history; files replace <upload-id|url> <file> writes to
it, over SDK v0.14.0's UploadsService.CreateVersion: stage the file as an
attachment (the same two-step flow as uploads create), then POST it to the
upload's versions endpoint.

The upload keeps its id, URL and comments; the previous file becomes a past
version. That's the issue's use case verbatim: a release script ships each
build to the same published link instead of minting duplicates. (#404
proposed PUT-with-sgid on the upload itself — bc3 has since shipped the
dedicated versions endpoint, which is what this rides.)

Semantics follow the endpoint's presence rules:

  • nobody is notified (no notify on the wire)
  • the description carries forward unless --description is given; an
    explicit --description "" clears it (tri-state pinned by
    TestFilesReplaceDescriptionTriState, including that omission stays off
    the wire)
  • --base-name renames without touching the extension
  • alias: files new-version

Completeness bar: catalog action, API-COVERAGE row, SKILL.md examples +
semantics note, .surface regenerated (406 lines — command + alias across
the tree), unit tests (two-step flow order, URL acceptance, tri-state), a
real write smoke (files replace on the suite's own created upload, then
files versions asserting exactly one current) plus out-of-scope markers for
the alias leaves.

Live-verified against production: uploads create → files replace →
files versions shows both filenames with exactly one current: true, same
upload id throughout. Verification upload trashed after.

bin/ci green at the head (real exit 0).


Summary by cubic

Add basecamp files replace to publish a new version of an uploaded file while keeping the same upload ID/URL and comments. This delivers the write half of #404 and pairs with files versions to support stable links for new builds.

  • New Features

    • Command: basecamp files replace <upload-id|url> <file> (alias: new-version) via SDK UploadsService.CreateVersion (stage attachment, then POST to versions).
    • Behavior: no notifications; description carries forward unless --description is set (empty clears); --base-name renames without changing the extension.
    • Accepts an upload ID or full Basecamp URL; returns the same upload with the new current version.
    • Updated command catalog/help; unit and e2e smoke tests; API coverage docs include replace.
  • Bug Fixes

    • Pre-flight validation: reject URLs on untrusted hosts, URLs for a different account, non-positive upload IDs, wrong recording types, uploads collection/listing URLs (must target a single upload), and unresolved local images in --description before staging any data.
    • Breadcrumbs: reuse the caller’s reference; include --project with fallback to the root-level --project when the group flag is unset; shell-quote all embedded values (both files replace and files versions) so emitted commands are safe and round-trip through a shell.
    • Smoke test: read JSON from $output directly; tests pin --base-name presence/omission behavior.