@brokkai/slopcop 0.0.11 → 0.0.13

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,10 +142,15 @@ 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,
@@ -218,6 +227,34 @@ Use `slopcop init --no-hooks` to install only the skill, or
218
227
  Ordinary checks do not reinstall a removed hook. The skill remains the way to
219
228
  check from other harnesses.
220
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
+
235
+ ### Managed rollout
236
+
237
+ An administrator can deploy the `Stop` hook through managed configuration
238
+ instead of having each user run `slopcop init`. Device management must still
239
+ put `slopcop` on `PATH`, and each user still signs in.
240
+
241
+ - **Claude Code:** add the handler `slopcop init` writes to the `hooks` key of
242
+ the managed settings (`managed-settings.json` or a file in
243
+ `managed-settings.d/`): a `Stop` group with `"type": "command"`,
244
+ `"command": "slopcop hook claude || true"`, `"timeout": 720` and
245
+ `"statusMessage": "Checking the change with SlopCop"`. Under
246
+ `allowManagedHooksOnly` the hook init writes to `~/.claude/settings.json`
247
+ is blocked, so the managed hook is the only one that runs. Claude Code runs
248
+ an identical handler from several settings files once.
249
+ - **Codex:** define the `Stop` hook under `[hooks]` in the managed
250
+ `requirements.toml` (`command = "slopcop hook codex || true"`,
251
+ `command_windows = "slopcop hook codex || exit /b 0"`, `timeout = 720`).
252
+ Managed hooks are trusted by policy, so users skip `/hooks`. Codex installs
253
+ nothing from `managed_dir`.
254
+
255
+ Users then run `slopcop init --no-hooks` to install only the skill. See
256
+ [Managed rollout](https://docs.slopcop.com/agents/managed-rollout/).
257
+
221
258
  ## Sign in
222
259
 
223
260
  ```console
@@ -240,7 +277,7 @@ Precedence:
240
277
  | --- | --- |
241
278
  | Service URL | `--service`, `$SLOPCOP_SERVICE`, stored by `slopcop login`, `https://slopcop.com` |
242
279
  | Token | `$SLOPCOP_TOKEN`, stored value |
243
- | Workspace (`check`, `ignore`, `repo`) | `-w`/`--workspace`, `$SLOPCOP_WORKSPACE`, the one the login is bound to |
280
+ | Workspace (`check`, `enable`, `status`, `ignore`, `unignore`, `ignored`, `repo`) | `-w`/`--workspace`, `$SLOPCOP_WORKSPACE`, the one the login is bound to |
244
281
 
245
282
  ## Workspace and repositories
246
283
 
@@ -249,6 +286,8 @@ active in the browser when the login was approved.
249
286
 
250
287
  ```console
251
288
  slopcop whoami # account, this login's workspace, its plan, the service URL
289
+ slopcop status # this checkout's repository, and whether the workspace checks it
290
+ slopcop enable # add this checkout's repository to the workspace, at a terminal
252
291
  slopcop workspace list # the account's workspaces; * marks this login's
253
292
  slopcop workspace use "Acme team" # move this login (not the browser) to another, by name or id
254
293
  slopcop check -w "Acme team" # check in, and bill, another workspace this once
@@ -257,8 +296,8 @@ slopcop repo disable acme/widgets # stop checking and charging for one (owner o
257
296
  slopcop repo enable acme/widgets # turn it back on, within the workspace's active limit
258
297
  ```
259
298
 
260
- `whoami`, `workspace list` and `repo list` take `--format human|json`, as do
261
- `workspace use` and `repo enable|disable` for their answer. Every active
299
+ `status`, `whoami`, `workspace list` and `repo list` take `--format human|json`,
300
+ as do `workspace use` and `repo enable|disable` for their answer. Every active
262
301
  repository after a workspace's first costs credits every 30 days; a disabled
263
302
  one is not checked or charged and keeps its reports, findings and settings.
264
303
  `repo enable` and `repo disable` ask you to type the repository's `owner/name`
@@ -267,36 +306,42 @@ login, and the service cannot tell it from you, so changing what the workspace
267
306
  pays stays a step you take yourself.
268
307
  `workspace use` moves every agent and script using this login, not only the
269
308
  one that runs it, so it asks `[y/N]` and refuses when stdin is not a terminal.
270
- To check in another workspace without moving anyone, `check`, `ignore` and
271
- `repo` take `-w`/`--workspace <name|id>` (or `$SLOPCOP_WORKSPACE`) for that one
272
- command; the login stays where it was. Give agents that share a login their
309
+ To check in another workspace without moving anyone, `check`, `status`,
310
+ `ignore`, `unignore`, `ignored` and `repo` take `-w`/`--workspace <name|id>`
311
+ (or `$SLOPCOP_WORKSPACE`) for that one command; the login stays where it was. Give agents that share a login their
273
312
  own `--workspace` instead of switching it.
274
313
 
275
314
  Names match without regard to case; when two workspaces share a name, or two
276
- providers a repository name, pass the id the listing prints. There is no `repo
277
- add`: a first check adds a repository. When the workspace would then pay for
278
- it (it already has an active repository and is charged), the service refuses
279
- the check with `repository_add_unconfirmed` until a person confirms: at a
280
- terminal `check` prints what it costs, asks `Add owner/name to "Workspace"?
281
- [y/N]`, and on a yes sends the check again and says `added owner/name to
282
- "Workspace"` on stderr. With no terminal, as for an agent or CI (a pipe or the
283
- null device is not one), nothing is asked: the check exits `4` with the
284
- service's remedy, a line naming the command that confirms it, and, in `json`,
285
- a `failed` report naming the code. A no at the terminal ends the same way.
286
- Once the person has approved it, `check --add-repository --workspace
287
- <name|id>` confirms without a terminal; the flag needs `--workspace` (the
288
- flag itself, not `$SLOPCOP_WORKSPACE`), so an approval given for one
289
- workspace cannot add the repository to the one the login happens to point at.
290
- The flag changes nothing for a repository already in that workspace. A
291
- workspace's first repository is added without asking. Deleting repositories,
292
- archiving workspaces, members, credits and repository settings stay in the web
293
- app. The commands exit `0` on success and `2` with the service's message and
294
- remedy otherwise, as `ignore` does.
315
+ providers a repository name, pass the id the listing prints.
316
+
317
+ `slopcop enable`, run inside a checkout at a terminal, adds the repository the
318
+ `origin` remote names to the workspace that checks and bills it, and runs its
319
+ first check. It names the workspace and what adding the repository costs, asks
320
+ you to type the repository's `owner/name`, and refuses when stdin is not a
321
+ terminal. A repository that is already added but disabled is enabled again;
322
+ one that is already active is left alone. An agent runs with your login and
323
+ the service cannot tell it from you, so adding a repository stays a step you
324
+ take yourself.
325
+
326
+ A check never adds a repository. A check of one the workspace has not added
327
+ exits `4` with `repository_not_enabled` and sends nothing; `status` shows the
328
+ same state, and a check that is not at a terminal asks nothing. Once a person
329
+ has approved adding one, `check --add-repository --workspace <name|id>`
330
+ carries that approval without a terminal; the flag needs `--workspace` (the
331
+ flag itself, not `$SLOPCOP_WORKSPACE`), so an approval given for one workspace
332
+ cannot add the repository to the one the login happens to point at. The flag
333
+ changes nothing for a repository already in that workspace. `slopcop enable`
334
+ says `added owner/name to "Workspace"` on stderr, and `json` reports
335
+ `"repositoryAdded": true`. Deleting repositories, archiving workspaces,
336
+ members, credits and repository settings stay in the web app. `enable` exits
337
+ with its first check's result; the other account commands exit `0` on success
338
+ and `2` with the service's message and remedy otherwise, as `ignore` does.
295
339
 
296
340
  ## Check
297
341
 
298
342
  ```console
299
343
  slopcop # check the change in the current checkout
344
+ slopcop check --if-enabled # automatic check: skip a repository not enabled here
300
345
  slopcop check --format json # same, machine-readable
301
346
  slopcop --root ../repo --base origin/main
302
347
  ```
@@ -308,7 +353,12 @@ pushed, the CLI uses the merge base with `origin/HEAD` instead, so a check
308
353
  right after a push still covers the branch. `--base REV` names the branch the
309
354
  change started from and, like `git diff REV...HEAD`, uses the merge base of
310
355
  `REV` and `HEAD`, so commits that landed on `REV` after the branch point are not
311
- sent as reverse edits. `--base-exact REV` diffs against `REV` itself. The
356
+ sent as reverse edits. A branch stacked on `REV` that has since merged a newer
357
+ `origin/HEAD`, or `REV`'s own upstream, moves the base to that line's merge base
358
+ once it holds `REV`'s, as after `REV` landed, so the merged-in commits are not
359
+ sent either. When the lines have diverged, no fetchable commit holds both, so
360
+ the base stays and the CLI warns that the patch carries the merged-in commits.
361
+ `--base-exact REV` diffs against `REV` itself. The
312
362
  service must already have the base commit in its clone; a missing one comes back as the service's
313
363
  `base_not_found` message and remedy. The CLI then asks origin for its default
314
364
  branch (`git ls-remote`, no prompt, 10 second limit) and adds a line when the
@@ -336,7 +386,8 @@ Flags:
336
386
  | `--no-policy-discovery` | skip `.slopcop/policies` rules |
337
387
  | `--timeout DURATION` | how long to wait for the result (default `10m`) |
338
388
  | `-w`, `--workspace NAME\|ID` | check in, and bill, this workspace of the account instead of the login's |
339
- | `--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 |
389
+ | `--if-enabled` | check only when the repository is active in the workspace; otherwise exit `0` without sending a check |
390
+ | `--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 |
340
391
  | `--verbose` | print the resolved request to stderr, and name each inconclusive check in `human` |
341
392
 
342
393
  ### What is sent
@@ -348,7 +399,7 @@ changes, and binary content. Git-ignored files stay out, except selected
348
399
  `.slopcop/policies` rules, which must travel because the service evaluates them
349
400
  from the patched checkout.
350
401
 
351
- A check run by a Claude Code or Codex agent also sends which models wrote the
402
+ A check run by a Claude Code, Codex or OpenCode agent also sends which models wrote the
352
403
  change, so the service can tie each finding to the model that wrote its file.
353
404
  The CLI finds the agent's session from its environment and reads that
354
405
  session's own record:
@@ -360,6 +411,10 @@ session's own record:
360
411
  - **Codex:** `CODEX_THREAD_ID` names the rollout under `~/.codex/sessions` (or
361
412
  `$CODEX_HOME/sessions`). Each completed file change gives the files, and its
362
413
  turn gives the model and effort. A move counts as writing its destination.
414
+ - **OpenCode:** `OPENCODE_SESSION_ID` names the session in OpenCode's
415
+ database, `~/.local/share/opencode/opencode.db` (or `$OPENCODE_DB`),
416
+ subagents included. Each completed edit, write or patch gives the files,
417
+ and its step gives the model and its variant as the effort.
363
418
 
364
419
  It reads only those fields, never the conversation, tool input or file
365
420
  contents. What it sends is the harness, its version, the session id as an
@@ -406,6 +461,16 @@ with a one-line confirmation, and otherwise exits `2` with the service's
406
461
  message and remedy; `finding_not_found` means the id is unknown or comes from a
407
462
  check outside your workspace.
408
463
 
464
+ To undo a mistaken ignore, run `slopcop unignore <id>` with the id it was
465
+ ignored from, or the same finding's id from any later check of the repository.
466
+ Later checks of the repository report the finding again. Unignoring a finding
467
+ that is not ignored is fine; it exits and fails like `ignore`.
468
+
469
+ `slopcop ignored` lists the findings your workspace ignored in this repository,
470
+ newest first, 25 per page (`--page <n>`), with each one's id for `unignore`,
471
+ location, rule, and when and by whom it was ignored. `--format json` prints the
472
+ service's answer.
473
+
409
474
  ### Output and exit codes
410
475
 
411
476
  The service answers structured data; the CLI renders it. `human` prints one
@@ -465,8 +530,10 @@ New findings that cross `--fail-on` exit `1` even when some check did not
465
530
  complete.
466
531
 
467
532
  While the service answers `check_running`, the CLI waits the `Retry-After` it
468
- names and asks again until `--timeout` runs out; every ask attaches to the same
469
- running check. If it is still running then, the CLI exits `3`, prints the
533
+ names and asks again until `--timeout` runs out. It asks by the `checkId` the
534
+ answer carries (`GET /v1/check/{checkId}`), so the change is uploaded once; a
535
+ service that sends no `checkId`, or no longer knows it, gets the same request
536
+ again, which attaches to the same running check. If it is still running then, the CLI exits `3`, prints the
470
537
  service's message and remedy on stderr, and in `json` prints
471
538
  `{"status": "pending", "retryAfter": 5, "message": …, "remedy": …}` on stdout
472
539
  (`sarif` prints a run with `slopcop.status` `pending`). Running the same check
@@ -479,23 +546,23 @@ rewrite them. The remedies name no client, so the CLI adds its own command
479
546
  after some: `slopcop login` when the remedy is to sign in, the listing to
480
547
  choose from after `workspace_not_found` or `workspace_repository_not_found`,
481
548
  and `slopcop whoami` after `repository_disabled`, since the workspace that
482
- disabled it is the one this login is bound to, `--workspace` after
483
- `owner_required`, and `--add-repository --workspace "Name"`, with the
484
- workspace the check would have added the repository to, after
485
- `repository_add_unconfirmed`. A failed check exits `4` when only a person can
486
- clear the refusal (`auth_required`, `auth_expired`, `account_required`,
549
+ disabled it is the one this login is bound to, and `--workspace` after
550
+ `owner_required`. A failed check exits `4` when only a person can clear the
551
+ refusal (`auth_required`, `auth_expired`, `account_required`,
487
552
  `repo_not_indexed`, `app_not_installed`, `app_no_repo_access`,
488
553
  `gitlab_not_connected`, `no_access`, `insufficient_credits`,
489
- `repository_disabled`, `repository_add_unconfirmed`,
490
- `workspace_repository_limit_reached`, `active_repository_limit_reached`,
491
- `owner_required`, and `browser_required`), so a script can stop instead of
492
- retrying, and `2` otherwise. Stderr starts with the code, as in `slopcop:
493
- repository_add_unconfirmed: …`. `human` prints nothing on stdout; `json`
494
- prints `{"status": "failed", "code": …, "message": …, "remedy": …,
495
- "retryable": …}`, plus `installUrl` or `topUpUrl` when the service sent one;
496
- `sarif` prints a run with `slopcop.status` `failed`, whose invocation is
497
- unsuccessful and carries an `error` notification whose descriptor id is the
498
- code.
554
+ `repository_disabled`, `repository_not_enabled`,
555
+ `repository_add_unconfirmed`, `workspace_repository_limit_reached`,
556
+ `active_repository_limit_reached`, `owner_required`, and `browser_required`),
557
+ so a script can stop instead of retrying, and `2` otherwise. The CLI refuses a
558
+ check of a repository the workspace has not added locally, as
559
+ `repository_not_enabled`, before sending anything. Stderr starts with the
560
+ code, as in `slopcop: repository_not_enabled: …`. `human` prints nothing on
561
+ stdout; `json` prints `{"status": "failed", "code": …, "message": …,
562
+ "remedy": …, "retryable": …}`, plus `installUrl` or `topUpUrl` when the
563
+ service sent one; `sarif` prints a run with `slopcop.status` `failed`, whose
564
+ invocation is unsuccessful and carries an `error` notification whose
565
+ descriptor id is the code.
499
566
 
500
567
  ## API
501
568
 
@@ -529,7 +596,13 @@ could be ignored omits it.
529
596
  `slopcop ignore <id>` calls `POST <service>/v1/ignore` with the same bearer
530
597
  token and `{"findingId": "<id>"}`, and gets back
531
598
  `{"findingId": "<id>", "status": "ignored"}`. Failures use the same closed
532
- contract, including `finding_not_found`.
599
+ contract, including `finding_not_found`. `slopcop unignore <id>` calls
600
+ `POST <service>/v1/unignore` the same way and gets back
601
+ `{"findingId": "<id>", "status": "unignored"}`, also when the finding was not
602
+ ignored.
603
+ `slopcop ignored` calls `GET <service>/v1/ignores?repoUrl=<url>&page=<n>`
604
+ (`page` zero-based) and gets back `repository`, `total`, `page`, `pageSize` and
605
+ `ignores`, newest first; see the [API reference](docs/src/content/docs/reference/api.md).
533
606
 
534
607
  The account commands use the same bearer token. `GET <service>/v1/whoami`
535
608
  answers `account`, `workspace` (`id`, `name`, `kind`, `role`, `current`),
@@ -571,13 +644,13 @@ linux, darwin, and windows for amd64 and arm64, packages `tar.gz` archives
571
644
  and a snapshot build on every change, and `make release-check` runs the same
572
645
  locally when GoReleaser is installed. The same tag push then packs
573
646
  `@brokkai/slopcop` from those release archives and publishes it to npm with
574
- [trusted publishing](docs/npm-publishing.md), so the package needs no npm
647
+ [trusted publishing](docs/src/content/docs/contribute/npm-publishing.md), so the package needs no npm
575
648
  token.
576
649
 
577
650
  The same tag also packs a wheel per release target from the binaries GoReleaser
578
651
  just built, installs the wheel for every platform GitHub can run, and
579
652
  publishes `brokk-slopcop` to PyPI with
580
- [trusted publishing](docs/pypi-publishing.md), so that package needs no PyPI
653
+ [trusted publishing](docs/src/content/docs/contribute/pypi-publishing.md), so that package needs no PyPI
581
654
  token either.
582
655
 
583
656
  Layout:
@@ -594,6 +667,5 @@ Layout:
594
667
  | `npm` | launcher, packer, and tests of the `@brokkai/slopcop` package |
595
668
  | `packaging/pypi` | wheel packer and launcher of the `brokk-slopcop` package |
596
669
  | `skills/slopcop` | the agent skill the binary embeds and installs |
597
- | `docs/npm-publishing.md` | npm release flow and trusted publisher setup |
598
- | `docs/pypi-publishing.md` | PyPI release flow and trusted publisher setup |
670
+ | `docs` | the documentation site at <https://docs.slopcop.com> (Astro Starlight), including the npm and PyPI release flows |
599
671
  | `.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.11",
3
+ "version": "0.0.13",
4
4
  "description": "Static analysis for coding agents and CI: check a change through the hosted SlopCop API",
5
5
  "keywords": [
6
6
  "agents",