torusguard 1.3.5 → 1.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.
Files changed (194) hide show
  1. package/.torusguard/.manifest.json +37 -36
  2. package/.torusguard/runs/report-latest.html +5862 -315
  3. package/.torusguard/runs/results-latest.sarif +20 -0
  4. package/.torusguard/runs/run-20260918-104221-audit/findings.json +1 -0
  5. package/.torusguard/runs/run-20260918-104221-audit/findings.md +8 -0
  6. package/.torusguard/runs/run-20260918-104221-audit/manifest.json +12 -0
  7. package/.torusguard/runs/run-20260918-104221-audit/summary.md +5 -0
  8. package/.torusguard/runs/run-20260918-104236-audit/findings.json +2314 -0
  9. package/.torusguard/runs/run-20260918-104236-audit/findings.md +960 -0
  10. package/.torusguard/runs/run-20260918-104236-audit/manifest.json +12 -0
  11. package/.torusguard/runs/run-20260918-104236-audit/summary.md +5 -0
  12. package/.torusguard/runs/run-20260918-105723-audit/findings.json +2382 -0
  13. package/.torusguard/runs/run-20260918-105723-audit/findings.md +960 -0
  14. package/.torusguard/runs/run-20260918-105723-audit/manifest.json +12 -0
  15. package/.torusguard/runs/run-20260918-105723-audit/summary.md +5 -0
  16. package/.torusguard/runs/run-20260918-105731-audit/findings.json +1 -0
  17. package/.torusguard/runs/run-20260918-105731-audit/findings.md +8 -0
  18. package/.torusguard/runs/run-20260918-105731-audit/manifest.json +12 -0
  19. package/.torusguard/runs/run-20260918-105731-audit/summary.md +5 -0
  20. package/.torusguard/runs/run-20260918-105940-audit/findings.json +1 -0
  21. package/.torusguard/runs/run-20260918-105940-audit/findings.md +8 -0
  22. package/.torusguard/runs/run-20260918-105940-audit/manifest.json +13 -0
  23. package/.torusguard/runs/run-20260918-105940-audit/remediation.md +7 -0
  24. package/.torusguard/runs/run-20260918-105940-audit/summary.md +5 -0
  25. package/.torusguard/runs/run-20260919-145701-audit/findings.json +1 -0
  26. package/.torusguard/runs/run-20260919-145701-audit/findings.md +8 -0
  27. package/.torusguard/runs/run-20260919-145701-audit/manifest.json +12 -0
  28. package/.torusguard/runs/run-20260919-145701-audit/summary.md +5 -0
  29. package/.torusguard/runs/run-20260919-151729-audit/findings.json +1 -0
  30. package/.torusguard/runs/run-20260919-151729-audit/findings.md +8 -0
  31. package/.torusguard/runs/run-20260919-151729-audit/manifest.json +13 -0
  32. package/.torusguard/runs/run-20260919-151729-audit/remediation.md +7 -0
  33. package/.torusguard/runs/run-20260919-151729-audit/summary.md +5 -0
  34. package/.torusguard/runs/run-20260919-152340-audit/findings.json +1 -0
  35. package/.torusguard/runs/run-20260919-152340-audit/findings.md +8 -0
  36. package/.torusguard/runs/run-20260919-152340-audit/manifest.json +12 -0
  37. package/.torusguard/runs/run-20260919-152340-audit/summary.md +5 -0
  38. package/.torusguard/runs/run-20260919-152345-audit/findings.json +1 -0
  39. package/.torusguard/runs/run-20260919-152345-audit/findings.md +8 -0
  40. package/.torusguard/runs/run-20260919-152345-audit/manifest.json +12 -0
  41. package/.torusguard/runs/run-20260919-152345-audit/summary.md +5 -0
  42. package/.torusguard/runs/run-20260919-153500-audit/findings.json +1 -0
  43. package/.torusguard/runs/run-20260919-153500-audit/findings.md +8 -0
  44. package/.torusguard/runs/run-20260919-153500-audit/manifest.json +12 -0
  45. package/.torusguard/runs/run-20260919-153500-audit/summary.md +5 -0
  46. package/.torusguard/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  47. package/.torusguard/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  48. package/.torusguard/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
  49. package/.torusguard/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  50. package/.torusguard/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  51. package/.torusguard/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  52. package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  53. package/.torusguard/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
  54. package/.torusguard/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
  55. package/.torusguard/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
  56. package/.torusguard/scripts/__pycache__/recipes_runner.cpython-314.pyc +0 -0
  57. package/.torusguard/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  58. package/.torusguard/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
  59. package/.torusguard/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  60. package/.torusguard/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
  61. package/.torusguard/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  62. package/.torusguard/scripts/apply_runner.py +108 -9
  63. package/.torusguard/scripts/audit_runner.py +336 -24
  64. package/.torusguard/scripts/harden_runner.py +124 -70
  65. package/.torusguard/scripts/html_reporter.py +3585 -648
  66. package/.torusguard/scripts/manifest_builder.py +2 -0
  67. package/.torusguard/scripts/recheck_runner.py +5 -4
  68. package/.torusguard/scripts/recipes_runner.py +91 -8
  69. package/.torusguard/scripts/report_sync.py +496 -73
  70. package/.torusguard/scripts/sarif_exporter.py +48 -8
  71. package/.torusguard/scripts/stack_detect.py +44 -2
  72. package/.torusguard/scripts/status_runner.py +267 -0
  73. package/.torusguard/scripts/term_ui.py +1 -1
  74. package/.torusguard/skills/torusguard/SKILL.md +75 -72
  75. package/.torusguard/skills/torusguard-apply/SKILL.md +84 -80
  76. package/.torusguard/skills/torusguard-audit/SKILL.md +87 -83
  77. package/.torusguard/skills/torusguard-authorize/SKILL.md +7 -2
  78. package/.torusguard/skills/torusguard-exploit-check/SKILL.md +7 -2
  79. package/.torusguard/skills/torusguard-full/SKILL.md +7 -2
  80. package/.torusguard/skills/torusguard-harden/SKILL.md +98 -94
  81. package/.torusguard/skills/torusguard-init/SKILL.md +68 -64
  82. package/.torusguard/skills/torusguard-recheck/SKILL.md +81 -77
  83. package/.torusguard/skills/torusguard-report/SKILL.md +93 -72
  84. package/.torusguard/skills/torusguard-status/SKILL.md +62 -58
  85. package/.torusguard/skills/torusguard-verify/SKILL.md +7 -2
  86. package/.torusguard/skills/torusguard-web-validate/SKILL.md +7 -2
  87. package/.torusguard/workflows/apply.md +1 -1
  88. package/.torusguard/workflows/audit.md +1 -1
  89. package/.torusguard/workflows/authorize.md +1 -1
  90. package/.torusguard/workflows/exploit-check.md +1 -1
  91. package/.torusguard/workflows/harden.md +1 -1
  92. package/.torusguard/workflows/init.md +1 -1
  93. package/.torusguard/workflows/memory.md +1 -1
  94. package/.torusguard/workflows/recheck.md +1 -1
  95. package/.torusguard/workflows/report.md +1 -1
  96. package/.torusguard/workflows/status.md +1 -1
  97. package/.torusguard/workflows/verify.md +1 -1
  98. package/.torusguard/workflows/web-validate.md +1 -1
  99. package/README.md +115 -81
  100. package/bin/torusguard.js +244 -38
  101. package/package.json +6 -2
  102. package/skills/torusguard/SKILL.md +1 -1
  103. package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
  104. package/skills/torusguard/bootstrap.py +52 -8
  105. package/skills/torusguard/payload/.manifest.json +51 -36
  106. package/skills/torusguard/payload/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  107. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-311.pyc +0 -0
  108. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  109. package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-311.pyc +0 -0
  110. package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
  111. package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-311.pyc +0 -0
  112. package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  113. package/skills/torusguard/payload/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  114. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-311.pyc +0 -0
  115. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  116. package/skills/torusguard/payload/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  117. package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-311.pyc +0 -0
  118. package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
  119. package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-311.pyc +0 -0
  120. package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
  121. package/skills/torusguard/payload/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
  122. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-311.pyc +0 -0
  123. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  124. package/skills/torusguard/payload/scripts/__pycache__/rules_sync.cpython-311.pyc +0 -0
  125. package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-311.pyc +0 -0
  126. package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
  127. package/skills/torusguard/payload/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  128. package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-311.pyc +0 -0
  129. package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
  130. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-311.pyc +0 -0
  131. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  132. package/skills/torusguard/payload/scripts/apply_runner.py +108 -9
  133. package/skills/torusguard/payload/scripts/audit_runner.py +336 -24
  134. package/skills/torusguard/payload/scripts/harden_runner.py +124 -70
  135. package/skills/torusguard/payload/scripts/html_reporter.py +3585 -648
  136. package/skills/torusguard/payload/scripts/manifest_builder.py +2 -0
  137. package/skills/torusguard/payload/scripts/recheck_runner.py +5 -4
  138. package/skills/torusguard/payload/scripts/recipes_runner.py +91 -8
  139. package/skills/torusguard/payload/scripts/report_sync.py +496 -73
  140. package/skills/torusguard/payload/scripts/sarif_exporter.py +48 -8
  141. package/skills/torusguard/payload/scripts/stack_detect.py +44 -2
  142. package/skills/torusguard/payload/scripts/status_runner.py +267 -0
  143. package/skills/torusguard/payload/scripts/term_ui.py +1 -1
  144. package/skills/torusguard/payload/skills/torusguard/SKILL.md +1 -1
  145. package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +1 -1
  146. package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +1 -1
  147. package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +1 -1
  148. package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +1 -1
  149. package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +1 -1
  150. package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +1 -1
  151. package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +1 -1
  152. package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +1 -1
  153. package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +40 -23
  154. package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +1 -1
  155. package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +1 -1
  156. package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +1 -1
  157. package/skills/torusguard/payload/workflows/apply.md +9 -1
  158. package/skills/torusguard/payload/workflows/audit.md +8 -2
  159. package/skills/torusguard/payload/workflows/authorize.md +1 -1
  160. package/skills/torusguard/payload/workflows/exploit-check.md +1 -1
  161. package/skills/torusguard/payload/workflows/harden.md +6 -1
  162. package/skills/torusguard/payload/workflows/init.md +7 -1
  163. package/skills/torusguard/payload/workflows/memory.md +1 -1
  164. package/skills/torusguard/payload/workflows/recheck.md +1 -1
  165. package/skills/torusguard/payload/workflows/recipes.md +55 -0
  166. package/skills/torusguard/payload/workflows/report.md +59 -55
  167. package/skills/torusguard/payload/workflows/status.md +4 -1
  168. package/skills/torusguard/payload/workflows/torusguard-apply.md +110 -0
  169. package/skills/torusguard/payload/workflows/torusguard-audit.md +105 -0
  170. package/skills/torusguard/payload/workflows/torusguard-authorize.md +96 -0
  171. package/skills/torusguard/payload/workflows/torusguard-exploit-check.md +98 -0
  172. package/skills/torusguard/payload/workflows/torusguard-harden.md +104 -0
  173. package/skills/torusguard/payload/workflows/torusguard-init.md +106 -0
  174. package/skills/torusguard/payload/workflows/torusguard-recheck.md +101 -0
  175. package/skills/torusguard/payload/workflows/torusguard-recipes.md +55 -0
  176. package/skills/torusguard/payload/workflows/torusguard-report.md +105 -0
  177. package/skills/torusguard/payload/workflows/torusguard-status.md +103 -0
  178. package/skills/torusguard/payload/workflows/torusguard-verify.md +100 -0
  179. package/skills/torusguard/payload/workflows/torusguard-web-validate.md +96 -0
  180. package/skills/torusguard/payload/workflows/torusguard.md +19 -0
  181. package/skills/torusguard/payload/workflows/verify.md +1 -1
  182. package/skills/torusguard/payload/workflows/web-validate.md +1 -1
  183. package/skills/torusguard-apply/SKILL.md +1 -1
  184. package/skills/torusguard-audit/SKILL.md +1 -1
  185. package/skills/torusguard-authorize/SKILL.md +1 -1
  186. package/skills/torusguard-exploit-check/SKILL.md +1 -1
  187. package/skills/torusguard-full/SKILL.md +1 -1
  188. package/skills/torusguard-harden/SKILL.md +1 -1
  189. package/skills/torusguard-init/SKILL.md +1 -1
  190. package/skills/torusguard-recheck/SKILL.md +1 -1
  191. package/skills/torusguard-report/SKILL.md +40 -23
  192. package/skills/torusguard-status/SKILL.md +1 -1
  193. package/skills/torusguard-verify/SKILL.md +1 -1
  194. package/skills/torusguard-web-validate/SKILL.md +1 -1
@@ -0,0 +1,12 @@
1
+ {
2
+ "run_id": "run-20260918-105723-audit",
3
+ "command": "audit",
4
+ "target_name": "TorusGuard",
5
+ "created_at": "2026-09-18 10:57:23 IST",
6
+ "created_at_iso": "2026-09-18T10:57:23.372394+05:30",
7
+ "status": "completed",
8
+ "torusguard_version": "1.3.0",
9
+ "findings_count": 68,
10
+ "confirmed_fixed_count": 0,
11
+ "regressed_count": 0
12
+ }
@@ -0,0 +1,5 @@
1
+ # TorusGuard Audit Summary: run-20260918-105723-audit
2
+ - Scanned Scope: C:\Users\Admin\Desktop\TorusGuard
3
+ - Total Findings: 68
4
+ - Root-Cause Clusters: 9
5
+ - Generated: 2026-09-18 10:57:23 IST
@@ -0,0 +1,8 @@
1
+ # TorusGuard Security Audit Findings: run-20260918-105731-audit
2
+ - Target Root: `C:\Users\Admin\Desktop\TorusGuard`
3
+ - Total Scored Findings: `0`
4
+ - Identified Clusters: `0`
5
+ - Generated At: `2026-09-18 10:57:31 IST`
6
+
7
+ ---
8
+ ## Summary of Findings
@@ -0,0 +1,12 @@
1
+ {
2
+ "run_id": "run-20260918-105731-audit",
3
+ "command": "audit",
4
+ "target_name": "TorusGuard",
5
+ "created_at": "2026-09-18 10:57:31 IST",
6
+ "created_at_iso": "2026-09-18T10:57:31.006888+05:30",
7
+ "status": "completed",
8
+ "torusguard_version": "1.3.0",
9
+ "findings_count": 0,
10
+ "confirmed_fixed_count": 0,
11
+ "regressed_count": 0
12
+ }
@@ -0,0 +1,5 @@
1
+ # TorusGuard Audit Summary: run-20260918-105731-audit
2
+ - Scanned Scope: C:\Users\Admin\Desktop\TorusGuard
3
+ - Total Findings: 0
4
+ - Root-Cause Clusters: 0
5
+ - Generated: 2026-09-18 10:57:31 IST
@@ -0,0 +1,8 @@
1
+ # TorusGuard Security Audit Findings: run-20260918-105940-audit
2
+ - Target Root: `C:\Users\Admin\Desktop\TorusGuard`
3
+ - Total Scored Findings: `0`
4
+ - Identified Clusters: `0`
5
+ - Generated At: `2026-09-18 10:59:40 IST`
6
+
7
+ ---
8
+ ## Summary of Findings
@@ -0,0 +1,13 @@
1
+ {
2
+ "run_id": "run-20260918-105940-audit",
3
+ "command": "audit",
4
+ "target_name": "TorusGuard",
5
+ "created_at": "2026-09-18 10:59:40 IST",
6
+ "created_at_iso": "2026-09-18T10:59:40.691005+05:30",
7
+ "status": "completed",
8
+ "torusguard_version": "1.3.0",
9
+ "findings_count": 0,
10
+ "confirmed_fixed_count": 0,
11
+ "regressed_count": 0,
12
+ "remediation_bundles_count": 0
13
+ }
@@ -0,0 +1,7 @@
1
+ # TorusGuard Governed Remediation Catalog
2
+ **Run ID:** `run-20260918-105940-audit`
3
+ **Generated:** `2026-09-19 14:54:41 IST`
4
+ **Candidate Bundles Formulated:** `0`
5
+
6
+ ---
7
+ ## Formulated Candidate Patches
@@ -0,0 +1,5 @@
1
+ # TorusGuard Audit Summary: run-20260918-105940-audit
2
+ - Scanned Scope: C:\Users\Admin\Desktop\TorusGuard
3
+ - Total Findings: 0
4
+ - Root-Cause Clusters: 0
5
+ - Generated: 2026-09-18 10:59:40 IST
@@ -0,0 +1,8 @@
1
+ # TorusGuard Security Audit Findings: run-20260919-145701-audit
2
+ - Target Root: `C:\Users\Admin\Desktop\TorusGuard`
3
+ - Total Scored Findings: `0`
4
+ - Identified Clusters: `0`
5
+ - Generated At: `2026-09-19 14:57:01 IST`
6
+
7
+ ---
8
+ ## Summary of Findings
@@ -0,0 +1,12 @@
1
+ {
2
+ "run_id": "run-20260919-145701-audit",
3
+ "command": "audit",
4
+ "target_name": "TorusGuard",
5
+ "created_at": "2026-09-19 14:57:01 IST",
6
+ "created_at_iso": "2026-09-19T14:57:01.568307+05:30",
7
+ "status": "completed",
8
+ "torusguard_version": "1.3.0",
9
+ "findings_count": 0,
10
+ "confirmed_fixed_count": 0,
11
+ "regressed_count": 0
12
+ }
@@ -0,0 +1,5 @@
1
+ # TorusGuard Audit Summary: run-20260919-145701-audit
2
+ - Scanned Scope: C:\Users\Admin\Desktop\TorusGuard
3
+ - Total Findings: 0
4
+ - Root-Cause Clusters: 0
5
+ - Generated: 2026-09-19 14:57:01 IST
@@ -0,0 +1,8 @@
1
+ # TorusGuard Security Audit Findings: run-20260919-151729-audit
2
+ - Target Root: `C:\Users\Admin\Desktop\TorusGuard`
3
+ - Total Scored Findings: `0`
4
+ - Identified Clusters: `0`
5
+ - Generated At: `2026-09-19 15:17:29 IST`
6
+
7
+ ---
8
+ ## Summary of Findings
@@ -0,0 +1,13 @@
1
+ {
2
+ "run_id": "run-20260919-151729-audit",
3
+ "command": "audit",
4
+ "target_name": "TorusGuard",
5
+ "created_at": "2026-09-19 15:17:29 IST",
6
+ "created_at_iso": "2026-09-19T15:17:29.783790+05:30",
7
+ "status": "completed",
8
+ "torusguard_version": "1.3.0",
9
+ "findings_count": 0,
10
+ "confirmed_fixed_count": 0,
11
+ "regressed_count": 0,
12
+ "remediation_bundles_count": 0
13
+ }
@@ -0,0 +1,7 @@
1
+ # TorusGuard Governed Remediation Catalog
2
+ **Run ID:** `run-20260919-151729-audit`
3
+ **Generated:** `2026-09-19 15:17:35 IST`
4
+ **Candidate Bundles Formulated:** `0`
5
+
6
+ ---
7
+ ## Formulated Candidate Patches
@@ -0,0 +1,5 @@
1
+ # TorusGuard Audit Summary: run-20260919-151729-audit
2
+ - Scanned Scope: C:\Users\Admin\Desktop\TorusGuard
3
+ - Total Findings: 0
4
+ - Root-Cause Clusters: 0
5
+ - Generated: 2026-09-19 15:17:29 IST
@@ -0,0 +1,8 @@
1
+ # TorusGuard Security Audit Findings: run-20260919-152340-audit
2
+ - Target Root: `C:\Users\Admin\Desktop\TorusGuard`
3
+ - Total Scored Findings: `0`
4
+ - Identified Clusters: `0`
5
+ - Generated At: `2026-09-19 15:23:40 IST`
6
+
7
+ ---
8
+ ## Summary of Findings
@@ -0,0 +1,12 @@
1
+ {
2
+ "run_id": "run-20260919-152340-audit",
3
+ "command": "audit",
4
+ "target_name": "TorusGuard",
5
+ "created_at": "2026-09-19 15:23:40 IST",
6
+ "created_at_iso": "2026-09-19T15:23:40.802283+05:30",
7
+ "status": "completed",
8
+ "torusguard_version": "1.3.0",
9
+ "findings_count": 0,
10
+ "confirmed_fixed_count": 0,
11
+ "regressed_count": 0
12
+ }
@@ -0,0 +1,5 @@
1
+ # TorusGuard Audit Summary: run-20260919-152340-audit
2
+ - Scanned Scope: C:\Users\Admin\Desktop\TorusGuard
3
+ - Total Findings: 0
4
+ - Root-Cause Clusters: 0
5
+ - Generated: 2026-09-19 15:23:40 IST
@@ -0,0 +1,8 @@
1
+ # TorusGuard Security Audit Findings: run-20260919-152345-audit
2
+ - Target Root: `C:\Users\Admin\Desktop\TorusGuard`
3
+ - Total Scored Findings: `0`
4
+ - Identified Clusters: `0`
5
+ - Generated At: `2026-09-19 15:23:45 IST`
6
+
7
+ ---
8
+ ## Summary of Findings
@@ -0,0 +1,12 @@
1
+ {
2
+ "run_id": "run-20260919-152345-audit",
3
+ "command": "audit",
4
+ "target_name": "TorusGuard",
5
+ "created_at": "2026-09-19 15:23:45 IST",
6
+ "created_at_iso": "2026-09-19T15:23:45.599143+05:30",
7
+ "status": "completed",
8
+ "torusguard_version": "1.3.0",
9
+ "findings_count": 0,
10
+ "confirmed_fixed_count": 0,
11
+ "regressed_count": 0
12
+ }
@@ -0,0 +1,5 @@
1
+ # TorusGuard Audit Summary: run-20260919-152345-audit
2
+ - Scanned Scope: C:\Users\Admin\Desktop\TorusGuard
3
+ - Total Findings: 0
4
+ - Root-Cause Clusters: 0
5
+ - Generated: 2026-09-19 15:23:45 IST
@@ -0,0 +1,8 @@
1
+ # TorusGuard Security Audit Findings: run-20260919-153500-audit
2
+ - Target Root: `C:\Users\Admin\Desktop\TorusGuard`
3
+ - Total Scored Findings: `0`
4
+ - Identified Clusters: `0`
5
+ - Generated At: `2026-09-19 15:35:00 IST`
6
+
7
+ ---
8
+ ## Summary of Findings
@@ -0,0 +1,12 @@
1
+ {
2
+ "run_id": "run-20260919-153500-audit",
3
+ "command": "audit",
4
+ "target_name": "TorusGuard",
5
+ "created_at": "2026-09-19 15:35:00 IST",
6
+ "created_at_iso": "2026-09-19T15:35:00.129289+05:30",
7
+ "status": "completed",
8
+ "torusguard_version": "1.3.0",
9
+ "findings_count": 0,
10
+ "confirmed_fixed_count": 0,
11
+ "regressed_count": 0
12
+ }
@@ -0,0 +1,5 @@
1
+ # TorusGuard Audit Summary: run-20260919-153500-audit
2
+ - Scanned Scope: C:\Users\Admin\Desktop\TorusGuard
3
+ - Total Findings: 0
4
+ - Root-Cause Clusters: 0
5
+ - Generated: 2026-09-19 15:35:00 IST
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
- TorusGuard Governed Patch Application & Snapshot Engine (v1.3.5)
3
+ TorusGuard Governed Patch Application & Snapshot Engine (v1.3.6)
4
4
  Interactive Human Gate authorization, pre-apply .bak rollback snapshots,
5
5
  atomic patch application, and Golden Fix Recipe distillation into persistent memory.
6
6
  Strict 75-column terminal UI formatting.
@@ -58,7 +58,7 @@ def box_line(content: str, width: int = 67, border: str = "│", border_color: s
58
58
  return term_ui.format_box_line(content, width=width, border=border, border_color=border_color)
59
59
  return f" {border_color}{border}{RESET} {content}"
60
60
 
61
- def box_header(title: str, subtitle: str = "", version: str = "v1.3.5", border_color: str = CYAN) -> str:
61
+ def box_header(title: str, subtitle: str = "", version: str = "v1.4.0", border_color: str = CYAN) -> str:
62
62
  if term_ui:
63
63
  return term_ui.card_header(title, subtitle, version, border_color)
64
64
  return f"=== {title} ({version}) ==="
@@ -81,6 +81,35 @@ def find_latest_audit_run(runs_dir: Path) -> Optional[Path]:
81
81
  return runs[0] if runs else None
82
82
 
83
83
 
84
+ def list_snapshots(target_root: Path) -> None:
85
+ """Display historical pre-apply backup snapshots."""
86
+ snapshots_base = target_root / ".torusguard" / "snapshots"
87
+ print()
88
+ print(box_header("🛡️ TORUSGUARD SNAPSHOT LEDGER", "Pre-Apply Safety Snapshots (.bak)", "v1.4.0"))
89
+ print()
90
+ if not snapshots_base.is_dir():
91
+ print(f" {YELLOW}ℹ No snapshots directory found at:{RESET} {snapshots_base}\n")
92
+ return
93
+ snapshots = sorted([d for d in snapshots_base.iterdir() if d.is_dir()], key=lambda p: p.stat().st_mtime, reverse=True)
94
+ if not snapshots:
95
+ print(f" {YELLOW}ℹ No rollback snapshots captured yet.{RESET}\n")
96
+ return
97
+ print(border_top(f"Available Snapshots ({len(snapshots)})"))
98
+ for s in snapshots:
99
+ bak_files = list(s.rglob("*.bak"))
100
+ total_bytes = sum(f.stat().st_size for f in bak_files)
101
+ kb_str = f"{total_bytes / 1024:.1f} KB"
102
+ try:
103
+ mtime_dt = datetime.datetime.fromtimestamp(s.stat().st_mtime, tz=IST)
104
+ time_str = mtime_dt.strftime("%Y-%m-%d %H:%M:%S IST")
105
+ except Exception:
106
+ time_str = "Captured"
107
+ print(box_line(f"{GREEN}{s.name}{RESET} ({len(bak_files)} files · {kb_str})"))
108
+ print(box_line(f" └─ {DIM}Timestamp: {time_str}{RESET}"))
109
+ print(border_bottom())
110
+ print(f"\n {DIM}To restore any snapshot, run: {CYAN}npx torusguard rollback --run <snapshot-name>{RESET}\n")
111
+
112
+
84
113
  def execute_rollback(target_root: Path, run_id_arg: Optional[str] = None) -> None:
85
114
  """Restore all target files from the pre-apply backup snapshots."""
86
115
  snapshots_base = target_root / ".torusguard" / "snapshots"
@@ -108,8 +137,14 @@ def execute_rollback(target_root: Path, run_id_arg: Optional[str] = None) -> Non
108
137
  shutil.copy2(bak_file, dest_file)
109
138
  restored_files.append(orig_rel)
110
139
 
140
+ try:
141
+ import report_sync
142
+ report_sync.record_rollback_results(target_root, restored_files, snapshot_dir.name)
143
+ except Exception:
144
+ pass
145
+
111
146
  print()
112
- print(box_header("🛡️ TORUSGUARD ROLLBACK RESTORATION", "Restored original files from pre-apply snapshot", "v1.3.5"))
147
+ print(box_header("🛡️ TORUSGUARD ROLLBACK RESTORATION", "Restored original files from pre-apply snapshot", "v1.4.0"))
113
148
  print()
114
149
 
115
150
  print(border_top("Rollback Snapshot Restored"))
@@ -122,7 +157,7 @@ def execute_rollback(target_root: Path, run_id_arg: Optional[str] = None) -> Non
122
157
  sys.exit(0)
123
158
 
124
159
 
125
- def execute_apply(target_root: Path, run_id_arg: Optional[str] = None, auto_approve: bool = False) -> Dict[str, Any]:
160
+ def execute_apply(target_root: Path, run_id_arg: Optional[str] = None, auto_approve: bool = False, diff_only: bool = False, selective: bool = False, verify_post_apply: bool = False) -> Dict[str, Any]:
126
161
  runs_dir = target_root / ".torusguard" / "runs"
127
162
  if run_id_arg:
128
163
  run_folder = runs_dir / run_id_arg
@@ -138,7 +173,7 @@ def execute_apply(target_root: Path, run_id_arg: Optional[str] = None, auto_appr
138
173
  bundle_meta_files = list(bundles_dir.glob("*/metadata.json")) if bundles_dir.is_dir() else []
139
174
  if not bundle_meta_files:
140
175
  print()
141
- print(box_header("🛡️ TORUSGUARD GOVERNED PATCH APPLIER", "Human-Gate Authorization, Snapshots & Golden Recipe Distillation", "v1.3.5"))
176
+ print(box_header("🛡️ TORUSGUARD GOVERNED PATCH APPLIER", "Human-Gate Authorization, Snapshots & Golden Recipe Distillation", "v1.4.0"))
142
177
  print()
143
178
  print(f" {YELLOW}ℹ Zero candidate remediation bundles found in run: {run_folder.name}{RESET}")
144
179
  print(f" {GRAY}The findings in this run require manual review or AI-assisted remediation.{RESET}\n")
@@ -157,13 +192,46 @@ def execute_apply(target_root: Path, run_id_arg: Optional[str] = None, auto_appr
157
192
  except Exception:
158
193
  pass
159
194
 
195
+ # Diff Preview Mode
196
+ if diff_only:
197
+ print()
198
+ print(box_header("🛡️ TORUSGUARD GOVERNED PATCH DIFF PREVIEW", "Dry-Run Unified Diff Inspection (No Files Modified)", "v1.4.0"))
199
+ print()
200
+ print(border_top(f"Candidate Patches ({len(bundles)})"))
201
+ for idx, b in enumerate(bundles, 1):
202
+ rule_id = b.get("rule_id", "TG-SEC")
203
+ rel_path = b.get("target_file", "")
204
+ line_no = b.get("line_number", 1)
205
+ diff = b.get("proposed_diff", "")
206
+ desc = b.get("what_should_change", "")
207
+ print(f" {YELLOW}─── [{idx}/{len(bundles)}] Candidate Patch: [{rule_id}] on {rel_path}:{line_no} ───{RESET}")
208
+ print(f" Strategy: {WHITE}{desc}{RESET}")
209
+ print(f" Ponytail: {GREEN}+{b.get('additions', 0)} / -{b.get('deletions', 0)}{RESET}\n")
210
+ for dline in diff.splitlines()[:16]:
211
+ if dline.startswith("+") and not dline.startswith("+++"):
212
+ print(f" {GREEN}{dline}{RESET}")
213
+ elif dline.startswith("-") and not dline.startswith("---"):
214
+ print(f" {RED}{dline}{RESET}")
215
+ elif dline.startswith("@"):
216
+ print(f" {CYAN}{dline}{RESET}")
217
+ else:
218
+ print(f" {DIM}{dline}{RESET}")
219
+ print()
220
+ print(border_bottom())
221
+ print(f"\n {DIM}To apply these patches to disk, run: {CYAN}npx torusguard apply{RESET} or {CYAN}npx torusguard apply --yes{RESET}\n")
222
+ return {
223
+ "status": "diff_preview",
224
+ "bundles_count": len(bundles),
225
+ "bundles": bundles
226
+ }
227
+
160
228
  # Snapshot directory
161
229
  snapshot_dir = target_root / ".torusguard" / "snapshots" / run_folder.name
162
230
  snapshot_dir.mkdir(parents=True, exist_ok=True)
163
231
 
164
232
  # Header Card
165
233
  print()
166
- print(box_header("🛡️ TORUSGUARD GOVERNED PATCH APPLIER", "Human-Gate Authorization, Snapshots & Golden Recipe Distillation", "v1.3.5"))
234
+ print(box_header("🛡️ TORUSGUARD GOVERNED PATCH APPLIER", "Human-Gate Authorization, Snapshots & Golden Recipe Distillation", "v1.4.0"))
167
235
  print()
168
236
 
169
237
  print(border_top("Candidate Bundles Ready for Application"))
@@ -175,7 +243,7 @@ def execute_apply(target_root: Path, run_id_arg: Optional[str] = None, auto_appr
175
243
 
176
244
  applied_count = 0
177
245
  skipped_count = 0
178
- all_approved = auto_approve
246
+ all_approved = False if selective else auto_approve
179
247
  diff_summary_lines = [f"# TorusGuard Applied Patch Summary: {run_folder.name}\n"]
180
248
  applied_bundles = []
181
249
 
@@ -351,6 +419,21 @@ def execute_apply(target_root: Path, run_id_arg: Optional[str] = None, auto_appr
351
419
  print(border_bottom(border_color=GREEN, double=True))
352
420
  print()
353
421
 
422
+ if verify_post_apply and applied_count > 0:
423
+ recheck_script = scripts_dir / "recheck_runner.py"
424
+ if recheck_script.is_file():
425
+ print(f"\n {CYAN}▸ Triggering differential recheck post-apply (--verify)...{RESET}\n")
426
+ try:
427
+ import importlib.util
428
+ spec = importlib.util.spec_from_file_location("recheck_runner", str(recheck_script))
429
+ if spec and spec.loader:
430
+ rc_mod = importlib.util.module_from_spec(spec)
431
+ spec.loader.exec_module(rc_mod)
432
+ if hasattr(rc_mod, "execute_recheck"):
433
+ rc_mod.execute_recheck(target_root, run_folder.name)
434
+ except Exception as e:
435
+ print(f" {YELLOW}⚠ Post-apply recheck notice: {e}{RESET}")
436
+
354
437
  return {
355
438
  "applied_count": applied_count,
356
439
  "skipped_count": skipped_count,
@@ -362,19 +445,35 @@ def execute_apply(target_root: Path, run_id_arg: Optional[str] = None, auto_appr
362
445
  def main():
363
446
  parser = argparse.ArgumentParser(description="TorusGuard Governed Patch Application Engine")
364
447
  parser.add_argument("path", nargs="?", default=".", help="Target project root directory")
448
+ parser.add_argument("--target", "-t", help="Target project root directory (alias for path)")
365
449
  parser.add_argument("--run", "-r", help="Explicit run ID to apply")
366
450
  parser.add_argument("--yes", "-y", action="store_true", help="Auto-approve all patches (non-interactive)")
451
+ parser.add_argument("--diff", action="store_true", help="Preview unified diffs without modifying files on disk")
452
+ parser.add_argument("--selective", action="store_true", help="Interactively review and select patches one by one")
453
+ parser.add_argument("--verify", action="store_true", help="Trigger differential AST recheck immediately post-apply")
454
+ parser.add_argument("--list-snapshots", action="store_true", help="List historical pre-apply backup snapshots")
367
455
  parser.add_argument("--rollback", action="store_true", help="Rollback all applied patches using snapshots")
368
456
  parser.add_argument("--json", action="store_true", help="Output raw JSON")
369
457
  args = parser.parse_args()
370
458
 
371
- target = Path(args.path).resolve()
459
+ target = Path(args.target or args.path).resolve()
460
+
461
+ if args.list_snapshots:
462
+ list_snapshots(target)
463
+ return
372
464
 
373
465
  if args.rollback:
374
466
  execute_rollback(target, run_id_arg=args.run)
375
467
  return
376
468
 
377
- result = execute_apply(target, run_id_arg=args.run, auto_approve=args.yes)
469
+ result = execute_apply(
470
+ target,
471
+ run_id_arg=args.run,
472
+ auto_approve=args.yes,
473
+ diff_only=args.diff,
474
+ selective=args.selective,
475
+ verify_post_apply=args.verify
476
+ )
378
477
  if args.json:
379
478
  print(json.dumps(result, indent=2))
380
479