Skip to content

CLI

One-command setup for PleaseAI code style — installs packages and writes config files.

Updated View as Markdown

@pleaseai/code-style is a zero-config CLI that wires PleaseAI’s shared code style into any project. It installs the ESLint / Prettier / EditorConfig packages and manages an AGENTS.md rules block so AI coding assistants know how to write code that passes lint on the first try.

Inspired by ultracite and NaverPay’s @naverpay/code-style-cli.

Quick Start

Run from the root of your project. A package.json is optional: without one (Gradle, pubspec or Cargo-only projects) init offers only the AGENTS.md block and its guides, and update and doctor work as usual:

The CLI will:

  1. Detect your package manager from the lockfile (bun → pnpm → yarn → npm, falling back to bun)
  2. Show a checkbox UI listing the available tools; already-installed ones are labelled (installed)
  3. Install the packages you select as dev dependencies
  4. Write or update the matching config files

Commands

init

Interactive setup — the default when no subcommand is given.

pleaseai-code-style init
pleaseai-code-style init --yes   # non-interactive, accept defaults

update

Refresh the AGENTS.md rules block and the guides in .agents/code-style/ without touching other config files. Use this after bumping @pleaseai/code-style to pull in the latest rules. If @pleaseai/eslint-config is installed without its antislop plugins, it then offers to install them (see antislop plugins below).

pleaseai-code-style update

doctor

Report the current project configuration status — which packages are installed, which config files exist, and whether the antislop plugins are present.

pleaseai-code-style doctor

check

Check file names, test paths, and shared test helpers against the ADR-0022 code-organization standard (layer 3). The structural rules (layer 2) run separately with ast-grep scan and the @pleaseai/ast-grep-config rules that the ast-grep tool wires into sgconfig.yml.

check runs the extraction rules from the CLI’s bundled @pleaseai/ast-grep-config with the ast-grep binary from @ast-grep/cli; the binary resolves from the checked project first (the project’s copy of the extraction rules is only a last-resort fallback). Install both as dev dependencies — the binary for check, the package for the ast-grep scan rules (the ast-grep tool in init does this):

bun add -D @pleaseai/ast-grep-config @ast-grep/cli
please-style check              # check the current directory
please-style check packages/    # check a subdirectory
please-style check --json       # machine-readable output
please-style check --strict     # exit 1 on any finding (for CI once clean)
Flag Description
[path] Directory to check (default: the current directory)
--json Print the result as JSON (root, findings, notices)
--strict Exit 1 when there is any finding (default: warn only)
--config <file> Config file (default: code-organization.json in the enclosing project root, or in <path> when no project marker is found above it)

Exit codes: 0 no findings or warnings only, 1 findings with --strict, 2 usage or config error, or @ast-grep/cli cannot be resolved while a file needs extraction.

An optional code-organization.json can only add names — extra TypeScript sourceRoots and extra test envSegments. There is no option to move tests next to sources or to turn a check off. See the CLI README for every check.

Supported Tools

Tool npm package(s) Config file
eslint-config @pleaseai/eslint-config, eslint eslint.config.mjs
prettier-config @pleaseai/prettier-config, prettier package.json#prettier
editorconfig @pleaseai/editorconfig .editorconfig
agents-md — AGENTS.md (marker-managed block)
ast-grep @pleaseai/ast-grep-config, @ast-grep/cli sgconfig.yml

The AGENTS.md Rules Block

The CLI writes a marker-delimited block into AGENTS.md so you can mix your own content around it without losing edits on the next run:

AGENTS.mdmd
My project notes live here.

<!-- pleaseai-code-style:start -->
# Passion Factory Code Style

These rules are managed by `@pleaseai/code-style`. Run
`pleaseai-code-style update` to refresh this block.

- Formatter: `@pleaseai/eslint-config` (wraps `@antfu/eslint-config`)
- No semicolons, single quotes, 2-space indent, trailing commas, LF line endings
- ESM only — never emit `require`/`module.exports`
- ...
<!-- pleaseai-code-style:end -->

My own content stays here untouched.

In AGENTS.md, the CLI only owns the content between the two marker comments — everything else is preserved verbatim. Running update twice in a row is a no-op; the block never duplicates.

The full canonical rules are copied into your project per language for AI assistants that prefer to read the long version, so they resolve without node_modules: start with .agents/code-style/general.md (every language), then the guide of your language (for example, .agents/code-style/typescript.md for TypeScript and JavaScript). NOTICE.md and LICENSE-Apache-2.0.txt in the same directory carry the attribution for the adapted guides. Commit .agents/code-style/: init and update rewrite it, overwrite its files and remove the guide of a language that is no longer selected (other files there are never touched). doctor checks that every guide the block links exists.

antislop plugins

@pleaseai/eslint-config turns antislop on when eslint-plugin-slop and eslint-plugin-sonarjs are installed. init installs them; for an existing project:

  • doctor reports each plugin (OK or missing, antislop rules are off) and the install command for your package manager. It prints nothing about them without @pleaseai/eslint-config or a package.json.
  • update offers to install the missing plugins after it refreshes the AGENTS.md block. Interactive runs ask first (default: yes), --yes installs without asking, and without a TTY it only prints the command. At a pnpm workspace root it installs with pnpm add -D -w. An install failure exits non-zero.
  • After installing, update prints the follow-up for existing code, with ESLint run through the project’s package manager (bunx, pnpm exec, yarn, or npx): eslint . --fix, then eslint . --suppress-all to move the remaining violations into eslint-suppressions.json (ESLint bulk suppressions), and eslint . --prune-suppressions as you fix them.
  • For a project that sets antislop: false in its eslint.config.*, doctor prints antislop: off instead of the plugin lines and update does not offer the install. antislop: { slop: false } or { sonarjs: false } drops only that plugin from both commands. This is a plain text search, so a computed value is not detected.

Options

Flag Description
--yes, -y Accept defaults and overwrite existing files without prompting
--lang <list> Languages for the AGENTS.md rules block, comma-separated (init/doctor: detected; update: the languages already in the block; see below)
--locale <ko|en> Force the CLI locale (defaults to $LC_ALL / $LANG)
--help, -h Print help
--version, -v Print the CLI version

Languages

--lang <list> selects the programming languages the AGENTS.md rules block links to, for example --lang typescript,dart. Accepted values: typescript, dart, rust, java, go, python, ruby, csharp, html-css. Without it, init detects languages from marker files in the project root: package.json or tsconfig.json (typescript), pubspec.yaml (dart), Cargo.toml (rust), build.gradle, build.gradle.kts or pom.xml (java), go.mod (go), pyproject.toml (python). Interactive init lets you adjust the detected set. update keeps the languages the existing block links unless --lang is given. An unknown --lang value exits with an error (exit code 1) listing the accepted languages. doctor reports the detected languages.

Localisation

The CLI auto-detects your locale from LC_ALL, LANG, or LC_MESSAGES and currently ships Korean and English messages. Override with --locale ko or --locale en:

pleaseai-code-style --locale ko init

--lang ko and --lang en are the deprecated locale alias: they still set the locale for now, with a deprecation warning, and select no languages. When both --lang ko|en and --locale are given, --locale wins. A --locale value other than ko or en also exits with an error (exit code 1).

CI Usage

Combine --yes with a locale override for a fully non-interactive invocation suitable for CI or project templates:

pleaseai-code-style --yes --locale en init

This accepts defaults for every tool, overwrites any existing config files, and uses English output.

Binaries

The package exposes two bin entries — use whichever you prefer:

  • pleaseai-code-style
  • please-style (short alias)

Both point to the same executable.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close