@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.
- package/CHANGELOG.md +0 -24
- package/README.md +96 -60
- package/bin/verity.js +15069 -12551
- package/data/skills/verity-analyze/SKILL.md +2 -2
- package/data/skills/verity-init/SKILL.md +176 -139
- package/data/skills/verity-setup/SKILL.md +35 -367
- package/data/skills/verity-setup/patterns-reference.yaml +4 -330
- package/data/skills/verity-setup/standard-template.yaml +2 -9
- package/package.json +3 -10
- package/data/skills/verity-setup/validate-patterns.mjs +0 -345
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: >-
|
|
3
|
-
Configure Verity for this project: create or update the project Standard
|
|
4
|
-
|
|
5
|
-
when the user asks to change quality rules
|
|
3
|
+
Configure Verity for this project: create or update the project Standard and
|
|
4
|
+
authenticate. Static analysis is Trivy only and needs no setup. Use when setting Verity up
|
|
5
|
+
for the first time, or when the user asks to change quality rules or severity thresholds.
|
|
6
6
|
disable-model-invocation: true
|
|
7
7
|
---
|
|
8
8
|
# /verity-setup — Configure Verity for this project
|
|
@@ -10,30 +10,35 @@ disable-model-invocation: true
|
|
|
10
10
|
You are finishing Verity's setup: the half that needs a model.
|
|
11
11
|
|
|
12
12
|
**`verity init` already ran the deterministic half** — prerequisites, the skills,
|
|
13
|
-
the Claude Code hooks (reconciled to the moments
|
|
14
|
-
|
|
15
|
-
the
|
|
13
|
+
the Claude Code hooks (reconciled to the moments in force), `.gitignore`, the
|
|
14
|
+
CLAUDE.md instructions, the optional GitHub login, and the Standard. It recorded
|
|
15
|
+
the answers in `.verity/setup.json`. It does not start this skill: the user runs
|
|
16
|
+
it, to add or change project rules.
|
|
16
17
|
|
|
17
18
|
So: **do not re-ask what init asked, and do not re-write what init wrote.** Wiring
|
|
18
19
|
hooks or a `.gitignore` block here is how the two flows drifted apart before — the
|
|
19
20
|
skill reconciled hooks init had just installed, silently removing them.
|
|
20
21
|
|
|
21
22
|
⚠ **`verity init` NOW DERIVES THE STANDARD BY ITSELF**, so in most projects there
|
|
22
|
-
is nothing here left to do — the languages, the
|
|
23
|
-
|
|
24
|
-
does them in about two seconds (`verity standard synthesize`).
|
|
23
|
+
is nothing here left to do — the languages, the quality dimensions, the security
|
|
24
|
+
patterns and `VERITY.md` are all lookups over this same catalogue, and the CLI
|
|
25
|
+
does them in about two seconds (`verity standard synthesize`). Static analysis is
|
|
26
|
+
Trivy only and needs no configuration. Step 1 will tell
|
|
25
27
|
you when that has already happened.
|
|
26
28
|
|
|
27
29
|
**You are here for the part a lookup cannot produce:** project-specific patterns —
|
|
28
30
|
"every route under `api/` uses the auth middleware", "RLS policies on all Supabase
|
|
29
|
-
tables".
|
|
30
|
-
|
|
31
|
+
tables". When the user agreed, init already asked the Verity service to write
|
|
32
|
+
some (`created_by: verity-generate`). That service saw a profile of the
|
|
33
|
+
repository but never its code, so its rules can name the wrong scope or a rule
|
|
34
|
+
the code does not follow. You can read the code: check each existing
|
|
35
|
+
`custom_patterns` entry against it, fix or remove the wrong ones, and add what
|
|
36
|
+
is missing. Without that agreement, `custom_patterns` is empty.
|
|
31
37
|
|
|
32
38
|
**What is yours when there is no Standard at all** (Step 1 says so, or `--force`):
|
|
33
39
|
1. Read the codebase and understand it (Step 2).
|
|
34
40
|
2. Synthesize `.verity/standard.yaml` from what you found (Step 4).
|
|
35
|
-
3.
|
|
36
|
-
4. Upload both, seed the knowledge base, write `VERITY.md` (Steps 7–8).
|
|
41
|
+
3. Upload it, seed the knowledge base, write `VERITY.md` (Steps 7–8).
|
|
37
42
|
|
|
38
43
|
**Reference files** (bundled alongside this skill, at `${CLAUDE_SKILL_DIR}`):
|
|
39
44
|
- `patterns-reference.yaml` — Research-backed patterns catalog (quality, security, language-specific)
|
|
@@ -61,10 +66,11 @@ exists on THIS install:**
|
|
|
61
66
|
not exist. A remedy that names a command the user does not have is worse than
|
|
62
67
|
no remedy — they cannot tell whether they are stuck or broken.
|
|
63
68
|
|
|
64
|
-
**Do not run `verity init` from this skill.** That flow asks the user
|
|
65
|
-
questions
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
**Do not run `verity init` from this skill.** That flow asks the user its
|
|
70
|
+
questions (sign-in, and what to do about the Standard) before it changes
|
|
71
|
+
anything, and running it here takes the answers away from them — silently
|
|
72
|
+
choosing the defaults: review at turn, commit and push, and formal verification
|
|
73
|
+
at push. One skill owns setup, and it is not this one.
|
|
68
74
|
|
|
69
75
|
Branch on the same `doctor` output:
|
|
70
76
|
|
|
@@ -80,11 +86,6 @@ Branch on the same `doctor` output:
|
|
|
80
86
|
`verity standard push`. Do NOT rewrite the rest of the Standard — `standard push`
|
|
81
87
|
auto-versions, so a full re-synthesis lands as the version everybody is then
|
|
82
88
|
held to.
|
|
83
|
-
- **`artifacts.standard` is true but `artifacts.analysisConfig` is false** → the
|
|
84
|
-
CLI derives this case too: `verity standard synthesize --config-only` rewrites
|
|
85
|
-
the config from the Standard already in place. Prefer that over doing it by hand.
|
|
86
|
-
⚠ Do NOT suggest `--force` here — it REPLACES the Standard, and the team already
|
|
87
|
-
agreed that one. If you do it by hand, **Step 5 only**, then `verity config push`.
|
|
88
89
|
- **`artifacts.verityMd` is true and the user did not pass `--force`** → already
|
|
89
90
|
configured. Say "Already configured. Run `/verity-setup --force` to
|
|
90
91
|
reconfigure." and stop.
|
|
@@ -118,14 +119,6 @@ find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx"
|
|
|
118
119
|
- `services/` or `packages/` directories → monorepo or microservices
|
|
119
120
|
- Single root → monolith
|
|
120
121
|
|
|
121
|
-
**Existing tool configs** — check for configs already present:
|
|
122
|
-
- `eslint.config.*` or `.eslintrc*` → ESLint already configured (note the path)
|
|
123
|
-
- `.semgrep*` or `semgrep.yaml` → Semgrep rules
|
|
124
|
-
- `trivy.yaml` → Trivy config (note the path)
|
|
125
|
-
- `ruff.toml` or `pyproject.toml [tool.ruff]` → Ruff config
|
|
126
|
-
- `.pylintrc` → Pylint config
|
|
127
|
-
- `.codacy/tools-configs/` → Codacy tool configs (note any files here)
|
|
128
|
-
|
|
129
122
|
**Context** — read for additional insight:
|
|
130
123
|
- `README.md` — project description, purpose
|
|
131
124
|
- `CLAUDE.md` — existing agent instructions
|
|
@@ -141,20 +134,12 @@ From the `verity doctor --json` output in Step 1:
|
|
|
141
134
|
|
|
142
135
|
| Field | What it is | Where you use it |
|
|
143
136
|
|---|---|---|
|
|
144
|
-
| `answers.intensity` | `lightweight` \| `balanced` \| `thorough` | Step 4 (`process_constraints.analysis_mode`) and Step 5 (which tools/patterns) |
|
|
145
137
|
| `answers.moments` | `stop`, `pre-commit`, `pre-push` | Nothing to do — the hooks are already wired to exactly this |
|
|
146
138
|
| `answers.telemetry` | `enabled` \| `declined` \| `deferred` | Nothing to do — mention `deferred` once (see below) |
|
|
147
139
|
|
|
148
140
|
**Do not ask these again.** They were asked on init's terminal, and the machine
|
|
149
141
|
state already reflects them.
|
|
150
142
|
|
|
151
|
-
If `answers.intensity` is `null` (a project set up before this file existed, or a
|
|
152
|
-
failed write), that is the only case where you ask — a single question, defaulting
|
|
153
|
-
to `balanced`:
|
|
154
|
-
|
|
155
|
-
> **Analysis intensity:** lightweight (critical security only, ~3s) ·
|
|
156
|
-
> **balanced** (security + quality, ~8s) · thorough (all tools, all rules, ~15s)
|
|
157
|
-
|
|
158
143
|
If `answers.telemetry` is `deferred`, the user asked for cost & usage telemetry
|
|
159
144
|
before a token existed. Say so once, and that `verity login` followed by
|
|
160
145
|
`verity telemetry install` finishes it. Do not run either — logging in is the
|
|
@@ -172,7 +157,7 @@ Generate `.verity/standard.yaml` by filling in the template:
|
|
|
172
157
|
|
|
173
158
|
2. **quality_dimensions**: Keep all 4. Adjust thresholds if the existing codebase diverges significantly (e.g., if average file length is 500, set threshold to 400 instead of 300). Add language-specific type_safety signals from the patterns reference.
|
|
174
159
|
|
|
175
|
-
3. **security_patterns**: Keep all 7.
|
|
160
|
+
3. **security_patterns**: Keep all 7. Static analysis is Trivy only, so `enforced_by` lists Trivy where the patterns reference says Trivy enforces the pattern (secrets, dependency verification) and is `[]` everywhere else.
|
|
176
161
|
|
|
177
162
|
4. **custom_patterns**: Synthesize 2-5 project-specific patterns by analyzing:
|
|
178
163
|
- Project structure (e.g., "all files in `api/` use auth middleware")
|
|
@@ -180,9 +165,9 @@ Generate `.verity/standard.yaml` by filling in the template:
|
|
|
180
165
|
- Existing code patterns (e.g., "RLS policies on all Supabase tables")
|
|
181
166
|
- Each pattern needs: id, description, severity, rationale
|
|
182
167
|
|
|
183
|
-
5. **process_constraints**:
|
|
168
|
+
5. **process_constraints**: Keep `self_healing_limit: 2`. Leave the knowledge-system flags (`compound_enabled`, `memory_graph_enabled`, `memory_graph_budget_tokens`, `knowledge_injection_budget_tokens`, `finding_autosuppress_threshold`) and intent thresholds (`intent_fail_threshold`, `intent_warn_threshold`) at their template defaults — they're surfaced so users can tune later, not so you pick new values during setup.
|
|
184
169
|
|
|
185
|
-
6. **tool_configuration**:
|
|
170
|
+
6. **tool_configuration**: `{ Trivy: { enabled: true } }`. There is nothing else to choose.
|
|
186
171
|
|
|
187
172
|
Write the file to `.verity/standard.yaml`. Show the user a summary:
|
|
188
173
|
> **Standard synthesized:**
|
|
@@ -190,324 +175,18 @@ Write the file to `.verity/standard.yaml`. Show the user a summary:
|
|
|
190
175
|
> - Quality dimensions: 4 (comprehensibility, modularity, type_safety, test_adequacy)
|
|
191
176
|
> - Security patterns: 7 (3 critical, 4 high)
|
|
192
177
|
> - Custom patterns: 3 (auth-middleware, rls-policy, error-boundary)
|
|
193
|
-
> -
|
|
194
|
-
> - Tools: ESLint9, Trivy
|
|
178
|
+
> - Static analysis: Trivy
|
|
195
179
|
|
|
196
180
|
Ask for confirmation before proceeding.
|
|
197
181
|
|
|
198
182
|
---
|
|
199
183
|
|
|
200
|
-
## Step 5:
|
|
201
|
-
|
|
202
|
-
**ALWAYS OVERWRITE `.codacy/codacy.config.json` completely.** Do NOT read an existing config and tweak it — delete it and write a fresh file from scratch using the template below. Do NOT run `codacy-analysis init` either.
|
|
203
|
-
|
|
204
|
-
### Why this matters
|
|
205
|
-
|
|
206
|
-
`"patterns": []` means **ALL default patterns** for a tool:
|
|
207
|
-
- ESLint9 = 2,900+ rules → massive output, slow, token explosion
|
|
208
|
-
- Semgrep = 2,517 rules → massive output, slow, token explosion
|
|
209
|
-
- Ruff = 773 rules → same problem
|
|
210
|
-
|
|
211
|
-
**NEVER use `"patterns": []`.** Always populate patterns with specific patternId entries from `patterns-reference.yaml` section 8 (`curated_patterns`). This is the single most important step for keeping analysis fast and token-efficient.
|
|
212
|
-
|
|
213
|
-
### Pattern ID format — a wrong ID disables the tool SILENTLY
|
|
214
|
-
|
|
215
|
-
Every ID is `<toolId>_<ruleId>`, with `/` replaced by `_`:
|
|
216
|
-
|
|
217
|
-
| Rule as documented upstream | patternId to write |
|
|
218
|
-
|---|---|
|
|
219
|
-
| `no-eval` | `ESLint9_no-eval` |
|
|
220
|
-
| `@typescript-eslint/no-explicit-any` | `ESLint9_@typescript-eslint_no-explicit-any` |
|
|
221
|
-
| `F401` | `Ruff_F401` |
|
|
222
|
-
| `SC2086` | `shellcheck_SC2086` |
|
|
223
|
-
|
|
224
|
-
An unrecognised ID produces **no error**. The adapter builds `enabledPatterns` from
|
|
225
|
-
the config, matches nothing, and returns 0 issues — indistinguishable from clean
|
|
226
|
-
code. Note the perverse asymmetry: `patterns: []` (size 0) means "run all defaults"
|
|
227
|
-
and works, so a *wrong* list is strictly worse than *no* list.
|
|
228
|
-
|
|
229
|
-
Never hand-author or guess an ID. Copy it from `patterns-reference.yaml`, or derive
|
|
230
|
-
it from the installed adapter. Then **always validate** (next section).
|
|
231
|
-
|
|
232
|
-
### How to build the config
|
|
233
|
-
|
|
234
|
-
1. **Generate the umbrella-pattern tools mechanically.** Trivy's catalogue is small,
|
|
235
|
-
fixed, and severity-partitioned, so never copy it by hand — emit it from the
|
|
236
|
-
installed adapter metadata:
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
# balanced/thorough: critical + high vulns, secrets, malicious packages
|
|
240
|
-
node ${CLAUDE_SKILL_DIR}/validate-patterns.mjs --emit Trivy \
|
|
241
|
-
'^Trivy_(secret|malicious_packages|vulnerability_(critical|high))$'
|
|
242
|
-
|
|
243
|
-
# lightweight: drop malicious_packages if you want the minimum
|
|
244
|
-
# thorough: add |medium to the regex to widen severity
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
Paste the emitted array straight into the Trivy `patterns` field. `--list Trivy`
|
|
248
|
-
shows all six available patterns if you need to choose a different subset.
|
|
249
|
-
|
|
250
|
-
2. Read `patterns-reference.yaml` → `curated_patterns` section for the rule-level
|
|
251
|
-
tools (ESLint9, Ruff, shellcheck, …), where the curation is an editorial choice
|
|
252
|
-
about signal rather than a complete enumeration. Copy the pattern list for each
|
|
253
|
-
tool selected for this mode. `--list <toolId> <regex>` will confirm any single ID
|
|
254
|
-
or let you derive additions.
|
|
255
|
-
> ⚠ **Semgrep ids carry a doubled suffix.** The rule name appears twice — once as
|
|
256
|
-
> the path segment and once as the rule id:
|
|
257
|
-
> `Semgrep_javascript.browser.security.raw-html-concat.raw-html-concat`. Deriving
|
|
258
|
-
> them with `--list Semgrep '<regex>'` gives the correct form; constructing them by
|
|
259
|
-
> hand from the rule name does not.
|
|
260
|
-
|
|
261
|
-
3. ⚠ **NEVER point `localConfigurationFile` at the project's own config** (VRT-108).
|
|
262
|
-
Doing so hands the tool the project's rule set, and Verity's `patterns` array
|
|
263
|
-
degrades to a **filter over rules someone else enabled** — it can no longer turn
|
|
264
|
-
a rule ON. A project that disables a rule makes it permanently unreachable by
|
|
265
|
-
the gate, silently. Measured: a repo whose `eslint.config.js` sets
|
|
266
|
-
`"@typescript-eslint/no-unused-vars": "off"` and omits `no-eval`/`eqeqeq`/`no-var`
|
|
267
|
-
had all four listed in its Verity config and **only** `no-explicit-any` could fire.
|
|
268
|
-
|
|
269
|
-
Setting the path is not even sufficient on its own. `useLocalConfigurationFile`
|
|
270
|
-
**defaults to true**, and the adapter auto-discovers `./eslint.config.js` and
|
|
271
|
-
overrides your value unless the flag is explicitly `false`:
|
|
272
|
-
|
|
273
|
-
```js
|
|
274
|
-
// @codacy/analysis-cli — defaults to true unless EXPLICITLY false
|
|
275
|
-
if (!existing || existing.useLocalConfigurationFile !== false) {
|
|
276
|
-
config.useLocalConfigurationFile = true;
|
|
277
|
-
}
|
|
278
|
-
// patterns become the ENABLED set only when the flag is false
|
|
279
|
-
if (!codacyToolConfig.useLocalConfigurationFile && codacyToolConfig.patterns.length === …)
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
So for ESLint9 always emit **both**:
|
|
283
|
-
|
|
284
|
-
- `"useLocalConfigurationFile": false` — makes `patterns` the enabled rule set
|
|
285
|
-
- `"localConfigurationFile": "./.codacy/tools-configs/eslint.config.mjs"` — a
|
|
286
|
-
**Verity-owned** config, written by this skill, so the gate does not inherit
|
|
287
|
-
the project's lint policy
|
|
288
|
-
|
|
289
|
-
The project's own `eslint.config.js` is left untouched and keeps serving
|
|
290
|
-
`npm run lint`. The two are deliberately independent: a team may reasonably turn
|
|
291
|
-
a rule off for their editor and still want the gate to enforce it.
|
|
292
|
-
4. For tools **without** a local config: populate the full curated pattern list from `patterns-reference.yaml`
|
|
293
|
-
5. **Validate** (next section). This is not optional — it is the only thing that
|
|
294
|
-
catches a stale or mistyped ID, and the failure mode is silent.
|
|
295
|
-
|
|
296
|
-
### Template — write this file exactly
|
|
297
|
-
|
|
298
|
-
Delete `.codacy/codacy.config.json` and write a new one. This example is for TypeScript **balanced** mode. Adapt the tool list and patterns for the detected languages and mode.
|
|
299
|
-
|
|
300
|
-
> The `Trivy` block below shows what `--emit Trivy` produces for balanced mode — it is
|
|
301
|
-
> illustrative output, **not** a list to copy. Run the command (step 1) and paste its
|
|
302
|
-
> actual result, so the config tracks the installed adapter rather than this document.
|
|
303
|
-
> `patterns-reference.yaml` deliberately stores no Trivy list for the same reason.
|
|
304
|
-
|
|
305
|
-
```json
|
|
306
|
-
{
|
|
307
|
-
"version": 1,
|
|
308
|
-
"metadata": {
|
|
309
|
-
"source": "local",
|
|
310
|
-
"languages": ["TypeScript"]
|
|
311
|
-
},
|
|
312
|
-
"tools": [
|
|
313
|
-
{
|
|
314
|
-
"toolId": "ESLint9",
|
|
315
|
-
"localConfigurationFile": "./.codacy/tools-configs/eslint.config.mjs",
|
|
316
|
-
"useLocalConfigurationFile": false,
|
|
317
|
-
"patterns": [
|
|
318
|
-
{ "patternId": "ESLint9_no-eval" },
|
|
319
|
-
{ "patternId": "ESLint9_no-implied-eval" },
|
|
320
|
-
{ "patternId": "ESLint9_no-new-func" },
|
|
321
|
-
{ "patternId": "ESLint9_no-script-url" },
|
|
322
|
-
{ "patternId": "ESLint9_no-unused-vars" },
|
|
323
|
-
{ "patternId": "ESLint9_no-undef" },
|
|
324
|
-
{ "patternId": "ESLint9_no-unreachable" },
|
|
325
|
-
{ "patternId": "ESLint9_no-constant-condition" },
|
|
326
|
-
{ "patternId": "ESLint9_no-dupe-keys" },
|
|
327
|
-
{ "patternId": "ESLint9_no-duplicate-case" },
|
|
328
|
-
{ "patternId": "ESLint9_no-fallthrough" },
|
|
329
|
-
{ "patternId": "ESLint9_no-self-assign" },
|
|
330
|
-
{ "patternId": "ESLint9_no-self-compare" },
|
|
331
|
-
{ "patternId": "ESLint9_use-isnan" },
|
|
332
|
-
{ "patternId": "ESLint9_valid-typeof" },
|
|
333
|
-
{ "patternId": "ESLint9_no-loss-of-precision" },
|
|
334
|
-
{ "patternId": "ESLint9_no-unsafe-optional-chaining" },
|
|
335
|
-
{ "patternId": "ESLint9_@typescript-eslint_no-explicit-any" },
|
|
336
|
-
{ "patternId": "ESLint9_@typescript-eslint_no-unused-vars" },
|
|
337
|
-
{ "patternId": "ESLint9_@typescript-eslint_no-unsafe-assignment" },
|
|
338
|
-
{ "patternId": "ESLint9_@typescript-eslint_no-unsafe-call" },
|
|
339
|
-
{ "patternId": "ESLint9_@typescript-eslint_no-unsafe-return" },
|
|
340
|
-
{ "patternId": "ESLint9_eqeqeq" },
|
|
341
|
-
{ "patternId": "ESLint9_no-var" },
|
|
342
|
-
{ "patternId": "ESLint9_prefer-const" }
|
|
343
|
-
]
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
"toolId": "Trivy",
|
|
347
|
-
"patterns": [
|
|
348
|
-
{ "patternId": "Trivy_vulnerability_critical" },
|
|
349
|
-
{ "patternId": "Trivy_vulnerability_high" },
|
|
350
|
-
{ "patternId": "Trivy_secret" },
|
|
351
|
-
{ "patternId": "Trivy_malicious_packages" }
|
|
352
|
-
]
|
|
353
|
-
}
|
|
354
|
-
],
|
|
355
|
-
"exclude": [
|
|
356
|
-
"**/node_modules/**",
|
|
357
|
-
"**/dist/**",
|
|
358
|
-
"**/build/**",
|
|
359
|
-
"**/.git/**",
|
|
360
|
-
"**/vendor/**",
|
|
361
|
-
"**/coverage/**"
|
|
362
|
-
]
|
|
363
|
-
}
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
### Also write the Verity-owned ESLint config
|
|
367
|
-
|
|
368
|
-
Because `useLocalConfigurationFile` is `false`, the adapter builds ESLint's rule set
|
|
369
|
-
from the `patterns` array — but ESLint still needs a config for parser, globals and
|
|
370
|
-
ignores. Write `.codacy/tools-configs/eslint.config.mjs`, adapted to the project's
|
|
371
|
-
frameworks and ignore paths:
|
|
372
|
-
|
|
373
|
-
```js
|
|
374
|
-
// Verity-owned ESLint config for the quality gate.
|
|
375
|
-
//
|
|
376
|
-
// Deliberately SEPARATE from the project's ./eslint.config.js. Pointing the gate at
|
|
377
|
-
// the project config makes Verity's pattern list a FILTER over rules the project
|
|
378
|
-
// enabled, so any rule the project disables becomes unreachable (VRT-108).
|
|
379
|
-
//
|
|
380
|
-
// Keep the rules here in sync with the ESLint9 patterns in codacy.config.json.
|
|
381
|
-
import js from "@eslint/js";
|
|
382
|
-
import globals from "globals";
|
|
383
|
-
import tseslint from "typescript-eslint";
|
|
384
|
-
|
|
385
|
-
export default tseslint.config(
|
|
386
|
-
{ ignores: ["dist/**", "build/**", "node_modules/**", "coverage/**", ".codacy/**"] },
|
|
387
|
-
{
|
|
388
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
389
|
-
files: ["**/*.{ts,tsx,js,jsx}"],
|
|
390
|
-
languageOptions: {
|
|
391
|
-
ecmaVersion: 2022,
|
|
392
|
-
sourceType: "module",
|
|
393
|
-
globals: { ...globals.browser, ...globals.node },
|
|
394
|
-
},
|
|
395
|
-
rules: {
|
|
396
|
-
// Mirror the ESLint9 patterns in codacy.config.json.
|
|
397
|
-
"no-eval": "error",
|
|
398
|
-
"no-implied-eval": "error",
|
|
399
|
-
"no-new-func": "error",
|
|
400
|
-
"no-script-url": "error",
|
|
401
|
-
eqeqeq: ["error", "smart"],
|
|
402
|
-
"no-var": "error",
|
|
403
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
404
|
-
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
405
|
-
},
|
|
406
|
-
},
|
|
407
|
-
);
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
⚠ **Do not enable type-checked rules** (`no-unsafe-assignment`, `no-unsafe-call`,
|
|
411
|
-
`no-unsafe-return`). They require `parserOptions.projectService`, which makes a
|
|
412
|
-
per-turn gate far too slow on a large repo. Cover those through AI review in the
|
|
413
|
-
Standard instead.
|
|
414
|
-
|
|
415
|
-
⚠ **Generated files belong in `ignores`** — `src/integrations/supabase/types.ts` and
|
|
416
|
-
similar. They are not the agent's work and will otherwise dominate the findings.
|
|
417
|
-
|
|
418
|
-
### Validate the config — REQUIRED, do not skip
|
|
419
|
-
|
|
420
|
-
Immediately after writing `.codacy/codacy.config.json`, run the validator that ships
|
|
421
|
-
alongside this skill. It checks every `patternId` against the IDs the installed
|
|
422
|
-
adapters actually define, and exits non-zero on any that does not exist:
|
|
423
|
-
|
|
424
|
-
```bash
|
|
425
|
-
node ${CLAUDE_SKILL_DIR}/validate-patterns.mjs
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
Expected output:
|
|
429
|
-
|
|
430
|
-
```
|
|
431
|
-
ESLint9: 25/25 valid
|
|
432
|
-
Trivy: 4/4 valid
|
|
433
|
-
shellcheck: 14/14 valid
|
|
434
|
-
|
|
435
|
-
PASS: every patternId resolves.
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
**If it reports FAIL, fix the IDs before continuing.** Do not report setup as
|
|
439
|
-
complete with a failing validation — every listed pattern is silently disabled, so
|
|
440
|
-
the project would appear to have static analysis while enforcing nothing. The
|
|
441
|
-
validator prints the conventional `<toolId>_<rule>` form as a suggested fix.
|
|
442
|
-
|
|
443
|
-
**Tool selection by language** — ONLY include tools that apply to the detected languages:
|
|
444
|
-
|
|
445
|
-
| Language | Balanced mode tools |
|
|
446
|
-
|----------|-------------------|
|
|
447
|
-
| TypeScript/JavaScript | ESLint9 + Trivy |
|
|
448
|
-
| Python | Ruff + Trivy |
|
|
449
|
-
| Go | Trivy |
|
|
450
|
-
| Java | PMD7 + Trivy |
|
|
451
|
-
| Kotlin | detekt + Trivy |
|
|
452
|
-
| Shell | shellcheck + Trivy |
|
|
453
|
-
| C/C++ | cppcheck + flawfinder + Trivy |
|
|
454
|
-
| Dockerfile | Hadolint + Trivy |
|
|
184
|
+
## Step 5: Static analysis — nothing to configure
|
|
455
185
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
> 2523 default rules. Re-add it once IDs are derived and the validator passes.
|
|
461
|
-
|
|
462
|
-
Use curated patterns from `patterns-reference.yaml` for each tool. For Python, use the Ruff patterns. For TypeScript, use the ESLint9 patterns.
|
|
463
|
-
|
|
464
|
-
**Do NOT include tools for languages not in the project.** For example:
|
|
465
|
-
- Do NOT add ESLint9 to a Python project
|
|
466
|
-
- Do NOT add Checkov unless the project has Terraform/CloudFormation/K8s files
|
|
467
|
-
- Do NOT add Hadolint unless the project has Dockerfiles
|
|
468
|
-
- Do NOT add shellcheck unless the project has shell scripts
|
|
469
|
-
|
|
470
|
-
### Format rules (the CLI will crash without these)
|
|
471
|
-
|
|
472
|
-
- **Every tool MUST have a `"patterns"` array with at least one entry.** Without it: `Cannot read properties of undefined (reading 'map')`.
|
|
473
|
-
- **NEVER use `"patterns": []`** — this enables ALL defaults (thousands of rules).
|
|
474
|
-
- `"toolId"` is the field name, NOT `"name"` or `"tool"`.
|
|
475
|
-
- Exact adapter IDs: `ESLint9`, `Semgrep`, `Trivy`, `Ruff`, `Bandit`, `shellcheck`, `Hadolint`, `PMD7`, `Checkstyle`, `detekt`, `cppcheck`, `flawfinder`, `Lizard`, `PyLintPython3`.
|
|
476
|
-
- `"metadata.languages"` — capitalize first letter: `"TypeScript"`, `"Python"`, `"JavaScript"`, `"Go"`, `"Java"`, `"Shell"`.
|
|
477
|
-
|
|
478
|
-
### Tool selection by mode
|
|
479
|
-
|
|
480
|
-
| Mode | Tools | Approximate pattern count |
|
|
481
|
-
|------|-------|--------------------------|
|
|
482
|
-
| lightweight | Trivy only | ~4 patterns |
|
|
483
|
-
| balanced | Language linter + Trivy | ~25 + 4 = ~29 patterns |
|
|
484
|
-
| thorough | All applicable + Lizard | ~60-80 patterns |
|
|
485
|
-
|
|
486
|
-
### Verify
|
|
487
|
-
|
|
488
|
-
First confirm every pattern ID resolves (see "Validate the config" above) — a silently
|
|
489
|
-
disabled tool produces the same zero findings as clean code, so a quiet run proves
|
|
490
|
-
nothing on its own:
|
|
491
|
-
|
|
492
|
-
```bash
|
|
493
|
-
node ${CLAUDE_SKILL_DIR}/validate-patterns.mjs
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
Then confirm the volume is sane:
|
|
497
|
-
|
|
498
|
-
```bash
|
|
499
|
-
codacy-analysis analyze --install-dependencies --files src/some-small-file.ts --log-level error --output-format json 2>/dev/null
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
Expected: single-digit findings per file, not hundreds. If you see 50+ issues from one
|
|
503
|
-
file, you likely have `"patterns": []` somewhere — fix it.
|
|
504
|
-
|
|
505
|
-
Check the `capability.ready` array in the JSON to see which tools actually ran.
|
|
506
|
-
`--install-dependencies` handles tools the CLI can install itself (ESLint9 is bundled,
|
|
507
|
-
shellcheck it downloads, Trivy it finds on PATH) but it does **not** fetch every
|
|
508
|
-
binary — Semgrep needs Opengrep installed separately, and at `--log-level error` the
|
|
509
|
-
"Tool unavailable" warning is suppressed, so the omission is invisible. Use
|
|
510
|
-
`--log-level warning` or `--inspect` when a tool seems to report nothing.
|
|
186
|
+
Static analysis is Trivy only, and Verity configures and runs it itself from
|
|
187
|
+
`.verity/static-analysis.json`. **Do not write `.codacy/codacy.config.json`, an
|
|
188
|
+
ESLint config or any pattern list.** The project's `.codacy/` files belong to the
|
|
189
|
+
project and to Codacy's own tooling, and the gate does not read them.
|
|
511
190
|
|
|
512
191
|
---
|
|
513
192
|
|
|
@@ -555,13 +234,12 @@ The token and service_url live in the single global file `~/.verity/credentials`
|
|
|
555
234
|
|
|
556
235
|
---
|
|
557
236
|
|
|
558
|
-
## Step 7: Upload Standard
|
|
237
|
+
## Step 7: Upload the Standard
|
|
559
238
|
|
|
560
239
|
> **Skip this entire step if the user is not authenticated** (Step 6 reported
|
|
561
240
|
> local-only mode). These commands require a token and will fail without one. The
|
|
562
|
-
> `.verity/standard.yaml`
|
|
563
|
-
>
|
|
564
|
-
> re-runs setup.
|
|
241
|
+
> `.verity/standard.yaml` you generated locally is pushed automatically the next
|
|
242
|
+
> time the user signs in.
|
|
565
243
|
|
|
566
244
|
### Upload the Standard
|
|
567
245
|
|
|
@@ -573,14 +251,6 @@ verity standard push
|
|
|
573
251
|
|
|
574
252
|
This reads `.verity/standard.yaml`, converts it to JSON, and uploads it. Verify the output shows `version: 1`.
|
|
575
253
|
|
|
576
|
-
### Upload analysis config
|
|
577
|
-
|
|
578
|
-
```bash
|
|
579
|
-
verity config push
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
This reads `.codacy/codacy.config.json` and uploads it.
|
|
583
|
-
|
|
584
254
|
### Seed the knowledge base
|
|
585
255
|
|
|
586
256
|
```bash
|
|
@@ -684,11 +354,9 @@ Project: ${PROJECT_NAME}
|
|
|
684
354
|
Languages: ${LANGUAGES}
|
|
685
355
|
Frameworks: ${FRAMEWORKS}
|
|
686
356
|
Architecture: ${ARCHITECTURE}
|
|
687
|
-
Intensity: ${MODE} (chosen during verity init)
|
|
688
357
|
|
|
689
358
|
This step wrote:
|
|
690
359
|
.verity/standard.yaml — Standard v1 (4 quality, 7 security, N custom patterns)
|
|
691
|
-
.codacy/codacy.config.json — ${TOOL_LIST}, curated patterns, validated
|
|
692
360
|
VERITY.md — project quality overview
|
|
693
361
|
.verityignore — only if you created one in Step 9
|
|
694
362
|
|