Skip to content

feat(tb-lf): add share upload command#35

Merged
trogulja merged 2 commits into
mainfrom
feat/tb-lf-share
May 20, 2026
Merged

feat(tb-lf): add share upload command#35
trogulja merged 2 commits into
mainfrom
feat/tb-lf-share

Conversation

@trogulja
Copy link
Copy Markdown
Collaborator

Summary

Adds a tb-lf share upload command that posts files to the new DevPortal Shares API (productiveio/devportal#284). Lets us go from "I have an HTML report" to a short shareable URL with one command from the terminal.

tb-lf share upload report.html
tb-lf share upload report.html diagram.png --visibility unlisted --title "Q3 review"
tb-lf share upload bundle/*.html --visibility unlisted --json

Reserves the `share` namespace for upcoming actions (`list`, `delete`, `show`) which will follow as DevPortal exposes the corresponding endpoints.

Implementation

  • Enables `multipart` + `stream` features on workspace `reqwest`.
  • Adds `DevPortalClient::post_multipart` which posts to the bare DevPortal URL (not the `/spa_api/ai` API base) — Shares is cross-team infrastructure at `/spa_api/shares`.
  • Stores `config.url` separately as `devportal_url` on the client so existing `/spa_api/ai/*` paths keep using the AI-prefixed base.
  • `mime_for_path` provides explicit Content-Type for common extensions. The DevPortal-side CSP injector only fires on `text/html` / `application/xhtml+xml`, so accurate MIME at upload time controls whether the security policy gets baked in.

Drive-by

Replaced two pre-existing `3.14` literals in `types.rs` tests that clippy 1.93 now flags as `approx_constant`. Per repo CLAUDE.md: don't waste time proving pre-existing — fix it.

Requires

  • productiveio/devportal#284 to be merged + deployed before this is usable end-to-end. The CLI compiles and runs without it, but POST will fail.

Test plan

  • `cargo build -p tb-lf` — clean
  • `cargo clippy -p tb-lf --all-targets -- -D warnings` — clean
  • `cargo test -p tb-lf` — 3 passing
  • `./target/debug/tb-lf share --help` — shows subcommand
  • `./target/debug/tb-lf share upload --help` — shows args
  • Once devportal#284 is deployed: `DEVPORTAL_TOKEN=... tb-lf share upload ./output/lazy-output-alpha-report.html --visibility unlisted` returns a working `/s/` URL

🤖 Generated with Claude Code

Adds a new `tb-lf share` subcommand. Today only `upload` exists:

  tb-lf share upload <file>...
    --visibility private|unlisted   (default: private)
    --title "<title>"               (optional)
    --json                          (machine-readable output)

Reserves the `share` namespace for upcoming actions like `list`, `delete`,
and `show` (which will land alongside the matching DevPortal API endpoints).

## Implementation notes

- Enables `multipart` + `stream` features on workspace `reqwest`.
- Adds `DevPortalClient::post_multipart` which posts to the bare DevPortal
  URL (not the `/spa_api/ai` API base) because Shares is cross-team
  infrastructure that lives at `/spa_api/shares`.
- Stores `config.url` separately as `devportal_url` on the client.
- `mime_for_path` provides explicit Content-Type for common extensions —
  DevPortal-side CSP injector only triggers on `text/html` / `application/xhtml+xml`,
  so accurate MIME at upload time is what controls whether CSP is added.

## Drive-by fix

Replaced two pre-existing `3.14` literals in `types.rs` tests that
clippy 1.93 now flags as `approx_constant`. Per repo CLAUDE.md ("don't
waste time proving pre-existing — fix it").

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@trogulja trogulja marked this pull request as ready for review May 20, 2026 16:14
@trogulja trogulja merged commit a98247c into main May 20, 2026
1 check passed
@trogulja trogulja deleted the feat/tb-lf-share branch May 20, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant