@a2f0/agent-tool 0.1.49 → 0.1.50
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/package.json +1 -1
- package/src/cli.ts +1 -1
- package/src/permissions/catalog.ts +0 -1
- package/src/pr/squashMerge.ts +1 -1
- package/src/runAgentToolAction.ts +8 -15
- package/src/workflows/pr.ts +9 -10
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -88,7 +88,7 @@ Usage: agent-tool [--repo <directory>] [--config <file>] <command>
|
|
|
88
88
|
--help | --version
|
|
89
89
|
|
|
90
90
|
Legacy actions remain available: solicitClaudeCodeReview, solicitCodexReview,
|
|
91
|
-
solicitOpencodeReview, openPr,
|
|
91
|
+
solicitOpencodeReview, openPr, bumpVersions, checkVersions,
|
|
92
92
|
resolveVersionConflicts. A successful review exit means a usable review was
|
|
93
93
|
returned; inspect VERDICT before shipping. Skill install previews unless --apply.
|
|
94
94
|
`;
|
|
@@ -37,7 +37,6 @@ export const CATALOG: CatalogEntry[] = [
|
|
|
37
37
|
...["checkVersions"].map(command => ({ command, class: "read" as const })),
|
|
38
38
|
...["bumpVersions", "resolveVersionConflicts", "solicitClaudeCodeReview", "solicitCodexReview", "solicitOpencodeReview"].map(command => ({ command, class: "local" as const })),
|
|
39
39
|
{ command: "openPr", class: "share" },
|
|
40
|
-
{ command: "squashMerge", class: "release" },
|
|
41
40
|
];
|
|
42
41
|
// `run`, `run-group` and `proc start` execute arbitrary commands, so they stay unclassified and keep the harness default.
|
|
43
42
|
// `bun x` runs only executables that `permissions.executables` classifies; project.ts adds those.
|
package/src/pr/squashMerge.ts
CHANGED
|
@@ -97,7 +97,7 @@ export function parsePullRequestMergeTarget(
|
|
|
97
97
|
recordField(pullRequest, "autoMergeRequest") !== null
|
|
98
98
|
) {
|
|
99
99
|
throw new Error(
|
|
100
|
-
"Pull request already has a queued or automatic merge; cancel it before running
|
|
100
|
+
"Pull request already has a queued or automatic merge; cancel it before running pr merge.",
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
if (expectedBaseRef !== undefined && baseRefName !== expectedBaseRef) {
|
|
@@ -4,10 +4,9 @@ import { solicitCodexReview } from "./review/solicitCodexReview";
|
|
|
4
4
|
import { solicitOpencodeReview } from "./review/solicitOpencodeReview";
|
|
5
5
|
import { bumpVersions, checkVersions } from "./version/bumpVersions";
|
|
6
6
|
import { resolveVersionConflicts } from "./version/resolveVersionConflicts";
|
|
7
|
-
import { mergeReviewedHead } from "./workflows/pr";
|
|
8
7
|
|
|
9
8
|
const AGENT_TOOL_USAGE =
|
|
10
|
-
"Usage: agent-tool <solicitClaudeCodeReview|solicitCodexReview|solicitOpencodeReview|openPr|
|
|
9
|
+
"Usage: agent-tool <solicitClaudeCodeReview|solicitCodexReview|solicitOpencodeReview|openPr|bumpVersions|checkVersions|resolveVersionConflicts> [args]\n";
|
|
11
10
|
|
|
12
11
|
export interface AgentToolActions {
|
|
13
12
|
readonly bumpVersions: (rootDir: string, baseOid?: string) => number;
|
|
@@ -20,12 +19,6 @@ export interface AgentToolActions {
|
|
|
20
19
|
) => number | Promise<number>;
|
|
21
20
|
readonly solicitCodexReview: (rootDir: string, effort?: string) => number | Promise<number>;
|
|
22
21
|
readonly solicitOpencodeReview: (rootDir: string, effort?: string) => number | Promise<number>;
|
|
23
|
-
readonly squashMerge: (
|
|
24
|
-
rootDir: string,
|
|
25
|
-
subject?: string,
|
|
26
|
-
expectedHeadSha?: string,
|
|
27
|
-
expectedBaseRef?: string,
|
|
28
|
-
) => number;
|
|
29
22
|
}
|
|
30
23
|
|
|
31
24
|
const defaultActions: AgentToolActions = {
|
|
@@ -36,8 +29,6 @@ const defaultActions: AgentToolActions = {
|
|
|
36
29
|
solicitClaudeCodeReview,
|
|
37
30
|
solicitCodexReview,
|
|
38
31
|
solicitOpencodeReview,
|
|
39
|
-
// A reviewed HEAD merges only after every preflight gate passes.
|
|
40
|
-
squashMerge: mergeReviewedHead,
|
|
41
32
|
};
|
|
42
33
|
|
|
43
34
|
function assertMaximumPositionals(
|
|
@@ -59,7 +50,7 @@ export function runAgentToolAction(
|
|
|
59
50
|
actions: AgentToolActions = defaultActions,
|
|
60
51
|
): number | Promise<number> {
|
|
61
52
|
const [action, ...positionals] = args;
|
|
62
|
-
const [first
|
|
53
|
+
const [first] = positionals;
|
|
63
54
|
switch (action) {
|
|
64
55
|
case "bumpVersions": {
|
|
65
56
|
assertMaximumPositionals(action, positionals, 1);
|
|
@@ -89,10 +80,12 @@ export function runAgentToolAction(
|
|
|
89
80
|
assertMaximumPositionals(action, positionals, 1);
|
|
90
81
|
return actions.openPr(rootDir, first);
|
|
91
82
|
}
|
|
92
|
-
case "squashMerge":
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
case "squashMerge":
|
|
84
|
+
// Removed: its optional reviewed head let a merge skip preflight.
|
|
85
|
+
process.stderr.write(
|
|
86
|
+
"squashMerge was removed; use agent-tool pr merge <subject-or-empty> <reviewed-head-oid> <base-branch>.\n",
|
|
87
|
+
);
|
|
88
|
+
return 1;
|
|
96
89
|
default:
|
|
97
90
|
process.stderr.write(`Unknown action: ${action ?? "(none)"}\n`);
|
|
98
91
|
process.stderr.write(AGENT_TOOL_USAGE);
|
package/src/workflows/pr.ts
CHANGED
|
@@ -89,18 +89,17 @@ export function preflight(expectedHead: string, baseBranch: string, baseOid: str
|
|
|
89
89
|
/**
|
|
90
90
|
* Merge a reviewed HEAD only after every preflight gate passes against the
|
|
91
91
|
* freshly fetched live base: a skipped, failed, or stale preflight run never
|
|
92
|
-
* leads to a merge.
|
|
93
|
-
* merge
|
|
92
|
+
* leads to a merge. The reviewed HEAD and base branch are required, so no
|
|
93
|
+
* merge path skips preflight.
|
|
94
94
|
*/
|
|
95
|
-
export function mergeReviewedHead(rootDir: string, subject
|
|
96
|
-
|
|
95
|
+
export function mergeReviewedHead(rootDir: string, subject: string | undefined, expectedHead: string, baseBranch: string): number {
|
|
96
|
+
assert(!!expectedHead && !!baseBranch, "Merge requires a reviewed HEAD and a base branch.");
|
|
97
97
|
const identity = resolvePr();
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return squashMerge(rootDir, subject, expectedHead, branch);
|
|
98
|
+
const baseOid = resolveFreshBaseRef(identity.repo, baseBranch);
|
|
99
|
+
try { preflight(expectedHead, baseBranch, baseOid); }
|
|
100
|
+
catch (error) { throw new Error(`Refusing to merge: preflight failed against live ${baseBranch} ${baseOid}: ${(error as Error).message}`); }
|
|
101
|
+
// Bind the merge to the branch that passed preflight, so a retarget in between is refused.
|
|
102
|
+
return squashMerge(rootDir, subject, expectedHead, baseBranch);
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
interface Comment { id: string; databaseId: number; body: string; url: string; author: { login: string } | null }
|