Rewrite things-cli in Rust #3
Loading…
Reference in a new issue
No description provided.
Delete branch "kglitchy/rust-rewrite"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rewrites things-cli in Rust. The Go implementation is removed; the Rust crate lives at the repo root.
Commits
d5a6a8e— Rust port with the samethingsbinary, command surface, config location, Things Cloud auth/sync, JSON output, and state replay (including Task7 and legacy Tombstone handling).d28786e— replaces hand-rolled Go/Cobra emulation with mainstream crates:clap(CLI + help),clap_complete(shell completion),figment(config: flag > env > file > default),bs58(Things IDs), andserde_json/chrono/percent-encodingin place of Go formatting reimplementations.70e44b3— pinsclap_completeto=4.6.11, since itsunstable-dynamicfeature can change between minor releases.04aa70b— deletes the Go code, moves the crate to the root (git mv, history preserved), switches the Makefile to cargo, moves the MIT notice to the rootLICENSE(identical to the two GoLICENSEfiles), removes the emptypackage.json/package-lock.json.17ddd68— replaces the Go-vs-Rust parity harness with end-to-end tests (tests/cloud.rs,tests/config.rs) that run the real binary against a fake Things Cloud in a temp home.18ba4c1— README,skills/things-cli/SKILL.md, anddocs/updated for Rust.3a81fdf— fix (pre-existing Go bug): explicitnullclears forsr,dd,sp,ato(and checklistsp) are applied in history order during replay. Previously a batch post-pass re-applied everysr: null, so a task created unscheduled and scheduled within the same sync batch lost its date and vanished from every view. The state cache version was bumped (now 3), so existing caches are rebuilt once by a full sync.56c4a57— fix (pre-existing Go bug): Today (and Anytime) include deferredst=2tasks whose start date has arrived, as the Things app does. Previously they were hidden from every view until a Things client flipped them tost=1. Protocol doc view mapping updated.e4a0bd9— docs: version-2 cache, Today/replay fixes, corrected escape examples, no hard-coded checkout path.Review fixes (all bugs inherited from the Go version; each has a regression test):
af4cb5e— moving a task keeps it in one project or heading (--projectclears the heading, heading lookup is scoped to--project).d1b66cd— overdue deadlines show in Today; tasks with a future start stay out of Anytime.c6def61— repeating templates are detected by their repeat rule (rr), even before the first instance, and are kept out of Today/Anytime consistently.673b3a2— headings resolve to their project in views and--projectfilters; tasks in closed projects' headings and in Someday projects are hidden from Anytime.f1b92f2— environment settings are taken verbatim (onlyTHINGS_DEBUGis parsed), soTHINGS_CLI_CACHE=0123stays0123.ffddc56— config is only read by commands that use the service, so a broken config file no longer blocksauthorcompletion.2d055ec—editrequires a change flag even when global flags like--jsonare given.e69bb0d—logbook --page 0is rejected.64b8ad6— docs describe the OS cache directory (~/Library/Cacheson macOS) and the fixed~/.config/things-cliconfig directory.Cleanup:
758f676— dead code removed, along with the blanketdead_codeallowance.047c677— Go state-cache compatibility dropped.033619f— task lists sort by a well-defined total order.b7ca6d4,2f1920e— trivial wrappers inlined; validation wording shared between the CLI and the service.89630d1,e33f5f0— error messages and comments no longer mimic Go.e27328c— behavior changes recorded; the design doc is marked historical.Verification
From the repo root:
cargo fmt --check,cargo build --release,cargo clippy --all-targets -- -D warnings,make test: cleancargo test: 136 passed; the live Things Cloud test stays ignored and opt-in and was not runThe new end-to-end tests cover:
Coverage that only compared output with the Go binary byte for byte is gone.
Changes for existing users
See "Changes from the Go version" in
README.md. The main ones:--json=falseis a usage error).things completion <shell>.--jsonno longer escapes<,>,&; parsed values are identical.THINGS_DEBUGrejects values other than true/false/1/0; explicit--configmust be YAML, JSON, or TOML.Real-account check (read-only)
things todaywith the fixed build lists all five tasks the Things app shows in Today; the pre-fix build (and the Go binary) missed one or more. After the review fixes, Today is unchanged.Not done
make install) on the Linux host; the first run rebuilt the cache and Today matched the Things app. Not merged.- CLI: clap derive replaces the Cobra/pflag-compatible parser and help renderer (command.rs); same commands, aliases, flags, arguments, and exit codes (usage errors still exit 1; repeated flags keep the last value). - Completion: clap_complete's dynamic engine replaces the Cobra __complete protocol and the embedded Cobra scripts; entity titles still come from the state cache. Installed completion scripts must be regenerated. - Config: figment replaces the Viper emulation; same file location, env names, and flag > env > file > default precedence (YAML, JSON, TOML). - gofmt.rs removed: messages use {:?}, JSON uses serde_json, timestamps use chrono's serde, URL escaping uses percent-encoding; go_timestamps.tsv fixture dropped. Base58 uses bs58; cache dir uses dirs. - Unreadable or outdated state caches now trigger a full sync instead of failing; Go-written caches are still read. - Parity harness: compares parsed JSON and semantic requests, checks the command/flag surface (surface_parity.py) instead of help bytes, compares completion candidates, and compares error text only for app-level results.Add Rust port of things-clito Rewrite things-cli in RustReplace 'unexpected end of JSON input', 'EOF', 'unexpected/expected newline', PascalCase operation names, and 'exec: {:?}' with plain messages.