pi-do-always 0.8.0 → 0.10.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 +95 -17
- package/extensions/pi-do-always/do-always.json +6 -4
- package/extensions/pi-do-always/index.ts +1152 -213
- package/extensions/pi-do-always/tasks.ts +450 -46
- package/package.json +2 -2
- package/pi.image.png +0 -0
package/README.md
CHANGED
|
@@ -11,26 +11,23 @@ type to filter, scroll or click, or navigate with arrows + Enter → the task's
|
|
|
11
11
|
```text
|
|
12
12
|
do-always — pick a task
|
|
13
13
|
|
|
14
|
+
# TASK DESCRIPTION ORDER
|
|
14
15
|
PLAN
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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) ·
|
|
21
22
|
DO
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
7 Build Test build is ok and fix issues ·
|
|
24
|
+
8 Tests Run tests and fix failures ·
|
|
24
25
|
DOCS
|
|
25
|
-
|
|
26
|
-
OPS
|
|
27
|
-
10. Release Prepare a release (version, changelog, tag)
|
|
28
|
-
11. Commit Prepare a clean commit
|
|
26
|
+
9 Readme Update the README.md ·
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
`git diff` to see what changed, then double-check the changes for bugs, edge …
|
|
28
|
+
──────────────────────────────────────────────────────────────────────────────────────────────────
|
|
29
|
+
Run the chain (3)
|
|
30
|
+
← tasks • ⏎ remove • esc • ctrl+u clear
|
|
34
31
|
|
|
35
32
|
1-9 pick by number • type to filter • ↑↓ navigate • enter select • esc cancel • ⚡ auto-runs
|
|
36
33
|
```
|
|
@@ -59,6 +56,82 @@ not filled): the `Plan` category does this by default, and any task can opt in o
|
|
|
59
56
|
In non-interactive modes (no TUI) there is no editor to fill, so the selected prompt is sent
|
|
60
57
|
as a user message instead.
|
|
61
58
|
|
|
59
|
+
## Chains
|
|
60
|
+
|
|
61
|
+
Run several tasks in a row as a **chain**. The selector shows an `ORDER` column; tasks in
|
|
62
|
+
the chain get a `[n]` marker in execution order, and a pinned row at the bottom of the
|
|
63
|
+
list runs the chain.
|
|
64
|
+
|
|
65
|
+
Building a chain in the selector:
|
|
66
|
+
|
|
67
|
+
- **Enter on a task row** runs just that task (the classic pick — the cursor starts in
|
|
68
|
+
the task column).
|
|
69
|
+
- **→** moves the cursor to the ORDER column on the same row, where **Enter** toggles
|
|
70
|
+
that task's chain membership (`·` → `[n]` → `·`). **←** goes back to the task column.
|
|
71
|
+
- **↑ / ↓** move the cursor in either column. The cursor is a **►** marker in the
|
|
72
|
+
theme's accent color: in the left gutter in the task column, in the ORDER cell in
|
|
73
|
+
the order column (plus a row highlight where your theme makes it visible). From the
|
|
74
|
+
last task row, **↓** lands on the pinned Run row (and **↑** back).
|
|
75
|
+
- **Enter on the `Run the chain (n)` row** — or a mouse click on it — runs the chain.
|
|
76
|
+
The row is dimmed while the chain is empty. The ► marker appears on it only
|
|
77
|
+
while the cursor is on the row (as on task rows).
|
|
78
|
+
- **Backspace** (with no filter typed) undoes the last add; **ctrl+u** clears the whole
|
|
79
|
+
chain; **Esc** cancels and discards it.
|
|
80
|
+
- Clicking an ORDER cell toggles the task's chain membership.
|
|
81
|
+
- The classic fast paths are unchanged: **1-9** runs a task immediately, and clicking a
|
|
82
|
+
task row runs it — both close the selector and discard the chain.
|
|
83
|
+
|
|
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
|
|
86
|
+
column is dropped and the chain is shown on its own line below the list (keyboard
|
|
87
|
+
chaining still works).
|
|
88
|
+
|
|
89
|
+
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. Each step's guards are
|
|
91
|
+
re-evaluated at its turn against the current state; a step whose guards no longer hold
|
|
92
|
+
stops the chain there (with a warning), as do an aborted step (Esc) or a step that
|
|
93
|
+
errors. Steps already run are kept.
|
|
94
|
+
|
|
95
|
+
If the first task of a chain is a fill task (no `⚡`) in the TUI, step 1 is put in the
|
|
96
|
+
editor and the rest of the chain starts automatically once you press Enter and that run
|
|
97
|
+
finishes.
|
|
98
|
+
|
|
99
|
+
While a chain is running, a **status widget** is shown below the prompt: the chain's
|
|
100
|
+
tasks with a marker per step and a `(n/N)` progress count — the step the chain is
|
|
101
|
+
currently at.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
⛓ do-always (2/4)
|
|
105
|
+
✓ Review changes
|
|
106
|
+
▶ Build
|
|
107
|
+
○ Test
|
|
108
|
+
○ Deploy
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Markers: `✓` completed, `▶` running (or waiting for your Enter on a fill-first step 1),
|
|
112
|
+
`○` pending, `✗` errored / failed to start, `⊘` aborted, `–` skipped because its guards
|
|
113
|
+
no longer hold. The widget is removed when the chain completes; if the chain stops early
|
|
114
|
+
it stays below the prompt as a trace of where it stopped (until your next prompt or a new
|
|
115
|
+
session). Starting a second chain while
|
|
116
|
+
one is running is refused — wait for it to finish or abort the current step with Esc.
|
|
117
|
+
|
|
118
|
+
Every chain run also writes a **report file** in the project root —
|
|
119
|
+
`do-always-report-tasks-YYYY-MM-DD-HHMM.md` (e.g. `do-always-report-tasks-2025-01-15-1432.md`) —
|
|
120
|
+
so earlier steps' results are not lost when later steps' output scrolls them off screen.
|
|
121
|
+
Each step appends a section as it finishes (the step's final assistant message, with its
|
|
122
|
+
outcome and run time), so the file is complete even if the session dies mid-chain; a
|
|
123
|
+
footer with the overall summary is appended when the chain ends, and the completion
|
|
124
|
+
notification carries the file's path. A run that produces nothing worth keeping (no
|
|
125
|
+
completed step and no step result text — e.g. step 1 errors before any output) leaves no
|
|
126
|
+
file behind. Set `"report": false` in the config to disable
|
|
127
|
+
it (the project file's value wins over the global one). See [Report file](#report-file).
|
|
128
|
+
|
|
129
|
+
**Inline report in the chat.** When a chain completes fully (all steps done), the full
|
|
130
|
+
Markdown report is sent as a message in the chat so you can read the results without
|
|
131
|
+
opening the file. The message is automatically removed when you start the next
|
|
132
|
+
prompt or session. A run that stops early (aborted, errored, or skipped steps) does
|
|
133
|
+
not show the inline report — only the status trace widget below the prompt.
|
|
134
|
+
|
|
62
135
|
## Install
|
|
63
136
|
|
|
64
137
|
Install it from npm as a Pi package, which loads the bundled `index.ts` (and its `tasks.ts`) without
|
|
@@ -117,6 +190,7 @@ In the object form you can also configure the selector shortcut:
|
|
|
117
190
|
|
|
118
191
|
- `shortcut` (optional) — key that opens the selector, e.g. `"f4"`. Set to `null` to disable the shortcut. Defaults to `F4`. The project file's value wins over the global one.
|
|
119
192
|
- `merge` (optional) — how project tasks combine with the global tasks: `"override"` (default) replaces a global task with the same `name`; `"append"` keeps the global tasks and only adds new project task names (a cascade, like CSS). The project file's value wins over the global one; when neither sets it, the default is `override` (the historical behavior).
|
|
193
|
+
- `report` (optional) — whether chain runs write a Markdown report file in the project root (one per run, appended as each step finishes). Default `true`; set `false` to disable. The project file's value wins over the global one. See [Chains](#chains).
|
|
120
194
|
|
|
121
195
|
Example project file that only *adds* tasks without overriding the global set:
|
|
122
196
|
|
|
@@ -147,6 +221,10 @@ injects “Review the changes on branch `fix/login-null` (3 changed files:
|
|
|
147
221
|
|`{{files_changed}}`|Changed files from `git status` — comma-separated, capped at 20 entries (`none` when clean or not a git repo)|
|
|
148
222
|
|`{{files_changed_count}}`|Number of changed files (`0` when clean or not a git repo)|
|
|
149
223
|
|`{{user}}`|`git config user.name` (`unknown` when unset)|
|
|
224
|
+
|`{{diff_stat}}`|`git diff --shortstat` output, e.g. `3 files changed, 41 insertions(+), 7 deletions(-)` (`none` when unavailable)|
|
|
225
|
+
|`{{repo}}`|Basename of the git remote (or of the working directory when there is no remote) — disambiguates monorepo work|
|
|
226
|
+
|`{{staged_files}}`|Files staged for commit, one per line (`none` when empty)|
|
|
227
|
+
|`{{unstaged_files}}`|Modified-but-unstaged files, one per line (`none` when empty)|
|
|
150
228
|
|
|
151
229
|
Unknown placeholders are left as-is, and a prompt without placeholders is
|
|
152
230
|
injected unchanged, so existing configs keep working. The selector preview and
|
|
@@ -198,7 +276,7 @@ The `guards` array accepts these guard objects (all must pass):
|
|
|
198
276
|
|
|
199
277
|
| `type` | `value` | Blocks when… |
|
|
200
278
|
|---|---|---|
|
|
201
|
-
| `requireDirty` | none | the working tree is clean (
|
|
279
|
+
| `requireDirty` | none | the working tree is clean (no changed files) |
|
|
202
280
|
| `requireBranch` | branch name | the current branch is not the given name |
|
|
203
281
|
| `requireRepo` | repo name | the git-remote basename context value is not the given name |
|
|
204
282
|
| `requireFilePattern` | glob | no changed file matches the glob |
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
{
|
|
5
5
|
"name": "Review changes",
|
|
6
6
|
"category": "Plan",
|
|
7
|
-
"requireDirty": true,
|
|
8
7
|
"description": "Review the current code changes (Plan)",
|
|
9
|
-
"
|
|
8
|
+
"requireDirty": true,
|
|
9
|
+
"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
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"name": "Review code",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
{
|
|
18
18
|
"name": "Cleanup",
|
|
19
19
|
"category": "Plan",
|
|
20
|
-
"autoRun": false,
|
|
21
20
|
"description": "Clean up dead code and duplicates (Plan)",
|
|
22
21
|
"prompt": "Scan the project for dead code, unused imports, commented-out blocks, and duplicated logic. Do a plan proposal for the removals and consolidations, keeping behavior unchanged. Do not make any changes yet."
|
|
23
22
|
},
|
|
@@ -61,13 +60,16 @@
|
|
|
61
60
|
"name": "Release",
|
|
62
61
|
"category": "Ops",
|
|
63
62
|
"description": "Prepare a release (version, changelog, tag)",
|
|
63
|
+
"when": "git",
|
|
64
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."
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"name": "Commit",
|
|
68
68
|
"category": "Ops",
|
|
69
69
|
"description": "Prepare a clean commit",
|
|
70
|
-
"
|
|
70
|
+
"requireDirty": true,
|
|
71
|
+
"when": "git",
|
|
72
|
+
"prompt": "Prepare the working tree on branch {{branch}} ({{files_changed_count}} changed files: {{files_changed}}) for a clean commit: stage the relevant changes, and write a clear commit message describing what changed and why. Do not push."
|
|
71
73
|
}
|
|
72
74
|
]
|
|
73
75
|
}
|