@wichayutdew/pi-workflows 2.5.1 → 2.7.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 +34 -1
- package/dist/index.js +1315 -2467
- package/examples/starter-kit/agents/planner.md +11 -0
- package/examples/starter-kit/agents/reviewer.md +10 -0
- package/examples/starter-kit/agents/scout.md +10 -0
- package/examples/starter-kit/agents/worker.md +11 -0
- package/examples/starter-kit/agents/workspace-preparer.md +10 -0
- package/examples/starter-kit/investigate.workflow.yaml +84 -0
- package/examples/starter-kit/jira.workflow.yaml +75 -0
- package/examples/starter-kit/mr-comment.workflow.yaml +86 -93
- package/examples/starter-kit/mr-review.workflow.yaml +52 -88
- package/examples/starter-kit/settings.yaml +4 -0
- package/examples/starter-kit/steps/investigate/investigate.md +40 -0
- package/examples/starter-kit/steps/investigate/retrieve.md +28 -0
- package/examples/starter-kit/steps/investigate/validate.md +20 -0
- package/examples/starter-kit/steps/jira/create.md +25 -0
- package/examples/starter-kit/steps/jira/draft.md +18 -0
- package/examples/starter-kit/steps/jira/plan.md +30 -0
- package/examples/starter-kit/steps/mr-comment/checkout-source.md +14 -0
- package/examples/starter-kit/steps/mr-comment/fetch.md +11 -28
- package/examples/starter-kit/steps/mr-comment/implement.md +9 -26
- package/examples/starter-kit/steps/mr-comment/plan.md +46 -55
- package/examples/starter-kit/steps/mr-comment/publish.md +11 -31
- package/examples/starter-kit/steps/mr-comment/verify.md +7 -34
- package/examples/starter-kit/steps/mr-review/fetch.md +13 -21
- package/examples/starter-kit/steps/mr-review/publish-approved.md +18 -0
- package/examples/starter-kit/steps/mr-review/review-for-approval.md +53 -0
- package/examples/starter-kit/steps/mr-review/verify-published.md +16 -0
- package/examples/starter-kit/steps/shared/prepare-workspace.md +11 -89
- package/examples/starter-kit/steps/shared/publish-remote.md +16 -0
- package/examples/starter-kit/steps/ticket/implement.md +10 -23
- package/examples/starter-kit/steps/ticket/plan.md +49 -98
- package/examples/starter-kit/steps/ticket/verify.md +14 -65
- package/examples/starter-kit/steps/work/implement.md +11 -22
- package/examples/starter-kit/steps/work/plan.md +43 -59
- package/examples/starter-kit/steps/work/verify.md +14 -25
- package/examples/starter-kit/ticket.workflow.yaml +57 -61
- package/examples/starter-kit/work.workflow.yaml +49 -57
- package/package.json +9 -19
- package/schemas/workflow.schema.json +63 -15
- package/scripts/patch-herdr-agent-state.mjs +36 -0
- package/src/agents/profile.ts +98 -0
- package/src/config/ceiling.ts +0 -82
- package/src/config/types.ts +15 -53
- package/src/config/validation/settings.ts +2 -14
- package/src/config/validation/step.ts +129 -8
- package/src/config/validation/workflow.ts +1 -10
- package/src/engine/run-workflow-validation.ts +0 -3
- package/src/engine/state-types.ts +1 -1
- package/src/harness/action-context.ts +1 -13
- package/src/harness/artifact-contract.ts +46 -0
- package/src/harness/delegation-control-actions.ts +4 -63
- package/src/harness/delegation-plan.ts +26 -80
- package/src/harness/delegation-response-actions.ts +22 -135
- package/src/harness/dependencies.ts +1 -12
- package/src/harness/gate-submission-action.ts +28 -0
- package/src/harness/status-actions.ts +20 -0
- package/src/harness/step-execution-actions.ts +2 -9
- package/src/harness/types.ts +2 -40
- package/src/harness.ts +2 -17
- package/src/herdr-workflow-state.ts +65 -0
- package/src/index.ts +4 -9
- package/src/integrations/subagents/child-policy-validation.ts +6 -7
- package/src/integrations/subagents/child-runtime-dependencies.ts +1 -1
- package/src/integrations/subagents/child-runtime-policy.ts +1 -7
- package/src/integrations/subagents/child-runtime.ts +18 -9
- package/src/integrations/subagents/client.ts +240 -98
- package/src/integrations/subagents/protocol-events.ts +32 -15
- package/src/integrations/subagents/protocol.ts +1 -1
- package/src/preflight.ts +0 -8
- package/src/prompt/main-workflow-notice.ts +8 -15
- package/src/prompt/step-task.ts +7 -6
- package/src/workflow-status/format-status.ts +5 -1
- package/src/workflow-status/render-step-detail.ts +94 -0
- package/src/workflow-status/types.ts +1 -0
- package/src/workflow-status/view.ts +49 -14
- package/agents/step.md +0 -32
- package/examples/mr-comments.workflow.yaml +0 -125
- package/examples/prompts/mr-comments/implement.md +0 -17
- package/examples/prompts/mr-comments/inspect.md +0 -5
- package/examples/prompts/mr-comments/plan.md +0 -54
- package/examples/prompts/mr-comments/verify.md +0 -9
- package/examples/settings.yaml +0 -27
- package/examples/starter-kit/steps/mr-review/publish.md +0 -48
- package/examples/starter-kit/steps/mr-review/review.md +0 -76
- package/examples/starter-kit/steps/mr-review/verify.md +0 -35
- package/src/config/validation/subagent.ts +0 -288
- package/src/harness/delegation-failure.ts +0 -248
- package/src/harness/delegation-recovery-validation.ts +0 -161
- package/src/harness/delegation-retry-policy.ts +0 -120
- package/src/integrations/subagents/client-delegation.ts +0 -181
- package/src/integrations/subagents/client-messages.ts +0 -66
- package/src/integrations/subagents/client-types.ts +0 -36
- package/src/integrations/subagents/diagnostic-format.ts +0 -45
- package/src/integrations/subagents/diagnostic-text.ts +0 -114
- package/src/integrations/subagents/diagnostic-types.ts +0 -83
- package/src/integrations/subagents/diagnostics.ts +0 -26
- package/src/integrations/subagents/failure-correlation.ts +0 -285
- package/src/integrations/subagents/failure-transcript.ts +0 -252
- package/src/integrations/subagents/hidden-bash-failure.ts +0 -98
- package/src/integrations/subagents/replay-audit.ts +0 -146
- package/src/integrations/subagents/replay-safety.ts +0 -67
- package/src/integrations/subagents/session-diagnostics.ts +0 -357
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
You are the scope-retrieval stage for `/investigate`. Stay read-only in this delegated child; do not launch subagents.
|
|
2
|
+
|
|
3
|
+
Workflow input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Previously rejected scope:
|
|
7
|
+
{{gate.artifact}}
|
|
8
|
+
|
|
9
|
+
Plannotator feedback:
|
|
10
|
+
{{gate.feedback}}
|
|
11
|
+
|
|
12
|
+
## Scope Artifact Structure
|
|
13
|
+
|
|
14
|
+
1. `# <Investigation title>`
|
|
15
|
+
2. `## Brief description`
|
|
16
|
+
3. `## Goals` (numbered list)
|
|
17
|
+
4. `## Boundaries` (in-scope systems & explicit exclusions)
|
|
18
|
+
5. `## Evidence & sources` (Jira, local files, documents, search tools)
|
|
19
|
+
6. `## Report destination` (`./investigation-findings/<slug>.md`)
|
|
20
|
+
7. `## Open evidence gaps`
|
|
21
|
+
|
|
22
|
+
## Artifact limit
|
|
23
|
+
Keep the submitted artifact concise and at most 6,000 characters. Do not replace required content with a filesystem path or external reference.
|
|
24
|
+
|
|
25
|
+
## Outcomes
|
|
26
|
+
- `submit`: Scope ready for Plannotator gate review.
|
|
27
|
+
- `retry`: Transient read-only API failure.
|
|
28
|
+
- `blocked`: Empty input or inaccessible required Jira data.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
You are the independent validation stage for an investigation report. Stay read-only; do not edit the report or launch subagents.
|
|
2
|
+
|
|
3
|
+
Original request:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Approved scope artifact:
|
|
7
|
+
{{reviewed.artifact}}
|
|
8
|
+
|
|
9
|
+
Investigation ledger:
|
|
10
|
+
{{last.summary}}
|
|
11
|
+
|
|
12
|
+
## Validation Rules & Review Criteria
|
|
13
|
+
|
|
14
|
+
1. **Independent Verification**: Do not trust the prior claim ledger; verify citations, line numbers, and sources directly with read-only tools.
|
|
15
|
+
2. **Reader-Clarity Review**: Ensure prose is concise, scannable, and free of filler. Recommend Mermaid diagrams only where complex flows or relationships warrant visual representation.
|
|
16
|
+
3. **Outcomes**:
|
|
17
|
+
- `approved`: All material claims verified and clear.
|
|
18
|
+
- `gaps`: Actionable evidence gaps, contradictions, or clarity issues (returns to `investigate`).
|
|
19
|
+
- `retry`: Recoverable read-only tool failure.
|
|
20
|
+
- `blocked`: Irreconcilable evidence or missing sources after exhaustive attempts.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
You are the Jira creation stage for an approved `/jira` plan. Do not launch subagents, write local files, or mutate unapproved Jira records.
|
|
2
|
+
|
|
3
|
+
Original input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Approved Jira plan:
|
|
7
|
+
{{reviewed.artifact}}
|
|
8
|
+
|
|
9
|
+
Approval feedback:
|
|
10
|
+
{{reviewed.feedback}}
|
|
11
|
+
|
|
12
|
+
Previous creation ledger:
|
|
13
|
+
{{last.summary}}
|
|
14
|
+
|
|
15
|
+
## Guardrails & Output Contract
|
|
16
|
+
|
|
17
|
+
1. **Idempotence**: Check the creation ledger before every write; skip any issue or link already created and confirmed.
|
|
18
|
+
2. **Immediate Readback**: Always read back created issues to capture exact numeric IDs, keys, and URLs.
|
|
19
|
+
3. **Safety**: Never delete issues, guess custom fields, or retry ambiguous mutations. On any partial failure or timeout, return `blocked` with the confirmed ledger.
|
|
20
|
+
4. **Required Output Format**:
|
|
21
|
+
- `# Epic ID: <numeric ID>`
|
|
22
|
+
- `# Epic key: <key>`
|
|
23
|
+
- `# Epic URL: <URL>`
|
|
24
|
+
- `## Stories` (numbered list with IDs, keys, URLs, Epic membership, and link proofs)
|
|
25
|
+
- `## Creation ledger` (full preflight mapping and execution trace)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
You are the input-normalization stage for `/jira`. Stay read-only; do not call Atlassian tools or write files.
|
|
2
|
+
|
|
3
|
+
Workflow input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
## Draft Artifact Structure
|
|
7
|
+
|
|
8
|
+
1. `# Jira draft`
|
|
9
|
+
2. `## Source` (`Markdown path: <path>` or `Quick summary`)
|
|
10
|
+
3. `## Project key` (explicit key or `Missing`)
|
|
11
|
+
4. `## Epic draft` (Name, goal, expected value, touched services)
|
|
12
|
+
5. `## Ordered Story draft` (numbered list with stable draft IDs, service, frontend/backend scope, implementation bullets, risks, dependencies)
|
|
13
|
+
6. `## Unknowns` (missing details needed before creation)
|
|
14
|
+
|
|
15
|
+
## Outcomes
|
|
16
|
+
- `ready`: Draft parsed and ready for planning.
|
|
17
|
+
- `retry`: Transient file read failure.
|
|
18
|
+
- `blocked`: Unreadable file path or empty input.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
You are the Jira planning and approval stage for `/jira`. Stay read-only; do not create issues or launch subagents.
|
|
2
|
+
|
|
3
|
+
Original input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Normalized draft:
|
|
7
|
+
{{last.summary}}
|
|
8
|
+
|
|
9
|
+
Previously rejected plan:
|
|
10
|
+
{{gate.artifact}}
|
|
11
|
+
|
|
12
|
+
Plannotator feedback:
|
|
13
|
+
{{gate.feedback}}
|
|
14
|
+
|
|
15
|
+
## Plan Artifact Structure
|
|
16
|
+
|
|
17
|
+
1. `# Create Jira Epic and Stories`
|
|
18
|
+
2. `## Jira field contract` — verified field IDs, link types, payload shapes, and representative keys.
|
|
19
|
+
3. `## Epic` — Name, quick summary, goal, **Feature diagram (Mermaid)**, expected value, timeline, touched services, references.
|
|
20
|
+
4. `## Ordered Stories` — Numbered stories with `<service> — <Frontend|Backend> — <outcome>`, background, implementation bullets, risks, acceptance criteria, Epic membership, dependencies.
|
|
21
|
+
5. `## Creation sequence` — Epic first, followed by stories in dependency order.
|
|
22
|
+
6. `## Safety limits` — Exact mapped fields only; no guessed IDs or unapproved objects.
|
|
23
|
+
|
|
24
|
+
## Artifact limit
|
|
25
|
+
Keep the submitted artifact concise and at most 16,000 characters. Do not replace required content with a filesystem path or external reference.
|
|
26
|
+
|
|
27
|
+
## Outcomes
|
|
28
|
+
- `submit`: Plan ready for Plannotator review.
|
|
29
|
+
- `retry`: Transient read-only Atlassian API failure.
|
|
30
|
+
- `blocked`: Inaccessible project, unverified field mappings, or missing project key.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
You prepare the local checkout for resolving hosted MR comments. Do not delete worktrees, reset HEAD, or launch subagents.
|
|
2
|
+
|
|
3
|
+
Review input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Fetched review evidence:
|
|
7
|
+
{{last.summary}}
|
|
8
|
+
|
|
9
|
+
## Guardrails
|
|
10
|
+
- **Preservation**: Never stash, reset, clean, or delete files.
|
|
11
|
+
- **Outcomes**:
|
|
12
|
+
- `ready`: Source branch checked out/bound safely. Include `workspace: {cwd: "<path>"}`.
|
|
13
|
+
- `retry`: Transient fetch error.
|
|
14
|
+
- `blocked`: Dirty unrelated checkout, divergent branch history, or missing remote.
|
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
You are the
|
|
2
|
-
request or GitHub pull request comments. Do not propose fixes, edit files, or
|
|
3
|
-
mutate remote state.
|
|
1
|
+
You are the read-only evidence-fetch stage for `/mr-comment`. Do not modify local/remote state or launch subagents.
|
|
4
2
|
|
|
5
3
|
Review input:
|
|
6
4
|
{{workflow.input}}
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
## Evidence Packet Structure
|
|
7
|
+
- Canonical URL, host, project/repo, review number.
|
|
8
|
+
- Source/target branches and remote SHAs.
|
|
9
|
+
- Matching local remote name and local Git status.
|
|
10
|
+
- Changed file list and diff context.
|
|
11
|
+
- Unresolved discussion comments with IDs, authors, anchors (path/line), and text.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Inspect the current Git root, registered worktree, branch, HEAD, status,
|
|
19
|
-
remotes, and repository instructions. This current checkout is the only
|
|
20
|
-
workspace the entire workflow may use. Never create, switch, reset, clean,
|
|
21
|
-
delete, or prepare another branch or worktree. Preserve all local changes. A
|
|
22
|
-
local branch ahead of the hosted head is evidence, not a reason to reset it.
|
|
23
|
-
Run Git inspection from the current child directory with the subcommand first
|
|
24
|
-
(`git status`, `git rev-parse`, and so on); the YAML allow-list does not permit
|
|
25
|
-
a dynamic `git -C` prefix. For machine-readable GitLab evidence, prefer
|
|
26
|
-
`glab api` and do not assume the installed `glab mr view` supports `--json`.
|
|
27
|
-
|
|
28
|
-
Call `structured_output` alone with outcome `ready` and a self-contained
|
|
29
|
-
evidence packet in `summary`: canonical URL/host, review identity, branches and
|
|
30
|
-
SHAs, current Git root/worktree/branch/HEAD/status, head relationship, changed
|
|
31
|
-
files, checks/conflicts, every unresolved comment and anchor, pagination, and
|
|
32
|
-
acquisition mechanisms. Use `blocked` when review identity, authentication,
|
|
33
|
-
pagination, checkout identity, or material evidence cannot be made safe.
|
|
13
|
+
## Outcomes
|
|
14
|
+
- `ready`: Evidence gathered successfully.
|
|
15
|
+
- `retry`: Transient network/read failure.
|
|
16
|
+
- `blocked`: Authentication failure, invalid URL, or missing permissions.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
You
|
|
2
|
-
checkout.
|
|
1
|
+
You are the implementation stage for the approved review-comment plan. Stay in this delegated child; do not launch subagents.
|
|
3
2
|
|
|
4
3
|
Review input:
|
|
5
4
|
{{workflow.input}}
|
|
@@ -10,29 +9,13 @@ Approved plan:
|
|
|
10
9
|
Approval feedback:
|
|
11
10
|
{{reviewed.feedback}}
|
|
12
11
|
|
|
13
|
-
Previous
|
|
12
|
+
Previous ledger:
|
|
14
13
|
{{last.summary}}
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
and current tool documentation; the harness does not know the language,
|
|
24
|
-
framework, package manager, argument order, or cwd syntax. Diagnose a failed
|
|
25
|
-
invocation and current state before trying a semantically identical repair.
|
|
26
|
-
Never weaken checks, broaden mutation scope, or duplicate an existing commit.
|
|
27
|
-
|
|
28
|
-
Run all approved worker validation and commit only when the contract requires
|
|
29
|
-
it. Do not push, reply, resolve, approve, merge, close, delete, or otherwise
|
|
30
|
-
mutate remote state.
|
|
31
|
-
|
|
32
|
-
Call `structured_output` alone with outcome `ready` when local work is ready for
|
|
33
|
-
independent verification. Repeat review/head/checkout identity, comment
|
|
34
|
-
classifications, changed files, exact commands/results, criteria evidence,
|
|
35
|
-
commit or reply-only state, current status, intended replies, risks, and the
|
|
36
|
-
unchanged Execution contract in `summary`. Use `blocked` for stale identity,
|
|
37
|
-
missing authority, unsafe scope, or exhausted recovery. Do not create a new
|
|
38
|
-
plan or workspace.
|
|
15
|
+
## Rules & Invariants
|
|
16
|
+
- Execute only approved `workerCommands`.
|
|
17
|
+
- For reply-only plans (no code changes needed), verify code without creating commits.
|
|
18
|
+
- Outcomes:
|
|
19
|
+
- `ready`: Implementation complete and committed. Pass full JSON contract to reviewer.
|
|
20
|
+
- `retry`: Transient tool failure.
|
|
21
|
+
- `blocked`: Unapproved command required or unrecoverable error.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
You are the planning
|
|
1
|
+
You are the planning stage for resolving hosted MR comments. Stay read-only on the bound checkout; do not launch subagents.
|
|
2
2
|
|
|
3
3
|
Review input:
|
|
4
4
|
{{workflow.input}}
|
|
@@ -9,62 +9,53 @@ Fetched evidence:
|
|
|
9
9
|
Previously rejected artifact:
|
|
10
10
|
{{gate.artifact}}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Plannotator feedback:
|
|
13
13
|
{{gate.feedback}}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
evidence and submit the complete proposal for another review. Each rejection
|
|
17
|
-
returns to this same planning step on the existing checkout.
|
|
15
|
+
## Plan Artifact Structure
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
branch, HEAD, and status. Work on top of this checkout exactly as it exists.
|
|
21
|
-
Never create, switch, reset, clean, delete, or prepare another branch or
|
|
22
|
-
worktree. Use matching read-only MCP/CLI/cURL calls and repository inspection
|
|
23
|
-
to close evidence gaps.
|
|
24
|
-
|
|
25
|
-
Classify every unresolved comment as valid, partly valid, invalid, or already
|
|
26
|
-
addressed, with causal evidence. Define scoped code changes, exact
|
|
27
|
-
repository-native checks, an optional commit, and the public reply for each
|
|
28
|
-
comment. Include the matching non-force push whenever a committed code fix must
|
|
29
|
-
reach the host, and one same-host reply action for every comment that requires
|
|
30
|
-
a response. Never include approval, merge, resolution, closure, deletion,
|
|
31
|
-
force-push, cross-host mutation, or unrelated work.
|
|
32
|
-
|
|
33
|
-
This user-owned prompt defines the Plannotator artifact:
|
|
34
|
-
|
|
35
|
-
1. `# <outcome-oriented title>`
|
|
17
|
+
1. `# <Outcome-oriented title>`
|
|
36
18
|
2. `## Review summary`
|
|
37
|
-
3. `## Comment decisions`
|
|
38
|
-
4. `## Implementation plan`
|
|
39
|
-
5. `##
|
|
40
|
-
6. `## Replies and remote actions`
|
|
19
|
+
3. `## Comment decisions` (per-comment classification and evidence)
|
|
20
|
+
4. `## Implementation plan` (scoped files, observable changes)
|
|
21
|
+
5. `## Validation` (tests, lint, format)
|
|
22
|
+
6. `## Replies and remote actions` (exact reply text per comment)
|
|
41
23
|
7. `## Risks`
|
|
42
|
-
8. `## Execution
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
24
|
+
8. `## Execution appendix (machine-readable)` (fenced JSON with `repository`, `workerCommands`, `reviewerCommands`, `remoteActions`)
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"repository": {
|
|
29
|
+
"cwd": "<bound-path>",
|
|
30
|
+
"branch": "<source-branch>",
|
|
31
|
+
"commitTitle": "fix(scope): address review comments",
|
|
32
|
+
"scopedFiles": ["src/a.ts"]
|
|
33
|
+
},
|
|
34
|
+
"workerCommands": [
|
|
35
|
+
{"id": "test-red", "command": "..."},
|
|
36
|
+
{"id": "test-green", "command": "..."}
|
|
37
|
+
],
|
|
38
|
+
"reviewerCommands": [
|
|
39
|
+
{"id": "full-tests", "command": "..."},
|
|
40
|
+
{"id": "lint", "command": "..."}
|
|
41
|
+
],
|
|
42
|
+
"remoteActions": [
|
|
43
|
+
{
|
|
44
|
+
"toolName": "bash",
|
|
45
|
+
"input": {"command": "git push origin HEAD:<source-branch>"}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"toolName": "bash",
|
|
49
|
+
"input": {"command": "glab api projects/<id>/merge_requests/<iid>/discussions/<disc_id>/notes -f body='...'"}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Artifact limit
|
|
56
|
+
Keep the submitted artifact concise and at most 10,000 characters. Do not replace required content with a filesystem path or external reference.
|
|
57
|
+
|
|
58
|
+
## Outcomes
|
|
59
|
+
- `submit`: Complete plan ready for Plannotator gate.
|
|
60
|
+
- `retry`: Transient API failure.
|
|
61
|
+
- `blocked`: Unsafe anchors, ambiguous comment context, or missing permissions.
|
|
@@ -1,37 +1,17 @@
|
|
|
1
|
-
You
|
|
2
|
-
from the current Git root, branch, and worktree; never create, switch, reset,
|
|
3
|
-
clean, delete, or prepare another one.
|
|
1
|
+
You are the publication stage for an approved review-comment plan. Do not broaden scope or launch subagents.
|
|
4
2
|
|
|
5
3
|
Review input:
|
|
6
4
|
{{workflow.input}}
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
{{
|
|
10
|
-
|
|
11
|
-
Refresh the same-host review head, comment anchors, local HEAD/status, and
|
|
12
|
-
remote branch through read-only calls. Require every identity and precondition
|
|
13
|
-
in the approved Execution contract to remain current.
|
|
14
|
-
Run Git from the current child directory with the approved subcommand first;
|
|
15
|
-
do not add `git -C`. Use `glab api` for machine-readable GitLab reads instead of
|
|
16
|
-
assuming `glab mr view --json` support.
|
|
6
|
+
Approved plan:
|
|
7
|
+
{{reviewed.artifact}}
|
|
17
8
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
user with the approved marker. Execute each remaining action once, in approved
|
|
21
|
-
order, through its exact configured MCP tool/input or standalone `git`, `glab`,
|
|
22
|
-
`gh`, or authenticated cURL command. Push before replies that describe the
|
|
23
|
-
code fix. Automatically perform every required approved push and reply; never
|
|
24
|
-
ask the user to perform one.
|
|
25
|
-
|
|
26
|
-
Require a successful same-host, target-correlated response. Never change reply
|
|
27
|
-
meaning, target another comment, expose credentials, force-push, approve,
|
|
28
|
-
merge, resolve, close, delete, or perform an unlisted mutation. After any
|
|
29
|
-
mutation-capable call is attempted, ambiguity is `blocked`; never blindly
|
|
30
|
-
replay it.
|
|
9
|
+
Verification ledger:
|
|
10
|
+
{{last.summary}}
|
|
31
11
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`blocked
|
|
12
|
+
## Guardrails
|
|
13
|
+
- Run only approved `remoteActions` (`git push`, `glab api`, `gh api`).
|
|
14
|
+
- Never force-push, resolve threads, approve, or merge MRs.
|
|
15
|
+
- Outcomes:
|
|
16
|
+
- `published`: All remote actions executed and confirmed.
|
|
17
|
+
- `blocked`: Remote failure or ambiguous state.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
You
|
|
2
|
-
edit files, change branches or worktrees, or mutate remote state.
|
|
1
|
+
You are the independent verification stage for the approved review-comment fixes. Stay read-only for code; do not modify files or launch subagents.
|
|
3
2
|
|
|
4
3
|
Review input:
|
|
5
4
|
{{workflow.input}}
|
|
@@ -7,37 +6,11 @@ Review input:
|
|
|
7
6
|
Approved plan:
|
|
8
7
|
{{reviewed.artifact}}
|
|
9
8
|
|
|
10
|
-
Implementation
|
|
9
|
+
Implementation ledger:
|
|
11
10
|
{{last.summary}}
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
acceptance criterion. Run all exact reviewer commands from the approved
|
|
19
|
-
contract. A skipped, stale, unavailable, or failing required check is not
|
|
20
|
-
passing. Verify every planned reply remains accurate and targets the same
|
|
21
|
-
comment/anchor. Verify every remote action is same-host, non-force,
|
|
22
|
-
idempotently observable, and limited to the approved push and replies. Do not
|
|
23
|
-
execute remote actions here.
|
|
24
|
-
|
|
25
|
-
Any regression, lint failure, formatting failure, or other actionable local
|
|
26
|
-
finding is `failed`; the workflow sends that outcome directly back to
|
|
27
|
-
implementation. Do not use `blocked` for a fixable local finding. When a code
|
|
28
|
-
fix was committed, require the matching approved non-force push action before
|
|
29
|
-
the replies. A valid unresolved review comment requires its approved public
|
|
30
|
-
reply action.
|
|
31
|
-
|
|
32
|
-
Call `structured_output` alone with:
|
|
33
|
-
|
|
34
|
-
- `ready` when all criteria pass and approved remote actions remain;
|
|
35
|
-
- `no-actions` when all criteria pass and no remote action is needed;
|
|
36
|
-
- `failed` for an actionable local defect, with exact evidence and the smallest
|
|
37
|
-
corrective handoff;
|
|
38
|
-
- `blocked` for stale head, checkout, anchor, scope, authority, or verification
|
|
39
|
-
that cannot proceed safely.
|
|
40
|
-
|
|
41
|
-
For `ready` and `failed`, include complete fresh evidence and the unchanged
|
|
42
|
-
Execution contract in `summary`. A `ready` handoff automatically proceeds to
|
|
43
|
-
the publisher; do not ask the user to push or post a reply.
|
|
12
|
+
## Outcomes
|
|
13
|
+
- `passed`: All acceptance criteria, tests, and linters pass. Hands off approved `remoteActions` to publication stage.
|
|
14
|
+
- `failed`: Local test failure or regression (returns to `implement`).
|
|
15
|
+
- `retry`: Recoverable read-only environment failure.
|
|
16
|
+
- `blocked`: Corrupted workspace or missing authority.
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
You are the
|
|
2
|
-
GitHub pull request. Do not review the code yet and do not mutate local or
|
|
3
|
-
remote state.
|
|
1
|
+
You are the read-only evidence-fetch stage for `/mr-review`. Do not mutate state or launch subagents.
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
Hosted review URL & context:
|
|
6
4
|
{{workflow.input}}
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
## Evidence Bundle Structure
|
|
7
|
+
1. `# Hosted review evidence`
|
|
8
|
+
2. `## Identity and immutable coordinates` (URL, host, project, MR/PR number, source/target branch, head SHA)
|
|
9
|
+
3. `## Description and commits`
|
|
10
|
+
4. `## Change manifest and diff evidence`
|
|
11
|
+
5. `## Pipelines or checks`
|
|
12
|
+
6. `## Existing review state`
|
|
13
|
+
7. `## Repository context`
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
evidence is complete. Inspect the local repository only when it corresponds to
|
|
17
|
-
the same review; record repository instructions and relevant current code
|
|
18
|
-
without editing it.
|
|
19
|
-
|
|
20
|
-
Call `structured_output` alone with outcome `fetched` and a self-contained
|
|
21
|
-
evidence packet in `summary`: canonical URL and host, project/repository and
|
|
22
|
-
review number, branches and SHAs, changed files, decisive diff context,
|
|
23
|
-
pipeline/check result, conflict state, discussions, pagination evidence, local
|
|
24
|
-
context used, and acquisition mechanisms. Use `blocked` when identity,
|
|
25
|
-
authentication, pagination, or material evidence cannot be established safely.
|
|
15
|
+
## Outcomes
|
|
16
|
+
- `fetched`: Evidence gathering complete.
|
|
17
|
+
- `blocked`: Inaccessible review, invalid URL, or missing permissions.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
You are the publication stage for an approved hosted code review. Do not rewrite approved content or launch subagents.
|
|
2
|
+
|
|
3
|
+
Original input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Approved review artifact:
|
|
7
|
+
{{reviewed.artifact}}
|
|
8
|
+
|
|
9
|
+
Approval feedback:
|
|
10
|
+
{{reviewed.feedback}}
|
|
11
|
+
|
|
12
|
+
Previous step handoff:
|
|
13
|
+
{{last.summary}}
|
|
14
|
+
|
|
15
|
+
## Guardrails
|
|
16
|
+
- Execute only literal commands approved in `actions`.
|
|
17
|
+
- Never force-push, approve, merge, resolve, or close reviews.
|
|
18
|
+
- Outcome `published` requires all actions either executed or verified already existing. Outcome `blocked` on ambiguity or error.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
You are the independent reviewer for a hosted MR/PR. This is the sole review artifact submitted to Plannotator. Do not mutate state or launch subagents.
|
|
2
|
+
|
|
3
|
+
Original input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Fetched evidence bundle:
|
|
7
|
+
{{last.summary}}
|
|
8
|
+
|
|
9
|
+
Previously rejected artifact:
|
|
10
|
+
{{gate.artifact}}
|
|
11
|
+
|
|
12
|
+
Plannotator feedback:
|
|
13
|
+
{{gate.feedback}}
|
|
14
|
+
|
|
15
|
+
## Review Artifact Structure
|
|
16
|
+
|
|
17
|
+
1. `# Review: <Short verdict>`
|
|
18
|
+
2. `## Verdict` — URL, host, current head SHA, concise outcome.
|
|
19
|
+
3. `## Findings` — Ordered by severity: path, line, problem, impact, evidence, fix. (Or `No actionable findings.`).
|
|
20
|
+
4. `## Validation` — Refreshed diff, checks, and false-positive checks.
|
|
21
|
+
5. `## Publication contract` — Fenced JSON with `actions` array.
|
|
22
|
+
6. `## Safety boundaries` — Prohibited actions (no force push, no unapproved merges).
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"actions": [
|
|
27
|
+
{
|
|
28
|
+
"toolName": "bash",
|
|
29
|
+
"input": {
|
|
30
|
+
"command": "glab api projects/<id>/merge_requests/<iid>/discussions ..."
|
|
31
|
+
},
|
|
32
|
+
"effect": {
|
|
33
|
+
"kind": "inline-comment",
|
|
34
|
+
"host": "gitlab.com",
|
|
35
|
+
"reviewUrl": "https://...",
|
|
36
|
+
"headSha": "<current-sha>",
|
|
37
|
+
"path": "src/file.ts",
|
|
38
|
+
"line": 42,
|
|
39
|
+
"body": "Exact feedback...",
|
|
40
|
+
"marker": "<unique-marker>"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Artifact limit
|
|
48
|
+
Keep the submitted artifact concise and at most 8,000 characters. Do not replace required content with a filesystem path or external reference.
|
|
49
|
+
|
|
50
|
+
## Outcomes
|
|
51
|
+
- `submit`: Review artifact ready for Plannotator gate.
|
|
52
|
+
- `retry`: Transient read-only API failure.
|
|
53
|
+
- `blocked`: Stale review head or inaccessible discussion API.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
You are the read-only verification stage for an approved hosted review. Do not mutate state or execute publication commands.
|
|
2
|
+
|
|
3
|
+
Original input:
|
|
4
|
+
{{workflow.input}}
|
|
5
|
+
|
|
6
|
+
Approved review artifact:
|
|
7
|
+
{{reviewed.artifact}}
|
|
8
|
+
|
|
9
|
+
Publication ledger:
|
|
10
|
+
{{last.summary}}
|
|
11
|
+
|
|
12
|
+
## Reviewer Invariants & Outcomes
|
|
13
|
+
- `verified`: Every approved inline comment or summary note is observable on the host with its exact marker.
|
|
14
|
+
- `failed`: An actionable missing comment or mismatch is detected; returns to `publish-approved` stage for correction.
|
|
15
|
+
- `retry`: Recoverable read-only API failure.
|
|
16
|
+
- `blocked`: Stale review or corrupted state.
|