na 1.2.86 → 1.2.88

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05b84c85234711e95bc6fae91b279577d0908ba7bc0b1fb254729d65c2823f99
4
- data.tar.gz: acf70b87b92d32a81ae7802397e3f72fd72b28410c50556c680ad0f05c6ea21f
3
+ metadata.gz: b06708529c5a33331a67f4295783bee29e559343ff3e2aa097f0802efac04ca6
4
+ data.tar.gz: 4bf4437737504d54b4cd018c339a4643ca1d108d94e407624040905c0fa5e9f8
5
5
  SHA512:
6
- metadata.gz: 627981de849f31ca58ba38ff7e40915baf7cbf32f4a78d005f35a2590b853a477e28e71c209b5974cb9f4eae311d3f9e4c14c4fd690a253c16584bcac7d48fb1
7
- data.tar.gz: 362e2719a19069a27cad8937d3ed7cabd81a7fd57a2b9f6a1dfa72ff439adf3fd64e691f651ad46020cdd4cdd08d0b6161b93adfcaf75c96040cf75451397a2f
6
+ metadata.gz: b3aac3037d6a51782dad07a452e4fc3e987ef4b3165dfc718119a7b9b5afc23ad42c069243769bf160cd6852f65a239ab655300e465524d03e9480fbef853282
7
+ data.tar.gz: 67aa8edd664f3023a9cef4478c1ef607aba7f8b435413579d51110fdeeddbd9786674ad9320c65a3b7ef3d3b00b34860510fcae089fba37843fc010253306a92
@@ -0,0 +1,4 @@
1
+ Write a commmit message that uses @ labels to specify what type of change each line is. Apply @new, @fixed, @changed, @improved, and @breaking as appropriate to each line. Only add @ labels to changes that affect the user, not technical details. Technical details can be included in the commit, just don't add @ labels to those lines. Be sure to include a general description (< 60 characters) as the first line, followed by a line break.
2
+
3
+
4
+ Save this commit message to commit_message.txt. Overwrite existing contents.
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-10-27 21:36:52 UTC using RuboCop version 1.75.7.
3
+ # on 2025-10-28 13:13:50 UTC using RuboCop version 1.75.7.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -21,46 +21,51 @@ Lint/UnusedMethodArgument:
21
21
  Exclude:
22
22
  - 'lib/na/string.rb'
23
23
 
24
- # Offense count: 36
24
+ # Offense count: 45
25
25
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
26
26
  Metrics/AbcSize:
27
- Max: 243
27
+ Max: 276
28
28
 
29
- # Offense count: 9
29
+ # Offense count: 11
30
30
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
31
31
  # AllowedMethods: refine
32
32
  Metrics/BlockLength:
33
- Max: 144
33
+ Max: 158
34
34
 
35
35
  # Offense count: 5
36
+ # Configuration parameters: CountBlocks, CountModifierForms.
37
+ Metrics/BlockNesting:
38
+ Max: 4
39
+
40
+ # Offense count: 6
36
41
  # Configuration parameters: CountComments, CountAsOne.
37
42
  Metrics/ClassLength:
38
- Max: 777
43
+ Max: 904
39
44
 
40
- # Offense count: 25
45
+ # Offense count: 34
41
46
  # Configuration parameters: AllowedMethods, AllowedPatterns.
42
47
  Metrics/CyclomaticComplexity:
43
- Max: 70
48
+ Max: 82
44
49
 
45
- # Offense count: 40
50
+ # Offense count: 53
46
51
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
47
52
  Metrics/MethodLength:
48
- Max: 146
53
+ Max: 183
49
54
 
50
- # Offense count: 3
55
+ # Offense count: 5
51
56
  # Configuration parameters: CountComments, CountAsOne.
52
57
  Metrics/ModuleLength:
53
- Max: 779
58
+ Max: 906
54
59
 
55
- # Offense count: 4
60
+ # Offense count: 5
56
61
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
57
62
  Metrics/ParameterLists:
58
- Max: 19
63
+ Max: 22
59
64
 
60
- # Offense count: 24
65
+ # Offense count: 33
61
66
  # Configuration parameters: AllowedMethods, AllowedPatterns.
62
67
  Metrics/PerceivedComplexity:
63
- Max: 81
68
+ Max: 94
64
69
 
65
70
  # Offense count: 1
66
71
  # Configuration parameters: ForbiddenDelimiters.
@@ -91,6 +96,14 @@ Style/ModuleFunction:
91
96
  Exclude:
92
97
  - 'lib/na/colors.rb'
93
98
 
99
+ # Offense count: 1
100
+ # This cop supports safe autocorrection (--autocorrect).
101
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
102
+ # SupportedStyles: single_quotes, double_quotes
103
+ Style/StringLiterals:
104
+ Exclude:
105
+ - 'lib/na/next_action.rb'
106
+
94
107
  # Offense count: 1
95
108
  # This cop supports safe autocorrection (--autocorrect).
96
109
  # Configuration parameters: EnforcedStyle.
@@ -105,7 +118,7 @@ Style/YAMLFileRead:
105
118
  Exclude:
106
119
  - 'lib/na/theme.rb'
107
120
 
108
- # Offense count: 22
121
+ # Offense count: 30
109
122
  # This cop supports safe autocorrection (--autocorrect).
110
123
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
111
124
  # URISchemes: http, https
@@ -0,0 +1,142 @@
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.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,102 @@
1
+ ### 1.2.88
2
+
3
+ 2025-10-28 08:22
4
+
5
+ #### CHANGED
6
+
7
+ - Update command interactive menu lists available plugins
8
+ - README: add detailed Plugins section with examples and schema
9
+ - CHANGELOG: add 1.2.88 entry for plugins feature
10
+
11
+ #### NEW
12
+
13
+ - Plugin system with scripts in ~/.local/share/na/plugins
14
+ - Na plugin command to run plugins on selected actions
15
+ - --plugin/--input/--output/--divider flags on update/next/tagged/find
16
+ - Plugin IO supports json, yaml, csv, and text formats
17
+ - ACTION support in plugin IO (UPDATE/DELETE/COMPLETE/RESTORE/ARCHIVE/ADD_TAG/DELETE_TAG/MOVE)
18
+ - Auto-create plugins dir with README and sample plugins (Add Foo.py, Add Bar.sh)
19
+ - Display commands can pipe through plugins (STDOUT-only, no writes)
20
+ - Add --json_times to next/tagged (JSON of timed actions, tags, total)
21
+ - Add --only_times to next/tagged (show only totals, no action list)
22
+
23
+ #### IMPROVED
24
+
25
+ - Duration/time docs and output clarifications in README
26
+ - Internal plugin README with metadata, IO, and examples
27
+ - --only_timed, --times, and --json_times imply --done automatically
28
+ - Per-tag duration totals rendered as aligned Markdown table with footer
29
+ - Duration color configurable via theme key `duration` (default {y})
30
+
31
+ #### FIXED
32
+
33
+ - Plugin update path writing duplicate actions; now in-place by line
34
+ - Plugin apply finds action via target_line, avoids Symbol->Integer error
35
+ - String#wrap indentation and width handling for multi-line wrapping
36
+ - Lint/DuplicateBranch in plugin parse_actions
37
+ - Style/MapToHash in apply_plugin_result
38
+ - String wrapping now wraps at requested widths (e.g., 60 cols) and indents
39
+
40
+ ### 1.2.87
41
+
42
+ 2025-10-28 06:21
43
+
44
+ #### CHANGED
45
+
46
+ - Default theme/templates include `%line`; users with custom theme may need to regenerate to see line numbers
47
+
48
+ #### NEW
49
+
50
+ - Display line numbers with actions across `na next` and selection
51
+ - Support `PATH:LINE` targeting in `na update` and `na edit`
52
+ - Multi-action editing in external editor using `# ------ PATH:LINE` markers; notes supported beneath each action
53
+ - Add --started flag on add/complete(update) to set @started
54
+ - Add --finished alias to --end on add/complete/update to set @done
55
+ - Add --duration (add/complete/update); backfills @started from --end
56
+ - Add --times (next/tagged) to show per-action durations and totals
57
+ - Add --human (next/tagged) for human-friendly duration format
58
+ - Add --only_timed (next/tagged) to show only items with @started/@done
59
+ - Add --json_times to next/tagged (JSON of timed actions, tags, total)
60
+ - Add --only_times to next/tagged (show only totals, no action list)
61
+
62
+ #### IMPROVED
63
+
64
+ - --times and --only_timed imply --done for next/tagged
65
+ - Duration annotations render with theme colors in output
66
+ - Natural-language dates for @started/@done normalized automatically
67
+ - Support shorthand: 2h30m, 30m ago, -2:30, 2:05 ago
68
+ - --only_timed, --times, and --json_times imply --done automatically
69
+ - Per-tag duration totals rendered as aligned Markdown table with footer
70
+ - Duration color configurable via theme key `duration` (default {y})
71
+
72
+ #### FIXED
73
+
74
+ - Incorrect colorization (unexpected bright green) in action output
75
+ - Search highlighting no longer corrupts ANSI color codes or numbers in escape sequences
76
+ - Multi-action editor now only includes the specifically selected lines (no duplicates)
77
+ - Delete in update menu removes the correct lines
78
+ - Multi-select updates process bottom-to-top to avoid line shifts
79
+ - String wrapping now wraps at requested widths (e.g., 60 cols) and indents
80
+
1
81
  ### 1.2.86
2
82
 
3
- 2025-10-27 17:16
83
+ 2025-10-28 02:29
84
+
85
+ #### CHANGED
86
+
87
+ - Default theme/templates include `%line`; users with custom theme may need to regenerate to see line numbers
88
+
89
+ #### NEW
90
+
91
+ - Display line numbers with actions across `na next` and selection
92
+ - Support `PATH:LINE` targeting in `na update` and `na edit`
93
+ - Multi-action editing in external editor using `# ------ PATH:LINE` markers; notes supported beneath each action
94
+
95
+ #### FIXED
96
+
97
+ - Incorrect colorization (unexpected bright green) in action output
98
+ - Search highlighting no longer corrupts ANSI color codes or numbers in escape sequences
99
+ - Multi-action editor now only includes the specifically selected lines (no duplicates)
4
100
 
5
101
  ### 1.2.85
6
102
 
data/Gemfile CHANGED
@@ -4,4 +4,11 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
  gem 'rake'
6
6
 
7
- gem "simplecov", "~> 0.22.0", group: :development
7
+ gem 'simplecov', '~> 0.22.0', group: :development
8
+
9
+ group :development do
10
+ gem 'rubocop', '~> 1.66'
11
+ gem 'rubocop-performance', '~> 1.21'
12
+ end
13
+ gem 'chronic'
14
+ gem 'csv'
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.86)
4
+ na (1.2.88)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
+ csv (>= 3.2)
6
7
  git (~> 3.0.0)
7
8
  gli (~> 2.21.0)
8
9
  mdless (~> 1.0, >= 1.0.32)
@@ -29,12 +30,14 @@ GEM
29
30
  uri (>= 0.13.1)
30
31
  addressable (2.8.7)
31
32
  public_suffix (>= 2.0.2, < 7.0)
33
+ ast (2.4.3)
32
34
  base64 (0.3.0)
33
35
  bigdecimal (3.3.1)
34
36
  bump (0.6.1)
35
37
  chronic (0.10.2)
36
38
  concurrent-ruby (1.3.5)
37
39
  connection_pool (2.5.4)
40
+ csv (3.3.5)
38
41
  diff-lcs (1.6.2)
39
42
  docile (1.4.1)
40
43
  drb (2.2.3)
@@ -47,15 +50,25 @@ GEM
47
50
  i18n (1.14.7)
48
51
  concurrent-ruby (~> 1.0)
49
52
  json (2.15.2)
53
+ language_server-protocol (3.17.0.5)
54
+ lint_roller (1.1.0)
50
55
  logger (1.7.0)
51
56
  mdless (1.0.37)
52
57
  minitest (5.26.0)
53
58
  ostruct (0.6.3)
59
+ parallel (1.27.0)
60
+ parser (3.3.8.0)
61
+ ast (~> 2.4.1)
62
+ racc
63
+ prism (1.6.0)
54
64
  process_executer (1.3.0)
55
65
  public_suffix (6.0.2)
66
+ racc (1.8.1)
67
+ rainbow (3.1.1)
56
68
  rake (13.3.0)
57
69
  rchardet (1.10.0)
58
70
  rdoc (4.3.0)
71
+ regexp_parser (2.10.0)
59
72
  rspec (3.13.0)
60
73
  rspec-core (~> 3.13.0)
61
74
  rspec-expectations (~> 3.13.0)
@@ -69,6 +82,25 @@ GEM
69
82
  diff-lcs (>= 1.2.0, < 2.0)
70
83
  rspec-support (~> 3.13.0)
71
84
  rspec-support (3.13.6)
85
+ rubocop (1.75.7)
86
+ json (~> 2.3)
87
+ language_server-protocol (~> 3.17.0.2)
88
+ lint_roller (~> 1.1.0)
89
+ parallel (~> 1.10)
90
+ parser (>= 3.3.0.2)
91
+ rainbow (>= 2.2.2, < 4.0)
92
+ regexp_parser (>= 2.9.3, < 3.0)
93
+ rubocop-ast (>= 1.44.0, < 2.0)
94
+ ruby-progressbar (~> 1.7)
95
+ unicode-display_width (>= 2.4.0, < 4.0)
96
+ rubocop-ast (1.44.1)
97
+ parser (>= 3.3.7.2)
98
+ prism (~> 1.4)
99
+ rubocop-performance (1.25.0)
100
+ lint_roller (~> 1.1)
101
+ rubocop (>= 1.75.0, < 2.0)
102
+ rubocop-ast (>= 1.38.0, < 2.0)
103
+ ruby-progressbar (1.13.0)
72
104
  securerandom (0.4.1)
73
105
  simplecov (0.22.0)
74
106
  docile (~> 1.1)
@@ -87,6 +119,9 @@ GEM
87
119
  tty-which (0.5.0)
88
120
  tzinfo (2.0.6)
89
121
  concurrent-ruby (~> 1.0)
122
+ unicode-display_width (3.1.4)
123
+ unicode-emoji (~> 4.0, >= 4.0.4)
124
+ unicode-emoji (4.0.4)
90
125
  uri (1.0.4)
91
126
  wisper (2.0.1)
92
127
 
@@ -105,11 +140,15 @@ PLATFORMS
105
140
 
106
141
  DEPENDENCIES
107
142
  bump (~> 0.6.0)
143
+ chronic
144
+ csv
108
145
  minitest (~> 5.14)
109
146
  na!
110
147
  rake
111
148
  rdoc (~> 4.3)
112
149
  rspec (~> 3.0)
150
+ rubocop (~> 1.66)
151
+ rubocop-performance (~> 1.21)
113
152
  simplecov (~> 0.22.0)
114
153
  tty-spinner (~> 0.9, >= 0.9.0)
115
154