66
77---
88
9+ ## π Table of Contents
10+
11+ 1 . [ Core Concept] ( #-core-concept )
12+ 2 . [ Implementation Phases] ( #-implementation-phases )
13+ - [ Phase 1: Core Functionality (MVP)] ( #phase-1-core-functionality-mvp )
14+ - [ Phase 2: Enhanced Features] ( #phase-2-enhanced-features )
15+ - [ Phase 3: Advanced Automation] ( #phase-3-advanced-automation )
16+ 3 . [ Workflow Overview] ( #-thoughts-on-extending-the-workflow )
17+ 4 . [ Enhanced Phase 3 Workflow] ( #-enhanced-phase-3-workflow )
18+ 5 . [ Implementation Strategy] ( #-implementation-strategy )
19+ 6 . [ Parent Issue Template Structure] ( #-parent-issue-template-structure )
20+ 7 . [ Benefits & Considerations] ( #-benefits-of-parent-issue--checklist-approach )
21+ 8 . [ Implementation Plan] ( #-implementation-plan )
22+ 9 . [ Example Usage] ( #-example-usage )
23+ 10 . [ Design Decisions] ( #-design-decisions )
24+ 11 . [ Template Enhancement Strategy] ( #-template-enhancement-strategy )
25+ 12 . [ Fallback Detection Strategy] ( #-fallback-detection-strategy )
26+
27+ ---
28+
929## π― Core Concept
1030
1131** One Parent Issue Per Scan** with a checklist of confirmed findings that can be converted to child issues using GitHub's tasklist feature.
1232
1333---
1434
35+ ## π Implementation Phases
36+
37+ ### ** Phase 1: Core Functionality (MVP)**
38+
39+ ** Goal:** Create parent GitHub issues with AI-triaged findings as checklists
40+
41+ - [ ] ** 1.1 Template System Enhancement**
42+ - [ ] Update ` _TEMPLATE.txt ` with GitHub integration section
43+ - [ ] Add ` GITHUB_REPO ` , ` GITHUB_AUTO_ISSUE ` , ` GITHUB_ISSUE_LABELS ` fields
44+ - [ ] Add ` GITHUB_ASSIGNEE ` , ` GITHUB_MILESTONE ` fields
45+ - [ ] Add ` GITHUB_ALLOW_MULTIPLE_DAILY_SCANS ` field
46+ - [ ] Update ` _AI_INSTRUCTIONS.md ` with Phase 3 workflow documentation
47+
48+ - [ ] ** 1.2 Repository Detection**
49+ - [ ] Create ` dist/bin/lib/detect-github-repo.sh ` helper script
50+ - [ ] Implement git remote URL parsing (HTTPS, SSH, git:// formats)
51+ - [ ] Extract owner/repo from various GitHub URL formats
52+ - [ ] Validate repository format (owner/repo pattern)
53+ - [ ] Add fallback to template-specified ` GITHUB_REPO ` value
54+
55+ - [ ] ** 1.3 GitHub CLI Validation**
56+ - [ ] Check if ` gh ` CLI is installed
57+ - [ ] Verify ` gh auth status ` (authenticated)
58+ - [ ] Validate repository access with ` gh repo view `
59+ - [ ] Check write permissions with ` gh repo view --json viewerPermission `
60+ - [ ] Add helpful error messages for each failure case
61+
62+ - [ ] ** 1.4 Parent Issue Template Generator**
63+ - [ ] Create ` dist/bin/lib/generate-parent-issue-body.sh ` script
64+ - [ ] Format executive summary (total findings, confirmed, false positives)
65+ - [ ] Generate GitHub tasklist syntax for confirmed issues
66+ - [ ] Add severity sections (Critical, High, Medium, Low)
67+ - [ ] Include collapsed ` <details> ` section for false positives
68+ - [ ] Add detailed breakdown for each confirmed issue (code, analysis, recommendation)
69+ - [ ] Include links to HTML report and JSON log
70+ - [ ] Add footer with scanner version and branding
71+
72+ - [ ] ** 1.5 Issue Creation Logic**
73+ - [ ] Add ` --create-github-issue ` flag to ` check-performance.sh `
74+ - [ ] Integrate repository detection after template loading
75+ - [ ] Generate parent issue body from AI triage JSON
76+ - [ ] Create issue with ` gh issue create ` command
77+ - [ ] Apply labels from template (` GITHUB_ISSUE_LABELS ` )
78+ - [ ] Assign to user from template (` GITHUB_ASSIGNEE ` )
79+ - [ ] Link to milestone if specified (` GITHUB_MILESTONE ` )
80+ - [ ] Output issue URL to console
81+
82+ - [ ] ** 1.6 Duplicate Detection**
83+ - [ ] Search for existing issues with same UTC timestamp in title
84+ - [ ] Use ` gh issue list --search "in:title [WP Code Check] Scan Report (YYYY-MM-DD-HHMMSS)" `
85+ - [ ] UTC timestamp ensures unique identification per scan
86+ - [ ] If found (unlikely with timestamp), add comment instead of creating duplicate
87+ - [ ] Support ` GITHUB_ALLOW_MULTIPLE_DAILY_SCANS ` for backward compatibility
88+
89+ - [ ] ** 1.7 Dry-Run Mode**
90+ - [ ] Add ` --dry-run-github-issue ` flag
91+ - [ ] Preview issue title, labels, assignee, milestone
92+ - [ ] Display full markdown body with formatting
93+ - [ ] Show what would be created without actually creating it
94+ - [ ] Add instructions on how to create for real
95+
96+ - [ ] ** 1.8 Opt-In Safety**
97+ - [ ] Default ` GITHUB_AUTO_ISSUE=false ` in templates
98+ - [ ] Require explicit ` true ` value to enable auto-creation
99+ - [ ] Skip GitHub integration silently if not enabled
100+ - [ ] Allow manual issue creation from JSON log later
101+
102+ - [ ] ** 1.9 Testing & Validation**
103+ - [ ] Test with Hypercart Server Monitor MKII repository
104+ - [ ] Verify parent issue creation with checklist
105+ - [ ] Test duplicate detection (same-day scans)
106+ - [ ] Verify dry-run mode output
107+ - [ ] Test with different label/assignee/milestone configurations
108+ - [ ] Validate GitHub tasklist β child issue conversion workflow
109+
110+ - [ ] ** 1.10 Documentation**
111+ - [ ] Update README.md with GitHub integration section
112+ - [ ] Add setup instructions (gh CLI installation, authentication)
113+ - [ ] Document template configuration options
114+ - [ ] Add example workflows (auto, manual, dry-run)
115+ - [ ] Include screenshots of parent issue and child issue conversion
116+ - [ ] Document security considerations and permissions
117+
118+ ---
119+
120+ ### ** Phase 2: Enhanced Features**
121+
122+ ** Goal:** Add advanced integrations and analytics
123+
124+ - [ ] ** 2.1 GitHub Projects Integration**
125+ - [ ] Add ` GITHUB_PROJECT ` field to templates
126+ - [ ] Auto-add parent issue to project board
127+ - [ ] Set project status (e.g., "Triage", "To Do")
128+ - [ ] Support GitHub Projects v2 API
129+
130+ - [ ] ** 2.2 Report Artifact Upload**
131+ - [ ] Upload HTML report as GitHub release asset
132+ - [ ] Link to uploaded report in parent issue body
133+ - [ ] Add JSON log as downloadable artifact
134+ - [ ] Set retention policy for old reports
135+
136+ - [ ] ** 2.3 Trend Analysis**
137+ - [ ] Compare current scan with previous scan results
138+ - [ ] Show improvement/regression metrics in issue
139+ - [ ] Add trend chart (e.g., "5 issues β 2 issues β
")
140+ - [ ] Track issue resolution rate over time
141+
142+ - [ ] ** 2.4 Smart Labeling**
143+ - [ ] Auto-detect issue type (security, performance, reliability)
144+ - [ ] Apply category labels to parent issue
145+ - [ ] Suggest labels for child issues based on pattern ID
146+ - [ ] Support custom label mapping in templates
147+
148+ - [ ] ** 2.5 Team Mentions**
149+ - [ ] Parse CODEOWNERS file for file ownership
150+ - [ ] ` @mention ` relevant team members in issue
151+ - [ ] Add team-based assignee suggestions
152+ - [ ] Support custom mention rules in templates
153+
154+ ---
155+
156+ ### ** Phase 3: Advanced Automation**
157+
158+ ** Goal:** Full automation with intelligent workflows
159+
160+ - [ ] ** 3.1 Auto-Close Resolved Issues**
161+ - [ ] Re-scan and compare with previous findings
162+ - [ ] Auto-close child issues when issue no longer detected
163+ - [ ] Add comment with verification details
164+ - [ ] Support manual override (keep issue open)
165+
166+ - [ ] ** 3.2 Webhook Notifications**
167+ - [ ] Add Slack webhook integration
168+ - [ ] Add Discord webhook integration
169+ - [ ] Send scan summary to configured channels
170+ - [ ] Include quick links to parent issue
171+
172+ - [ ] ** 3.3 Email Digests**
173+ - [ ] Weekly summary of scan results
174+ - [ ] Aggregate multiple scans into one email
175+ - [ ] Include trend analysis and highlights
176+ - [ ] Support multiple recipients
177+
178+ - [ ] ** 3.4 Multi-Platform Support**
179+ - [ ] GitLab integration (GitLab CLI)
180+ - [ ] Bitbucket integration (Bitbucket API)
181+ - [ ] Azure DevOps integration (Azure CLI)
182+ - [ ] Generic webhook for other platforms
183+
184+ - [ ] ** 3.5 Auto-PR Creation**
185+ - [ ] Detect simple fixable issues (e.g., add LIMIT clause)
186+ - [ ] Generate fix code automatically
187+ - [ ] Create PR with fix and link to parent issue
188+ - [ ] Add tests to verify fix
189+ - [ ] Request review from CODEOWNERS
190+
191+ ---
192+
15193## π‘ Thoughts on Extending the Workflow
16194
17195### ** Current State Analysis**
@@ -78,23 +256,29 @@ Add to template files:
78256``` bash
79257gh issue create \
80258 --repo " Hypercart-Dev-Tools/Server-Monitor-MKII" \
81- --title " [WP Code Check] Scan Report - 2026-01-10 ( 2 confirmed issues) " \
259+ --title " [WP Code Check] Scan Report ( 2026-01-10-205923) - 2 confirmed issues" \
82260 --body " $( cat parent-issue-template.md) " \
83261 --label " code-quality,wp-code-check" \
84262 --assignee " @me"
85263```
86264
265+ ** Title Format:** ` [WP Code Check] Scan Report (YYYY-MM-DD-HHMMSS) - N confirmed issues `
266+ - ** UTC Timestamp:** Matches JSON log filename for easy correlation
267+ - ** Issue Count:** Quick visibility of scan severity
268+ - ** Unique Identifier:** Prevents duplicates, enables log lookup
269+
87270---
88271
89272## π Parent Issue Template Structure
90273
91274``` markdown
92- # π WP Code Check Scan Report - 2026-01-10
275+ # π WP Code Check Scan Report ( 2026-01-10-205927)
93276
94- ** Scan Date :** 2026-01-10T20:59:27Z
277+ ** Scan Timestamp :** 2026-01-10-205927 UTC (2026-01- 10T20:59:27Z)
95278** Scanner Version:** 1.2.2
96279** Project:** Hypercart Server Monitor MKII v0.2.0
97280** Files Analyzed:** 20 files (3,438 lines of code)
281+ ** Log File:** ` 2026-01-10-205927-UTC.json `
98282
99283---
100284
@@ -296,11 +480,14 @@ gh repo view "$GITHUB_REPO" --json viewerPermission
296480
297481### ** 2. Duplicate Prevention**
298482``` bash
299- # Check if scan report already exists for this date
300- gh issue list --repo " $GITHUB_REPO " --search " in:title [WP Code Check] Scan Report - $( date +%Y-%m-%d) "
301-
302- # If exists, add comment with new scan results instead of creating new issue
303- # Or append to existing issue body
483+ # Check if scan report already exists for this exact timestamp
484+ # UTC timestamp format: YYYY-MM-DD-HHMMSS (matches JSON log filename)
485+ TIMESTAMP=" 2026-01-10-205927"
486+ gh issue list --repo " $GITHUB_REPO " --search " in:title [WP Code Check] Scan Report ($TIMESTAMP )"
487+
488+ # With UTC timestamp, duplicates are virtually impossible
489+ # Each scan has unique timestamp matching the JSON log file
490+ # Example: 2026-01-10-205927-UTC.json β Issue title includes (2026-01-10-205927)
304491```
305492
306493### ** 3. Rate Limiting**
@@ -364,10 +551,11 @@ gh issue list --repo "$GITHUB_REPO" --search "in:title [WP Code Check] Scan Repo
364551./dist/bin/run hypercart-server-monitor-mkii
365552
366553# Output:
367- # β
Scan complete: 5 findings
554+ # β
Scan complete: 5 findings (2026-01-10-205927-UTC.json)
368555# π§ AI Triage: 2 confirmed, 3 false positives
369556# π Detected repo: Hypercart-Dev-Tools/Server-Monitor-MKII
370557# π Creating parent issue with 2 confirmed items...
558+ # π Title: [WP Code Check] Scan Report (2026-01-10-205927) - 2 confirmed issues
371559# β
Issue created: https://github.com/Hypercart-Dev-Tools/Server-Monitor-MKII/issues/42
372560```
373561
@@ -377,11 +565,12 @@ gh issue list --repo "$GITHUB_REPO" --search "in:title [WP Code Check] Scan Repo
377565./dist/bin/run hypercart-server-monitor-mkii --format json
378566
379567# Then create parent issue from scan log
380- ./dist/bin/create-github-issue-from-scan.sh dist/logs/2026-01-10-205923 -UTC.json
568+ ./dist/bin/create-github-issue-from-scan.sh dist/logs/2026-01-10-205927 -UTC.json
381569
382570# Output:
383- # π Scan Summary: 2 confirmed issues, 3 false positives
571+ # π Scan Summary: 2 confirmed issues, 3 false positives (2026-01-10-205927)
384572# π Creating parent issue in Hypercart-Dev-Tools/Server-Monitor-MKII...
573+ # π Title: [WP Code Check] Scan Report (2026-01-10-205927) - 2 confirmed issues
385574# β
Issue #42 created: https://github.com/Hypercart-Dev-Tools/Server-Monitor-MKII/issues/42
386575#
387576# Next steps:
@@ -397,9 +586,10 @@ gh issue list --repo "$GITHUB_REPO" --search "in:title [WP Code Check] Scan Repo
397586# Output:
398587# π Preview of GitHub issue that would be created:
399588#
400- # Title: [WP Code Check] Scan Report - 2026-01-10 ( 2 confirmed issues)
589+ # Title: [WP Code Check] Scan Report ( 2026-01-10-205927) - 2 confirmed issues
401590# Labels: code-quality, wp-code-check
402591# Assignee: @me
592+ # Repo: Hypercart-Dev-Tools/Server-Monitor-MKII
403593#
404594# Body:
405595# ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
@@ -451,9 +641,11 @@ gh issue list --repo "$GITHUB_REPO" --search "in:title [WP Code Check] Scan Repo
451641- π‘ ** Child issues:** Inherit parent milestone automatically
452642
453643### ** 5. Duplicate Handling**
454- - β
** One parent issue per day max** (check for existing issue with same date)
455- - β
** If exists:** Add comment with new scan results instead of creating new issue
456- - βοΈ ** Configurable:** ` GITHUB_ALLOW_MULTIPLE_DAILY_SCANS=true ` (create new issue each time)
644+ - β
** One parent issue per scan** (UTC timestamp ensures uniqueness)
645+ - β
** Timestamp format:** ` (YYYY-MM-DD-HHMMSS) ` matches JSON log filename
646+ - β
** Virtually no duplicates** - each scan has unique timestamp
647+ - β
** Easy correlation:** Issue title β JSON log file (e.g., ` 2026-01-10-205927-UTC.json ` )
648+ - βοΈ ** Configurable:** ` GITHUB_ALLOW_MULTIPLE_DAILY_SCANS ` kept for backward compatibility
457649
458650### ** 6. Notification Preferences**
459651- β
** Default:** Standard GitHub notifications (issue creation)
0 commit comments