pi-do-always 0.10.0 → 0.13.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 +44 -36
- package/extensions/pi-do-always/do-always.json +21 -2
- package/extensions/pi-do-always/index.ts +1199 -214
- package/extensions/pi-do-always/tasks.ts +417 -39
- package/package.json +1 -1
- package/pi.image.png +0 -0
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
|

|
|
36
13
|
|
|
@@ -81,16 +58,17 @@ Building a chain in the selector:
|
|
|
81
58
|
- The classic fast paths are unchanged: **1-9** runs a task immediately, and clicking a
|
|
82
59
|
task row runs it — both close the selector and discard the chain.
|
|
83
60
|
|
|
84
|
-
Chains are capped at 8 tasks. Reordering is done by removing a task and re-adding it
|
|
85
|
-
(mouse drag reordering is planned for a future release). On narrow terminals the ORDER
|
|
61
|
+
Chains are capped at 8 tasks. Reordering is done by removing a task and re-adding it. On narrow terminals the ORDER
|
|
86
62
|
column is dropped and the chain is shown on its own line below the list (keyboard
|
|
87
63
|
chaining still works).
|
|
88
64
|
|
|
89
65
|
Running a chain sends each step as its own turn, strictly one after another — the next
|
|
90
|
-
step starts only after the previous run has fully finished.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
66
|
+
step starts only after the previous run has fully finished. Before anything is sent,
|
|
67
|
+
every step's guards are checked against the current state (fail fast: the first blocked
|
|
68
|
+
step is reported and the chain doesn't start). All steps share the prompt context
|
|
69
|
+
captured when the chain started, so each step's placeholders and guards see the tree as
|
|
70
|
+
it was at that point. An aborted step (Esc), a step that errors, or a step whose send
|
|
71
|
+
fails to start stops the chain; steps already run are kept.
|
|
94
72
|
|
|
95
73
|
If the first task of a chain is a fill task (no `⚡`) in the TUI, step 1 is put in the
|
|
96
74
|
editor and the rest of the chain starts automatically once you press Enter and that run
|
|
@@ -126,11 +104,37 @@ completed step and no step result text — e.g. step 1 errors before any output)
|
|
|
126
104
|
file behind. Set `"report": false` in the config to disable
|
|
127
105
|
it (the project file's value wins over the global one). See [Report file](#report-file).
|
|
128
106
|
|
|
129
|
-
**Inline report
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
not show the inline report — only the status trace widget below
|
|
107
|
+
**Inline report.** When a chain completes fully (all steps done), the full Markdown
|
|
108
|
+
report opens in an editor view so you can read the results without opening the file —
|
|
109
|
+
press Esc to dismiss it. Nothing is persisted to the session: the report lives only in
|
|
110
|
+
that view and in the report file on disk. A run that stops early (aborted, errored, or
|
|
111
|
+
skipped steps) does not show the inline report — only the status trace widget below
|
|
112
|
+
the prompt.
|
|
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.
|
|
134
138
|
|
|
135
139
|
## Install
|
|
136
140
|
|
|
@@ -161,7 +165,7 @@ Tasks are read from JSON files (an array of tasks, or the object form `{"tasks":
|
|
|
161
165
|
|`~/.pi/agent/do-always.json`|Global (all projects)|
|
|
162
166
|
|`<project>/.pi/do-always.json`|Project-local; overrides global tasks with the same `name`|
|
|
163
167
|
|
|
164
|
-
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.
|
|
165
169
|
This repo ships a sample in [`do-always.json`](./extensions/pi-do-always/do-always.json) — copy it to one of the
|
|
166
170
|
locations above to make it your own:
|
|
167
171
|
|
|
@@ -179,10 +183,13 @@ locations above to make it your own:
|
|
|
179
183
|
Fields:
|
|
180
184
|
|
|
181
185
|
- `name` (required) — short unique id, used for `/do-always <name>`
|
|
182
|
-
- `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`.
|
|
183
187
|
- `description` (optional) — one-line label shown in the selector
|
|
184
188
|
- `prompt` (required) — the text filled into the editor (supports `{{placeholders}}` — see [Prompt placeholders](#prompt-placeholders))
|
|
185
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.
|
|
186
193
|
- `when` (optional) — a condition that hides the task from the selector and lists when it is not met (see [Conditionals](#conditionals)).
|
|
187
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`.
|
|
188
195
|
|
|
@@ -225,6 +232,7 @@ injects “Review the changes on branch `fix/login-null` (3 changed files:
|
|
|
225
232
|
|`{{repo}}`|Basename of the git remote (or of the working directory when there is no remote) — disambiguates monorepo work|
|
|
226
233
|
|`{{staged_files}}`|Files staged for commit, one per line (`none` when empty)|
|
|
227
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)|
|
|
228
236
|
|
|
229
237
|
Unknown placeholders are left as-is, and a prompt without placeholders is
|
|
230
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
|
-
"
|
|
9
|
+
"notForCommits": true,
|
|
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,7 +38,24 @@
|
|
|
36
38
|
"name": "Propose features",
|
|
37
39
|
"category": "Plan",
|
|
38
40
|
"description": "Propose new features (Plan)",
|
|
39
|
-
"
|
|
41
|
+
"notForCommits": true,
|
|
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."
|
|
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."
|
|
40
59
|
},
|
|
41
60
|
{
|
|
42
61
|
"name": "Build",
|