pi-workflow-engine 0.5.0 → 0.6.1
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/.pi/extensions/pi-workflow-engine/index.ts +74 -6
- package/.pi/extensions/pi-workflow-engine/src/dynamax.ts +3 -3
- package/.pi/extensions/pi-workflow-engine/src/engine.ts +11 -7
- package/.pi/extensions/pi-workflow-engine/src/review/github-pr-comments.ts +185 -0
- package/.pi/extensions/pi-workflow-engine/src/review/review-actions.ts +114 -0
- package/.pi/extensions/pi-workflow-engine/src/review/review-format.ts +132 -0
- package/.pi/extensions/pi-workflow-engine/src/review/review-handoff.ts +90 -0
- package/.pi/extensions/pi-workflow-engine/src/review/review-issues.ts +61 -0
- package/.pi/extensions/pi-workflow-engine/src/review/review-results-flow.ts +56 -0
- package/.pi/extensions/pi-workflow-engine/src/review/review-results-viewer.ts +240 -0
- package/.pi/extensions/pi-workflow-engine/src/types.ts +4 -0
- package/.pi/extensions/pi-workflow-engine/src/ui/workflow-inspector.ts +22 -4
- package/.pi/extensions/pi-workflow-engine/src/ui/workflow-result-renderer.ts +11 -52
- package/.pi/extensions/pi-workflow-engine/workflows/code-review.ts +13 -3
- package/README.md +27 -5
- package/USAGE.md +12 -6
- package/package.json +3 -1
- package/skills/workflow-code-review-actions/SKILL.md +44 -0
package/README.md
CHANGED
|
@@ -65,7 +65,11 @@ In a pi session, from inside a git repo with changes:
|
|
|
65
65
|
/workflow refactor-scout src/ # find safe refactor opportunities
|
|
66
66
|
/workflow diagnose "typecheck fails after the schema change"
|
|
67
67
|
/workflow perf-review "workflow startup latency"
|
|
68
|
-
/workflow code-review --inspect # open the live workflow inspector
|
|
68
|
+
/workflow code-review --inspect # open the live workflow inspector while the run is active
|
|
69
|
+
/workflow:inspector # reopen the last completed workflow inspector
|
|
70
|
+
/workflow code-review --result-viewer # explicitly open the post-review results viewer
|
|
71
|
+
/workflow code-review --review-viewer # alias for --result-viewer
|
|
72
|
+
/workflow code-review --no-result-viewer # explicitly keep the post-review viewer closed
|
|
69
73
|
```
|
|
70
74
|
|
|
71
75
|
The host agent can also invoke the `workflow` tool mid-conversation. It accepts either a registered workflow `name` or a one-off inline workflow `script`:
|
|
@@ -78,15 +82,17 @@ Opt into dynamic multi-agent orchestration with the literal `dynamax` token, or
|
|
|
78
82
|
|
|
79
83
|
```text
|
|
80
84
|
dynamax inspect this bug with multiple focused agents
|
|
81
|
-
/dynamax on
|
|
82
|
-
/dynamax status
|
|
83
|
-
/dynamax off
|
|
85
|
+
/workflow:dynamax on
|
|
86
|
+
/workflow:dynamax status
|
|
87
|
+
/workflow:dynamax off
|
|
84
88
|
```
|
|
85
89
|
|
|
86
90
|
`dynamax` is a permission signal for the host agent: once opted in, it may run an existing named workflow or author an inline workflow script through the `workflow` tool. In interactive mode, `/workflow` with no arguments also offers `✍ Author temporary one-shot workflow…`; choose it, type a brief, and pi will ask the host agent to author/run a temporary inline workflow.
|
|
87
91
|
|
|
88
92
|
The advisory workflows inspect and report only; they do not edit files. They return the same shape: summary, ranked findings, evidence, impact, recommendations, and next steps.
|
|
89
93
|
|
|
94
|
+
The package also ships the `workflow-code-review-actions` skill. When you select review findings in the results viewer, the parent agent can use that skill to either make minimal local fixes or raise GitHub PR inline comments through GitHub MCP/tools or `gh`.
|
|
95
|
+
|
|
90
96
|
## Built-in workflows
|
|
91
97
|
|
|
92
98
|
- `code-review`: Reviews the current branch, open PR, ref range, or target. It looks for correctness bugs and cleanup issues, then independently verifies candidates before ranking them.
|
|
@@ -104,6 +110,22 @@ The bundled review workflow is deliberately shaped like a serious review process
|
|
|
104
110
|
4. **Verify**: send each survivor to an independent verifier that must confirm, mark plausible, or refute with evidence.
|
|
105
111
|
5. **Synthesize**: produce one ranked report with stats, verdicts, and concrete locations.
|
|
106
112
|
|
|
113
|
+
After a direct TUI `/workflow code-review` run produces findings, pi records a readable table-formatted result message without asking whether to open another surface. Use `--result-viewer`/`--review-viewer` when you want the interactive findings viewer to open immediately, or `--no-result-viewer`/`--no-review-viewer` when a script or alias should explicitly keep it closed. Use `/workflow:inspector` after a run to reopen the last completed workflow inspector.
|
|
114
|
+
|
|
115
|
+
Viewer controls:
|
|
116
|
+
|
|
117
|
+
- `↑`/`↓`: move between findings.
|
|
118
|
+
- `1`-`9`: jump directly to a visible finding.
|
|
119
|
+
- `space`: tag/untag the current finding.
|
|
120
|
+
- `a`: tag or untag all visible findings.
|
|
121
|
+
- `enter`: expand/collapse the detail pane.
|
|
122
|
+
- `←`/`→` or `pageup`/`pagedown`: scroll detail text.
|
|
123
|
+
- `f`: hand selected findings to the parent agent for minimal local fixes.
|
|
124
|
+
- `c`: comment on selected findings upstream.
|
|
125
|
+
- `q`/`escape`: close the viewer.
|
|
126
|
+
|
|
127
|
+
GitHub inline comments require a GitHub PR checkout, an authenticated `gh`, and findings with changed-file line numbers. If direct PR context resolution or posting is unavailable, the viewer queues a parent-agent fallback prompt that can use installed GitHub MCP/tools, project skills, or `gh`. Workflow tool invocations remain non-interactive: they do not prompt or open the viewer, and they return table-formatted results only.
|
|
128
|
+
|
|
107
129
|
The review lenses live in `.pi/extensions/pi-workflow-engine/workflows/code-review.ts`. That is where your repo's real failure modes belong.
|
|
108
130
|
|
|
109
131
|
## Authoring workflows
|
|
@@ -172,7 +194,7 @@ Under the hood:
|
|
|
172
194
|
- **Each `agent()` is an in-process pi `AgentSession`** using `createAgentSession` and `SessionManager.inMemory()`.
|
|
173
195
|
- **Structured output is a terminating tool**. The engine registers one tool whose `parameters` is your schema; pi validates the call and the engine captures the args. There is no JSON scraping.
|
|
174
196
|
- **A single global semaphore caps concurrent agents**, so `parallel` and `pipeline` can nest freely while every `agent()` call still respects the run cap.
|
|
175
|
-
- **Three surfaces are registered**: `/workflow <name> [args]` for direct use, `/dynamax on|off|status`
|
|
197
|
+
- **Three surfaces are registered**: `/workflow <name> [args]` for direct use, grouped workflow commands such as `/workflow:dynamax on|off|status` and `/workflow:inspector`, and a `workflow` tool for host-agent delegation by `name` or inline `script`.
|
|
176
198
|
|
|
177
199
|
## Local development
|
|
178
200
|
|
package/USAGE.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
`pi-workflow-engine` adds multi-agent workflows to pi. Most users only need two surfaces:
|
|
4
4
|
|
|
5
5
|
- `/workflow <name> [args]` to run a saved workflow directly.
|
|
6
|
-
-
|
|
6
|
+
- `/workflow:*` commands for related actions such as inspector reopening and dynamax sticky mode.
|
|
7
|
+
- `dynamax` as a literal one-shot opt-in token when you want the host agent to author a one-off inline workflow for investigation/review.
|
|
7
8
|
|
|
8
9
|
## Run a workflow
|
|
9
10
|
|
|
@@ -22,7 +23,10 @@ The built-in workflows are advisory. They inspect, verify, and report; they do *
|
|
|
22
23
|
Useful flags:
|
|
23
24
|
|
|
24
25
|
```text
|
|
25
|
-
/workflow code-review --inspect # show live inspector
|
|
26
|
+
/workflow code-review --inspect # show the live inspector while the run is active
|
|
27
|
+
/workflow:inspector # reopen the last completed workflow inspector
|
|
28
|
+
/workflow code-review --result-viewer # explicitly open the findings viewer
|
|
29
|
+
/workflow code-review --review-viewer # alias for --result-viewer
|
|
26
30
|
/workflow code-review --concurrency=4 # cap concurrent subagents
|
|
27
31
|
/workflow code-review --refresh # rediscover newly added workflow files
|
|
28
32
|
```
|
|
@@ -57,9 +61,9 @@ dynamax use parallel agents to review this design and report the risks
|
|
|
57
61
|
Sticky for the session:
|
|
58
62
|
|
|
59
63
|
```text
|
|
60
|
-
/dynamax on
|
|
61
|
-
/dynamax off
|
|
62
|
-
/dynamax status
|
|
64
|
+
/workflow:dynamax on
|
|
65
|
+
/workflow:dynamax off
|
|
66
|
+
/workflow:dynamax status
|
|
63
67
|
```
|
|
64
68
|
|
|
65
69
|
With dynamax enabled, the host agent usually calls the `workflow` tool with `script`: a one-off inline workflow. It can still call a saved workflow by `name` when one already fits.
|
|
@@ -75,7 +79,9 @@ Workflow results are rendered in pi with:
|
|
|
75
79
|
- next steps;
|
|
76
80
|
- run stats when available.
|
|
77
81
|
|
|
78
|
-
During a run, pi shows live phases and subagent status. Use `--inspect` if you want a larger live view.
|
|
82
|
+
During a run, pi shows live phases and subagent status. Use `--inspect` if you want a larger live view while the workflow is active, then `/workflow:inspector` if you want to bring the last completed inspector back up afterward.
|
|
83
|
+
|
|
84
|
+
Code-review findings are rendered as a formatted result message by default. pi no longer asks whether to open the findings viewer. Use `--result-viewer` or `--review-viewer` when you want to inspect findings interactively, press `enter` to expand/collapse the nicely formatted finding text, and use `1`-`9` to jump directly to a visible finding.
|
|
79
85
|
|
|
80
86
|
## Author a saved workflow
|
|
81
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-workflow-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A customisable multi-agent workflow-orchestration engine for the pi coding agent.",
|
|
6
6
|
"keywords": [
|
|
@@ -24,12 +24,14 @@
|
|
|
24
24
|
".pi/extensions/pi-workflow-engine",
|
|
25
25
|
".pi/settings.json",
|
|
26
26
|
"assets",
|
|
27
|
+
"skills",
|
|
27
28
|
"README.md",
|
|
28
29
|
"USAGE.md",
|
|
29
30
|
"LICENSE"
|
|
30
31
|
],
|
|
31
32
|
"pi": {
|
|
32
33
|
"extensions": [".pi/extensions/pi-workflow-engine/index.ts"],
|
|
34
|
+
"skills": ["skills"],
|
|
33
35
|
"image": "https://raw.githubusercontent.com/timbrinded/pi-workflow-engine/master/assets/preview.png"
|
|
34
36
|
},
|
|
35
37
|
"scripts": {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workflow-code-review-actions
|
|
3
|
+
description: "Act on selected code-review findings from pi-workflow-engine: make minimal fixes or post GitHub PR inline comments using gh, GitHub MCP/tools, or project-specific tools."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use this skill when the parent agent receives selected code-review finding JSON from `pi-workflow-engine`.
|
|
7
|
+
|
|
8
|
+
## Inputs
|
|
9
|
+
|
|
10
|
+
The prompt will include compact JSON with:
|
|
11
|
+
|
|
12
|
+
- `context`: workflow name, target, diff command, changed files, and optional summary.
|
|
13
|
+
- `issues`: selected findings with `id`, `summary`, `category`, `severity`, `confidence`, `location`, `impact`, `evidence`, and `recommendation`.
|
|
14
|
+
|
|
15
|
+
## Fix mode
|
|
16
|
+
|
|
17
|
+
When mode is `fix selected code-review findings`:
|
|
18
|
+
|
|
19
|
+
1. Inspect the selected issue JSON before editing.
|
|
20
|
+
2. Make minimal edits that address only the selected findings.
|
|
21
|
+
3. Preserve unrelated user changes and avoid broad refactors.
|
|
22
|
+
4. Run focused validation if available for the touched files or behavior.
|
|
23
|
+
5. Summarize changed files and validation results.
|
|
24
|
+
6. Do not post GitHub PR comments in fix mode.
|
|
25
|
+
|
|
26
|
+
## Comment mode
|
|
27
|
+
|
|
28
|
+
When mode is `post inline GitHub PR comments`:
|
|
29
|
+
|
|
30
|
+
1. Do not edit files or make code changes.
|
|
31
|
+
2. Prefer installed GitHub MCP/tools if visible in the active tool list.
|
|
32
|
+
3. If no GitHub MCP/tools are available, use `gh`:
|
|
33
|
+
- Resolve the PR with `gh pr view --json number,headRefOid,url,headRepositoryOwner,headRepository`.
|
|
34
|
+
- Resolve the repository with `gh repo view --json nameWithOwner` when owner/name is missing.
|
|
35
|
+
- Post each inline comment with `gh api repos/{owner}/{repo}/pulls/{number}/comments` and include `commit_id`, `path`, `line`, and `side=RIGHT`.
|
|
36
|
+
4. Keep each comment concise: summary, severity/confidence/category, impact, evidence, and recommendation.
|
|
37
|
+
5. Report posted, skipped, and failed counts.
|
|
38
|
+
|
|
39
|
+
## Safety rules
|
|
40
|
+
|
|
41
|
+
- Do not post duplicate comments.
|
|
42
|
+
- Do not comment line-less findings inline.
|
|
43
|
+
- Ask the user if the upstream PR cannot be identified.
|
|
44
|
+
- Keep actions scoped to the selected issue IDs only.
|