pi-do-always 0.12.0 → 0.15.0

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.
package/README.md CHANGED
@@ -8,29 +8,6 @@ type to filter, scroll or click, or navigate with arrows + Enter → the task's
8
8
  **filled into the input editor**. Review it, tweak it, press Enter to run. Tasks marked `⚡`
9
9
  (the `Plan` category by default) auto-run on selection instead — see `autoRun` below.
10
10
 
11
- ```text
12
- do-always — pick a task
13
-
14
- # TASK DESCRIPTION ORDER
15
- PLAN
16
- 1 ⚡ Review changes Review the current code changes (Plan) ·
17
- 2 ⚡ Review code Review the whole project's code quality (Plan) [1]
18
- 3 ⚡ Cleanup Clean up dead code and duplicates (Plan) [2]
19
- 4 ⚡ Security Security audit (Plan) ·
20
- 5 ⚡ Performance Performance review (Plan) ►[3]
21
- 6 ⚡ Propose features Propose new features (Plan) ·
22
- DO
23
- 7 Build Test build is ok and fix issues ·
24
- 8 Tests Run tests and fix failures ·
25
- DOCS
26
- 9 Readme Update the README.md ·
27
-
28
- ──────────────────────────────────────────────────────────────────────────────────────────────────
29
- Run the chain (3)
30
- ← tasks • ⏎ remove • esc • ctrl+u clear
31
-
32
- 1-9 pick by number • type to filter • ↑↓ navigate • enter select • esc cancel • ⚡ auto-runs
33
- ```
34
11
 
35
12
  ![do-always — the numbered task selector](pi.image.png)
36
13
 
@@ -134,6 +111,31 @@ that view and in the report file on disk. A run that stops early (aborted, error
134
111
  skipped steps) does not show the inline report — only the status trace widget below
135
112
  the prompt.
136
113
 
114
+ ## Commit browser
115
+
116
+ Two built-in tasks open the date-grouped commit browser (pages of 20, type to
117
+ filter, Space/Enter to select, ←/→ to page):
118
+
119
+ - **Browse commits** (category `Browse`, only shown inside a git repo) — the
120
+ generic entry: select commits, then confirm on the `do on the commits
121
+ (n commits)` row to pick which task runs on them — a picker lists your
122
+ visible `Plan` tasks, except those marked `notForCommits: true` (the
123
+ built-in Review changes, Review code, and Propose features — they operate
124
+ on the working tree or the whole project, not on a set of commits). The
125
+ chosen task's prompt is sent as a single turn (not a chain) with the
126
+ selection injected.
127
+ - **Review commits** (category `Plan`, hidden from the selector) — offered in
128
+ the picker after a selection; the review runs directly on the selected
129
+ commits (its prompt consumes the selection). Still resolvable by name:
130
+ `/do-always review commits` opens the browser as before.
131
+
132
+ The selection is injected into the chosen task's prompt: a prompt that
133
+ references `{{selected_commits}}` gets the numbered commit detail block
134
+ substituted in; any other prompt gets the block appended under
135
+ `Selected commits:`. In non-interactive modes (no TUI) the browser is skipped:
136
+ the latest commit is selected and the first eligible `Plan` task (not
137
+ `notForCommits`) whose guards pass runs on it.
138
+
137
139
  ## Install
138
140
 
139
141
  Install it from npm as a Pi package, which loads the bundled `index.ts` (and its `tasks.ts`) without
@@ -163,7 +165,7 @@ Tasks are read from JSON files (an array of tasks, or the object form `{"tasks":
163
165
  |`~/.pi/agent/do-always.json`|Global (all projects)|
164
166
  |`<project>/.pi/do-always.json`|Project-local; overrides global tasks with the same `name`|
165
167
 
166
- If neither file exists, the built-in defaults (Review changes, Review code, Cleanup, Security, Performance, Propose features, Build, Tests, Readme, Release, Commit) are used.
168
+ If neither file exists, the built-in defaults (Review changes, Review code, Cleanup, Security, Performance, Propose features, Review commits, Browse commits, Build, Tests, Readme, Release, Commit) are used.
167
169
  This repo ships a sample in [`do-always.json`](./extensions/pi-do-always/do-always.json) — copy it to one of the
168
170
  locations above to make it your own:
169
171
 
@@ -181,10 +183,13 @@ locations above to make it your own:
181
183
  Fields:
182
184
 
183
185
  - `name` (required) — short unique id, used for `/do-always <name>`
184
- - `category` (optional) — group header the task is shown under in the selector (e.g. `"Plan"`, `"Do"`). Matching is case-insensitive and the header is title-cased, so `"plan"` and `"Plan"` land in the same `Plan` group. Tasks without a category fall under `Other`. The built-in defaults are grouped into `Plan`, `Do`, `Docs`, and `Ops`.
186
+ - `category` (optional) — group header the task is shown under in the selector (e.g. `"Plan"`, `"Do"`). Matching is case-insensitive and the header is title-cased, so `"plan"` and `"Plan"` land in the same `Plan` group. Tasks without a category fall under `Other`. The built-in defaults are grouped into `Plan`, `Browse`, `Do`, `Docs`, and `Ops`.
185
187
  - `description` (optional) — one-line label shown in the selector
186
188
  - `prompt` (required) — the text filled into the editor (supports `{{placeholders}}` — see [Prompt placeholders](#prompt-placeholders))
187
189
  - `autoRun` (optional) — when `true`, selecting the task sends its prompt immediately instead of filling the editor; when `false`, it always fills the editor. When omitted, the default is derived from the category: `Plan` tasks auto-run, everything else fills the editor. Auto-run tasks are marked `⚡` in the selector.
190
+ - `browser` (optional) — a browser to open on selection instead of injecting the prompt. Only `"commits"` is supported: it opens the date-grouped commit browser, and after the selection the task runs on the selected commits — directly when its prompt references `{{selected_commits}}`, otherwise via a picker of `Plan` tasks (see [Commit browser](#commit-browser)). An invalid value is ignored with a warning.
191
+ - `hidden` (optional) — when `true`, the task is not shown in the selector or in `/do-always list` / `list-details`. Unlike a `when` condition, a hidden task can still be run by name (`/do-always <name>`), and it is offered as a candidate by the commit picker. The built-in `Review commits` uses this: it is a pick-after-browse option, not a standalone entry.
192
+ - `notForCommits` (optional) — when `true`, the task is excluded from the commit picker (the “run on the selected commits” list) because it does not operate on a set of commits. The task is otherwise unaffected (selector, lists, CLI). The built-in `Review changes`, `Review code`, and `Propose features` use this.
188
193
  - `when` (optional) — a condition that hides the task from the selector and lists when it is not met (see [Conditionals](#conditionals)).
189
194
  - `guards` (optional) — an array of selection-time guards that block the task (with a message, not a hide) when a condition is unmet (see [Guards](#guards)). The legacy `requireDirty` (boolean) still works and is combined with any `guards`.
190
195
 
@@ -227,6 +232,7 @@ injects “Review the changes on branch `fix/login-null` (3 changed files:
227
232
  |`{{repo}}`|Basename of the git remote (or of the working directory when there is no remote) — disambiguates monorepo work|
228
233
  |`{{staged_files}}`|Files staged for commit, one per line (`none` when empty)|
229
234
  |`{{unstaged_files}}`|Modified-but-unstaged files, one per line (`none` when empty)|
235
+ |`{{selected_commits}}`|Commits selected in the commit browser, as a numbered detail block (`none` outside a browser run)|
230
236
 
231
237
  Unknown placeholders are left as-is, and a prompt without placeholders is
232
238
  injected unchanged, so existing configs keep working. The selector preview and
@@ -6,12 +6,14 @@
6
6
  "category": "Plan",
7
7
  "description": "Review the current code changes (Plan)",
8
8
  "requireDirty": true,
9
+ "notForCommits": true,
9
10
  "prompt": "Review the changes on branch {{branch}} ({{files_changed_count}} changed files: {{files_changed}}). Change summary: {{diff_stat}}. Last commit: {{last_commit}}. Check `git status` and `git diff` to see what changed, then double-check the changes for bugs, edge cases, security issues, and consistency with the rest of the codebase. Do a plan proposal for the fixes if needed. Do a summary of your findings."
10
11
  },
11
12
  {
12
13
  "name": "Review code",
13
14
  "category": "Plan",
14
15
  "description": "Review the whole project's code quality (Plan)",
16
+ "notForCommits": true,
15
17
  "prompt": "Review this project's code holistically: identify code smells, dead code, duplication, awkward architecture or patterns, maintainability issues, inconsistencies, and missing or unclear documentation. Prioritize by impact, propose a plan for the fixes, and summarize your findings. Do not make any changes yet."
16
18
  },
17
19
  {
@@ -36,8 +38,25 @@
36
38
  "name": "Propose features",
37
39
  "category": "Plan",
38
40
  "description": "Propose new features (Plan)",
41
+ "notForCommits": true,
39
42
  "prompt": "Review this project and propose new features that would add value. For each idea, describe the problem it solves, the user benefit, and a rough implementation approach. Prioritize by impact and effort. Do not make any changes yet. Try to evaluate how many lines this will be in terms of changes, whether this will break APIs, or introduce compatibility issues."
40
43
  },
44
+ {
45
+ "name": "Review commits",
46
+ "category": "Plan",
47
+ "description": "Review the selected commits (Plan)",
48
+ "browser": "commits",
49
+ "hidden": true,
50
+ "prompt": "Review the selected commits: {{selected_commits}}. Inspect each with `git show <hash>`, double-check the changes for bugs, edge cases, security issues, and consistency with the rest of the codebase. Summarize your findings per commit and propose a plan for any fixes if needed. Do not make any changes yet."
51
+ },
52
+ {
53
+ "name": "Browse commits",
54
+ "category": "Browse",
55
+ "description": "Browse and select commits, then pick a task to run on them",
56
+ "browser": "commits",
57
+ "when": "git",
58
+ "prompt": "Browse recent commits, select some, then pick a task to run on them."
59
+ },
41
60
  {
42
61
  "name": "Build",
43
62
  "category": "Do",
@@ -61,7 +80,7 @@
61
80
  "category": "Ops",
62
81
  "description": "Prepare a release (version, changelog, tag)",
63
82
  "when": "git",
64
- "prompt": "Prepare a release for this project (branch {{branch}}): check `git log` since the last tag, update the version in package.json (or the equivalent location), add a changelog entry summarizing the changes, and create a git tag if git present. Do not push."
83
+ "prompt": "Prepare a release for this project (branch {{branch}}): check `git log` since the last tag, then bump the version in package.json (or the equivalent location) to the next version, and add a changelog entry under that exact version summarizing the changes. The changelog entry must use the same version number now set in package.json — never add a changelog section for a version that package.json does not yet contain, and never leave an 'Unreleased' or placeholder version heading. Create a git tag if git present. Do not push."
65
84
  },
66
85
  {
67
86
  "name": "Commit",