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.
- package/.torusguard/.manifest.json +37 -36
- package/.torusguard/runs/report-latest.html +5862 -315
- package/.torusguard/runs/results-latest.sarif +20 -0
- package/.torusguard/runs/run-20260918-104221-audit/findings.json +1 -0
- package/.torusguard/runs/run-20260918-104221-audit/findings.md +8 -0
- package/.torusguard/runs/run-20260918-104221-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260918-104221-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260918-104236-audit/findings.json +2314 -0
- package/.torusguard/runs/run-20260918-104236-audit/findings.md +960 -0
- package/.torusguard/runs/run-20260918-104236-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260918-104236-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260918-105723-audit/findings.json +2382 -0
- package/.torusguard/runs/run-20260918-105723-audit/findings.md +960 -0
- package/.torusguard/runs/run-20260918-105723-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260918-105723-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260918-105731-audit/findings.json +1 -0
- package/.torusguard/runs/run-20260918-105731-audit/findings.md +8 -0
- package/.torusguard/runs/run-20260918-105731-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260918-105731-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260918-105940-audit/findings.json +1 -0
- package/.torusguard/runs/run-20260918-105940-audit/findings.md +8 -0
- package/.torusguard/runs/run-20260918-105940-audit/manifest.json +13 -0
- package/.torusguard/runs/run-20260918-105940-audit/remediation.md +7 -0
- package/.torusguard/runs/run-20260918-105940-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260919-145701-audit/findings.json +1 -0
- package/.torusguard/runs/run-20260919-145701-audit/findings.md +8 -0
- package/.torusguard/runs/run-20260919-145701-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260919-145701-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260919-151729-audit/findings.json +1 -0
- package/.torusguard/runs/run-20260919-151729-audit/findings.md +8 -0
- package/.torusguard/runs/run-20260919-151729-audit/manifest.json +13 -0
- package/.torusguard/runs/run-20260919-151729-audit/remediation.md +7 -0
- package/.torusguard/runs/run-20260919-151729-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260919-152340-audit/findings.json +1 -0
- package/.torusguard/runs/run-20260919-152340-audit/findings.md +8 -0
- package/.torusguard/runs/run-20260919-152340-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260919-152340-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260919-152345-audit/findings.json +1 -0
- package/.torusguard/runs/run-20260919-152345-audit/findings.md +8 -0
- package/.torusguard/runs/run-20260919-152345-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260919-152345-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260919-153500-audit/findings.json +1 -0
- package/.torusguard/runs/run-20260919-153500-audit/findings.md +8 -0
- package/.torusguard/runs/run-20260919-153500-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260919-153500-audit/summary.md +5 -0
- package/.torusguard/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/recipes_runner.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
- package/.torusguard/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
- package/.torusguard/scripts/apply_runner.py +108 -9
- package/.torusguard/scripts/audit_runner.py +336 -24
- package/.torusguard/scripts/harden_runner.py +124 -70
- package/.torusguard/scripts/html_reporter.py +3585 -648
- package/.torusguard/scripts/manifest_builder.py +2 -0
- package/.torusguard/scripts/recheck_runner.py +5 -4
- package/.torusguard/scripts/recipes_runner.py +91 -8
- package/.torusguard/scripts/report_sync.py +496 -73
- package/.torusguard/scripts/sarif_exporter.py +48 -8
- package/.torusguard/scripts/stack_detect.py +44 -2
- package/.torusguard/scripts/status_runner.py +267 -0
- package/.torusguard/scripts/term_ui.py +1 -1
- package/.torusguard/skills/torusguard/SKILL.md +75 -72
- package/.torusguard/skills/torusguard-apply/SKILL.md +84 -80
- package/.torusguard/skills/torusguard-audit/SKILL.md +87 -83
- package/.torusguard/skills/torusguard-authorize/SKILL.md +7 -2
- package/.torusguard/skills/torusguard-exploit-check/SKILL.md +7 -2
- package/.torusguard/skills/torusguard-full/SKILL.md +7 -2
- package/.torusguard/skills/torusguard-harden/SKILL.md +98 -94
- package/.torusguard/skills/torusguard-init/SKILL.md +68 -64
- package/.torusguard/skills/torusguard-recheck/SKILL.md +81 -77
- package/.torusguard/skills/torusguard-report/SKILL.md +93 -72
- package/.torusguard/skills/torusguard-status/SKILL.md +62 -58
- package/.torusguard/skills/torusguard-verify/SKILL.md +7 -2
- package/.torusguard/skills/torusguard-web-validate/SKILL.md +7 -2
- package/.torusguard/workflows/apply.md +1 -1
- package/.torusguard/workflows/audit.md +1 -1
- package/.torusguard/workflows/authorize.md +1 -1
- package/.torusguard/workflows/exploit-check.md +1 -1
- package/.torusguard/workflows/harden.md +1 -1
- package/.torusguard/workflows/init.md +1 -1
- package/.torusguard/workflows/memory.md +1 -1
- package/.torusguard/workflows/recheck.md +1 -1
- package/.torusguard/workflows/report.md +1 -1
- package/.torusguard/workflows/status.md +1 -1
- package/.torusguard/workflows/verify.md +1 -1
- package/.torusguard/workflows/web-validate.md +1 -1
- package/README.md +115 -81
- package/bin/torusguard.js +244 -38
- package/package.json +6 -2
- package/skills/torusguard/SKILL.md +1 -1
- package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
- package/skills/torusguard/bootstrap.py +52 -8
- package/skills/torusguard/payload/.manifest.json +51 -36
- package/skills/torusguard/payload/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/rules_sync.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-311.pyc +0 -0
- package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/apply_runner.py +108 -9
- package/skills/torusguard/payload/scripts/audit_runner.py +336 -24
- package/skills/torusguard/payload/scripts/harden_runner.py +124 -70
- package/skills/torusguard/payload/scripts/html_reporter.py +3585 -648
- package/skills/torusguard/payload/scripts/manifest_builder.py +2 -0
- package/skills/torusguard/payload/scripts/recheck_runner.py +5 -4
- package/skills/torusguard/payload/scripts/recipes_runner.py +91 -8
- package/skills/torusguard/payload/scripts/report_sync.py +496 -73
- package/skills/torusguard/payload/scripts/sarif_exporter.py +48 -8
- package/skills/torusguard/payload/scripts/stack_detect.py +44 -2
- package/skills/torusguard/payload/scripts/status_runner.py +267 -0
- package/skills/torusguard/payload/scripts/term_ui.py +1 -1
- package/skills/torusguard/payload/skills/torusguard/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +40 -23
- package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +1 -1
- package/skills/torusguard/payload/workflows/apply.md +9 -1
- package/skills/torusguard/payload/workflows/audit.md +8 -2
- package/skills/torusguard/payload/workflows/authorize.md +1 -1
- package/skills/torusguard/payload/workflows/exploit-check.md +1 -1
- package/skills/torusguard/payload/workflows/harden.md +6 -1
- package/skills/torusguard/payload/workflows/init.md +7 -1
- package/skills/torusguard/payload/workflows/memory.md +1 -1
- package/skills/torusguard/payload/workflows/recheck.md +1 -1
- package/skills/torusguard/payload/workflows/recipes.md +55 -0
- package/skills/torusguard/payload/workflows/report.md +59 -55
- package/skills/torusguard/payload/workflows/status.md +4 -1
- package/skills/torusguard/payload/workflows/torusguard-apply.md +110 -0
- package/skills/torusguard/payload/workflows/torusguard-audit.md +105 -0
- package/skills/torusguard/payload/workflows/torusguard-authorize.md +96 -0
- package/skills/torusguard/payload/workflows/torusguard-exploit-check.md +98 -0
- package/skills/torusguard/payload/workflows/torusguard-harden.md +104 -0
- package/skills/torusguard/payload/workflows/torusguard-init.md +106 -0
- package/skills/torusguard/payload/workflows/torusguard-recheck.md +101 -0
- package/skills/torusguard/payload/workflows/torusguard-recipes.md +55 -0
- package/skills/torusguard/payload/workflows/torusguard-report.md +105 -0
- package/skills/torusguard/payload/workflows/torusguard-status.md +103 -0
- package/skills/torusguard/payload/workflows/torusguard-verify.md +100 -0
- package/skills/torusguard/payload/workflows/torusguard-web-validate.md +96 -0
- package/skills/torusguard/payload/workflows/torusguard.md +19 -0
- package/skills/torusguard/payload/workflows/verify.md +1 -1
- package/skills/torusguard/payload/workflows/web-validate.md +1 -1
- package/skills/torusguard-apply/SKILL.md +1 -1
- package/skills/torusguard-audit/SKILL.md +1 -1
- package/skills/torusguard-authorize/SKILL.md +1 -1
- package/skills/torusguard-exploit-check/SKILL.md +1 -1
- package/skills/torusguard-full/SKILL.md +1 -1
- package/skills/torusguard-harden/SKILL.md +1 -1
- package/skills/torusguard-init/SKILL.md +1 -1
- package/skills/torusguard-recheck/SKILL.md +1 -1
- package/skills/torusguard-report/SKILL.md +40 -23
- package/skills/torusguard-status/SKILL.md +1 -1
- package/skills/torusguard-verify/SKILL.md +1 -1
- package/skills/torusguard-web-validate/SKILL.md +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
TorusGuard Targeted Differential Recheck Engine (v1.3.
|
|
3
|
+
TorusGuard Targeted Differential Recheck Engine (v1.3.6)
|
|
4
4
|
Executes scoped differential re-audits verifying only impacted files and adjacent boundaries.
|
|
5
5
|
Evaluates formal status transitions (Confirmed Fixed vs Regressed vs Unresolved), updates run manifest,
|
|
6
6
|
and records verification telemetry in the persistent security memory subsystem.
|
|
@@ -57,7 +57,7 @@ def box_line(content: str, width: int = 67, border: str = "│", border_color: s
|
|
|
57
57
|
return term_ui.format_box_line(content, width=width, border=border, border_color=border_color)
|
|
58
58
|
return f" {border_color}{border}{RESET} {content}"
|
|
59
59
|
|
|
60
|
-
def box_header(title: str, subtitle: str = "", version: str = "v1.3.
|
|
60
|
+
def box_header(title: str, subtitle: str = "", version: str = "v1.3.6", border_color: str = CYAN) -> str:
|
|
61
61
|
if term_ui:
|
|
62
62
|
return term_ui.card_header(title, subtitle, version, border_color)
|
|
63
63
|
return f"=== {title} ({version}) ==="
|
|
@@ -106,7 +106,7 @@ def execute_recheck(target_root: Path, run_id_arg: Optional[str] = None) -> Dict
|
|
|
106
106
|
|
|
107
107
|
# Header Card
|
|
108
108
|
print()
|
|
109
|
-
print(box_header("🛡️ TORUSGUARD DIFFERENTIAL RECHECK ENGINE", "Targeted Differential AST Scan & Regression Verification", "v1.3.
|
|
109
|
+
print(box_header("🛡️ TORUSGUARD DIFFERENTIAL RECHECK ENGINE", "Targeted Differential AST Scan & Regression Verification", "v1.3.6"))
|
|
110
110
|
print()
|
|
111
111
|
|
|
112
112
|
print(border_top("Recheck Verification Scope"))
|
|
@@ -233,11 +233,12 @@ def execute_recheck(target_root: Path, run_id_arg: Optional[str] = None) -> Dict
|
|
|
233
233
|
def main():
|
|
234
234
|
parser = argparse.ArgumentParser(description="TorusGuard Differential Recheck Engine")
|
|
235
235
|
parser.add_argument("path", nargs="?", default=".", help="Target project root directory")
|
|
236
|
+
parser.add_argument("--target", "-t", help="Target project root directory (alias for path)")
|
|
236
237
|
parser.add_argument("--run", "-r", help="Explicit run ID to recheck")
|
|
237
238
|
parser.add_argument("--json", action="store_true", help="Output raw JSON")
|
|
238
239
|
args = parser.parse_args()
|
|
239
240
|
|
|
240
|
-
target = Path(args.path).resolve()
|
|
241
|
+
target = Path(args.target or args.path).resolve()
|
|
241
242
|
result = execute_recheck(target, run_id_arg=args.run)
|
|
242
243
|
|
|
243
244
|
if args.json:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
TorusGuard Golden Fix Recipe Explorer (v1.
|
|
3
|
+
TorusGuard Golden Fix Recipe Explorer (v1.4.0)
|
|
4
4
|
Inspect, list, and export reusable, verified AST remediation code snippets
|
|
5
5
|
distilled from passing security patches and persistent memory patterns.
|
|
6
6
|
Standardized 75-column terminal UI formatting.
|
|
@@ -47,7 +47,7 @@ def box_line(content: str, width: int = 67, border: str = "│", border_color: s
|
|
|
47
47
|
return term_ui.format_box_line(content, width=width, border=border, border_color=border_color)
|
|
48
48
|
return f" {border_color}{border}{RESET} {content}"
|
|
49
49
|
|
|
50
|
-
def box_header(title: str, subtitle: str = "", version: str = "v1.
|
|
50
|
+
def box_header(title: str, subtitle: str = "", version: str = "v1.4.0", border_color: str = CYAN) -> str:
|
|
51
51
|
if term_ui:
|
|
52
52
|
return term_ui.card_header(title, subtitle, version, border_color)
|
|
53
53
|
return f"=== {title} ({version}) ==="
|
|
@@ -63,28 +63,100 @@ def border_bottom(border_color: str = CYAN, double: bool = False) -> str:
|
|
|
63
63
|
return "└" + "─" * 71 + "┘"
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
def list_recipes(target_root: Path, detail_id: Optional[str] = None, json_output: bool = False) -> None:
|
|
66
|
+
def list_recipes(target_root: Path, detail_id: Optional[str] = None, search_query: Optional[str] = None, export_path: Optional[str] = None, apply_id: Optional[str] = None, json_output: bool = False) -> None:
|
|
67
67
|
patterns_file = target_root / ".torusguard" / "memory" / "patterns.json"
|
|
68
68
|
recipes: List[Dict[str, Any]] = []
|
|
69
69
|
|
|
70
70
|
if patterns_file.is_file():
|
|
71
71
|
try:
|
|
72
72
|
patterns = json.loads(patterns_file.read_text(encoding="utf-8"))
|
|
73
|
-
|
|
73
|
+
if isinstance(patterns, list):
|
|
74
|
+
recipes = [p for p in patterns if p.get("pattern_type") == "golden_fix_recipe"]
|
|
75
|
+
elif isinstance(patterns, dict) and "patterns" in patterns:
|
|
76
|
+
recipes = [p for p in patterns["patterns"] if p.get("pattern_type") == "golden_fix_recipe"]
|
|
74
77
|
except Exception:
|
|
75
78
|
recipes = []
|
|
76
79
|
|
|
80
|
+
# 1. Search filtering
|
|
81
|
+
if search_query:
|
|
82
|
+
sq = search_query.lower()
|
|
83
|
+
recipes = [
|
|
84
|
+
r for r in recipes
|
|
85
|
+
if sq in r.get("rule_id", "").lower()
|
|
86
|
+
or sq in r.get("recipe_id", "").lower()
|
|
87
|
+
or sq in r.get("description", "").lower()
|
|
88
|
+
or sq in r.get("recipe_data", {}).get("diff_snippet", "").lower()
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
# 2. Export requested
|
|
92
|
+
if export_path:
|
|
93
|
+
out_p = Path(export_path)
|
|
94
|
+
if not out_p.is_absolute():
|
|
95
|
+
out_p = (target_root / out_p).resolve()
|
|
96
|
+
out_p.parent.mkdir(parents=True, exist_ok=True)
|
|
97
|
+
if out_p.suffix.lower() == ".json":
|
|
98
|
+
out_p.write_text(json.dumps(recipes, indent=2), encoding="utf-8")
|
|
99
|
+
else:
|
|
100
|
+
md_lines = [
|
|
101
|
+
"# TorusGuard Golden Fix Recipes Catalog",
|
|
102
|
+
f"- Total Recipes: {len(recipes)}",
|
|
103
|
+
f"- Exported From: {target_root}",
|
|
104
|
+
""
|
|
105
|
+
]
|
|
106
|
+
for r in recipes:
|
|
107
|
+
md_lines.append(f"## [{r.get('rule_id')}] {r.get('recipe_id')}")
|
|
108
|
+
md_lines.append(f"- **Description:** {r.get('description')}")
|
|
109
|
+
rdata = r.get("recipe_data", {})
|
|
110
|
+
md_lines.append(f"- **Verified Count:** {rdata.get('verified_count', 1)}x")
|
|
111
|
+
md_lines.append("```diff")
|
|
112
|
+
md_lines.append(rdata.get("diff_snippet", ""))
|
|
113
|
+
md_lines.append("```\n")
|
|
114
|
+
out_p.write_text("\n".join(md_lines), encoding="utf-8")
|
|
115
|
+
print(f"\n {GREEN}✔ Exported {len(recipes)} golden recipe(s) to:{RESET} {CYAN}{out_p}{RESET}\n")
|
|
116
|
+
return
|
|
117
|
+
|
|
118
|
+
# 3. Apply inspection requested
|
|
119
|
+
if apply_id:
|
|
120
|
+
target_rec = next((r for r in recipes if r.get("recipe_id") == apply_id or apply_id in r.get("recipe_id", "")), None)
|
|
121
|
+
if not target_rec:
|
|
122
|
+
print(f"\n {RED}✖ Recipe '{apply_id}' not found in golden recipe memory.{RESET}\n")
|
|
123
|
+
return
|
|
124
|
+
rdata = target_rec.get("recipe_data", {})
|
|
125
|
+
print()
|
|
126
|
+
print(box_header("🛡️ GOLDEN RECIPE APPLICATION PREVIEW", f"Recipe ID: {target_rec.get('recipe_id')}", "v1.4.0"))
|
|
127
|
+
print()
|
|
128
|
+
print(border_top("Recipe Metadata"))
|
|
129
|
+
print(box_line(f"Rule ID: {YELLOW}{target_rec.get('rule_id')}{RESET}"))
|
|
130
|
+
print(box_line(f"Description: {WHITE}{target_rec.get('description')}{RESET}"))
|
|
131
|
+
metrics = rdata.get("ponytail_metrics", {})
|
|
132
|
+
print(box_line(f"Ponytail: {GREEN}+{metrics.get('additions', 0)} / -{metrics.get('deletions', 0)} lines{RESET}"))
|
|
133
|
+
print(border_bottom())
|
|
134
|
+
print()
|
|
135
|
+
print(f" {BOLD}Diff Projection:{RESET}")
|
|
136
|
+
print(" ```diff")
|
|
137
|
+
for line in rdata.get("diff_snippet", "").splitlines():
|
|
138
|
+
if line.startswith("+"):
|
|
139
|
+
print(f" {GREEN}{line}{RESET}")
|
|
140
|
+
elif line.startswith("-"):
|
|
141
|
+
print(f" {RED}{line}{RESET}")
|
|
142
|
+
else:
|
|
143
|
+
print(f" {DIM}{line}{RESET}")
|
|
144
|
+
print(" ```")
|
|
145
|
+
print(f"\n {DIM}To apply automatically across all matching findings, run: {CYAN}npx torusguard harden && npx torusguard apply{RESET}\n")
|
|
146
|
+
return
|
|
147
|
+
|
|
77
148
|
if json_output:
|
|
78
149
|
print(json.dumps(recipes, indent=2))
|
|
79
150
|
return
|
|
80
151
|
|
|
81
152
|
# Header Card
|
|
82
153
|
print()
|
|
83
|
-
|
|
154
|
+
sub_title = f"Filtered by '{search_query}'" if search_query else "Distilled Ponytail Fixes (<= 35 add, <= 25 del) in Persistent Memory"
|
|
155
|
+
print(box_header("🛡️ TORUSGUARD GOLDEN FIX RECIPES", sub_title, "v1.4.0"))
|
|
84
156
|
print()
|
|
85
157
|
|
|
86
158
|
if not recipes:
|
|
87
|
-
print(f" {YELLOW}ℹ No golden fix recipes
|
|
159
|
+
print(f" {YELLOW}ℹ No golden fix recipes found matching query.{RESET}")
|
|
88
160
|
print(f" Run {CYAN}npx torusguard harden{RESET} followed by {CYAN}npx torusguard apply{RESET} to distill verified recipes.\n")
|
|
89
161
|
return
|
|
90
162
|
|
|
@@ -125,12 +197,23 @@ def list_recipes(target_root: Path, detail_id: Optional[str] = None, json_output
|
|
|
125
197
|
def main():
|
|
126
198
|
parser = argparse.ArgumentParser(description="TorusGuard Golden Fix Recipe Explorer")
|
|
127
199
|
parser.add_argument("path", nargs="?", default=".", help="Target project root directory")
|
|
200
|
+
parser.add_argument("--target", "-t", help="Target project root directory (alias for path)")
|
|
128
201
|
parser.add_argument("--detail", "-d", help="Inspect specific recipe ID")
|
|
202
|
+
parser.add_argument("--search", "-s", help="Filter recipes by rule, keyword, or language")
|
|
203
|
+
parser.add_argument("--export", "-e", help="Export recipes to JSON or Markdown file path")
|
|
204
|
+
parser.add_argument("--apply", "-a", help="Project and display application diff for specific recipe ID")
|
|
129
205
|
parser.add_argument("--json", action="store_true", help="Output raw JSON")
|
|
130
206
|
args = parser.parse_args()
|
|
131
207
|
|
|
132
|
-
target = Path(args.path).resolve()
|
|
133
|
-
list_recipes(
|
|
208
|
+
target = Path(args.target or args.path).resolve()
|
|
209
|
+
list_recipes(
|
|
210
|
+
target,
|
|
211
|
+
detail_id=args.detail,
|
|
212
|
+
search_query=args.search,
|
|
213
|
+
export_path=args.export,
|
|
214
|
+
apply_id=args.apply,
|
|
215
|
+
json_output=args.json
|
|
216
|
+
)
|
|
134
217
|
|
|
135
218
|
|
|
136
219
|
if __name__ == "__main__":
|