@brokkai/slopcop 0.0.9 → 0.0.10

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
@@ -248,29 +248,43 @@ add`: a first check adds a repository. When the workspace would then pay for
248
248
  it (it already has an active repository and is charged), the service refuses
249
249
  the check with `repository_add_unconfirmed` until a person confirms: at a
250
250
  terminal `check` prints what it costs, asks `Add owner/name to "Workspace"?
251
- [y/N]`, and on a yes sends the check again; with no terminal, as for an agent
252
- or CI, it exits `4` with the service's remedy and, in `json`, a `failed`
253
- report naming the code. A workspace's first repository
254
- is added without asking. Deleting repositories, archiving
255
- workspaces, members, credits and repository settings stay in the web app. The
256
- commands exit `0` on success and `2` with the service's message and remedy
257
- otherwise, as `ignore` does.
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.
258
265
 
259
266
  ## Check
260
267
 
261
268
  ```console
262
269
  slopcop # check the change in the current checkout
263
270
  slopcop check --format json # same, machine-readable
264
- slopcop --root ../repo --base HEAD~1
271
+ slopcop --root ../repo --base origin/main
265
272
  ```
266
273
 
267
274
  The base commit defaults to the merge base with the branch upstream, then the
268
275
  merge base with `origin/HEAD`, then `HEAD` when neither is known. When the
269
276
  upstream merge base yields an empty patch, as on a branch whose commits are all
270
277
  pushed, the CLI uses the merge base with `origin/HEAD` instead, so a check
271
- right after a push still covers the branch. The service must already have the
272
- base commit in its clone; a missing one comes back as the service's
273
- `base_not_found` message and remedy.
278
+ right after a push still covers the branch. `--base REV` names the branch the
279
+ change started from and, like `git diff REV...HEAD`, uses the merge base of
280
+ `REV` and `HEAD`, so commits that landed on `REV` after the branch point are not
281
+ sent as reverse edits. `--base-exact REV` diffs against `REV` itself. The
282
+ service must already have the base commit in its clone; a missing one comes back as the service's
283
+ `base_not_found` message and remedy. The CLI then asks origin for its default
284
+ branch (`git ls-remote`, no prompt, 10 second limit) and adds a line when the
285
+ clone explains the failure: origin's default branch was renamed and
286
+ `origin/HEAD` still names the old one, or the base is not on origin's default
287
+ branch.
274
288
 
275
289
  Every run sends one check request, even when the working tree matches the base
276
290
  and the patch is empty. A clean result or a failure always comes from the
@@ -284,13 +298,15 @@ Flags:
284
298
  | Flag | Meaning |
285
299
  | --- | --- |
286
300
  | `--root PATH` | repository to check (default `.`) |
287
- | `--base REV` | base commit or revision for the change |
301
+ | `--base REV` | branch or revision the change started from; the base is its merge base with `HEAD` |
302
+ | `--base-exact REV` | exact base commit or revision, without a merge base |
288
303
  | `--format human\|json\|sarif` | report format (default `human`) |
289
304
  | `--fail-on never\|finding\|note\|warning\|error` | exit-1 threshold for new findings (default `finding`) |
290
305
  | `--policy PATH` | repository-relative `.rqlp` file to evaluate (repeatable) |
291
306
  | `--no-policy-discovery` | skip `.slopcop/policies` rules |
292
307
  | `--timeout DURATION` | how long to wait for the result (default `10m`) |
293
308
  | `-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 |
294
310
  | `--verbose` | print the resolved request to stderr |
295
311
 
296
312
  ### What is sent
@@ -420,9 +436,11 @@ rewrite them. The remedies name no client, so the CLI adds its own command
420
436
  after some: `slopcop login` when the remedy is to sign in, the listing to
421
437
  choose from after `workspace_not_found` or `workspace_repository_not_found`,
422
438
  and `slopcop whoami` after `repository_disabled`, since the workspace that
423
- disabled it is the one this login is bound to, and `--workspace` after
424
- `owner_required`. A failed check exits `4` when only a person can clear the
425
- refusal (`auth_required`, `auth_expired`, `account_required`,
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`,
426
444
  `repo_not_indexed`, `app_not_installed`, `app_no_repo_access`,
427
445
  `gitlab_not_connected`, `no_access`, `insufficient_credits`,
428
446
  `repository_disabled`, `repository_add_unconfirmed`,
@@ -451,11 +469,11 @@ The CLI calls `POST <service>/v1/check` with a bearer token:
451
469
  }
452
470
  ```
453
471
 
454
- `addRepository` is sent only after a person confirms adding the repository. The
455
- service rejects any other field. With `--workspace`, every request, the
456
- check's, the ignore's and the account routes', carries the workspace's id in
457
- the `SlopCop-Workspace` header; a name is first looked up with
458
- `GET <service>/v1/whoami`. The response carries `status`,
472
+ `addRepository` is sent only after a person confirms adding the repository, at
473
+ the terminal or with `--add-repository`. The service rejects any other field.
474
+ With `--workspace`, every request, the check's, the ignore's and the account
475
+ routes', carries the workspace's id in the `SlopCop-Workspace` header; a name
476
+ is first looked up with `GET <service>/v1/whoami`. The response carries `status`,
459
477
  `baseCommit`, `applied`, `summary`, `findings`, `incomplete`, and `failure`
460
478
  when the analysis did not complete. Against a service from before findings
461
479
  were marked `new`, the CLI treats every finding as new, as that service gated
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.9",
3
+ "version": "0.0.10",
4
4
  "description": "Static analysis for coding agents and CI: check a change through the hosted SlopCop API",
5
5
  "keywords": [
6
6
  "agents",