@nk070281sjv/cli 2.3.18 → 2.3.20
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/index.js +45 -46
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -30779,7 +30779,7 @@ ${hint}
|
|
|
30779
30779
|
}
|
|
30780
30780
|
|
|
30781
30781
|
// src/lib/version.ts
|
|
30782
|
-
var CLI_VERSION = true ? "2.3.
|
|
30782
|
+
var CLI_VERSION = true ? "2.3.20" : createRequire(import.meta.url)("../../package.json").version;
|
|
30783
30783
|
|
|
30784
30784
|
// src/lib/deps.ts
|
|
30785
30785
|
init_src();
|
|
@@ -37432,7 +37432,6 @@ import { execFile } from "node:child_process";
|
|
|
37432
37432
|
import { promisify } from "node:util";
|
|
37433
37433
|
var execFileAsync = promisify(execFile);
|
|
37434
37434
|
var GIT_SUMMARY_LIMIT = 2e4;
|
|
37435
|
-
var GIT_PATCH_LIMIT = 8e4;
|
|
37436
37435
|
var REVIEW_SNAPSHOT_EXCLUDES = [".ocr", ".opencode"];
|
|
37437
37436
|
async function prepareReviewContext(input) {
|
|
37438
37437
|
const roundDir = join25(input.sessionDir, "rounds", `round-${input.round}`);
|
|
@@ -37451,11 +37450,11 @@ async function prepareReviewContext(input) {
|
|
|
37451
37450
|
);
|
|
37452
37451
|
const reviewBriefPath = join25(roundDir, "review-brief.md");
|
|
37453
37452
|
const gitSnapshot = input.cwd ? await collectGitSnapshot(input.cwd, input.target) : void 0;
|
|
37454
|
-
const
|
|
37455
|
-
if (gitSnapshot &&
|
|
37453
|
+
const changedFilesPath = gitSnapshot ? join25(roundDir, "changed-files.md") : void 0;
|
|
37454
|
+
if (gitSnapshot && changedFilesPath) {
|
|
37456
37455
|
await writeFile2(
|
|
37457
|
-
|
|
37458
|
-
gitSnapshot.
|
|
37456
|
+
changedFilesPath,
|
|
37457
|
+
changedFilesArtifact(gitSnapshot, input.cwd),
|
|
37459
37458
|
"utf-8"
|
|
37460
37459
|
);
|
|
37461
37460
|
}
|
|
@@ -37468,7 +37467,7 @@ async function prepareReviewContext(input) {
|
|
|
37468
37467
|
`Round: ${input.round}`,
|
|
37469
37468
|
`Discovered standards: ${discoveredStandardsPath}`,
|
|
37470
37469
|
`Shared context: ${contextPath}`,
|
|
37471
|
-
...
|
|
37470
|
+
...changedFilesPath ? [`Changed files artifact: ${changedFilesPath}`] : [],
|
|
37472
37471
|
...input.cwd ? [`Repository root: ${input.cwd}`] : [],
|
|
37473
37472
|
"",
|
|
37474
37473
|
"## Scope",
|
|
@@ -37529,7 +37528,7 @@ async function prepareReviewContext(input) {
|
|
|
37529
37528
|
discovered_standards: discoveredStandardsPath,
|
|
37530
37529
|
context: contextPath,
|
|
37531
37530
|
review_brief: reviewBriefPath,
|
|
37532
|
-
...
|
|
37531
|
+
...changedFilesPath ? { changed_files: changedFilesPath } : {},
|
|
37533
37532
|
...requirementsPath ? { requirements: requirementsPath } : {}
|
|
37534
37533
|
}
|
|
37535
37534
|
},
|
|
@@ -37546,7 +37545,7 @@ async function prepareReviewContext(input) {
|
|
|
37546
37545
|
discoveredStandardsPath,
|
|
37547
37546
|
contextPath,
|
|
37548
37547
|
reviewBriefPath,
|
|
37549
|
-
|
|
37548
|
+
changedFilesPath,
|
|
37550
37549
|
requirementsPath,
|
|
37551
37550
|
metadataPath,
|
|
37552
37551
|
requirementsExpected: Boolean(requirementsPath)
|
|
@@ -37564,9 +37563,7 @@ async function collectGitSnapshot(cwd, target = ".") {
|
|
|
37564
37563
|
untrackedFiles,
|
|
37565
37564
|
branchFiles,
|
|
37566
37565
|
worktreeDiffStat,
|
|
37567
|
-
branchDiffStat
|
|
37568
|
-
worktreeDiffPatch,
|
|
37569
|
-
branchDiffPatch
|
|
37566
|
+
branchDiffStat
|
|
37570
37567
|
] = await Promise.all([
|
|
37571
37568
|
runGit(cwd, ["status", "--short"]),
|
|
37572
37569
|
runGit(cwd, ["diff", "--cached", "--name-only", "--", ...gitReviewPathspec()]),
|
|
@@ -37574,12 +37571,9 @@ async function collectGitSnapshot(cwd, target = ".") {
|
|
|
37574
37571
|
runGit(cwd, ["ls-files", "--others", "--exclude-standard", "--", ...gitReviewPathspec()]),
|
|
37575
37572
|
branchDiffArgs ? runGit(cwd, ["diff", "--name-only", ...branchDiffArgs]) : Promise.resolve(""),
|
|
37576
37573
|
runGit(cwd, ["diff", "--stat", "HEAD", "--", ...gitReviewPathspec()]),
|
|
37577
|
-
branchDiffArgs ? runGit(cwd, ["diff", "--stat", ...branchDiffArgs]) : Promise.resolve("")
|
|
37578
|
-
runGit(cwd, ["diff", "--patch", "HEAD", "--", ...gitReviewPathspec()], GIT_PATCH_LIMIT),
|
|
37579
|
-
branchDiffArgs ? runGit(cwd, ["diff", "--patch", ...branchDiffArgs], GIT_PATCH_LIMIT) : Promise.resolve("")
|
|
37574
|
+
branchDiffArgs ? runGit(cwd, ["diff", "--stat", ...branchDiffArgs]) : Promise.resolve("")
|
|
37580
37575
|
]);
|
|
37581
37576
|
const untrackedFileList = filterIgnoredPaths(uniqueLines(untrackedFiles));
|
|
37582
|
-
const untrackedDiffPatch = await collectUntrackedDiffPatch(cwd, untrackedFileList);
|
|
37583
37577
|
const changedFiles = filterIgnoredPaths(uniqueLines([
|
|
37584
37578
|
branchFiles,
|
|
37585
37579
|
cachedFiles,
|
|
@@ -37592,44 +37586,31 @@ ${branchDiffStat}` : "",
|
|
|
37592
37586
|
worktreeDiffStat ? `Working tree diff (HEAD):
|
|
37593
37587
|
${worktreeDiffStat}` : ""
|
|
37594
37588
|
]);
|
|
37595
|
-
const diffPatch = truncate(uniqueSections([
|
|
37596
|
-
branchDiffPatch ? `Branch diff (${baseRef}...HEAD):
|
|
37597
|
-
${branchDiffPatch}` : "",
|
|
37598
|
-
worktreeDiffPatch ? `Working tree diff (HEAD):
|
|
37599
|
-
${worktreeDiffPatch}` : "",
|
|
37600
|
-
untrackedDiffPatch ? `Untracked files diff:
|
|
37601
|
-
${untrackedDiffPatch}` : ""
|
|
37602
|
-
]), GIT_PATCH_LIMIT);
|
|
37603
37589
|
return {
|
|
37604
37590
|
status: filterIgnoredStatusLines(status),
|
|
37605
37591
|
changedFiles,
|
|
37606
37592
|
diffStat,
|
|
37607
|
-
diffPatch,
|
|
37608
37593
|
baseRef
|
|
37609
37594
|
};
|
|
37610
37595
|
}
|
|
37611
|
-
async function collectUntrackedDiffPatch(cwd, files) {
|
|
37612
|
-
const patches = [];
|
|
37613
|
-
let remaining = GIT_PATCH_LIMIT;
|
|
37614
|
-
for (const file of files.split(/\r?\n/).filter(Boolean)) {
|
|
37615
|
-
if (remaining <= 0) {
|
|
37616
|
-
patches.push("[truncated by OCR CLI]");
|
|
37617
|
-
break;
|
|
37618
|
-
}
|
|
37619
|
-
const patch = await runGit(cwd, ["diff", "--no-index", "--", "/dev/null", file], remaining);
|
|
37620
|
-
if (patch) {
|
|
37621
|
-
patches.push(patch);
|
|
37622
|
-
remaining -= patch.length;
|
|
37623
|
-
}
|
|
37624
|
-
}
|
|
37625
|
-
return patches.join("\n\n");
|
|
37626
|
-
}
|
|
37627
37596
|
function gitReviewPathspec() {
|
|
37628
37597
|
return [".", ...REVIEW_SNAPSHOT_EXCLUDES.flatMap((path2) => [
|
|
37629
37598
|
`:(exclude)${path2}`,
|
|
37630
37599
|
`:(exclude)${path2}/**`
|
|
37631
37600
|
])];
|
|
37632
37601
|
}
|
|
37602
|
+
function changedFilesArtifact(snapshot, cwd) {
|
|
37603
|
+
return [
|
|
37604
|
+
"# Changed Files",
|
|
37605
|
+
"",
|
|
37606
|
+
...cwd ? [`Repository root: ${cwd}`, ""] : [],
|
|
37607
|
+
...snapshot.baseRef ? [`Branch base: ${snapshot.baseRef}`, ""] : [],
|
|
37608
|
+
"Only file paths are captured here. Reviewer agents should inspect the listed files and run targeted diffs when needed.",
|
|
37609
|
+
"",
|
|
37610
|
+
fenced("text", snapshot.changedFiles || "No changed files reported."),
|
|
37611
|
+
""
|
|
37612
|
+
].join("\n");
|
|
37613
|
+
}
|
|
37633
37614
|
async function resolveDefaultRemoteBase(cwd) {
|
|
37634
37615
|
const originHead = await runGit(cwd, ["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"]);
|
|
37635
37616
|
if (originHead) return originHead;
|
|
@@ -38095,13 +38076,13 @@ async function reviewerSharedPrefix(context) {
|
|
|
38095
38076
|
`- Discovered standards: ${context.discoveredStandardsPath}`,
|
|
38096
38077
|
`- Shared context: ${context.contextPath}`,
|
|
38097
38078
|
`- Review brief: ${context.reviewBriefPath}`,
|
|
38098
|
-
...context.
|
|
38079
|
+
...context.changedFilesPath ? [`- Changed files: ${context.changedFilesPath}`] : [],
|
|
38099
38080
|
...context.requirementsPath ? [`- Requirements: ${context.requirementsPath}`] : [],
|
|
38100
38081
|
"",
|
|
38101
38082
|
embeddedFileSection("Discovered Standards", context.discoveredStandardsPath, await readTextFile(context.discoveredStandardsPath)),
|
|
38102
38083
|
embeddedFileSection("Shared Review Context", context.contextPath, await readTextFile(context.contextPath)),
|
|
38103
38084
|
embeddedFileSection("Review Brief", context.reviewBriefPath, await readTextFile(context.reviewBriefPath)),
|
|
38104
|
-
...context.
|
|
38085
|
+
...context.changedFilesPath ? [embeddedFileSection("Changed Files", context.changedFilesPath, await readTextFile(context.changedFilesPath))] : [],
|
|
38105
38086
|
...context.requirementsPath ? [embeddedFileSection("Requirements", context.requirementsPath, await readTextFile(context.requirementsPath))] : [],
|
|
38106
38087
|
""
|
|
38107
38088
|
];
|
|
@@ -38748,10 +38729,15 @@ async function runUkrainianTranslation(input) {
|
|
|
38748
38729
|
});
|
|
38749
38730
|
return result;
|
|
38750
38731
|
}
|
|
38751
|
-
const
|
|
38752
|
-
|
|
38732
|
+
const sourceFinalMarkdown = readFileSync16(finalPath, "utf-8");
|
|
38733
|
+
const translatedMarkdown = normalizeUkrainianTranslationOutput(
|
|
38734
|
+
sourceFinalMarkdown,
|
|
38753
38735
|
processOutput(result)
|
|
38754
38736
|
);
|
|
38737
|
+
const translationErrors = validateUkrainianTranslationOutput(
|
|
38738
|
+
sourceFinalMarkdown,
|
|
38739
|
+
translatedMarkdown
|
|
38740
|
+
);
|
|
38755
38741
|
if (translationErrors.length > 0) {
|
|
38756
38742
|
await patchProcessMeta(input.context.roundDir, logPaths.meta, {
|
|
38757
38743
|
status: "failed",
|
|
@@ -38788,7 +38774,7 @@ async function runUkrainianTranslation(input) {
|
|
|
38788
38774
|
});
|
|
38789
38775
|
return { ...result, exitCode: 1 };
|
|
38790
38776
|
}
|
|
38791
|
-
await writeRoundArtifact(input.context.roundDir, ref.artifactPath,
|
|
38777
|
+
await writeRoundArtifact(input.context.roundDir, ref.artifactPath, translatedMarkdown);
|
|
38792
38778
|
await journal.endInstance(agentSessionId, { exitCode: 0 });
|
|
38793
38779
|
emit({
|
|
38794
38780
|
event: "translation:complete",
|
|
@@ -38819,6 +38805,19 @@ function validateUkrainianTranslationOutput(sourceMarkdown, translatedMarkdown)
|
|
|
38819
38805
|
}
|
|
38820
38806
|
return [];
|
|
38821
38807
|
}
|
|
38808
|
+
function normalizeUkrainianTranslationOutput(sourceMarkdown, translatedMarkdown) {
|
|
38809
|
+
const sourceBlock = extractOcrJsonFence(sourceMarkdown);
|
|
38810
|
+
if (!sourceBlock) return translatedMarkdown;
|
|
38811
|
+
const translatedWithoutJson = translatedMarkdown.replace(/```ocr-json[\s\S]*?```/g, "").trimEnd();
|
|
38812
|
+
return `${translatedWithoutJson}
|
|
38813
|
+
|
|
38814
|
+
${sourceBlock}
|
|
38815
|
+
`;
|
|
38816
|
+
}
|
|
38817
|
+
function extractOcrJsonFence(markdown) {
|
|
38818
|
+
const matches = markdown.match(/```ocr-json[\s\S]*?```/g);
|
|
38819
|
+
return matches?.length === 1 ? matches[0] : void 0;
|
|
38820
|
+
}
|
|
38822
38821
|
function sortResults(results, requests) {
|
|
38823
38822
|
const order = new Map(requests.map((request, index) => [request.id, index]));
|
|
38824
38823
|
return [...results].sort((a, b) => (order.get(a.id) ?? 0) - (order.get(b.id) ?? 0));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nk070281sjv/cli",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.20",
|
|
4
4
|
"description": "CLI for Open Code Review - Multi-environment setup and progress tracking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@inquirer/prompts": "^7.2.0",
|
|
40
|
-
"@nk070281sjv/agents": "2.3.
|
|
40
|
+
"@nk070281sjv/agents": "2.3.20",
|
|
41
41
|
"chalk": "^5.4.1",
|
|
42
42
|
"chokidar": "^4.0.3",
|
|
43
43
|
"commander": "^13.0.0",
|