zelio-cli 0.0.0-stage → 0.1.0-beta.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/README.md +178 -2
- package/dist/attachments.js +121 -0
- package/dist/attachments.js.map +1 -0
- package/dist/cli.js +469 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud/board.js +311 -0
- package/dist/cloud/board.js.map +1 -0
- package/dist/cloud/command.js +260 -0
- package/dist/cloud/command.js.map +1 -0
- package/dist/cloud/config.js +132 -0
- package/dist/cloud/config.js.map +1 -0
- package/dist/cloud/credentials.js +134 -0
- package/dist/cloud/credentials.js.map +1 -0
- package/dist/cloud/login.js +165 -0
- package/dist/cloud/login.js.map +1 -0
- package/dist/cloud/pair.js +110 -0
- package/dist/cloud/pair.js.map +1 -0
- package/dist/cloud/pkce.js +16 -0
- package/dist/cloud/pkce.js.map +1 -0
- package/dist/cloud/push-nudge.js +63 -0
- package/dist/cloud/push-nudge.js.map +1 -0
- package/dist/cloud/relay.js +129 -0
- package/dist/cloud/relay.js.map +1 -0
- package/dist/cloud/token.js +66 -0
- package/dist/cloud/token.js.map +1 -0
- package/dist/cloud/tunnel.js +410 -0
- package/dist/cloud/tunnel.js.map +1 -0
- package/dist/db/db.js +1614 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/lifecycle.js +133 -0
- package/dist/db/lifecycle.js.map +1 -0
- package/dist/limits.js +35 -0
- package/dist/limits.js.map +1 -0
- package/dist/metrics.js +30 -0
- package/dist/metrics.js.map +1 -0
- package/dist/orchestrator/claude-session.js +208 -0
- package/dist/orchestrator/claude-session.js.map +1 -0
- package/dist/orchestrator/codex-session.js +326 -0
- package/dist/orchestrator/codex-session.js.map +1 -0
- package/dist/orchestrator/contract.js +181 -0
- package/dist/orchestrator/contract.js.map +1 -0
- package/dist/orchestrator/explore.js +176 -0
- package/dist/orchestrator/explore.js.map +1 -0
- package/dist/orchestrator/new-task-prompt.js +51 -0
- package/dist/orchestrator/new-task-prompt.js.map +1 -0
- package/dist/orchestrator/pi-session.js +228 -0
- package/dist/orchestrator/pi-session.js.map +1 -0
- package/dist/orchestrator/prompt.js +110 -0
- package/dist/orchestrator/prompt.js.map +1 -0
- package/dist/orchestrator/research.js +178 -0
- package/dist/orchestrator/research.js.map +1 -0
- package/dist/orchestrator/runtime.js +1054 -0
- package/dist/orchestrator/runtime.js.map +1 -0
- package/dist/orchestrator/session.js +2 -0
- package/dist/orchestrator/session.js.map +1 -0
- package/dist/orchestrator/types.js +2 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/orchestrator/web.js +276 -0
- package/dist/orchestrator/web.js.map +1 -0
- package/dist/repo/index.js +188 -0
- package/dist/repo/index.js.map +1 -0
- package/dist/repo/instructions.js +52 -0
- package/dist/repo/instructions.js.map +1 -0
- package/dist/repo/linked-boards.js +252 -0
- package/dist/repo/linked-boards.js.map +1 -0
- package/dist/run/actions.js +233 -0
- package/dist/run/actions.js.map +1 -0
- package/dist/run/bash-guard.js +183 -0
- package/dist/run/bash-guard.js.map +1 -0
- package/dist/run/claude-runtime.js +242 -0
- package/dist/run/claude-runtime.js.map +1 -0
- package/dist/run/claude-stream.js +306 -0
- package/dist/run/claude-stream.js.map +1 -0
- package/dist/run/codex-client.js +200 -0
- package/dist/run/codex-client.js.map +1 -0
- package/dist/run/codex-runtime.js +366 -0
- package/dist/run/codex-runtime.js.map +1 -0
- package/dist/run/context.js +87 -0
- package/dist/run/context.js.map +1 -0
- package/dist/run/diff.js +196 -0
- package/dist/run/diff.js.map +1 -0
- package/dist/run/evidence.js +48 -0
- package/dist/run/evidence.js.map +1 -0
- package/dist/run/finish.js +393 -0
- package/dist/run/finish.js.map +1 -0
- package/dist/run/harness-runtime.js +28 -0
- package/dist/run/harness-runtime.js.map +1 -0
- package/dist/run/harnesses.js +273 -0
- package/dist/run/harnesses.js.map +1 -0
- package/dist/run/issue.js +79 -0
- package/dist/run/issue.js.map +1 -0
- package/dist/run/keep-awake.js +58 -0
- package/dist/run/keep-awake.js.map +1 -0
- package/dist/run/lead.js +200 -0
- package/dist/run/lead.js.map +1 -0
- package/dist/run/manager.js +1709 -0
- package/dist/run/manager.js.map +1 -0
- package/dist/run/mentions.js +35 -0
- package/dist/run/mentions.js.map +1 -0
- package/dist/run/merge-watch.js +394 -0
- package/dist/run/merge-watch.js.map +1 -0
- package/dist/run/models.js +88 -0
- package/dist/run/models.js.map +1 -0
- package/dist/run/phases.js +23 -0
- package/dist/run/phases.js.map +1 -0
- package/dist/run/pi-rpc.js +412 -0
- package/dist/run/pi-rpc.js.map +1 -0
- package/dist/run/pr-merge.js +121 -0
- package/dist/run/pr-merge.js.map +1 -0
- package/dist/run/profiles.js +43 -0
- package/dist/run/profiles.js.map +1 -0
- package/dist/run/prompt.js +345 -0
- package/dist/run/prompt.js.map +1 -0
- package/dist/run/pull-request.js +23 -0
- package/dist/run/pull-request.js.map +1 -0
- package/dist/run/result-tool.js +93 -0
- package/dist/run/result-tool.js.map +1 -0
- package/dist/run/result.js +113 -0
- package/dist/run/result.js.map +1 -0
- package/dist/run/retro.js +346 -0
- package/dist/run/retro.js.map +1 -0
- package/dist/run/settings.js +25 -0
- package/dist/run/settings.js.map +1 -0
- package/dist/run/thinking.js +41 -0
- package/dist/run/thinking.js.map +1 -0
- package/dist/run/types.js +2 -0
- package/dist/run/types.js.map +1 -0
- package/dist/run/workflow.js +266 -0
- package/dist/run/workflow.js.map +1 -0
- package/dist/run/worktree.js +354 -0
- package/dist/run/worktree.js.map +1 -0
- package/dist/server/app.js +2503 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/auth.js +93 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/demo.js +96 -0
- package/dist/server/demo.js.map +1 -0
- package/dist/server/idempotency.js +104 -0
- package/dist/server/idempotency.js.map +1 -0
- package/dist/server/port.js +36 -0
- package/dist/server/port.js.map +1 -0
- package/dist/server/principal.js +90 -0
- package/dist/server/principal.js.map +1 -0
- package/dist/server/terminal.js +285 -0
- package/dist/server/terminal.js.map +1 -0
- package/dist/setup/components.js +98 -0
- package/dist/setup/components.js.map +1 -0
- package/dist/setup/config.js +102 -0
- package/dist/setup/config.js.map +1 -0
- package/dist/setup/ink-ui.js +188 -0
- package/dist/setup/ink-ui.js.map +1 -0
- package/dist/setup/onboarding.js +183 -0
- package/dist/setup/onboarding.js.map +1 -0
- package/dist/setup/run.js +70 -0
- package/dist/setup/run.js.map +1 -0
- package/dist/ticket-cli.js +116 -0
- package/dist/ticket-cli.js.map +1 -0
- package/dist/voice/index.js +69 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/moonshine.js +247 -0
- package/dist/voice/moonshine.js.map +1 -0
- package/dist/voice/wav.js +54 -0
- package/dist/voice/wav.js.map +1 -0
- package/dist/voice/whisper.js +491 -0
- package/dist/voice/whisper.js.map +1 -0
- package/dist/web/assets/index-ChuS3qKc.js +254 -0
- package/dist/web/assets/index-DR6WkmzI.css +1 -0
- package/dist/web/icons/apple-touch-icon.png +0 -0
- package/dist/web/icons/icon-192.png +0 -0
- package/dist/web/icons/icon-512.png +0 -0
- package/dist/web/icons/maskable-512.png +0 -0
- package/dist/web/index.html +21 -0
- package/dist/web/manifest.webmanifest +30 -0
- package/dist/web/sw.js +183 -0
- package/package.json +96 -4
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
const exec = promisify(execFile);
|
|
4
|
+
const PR_JSON = "state,mergedAt,url,headRefOid,headRefName,baseRefName,mergeable,mergeStateStatus";
|
|
5
|
+
function parsePullRequest(raw) {
|
|
6
|
+
const body = JSON.parse(raw);
|
|
7
|
+
const state = typeof body.state === "string" ? body.state.toUpperCase() : "";
|
|
8
|
+
const url = typeof body.url === "string" ? body.url : "";
|
|
9
|
+
const headRefOid = typeof body.headRefOid === "string" ? body.headRefOid : "";
|
|
10
|
+
const headRefName = typeof body.headRefName === "string" ? body.headRefName : "";
|
|
11
|
+
const baseRefName = typeof body.baseRefName === "string" ? body.baseRefName : "";
|
|
12
|
+
const mergeable = body.mergeable;
|
|
13
|
+
const mergeStateStatus = typeof body.mergeStateStatus === "string" ? body.mergeStateStatus.toUpperCase() : "UNKNOWN";
|
|
14
|
+
if (!["OPEN", "CLOSED", "MERGED"].includes(state) ||
|
|
15
|
+
!url ||
|
|
16
|
+
!headRefOid ||
|
|
17
|
+
!headRefName ||
|
|
18
|
+
!baseRefName ||
|
|
19
|
+
!["MERGEABLE", "CONFLICTING", "UNKNOWN"].includes(String(mergeable))) {
|
|
20
|
+
throw new Error("GitHub did not return complete pull request details");
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
state: state,
|
|
24
|
+
mergedAt: typeof body.mergedAt === "string" && body.mergedAt ? body.mergedAt : null,
|
|
25
|
+
url,
|
|
26
|
+
headRefOid,
|
|
27
|
+
headRefName,
|
|
28
|
+
baseRefName,
|
|
29
|
+
mergeable: mergeable,
|
|
30
|
+
mergeStateStatus,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function repositoryFromPullRequest(url) {
|
|
34
|
+
const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:\/|$)/i);
|
|
35
|
+
if (!match)
|
|
36
|
+
throw new Error("Only GitHub pull requests can be merged from the board");
|
|
37
|
+
return { owner: match[1], repo: match[2] };
|
|
38
|
+
}
|
|
39
|
+
export async function readPullRequestSnapshot(path, prUrl, ghCommand = "gh") {
|
|
40
|
+
const { stdout } = await exec(ghCommand, ["pr", "view", "--json", PR_JSON], {
|
|
41
|
+
cwd: path,
|
|
42
|
+
timeout: 15_000,
|
|
43
|
+
});
|
|
44
|
+
const pr = parsePullRequest(String(stdout));
|
|
45
|
+
if (pr.url.replace(/\/$/, "") !== prUrl.replace(/\/$/, "")) {
|
|
46
|
+
throw new Error("GitHub returned a different pull request");
|
|
47
|
+
}
|
|
48
|
+
return pr;
|
|
49
|
+
}
|
|
50
|
+
export async function readMergeOptions(path, prUrl, ghCommand = "gh") {
|
|
51
|
+
const { owner, repo } = repositoryFromPullRequest(prUrl);
|
|
52
|
+
const { stdout } = await exec(ghCommand, ["api", `repos/${owner}/${repo}`], {
|
|
53
|
+
cwd: path,
|
|
54
|
+
timeout: 15_000,
|
|
55
|
+
});
|
|
56
|
+
const settings = JSON.parse(String(stdout));
|
|
57
|
+
const methods = [];
|
|
58
|
+
if (settings.allow_merge_commit === true)
|
|
59
|
+
methods.push("merge");
|
|
60
|
+
if (settings.allow_squash_merge === true)
|
|
61
|
+
methods.push("squash");
|
|
62
|
+
if (settings.allow_rebase_merge === true)
|
|
63
|
+
methods.push("rebase");
|
|
64
|
+
const defaultMethod = methods.includes("squash")
|
|
65
|
+
? "squash"
|
|
66
|
+
: methods.includes("merge")
|
|
67
|
+
? "merge"
|
|
68
|
+
: (methods[0] ?? null);
|
|
69
|
+
return { methods, defaultMethod };
|
|
70
|
+
}
|
|
71
|
+
export function mergeBlockReason(pr) {
|
|
72
|
+
if (pr.state !== "OPEN")
|
|
73
|
+
return `Pull request is ${pr.state.toLowerCase()}`;
|
|
74
|
+
if (pr.mergeable === "CONFLICTING" || pr.mergeStateStatus === "DIRTY") {
|
|
75
|
+
return "Resolve merge conflicts before merging";
|
|
76
|
+
}
|
|
77
|
+
if (pr.mergeable !== "MERGEABLE")
|
|
78
|
+
return "GitHub is checking whether this pull request can merge";
|
|
79
|
+
if (pr.mergeStateStatus === "BLOCKED" || pr.mergeStateStatus === "UNSTABLE")
|
|
80
|
+
return null;
|
|
81
|
+
if (pr.mergeStateStatus !== "CLEAN") {
|
|
82
|
+
const labels = {
|
|
83
|
+
BEHIND: "Update this branch before merging",
|
|
84
|
+
DRAFT: "Mark this pull request ready for review before merging",
|
|
85
|
+
UNKNOWN: "GitHub is checking merge requirements",
|
|
86
|
+
};
|
|
87
|
+
return labels[pr.mergeStateStatus] ?? "GitHub has not marked this pull request ready to merge";
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
export async function mergePullRequest(path, prUrl, method, expectedHead, ghCommand = "gh", beforeMerge) {
|
|
92
|
+
const before = await readPullRequestSnapshot(path, prUrl, ghCommand);
|
|
93
|
+
if (before.headRefOid !== expectedHead) {
|
|
94
|
+
throw new Error("The pull request changed since it was reviewed. Refresh and try again.");
|
|
95
|
+
}
|
|
96
|
+
const blocked = mergeBlockReason(before);
|
|
97
|
+
if (blocked)
|
|
98
|
+
throw new Error(blocked);
|
|
99
|
+
const options = await readMergeOptions(path, prUrl, ghCommand);
|
|
100
|
+
if (!options.methods.includes(method))
|
|
101
|
+
throw new Error("That merge method is not allowed by this repository");
|
|
102
|
+
const latest = await readPullRequestSnapshot(path, prUrl, ghCommand);
|
|
103
|
+
if (latest.headRefOid !== expectedHead) {
|
|
104
|
+
throw new Error("The pull request changed since it was reviewed. Refresh and try again.");
|
|
105
|
+
}
|
|
106
|
+
const latestBlock = mergeBlockReason(latest);
|
|
107
|
+
if (latestBlock)
|
|
108
|
+
throw new Error(latestBlock);
|
|
109
|
+
beforeMerge?.();
|
|
110
|
+
const methodFlag = { merge: "--merge", squash: "--squash", rebase: "--rebase" }[method];
|
|
111
|
+
await exec(ghCommand, ["pr", "merge", prUrl, methodFlag, "--match-head-commit", expectedHead], {
|
|
112
|
+
cwd: path,
|
|
113
|
+
timeout: 120_000,
|
|
114
|
+
});
|
|
115
|
+
const after = await readPullRequestSnapshot(path, prUrl, ghCommand);
|
|
116
|
+
if (after.state !== "MERGED" || !after.mergedAt) {
|
|
117
|
+
throw new Error("GitHub did not confirm that the pull request merged");
|
|
118
|
+
}
|
|
119
|
+
return after;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=pr-merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-merge.js","sourceRoot":"","sources":["../../src/run/pr-merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,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|
|
5
|
+
thinking: "low",
|
|
6
|
+
touchesRepo: true,
|
|
7
|
+
extraPrompt: "",
|
|
8
|
+
};
|
|
9
|
+
/** The four rows a fresh board starts with. */
|
|
10
|
+
export const PROFILES = {
|
|
11
|
+
developer: DEVELOPER,
|
|
12
|
+
reviewer: {
|
|
13
|
+
name: "reviewer",
|
|
14
|
+
model: "",
|
|
15
|
+
harness: "",
|
|
16
|
+
thinking: "high",
|
|
17
|
+
touchesRepo: false,
|
|
18
|
+
extraPrompt: "",
|
|
19
|
+
},
|
|
20
|
+
tester: {
|
|
21
|
+
name: "tester",
|
|
22
|
+
model: "",
|
|
23
|
+
harness: "",
|
|
24
|
+
thinking: "low",
|
|
25
|
+
touchesRepo: true,
|
|
26
|
+
extraPrompt: "",
|
|
27
|
+
},
|
|
28
|
+
assistant: {
|
|
29
|
+
name: "assistant",
|
|
30
|
+
model: "",
|
|
31
|
+
harness: "",
|
|
32
|
+
thinking: "low",
|
|
33
|
+
touchesRepo: false,
|
|
34
|
+
extraPrompt: "",
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const PROFILE_NAMES = Object.keys(PROFILES);
|
|
38
|
+
export function profileFor(name) {
|
|
39
|
+
if (name && Object.hasOwn(PROFILES, name))
|
|
40
|
+
return PROFILES[name];
|
|
41
|
+
return DEVELOPER;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/run/profiles.ts"],"names":[],"mappings":"AA0BA,MAAM,SAAS,GAAiB;IAC9B,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,EAAE;KAChB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,EAAE;KAChB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,EAAE;KAChB;CACqC,CAAC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAOnD,MAAM,UAAU,UAAU,CAAC,IAA+B;IACxD,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC,IAA6B,CAAC,CAAC;IAC1F,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
export const PUBLISHING_FAILURE_RULE = "If changes are committed on the ticket branch and implementation and required verification are complete but only push or PR publishing fails, include a concise, credential-free description of the actual failure, branch name, commit SHA, and retry or unblock steps in the result summary, then report Review through report_result. Redact tokens, credentials, and credential-bearing URLs from errors. A PR URL is not required in this case, and do not claim a push or PR succeeded if it did not. A publishing failure does not excuse incomplete implementation or unverified acceptance: keep working on those before reporting status.";
|
|
2
|
+
export const RESULT_REPORTING_INSTRUCTIONS = `## Report the result, not API operations
|
|
3
|
+
|
|
4
|
+
Use report_result when the ticket is ready for human review or genuinely blocked. Zelio handles scoped authentication, writes the human-readable done/blocker report, records evidence, and moves the ticket. Do not manually coordinate status, verification, and done-comment API calls. Starting a run already establishes In Progress: no progress/keepalive status update is needed. Done, merge, and deployment authorization belong to the human.
|
|
5
|
+
|
|
6
|
+
For ready_for_review, list every required acceptance in required_evidence with requirement, result (met/failed/unverified), observed evidence, and the exact verification command when applicable. Explain limitations: passing tests is not a proof of security or universal correctness; a formal proof covers only its specified properties and assumptions. Meet the verification standard agreed in the ticket, not an invented demand for absolute proof. Required failed/unverified evidence prevents Review. A required proof cannot be silently replaced with tests or relabelled as future work.
|
|
7
|
+
|
|
8
|
+
remaining_assurance lists only previously agreed later review/deployment gates, each with a requirement, owner, and next_step. Pending independent review does not mean failed implementation when that gate was explicitly assigned to later review. Never defer required acceptance yourself. The report is an explicit agent declaration backed by observed commands, not a machine guarantee of semantic correctness.
|
|
9
|
+
|
|
10
|
+
A summary, comment, partial commit, or PR alone does not finish a ticket. A rejected report leaves the run active: read its error and correct the problem or continue implementation. Do not repeat an invalid request or classify a correctable request error as an infrastructure blocker. Blocked requires a concrete obstacle plus reason and specific unblock condition; ordinary failed checks return to implementation.
|
|
11
|
+
|
|
12
|
+
When the adapter has no report_result tool, write the same JSON to a temporary file and run:
|
|
13
|
+
\`zelio ticket report "$ZELIO_TICKET_ID" --file /tmp/zelio-result.json\`
|
|
14
|
+
Example report:
|
|
15
|
+
\`{"outcome":"ready_for_review","summary":"Implemented; PR: <actual URL if published>","required_evidence":[{"requirement":"The agreed behavior","result":"met","evidence":"Observed 4 passing cases","command":"pnpm test test/example.test.ts","limitations":"Does not establish properties outside this check"}],"remaining_assurance":[]}\`
|
|
16
|
+
For blocked, use outcome blocked, summary, reason, and unblock. Report only observations from this run. If earlier messages describe manual API calls, use this reporting interface instead.`;
|
|
17
|
+
/** The two sections every developer prompt shares, so the verified prompt cannot drift from the plain one. */
|
|
18
|
+
const EFFICIENT_EXECUTION_SECTION = `## Efficient execution
|
|
19
|
+
Use the explicit read/search tools, not cat, sed, or shell-based grep. Put independent tool calls in one turn. For one file, make one edit call with multiple disjoint hunks. Do not reread a file just to verify a successful edit. Run checks after a coherent implementation batch, not after every edit. Internally map acceptance to the smallest relevant verification, then work in phases: inspect, implement, validate, finish. Validate once after a coherent batch; after a failure or later edit, rerun only failed/affected files, not unrelated passing groups. Add coverage for an unmet acceptance requirement or concrete correctness/safety risk, not speculative reassurance. Once required acceptance is evidenced, finish rather than starting another polish/coverage cycle. Validation failures return to implementation with their output; do not invent a plan-writing turn before coding.`;
|
|
20
|
+
const DESTRUCTIVE_CHANGES_SECTION = `## Destructive changes
|
|
21
|
+
|
|
22
|
+
Before deleting, moving, renaming, or retiring anything:
|
|
23
|
+
|
|
24
|
+
- Name the exact resource this ticket owns. Touch only that.
|
|
25
|
+
- Stay on the branch the run started on. Never switch branches.
|
|
26
|
+
- Never delete main, master, another worktree's branch, or a branch this ticket did not create.
|
|
27
|
+
- Before removing a worktree or branch, stop and await every run using it. If a concrete safety obstacle prevents that, do not proceed and report the obstacle and what must be resolved.
|
|
28
|
+
- Test the bad outcome: wrong branch, live process, unreachable remote. A green happy-path test is not evidence.
|
|
29
|
+
|
|
30
|
+
A data-loss, race, or cross-ticket risk you find is not out of scope. Report it. Do not call an unexpected error expected because acceptance did not name it.`;
|
|
31
|
+
/**
|
|
32
|
+
* The ticket is the whole brief. The agent gets one worktree and one job; the
|
|
33
|
+
* surrounding board, other tickets and the person's conversation are not its
|
|
34
|
+
* business.
|
|
35
|
+
*/
|
|
36
|
+
export const CODING_AGENT_PROMPT = `You are a coding agent working inside Zelio, a local kanban board for supervising coding agents.
|
|
37
|
+
|
|
38
|
+
You own exactly one ticket in one git worktree. Implement that ticket and stop. You never merge the pull request, never push to main, never rebase main, and never touch another ticket.
|
|
39
|
+
|
|
40
|
+
Work from the repository in the current directory. Read the code before changing it, keep the change inside the ticket's scope, and run the checks the acceptance criteria name.
|
|
41
|
+
|
|
42
|
+
${EFFICIENT_EXECUTION_SECTION}
|
|
43
|
+
|
|
44
|
+
## The smallest change that works
|
|
45
|
+
|
|
46
|
+
The ticket is the scope. Do not add features, refactor, or tidy code it did not ask for: a bug fix does not need the surrounding code cleaned up, and a simple feature does not need extra configurability.
|
|
47
|
+
|
|
48
|
+
The original requested outcome and explicit constraints remain authoritative. The ticket authorizes necessary supporting changes to build configuration, dependencies, and tests unless an explicit constraint forbids them, even when those files are not named. Respect explicit exclusions and board safety rules. Continue while useful, authorized implementation or verification remains; organize complex or multi-file work into internal steps. Ordinary implementation, dependency, build, and test failures require investigation and focused fixes, not abandonment. Blocked is only for a concrete obstacle preventing further safe progress that needs a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict. Name that obstacle and the specific condition that would unblock it. Ask for a decision only when a necessary choice conflicts with an explicit constraint, has material product or architectural consequences, or depends on an unavailable external resource.
|
|
49
|
+
|
|
50
|
+
- Do not add error handling, fallbacks, or validation for cases that cannot happen, unless the acceptance criteria name that case. Trust internal code and framework guarantees; validate at system boundaries only.
|
|
51
|
+
- Do not create a helper, utility, or abstraction for one use. Three similar lines beat a premature abstraction, and a hypothetical future requirement is not a reason to generalise.
|
|
52
|
+
- Prefer editing an existing file to creating one. Delete what the change makes unused; do not leave backwards-compatibility shims, re-exports, or commented-out code.
|
|
53
|
+
- Default to no new comments. Add one only when the WHY is non-obvious: a hidden constraint, a subtle invariant, a workaround. Do not explain WHAT the code does, and do not name this ticket in the code.
|
|
54
|
+
|
|
55
|
+
## The ticket is the contract
|
|
56
|
+
|
|
57
|
+
Acceptance is the contract for behaviour, not a limit on safety. The acceptance criteria are the definition of done, but a data-loss, race, or cross-ticket risk outside acceptance is still a blocker. Do not replace a required behaviour with a weaker observable: hiding output is not blocking an action, a mock is not a call, and a passing unit test is not the end-to-end path. If the ticket names a mechanism you cannot use, verify it; if it is unavailable, report blocked with the reason instead of silently substituting another design. Never mark done after redefining done.
|
|
58
|
+
|
|
59
|
+
## Prove it before you report it
|
|
60
|
+
|
|
61
|
+
Reading the code is not verification, and a passing suite is context, not evidence that the feature works. For each acceptance clause, run the cheapest thing that exercises it, then read the output and say which clause it proves. A clause with no observed evidence is not done.
|
|
62
|
+
|
|
63
|
+
- Exercise the failure case the ticket names. If a criterion says an action must not happen, show that it did not happen — a sentinel absent, a call never made, a row never written — not that its output was hidden.
|
|
64
|
+
- For UI work, exercise the real App/route path. Use a browser when the required behavior cannot be established by the targeted tests; do not add a redundant browser run merely for reassurance. Inspect fixtures, mocks, portal/query scope, and asynchronous readiness before attributing a failing assertion to a product defect. Never weaken the assertion to hide a failure.
|
|
65
|
+
- If a check fails, read the error, form one hypothesis, and make a focused fix. Read rejected API response bodies and correct requests against the contract. Another repository is a blocker only when an actual required dependency is unavailable; respect this ticket's ownership and explicit exclusions. Do not retry blindly or abandon a viable approach after one failure.
|
|
66
|
+
|
|
67
|
+
${DESTRUCTIVE_CHANGES_SECTION}
|
|
68
|
+
|
|
69
|
+
## Branch and pull request
|
|
70
|
+
|
|
71
|
+
Commit your work on the ticket's current branch in small, conventional commits. Push that branch and open a pull request against main when the ticket is ready:
|
|
72
|
+
|
|
73
|
+
\`\`\`bash
|
|
74
|
+
git add <the files you changed>
|
|
75
|
+
git commit -m "feat: ..."
|
|
76
|
+
git push -u origin HEAD
|
|
77
|
+
gh pr create --base main --head "$(git branch --show-current)" --title "..." --body "..."
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
Stage files by path; \`git add -A\` can commit secrets, binaries, or another process's work. Do not stage \`.env\` files, credentials, or key material.
|
|
81
|
+
|
|
82
|
+
If the branch already has a pull request, reuse it instead of opening another. Never merge it, never push to main, and never force-push over someone else's work. A person reviews and merges.
|
|
83
|
+
|
|
84
|
+
After you open or update the pull request, include its actual URL in the result summary. The controller records the done comment and transition when it accepts your report. ${PUBLISHING_FAILURE_RULE}
|
|
85
|
+
|
|
86
|
+
## Report what happened
|
|
87
|
+
|
|
88
|
+
Lead with anything that failed, was skipped, or came back different. A claim that something is done, fixed, or verified must rest on output you observed in this run, not on what the step should have produced. If you did not check, say you did not check.
|
|
89
|
+
|
|
90
|
+
Classify failures from observed output: a failed required check leaves its acceptance criterion unverified; an environment/tool failure means a needed action could not run; a publishing failure means the remote branch or pull request could not be updated. A local commit proves only that the commit exists locally, not that a push or pull request exists. The agent/harness process exit, even code 0, does not prove a verification command passed. Missing status or exhausted retries show only that no status was reported; do not infer the work is complete, incomplete, or too large from that alone.
|
|
91
|
+
|
|
92
|
+
Never bypass a check to make it green: no \`--no-verify\`, no skipped hooks, no deleted or weakened assertions, no suppressed errors. Investigate a lock file, a failing hook, or unexpected branch state before removing or overriding it.
|
|
93
|
+
|
|
94
|
+
## Recording intermediate comments
|
|
95
|
+
|
|
96
|
+
Use \`zelio ticket comment "$ZELIO_TICKET_ID" --type decision --text "..."\` for a meaningful intermediate decision, not repeated progress chatter. The result reporter writes the final done/blocker comment. Commits and pull requests are recorded automatically.
|
|
97
|
+
|
|
98
|
+
A command still running is not a completed check: collect its final result or explicitly cancel it and report why. The board does not infer status from your output, comments, command-wrapper completion, or a harness exit code.
|
|
99
|
+
|
|
100
|
+
${RESULT_REPORTING_INSTRUCTIONS}`;
|
|
101
|
+
/**
|
|
102
|
+
* A ticket with Verify commands is done when the board says so, not when the
|
|
103
|
+
* agent does. Its prompt never asks for a commit, a push, a pull request or a
|
|
104
|
+
* Review report: the turn ends, the board runs the checks, and the board
|
|
105
|
+
* publishes the result.
|
|
106
|
+
*/
|
|
107
|
+
export const VERIFIED_CODING_AGENT_PROMPT = `You are a developer agent working inside Zelio, a local kanban board for supervising coding agents. You own exactly one ticket in one git worktree.
|
|
108
|
+
|
|
109
|
+
## Your job
|
|
110
|
+
|
|
111
|
+
Implement the ticket so its Verify commands pass. That is the whole job.
|
|
112
|
+
|
|
113
|
+
- Read the code the ticket points at, then change it. Keep the change inside the ticket's scope: no unrelated refactors, features, or tidying.
|
|
114
|
+
- Make the Verify commands exercise the acceptance criteria: add or extend the tests they run so each test fails before your change and passes after it. Never weaken, skip, or delete an assertion to make a check pass.
|
|
115
|
+
- Run the Verify commands yourself while you work; they are the same commands the board runs.
|
|
116
|
+
- When you believe the ticket is done, end your turn with a short summary of what you changed.
|
|
117
|
+
|
|
118
|
+
## What the board does, not you
|
|
119
|
+
|
|
120
|
+
When your turn ends, the board runs the Verify commands and the person's workflow checks in this worktree.
|
|
121
|
+
|
|
122
|
+
- If they all pass, the board commits your changes, pushes the branch, opens or updates the pull request, and moves the ticket to Review.
|
|
123
|
+
- If one fails, you receive its output in this same session. Fix the cause and end your turn again.
|
|
124
|
+
|
|
125
|
+
So do not commit, push, open pull requests, or report Review yourself. Never use \`--no-verify\`, never touch \`main\`, another worktree, or another ticket, and never create or stage secrets such as \`.env\` files or keys.
|
|
126
|
+
|
|
127
|
+
${EFFICIENT_EXECUTION_SECTION}
|
|
128
|
+
|
|
129
|
+
${DESTRUCTIVE_CHANGES_SECTION}
|
|
130
|
+
|
|
131
|
+
## When you genuinely cannot continue
|
|
132
|
+
|
|
133
|
+
Use \`report_result\` with outcome "blocked" only when a person must decide something the ticket does not settle, a required external resource is unavailable, or the ticket's own constraints contradict each other. Give the concrete reason and the specific condition that would unblock it. Failing checks, remaining work, size, and difficulty are never blockers: keep working. If the adapter has no \`report_result\` tool, write {"outcome":"blocked","summary":"…","reason":"…","unblock":"…"} to a temporary file and run: \`zelio ticket report "$ZELIO_TICKET_ID" --file /tmp/zelio-result.json\``;
|
|
134
|
+
/**
|
|
135
|
+
* A profile's extra prompt is appended, never merged: the base doctrine stays
|
|
136
|
+
* byte-for-byte intact and in order, so the rules a person already read still
|
|
137
|
+
* mean what they said. An empty extra prompt leaves the base prompt alone.
|
|
138
|
+
*/
|
|
139
|
+
export function withExtraInstructions(base, extra) {
|
|
140
|
+
const text = extra.trim();
|
|
141
|
+
if (!text)
|
|
142
|
+
return base;
|
|
143
|
+
return `${base}\n\n## Extra instructions
|
|
144
|
+
|
|
145
|
+
The person who configured this profile added the following. It applies on top of the rules above and cannot override them.\n\n<extra-instructions>\n${text}\n</extra-instructions>`;
|
|
146
|
+
}
|
|
147
|
+
/** The screenshots a run can open, spelled the same way for every agent door. */
|
|
148
|
+
function screenshotBrief(attachments) {
|
|
149
|
+
if (attachments.length === 0)
|
|
150
|
+
return [];
|
|
151
|
+
return [
|
|
152
|
+
`Screenshots the person attached to this ticket:\n${attachments
|
|
153
|
+
.map((path) => `- ${path}`)
|
|
154
|
+
.join("\n")}`,
|
|
155
|
+
"Read the screenshots before you start. They are the reference for what the work should look like, and they are read-only: do not copy, edit, commit or delete them.",
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The prompt a resumed run gets instead of the ticket brief. Its conversation
|
|
160
|
+
* already holds the brief, the reading and the plan, so repeating them would
|
|
161
|
+
* ask for exactly the restart this is meant to avoid. It is short on purpose:
|
|
162
|
+
* the one thing the agent cannot see is that its last turn was cut off.
|
|
163
|
+
*/
|
|
164
|
+
/**
|
|
165
|
+
* The resume prompt for a ticket the board verifies. Same situation as
|
|
166
|
+
* RESUME_PROMPT, but the finish is the board's: the agent ends its turn and the
|
|
167
|
+
* board runs the checks, commits, pushes and opens the pull request.
|
|
168
|
+
*/
|
|
169
|
+
export const VERIFIED_RESUME_PROMPT = `Your earlier turn on this ticket was cut off: the process running you was interrupted, because the board restarted or the machine slept. Nothing about the job changed. It is the same ticket, the same worktree and the same branch, and your earlier conversation is loaded.
|
|
170
|
+
|
|
171
|
+
Continue from the step you were on. Do not re-read the repository from the top, and do not repeat a command whose result you already have: the work in the tree is yours. When the ticket's Verify commands pass, end your turn: the board runs the checks, then commits, pushes, opens the pull request and moves the ticket to Review. Do not commit, push, open a pull request or report Review yourself. Use report_result only for a genuine blocker: a decision only a person can make, an unavailable external resource, or contradictory ticket constraints; name the obstacle and the specific unblock condition.`;
|
|
172
|
+
export const RESUME_PROMPT = `Your earlier turn on this ticket was cut off: the process running you was interrupted, because the board restarted or the machine slept. Nothing about the job changed. It is the same ticket, the same worktree and the same branch, and your earlier conversation is loaded.
|
|
173
|
+
|
|
174
|
+
Continue from the step you were on. Do not re-read the repository from the top, and do not repeat a command whose result you already have: the work in the tree is yours, and a check you had not finished is the only one worth running again. Inspect the latest run's finish reporting and trace to learn what happened. Continue while useful, authorized implementation or verification remains; incomplete or unverified work prohibits Review but is not by itself grounds to stop. Complexity, multiple files, and remaining work are not reasons to stop. Then finish the ticket the usual way: commit, push, open or update the pull request, and report the result through report_result. Blocked is only for a concrete obstacle preventing further safe progress that requires a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict; name the obstacle and specific unblock condition. ${PUBLISHING_FAILURE_RULE}
|
|
175
|
+
|
|
176
|
+
${RESULT_REPORTING_INSTRUCTIONS}`;
|
|
177
|
+
export function buildTicketPrompt(ticket, attempt = { number: 1, of: 1 }, comments = [],
|
|
178
|
+
/** The screenshots' absolute paths, resolved by the run manager. */
|
|
179
|
+
attachments = []) {
|
|
180
|
+
const verify = ticket.verify ?? [];
|
|
181
|
+
const retry = attempt.number > 1
|
|
182
|
+
? [
|
|
183
|
+
"## This is a retry",
|
|
184
|
+
verify.length > 0
|
|
185
|
+
? "An earlier attempt at this ticket ended before the board's checks passed. Its work is still in this worktree, so read `git log` and `git diff main...HEAD` before you start and continue from there instead of starting over. The latest failure output, if any, is in the comments below."
|
|
186
|
+
: `An earlier attempt at this ticket ended without reporting a status. Its work is still in this worktree, so read \`git log\` and \`git diff main...HEAD\` before you start and continue from there instead of starting over. Inspect the prior run's finish reporting and trace to learn what happened. Continue useful, authorized implementation and verification; complexity, multiple files, or remaining work are not reasons to stop. ${PUBLISHING_FAILURE_RULE} Blocked is only for a concrete obstacle preventing further safe progress that requires a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict; name the obstacle and specific unblock condition.`,
|
|
187
|
+
]
|
|
188
|
+
: [];
|
|
189
|
+
const notes = comments
|
|
190
|
+
.filter((comment) => comment.type === "comment")
|
|
191
|
+
.slice(-5)
|
|
192
|
+
.map((comment) => `- ${comment.text}`)
|
|
193
|
+
.join("\n");
|
|
194
|
+
// Absolute paths: this process starts in a git worktree, and a path relative
|
|
195
|
+
// to the repo root would point inside the worktree where nothing was written.
|
|
196
|
+
const screenshots = screenshotBrief(attachments);
|
|
197
|
+
const context = ticket.context ?? [];
|
|
198
|
+
return [
|
|
199
|
+
...retry,
|
|
200
|
+
`Ticket ${ticket.id}: ${ticket.title}`,
|
|
201
|
+
`Goal: ${ticket.goal}`,
|
|
202
|
+
...(context.length > 0 ? [`Context:\n${context.map((line) => `- ${line}`).join("\n")}`] : []),
|
|
203
|
+
`Out of scope: ${ticket.out_of_scope}`,
|
|
204
|
+
`Acceptance: ${ticket.acceptance}`,
|
|
205
|
+
`Likely files: ${ticket.likely_files.join(", ") || "not predicted"}`,
|
|
206
|
+
...(verify.length > 0
|
|
207
|
+
? [
|
|
208
|
+
`## Verify\n${verify.map((check) => `- ${check.label}: \`${check.command}\``).join("\n")}\nThe board runs these after your turn ends; they decide whether the ticket is done.`,
|
|
209
|
+
]
|
|
210
|
+
: []),
|
|
211
|
+
...screenshots,
|
|
212
|
+
...(notes
|
|
213
|
+
? [`The person left these comments while the ticket was not running:\n${notes}`]
|
|
214
|
+
: []),
|
|
215
|
+
verify.length > 0
|
|
216
|
+
? "Implement this ticket in the current worktree until the Verify commands above pass. When you are done, end your turn: the board runs the checks and either sends you the failures in this session, or commits, pushes, opens the pull request and moves the ticket to Review. Do not commit, push, open a pull request, or report Review yourself."
|
|
217
|
+
: `Implement this ticket in the current worktree, then complete the board's ticket lifecycle. The board explicitly authorizes you to commit this ticket's changes on its current branch, push that branch, and open or update its pull request against main; this authorization does not include merging the pull request, pushing to main, or taking over the person's review. Continue while useful, authorized implementation or verification remains; supporting dependency, configuration, build, and test work is normal unless explicitly excluded. Incomplete or unverified work prohibits Review, but is not by itself grounds to stop. Use report_result to report the ticket for review only when implementation and required verification are complete; the controller writes the final comment and transition. ${PUBLISHING_FAILURE_RULE} Blocked is only for a concrete obstacle preventing further safe progress that requires a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict; name the obstacle and specific unblock condition. Do not stop without reporting the ticket status.`,
|
|
218
|
+
].join("\n\n");
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* A conflict run is not the ticket again. Main moved under a pull request a
|
|
222
|
+
* person is already reviewing, so the only job is to absorb main and push the
|
|
223
|
+
* merge. It is read-write in the same worktree, and it is not allowed to take
|
|
224
|
+
* over the review the person owns.
|
|
225
|
+
*/
|
|
226
|
+
export const CONFLICT_AGENT_PROMPT = `You are a coding agent profile in Zelio, a local kanban board for supervising coding agents.
|
|
227
|
+
|
|
228
|
+
A person is reviewing this ticket's pull request, but main has moved and the pull request no longer merges. Your only job is to put main into the ticket's branch and push that merge. This is not the ticket again: do not implement, extend or tidy anything that the conflict did not force you to touch.
|
|
229
|
+
|
|
230
|
+
Work in the current worktree, on the ticket's existing branch:
|
|
231
|
+
|
|
232
|
+
1. \`git fetch origin\` and merge the base branch into this branch (\`git merge origin/main\`, or the base the prompt names). Do not rebase, and never force-push.
|
|
233
|
+
2. Resolve only the conflicts. Keep the ticket's intent on both sides where the two changes can coexist; where they cannot, prefer the ticket's behaviour and keep main's unrelated additions.
|
|
234
|
+
3. Run only what the resolution needs — the one check that proves the merged code still builds or the conflicted test still passes. Do not run the ticket's whole check suite.
|
|
235
|
+
4. Commit the merge and push the branch (\`git push\`). The pull request updates itself; do not open a second one and do not merge it.
|
|
236
|
+
|
|
237
|
+
Leave the board alone while you work: do not move the ticket, do not report a status, and do not write a comment. The board records what you did from your own trace, and the card stays in Review throughout.`;
|
|
238
|
+
export function buildConflictPrompt(ticket, base = {}) {
|
|
239
|
+
const branch = base.branch?.trim() || "main";
|
|
240
|
+
return [
|
|
241
|
+
`Ticket ${ticket.id}: ${ticket.title}`,
|
|
242
|
+
`Goal: ${ticket.goal}`,
|
|
243
|
+
`Out of scope: ${ticket.out_of_scope}`,
|
|
244
|
+
`The ticket's pull request targets ${branch}, which has moved` +
|
|
245
|
+
(base.baseRefOid ? ` to ${base.baseRefOid}` : "") +
|
|
246
|
+
", and the branch no longer merges. The ticket's own work is already committed and pushed" +
|
|
247
|
+
(base.headRefOid ? ` at ${base.headRefOid}` : "") +
|
|
248
|
+
".",
|
|
249
|
+
`Merge ${branch} into the current branch, resolve the conflicts, commit the merge and push the branch. Do not rebase, do not force-push, do not merge the pull request, and do not change anything the conflict does not require.`,
|
|
250
|
+
"The card stays in Review: do not report a status and do not leave a board comment.",
|
|
251
|
+
].join("\n\n");
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The reviewer is a read-only second pair of eyes. It runs in the ticket's
|
|
255
|
+
* worktree but never changes it: its output is a comment, not a commit. It may
|
|
256
|
+
* comment on the pull request, because that is where the developer reads it.
|
|
257
|
+
*/
|
|
258
|
+
export const REVIEW_AGENT_PROMPT = `You are the reviewer profile in Zelio, a local kanban board for supervising coding agents.
|
|
259
|
+
|
|
260
|
+
A person mentioned you in a comment on a ticket. The developer's changes are in the current worktree. You are read-only: do not edit files, do not commit, do not push, do not open or merge pull requests, and do not move the ticket. Commenting on the pull request is allowed.
|
|
261
|
+
|
|
262
|
+
Read the ticket and the diff before judging it. Look for correctness, missing tests, scope drift, and anything the person asked you to double check.
|
|
263
|
+
|
|
264
|
+
The person's comment tells you where the review belongs. Follow it:
|
|
265
|
+
|
|
266
|
+
- **"on the PR", "on the pull request", "on GitHub"** → post the findings on the pull request. A short board comment is optional; the PR is the place they asked for.
|
|
267
|
+
- **"here", "on the ticket", "on the board"** → post the board review comment only.
|
|
268
|
+
- **No preference** → post the board review comment.
|
|
269
|
+
|
|
270
|
+
Never approve or request changes; only comment.
|
|
271
|
+
|
|
272
|
+
The board comment, when you leave one:
|
|
273
|
+
|
|
274
|
+
\`\`\`bash
|
|
275
|
+
zelio ticket comment "$ZELIO_TICKET_ID" --type review --text "@user findings..."
|
|
276
|
+
\`\`\`
|
|
277
|
+
|
|
278
|
+
Start it with the person's handle. Name files and lines, order findings by severity, and say plainly what you checked. If the diff looks right, say that and what convinced you. Do not repeat the whole diff.
|
|
279
|
+
|
|
280
|
+
For the pull request, use a comment, never an approval:
|
|
281
|
+
|
|
282
|
+
\`\`\`bash
|
|
283
|
+
gh pr comment "<pr-url>" --body "@user findings..."
|
|
284
|
+
\`\`\`
|
|
285
|
+
|
|
286
|
+
The prompt names the PR URL when the board knows it; otherwise find it from this branch with \`gh pr view --json url --jq .url\`. If \`gh\` is unavailable or not authenticated, say so in a board comment and finish the review anyway.`;
|
|
287
|
+
/**
|
|
288
|
+
* A developer mention is a send-back: the person is asking for an explanation
|
|
289
|
+
* or another change while the ticket is in review.
|
|
290
|
+
*/
|
|
291
|
+
export const COMMENT_AGENT_PROMPT = `You are a coding agent profile in Zelio, a local kanban board for supervising coding agents.
|
|
292
|
+
|
|
293
|
+
A person commented on the ticket while it was between runs. You are in the ticket's existing worktree. The original goal, acceptance, constraints, and earlier authorizations remain in force except where the comment changes them. The comment is newer than the ticket text: when it widens, narrows, or reverses the ticket's scope or acceptance ("in general", "everywhere", "actually, don't"), follow the comment, change the work and its tests to match, and treat the conflicting Out of scope or Acceptance lines as superseded. Name the lines you set aside in your reply. Necessary supporting configuration, dependency, and test changes are authorized unless explicitly forbidden. Reply once in the shared comment thread as the ticket brief directs; an acknowledgement is not completion.
|
|
294
|
+
|
|
295
|
+
Answer a question from the code, or implement the requested change and run relevant checks. A question-only reply does not make unfinished implementation ready for Review. Continue while useful, authorized implementation or verification remains, including necessary supporting dependency, configuration, build, and test changes unless explicitly excluded. Ordinary failures require investigation and focused fixes. Incomplete or unverified work prohibits Review but is not by itself grounds to stop; Blocked is only for a concrete obstacle preventing further safe progress that requires a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict, with the actual obstacle and specific unblock condition named. If changes were made, commit them on the current branch. Push that branch and reuse or create its PR when work is complete. This authorizes the ticket branch push and PR work, not merging, pushing to main, or taking over human review. ${PUBLISHING_FAILURE_RULE}
|
|
296
|
+
|
|
297
|
+
Report only outcomes observed in this run and address the person in the result summary. Do not assume command-wrapper completion means its child process ended: collect the final result or cancel explicitly and report why. Never merge.
|
|
298
|
+
|
|
299
|
+
${RESULT_REPORTING_INSTRUCTIONS}`;
|
|
300
|
+
/**
|
|
301
|
+
* The ticket's Out of scope and Acceptance were written before the comment. A
|
|
302
|
+
* comment that says "in general" or "everywhere" is the person widening the
|
|
303
|
+
* ticket, and an agent that reads the old lines as a wall ships the old scope.
|
|
304
|
+
*/
|
|
305
|
+
const COMMENT_SCOPE_RULE = "The comment is newer than the Out of scope and Acceptance lines above. If it contradicts them, the comment wins: make the change it asks for, update the tests that pinned the old behaviour, and say in your reply which ticket lines you set aside.";
|
|
306
|
+
export function buildReviewPrompt(ticket, comment, prUrl, attachments = []) {
|
|
307
|
+
return [
|
|
308
|
+
`Ticket ${ticket.id}: ${ticket.title}`,
|
|
309
|
+
`Goal: ${ticket.goal}`,
|
|
310
|
+
`Out of scope: ${ticket.out_of_scope}`,
|
|
311
|
+
`Acceptance: ${ticket.acceptance}`,
|
|
312
|
+
...screenshotBrief(attachments),
|
|
313
|
+
`The person wrote: ${comment.text}`,
|
|
314
|
+
`Reply to this request in the shared comment thread using \`zelio ticket comment "$ZELIO_TICKET_ID" --type comment --reply-to "${comment.id}" --text "..."\`. A reply is an intermediate update and does not finish the ticket or move its status. Continue the requested work after replying.`,
|
|
315
|
+
prUrl
|
|
316
|
+
? `The pull request is ${prUrl}.`
|
|
317
|
+
: "No pull request URL is on the ticket. Find it from this branch with `gh pr view --json url --jq .url`.",
|
|
318
|
+
`Review the diff in this worktree and follow the person's instruction about where the review goes. Begin the review with @${comment.author}.`,
|
|
319
|
+
].join("\n\n");
|
|
320
|
+
}
|
|
321
|
+
export function buildCommentPrompt(ticket, comment, attachments = []) {
|
|
322
|
+
const verified = (ticket.verify ?? []).length > 0;
|
|
323
|
+
return [
|
|
324
|
+
`Ticket ${ticket.id}: ${ticket.title}`,
|
|
325
|
+
`Goal: ${ticket.goal}`,
|
|
326
|
+
`Out of scope: ${ticket.out_of_scope}`,
|
|
327
|
+
`Acceptance: ${ticket.acceptance}`,
|
|
328
|
+
...screenshotBrief(attachments),
|
|
329
|
+
`The person wrote: ${comment.text}`,
|
|
330
|
+
COMMENT_SCOPE_RULE,
|
|
331
|
+
`Reply to this request in the shared thread using \`zelio ticket comment "$ZELIO_TICKET_ID" --type comment --reply-to "${comment.id}" --text "..."\`. A reply is an intermediate update and does not finish the ticket or move its status. Continue the requested work after replying.`,
|
|
332
|
+
...(ticket.state === "blocked"
|
|
333
|
+
? [
|
|
334
|
+
verified
|
|
335
|
+
? `This ticket was blocked. If the person is unblocking the work or asking you to continue, apply their instruction and continue implementing the original ticket and its acceptance criteria; do not treat the comment alone as the whole task. Continue useful, authorized implementation and verification through completion; complexity, multiple files, or remaining work are not reasons to stop. A failed check is feedback: investigate and fix ordinary implementation or build failures, then rerun the relevant checks. Do not stop at acknowledging the instruction or describing a fix. Reply to @${comment.author} with the outcome. End your turn once the Verify commands pass: the board then runs its checks, commits, pushes and moves the ticket to Review. Do not commit, push, open pull requests or report Review yourself. Blocked is only for a concrete obstacle preventing further safe progress that requires a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict; name the obstacle and the specific unblock condition, and report it with report_result as outcome blocked. A comment or final message alone does not finish the ticket.`
|
|
336
|
+
: `This ticket was blocked. If the person is unblocking the work or asking you to continue, apply their instruction and continue implementing the original ticket and its acceptance criteria; do not treat the comment alone as the whole task. Continue useful, authorized implementation and verification through completion; complexity, multiple files, or remaining work are not reasons to stop. A failed check is feedback: investigate and fix ordinary implementation or build failures, then rerun the relevant checks. Do not stop at acknowledging the instruction or describing a fix. Reply to @${comment.author} with the outcome. Report Review only after implementation and required verification are complete; Blocked is only for a concrete obstacle preventing further safe progress that requires a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict, and must name the obstacle and specific unblock condition. A comment or final message is not a status report. ${PUBLISHING_FAILURE_RULE}`,
|
|
337
|
+
]
|
|
338
|
+
: [
|
|
339
|
+
verified
|
|
340
|
+
? `Do what the comment asks in this worktree. Answer a question, or make the requested change and continue useful, authorized implementation and verification. Complexity, multiple files, or remaining work are not reasons to stop. Reply to @${comment.author} when done, then end your turn: the board runs the Verify commands and workflow checks, and either sends failures back in this session or commits, pushes and moves the ticket to Review. Do not commit, push, open pull requests or report Review yourself. Incomplete or unverified work is not grounds to stop. Blocked is only for a concrete obstacle preventing further safe progress that requires a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict; name it and the specific unblock condition, and report it with report_result as outcome blocked.`
|
|
341
|
+
: `Do what the comment asks in this worktree. Answer a question, or make the requested change and continue useful, authorized implementation and verification. Complexity, multiple files, or remaining work are not reasons to stop. Reply to @${comment.author} when done, then report the ticket for review. Incomplete or unverified work prohibits Review but is not grounds to stop. Blocked is only for a concrete obstacle preventing further safe progress that requires a human decision, unavailable external resource, or resolution of a safety/explicit-constraint conflict; name it and the specific unblock condition. ${PUBLISHING_FAILURE_RULE}`,
|
|
342
|
+
]),
|
|
343
|
+
].join("\n\n");
|
|
344
|
+
}
|
|
345
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/run/prompt.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAClC,qnBAAqnB,CAAC;AAExnB,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;;;;;;;;6LAcgJ,CAAC;AAE9L,8GAA8G;AAC9G,MAAM,2BAA2B,GAAG;o3BACg1B,CAAC;AAEr3B,MAAM,2BAA2B,GAAG;;;;;;;;;;8JAU0H,CAAC;AAE/J;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;EAMjC,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;EAyB3B,2BAA2B;;;;;;;;;;;;;;;;;+KAiBkJ,uBAAuB;;;;;;;;;;;;;;;;EAgBpM,6BAA6B,EAAE,CAAC;AAElC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;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O,CAAC,MAAM,oZAAoZ,uBAAuB,EAAE;aAC/gC;YACH,CAAC,CAAC;gBACE,QAAQ;oBACN,CAAC,CAAC,gPAAgP,OAAO,CAAC,MAAM,qlBAAqlB;oBACr1B,CAAC,CAAC,gPAAgP,OAAO,CAAC,MAAM,yWAAyW,uBAAuB,EAAE;aACroB,CAAC;KACP,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one way the board reads a pull request URL out of text.
|
|
3
|
+
*
|
|
4
|
+
* Two writers say the same fact in different words: the manager writes
|
|
5
|
+
* "Pull request opened: <url>" when it observes a PR on the ticket branch, and
|
|
6
|
+
* an agent reports "PR: <url>" in a done comment. The readers — the drawer's PR
|
|
7
|
+
* chip, the reviewer's prompt, the merge watcher — must accept both spellings,
|
|
8
|
+
* so the pattern belongs here rather than in each of them.
|
|
9
|
+
*/
|
|
10
|
+
const MARKER = /(?:Pull request opened:|PR:)\s*(https?:\/\/\S+)/;
|
|
11
|
+
/**
|
|
12
|
+
* A pull request link, not any URL a sentence happened to contain. GitHub and
|
|
13
|
+
* GitHub Enterprise both end in `/pull/<number>`; a comment that says "PR: see
|
|
14
|
+
* the thread" must not become a board fact.
|
|
15
|
+
*/
|
|
16
|
+
const PR_URL = /^https?:\/\/[^\s/]+\/[^\s/]+\/[^\s/]+\/pull\/\d+(?:[/?#]\S*)?$/;
|
|
17
|
+
/** The URL a comment points at, or null when it names none. */
|
|
18
|
+
export function pullRequestUrlIn(text) {
|
|
19
|
+
const match = text.match(MARKER);
|
|
20
|
+
const raw = match?.[1]?.replace(/[),.;!?]+$/, "");
|
|
21
|
+
return raw && PR_URL.test(raw) ? raw : null;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=pull-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull-request.js","sourceRoot":"","sources":["../../src/run/pull-request.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,GAAG,iDAAiD,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,GAAG,gEAAgE,CAAC;AAEhF,+DAA+D;AAC/D,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAClD,OAAO,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9C,CAAC"}
|