@mrsf/cli 0.7.1 → 0.8.0
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/LICENSE +21 -21
- package/README.md +513 -513
- package/dist/bin.js +6 -6
- package/dist/browser.cjs +2 -2
- package/dist/browser.cjs.map +1 -1
- package/dist/commands/add.js +3 -3
- package/dist/index.cjs +17 -6
- package/dist/index.cjs.map +3 -3
- package/dist/lib/comments.d.ts +2 -1
- package/dist/lib/comments.js +2 -1
- package/dist/lib/reanchor.js +1 -1
- package/dist/lib/types.d.ts +2 -0
- package/dist/lib/writer.js +15 -1
- package/mrsf.schema.json +113 -113
- package/package.json +95 -95
package/dist/commands/add.js
CHANGED
|
@@ -56,8 +56,8 @@ export function registerAdd(program) {
|
|
|
56
56
|
.requiredOption("-t, --text <text>", "Comment text")
|
|
57
57
|
.option("-l, --line <n>", "Line number (1-based)")
|
|
58
58
|
.option("--end-line <n>", "End line (inclusive)")
|
|
59
|
-
.option("--start-column <n>", "
|
|
60
|
-
.option("--end-column <n>", "
|
|
59
|
+
.option("--start-column <n>", "Inclusive UTF-16 column (0-based)")
|
|
60
|
+
.option("--end-column <n>", "Exclusive UTF-16 column (0-based)")
|
|
61
61
|
.option("--type <type>", "Comment type (e.g. suggestion, issue)")
|
|
62
62
|
.option("--severity <level>", "Severity: low | medium | high")
|
|
63
63
|
.option("--reply-to <id>", "Reply to an existing comment")
|
|
@@ -116,7 +116,7 @@ export function registerAdd(program) {
|
|
|
116
116
|
else if (comment.line != null) {
|
|
117
117
|
try {
|
|
118
118
|
const lines = await readDocumentLines(docPath);
|
|
119
|
-
populateSelectedText(comment, lines);
|
|
119
|
+
populateSelectedText(comment, lines.slice(1));
|
|
120
120
|
}
|
|
121
121
|
catch {
|
|
122
122
|
// Document file may not exist yet, skip
|
package/dist/index.cjs
CHANGED
|
@@ -381,6 +381,7 @@ init_parser();
|
|
|
381
381
|
var import_promises3 = require("node:fs/promises");
|
|
382
382
|
var import_node_fs2 = require("node:fs");
|
|
383
383
|
var import_node_crypto = require("node:crypto");
|
|
384
|
+
var import_promises4 = require("node:timers/promises");
|
|
384
385
|
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
385
386
|
var import_yaml2 = require("yaml");
|
|
386
387
|
init_serialize();
|
|
@@ -401,7 +402,17 @@ async function atomicWriteFile(filePath, content) {
|
|
|
401
402
|
const tmp = filePath + "." + (0, import_node_crypto.randomBytes)(6).toString("hex") + ".tmp";
|
|
402
403
|
try {
|
|
403
404
|
await (0, import_promises3.writeFile)(tmp, content, "utf-8");
|
|
404
|
-
|
|
405
|
+
for (let attempt = 0; ; attempt++) {
|
|
406
|
+
try {
|
|
407
|
+
await (0, import_promises3.rename)(tmp, filePath);
|
|
408
|
+
break;
|
|
409
|
+
} catch (error) {
|
|
410
|
+
if (attempt >= 5 || !(error instanceof Error) || !("code" in error) || !["EPERM", "EACCES", "EBUSY"].some((code) => code === error.code)) {
|
|
411
|
+
throw error;
|
|
412
|
+
}
|
|
413
|
+
await (0, import_promises4.setTimeout)(50 * (attempt + 1));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
405
416
|
} catch (err) {
|
|
406
417
|
try {
|
|
407
418
|
await (0, import_promises3.unlink)(tmp);
|
|
@@ -711,7 +722,7 @@ async function writeSidecarInternal(abs, doc) {
|
|
|
711
722
|
}
|
|
712
723
|
|
|
713
724
|
// src/lib/validator.ts
|
|
714
|
-
var
|
|
725
|
+
var import_promises5 = require("node:fs/promises");
|
|
715
726
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
716
727
|
var import_node_url = require("node:url");
|
|
717
728
|
|
|
@@ -805,12 +816,12 @@ var mrsf_schema_default = {
|
|
|
805
816
|
start_column: {
|
|
806
817
|
type: "integer",
|
|
807
818
|
minimum: 0,
|
|
808
|
-
description: "
|
|
819
|
+
description: "Inclusive starting UTF-16 code-unit offset (0-based) within the starting line."
|
|
809
820
|
},
|
|
810
821
|
end_column: {
|
|
811
822
|
type: "integer",
|
|
812
823
|
minimum: 0,
|
|
813
|
-
description: "
|
|
824
|
+
description: "Exclusive ending UTF-16 code-unit offset (0-based) within the ending line. MUST be >= start_column when on the same line."
|
|
814
825
|
},
|
|
815
826
|
selected_text: {
|
|
816
827
|
type: "string",
|
|
@@ -975,7 +986,7 @@ async function loadSchema() {
|
|
|
975
986
|
];
|
|
976
987
|
for (const candidate of candidates) {
|
|
977
988
|
try {
|
|
978
|
-
const raw = await (0,
|
|
989
|
+
const raw = await (0, import_promises5.readFile)(candidate, "utf-8");
|
|
979
990
|
_schemaCache = JSON.parse(raw);
|
|
980
991
|
return _schemaCache;
|
|
981
992
|
} catch {
|
|
@@ -2864,7 +2875,7 @@ async function reanchorDocument(doc, documentLines, opts = {}) {
|
|
|
2864
2875
|
if (!opts.noGit && await isGitAvailable()) {
|
|
2865
2876
|
const repoRoot = opts.repoRoot ?? await findRepoRoot(opts.cwd);
|
|
2866
2877
|
if (repoRoot && opts.documentPath) {
|
|
2867
|
-
const relPath = import_node_path6.default.relative(repoRoot, opts.documentPath);
|
|
2878
|
+
const relPath = import_node_path6.default.relative(repoRoot, opts.documentPath).split(import_node_path6.default.sep).join("/");
|
|
2868
2879
|
const head = await getCurrentCommit(repoRoot);
|
|
2869
2880
|
const globalFrom = opts.fromCommit;
|
|
2870
2881
|
const diffCache = /* @__PURE__ */ new Map();
|