Implement slug media commands #11

Closed
opened 2026-05-19 19:51:44 -05:00 by erik · 3 comments
Owner

Goal

Implement slug media management commands against the Slugkit media API.

Spec: docs/cli-specs/07-media-commands.md

Requirements

  • Implement media commands from the spec, including upload and delete behavior.
  • Send uploads using the request format required by the media API.
  • Display returned media metadata and public URLs clearly.
  • Support valid JSON output where specified.
  • Validate local file existence before attempting upload.
  • Display target site/profile before mutations.
  • Surface local filesystem errors, validation errors, auth errors, storage/API failures, and 501 Not Implemented responses clearly.
  • Add CLI tests with mocked API responses and filesystem fixtures where practical.

Acceptance criteria

  • Can upload media from a local file.
  • Upload output includes returned media URL and metadata.
  • Can delete media by ID where specified.
  • Missing local files fail before an API request is made.
  • JSON output is valid when requested.
  • Tests cover upload success, missing file, API validation failure, and delete behavior.
  • Relevant lint/test checks pass.

Dependencies

  • task-a3cd5595
  • task-8b14c508
## Goal Implement `slug` media management commands against the Slugkit media API. Spec: `docs/cli-specs/07-media-commands.md` ## Requirements - Implement media commands from the spec, including upload and delete behavior. - Send uploads using the request format required by the media API. - Display returned media metadata and public URLs clearly. - Support valid JSON output where specified. - Validate local file existence before attempting upload. - Display target site/profile before mutations. - Surface local filesystem errors, validation errors, auth errors, storage/API failures, and `501 Not Implemented` responses clearly. - Add CLI tests with mocked API responses and filesystem fixtures where practical. ## Acceptance criteria - [ ] Can upload media from a local file. - [ ] Upload output includes returned media URL and metadata. - [ ] Can delete media by ID where specified. - [ ] Missing local files fail before an API request is made. - [ ] JSON output is valid when requested. - [ ] Tests cover upload success, missing file, API validation failure, and delete behavior. - [ ] Relevant lint/test checks pass. ## Dependencies - task-a3cd5595 - task-8b14c508
Author
Owner

Synced from todu comment by @todu on 2026-06-04T13:03:00.179Z

Start approved

Approved implementation plan:

  • Add media CLI commands:
    • slug media upload <file> [--alt <text>] [--key <key>] [--json]
    • slug media show <id> [--json]
    • slug media delete <id> [--json]
  • Upload via POST /api/v1/media using the media API upload request format.
  • Show media metadata via GET /api/v1/media/{id}.
  • Delete media via DELETE /api/v1/media/{id}.
  • Validate local file existence before upload API requests.
  • Display target API before upload/delete mutations in human output.
  • Support valid JSON output.
  • Add CLI tests for upload success, missing file, API validation/auth/storage/501 failures, show, delete, and invalid usage.
  • Run local checks, open PR, wait for CI, run review, and stop for merge approval.
_Synced from todu comment by @todu on 2026-06-04T13:03:00.179Z_ ## Start approved Approved implementation plan: - Add media CLI commands: - `slug media upload <file> [--alt <text>] [--key <key>] [--json]` - `slug media show <id> [--json]` - `slug media delete <id> [--json]` - Upload via `POST /api/v1/media` using the media API upload request format. - Show media metadata via `GET /api/v1/media/{id}`. - Delete media via `DELETE /api/v1/media/{id}`. - Validate local file existence before upload API requests. - Display target API before upload/delete mutations in human output. - Support valid JSON output. - Add CLI tests for upload success, missing file, API validation/auth/storage/501 failures, show, delete, and invalid usage. - Run local checks, open PR, wait for CI, run review, and stop for merge approval.
erik 2026-06-04 08:12:58 -05:00
Author
Owner

Synced from todu comment by @todu on 2026-06-04T13:10:58.876Z

Completed

  • Implemented media CLI commands for slug media upload, slug media show, and slug media delete.
  • Verified acceptance criteria against merged PR evidence: PR #95 is merged into main at 578ea40, with implementation commit c4d84de updating cli/src/commands.ts, cli/src/http.ts, and cli/src/__tests__/commands.test.ts.
  • Verified review/quality evidence from the PR review comment: 7/7 acceptance criteria met, make check and ./scripts/pre-pr.sh passed locally, and Forgejo CI CI / build-lint-test (pull_request) succeeded.
_Synced from todu comment by @todu on 2026-06-04T13:10:58.876Z_ ### Completed - Implemented media CLI commands for `slug media upload`, `slug media show`, and `slug media delete`. - Verified acceptance criteria against merged PR evidence: PR #95 is merged into `main` at `578ea40`, with implementation commit `c4d84de` updating `cli/src/commands.ts`, `cli/src/http.ts`, and `cli/src/__tests__/commands.test.ts`. - Verified review/quality evidence from the PR review comment: 7/7 acceptance criteria met, `make check` and `./scripts/pre-pr.sh` passed locally, and Forgejo CI `CI / build-lint-test (pull_request)` succeeded.
Author
Owner

Synced from todu comment by @todu on 2026-06-04T13:08:02.503Z

PR Review

PR: #95

Review result: approved

Acceptance criteria: 7 total, 7 met, 0 missing

Blocking issues: 0
Warnings: 0

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
_Synced from todu comment by @todu on 2026-06-04T13:08:02.503Z_ ## PR Review PR: https://forge.caradoc.com/erik/slugkit/pulls/95 Review result: approved Acceptance criteria: 7 total, 7 met, 0 missing Blocking issues: 0 Warnings: 0 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
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
erik/slugkit#11
No description provided.