pramanasutra 0.3.2 → 0.3.4

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.
Files changed (186) hide show
  1. package/.agents/skills/pramanasutra-access/SKILL.md +5 -18
  2. package/.agents/skills/pramanasutra-api/SKILL.md +5 -18
  3. package/.agents/skills/pramanasutra-data/SKILL.md +5 -18
  4. package/.agents/skills/pramanasutra-defect/SKILL.md +5 -18
  5. package/.agents/skills/pramanasutra-evidence/SKILL.md +5 -18
  6. package/.agents/skills/pramanasutra-flake/SKILL.md +5 -18
  7. package/.agents/skills/pramanasutra-flow/SKILL.md +5 -18
  8. package/.agents/skills/pramanasutra-load/SKILL.md +5 -18
  9. package/.agents/skills/pramanasutra-pipeline/SKILL.md +5 -18
  10. package/.agents/skills/pramanasutra-prime/SKILL.md +6 -22
  11. package/.agents/skills/pramanasutra-regression/SKILL.md +5 -18
  12. package/.agents/skills/pramanasutra-release/SKILL.md +5 -18
  13. package/.agents/skills/pramanasutra-secure/SKILL.md +5 -18
  14. package/.agents/skills/pramanasutra-strategy/SKILL.md +5 -18
  15. package/.agents/skills/pramanasutra-unit/SKILL.md +5 -18
  16. package/.agents/skills/pramanasutra-verify/SKILL.md +5 -18
  17. package/.agents/skills/pramanasutra-visual/SKILL.md +5 -18
  18. package/CHANGELOG.md +24 -0
  19. package/README.md +64 -61
  20. package/docs/00-start-here.html +27 -15
  21. package/docs/01-executive-summary.html +20 -7
  22. package/docs/02-functional-specification.html +23 -10
  23. package/docs/03-architecture.html +19 -6
  24. package/docs/04-technical-reference.html +22 -9
  25. package/docs/05-user-guide.html +23 -9
  26. package/docs/06-cli-and-reports.html +24 -11
  27. package/docs/07-rule-catalog.html +21 -8
  28. package/docs/08-skills-and-agents.html +20 -7
  29. package/docs/09-security-and-privacy.html +18 -5
  30. package/docs/10-legal-and-compliance.html +19 -6
  31. package/docs/11-testing-and-proof.html +22 -9
  32. package/docs/12-ci-and-release.html +19 -6
  33. package/docs/13-roadmap-and-status.html +25 -12
  34. package/docs/14-faq-and-glossary.html +18 -5
  35. package/docs/15-maintainer-guide.html +18 -5
  36. package/docs/audit/report.html +8 -6
  37. package/docs/audit/report.json +7 -5
  38. package/docs/audit/report.md +10 -7
  39. package/docs/audit/report.sarif.json +16 -0
  40. package/docs/handbook/05-user-guide.md +2 -1
  41. package/docs/handbook/06-cli-reference.md +1 -1
  42. package/docs/index.html +60 -42
  43. package/docs/proof/test-results.txt +47 -42
  44. package/docs/samples/clean-project/report.html +3 -2
  45. package/docs/samples/clean-project/report.json +2 -1
  46. package/docs/samples/clean-project/report.md +5 -3
  47. package/docs/samples/clean-project/report.sarif.json +16 -0
  48. package/docs/samples/focused-test/report.html +3 -2
  49. package/docs/samples/focused-test/report.json +2 -1
  50. package/docs/samples/focused-test/report.md +5 -3
  51. package/docs/samples/focused-test/report.sarif.json +43 -0
  52. package/docs/samples/missing-ci/report.html +4 -3
  53. package/docs/samples/missing-ci/report.json +2 -1
  54. package/docs/samples/missing-ci/report.md +6 -4
  55. package/docs/samples/missing-ci/report.sarif.json +40 -0
  56. package/docs/samples/missing-tests/report.html +3 -2
  57. package/docs/samples/missing-tests/report.json +2 -1
  58. package/docs/samples/missing-tests/report.md +5 -3
  59. package/docs/samples/missing-tests/report.sarif.json +40 -0
  60. package/docs/samples/multi-language/report.html +4 -3
  61. package/docs/samples/multi-language/report.json +2 -1
  62. package/docs/samples/multi-language/report.md +6 -4
  63. package/docs/samples/multi-language/report.sarif.json +125 -0
  64. package/docs/samples/unsafe-names/report.html +3 -2
  65. package/docs/samples/unsafe-names/report.json +2 -1
  66. package/docs/samples/unsafe-names/report.md +5 -3
  67. package/docs/samples/unsafe-names/report.sarif.json +43 -0
  68. package/docs/status.md +5 -3
  69. package/documents/pramanasutra/00-start-here.md +7 -10
  70. package/documents/pramanasutra/01-executive-summary.md +2 -2
  71. package/documents/pramanasutra/02-functional-specification.md +4 -4
  72. package/documents/pramanasutra/03-architecture.md +1 -1
  73. package/documents/pramanasutra/04-technical-reference.md +8 -6
  74. package/documents/pramanasutra/05-user-guide.md +8 -5
  75. package/documents/pramanasutra/06-cli-and-reports.md +6 -6
  76. package/documents/pramanasutra/07-rule-catalog.md +3 -3
  77. package/documents/pramanasutra/08-skills-and-agents.md +2 -2
  78. package/documents/pramanasutra/10-legal-and-compliance.md +1 -1
  79. package/documents/pramanasutra/11-testing-and-proof.md +6 -6
  80. package/documents/pramanasutra/12-ci-and-release.md +1 -1
  81. package/documents/pramanasutra/13-roadmap-and-status.md +14 -9
  82. package/documents/pramanasutra/audit/report.html +8 -6
  83. package/documents/pramanasutra/audit/report.json +7 -5
  84. package/documents/pramanasutra/audit/report.md +10 -7
  85. package/documents/pramanasutra/audit/report.sarif.json +16 -0
  86. package/documents/pramanasutra/html/00-start-here.html +27 -15
  87. package/documents/pramanasutra/html/01-executive-summary.html +20 -7
  88. package/documents/pramanasutra/html/02-functional-specification.html +23 -10
  89. package/documents/pramanasutra/html/03-architecture.html +19 -6
  90. package/documents/pramanasutra/html/04-technical-reference.html +22 -9
  91. package/documents/pramanasutra/html/05-user-guide.html +23 -9
  92. package/documents/pramanasutra/html/06-cli-and-reports.html +24 -11
  93. package/documents/pramanasutra/html/07-rule-catalog.html +21 -8
  94. package/documents/pramanasutra/html/08-skills-and-agents.html +20 -7
  95. package/documents/pramanasutra/html/09-security-and-privacy.html +18 -5
  96. package/documents/pramanasutra/html/10-legal-and-compliance.html +19 -6
  97. package/documents/pramanasutra/html/11-testing-and-proof.html +22 -9
  98. package/documents/pramanasutra/html/12-ci-and-release.html +19 -6
  99. package/documents/pramanasutra/html/13-roadmap-and-status.html +25 -12
  100. package/documents/pramanasutra/html/14-faq-and-glossary.html +18 -5
  101. package/documents/pramanasutra/html/15-maintainer-guide.html +18 -5
  102. package/documents/pramanasutra/html/audit/report.html +8 -6
  103. package/documents/pramanasutra/html/audit/report.json +7 -5
  104. package/documents/pramanasutra/html/audit/report.md +10 -7
  105. package/documents/pramanasutra/html/audit/report.sarif.json +16 -0
  106. package/documents/pramanasutra/html/index.html +60 -42
  107. package/documents/pramanasutra/html/proof/test-results.txt +47 -42
  108. package/documents/pramanasutra/html/samples/clean-project/report.html +3 -2
  109. package/documents/pramanasutra/html/samples/clean-project/report.json +2 -1
  110. package/documents/pramanasutra/html/samples/clean-project/report.md +5 -3
  111. package/documents/pramanasutra/html/samples/clean-project/report.sarif.json +16 -0
  112. package/documents/pramanasutra/html/samples/focused-test/report.html +3 -2
  113. package/documents/pramanasutra/html/samples/focused-test/report.json +2 -1
  114. package/documents/pramanasutra/html/samples/focused-test/report.md +5 -3
  115. package/documents/pramanasutra/html/samples/focused-test/report.sarif.json +43 -0
  116. package/documents/pramanasutra/html/samples/missing-ci/report.html +4 -3
  117. package/documents/pramanasutra/html/samples/missing-ci/report.json +2 -1
  118. package/documents/pramanasutra/html/samples/missing-ci/report.md +6 -4
  119. package/documents/pramanasutra/html/samples/missing-ci/report.sarif.json +40 -0
  120. package/documents/pramanasutra/html/samples/missing-tests/report.html +3 -2
  121. package/documents/pramanasutra/html/samples/missing-tests/report.json +2 -1
  122. package/documents/pramanasutra/html/samples/missing-tests/report.md +5 -3
  123. package/documents/pramanasutra/html/samples/missing-tests/report.sarif.json +40 -0
  124. package/documents/pramanasutra/html/samples/multi-language/report.html +4 -3
  125. package/documents/pramanasutra/html/samples/multi-language/report.json +2 -1
  126. package/documents/pramanasutra/html/samples/multi-language/report.md +6 -4
  127. package/documents/pramanasutra/html/samples/multi-language/report.sarif.json +125 -0
  128. package/documents/pramanasutra/html/samples/unsafe-names/report.html +3 -2
  129. package/documents/pramanasutra/html/samples/unsafe-names/report.json +2 -1
  130. package/documents/pramanasutra/html/samples/unsafe-names/report.md +5 -3
  131. package/documents/pramanasutra/html/samples/unsafe-names/report.sarif.json +43 -0
  132. package/documents/pramanasutra/proof/test-results.txt +47 -42
  133. package/documents/pramanasutra/samples/clean-project/report.html +3 -2
  134. package/documents/pramanasutra/samples/clean-project/report.json +2 -1
  135. package/documents/pramanasutra/samples/clean-project/report.md +5 -3
  136. package/documents/pramanasutra/samples/clean-project/report.sarif.json +16 -0
  137. package/documents/pramanasutra/samples/focused-test/report.html +3 -2
  138. package/documents/pramanasutra/samples/focused-test/report.json +2 -1
  139. package/documents/pramanasutra/samples/focused-test/report.md +5 -3
  140. package/documents/pramanasutra/samples/focused-test/report.sarif.json +43 -0
  141. package/documents/pramanasutra/samples/missing-ci/report.html +4 -3
  142. package/documents/pramanasutra/samples/missing-ci/report.json +2 -1
  143. package/documents/pramanasutra/samples/missing-ci/report.md +6 -4
  144. package/documents/pramanasutra/samples/missing-ci/report.sarif.json +40 -0
  145. package/documents/pramanasutra/samples/missing-tests/report.html +3 -2
  146. package/documents/pramanasutra/samples/missing-tests/report.json +2 -1
  147. package/documents/pramanasutra/samples/missing-tests/report.md +5 -3
  148. package/documents/pramanasutra/samples/missing-tests/report.sarif.json +40 -0
  149. package/documents/pramanasutra/samples/multi-language/report.html +4 -3
  150. package/documents/pramanasutra/samples/multi-language/report.json +2 -1
  151. package/documents/pramanasutra/samples/multi-language/report.md +6 -4
  152. package/documents/pramanasutra/samples/multi-language/report.sarif.json +125 -0
  153. package/documents/pramanasutra/samples/unsafe-names/report.html +3 -2
  154. package/documents/pramanasutra/samples/unsafe-names/report.json +2 -1
  155. package/documents/pramanasutra/samples/unsafe-names/report.md +5 -3
  156. package/documents/pramanasutra/samples/unsafe-names/report.sarif.json +43 -0
  157. package/examples/sample-output/clean-project/report.html +3 -2
  158. package/examples/sample-output/clean-project/report.json +2 -1
  159. package/examples/sample-output/clean-project/report.md +5 -3
  160. package/examples/sample-output/clean-project/report.sarif.json +16 -0
  161. package/examples/sample-output/focused-test/report.html +3 -2
  162. package/examples/sample-output/focused-test/report.json +2 -1
  163. package/examples/sample-output/focused-test/report.md +5 -3
  164. package/examples/sample-output/focused-test/report.sarif.json +43 -0
  165. package/examples/sample-output/missing-ci/report.html +4 -3
  166. package/examples/sample-output/missing-ci/report.json +2 -1
  167. package/examples/sample-output/missing-ci/report.md +6 -4
  168. package/examples/sample-output/missing-ci/report.sarif.json +40 -0
  169. package/examples/sample-output/missing-tests/report.html +3 -2
  170. package/examples/sample-output/missing-tests/report.json +2 -1
  171. package/examples/sample-output/missing-tests/report.md +5 -3
  172. package/examples/sample-output/missing-tests/report.sarif.json +40 -0
  173. package/examples/sample-output/multi-language/report.html +4 -3
  174. package/examples/sample-output/multi-language/report.json +2 -1
  175. package/examples/sample-output/multi-language/report.md +6 -4
  176. package/examples/sample-output/multi-language/report.sarif.json +125 -0
  177. package/examples/sample-output/unsafe-names/report.html +3 -2
  178. package/examples/sample-output/unsafe-names/report.json +2 -1
  179. package/examples/sample-output/unsafe-names/report.md +5 -3
  180. package/examples/sample-output/unsafe-names/report.sarif.json +43 -0
  181. package/llms.txt +7 -4
  182. package/package.json +2 -2
  183. package/packages/cli/bin/pramanasutra.mjs +11 -10
  184. package/packages/cli/lib/evidence.mjs +15 -1
  185. package/packages/cli/lib/report.mjs +63 -8
  186. package/packages/cli/lib/scanner.mjs +21 -3
@@ -0,0 +1,125 @@
1
+ {
2
+ "version": "2.1.0",
3
+ "runs": [
4
+ {
5
+ "tool": {
6
+ "driver": {
7
+ "name": "PramanaSutra AI",
8
+ "version": "0.3.4",
9
+ "informationUri": "https://github.com/shahvatsalofficial/pramanasutra-ai",
10
+ "rules": [
11
+ {
12
+ "id": "SKIPPED_TEST",
13
+ "shortDescription": {
14
+ "text": "Skipped test found"
15
+ }
16
+ },
17
+ {
18
+ "id": "NO_CI",
19
+ "shortDescription": {
20
+ "text": "No recognized CI workflow discovered"
21
+ }
22
+ },
23
+ {
24
+ "id": "NO_LICENSE",
25
+ "shortDescription": {
26
+ "text": "No license file at root"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ },
32
+ "results": [
33
+ {
34
+ "ruleId": "SKIPPED_TEST",
35
+ "level": "note",
36
+ "message": {
37
+ "text": "Skipped test found"
38
+ },
39
+ "locations": [
40
+ {
41
+ "physicalLocation": {
42
+ "artifactLocation": {
43
+ "uri": "pkg/b_test.go"
44
+ },
45
+ "region": {
46
+ "startLine": 3
47
+ }
48
+ }
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ "ruleId": "SKIPPED_TEST",
54
+ "level": "note",
55
+ "message": {
56
+ "text": "Skipped test found"
57
+ },
58
+ "locations": [
59
+ {
60
+ "physicalLocation": {
61
+ "artifactLocation": {
62
+ "uri": "src/UserServiceTest.java"
63
+ },
64
+ "region": {
65
+ "startLine": 2
66
+ }
67
+ }
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ "ruleId": "SKIPPED_TEST",
73
+ "level": "note",
74
+ "message": {
75
+ "text": "Skipped test found"
76
+ },
77
+ "locations": [
78
+ {
79
+ "physicalLocation": {
80
+ "artifactLocation": {
81
+ "uri": "tests/test_api.py"
82
+ },
83
+ "region": {
84
+ "startLine": 3
85
+ }
86
+ }
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "ruleId": "NO_CI",
92
+ "level": "warning",
93
+ "message": {
94
+ "text": "No recognized CI workflow discovered"
95
+ },
96
+ "locations": [
97
+ {
98
+ "physicalLocation": {
99
+ "artifactLocation": {
100
+ "uri": "."
101
+ }
102
+ }
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ "ruleId": "NO_LICENSE",
108
+ "level": "note",
109
+ "message": {
110
+ "text": "No license file at root"
111
+ },
112
+ "locations": [
113
+ {
114
+ "physicalLocation": {
115
+ "artifactLocation": {
116
+ "uri": "."
117
+ }
118
+ }
119
+ }
120
+ ]
121
+ }
122
+ ]
123
+ }
124
+ ]
125
+ }
@@ -14,15 +14,16 @@ code{font-family:ui-monospace,Consolas,monospace;background:var(--bg);padding:.0
14
14
  @media(prefers-color-scheme:dark){.skip{color:#10201f}}
15
15
  @media print{body{background:#fff;color:#000}.card{break-inside:avoid}.skip{display:none}}
16
16
  @media(max-width:640px){body{font-size:16px}}</style></head><body><a class="skip" href="#content">Skip to content</a><main id="content">
17
- <p class="muted">PramanaSutra AI &middot; QA &amp; Release Audit &middot; Markdown, HTML and JSON are the same audit</p><h1>unsafe-names</h1><p class="muted">Generated 2026-11-06T00:00:00.000Z &middot; schema 1.0.0 &middot; tool 0.3.0</p>
17
+ <p class="muted">PramanaSutra AI &middot; QA &amp; Release Audit &middot; Markdown, HTML, JSON and SARIF are the same audit</p><h1>unsafe-names</h1><p class="muted">Generated 2026-11-06T00:00:00.000Z &middot; schema 1.0.0 &middot; tool 0.3.4</p>
18
18
  <section class="card banner NO_GO" role="status"><p class="muted" style="margin:0">Release decision</p><p style="margin:.35rem 0"><span class="pill NO_GO">NO_GO</span></p><p style="margin:.4rem 0 0">Blocking issue found. Do not release until it is fixed and re-checked.</p><p class="muted" style="margin:.35rem 0 0">Policy: recommended &middot; Supplied test evidence: absent</p></section>
19
19
  <section class="grid" aria-label="Summary"><div class="stat card"><b>5</b><span>files inspected</span></div><div class="stat card"><b>2</b><span>test files</span></div><div class="stat card"><b>1</b><span>CI workflows</span></div><div class="stat card"><b>1</b><span>findings</span></div><div class="stat card"><b>1</b><span>critical + high</span></div></section>
20
20
  <p class="card"><strong>Tests executed by PramanaSutra: NO (static scan only). Executed-test results count only when supplied as evidence.</strong></p>
21
- <h2>Supplied test evidence</h2><div class="card"><p>No evidence file was supplied. Counts on this page are not test results. The release gate cannot treat the suite as passed.</p></div>
21
+ <h2>Supplied test evidence</h2><div class="card"><p>No evidence file was supplied. Counts on this page are not test results. The release gate cannot treat the suite as passed.</p><p>Evidence binding: none. No evidence file was supplied.</p></div>
22
22
  <h2>Findings at a glance</h2><div class="card" style="overflow-x:auto"><table><thead><tr><th>Severity</th><th>Rule</th><th>Where</th><th>Fix</th></tr></thead><tbody><tr><td><span class="pill high">high</span></td><td><code>FOCUSED_TEST</code></td><td><code>tests/a &amp; b (x) $y &#39;q&#39;.test.js:2</code></td><td>Remove .only / fit / fdescribe, then execute the full suite.</td></tr></tbody></table></div>
23
23
  <h2>Findings</h2><article class="card"><h3 style="margin:.1rem 0"><span class="pill high">high</span> Focused test found</h3><p class="muted">Rule <code>FOCUSED_TEST</code> &middot; confidence medium &middot; observed &middot; <code>tests/a &amp; b (x) $y &#39;q&#39;.test.js:2</code></p><p><strong>Why it matters:</strong> A focused test declaration may silently omit other tests.</p><p><strong>Fix:</strong> Remove .only / fit / fdescribe, then execute the full suite.</p></article>
24
24
  <h2>Test files seen</h2><div class="card"><ul><li><code>tests/a &amp; b (x) $y &#39;q&#39;.test.js</code></li><li><code>tests/ünïcode 测试.test.js</code></li></ul></div>
25
25
  <h2>CI workflows seen</h2><div class="card"><ul><li><code>.github/workflows/ci.yml</code></li></ul></div>
26
+
26
27
  <h2>Release gate reasons</h2><div class="card"><ul><li>Found 1 blocking static finding(s) under policy &quot;recommended&quot;.</li></ul></div>
27
28
  <h2>Capabilities</h2><div class="card" style="overflow-x:auto"><table><thead><tr><th>Capability</th><th>State</th><th>What that means</th></tr></thead><tbody><tr><th scope="row">staticAudit</th><td><code>executed</code></td><td>Source text was inspected with heuristic rules.</td></tr><tr><th scope="row">testExecution</th><td><code>not-run</code></td><td>not-run means this tool did not execute tests. evidence-supplied means an evidence file was attached.</td></tr><tr><th scope="row">browser</th><td><code>not-supported</code></td><td>No browser was launched.</td></tr><tr><th scope="row">securityScan</th><td><code>not-run</code></td><td>This is not a vulnerability scanner.</td></tr><tr><th scope="row">performanceTest</th><td><code>not-run</code></td><td>No load or timing test was run.</td></tr><tr><th scope="row">aiInference</th><td><code>not-run</code></td><td>The CLI did not call a model.</td></tr></tbody></table></div>
28
29
  <h2>Limitations</h2><div class="card"><ul><li>Heuristic checks do not prove the absence of bugs or release readiness.</li><li>No target tests, security scanners, browser, load tests or deploy checks were run by this tool.</li><li>This report is decision support, not a compliance certification or legal advice.</li></ul></div>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
3
  "product": "PramanaSutra AI",
4
- "toolVersion": "0.3.0",
4
+ "toolVersion": "0.3.4",
5
5
  "generatedAt": "2026-11-06T00:00:00.000Z",
6
6
  "scannedPath": "unsafe-names",
7
7
  "capabilities": {
@@ -24,6 +24,7 @@
24
24
  "ciWorkflows": [
25
25
  ".github/workflows/ci.yml"
26
26
  ],
27
+ "changedFiles": null,
27
28
  "skippedSymlinks": 0,
28
29
  "oversizedFiles": 0,
29
30
  "binaryFiles": 0,
@@ -1,12 +1,12 @@
1
1
  # PramanaSutra AI: QA & Release Audit Report
2
2
 
3
- This audit is three files with the same facts: **report.md** (this file), **report.html** (open in a browser) and **report.json** (for CI). A static finding is text the scanner saw. It is not a test PramanaSutra ran.
3
+ This audit is four files with the same facts: **report.md** (this file), **report.html** (open in a browser), **report.json** (for tools) and **report.sarif.json** (SARIF 2.1.0 for code scanning). A static finding is text the scanner saw. It is not a test PramanaSutra ran.
4
4
 
5
5
  | | |
6
6
  |---|---|
7
7
  | Project | `unsafe-names` |
8
8
  | Generated | 2026-11-06T00:00:00.000Z |
9
- | Tool | PramanaSutra AI 0.3.0 (schema 1.0.0) |
9
+ | Tool | PramanaSutra AI 0.3.4 (schema 1.0.0) |
10
10
  | **Release decision** | **NO_GO** |
11
11
  | Policy | recommended |
12
12
  | Supplied test evidence | absent |
@@ -26,6 +26,8 @@ This audit is three files with the same facts: **report.md** (this file), **repo
26
26
 
27
27
  No evidence file was supplied. Counts below are not test results. The release gate cannot treat the suite as passed.
28
28
 
29
+ Evidence binding: none. No evidence file was supplied.
30
+
29
31
  ## Findings at a glance
30
32
 
31
33
  | Severity | Rule | Where | Fix |
@@ -72,4 +74,4 @@ No evidence file was supplied. Counts below are not test results. The release ga
72
74
  - This report is decision support, not a compliance certification or legal advice.
73
75
 
74
76
  ---
75
- *Created by Vatsal Shah. Generated locally; nothing was sent over the network. Same audit: report.html and report.json.*
77
+ *Created by Vatsal Shah. Generated locally; nothing was sent over the network. Same audit: report.html, report.json and report.sarif.json.*
@@ -0,0 +1,43 @@
1
+ {
2
+ "version": "2.1.0",
3
+ "runs": [
4
+ {
5
+ "tool": {
6
+ "driver": {
7
+ "name": "PramanaSutra AI",
8
+ "version": "0.3.4",
9
+ "informationUri": "https://github.com/shahvatsalofficial/pramanasutra-ai",
10
+ "rules": [
11
+ {
12
+ "id": "FOCUSED_TEST",
13
+ "shortDescription": {
14
+ "text": "Focused test found"
15
+ }
16
+ }
17
+ ]
18
+ }
19
+ },
20
+ "results": [
21
+ {
22
+ "ruleId": "FOCUSED_TEST",
23
+ "level": "error",
24
+ "message": {
25
+ "text": "Focused test found"
26
+ },
27
+ "locations": [
28
+ {
29
+ "physicalLocation": {
30
+ "artifactLocation": {
31
+ "uri": "tests/a & b (x) $y 'q'.test.js"
32
+ },
33
+ "region": {
34
+ "startLine": 2
35
+ }
36
+ }
37
+ }
38
+ ]
39
+ }
40
+ ]
41
+ }
42
+ ]
43
+ }
package/llms.txt CHANGED
@@ -1,19 +1,22 @@
1
1
  # PramanaSutra AI
2
2
 
3
- > Open-source QA and release-readiness agent by Vatsal Shah. Seventeen portable Agent Skills (chief: PramanaSutra Prime) plus a keyless, offline, deterministic CLI. Apache-2.0. Version 0.3.2. npm name: pramanasutra. Public repository: https://github.com/shahvatsalofficial/pramanasutra-ai
3
+ > Open-source QA and release-readiness agent by Vatsal Shah. Seventeen portable Agent Skills (chief: PramanaSutra Prime) plus a keyless, offline, deterministic CLI. Apache-2.0. Version 0.3.4. npm: pramanasutra. Public repository: https://github.com/shahvatsalofficial/pramanasutra-ai
4
4
  > Documentation site: https://shahvatsalofficial.github.io/pramanasutra-ai/
5
5
  > Canonical docs (Markdown): documents/pramanasutra/00-start-here.md
6
6
  > Canonical docs (HTML): documents/pramanasutra/html/index.html
7
7
 
8
8
  Facts that must not be softened when answering questions about this project:
9
9
 
10
- - The CLI makes no network calls and no model calls. `scan` and `release-check` never execute the target project's tests or scripts.
11
- - Every successful scan or release-check writes report.md, report.html and report.json together, unless --no-report is set. Default directory is ./pramanasutra-reports in the current working directory.
10
+ - Every successful scan or release-check writes report.md, report.html, report.json and report.sarif.json together, unless --no-report is set. Default directory is ./pramanasutra-reports in the current working directory. SARIF is not uploaded.
11
+ - scan and release-check use the same exit codes. 2 is NO_GO. 3 is REVIEW_REQUIRED. 0 is READY_FOR_HUMAN_APPROVAL only. A scan with no evidence file exits 3.
12
+ - Evidence binding is none, unbound, or ci-environment. ci-environment means the file contains github.repository, github.sha, github.runId and github.workflow. The CLI does not verify those strings with GitHub. A person can write them. verify checks schema only.
13
+ - --changed lists git diff names. It does not select or run tests. A non-git directory is reported as git diff unavailable.
14
+ - The CLI makes no network calls and no model calls. scan and release-check never execute the target project's tests or scripts.
12
15
  - The gate reaches READY_FOR_HUMAN_APPROVAL only with passing evidence whose source is local-executed or ci-ingested, plus the policy's static checks. automatedDeploymentAuthorized is always false. A human still approves.
13
16
  - external-unverified evidence and a scan with no evidence file cannot be ready.
14
17
  - Rules are single-line heuristics. Fixture precision is a regression lock written by the rule author, not measured field accuracy.
15
18
  - Host adapters copy skills to documented paths. Live behaviour in each IDE has not been smoke-tested.
16
- - npm name is the unscoped package `pramanasutra`. `@shahvatsal/pramanasutra@0.3.1` was published and then deleted. `@vatsalshah/pramanasutra` returned 404. Until `npm view pramanasutra version` prints `0.3.2`, run `npx github:shahvatsalofficial/pramanasutra-ai`.
19
+ - npm package is `pramanasutra`. Install with `npx pramanasutra` or `npm install -g pramanasutra`.
17
20
  - The name PramanaSutra is not claimed as a registered trademark. A clearance search has not been completed. Output is not legal advice, not a certification, and not a security assessment.
18
21
  - Required CI is Ubuntu and Windows, Node 20 and 22. macOS is not scheduled: GitHub cancelled those jobs with zero steps (runs 41884015367 and 42098256304). That is not a pass and not a test failure.
19
22
  - .pramanasutraignore excludes paths and the report discloses the exclusion. This repo excludes fixtures/ and examples/sample-app/.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pramanasutra",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "PramanaSutra AI: open-source AI QA, test automation and release-readiness agent skills for Claude Code, Cursor, Codex, GitHub Copilot and Gemini CLI, plus a keyless, offline, evidence-first CLI.",
5
5
  "keywords": [
6
6
  "qa",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "license": "Apache-2.0",
26
26
  "author": "Vatsal Shah",
27
- "homepage": "https://github.com/shahvatsalofficial/pramanasutra-ai#readme",
27
+ "homepage": "https://shahvatsalofficial.github.io/pramanasutra-ai/",
28
28
  "repository": {
29
29
  "type": "git",
30
30
  "url": "git+https://github.com/shahvatsalofficial/pramanasutra-ai.git"
@@ -13,18 +13,19 @@ Usage:
13
13
  pramanasutra version
14
14
  pramanasutra doctor [--json]
15
15
  pramanasutra agents list [--json]
16
- pramanasutra scan --path <dir> [--out <dir>] [--no-report] [--json]
17
- pramanasutra release-check --path <dir> [--evidence <file>] [--policy <file>] [--out <dir>] [--no-report] [--json]
16
+ pramanasutra scan --path <dir> [--changed] [--out <dir>] [--no-report] [--json]
17
+ pramanasutra release-check --path <dir> [--evidence <file>] [--policy <file>] [--changed] [--out <dir>] [--no-report] [--json]
18
18
  pramanasutra verify --evidence <file> [--json]
19
19
  pramanasutra init --ide <${supportedIdes.join('|')}|all> --target <existing-dir> [--force]
20
20
  pramanasutra help
21
21
 
22
- Exit codes: 0 success or READY_FOR_HUMAN_APPROVAL; 1 invalid input/error; 2 NO_GO; 3 REVIEW_REQUIRED.
23
- Every scan and release-check writes three files together: report.md and report.html for people, report.json for tools.
24
- Default directory: ./pramanasutra-reports. Change it with --out. Skip files with --no-report.
22
+ Exit codes: 0 READY_FOR_HUMAN_APPROVAL or a non-gate command; 1 invalid input/error; 2 NO_GO; 3 REVIEW_REQUIRED.
23
+ Every scan and release-check writes report.md, report.html, report.json and report.sarif.json unless you pass --no-report.
24
+ scan and release-check use the same exit codes. Exit 0 is only READY_FOR_HUMAN_APPROVAL. A scan with no evidence file is REVIEW_REQUIRED.
25
+ Default directory: ./pramanasutra-reports. Change it with --out. --changed lists git diff names. It does not choose tests.
25
26
  Static audit NEVER executes project tests. No additional AI key required.`;
26
27
  const OPTION_VALUE = new Set(['--path','--out','--ide','--target','--evidence','--policy']);
27
- const OPTION_FLAG = new Set(['--force','--json','--no-report']);
28
+ const OPTION_FLAG = new Set(['--force','--json','--no-report','--changed']);
28
29
  function parse(raw) {
29
30
  const flags={}; const words=[];
30
31
  for(let i=0;i<raw.length;i++) {
@@ -69,17 +70,17 @@ export function main(rawArgs=process.argv.slice(2)) {
69
70
  if(command==='scan' || command==='release-check') {
70
71
  if(!flags.path) throw new Error(`Use ${command} --path <existing directory>`);
71
72
  if(command==='scan' && (flags.evidence||flags.policy)) throw new Error('--evidence and --policy apply to release-check only');
72
- const report=scanProject(flags.path);
73
+ const report=scanProject(flags.path, { changed: !!flags.changed });
73
74
  const evidence=flags.evidence && command==='release-check' ? loadEvidence(flags.evidence) : null;
74
75
  report.releaseGate=evaluateGate(report,evidence,loadPolicy(flags.policy));
75
76
  if(evidence) {
76
77
  report.capabilities.testExecution='evidence-supplied';
77
- report.evidence={source:evidence.source,command:evidence.command,executedAt:evidence.executedAt,exitCode:evidence.exitCode,passed:evidence.passed,failed:evidence.failed,skipped:evidence.skipped,environment:evidence.environment,commit:evidence.commit};
78
+ report.evidence={source:evidence.source,command:evidence.command,executedAt:evidence.executedAt,exitCode:evidence.exitCode,passed:evidence.passed,failed:evidence.failed,skipped:evidence.skipped,environment:evidence.environment,commit:evidence.commit,github:evidence.github};
78
79
  }
79
80
  const outputs=flags['no-report']?[]:writeReports(report,flags.out||'pramanasutra-reports');
80
81
  if(flags.json) emit(report,true);
81
- else console.log(`PramanaSutra ${command}: ${report.inventory.fileCount} file(s), ${report.inventory.testFiles.length} test file(s), ${report.findings.length} finding(s). Gate: ${report.releaseGate.decision}. Tests executed by this tool: NO. Evidence: ${report.releaseGate.evidenceState}.\n${outputs.length?'Reports (Markdown, HTML, JSON): '+outputs.join(', '):'Reports not written (--no-report).'}`);
82
- return command==='release-check' ? ({NO_GO:2,REVIEW_REQUIRED:3}[report.releaseGate.decision]??0) : 0;
82
+ else console.log(`PramanaSutra ${command}: ${report.inventory.fileCount} file(s), ${report.inventory.testFiles.length} test file(s), ${report.findings.length} finding(s). Gate: ${report.releaseGate.decision}. Tests executed by this tool: NO. Evidence: ${report.releaseGate.evidenceState}.\n${outputs.length?'Reports (Markdown, HTML, JSON, SARIF): '+outputs.join(', '):'Reports not written (--no-report).'}`);
83
+ return ({NO_GO:2,REVIEW_REQUIRED:3}[report.releaseGate.decision]??0);
83
84
  }
84
85
  throw new Error(`Unknown command: ${words.join(' ')}`);
85
86
  } catch(err) {
@@ -27,12 +27,26 @@ export function validateEvidence(data) {
27
27
  if (!count(data.passed)) errors.push('passed must be a non-negative integer');
28
28
  if (!count(data.failed)) errors.push('failed must be a non-negative integer');
29
29
  if (data.skipped !== undefined && !count(data.skipped)) errors.push('skipped must be a non-negative integer when present');
30
+ let github = null;
31
+ if (data.github !== undefined) {
32
+ const g = data.github;
33
+ if (!g || typeof g !== 'object' || Array.isArray(g)) errors.push('github must be an object when present');
34
+ else {
35
+ for (const key of ['repository', 'sha', 'runId', 'workflow']) {
36
+ if (typeof g[key] !== 'string' || !g[key].trim()) errors.push(`github.${key} must be a non-empty string`);
37
+ }
38
+ if (!errors.some((item) => item.startsWith('github.'))) {
39
+ github = { repository: g.repository, sha: g.sha, runId: g.runId, workflow: g.workflow };
40
+ }
41
+ }
42
+ }
30
43
  if (errors.length) throw new Error(`Invalid evidence: ${errors.join('; ')}`);
31
44
  return {
32
45
  schemaVersion: data.schemaVersion, source: data.source, command: data.command, executedAt: data.executedAt,
33
46
  exitCode: data.exitCode, passed: data.passed, failed: data.failed, skipped: data.skipped ?? 0,
34
47
  environment: typeof data.environment === 'string' ? data.environment : null,
35
- commit: typeof data.commit === 'string' ? data.commit : null
48
+ commit: typeof data.commit === 'string' ? data.commit : null,
49
+ github
36
50
  };
37
51
  }
38
52
 
@@ -11,7 +11,14 @@ const GATE_TEXT = {
11
11
  REVIEW_REQUIRED: 'Evidence is missing or incomplete. A human must review before any release decision.',
12
12
  READY_FOR_HUMAN_APPROVAL: 'All policy checks passed. A human must still approve; this is never a deploy order.'
13
13
  };
14
+ const CI_NONE = 'None recognised (GitHub Actions, GitLab CI, Jenkins, Azure Pipelines, Bitbucket Pipelines, CircleCI, Buildkite, Drone, Woodpecker).';
14
15
  const NOT_RUN = 'Tests executed by PramanaSutra: NO (static scan only). Executed-test results count only when supplied as evidence.';
16
+
17
+ export function bindingText(ev) {
18
+ if (!ev) return 'Evidence binding: none. No evidence file was supplied.';
19
+ if (ev.github) return 'Evidence binding: ci-environment. The file names a repository, commit, run id and workflow. PramanaSutra did not verify those values with GitHub. A person can still write them by hand.';
20
+ return 'Evidence binding: unbound. This JSON is not tied to a CI identity. A passing file is not proof the command ran.';
21
+ }
15
22
  const LIMITS = [
16
23
  'Heuristic checks do not prove the absence of bugs or release readiness.',
17
24
  'No target tests, security scanners, browser, load tests or deploy checks were run by this tool.',
@@ -31,7 +38,7 @@ export function markdown(report) {
31
38
  const ev = report.evidence || null;
32
39
  const L = [];
33
40
  L.push('# PramanaSutra AI: QA & Release Audit Report', '');
34
- L.push('This audit is three files with the same facts: **report.md** (this file), **report.html** (open in a browser) and **report.json** (for CI). A static finding is text the scanner saw. It is not a test PramanaSutra ran.', '');
41
+ L.push('This audit is four files with the same facts: **report.md** (this file), **report.html** (open in a browser), **report.json** (for tools) and **report.sarif.json** (SARIF 2.1.0 for code scanning). A static finding is text the scanner saw. It is not a test PramanaSutra ran.', '');
35
42
  L.push('| | |', '|---|---|');
36
43
  L.push(`| Project | \`${escMd(report.scannedPath)}\` |`);
37
44
  L.push(`| Generated | ${escMd(report.generatedAt)} |`);
@@ -44,6 +51,7 @@ export function markdown(report) {
44
51
  L.push('## Supplied test evidence', '');
45
52
  if (!ev) {
46
53
  L.push('No evidence file was supplied. Counts below are not test results. The release gate cannot treat the suite as passed.', '');
54
+ L.push(bindingText(ev), '');
47
55
  } else {
48
56
  L.push('These numbers come from the evidence file the operator supplied. PramanaSutra did not run that command.', '');
49
57
  L.push('| Field | Value |', '|---|---|');
@@ -56,7 +64,14 @@ export function markdown(report) {
56
64
  L.push(`| Skipped | ${escMd(ev.skipped ?? 0)} |`);
57
65
  if (ev.environment) L.push(`| Environment | ${escMd(ev.environment)} |`);
58
66
  if (ev.commit) L.push(`| Commit | \`${escMd(ev.commit)}\` |`);
67
+ if (ev.github) {
68
+ L.push(`| GitHub repository | \`${escMd(ev.github.repository)}\` |`);
69
+ L.push(`| GitHub commit | \`${escMd(ev.github.sha)}\` |`);
70
+ L.push(`| GitHub run | \`${escMd(ev.github.runId)}\` |`);
71
+ L.push(`| GitHub workflow | \`${escMd(ev.github.workflow)}\` |`);
72
+ }
59
73
  L.push('');
74
+ L.push(bindingText(ev), '');
60
75
  }
61
76
  L.push('## Findings at a glance', '');
62
77
  if (!report.findings.length) L.push('No static issues detected. This does **not** mean the project is release-ready; other checks were not run.', '');
@@ -73,7 +88,11 @@ export function markdown(report) {
73
88
  L.push('## Test files seen', '');
74
89
  L.push(...listOrNote(report.inventory.testFiles, 'None. Either there are no tests, or they use a naming convention this scanner does not recognise.'));
75
90
  L.push('## CI workflows seen', '');
76
- L.push(...listOrNote(report.inventory.ciWorkflows, 'None recognised (GitHub Actions, GitLab CI, Jenkins, Azure Pipelines, Bitbucket Pipelines).'));
91
+ L.push(...listOrNote(report.inventory.ciWorkflows, CI_NONE));
92
+ if (Array.isArray(report.inventory.changedFiles)) {
93
+ L.push('## Changed files', '', 'These names came from `git diff`. They are not a list of tests to run.', '');
94
+ L.push(...listOrNote(report.inventory.changedFiles, 'git reported no changed files.'));
95
+ }
77
96
  L.push('## Capabilities', '', '| Capability | State | What that means |', '|---|---|---|');
78
97
  const capHelp = {
79
98
  staticAudit: 'Source text was inspected with heuristic rules.',
@@ -88,7 +107,7 @@ export function markdown(report) {
88
107
  for (const r of (gate ? gate.reasons : ['Not requested'])) L.push(`- ${escMd(r)}`);
89
108
  L.push('', '## Limitations', '');
90
109
  for (const lim of [...report.limitations, ...LIMITS]) L.push(`- ${escMd(lim)}`);
91
- L.push('', '---', '*Created by Vatsal Shah. Generated locally; nothing was sent over the network. Same audit: report.html and report.json.*', '');
110
+ L.push('', '---', '*Created by Vatsal Shah. Generated locally; nothing was sent over the network. Same audit: report.html, report.json and report.sarif.json.*', '');
92
111
  return L.join('\n');
93
112
  }
94
113
 
@@ -131,7 +150,7 @@ export function html(report) {
131
150
  const stat = (n, label) => `<div class="stat card"><b>${e(n)}</b><span>${e(label)}</span></div>`;
132
151
  const fileList = (items, empty) => items.length ? `<ul>${items.slice(0, 40).map(x => `<li><code>${e(x)}</code></li>`).join('')}${items.length > 40 ? `<li>… ${e(items.length - 40)} more not listed.</li>` : ''}</ul>` : `<p>${e(empty)}</p>`;
133
152
  const evidence = !ev
134
- ? '<p>No evidence file was supplied. Counts on this page are not test results. The release gate cannot treat the suite as passed.</p>'
153
+ ? `<p>No evidence file was supplied. Counts on this page are not test results. The release gate cannot treat the suite as passed.</p><p>${e(bindingText(ev))}</p>`
135
154
  : `<p>These numbers come from the evidence file the operator supplied. PramanaSutra did not run that command.</p><table><tbody>
136
155
  <tr><th scope="row">Source</th><td><code>${e(ev.source)}</code></td></tr>
137
156
  <tr><th scope="row">Command</th><td><code>${e(ev.command)}</code></td></tr>
@@ -142,9 +161,10 @@ export function html(report) {
142
161
  <tr><th scope="row">Skipped</th><td>${e(ev.skipped ?? 0)}</td></tr>
143
162
  ${ev.environment ? `<tr><th scope="row">Environment</th><td>${e(ev.environment)}</td></tr>` : ''}
144
163
  ${ev.commit ? `<tr><th scope="row">Commit</th><td><code>${e(ev.commit)}</code></td></tr>` : ''}
145
- </tbody></table>`;
164
+ ${ev.github ? `<tr><th scope="row">GitHub repository</th><td><code>${e(ev.github.repository)}</code></td></tr><tr><th scope="row">GitHub commit</th><td><code>${e(ev.github.sha)}</code></td></tr><tr><th scope="row">GitHub run</th><td><code>${e(ev.github.runId)}</code></td></tr><tr><th scope="row">GitHub workflow</th><td><code>${e(ev.github.workflow)}</code></td></tr>` : ''}
165
+ </tbody></table><p>${e(bindingText(ev))}</p>`;
146
166
  return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="color-scheme" content="light dark"><meta name="description" content="PramanaSutra AI QA and release audit report. Decision support, not a certification."><title>PramanaSutra AI QA &amp; Release Audit Report</title><style>${CSS}</style></head><body><a class="skip" href="#content">Skip to content</a><main id="content">
147
- <p class="muted">PramanaSutra AI &middot; QA &amp; Release Audit &middot; Markdown, HTML and JSON are the same audit</p><h1>${e(report.scannedPath)}</h1><p class="muted">Generated ${e(report.generatedAt)} &middot; schema ${e(report.schemaVersion)} &middot; tool ${e(report.toolVersion || '')}</p>
167
+ <p class="muted">PramanaSutra AI &middot; QA &amp; Release Audit &middot; Markdown, HTML, JSON and SARIF are the same audit</p><h1>${e(report.scannedPath)}</h1><p class="muted">Generated ${e(report.generatedAt)} &middot; schema ${e(report.schemaVersion)} &middot; tool ${e(report.toolVersion || '')}</p>
148
168
  ${gate ? `<section class="card banner ${e(gate.decision)}" role="status"><p class="muted" style="margin:0">Release decision</p><p style="margin:.35rem 0"><span class="pill ${e(gate.decision)}">${e(gate.decision)}</span></p><p style="margin:.4rem 0 0">${e(GATE_TEXT[gate.decision])}</p><p class="muted" style="margin:.35rem 0 0">Policy: ${e(gate.policy)} &middot; Supplied test evidence: ${e(gate.evidenceState)}</p></section>` : '<p class="card">Release decision: not evaluated. This was a scan without a gate.</p>'}
149
169
  <section class="grid" aria-label="Summary">${stat(report.inventory.fileCount, 'files inspected')}${stat(report.inventory.testFiles.length, 'test files')}${stat(report.inventory.ciWorkflows.length, 'CI workflows')}${stat(report.findings.length, 'findings')}${stat(c.critical + c.high, 'critical + high')}</section>
150
170
  <p class="card"><strong>${e(NOT_RUN)}</strong></p>
@@ -152,18 +172,53 @@ ${gate ? `<section class="card banner ${e(gate.decision)}" role="status"><p clas
152
172
  <h2>Findings at a glance</h2>${report.findings.length ? `<div class="card" style="overflow-x:auto"><table><thead><tr><th>Severity</th><th>Rule</th><th>Where</th><th>Fix</th></tr></thead><tbody>${glance}</tbody></table></div>` : '<p class="card">No static issues detected. This does <strong>not</strong> mean the project is release-ready; other checks were not run.</p>'}
153
173
  <h2>Findings</h2>${cards || '<p class="card">None.</p>'}
154
174
  <h2>Test files seen</h2><div class="card">${fileList(report.inventory.testFiles, 'None. Either there are no tests, or they use a naming convention this scanner does not recognise.')}</div>
155
- <h2>CI workflows seen</h2><div class="card">${fileList(report.inventory.ciWorkflows, 'None recognised (GitHub Actions, GitLab CI, Jenkins, Azure Pipelines, Bitbucket Pipelines).')}</div>
175
+ <h2>CI workflows seen</h2><div class="card">${fileList(report.inventory.ciWorkflows, CI_NONE)}</div>
176
+ ${Array.isArray(report.inventory.changedFiles) ? `<h2>Changed files</h2><div class="card"><p>These names came from git diff. They are not a list of tests to run.</p>${fileList(report.inventory.changedFiles, 'git reported no changed files.')}</div>` : ''}
156
177
  <h2>Release gate reasons</h2><div class="card"><ul>${reasons}</ul></div>
157
178
  <h2>Capabilities</h2><div class="card" style="overflow-x:auto"><table><thead><tr><th>Capability</th><th>State</th><th>What that means</th></tr></thead><tbody>${caps}</tbody></table></div>
158
179
  <h2>Limitations</h2><div class="card"><ul>${lims}</ul></div>
159
180
  <footer>Created by Vatsal Shah. Generated locally; nothing was sent over the network. Not a compliance certification, a security test, or a release authorization. Open <code>report.md</code> for the same audit in Markdown.</footer></main></body></html>`;
160
181
  }
161
182
 
183
+ export function sarif(report) {
184
+ const rules = [...new Map(report.findings.map((finding) => [finding.ruleId, finding])).values()];
185
+ const level = (severity) => (severity === 'critical' || severity === 'high' ? 'error' : severity === 'medium' ? 'warning' : 'note');
186
+ return {
187
+ version: '2.1.0',
188
+ runs: [{
189
+ tool: {
190
+ driver: {
191
+ name: 'PramanaSutra AI',
192
+ version: String(report.toolVersion || ''),
193
+ informationUri: 'https://github.com/shahvatsalofficial/pramanasutra-ai',
194
+ rules: rules.map((finding) => ({ id: finding.ruleId, shortDescription: { text: finding.title } }))
195
+ }
196
+ },
197
+ results: report.findings.map((finding) => ({
198
+ ruleId: finding.ruleId,
199
+ level: level(finding.severity),
200
+ message: { text: finding.title },
201
+ locations: [{
202
+ physicalLocation: {
203
+ artifactLocation: { uri: finding.evidence.path },
204
+ ...(finding.evidence.line ? { region: { startLine: finding.evidence.line } } : {})
205
+ }
206
+ }]
207
+ }))
208
+ }]
209
+ };
210
+ }
211
+
162
212
  export function writeReports(report, out) {
163
213
  if (!out) return [];
164
214
  const target = path.resolve(out);
165
215
  fs.mkdirSync(target, { recursive: true });
166
- const outputs = [['report.md', markdown(report)], ['report.html', html(report)], ['report.json', JSON.stringify(report, null, 2) + '\n']];
216
+ const outputs = [
217
+ ['report.md', markdown(report)],
218
+ ['report.html', html(report)],
219
+ ['report.json', JSON.stringify(report, null, 2) + '\n'],
220
+ ['report.sarif.json', JSON.stringify(sarif(report), null, 2) + '\n']
221
+ ];
167
222
  for (const [file, content] of outputs) fs.writeFileSync(path.join(target, file), content, 'utf8');
168
223
  return outputs.map(([file]) => path.join(target, file));
169
224
  }
@@ -1,3 +1,4 @@
1
+ import { spawnSync } from 'node:child_process';
1
2
  import fs from 'node:fs';
2
3
  import path from 'node:path';
3
4
  import { classifyEvidence } from './evidence.mjs';
@@ -45,7 +46,18 @@ function existsFile(root, rel) {
45
46
  try { return fs.statSync(path.join(root, rel)).isFile(); } catch { return false; }
46
47
  }
47
48
 
48
- export function scanProject(target) {
49
+ function readChanged(root) {
50
+ const unavailable = { files: null, note: 'git diff was not available for this directory, so no changed-file list was collected.' };
51
+ const probe = spawnSync('git', ['-C', root, 'rev-parse', '--is-inside-work-tree'], { encoding: 'utf8' });
52
+ if (probe.status !== 0) return unavailable;
53
+ const diff = spawnSync('git', ['-C', root, 'diff', '--name-only', 'HEAD'], { encoding: 'utf8' });
54
+ const staged = spawnSync('git', ['-C', root, 'diff', '--name-only', '--cached'], { encoding: 'utf8' });
55
+ if (diff.status !== 0) return unavailable;
56
+ const files = [...new Set(`${diff.stdout || ''}\n${staged.stdout || ''}`.split(/\r?\n/).map((line) => line.trim()).filter(Boolean))].sort();
57
+ return { files, note: 'Changed-file list is names from git diff. It is not a selection of tests to run.' };
58
+ }
59
+
60
+ export function scanProject(target, options = {}) {
49
61
  const targetPath = path.resolve(target);
50
62
  const info = fs.lstatSync(targetPath);
51
63
  if (!info.isDirectory() || info.isSymbolicLink()) throw new Error('Scan target must be a real directory (not a symlink)');
@@ -84,7 +96,7 @@ export function scanProject(target) {
84
96
  const testFiles = entries.filter(isTestFile);
85
97
  const findings = [];
86
98
  const manifests = entries.filter(p => /(?:^|\/)(?:package\.json|pyproject\.toml|requirements\.txt|pom\.xml|build\.gradle(?:\.kts)?|Cargo\.toml|go\.mod|Gemfile|composer\.json|pubspec\.yaml|[^/]+\.sln|[^/]+\.csproj)$/.test(p));
87
- const workflows = entries.filter(p => /^\.github\/workflows\/[^/]+\.ya?ml$/.test(p) || /(?:^|\/)(?:\.gitlab-ci\.yml|Jenkinsfile|azure-pipelines\.yml|bitbucket-pipelines\.yml)$/.test(p));
99
+ const workflows = entries.filter(p => /^\.github\/workflows\/[^/]+\.ya?ml$/.test(p) || /(?:^|\/)(?:\.gitlab-ci\.yml|Jenkinsfile|azure-pipelines\.yml|bitbucket-pipelines\.yml|\.circleci\/config\.yml|\.buildkite\/pipeline\.yml|\.drone\.yml|woodpecker\.ya?ml)$/.test(p));
88
100
  for (const rel of testFiles) {
89
101
  if (!SOURCE_EXT.test(rel)) continue;
90
102
  const full=path.join(targetPath,...rel.split('/'));
@@ -107,6 +119,12 @@ export function scanProject(target) {
107
119
  if (oversizedFiles) limitations.push(`Skipped inspecting ${oversizedFiles} large test file(s) (> ${MAX_SOURCE_SIZE} bytes).`);
108
120
  if (binaryFiles) limitations.push(`Skipped inspecting ${binaryFiles} binary test file(s); they contain NUL bytes and were not treated as source.`);
109
121
  if (ignoredPaths) limitations.push(`Excluded ${ignoredPaths} path(s) listed in .pramanasutraignore. Excluded content was not inspected.`);
122
+ let changedFiles = null;
123
+ if (options.changed) {
124
+ const changed = readChanged(targetPath);
125
+ changedFiles = changed.files;
126
+ limitations.push(changed.note);
127
+ }
110
128
  if (!testFiles.length) findings.push(finding('NO_TESTS','medium','medium','No tests discovered','No test files matched the starter\'s supported path conventions.',{path:'.',line:null},'Confirm test framework location; add and execute relevant tests.'));
111
129
  if (!workflows.length) findings.push(finding('NO_CI','medium','medium','No recognized CI workflow discovered','No recognized CI configuration was found in the files scanned.',{path:'.',line:null},'Verify your CI configuration and enforce required test gates.'));
112
130
  const license = entries.some(p => /^(?:LICENSE|LICENSE\.md|LICENSE\.txt|COPYING)$/i.test(p));
@@ -114,7 +132,7 @@ export function scanProject(target) {
114
132
  const output = {
115
133
  schemaVersion: '1.0.0', product: 'PramanaSutra AI', toolVersion: toolVersion(), generatedAt: new Date().toISOString(), scannedPath: path.basename(targetPath) || ".",
116
134
  capabilities: { staticAudit:'executed', testExecution:'not-run', browser:'not-supported', securityScan:'not-run', performanceTest:'not-run', aiInference:'not-run' },
117
- inventory: { fileCount:entries.length, testFiles, manifests, ciWorkflows:workflows, skippedSymlinks, oversizedFiles, binaryFiles, ignoredPaths, partial:truncated || oversizedFiles > 0 || binaryFiles > 0 || limitations.some(x=>x.startsWith('Unreadable')) },
135
+ inventory: { fileCount:entries.length, testFiles, manifests, ciWorkflows:workflows, changedFiles, skippedSymlinks, oversizedFiles, binaryFiles, ignoredPaths, partial:truncated || oversizedFiles > 0 || binaryFiles > 0 || limitations.some(x=>x.startsWith('Unreadable')) },
118
136
  findings, limitations,
119
137
  releaseGate: null
120
138
  };