feat: add media CLI commands #95

Merged
erik merged 1 commit from feat/task-c1022af3-media-cli into main 2026-06-04 08:08:37 -05:00
Owner

Summary

Implement Slugkit media management commands in the CLI.

Task

#task-c1022af3

Changes

  • Add slug media upload <file> [--alt <text>] [--key <key>] [--json]
  • Add slug media show <id> [--json]
  • Add slug media delete <id> [--json]
  • Send uploads as multipart FormData with file, optional altText, and optional key
  • Validate local files before upload requests
  • Render media metadata and public URLs in human output
  • Support JSON output for upload/show/delete
  • Add mocked CLI tests for upload success, missing local files, show/delete, JSON output, API validation/auth/storage/501/network failures, and invalid usage

Testing

  • Unit tests added/updated
  • Manual testing performed

Checklist

  • ./scripts/pre-pr.sh passes
  • Documentation updated (CLI help)
  • No unrelated changes included
## Summary Implement Slugkit media management commands in the CLI. ## Task #task-c1022af3 ## Changes - Add `slug media upload <file> [--alt <text>] [--key <key>] [--json]` - Add `slug media show <id> [--json]` - Add `slug media delete <id> [--json]` - Send uploads as multipart `FormData` with `file`, optional `altText`, and optional `key` - Validate local files before upload requests - Render media metadata and public URLs in human output - Support JSON output for upload/show/delete - Add mocked CLI tests for upload success, missing local files, show/delete, JSON output, API validation/auth/storage/501/network failures, and invalid usage ## Testing - [x] Unit tests added/updated - [ ] Manual testing performed ## Checklist - [x] `./scripts/pre-pr.sh` passes - [x] Documentation updated (CLI help) - [x] No unrelated changes included
feat: add media CLI commands
All checks were successful
CI / build-lint-test (pull_request) Successful in 30s
c4d84de300
Task: #task-c1022af3
Author
Owner

PR Review

Summary

Reviewed PR #95 against task task-c1022af3. The PR adds media upload/show/delete CLI commands, multipart upload support, local file validation before upload, human/JSON output, and mocked tests for success and common failures.

Acceptance criteria

  • Can upload media from a local file. — slug media upload <file> validates and reads a local file, builds multipart FormData, and calls POST /media.
  • Upload output includes returned media URL and metadata. — human output prints id, filename, MIME type, key, alt text, URL, and created time when returned.
  • Can delete media by ID where specified. — slug media delete <id> calls DELETE /media/{id} and supports JSON delete confirmation.
  • Missing local files fail before an API request is made. — tests assert no mocked fetch call occurs for a missing file.
  • JSON output is valid when requested. — tests parse upload JSON output and delete JSON output.
  • Tests cover upload success, missing file, API validation failure, and delete behavior. — CLI tests cover upload, missing file, show/delete, unsupported/validation-style API failure, auth, storage/API, 501, network, and invalid usage.
  • Relevant lint/test checks pass. — ./scripts/pre-pr.sh passed locally and Forgejo CI succeeded.

Blocking issues

None.

Warnings

None.

Verification

  • make check passed locally before commit.
  • ./scripts/pre-pr.sh passed locally.
  • Forgejo CI status for CI / build-lint-test (pull_request) is success.

Verdict

Approved. Ready for human merge approval.

PR Review Worker Result

  • pr: open
  • review: approved
  • pr_comment: posted
  • task_comment: posted
  • blocking_issues: 0
  • warnings: 0
  • criteria_total: 7
  • criteria_met: 7
  • criteria_missing: 0
## PR Review ### Summary Reviewed PR #95 against task `task-c1022af3`. The PR adds media upload/show/delete CLI commands, multipart upload support, local file validation before upload, human/JSON output, and mocked tests for success and common failures. ### Acceptance criteria - [x] Can upload media from a local file. — `slug media upload <file>` validates and reads a local file, builds multipart `FormData`, and calls `POST /media`. - [x] Upload output includes returned media URL and metadata. — human output prints id, filename, MIME type, key, alt text, URL, and created time when returned. - [x] Can delete media by ID where specified. — `slug media delete <id>` calls `DELETE /media/{id}` and supports JSON delete confirmation. - [x] Missing local files fail before an API request is made. — tests assert no mocked fetch call occurs for a missing file. - [x] JSON output is valid when requested. — tests parse upload JSON output and delete JSON output. - [x] Tests cover upload success, missing file, API validation failure, and delete behavior. — CLI tests cover upload, missing file, show/delete, unsupported/validation-style API failure, auth, storage/API, 501, network, and invalid usage. - [x] Relevant lint/test checks pass. — `./scripts/pre-pr.sh` passed locally and Forgejo CI succeeded. ### Blocking issues None. ### Warnings None. ### Verification - `make check` passed locally before commit. - `./scripts/pre-pr.sh` passed locally. - Forgejo CI status for `CI / build-lint-test (pull_request)` is `success`. ### Verdict Approved. Ready for human merge approval. PR Review Worker Result - pr: open - review: approved - pr_comment: posted - task_comment: posted - blocking_issues: 0 - warnings: 0 - criteria_total: 7 - criteria_met: 7 - criteria_missing: 0
erik merged commit 578ea40753 into main 2026-06-04 08:08:37 -05:00
erik deleted branch feat/task-c1022af3-media-cli 2026-06-04 08:08:37 -05:00
Sign in to join this conversation.
No description provided.