@hdwebsoft/hdcode-ai-darwin-x64 0.0.6 → 0.0.8

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 (55) hide show
  1. package/bin/hdcode +0 -0
  2. package/bin/index.js.map +1 -1
  3. package/bin/worker.js.map +1 -1
  4. package/package.json +1 -1
  5. package/resources/agents/finder.md +1 -1
  6. package/resources/agents/mermaid.md +1 -1
  7. package/resources/opencode.json +2 -1
  8. package/resources/skills/hd-code-review/CODING_STANDARDS.md +14 -114
  9. package/resources/skills/hd-code-review/REVIEW_STANDARDS.md +76 -0
  10. package/resources/skills/hd-code-review/SKILL.md +314 -90
  11. package/resources/skills/hd-code-review/reference/review-checklist.md +104 -101
  12. package/resources/skills/hd-code-review/reference/stacks/apex.md +49 -0
  13. package/resources/skills/hd-code-review/reference/stacks/aura.md +39 -0
  14. package/resources/skills/hd-code-review/reference/stacks/cakephp.md +50 -0
  15. package/resources/skills/hd-code-review/reference/stacks/django.md +53 -0
  16. package/resources/skills/hd-code-review/reference/stacks/dotnet.md +52 -0
  17. package/resources/skills/hd-code-review/reference/stacks/expo.md +39 -0
  18. package/resources/skills/hd-code-review/reference/stacks/flutter.md +48 -0
  19. package/resources/skills/hd-code-review/reference/stacks/go.md +51 -0
  20. package/resources/skills/hd-code-review/reference/stacks/laravel.md +56 -0
  21. package/resources/skills/hd-code-review/reference/stacks/lwc.md +49 -0
  22. package/resources/skills/hd-code-review/reference/stacks/nodejs.md +51 -0
  23. package/resources/skills/hd-code-review/reference/stacks/php.md +52 -0
  24. package/resources/skills/hd-code-review/reference/stacks/python.md +50 -0
  25. package/resources/skills/hd-code-review/reference/stacks/react.md +51 -0
  26. package/resources/skills/hd-code-review/reference/stacks/reactnative.md +54 -0
  27. package/resources/skills/hd-code-review/reference/stacks/scala.md +48 -0
  28. package/resources/skills/hd-code-review/reference/stacks/visualforce.md +38 -0
  29. package/resources/skills/hd-code-review/reference/stacks/vuejs.md +52 -0
  30. package/resources/skills/hd-code-review/reference/stacks/wordpress.md +54 -0
  31. package/resources/skills/hd-daily-goals/SKILL.md +41 -9
  32. package/resources/skills/hd-daily-goals/reference/ticket-autofill.md +104 -0
  33. package/resources/skills/hd-daily-goals/reference/validation-rules.md +13 -0
  34. package/resources/skills/hd-daily-report/SKILL.md +70 -14
  35. package/resources/skills/hd-daily-report/reference/sample-report-qc.md +44 -0
  36. package/resources/skills/hd-daily-report/reference/sample-report.md +18 -15
  37. package/resources/skills/hd-daily-report/reference/validation-rules.md +28 -7
  38. package/resources/skills/hd-daily-viewer/SKILL.md +222 -0
  39. package/resources/skills/hd-docs-init/SKILL.md +33 -0
  40. package/resources/skills/hd-docs-parse/SKILL.md +2 -0
  41. package/resources/skills/hd-docs-parse/scripts/parse_document.py +6 -0
  42. package/resources/skills/hd-docs-sync/SKILL.md +65 -3
  43. package/resources/skills/hd-docs-sync/reference/doc-mapping.md +1 -0
  44. package/resources/skills/hd-help/SKILL.md +24 -0
  45. package/resources/skills/hd-help/reference/skill-map.md +122 -7
  46. package/resources/skills/hd-iso/SKILL.md +409 -0
  47. package/resources/skills/hd-iso/reference/iso-27001-requirements.md +166 -0
  48. package/resources/skills/hd-iso/reference/iso-9001-requirements.md +91 -0
  49. package/resources/skills/hd-iso/reference/role-profiles.md +115 -0
  50. package/resources/skills/hd-iso-ready/SKILL.md +146 -0
  51. package/resources/skills/hd-iso-sync/SKILL.md +217 -0
  52. package/resources/skills/hd-iso-sync/reference/frontmatter-schema.md +89 -0
  53. package/resources/skills/hd-iso-verify/SKILL.md +294 -0
  54. package/resources/skills/hd-issue-resolution/SKILL.md +20 -0
  55. package/resources/skills/hd-task/SKILL.md +12 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hd-code-review
3
- description: "Review code changes between branches with a skeptical gatekeeper mindset. Reviews git diff across 11 aspects (requirements, correctness, possible breakage, better approach, redundancy, tests, security, breaking changes, implication assessment, code quality, completeness). Reads CODING_STANDARDS.md for project-specific rules. Outputs Approved / Approved with Comments / Changes Requested verdict."
3
+ description: "Review code changes between branches with a skeptical gatekeeper mindset. Reviews git diff across 12 aspects (requirements, correctness, possible breakage, better approach, redundancy, tests, security, breaking changes, implication assessment, code quality, completeness, architecture & design). Reads CODING_STANDARDS.md for project-specific style rules and REVIEW_STANDARDS.md for tech-stack presets, aspect escalations, and custom aspects. Outputs Approved / Approved with Comments / Changes Requested verdict."
4
4
  license: proprietary
5
5
  metadata:
6
6
  version: "1.0.0"
@@ -9,16 +9,16 @@ metadata:
9
9
 
10
10
  # Code Review Skill
11
11
 
12
- > [IMPORTANT] This skill is THINKING-HEAVY it relies on reading the diff and applying
13
- > the 11-aspect checklist from `reference/review-checklist.md`. It does NOT replace
14
- > `hd-security-review` for deep security analysis.
12
+ > [IMPORTANT] This skill orchestrates 3 parallel subagents (`code-review-security`, `code-review-logic`, `code-review-quality`)
13
+ > that each embed the relevant aspect checklists from `reference/review-checklist.md`.
14
+ > It does NOT replace `hd-security-review` for deep security analysis.
15
15
  > For comprehensive security review, run `/hd-security-review code-review` separately.
16
16
 
17
17
  ## Pipeline
18
18
 
19
19
  ```
20
20
  INPUT → Arg Parse → Standards Load → Diff Fetch → Task Context →
21
- 11-Aspect ReviewBreaking Change Gate → Verdict → File Output → (TODO: Post to VCS)
21
+ Context Assembly[code-review-security code-review-logic ‖ code-review-quality] → Gate → Verdict → File Output → (TODO: Post to VCS)
22
22
  ```
23
23
 
24
24
  ---
@@ -39,20 +39,7 @@ Parse the invocation:
39
39
 
40
40
  ### Natural Language Resolution
41
41
 
42
- If the first argument is not a task URL and contains branch-like patterns,
43
- extract branch names before treating the remainder as task context:
44
-
45
- | Pattern | Example | Resolution |
46
- |---------|---------|------------|
47
- | `against <branch>` | "against develop" | `TARGET_BRANCH = develop` |
48
- | `vs <branch>` | "vs main" | `TARGET_BRANCH = main` |
49
- | `compare with <branch>` | "compare with staging" | `TARGET_BRANCH = staging` |
50
- | `from <branch>` | "from feat/auth" | `SOURCE_BRANCH = feat/auth` |
51
- | `<branch> against <branch>` | "feat/x against main" | SOURCE = feat/x, TARGET = main |
52
-
53
- After extracting branch names, treat any remaining text as task context (Path B).
54
- If remaining text is empty or only articles/prepositions, treat as no task context (Path C).
55
- Explicit flags (`--source`, `--target`) always take precedence over natural language.
42
+ Extract branch names from patterns like "against `<b>`", "vs `<b>`", "from `<b>`", "`<s>` against `<t>`". Remaining text = task context (Path B); empty remainder = Path C. Explicit flags always take precedence.
56
43
 
57
44
  Determine:
58
45
  - `SOURCE_BRANCH` — from `--source` flag, natural language, or `git branch --show-current`
@@ -80,6 +67,41 @@ Display: `Standards loaded. Active policies: [comma-separated list of policies w
80
67
 
81
68
  ---
82
69
 
70
+ ## Phase 1.5: Review Standards Load
71
+
72
+ Load `REVIEW_STANDARDS.md` via two-layer inheritance:
73
+
74
+ | Layer | Path | Role |
75
+ |-------|------|------|
76
+ | Layer 1 (always) | `skills/hd-code-review/REVIEW_STANDARDS.md` | Schema + empty defaults |
77
+ | Layer 2 (if exists) | `<project-root>/docs/REVIEW_STANDARDS.md` | Project overrides — wins on conflict |
78
+
79
+ Extract:
80
+ - `TECH_STACK` — from `tech_stack:` field (`~` = none)
81
+ - `ASPECT_ESCALATIONS` — aspects promoted from Tier 2 advisory to Tier 1 blocker
82
+ - `CUSTOM_ASPECTS` — project-specific review dimensions
83
+
84
+ If `TECH_STACK` is explicitly set (not `~`): record it as the forced stack — skip auto-detection in Phase 4.
85
+
86
+ Apply `ASPECT_ESCALATIONS`: escalated aspect numbers are passed to agents via the Review Context payload; agents mark those findings as 🔴 Blocker. The skill also checks ALL agent outputs (including quality) for 🔴 markers when escalations are active.
87
+
88
+ Display: `Review standards loaded. Stack: <explicit value or 'auto-detect'> | Escalations: <count> | Custom aspects: <count>`
89
+
90
+ ---
91
+
92
+ ## Phase 1.6: Known Issues Load
93
+
94
+ Load `docs/KNOWN_ISSUES.md` if it exists in the project root:
95
+
96
+ | Condition | Action |
97
+ |-----------|--------|
98
+ | File exists | Parse all `## KI-NNN` entries into `KNOWN_ISSUES` list. Each entry captures: ID, title, scope, reason, accepted-on, target-fix. |
99
+ | File does not exist | `KNOWN_ISSUES` = empty list. |
100
+
101
+ Display: `Known issues loaded: <N> entries.` or `Known issues: none (docs/KNOWN_ISSUES.md not found).`
102
+
103
+ ---
104
+
83
105
  ## Phase 2: Diff Fetch
84
106
 
85
107
  Run:
@@ -98,103 +120,240 @@ Assess diff size:
98
120
 
99
121
  Display: `Diff: <N> lines changed across <M> files`
100
122
 
123
+ **Remote URL detection** (run in parallel with diff, does not block):
124
+
125
+ ```bash
126
+ git remote get-url origin
127
+ ```
128
+
129
+ Parse the output into `PLATFORM_LINK_BASE`:
130
+
131
+ | Remote URL pattern | Platform | `PLATFORM_LINK_BASE` |
132
+ |--------------------|----------|----------------------|
133
+ | `https://github.com/<owner>/<repo>[.git]` | GitHub | `https://github.com/<owner>/<repo>/blob/<SOURCE_BRANCH>` |
134
+ | `git@github.com:<owner>/<repo>.git` | GitHub | `https://github.com/<owner>/<repo>/blob/<SOURCE_BRANCH>` |
135
+ | `https://gitlab.com/<owner>/<repo>[.git]` | GitLab | `https://gitlab.com/<owner>/<repo>/-/blob/<SOURCE_BRANCH>` |
136
+ | `git@gitlab.com:<owner>/<repo>.git` | GitLab | `https://gitlab.com/<owner>/<repo>/-/blob/<SOURCE_BRANCH>` |
137
+ | `https://bitbucket.org/<owner>/<repo>[.git]` | Bitbucket | `https://bitbucket.org/<owner>/<repo>/src/<SOURCE_BRANCH>` |
138
+ | Any other host (self-hosted) | unknown | `~` |
139
+ | Command fails / no remote | none | `~` |
140
+
141
+ If `REVIEW_STANDARDS.md` has `remote_url` set (Layer 2 override), use it instead and skip `git remote get-url origin` parsing. The `remote_url` value IS the `PLATFORM_LINK_BASE` (append `/<SOURCE_BRANCH>` if the value ends with the repo path and has no branch segment, or use as-is if it already includes the branch path).
142
+
143
+ Store as `PLATFORM_LINK_BASE` (`~` = unavailable — fall back to IDE-only links).
144
+
101
145
  ---
102
146
 
103
147
  ## Phase 3: Task Context
104
148
 
105
- Three pathscheck in order:
149
+ **Path AURL provided:** Detect platform (Linear `linear.app`, Jira `atlassian.net`, ClickUp `app.clickup.com`, Asana `app.asana.com`). Fetch title + description + labels via MCP; if MCP inactive, ask user to paste.
150
+
151
+ Detect task type:
152
+ | Signal | Type |
153
+ |--------|------|
154
+ | Labels: `bug`/`defect`/`regression`/`hotfix` | Bug |
155
+ | Branch prefix: `fix/` `hotfix/` `bugfix/` `patch/` | Bug |
156
+ | Otherwise | Feature (default) |
157
+
158
+ **Feature:** Parse `- [ ]`/`- [x]` items as ACs; fall back to full description if none. Display: `Task context loaded: <title> — <N> ACs`. Aspects 1 + 11: cross-reference each AC.
106
159
 
107
- **Path A Task URL provided:**
108
- - Detect platform from URL pattern: Linear (`linear.app`), Jira (`atlassian.net`), ClickUp (`app.clickup.com`), Asana (`app.asana.com`)
109
- - If MCP is active: call `get_task` with the detected platform to fetch title + description
110
- - If MCP is inactive: ask the user to paste the task title and description
160
+ **Bug:** Fetch comments + priority via MCP. Display: `Task context loaded: <title> — Bug (Priority: <P>) | Repro: <first comment or "none">`. Elevate Aspects 2, 3, 6 (require regression test).
111
161
 
112
- **Path B — Plain-text description provided:**
113
- - Use the provided text as-is for requirements context in Aspects 1 and 11
162
+ **Path B — Plain text:** Use as-is for Aspects 1 and 11.
114
163
 
115
- **Path C — No context provided:**
116
- - Note: Aspects 1 (Requirements Coverage) and 11 (Completeness) will be marked N/A
117
- - Proceed with the 9 remaining aspects only
164
+ **Path C — None:** Aspects 1 and 11 → N/A; continue with 9 remaining.
118
165
 
119
166
  ---
120
167
 
121
- ## Phase 4: 11-Aspect Review
168
+ ## Phase 4: Context Assembly
169
+
170
+ **Step 1 — Stack detection:** If `TECH_STACK` was explicitly set in Phase 1.5, use it. Otherwise, auto-detect from the diff's changed file extensions:
171
+
172
+ | Extensions / path signals in diff | Stack preset(s) loaded |
173
+ |-----------------------------------|----------------------|
174
+ | `.cs` `.csproj` `.sln` `.razor` | `dotnet` |
175
+ | `.ts` `.js` `.mjs` `.cjs` `package.json` (no `.tsx`/`.jsx`, no RN signals) | `nodejs` |
176
+ | `.tsx` `.jsx` (no RN signals) | `react` |
177
+ | `.ts` `.js` + `.tsx` `.jsx` (no RN signals) | `nodejs` + `react` |
178
+ | `.vue` | `vuejs` |
179
+ | `.native.ts/tsx/js` OR `react-native` in `package.json`, `android/`/`ios/` paths (no Expo) | `reactnative` |
180
+ | RN signals + `expo` in `package.json` / `app.json` / `app.config.*` | `reactnative` + `expo` |
181
+ | `.dart` `pubspec.yaml` | `flutter` |
182
+ | `.go` `go.mod` | `go` |
183
+ | `.py` (no Django path signals) | `python` |
184
+ | `.py` + Django paths (`views.py` `models.py` `urls.py` `serializers.py` `migrations/`) | `python` + `django` |
185
+ | `.php` (no framework signals) | `php` |
186
+ | `.php` + Laravel signals (`artisan`, `app/Http/Controllers/`, `routes/web.php`) | `php` + `laravel` |
187
+ | `.php` + CakePHP signals (`src/Controller/`, `config/routes.php`, `"cakephp/cakephp"` in `composer.json`) | `php` + `cakephp` |
188
+ | `.php` + WordPress signals (`wp-config.php`, `wp-content/`, `functions.php`, WP function calls) | `php` + `wordpress` |
189
+ | `.scala` `build.sbt` | `scala` |
190
+ | `.cls` `.trigger` `.apex` | `apex` |
191
+ | `.html` or `.js` under `lwc/` path | `lwc` |
192
+ | `.cls` + `.html`/`.js` under `lwc/` path | `apex` + `lwc` |
193
+ | `.cmp` `.app` `.evt` `.intf` | `aura` |
194
+ | `.page` or `.component` under `pages/` path | `visualforce` |
195
+ | Multiple sets present | all matching presets — checks scoped to relevant file types |
196
+ | None of the above | none |
197
+
198
+ Read `reference/stacks/<stack>.md` for each detected stack.
199
+
200
+ **Step 2 — Build the Review Context payload** (used as the prompt for all 3 agents):
122
201
 
123
- **Before starting:** Read `reference/review-checklist.md` in full. Apply every aspect from that file to the diff.
202
+ ```markdown
203
+ ## Review Context
124
204
 
125
- **Strategy for large diffs:** Do not review linearly. Process file-by-file, then function-by-function within each file. Trace call paths where behavior is non-obvious.
205
+ ### Diff
206
+ ```diff
207
+ <full git diff>
208
+ ```
126
209
 
127
- **Aspect 4 (Better Approach) rule:** ALWAYS use Grep/Glob to verify that an alternative pattern does not already exist in the codebase before suggesting it. Do not recommend an approach that is already present.
210
+ ### Task
211
+ - Title: <title or "No task context provided">
212
+ - Type: Bug | Feature | N/A
213
+ - Acceptance Criteria:
214
+ <AC list, or "No task context provided">
128
215
 
129
- **Output per aspect:**
130
- - No issues: `✓ Aspect N (Name) — no issues`
131
- - Issues found: full finding block with 🔴 Blocker or 🟡 Advisory severity (see checklist for per-aspect rules)
216
+ ### Coding Standards
217
+ <merged CODING_STANDARDS content>
132
218
 
133
- Track state across all aspects:
134
- - `has_blocker` set to `true` if any 🔴 finding is recorded
135
- - `has_advisory` — set to `true` if any 🟡 finding is recorded
219
+ ### Tech Stack
220
+ <detected stack(s), or "none">
136
221
 
137
- ---
222
+ ### Stack-Specific Checks
223
+ <full content of reference/stacks/<stack>.md for each detected stack, or "none">
224
+ When multiple stacks are active, scope each stack's checks to files of that type.
138
225
 
139
- ## Phase 5: Breaking Change Gate
226
+ ### Escalated Aspects
227
+ <comma-separated aspect numbers from ASPECT_ESCALATIONS, or "none">
140
228
 
141
- Regardless of other findings, check for breaking changes in the diff:
229
+ ### Custom Aspects (Tier 1)
230
+ <CUSTOM_ASPECTS entries with tier: 1, or "none">
142
231
 
143
- - Public API signature changes (function name, parameter names/types/order, return type)
144
- - Existing interface or contract violations (removed fields, renamed fields, changed types)
145
- - DB schema changes without a corresponding migration
146
- - Config format changes that break existing deployments
147
- - Behavior changes for existing users without explicit versioning
232
+ ### Custom Aspects (Tier 2)
233
+ <CUSTOM_ASPECTS entries with tier: 2, or "none">
148
234
 
149
- If any breaking changes found: produce a dedicated `### ⚠️ Breaking Changes` block.
150
- This block appears in the final verdict output **even if the overall verdict is Approved**.
151
- If none found, write: `No breaking changes detected.`
235
+ ### Known Issues
236
+ <KNOWN_ISSUES list (ID, title, scope, reason, target-fix for each entry), or "none">
152
237
 
153
- ---
238
+ ### Cross-Reference Instruction
239
+ When generating findings: if a finding topic or file scope overlaps with a known issue entry above, append `[Known Issue: KI-NNN — <title>]` to that finding and downgrade its severity to **INFO**. Do NOT omit the finding — preserve full visibility. A finding can match at most one KI entry.
154
240
 
155
- ## Phase 6: Verdict
241
+ ### Platform Link Base
242
+ <PLATFORM_LINK_BASE value, or "~" if unavailable>
156
243
 
157
- Determine verdict from tracked state:
244
+ ### Finding Format (REQUIRED)
245
+ Every finding header MUST include the affected file AND line number as clickable links.
158
246
 
247
+ **When `Platform Link Base` is set (not `~`)** — produce dual links: IDE link + platform link:
159
248
  ```
160
- has_blocker = true → ❌ Changes Requested
161
- has_blocker = false AND has_advisory = true → ⚠️ Approved with Comments
162
- has_blocker = false AND has_advisory = false → ✅ Approved
249
+ **<PREFIX>:<N>** <🔴/🟡> <Label> · [<file>:<line>](<file>#L<line>) · [↗](<PLATFORM_LINK_BASE>/<file>#L<line>)
250
+ **<PREFIX>:<N>** <🔴/🟡> <Label> · [<file>:<start>-<end>](<file>#L<start>-L<end>) · [↗](<PLATFORM_LINK_BASE>/<file>#L<start>-L<end>)
163
251
  ```
164
252
 
165
- Output in this format:
253
+ **When `Platform Link Base` is `~`** — IDE link only:
254
+ ```
255
+ **<PREFIX>:<N>** — <🔴/🟡> <Label> · [<file>:<line>](<file>#L<line>)
256
+ **<PREFIX>:<N>** — <🔴/🟡> <Label> · [<file>:<start>-<end>](<file>#L<start>-L<end>)
257
+ ```
166
258
 
167
- ```markdown
259
+ Rules:
260
+ - Extract line numbers from the diff `@@` hunk headers and `+`/`-` line markers
261
+ - Use the **new file** (post-patch) line number where the issue appears
262
+ - For a range, use `start-end` in display text and `#L<start>-L<end>` as the anchor
263
+ - The anchor MUST be `#L<line>` (e.g., `#L140`) — never `#<line>` or `:<line>`
264
+ - If no specific line can be determined, omit the line number rather than guess
265
+ ```
266
+
267
+ ---
268
+
269
+ ## Phase 4.5: Parallel Agent Review
270
+
271
+ Print the review header before spawning agents:
272
+
273
+ ```
168
274
  ## Code Review: `<SOURCE_BRANCH>` → `<TARGET_BRANCH>`
169
275
  **Reviewed:** <YYYY-MM-DD>
170
276
  **Task:** <task title or 'No task context'>
171
277
  **Standards:** <comma-separated required policies, or 'defaults only'>
172
278
 
173
279
  ---
280
+ ⏳ Running parallel review (security · logic · quality)...
281
+ ```
282
+
283
+ Record `T1_START` = current timestamp (seconds).
174
284
 
175
- ### Review Findings
176
-
177
- ✓ Aspect 1 (Requirements Coverage) — no issues
178
- ✓ Aspect 2 (Correctness) — no issues
179
- **Aspect 3 — Possible Breakage** 🔴 Blocker
180
- - Unhandled null case in createUser() when email is undefined — src/users.ts:42
181
- ✓ Aspect 4 (Better Approach) — no issues
182
- ✓ Aspect 5 (Redundancy) — no issues
183
- **Aspect 6 — Tests** 🔴 Blocker
184
- - No test covers the null email path added in src/users.ts
185
- ✓ Aspect 7 (Security) — no issues
186
- ✓ Aspect 8 (Breaking Changes) — see Breaking Changes block below
187
- ✓ Aspect 9 (Implication Assessment) — no issues
188
- ✓ Aspect 10 (Code Quality) — no issues
189
- ✓ Aspect 11 (Completeness) — no issues
285
+ **Spawn all 3 agents simultaneously** (single parallel tool call):
190
286
 
287
+ | Agent | Aspects | Model | Context |
288
+ |-------|---------|-------|---------|
289
+ | `code-review-security` | 3, 7, 8 + Tier 1 custom | sonnet | Review Context payload |
290
+ | `code-review-logic` | 2, 6, 1, 11 + Tier 1 custom | sonnet | Review Context payload |
291
+ | `code-review-quality` | 4, 5, 9, 10, 12 + Tier 2 custom | haiku | Review Context payload |
292
+
293
+ Wait for all 3 agents to complete. Record `T1_END` = current timestamp (seconds).
294
+
295
+ **Print results:** Output each agent's full response **verbatim** (do NOT reconstruct, summarize, or reformat findings — preserve the original finding headings, description, suggestion, and the fenced `markdown` copy block exactly as the agent emitted them):
296
+ 1. `code-review-security` output (Tier 1 — security & safety)
297
+ 2. `code-review-logic` output (Tier 1 — correctness & coverage)
298
+ 3. *(hold `code-review-quality` output — apply gate first)*
299
+
300
+ **Gate check:** Scan the combined security + logic outputs for any 🔴 marker.
301
+
302
+ If blockers found:
303
+
304
+ ```
191
305
  ---
306
+ ⏱ Tier 1 completed in <T1_END - T1_START>s
307
+ **Tier 1 complete.** 🔴 Blocker(s) found — this branch needs rework before advisories matter.
308
+ Continue to advisory aspects (better approach, redundancy, implications, quality, architecture)? [y/n]
309
+ ```
192
310
 
193
- ### ⚠️ Breaking Changes
194
- - Changed signature of `createUser(name)` → `createUser(name, options)` — check all callers
311
+ Wait for user input. If **n** → skip to Phase 6 immediately.
312
+
313
+ If no blockers (or user says **y**):
314
+
315
+ ```
316
+ ---
317
+ ⏱ Tier 1 completed in <T1_END - T1_START>s · no blockers — continuing to advisory aspects...
318
+ ```
319
+
320
+ Record `T2_START` = current timestamp (seconds).
321
+
322
+ Print `code-review-quality` output now.
323
+
324
+ Record `T2_END` = current timestamp (seconds). Print timing line:
325
+
326
+ ```
327
+ ⏱ Tier 2 completed in <T2_END - T2_START>s
328
+ ```
329
+
330
+ **Track state from agent outputs:**
331
+ - `has_blocker` — `true` if any 🔴 found across all agent outputs
332
+ - `has_advisory` — `true` if any 🟡 found across all agent outputs
333
+ - `findings[]` — collect all findings from all agents; assign global sequential IDs (F:1, F:2, …) mapping from agent-local IDs (SEC:N, LOG:N, QUA:N). These global IDs are used **only** in Phase 7 file output (HTML comment markers) and Phase 8 copy menu — the live display above prints verbatim agent output with original IDs
334
+
335
+ Print total timing:
336
+
337
+ ```
338
+ ⏱ Total review: <(T1_END - T1_START) + (T2_END - T2_START)>s (Tier 1: <T1_END - T1_START>s · Tier 2: <T2_END - T2_START>s)
339
+ ```
195
340
 
196
341
  ---
197
342
 
343
+ ## Phase 6: Verdict
344
+
345
+ Determine verdict from tracked state:
346
+
347
+ ```
348
+ has_blocker = true → ❌ Changes Requested
349
+ has_blocker = false AND has_advisory = true → ⚠️ Approved with Comments
350
+ has_blocker = false AND has_advisory = false → ✅ Approved
351
+ ```
352
+
353
+ Print the closing verdict (aspects were already printed progressively — do NOT re-list them):
354
+
355
+ ```markdown
356
+ ---
198
357
  ## Verdict: ❌ Changes Requested
199
358
  Fix all 🔴 Blocker findings before merging.
200
359
 
@@ -203,6 +362,11 @@ Fix all 🔴 Blocker findings before merging.
203
362
  > automated testing, and security scanning.
204
363
  ```
205
364
 
365
+ Verdict line variants:
366
+ - `❌ Changes Requested` → `Fix all 🔴 Blocker findings before merging.`
367
+ - `⚠️ Approved with Comments` → `Address 🟡 advisory findings where practical.`
368
+ - `✅ Approved` → `No blocking issues found.`
369
+
206
370
  ---
207
371
 
208
372
  ## Phase 7: File Output
@@ -216,6 +380,19 @@ Determine output path:
216
380
 
217
381
  Write the full verdict output to the file. Create intermediate directories as needed.
218
382
 
383
+ When writing findings to the file, wrap each finding block with HTML comment markers so they can be extracted individually. Preserve the agent-local ID (e.g., `SEC:2`, `LOG:1`, `QUA:3`) in the heading so findings are searchable by ID:
384
+ ```
385
+ <!-- F:1 -->
386
+ ### LOG:1 — 🔴 Correctness · `src/auth.ts:42`
387
+ ...finding content...
388
+
389
+ <!-- F:2 -->
390
+ ### SEC:2 — 🟡 Security · `src/api.ts:15`
391
+ ...finding content...
392
+ ```
393
+
394
+ The markers are hidden when rendered on GitHub/GitLab — safe to paste as-is.
395
+
219
396
  Display: `Review saved to <path>`
220
397
 
221
398
  Then output:
@@ -230,28 +407,75 @@ For full OWASP Top 10, PII audit, compliance gate, and tenant isolation — scop
230
407
 
231
408
  ---
232
409
 
233
- ## Phase 8: Future Hook (TODO)
410
+ ## Phase 8: Interactive Finding Copy
411
+
412
+ Only enter this phase if `findings[]` is non-empty.
413
+
414
+ Display the findings menu:
234
415
 
235
416
  ```
236
- ## TODO: VCS Integration
237
- Post review as PR/MR comment when platform integration is available.
417
+ 📋 Copy a finding to clipboard — paste directly into GitHub/GitLab:
238
418
 
239
- Planned endpoints:
240
- - GitHub: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews
241
- - GitLab: POST /projects/{id}/merge_requests/{iid}/notes
419
+ [1] 🔴 Correctness · src/auth.ts:42
420
+ [2] 🟡 Security · src/api.ts:15
421
+ [3] 🟡 Code Quality · src/utils.ts:88
242
422
 
243
- For now: copy the review output and paste it as a PR comment manually.
423
+ Enter number to copy, or Enter to skip:
244
424
  ```
245
425
 
246
- ---
426
+ Wait for user input.
427
+
428
+ **On a valid number N:**
429
+
430
+ Run via Bash — extract finding block N from the saved file and copy to clipboard:
431
+
432
+ ```bash
433
+ # Extract block between <!-- F:N --> and next <!-- F: --> marker (or EOF)
434
+ # Windows
435
+ awk '/<!-- F:N -->/{found=1;next} /<!-- F:[0-9]/{if(found)exit} found{print}' "<path>" | clip
247
436
 
248
- ## Quick Reference
437
+ # macOS
438
+ awk '/<!-- F:N -->/{found=1;next} /<!-- F:[0-9]/{if(found)exit} found{print}' "<path>" | pbcopy
249
439
 
440
+ # Linux
441
+ awk '/<!-- F:N -->/{found=1;next} /<!-- F:[0-9]/{if(found)exit} found{print}' "<path>" | xclip -sel clip
250
442
  ```
251
- /hd-code-review — review HEAD vs main
252
- /hd-code-review --source=feat/my-branch — specific source branch
253
- /hd-code-review --target=develop — review against develop
254
- /hd-code-review "Add user auth feature" with plain-text task
255
- /hd-code-review https://linear.app/.../PROJ-123 — with Linear task URL
256
- /hd-code-review --source=feat/x -- src/auth/ — scope diff to path
443
+
444
+ Replace `N` with the actual finding number. Use the platform detected during Phase 7.
445
+
446
+ Display: `Finding [N] copied paste into your PR comment`
447
+
448
+ Then prompt again (loop until empty input).
449
+
450
+ **On empty input / Enter:** Exit the loop silently.
451
+
452
+ ## Known Issues Suggestion Hook
453
+
454
+ After the copy loop exits, scan all findings in the review for language indicating accepted or deferred debt:
455
+
456
+ **Trigger signals** (in finding text, task description, or PR description):
457
+ - "known issue", "known limitation", "we know", "already known"
458
+ - "accepted", "acceptable for now", "accepted debt", "acknowledged"
459
+ - "workaround", "temporary fix", "deferred", "won't fix", "can't fix now"
460
+ - "TODO", "FIXME", "tech debt", "legacy"
461
+
462
+ For each finding that **matches a trigger signal but has no existing KI entry** (i.e., not already annotated `[Known Issue: KI-NNN]`):
463
+
257
464
  ```
465
+ > Finding [SEC:2] appears to be accepted/deferred debt ("workaround for legacy auth").
466
+ > Add to docs/KNOWN_ISSUES.md as a known issue? (y/n)
467
+ ```
468
+
469
+ On **yes**: append a new KI entry to `docs/KNOWN_ISSUES.md` with:
470
+ - Auto-assigned next sequential ID (scan existing KI-NNN headings to determine next number)
471
+ - Title from finding label
472
+ - Scope from affected file
473
+ - Reason left as `<fill in reason>` placeholder
474
+ - Accepted by: `<fill in>`
475
+ - Accepted on: today's date
476
+ - Target fix: `<fill in>`
477
+
478
+ Display: `KI-NNN added to docs/KNOWN_ISSUES.md — fill in Reason, Accepted by, and Target fix.`
479
+
480
+ On **no**: skip silently. Only prompt once per matching finding.
481
+