arkaik 0.2.0 → 0.4.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/io.js CHANGED
@@ -15203,6 +15203,13 @@ var QualityFindingResolvedEventSchema = external_exports.object({
15203
15203
  resolved_by: external_exports.string().optional(),
15204
15204
  node_ids: external_exports.array(external_exports.string()).optional()
15205
15205
  }).catchall(external_exports.unknown());
15206
+ var QualityFindingAcceptedEventSchema = external_exports.object({
15207
+ ...envelope,
15208
+ type: external_exports.literal("quality.finding.accepted"),
15209
+ finding_id: external_exports.string(),
15210
+ reason: external_exports.string(),
15211
+ node_ids: external_exports.array(external_exports.string()).optional()
15212
+ }).catchall(external_exports.unknown());
15206
15213
  var QualitySignalTrippedEventSchema = external_exports.object({
15207
15214
  ...envelope,
15208
15215
  type: external_exports.literal("quality.signal.tripped"),
@@ -15230,6 +15237,7 @@ var JOURNAL_EVENT_SCHEMAS = {
15230
15237
  "quality.audit.completed": QualityAuditCompletedEventSchema,
15231
15238
  "quality.finding.opened": QualityFindingOpenedEventSchema,
15232
15239
  "quality.finding.resolved": QualityFindingResolvedEventSchema,
15240
+ "quality.finding.accepted": QualityFindingAcceptedEventSchema,
15233
15241
  "quality.signal.tripped": QualitySignalTrippedEventSchema
15234
15242
  };
15235
15243
  var KnownJournalEventSchema = external_exports.union([
@@ -15251,6 +15259,7 @@ var KnownJournalEventSchema = external_exports.union([
15251
15259
  QualityAuditCompletedEventSchema,
15252
15260
  QualityFindingOpenedEventSchema,
15253
15261
  QualityFindingResolvedEventSchema,
15262
+ QualityFindingAcceptedEventSchema,
15254
15263
  QualitySignalTrippedEventSchema
15255
15264
  ]);
15256
15265
 
@@ -15338,6 +15347,9 @@ var QualityFindingSchema = external_exports.object({
15338
15347
  remediation: external_exports.string().optional(),
15339
15348
  node_ids: external_exports.array(external_exports.string()).optional().meta({ description: "Graph nodes this finding is about \u2014 the tie deliverable.shipped already uses." }),
15340
15349
  issue_url: external_exports.string().optional(),
15350
+ commit: external_exports.string().optional().meta({
15351
+ description: "Commit SHA anchoring the file:line evidence. Required by policy on any finding written away from a checkout (issue #400 decision 4) \u2014 without it a stale citation is indistinguishable from a wrong one."
15352
+ }),
15341
15353
  verification: external_exports.object({ verdict: external_exports.enum(["CONFIRMED", "REFUTED", "DOWNGRADED"]), note: external_exports.string().optional() }).catchall(external_exports.unknown()).optional().meta({ description: "Result of the adversarial refutation pass. Refuted findings are disclosed, not deleted." })
15342
15354
  }).catchall(external_exports.unknown()).meta({
15343
15355
  id: "QualityFinding",
@@ -16422,6 +16434,15 @@ function validateBundle(input) {
16422
16434
  );
16423
16435
  }
16424
16436
  }
16437
+ if (type === "quality.finding.accepted" && typeof event.finding_id === "string") {
16438
+ if (!openedInJournal.has(event.finding_id) && !seenFindingIds.has(event.finding_id)) {
16439
+ warn(
16440
+ `journal[${index}].finding_id`,
16441
+ "quality-accepted-never-opened",
16442
+ `Journal event ${index}: accepts finding "${event.finding_id}", which no quality.finding.opened event or stored finding ever declared`
16443
+ );
16444
+ }
16445
+ }
16425
16446
  });
16426
16447
  }
16427
16448
  for (const finding of crossCheckJournal(bundle)) findings.push(finding);
@@ -16583,7 +16604,7 @@ function compactSlice(journalPath, slice, version2) {
16583
16604
 
16584
16605
  // src/lib/kritik-io.ts
16585
16606
  import { existsSync as existsSync4 } from "node:fs";
16586
- import { dirname as dirname3, join as join3 } from "node:path";
16607
+ import { basename, dirname as dirname3, join as join3, resolve as resolve2 } from "node:path";
16587
16608
  import { fileURLToPath } from "node:url";
16588
16609
 
16589
16610
  // ../schema/src/cli/kritik-paths.ts
@@ -16593,7 +16614,12 @@ var QUALITY_DIR = "docs/quality";
16593
16614
  var OVERLAY_FILE = "criteria.custom.json";
16594
16615
  var PACK_FILE = "library.json";
16595
16616
  function readJson(path) {
16596
- return JSON.parse(readFileSync3(path, "utf8"));
16617
+ const text = readFileSync3(path, "utf8");
16618
+ try {
16619
+ return JSON.parse(text);
16620
+ } catch (e) {
16621
+ throw new Error(`${path}: not valid JSON \u2014 ${e.message}`);
16622
+ }
16597
16623
  }
16598
16624
  var overlayPath = (root) => join2(root, QUALITY_DIR, OVERLAY_FILE);
16599
16625
  function loadOverlay(root) {
@@ -16638,10 +16664,18 @@ function appendQualityEvents(root, inputs, options = {}) {
16638
16664
  for (const event of events) appendJournalEvent(journal.journalPath, event);
16639
16665
  return { journalPath: journal.journalPath, events, ...baseline !== void 0 ? { baseline } : {} };
16640
16666
  }
16667
+ function resolveQualityRoot(options) {
16668
+ if (options.root !== void 0) return resolve2(options.fallback, options.root);
16669
+ const envRoot = (options.env ?? process.env).ARKAIK_QUALITY_ROOT;
16670
+ if (envRoot) return resolve2(envRoot);
16671
+ const dir = dirname3(options.bundlePath);
16672
+ if (basename(dir) === "arkaik" && basename(dirname3(dir)) === "docs") return resolve2(dir, "..", "..");
16673
+ return options.fallback;
16674
+ }
16641
16675
 
16642
16676
  // src/lib/bundle-validate.ts
16643
16677
  import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
16644
- import { basename } from "node:path";
16678
+ import { basename as basename2 } from "node:path";
16645
16679
  function validateBundleAt(filePath) {
16646
16680
  const bundle = readBundle(filePath);
16647
16681
  const loose = bundle;
@@ -16663,7 +16697,7 @@ function validateBundleAt(filePath) {
16663
16697
  }
16664
16698
  for (const archivePath of archivePathsFor(sidecarPath)) {
16665
16699
  const { events, findings } = parseJournalLines(readFileSync4(archivePath, "utf8"));
16666
- const file2 = basename(archivePath);
16700
+ const file2 = basename2(archivePath);
16667
16701
  for (const finding of findings) archiveFindings.push({ ...finding, file: file2 });
16668
16702
  archivesLoaded.push(file2);
16669
16703
  folded.push(...events);
@@ -16714,5 +16748,6 @@ export {
16714
16748
  readJournalEvents,
16715
16749
  resolveJournal,
16716
16750
  resolvePack,
16751
+ resolveQualityRoot,
16717
16752
  validateBundleAt
16718
16753
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkaik",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Arkaik CLI — link a repository to a hosted product graph, validate and pack bundles, mirror external ref status.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/io.ts CHANGED
@@ -30,6 +30,7 @@ export {
30
30
  loadKritikLibrary,
31
31
  resolveJournal,
32
32
  appendQualityEvents,
33
+ resolveQualityRoot,
33
34
  type ResolvedPack,
34
35
  } from "./lib/kritik-io";
35
36
  export {