@crewhaus/report-writer 0.4.0 → 0.4.2

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.d.ts CHANGED
@@ -28,6 +28,11 @@
28
28
  * [2] <url>
29
29
  * <snippet>
30
30
  *
31
+ * The `## Citations` section is emitted UNCONDITIONALLY: a run that cited
32
+ * nothing renders the heading plus `NO_CITATIONS_NOTICE` rather than
33
+ * dropping the section, so an unsourced report can never pass for a
34
+ * sourced one.
35
+ *
31
36
  * The JSON report carries the same data programmatically so studio /
32
37
  * downstream consumers don't have to re-parse markdown.
33
38
  */
@@ -67,4 +72,10 @@ export type WriteReportArgs = {
67
72
  readonly citations: ReadonlyArray<Citation>;
68
73
  readonly now?: () => Date;
69
74
  };
75
+ /**
76
+ * Rendered in place of the `[N] url` list when the run recorded no citations.
77
+ * Exported so a caller (or a test) can assert on the exact wording rather than
78
+ * pattern-matching prose.
79
+ */
80
+ export declare const NO_CITATIONS_NOTICE = "_No citations were recorded for this run \u2014 nothing above is anchored to a fetched source. Treat the findings as unverified._";
70
81
  export declare function writeReport(args: WriteReportArgs): Report;
package/dist/index.js CHANGED
@@ -36,6 +36,12 @@ function citationNumbersForBranch(branch, numberByUrl) {
36
36
  out.sort((a, b) => a - b);
37
37
  return out;
38
38
  }
39
+ /**
40
+ * Rendered in place of the `[N] url` list when the run recorded no citations.
41
+ * Exported so a caller (or a test) can assert on the exact wording rather than
42
+ * pattern-matching prose.
43
+ */
44
+ export const NO_CITATIONS_NOTICE = "_No citations were recorded for this run — nothing above is anchored to a fetched source. Treat the findings as unverified._";
39
45
  function renderMarkdown(args) {
40
46
  const lines = [];
41
47
  lines.push(`# ${args.goal}`);
@@ -46,9 +52,16 @@ function renderMarkdown(args) {
46
52
  lines.push(b.answer.trim());
47
53
  lines.push("");
48
54
  }
49
- if (args.numbered.length > 0) {
50
- lines.push("## Citations");
51
- lines.push("");
55
+ // The Citations section is UNCONDITIONAL. A research report that quietly
56
+ // drops its citation footer reads as a finished, sourced document while
57
+ // being nothing of the kind — for a shape whose premise is "must cite",
58
+ // silence is the worst possible rendering of "cited nothing". Say it.
59
+ lines.push("## Citations");
60
+ lines.push("");
61
+ if (args.numbered.length === 0) {
62
+ lines.push(NO_CITATIONS_NOTICE);
63
+ }
64
+ else {
52
65
  for (const c of args.numbered) {
53
66
  lines.push(`[${c.number}] ${c.url}`);
54
67
  const trimmed = c.snippet.trim().replace(/\n+/g, " ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/report-writer",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "Markdown + JSON report assembly from citations + branch answers (Section 23 RES)",
6
6
  "main": "dist/index.js",
@@ -15,8 +15,8 @@
15
15
  "test": "bun test src"
16
16
  },
17
17
  "dependencies": {
18
- "@crewhaus/citation-tracker": "0.4.0",
19
- "@crewhaus/errors": "0.4.0"
18
+ "@crewhaus/citation-tracker": "0.4.2",
19
+ "@crewhaus/errors": "0.4.2"
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "author": {