Skip to content

Commit c937d2b

Browse files
authored
Merge pull request #50 from Hypercart-Dev-Tools/development
Development to Main
2 parents e4fd125 + 9261b73 commit c937d2b

150 files changed

Lines changed: 25167 additions & 1079 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ If you're unsure whether to create a new workflow or modify `ci.yml`, ask yourse
127127
3. **Is this for other repos to consume?** → Create reusable workflow with `workflow_call`
128128
4. **Is this completely unrelated to CI?** → Maybe OK, but document why
129129

130+
For WP Code Check's responsible disclosure and report publication policy, see `../../DISCLOSURE-POLICY.md`.
131+
130132
## History
131133

132134
- **2025-12-31**: Consolidated 3 workflows into 1

.gitleaks.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Gitleaks configuration for WP Code Check
2+
# Excludes test fixtures containing fake secrets
3+
4+
title = "WP Code Check - Gitleaks Configuration"
5+
6+
# Exclude test files and fixtures from secret scanning
7+
[allowlist]
8+
description = "Allowlist for test fixtures with fake secrets"
9+
paths = [
10+
'''dist/tests/.*''',
11+
'''dist/tests/fixtures/.*''',
12+
'''tests/.*''',
13+
]
14+
15+
# Exclude specific patterns that are known to be test data
16+
regexes = [
17+
'''sk_live_1234567890abcdef1234567890abcdef''', # Fake Stripe key in test-js-pattern.js
18+
'''ghp_1234567890abcdefghijklmnopqrstuvwxyz''', # Fake GitHub token in test-js-pattern.js
19+
]
20+

AGENTS.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,50 @@ This project includes a **Project Templates** feature (alpha) that allows users
4141

4242
---
4343

44+
### JSON to HTML Report Conversion
45+
46+
This project includes a **standalone JSON-to-HTML converter** (`dist/bin/json-to-html.py`) that converts scan logs to beautiful HTML reports. This tool is designed for reliability and should be used when the main scanner's HTML generation stalls or fails.
47+
48+
**When to use:**
49+
- The main scan completes but HTML report generation hangs or times out
50+
- You need to regenerate an HTML report from an existing JSON log
51+
- The user explicitly asks to convert a JSON log to HTML
52+
53+
**Usage:**
54+
```bash
55+
python3 dist/bin/json-to-html.py <input.json> <output.html>
56+
```
57+
58+
**Example:**
59+
```bash
60+
# Convert a specific JSON log to HTML
61+
python3 dist/bin/json-to-html.py dist/logs/2026-01-05-032317-UTC.json dist/reports/my-report.html
62+
63+
# Find the latest JSON log and convert it
64+
latest_json=$(ls -t dist/logs/*.json | head -1)
65+
python3 dist/bin/json-to-html.py "$latest_json" dist/reports/latest-report.html
66+
```
67+
68+
**Features:**
69+
-**Fast & Reliable** - Python-based, no bash subprocess issues
70+
-**Standalone** - Works independently of the main scanner
71+
-**Auto-opens** - Automatically opens the report in your browser (macOS/Linux)
72+
-**No Dependencies** - Uses only Python 3 standard library
73+
-**Detailed Output** - Shows progress and file size
74+
75+
**Troubleshooting:**
76+
- If the script fails, check that Python 3 is installed: `python3 --version`
77+
- If the template is missing, ensure `dist/bin/templates/report-template.html` exists
78+
- If JSON is invalid, validate it with: `jq empty <file.json>`
79+
80+
**Integration:**
81+
The main scanner (`check-performance.sh`) automatically calls this converter when using `--format json`. If you encounter issues with HTML generation during a scan, you can:
82+
1. Let the scan complete (JSON will be saved)
83+
2. Manually run the converter on the saved JSON log
84+
3. Report the issue so the integration can be improved
85+
86+
---
87+
4488
## 🔐 Security
4589

4690
- [ ] **Sanitize all inputs** using WordPress functions (`sanitize_text_field()`, `sanitize_email()`, `absint()`, etc.)

CHANGELOG.md

Lines changed: 756 additions & 0 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,39 @@ Expected output:
9797
- **Errors**: 6+ (depending on active checks)
9898
- **Warnings**: 4+
9999

100+
### End-to-End Template Testing
101+
102+
Use the keyword **"Run template [name] end to end"** to execute a complete scan and AI triage workflow with minimal human intervention.
103+
104+
**What this does:**
105+
1. Loads the template configuration from `TEMPLATES/[name].txt`
106+
2. Executes the full performance scan (`check-performance.sh`)
107+
3. Generates JSON log with all findings
108+
4. Runs AI-assisted triage on the findings
109+
5. Converts JSON to HTML report with triage data embedded
110+
6. Opens the final report in your browser
111+
112+
**Example:**
113+
```bash
114+
# User request: "Run template gravityforms end to end"
115+
# AI will execute:
116+
./dist/bin/run gravityforms --format json
117+
python3 dist/bin/ai-triage.py dist/logs/[latest].json
118+
python3 dist/bin/json-to-html.py dist/logs/[latest].json dist/reports/[output].html
119+
```
120+
121+
**Benefits:**
122+
- ✅ Complete workflow in one command
123+
- ✅ AI triage automatically classifies findings
124+
- ✅ HTML report includes triage classifications and confidence levels
125+
- ✅ No manual JSON/HTML conversion needed
126+
- ✅ Ideal for testing new checks or validating fixes
127+
128+
**Template Requirements:**
129+
- Template file must exist in `TEMPLATES/[name].txt`
130+
- Must contain `PROJECT_PATH` pointing to a valid WordPress plugin/theme directory
131+
- Optional: `FORMAT=json` to enable JSON output (required for triage)
132+
100133
---
101134

102135
## 📋 Commit Message Guidelines

0 commit comments

Comments
 (0)