@codacy/verity-cli 0.34.3 → 0.35.0-experimental.ce90a7b

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.
@@ -20,8 +20,8 @@ You are running an on-demand Verity analysis. This is like a "second opinion"
20
20
 
21
21
  ## Step 1: Check configuration
22
22
 
23
- 1. Verify `.verity/standard.yaml` exists. If not: "Run `/verity-setup` first."
24
- 2. Verify `verity` CLI is available: `which verity`. If not: "Re-run the Verity installer: `curl -fsSL https://raw.githubusercontent.com/codacy/verity/main/install.sh | bash`"
23
+ 1. Verify `.verity/standard.yaml` exists. If not: "Run `/verity-init` (or `verity init` in a terminal) first."
24
+ 2. Verify `verity` CLI is available: `which verity`. If not: "Install it: `npm install -g @codacy/verity-cli`, or install the Verity Claude Code plugin."
25
25
  3. Run `verity auth verify` to check the token is valid.
26
26
  - **Valid**: proceed with the full deep review.
27
27
  - **Fails / not authenticated**: don't stop. Tell the user Verity is in
@@ -1,153 +1,125 @@
1
1
  ---
2
2
  description: >-
3
- Set Verity up in this project: ask the setup questions in the session, run the
4
- deterministic install with those answers, sign in, and repair a project the Claude
5
- Code plugin has just been added to. Use right after installing the Verity plugin,
6
- or when Verity says this project is not set up.
3
+ Set Verity up in this project: ask the setup questions in the session (sign in,
4
+ and the Standard: use the team's, or write project rules from a repo profile),
5
+ sign in, and run the install with those answers. Use right after installing the Verity plugin, or when
6
+ Verity says this project is not set up.
7
7
  disable-model-invocation: true
8
8
  ---
9
9
  # /verity-init — set Verity up in this project
10
10
 
11
- You are running, inside this session, the same setup `verity init` runs at a
12
- terminal: the same questions, the same install, the same sign-in. The only
13
- difference is who asks. At a terminal the CLI prompts; here **you** ask, and pass
14
- the answers down as flags.
11
+ You run, inside this session, the same setup that `verity init` runs at a
12
+ terminal. At a terminal the CLI asks about sign-in and about the Standard. Here
13
+ **you** ask, and pass the answers to the CLI as flags.
15
14
 
16
- **Why this skill exists.** Claude Code has no post-install hook and a plugin
17
- cannot invoke a skill, so installing Verity repairs nothing: it cannot remove a
18
- project's superseded skills, stand down duplicate hooks, or derive a Standard.
19
- All of that needs a command someone runs — this one.
15
+ **Why this skill exists.** Claude Code has no post-install hook, and a plugin
16
+ cannot start a skill. So installing Verity does not set up the project. That needs
17
+ a command, and this skill runs it.
20
18
 
21
- **`verity init` prompts on a terminal, and you are not one.** Run with `--yes`
22
- alone it takes the unattended answer to every question: stop-only review (no
23
- commit or push gate), no telemetry, no sign-in, nothing untracked. Every one of
24
- those is a decision that belongs to the user, so every one is asked here.
19
+ **`verity init --yes` asks nothing.** Without these flags it skips sign-in, uses
20
+ the team's Standard if there is one, and sends no profile. These are the user's
21
+ decisions, so ask them here.
25
22
 
26
- Run every `verity` command below the way this session's context says (the
27
- plugin's own copy), not with plain `verity`, whenever the context names one.
23
+ When this session's context names the plugin's own copy of the CLI, run every
24
+ `verity` command below with that copy, not with plain `verity`.
28
25
 
29
26
  ---
30
27
 
31
- ## Step 0: Read where the project stands — before asking anything
28
+ ## Step 0: Read where the project stands
32
29
 
33
30
  ```bash
34
31
  verity doctor --json
35
32
  ```
36
33
 
37
- From that one report:
34
+ Use this one report:
38
35
 
39
36
  - **`blocked` is true** → show the `prerequisites[].remedy` lines and stop.
40
- Nothing below can work.
41
37
  - **`hooks.versions.skew` is set** → tell the user first, in one line, with
42
- `hooks.versions.skew.remedy`. An older CLI cannot take the answers, so they
43
- should hear it now, not after answering.
44
- - **`answers`** holds what a previous run recorded (`intensity`, `moments`,
45
- `telemetry`). On a re-run those are the defaults — pre-select them. The shipped
46
- defaults are only for a project with nothing recorded.
47
- - **`telemetry.enabled`** decides whether the telemetry question is asked at all.
48
- - **`memory.trackedFiles > 0` and `memory.optedOut` is false** → the graph
49
- question applies.
50
- - **`trackedState.files > 0`** → the committed-state question applies.
38
+ `hooks.versions.skew.remedy`.
39
+ - **`artifacts.standard` is true** → this project already has a Standard here.
40
+ Do not ask question 2. Init keeps the Standard and sends no profile.
51
41
 
52
- ## Step 1: Ask — once, in one prompt
42
+ When `artifacts.standard` is false, also run:
53
43
 
54
- Use `AskUserQuestion` with every question that applies **in a single call**, in
55
- this order. It takes at most four; if more apply, put the rest in ONE follow-up
56
- call. Do not ask one at a time, and do not ask in prose unless `AskUserQuestion`
57
- is unavailable (then ask in prose and **wait** — never choose for the user).
44
+ ```bash
45
+ verity standard history
46
+ ```
58
47
 
59
- **1 — "When should Verity review your code?"** (multi-select, always asked)
48
+ - **It lists versions** → the team already has a Standard on the service.
49
+ Question 2 is **2a**.
50
+ - **It prints "No Standard versions found."** → question 2 is **2b**.
51
+ - **It fails** (for example, not signed in) → question 2 is **2b** for now.
52
+ Step 2 checks again after sign-in.
53
+ - **`memory.trackedFiles > 0` and `memory.optedOut` is false** → question 3 applies.
54
+ - **`trackedState.files > 0`** → question 4 applies.
60
55
 
61
- | Option | Description |
62
- |---|---|
63
- | `After every turn (always on with the plugin, for now)` | Reviews what the agent just wrote, as you work. Fast feedback, never blocks a commit. Under the Claude Code plugin it cannot be turned off yet. |
64
- | `Before commit` | Reviews the staged diff and blocks the commit on a failing review. |
65
- | `Before push / PR` | Reviews the commits about to be pushed and blocks on a failing review. |
56
+ ## Step 1: Ask, once, in one prompt
66
57
 
67
- Pre-select the recorded moments, or **After every turn** on a first run, and do
68
- not call it "recommended": under the plugin it runs whatever the answer. Say
69
- plainly in the question text that choosing only the first means **git commits
70
- and pushes are not gated**.
58
+ Use `AskUserQuestion` with every question that applies, **in one call**. Do not
59
+ ask one at a time. If `AskUserQuestion` is not available, ask in prose and wait for
60
+ the answer. Never choose for the user.
71
61
 
72
- **2 — "How deeply should Verity review?"** (single-select, always asked)
62
+ **1 — "Sign in to Verity now?"** (always)
73
63
 
74
64
  | Option | Description |
75
65
  |---|---|
76
- | `Balanced (recommended)` | Security + quality, about 8s per review. |
77
- | `Lightweight` | Critical security only, about 3s. |
78
- | `Thorough` | All tools, all rules, about 15s. |
66
+ | `Sign in now (recommended)` | One GitHub sign-in covers every repository on this machine, for 90 days. AI review needs it. If you are signed in already, this only confirms it. |
67
+ | `Skip for now` | Only the local security scan runs. Nothing is saved. Sign in later with `/verity-init` or `verity login`. |
79
68
 
80
- **3 — "Send cost & usage telemetry to Verity?"** (single-select; **only when
81
- `telemetry.enabled` is false**)
69
+ If the user asks: the GitHub token is used once to check which repositories they
70
+ can write to, then discarded. Signing in does not give Verity access to the
71
+ contents of their repositories.
72
+
73
+ **2a — "Your team already has a Standard for this repository. Use it, or create a new one?"**
74
+ (only when `verity standard history` lists versions; name the latest version and who pushed it)
82
75
 
83
76
  | Option | Description |
84
77
  |---|---|
85
- | `Yes, enable it` | Powers the /usage dashboard. Sends Claude Code's own OpenTelemetry metrics and traces: model names, token counts, cost, session ids. Not your prompts, code, or tool input/output. |
86
- | `No` | /usage stays empty. Enable later with `verity telemetry install`. |
78
+ | `Use it (recommended)` | Reviews use the same rules as everyone else on the project. Nothing is sent. |
79
+ | `Create a new one from a repo profile` | The new Standard becomes the next version for the whole team. Verity sends the repo profile that 2b describes, and writes project rules from it. |
80
+ | `Create a new one with the built-in rules` | The new Standard becomes the next version for the whole team. It has the built-in rules only. Nothing is sent. |
87
81
 
88
- **4 — "Sign in to Verity now?"** (single-select, always asked)
82
+ **2b — "Let Verity write review rules for this repository?"** (only when
83
+ `artifacts.standard` is false and 2a does not apply)
89
84
 
90
85
  | Option | Description |
91
86
  |---|---|
92
- | `Sign in now (recommended)` | One GitHub login covers every repository you can write to, for 90 days. Needed for run history, cloud memory and the dashboard. If you are already signed in this just confirms it. |
93
- | `Skip for now` | The gate still reviews your code locally; nothing is saved. Sign in later with `/verity-init` or `verity login`. |
87
+ | `Yes, send the profile (recommended)` | Verity sends a profile of this repository to the Verity service: languages, frameworks and dependency names; folder names, 3 levels deep; the subjects of recent commits and the paths each one changed; the agent docs (CLAUDE.md, AGENTS.md, and those of sub-projects) without their code blocks, or the rule sections of README.md when there are none. This step sends no source code, diffs or author names. Verity does not store the profile. Later, each review sends the code that changed. |
88
+ | `No, use the built-in rules` | The Standard has the built-in rules only. Add project rules later with `verity standard generate`. |
94
89
 
95
- If asked, explain: the GitHub token is used once to check which repositories they
96
- can write to, then discarded; signing in does not give Verity access to their
97
- code, which is analyzed in memory and never stored.
90
+ Say in the question text that the profile needs sign-in. If the user skips
91
+ sign-in, question 2b has no effect.
98
92
 
99
- **5 — "Stop tracking Verity's knowledge graph in git?"** (only when the graph
100
- question applies; say how many files)
93
+ **3 — "Stop tracking Verity's knowledge graph in git?"** (only when it applies;
94
+ say how many files)
101
95
 
102
96
  | Option | Description |
103
97
  |---|---|
104
- | `Yes, untrack it (recommended)` | Files stay on disk; their removal from the index is staged for you to commit. Generated notes stop appearing in every diff and PR. |
98
+ | `Yes, untrack it (recommended)` | The files stay on disk. Their removal from the index is staged for you to commit. Generated notes stop appearing in every diff. |
105
99
  | `No, not now` | Nothing changes. `verity memory track` records it as deliberate. |
106
100
 
107
- **6 — "Untrack committed Verity state?"** (only when `trackedState.files > 0`;
101
+ **4 — "Untrack committed Verity state?"** (only when `trackedState.files > 0`;
108
102
  say how many files)
109
103
 
110
104
  | Option | Description |
111
105
  |---|---|
112
- | `Yes, untrack it (recommended)` | Machine-local files that should never have been committed — they can include copies of flagged secrets. Files stay on disk; the removal is staged. |
106
+ | `Yes, untrack it (recommended)` | These files are machine-local and can include copies of flagged secrets. The files stay on disk, and the removal is staged. |
113
107
  | `No, not now` | Nothing changes. |
114
108
 
115
- ## Step 2: Run the install with those answers
116
-
117
- One command, no prompts, nothing silently defaulted:
118
-
119
- ```bash
120
- verity init --yes --no-setup \
121
- --moments <stop[,pre-commit][,pre-push] | none> \
122
- --intensity <balanced|lightweight|thorough> \
123
- [--telemetry on|off] [--untrack-memory] [--untrack-state]
124
- ```
125
-
126
- - Pass `--telemetry` only when question 3 was asked. Omitting it leaves the
127
- recorded choice alone.
128
- - Pass `--untrack-memory` / `--untrack-state` only on a yes.
129
- - Pass `stop` only if they ticked it. Under the plugin the Stop review runs either
130
- way and `verity init` says so.
131
- - An unrecognised value is refused rather than dropped, so a typo cannot quietly
132
- remove a gate. If init exits non-zero, show its error and stop.
133
-
134
- This is idempotent and does the whole install: removes the project's own
135
- `.claude/skills/verity-*` copies that the plugin supersedes, stands down duplicate
136
- `.claude/settings.json` hooks, adopts the team's Standard from the service or
137
- derives one from the codebase, heals a stale analysis config, and records the
138
- plugin version — which is what stops Verity asking at every session start.
109
+ Do not ask when Verity reviews. All three moments are on by default: each turn,
110
+ each commit and each push. Step 4 tells the user how to change them.
139
111
 
140
- Init runs before sign-in, so on a first run it says it skipped authentication and
141
- that telemetry needs a token. That is expected — Step 3 handles both. Do not
142
- repeat those lines to the user as problems.
112
+ ## Step 2: Sign in first, in two halves
143
113
 
144
- ## Step 3: Sign in — here, in two halves
114
+ Skip this step if the user chose **Skip for now**.
145
115
 
146
- Skip this step if they chose **Skip for now**; say the gate runs locally and how
147
- to sign in later.
116
+ ⚠ **Sign in BEFORE the install.** Init needs the sign-in to use the team's
117
+ Standard, to write project rules, and to share the Standard. Run the other way
118
+ round, the Standard stays on this machine, and every review fails with
119
+ `STANDARD_NOT_FOUND`.
148
120
 
149
- `verity login` on its own prints a code and then blocks until it is approved, and
150
- you would only see the code after it ended. So it is split:
121
+ `verity login` waits until the code is approved, and you would see the code only
122
+ after it ends. So use the two halves:
151
123
 
152
124
  ```bash
153
125
  verity login --start
@@ -155,79 +127,94 @@ verity login --start
155
127
 
156
128
  It prints one JSON object on stdout:
157
129
 
158
- - **`"status": "logged_in"`** → they already are. Say so and go to Step 4.
159
- - **`"status": "pending"`** → show the user `verification_uri` and `user_code`
160
- exactly as given, and ask them to approve it in their browser and tell you when
161
- they have. Wait for their reply. Do not run anything in the meantime.
162
- - **`"status": "failed"`** → show the error, and tell them to run `verity login`
163
- in their own terminal later. Go to Step 4.
130
+ - **`"status": "logged_in"`** → the user is signed in. Say so and go to Step 3.
131
+ - **`"status": "pending"`** → show `verification_uri` and `user_code` exactly as
132
+ given. Ask the user to approve it in the browser and to tell you when they have.
133
+ Wait for the reply. Run nothing in the meantime.
134
+ - **`"status": "failed"`** → show the error. Tell the user to run `verity login`
135
+ in a terminal later. Go to Step 3.
164
136
 
165
- When they say it is approved (or ask you to check):
137
+ **After a new sign-in, check the Standard again.** If Step 0 could not run
138
+ `verity standard history` (it failed) and `artifacts.standard` is false, run it
139
+ now. If it lists versions, ask question 2a now, in its own prompt. Its answer
140
+ replaces the answer to 2b.
141
+
142
+ When the user says it is approved, or asks you to check:
166
143
 
167
144
  ```bash
168
145
  verity login --finish
169
146
  ```
170
147
 
171
- Give the tool call at least a 150-second timeout; it waits up to 100 seconds.
148
+ Give this tool call a timeout of at least 150 seconds. It waits up to 100 seconds.
172
149
 
173
150
  - **exit 0, `"status": "logged_in"`** → report the lines it printed about the
174
- account and whether this repository is covered, word for word where it names a
175
- link to grant the Verity GitHub App.
151
+ account and this repository's coverage. Give any link to the Verity GitHub App
152
+ word for word. Then go to Step 3.
176
153
  - **exit 2, `"status": "pending"`** → not approved yet. Show the code again, wait
177
- for them, and run `--finish` again.
154
+ for the user, and run `--finish` again.
178
155
  - **exit 1** → `denied`, `expired`, `service_changed`, `no_pending` or `failed`.
179
- Show the error. For `expired` or `no_pending`, offer to start again with
180
- `--start`.
156
+ Show the error. For `expired` or `no_pending`, offer to start again with `--start`.
181
157
 
182
- If they change their mind while a code is pending, run `verity login --cancel`.
158
+ If the user changes their mind while a code is pending, run `verity login --cancel`.
183
159
 
184
- ⚠ Never run plain `verity login` from here, and never tell a user whose Step 0
185
- reported a version skew to run it in a terminal until they have fixed the skew —
186
- the old global CLI can sign the machine in to a different server, and the plugin
187
- follows that sign-in.
160
+ ⚠ Never run plain `verity login` here. If Step 0 reported a version skew, do not
161
+ tell the user to run it in a terminal until they fix the skew: the old global CLI
162
+ can sign the machine in to a different server, and the plugin follows that sign-in.
188
163
 
189
- ## Step 4: Finish telemetry, if it waited on sign-in
164
+ ## Step 3: Run the install with the answers
190
165
 
191
- If they said yes to telemetry and init reported it needs a token, and Step 3
192
- signed them in:
166
+ One command. It asks nothing:
193
167
 
194
168
  ```bash
195
- verity telemetry install
169
+ verity init --yes [--standard <use|new>] --profile <send|skip> [--untrack-memory] [--untrack-state]
196
170
  ```
197
171
 
198
- It takes effect on their next Claude Code session.
172
+ - Question 2a: `Use it` → `--standard use`. `Create a new one from a repo
173
+ profile` → `--standard new --profile send`. `Create a new one with the
174
+ built-in rules` → `--standard new --profile skip`.
175
+ - Question 2b: `--profile send` only when the user said yes and signed in.
176
+ Otherwise `--profile skip`.
177
+ - When question 2 was not asked, leave `--standard` and `--profile` off.
178
+ - `--untrack-memory` and `--untrack-state` only on a yes.
179
+ - Do not pass `--moments` or `--telemetry`. Without them, init keeps the moments
180
+ the project has, or turns on all three for a new project.
181
+ - If init exits non-zero, show its error and stop.
182
+
183
+ Init is idempotent. It removes the project's own `.claude/skills/verity-*` copies
184
+ that the plugin replaces, removes duplicate `.claude/settings.json` hooks, keeps
185
+ or adopts or writes the Standard, and records the plugin version. That record
186
+ stops Verity asking at every session start.
199
187
 
200
- ## Step 5: Report what happened
188
+ With `--profile send`, init prints the rules that Verity wrote. Each rule has an
189
+ id, one sentence, where it applies and why. Show them to the user as printed.
190
+
191
+ ## Step 4: Report what happened
201
192
 
202
193
  ```bash
203
194
  verity doctor --json
204
195
  ```
205
196
 
206
- Summarise from this report, not from memory of what you ran:
207
-
208
- - what init removed (superseded skills, duplicate hooks) — those skill
209
- directories are usually committed, so the deletions show in `git status` and
210
- are the user's to commit;
211
- - whether the Standard was **adopted** from the service or **derived** from the
212
- codebase (init's output says which);
213
- - the moments and intensity now in effect, and who wires the hooks
214
- (`hooks.source`);
215
- - anything untracked, and that the staged removal is theirs to commit;
216
- - sign-in and telemetry state;
197
+ Summarise from this report and from init's output, not from memory:
198
+
199
+ - the Standard: **kept**, **adopted** from the team, **written** from the profile
200
+ (with its rules), or built from the catalogue. When it is a new one that
201
+ replaced the team's, say which version it replaced;
202
+ - the moments in effect. Say: "Verity reviews every turn, every commit and every
203
+ push. To change it, run `verity config moments`, or just ask me.";
204
+ - what init removed (superseded skills, duplicate hooks). Those skill folders are
205
+ usually committed, so the deletions show in `git status` and are the user's to
206
+ commit;
207
+ - anything untracked, and that the staged removal is the user's to commit;
208
+ - sign-in state;
217
209
  - each line of `next`, if any.
218
210
 
219
- Then offer `/verity-setup` for the part a lookup cannot produce — project-specific
220
- `custom_patterns` such as *"every route under `api/` uses the auth middleware"* —
221
- and say it is optional: the gate is already running.
222
-
223
211
  ---
224
212
 
225
213
  ## What NOT to do here
226
214
 
227
215
  - **Do not wire hooks or edit `.gitignore` yourself.** `verity init` owns that.
228
- Doing it here is how the two flows drifted apart before.
229
- - **Do not synthesize a Standard by hand.** The CLI derives it in seconds from
230
- the same catalogue you would be reading.
231
- - **Do not answer a question for the user**, including by leaving a flag off
232
- because it seemed obvious. An omitted question is an unattended answer.
233
- - **Do not run plain `verity login`.** Step 3.
216
+ - **Do not write a Standard by hand.** Init gets it from the team, from the
217
+ profile, or from the catalogue.
218
+ - **Do not answer a question for the user**, and do not leave a flag off because
219
+ it seems obvious. An omitted answer is an unattended one.
220
+ - **Do not run plain `verity login`.** See Step 2.