MCPcopy Index your code
hub / github.com/PicoJr/rtw

github.com/PicoJr/rtw @v2.3.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.3.1 ↗ · + Follow
177 symbols 408 edges 20 files 34 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

rtw crate rtw documentation GitHub license

Branch Status
master Build Status

RTW - Rust Time Watcher

Command-line interface (CLI) time tracker.

CLI usage is stable, underlying API is not stable.

Note: This software is built specifically as a productivity tool for myself, not as a consumer resource. I cannot commit a large amount of time to maintaining this software but I'll do my best to provide support if something fails =).

This project is heavily inspired from Timewarrior.

For a stable feature-rich CLI time tracker, please use Timewarrior: https://timewarrior.net/.

Why another time tracker tool?

  1. learn Rust
  2. I once lost a month worth of data with another time tracker tool (database corruption)...never again!

Install

Supported OS: Linux, MacOS, Windows

CI runs on ubuntu-latest, macos-latest, windows-latest.

Note: Windows support is only experimental. Some features may not be supported on Windows.

Cargo

cargo install rtw

Build From Source

rtw compiles with Rust 1.42.0 (stable) or newer.

Clone and build from source:

git clone https://github.com/PicoJr/rtw.git
cd rtw
cargo build --release

From binaries (Linux only)

Download the corresponding archive from the Release page.

Shell Completion (Bash, Zsh, Fish, Powershell, Elvish)

Please see shell completion.

Starship prompt integration

# starship.toml
[custom.rtw]
command = """ rtw status --format "{ongoing} {human_duration}" """
when = "test -f ~/.rtw.json"
shell = ["bash", "--noprofile", "--norc"]

~/.rtw.json is the file where rtw stores ongoing activities

Changelog

Please see the CHANGELOG for a release history.

Basic Usage

Start tracking an activity

Example:

rtw start "learn rust"

Example output:

Tracking learn rust
Started  2019-12-25T19:43:00

Display current activity

rtw

Example output:

Tracking learn rust
Total    01:15:00

Stop current activity

rtw stop

Example output:

Recorded learn rust
Started 2019-12-25T19:43:00
Ended   2019-12-25T21:00:00
Total   01:17:000

Display the day's activity summary

rtw summary

Example output:

read the doc 2019-12-25T11:49:30 2019-12-25T11:53:36 00:04:246
eat cookies  2019-12-25T12:08:49 2019-12-25T12:12:14 00:03:204

Display a timeline for the day

rtw day

Example output (YMMV):

timeline

More?

For further details see Full Usage.

Configuration

RTW doesn't create the config file for you, but it looks for one in the following locations (in this order):

  1. $XDG_CONFIG_HOME/rtw/rtw_config.json
  2. $HOME/.config/rtw/rtw_config.json
  3. $XDG_CONFIG_HOME/.config/rtw_config.json
  4. $HOME/.config/rtw_config.json

see example folder for a default config file.

Implementation

RTW relies on json files for persistence.

Default location is the home (~) directory.

~/.rtw.json  # stores current activity
~/.rtwh.json # stores finished activities

there is currently no file locking mechanism: running several rtw commands at the same time may lead to undefined behavior.

Similar Tools

Extension points exported contracts — how you extend this code

ActivityService (Interface)
A service for activities Abstracts activities queries and modifications [1 implementers]
src/rtw_core/service.rs
Clock (Interface)
Clock Abstraction [1 implementers]
src/rtw_core/clock.rs
Storage (Interface)
(no doc) [1 implementers]
src/rtw_core/storage.rs

Core symbols most depended-on inside this repo

get_start_time
called by 26
src/rtw_core/activity.rs
into_activity
called by 12
src/rtw_core/activity.rs
build_json_service
called by 10
src/service.rs
get_time
called by 10
src/chrono_clock.rs
days
called by 8
src/timeline.rs
date_time
called by 8
src/chrono_clock.rs
split_time_clue_from_tags
called by 7
src/cli_helper.rs
start_activity
called by 7
src/service.rs

Shape

Function 105
Method 53
Class 11
Enum 5
Interface 3

Languages

Rust100%

Modules by API surface

tests/integration_test.rs40 symbols
src/service.rs24 symbols
src/cli_helper.rs22 symbols
src/rtw_core/activity.rs16 symbols
src/json_storage.rs15 symbols
src/timeline.rs12 symbols
src/rtw_config.rs9 symbols
src/chrono_clock.rs9 symbols
src/rtw_cli.rs8 symbols
src/rtw_core/durationw.rs7 symbols
src/rtw_core/datetimew.rs4 symbols
src/time_tools.rs3 symbols

For agents

$ claude mcp add rtw \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact