arkaik 0.6.0 → 0.7.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/dist/index.js +81 -34
- package/dist/io.js +16 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15202,7 +15202,20 @@ var QualityAuditCompletedEventSchema = external_exports.object({
|
|
|
15202
15202
|
partial: external_exports.boolean().optional(),
|
|
15203
15203
|
cells: external_exports.number().optional(),
|
|
15204
15204
|
since: external_exports.string().optional()
|
|
15205
|
-
}).catchall(external_exports.unknown()).optional()
|
|
15205
|
+
}).catchall(external_exports.unknown()).optional(),
|
|
15206
|
+
// A reading synthesized from a stored audit that arrived without one (issue #472).
|
|
15207
|
+
baseline: external_exports.boolean().optional()
|
|
15208
|
+
}).catchall(external_exports.unknown());
|
|
15209
|
+
var QualityAssessmentScoredEventSchema = external_exports.object({
|
|
15210
|
+
...envelope,
|
|
15211
|
+
type: external_exports.literal("quality.assessment.scored"),
|
|
15212
|
+
audit_id: external_exports.string(),
|
|
15213
|
+
criterion_id: external_exports.string(),
|
|
15214
|
+
surface: external_exports.string(),
|
|
15215
|
+
level: external_exports.number().int().min(0).max(4),
|
|
15216
|
+
evidence: external_exports.string(),
|
|
15217
|
+
commit: external_exports.string().optional(),
|
|
15218
|
+
scope: external_exports.object({ since: external_exports.string().optional() }).catchall(external_exports.unknown()).optional()
|
|
15206
15219
|
}).catchall(external_exports.unknown());
|
|
15207
15220
|
var QualityFindingOpenedEventSchema = external_exports.object({
|
|
15208
15221
|
...envelope,
|
|
@@ -15256,6 +15269,7 @@ var JOURNAL_EVENT_SCHEMAS = {
|
|
|
15256
15269
|
"ref.status_changed": RefStatusChangedEventSchema,
|
|
15257
15270
|
"journal.baseline": JournalBaselineEventSchema,
|
|
15258
15271
|
"quality.audit.completed": QualityAuditCompletedEventSchema,
|
|
15272
|
+
"quality.assessment.scored": QualityAssessmentScoredEventSchema,
|
|
15259
15273
|
"quality.finding.opened": QualityFindingOpenedEventSchema,
|
|
15260
15274
|
"quality.finding.resolved": QualityFindingResolvedEventSchema,
|
|
15261
15275
|
"quality.finding.accepted": QualityFindingAcceptedEventSchema,
|
|
@@ -15278,6 +15292,7 @@ var KnownJournalEventSchema = external_exports.union([
|
|
|
15278
15292
|
RefStatusChangedEventSchema,
|
|
15279
15293
|
JournalBaselineEventSchema,
|
|
15280
15294
|
QualityAuditCompletedEventSchema,
|
|
15295
|
+
QualityAssessmentScoredEventSchema,
|
|
15281
15296
|
QualityFindingOpenedEventSchema,
|
|
15282
15297
|
QualityFindingResolvedEventSchema,
|
|
15283
15298
|
QualityFindingAcceptedEventSchema,
|
|
@@ -17342,6 +17357,10 @@ function sameFrameworkMajor(a, b) {
|
|
|
17342
17357
|
const right = frameworkMajor(b);
|
|
17343
17358
|
return left === null || right === null || left === right;
|
|
17344
17359
|
}
|
|
17360
|
+
function scopeOf(raw) {
|
|
17361
|
+
if (!isRecord(raw) || typeof raw.since !== "string" || raw.since === "") return void 0;
|
|
17362
|
+
return { scope: { since: raw.since, cells: typeof raw.cells === "number" && Number.isFinite(raw.cells) ? raw.cells : null } };
|
|
17363
|
+
}
|
|
17345
17364
|
function cleanScores(raw) {
|
|
17346
17365
|
const scores = {};
|
|
17347
17366
|
if (!isRecord(raw)) return scores;
|
|
@@ -17412,7 +17431,9 @@ function deriveQualityTrend(events, profile, live) {
|
|
|
17412
17431
|
comparable: true,
|
|
17413
17432
|
scores,
|
|
17414
17433
|
overall,
|
|
17415
|
-
counts: cleanCounts(event.counts)
|
|
17434
|
+
counts: cleanCounts(event.counts),
|
|
17435
|
+
...event.baseline === true ? { baseline: true } : {},
|
|
17436
|
+
...scopeOf(event.scope) ?? {}
|
|
17416
17437
|
};
|
|
17417
17438
|
byAudit.delete(auditId);
|
|
17418
17439
|
byAudit.set(auditId, snapshot);
|
|
@@ -17468,7 +17489,9 @@ function trendRows(trend, filter = {}) {
|
|
|
17468
17489
|
...snapshot.commit !== void 0 ? { commit: snapshot.commit } : {},
|
|
17469
17490
|
...snapshot.framework_version !== void 0 ? { framework_version: snapshot.framework_version } : {},
|
|
17470
17491
|
comparable: snapshot.comparable,
|
|
17471
|
-
cells
|
|
17492
|
+
cells,
|
|
17493
|
+
...snapshot.baseline ? { baseline: true } : {},
|
|
17494
|
+
...snapshot.scope !== void 0 ? { scope: snapshot.scope } : {}
|
|
17472
17495
|
});
|
|
17473
17496
|
});
|
|
17474
17497
|
return { surfaces, rows };
|
|
@@ -17630,6 +17653,49 @@ function deriveAuditScope(events, section, library, options = {}) {
|
|
|
17630
17653
|
);
|
|
17631
17654
|
return { since, since_ts: sinceTs, cells: sorted, findings: drivers, resolved_by: resolvedBy, unknown: unknown2, unscorable, widened };
|
|
17632
17655
|
}
|
|
17656
|
+
function scopedAuditId(input) {
|
|
17657
|
+
const { since, month, requested, known, recorded, open } = input;
|
|
17658
|
+
const newest = [...known].sort().at(-1);
|
|
17659
|
+
if (requested !== void 0) {
|
|
17660
|
+
if (requested === since) {
|
|
17661
|
+
throw new Error(
|
|
17662
|
+
`"${requested}" is the audit this scope is measured from \u2014 its recorded reading is history. Name a new audit (e.g. \`${suggestedAuditId(input)}\`); every other cell keeps its score through the merge.`
|
|
17663
|
+
);
|
|
17664
|
+
}
|
|
17665
|
+
if (recorded.includes(requested)) {
|
|
17666
|
+
throw new Error(`"${requested}" is already recorded \u2014 its reading is history. Name a new audit.`);
|
|
17667
|
+
}
|
|
17668
|
+
if (newest !== void 0 && requested < newest) {
|
|
17669
|
+
throw new Error(
|
|
17670
|
+
`"${requested}" sorts before "${newest}", and audits merge latest-wins in lexical order \u2014 its scores would be outvoted by the older ones they replace. Name one that sorts last (e.g. \`${suggestedAuditId(input)}\`).`
|
|
17671
|
+
);
|
|
17672
|
+
}
|
|
17673
|
+
return requested;
|
|
17674
|
+
}
|
|
17675
|
+
if (open !== void 0 && (newest === void 0 || open >= newest)) return open;
|
|
17676
|
+
for (const candidate of scopedCandidates(month)) {
|
|
17677
|
+
if (known.includes(candidate)) continue;
|
|
17678
|
+
if (newest !== void 0 && candidate < newest) {
|
|
17679
|
+
throw new Error(
|
|
17680
|
+
`"${candidate}" would sort before "${newest}", so its scores would lose the latest-wins merge. Name the scoped audit yourself, one that sorts after "${newest}" (e.g. \`${suggestedAuditId(input)}\`).`
|
|
17681
|
+
);
|
|
17682
|
+
}
|
|
17683
|
+
return candidate;
|
|
17684
|
+
}
|
|
17685
|
+
throw new Error(`99 scoped audits in ${month} \u2014 name the next one yourself.`);
|
|
17686
|
+
}
|
|
17687
|
+
function* scopedCandidates(month) {
|
|
17688
|
+
for (let n = 1; n < 100; n++) yield n === 1 ? `${month}-scoped` : `${month}-scoped-${String(n).padStart(2, "0")}`;
|
|
17689
|
+
}
|
|
17690
|
+
function suggestedAuditId({ since, month, requested, known, recorded }) {
|
|
17691
|
+
const taken = /* @__PURE__ */ new Set([...known, ...recorded, since, ...requested !== void 0 ? [requested] : []]);
|
|
17692
|
+
const floor = [...taken].sort().at(-1);
|
|
17693
|
+
for (const candidate of scopedCandidates(month)) {
|
|
17694
|
+
if (taken.has(candidate)) continue;
|
|
17695
|
+
if (floor === void 0 || candidate > floor) return candidate;
|
|
17696
|
+
}
|
|
17697
|
+
return `${floor}-scoped`;
|
|
17698
|
+
}
|
|
17633
17699
|
function scopeSummary(scope) {
|
|
17634
17700
|
const direct = scope.cells.length - scope.widened;
|
|
17635
17701
|
const cells = `${scope.cells.length} cell${scope.cells.length === 1 ? "" : "s"} to re-score`;
|
|
@@ -19151,35 +19217,10 @@ function mergeAudits(root, auditIds, library, profile) {
|
|
|
19151
19217
|
};
|
|
19152
19218
|
}
|
|
19153
19219
|
function scopedAuditTarget(root, since, month, requested, recorded = []) {
|
|
19154
|
-
const
|
|
19155
|
-
const newest =
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
throw new Error(
|
|
19159
|
-
`"${requested}" is the audit this scope is measured from \u2014 its recorded reading is history. Re-score into a new audit (e.g. \`--audit ${month}-scoped\`); every other cell keeps its score through the merge.`
|
|
19160
|
-
);
|
|
19161
|
-
}
|
|
19162
|
-
if (newest !== void 0 && requested < newest) {
|
|
19163
|
-
throw new Error(
|
|
19164
|
-
`"${requested}" sorts before "${newest}", and audits merge latest-wins in lexical order \u2014 its scores would be outvoted by the older ones they replace. Name one that sorts last (e.g. \`${month}-scoped\`).`
|
|
19165
|
-
);
|
|
19166
|
-
}
|
|
19167
|
-
return requested;
|
|
19168
|
-
}
|
|
19169
|
-
if (newest !== void 0 && newest !== since && !recorded.includes(newest) && loadScoresOrEmpty(root, newest).scope?.since === since) {
|
|
19170
|
-
return newest;
|
|
19171
|
-
}
|
|
19172
|
-
for (let n = 1; n < 100; n++) {
|
|
19173
|
-
const candidate = n === 1 ? `${month}-scoped` : `${month}-scoped-${String(n).padStart(2, "0")}`;
|
|
19174
|
-
if (existing.includes(candidate)) continue;
|
|
19175
|
-
if (newest !== void 0 && candidate < newest) {
|
|
19176
|
-
throw new Error(
|
|
19177
|
-
`"${candidate}" would sort before "${newest}", so its scores would lose the latest-wins merge. Name the scoped audit yourself with --audit, one that sorts after "${newest}".`
|
|
19178
|
-
);
|
|
19179
|
-
}
|
|
19180
|
-
return candidate;
|
|
19181
|
-
}
|
|
19182
|
-
throw new Error(`99 scoped audits in ${month} \u2014 name the next one with --audit.`);
|
|
19220
|
+
const known = listAuditIds(root);
|
|
19221
|
+
const newest = known[known.length - 1];
|
|
19222
|
+
const open = newest !== void 0 && newest !== since && !recorded.includes(newest) && loadScoresOrEmpty(root, newest).scope?.since === since ? newest : void 0;
|
|
19223
|
+
return scopedAuditId({ since, month, requested, known, recorded, open });
|
|
19183
19224
|
}
|
|
19184
19225
|
function declaredScopeSince(auditId, recorded) {
|
|
19185
19226
|
if (recorded.includes(auditId)) {
|
|
@@ -22496,7 +22537,7 @@ ${SCORE_USAGE}`);
|
|
|
22496
22537
|
try {
|
|
22497
22538
|
auditId = scopedAuditTarget(common.root, scope.since, currentAuditId(), single.audit, recorded);
|
|
22498
22539
|
} catch (error51) {
|
|
22499
|
-
return fail12(`kritik: ${error51.message}
|
|
22540
|
+
return fail12(`kritik: ${error51.message} Pass it with --audit <id>.`);
|
|
22500
22541
|
}
|
|
22501
22542
|
scopedFrom = scope.since;
|
|
22502
22543
|
} else {
|
|
@@ -23025,6 +23066,12 @@ function runTrend(args, common) {
|
|
|
23025
23066
|
if (!row.comparable) {
|
|
23026
23067
|
console.log(` ${"".padEnd(widths[0])} framework ${row.framework_version ?? "?"} \u2014 not comparable to the audit above`);
|
|
23027
23068
|
}
|
|
23069
|
+
if (row.baseline) {
|
|
23070
|
+
console.log(` ${"".padEnd(widths[0])} baseline \u2014 rebuilt from a restored audit's stored scores`);
|
|
23071
|
+
}
|
|
23072
|
+
if (row.scope) {
|
|
23073
|
+
console.log(` ${"".padEnd(widths[0])} scoped re-audit of ${row.scope.cells ?? "?"} cell(s) since ${row.scope.since}`);
|
|
23074
|
+
}
|
|
23028
23075
|
}
|
|
23029
23076
|
console.log(
|
|
23030
23077
|
`
|
|
@@ -23306,7 +23353,7 @@ Options:
|
|
|
23306
23353
|
-v, --version Print the version.
|
|
23307
23354
|
|
|
23308
23355
|
Run "arkaik <command> --help" for command-specific help.`;
|
|
23309
|
-
var VERSION = "0.
|
|
23356
|
+
var VERSION = "0.7.0";
|
|
23310
23357
|
function main(argv) {
|
|
23311
23358
|
const [command, ...rest] = argv;
|
|
23312
23359
|
if (command === void 0 || command === "--help" || command === "-h" || command === "help") {
|
package/dist/io.js
CHANGED
|
@@ -15189,7 +15189,20 @@ var QualityAuditCompletedEventSchema = external_exports.object({
|
|
|
15189
15189
|
partial: external_exports.boolean().optional(),
|
|
15190
15190
|
cells: external_exports.number().optional(),
|
|
15191
15191
|
since: external_exports.string().optional()
|
|
15192
|
-
}).catchall(external_exports.unknown()).optional()
|
|
15192
|
+
}).catchall(external_exports.unknown()).optional(),
|
|
15193
|
+
// A reading synthesized from a stored audit that arrived without one (issue #472).
|
|
15194
|
+
baseline: external_exports.boolean().optional()
|
|
15195
|
+
}).catchall(external_exports.unknown());
|
|
15196
|
+
var QualityAssessmentScoredEventSchema = external_exports.object({
|
|
15197
|
+
...envelope,
|
|
15198
|
+
type: external_exports.literal("quality.assessment.scored"),
|
|
15199
|
+
audit_id: external_exports.string(),
|
|
15200
|
+
criterion_id: external_exports.string(),
|
|
15201
|
+
surface: external_exports.string(),
|
|
15202
|
+
level: external_exports.number().int().min(0).max(4),
|
|
15203
|
+
evidence: external_exports.string(),
|
|
15204
|
+
commit: external_exports.string().optional(),
|
|
15205
|
+
scope: external_exports.object({ since: external_exports.string().optional() }).catchall(external_exports.unknown()).optional()
|
|
15193
15206
|
}).catchall(external_exports.unknown());
|
|
15194
15207
|
var QualityFindingOpenedEventSchema = external_exports.object({
|
|
15195
15208
|
...envelope,
|
|
@@ -15243,6 +15256,7 @@ var JOURNAL_EVENT_SCHEMAS = {
|
|
|
15243
15256
|
"ref.status_changed": RefStatusChangedEventSchema,
|
|
15244
15257
|
"journal.baseline": JournalBaselineEventSchema,
|
|
15245
15258
|
"quality.audit.completed": QualityAuditCompletedEventSchema,
|
|
15259
|
+
"quality.assessment.scored": QualityAssessmentScoredEventSchema,
|
|
15246
15260
|
"quality.finding.opened": QualityFindingOpenedEventSchema,
|
|
15247
15261
|
"quality.finding.resolved": QualityFindingResolvedEventSchema,
|
|
15248
15262
|
"quality.finding.accepted": QualityFindingAcceptedEventSchema,
|
|
@@ -15265,6 +15279,7 @@ var KnownJournalEventSchema = external_exports.union([
|
|
|
15265
15279
|
RefStatusChangedEventSchema,
|
|
15266
15280
|
JournalBaselineEventSchema,
|
|
15267
15281
|
QualityAuditCompletedEventSchema,
|
|
15282
|
+
QualityAssessmentScoredEventSchema,
|
|
15268
15283
|
QualityFindingOpenedEventSchema,
|
|
15269
15284
|
QualityFindingResolvedEventSchema,
|
|
15270
15285
|
QualityFindingAcceptedEventSchema,
|