Add @filehub/rclone package #89

Merged
miro merged 3 commits from claude/rclone-rc-fetch-package-f64ded into main 2026-10-12 19:40:22 +00:00
Owner

Summary

Adds @filehub/rclone (packages/rclone), a fetch-based client for the rclone rc HTTP API.

  • createRcloneClient({ url, user?, pass?, fetch?, timeoutMs? }) with a typed call() plus helpers: list, listRemotes, listProviders, mkdir, deleteFile, startJob, jobStatus, stopJob, noop.
  • A command registry (rcloneCommands) maps known command names to valibot params and response schemas (23 commands including core/stats, config/providers, operations/*, sync/*, job/*). call("job/status", { jobid }) is fully typed and validated. Unregistered commands can pass their own schema.
  • Control keys are separate call options (async, group) mapped to rclone's _async/_group, so they cannot clash with real params such as core/stats' group.
  • PascalCase responses (operations/list, operations/stat, config/providers) are mapped to camelCase.
  • Empty lists that rclone sends as null are normalised to [].
  • Errors: RcloneError (non-2xx), RcloneResponseError (non-JSON or schema mismatch), RcloneRequestError (network failure or timeout, including a timeout while the body streams, with timedOut). Per-call timeoutMs (null disables) and signal are supported.
  • Basic auth uses TextEncoder/btoa, so it has no Node-only dependency and handles UTF-8 credentials.
  • 48 vitest unit tests with a mocked fetch, plus 14 integration tests that run against a real rclone rcd (open and basic-auth servers, with a files: alias remote like the Docker image). Set RCLONE_BIN to choose the binary; the integration suite skips itself when rclone can't be run.

Notes

  • Response schemas were written from the rclone docs. The integration tests confirm them against rclone 1.69.0 (the Dockerfile's version) for an idle server; not yet run against 1.75.2 (mise.toml), and the shape of transferring during an active transfer is untested.
  • Not included yet: config/create|update|delete|password, vfs/*, options/*, sync/bisync, operations/check, mount/*.

Test plan

  • pnpm --filter @filehub/rclone test
  • pnpm --filter @filehub/rclone typecheck
  • biome check and knip
  • Integration tests against a real rclone rcd 1.69.0
## Summary Adds `@filehub/rclone` (`packages/rclone`), a fetch-based client for the `rclone rc` HTTP API. - `createRcloneClient({ url, user?, pass?, fetch?, timeoutMs? })` with a typed `call()` plus helpers: `list`, `listRemotes`, `listProviders`, `mkdir`, `deleteFile`, `startJob`, `jobStatus`, `stopJob`, `noop`. - A command registry (`rcloneCommands`) maps known command names to valibot params and response schemas (23 commands including `core/stats`, `config/providers`, `operations/*`, `sync/*`, `job/*`). `call("job/status", { jobid })` is fully typed and validated. Unregistered commands can pass their own `schema`. - Control keys are separate call options (`async`, `group`) mapped to rclone's `_async`/`_group`, so they cannot clash with real params such as `core/stats`' `group`. - PascalCase responses (`operations/list`, `operations/stat`, `config/providers`) are mapped to camelCase. - Empty lists that rclone sends as `null` are normalised to `[]`. - Errors: `RcloneError` (non-2xx), `RcloneResponseError` (non-JSON or schema mismatch), `RcloneRequestError` (network failure or timeout, including a timeout while the body streams, with `timedOut`). Per-call `timeoutMs` (`null` disables) and `signal` are supported. - Basic auth uses `TextEncoder`/`btoa`, so it has no Node-only dependency and handles UTF-8 credentials. - 48 vitest unit tests with a mocked `fetch`, plus 14 integration tests that run against a real `rclone rcd` (open and basic-auth servers, with a `files:` alias remote like the Docker image). Set `RCLONE_BIN` to choose the binary; the integration suite skips itself when rclone can't be run. ## Notes - Response schemas were written from the rclone docs. The integration tests confirm them against rclone 1.69.0 (the Dockerfile's version) for an idle server; not yet run against 1.75.2 (`mise.toml`), and the shape of `transferring` during an active transfer is untested. - Not included yet: `config/create|update|delete|password`, `vfs/*`, `options/*`, `sync/bisync`, `operations/check`, `mount/*`. ## Test plan - [x] `pnpm --filter @filehub/rclone test` - [x] `pnpm --filter @filehub/rclone typecheck` - [x] `biome check` and `knip` - [x] Integration tests against a real `rclone rcd` 1.69.0
Add @filehub/rclone, a typed fetch client for rclone rc
All checks were successful
CI / lint (pull_request) Successful in 27s
CI / test (pull_request) Successful in 44s
CI / typecheck (pull_request) Successful in 45s
CI / format (pull_request) Successful in 46s
CI / knip (pull_request) Successful in 47s
CI / build (pull_request) Successful in 41s
CI / docker (arm64, docker-arm64) (pull_request) Successful in 32s
CI / docker (amd64, docker-amd64) (pull_request) Successful in 50s
CI / manifest (pull_request) Has been skipped
CI / deploy-test (pull_request) Has been skipped
E2E / playwright (pull_request) Successful in 1m48s
20111c6dce
Harden rclone client after review
All checks were successful
CI / lint (pull_request) Successful in 28s
CI / test (pull_request) Successful in 36s
CI / format (pull_request) Successful in 37s
CI / typecheck (pull_request) Successful in 39s
CI / knip (pull_request) Successful in 39s
CI / docker (arm64, docker-arm64) (pull_request) Successful in 17s
CI / build (pull_request) Successful in 42s
CI / docker (amd64, docker-amd64) (pull_request) Successful in 23s
CI / manifest (pull_request) Has been skipped
CI / deploy-test (pull_request) Has been skipped
E2E / playwright (pull_request) Successful in 2m17s
67a888f970
Add integration tests against a real rclone rcd
All checks were successful
CI / lint (pull_request) Successful in 27s
CI / test (pull_request) Successful in 27s
CI / format (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 44s
CI / knip (pull_request) Successful in 46s
CI / docker (arm64, docker-arm64) (pull_request) Successful in 22s
CI / build (pull_request) Successful in 38s
CI / docker (amd64, docker-amd64) (pull_request) Successful in 22s
CI / manifest (pull_request) Has been skipped
CI / deploy-test (pull_request) Has been skipped
E2E / playwright (pull_request) Successful in 1m45s
3183bc4659
miro merged commit 28d2850b2a into main 2026-10-12 19:40:22 +00:00
miro deleted branch claude/rclone-rc-fetch-package-f64ded 2026-10-12 19:40:22 +00:00
miro referenced this pull request from a commit 2026-10-12 19:40:23 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
miro/files!89
No description provided.