feat(humanizer): wire humanizer into posture and scoring scorecard
generateHealthScorecard signature: 2-arg → 3-arg (areaScores, opportunityCount,
options = {}). options.humanized=true renders friendlier title, grade-context
line per overall grade, and rephrased opportunity line. options.humanized=false
(or 2-arg call) preserves v5.0.0 verbatim output for backwards-compat.
topActions also gets an optional options.humanized that swaps recommendations
through humanizeFinding lookup.
posture.mjs main():
--json → write JSON to stdout, suppress stderr scorecard
--raw → write JSON to stdout (byte-identical to --json), write v5.0.0
verbatim scorecard to stderr
default → humanized scorecard to stderr, no stdout
posture.test.mjs scorecard-prose assertions re-anchored to --raw mode (the
explicit v5.0.0 path) — Wave 0 audit only covered finding-title strings;
scorecard prose surfaces here for the first time.
Wave 3 / Step 6 of v5.1.0 humanizer.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
5ff6594976
commit
70ff900578
5 changed files with 331 additions and 14 deletions
|
|
@ -60,6 +60,7 @@ async function main() {
|
|||
let targetPath = '.';
|
||||
let outputFile = null;
|
||||
let jsonMode = false;
|
||||
let rawMode = false;
|
||||
let includeGlobal = false;
|
||||
let fullMachine = false;
|
||||
|
||||
|
|
@ -68,6 +69,8 @@ async function main() {
|
|||
outputFile = args[++i];
|
||||
} else if (args[i] === '--json') {
|
||||
jsonMode = true;
|
||||
} else if (args[i] === '--raw') {
|
||||
rawMode = true;
|
||||
} else if (args[i] === '--global') {
|
||||
includeGlobal = true;
|
||||
} else if (args[i] === '--full-machine') {
|
||||
|
|
@ -82,14 +85,20 @@ async function main() {
|
|||
const filterFixtures = !args.includes('--include-fixtures');
|
||||
const result = await runPosture(targetPath, { includeGlobal, fullMachine, filterFixtures });
|
||||
|
||||
if (jsonMode) {
|
||||
// stdout JSON path: --json and --raw both write the v5.0.0-shape result
|
||||
// (byte-identical). Default mode writes nothing to stdout.
|
||||
if (jsonMode || rawMode) {
|
||||
const json = JSON.stringify(result, null, 2);
|
||||
process.stdout.write(json + '\n');
|
||||
} else {
|
||||
// Terminal scorecard (v3 health format)
|
||||
}
|
||||
|
||||
// stderr scorecard path: --json suppresses; --raw renders v5.0.0 verbatim
|
||||
// (humanized=false); default renders humanized scorecard.
|
||||
if (!jsonMode) {
|
||||
const scorecard = generateHealthScorecard(
|
||||
{ areas: result.areas, overallGrade: result.overallGrade },
|
||||
result.opportunityCount,
|
||||
{ humanized: !rawMode },
|
||||
);
|
||||
process.stderr.write('\n' + scorecard + '\n');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue