@ateriss_/aiv-cli 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -29,6 +29,10 @@ It sends the diff to three specialized AI agents in parallel — one focused on
29
29
  - A payroll mutation that doesn't call `auditLog()` as required by your rules
30
30
  - A function moved to a shared module that now exposes internal state to layers that shouldn't see it
31
31
 
32
+ **Two perspectives, one tool:**
33
+
34
+ aiv covers both sides of the code review workflow. As a **reviewer**, run `aiv review` to analyze an open PR and act directly from the terminal — approve, request changes, post the report as a comment, or merge. As the **author**, run `aiv check` before opening a PR to catch issues in your own branch first. If the report looks good, create the PR directly from the terminal; if not, save a `.aiv/checklist.md` with all findings as checkboxes so you know exactly what to fix.
35
+
32
36
  **What happens after the review:**
33
37
 
34
38
  Once the report is in, aiv lets you act on it directly from the terminal — approve the PR, request changes, post the full report as a formatted GitHub comment, or merge with your preferred strategy (squash, merge, rebase). If you've already reviewed the PR in a previous session, aiv detects the cached analysis in the PR comments and asks if you want to reuse it instead of re-running the agents.
@@ -43,6 +47,8 @@ Once the report is in, aiv lets you act on it directly from the terminal — app
43
47
  - [Installation](#installation)
44
48
  - [Quick Start](#quick-start)
45
49
  - [Commands Reference](#commands-reference)
50
+ - [aiv review](#aiv-review)
51
+ - [aiv check](#aiv-check)
46
52
  - [Configuration](#configuration)
47
53
  - [Global Config](#global-config)
48
54
  - [Repo Config](#repo-config)
@@ -122,7 +128,7 @@ aiv context generate
122
128
  aiv prs
123
129
  ```
124
130
 
125
- **5. Review a PR:**
131
+ **5. Review a PR (as a reviewer):**
126
132
 
127
133
  ```bash
128
134
  aiv review 42
@@ -130,6 +136,15 @@ aiv review 42
130
136
 
131
137
  After the report, aiv asks if you want to approve, request changes, post the report as a PR comment, or merge directly from the terminal.
132
138
 
139
+ **Or: analyze your own branch before opening a PR (as the author):**
140
+
141
+ ```bash
142
+ aiv check # compares current branch vs origin/main (auto-detected)
143
+ aiv check qa # compares current branch vs origin/qa
144
+ ```
145
+
146
+ After the report, aiv asks: create the PR on GitHub or save a checklist of findings to `.aiv/checklist.md`.
147
+
133
148
  ---
134
149
 
135
150
  ## Commands Reference
@@ -142,7 +157,8 @@ Every command has a short alias. Long and short forms are identical.
142
157
  |-----------|-------|-------------|
143
158
  | `aiv init` | `aiv i` | Initialize aiv globally and in the current repo |
144
159
  | `aiv prs` | `aiv p` | List open PRs, then optionally review one |
145
- | `aiv review [pr-number]` | `aiv r` | Review a PR or pick interactively |
160
+ | `aiv review [pr-number]` | `aiv r` | Review a PR or pick interactively (reviewer perspective) |
161
+ | `aiv check [base-branch]` | `aiv c` | Analyze local diff before opening a PR (author perspective) |
146
162
  | `aiv agents` | `aiv a` | List available agents and their focus areas |
147
163
 
148
164
  ### Context
@@ -233,6 +249,63 @@ If a previous aiv analysis exists as a comment on the PR, aiv asks whether to re
233
249
 
234
250
  ---
235
251
 
252
+ ### `aiv check`
253
+
254
+ Analyzes your local branch against a remote base branch **before** opening a PR — the author's equivalent of `aiv review`.
255
+
256
+ ```bash
257
+ aiv check # auto-detects base (origin/main, origin/master, origin/develop)
258
+ aiv c
259
+
260
+ aiv check qa # compare current branch vs origin/qa
261
+ aiv check main # compare current branch vs origin/main
262
+ aiv check --agent security # run only the security agent
263
+ aiv check qa --json # raw JSON output
264
+ ```
265
+
266
+ The diff is always computed against the **remote** branch (`origin/<base>`), not your local copy, so findings reflect the actual gap that would be in the PR.
267
+
268
+ After the report, aiv detects whether your branch has unpushed commits and adjusts the menu accordingly:
269
+
270
+ ```
271
+ # If there are unpushed commits:
272
+ ? What would you like to do?
273
+ ❯ 🚀 Push y crear PR en GitHub
274
+ 📋 Guardar checklist en .aiv/
275
+ ────────────────────────────────────────
276
+ ↩ Skip
277
+
278
+ # If the branch is already up to date with the remote:
279
+ ? What would you like to do?
280
+ ❯ 🚀 Crear PR en GitHub
281
+ 📋 Guardar checklist en .aiv/
282
+ ────────────────────────────────────────
283
+ ↩ Skip
284
+ ```
285
+
286
+ - **Push y crear PR** — runs `git push origin <branch>`, then creates the PR via GitHub API. If the push fails, it stops before attempting PR creation.
287
+ - **Crear PR** — branch is already pushed; creates the PR directly without a push.
288
+ - **Guardar checklist** — writes `.aiv/checklist.md` with all findings as `- [ ]` checkboxes, grouped by severity. The `.aiv/` folder is gitignored so the file never reaches the remote.
289
+
290
+ **Example checklist (`aiv/checklist.md`):**
291
+
292
+ ```markdown
293
+ # aiv Check: feature/payments → main
294
+ Generated: 2026-05-18 | Risk: HIGH (74/100)
295
+
296
+ ## Critical & High
297
+
298
+ - [ ] **[HIGH]** Missing idempotency key on retry — `src/payments/retry.ts`
299
+ > Pass a stable key derived from the original transaction ID.
300
+ - [ ] **[CRITICAL]** auditLog() not called in retry path
301
+
302
+ ## Medium
303
+
304
+ - [ ] **[MEDIUM]** Direct database write outside billing module — `src/db/payments.ts`
305
+ ```
306
+
307
+ ---
308
+
236
309
  ### `aiv context`
237
310
 
238
311
  ```bash
@@ -867,6 +940,14 @@ business_rules:
867
940
  forbidden_patterns: [skipFraudCheck, directInventoryWrite]
868
941
  ```
869
942
 
943
+ ### Check your own branch before opening a PR
944
+
945
+ ```bash
946
+ aiv check qa # or whatever branch you're merging into
947
+ ```
948
+
949
+ Running `aiv check` before opening a PR catches issues that would otherwise land in the reviewer's lap. If the report shows problems, save a checklist to `.aiv/checklist.md`, fix, and run `aiv check` again. Once clean, aiv detects whether the branch needs a push and handles it — you go from analysis to open PR in one step.
950
+
870
951
  ### Post the report as a PR comment
871
952
 
872
953
  After reviewing, choose **Post as PR comment** to make the findings visible to the whole team directly in GitHub. The comment is also used as a cache — the next time anyone runs `aiv review` on the same PR, aiv detects it and offers to skip the AI calls.
@@ -908,15 +989,14 @@ Fewer agents = faster, cheaper, more focused output.
908
989
 
909
990
  ### Commit `.aiv/` to the repository
910
991
 
911
- Committing `config.yml`, `rules.yml`, and `context.md` means every team member gets identical review behavior with no local setup. Only exclude `tree.json`:
992
+ Committing `config.yml`, `rules.yml`, and `context.md` means every team member gets identical review behavior with no local setup. `aiv init` automatically gitignores only the files that shouldn't be shared:
912
993
 
913
994
  ```
914
- # .gitignore
915
- .aiv/tree.json
995
+ # added automatically by aiv init
996
+ .aiv/tree.json # auto-generated snapshot — large, noise in diffs
997
+ .aiv/checklist.md # personal pre-PR draft — not team-relevant
916
998
  ```
917
999
 
918
- `aiv init` adds this entry automatically.
919
-
920
1000
  ### CI integration with `--json`
921
1001
 
922
1002
  ```bash
@@ -943,7 +1023,7 @@ Its value is **semantic understanding**: catching business rule violations, arch
943
1023
  src/
944
1024
  agents/ — business, architecture, security reviewers
945
1025
  cli/
946
- commands/ — init, prs, review, config, context, agents
1026
+ commands/ — init, prs, review, check, config, context, agents
947
1027
  banner.ts — ASCII welcome banner
948
1028
  renderer.ts — terminal renderer + GitHub comment builder
949
1029
  selector.ts — interactive PR/action picker (inquirer)
@@ -953,7 +1033,7 @@ src/
953
1033
  generator.ts — AI-powered context + rules generation
954
1034
  manager.ts — context reader + refreshContextFiles helper
955
1035
  tree.ts — file tree scanner
956
- git/ — GitHub REST client + remote detection
1036
+ git/ — GitHub REST client, remote detection, local diff builder
957
1037
  i18n/ — EN/ES translations (all user-facing strings)
958
1038
  orchestrator/ — runs agents in parallel, aggregates results
959
1039
  providers/