@brokkai/slopcop 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,10 +18,14 @@ and the certainty behind it. The analysis is
18
18
  engine rather than a language model, so a finding traces back to a rule instead
19
19
  of to a guess.
20
20
 
21
+ The full documentation is at <https://docs.slopcop.com>.
22
+
21
23
  There is no local analyzer and nothing to install per language: the CLI ships
22
- the change and prints what comes back, and it never decides on its own that
23
- there is nothing to check. The command is built for agents and one-shot CI: no
24
- prompts, one request, and the analyzer's exit contract.
24
+ the change and prints what comes back, and it never reports a check as passed
25
+ without the service. The command is built for agents and one-shot CI: no
26
+ prompts, one request, and the analyzer's exit contract. A check never adds a
27
+ repository; `--if-enabled` skips one the workspace has not enabled, and says it
28
+ was skipped.
25
29
 
26
30
  ## Install
27
31
 
@@ -129,7 +133,7 @@ go install github.com/BrokkAi/slopcop/cmd/slopcop@latest
129
133
  Go 1.25 or newer is required to build. A plain `go install` reports `dev` as
130
134
  its version; in a clone, `make install` stamps the version from `git describe`.
131
135
 
132
- ## Enable it in an agent
136
+ ## Set it up in an agent
133
137
 
134
138
  The binary carries the agent skill that teaches a coding agent how to run
135
139
  slopcop, plus an automatic check hook for Claude Code and Codex. `slopcop init`
@@ -138,16 +142,34 @@ present, and names what it did:
138
142
 
139
143
  | Location | Harness |
140
144
  | --- | --- |
141
- | `~/.agents/skills/slopcop/` | Codex, opencode |
145
+ | `~/.agents/skills/slopcop/` | Codex, opencode, Cursor, and other agents |
142
146
  | `~/.claude/skills/slopcop/` | Claude Code, opencode |
143
147
  | `$CODEX_HOME/skills/slopcop/`, or `~/.codex/skills/slopcop/` | Codex home |
144
148
 
149
+ When none of those harness directories is present, init writes the
150
+ vendor-neutral `~/.agents/skills/slopcop/` instead, which Codex, opencode,
151
+ Cursor and other agents read. A fresh machine therefore has the skill before
152
+ any harness has created its configuration directory.
153
+
145
154
  A skill that is already there is left alone by init, so running it again is
146
155
  safe. `slopcop login` and every check also install the skill in those
147
156
  directories, rewriting one that differs from the skill bundled into the binary,
148
- so an agent follows the instructions of the slopcop version it runs; local
149
- edits to an installed skill do not survive them. `slopcop init --no-skill`
150
- skips the install and any update of it.
157
+ so an agent follows the instructions of the slopcop version it runs. Each
158
+ install records the version that wrote it, and what each file held, in
159
+ `.slopcop-skill.json` in the skill folder. An update names the version it
160
+ replaces, the new one and the files that changed, for example:
161
+
162
+ ```
163
+ slopcop: updated the slopcop skill at ~/.claude/skills/slopcop from v0.0.9 to v0.0.10 (changed: SKILL.md). Reread it if you loaded the old one.
164
+ ```
165
+
166
+ It removes the files the new skill no longer has. A skill with local edits,
167
+ one that matches neither its record nor any release, is copied first to
168
+ `skill-backups/<harness>-<time>` next to the slopcop configuration, outside
169
+ every skills directory so no harness loads it as a second skill, and the
170
+ notice says where. A check's `json` and `sarif` reports carry the same update
171
+ (see below). `slopcop init --no-skill` skips the install and any update of
172
+ it.
151
173
 
152
174
  Init also adds a `Stop` hook for each harness installed here, and leaves
153
175
  everything else in the file as it was:
@@ -166,13 +188,28 @@ When the agent stops, the hook checks the working tree through the same
166
188
  hosted API, but only when all of these hold:
167
189
 
168
190
  - the session wrote files in the repository with its edit tools (a Codex
169
- session's subagents included);
191
+ session's subagents included), or the working tree has a changed
192
+ dependency manifest or lockfile (see below);
170
193
  - slopcop is signed in, and the workspace a check would use
171
194
  (`$SLOPCOP_WORKSPACE`, or the login's) has the repository active
172
195
  (`slopcop repo list`), so nothing is sent from other repositories;
173
196
  - the tree differs from the last check in the session, including a check the
174
197
  agent ran by hand.
175
198
 
199
+ An agent often adds a dependency through its shell, with `npm install`,
200
+ `pnpm add`, `cargo add` or `uv add`, which no edit tool records. So the hook
201
+ also checks when git shows one of these files changed, added or untracked in
202
+ any directory of the repository: `package.json`, `package-lock.json`,
203
+ `npm-shrinkwrap.json`, `pnpm-lock.yaml`, `yarn.lock`, `Cargo.toml`,
204
+ `Cargo.lock`, `pyproject.toml`, `uv.lock`, `poetry.lock`, `requirements*.txt`,
205
+ `go.mod` and `go.sum`. Files git ignores and those under `node_modules` do
206
+ not count. The hook recognises these files by name only: it never reads
207
+ them, runs a package manager or asks an advisory database; the hosted check
208
+ reads them like any other file in the change. A changed dependency file
209
+ counts as one the session wrote, since the hook cannot tell which command
210
+ changed it, so its new findings are handed to the agent like those in files
211
+ it edited, even if the file was already changed when the session began.
212
+
176
213
  New findings in files the session wrote are handed to the agent to fix, once
177
214
  for a given tree and at most twice in a row; then the agent is let go and you
178
215
  are told what remains. A finding ignored with `slopcop ignore` is not handed
@@ -190,6 +227,11 @@ Use `slopcop init --no-hooks` to install only the skill, or
190
227
  Ordinary checks do not reinstall a removed hook. The skill remains the way to
191
228
  check from other harnesses.
192
229
 
230
+ The hook is dormant in a repository until it is enabled in the workspace. Run
231
+ `slopcop enable` in the checkout, at a terminal, to add it and run its first
232
+ check. The hook then checks what an agent writes and hands findings back; it
233
+ never adds a repository and sends nothing for one that is not active.
234
+
193
235
  ## Sign in
194
236
 
195
237
  ```console
@@ -197,8 +239,10 @@ slopcop login # browser device flow
197
239
  slopcop login --token "$SLOPCOP_TOKEN" # existing credential, for CI and agents
198
240
  ```
199
241
 
200
- The browser flow prints a URL and a code and stores the token once the login is
201
- approved. The service URL defaults to `https://slopcop.com`; `--service`,
242
+ The browser flow prints a link that opens the approval page with the code
243
+ filled in, plus the page and code to type in instead, and stores the token once
244
+ the login is approved. Approve only if the page shows the code your terminal
245
+ printed. The service URL defaults to `https://slopcop.com`; `--service`,
202
246
  `$SLOPCOP_SERVICE`, or a stored value override it.
203
247
 
204
248
  The credential lives in `slopcop/config.json` under the user config directory
@@ -210,7 +254,7 @@ Precedence:
210
254
  | --- | --- |
211
255
  | Service URL | `--service`, `$SLOPCOP_SERVICE`, stored by `slopcop login`, `https://slopcop.com` |
212
256
  | Token | `$SLOPCOP_TOKEN`, stored value |
213
- | Workspace (`check`, `ignore`, `repo`) | `-w`/`--workspace`, `$SLOPCOP_WORKSPACE`, the one the login is bound to |
257
+ | Workspace (`check`, `enable`, `status`, `ignore`, `unignore`, `ignored`, `repo`) | `-w`/`--workspace`, `$SLOPCOP_WORKSPACE`, the one the login is bound to |
214
258
 
215
259
  ## Workspace and repositories
216
260
 
@@ -219,6 +263,8 @@ active in the browser when the login was approved.
219
263
 
220
264
  ```console
221
265
  slopcop whoami # account, this login's workspace, its plan, the service URL
266
+ slopcop status # this checkout's repository, and whether the workspace checks it
267
+ slopcop enable # add this checkout's repository to the workspace, at a terminal
222
268
  slopcop workspace list # the account's workspaces; * marks this login's
223
269
  slopcop workspace use "Acme team" # move this login (not the browser) to another, by name or id
224
270
  slopcop check -w "Acme team" # check in, and bill, another workspace this once
@@ -227,8 +273,8 @@ slopcop repo disable acme/widgets # stop checking and charging for one (owner o
227
273
  slopcop repo enable acme/widgets # turn it back on, within the workspace's active limit
228
274
  ```
229
275
 
230
- `whoami`, `workspace list` and `repo list` take `--format human|json`, as do
231
- `workspace use` and `repo enable|disable` for their answer. Every active
276
+ `status`, `whoami`, `workspace list` and `repo list` take `--format human|json`,
277
+ as do `workspace use` and `repo enable|disable` for their answer. Every active
232
278
  repository after a workspace's first costs credits every 30 days; a disabled
233
279
  one is not checked or charged and keeps its reports, findings and settings.
234
280
  `repo enable` and `repo disable` ask you to type the repository's `owner/name`
@@ -237,36 +283,42 @@ login, and the service cannot tell it from you, so changing what the workspace
237
283
  pays stays a step you take yourself.
238
284
  `workspace use` moves every agent and script using this login, not only the
239
285
  one that runs it, so it asks `[y/N]` and refuses when stdin is not a terminal.
240
- To check in another workspace without moving anyone, `check`, `ignore` and
241
- `repo` take `-w`/`--workspace <name|id>` (or `$SLOPCOP_WORKSPACE`) for that one
242
- command; the login stays where it was. Give agents that share a login their
286
+ To check in another workspace without moving anyone, `check`, `status`,
287
+ `ignore`, `unignore`, `ignored` and `repo` take `-w`/`--workspace <name|id>`
288
+ (or `$SLOPCOP_WORKSPACE`) for that one command; the login stays where it was. Give agents that share a login their
243
289
  own `--workspace` instead of switching it.
244
290
 
245
291
  Names match without regard to case; when two workspaces share a name, or two
246
- providers a repository name, pass the id the listing prints. There is no `repo
247
- add`: a first check adds a repository. When the workspace would then pay for
248
- it (it already has an active repository and is charged), the service refuses
249
- the check with `repository_add_unconfirmed` until a person confirms: at a
250
- terminal `check` prints what it costs, asks `Add owner/name to "Workspace"?
251
- [y/N]`, and on a yes sends the check again and says `added owner/name to
252
- "Workspace"` on stderr. With no terminal, as for an agent or CI (a pipe or the
253
- null device is not one), nothing is asked: the check exits `4` with the
254
- service's remedy, a line naming the command that confirms it, and, in `json`,
255
- a `failed` report naming the code. A no at the terminal ends the same way.
256
- Once the person has approved it, `check --add-repository --workspace
257
- <name|id>` confirms without a terminal; the flag needs `--workspace` (the
258
- flag itself, not `$SLOPCOP_WORKSPACE`), so an approval given for one
259
- workspace cannot add the repository to the one the login happens to point at.
260
- The flag changes nothing for a repository already in that workspace. A
261
- workspace's first repository is added without asking. Deleting repositories,
262
- archiving workspaces, members, credits and repository settings stay in the web
263
- app. The commands exit `0` on success and `2` with the service's message and
264
- remedy otherwise, as `ignore` does.
292
+ providers a repository name, pass the id the listing prints.
293
+
294
+ `slopcop enable`, run inside a checkout at a terminal, adds the repository the
295
+ `origin` remote names to the workspace that checks and bills it, and runs its
296
+ first check. It names the workspace and what adding the repository costs, asks
297
+ you to type the repository's `owner/name`, and refuses when stdin is not a
298
+ terminal. A repository that is already added but disabled is enabled again;
299
+ one that is already active is left alone. An agent runs with your login and
300
+ the service cannot tell it from you, so adding a repository stays a step you
301
+ take yourself.
302
+
303
+ A check never adds a repository. A check of one the workspace has not added
304
+ exits `4` with `repository_not_enabled` and sends nothing; `status` shows the
305
+ same state, and a check that is not at a terminal asks nothing. Once a person
306
+ has approved adding one, `check --add-repository --workspace <name|id>`
307
+ carries that approval without a terminal; the flag needs `--workspace` (the
308
+ flag itself, not `$SLOPCOP_WORKSPACE`), so an approval given for one workspace
309
+ cannot add the repository to the one the login happens to point at. The flag
310
+ changes nothing for a repository already in that workspace. `slopcop enable`
311
+ says `added owner/name to "Workspace"` on stderr, and `json` reports
312
+ `"repositoryAdded": true`. Deleting repositories, archiving workspaces,
313
+ members, credits and repository settings stay in the web app. `enable` exits
314
+ with its first check's result; the other account commands exit `0` on success
315
+ and `2` with the service's message and remedy otherwise, as `ignore` does.
265
316
 
266
317
  ## Check
267
318
 
268
319
  ```console
269
320
  slopcop # check the change in the current checkout
321
+ slopcop check --if-enabled # automatic check: skip a repository not enabled here
270
322
  slopcop check --format json # same, machine-readable
271
323
  slopcop --root ../repo --base origin/main
272
324
  ```
@@ -306,8 +358,9 @@ Flags:
306
358
  | `--no-policy-discovery` | skip `.slopcop/policies` rules |
307
359
  | `--timeout DURATION` | how long to wait for the result (default `10m`) |
308
360
  | `-w`, `--workspace NAME\|ID` | check in, and bill, this workspace of the account instead of the login's |
309
- | `--add-repository` | add the repository to the workspace `--workspace` names, which then pays for it, without asking at a terminal; for after the user approved it |
310
- | `--verbose` | print the resolved request to stderr |
361
+ | `--if-enabled` | check only when the repository is active in the workspace; otherwise exit `0` without sending a check |
362
+ | `--add-repository` | add the repository to the workspace `--workspace` names, which then pays for it, without asking at a terminal; for after the user approved it. A check without it never adds a repository |
363
+ | `--verbose` | print the resolved request to stderr, and name each inconclusive check in `human` |
311
364
 
312
365
  ### What is sent
313
366
 
@@ -376,6 +429,16 @@ with a one-line confirmation, and otherwise exits `2` with the service's
376
429
  message and remedy; `finding_not_found` means the id is unknown or comes from a
377
430
  check outside your workspace.
378
431
 
432
+ To undo a mistaken ignore, run `slopcop unignore <id>` with the id it was
433
+ ignored from, or the same finding's id from any later check of the repository.
434
+ Later checks of the repository report the finding again. Unignoring a finding
435
+ that is not ignored is fine; it exits and fails like `ignore`.
436
+
437
+ `slopcop ignored` lists the findings your workspace ignored in this repository,
438
+ newest first, 25 per page (`--page <n>`), with each one's id for `unignore`,
439
+ location, rule, and when and by whom it was ignored. `--format json` prints the
440
+ service's answer.
441
+
379
442
  ### Output and exit codes
380
443
 
381
444
  The service answers structured data; the CLI renders it. `human` prints one
@@ -384,8 +447,13 @@ summary line such as `1 new finding across 1 file(s); 72 already in the code |
384
447
  Analysis complete`, and any omitted new findings or
385
448
  incomplete checks. `json` prints `status`, `baseCommit`, `summary`
386
449
  (`newFindings` and `existingFindings` count the split), `findings` (each with
387
- `new` and its `id`), `incomplete`, `failure` when the analysis did not
388
- complete, and `emptyChange` when the patch was empty. `sarif` prints a SARIF 2.1.0 log whose results carry `baselineState`
450
+ `new` and its `id`), `incomplete`, `inconclusive`, `failure` when the analysis did not
451
+ complete, and `emptyChange` when the patch was empty. When the check
452
+ installed or updated the skill, `skillUpdated` lists each skill directory it
453
+ wrote: `dir`, `from` (a release, `unknown`, or absent for a fresh install),
454
+ `to`, `changed` and, for a skill with local edits, `backup`; the failed and
455
+ pending reports carry it too, and `sarif` puts it in
456
+ `properties["slopcop.skillUpdated"]`. `sarif` prints a SARIF 2.1.0 log whose results carry `baselineState`
389
457
  `new` and the finding id in `properties["slopcop.findingId"]`. `--format` only
390
458
  changes the rendering, never the request, so the service answers the same check
391
459
  whichever is used.
@@ -406,10 +474,18 @@ reached the service; after, a service that received it keeps running it, and
406
474
  running the same check again picks up its result.
407
475
 
408
476
  An inconclusive check, one that ran but could not prove there is nothing
409
- more to find, never changes the exit code and is not named in any format.
410
- Complete proof is rare in static analysis, typically at a library boundary,
411
- so this is the norm rather than a gap. `summary.inconclusive` counts them in
412
- `json`, as does `slopcop.inconclusive` in `sarif`. A check that timed out or
477
+ more to find, never changes the exit code or the status. Complete proof is
478
+ rare in static analysis, typically at a library boundary, so this is the norm
479
+ rather than a gap. Each report still says where they are, so a reviewer can
480
+ judge what a `clean` result is worth: `human` prints one `Inconclusive:` line
481
+ with the count and how many concern only files the change does not write, and
482
+ `--verbose` names each check. `json` lists them in `inconclusive`, each with
483
+ `policyId`, `reason` and `elsewhere` (true when it concerns only files the
484
+ change does not write), beside the `summary.inconclusive` count. `sarif` adds
485
+ a `note` notification per check with `slopcop.inconclusive` and
486
+ `slopcop.elsewhere` properties. The service names at most 50; the counts
487
+ cover the rest. It does not yet say which files or lines each one concerns,
488
+ or what evidence was missing. A check that timed out or
413
489
  that Bifrost judged unreliable is incomplete and counts wherever it is.
414
490
 
415
491
  The service applies `--fail-on` and sets the status; the exit code follows it.
@@ -422,8 +498,10 @@ New findings that cross `--fail-on` exit `1` even when some check did not
422
498
  complete.
423
499
 
424
500
  While the service answers `check_running`, the CLI waits the `Retry-After` it
425
- names and asks again until `--timeout` runs out; every ask attaches to the same
426
- running check. If it is still running then, the CLI exits `3`, prints the
501
+ names and asks again until `--timeout` runs out. It asks by the `checkId` the
502
+ answer carries (`GET /v1/check/{checkId}`), so the change is uploaded once; a
503
+ service that sends no `checkId`, or no longer knows it, gets the same request
504
+ again, which attaches to the same running check. If it is still running then, the CLI exits `3`, prints the
427
505
  service's message and remedy on stderr, and in `json` prints
428
506
  `{"status": "pending", "retryAfter": 5, "message": …, "remedy": …}` on stdout
429
507
  (`sarif` prints a run with `slopcop.status` `pending`). Running the same check
@@ -436,23 +514,23 @@ rewrite them. The remedies name no client, so the CLI adds its own command
436
514
  after some: `slopcop login` when the remedy is to sign in, the listing to
437
515
  choose from after `workspace_not_found` or `workspace_repository_not_found`,
438
516
  and `slopcop whoami` after `repository_disabled`, since the workspace that
439
- disabled it is the one this login is bound to, `--workspace` after
440
- `owner_required`, and `--add-repository --workspace "Name"`, with the
441
- workspace the check would have added the repository to, after
442
- `repository_add_unconfirmed`. A failed check exits `4` when only a person can
443
- clear the refusal (`auth_required`, `auth_expired`, `account_required`,
517
+ disabled it is the one this login is bound to, and `--workspace` after
518
+ `owner_required`. A failed check exits `4` when only a person can clear the
519
+ refusal (`auth_required`, `auth_expired`, `account_required`,
444
520
  `repo_not_indexed`, `app_not_installed`, `app_no_repo_access`,
445
521
  `gitlab_not_connected`, `no_access`, `insufficient_credits`,
446
- `repository_disabled`, `repository_add_unconfirmed`,
447
- `workspace_repository_limit_reached`, `active_repository_limit_reached`,
448
- `owner_required`, and `browser_required`), so a script can stop instead of
449
- retrying, and `2` otherwise. Stderr starts with the code, as in `slopcop:
450
- repository_add_unconfirmed: …`. `human` prints nothing on stdout; `json`
451
- prints `{"status": "failed", "code": …, "message": …, "remedy": …,
452
- "retryable": …}`, plus `installUrl` or `topUpUrl` when the service sent one;
453
- `sarif` prints a run with `slopcop.status` `failed`, whose invocation is
454
- unsuccessful and carries an `error` notification whose descriptor id is the
455
- code.
522
+ `repository_disabled`, `repository_not_enabled`,
523
+ `repository_add_unconfirmed`, `workspace_repository_limit_reached`,
524
+ `active_repository_limit_reached`, `owner_required`, and `browser_required`),
525
+ so a script can stop instead of retrying, and `2` otherwise. The CLI refuses a
526
+ check of a repository the workspace has not added locally, as
527
+ `repository_not_enabled`, before sending anything. Stderr starts with the
528
+ code, as in `slopcop: repository_not_enabled: …`. `human` prints nothing on
529
+ stdout; `json` prints `{"status": "failed", "code": …, "message": …,
530
+ "remedy": …, "retryable": …}`, plus `installUrl` or `topUpUrl` when the
531
+ service sent one; `sarif` prints a run with `slopcop.status` `failed`, whose
532
+ invocation is unsuccessful and carries an `error` notification whose
533
+ descriptor id is the code.
456
534
 
457
535
  ## API
458
536
 
@@ -486,7 +564,13 @@ could be ignored omits it.
486
564
  `slopcop ignore <id>` calls `POST <service>/v1/ignore` with the same bearer
487
565
  token and `{"findingId": "<id>"}`, and gets back
488
566
  `{"findingId": "<id>", "status": "ignored"}`. Failures use the same closed
489
- contract, including `finding_not_found`.
567
+ contract, including `finding_not_found`. `slopcop unignore <id>` calls
568
+ `POST <service>/v1/unignore` the same way and gets back
569
+ `{"findingId": "<id>", "status": "unignored"}`, also when the finding was not
570
+ ignored.
571
+ `slopcop ignored` calls `GET <service>/v1/ignores?repoUrl=<url>&page=<n>`
572
+ (`page` zero-based) and gets back `repository`, `total`, `page`, `pageSize` and
573
+ `ignores`, newest first; see the [API reference](docs/src/content/docs/reference/api.md).
490
574
 
491
575
  The account commands use the same bearer token. `GET <service>/v1/whoami`
492
576
  answers `account`, `workspace` (`id`, `name`, `kind`, `role`, `current`),
@@ -528,13 +612,13 @@ linux, darwin, and windows for amd64 and arm64, packages `tar.gz` archives
528
612
  and a snapshot build on every change, and `make release-check` runs the same
529
613
  locally when GoReleaser is installed. The same tag push then packs
530
614
  `@brokkai/slopcop` from those release archives and publishes it to npm with
531
- [trusted publishing](docs/npm-publishing.md), so the package needs no npm
615
+ [trusted publishing](docs/src/content/docs/contribute/npm-publishing.md), so the package needs no npm
532
616
  token.
533
617
 
534
618
  The same tag also packs a wheel per release target from the binaries GoReleaser
535
619
  just built, installs the wheel for every platform GitHub can run, and
536
620
  publishes `brokk-slopcop` to PyPI with
537
- [trusted publishing](docs/pypi-publishing.md), so that package needs no PyPI
621
+ [trusted publishing](docs/src/content/docs/contribute/pypi-publishing.md), so that package needs no PyPI
538
622
  token either.
539
623
 
540
624
  Layout:
@@ -551,6 +635,5 @@ Layout:
551
635
  | `npm` | launcher, packer, and tests of the `@brokkai/slopcop` package |
552
636
  | `packaging/pypi` | wheel packer and launcher of the `brokk-slopcop` package |
553
637
  | `skills/slopcop` | the agent skill the binary embeds and installs |
554
- | `docs/npm-publishing.md` | npm release flow and trusted publisher setup |
555
- | `docs/pypi-publishing.md` | PyPI release flow and trusted publisher setup |
638
+ | `docs` | the documentation site at <https://docs.slopcop.com> (Astro Starlight), including the npm and PyPI release flows |
556
639
  | `.goreleaser.yaml` | tag release build, archives, and checksums |
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brokkai/slopcop",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Static analysis for coding agents and CI: check a change through the hosted SlopCop API",
5
5
  "keywords": [
6
6
  "agents",