Skip to content

Commit 55bacd7

Browse files
tjpinderclaude
andauthored
v1.4.0: tier field in check JSON output (#2)
Adds a top-level "tier" string to the JSON returned by `check --format=json`. Computed deterministically from severity counts: - silver: 0 CRITICAL + 0 HIGH - bronze: 0 CRITICAL + ≥1 HIGH - fail: ≥1 CRITICAL This is the CLI-green Silver path the directory site already uses as one of its two Silver gates. The other Silver path (public methodology page with Version + Changelog headings) requires a remote URL fetch and remains directory-side. The CLI does not opine on that. Motivation: integrity-md-action and the directory previously computed their own tier labels from raw counts, drifting independently. One source of truth means the badge the action publishes and the tier the directory awards are always the same string. Exported computeTier(counts) so external tooling can pin the mapping without scraping JSON. Base manifest unchanged (still v1.10.0). No rule additions, removals, or shape changes — purely an additive JSON output field. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 08bf66a commit 55bacd7

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ update both sides.
6060
- `2` — one or more HIGH findings (only when `--strict`)
6161
- `3` — usage error
6262

63+
### Tier (JSON output, v1.4.0+)
64+
65+
The JSON payload returned by `check --format=json` includes a top-level `tier` field, derived from the severity counts so tooling doesn't have to reimplement the mapping:
66+
67+
- `"silver"` — no CRITICAL and no HIGH findings (CLI-green path)
68+
- `"bronze"` — no CRITICAL but one or more HIGH findings
69+
- `"fail"` — one or more CRITICAL findings
70+
71+
The directory's other Silver path — a public methodology page with `Version` + `Changelog` headings — is intentionally not computed here. It requires a remote URL fetch and lives in the directory site.
72+
6373
## Badge
6474

6575
Once your product is listed in the directory at a Bronze or Silver tier, you can embed a tier badge in your README so prospective buyers can verify the listing in one click.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@startvest/integrity-cli",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "CLI for The Integrity Framework. Run the v1.0 assertion suite against any repo, generate badge markdown, browse and submit listings to the Integrity Framework Directory. Pure ESM, zero runtime dependencies.",
55
"type": "module",
66
"bin": {

src/cli.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,16 @@ async function cmdCheck(argv) {
145145
const results = metaRuleResult ? [metaRuleResult, ...scanResults] : scanResults;
146146
const counts = countBySeverity(results);
147147

148+
const tier = computeTier(counts);
149+
148150
if (flags.format === 'json') {
149151
const payload = {
150152
framework: 'Startvest Integrity Framework',
151153
baseVersion: base.version,
152154
repoRoot,
153155
sources: { base: !flags.noBase, repoManifests: repoFiles },
154156
counts,
157+
tier,
155158
results,
156159
};
157160
process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
@@ -233,3 +236,15 @@ function countBySeverity(results) {
233236
}
234237
return counts;
235238
}
239+
240+
// Tier derived from severity counts. Matches the green-build path of the
241+
// directory's tier gates: Silver via CLI-green (no CRITICAL, no HIGH),
242+
// Bronze when a published integrity.md exists but HIGH findings remain,
243+
// fail when any CRITICAL is unresolved. The methodology-page Silver path
244+
// is intentionally not computed here — it requires a remote URL fetch
245+
// and lives in the directory site, not in this CLI.
246+
export function computeTier(counts) {
247+
if ((counts?.CRITICAL ?? 0) > 0) return 'fail';
248+
if ((counts?.HIGH ?? 0) > 0) return 'bronze';
249+
return 'silver';
250+
}

0 commit comments

Comments
 (0)