@weareikko/code-review 0.11.0 → 0.11.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/dist/{cli-sMHMzfB_.js → cli-BFqDzUM6.js} +40 -28
- package/dist/cli-BFqDzUM6.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +6 -9
- package/dist/config.d.ts.map +1 -1
- package/dist/gitlab-review.d.ts +6 -0
- package/dist/gitlab-review.d.ts.map +1 -1
- package/dist/review.d.ts +2 -0
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +2 -2
- package/package.json +2 -2
- package/dist/cli-sMHMzfB_.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, rm, unlink, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
-
import { AgentContextError, CONVENTION_FILES, buildMarketplaceRegistry, createSkillReadCounter, findGitRoot, formatMcpFooter, formatReviewUsageSummary, formatSkillsFooter, isReadOnlyMcpTool, loadSkills, parseMarketplaceEntry, pickMcpEnvVars, redactUrl, resolveMcpServers, resolveSkillCacheDir, walkUpContextFiles } from "@weareikko/agent-context";
|
|
4
|
+
import { AgentContextError, CONVENTION_FILES, GitRevisionProjectConfigReader, MCP_DISCOVERY_MODES, WorkingTreeProjectConfigReader, buildMarketplaceRegistry, createSkillReadCounter, findGitRoot, formatMcpFooter, formatReviewUsageSummary, formatSkillsFooter, isReadOnlyMcpTool, loadSkills, parseMarketplaceEntry, pickMcpEnvVars, redactUrl, resolveMcpServers, resolveSkillCacheDir, walkUpContextFiles } from "@weareikko/agent-context";
|
|
5
5
|
import nodeFs, { readFileSync } from "node:fs";
|
|
6
6
|
import { getEnvApiKey, streamSimple } from "@earendil-works/pi-ai/compat";
|
|
7
7
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -525,7 +525,7 @@ var BUILTIN_SKILLS_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "sk
|
|
|
525
525
|
*/
|
|
526
526
|
var BUILTIN_SKILLS = {
|
|
527
527
|
repoWebUrl: PRODUCT_URL,
|
|
528
|
-
ref: "0.11.
|
|
528
|
+
ref: "0.11.1",
|
|
529
529
|
path: "packages/code-review/skills"
|
|
530
530
|
};
|
|
531
531
|
//#endregion
|
|
@@ -608,7 +608,7 @@ function buildSummaryBody(summary, costFooter, options = {}) {
|
|
|
608
608
|
return `${withFooter}\n\n${buildSummaryHistoryBlock(historyEntries)}`;
|
|
609
609
|
}
|
|
610
610
|
function buildReviewedCommitFooter(commitSha) {
|
|
611
|
-
return `Reviewed by ${PRODUCT_LINK} v0.11.
|
|
611
|
+
return `Reviewed by ${PRODUCT_LINK} v0.11.1 for commit ${commitSha}.`;
|
|
612
612
|
}
|
|
613
613
|
function extractReviewedCommitSha(body) {
|
|
614
614
|
return REVIEWED_COMMIT_FOOTER_PATTERN.exec(body)?.[1] ?? null;
|
|
@@ -1006,7 +1006,6 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
1006
1006
|
"retrieve-skipped",
|
|
1007
1007
|
"no-retrieve-skipped",
|
|
1008
1008
|
"verbose",
|
|
1009
|
-
"mcp-discovery",
|
|
1010
1009
|
"help",
|
|
1011
1010
|
"version"
|
|
1012
1011
|
]);
|
|
@@ -1173,22 +1172,15 @@ function resolveMcpEnv(args, env) {
|
|
|
1173
1172
|
if (envVal) return envVal.split(",").map((s) => s.trim()).filter(Boolean);
|
|
1174
1173
|
return [];
|
|
1175
1174
|
}
|
|
1176
|
-
/**
|
|
1177
|
-
* Resolve whether repo `.mcp.json` auto-discovery runs. Off by default because
|
|
1178
|
-
* those files belong to the repository under review; `--mcp-discovery` always
|
|
1179
|
-
* wins, otherwise `CODE_REVIEW_MCP_DISCOVERY` truthy values (`1`, `true`, `yes`,
|
|
1180
|
-
* `on`) turn it on.
|
|
1181
|
-
*/
|
|
1175
|
+
/** Resolve the repository-controlled MCP configuration source. */
|
|
1182
1176
|
function resolveMcpDiscovery(args, env) {
|
|
1183
|
-
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
].includes(raw.trim().toLowerCase());
|
|
1191
|
-
return false;
|
|
1177
|
+
const fromFlag = args.mcpDiscovery;
|
|
1178
|
+
const hasFlag = fromFlag !== void 0;
|
|
1179
|
+
const fromEnv = env.CODE_REVIEW_MCP_DISCOVERY;
|
|
1180
|
+
if (!hasFlag && !(fromEnv !== void 0)) return "off";
|
|
1181
|
+
const raw = hasFlag ? fromFlag : fromEnv;
|
|
1182
|
+
if (MCP_DISCOVERY_MODES.includes(raw)) return raw;
|
|
1183
|
+
throw new ConfigError(raw ? `Unknown MCP discovery mode "${String(raw)}".` : "Missing MCP discovery mode.", { hint: `--mcp-discovery (or CODE_REVIEW_MCP_DISCOVERY) must be one of: ${MCP_DISCOVERY_MODES.join(", ")}.` });
|
|
1192
1184
|
}
|
|
1193
1185
|
/**
|
|
1194
1186
|
* Resolve marketplace declarations from `--marketplace` (repeatable, preferred)
|
|
@@ -1442,6 +1434,7 @@ function validateConfig(config) {
|
|
|
1442
1434
|
if (!REVIEW_DEPTHS.includes(config.reviewDepth)) throw new ConfigError(`--review-depth must be one of: ${REVIEW_DEPTHS.join(", ")}`);
|
|
1443
1435
|
if (config.inputMode !== void 0 && !REVIEW_INPUT_MODES.includes(config.inputMode)) throw new ConfigError(`--input-mode must be one of: ${REVIEW_INPUT_MODES.join(", ")}`);
|
|
1444
1436
|
if (!POSTING_MODES.includes(config.postingMode)) throw new ConfigError(`--posting-mode must be one of: ${POSTING_MODES.join(", ")}`);
|
|
1437
|
+
if (!MCP_DISCOVERY_MODES.includes(config.mcpDiscovery)) throw new ConfigError(`--mcp-discovery must be one of: ${MCP_DISCOVERY_MODES.join(", ")}`);
|
|
1445
1438
|
const clean = new Set(config.labelsOnClean ?? []);
|
|
1446
1439
|
const overlap = (config.labelsOnFindings ?? []).filter((label) => clean.has(label));
|
|
1447
1440
|
if (overlap.length > 0) throw new ConfigError(`--labels-on-findings and --labels-on-clean share label(s): ${overlap.join(", ")}.`, { hint: "Each review outcome adds its own labels and removes the other set, so a label cannot belong to both." });
|
|
@@ -2206,7 +2199,7 @@ async function connectOne(config, options) {
|
|
|
2206
2199
|
};
|
|
2207
2200
|
const client = new McpClient({
|
|
2208
2201
|
name: PRODUCT_NAME,
|
|
2209
|
-
version: "0.11.
|
|
2202
|
+
version: "0.11.1",
|
|
2210
2203
|
requestTimeoutMs: MCP_CONNECT_TIMEOUT_MS
|
|
2211
2204
|
});
|
|
2212
2205
|
try {
|
|
@@ -3890,15 +3883,30 @@ async function runReview(config, options) {
|
|
|
3890
3883
|
marketplaces: config.marketplaces
|
|
3891
3884
|
});
|
|
3892
3885
|
const gitRoot = await findGitRoot(cwd);
|
|
3886
|
+
const mcpDiscovery = config.mcpDiscovery ?? "off";
|
|
3887
|
+
let projectConfigReader;
|
|
3888
|
+
if (mcpDiscovery === "worktree") projectConfigReader = new WorkingTreeProjectConfigReader(gitRoot);
|
|
3889
|
+
else if (mcpDiscovery === "target") {
|
|
3890
|
+
if (!options.targetSha) throw new ConfigError("Target MCP discovery requires the immutable review target SHA.", { hint: "Pass RunReviewOptions.targetSha from DiffRefs.base_sha, or select mcpDiscovery \"off\" or \"worktree\"." });
|
|
3891
|
+
try {
|
|
3892
|
+
projectConfigReader = await GitRevisionProjectConfigReader.create(gitRoot, options.targetSha);
|
|
3893
|
+
} catch (error) {
|
|
3894
|
+
throw new ConfigError(`Unable to load MCP configuration from target commit ${options.targetSha}.`, {
|
|
3895
|
+
hint: "Ensure the immutable target commit is available in the local Git history, or select mcpDiscovery \"off\" or \"worktree\".",
|
|
3896
|
+
cause: error
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3893
3900
|
const mcpConfigs = await resolveMcpServers({
|
|
3894
3901
|
mcp: config.mcp ?? [],
|
|
3895
3902
|
disableMcp: config.disableMcp ?? [],
|
|
3896
|
-
mcpDiscovery
|
|
3903
|
+
mcpDiscovery
|
|
3897
3904
|
}, cwd, gitRoot, buildMarketplaceRegistry(config.marketplaces ?? []), {
|
|
3898
3905
|
cacheDir: resolveSkillCacheDir(PRODUCT_SLUG),
|
|
3899
3906
|
vars: pickMcpEnvVars(process.env, config.mcpEnv ?? []),
|
|
3900
3907
|
refresh: config.refreshGitSkills,
|
|
3901
3908
|
envPrefix: ENV_PREFIX,
|
|
3909
|
+
projectConfigReader,
|
|
3902
3910
|
warn: (msg) => logger.warn(msg)
|
|
3903
3911
|
});
|
|
3904
3912
|
const mcpConnection = await (options.connectMcp ?? connectMcpServers)(mcpConfigs, {
|
|
@@ -4991,7 +4999,7 @@ async function loadDefaultRuntime() {
|
|
|
4991
4999
|
const [sdkNode, resources, semconv] = modules;
|
|
4992
5000
|
const serviceResource = resources.resourceFromAttributes({
|
|
4993
5001
|
[semconv.ATTR_SERVICE_NAME ?? "service.name"]: SERVICE_NAME,
|
|
4994
|
-
[semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.11.
|
|
5002
|
+
[semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.11.1"
|
|
4995
5003
|
});
|
|
4996
5004
|
applyOtelExporterDefaults(process.env);
|
|
4997
5005
|
const sdk = new sdkNode.NodeSDK({ resource: resources.defaultResource().merge(serviceResource) });
|
|
@@ -5504,7 +5512,7 @@ function boldCommentTitle(body) {
|
|
|
5504
5512
|
*/
|
|
5505
5513
|
function buildCommentBody(body, commitSha, confidence) {
|
|
5506
5514
|
const confidenceLine = `_Confidence: ${confidence}._`;
|
|
5507
|
-
const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.11.
|
|
5515
|
+
const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.11.1 for commit ${commitSha}.</sub>`;
|
|
5508
5516
|
return `${boldCommentTitle(body.trim())}\n\n${confidenceLine}\n\n---\n\n${footer}`;
|
|
5509
5517
|
}
|
|
5510
5518
|
function buildPayload(comment, body, refs, resolved) {
|
|
@@ -6282,6 +6290,9 @@ Options:
|
|
|
6282
6290
|
Comma-separated labels added to the MR/PR when the review posts no
|
|
6283
6291
|
new comment; the --labels-on-findings set is removed.
|
|
6284
6292
|
(env: CODE_REVIEW_LABELS_ON_CLEAN)
|
|
6293
|
+
--mcp-discovery <mode> Repository MCP discovery: off, worktree, or target. target reads
|
|
6294
|
+
.mcp.json and .claude/settings*.json from the immutable review target
|
|
6295
|
+
commit. (default: off; env: CODE_REVIEW_MCP_DISCOVERY)
|
|
6285
6296
|
--review-file <path> Raw code-review output file (default: code-review.md)
|
|
6286
6297
|
--output <path> Generated payload artifact (default: review-comments.json)
|
|
6287
6298
|
--cwd <path> Working directory (default: process.cwd())
|
|
@@ -6390,7 +6401,8 @@ async function run(config, bridges) {
|
|
|
6390
6401
|
onUsage: (u) => {
|
|
6391
6402
|
partialUsage = u;
|
|
6392
6403
|
},
|
|
6393
|
-
sinceRef: config.inputMode === "commits" && reviewedCommitSha && reviewedCommitSha !== refs.head_sha ? reviewedCommitSha : void 0
|
|
6404
|
+
sinceRef: config.inputMode === "commits" && reviewedCommitSha && reviewedCommitSha !== refs.head_sha ? reviewedCommitSha : void 0,
|
|
6405
|
+
targetSha: refs.base_sha
|
|
6394
6406
|
});
|
|
6395
6407
|
context.usage = result;
|
|
6396
6408
|
return result;
|
|
@@ -6685,10 +6697,10 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
6685
6697
|
return;
|
|
6686
6698
|
}
|
|
6687
6699
|
if (argv.includes("--version") || argv.includes("-v")) {
|
|
6688
|
-
console.log("0.11.
|
|
6700
|
+
console.log("0.11.1");
|
|
6689
6701
|
return;
|
|
6690
6702
|
}
|
|
6691
|
-
process.stderr.write(`[code-review] @weareikko/code-review v0.11.
|
|
6703
|
+
process.stderr.write(`[code-review] @weareikko/code-review v0.11.1\n`);
|
|
6692
6704
|
assertNodeVersion();
|
|
6693
6705
|
applyCodeReviewEnvPrefix();
|
|
6694
6706
|
applyDefaultCacheRetention();
|
|
@@ -6709,6 +6721,6 @@ if (isDirectRun()) main().catch((error) => {
|
|
|
6709
6721
|
process.exitCode = 1;
|
|
6710
6722
|
});
|
|
6711
6723
|
//#endregion
|
|
6712
|
-
export {
|
|
6724
|
+
export { fingerprints as $, toGitLabReviewSeverity as A, buildSummaryBody as B, diagnosticChannels as C, traceMcpDiagnostic as D, traceDiagnosticPhase as E, SUMMARY_HISTORY_START as F, findExistingSummaryNote as G, extractReviewedCommitSha as H, SUMMARY_MARKER as I, stripSummaryMarker as J, findExistingSummaryNoteId as K, buildArchivedSummaryEntry as L, SUMMARY_HISTORY_ENTRY_END as M, SUMMARY_HISTORY_ENTRY_START as N, MCP_DISCOVERY_MODES as O, SUMMARY_HISTORY_LIMIT as P, extractExistingFingerprints as Q, buildReviewedCommitFooter as R, createDiagnosticRunId as S, traceDiagnostic as T, extractSummaryHistoryEntries as U, buildSummaryHistoryEntries as V, findExistingReviewedCommitSha as W, appendFingerprintMarkers as X, upsertSummaryNote as Y, extractDiffHunkContext as Z, connectMcpServers as _, main as a, MCP_DIAGNOSTIC_CHANNEL_NAMES as b, withHttpStamping as c, isOtelEnabled as d, normalizeBody as et, startOtelBridge as f, parseReviewMarkdownWithWarnings as g, parseReviewMarkdown as h, formatUsageLine as i, SUMMARY_HISTORY_END as j, normalizeSeverity as k, buildGeneratedComments as l, runReview as m, formatLabelChange as n, resolveLabelChange as o, filterDiff as p, stripSummaryHistory as q, formatPerModelUsage as r, run as s, countPostedBySeverity as t, sha256 as tt, buildPayload as u, DIAGNOSTIC_CHANNEL_NAMES as v, mcpDiagnosticChannels as w, createDiagnosticContext as x, DIAGNOSTIC_CHANNEL_PREFIX as y, buildSizeNoticeBlock as z };
|
|
6713
6725
|
|
|
6714
|
-
//# sourceMappingURL=cli-
|
|
6726
|
+
//# sourceMappingURL=cli-BFqDzUM6.js.map
|