@riddledc/riddle-proof 0.7.192 → 0.7.193
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.cjs +53 -3
- package/dist/cli.js +53 -3
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -15956,7 +15956,7 @@ function usage() {
|
|
|
15956
15956
|
" riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
|
|
15957
15957
|
" riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
|
|
15958
15958
|
" riddle-proof-loop status --state-path <path>",
|
|
15959
|
-
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|summary|none; default json] [--quiet]",
|
|
15959
|
+
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json] [--quiet]",
|
|
15960
15960
|
" riddle-proof-loop profile-body-assertions --artifact <file|url|-> --candidates-json <file|json|-> [--required-json <file|json|->] [--format json|body-contains]",
|
|
15961
15961
|
" riddle-proof-loop profile-http-status-preflight --profile <file|json|-> --url <base-url> [--format json|summary]",
|
|
15962
15962
|
" riddle-proof-loop riddle-preview-deploy <build-dir> <label> [--framework spa|static]",
|
|
@@ -16035,8 +16035,53 @@ function profileOutputDirOption(options) {
|
|
|
16035
16035
|
}
|
|
16036
16036
|
function runProfileResultFormatOption(options) {
|
|
16037
16037
|
const format = optionString(options, "resultFormat") ?? "json";
|
|
16038
|
-
if (format === "
|
|
16039
|
-
|
|
16038
|
+
if (format === "compact") return "compact-json";
|
|
16039
|
+
if (format === "json" || format === "compact-json" || format === "summary" || format === "none") return format;
|
|
16040
|
+
throw new Error("--result-format must be json, compact-json, summary, or none.");
|
|
16041
|
+
}
|
|
16042
|
+
function compactProfileCheckCounts(result) {
|
|
16043
|
+
return result.checks.reduce((counts, check) => {
|
|
16044
|
+
const status = String(check.status || "unknown");
|
|
16045
|
+
counts[status] = (counts[status] || 0) + 1;
|
|
16046
|
+
counts.total = (counts.total || 0) + 1;
|
|
16047
|
+
return counts;
|
|
16048
|
+
}, { total: 0 });
|
|
16049
|
+
}
|
|
16050
|
+
function compactProfileChecks(result) {
|
|
16051
|
+
return result.checks.map((check) => ({
|
|
16052
|
+
type: check.type,
|
|
16053
|
+
label: check.label,
|
|
16054
|
+
status: check.status,
|
|
16055
|
+
message: check.message
|
|
16056
|
+
}));
|
|
16057
|
+
}
|
|
16058
|
+
function compactRunProfileResult(result, options) {
|
|
16059
|
+
const outputDir = profileOutputDirOption(options);
|
|
16060
|
+
return {
|
|
16061
|
+
version: "riddle-proof.profile-compact-result.v1",
|
|
16062
|
+
profile_name: result.profile_name,
|
|
16063
|
+
runner: result.runner,
|
|
16064
|
+
status: result.status,
|
|
16065
|
+
summary: result.summary,
|
|
16066
|
+
captured_at: result.captured_at,
|
|
16067
|
+
baseline_policy: result.baseline_policy,
|
|
16068
|
+
route: result.route,
|
|
16069
|
+
check_counts: compactProfileCheckCounts(result),
|
|
16070
|
+
checks: compactProfileChecks(result),
|
|
16071
|
+
warnings: result.warnings,
|
|
16072
|
+
environment_blocker: result.environment_blocker,
|
|
16073
|
+
metadata: result.metadata,
|
|
16074
|
+
riddle: result.riddle,
|
|
16075
|
+
artifacts: result.artifacts,
|
|
16076
|
+
output_dir: outputDir,
|
|
16077
|
+
output_files: outputDir ? {
|
|
16078
|
+
profile_result: "profile-result.json",
|
|
16079
|
+
summary: "summary.md",
|
|
16080
|
+
proof_json: result.evidence ? "proof.json" : void 0,
|
|
16081
|
+
console: result.evidence?.console ? "console.json" : void 0,
|
|
16082
|
+
dom_summary: result.evidence?.dom_summary ? "dom-summary.json" : void 0
|
|
16083
|
+
} : void 0
|
|
16084
|
+
};
|
|
16040
16085
|
}
|
|
16041
16086
|
function writeRunProfileResult(result, options) {
|
|
16042
16087
|
const format = runProfileResultFormatOption(options);
|
|
@@ -16045,6 +16090,11 @@ function writeRunProfileResult(result, options) {
|
|
|
16045
16090
|
process.stdout.write(profileResultMarkdown(result));
|
|
16046
16091
|
return;
|
|
16047
16092
|
}
|
|
16093
|
+
if (format === "compact-json") {
|
|
16094
|
+
process.stdout.write(`${JSON.stringify(compactRunProfileResult(result, options), null, 2)}
|
|
16095
|
+
`);
|
|
16096
|
+
return;
|
|
16097
|
+
}
|
|
16048
16098
|
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
16049
16099
|
`);
|
|
16050
16100
|
}
|
package/dist/cli.js
CHANGED
|
@@ -48,7 +48,7 @@ function usage() {
|
|
|
48
48
|
" riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
|
|
49
49
|
" riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
|
|
50
50
|
" riddle-proof-loop status --state-path <path>",
|
|
51
|
-
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|summary|none; default json] [--quiet]",
|
|
51
|
+
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|compact-json|summary|none; default json] [--quiet]",
|
|
52
52
|
" riddle-proof-loop profile-body-assertions --artifact <file|url|-> --candidates-json <file|json|-> [--required-json <file|json|->] [--format json|body-contains]",
|
|
53
53
|
" riddle-proof-loop profile-http-status-preflight --profile <file|json|-> --url <base-url> [--format json|summary]",
|
|
54
54
|
" riddle-proof-loop riddle-preview-deploy <build-dir> <label> [--framework spa|static]",
|
|
@@ -127,8 +127,53 @@ function profileOutputDirOption(options) {
|
|
|
127
127
|
}
|
|
128
128
|
function runProfileResultFormatOption(options) {
|
|
129
129
|
const format = optionString(options, "resultFormat") ?? "json";
|
|
130
|
-
if (format === "
|
|
131
|
-
|
|
130
|
+
if (format === "compact") return "compact-json";
|
|
131
|
+
if (format === "json" || format === "compact-json" || format === "summary" || format === "none") return format;
|
|
132
|
+
throw new Error("--result-format must be json, compact-json, summary, or none.");
|
|
133
|
+
}
|
|
134
|
+
function compactProfileCheckCounts(result) {
|
|
135
|
+
return result.checks.reduce((counts, check) => {
|
|
136
|
+
const status = String(check.status || "unknown");
|
|
137
|
+
counts[status] = (counts[status] || 0) + 1;
|
|
138
|
+
counts.total = (counts.total || 0) + 1;
|
|
139
|
+
return counts;
|
|
140
|
+
}, { total: 0 });
|
|
141
|
+
}
|
|
142
|
+
function compactProfileChecks(result) {
|
|
143
|
+
return result.checks.map((check) => ({
|
|
144
|
+
type: check.type,
|
|
145
|
+
label: check.label,
|
|
146
|
+
status: check.status,
|
|
147
|
+
message: check.message
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
function compactRunProfileResult(result, options) {
|
|
151
|
+
const outputDir = profileOutputDirOption(options);
|
|
152
|
+
return {
|
|
153
|
+
version: "riddle-proof.profile-compact-result.v1",
|
|
154
|
+
profile_name: result.profile_name,
|
|
155
|
+
runner: result.runner,
|
|
156
|
+
status: result.status,
|
|
157
|
+
summary: result.summary,
|
|
158
|
+
captured_at: result.captured_at,
|
|
159
|
+
baseline_policy: result.baseline_policy,
|
|
160
|
+
route: result.route,
|
|
161
|
+
check_counts: compactProfileCheckCounts(result),
|
|
162
|
+
checks: compactProfileChecks(result),
|
|
163
|
+
warnings: result.warnings,
|
|
164
|
+
environment_blocker: result.environment_blocker,
|
|
165
|
+
metadata: result.metadata,
|
|
166
|
+
riddle: result.riddle,
|
|
167
|
+
artifacts: result.artifacts,
|
|
168
|
+
output_dir: outputDir,
|
|
169
|
+
output_files: outputDir ? {
|
|
170
|
+
profile_result: "profile-result.json",
|
|
171
|
+
summary: "summary.md",
|
|
172
|
+
proof_json: result.evidence ? "proof.json" : void 0,
|
|
173
|
+
console: result.evidence?.console ? "console.json" : void 0,
|
|
174
|
+
dom_summary: result.evidence?.dom_summary ? "dom-summary.json" : void 0
|
|
175
|
+
} : void 0
|
|
176
|
+
};
|
|
132
177
|
}
|
|
133
178
|
function writeRunProfileResult(result, options) {
|
|
134
179
|
const format = runProfileResultFormatOption(options);
|
|
@@ -137,6 +182,11 @@ function writeRunProfileResult(result, options) {
|
|
|
137
182
|
process.stdout.write(profileResultMarkdown(result));
|
|
138
183
|
return;
|
|
139
184
|
}
|
|
185
|
+
if (format === "compact-json") {
|
|
186
|
+
process.stdout.write(`${JSON.stringify(compactRunProfileResult(result, options), null, 2)}
|
|
187
|
+
`);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
140
190
|
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
141
191
|
`);
|
|
142
192
|
}
|