@codacy/verity-cli 0.34.4 → 0.34.5-experimental.29502a2

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,157 @@
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` or `artifacts.legacyStandard` is true** → this project
40
+ already has a Standard here. `legacyStandard` is an old GATE.md Standard at
41
+ `.gate/standard.yaml`: init moves it to `.verity/` first, then keeps it. Do not
42
+ ask question 2. Init keeps the Standard and sends no profile.
51
43
 
52
- ## Step 1: Ask — once, in one prompt
44
+ When both are false, also run:
53
45
 
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).
46
+ ```bash
47
+ verity standard history
48
+ ```
58
49
 
59
- **1 — "When should Verity review your code?"** (multi-select, always asked)
50
+ - **It lists versions** → the team already has a Standard on the service.
51
+ Question 2 is **2a**.
52
+ - **It prints "No Standard versions found."** → question 2 is **2b**.
53
+ - **It fails** (for example, not signed in) → question 2 is **2b** for now.
54
+ Step 2 checks again after sign-in.
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
+ Then check whether the service writes project rules for this project:
57
+
58
+ ```bash
59
+ verity standard generate --status
60
+ ```
61
+
62
+ It prints one word, and sends nothing:
63
+
64
+ - **`on`** or **`unknown`** → ask 2b, and offer "Create a new one from a repo
65
+ profile" in 2a.
66
+ - **`off`** or **`unsupported`** → the service would not use a profile. Do not
67
+ ask 2b, and do not offer "Create a new one from a repo profile" in 2a.
68
+ Pass `--profile skip`.
69
+ - **It fails** (not signed in) → decide as for `unknown`. Step 2 runs it again
70
+ after sign-in.
71
+ - **`memory.trackedFiles > 0` and `memory.optedOut` is false** → question 3 applies.
72
+ - **`trackedState.files > 0`** → question 4 applies.
73
+ - **`telemetry.enabled` is false and `answers.telemetry` is not `declined`** →
74
+ question 5 applies. An earlier "no" is an answer: do not ask again.
75
+
76
+ ## Step 1: Ask, once, in one prompt
66
77
 
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**.
78
+ Use `AskUserQuestion` with every question that applies, **in one call**. Do not
79
+ ask one at a time. If `AskUserQuestion` is not available, ask in prose and wait for
80
+ the answer. Never choose for the user.
71
81
 
72
- **2 — "How deeply should Verity review?"** (single-select, always asked)
82
+ **1 — "Sign in to Verity now?"** (always)
73
83
 
74
84
  | Option | Description |
75
85
  |---|---|
76
- | `Balanced (recommended)` | Security + quality, about 8s per review. |
77
- | `Lightweight` | Critical security only, about 3s. |
78
- | `Thorough` | All tools, all rules, about 15s. |
86
+ | `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. |
87
+ | `Skip for now` | Only the local security scan runs. Nothing is saved. Sign in later with `/verity-init` or `verity login`. |
79
88
 
80
- **3 — "Send cost & usage telemetry to Verity?"** (single-select; **only when
81
- `telemetry.enabled` is false**)
89
+ If the user asks: the GitHub token is used once to check which repositories they
90
+ can write to, then discarded. Signing in does not give Verity access to the
91
+ contents of their repositories.
92
+
93
+ **2a — "Your team already has a Standard for this repository. Use it, or create a new one?"**
94
+ (only when `verity standard history` lists versions; name the latest version and who pushed it)
82
95
 
83
96
  | Option | Description |
84
97
  |---|---|
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`. |
98
+ | `Use it (recommended)` | Reviews use the same rules as everyone else on the project. Nothing is sent. |
99
+ | `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. |
100
+ | `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
101
 
88
- **4 — "Sign in to Verity now?"** (single-select, always asked)
102
+ **2b — "Let Verity write review rules for this repository?"** (only when
103
+ `artifacts.standard` and `artifacts.legacyStandard` are both false, 2a does not
104
+ apply, and the status is `on` or `unknown`)
89
105
 
90
106
  | Option | Description |
91
107
  |---|---|
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`. |
108
+ | `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. |
109
+ | `No, use the built-in rules` | The Standard has the built-in rules only. Add project rules later with `verity standard generate`. |
94
110
 
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.
111
+ Say in the question text that the profile needs sign-in. If the user skips
112
+ sign-in, question 2b has no effect.
98
113
 
99
- **5 — "Stop tracking Verity's knowledge graph in git?"** (only when the graph
100
- question applies; say how many files)
114
+ **3 — "Stop tracking Verity's knowledge graph in git?"** (only when it applies;
115
+ say how many files)
101
116
 
102
117
  | Option | Description |
103
118
  |---|---|
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. |
119
+ | `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
120
  | `No, not now` | Nothing changes. `verity memory track` records it as deliberate. |
106
121
 
107
- **6 — "Untrack committed Verity state?"** (only when `trackedState.files > 0`;
122
+ **4 — "Untrack committed Verity state?"** (only when `trackedState.files > 0`;
108
123
  say how many files)
109
124
 
110
125
  | Option | Description |
111
126
  |---|---|
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. |
127
+ | `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
128
  | `No, not now` | Nothing changes. |
114
129
 
115
- ## Step 2: Run the install with those answers
116
-
117
- One command, no prompts, nothing silently defaulted:
130
+ **5 — "Send Claude Code cost and usage from this machine to Verity?"** (only
131
+ when it applies)
118
132
 
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
- ```
133
+ | Option | Description |
134
+ |---|---|
135
+ | `Yes (recommended)` | Token counts, cost, models, tool names and the repository name, from every Claude Code session on this machine. No prompts, no code, no file contents. It needs sign-in. See it on the /usage page. Turn it off any time: `verity telemetry uninstall`. |
136
+ | `No` | Nothing changes, and init does not ask again. Turn it on later: `verity telemetry install`. |
125
137
 
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.
138
+ Say that the scope is the whole machine: Claude Code takes these settings only
139
+ from user settings, never from one project.
133
140
 
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.
141
+ Do not ask when Verity reviews. All three moments are on by default: each turn,
142
+ each commit and each push. Step 4 tells the user how to change them.
139
143
 
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.
144
+ ## Step 2: Sign in first, in two halves
143
145
 
144
- ## Step 3: Sign in — here, in two halves
146
+ Skip this step if the user chose **Skip for now**.
145
147
 
146
- Skip this step if they chose **Skip for now**; say the gate runs locally and how
147
- to sign in later.
148
+ ⚠ **Sign in BEFORE the install.** Init needs the sign-in to use the team's
149
+ Standard, to write project rules, and to share the Standard. Run the other way
150
+ round, the Standard stays on this machine, and every review fails with
151
+ `STANDARD_NOT_FOUND`.
148
152
 
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:
153
+ `verity login` waits until the code is approved, and you would see the code only
154
+ after it ends. So use the two halves:
151
155
 
152
156
  ```bash
153
157
  verity login --start
@@ -155,79 +159,112 @@ verity login --start
155
159
 
156
160
  It prints one JSON object on stdout:
157
161
 
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.
162
+ - **`"status": "logged_in"`** → the user is signed in. Say so and go to Step 3.
163
+ - **`"status": "pending"`** → show `verification_uri` and `user_code` exactly as
164
+ given. Ask the user to approve it in the browser and to tell you when they have.
165
+ Wait for the reply. Run nothing in the meantime.
166
+ - **`"status": "failed"`** → show the error. Tell the user to run `verity login`
167
+ in a terminal later. Go to Step 3.
168
+
169
+ **After a new sign-in, check the Standard again.** If Step 0 could not run
170
+ `verity standard history` (it failed) and `artifacts.standard` and
171
+ `artifacts.legacyStandard` are both false, run it
172
+ now. If it lists versions, ask question 2a now, in its own prompt. Its answer
173
+ replaces the answer to 2b. Also run `verity standard generate --status` again.
174
+ If it prints `off` or `unsupported`, the answer to 2b has no effect: pass
175
+ `--profile skip`.
164
176
 
165
- When they say it is approved (or ask you to check):
177
+ When the user says it is approved, or asks you to check:
166
178
 
167
179
  ```bash
168
180
  verity login --finish
169
181
  ```
170
182
 
171
- Give the tool call at least a 150-second timeout; it waits up to 100 seconds.
183
+ Give this tool call a timeout of at least 150 seconds. It waits up to 100 seconds.
172
184
 
173
185
  - **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.
186
+ account and this repository's coverage. Give any link to the Verity GitHub App
187
+ word for word. Then go to Step 3.
176
188
  - **exit 2, `"status": "pending"`** → not approved yet. Show the code again, wait
177
- for them, and run `--finish` again.
189
+ for the user, and run `--finish` again.
178
190
  - **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`.
191
+ Show the error. For `expired` or `no_pending`, offer to start again with `--start`.
181
192
 
182
- If they change their mind while a code is pending, run `verity login --cancel`.
193
+ If the user changes their mind while a code is pending, run `verity login --cancel`.
183
194
 
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.
195
+ ⚠ Never run plain `verity login` here. If Step 0 reported a version skew, do not
196
+ tell the user to run it in a terminal until they fix the skew: the old global CLI
197
+ can sign the machine in to a different server, and the plugin follows that sign-in.
188
198
 
189
- ## Step 4: Finish telemetry, if it waited on sign-in
199
+ ## Step 3: Run the install with the answers
190
200
 
191
- If they said yes to telemetry and init reported it needs a token, and Step 3
192
- signed them in:
201
+ One command. It asks nothing:
193
202
 
194
203
  ```bash
195
- verity telemetry install
204
+ verity init --yes [--standard <use|new>] --profile <send|skip> [--telemetry <on|off>] [--untrack-memory] [--untrack-state]
196
205
  ```
197
206
 
198
- It takes effect on their next Claude Code session.
199
-
200
- ## Step 5: Report what happened
207
+ - Question 2a: `Use it` → `--standard use`. `Create a new one from a repo
208
+ profile` → `--standard new --profile send`. `Create a new one with the
209
+ built-in rules` → `--standard new --profile skip`.
210
+ - Question 2b: `--profile send` only when the user said yes and signed in.
211
+ Otherwise `--profile skip`.
212
+ - When question 2 was not asked, leave `--standard` and `--profile` off.
213
+ - `--untrack-memory` and `--untrack-state` only on a yes.
214
+ - Question 5: `--telemetry on` on a yes, `--telemetry off` on a no. When it was
215
+ not asked, leave `--telemetry` off.
216
+ - Do not pass `--moments`. Without it, init keeps the moments the project has,
217
+ or turns on all three for a new project.
218
+ - If init exits non-zero, show its error and stop.
219
+
220
+ Init is idempotent. It removes the project's own `.claude/skills/verity-*` copies
221
+ that the plugin replaces, removes duplicate `.claude/settings.json` hooks, keeps
222
+ or adopts or writes the Standard, and records the plugin version. That record
223
+ stops Verity asking at every session start.
224
+
225
+ With `--profile send`, init prints the rules that Verity wrote. Each rule has an
226
+ id, one sentence, where it applies and why. Show them to the user as printed.
227
+ When init prints the "too little history" line, tell the user that the built-in
228
+ rules apply.
229
+
230
+ ## Step 4: Report what happened
201
231
 
202
232
  ```bash
203
233
  verity doctor --json
204
234
  ```
205
235
 
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;
236
+ Summarise from this report and from init's output, not from memory:
237
+
238
+ - the Standard: **kept**, **adopted** from the team, **written** from the profile
239
+ (with its rules), or built from the catalogue. When it is a new one that
240
+ replaced the team's, say which version it replaced;
241
+ - the moments in effect. Say: "Verity reviews every turn, every commit and every
242
+ push. To change it, run `verity config moments`, or just ask me.";
243
+ - what init removed (superseded skills, duplicate hooks). Those skill folders are
244
+ usually committed, so the deletions show in `git status` and are the user's to
245
+ commit;
246
+ - anything untracked, and that the staged removal is the user's to commit;
247
+ - sign-in state;
248
+ - formal verification, when init printed "Formal verification at push: on". Say
249
+ it as a fact, in init's words: at a push, Verity checks a small model of the
250
+ riskiest changed function and replays any counterexample on the real code;
251
+ that function's source is sent to Verity; only a reproduced bug blocks; turn
252
+ it off with `verity config formal off`. It is a default, like the moments. Do
253
+ not suggest turning it off, and do not connect it to the user's answers to
254
+ other questions;
255
+ - when init printed that the kept Standard has no project rules yet, that line
256
+ and its command (`verity standard generate`);
217
257
  - each line of `next`, if any.
218
258
 
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
259
  ---
224
260
 
225
261
  ## What NOT to do here
226
262
 
227
263
  - **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.
264
+ - **Do not write a Standard by hand.** Init gets it from the team, from the
265
+ profile, or from the catalogue.
266
+ - **Do not answer a question for the user**, and do not leave a flag off because
267
+ it seems obvious. An omitted answer is an unattended one.
268
+ - **Do not run plain `verity login`.** See Step 2.
269
+ - **Do not advise turning off a default** (the moments, formal verification)
270
+ unless the user asks. Say what it does and how to change it.