@codacy/verity-cli 0.33.3-experimental.b6d47c6 → 0.33.3-experimental.ca95f54

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.
@@ -1,46 +1,62 @@
1
1
  ---
2
2
  description: >-
3
- Set Verity up in this project: ask the two setup questions, run the deterministic
4
- install, and repair a project the Claude Code plugin has just been added to. Use
5
- right after installing the Verity plugin, or when Verity says this project is not
6
- set up.
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.
7
7
  disable-model-invocation: true
8
8
  ---
9
9
  # /verity-init — set Verity up in this project
10
10
 
11
- You are running the setup a plugin install cannot do for itself.
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.
12
15
 
13
16
  **Why this skill exists.** Claude Code has no post-install hook and a plugin
14
17
  cannot invoke a skill, so installing Verity repairs nothing: it cannot remove a
15
18
  project's superseded skills, stand down duplicate hooks, or derive a Standard.
16
19
  All of that needs a command someone runs — this one.
17
20
 
18
- **`verity init` prompts on a terminal, and you are not one.** That is the whole
19
- problem this skill solves. Left to itself the CLI would take `--yes` and silently
20
- choose **stop-only** review — no pre-commit gate, no pre-push gate — for every
21
- plugin user, which is exactly the outcome we treat as a serious bug when it
22
- happens by accident. So **you** ask, in the session, where the user actually is.
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.
25
+
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
28
 
24
29
  ---
25
30
 
26
- ## Step 0: Check the CLI before asking anything
31
+ ## Step 0: Read where the project stands — before asking anything
32
+
33
+ ```bash
34
+ verity doctor --json
35
+ ```
27
36
 
28
- If this session's context says the `verity` on PATH is a different version from
29
- the plugin's, **tell the user that first**, in one line, before the questions —
30
- with the `npm install -g` command the context gives. Finding out after they have
31
- answered is the failure this step exists to prevent: an older CLI cannot take the
32
- answers.
37
+ From that one report:
33
38
 
34
- Then run every command below the way the context says (the plugin's own copy),
35
- not with plain `verity`.
39
+ - **`blocked` is true** → show the `prerequisites[].remedy` lines and stop.
40
+ Nothing below can work.
41
+ - **`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.
36
51
 
37
- ## Step 1: Ask both questions in ONE prompt
52
+ ## Step 1: Ask — once, in one prompt
38
53
 
39
- Use `AskUserQuestion` with **both** questions in a single call. Do not ask them
40
- one at a time, and do not ask them in prose — this is the only interruption the
41
- setup gets, so spend it once.
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).
42
58
 
43
- **Question 1 — "When should Verity review your code?"** (multi-select)
59
+ **1 — "When should Verity review your code?"** (multi-select, always asked)
44
60
 
45
61
  | Option | Description |
46
62
  |---|---|
@@ -48,12 +64,12 @@ setup gets, so spend it once.
48
64
  | `Before commit` | Reviews the staged diff and blocks the commit on a failing review. |
49
65
  | `Before push / PR` | Reviews the commits about to be pushed and blocks on a failing review. |
50
66
 
51
- Pre-select **After every turn**, and do not call it "recommended": under the
52
- plugin it runs whatever the answer, and a user who unticks it should not find
53
- that out afterwards. Say plainly in the question text that choosing only the
54
- first means **git commits and pushes are not gated**.
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**.
55
71
 
56
- **Question 2 — "How deeply should Verity review?"** (single-select)
72
+ **2 — "How deeply should Verity review?"** (single-select, always asked)
57
73
 
58
74
  | Option | Description |
59
75
  |---|---|
@@ -61,75 +77,157 @@ first means **git commits and pushes are not gated**.
61
77
  | `Lightweight` | Critical security only, about 3s. |
62
78
  | `Thorough` | All tools, all rules, about 15s. |
63
79
 
80
+ **3 — "Send cost & usage telemetry to Verity?"** (single-select; **only when
81
+ `telemetry.enabled` is false**)
82
+
83
+ | Option | Description |
84
+ |---|---|
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`. |
87
+
88
+ **4 — "Sign in to Verity now?"** (single-select, always asked)
89
+
90
+ | Option | Description |
91
+ |---|---|
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`. |
94
+
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.
98
+
99
+ **5 — "Stop tracking Verity's knowledge graph in git?"** (only when the graph
100
+ question applies; say how many files)
101
+
102
+ | Option | Description |
103
+ |---|---|
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. |
105
+ | `No, not now` | Nothing changes. `verity memory track` records it as deliberate. |
106
+
107
+ **6 — "Untrack committed Verity state?"** (only when `trackedState.files > 0`;
108
+ say how many files)
109
+
110
+ | Option | Description |
111
+ |---|---|
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. |
113
+ | `No, not now` | Nothing changes. |
114
+
64
115
  ## Step 2: Run the install with those answers
65
116
 
66
- Map the answers to flags and run it — one command, no prompts, nothing silently
67
- defaulted:
117
+ One command, no prompts, nothing silently defaulted:
68
118
 
69
119
  ```bash
70
- verity init --yes --no-setup --moments <stop[,pre-commit][,pre-push]> --intensity <balanced|lightweight|thorough>
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]
71
124
  ```
72
125
 
73
- `--moments none` is the deliberate way to gate nothing; an unrecognised value is
74
- refused rather than dropped, so a typo cannot quietly remove a gate.
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.
75
139
 
76
- Pass `stop` only if they ticked it. Under the plugin the Stop review runs either
77
- way and `verity init` says so; recording their real answer is what lets it be
78
- honoured once Stop can be turned off.
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.
79
143
 
80
- This is idempotent and does the whole job: removes the project's own
81
- `.claude/skills/verity-*` copies that the plugin supersedes (they are why the
82
- slash-command list shows every skill twice), stands down duplicate
83
- `.claude/settings.json` hooks so a turn is reviewed once, derives the Standard
84
- and the analysis config if there is none, heals a stale one, and records the
85
- plugin version — which is what stops Verity asking at every session start.
144
+ ## Step 3: Sign in — here, in two halves
145
+
146
+ Skip this step if they chose **Skip for now**; say the gate runs locally and how
147
+ to sign in later.
148
+
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:
151
+
152
+ ```bash
153
+ verity login --start
154
+ ```
155
+
156
+ It prints one JSON object on stdout:
157
+
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.
164
+
165
+ When they say it is approved (or ask you to check):
86
166
 
87
- Report what it removed. Those skill directories are usually committed, so the
88
- deletions will show in `git status` and are the user's to commit.
167
+ ```bash
168
+ verity login --finish
169
+ ```
170
+
171
+ Give the tool call at least a 150-second timeout; it waits up to 100 seconds.
172
+
173
+ - **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.
176
+ - **exit 2, `"status": "pending"`** → not approved yet. Show the code again, wait
177
+ for them, and run `--finish` again.
178
+ - **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`.
181
+
182
+ If they change their mind while a code is pending, run `verity login --cancel`.
89
183
 
90
- ## Step 3: Tell the user to sign in — in their own terminal
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.
91
188
 
92
- **Do not run `verity login` yourself.** It is a GitHub device flow: it prints a
93
- code, waits for the user to approve it in a browser, and blocks until they do.
94
- Started from a tool call it just hangs, and the user never sees the code.
189
+ ## Step 4: Finish telemetry, if it waited on sign-in
95
190
 
96
- Say this, and stop:
191
+ If they said yes to telemetry and init reported it needs a token, and Step 3
192
+ signed them in:
97
193
 
98
- > Verity is set up. One more step, in your own terminal — not here:
99
- >
100
- > ```
101
- > verity login
102
- > ```
103
- >
104
- > It prints a code and a link; approve it in your browser. One login covers every
105
- > repository you can write to, for 90 days. Without it the gate still reviews
106
- > your code — it just records nothing, so there is no history, no cloud memory
107
- > and no dashboard.
194
+ ```bash
195
+ verity telemetry install
196
+ ```
197
+
198
+ It takes effect on their next Claude Code session.
108
199
 
109
- If `verity status` already reports an account, skip this step and say so.
200
+ ## Step 5: Report what happened
110
201
 
111
- If Step 0 found a version mismatch, the `verity` in their terminal is the old
112
- global one, not the plugin's: tell them to update it first (the `npm install -g`
113
- command from Step 0), then log in. An older or experimental build can sign the
114
- machine in to a different server, and the plugin follows that sign-in.
202
+ ```bash
203
+ verity doctor --json
204
+ ```
115
205
 
116
- ## Step 4: Offer the part a lookup cannot produce
206
+ Summarise from this report, not from memory of what you ran:
117
207
 
118
- The Standard `init` derives covers the research-backed patterns for the
119
- languages and tools it found. What it deliberately leaves empty is
120
- `custom_patterns` — rules like *"every route under `api/` uses the auth
121
- middleware"*, which need something to read the code for intent.
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;
217
+ - each line of `next`, if any.
122
218
 
123
- Offer `/verity-setup` for that, and say it is optional: the gate is already
124
- running.
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.
125
222
 
126
223
  ---
127
224
 
128
225
  ## What NOT to do here
129
226
 
130
227
  - **Do not wire hooks or edit `.gitignore` yourself.** `verity init` owns that.
131
- Doing it here is how the two flows drifted apart before — the skill reconciled
132
- hooks init had just installed and silently removed them.
133
- - **Do not synthesize a Standard by hand.** The CLI derives it in about two
134
- seconds from the same catalogue you would be reading.
135
- - **Do not run `verity login`.** Step 3.
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.33.3-experimental.b6d47c6",
3
+ "version": "0.33.3-experimental.ca95f54",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://verity.md",
@@ -13,6 +13,7 @@
13
13
  "files": [
14
14
  "bin/verity.js",
15
15
  "data/skills/",
16
+ "data/grammars/",
16
17
  "package.json",
17
18
  "README.md",
18
19
  "LICENSE",
@@ -31,8 +32,14 @@
31
32
  "devDependencies": {
32
33
  "@types/node": "^20",
33
34
  "esbuild": "^0.25.12",
35
+ "tree-sitter-go": "0.25.0",
36
+ "tree-sitter-java": "0.23.5",
37
+ "tree-sitter-javascript": "0.25.0",
38
+ "tree-sitter-python": "0.25.0",
39
+ "tree-sitter-typescript": "0.23.2",
34
40
  "tsx": "^4.21.0",
35
- "typescript": "^5.4"
41
+ "typescript": "^5.4",
42
+ "web-tree-sitter": "0.27.0"
36
43
  },
37
44
  "dependencies": {
38
45
  "commander": "^12",