@weareikko/code-review 0.10.0 → 0.10.2
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 +1 -1
- package/dist/{cli-oQSwCSL0.js → cli-D_wubGGT.js} +30 -25
- package/dist/cli-D_wubGGT.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/git.d.ts +11 -6
- package/dist/git.d.ts.map +1 -1
- package/dist/gitlab-review.d.ts +1 -1
- package/dist/review.js +1 -1
- package/package.json +5 -5
- package/dist/cli-oQSwCSL0.js.map +0 -1
package/README.md
CHANGED
|
@@ -258,7 +258,7 @@ Prereleases follow the file `.changelog/prerelease` ([prereleases](https://githu
|
|
|
258
258
|
A manual run forces a bump, for example a major version without a breaking entry:
|
|
259
259
|
|
|
260
260
|
```bash
|
|
261
|
-
gh workflow run publish.yml -f
|
|
261
|
+
gh workflow run publish.yml -f version=major # or patch / minor
|
|
262
262
|
```
|
|
263
263
|
|
|
264
264
|
Publishing uses npm trusted publishing (no npm token) and skips a version that npm already has: if the `Publish to npm` job fails, use "Re-run failed jobs".
|
|
@@ -660,11 +660,16 @@ async function git$1(args, options = {}) {
|
|
|
660
660
|
function remoteRef(remote, branch) {
|
|
661
661
|
return `refs/remotes/${remote}/${branch}`;
|
|
662
662
|
}
|
|
663
|
-
|
|
663
|
+
/**
|
|
664
|
+
* Diff the target branch with the MR head commit, not `HEAD`: CI checks out a
|
|
665
|
+
* merge commit (GitHub `refs/pull/N/merge`, GitLab merged results) whose base
|
|
666
|
+
* can be stale, and then `HEAD` carries commits the MR does not change.
|
|
667
|
+
*/
|
|
668
|
+
function getMergeDiffArguments(targetBranch, headSha, options = {}) {
|
|
664
669
|
const remote = options.remote ?? "origin";
|
|
665
670
|
const context = options.context ?? DEFAULT_DIFF_CONTEXT;
|
|
666
671
|
return [
|
|
667
|
-
`${remoteRef(remote, targetBranch)}
|
|
672
|
+
`${remoteRef(remote, targetBranch)}...${headSha}`,
|
|
668
673
|
`--unified=${context}`,
|
|
669
674
|
"--"
|
|
670
675
|
];
|
|
@@ -676,12 +681,12 @@ function getMergeDiffArguments(targetBranch, options = {}) {
|
|
|
676
681
|
* leaving such comments with invalid one-sided positions that 500 on
|
|
677
682
|
* `bulk_publish`. Diffing literally also gives the reviewer readable paths.
|
|
678
683
|
*/
|
|
679
|
-
function getMergeDiffCommand(targetBranch, options = {}) {
|
|
684
|
+
function getMergeDiffCommand(targetBranch, headSha, options = {}) {
|
|
680
685
|
return [
|
|
681
686
|
"-c",
|
|
682
687
|
"core.quotepath=false",
|
|
683
688
|
"diff",
|
|
684
|
-
...getMergeDiffArguments(targetBranch, options)
|
|
689
|
+
...getMergeDiffArguments(targetBranch, headSha, options)
|
|
685
690
|
];
|
|
686
691
|
}
|
|
687
692
|
async function fetchBranch(remote, branch, options) {
|
|
@@ -718,7 +723,7 @@ async function removeGeneratedCodeQualityArtifacts(paths = DEFAULT_CODEQUALITY_A
|
|
|
718
723
|
}
|
|
719
724
|
return removed;
|
|
720
725
|
}
|
|
721
|
-
async function prepareGitHistory(sourceBranch, targetBranch, options = {}) {
|
|
726
|
+
async function prepareGitHistory(sourceBranch, targetBranch, headSha, options = {}) {
|
|
722
727
|
const remote = options.remote ?? "origin";
|
|
723
728
|
await removeGeneratedCodeQualityArtifacts(options.codeQualityArtifacts, options);
|
|
724
729
|
await git$1([
|
|
@@ -738,29 +743,29 @@ async function prepareGitHistory(sourceBranch, targetBranch, options = {}) {
|
|
|
738
743
|
await git$1([
|
|
739
744
|
"merge-base",
|
|
740
745
|
remoteRef(remote, targetBranch),
|
|
741
|
-
|
|
746
|
+
headSha
|
|
742
747
|
], options);
|
|
743
748
|
} catch (error) {
|
|
744
749
|
const fetchDetail = fetchErrors.length > 0 ? `\nFetch warnings:\n${fetchErrors.join("\n")}` : "";
|
|
745
|
-
throw new GitError(`Unable to prepare Git history for MR review: merge-base ${remoteRef(remote, targetBranch)}
|
|
750
|
+
throw new GitError(`Unable to prepare Git history for MR review: merge-base ${remoteRef(remote, targetBranch)} ${headSha} failed.`, {
|
|
746
751
|
cause: error,
|
|
747
|
-
hint: `Set GIT_DEPTH: 0 or ensure ${remote}/${targetBranch}
|
|
752
|
+
hint: `Set GIT_DEPTH: 0 or ensure ${remote}/${targetBranch} and ${remote}/${sourceBranch} are fetchable.${fetchDetail}\n${gitErrorMessage(error)}`
|
|
748
753
|
});
|
|
749
754
|
}
|
|
750
755
|
}
|
|
751
|
-
async function getMergeDiff(targetBranch, options = {}) {
|
|
752
|
-
return git$1(getMergeDiffCommand(targetBranch, options), options);
|
|
756
|
+
async function getMergeDiff(targetBranch, headSha, options = {}) {
|
|
757
|
+
return git$1(getMergeDiffCommand(targetBranch, headSha, options), options);
|
|
753
758
|
}
|
|
754
|
-
function getMergeCommitLogArguments(targetBranch, options = {}) {
|
|
759
|
+
function getMergeCommitLogArguments(targetBranch, headSha, options = {}) {
|
|
755
760
|
return [
|
|
756
|
-
`${remoteRef(options.remote ?? "origin", targetBranch)}
|
|
761
|
+
`${remoteRef(options.remote ?? "origin", targetBranch)}...${headSha}`,
|
|
757
762
|
"--pretty=tformat:commit %h%nAuthor: %an%nDate: %as%n%n%s%n%n%b",
|
|
758
763
|
"--reverse",
|
|
759
764
|
"--no-merges"
|
|
760
765
|
];
|
|
761
766
|
}
|
|
762
|
-
async function getMergeCommitLog(targetBranch, options = {}) {
|
|
763
|
-
return git$1(["log", ...getMergeCommitLogArguments(targetBranch, options)], options);
|
|
767
|
+
async function getMergeCommitLog(targetBranch, headSha, options = {}) {
|
|
768
|
+
return git$1(["log", ...getMergeCommitLogArguments(targetBranch, headSha, options)], options);
|
|
764
769
|
}
|
|
765
770
|
/**
|
|
766
771
|
* Summarize a unified diff into file/line counts for telemetry. Counts one file
|
|
@@ -1767,7 +1772,7 @@ function buildSummaryBody(summary, costFooter, options = {}) {
|
|
|
1767
1772
|
return `${withFooter}\n\n${buildSummaryHistoryBlock(historyEntries)}`;
|
|
1768
1773
|
}
|
|
1769
1774
|
function buildReviewedCommitFooter(commitSha) {
|
|
1770
|
-
return `Reviewed by ${PRODUCT_LINK} v0.10.
|
|
1775
|
+
return `Reviewed by ${PRODUCT_LINK} v0.10.2 for commit ${commitSha}.`;
|
|
1771
1776
|
}
|
|
1772
1777
|
function extractReviewedCommitSha(body) {
|
|
1773
1778
|
return REVIEWED_COMMIT_FOOTER_PATTERN.exec(body)?.[1] ?? null;
|
|
@@ -3382,7 +3387,7 @@ async function connectOne(config, options) {
|
|
|
3382
3387
|
};
|
|
3383
3388
|
const client = new McpClient({
|
|
3384
3389
|
name: PRODUCT_NAME,
|
|
3385
|
-
version: "0.10.
|
|
3390
|
+
version: "0.10.2",
|
|
3386
3391
|
requestTimeoutMs: MCP_CONNECT_TIMEOUT_MS
|
|
3387
3392
|
});
|
|
3388
3393
|
try {
|
|
@@ -7056,7 +7061,7 @@ async function loadDefaultRuntime() {
|
|
|
7056
7061
|
const [sdkNode, resources, semconv] = modules;
|
|
7057
7062
|
const serviceResource = resources.resourceFromAttributes({
|
|
7058
7063
|
[semconv.ATTR_SERVICE_NAME ?? "service.name"]: SERVICE_NAME,
|
|
7059
|
-
[semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.10.
|
|
7064
|
+
[semconv.ATTR_SERVICE_VERSION ?? "service.version"]: "0.10.2"
|
|
7060
7065
|
});
|
|
7061
7066
|
applyOtelExporterDefaults(process.env);
|
|
7062
7067
|
const sdk = new sdkNode.NodeSDK({ resource: resources.defaultResource().merge(serviceResource) });
|
|
@@ -7569,7 +7574,7 @@ function boldCommentTitle(body) {
|
|
|
7569
7574
|
*/
|
|
7570
7575
|
function buildCommentBody(body, commitSha, confidence) {
|
|
7571
7576
|
const confidenceLine = `_Confidence: ${confidence}._`;
|
|
7572
|
-
const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.10.
|
|
7577
|
+
const footer = `<sub>Reviewed by ${PRODUCT_LINK} v0.10.2 for commit ${commitSha}.</sub>`;
|
|
7573
7578
|
return `${boldCommentTitle(body.trim())}\n\n${confidenceLine}\n\n---\n\n${footer}`;
|
|
7574
7579
|
}
|
|
7575
7580
|
function buildPayload(comment, body, refs, resolved) {
|
|
@@ -8221,7 +8226,7 @@ function gitRepoWebUrl(cloneUrl) {
|
|
|
8221
8226
|
*/
|
|
8222
8227
|
function skillSourceUrl(origin, context = {}) {
|
|
8223
8228
|
switch (origin.kind) {
|
|
8224
|
-
case "builtin": return blobUrl(PRODUCT_URL, "0.10.
|
|
8229
|
+
case "builtin": return blobUrl(PRODUCT_URL, "0.10.2", `skills/${origin.name}/SKILL.md`);
|
|
8225
8230
|
case "project":
|
|
8226
8231
|
if (!context.projectWebUrl || !context.commitSha) return void 0;
|
|
8227
8232
|
return blobUrl(context.projectWebUrl, context.commitSha, `${origin.path}/SKILL.md`);
|
|
@@ -8533,9 +8538,9 @@ async function run(config, bridges) {
|
|
|
8533
8538
|
};
|
|
8534
8539
|
}
|
|
8535
8540
|
logger.info("Fetching diff...");
|
|
8536
|
-
await traceDiagnosticPhase("git.prepare_history", config, runId, () => prepareGitHistory(mr.source_branch, mr.target_branch, { cwd: config.cwd }));
|
|
8541
|
+
await traceDiagnosticPhase("git.prepare_history", config, runId, () => prepareGitHistory(mr.source_branch, mr.target_branch, refs.head_sha, { cwd: config.cwd }));
|
|
8537
8542
|
const diff = await traceDiagnosticPhase("git.get_merge_diff", config, runId, async (context) => {
|
|
8538
|
-
const merged = await getMergeDiff(mr.target_branch, {
|
|
8543
|
+
const merged = await getMergeDiff(mr.target_branch, refs.head_sha, {
|
|
8539
8544
|
cwd: config.cwd,
|
|
8540
8545
|
...config.diffContext > 0 ? { context: config.diffContext } : {}
|
|
8541
8546
|
});
|
|
@@ -8545,7 +8550,7 @@ async function run(config, bridges) {
|
|
|
8545
8550
|
context.diffLinesRemoved = summary.linesRemoved;
|
|
8546
8551
|
return merged;
|
|
8547
8552
|
});
|
|
8548
|
-
const commitLog = await traceDiagnosticPhase("git.get_commit_log", config, runId, () => getMergeCommitLog(mr.target_branch, { cwd: config.cwd }));
|
|
8553
|
+
const commitLog = await traceDiagnosticPhase("git.get_commit_log", config, runId, () => getMergeCommitLog(mr.target_branch, refs.head_sha, { cwd: config.cwd }));
|
|
8549
8554
|
const priorThreads = extractPriorThreads(initialDiscussions, extractChangedFiles(diff));
|
|
8550
8555
|
if (priorThreads.length > 0) logger.info(`Found ${priorThreads.length} prior thread(s) with developer replies — including as context.`);
|
|
8551
8556
|
logger.info("Running review...");
|
|
@@ -8889,10 +8894,10 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
8889
8894
|
return;
|
|
8890
8895
|
}
|
|
8891
8896
|
if (argv.includes("--version") || argv.includes("-v")) {
|
|
8892
|
-
console.log("0.10.
|
|
8897
|
+
console.log("0.10.2");
|
|
8893
8898
|
return;
|
|
8894
8899
|
}
|
|
8895
|
-
process.stderr.write(`[code-review] @weareikko/code-review v0.10.
|
|
8900
|
+
process.stderr.write(`[code-review] @weareikko/code-review v0.10.2\n`);
|
|
8896
8901
|
assertNodeVersion();
|
|
8897
8902
|
applyCodeReviewEnvPrefix();
|
|
8898
8903
|
applyDefaultCacheRetention();
|
|
@@ -8915,4 +8920,4 @@ if (isDirectRun()) main().catch((error) => {
|
|
|
8915
8920
|
//#endregion
|
|
8916
8921
|
export { buildSummaryHistoryEntries as $, connectMcpServers as A, traceMcpDiagnostic as B, findSkillForPath as C, readToolPath as D, formatSkillUsageState as E, createDiagnosticRunId as F, SUMMARY_HISTORY_ENTRY_START as G, toGitLabReviewSeverity as H, diagnosticChannels as I, SUMMARY_MARKER as J, SUMMARY_HISTORY_LIMIT as K, mcpDiagnosticChannels as L, DIAGNOSTIC_CHANNEL_PREFIX as M, MCP_DIAGNOSTIC_CHANNEL_NAMES as N, parseReviewMarkdown as O, createDiagnosticContext as P, buildSummaryBody as Q, traceDiagnostic as R, createSkillReadCounter as S, formatReviewUsageSummary as T, SUMMARY_HISTORY_END as U, normalizeSeverity as V, SUMMARY_HISTORY_ENTRY_END as W, buildReviewedCommitFooter as X, buildArchivedSummaryEntry as Y, buildSizeNoticeBlock as Z, buildPayload as _, resolveNpmSkillDir as _t, formatSkillsFooter as a, stripSummaryHistory as at, filterDiff as b, resolveLabelChange as c, appendFingerprintMarkers as ct, blobUrl as d, fingerprints as dt, extractReviewedCommitSha as et, formatSkillLink as f, normalizeBody as ft, buildGeneratedComments as g, parseSkillSpec as gt, skillSourceUrl as h, loadNamedSkill as ht, formatPerModelUsage as i, findExistingSummaryNoteId as it, DIAGNOSTIC_CHANNEL_NAMES as j, parseReviewMarkdownWithWarnings as k, run as l, extractDiffHunkContext as lt, skillDisplayName as m, gitSkillCacheKey as mt, formatLabelChange as n, findExistingReviewedCommitSha as nt, formatUsageLine as o, stripSummaryMarker as ot, gitRepoWebUrl as p, sha256 as pt, SUMMARY_HISTORY_START as q, formatMcpFooter as r, findExistingSummaryNote as rt, main as s, upsertSummaryNote as st, countPostedBySeverity as t, extractSummaryHistoryEntries as tt, withHttpStamping as u, extractExistingFingerprints as ut, isOtelEnabled as v, resolveSkillCacheDir as vt, formatMcpUsageState as w, runReview as x, startOtelBridge as y, traceDiagnosticPhase as z };
|
|
8917
8922
|
|
|
8918
|
-
//# sourceMappingURL=cli-
|
|
8923
|
+
//# sourceMappingURL=cli-D_wubGGT.js.map
|