nexarch 0.6.5 → 0.6.7
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
1
2
|
import process from "process";
|
|
2
3
|
import { requireCredentials } from "../lib/credentials.js";
|
|
3
4
|
import { callMcpTool } from "../lib/mcp.js";
|
|
@@ -19,7 +20,16 @@ function parseToolText(result) {
|
|
|
19
20
|
export async function commandDone(args) {
|
|
20
21
|
const asJson = parseFlag(args, "--json");
|
|
21
22
|
const id = parseOptionValue(args, "--id");
|
|
22
|
-
const
|
|
23
|
+
const summaryArg = parseOptionValue(args, "--summary");
|
|
24
|
+
const summaryFile = parseOptionValue(args, "--summary-file");
|
|
25
|
+
let summary = summaryArg;
|
|
26
|
+
if (summaryFile) {
|
|
27
|
+
if (!existsSync(summaryFile)) {
|
|
28
|
+
console.error(`error: --summary-file not found: ${summaryFile}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
summary = readFileSync(summaryFile, "utf8");
|
|
32
|
+
}
|
|
23
33
|
if (!id) {
|
|
24
34
|
console.error("error: --id <commandId> is required");
|
|
25
35
|
process.exit(1);
|
|
@@ -62,17 +62,24 @@ function parseFindingToken(token) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
function parseFindings(args) {
|
|
65
|
-
const
|
|
65
|
+
const findingsFile = parseOptionValue(args, "--findings-file");
|
|
66
|
+
let findingsJson = parseOptionValue(args, "--findings-json");
|
|
67
|
+
if (findingsFile) {
|
|
68
|
+
if (!existsSync(findingsFile)) {
|
|
69
|
+
throw new Error(`--findings-file not found: ${findingsFile}`);
|
|
70
|
+
}
|
|
71
|
+
findingsJson = readFileSync(findingsFile, "utf8");
|
|
72
|
+
}
|
|
66
73
|
if (findingsJson) {
|
|
67
74
|
let parsed;
|
|
68
75
|
try {
|
|
69
76
|
parsed = JSON.parse(findingsJson);
|
|
70
77
|
}
|
|
71
78
|
catch {
|
|
72
|
-
throw new Error("--findings-json must be valid JSON array");
|
|
79
|
+
throw new Error(findingsFile ? "--findings-file must contain valid JSON array" : "--findings-json must be valid JSON array");
|
|
73
80
|
}
|
|
74
81
|
if (!Array.isArray(parsed) || parsed.length === 0) {
|
|
75
|
-
throw new Error("--findings-json must be a non-empty JSON array");
|
|
82
|
+
throw new Error(findingsFile ? "--findings-file must contain a non-empty JSON array" : "--findings-json must be a non-empty JSON array");
|
|
76
83
|
}
|
|
77
84
|
return parsed.map((item) => {
|
|
78
85
|
const value = item;
|
|
@@ -94,7 +101,7 @@ function parseFindings(args) {
|
|
|
94
101
|
}
|
|
95
102
|
const tokens = parseMultiOptionValues(args, "--finding");
|
|
96
103
|
if (tokens.length === 0) {
|
|
97
|
-
throw new Error("Provide findings via --finding (repeatable)
|
|
104
|
+
throw new Error("Provide findings via --finding (repeatable), --findings-json '<json-array>', or --findings-file <path.json>");
|
|
98
105
|
}
|
|
99
106
|
return tokens.map(parseFindingToken);
|
|
100
107
|
}
|
package/dist/index.js
CHANGED
|
@@ -132,6 +132,7 @@ Usage:
|
|
|
132
132
|
Mark a claimed command as completed.
|
|
133
133
|
Options: --id <commandId> (required)
|
|
134
134
|
--summary <text> short summary of what was done
|
|
135
|
+
--summary-file <path.md|txt>
|
|
135
136
|
--json
|
|
136
137
|
nexarch command-fail
|
|
137
138
|
Mark a claimed command as failed.
|
|
@@ -149,6 +150,7 @@ Usage:
|
|
|
149
150
|
--agent-key <key> (optional; defaults from identity)
|
|
150
151
|
--finding <controlId|ruleId|result|rationale|missing1;missing2> (repeatable)
|
|
151
152
|
--findings-json <json-array>
|
|
153
|
+
--findings-file <path.json>
|
|
152
154
|
--json
|
|
153
155
|
`);
|
|
154
156
|
process.exit(command ? 1 : 0);
|