Agent-focused notes for hacking on remarkable-cli. PRs welcome.
git clone https://github.com/itsfabioroma/remarkable-cli
cd remarkable-cli
go build -o remarkable .
go test ./...- Fork the repo + create a branch off
main. - Make the change. Keep commits small, use conventional-commit prefixes
(
feat:,fix:,docs:,refactor:,test:) — the release changelog groups them automatically. - Run
go test ./...andgofmt -w .locally. CI runsgo vet,gofmtcheck, and the test matrix on ubuntu + macos. - Open a PR against
main. The PR template has a short checklist. - For cloud-affecting changes, run the e2e suite locally first (needs a
real account):
RMCLI_E2E_WRITE=1 go test ./e2e -v
Releases are cut from git tags via goreleaser.
git tag -a v0.2.0 -m "release v0.2.0"
git push origin v0.2.0.github/workflows/release.yml picks up the tag and publishes a GitHub
Release with darwin/linux × amd64/arm64 binaries, archives, and a
checksums.txt. Users then get the update via remarkable update.
# unit + integration
go test ./...
# e2e against real cloud account (writes data)
RMCLI_E2E_WRITE=1 go test ./e2e -vcmd/*.go— one file per cobra command (ls.go,put.go,mv.go, ...).pkg/transport/cloud.go— cloud sync v3/v4 transport (default).pkg/transport/ssh.go— SSH transport (fast, full access).pkg/auth/— cloud device registration + token caching.pkg/model/—Document,Metadata,CLIErrorenvelope.pkg/encoding/,pkg/render/,pkg/extract/—.rmv6 parser, SVG/PNG render, EPUB/highlight extract.
- Copy an existing
cmd/*.go(e.g.cmd/ls.go) as a template. - Define a
cobra.Command, setUse/Short/Args/RunE. - Register in
init()withrootCmd.AddCommand(myCmd). - Acquire transport via
getTransport(); alwaysdefer t.Close().
- JSON output: call
output(v)— neverfmt.Printlnraw structs. - Errors: build with
model.NewCLIError(code, path, msg)and emit viaoutputError(err)before returning. - After any cloud write (
put,mv,rm,mkdir,tags,pages), callsyncCloudDoc(t, docID)so the doc-index merges instead of clobbering. - Keep cmd files small + modular; push logic into
pkg/. - Blank lines between blocks; concise comment on top of each block.
- Don't bypass
output()/outputError()— agents parse stdout as JSON. - Don't add new top-level packages without a reason; prefer extending
pkg/transportorpkg/model. - Don't commit credentials or
~/.config/remarkable-cli/fixtures.