Add basecamp files replace: publish a new version of an uploaded file
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
notifyon the wire) - the description carries forward unless
--descriptionis given; an
explicit--description ""clears it (tri-state pinned by
TestFilesReplaceDescriptionTriState, including that omission stays off
the wire) --base-namerenames 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 SDKUploadsService.CreateVersion(stage attachment, then POST to versions). - Behavior: no notifications; description carries forward unless
--descriptionis set (empty clears);--base-namerenames 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.
- Command:
-
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
--descriptionbefore staging any data. - Breadcrumbs: reuse the caller’s reference; include
--projectwith fallback to the root-level--projectwhen the group flag is unset; shell-quote all embedded values (bothfiles replaceandfiles versions) so emitted commands are safe and round-trip through a shell. - Smoke test: read JSON from
$outputdirectly; tests pin--base-namepresence/omission behavior.
- 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