@alint-js/cli 0.4.0 → 0.6.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 +128 -24
- package/dist/bin/index.mjs +1 -1
- package/dist/{cli-DFWnPI6m.mjs → cli-cQihuHqx.mjs} +1967 -1269
- package/dist/index.d.mts +11 -3
- package/dist/index.mjs +1 -1
- package/dist/server-xx0w7UQL.mjs +368 -0
- package/package.json +24 -6
package/README.md
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
# `alint`
|
|
16
16
|
|
|
17
|
-
[![npm version][
|
|
18
|
-
[![npm downloads][
|
|
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
|

|
|
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
|
|
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
|
|
@@ -207,6 +217,91 @@ alint --format json src > alint-output.json
|
|
|
207
217
|
alint output inspect alint-output.json
|
|
208
218
|
```
|
|
209
219
|
|
|
220
|
+
### Editor Integration
|
|
221
|
+
|
|
222
|
+
> **Work in progress.** `alint lsp` currently publishes cached diagnostics when an editor opens a
|
|
223
|
+
> workspace, and nothing more. Saving a file does not refresh it, changing `alint.config.ts` does
|
|
224
|
+
> not reload it, and the run commands below are advertised but not yet implemented. Restart the
|
|
225
|
+
> server to pick up either kind of change.
|
|
226
|
+
|
|
227
|
+
`alint lsp` runs alint as a language server over stdin and stdout.
|
|
228
|
+
|
|
229
|
+
It is cache-first. The server reads diagnostics that earlier runs already stored and **never calls
|
|
230
|
+
a model on its own**, so opening a workspace costs nothing. A cold cache therefore shows nothing —
|
|
231
|
+
run `alint` once to populate it.
|
|
232
|
+
|
|
233
|
+
Point any LSP editor at the command. In Neovim:
|
|
234
|
+
|
|
235
|
+
```lua
|
|
236
|
+
vim.lsp.config.alint = {
|
|
237
|
+
cmd = { 'alint', 'lsp' },
|
|
238
|
+
root_markers = { 'alint.config.ts' },
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
The server declares two commands, `alint.runFile` and `alint.runWorkspace`, which will start runs
|
|
243
|
+
that call models and spend tokens. Both return `MethodNotFound` today.
|
|
244
|
+
|
|
245
|
+
A VS Code extension lives in `apps/vscode`. It starts the server and shows the diagnostics; it is
|
|
246
|
+
not published to the marketplace yet. To run it from a checkout:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
pnpm -F @alint-js/vscode build
|
|
250
|
+
code --extensionDevelopmentPath=apps/vscode /path/to/your/project
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
It resolves the alint executable from the `alint.path` setting, then `node_modules/.bin/alint` in
|
|
254
|
+
the workspace folder, then `PATH`. The workspace install wins so that the server and the alint you
|
|
255
|
+
run in a terminal share one cache.
|
|
256
|
+
|
|
257
|
+
### Codex stop-gate plugin (optional)
|
|
258
|
+
|
|
259
|
+
#### Install
|
|
260
|
+
The Codex plugin adds a Stop hook that runs `alint --dirty` before the agent ends a turn.
|
|
261
|
+
|
|
262
|
+
Run these commands to install the plugin from the repository's default branch. These commands do not select the latest release:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
codex plugin marketplace add moeru-ai/alint \
|
|
266
|
+
--sparse .agents/plugins \
|
|
267
|
+
--sparse plugins/codex-plugin-alint
|
|
268
|
+
codex plugin add alint@alint
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
To install from a release, use its Git tag:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
codex plugin marketplace add moeru-ai/alint \
|
|
275
|
+
--ref vX.Y.Z \
|
|
276
|
+
--sparse .agents/plugins \
|
|
277
|
+
--sparse plugins/codex-plugin-alint
|
|
278
|
+
codex plugin add alint@alint
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
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.
|
|
282
|
+
|
|
283
|
+
#### Configure
|
|
284
|
+
|
|
285
|
+
The codex plugin explicitly requires per-repo enable. Use this command to enable for current repository:
|
|
286
|
+
|
|
287
|
+
- .toml: run `alint config integrations stop-gate enable`
|
|
288
|
+
- .js/.ts:
|
|
289
|
+
```typescript
|
|
290
|
+
export default defineConfig([
|
|
291
|
+
// ...
|
|
292
|
+
{
|
|
293
|
+
integrations: {
|
|
294
|
+
stopGate: {
|
|
295
|
+
enabled: true,
|
|
296
|
+
// target: 'dirty-files' | 'all'
|
|
297
|
+
// timeoutMs: 900000
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
// ...
|
|
302
|
+
])
|
|
303
|
+
```
|
|
304
|
+
|
|
210
305
|
## Concepts
|
|
211
306
|
|
|
212
307
|
`alint` keeps the familiar lint shape: select targets, apply named rules, report diagnostics, and return an exit code that CI can understand. The difference is that a rule can reach its judgment through model calls or a tool-using agent when syntax-only checks are not enough.
|
|
@@ -244,7 +339,7 @@ thinking = { type = "disabled" }
|
|
|
244
339
|
|
|
245
340
|
`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.
|
|
246
341
|
|
|
247
|
-
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
|
|
342
|
+
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:
|
|
248
343
|
|
|
249
344
|
```toml
|
|
250
345
|
version = 1
|
|
@@ -263,15 +358,7 @@ args = []
|
|
|
263
358
|
cwd = "."
|
|
264
359
|
```
|
|
265
360
|
|
|
266
|
-
Then
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
alint --model acp/codex src
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
`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.
|
|
273
|
-
|
|
274
|
-
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.
|
|
361
|
+
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.
|
|
275
362
|
|
|
276
363
|
`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.
|
|
277
364
|
|
|
@@ -290,6 +377,19 @@ alint setup -N \
|
|
|
290
377
|
- `--local` writes `.alint/config.toml` in the current project.
|
|
291
378
|
- You can inspect configs using the `alint config` command group.
|
|
292
379
|
|
|
380
|
+
##### Codex Stop Gate
|
|
381
|
+
|
|
382
|
+
Configure the optional Codex Stop Gate integration through the same project config system:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
alint config integrations stop-gate enable
|
|
386
|
+
alint config integrations stop-gate show
|
|
387
|
+
alint config integrations stop-gate set --target all --timeout-ms 1800000
|
|
388
|
+
alint config integrations stop-gate disable
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
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.
|
|
392
|
+
|
|
293
393
|
#### Using Rules & Plugins
|
|
294
394
|
|
|
295
395
|
Similar to `eslint`, use `alint.config.ts` for files, ignores, plugins, and rules:
|
|
@@ -425,6 +525,8 @@ export default defineConfig([
|
|
|
425
525
|
|
|
426
526
|
`alint` caches rule target results by default in `.alintcache` to avoid repeating LLM calls for unchanged source targets.
|
|
427
527
|
|
|
528
|
+
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.
|
|
529
|
+
|
|
428
530
|
> [!NOTE]
|
|
429
531
|
> `.alintcache` should not be committed to Git. Add it to `.gitignore` before running repeated local analysis.
|
|
430
532
|
|
|
@@ -556,6 +658,7 @@ defineRule({
|
|
|
556
658
|
| [`@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. |
|
|
557
659
|
| [`@alint-js/agent-apeira`](https://github.com/moeru-ai/alint/tree/main/packages/agent-apeira) | Apeira-backed `AgentAdapter`. |
|
|
558
660
|
| [`@alint-js/agent-pi`](https://github.com/moeru-ai/alint/tree/main/packages/agent-pi) | Pi-backed `AgentAdapter`. |
|
|
661
|
+
| [`@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. |
|
|
559
662
|
| [`@alint-js/plugin-example`](https://github.com/moeru-ai/alint/tree/main/packages/plugin-example) | Example TypeScript/JavaScript model-backed rules. |
|
|
560
663
|
| [`@alint-js/plugin-example-agent`](https://github.com/moeru-ai/alint/tree/main/packages/plugin-example-agent) | Example plugin for framework-agnostic agentic rules. |
|
|
561
664
|
| [`@alint-js/plugin-example-go`](https://github.com/moeru-ai/alint/tree/main/packages/plugin-example-go) | Example semantic Go review plugin using `plaintext`. |
|
|
@@ -593,15 +696,16 @@ pnpm lint
|
|
|
593
696
|
|
|
594
697
|
## License
|
|
595
698
|
|
|
699
|
+
|
|
596
700
|
MIT
|
|
597
701
|
|
|
598
|
-
[
|
|
599
|
-
[
|
|
600
|
-
[
|
|
601
|
-
[
|
|
602
|
-
[bundle-src]: https://
|
|
702
|
+
[npmx-version-src]: https://npmx.dev/api/registry/badge/version/@alint-js/cli
|
|
703
|
+
[npmx-version-href]: https://npmx.dev/@alint-js/cli
|
|
704
|
+
[npmx-downloads-src]: https://npmx.dev/api/registry/badge/downloads-month/@alint-js/cli
|
|
705
|
+
[npmx-downloads-href]: https://npmx.dev/@alint-js/cli
|
|
706
|
+
[bundle-src]: https://npmx.dev/api/registry/badge/size/@alint-js/cli
|
|
603
707
|
[bundle-href]: https://bundlephobia.com/result?p=@alint-js/cli
|
|
604
|
-
[license-src]: https://
|
|
708
|
+
[license-src]: https://npmx.dev/api/registry/badge/license/@alint-js/cli
|
|
605
709
|
[license-href]: https://github.com/moeru-ai/alint/blob/main/LICENSE
|
|
606
710
|
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
607
711
|
[jsdocs-href]: https://www.jsdocs.io/package/@alint-js/cli
|
package/dist/bin/index.mjs
CHANGED