@mergelight/cli 0.1.19 → 0.1.23
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 +2 -2
- package/dist/answer.js +85 -0
- package/dist/cli.js +75 -16
- package/dist/cloud.js +2 -2
- package/dist/connect.js +1 -1
- package/dist/init.js +42 -14
- package/dist/mcp/code-server.js +414 -0
- package/dist/mcp/server.js +13 -11
- package/dist/prompt.js +28 -4
- package/dist/providers/agy-login.js +60 -0
- package/dist/providers/antigravity.js +363 -0
- package/dist/providers/codex.js +38 -6
- package/dist/providers/index.js +23 -2
- package/dist/publish/handled.js +13 -7
- package/dist/publish/markdown.js +11 -5
- package/dist/publish/publish.js +19 -8
- package/dist/review.js +18 -13
- package/dist/setup.js +8 -2
- package/dist/update.js +18 -2
- package/package.json +1 -1
- package/scripts/refresh-login.mjs +21 -2
- package/templates/mergelight-jobs.yml +17 -5
- package/templates/mergelight.yml +15 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ AI code review that runs on the ChatGPT or Claude plan you already pay for. Merg
|
|
|
6
6
|
|
|
7
7
|
**Reviews on every pull request.** Set it up at [mergelight.dev/setup](https://mergelight.dev/setup). It runs in your own GitHub Actions, on your own plan. See the [GitHub Action guide](https://github.com/mergelightai/mergelight/blob/main/docs/github-action.md).
|
|
8
8
|
|
|
9
|
-
**Findings in your coding agent.** One command adds the MCP server and the skill to Claude Code, Codex and
|
|
9
|
+
**Findings in your coding agent.** One command adds the MCP server and the skill to Claude Code, Codex, Cursor and Antigravity:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npx @mergelight/cli init
|
|
@@ -70,7 +70,7 @@ Two more commands, used by the GitHub Action:
|
|
|
70
70
|
- `mergelight post review.json` posts a review saved with `--out`.
|
|
71
71
|
- `mergelight approve owner/repo#123 --by login` turns a 🟡 "needs a human" check green after someone approves the PR. A 🔴 "blocked" check stays blocked until a fix.
|
|
72
72
|
|
|
73
|
-
`mergelight init` adds Mergelight to your coding agents, and `mergelight mcp` is the MCP server they start, so Claude Code, Codex or
|
|
73
|
+
`mergelight init` adds Mergelight to your coding agents, and `mergelight mcp` is the MCP server they start, so Claude Code, Codex, Cursor or Antigravity can read a PR's findings and mark them handled. `mergelight setup owner/repo` sets up the GitHub Action from a terminal.
|
|
74
74
|
|
|
75
75
|
The exit code is `2` when the review finds a bug that blocks the merge, `1` on errors and `0` otherwise. With `--post` it is `0` unless the review fails, since the check carries the verdict. On a personal `gh` login, where GitHub doesn't allow checks, the summary comment carries it instead.
|
|
76
76
|
|
package/dist/answer.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { RESOLVED_ONLY } from "./prompt.js";
|
|
2
|
+
import { encodeMark, MAX_NOTE } from "./publish/handled.js";
|
|
3
|
+
import { withoutHidden } from "./skills.js";
|
|
4
|
+
/** Enough for a long answer to every finding of a round, and no wall that crowds out the code. */
|
|
5
|
+
export const MAX_ANSWER = 8_000;
|
|
6
|
+
/** The comment that started this run, as the Action passes it on. Null when no comment did. */
|
|
7
|
+
export function teamAnswerFromEnv(env = process.env) {
|
|
8
|
+
const by = env.MERGELIGHT_COMMENT_BY?.trim();
|
|
9
|
+
const text = withoutHidden(env.MERGELIGHT_COMMENT_BODY ?? "").trim();
|
|
10
|
+
if (!by || !text || !/^[\w.-]{1,100}$/.test(by))
|
|
11
|
+
return null;
|
|
12
|
+
return { by, at: env.MERGELIGHT_COMMENT_AT ?? new Date().toISOString(), url: env.MERGELIGHT_COMMENT_URL ?? "", text: text.slice(0, MAX_ANSWER) };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* How the verifier names a finding the answer decided to leave: "the team decided not to fix this: <their
|
|
16
|
+
* reason>". The bare form is for a decision made before, so it is no new one.
|
|
17
|
+
*/
|
|
18
|
+
const DECIDED = /^\s*the team decided not to fix this\s*:\s*(\S.*)$/is;
|
|
19
|
+
/**
|
|
20
|
+
* The earlier findings the verifier left because the team's answer decided so, each with the team's
|
|
21
|
+
* reason as the verifier put it. Only earlier findings: a candidate isn't the team's to decide on.
|
|
22
|
+
*/
|
|
23
|
+
export function decisionsFromAnswer(previous, rejected) {
|
|
24
|
+
const earlier = new Map((previous ?? []).map((p) => [p.id, p]));
|
|
25
|
+
const decided = new Map();
|
|
26
|
+
for (const r of rejected) {
|
|
27
|
+
const p = earlier.get(r.candidate);
|
|
28
|
+
const m = DECIDED.exec(r.reason);
|
|
29
|
+
// A finding someone decided on before, with a reason, keeps their decision and their name. A thread
|
|
30
|
+
// resolved without a word gets its reason from the answer.
|
|
31
|
+
const reasoned = p?.handled?.as === "wont_fix" && Boolean(p.handled.note) && p.handled.note !== RESOLVED_ONLY;
|
|
32
|
+
if (!p || !m || decided.has(p.id) || reasoned)
|
|
33
|
+
continue;
|
|
34
|
+
decided.set(p.id, { id: p.id, title: p.title, note: m[1].replace(/\s+/g, " ").trim() });
|
|
35
|
+
}
|
|
36
|
+
return [...decided.values()];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The decisions as the team's own: the next steps read them like a mark the person wrote, so the
|
|
40
|
+
* server can keep their reasons for later pull requests.
|
|
41
|
+
*/
|
|
42
|
+
export function withDecisions(previous, decided, answer, sha) {
|
|
43
|
+
if (!decided.length)
|
|
44
|
+
return previous;
|
|
45
|
+
const notes = new Map(decided.map((d) => [d.id, d.note]));
|
|
46
|
+
return previous?.map((p) => (notes.has(p.id) ? { ...p, handled: { as: "wont_fix", note: notes.get(p.id), by: answer.by, sha, from: "mark", at: answer.at } } : p));
|
|
47
|
+
}
|
|
48
|
+
/** A finding's title as one plain line, safe inside a list. */
|
|
49
|
+
function line(text) {
|
|
50
|
+
return text
|
|
51
|
+
.replace(/\s+/g, " ")
|
|
52
|
+
.replace(/<!--/g, "<!--")
|
|
53
|
+
.replace(/(^|[^\w`])@(?=[A-Za-z0-9-])/g, "$1@")
|
|
54
|
+
.trim();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Mergelight's answer to the comment: what it took from it, and what still holds the merge. Each
|
|
58
|
+
* decision is kept as a mark of its own, with the team's reason, so later rounds and the agent tools
|
|
59
|
+
* read it like any other. Never names Mergelight with an @, so it can't start another run.
|
|
60
|
+
*/
|
|
61
|
+
export function answerReplyBody(answer, decided, review, sha) {
|
|
62
|
+
const holding = review.findings.filter((f) => f.tier !== "hardening");
|
|
63
|
+
const out = [`Read the answer from ${line(answer.by)}${answer.url ? ` ([comment](${answer.url}))` : ""}.`];
|
|
64
|
+
if (decided.length) {
|
|
65
|
+
out.push("", `**Left as the team decided (${decided.length}):** these don't come back.`);
|
|
66
|
+
for (const d of decided)
|
|
67
|
+
out.push(`- ${line(d.title)}: ${line(d.note)}`);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
out.push("", "Nothing in it decided to leave a finding as it is.");
|
|
71
|
+
}
|
|
72
|
+
if (holding.length) {
|
|
73
|
+
out.push("", `**Still holds the merge (${holding.length}):**`);
|
|
74
|
+
for (const f of holding)
|
|
75
|
+
out.push(`- ${line(f.title)}: ${line(f.verdict)}`);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// A team check, or a guarded file, can still hold it: the summary and the checks say.
|
|
79
|
+
out.push("", "No finding holds the merge now. The summary and the checks show anything else that does.");
|
|
80
|
+
}
|
|
81
|
+
out.push("", "The summary is up to date.");
|
|
82
|
+
for (const d of decided)
|
|
83
|
+
out.push(encodeMark([d.id], "wont_fix", `${answer.by}: ${d.note}`.slice(0, MAX_NOTE), sha));
|
|
84
|
+
return out.join("\n");
|
|
85
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -5,15 +5,18 @@ import { currentRepo, fetchPullRequest, parsePrRef } from "./github.js";
|
|
|
5
5
|
import { serve } from "./mcp/server.js";
|
|
6
6
|
import { declinesOf, fetchContext, MAX_REASON, reportReview } from "./cloud.js";
|
|
7
7
|
import { GitHub } from "./publish/api.js";
|
|
8
|
-
import { writeAccess } from "./publish/handled.js";
|
|
8
|
+
import { askWriteAccess, writeAccess } from "./publish/handled.js";
|
|
9
|
+
import { answerReplyBody, decisionsFromAnswer, teamAnswerFromEnv, withDecisions } from "./answer.js";
|
|
9
10
|
import { publishTeamChecks } from "./publish/team-checks.js";
|
|
10
11
|
import { answerRemembered, confirmReasons, approveCheck, checkHeldTitle, checkLimitTitle, checkLoginTitle, failCheck, failSummary, previousReview, publishReview, startCheck, startSummary, syncApproval, UNREVIEWED, APPROVALS_OFF, updatePendingSummary } from "./publish/publish.js";
|
|
11
12
|
import { configuredModel, HeldLoginError, LimitError, LoginError, loginFailureMessage } from "./providers/codex.js";
|
|
13
|
+
import { isProvider } from "./providers/index.js";
|
|
12
14
|
import { heldLoginNotice, limitNotice, loginNotice } from "./publish/markdown.js";
|
|
13
15
|
import { renderRejected, renderTerminal } from "./render.js";
|
|
14
16
|
import { reviewPullRequest } from "./review.js";
|
|
15
17
|
import { jobsCommand } from "./jobs-command.js";
|
|
16
18
|
import { pushJobs } from "./push-jobs.js";
|
|
19
|
+
import { CURRENT } from "./update.js";
|
|
17
20
|
import { jobsReport } from "./run-jobs.js";
|
|
18
21
|
import { askForApp, connect, githubConnect } from "./connect.js";
|
|
19
22
|
import { init, realInitDeps } from "./init.js";
|
|
@@ -24,7 +27,7 @@ Usage
|
|
|
24
27
|
mergelight review <pr> [options] Review a pull request
|
|
25
28
|
mergelight post <review.json> Post a saved review to its pull request
|
|
26
29
|
mergelight approve <pr> --by <login> Turn a "needs a human" check green after approval
|
|
27
|
-
mergelight init Add Mergelight to your coding agents: Claude Code, Codex and
|
|
30
|
+
mergelight init Add Mergelight to your coding agents: Claude Code, Codex, Cursor and Antigravity
|
|
28
31
|
mergelight mcp Run the MCP server, so your coding agent can read findings
|
|
29
32
|
mergelight setup <owner/repo> Set up the GitHub Action on a repository
|
|
30
33
|
mergelight connect <pr> In the Action: connect ChatGPT from the pull request
|
|
@@ -46,11 +49,12 @@ Options
|
|
|
46
49
|
--no-approve With --post or post: never approve the pull request, and take back an approval Mergelight gave
|
|
47
50
|
--json Print the review as JSON
|
|
48
51
|
--out <file> Also write the JSON review to a file
|
|
49
|
-
--provider <name> Who hunts for problems: codex or
|
|
52
|
+
--provider <name> Who hunts for problems: codex, claude or antigravity (default: codex)
|
|
50
53
|
--model <name> Model for the hunters (default: your Codex config, or opus on Claude)
|
|
51
54
|
--effort <level> Reasoning effort: low, medium, high (default: high)
|
|
52
|
-
--verify-with <name> Who checks the findings: claude or
|
|
53
|
-
(default: claude when Claude Code is installed
|
|
55
|
+
--verify-with <name> Who checks the findings: claude, codex or antigravity
|
|
56
|
+
(default: claude when Claude Code is installed; with
|
|
57
|
+
--provider antigravity, Antigravity checks its own)
|
|
54
58
|
--verify-missed <name>
|
|
55
59
|
The AI that was meant to check but had no login: the summary says so
|
|
56
60
|
--verify-model <name> Model for the checker (default for claude: opus)
|
|
@@ -71,8 +75,10 @@ Options
|
|
|
71
75
|
For connect: connect the AI that checks another AI's review. Nobody
|
|
72
76
|
connecting it holds nothing up: the reviewer checks instead
|
|
73
77
|
-h, --help Show this help
|
|
78
|
+
-v, --version Show the version
|
|
74
79
|
|
|
75
80
|
Reviews run on your own logged-in Codex CLI, and Claude Code if you check with it.
|
|
81
|
+
Antigravity logs in with ANTIGRAVITY_AUTH_JSON (a Google AI plan's login) or GEMINI_API_KEY.
|
|
76
82
|
Your code and your AI login are never sent to Mergelight.
|
|
77
83
|
`;
|
|
78
84
|
function progressPrinter() {
|
|
@@ -106,8 +112,17 @@ function progressPrinter() {
|
|
|
106
112
|
};
|
|
107
113
|
}
|
|
108
114
|
const log = (line) => process.stderr.write(`${line}\n`);
|
|
115
|
+
/** parseArgs throws on an option it doesn't know, like a typo. That gets one line, not a stack trace. */
|
|
116
|
+
function argsOrError(read) {
|
|
117
|
+
try {
|
|
118
|
+
return read();
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
109
124
|
async function main() {
|
|
110
|
-
const
|
|
125
|
+
const parsed = argsOrError(() => parseArgs({
|
|
111
126
|
allowPositionals: true,
|
|
112
127
|
options: {
|
|
113
128
|
repo: { type: "string" },
|
|
@@ -143,9 +158,20 @@ async function main() {
|
|
|
143
158
|
"jobs-commit": { type: "string" },
|
|
144
159
|
"jobs-why": { type: "string" },
|
|
145
160
|
help: { type: "boolean", short: "h" },
|
|
161
|
+
version: { type: "boolean", short: "v" },
|
|
146
162
|
},
|
|
147
|
-
});
|
|
163
|
+
}));
|
|
164
|
+
if (parsed instanceof Error) {
|
|
165
|
+
// Node's message goes on to explain "--" for positionals, which helps nobody here: the first sentence says it.
|
|
166
|
+
log(`mergelight: ${(parsed.message.split(/\.\s/)[0] ?? parsed.message).replace(/\.$/, "")}. Run mergelight --help to see the options.`);
|
|
167
|
+
return 1;
|
|
168
|
+
}
|
|
169
|
+
const { values, positionals } = parsed;
|
|
148
170
|
const [command, target] = positionals;
|
|
171
|
+
if (values.version) {
|
|
172
|
+
process.stdout.write(`${CURRENT}\n`);
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
149
175
|
if (values.help || !command) {
|
|
150
176
|
process.stdout.write(HELP);
|
|
151
177
|
return values.help ? 0 : 1;
|
|
@@ -190,19 +216,19 @@ async function main() {
|
|
|
190
216
|
}
|
|
191
217
|
const dryRun = Boolean(values["dry-run"]);
|
|
192
218
|
const provider = values.provider;
|
|
193
|
-
if (provider !== undefined && provider
|
|
194
|
-
log(`mergelight: --provider must be codex or
|
|
219
|
+
if (provider !== undefined && !isProvider(provider)) {
|
|
220
|
+
log(`mergelight: --provider must be codex, claude or antigravity, not "${provider}"`);
|
|
195
221
|
return 1;
|
|
196
222
|
}
|
|
197
223
|
const verifyWith = values["verify-with"];
|
|
198
|
-
if (verifyWith !== undefined && verifyWith
|
|
199
|
-
log(`mergelight: --verify-with must be codex or
|
|
224
|
+
if (verifyWith !== undefined && !isProvider(verifyWith)) {
|
|
225
|
+
log(`mergelight: --verify-with must be codex, claude or antigravity, not "${verifyWith}"`);
|
|
200
226
|
return 1;
|
|
201
227
|
}
|
|
202
228
|
// The AI the team asked to check, which had no login, so the reviewer's own AI checked instead.
|
|
203
229
|
const verifyMissed = values["verify-missed"];
|
|
204
|
-
if (verifyMissed !== undefined && verifyMissed
|
|
205
|
-
log(`mergelight: --verify-missed must be codex or
|
|
230
|
+
if (verifyMissed !== undefined && !isProvider(verifyMissed)) {
|
|
231
|
+
log(`mergelight: --verify-missed must be codex, claude or antigravity, not "${verifyMissed}"`);
|
|
206
232
|
return 1;
|
|
207
233
|
}
|
|
208
234
|
if (command === "post") {
|
|
@@ -213,6 +239,11 @@ async function main() {
|
|
|
213
239
|
}
|
|
214
240
|
const ref = parsePrRef(target, values.repo ?? (await currentRepo()));
|
|
215
241
|
if (command === "jobs") {
|
|
242
|
+
// A job changes files, and agy has no way to keep its hands inside one folder: jobs stay on Codex and Claude.
|
|
243
|
+
if (provider === "antigravity") {
|
|
244
|
+
log("mergelight: jobs run on Codex or Claude. Antigravity can review and check, but not run jobs.");
|
|
245
|
+
return 1;
|
|
246
|
+
}
|
|
216
247
|
const progress = progressPrinter();
|
|
217
248
|
try {
|
|
218
249
|
// A log line clears the progress line first, so the two never run together in a terminal.
|
|
@@ -251,8 +282,9 @@ async function main() {
|
|
|
251
282
|
log(`mergelight: --for must be review or check, not "${values.for}"`);
|
|
252
283
|
return 1;
|
|
253
284
|
}
|
|
254
|
-
|
|
255
|
-
|
|
285
|
+
// The checker to connect is Codex or Claude; the reviewer can be any AI, Antigravity too.
|
|
286
|
+
if (check && ((ai !== "codex" && ai !== "claude") || !isProvider(reviewer) || ai === reviewer)) {
|
|
287
|
+
log("mergelight: connect --for check needs --ai, codex or claude, and --reviewer, codex, claude or antigravity, and not the same.");
|
|
256
288
|
return 1;
|
|
257
289
|
}
|
|
258
290
|
// For a review, --ai claude offers only Claude's link: the workflow says Claude reviews, and it has no login yet.
|
|
@@ -329,6 +361,22 @@ async function main() {
|
|
|
329
361
|
values.at = newest;
|
|
330
362
|
}
|
|
331
363
|
}
|
|
364
|
+
// A comment that mentioned Mergelight started this run: the team's answer to the findings, for this review.
|
|
365
|
+
const answer = values.post ? teamAnswerFromEnv() : null;
|
|
366
|
+
if (answer) {
|
|
367
|
+
const pr = await fetchPullRequest(ref);
|
|
368
|
+
// A fork's pull request gets no review on a push, and a comment on one starts none either.
|
|
369
|
+
if (pr.headRepo && pr.headRepo.toLowerCase() !== `${ref.owner}/${ref.repo}`.toLowerCase()) {
|
|
370
|
+
log(`This pull request comes from the fork ${pr.headRepo}, so a comment on it starts no review.`);
|
|
371
|
+
return 0;
|
|
372
|
+
}
|
|
373
|
+
// Only someone who can push answers for the team. Not when GitHub can't say either.
|
|
374
|
+
if ((await askWriteAccess(api)(answer.by)) !== true) {
|
|
375
|
+
log(`${answer.by} can't push to this repository, or GitHub couldn't say, so their comment isn't the team's answer and starts no review.`);
|
|
376
|
+
return 0;
|
|
377
|
+
}
|
|
378
|
+
log(`Reading the answer ${answer.by} wrote${answer.url ? ` (${answer.url})` : ""}.`);
|
|
379
|
+
}
|
|
332
380
|
let headSha = values.at ?? null;
|
|
333
381
|
if (values.post) {
|
|
334
382
|
headSha ??= (await fetchPullRequest(ref)).headSha;
|
|
@@ -346,7 +394,7 @@ async function main() {
|
|
|
346
394
|
checkRunId = await startCheck(api, headSha, provider ?? "codex", handedOver, record);
|
|
347
395
|
// Says which AI reviews from the start. The models' exact names follow once the first reviewer answers.
|
|
348
396
|
// Without --provider the review runs on Codex, as reviewPullRequest decides.
|
|
349
|
-
const firstGuess = values.model ?? (provider === "claude" ? "opus" : configuredModel());
|
|
397
|
+
const firstGuess = values.model ?? (provider === "claude" ? "opus" : provider === "antigravity" ? null : configuredModel());
|
|
350
398
|
summaryComment = await startSummary(api, ref.number, { reviewer: { name: provider ?? "codex", model: firstGuess ?? null } }, process.env.MERGELIGHT_PROMPT || undefined).catch((e) => {
|
|
351
399
|
log(`Couldn't post the summary yet: ${e.message}`);
|
|
352
400
|
return null;
|
|
@@ -376,9 +424,11 @@ async function main() {
|
|
|
376
424
|
previous,
|
|
377
425
|
// The round this review becomes: from LATE_ROUND on, the loop breaker lets fewer findings hold the merge.
|
|
378
426
|
...(earlier ? { round: earlier.round + 1 } : {}),
|
|
427
|
+
...(answer ? { teamAnswer: { by: answer.by, text: answer.text } } : {}),
|
|
379
428
|
memories: cloud.memories,
|
|
380
429
|
rules: cloud.rules,
|
|
381
430
|
rulesUnread: cloud.failed === true,
|
|
431
|
+
planEnded: cloud.planEnded === true,
|
|
382
432
|
skills: cloud.skills,
|
|
383
433
|
writtenSkills: cloud.writtenSkills,
|
|
384
434
|
checks: cloud.checks,
|
|
@@ -424,6 +474,15 @@ async function main() {
|
|
|
424
474
|
log(line);
|
|
425
475
|
if (values.post) {
|
|
426
476
|
previous = confirmReasons(previous, review.trace.rejected);
|
|
477
|
+
if (answer) {
|
|
478
|
+
// Mergelight answers the comment, and keeps each decision it took from it as a mark with the team's
|
|
479
|
+
// reason: the summary below counts them as handled, and later rounds and the agent tools read them.
|
|
480
|
+
const decided = decisionsFromAnswer(previous, review.trace.rejected);
|
|
481
|
+
await api.write("POST", `issues/${ref.number}/comments`, { body: answerReplyBody(answer, decided, review, review.pr.head_sha) }).catch((e) => log(`Couldn't answer the comment: ${e.message}`));
|
|
482
|
+
// Kept as the person's own decisions, so the server can remember their reasons for later pull requests.
|
|
483
|
+
previous = withDecisions(previous, decided, answer, review.pr.head_sha);
|
|
484
|
+
log(`Took ${decided.length} decision${decided.length === 1 ? "" : "s"} from the answer.`);
|
|
485
|
+
}
|
|
427
486
|
// Reasons given in threads that this review sends to keep: the state holds them until the server confirms.
|
|
428
487
|
// Also when the server couldn't be asked this time, so a waiting reason isn't dropped from the state.
|
|
429
488
|
const remember = cloud.connected || cloud.failed ? (previous ?? []).filter((p) => p.handled?.from === "reply" && p.handled.remember && p.handled.at).map((p) => ({ id: p.id, at: p.handled.at, tries: (p.handled.tries ?? 0) + (cloud.connected ? 1 : 0) })) : [];
|
package/dist/cloud.js
CHANGED
|
@@ -291,9 +291,9 @@ export async function fetchContext(deps = {}) {
|
|
|
291
291
|
return { ...NOTHING, failed: true };
|
|
292
292
|
}
|
|
293
293
|
const answer = res.answer;
|
|
294
|
-
// Not on the dashboard: nothing of it, but whether the org's plan includes Jobs still counts.
|
|
294
|
+
// Not on the dashboard: nothing of it, but whether the org's plan includes Jobs still counts, and whether its plan ended.
|
|
295
295
|
if (answer?.connected !== true)
|
|
296
|
-
return { ...NOTHING, answered: true, ...(answer?.jobs === true ? { jobs: true } : {}) };
|
|
296
|
+
return { ...NOTHING, answered: true, ...(answer?.jobs === true ? { jobs: true } : {}), ...(answer?.plan_ended === true ? { planEnded: true } : {}) };
|
|
297
297
|
const skills = Array.isArray(answer.skills) ? answer.skills.filter(isSkillPath).slice(0, 10) : [];
|
|
298
298
|
return { connected: true, answered: true, memories: readMemories(answer.memories), rules: readRules(answer.rules), skills, checks: readChecks(answer.checks), writtenSkills: readWrittenSkills(answer.written_skills), jobs: answer.jobs === true };
|
|
299
299
|
}
|
package/dist/connect.js
CHANGED
|
@@ -90,7 +90,7 @@ export function loginName(ai) {
|
|
|
90
90
|
}
|
|
91
91
|
/** The name of the AI that does the work. */
|
|
92
92
|
export function aiName(ai) {
|
|
93
|
-
return ai === "codex" ? "Codex" : "Claude";
|
|
93
|
+
return ai === "codex" ? "Codex" : ai === "antigravity" ? "Antigravity" : "Claude";
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* The comment that asks to connect the AI that checks the review. The review doesn't wait for it longer
|
package/dist/init.js
CHANGED
|
@@ -23,6 +23,28 @@ function addSkill(deps, skills) {
|
|
|
23
23
|
cpSync(deps.skillDir, join(skills, "mergelight"), { recursive: true });
|
|
24
24
|
}
|
|
25
25
|
const why = (r) => (r.stderr || r.stdout).trim().split("\n").at(-1)?.slice(0, 200) ?? "no reason given";
|
|
26
|
+
/**
|
|
27
|
+
* Adds the server as "mergelight" to an agent's JSON file of MCP servers, keeping everything else in it.
|
|
28
|
+
* A file that isn't a JSON object is never overwritten: false, and it stays as it was.
|
|
29
|
+
*/
|
|
30
|
+
function addToMcpFile(file, entry) {
|
|
31
|
+
let config = {};
|
|
32
|
+
if (existsSync(file)) {
|
|
33
|
+
try {
|
|
34
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
35
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
36
|
+
return false;
|
|
37
|
+
config = parsed;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const servers = config.mcpServers && typeof config.mcpServers === "object" ? config.mcpServers : {};
|
|
44
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
45
|
+
writeFileSync(file, `${JSON.stringify({ ...config, mcpServers: { ...servers, mergelight: entry } }, null, 2)}\n`);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
26
48
|
export async function init(deps) {
|
|
27
49
|
const server = serverCommand(deps.cliPath);
|
|
28
50
|
let added = 0;
|
|
@@ -51,19 +73,7 @@ export async function init(deps) {
|
|
|
51
73
|
const cursor = join(deps.home, ".cursor");
|
|
52
74
|
if (existsSync(cursor)) {
|
|
53
75
|
const file = join(cursor, "mcp.json");
|
|
54
|
-
|
|
55
|
-
if (existsSync(file)) {
|
|
56
|
-
try {
|
|
57
|
-
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
58
|
-
config = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
config = null;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (config) {
|
|
65
|
-
const servers = config.mcpServers && typeof config.mcpServers === "object" ? config.mcpServers : {};
|
|
66
|
-
writeFileSync(file, `${JSON.stringify({ ...config, mcpServers: { ...servers, mergelight: { type: "stdio", ...server } } }, null, 2)}\n`);
|
|
76
|
+
if (addToMcpFile(file, { type: "stdio", ...server })) {
|
|
67
77
|
addSkill(deps, join(cursor, "skills"));
|
|
68
78
|
deps.log("✓ MCP server and skill added for Cursor");
|
|
69
79
|
added++;
|
|
@@ -71,8 +81,26 @@ export async function init(deps) {
|
|
|
71
81
|
else
|
|
72
82
|
deps.log(`Cursor: ${file} isn't valid JSON, so it's left as it is. To add Mergelight by hand, see ${DOCS}`);
|
|
73
83
|
}
|
|
84
|
+
// Antigravity, Google's agent app and its CLI (agy). Both read one shared file for MCP servers. ~/.gemini alone
|
|
85
|
+
// is Gemini CLI's, so only the folders Antigravity makes, or its CLI on the PATH, count as a sign that it is here.
|
|
86
|
+
const gemini = join(deps.home, ".gemini");
|
|
87
|
+
const agyCli = existsSync(join(gemini, "antigravity-cli")) || (await has(deps, "agy"));
|
|
88
|
+
if (agyCli || ["antigravity", "antigravity-ide", "config"].some((d) => existsSync(join(gemini, d)))) {
|
|
89
|
+
const file = join(gemini, "config", "mcp_config.json");
|
|
90
|
+
// Antigravity has no "type" field: a server with a command is a local one.
|
|
91
|
+
if (addToMcpFile(file, server)) {
|
|
92
|
+
// The app reads global skills from config/skills, and the CLI from antigravity-cli/skills.
|
|
93
|
+
addSkill(deps, join(gemini, "config", "skills"));
|
|
94
|
+
if (agyCli)
|
|
95
|
+
addSkill(deps, join(gemini, "antigravity-cli", "skills"));
|
|
96
|
+
deps.log("✓ MCP server and skill added for Antigravity");
|
|
97
|
+
added++;
|
|
98
|
+
}
|
|
99
|
+
else
|
|
100
|
+
deps.log(`Antigravity: ${file} isn't valid JSON, so it's left as it is. To add Mergelight by hand, see ${DOCS}`);
|
|
101
|
+
}
|
|
74
102
|
if (!added) {
|
|
75
|
-
deps.log(`No coding agent was set up. Mergelight looks for Claude Code, Codex and
|
|
103
|
+
deps.log(`No coding agent was set up. Mergelight looks for Claude Code, Codex, Cursor and Antigravity. To add it by hand, see ${DOCS}`);
|
|
76
104
|
return 1;
|
|
77
105
|
}
|
|
78
106
|
if (!(await has(deps, "gh")))
|