@cleanslop/cli 0.1.0-beta.2 → 0.1.0-beta.20
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 +5 -4
- package/assets/skill-core.md +25 -7
- package/dist/action.d.ts +4 -1
- package/dist/action.js +24 -0
- package/dist/action.js.map +1 -1
- package/dist/args.d.ts +1 -1
- package/dist/args.js +31 -9
- package/dist/args.js.map +1 -1
- package/dist/commands/credits.d.ts +30 -1
- package/dist/commands/credits.js +302 -43
- package/dist/commands/credits.js.map +1 -1
- package/dist/commands/email.js +22 -0
- package/dist/commands/email.js.map +1 -1
- package/dist/commands/link-login.js +4 -4
- package/dist/commands/link-login.js.map +1 -1
- package/dist/commands/login.d.ts +1 -0
- package/dist/commands/login.js +22 -8
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts +2 -1
- package/dist/commands/logout.js +48 -23
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/redeem.d.ts +7 -0
- package/dist/commands/redeem.js +33 -0
- package/dist/commands/redeem.js.map +1 -0
- package/dist/commands/scan-upload.js +48 -27
- package/dist/commands/scan-upload.js.map +1 -1
- package/dist/commands/scan.js +45 -4
- package/dist/commands/scan.js.map +1 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/connect.d.ts +15 -0
- package/dist/connect.js +100 -0
- package/dist/connect.js.map +1 -0
- package/dist/credentials.d.ts +14 -0
- package/dist/credentials.js +25 -7
- package/dist/credentials.js.map +1 -1
- package/dist/done-question.d.ts +20 -0
- package/dist/done-question.js +25 -0
- package/dist/done-question.js.map +1 -0
- package/dist/exit.d.ts +29 -0
- package/dist/exit.js +12 -0
- package/dist/exit.js.map +1 -1
- package/dist/git.d.ts +8 -1
- package/dist/git.js +35 -1
- package/dist/git.js.map +1 -1
- package/dist/http.js +74 -4
- package/dist/http.js.map +1 -1
- package/dist/link.d.ts +45 -11
- package/dist/link.js +154 -43
- package/dist/link.js.map +1 -1
- package/dist/main.js +8 -3
- package/dist/main.js.map +1 -1
- package/dist/output.js +6 -1
- package/dist/output.js.map +1 -1
- package/dist/pack.d.ts +19 -3
- package/dist/pack.js +30 -2
- package/dist/pack.js.map +1 -1
- package/dist/skill.d.ts +1 -1
- package/dist/skill.js +2 -1
- package/dist/skill.js.map +1 -1
- package/dist/top-up.d.ts +8 -0
- package/dist/top-up.js +35 -0
- package/dist/top-up.js.map +1 -0
- package/dist/types.d.ts +18 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# cleanslop CLI (M4)
|
|
2
2
|
|
|
3
|
-
Private-beta CLI for agentic CleanSlop, published as `@cleanslop/cli` (bin `cleanslop`). Beta builds go out under the `beta` dist-tag from `.github/workflows/cli-beta.yml
|
|
3
|
+
Private-beta CLI for agentic CleanSlop, published as `@cleanslop/cli` (bin `cleanslop`). Beta builds go out under the `beta` dist-tag from `.github/workflows/cli-beta.yml`, and releases under `latest` from `.github/workflows/cli-release.yml` on every `master` change to `cli/` (versions from `scripts/release-version.mjs`); do not `npm publish` by hand except the one-time first publish in `docs/ops/agent-beta.md` (CLI beta).
|
|
4
4
|
|
|
5
5
|
## Install / run
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ CLEANSLOP_ORIGIN=<origin> npx @cleanslop/cli@beta scan
|
|
|
12
12
|
node cli/dist/index.js scan
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Requires Node 20 or later. **Zero runtime dependencies.** Link commands shell out to `link-cli` (`CLEANSLOP_LINK_CLI`, else `PATH`, else a pinned `npx @stripe/link-cli`); uploads pack with
|
|
15
|
+
Requires Node 20 or later. **Zero runtime dependencies.** Link commands shell out to `link-cli` (`CLEANSLOP_LINK_CLI`, else `PATH`, else a pinned `npx @stripe/link-cli`); uploads pack with a built-in tar writer.
|
|
16
16
|
|
|
17
17
|
## Gate (run locally and in CI)
|
|
18
18
|
|
|
@@ -30,11 +30,12 @@ The app TypeScript / ESLint / coverage gates exclude `cli/` (`tsconfig.json`, `t
|
|
|
30
30
|
|---|---|
|
|
31
31
|
| `scan` (default) | Resolve the github.com origin + HEAD, start a scan, optionally `--wait` |
|
|
32
32
|
| `login [--no-wait \| --resume]` | RFC 8628 device flow. Prints `verification_uri_complete` and `user_code`. `--no-wait` stores the device code; `--resume` finishes it. Never prints the token. |
|
|
33
|
-
| `logout` | Revoke server-side and
|
|
33
|
+
| `logout [--all]` | Revoke server-side, delete this origin's credentials, and drop its pending GitHub login and Link payment. `--all` revokes every saved origin's token and deletes all local CleanSlop data (Link's own session and `~/.link-cli` files stay; `link-cli auth logout` clears the session) |
|
|
34
34
|
| `whoami` | Connected `@login` and token last4 |
|
|
35
35
|
| `status [id] [--wait]` | Poll scan status |
|
|
36
36
|
| `report [id] [--format md\|json] [--preview]` | Fetch `cleanslop.report.v1` |
|
|
37
37
|
| `setup` | Idempotent skill/rules. Never logs in, never writes a token |
|
|
38
|
+
| `redeem <code>` | Redeem a promo (invite) code the human gave you for free scans (`POST /api/agent/v1/credits/redeem`). One code per account; `promo_invalid` / `promo_already_redeemed` exit 12 with an `ask_human` block. |
|
|
38
39
|
|
|
39
40
|
### Wait
|
|
40
41
|
|
|
@@ -80,7 +81,7 @@ Skill / Cursor rules / AGENTS snippet are generated from [`assets/skill-core.md`
|
|
|
80
81
|
| 20 | Scan failed server-side |
|
|
81
82
|
| 75 | Still running; resume command printed |
|
|
82
83
|
|
|
83
|
-
`CLEANSLOP_ACTION_REQUIRED` blocks go to stderr. Never open, approve, or pay.
|
|
84
|
+
`CLEANSLOP_ACTION_REQUIRED` blocks go to stderr. Never open, approve, or pay. A block may end with a `CLEANSLOP_QUESTION:` JSON line (`id`, `header`, `question`, `options[]` with `value`, `label`, optional `description`, and `run` for the exact next command or `next` for a plain next step; neither means stop). Agents with a multiple-choice question tool (for example Claude Code's AskUserQuestion) should ask with it, using exactly those options, and never answer for the human. Consent questions never carry `--agree`.
|
|
84
85
|
|
|
85
86
|
## Tests
|
|
86
87
|
|
package/assets/skill-core.md
CHANGED
|
@@ -4,26 +4,44 @@ Run a CleanSlop readiness scan at milestones (before claiming work is done, befo
|
|
|
4
4
|
|
|
5
5
|
## Git preconditions
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Just run `cleanslop scan`. Do not check git state first or tell the human a commit or push may be needed: the CLI picks the source and asks when the human must choose. A clean pushed github.com commit is scanned from GitHub. Otherwise, when `/me` reports `uploads: true` (Link) or `uploadFallback: true` (GitHub), it uploads the local files: a folder with no commits or no GitHub origin uploads at once, and uncommitted or unpushed changes ask `push_or_upload` ("Scan local files" reruns with `--upload`; "I pushed" reruns as is). A `github_install` question also offers "Scan local files". Do not commit, push, stash, or rewrite history yourself.
|
|
8
8
|
|
|
9
9
|
## Transport
|
|
10
10
|
|
|
11
11
|
Use MCP if it is registered (`<origin>/mcp`); otherwise the CLI. Run it as `npx @cleanslop/cli <command>` unless `cleanslop` is already installed (commands below are written as `cleanslop …`). If your harness blocks npx, **ask the human** to allow it or run the command themselves; do not work around the block. In Claude Code, run long waits as a **background** command (`cleanslop scan --wait 75m`) so waiting costs zero tokens. `cleanslop setup` registers MCP for Claude Code, Cursor, and Codex and never writes a token. MCP stays on GitHub; connect with Link through the CLI.
|
|
12
12
|
|
|
13
|
-
## Connect
|
|
13
|
+
## Connect
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
If the human already said how to connect (Link or GitHub), use that. Otherwise, when a command says this machine is not connected and asks how to connect (`connect_method`), ask the human with exactly its options (Stripe Link, recommended, or GitHub).
|
|
16
|
+
|
|
17
|
+
Run Link and login commands in the foreground with `--no-wait`. When one prints an `approve` block, ask its Done / Not now question (it repeats the link and code). On Done, rerun the same command with `--resume` instead of `--no-wait`; on Not now, stop. Never ask the human to type “done”.
|
|
18
|
+
|
|
19
|
+
**GitHub:** run `cleanslop login --no-wait`, then the approve-then-`--resume` step.
|
|
20
|
+
|
|
21
|
+
**Link:**
|
|
16
22
|
|
|
17
23
|
1. Run `cleanslop login --link --no-wait`. The first run stops with an `ask_human` block quoting one question (an account from the Link-verified email, plus the terms). Relay it **exactly as printed**.
|
|
18
24
|
2. If the human says yes, rerun with `--agree --no-wait`. If not, stop.
|
|
19
|
-
3. If Link is not signed in on this machine, the CLI prints an `approve` block with a Link link and a phrase and exits 10.
|
|
25
|
+
3. If Link is not signed in on this machine, the CLI prints an `approve` block with a Link link and a phrase and exits 10. Ask its Done question; on Done, rerun with `--resume` instead of `--no-wait`.
|
|
20
26
|
4. On success it prints “Connected as <masked email> (Link)”. Repeat that to the human.
|
|
21
27
|
5. `link_existing` means the Link email already belongs to a CleanSlop account. Run `cleanslop login --no-wait` (GitHub device login), then `cleanslop link-identity --no-wait`, each with the approve-then-`--resume` step above. `link-identity` asks its own email question (`--agree` after a yes).
|
|
22
28
|
6. `beta` means this Link email is not in the pilot yet. Tell the human and stop.
|
|
29
|
+
7. If Link sign-in fails and the CLI offers GitHub instead (`link_failed`), ask the human; Link may not be available to them.
|
|
30
|
+
|
|
31
|
+
## Buy credits with Link
|
|
32
|
+
|
|
33
|
+
Run purchase commands in the foreground with `--no-wait`, the same way as Link sign-in. The human approves every payment in their Link app; never approve or pay yourself.
|
|
34
|
+
|
|
35
|
+
1. When a scan exits 11 with a `top-up` block, or `credits buy` without `--pack` asks which pack, ask the human to choose (the block lists each pack's scans, price, and price per scan). If they choose not to buy, stop. Never pick a pack for them.
|
|
36
|
+
2. Run `cleanslop credits buy --link --pack <pack> --no-wait` with their pack. It prints an `approve` block and exits 10. Ask its Done question: Link sends the approval to the human's Link app, and there is usually no link to open. If Link first needs payment permission, the block says so (header Permission): relay it as a one-time permission, not the purchase; nothing is charged, and the purchase approval comes next.
|
|
37
|
+
3. When the human answers Done, run `cleanslop credits buy --link --resume`. If it prints `approve` again, they have not approved yet: relay the prompt again and wait. If it prints `ask_human`, relay it and follow it. Never start a second purchase while one is pending.
|
|
38
|
+
4. On success it prints “Added … scan credits. Balance: N”. Rerun the scan.
|
|
39
|
+
5. If the CLI says Link packs are not available or to contact us for credits, tell the human and stop. For a GitHub account, the `top-up` block is a checkout link instead: relay it and wait.
|
|
40
|
+
6. Promo codes: if the human gives you a CleanSlop promo code, run `cleanslop redeem <code>` (MCP: `promo_redeem`). Use only a code the human typed in this session; never guess, search for, or reuse one. Each account can use one code; if the CLI says the code is not valid or already used, tell the human and stop. While the account has not used a code, the out-of-scans and `credits buy` questions also offer "Use a promo code"; if the human picks buying instead, run the command that answer gives.
|
|
23
41
|
|
|
24
42
|
## Relay human actions
|
|
25
43
|
|
|
26
|
-
When the CLI prints a `CLEANSLOP_ACTION_REQUIRED` block, show the human the link and code **exactly as printed** and wait. Kinds: approve (device login
|
|
44
|
+
When the CLI prints a `CLEANSLOP_ACTION_REQUIRED` block, show the human the link and code **exactly as printed** and wait. Blocks that wait on the human (approvals, GitHub App install, push, checkout) carry a Done / Not now question; ask it rather than asking them to reply. Kinds: approve (device login, Link sign-in, or a Link payment), install (GitHub App), top-up (credits), beta (request access), reauth (reconnect GitHub), present_identity (Link), link_existing (connect Link to an existing account), ask_human (quoted terms or email-sharing question). Never open the link, never approve, never pay, never enter credentials. `cleanslop login --link` drives `link-cli` itself (Link sign-in, attestations, identity credential). Never run `link-cli … present`, `attestations pop`, or `spend-request` yourself, and never paste their output. When CleanSlop says the person must approve a payment in Link, tell them and wait. Pass `--agree` only after the human answers yes to the quoted question in this session. When a block includes a `CLEANSLOP_QUESTION:` line (a JSON question with options), you must ask it with your multiple-choice question tool if you have one (for example AskUserQuestion), offering exactly those options; never ask the human to type a reply such as “Done” instead. Only without such a tool, ask in plain text. Never answer for the human. Then do what the chosen option says: run its `run` command, follow its `next` step, or stop if it has neither. MCP tool results carry the same JSON as `action.question` on an error, or `question` on a preview; their options use `next` only. After login, repeat “Connected as @login” or the masked Link email to the human.
|
|
27
45
|
|
|
28
46
|
## Waiting
|
|
29
47
|
|
|
@@ -43,11 +61,11 @@ When `review` is `unavailable`, the findings are unreviewed first-pass results (
|
|
|
43
61
|
|
|
44
62
|
## Fix loop
|
|
45
63
|
|
|
46
|
-
Fix by priority, run the repo’s tests, ask the human about `needs_input`,
|
|
64
|
+
Fix by priority, run the repo’s tests, ask the human about `needs_input`, rescan **once** (the CLI asks whether to upload the local files or have the human push first), and compare the delta (`new` / `still_open` / `resolved` / `no_longer_listed`). `no_longer_listed` means the review stopped listing the finding — it is not a confirmed fix.
|
|
47
65
|
|
|
48
66
|
## Stop conditions
|
|
49
67
|
|
|
50
|
-
Stop when all listed issues are resolved; the same fingerprints are still open after one rescan; the
|
|
68
|
+
Stop when all listed issues are resolved; the same fingerprints are still open after one rescan; the account is out of scans and the human does not buy more (or none can be bought); the human declines; or the code has not changed.
|
|
51
69
|
|
|
52
70
|
## Report back
|
|
53
71
|
|
package/dist/action.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { CliDeps } from "./deps.js";
|
|
2
|
-
import type { ActionRequired } from "./exit.js";
|
|
2
|
+
import type { ActionQuestion, ActionRequired } from "./exit.js";
|
|
3
3
|
import type { AgentScan } from "./types.js";
|
|
4
4
|
export declare function writeAction(deps: CliDeps, action: ActionRequired): void;
|
|
5
|
+
export declare const QUESTION_TOOL_HINT = "If you have a multiple-choice question tool (for example AskUserQuestion), you must ask this with it, offering exactly these options; do not ask the human to type a reply such as \"Done\". Only without such a tool, ask in plain text. Never answer for the human. Then do what the chosen option says: run its command, follow its next step, or stop.";
|
|
6
|
+
/** Numbered options, the machine-readable line, and how to ask. */
|
|
7
|
+
export declare function questionLines(question: ActionQuestion): string[];
|
|
5
8
|
export declare function writeResume(deps: CliDeps, scanId: string, scan?: Pick<AgentScan, "eta" | "elapsedSec">): void;
|
package/dist/action.js
CHANGED
|
@@ -11,9 +11,33 @@ export function writeAction(deps, action) {
|
|
|
11
11
|
if (action.code) {
|
|
12
12
|
lines.push("", `Code: ${action.code}`);
|
|
13
13
|
}
|
|
14
|
+
if (action.question) {
|
|
15
|
+
lines.push("", ...questionLines(action.question));
|
|
16
|
+
}
|
|
14
17
|
lines.push("", "Never open, approve, or pay yourself. Never enter credentials or payment details.");
|
|
15
18
|
deps.io.stderr(`${lines.join("\n")}\n`);
|
|
16
19
|
}
|
|
20
|
+
export const QUESTION_TOOL_HINT = "If you have a multiple-choice question tool (for example AskUserQuestion), you must ask this with it, offering exactly these options; do not ask the human to type a reply such as \"Done\". Only without such a tool, ask in plain text. Never answer for the human. Then do what the chosen option says: run its command, follow its next step, or stop.";
|
|
21
|
+
/** Numbered options, the machine-readable line, and how to ask. */
|
|
22
|
+
export function questionLines(question) {
|
|
23
|
+
const options = question.options.map((option, i) => {
|
|
24
|
+
const detail = option.description ? ` (${option.description})` : "";
|
|
25
|
+
const next = option.run
|
|
26
|
+
? ` → run: ${option.run}`
|
|
27
|
+
: option.next
|
|
28
|
+
? ` → next: ${option.next}`
|
|
29
|
+
: " → stop";
|
|
30
|
+
return ` ${i + 1}. ${option.label}${detail}${next}`;
|
|
31
|
+
});
|
|
32
|
+
return [
|
|
33
|
+
`Options:`,
|
|
34
|
+
...options,
|
|
35
|
+
"",
|
|
36
|
+
`CLEANSLOP_QUESTION: ${JSON.stringify(question)}`,
|
|
37
|
+
"",
|
|
38
|
+
QUESTION_TOOL_HINT,
|
|
39
|
+
];
|
|
40
|
+
}
|
|
17
41
|
export function writeResume(deps, scanId, scan) {
|
|
18
42
|
const eta = scan ? formatEtaLine(scan) : null;
|
|
19
43
|
const head = eta ? `Still running (${eta}).` : "Still running.";
|
package/dist/action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,MAAM,UAAU,WAAW,CAAC,IAAa,EAAE,MAAsB;IAC/D,MAAM,KAAK,GAAG;QACZ,8BAA8B,MAAM,CAAC,IAAI,EAAE;QAC3C,EAAE;QACF,MAA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ACF,kBAAkB;KACnB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,IAAa,EACb,MAAc,EACd,IAA4C;IAE5C,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9C,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAChE,IAAI,CAAC,EAAE,CAAC,MAAM,CACZ,GAAG,IAAI,qCAAqC,MAAM,WAAW,CAC9D,CAAC;AACJ,CAAC"}
|
package/dist/args.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ParsedArgs } from "./types.js";
|
|
2
2
|
export declare function parseWaitMs(raw: string, fallback?: number): number;
|
|
3
3
|
export declare function parseArgs(argv: string[], defaultWaitMs?: number): ParsedArgs;
|
|
4
|
-
export declare const HELP_TEXT = "cleanslop \u2014 CleanSlop agent CLI\n\nUsage:\n cleanslop [scan] [--wait [duration]] [--json] [--force] [--preview]\n cleanslop login [--link] [--agree] [--no-wait | --resume]\n cleanslop link-identity [--agree] [--no-wait | --resume]\n cleanslop credits buy --link [--pack p5]
|
|
4
|
+
export declare const HELP_TEXT = "cleanslop \u2014 CleanSlop agent CLI\n\nUsage:\n cleanslop [scan] [--wait [duration]] [--json] [--force] [--preview] [--upload]\n cleanslop login [--link] [--agree] [--no-wait | --resume]\n cleanslop link-identity [--agree] [--no-wait | --resume]\n cleanslop credits buy --link [--pack p5] [--no-promo] [--no-wait | --resume]\n cleanslop redeem <code>\n cleanslop logout [--all]\n cleanslop whoami\n cleanslop status [id] [--wait [duration]]\n cleanslop report [id] [--format md|json] [--preview]\n cleanslop email <id> --consent \"<exact question>\" [--reply \"<human reply>\"]\n cleanslop setup [--dry-run] [--uninstall] [--project] [--yes]\n\nscan is the default command. GitHub App repos, or a packed upload when /me\nreports uploads:true (Link). With uploadFallback:true (GitHub), a checkout\nwith no GitHub origin uploads its files, and a dirty or unpushed one asks\nwhether to upload them or push first. --dry-run on scan lists the upload pack.\n\nWait:\n --wait poll until final or the budget (default 8 minutes)\n --wait 75m Claude Code background budget (hours/minutes/seconds: 1h, 75m, 30s)\n At the deadline: exit 75 and print a resume command. The scan keeps running.\n\nFlags:\n --json one JSON document on stdout\n --force skip same-commit dedupe (sends Idempotency-Key)\n --preview first-pass report before judgment is final\n --upload scan: upload the local files instead of the pushed commit (after the human picks it)\n --no-wait login / link-identity / credits buy: print what to approve and exit 10\n --resume login / link-identity / credits buy: continue a pending --no-wait approval\n --link login: Stripe Link sign-up / sign-in (requires link-cli)\n --agree login --link / link-identity: pass only after the human answers yes to the quoted question\n (--accept-terms --yes-share-email together still work for login --link; --yes-share-email for link-identity)\n --pack credits buy: p5, p15, or p40. Required without a terminal (the human picks); a terminal defaults to p5. Price and network id come from CleanSlop.\n --no-promo credits buy: skip the promo-code choice (the human already chose to buy)\n --all logout: revoke every saved token and delete all local CleanSlop data\n (without it, logout signs out of this origin and drops its pending login and Link payment)\n --dry-run setup: print the plan. scan (upload): list the pack, upload nothing\n --uninstall setup: remove marker blocks / skill files\n --project setup: project files instead of user scope\n --yes setup: write in a non-TTY (otherwise non-TTY is a plan only)\n --consent email: the exact masked-recipient question you asked\n --reply email: optional verbatim human reply\n\nEnv:\n CLEANSLOP_ORIGIN API origin (default https://cleanslop.com)\n CLEANSLOP_TOKEN bearer token override (never printed)\n CLEANSLOP_LINK_CLI path to link-cli (default: link-cli on PATH)\n\nCredentials: $XDG_CONFIG_HOME/cleanslop/credentials.json or ~/.config/cleanslop/\nDirectory 0700, file 0600. Never stored inside the git worktree.\n\nExit codes: 0 ok \u00B7 1 unexpected \u00B7 2 usage \u00B7 10 human action \u00B7 11 payment\n 12 policy \u00B7 13 source \u00B7 20 scan failed \u00B7 75 still running\n\nNever open, approve, or pay yourself. Relay CLEANSLOP_ACTION_REQUIRED blocks.\nAsk a CLEANSLOP_QUESTION with your multiple-choice question tool when you have\none (never ask the human to type \"Done\"), using exactly its options. Never\nanswer for the human.\n";
|
package/dist/args.js
CHANGED
|
@@ -11,6 +11,7 @@ const COMMANDS = [
|
|
|
11
11
|
"email",
|
|
12
12
|
"link-identity",
|
|
13
13
|
"credits",
|
|
14
|
+
"redeem",
|
|
14
15
|
];
|
|
15
16
|
function isCommand(value) {
|
|
16
17
|
return COMMANDS.includes(value);
|
|
@@ -38,12 +39,15 @@ function emptyArgs(defaultWaitMs) {
|
|
|
38
39
|
wait: false,
|
|
39
40
|
waitMs: defaultWaitMs,
|
|
40
41
|
noWait: false,
|
|
42
|
+
noPromo: false,
|
|
41
43
|
resume: false,
|
|
42
44
|
force: false,
|
|
45
|
+
upload: false,
|
|
43
46
|
preview: false,
|
|
44
47
|
format: "md",
|
|
45
48
|
dryRun: false,
|
|
46
49
|
uninstall: false,
|
|
50
|
+
all: false,
|
|
47
51
|
project: false,
|
|
48
52
|
yes: false,
|
|
49
53
|
consent: null,
|
|
@@ -85,9 +89,15 @@ export function parseArgs(argv, defaultWaitMs = DEFAULT_WAIT_MS) {
|
|
|
85
89
|
case "--resume":
|
|
86
90
|
out.resume = true;
|
|
87
91
|
break;
|
|
92
|
+
case "--no-promo":
|
|
93
|
+
out.noPromo = true;
|
|
94
|
+
break;
|
|
88
95
|
case "--force":
|
|
89
96
|
out.force = true;
|
|
90
97
|
break;
|
|
98
|
+
case "--upload":
|
|
99
|
+
out.upload = true;
|
|
100
|
+
break;
|
|
91
101
|
case "--preview":
|
|
92
102
|
out.preview = true;
|
|
93
103
|
break;
|
|
@@ -97,6 +107,9 @@ export function parseArgs(argv, defaultWaitMs = DEFAULT_WAIT_MS) {
|
|
|
97
107
|
case "--uninstall":
|
|
98
108
|
out.uninstall = true;
|
|
99
109
|
break;
|
|
110
|
+
case "--all":
|
|
111
|
+
out.all = true;
|
|
112
|
+
break;
|
|
100
113
|
case "--project":
|
|
101
114
|
out.project = true;
|
|
102
115
|
break;
|
|
@@ -194,12 +207,12 @@ export function parseArgs(argv, defaultWaitMs = DEFAULT_WAIT_MS) {
|
|
|
194
207
|
export const HELP_TEXT = `cleanslop — CleanSlop agent CLI
|
|
195
208
|
|
|
196
209
|
Usage:
|
|
197
|
-
cleanslop [scan] [--wait [duration]] [--json] [--force] [--preview]
|
|
210
|
+
cleanslop [scan] [--wait [duration]] [--json] [--force] [--preview] [--upload]
|
|
198
211
|
cleanslop login [--link] [--agree] [--no-wait | --resume]
|
|
199
212
|
cleanslop link-identity [--agree] [--no-wait | --resume]
|
|
200
|
-
cleanslop credits buy --link [--pack p5]
|
|
201
|
-
cleanslop
|
|
202
|
-
cleanslop logout
|
|
213
|
+
cleanslop credits buy --link [--pack p5] [--no-promo] [--no-wait | --resume]
|
|
214
|
+
cleanslop redeem <code>
|
|
215
|
+
cleanslop logout [--all]
|
|
203
216
|
cleanslop whoami
|
|
204
217
|
cleanslop status [id] [--wait [duration]]
|
|
205
218
|
cleanslop report [id] [--format md|json] [--preview]
|
|
@@ -207,7 +220,9 @@ Usage:
|
|
|
207
220
|
cleanslop setup [--dry-run] [--uninstall] [--project] [--yes]
|
|
208
221
|
|
|
209
222
|
scan is the default command. GitHub App repos, or a packed upload when /me
|
|
210
|
-
reports uploads:true (Link).
|
|
223
|
+
reports uploads:true (Link). With uploadFallback:true (GitHub), a checkout
|
|
224
|
+
with no GitHub origin uploads its files, and a dirty or unpushed one asks
|
|
225
|
+
whether to upload them or push first. --dry-run on scan lists the upload pack.
|
|
211
226
|
|
|
212
227
|
Wait:
|
|
213
228
|
--wait poll until final or the budget (default 8 minutes)
|
|
@@ -218,13 +233,17 @@ Flags:
|
|
|
218
233
|
--json one JSON document on stdout
|
|
219
234
|
--force skip same-commit dedupe (sends Idempotency-Key)
|
|
220
235
|
--preview first-pass report before judgment is final
|
|
221
|
-
--
|
|
222
|
-
--
|
|
236
|
+
--upload scan: upload the local files instead of the pushed commit (after the human picks it)
|
|
237
|
+
--no-wait login / link-identity / credits buy: print what to approve and exit 10
|
|
238
|
+
--resume login / link-identity / credits buy: continue a pending --no-wait approval
|
|
223
239
|
--link login: Stripe Link sign-up / sign-in (requires link-cli)
|
|
224
240
|
--agree login --link / link-identity: pass only after the human answers yes to the quoted question
|
|
225
241
|
(--accept-terms --yes-share-email together still work for login --link; --yes-share-email for link-identity)
|
|
226
|
-
--pack credits buy: p5, p15, or p40 (
|
|
227
|
-
--
|
|
242
|
+
--pack credits buy: p5, p15, or p40. Required without a terminal (the human picks); a terminal defaults to p5. Price and network id come from CleanSlop.
|
|
243
|
+
--no-promo credits buy: skip the promo-code choice (the human already chose to buy)
|
|
244
|
+
--all logout: revoke every saved token and delete all local CleanSlop data
|
|
245
|
+
(without it, logout signs out of this origin and drops its pending login and Link payment)
|
|
246
|
+
--dry-run setup: print the plan. scan (upload): list the pack, upload nothing
|
|
228
247
|
--uninstall setup: remove marker blocks / skill files
|
|
229
248
|
--project setup: project files instead of user scope
|
|
230
249
|
--yes setup: write in a non-TTY (otherwise non-TTY is a plan only)
|
|
@@ -243,5 +262,8 @@ Exit codes: 0 ok · 1 unexpected · 2 usage · 10 human action · 11 payment
|
|
|
243
262
|
12 policy · 13 source · 20 scan failed · 75 still running
|
|
244
263
|
|
|
245
264
|
Never open, approve, or pay yourself. Relay CLEANSLOP_ACTION_REQUIRED blocks.
|
|
265
|
+
Ask a CLEANSLOP_QUESTION with your multiple-choice question tool when you have
|
|
266
|
+
one (never ask the human to type "Done"), using exactly its options. Never
|
|
267
|
+
answer for the human.
|
|
246
268
|
`;
|
|
247
269
|
//# sourceMappingURL=args.js.map
|
package/dist/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,MAAM,QAAQ,GAA2B;IACvC,M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BACrE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;gBACjB,MAAM;YACR,CAAC;YACD;gBACE,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC1B,MAAM,UAAU,CAAC,iBAAiB,KAAK,EAAE,CAAC,CAAC;gBAC7C,CAAC;gBACD,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;oBACX,MAAM,UAAU,CAAC,8BAA8B,KAAK,EAAE,CAAC,CAAC;gBAC1D,CAAC;gBACD,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC;gBACf,MAAM;QACV,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DxB,CAAC"}
|
|
@@ -12,18 +12,47 @@ export type StripeSptOffer = {
|
|
|
12
12
|
currency: string;
|
|
13
13
|
networkId: string;
|
|
14
14
|
purchaseUrl: string;
|
|
15
|
+
/** CleanSlop marks one pack as the best value. */
|
|
16
|
+
best?: boolean;
|
|
15
17
|
};
|
|
16
18
|
/** Fixed Link approval budget. Auto-buy ignores `scan --wait`. */
|
|
17
19
|
export declare const LINK_APPROVAL_WAIT_MS: number;
|
|
20
|
+
/**
|
|
21
|
+
* `--resume` budget. The human has usually approved already; anything longer
|
|
22
|
+
* would outlast an agent's foreground shell call.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LINK_RESUME_WAIT_MS: number;
|
|
25
|
+
/**
|
|
26
|
+
* How long to poll Link for approval. `--no-wait` checks once, `--resume`
|
|
27
|
+
* polls briefly, and the default (a human at a terminal) waits 10 minutes.
|
|
28
|
+
*/
|
|
18
29
|
export declare function linkApprovalWaitMs(args: ParsedArgs, opts?: {
|
|
19
30
|
autoBuy?: boolean;
|
|
20
31
|
}): number;
|
|
32
|
+
/** Cents to a display price, e.g. `5.00 USD`. */
|
|
33
|
+
export declare function formatPackPrice(amount: number, currency: string): string;
|
|
34
|
+
/** `p15 (15 scans, 25.00 USD, 1.67 USD per scan, best value)`. */
|
|
35
|
+
export declare function describePackOffer(offer: StripeSptOffer): string;
|
|
36
|
+
/** Every `stripe_spt` offer in a 402 `out_of_scans` body, in server order. */
|
|
37
|
+
export declare function stripeSptOffersFromErrorBody(json: unknown): StripeSptOffer[];
|
|
21
38
|
/** Read a matching `stripe_spt` offer from a 402 `out_of_scans` body. */
|
|
22
39
|
export declare function stripeSptOfferFromErrorBody(json: unknown, packHint: string | null): StripeSptOffer | null;
|
|
40
|
+
/**
|
|
41
|
+
* Buys a Link credit pack. Default mode (a human at a terminal) creates the
|
|
42
|
+
* spend request and waits up to 10 minutes. `--no-wait` creates it (or checks
|
|
43
|
+
* the saved one), prints the approve block, and exits 10; `--resume` finishes
|
|
44
|
+
* the saved request. A saved request for this origin is always reused rather
|
|
45
|
+
* than replaced, so retries never send the person a second approval.
|
|
46
|
+
*/
|
|
23
47
|
export declare function buyLinkCredits(deps: CliDeps, args: ParsedArgs, offer?: StripeSptOffer | null, opts?: {
|
|
24
48
|
autoBuy?: boolean;
|
|
25
49
|
}): Promise<number>;
|
|
26
50
|
export declare function runCredits(deps: CliDeps, args: ParsedArgs): Promise<number>;
|
|
27
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* If a scan 402 offers `stripe_spt`: a human at a terminal buys that pack in
|
|
53
|
+
* place and the scan retries once. An agent (no TTY) gets a top-up block that
|
|
54
|
+
* sends it through `credits buy --link --no-wait` / `--resume`, because a
|
|
55
|
+
* 10-minute approval wait outlasts its shell call.
|
|
56
|
+
*/
|
|
28
57
|
export declare function recoverOutOfScansIfOffered(deps: CliDeps, args: ParsedArgs, result: HttpResult, retry: () => Promise<HttpResult>): Promise<HttpResult>;
|
|
29
58
|
export {};
|