na 1.2.88 → 1.2.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cursor/commands/changelog.md +3 -1
- data/.rubocop_todo.yml +12 -12
- data/CHANGELOG.md +36 -0
- data/Gemfile.lock +1 -1
- data/README.md +208 -57
- data/bin/commands/plugin.rb +271 -57
- data/bin/commands/update.rb +121 -90
- data/lib/na/action.rb +6 -0
- data/lib/na/actions.rb +3 -2
- data/lib/na/next_action.rb +24 -18
- data/lib/na/plugins.rb +152 -7
- data/lib/na/version.rb +1 -1
- data/src/_README.md +142 -55
- metadata +1 -2
- data/2025-10-29-one-more-na-update.md +0 -142
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: post
|
|
3
|
-
title: One more na update
|
|
4
|
-
categories:
|
|
5
|
-
- Code
|
|
6
|
-
- Blog
|
|
7
|
-
tags:
|
|
8
|
-
- scripting
|
|
9
|
-
- zsh
|
|
10
|
-
- tagging
|
|
11
|
-
- na
|
|
12
|
-
- cli
|
|
13
|
-
- ruby
|
|
14
|
-
- productivity
|
|
15
|
-
- taskpaper
|
|
16
|
-
date: 2025-10-29 08:00
|
|
17
|
-
slug: one-more-na-update
|
|
18
|
-
post_class: code
|
|
19
|
-
keywords: [next action]
|
|
20
|
-
---
|
|
21
|
-
This week I pushed a set of focused improvements to [NA](https://brettterpstra.com/projects/na) that make interactive workflows a lot smoother and the codebase a little more robust — including first‑class time tracking.
|
|
22
|
-
|
|
23
|
-
If you run `na update` without arguments you'll now get an interactive menu that helps you pick the file(s) and actions to operate on, with multiple selection and small but important quality-of-life fixes across parsing, move/edit behavior, and documentation.
|
|
24
|
-
|
|
25
|
-
## TL;DR
|
|
26
|
-
|
|
27
|
-
- `na update` (no args) now launches an interactive, consistent selection flow for files and actions.
|
|
28
|
-
- The update submenu supports multi-select, edit, move, and direct action modes more reliably.
|
|
29
|
-
- Fixed many edge cases: nil-safe string helpers, clearer YARD docs, and better tests for helper code.
|
|
30
|
-
- Under-the-hood improvements to file selection, action movement, and tagging logic.
|
|
31
|
-
|
|
32
|
-
### New: Time tracking
|
|
33
|
-
|
|
34
|
-
- Add start/finish times right from the CLI:
|
|
35
|
-
- `--started TIME` on `add`, `complete`/`finish`, and `update`
|
|
36
|
-
- `--end TIME` (alias `--finished`) on `add`, `complete`/`finish`, and `update`
|
|
37
|
-
- `--duration DURATION` to backfill a start time from the finish
|
|
38
|
-
- Natural language and shorthand supported everywhere: `30m ago`, `-2h`, `2h30m`, `2:30 ago`, `yesterday 5pm`
|
|
39
|
-
- Durations aren’t stored; they’re computed from `@started(...)` and `@done(...)` when displayed.
|
|
40
|
-
- Display enhancements in `next`/`tagged`:
|
|
41
|
-
- `--times` shows per‑action durations and a grand total (implies `--done`)
|
|
42
|
-
- `--human` switches durations to friendly text
|
|
43
|
-
- `--only_timed` filters to actions with both `@started` and `@done` (implies `--times --done`)
|
|
44
|
-
- `--only_times` outputs only the totals (no action list; implies `--times --done`)
|
|
45
|
-
- `--json_times` emits a JSON object with timed actions, per‑tag totals, and overall totals (implies `--times --done`)
|
|
46
|
-
- Per‑tag totals are shown as a Markdown table with aligned columns and a footer row for the grand total
|
|
47
|
-
- Duration color is theme‑configurable via a `duration` key (default `{y}`)
|
|
48
|
-
|
|
49
|
-
Example:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
na add --started "30 minutes ago" "Investigate bug"
|
|
53
|
-
na complete --finished now --duration 2h30m "Investigate bug"
|
|
54
|
-
na next --times --human
|
|
55
|
-
na next --only_times
|
|
56
|
-
na tagged bug --json_times | jq
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## What triggered this
|
|
60
|
-
|
|
61
|
-
A number of small UX issues had crept in over time: the interactive menu sometimes re-prompted or skipped expected options, move/edit operations wouldn't always update a project's indexes correctly, and a few helper methods could raise when given `nil` paths or values. I wanted to make the interactive flow predictable and to harden the helpers so the command-line experience is less brittle.
|
|
62
|
-
|
|
63
|
-
## Interactive `na update` flow
|
|
64
|
-
|
|
65
|
-
Run `na update` with no arguments and you'll see a consistent selection flow:
|
|
66
|
-
|
|
67
|
-
- Choose one or more todo files (fuzzy search / [fzf](https://github.com/junegunn/fzf) / [gum](https://github.com/charmbracelet/gum) used when available).
|
|
68
|
-
- Pick which actions to update (multi-selection supported).
|
|
69
|
-
- Choose an operation: edit, move, add tag, remove tag, mark done, delete.
|
|
70
|
-
|
|
71
|
-
Examples:
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
$ na update
|
|
75
|
-
Select files: (interactive list)
|
|
76
|
-
Select actions (multi):
|
|
77
|
-
[x] 23 % Inbox/Work : - Fix X
|
|
78
|
-
[x] 45 % Inbox/Personal : - Call Y
|
|
79
|
-
Choose operation: (edit / move / done / delete / tag)
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
The menu now behaves consistently whether you pick a single file or multiple files; if you choose multi-select the update command applies as you'd expect to the set of chosen actions.
|
|
83
|
-
|
|
84
|
-
There's a direct action mode when you know the file and action: `na update PATH -l 23` still works as before. The interactive flow only kicks in when no explicit target is provided.
|
|
85
|
-
|
|
86
|
-
## Notable fixes
|
|
87
|
-
|
|
88
|
-
A lot of the work was small but important:
|
|
89
|
-
|
|
90
|
-
- Nil-safe string helpers: `trunc_middle`, `highlight_filename`, and friends were guarded against `nil` inputs so tests and UI code don't explode when a file is missing or the database contains a stray blank line.
|
|
91
|
-
- Action move/edit correctness: moving an action to a different project now updates parent indexes and project line numbers properly, avoiding off-by-one bugs that could leave the file in a strange state.
|
|
92
|
-
- `select_file` and fuzzy matching: the fuzzy and database-driven file selection was made more robust — the code handles directories that have a `file.na` or `file/file.na` pattern and falls back to a clear error instead of failing silently.
|
|
93
|
-
- YARD docs: cleaned up a number of `@!method` directives and added top-level `@example` blocks for the main classes and helpers so the docs are friendlier and generate without warnings.
|
|
94
|
-
- Tests: added and fixed unit tests for `Array`, `Hash`, and `String` helpers. TTY screen and color-related test stubs were improved for reliability on CI.
|
|
95
|
-
- New tests for time features: JSON output, totals‑only output, timed‑only filtering.
|
|
96
|
-
|
|
97
|
-
## Try it
|
|
98
|
-
|
|
99
|
-
You can update to the latest version with:
|
|
100
|
-
|
|
101
|
-
{% iterm "gem install na" %}
|
|
102
|
-
|
|
103
|
-
That should give you v1.2.85 or higher.
|
|
104
|
-
|
|
105
|
-
If you're on a recent development build or want to try the updates locally:
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
# From the gem checkout
|
|
109
|
-
bundle exec bin/na update
|
|
110
|
-
|
|
111
|
-
# Or after building the gem and installing
|
|
112
|
-
na update
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
If you run into anything odd, please open an issue with the command you ran and a short description of what you expected vs what happened. Small, reproducible steps are the fastest way to a fix.
|
|
116
|
-
|
|
117
|
-
If you hit an error and want to include a backtrace, run the command with debug enabled and paste the output:
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
GLI_DEBUG=true na [COMMAND]
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Other updates
|
|
124
|
-
|
|
125
|
-
I last wrote about 1.2.80. Here are a few highlights from the subsequent releases:
|
|
126
|
-
|
|
127
|
-
- 1.2.85 (2025-10-26)
|
|
128
|
-
- YARD docs polish — coverage is now effectively complete
|
|
129
|
-
- Nil-safety: guards for `trunc_middle` and `highlight_filename`
|
|
130
|
-
- 1.2.84 (2025-10-25)
|
|
131
|
-
- Fix: handle nil input when traversing depth
|
|
132
|
-
- 1.2.83 (2025-10-25)
|
|
133
|
-
- Fix: ignore `-d X` values that exceed existing structure depth
|
|
134
|
-
- Allow depth > 9 for `-d`
|
|
135
|
-
- 1.2.82 (2025-10-25)
|
|
136
|
-
- New: multi‑select menu when using `na update`
|
|
137
|
-
- 1.2.81 (2025-10-25)
|
|
138
|
-
- New: `na scan` to find untracked todo files (thanks @rhsev)
|
|
139
|
-
- Improvements: RuboCop cleanup, YARD docs, and test coverage
|
|
140
|
-
- Fixes: color reset in parent display; subdirectory traversal with `na next -d X`
|
|
141
|
-
|
|
142
|
-
Thanks for playing with it and for the helpful feedback you've been sending. Check out the [NA project page](https://brettterpstra.com/projects/na) for more info.
|