Skip to content

Conversation

@LudeeD
Copy link
Contributor

@LudeeD LudeeD commented Jan 23, 2026

No description provided.

@LudeeD LudeeD requested review from Alw3ys and dduuukk as code owners January 23, 2026 10:27
@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

Walkthrough

This PR introduces device approval and revocation capabilities to the CLI, adding new commands for managing device approvals. It also standardizes Docker configuration paths, excludes volumes from build context, and updates container cgroup settings.

Changes

Cohort / File(s) Summary
Docker & Container Configuration
.dockerignore, api.Dockerfile, compose.yaml
Added volumes/ exclusion pattern to .dockerignore; changed ROLES_PATH from relative (./api/roles.toml) to absolute (/app/api/roles.toml) in api.Dockerfile; added cgroup: host directive to device service in compose.yaml
CLI API Methods
cli/src/api.rs
Added two new async methods: approve_device(device_id) and revoke_device(device_id) to SmithAPI, each sending authorized POST/DELETE requests to device approval endpoints
CLI Command Definitions
cli/src/cli.rs
Added Approve and Revoke command variants to Commands enum; both include flattened DeviceSelector and --yes flag for confirmation bypass
CLI Command Implementation
cli/src/main.rs
Implemented handler branches for Approve and Revoke commands with device validation, filtering by approval status, preview display, confirmation prompts, batch processing, and per-device error handling

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI
    participant SmithAPI
    participant Server

    User->>CLI: approve/revoke with device selector
    CLI->>CLI: Validate selector has filters
    CLI->>SmithAPI: Authenticate & create client
    SmithAPI->>Server: Fetch devices matching selector
    Server-->>SmithAPI: Device list
    SmithAPI-->>CLI: Device list
    CLI->>CLI: Filter (unapproved or approved)
    CLI->>CLI: Deduplicate by device.id
    CLI->>User: Show preview of matched devices
    User->>CLI: Confirm operation (or use --yes)
    loop For each selected device
        alt Approve
            CLI->>SmithAPI: POST /devices/{id}/approval
        else Revoke
            CLI->>SmithAPI: DELETE /devices/{id}/approval
        end
        SmithAPI->>Server: Send request with auth
        Server-->>SmithAPI: Success or error
        SmithAPI-->>CLI: Result
        CLI->>User: Log per-device outcome
    end
    CLI->>User: Print "Done!"
Loading
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining the purpose of the approve/revoke CLI commands, their usage, and how they fit into the larger feature.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: approve on the cli' clearly describes the main addition: CLI commands for device approval, which aligns with the primary changes across multiple files (cli.rs, main.rs, api.rs).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

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