@cleanslop/cli

中文文档
0.2.0发布于 2026/11/11MITES Module零依赖构建来源已验证近 30 天下载 8350

CleanSlop CLI — readiness scans from your coding agent

原始使用文档
文档目录10 节
  1. New in 0.2.0
  2. Quick start
  3. Commands
  4. Wait
  5. Setup
  6. Credentials
  7. Exit codes
  8. Claude Code plugin
  9. Development
  10. License

CleanSlop CLI

npm license node

Readiness scans from your coding agent. The CLI starts a CleanSlop scan of your repo, waits for it, and hands the report back so the agent can fix what it finds. Published as @cleanslop/cli (bin cleanslop).

New in 0.2.0

  • Rescans check only what changed. cleanslop scan builds on the last scan of the same branch, or of the same uploaded folder, and costs only the files changed since. It prints which scan it built on, or why it ran a full scan. --full scans everything again; when nothing changed, it asks before doing that.
  • Credits. Balances, plans and packs are counted in credits. A scan priced over 4 credits stops before it is charged and asks; after a yes, rerun with --confirm-credits <credits>.
  • The Claude Code plugin moved to cleanslop/skills.

Everything else is in CHANGELOG.md.

Quick start

npx -y @cleanslop/cli scan

Run it from a git checkout whose HEAD is pushed to github.com. Then npx -y @cleanslop/cli setup installs the skill or rules for Claude Code, Cursor and Codex so your agent runs it for you.

Requires Node 22 or later (Node 20 is end-of-life; npm warns there). Zero runtime dependencies. Link commands shell out to link-cli 1.2.0 or later: CLEANSLOP_LINK_CLI (an older one is an error), else link-cli on PATH when it is new enough, else the pinned npx @stripe/[email protected]. link-cli runs from the CLI's config folder with the project's node_modules/.bin off PATH, so the repo you scan can't choose it; uploads pack with a built-in tar writer.

Commands

CommandPurpose
scan (default)Resolve the github.com origin + HEAD and start a scan. It builds on the last scan of the branch (or of the uploaded folder) and costs only the files changed since. --wait waits for the report; --full scans everything again; --upload scans the local files instead of the pushed commit (after the human picks it); --confirm-credits <credits> approves a price over 4 credits, only after the human says yes; --force skips the same-commit dedupe
login [--link [--agree]] [--no-wait | --resume]RFC 8628 device flow. Prints verification_uri_complete and user_code. --no-wait stores the device code; --resume finishes it. --link signs up or signs in with Stripe Link through link-cli instead of GitHub; pass --agree only after the human says yes to the quoted terms question. Never prints the token.
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)
whoamiConnected @login, token last4, plan with its monthly credits, and credits remaining (with what a scan costs). --json adds creditBalance
status [id] [--wait]Poll scan status
report [id] [--format md|json] [--preview]Fetch cleanslop.report.v1 (the whole list: limit=250). A final Markdown report with confirmed or needs-input findings is followed on stderr by a fix_findings question (Fix them / Show me first / Not now); scan does the same. Exit stays 0.
setupIdempotent skill/rules. Never logs in, never writes a token
redeem <code>Redeem a promo (invite) code the human gave you for bonus credits (POST /api/agent/v1/credits/redeem). One code per account; promo_invalid / promo_already_redeemed exit 12 with an ask_human block.
credits buy --link [--pack p5|p15|p40] [--no-promo] [--no-wait | --resume]Link account: buys a one-time credit pack from a Link approval (link-cli spend-request create), then POST /api/agent/v1/credits/purchases. --pack is required without a terminal (the human picks); a terminal defaults to p5. --no-promo skips the promo-code choice. --no-wait prints what to approve and exits 10; --resume continues it, saved in pending-spend-request.json.
billingLink account: POST /api/agent/v1/billing/sign-in-link has the server email a sign-in link to the account's Link address, where the human subscribes, buys credits or cancels a plan. Prints the masked address it went to, plus /signin/email?from=agent and the masked email to type if it does not arrive. When the server cannot send (email login off, rate limited) or is older (404, read webBilling from GET /me), it prints only the typed-address page. The CLI never sees the link. Exits 10 with an ask_human block; --json prints {sent, expiresAt | reason, webBilling}. Prints "Not available for this account" (exit 0) without webBilling.
plan [starter|pro|max]Link account: starts a monthly plan paid each month from a recurring Link approval (link-cli spend-request create --recurring-interval month), then POST /api/agent/v1/plans/purchases. Without a plan name an agent gets a link_plan question (Starter, Pro, Max with monthly prices, Not now). Same --no-wait / --resume flow as credits buy --link, saved in its own pending-plan-request.json. When CleanSlop offers no Link plans it does what billing does. Prints "Started the CleanSlop … plan" (exit 0). Change or cancel the plan with billing.

Wait

  • --wait defaults to 8 minutes when no duration is given.
  • --wait 75m is the Claude Code background budget.
  • Durations: 30s, 8m, 1h.
  • Honour pollAfterSec (10 pending/first pass, 20 review, 30 past p90); never poll faster than 3 seconds. Print the ETA while waiting.
  • At the deadline: exit 75 and print the ETA plus cleanslop status <id> --wait.

Setup

Default is user scope:

AgentPath
Claude Code~/.claude/skills/cleanslop/SKILL.md
Cursor~/.cursor/rules/cleanslop.mdc
Codexmarker block in ~/.codex/AGENTS.md

--project writes .cursor/rules/cleanslop.mdc and an AGENTS.md marker in the current repo. --dry-run / non-TTY without --yes only print the plan. --uninstall removes the marker blocks / owned files.

Skill / Cursor rules / AGENTS snippet are generated from assets/skill-core.md. The Claude Code plugin's SKILL.md in cleanslop/skills is rendered from the same file. Remote MCP is a separate install: see https://cleanslop.com/mcp.

Credentials

  • $XDG_CONFIG_HOME/cleanslop/credentials.json or ~/.config/cleanslop/ (Windows: %APPDATA%\cleanslop\)
  • Directory 0700, file 0600
  • Refuses to write inside the current git worktree
  • CLEANSLOP_TOKEN and CLEANSLOP_ORIGIN override the file / default origin (https://cleanslop.com)
  • The token is never printed; whoami shows last4

Exit codes

CodeMeaning
0Done
1Unexpected error
2Usage or config
10Human action (approve, install, reauth, or a question such as a scan price to confirm)
11Payment (402)
12Policy (waitlisted, beta, cap)
13Source unavailable (dirty, unpushed, not github.com)
20Scan failed server-side
75Still running; resume command printed

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.

Claude Code plugin

The plugin, which bundles the skill and the remote MCP server, lives in cleanslop/skills:

/plugin marketplace add cleanslop/skills
/plugin install cleanslop@cleanslop

The cleanslop marketplace in this repository still works; it now installs the plugin from cleanslop/skills.

Development

npm ci
npm test
npm run build
node dist/index.js scan

test/ uses node:test and c8 against a fake HTTP server. The coverage floor is 90% for lines, statements and functions, and 80% for branches. npm test also checks that the tree names no upstream-only hosts or paths (scripts/check-public.mjs).

This repository is a read-only mirror of the CLI's upstream source; see CONTRIBUTING.md for how pull requests land. Each sync to main stages the next patch release (scripts/release-version.mjs) with npm provenance, and a maintainer approves it under Staged Packages on npmjs.com, then publishes the GitHub release drafted from CHANGELOG.md. Do not npm publish by hand.

License

MIT

版本与发布记录

@cleanslop/cli 共发布 75 个版本,首次发布于 2026/10/14;过去 12 个月发布了 75 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.0latest2026/11/11今天
0.2.0-beta.65beta2026/11/10今天
0.1.8-beta.642026/11/10今天
0.1.8-beta.632026/11/101 天前
0.1.8-beta.622026/11/101 天前
0.1.8-beta.612026/11/091 天前

关于 @cleanslop/cli 的常见问题

@cleanslop/cli 是什么?

CleanSlop CLI — readiness scans from your coding agent

如何安装 @cleanslop/cli?

在项目目录运行 npm install @cleanslop/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 cleanslop,可以用 npx cleanslop 直接运行。

@cleanslop/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cleanslop__cli 是否存在。

@cleanslop/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cleanslop/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cleanslop/cli 可以商用吗?

@cleanslop/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cleanslop/cli 的下载量有多少?

根据 npm 官方下载统计,@cleanslop/cli 在 2026/10/10 – 2026/11/08 这 30 天内被下载 8,350 次,日均约 278 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cleanslop/cli 还在维护吗?

最新版本 0.2.0 发布于 2026/11/11(今天);至今共发布 75 个版本,其中过去 12 个月发布了 75 个;首次发布于 2026/10/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。