qfai 0.4.9 → 0.5.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.
@@ -1261,8 +1261,8 @@ import { readFile as readFile4 } from "fs/promises";
1261
1261
  import path9 from "path";
1262
1262
  import { fileURLToPath as fileURLToPath2 } from "url";
1263
1263
  async function resolveToolVersion() {
1264
- if ("0.4.9".length > 0) {
1265
- return "0.4.9";
1264
+ if ("0.5.0".length > 0) {
1265
+ return "0.5.0";
1266
1266
  }
1267
1267
  try {
1268
1268
  const packagePath = resolvePackageJsonPath();
@@ -2605,8 +2605,11 @@ async function createReportData(root, validation, configResult) {
2605
2605
  db: dbFiles
2606
2606
  } = await collectContractFiles(uiRoot, apiRoot, dbRoot);
2607
2607
  const contractIndex = await buildContractIndex(root, config);
2608
- const specContractRefs = await collectSpecContractRefs(specFiles);
2609
2608
  const contractIdList = Array.from(contractIndex.ids);
2609
+ const specContractRefs = await collectSpecContractRefs(
2610
+ specFiles,
2611
+ contractIdList
2612
+ );
2610
2613
  const referencedContracts = /* @__PURE__ */ new Set();
2611
2614
  for (const ids of specContractRefs.specToContractIds.values()) {
2612
2615
  ids.forEach((id) => referencedContracts.add(id));
@@ -2687,6 +2690,7 @@ async function createReportData(root, validation, configResult) {
2687
2690
  },
2688
2691
  specs: {
2689
2692
  contractRefMissing: specContractRefs.missingRefSpecs.size,
2693
+ missingRefSpecs: toSortedArray2(specContractRefs.missingRefSpecs),
2690
2694
  specToContractIds: specToContractIdsRecord
2691
2695
  }
2692
2696
  },
@@ -2769,6 +2773,16 @@ function formatReportMarkdown(data) {
2769
2773
  }
2770
2774
  }
2771
2775
  lines.push("");
2776
+ lines.push("## Spec\u3067 contract-ref \u672A\u5BA3\u8A00");
2777
+ const missingRefSpecs = data.traceability.specs.missingRefSpecs;
2778
+ if (missingRefSpecs.length === 0) {
2779
+ lines.push("- (none)");
2780
+ } else {
2781
+ for (const specId of missingRefSpecs) {
2782
+ lines.push(`- ${specId}`);
2783
+ }
2784
+ }
2785
+ lines.push("");
2772
2786
  lines.push("## SC\u30AB\u30D0\u30EC\u30C3\u30B8");
2773
2787
  lines.push(`- total: ${data.traceability.sc.total}`);
2774
2788
  lines.push(`- covered: ${data.traceability.sc.covered}`);
@@ -2872,10 +2886,13 @@ function formatReportMarkdown(data) {
2872
2886
  function formatReportJson(data) {
2873
2887
  return JSON.stringify(data, null, 2);
2874
2888
  }
2875
- async function collectSpecContractRefs(specFiles) {
2889
+ async function collectSpecContractRefs(specFiles, contractIdList) {
2876
2890
  const specToContractIds = /* @__PURE__ */ new Map();
2877
2891
  const idToSpecs = /* @__PURE__ */ new Map();
2878
2892
  const missingRefSpecs = /* @__PURE__ */ new Set();
2893
+ for (const contractId of contractIdList) {
2894
+ idToSpecs.set(contractId, /* @__PURE__ */ new Set());
2895
+ }
2879
2896
  for (const file of specFiles) {
2880
2897
  const text = await readFile11(file, "utf-8");
2881
2898
  const parsed = parseSpec(text, file);
@@ -2883,13 +2900,15 @@ async function collectSpecContractRefs(specFiles) {
2883
2900
  const refs = parsed.contractRefs;
2884
2901
  if (refs.lines.length === 0) {
2885
2902
  missingRefSpecs.add(specKey);
2903
+ continue;
2886
2904
  }
2887
2905
  const currentContracts = specToContractIds.get(specKey) ?? /* @__PURE__ */ new Set();
2888
2906
  for (const id of refs.ids) {
2889
2907
  currentContracts.add(id);
2890
- const specs = idToSpecs.get(id) ?? /* @__PURE__ */ new Set();
2891
- specs.add(specKey);
2892
- idToSpecs.set(id, specs);
2908
+ const specs = idToSpecs.get(id);
2909
+ if (specs) {
2910
+ specs.add(specKey);
2911
+ }
2893
2912
  }
2894
2913
  specToContractIds.set(specKey, currentContracts);
2895
2914
  }