hq-jr 0.1.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/.env.example +22 -0
- package/LICENSE +176 -0
- package/README.md +207 -0
- package/app.yml +17 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +193 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +16 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +827 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/review.d.ts +217 -0
- package/dist/schemas/review.js +52 -0
- package/dist/schemas/review.js.map +1 -0
- package/dist/services/ai.d.ts +58 -0
- package/dist/services/ai.js +268 -0
- package/dist/services/ai.js.map +1 -0
- package/dist/services/context-packager.d.ts +26 -0
- package/dist/services/context-packager.js +105 -0
- package/dist/services/context-packager.js.map +1 -0
- package/dist/services/db.d.ts +31 -0
- package/dist/services/db.js +133 -0
- package/dist/services/db.js.map +1 -0
- package/dist/services/diff-parser.d.ts +43 -0
- package/dist/services/diff-parser.js +190 -0
- package/dist/services/diff-parser.js.map +1 -0
- package/dist/services/discussion.d.ts +20 -0
- package/dist/services/discussion.js +78 -0
- package/dist/services/discussion.js.map +1 -0
- package/dist/services/file-filter.d.ts +10 -0
- package/dist/services/file-filter.js +167 -0
- package/dist/services/file-filter.js.map +1 -0
- package/dist/services/json-repair.d.ts +4 -0
- package/dist/services/json-repair.js +100 -0
- package/dist/services/json-repair.js.map +1 -0
- package/dist/services/remediation.d.ts +41 -0
- package/dist/services/remediation.js +370 -0
- package/dist/services/remediation.js.map +1 -0
- package/dist/services/review-memory.d.ts +44 -0
- package/dist/services/review-memory.js +99 -0
- package/dist/services/review-memory.js.map +1 -0
- package/dist/services/sandbox-runner.d.ts +66 -0
- package/dist/services/sandbox-runner.js +144 -0
- package/dist/services/sandbox-runner.js.map +1 -0
- package/dist/services/scrubber.d.ts +7 -0
- package/dist/services/scrubber.js +46 -0
- package/dist/services/scrubber.js.map +1 -0
- package/dist/services/symbol-cache.d.ts +34 -0
- package/dist/services/symbol-cache.js +49 -0
- package/dist/services/symbol-cache.js.map +1 -0
- package/package.json +61 -0
package/.env.example
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# GitHub App Configuration
|
|
2
|
+
APP_ID=
|
|
3
|
+
PRIVATE_KEY=
|
|
4
|
+
WEBHOOK_SECRET=
|
|
5
|
+
WEBHOOK_PROXY_URL=https://smee.io/your_smee_channel_id
|
|
6
|
+
|
|
7
|
+
# Google Cloud Vertex AI Configuration
|
|
8
|
+
GOOGLE_CLOUD_PROJECT=your-google-cloud-project-id
|
|
9
|
+
GOOGLE_CLOUD_LOCATION=global
|
|
10
|
+
# GOOGLE_APPLICATION_CREDENTIALS=/path/to/application_default_credentials.json
|
|
11
|
+
|
|
12
|
+
# Model Routing Configuration (defaults match src/config.ts)
|
|
13
|
+
HQ_JR_MODEL_TIER1=gemini-3.8-flash
|
|
14
|
+
HQ_JR_MODEL_TIER2=gemini-3.8-flash
|
|
15
|
+
# Optional override for Tier 2: gemini-3.1-pro-preview
|
|
16
|
+
HQ_JR_AGENT_TIER3=antigravity-preview-05-2026
|
|
17
|
+
HQ_JR_DB_PATH=./data/hq-jr.db
|
|
18
|
+
|
|
19
|
+
# Server Configuration
|
|
20
|
+
PORT=3000
|
|
21
|
+
NODE_ENV=development
|
|
22
|
+
LOG_LEVEL=info
|
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or exemplary damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo.png" alt="Headquarter Junior logo" width="300" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">hq-jr</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>The junior engineer who won't say LGTM until the break reproduces.</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
Self-hosted GitHub App that reviews PRs with Vertex AI, remembers past findings,
|
|
13
|
+
and can reproduce bugs in a sandbox before it speaks.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
### Why hq-jr
|
|
17
|
+
|
|
18
|
+
- **Sandbox proof.** Suspicious findings can be reproduced in an isolated container before the bot files a strong claim. Tier 3 / Antigravity is experimental.
|
|
19
|
+
- **Mention manners.** Peer-to-peer PR chat is ignored until someone addresses `@hq-jr`.
|
|
20
|
+
- **Self-hosted on Vertex.** Runs in your account. Diffs go to your GCP project via Vertex AI, not a third-party review SaaS.
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License Apache-2.0" /></a>
|
|
24
|
+
<a href="https://probot.github.io/"><img src="https://img.shields.io/badge/Probot-v13-ea4aaa?logo=probot&logoColor=white" alt="Probot v13" /></a>
|
|
25
|
+
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-22-339933?logo=nodedotjs&logoColor=white" alt="Node.js 22" /></a>
|
|
26
|
+
<a href="https://cloud.google.com/vertex-ai"><img src="https://img.shields.io/badge/Google%20Cloud-Vertex%20AI-4285F4?logo=googlecloud&logoColor=white" alt="Google Cloud Vertex AI" /></a>
|
|
27
|
+
<a href="https://sqlite.org/"><img src="https://img.shields.io/badge/SQLite-WAL-003B57?logo=sqlite&logoColor=white" alt="SQLite WAL" /></a>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
Junior sits on your webhook path. Humans skim diffs and type LGTM. Junior does not skim.
|
|
33
|
+
|
|
34
|
+
It filters noise, scrubs credentials, triages with a fast model, then deep-reviews risky hunks. SQLite WAL memory tracks prior findings across pushes. When a break looks real, it can ask the experimental sandbox path to reproduce before speaking loudly. Tag `@hq-jr fix` if you want a remediation branch.
|
|
35
|
+
|
|
36
|
+
### Generic AI review bots vs hq-jr
|
|
37
|
+
|
|
38
|
+
| Dimension | Generic AI review bots | hq-jr |
|
|
39
|
+
| :--- | :--- | :--- |
|
|
40
|
+
| **Verification** | Guesses from completions. | Can reproduce in a sandbox before strong claims (Tier 3 experimental). |
|
|
41
|
+
| **Memory** | Stateless; repeats nags after force-push. | SQLite WAL remembers prior findings. |
|
|
42
|
+
| **Noise** | Reviews lockfiles and vendor junk. | Heuristic filter + Tier 1 triage skip low-risk diffs. |
|
|
43
|
+
| **Etiquette** | Hijacks human threads. | Speaks when `@hq-jr` is mentioned (or already in-thread). |
|
|
44
|
+
| **Hosting** | Third-party SaaS sees your diffs. | Self-hosted; Vertex AI in *your* GCP project. |
|
|
45
|
+
| **Secrets** | Raw diffs to vendor endpoints. | Scrubber redacts common tokens/keys before model calls. |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Architecture Overview
|
|
50
|
+
|
|
51
|
+
```mermaid
|
|
52
|
+
flowchart TD
|
|
53
|
+
PR["GitHub Webhook: PR / Comment / Check Run"] --> Ingress["Probot Webhook Ingress: HMAC SHA-256"]
|
|
54
|
+
Ingress --> Route{"Event Router"}
|
|
55
|
+
|
|
56
|
+
Route -->|"PR Discussion Comment"| AntiHijack{"Is @hq-jr mentioned or in thread history?"}
|
|
57
|
+
AntiHijack -->|"Yes"| Disc["Discussion Engine: replyToDiscussion"]
|
|
58
|
+
Disc --> PostReply["Post PR Thread Reply"]
|
|
59
|
+
AntiHijack -->|"No"| Ignore["Ignore (Human Peer Review)"]
|
|
60
|
+
|
|
61
|
+
Route -->|"PR Sync, Open, or @hq-jr review"| Filter["Diff Parser & Heuristic Filter"]
|
|
62
|
+
Filter -->|"Zero Reviewable Hunks"| FastPass["Complete Check Run: Neutral"]
|
|
63
|
+
Filter -->|"Reviewable Diffs"| Scrubber["Secret & Credential Scrubber"]
|
|
64
|
+
Scrubber --> Tier1["Tier 1: Fast Triage"]
|
|
65
|
+
|
|
66
|
+
Tier1 --> TriageDecision{"Any shouldReview files?"}
|
|
67
|
+
TriageDecision -->|"No"| LowRiskExit["Complete Check Run: Low Risk"]
|
|
68
|
+
TriageDecision -->|"Yes"| Memory["Prior Review Memory: review-memory.ts"]
|
|
69
|
+
Memory --> Tier2["Tier 2: Deep Review + High Thinking"]
|
|
70
|
+
|
|
71
|
+
Tier2 --> Output["Post Line Comments (with HTTP 422 Fallback) & Complete Check Run"]
|
|
72
|
+
|
|
73
|
+
Route -->|"@hq-jr fix / merge"| RBAC{"Caller write or admin?"}
|
|
74
|
+
RBAC -->|"Yes"| Remediate["Autonomous Remediation: synthesizeFileFix & Branch Commit"]
|
|
75
|
+
RBAC -->|"No"| Deny["Post Access Denied Notice"]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Multi-Tier AI Review Funnel
|
|
79
|
+
|
|
80
|
+
Defaults match [`src/config.ts`](src/config.ts): Tier 1 and Tier 2 use `gemini-3.8-flash`. Override via env if needed.
|
|
81
|
+
|
|
82
|
+
1. **Pre-AI Heuristic Filter & Diff Parser** ([`src/services/file-filter.ts`](src/services/file-filter.ts), [`src/services/diff-parser.ts`](src/services/diff-parser.ts)):
|
|
83
|
+
- Excludes lockfiles, compiled artifacts (`dist/`, `build/`), vendor bundles, minified JS, and binary assets.
|
|
84
|
+
- Parses unified diffs including quoted paths, Git submodules (`160000`), and permission changes.
|
|
85
|
+
- Passes content through the credential scrubber ([`src/services/scrubber.ts`](src/services/scrubber.ts)).
|
|
86
|
+
2. **Tier 1: Fast Triage** ([`src/services/ai.ts`](src/services/ai.ts)):
|
|
87
|
+
- Screening with **Gemini 3.8 Flash** (`HQ_JR_MODEL_TIER1`).
|
|
88
|
+
- Sets `risk` and `shouldReview` per file; skips deep review for low-risk changes.
|
|
89
|
+
3. **Tier 2: Deep Semantic Audit** ([`src/services/ai.ts`](src/services/ai.ts)):
|
|
90
|
+
- Deep review with **Gemini 3.8 Flash + High Thinking** (`HQ_JR_MODEL_TIER2`, same default model; optional override e.g. `gemini-3.1-pro-preview`).
|
|
91
|
+
- Loads prior findings via [`src/services/review-memory.ts`](src/services/review-memory.ts).
|
|
92
|
+
- Line-anchored comments with suggestion blocks; HTTP 422 fallback if lines drift.
|
|
93
|
+
4. **Tier 3: Sandbox Verification (experimental)** (CLI & runner):
|
|
94
|
+
- Antigravity agent (`HQ_JR_AGENT_TIER3`, default `antigravity-preview-05-2026`) for empirical reproduction in isolated containers via `src/cli.ts` / [`src/services/sandbox-runner.ts`](src/services/sandbox-runner.ts).
|
|
95
|
+
- Treat as experimental until you validate it in your environment.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Interactive GitHub Experience
|
|
100
|
+
|
|
101
|
+
- **Inline Diff Comments**: Comments and suggested replacements on the **Files changed** tab.
|
|
102
|
+
- **GitHub Check Runs**: Status via `hq-jr AI Code Review`.
|
|
103
|
+
- **Interactive PR Chat**: Mention `@hq-jr` to ask questions. Human-to-human threads stay quiet.
|
|
104
|
+
- **On-Demand Review**: `@hq-jr review`, `@hq-jr audit`, or `@hq-jr scan`.
|
|
105
|
+
- **Remediation with RBAC**: `@hq-jr fix` / `@hq-jr patch` synthesizes a fix branch `hq-jr/fix-pr-<id>`. `@hq-jr fix and merge` when permissions allow. Requires collaborator `admin` or `write`.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Quickstart
|
|
110
|
+
|
|
111
|
+
### Prerequisites
|
|
112
|
+
|
|
113
|
+
- Node.js >= 22.0.0
|
|
114
|
+
- Google Cloud Project with Vertex AI API enabled and Application Default Credentials (ADC):
|
|
115
|
+
```bash
|
|
116
|
+
gcloud auth application-default login
|
|
117
|
+
gcloud config set project <PROJECT_ID>
|
|
118
|
+
```
|
|
119
|
+
- GitHub App registered (or via the Probot manifest flow).
|
|
120
|
+
|
|
121
|
+
### Installation
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
git clone https://github.com/adi-IL/hq-jr.git
|
|
125
|
+
cd hq-jr
|
|
126
|
+
npm install
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Environment Configuration
|
|
130
|
+
|
|
131
|
+
Create a `.env` from [`.env.example`](.env.example):
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Probot / GitHub App Credentials
|
|
135
|
+
APP_ID=123456
|
|
136
|
+
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n"
|
|
137
|
+
WEBHOOK_SECRET=your_webhook_secret
|
|
138
|
+
WEBHOOK_PROXY_URL=https://smee.io/your_smee_channel # Optional for local development
|
|
139
|
+
|
|
140
|
+
# Google Cloud Vertex AI
|
|
141
|
+
GOOGLE_CLOUD_PROJECT=your-gcp-project-id
|
|
142
|
+
GOOGLE_CLOUD_LOCATION=global
|
|
143
|
+
|
|
144
|
+
# Model Configuration (defaults match src/config.ts)
|
|
145
|
+
HQ_JR_MODEL_TIER1=gemini-3.8-flash
|
|
146
|
+
HQ_JR_MODEL_TIER2=gemini-3.8-flash
|
|
147
|
+
# Optional: HQ_JR_MODEL_TIER2=gemini-3.1-pro-preview
|
|
148
|
+
HQ_JR_AGENT_TIER3=antigravity-preview-05-2026
|
|
149
|
+
|
|
150
|
+
PORT=3000
|
|
151
|
+
NODE_ENV=development
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Running Locally
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm run build
|
|
158
|
+
npm test
|
|
159
|
+
npm start
|
|
160
|
+
npm run dev # watch mode
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Docker
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
docker build -t hq-jr:local .
|
|
167
|
+
docker run --rm -p 3000:3000 --env-file .env hq-jr:local
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
For Cloud Run and systemd options, see [docs/05-deployment-and-operations.md](docs/05-deployment-and-operations.md).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Project Structure
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
hq-jr/
|
|
178
|
+
├── app.yml # GitHub App Manifest (permissions & events)
|
|
179
|
+
├── Dockerfile # Multi-stage Node 22 production image
|
|
180
|
+
├── docs/ # Architecture and operations guides
|
|
181
|
+
├── src/
|
|
182
|
+
│ ├── cli.ts # Standalone PR / sandbox CLI
|
|
183
|
+
│ ├── config.ts # Env schema (source of truth for defaults)
|
|
184
|
+
│ ├── index.ts # Probot entry and event handlers
|
|
185
|
+
│ ├── schemas/
|
|
186
|
+
│ └── services/ # AI, scrubber, memory, sandbox, remediation, ...
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Documentation
|
|
192
|
+
|
|
193
|
+
- [Architecture and Probot](docs/01-architecture-and-probot.md)
|
|
194
|
+
- [Model Orchestration and Vertex AI ADC](docs/02-model-orchestration-and-vertex-adc.md)
|
|
195
|
+
- [Codebase Ingestion and Context](docs/03-codebase-ingestion-and-context.md)
|
|
196
|
+
- [GitHub App Lifecycle and Security](docs/04-github-app-lifecycle-and-security.md)
|
|
197
|
+
- [Deployment and Operations](docs/05-deployment-and-operations.md)
|
|
198
|
+
- [SECURITY.md](SECURITY.md) (threat model and vulnerability reporting)
|
|
199
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
200
|
+
- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)
|
|
201
|
+
- [CHANGELOG.md](CHANGELOG.md)
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
Apache-2.0
|
package/app.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: hq-jr
|
|
2
|
+
url: https://github.com/adi-IL/hq-jr
|
|
3
|
+
hook_attributes:
|
|
4
|
+
url: https://smee.io/your_smee_channel_id
|
|
5
|
+
description: Self-hosted GitHub App that reviews PRs with Vertex AI, remembers past findings, and can reproduce bugs in a sandbox before it speaks.
|
|
6
|
+
public: false
|
|
7
|
+
default_permissions:
|
|
8
|
+
checks: write
|
|
9
|
+
pull_requests: write
|
|
10
|
+
contents: write
|
|
11
|
+
issues: write
|
|
12
|
+
metadata: read
|
|
13
|
+
default_events:
|
|
14
|
+
- pull_request
|
|
15
|
+
- pull_request_review_comment
|
|
16
|
+
- issue_comment
|
|
17
|
+
- check_run
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { checkAiHealth, runTriage, runDeepReview, dispatchSandboxVerification } from "./services/ai.js";
|
|
5
|
+
import { parseUnifiedDiff, isLineInDiff } from "./services/diff-parser.js";
|
|
6
|
+
import { packageReviewContext } from "./services/context-packager.js";
|
|
7
|
+
import { config } from "./config.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
const command = args[0];
|
|
11
|
+
if (!command || command === "--help" || command === "-h") {
|
|
12
|
+
printHelp();
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
if (command === "health") {
|
|
16
|
+
await handleHealth();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (command === "review") {
|
|
20
|
+
await handleReview(args.slice(1));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (command === "sandbox-test") {
|
|
24
|
+
await handleSandboxTest(args.slice(1));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.error(`Unknown command: ${command}`);
|
|
28
|
+
printHelp();
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
function printHelp() {
|
|
32
|
+
console.log(`
|
|
33
|
+
hq-jr - Automated Code Review CLI (Powered by Vertex AI & Gemini)
|
|
34
|
+
|
|
35
|
+
Usage:
|
|
36
|
+
hq-jr health Check Vertex AI ADC connectivity and latency
|
|
37
|
+
hq-jr review --diff <path> Run review on a local unified diff file
|
|
38
|
+
hq-jr review --pr <number> [--repo] Fetch PR diff using 'gh pr diff' and review
|
|
39
|
+
hq-jr sandbox-test --repo <url> Dispatch Antigravity sandbox agent test
|
|
40
|
+
--branch <name>
|
|
41
|
+
--cmd <test_cmd>
|
|
42
|
+
`);
|
|
43
|
+
}
|
|
44
|
+
async function handleHealth() {
|
|
45
|
+
console.log("Checking Google Cloud Vertex AI ADC connectivity...");
|
|
46
|
+
console.log(`Project: ${config.GOOGLE_CLOUD_PROJECT}`);
|
|
47
|
+
console.log(`Location: ${config.GOOGLE_CLOUD_LOCATION}`);
|
|
48
|
+
console.log(`Tier 1: ${config.HQ_JR_MODEL_TIER1}`);
|
|
49
|
+
console.log(`Tier 2: ${config.HQ_JR_MODEL_TIER2}`);
|
|
50
|
+
try {
|
|
51
|
+
const health = await checkAiHealth();
|
|
52
|
+
if (health.status === "ok") {
|
|
53
|
+
console.log(`\n[SUCCESS] Vertex AI is healthy (Latency: ${health.latencyMs}ms)`);
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.error(`\n[FAILURE] Vertex AI returned error: ${health.message}`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
63
|
+
console.error(`\n[FATAL] Health check failed: ${msg}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async function handleReview(args) {
|
|
68
|
+
let diffContent = "";
|
|
69
|
+
const diffIndex = args.indexOf("--diff");
|
|
70
|
+
const prIndex = args.indexOf("--pr");
|
|
71
|
+
const repoIndex = args.indexOf("--repo");
|
|
72
|
+
if (diffIndex !== -1 && args[diffIndex + 1]) {
|
|
73
|
+
const filePath = args[diffIndex + 1];
|
|
74
|
+
console.log(`Reading diff file: ${filePath}`);
|
|
75
|
+
diffContent = readFileSync(filePath, "utf-8");
|
|
76
|
+
}
|
|
77
|
+
else if (prIndex !== -1 && args[prIndex + 1]) {
|
|
78
|
+
const rawPrNumber = args[prIndex + 1];
|
|
79
|
+
if (!/^\d+$/.test(rawPrNumber)) {
|
|
80
|
+
console.error(`Error: Invalid PR number '${rawPrNumber}'. PR number must be an integer.`);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
const ghArgs = ["pr", "diff", rawPrNumber];
|
|
84
|
+
if (repoIndex !== -1 && args[repoIndex + 1]) {
|
|
85
|
+
const repo = args[repoIndex + 1];
|
|
86
|
+
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo)) {
|
|
87
|
+
console.error(`Error: Invalid repository format '${repo}'. Expected format: owner/repo.`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
ghArgs.push("--repo", repo);
|
|
91
|
+
}
|
|
92
|
+
console.log(`Fetching PR #${rawPrNumber} diff using GitHub CLI (gh)...`);
|
|
93
|
+
try {
|
|
94
|
+
diffContent = execFileSync("gh", ghArgs, {
|
|
95
|
+
encoding: "utf-8",
|
|
96
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
101
|
+
console.error(`Failed to fetch diff with gh CLI: ${msg}`);
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
console.error("Error: Either --diff <path> or --pr <number> must be specified.");
|
|
107
|
+
printHelp();
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
if (!diffContent || diffContent.trim().length === 0) {
|
|
111
|
+
console.log("No textual diff found to review.");
|
|
112
|
+
process.exit(0);
|
|
113
|
+
}
|
|
114
|
+
// 1. Ingestion and diff parsing
|
|
115
|
+
const parsed = parseUnifiedDiff(diffContent);
|
|
116
|
+
console.log(`Parsed ${parsed.files.length} modified file(s), +${parsed.totalAdditions}/-${parsed.totalDeletions} lines.`);
|
|
117
|
+
// 2. Context window packager
|
|
118
|
+
const context = packageReviewContext(parsed);
|
|
119
|
+
console.log(`Reviewable files: ${context.itemsToReview.length}. Excluded noise files: ${context.ignoredItems.length}.`);
|
|
120
|
+
if (context.itemsToReview.length === 0) {
|
|
121
|
+
console.log("\nAll files were excluded by noise filters (lockfiles, assets, build artifacts). Nothing to review.");
|
|
122
|
+
process.exit(0);
|
|
123
|
+
}
|
|
124
|
+
// 3. Tier 1 Triage
|
|
125
|
+
console.log(`\n--- Tier 1: Fast Triage (${config.HQ_JR_MODEL_TIER1}) ---`);
|
|
126
|
+
const triage = await runTriage(context.promptPayload);
|
|
127
|
+
console.log(`Overall Risk: [${triage.overallRisk}]`);
|
|
128
|
+
console.log(`Summary: ${triage.summary}\n`);
|
|
129
|
+
for (const f of triage.files) {
|
|
130
|
+
console.log(`- ${f.path.padEnd(40)} [${f.risk.padEnd(6)}] (Review: ${f.shouldReview ? "YES" : "NO"}) - ${f.reason}`);
|
|
131
|
+
}
|
|
132
|
+
const reviewables = triage.files.filter((f) => f.shouldReview);
|
|
133
|
+
if (reviewables.length === 0) {
|
|
134
|
+
console.log("\nAll files classified as low risk. Deep review bypassed.");
|
|
135
|
+
process.exit(0);
|
|
136
|
+
}
|
|
137
|
+
// 4. Tier 2 Deep Semantic Review
|
|
138
|
+
console.log(`\n--- Tier 2: Deep Semantic Review (${config.HQ_JR_MODEL_TIER2}) ---`);
|
|
139
|
+
const reviewPrompt = `Local CLI Review Mode
|
|
140
|
+
Files requiring deep review:
|
|
141
|
+
${reviewables.map((f) => `- ${f.path} (Risk: ${f.risk}, Reason: ${f.reason})`).join("\n")}
|
|
142
|
+
|
|
143
|
+
${context.promptPayload}
|
|
144
|
+
`;
|
|
145
|
+
const review = await runDeepReview(reviewPrompt);
|
|
146
|
+
console.log(`\nVerdict: ${review.verdict}`);
|
|
147
|
+
console.log(`Summary: ${review.summary}\n`);
|
|
148
|
+
if (review.comments.length === 0) {
|
|
149
|
+
console.log("No specific defects or vulnerabilities found. Code looks clean!");
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
console.log(`Observations (${review.comments.length}):`);
|
|
153
|
+
const fileMap = new Map(parsed.files.map((f) => [f.newPath || f.oldPath, f]));
|
|
154
|
+
for (const c of review.comments) {
|
|
155
|
+
const matched = fileMap.get(c.path);
|
|
156
|
+
const isAnchored = matched ? isLineInDiff(matched, c.line, c.side) : false;
|
|
157
|
+
const anchorTag = isAnchored ? `[Anchored L${c.line}]` : `[File Note L${c.line}]`;
|
|
158
|
+
console.log(`\n------------------------------------------------------------`);
|
|
159
|
+
console.log(`${c.path}:${c.line} (${c.side}) ${anchorTag} [${c.severity}] [${c.category}]`);
|
|
160
|
+
console.log(`Title: ${c.title}`);
|
|
161
|
+
console.log(`Body: ${c.body}`);
|
|
162
|
+
if (c.suggestedPatch) {
|
|
163
|
+
console.log(`\nSuggested Patch:\n${c.suggestedPatch}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async function handleSandboxTest(args) {
|
|
169
|
+
const repoIdx = args.indexOf("--repo");
|
|
170
|
+
const branchIdx = args.indexOf("--branch");
|
|
171
|
+
const cmdIdx = args.indexOf("--cmd");
|
|
172
|
+
if (repoIdx === -1 || branchIdx === -1 || cmdIdx === -1) {
|
|
173
|
+
console.error("Error: --repo, --branch, and --cmd are required for sandbox-test.");
|
|
174
|
+
process.exit(1);
|
|
175
|
+
}
|
|
176
|
+
const repoUrl = args[repoIdx + 1];
|
|
177
|
+
const branch = args[branchIdx + 1];
|
|
178
|
+
const testCommand = args[cmdIdx + 1];
|
|
179
|
+
console.log(`Dispatching Tier 3 Antigravity Sandbox Agent for ${repoUrl} (${branch})...`);
|
|
180
|
+
const result = await dispatchSandboxVerification({
|
|
181
|
+
repoUrl,
|
|
182
|
+
branch,
|
|
183
|
+
testCommand,
|
|
184
|
+
instructions: "Run tests and verify pull request stability.",
|
|
185
|
+
});
|
|
186
|
+
console.log("[SUCCESS] Sandbox agent job dispatched.");
|
|
187
|
+
console.log(JSON.stringify(result, null, 2));
|
|
188
|
+
}
|
|
189
|
+
main().catch((err) => {
|
|
190
|
+
console.error("Unhandled CLI error:", err);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
});
|
|
193
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mapp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C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAErC,OAAO,CAAC,GAAG,CAAC,oDAAoD,OAAO,KAAK,MAAM,MAAM,CAAC,CAAC;IAC1F,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC;QAC/C,OAAO;QACP,MAAM;QACN,WAAW;QACX,YAAY,EAAE,8CAA8C;KAC7D,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const config: {
|
|
2
|
+
GOOGLE_CLOUD_PROJECT: string;
|
|
3
|
+
GOOGLE_CLOUD_LOCATION: string;
|
|
4
|
+
HQ_JR_MODEL_TIER1: string;
|
|
5
|
+
HQ_JR_MODEL_TIER2: string;
|
|
6
|
+
HQ_JR_AGENT_TIER3: string;
|
|
7
|
+
HQ_JR_DB_PATH: string;
|
|
8
|
+
PORT: number;
|
|
9
|
+
NODE_ENV: "development" | "production" | "test";
|
|
10
|
+
LOG_LEVEL: string;
|
|
11
|
+
};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import dotenv from "dotenv";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
dotenv.config();
|
|
4
|
+
const envSchema = z.object({
|
|
5
|
+
GOOGLE_CLOUD_PROJECT: z.string().default("test-gcp-project"),
|
|
6
|
+
GOOGLE_CLOUD_LOCATION: z.string().default("global"),
|
|
7
|
+
HQ_JR_MODEL_TIER1: z.string().default("gemini-3.8-flash"),
|
|
8
|
+
HQ_JR_MODEL_TIER2: z.string().default("gemini-3.8-flash"),
|
|
9
|
+
HQ_JR_AGENT_TIER3: z.string().default("antigravity-preview-05-2026"),
|
|
10
|
+
HQ_JR_DB_PATH: z.string().default("./data/hq-jr.db"),
|
|
11
|
+
PORT: z.coerce.number().default(3000),
|
|
12
|
+
NODE_ENV: z.enum(["development", "production", "test"]).default("development"),
|
|
13
|
+
LOG_LEVEL: z.string().default("info"),
|
|
14
|
+
});
|
|
15
|
+
export const config = envSchema.parse(process.env);
|
|
16
|
+
//# sourceMappingURL=config.js.map
|