|
| 1 | +--- |
| 2 | +title: CLI |
| 3 | +description: One-command setup for PleaseAI code style — installs packages and writes config files. |
| 4 | +navigation: |
| 5 | + icon: i-lucide-terminal |
| 6 | +--- |
| 7 | + |
| 8 | +# CLI |
| 9 | + |
| 10 | +`@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. |
| 11 | + |
| 12 | +Inspired by [ultracite](https://github.com/haydenbleasel/ultracite) and NaverPay's [`@naverpay/code-style-cli`](https://github.com/NaverPayDev/code-style). |
| 13 | + |
| 14 | +## Quick Start |
| 15 | + |
| 16 | +Run from the root of any project that has a `package.json`: |
| 17 | + |
| 18 | +:::code-group |
| 19 | +```bash [bun] |
| 20 | +bunx @pleaseai/code-style |
| 21 | +``` |
| 22 | + |
| 23 | +```bash [pnpm] |
| 24 | +pnpm dlx @pleaseai/code-style |
| 25 | +``` |
| 26 | + |
| 27 | +```bash [npm] |
| 28 | +npx @pleaseai/code-style |
| 29 | +``` |
| 30 | +::: |
| 31 | + |
| 32 | +The CLI will: |
| 33 | + |
| 34 | +1. Detect your package manager from the lockfile (bun → pnpm → yarn → npm, falling back to bun) |
| 35 | +2. Show a checkbox UI listing the available tools; already-installed ones are labelled `(installed)` |
| 36 | +3. Install the packages you select as dev dependencies |
| 37 | +4. Write or update the matching config files |
| 38 | + |
| 39 | +## Commands |
| 40 | + |
| 41 | +### `init` |
| 42 | + |
| 43 | +Interactive setup — the default when no subcommand is given. |
| 44 | + |
| 45 | +```bash |
| 46 | +pleaseai-code-style init |
| 47 | +pleaseai-code-style init --yes # non-interactive, accept defaults |
| 48 | +``` |
| 49 | + |
| 50 | +### `update` |
| 51 | + |
| 52 | +Refresh **only** the `AGENTS.md` rules block without touching packages or other config files. Use this after bumping `@pleaseai/code-style` to pull in the latest rules. |
| 53 | + |
| 54 | +```bash |
| 55 | +pleaseai-code-style update |
| 56 | +``` |
| 57 | + |
| 58 | +### `doctor` |
| 59 | + |
| 60 | +Report the current project configuration status — which packages are installed, which config files exist. |
| 61 | + |
| 62 | +```bash |
| 63 | +pleaseai-code-style doctor |
| 64 | +``` |
| 65 | + |
| 66 | +## Supported Tools |
| 67 | + |
| 68 | +| Tool | npm package(s) | Config file | |
| 69 | +| --- | --- | --- | |
| 70 | +| eslint-config | `@pleaseai/eslint-config`, `eslint` | `eslint.config.mjs` | |
| 71 | +| prettier-config | `@pleaseai/prettier-config`, `prettier` | `package.json#prettier` | |
| 72 | +| editorconfig | `@pleaseai/editorconfig` | `.editorconfig` | |
| 73 | +| agents-md | — | `AGENTS.md` (marker-managed block) | |
| 74 | + |
| 75 | +## The `AGENTS.md` Rules Block |
| 76 | + |
| 77 | +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: |
| 78 | + |
| 79 | +```md [AGENTS.md] |
| 80 | +My project notes live here. |
| 81 | + |
| 82 | +<!-- pleaseai-code-style:start --> |
| 83 | +# PleaseAI Code Style |
| 84 | + |
| 85 | +These rules are managed by `@pleaseai/code-style`. Run |
| 86 | +`pleaseai-code-style update` to refresh this block. |
| 87 | + |
| 88 | +- Formatter: `@pleaseai/eslint-config` (wraps `@antfu/eslint-config`) |
| 89 | +- No semicolons, single quotes, 2-space indent, trailing commas, LF line endings |
| 90 | +- ESM only — never emit `require`/`module.exports` |
| 91 | +- ... |
| 92 | +<!-- pleaseai-code-style:end --> |
| 93 | + |
| 94 | +My own content stays here untouched. |
| 95 | +``` |
| 96 | + |
| 97 | +The CLI **only** owns the content between the two marker comments — everything else in `AGENTS.md` is preserved verbatim. Running `update` twice in a row is a no-op; the block never duplicates. |
| 98 | + |
| 99 | +The full canonical rules list is shipped as `node_modules/@pleaseai/code-style/rules.md` for AI assistants that prefer to read the long version. |
| 100 | + |
| 101 | +## Options |
| 102 | + |
| 103 | +| Flag | Description | |
| 104 | +| --- | --- | |
| 105 | +| `--yes`, `-y` | Accept defaults and overwrite existing files without prompting | |
| 106 | +| `--lang <ko\|en>` | Force the CLI locale (defaults to `$LC_ALL` / `$LANG`) | |
| 107 | +| `--help`, `-h` | Print help | |
| 108 | +| `--version`, `-v` | Print the CLI version | |
| 109 | + |
| 110 | +## Localisation |
| 111 | + |
| 112 | +The CLI auto-detects your locale from `LC_ALL`, `LANG`, or `LC_MESSAGES` and currently ships Korean and English messages. Override with `--lang ko` or `--lang en`: |
| 113 | + |
| 114 | +```bash |
| 115 | +pleaseai-code-style --lang ko init |
| 116 | +``` |
| 117 | + |
| 118 | +## CI Usage |
| 119 | + |
| 120 | +Combine `--yes` with a locale override for a fully non-interactive invocation suitable for CI or project templates: |
| 121 | + |
| 122 | +```bash |
| 123 | +pleaseai-code-style --yes --lang en init |
| 124 | +``` |
| 125 | + |
| 126 | +This accepts defaults for every tool, overwrites any existing config files, and uses English output. |
| 127 | + |
| 128 | +## Binaries |
| 129 | + |
| 130 | +The package exposes two bin entries — use whichever you prefer: |
| 131 | + |
| 132 | +- `pleaseai-code-style` |
| 133 | +- `please-style` (short alias) |
| 134 | + |
| 135 | +Both point to the same executable. |
0 commit comments