@alint-js/cli 0.5.0 → 0.7.0

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
@@ -14,11 +14,11 @@
14
14
 
15
15
  # `alint`
16
16
 
17
- [![npm version][npm-version-src]][npm-version-href]
18
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
17
+ [![npm version][npmx-version-src]][npmx-version-href]
18
+ [![npm downloads][npmx-downloads-src]][npmx-downloads-href]
19
19
  [![bundle][bundle-src]][bundle-href]
20
- [![JSDocs][jsdocs-src]][jsdocs-href]
21
20
  [![License][license-src]][license-href]
21
+ [![JSDocs][jsdocs-src]][jsdocs-href]
22
22
 
23
23
  ![Demo](./docs/assets/demo.gif)
24
24
 
@@ -50,7 +50,7 @@ You also need at least one OpenAI-compatible model provider. Local providers suc
50
50
 
51
51
  ### Install the CLI
52
52
 
53
- Download a standalone binary from the GitHub release assets when you want to use `alint` without a Node.js toolchain.
53
+ Download a standalone binary from the GitHub release assets if you want to use `alint` without a Node.js toolchain.
54
54
 
55
55
  Install globally if you want an `alint` command available everywhere:
56
56
 
@@ -161,12 +161,26 @@ alint demo.ts
161
161
  alint --format json demo.ts
162
162
  ```
163
163
 
164
+ #### --dirty
165
+
166
+ Use `--dirty` without file arguments to lint only existing files that differ from `HEAD`:
167
+
168
+ ```bash
169
+ alint --dirty
170
+ ```
171
+
172
+ This includes staged, unstaged, and untracked files from the Git repository root. Ignored and deleted files are excluded. Registered submodule worktrees are excluded. A clean repository exits successfully without producing lint output.
173
+
174
+ #### --model
175
+
164
176
  Override the matched model for a one-off run:
165
177
 
166
178
  ```bash
167
179
  alint --model qwen:8b demo.ts
168
180
  ```
169
181
 
182
+ #### --lang
183
+
170
184
  When the project-local setup does not configure any models, model calls without a rule-level or call-level selector use the `default` alias from the global setup. Rule selectors continue to use normal model matching. Configuring at least one model in `.alint/config.toml` restores project-first matching for unselected calls. An explicit `--model` override always takes precedence.
171
185
 
172
186
  Ask model-backed rules to write diagnostics in a specific language:
@@ -186,8 +200,6 @@ alint config inspect src/index.ts
186
200
  alint config providers list
187
201
  alint config providers show openrouter
188
202
  alint config models list
189
- alint config models list --with-speed
190
- alint config models list --with-speed --with-speed-concurrency openrouter=10 --with-speed-concurrency ollama=1
191
203
  alint config models show ollama/qwen
192
204
  alint config models probe --endpoint http://localhost:11434/v1
193
205
  alint config models rm qwen --provider ollama
@@ -198,8 +210,6 @@ When a model ID exists under multiple providers, qualify it as `<provider>/<mode
198
210
 
199
211
  `models rm` removes one exact configured model. `models prune` probes provider model endpoints and destructively removes configured IDs that are no longer reported. Interactive prune asks for confirmation; scripts must pass `-N --yes`.
200
212
 
201
- `models list --with-speed` sends live streamed requests to every configured model. It reports median repeat and non-repeat latency, non-repeat output throughput, and successful attempts. Each model receives one repeat warm-up, three measured repeat requests, and three non-repeat requests. Model jobs run concurrently within independent provider limits: OpenRouter defaults to 20, while CLIProxyAPI and other providers default to 2. Repeat `--with-speed-concurrency <provider-id>=<limit>` to override one or more configured providers. Requests within one model remain serial so its repeat and non-repeat cache measurements do not overlap. An unavailable model is shown as `errored` without preventing the remaining models from running. On a TTY, spinners and a refreshable table show active models, phases, and samples. Each request uses the configured runner timeout, or 60 seconds when none is configured. This command consumes provider tokens and may incur charges.
202
-
203
213
  Save machine-readable output and inspect it later without rerunning model calls:
204
214
 
205
215
  ```bash
@@ -209,18 +219,17 @@ alint output inspect alint-output.json
209
219
 
210
220
  ### Editor Integration
211
221
 
212
- > **Work in progress.** `alint lsp` currently publishes cached diagnostics when an editor opens a
213
- > workspace, and nothing more. Saving a file does not refresh it, changing `alint.config.ts` does
214
- > not reload it, and the run commands below are advertised but not yet implemented. Restart the
215
- > server to pick up either kind of change.
222
+ `alint lsp` runs alint as a language server on stdin and stdout. Any editor with LSP support can
223
+ use it.
216
224
 
217
- `alint lsp` runs alint as a language server over stdin and stdout.
225
+ The server is cache-first. It publishes diagnostics that earlier runs stored, and it never calls a
226
+ model on its own, so opening a workspace costs nothing. A cold cache shows no diagnostics. Run
227
+ `alint` once to fill it.
218
228
 
219
- It is cache-first. The server reads diagnostics that earlier runs already stored and **never calls
220
- a model on its own**, so opening a workspace costs nothing. A cold cache therefore shows nothing —
221
- run `alint` once to populate it.
229
+ Diagnostics appear when the editor opens the workspace, and they refresh when you save a file. The
230
+ server reloads `alint.config.ts` after it changes.
222
231
 
223
- Point any LSP editor at the command. In Neovim:
232
+ Configure the editor to start the command. In Neovim:
224
233
 
225
234
  ```lua
226
235
  vim.lsp.config.alint = {
@@ -229,20 +238,71 @@ vim.lsp.config.alint = {
229
238
  }
230
239
  ```
231
240
 
232
- The server declares two commands, `alint.runFile` and `alint.runWorkspace`, which will start runs
233
- that call models and spend tokens. Both return `MethodNotFound` today.
241
+ The server declares three commands. `alint.runFile` and `alint.runWorkspace` start runs that call
242
+ models and spend tokens; both report progress and accept cancellation. `alint.clearCache` deletes
243
+ the cached diagnostics.
244
+
245
+ #### VS Code
234
246
 
235
- A VS Code extension lives in `apps/vscode`. It starts the server and shows the diagnostics; it is
236
- not published to the marketplace yet. To run it from a checkout:
247
+ The extension in `apps/vscode` starts the server and displays the diagnostics. It is not published
248
+ to the Marketplace yet. To run it from a checkout:
237
249
 
238
250
  ```bash
239
251
  pnpm -F @alint-js/vscode build
240
- code --extensionDevelopmentPath=apps/vscode /path/to/your/project
252
+ code --extensionDevelopmentPath=apps/vscode/dist /path/to/your/project
253
+ ```
254
+
255
+ The extension finds the alint executable in this order: the `alint.path` setting, then
256
+ `node_modules/.bin/alint` in the workspace folder, then `PATH`. The workspace installation takes
257
+ precedence, so the server and a terminal run use the same cache.
258
+
259
+ ### Codex stop-gate plugin (optional)
260
+
261
+ #### Install
262
+ The Codex plugin adds a Stop hook that runs `alint --dirty` before the agent ends a turn.
263
+
264
+ Run these commands to install the plugin from the repository's default branch. These commands do not select the latest release:
265
+
266
+ ```bash
267
+ codex plugin marketplace add moeru-ai/alint \
268
+ --sparse .agents/plugins \
269
+ --sparse plugins/codex-plugin-alint
270
+ codex plugin add alint@alint
271
+ ```
272
+
273
+ To install from a release, use its Git tag:
274
+
275
+ ```bash
276
+ codex plugin marketplace add moeru-ai/alint \
277
+ --ref vX.Y.Z \
278
+ --sparse .agents/plugins \
279
+ --sparse plugins/codex-plugin-alint
280
+ codex plugin add alint@alint
241
281
  ```
242
282
 
243
- It resolves the alint executable from the `alint.path` setting, then `node_modules/.bin/alint` in
244
- the workspace folder, then `PATH`. The workspace install wins so that the server and the alint you
245
- run in a terminal share one cache.
283
+ Replace `vX.Y.Z` with the required release tag. Review and trust the Stop hook when Codex asks. The plugin stays inactive until a repository enables Stop Gate.
284
+
285
+ #### Configure
286
+
287
+ The codex plugin explicitly requires per-repo enable. Use this command to enable for current repository:
288
+
289
+ - .toml: run `alint config integrations stop-gate enable`
290
+ - .js/.ts:
291
+ ```typescript
292
+ export default defineConfig([
293
+ // ...
294
+ {
295
+ integrations: {
296
+ stopGate: {
297
+ enabled: true,
298
+ // target: 'dirty-files' | 'all'
299
+ // timeoutMs: 900000
300
+ },
301
+ },
302
+ },
303
+ // ...
304
+ ])
305
+ ```
246
306
 
247
307
  ## Concepts
248
308
 
@@ -281,7 +341,7 @@ thinking = { type = "disabled" }
281
341
 
282
342
  `default_params` is merged into every chat request for that model. Use it for provider-specific request fields that are not covered by the rest of the model entry.
283
343
 
284
- The CLI can also launch an ACP coding-agent command and expose it to rules as an ordinary model. Interactive `alint setup` provides presets for Claude Code, Codex, Gemini CLI, Kimi Code CLI, and OpenCode. Put a custom machine-specific command in the global setup config, or in `.alint/config.toml` when the repository standardizes the same command for every contributor:
344
+ The CLI can also launch an ACP coding-agent command and expose it to rules as an ordinary model. Interactive `alint setup` provides presets for Claude Code, Codex, Gemini CLI, Kimi Code CLI, and OpenCode:
285
345
 
286
346
  ```toml
287
347
  version = 1
@@ -300,15 +360,7 @@ args = []
300
360
  cwd = "."
301
361
  ```
302
362
 
303
- Then select it like any other model:
304
-
305
- ```bash
306
- alint --model acp/codex src
307
- ```
308
-
309
- `alint.config.ts` remains the shareable lint policy: it selects models, plugins, and rules but does not launch processes. The CLI merges global setup with `.alint/config.toml`, starts a loopback OpenAI-compatible adapter for the run, and shuts it down afterward. Each concurrent model request gets its own ACP process, so `--rule-concurrency` also bounds how many coding-agent processes a run can require.
310
-
311
- The command inherits the environment that launched `alint`. Optional `[providers.models.env]` entries override individual variables, but setup TOML does not interpolate variables. Do not commit credentials into the table. Request tools require the ACP agent to support MCP over HTTP.
363
+ Then run `alint --model acp/codex src`. The checked-in `alint.config.ts` remains lint policy; process commands come only from global setup or `.alint/config.toml`. The command inherits the environment that launched `alint`; optional model `env` entries are literal overrides and should not contain committed credentials. Each concurrent request starts one ACP process, and request tools require MCP-over-HTTP support from the agent.
312
364
 
313
365
  `alint` structured output forces a tool call (`tool_choice`). Some models, such as DeepSeek V4, reject that combination while thinking/reasoning is enabled. For those models, set `thinking = { type = "disabled" }` as above so structured output can run.
314
366
 
@@ -327,6 +379,19 @@ alint setup -N \
327
379
  - `--local` writes `.alint/config.toml` in the current project.
328
380
  - You can inspect configs using the `alint config` command group.
329
381
 
382
+ ##### Codex Stop Gate
383
+
384
+ Configure the optional Codex Stop Gate integration through the same project config system:
385
+
386
+ ```bash
387
+ alint config integrations stop-gate enable
388
+ alint config integrations stop-gate show
389
+ alint config integrations stop-gate set --target all --timeout-ms 1800000
390
+ alint config integrations stop-gate disable
391
+ ```
392
+
393
+ Stop Gate is disabled by default and runs only when the repository explicitly sets `integrations.stopGate.enabled = true`. The defaults after activation are `target = "dirty-files"` and `timeoutMs = 900000`; the maximum timeout is `86100000` (23 hours 55 minutes), leaving five minutes inside the plugin's 24-hour Codex hook limit for startup and persistence. The writer persists only non-default overrides and only extends the existing TOML write path; it does not extend the config writer to other formats. Read the [`plugins/codex-plugin-alint`](https://github.com/moeru-ai/alint/tree/main/plugins/codex-plugin-alint) documentation for complete runtime behavior.
394
+
330
395
  #### Using Rules & Plugins
331
396
 
332
397
  Similar to `eslint`, use `alint.config.ts` for files, ignores, plugins, and rules:
@@ -462,6 +527,8 @@ export default defineConfig([
462
527
 
463
528
  `alint` caches rule target results by default in `.alintcache` to avoid repeating LLM calls for unchanged source targets.
464
529
 
530
+ After each cacheable rule job completes, `alint` writes a cache checkpoint before releasing that job's scheduler slot. Each checkpoint atomically replaces the complete cache file, so an interrupted run can reuse every result that had already become durable. Cache hits, skipped jobs, failed jobs, and rules that opt out of caching do not add checkpoint writes. Any checkpoint or final cache write error causes the run to fail.
531
+
465
532
  > [!NOTE]
466
533
  > `.alintcache` should not be committed to Git. Add it to `.gitignore` before running repeated local analysis.
467
534
 
@@ -593,6 +660,7 @@ defineRule({
593
660
  | [`@alint-js/core`](https://github.com/moeru-ai/alint/tree/main/packages/core) | SDK and run engine for plugins, rules, source runtime, model resolution, diagnostics, cache, and agent contracts. |
594
661
  | [`@alint-js/agent-apeira`](https://github.com/moeru-ai/alint/tree/main/packages/agent-apeira) | Apeira-backed `AgentAdapter`. |
595
662
  | [`@alint-js/agent-pi`](https://github.com/moeru-ai/alint/tree/main/packages/agent-pi) | Pi-backed `AgentAdapter`. |
663
+ | [`@alint-js/languages`](https://github.com/moeru-ai/alint/tree/main/packages/languages) | First-party language support beyond core's built-in JavaScript and TypeScript: Go, Python, and Rust. |
596
664
  | [`@alint-js/plugin-example`](https://github.com/moeru-ai/alint/tree/main/packages/plugin-example) | Example TypeScript/JavaScript model-backed rules. |
597
665
  | [`@alint-js/plugin-example-agent`](https://github.com/moeru-ai/alint/tree/main/packages/plugin-example-agent) | Example plugin for framework-agnostic agentic rules. |
598
666
  | [`@alint-js/plugin-example-go`](https://github.com/moeru-ai/alint/tree/main/packages/plugin-example-go) | Example semantic Go review plugin using `plaintext`. |
@@ -630,15 +698,16 @@ pnpm lint
630
698
 
631
699
  ## License
632
700
 
701
+
633
702
  MIT
634
703
 
635
- [npm-version-src]: https://img.shields.io/npm/v/@alint-js/cli?style=flat&colorA=080f12&colorB=1fa669
636
- [npm-version-href]: https://npmjs.com/package/@alint-js/cli
637
- [npm-downloads-src]: https://img.shields.io/npm/dm/@alint-js/core?style=flat&colorA=080f12&colorB=1fa669
638
- [npm-downloads-href]: https://npmjs.com/package/@alint-js/core
639
- [bundle-src]: https://img.shields.io/bundlephobia/minzip/@alint-js/cli?style=flat&colorA=080f12&colorB=1fa669&label=minzip
704
+ [npmx-version-src]: https://npmx.dev/api/registry/badge/version/@alint-js/cli
705
+ [npmx-version-href]: https://npmx.dev/@alint-js/cli
706
+ [npmx-downloads-src]: https://npmx.dev/api/registry/badge/downloads-month/@alint-js/cli
707
+ [npmx-downloads-href]: https://npmx.dev/@alint-js/cli
708
+ [bundle-src]: https://npmx.dev/api/registry/badge/size/@alint-js/cli
640
709
  [bundle-href]: https://bundlephobia.com/result?p=@alint-js/cli
641
- [license-src]: https://img.shields.io/github/license/moeru-ai/alint.svg?style=flat&colorA=080f12&colorB=1fa669
710
+ [license-src]: https://npmx.dev/api/registry/badge/license/@alint-js/cli
642
711
  [license-href]: https://github.com/moeru-ai/alint/blob/main/LICENSE
643
712
  [jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
644
713
  [jsdocs-href]: https://www.jsdocs.io/package/@alint-js/cli
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as executeCli } from "../cli-ChymU1Wr.mjs";
2
+ import { t as executeCli } from "../cli-BsBgbtds.mjs";
3
3
  import process from "node:process";
4
4
  //#region src/bin/index.ts
5
5
  executeCli(process.argv, {