Skip to content

feat(cli): titles, references, JSON output and restoring deleted pastes - #72

Merged
darwin67 merged 3 commits into
feat/api-paste-lifecyclefrom
feat/cli-paste-model
Oct 11, 2026
Merged

darwin67 merged 3 commits into
feat/api-paste-lifecyclefrom
feat/cli-paste-model

Conversation

@darwin67

Copy link
Copy Markdown
Member

Summary

The second of two stacked PRs. Stacked on #71, whose endpoints it uses. It brings the Rust client and the CLI up to the redesigned paste model.

Client (textbin-client)

  • Create takes a CreateOptions struct and sends title and reference_url along with syntax, expiry and visibility.
  • Pastes carry their id, title, reference link, share URL, raw URL and timestamps. All of them are optional, so responses from older servers still decode.
  • New calls: list_removed_pastes, restore_paste and purge_paste.
  • Pastes serialize the way the server represents them: text in data, and binary content as base64.

CLI (textbin)

  • create --title … --reference … (alias --ref) prints the server's share link.
  • --json on create, show, delete, deleted and restore prints one line of JSON for scripts. This covers the paste commands in RFD 3's "machine-readable --json" item. The auth commands are not covered yet.
  • delete tells you how to restore the paste. delete --permanent deletes it for good, including one that was already deleted.
  • deleted lists restorable pastes with their reason, purge date and title.
  • restore <id> brings a deleted or expired paste back.

Test plan

  • cargo fmt --check, cargo clippy --workspace --all-features -- -D warnings
  • cargo test --workspace: 61 tests, 0 failures. New tests cover create query params, decoding links, JSON serialization of text and binary pastes, the deleted-collection requests against a stub server, deleted row formatting and argument parsing.
  • End to end against a local server: created a paste with a title and reference, then ran show --json, delete, deleted, restore, delete --permanent, and a restore of the purged paste, which returned 404.

🤖 Generated with Claude Code

https://claude.ai/code/session_019fnjMN7WpEjQJD2zveakV6


Generated by Claude Code

Creating a paste takes a CreateOptions struct instead of a growing list of
positional arguments, and passes title and reference_url along with the
existing syntax, expiry and visibility parameters. Pastes now carry their
id, title, reference link, share and raw URLs and timestamps, all optional
so older servers still decode. New calls list removed pastes, restore one
and delete one for good. Pastes serialize the way the server represents
them, with binary content base64 encoded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019fnjMN7WpEjQJD2zveakV6
- create takes --title and --reference (alias --ref) and prints the
  server's share link.
- create, show, delete, deleted and restore accept --json and print a
  single line of JSON, so scripts can read ids, links and metadata.
- delete explains how to restore the paste; delete --permanent removes it
  for good, including one that was already deleted.
- deleted lists restorable pastes with their reason, purge date and title.
- restore brings a deleted or expired paste back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019fnjMN7WpEjQJD2zveakV6
@github-actions github-actions Bot added the feat label Oct 10, 2026
@darwin67
darwin67 added this pull request to stack #73 October 11, 2026 00:02
@darwin67
darwin67 marked this pull request as ready for review October 11, 2026 00:02
@darwin67

darwin67 commented Oct 11, 2026 •

Copy link
Copy Markdown
Member Author

Oracle review complete: signed off, with no blocking findings in the CLI/client changes. Integrated the reviewed PR71 reference-metadata fix via a history-preserving merge; no Rust code changes were needed. Final validation: cargo fmt --check, cargo clippy --workspace --all-features -- -D warnings, cargo test --workspace, mix precommit (563 ExUnit tests plus JS tests), and mix credo passed. Compatibility note from review: older server responses still decode (wire compatibility), but CreateOptions replaces the previous Rust method argument lists, so downstream Rust callers must migrate; source compatibility is not claimed. Review session: https://ampcode.com/threads/T-01a12594-e2f1-75be-b343-9239564f5c84

Post-push CI is green: memory/local/S3 Elixir tests, Rust tests, formatting/linting, and production-container build passed. Release/publication jobs skipped as expected.

@darwin67
darwin67 merged commit 9e31f33 into main Oct 11, 2026
34 checks passed
@darwin67
darwin67 deleted the feat/cli-paste-model branch October 11, 2026 00:28
@chaba2-bot chaba2-bot Bot mentioned this pull request Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants