@alint-js/cli 0.0.18 → 0.0.20
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 +52 -10
- package/dist/bin/index.mjs +1 -1
- package/dist/{cli-0CZLDTFP.mjs → cli-CGvIT3NA.mjs} +43 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +4 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -24,12 +24,14 @@ While `alint` is inspired by `eslint`, we expect the concept that `alint` brings
|
|
|
24
24
|
|
|
25
25
|
### Prerequisites
|
|
26
26
|
|
|
27
|
-
`alint` is published as ESM packages and
|
|
27
|
+
`alint` is written in TypeScript and published as ESM packages for JavaScript and TypeScript projects. Release builds also include standalone binaries, so teams working in Python, Go, Rust, and other non-Node.js projects can run the CLI without setting up Node.js, npm, or pnpm.
|
|
28
28
|
|
|
29
29
|
You also need at least one OpenAI-compatible model provider. Local providers such as Ollama and LM Studio work well for repeated lint runs because they keep token cost predictable.
|
|
30
30
|
|
|
31
31
|
### Install the CLI
|
|
32
32
|
|
|
33
|
+
Download a standalone binary from the GitHub release assets when you want to use `alint` without a Node.js toolchain.
|
|
34
|
+
|
|
33
35
|
Install globally if you want an `alint` command available everywhere:
|
|
34
36
|
|
|
35
37
|
```bash
|
|
@@ -40,12 +42,12 @@ pnpm add -g @alint-js/cli
|
|
|
40
42
|
Or install it in a project and run it through your package manager:
|
|
41
43
|
|
|
42
44
|
```bash
|
|
43
|
-
npm install -D @alint-js/cli
|
|
45
|
+
npm install -D @alint-js/cli
|
|
44
46
|
npx alint src
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
```bash
|
|
48
|
-
pnpm add -D @alint-js/cli
|
|
50
|
+
pnpm add -D @alint-js/cli
|
|
49
51
|
pnpm exec alint src
|
|
50
52
|
```
|
|
51
53
|
|
|
@@ -171,12 +173,12 @@ In order to provision models and LLMs for `alint` while keeping it clean for con
|
|
|
171
173
|
The priorities follow:
|
|
172
174
|
|
|
173
175
|
```text
|
|
174
|
-
~/.config/alint/config.toml < .alint/config.toml < alint.config
|
|
176
|
+
~/.config/alint/config.toml < .alint/config.toml < alint.config.* < environment and CLI overrides
|
|
175
177
|
```
|
|
176
178
|
|
|
177
179
|
- `~/.config/alint/config.toml` stores user-level provider setup.
|
|
178
180
|
- `.alint/config.toml` stores optional project-local provider setup.
|
|
179
|
-
- `alint.config
|
|
181
|
+
- `alint.config.*` stores project lint config, plugins, files, ignores, and rule settings.
|
|
180
182
|
- Environment variables and CLI flags are the highest-priority overrides.
|
|
181
183
|
|
|
182
184
|
Use setup TOML for machine or project provider definitions:
|
|
@@ -216,7 +218,7 @@ alint setup -N \
|
|
|
216
218
|
Similar to `eslint`, use `alint.config.ts` for files, ignores, plugins, and rules:
|
|
217
219
|
|
|
218
220
|
```ts
|
|
219
|
-
import { defineConfig } from '@alint-js/
|
|
221
|
+
import { defineConfig } from '@alint-js/cli'
|
|
220
222
|
import { examplePlugin } from '@alint-js/plugin-example'
|
|
221
223
|
|
|
222
224
|
export default defineConfig([
|
|
@@ -240,6 +242,46 @@ export default defineConfig([
|
|
|
240
242
|
])
|
|
241
243
|
```
|
|
242
244
|
|
|
245
|
+
#### Executable and static configs
|
|
246
|
+
|
|
247
|
+
`alint` supports executable configs (`.js`, `.ts`, `.mjs`, `.cjs`, `.mts`, and `.cts`) and data-only static configs (`.toml`, `.yaml`, `.yml`, `.json`, `.jsonc`, and `.json5`).
|
|
248
|
+
|
|
249
|
+
- Executable configs export a flat config array and can import plugin definitions directly.
|
|
250
|
+
- Static configs use a `config.group` array and identify plugin sources with strings. They are useful for Python, Rust, Go, and other repositories that do not want to author a JavaScript config file or install a Node.js package manager just to run `alint`.
|
|
251
|
+
|
|
252
|
+
For example, a TOML static config can install an exact remote package or a local plugin directory:
|
|
253
|
+
|
|
254
|
+
```toml
|
|
255
|
+
[[config.group]]
|
|
256
|
+
|
|
257
|
+
[config.group.plugins]
|
|
258
|
+
plugin_1 = "@scope/alint-plugin-example1@1.2.3" # package
|
|
259
|
+
plugin_2 = "./plugins/relative-plugin-examplex" # relative directory
|
|
260
|
+
plugin_3 = "/opt/alint/plugins/absolute-plugin" # absolute directory
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Relative plugin paths are resolved from the directory containing the config file, including when `--config` points to a nested config. On Windows, use TOML literal strings to preserve native backslashes:
|
|
264
|
+
|
|
265
|
+
```toml
|
|
266
|
+
[[config.group]]
|
|
267
|
+
|
|
268
|
+
[config.group.plugins]
|
|
269
|
+
native = 'C:\alint\plugins\native-plugin'
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Use `alint plugin install` after adding or changing plugin sources.
|
|
273
|
+
|
|
274
|
+
- **Package:** `@scope/alint-plugin-example1@1.2.3` downloads that exact version into `.alint/plugins/store`, verifies its integrity, and loads its root export.
|
|
275
|
+
- **Local:** `./plugins/my-plugin` or an absolute directory loads the current package root export in place. `alint` checks that the package and entry exist and that the entry stays inside the package directory. It does not build the plugin or install the plugin's dependencies.
|
|
276
|
+
|
|
277
|
+
Run the install command again after changing a source string, moving a local directory, or changing its symlink target. Changes inside the same local directory are loaded by the next CLI process without reinstalling.
|
|
278
|
+
|
|
279
|
+
Local plugins execute as trusted Node.js code. Directory containment checks validate the installed source; they are not a sandbox.
|
|
280
|
+
|
|
281
|
+
#### Plugin lockfile
|
|
282
|
+
|
|
283
|
+
`alint plugin install` writes `.alint/plugins/lock.json`. Package entries lock the downloaded package and integrity metadata. Local entries lock the physical directory identity while loading its current contents at runtime.
|
|
284
|
+
|
|
243
285
|
Rule severities follow the familiar lint convention:
|
|
244
286
|
|
|
245
287
|
- `"off"` or `0` disables a rule.
|
|
@@ -251,7 +293,7 @@ Flat configs can analyze non-JavaScript files by selecting `text/plain`:
|
|
|
251
293
|
```ts
|
|
252
294
|
import docsPlugin from '@your-alint-config/docs-rules'
|
|
253
295
|
|
|
254
|
-
import { defineConfig } from '@alint-js/
|
|
296
|
+
import { defineConfig } from '@alint-js/cli'
|
|
255
297
|
|
|
256
298
|
export default defineConfig([
|
|
257
299
|
{
|
|
@@ -401,9 +443,9 @@ defineRule({
|
|
|
401
443
|
|
|
402
444
|
| Package | Purpose |
|
|
403
445
|
| --- | --- |
|
|
404
|
-
| [`@alint-js/cli`](https://github.com/moeru-ai/alint/tree/main/packages/cli) | CLI entrypoint, setup commands, reporters, output inspection, and stats commands. |
|
|
405
|
-
| [`@alint-js/config`](https://github.com/moeru-ai/alint/tree/main/packages/config) |
|
|
406
|
-
| [`@alint-js/core`](https://github.com/moeru-ai/alint/tree/main/packages/core) |
|
|
446
|
+
| [`@alint-js/cli`](https://github.com/moeru-ai/alint/tree/main/packages/cli) | CLI entrypoint, user-facing config facade, setup commands, reporters, output inspection, and stats commands. |
|
|
447
|
+
| [`@alint-js/config`](https://github.com/moeru-ai/alint/tree/main/packages/config) | Lower-level config loading, setup TOML parsing, config paths, and ignore defaults for tools. |
|
|
448
|
+
| [`@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. |
|
|
407
449
|
| [`@alint-js/agent-apeira`](https://github.com/moeru-ai/alint/tree/main/packages/agent-apeira) | Apeira-backed `AgentAdapter`. |
|
|
408
450
|
| [`@alint-js/agent-pi`](https://github.com/moeru-ai/alint/tree/main/packages/agent-pi) | Pi-backed `AgentAdapter`. |
|
|
409
451
|
| [`@alint-js/plugin-example`](https://github.com/moeru-ai/alint/tree/main/packages/plugin-example) | Example TypeScript/JavaScript model-backed rules. |
|
package/dist/bin/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
2
|
import { inspect } from "node:util";
|
|
3
3
|
import { cac } from "cac";
|
|
4
|
-
import { getGlobalSetupConfigPath, getProjectSetupConfigPath, getStatsDir, loadAlintConfig, loadSetupConfig, mergeSetupConfigs, writeSetupConfig } from "@alint-js/config";
|
|
4
|
+
import { getGlobalSetupConfigPath, getProjectSetupConfigPath, getStatsDir, installStaticPlugins, loadAlintConfig, loadSetupConfig, mergeSetupConfigs, writeSetupConfig } from "@alint-js/config";
|
|
5
5
|
import { AlintRunError, hasDiscoveryFilePatterns, matchesDiscoveryFile, normalizeConfig, resolveConfigForFile, runAlint } from "@alint-js/core";
|
|
6
6
|
import { isAbsolute, join, relative, resolve } from "pathe";
|
|
7
7
|
import { getBorderCharacters, table } from "table";
|
|
@@ -14,7 +14,7 @@ import Gitignore from "gitignore-fs";
|
|
|
14
14
|
import { Minimatch, minimatch } from "minimatch";
|
|
15
15
|
import { errorMessageFrom as errorMessageFrom$1 } from "@moeru/std";
|
|
16
16
|
//#region package.json
|
|
17
|
-
var version = "0.0.
|
|
17
|
+
var version = "0.0.20";
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/cli/commands/command.ts
|
|
20
20
|
function defineCommand(node) {
|
|
@@ -1639,6 +1639,46 @@ const output = defineCommand({
|
|
|
1639
1639
|
name: "output"
|
|
1640
1640
|
});
|
|
1641
1641
|
//#endregion
|
|
1642
|
+
//#region src/cli/commands/plugin/index.ts
|
|
1643
|
+
const plugin = defineCommand({
|
|
1644
|
+
children: [defineCommand({
|
|
1645
|
+
action: async (context, options) => {
|
|
1646
|
+
const result = await installStaticPlugins({
|
|
1647
|
+
configFile: options.config,
|
|
1648
|
+
cwd: context.io.cwd,
|
|
1649
|
+
registry: options.registry
|
|
1650
|
+
});
|
|
1651
|
+
if (result.configuredPluginCount === 0) {
|
|
1652
|
+
context.io.stdout.write("No static plugins configured. Wrote empty plugin lock.\n");
|
|
1653
|
+
return 0;
|
|
1654
|
+
}
|
|
1655
|
+
context.io.stdout.write(`Installed packages: ${result.installedPackageCount}, local directories: ${result.installedLocalDirectoryCount}.\n`);
|
|
1656
|
+
return 0;
|
|
1657
|
+
},
|
|
1658
|
+
description: "Install plugins from static configs",
|
|
1659
|
+
examples: [
|
|
1660
|
+
["# Install plugins referenced by static configs", "alint plugin install"].join("\n"),
|
|
1661
|
+
["# Install using a custom registry", "alint plugin install --registry https://registry.npmjs.org/"].join("\n"),
|
|
1662
|
+
["# Install a local directory configured as ./plugins/local-plugin", "alint plugin install"].join("\n")
|
|
1663
|
+
],
|
|
1664
|
+
help: ["Install remote packages or local directories from static configs.", "Remote packages are extracted into the project plugin store. Local directories are installed in place. Both are recorded in `.alint/plugins/lock.json`."].join("\n\n"),
|
|
1665
|
+
name: "install",
|
|
1666
|
+
options: [{
|
|
1667
|
+
description: "Npm registry URL",
|
|
1668
|
+
flags: "--registry <url>"
|
|
1669
|
+
}]
|
|
1670
|
+
})],
|
|
1671
|
+
description: "Install remote packages or local directories from static configs",
|
|
1672
|
+
examples: [["# Install remote packages or local directories from static configs", "alint plugin install"].join("\n"), [
|
|
1673
|
+
"# Install a local plugin directory from alint.config.toml",
|
|
1674
|
+
"[[config.group]]",
|
|
1675
|
+
"[config.group.plugins]",
|
|
1676
|
+
"local = \"./plugins/local-plugin\""
|
|
1677
|
+
].join("\n")],
|
|
1678
|
+
help: ["Install remote packages or local directories from static configs.", "Use `plugin install` after adding or changing plugin sources."].join("\n\n"),
|
|
1679
|
+
name: "plugin"
|
|
1680
|
+
});
|
|
1681
|
+
//#endregion
|
|
1642
1682
|
//#region src/cli/commands/setup/interactive.ts
|
|
1643
1683
|
const nonTtyMessage = "interactive setup requires a TTY. Use -N/--no-interactive with --provider-id and --provider-endpoint.\n";
|
|
1644
1684
|
const backValue = "__alint_back__";
|
|
@@ -2052,6 +2092,7 @@ function statsLocation(stats) {
|
|
|
2052
2092
|
const commandTree = [
|
|
2053
2093
|
setup,
|
|
2054
2094
|
config,
|
|
2095
|
+
plugin,
|
|
2055
2096
|
output,
|
|
2056
2097
|
defineCommand({
|
|
2057
2098
|
action: (context, options) => runStatsCommand(options, context.io),
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ignorePatternsAIAgents, ignorePatternsBuildOutputs, ignorePatternsCaches, ignorePatternsCommon, ignorePatternsEslintDefaults, ignorePatternsGenerated } from "@alint-js/config";
|
|
2
|
+
import { AlintConfig, AlintConfigItem, Diagnostic, RunResult, RunnerConfig, defineConfig } from "@alint-js/core";
|
|
2
3
|
|
|
3
4
|
//#region src/cli/types.d.ts
|
|
4
5
|
interface CliIo {
|
|
@@ -35,4 +36,4 @@ interface StylishReporterOptions {
|
|
|
35
36
|
}
|
|
36
37
|
declare function formatStylish(input: Diagnostic[] | RunResult, options?: StylishReporterOptions): string;
|
|
37
38
|
//#endregion
|
|
38
|
-
export { type CliIo, type ReporterName, executeCli, formatDiagnostics, formatJson, formatStylish };
|
|
39
|
+
export { type AlintConfig, type AlintConfigItem, type CliIo, type ReporterName, type RunnerConfig, defineConfig, executeCli, formatDiagnostics, formatJson, formatStylish, ignorePatternsAIAgents, ignorePatternsBuildOutputs, ignorePatternsCaches, ignorePatternsCommon, ignorePatternsEslintDefaults, ignorePatternsGenerated };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { i as formatJson, n as formatDiagnostics, r as formatStylish, t as executeCli } from "./cli-
|
|
2
|
-
|
|
1
|
+
import { i as formatJson, n as formatDiagnostics, r as formatStylish, t as executeCli } from "./cli-CGvIT3NA.mjs";
|
|
2
|
+
import { ignorePatternsAIAgents, ignorePatternsBuildOutputs, ignorePatternsCaches, ignorePatternsCommon, ignorePatternsEslintDefaults, ignorePatternsGenerated } from "@alint-js/config";
|
|
3
|
+
import { defineConfig } from "@alint-js/core";
|
|
4
|
+
export { defineConfig, executeCli, formatDiagnostics, formatJson, formatStylish, ignorePatternsAIAgents, ignorePatternsBuildOutputs, ignorePatternsCaches, ignorePatternsCommon, ignorePatternsEslintDefaults, ignorePatternsGenerated };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alint-js/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.20",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"pathe": "^2.0.3",
|
|
26
26
|
"table": "^6.9.0",
|
|
27
27
|
"tinyrainbow": "^3.1.0",
|
|
28
|
-
"@alint-js/
|
|
29
|
-
"@alint-js/
|
|
28
|
+
"@alint-js/core": "0.0.20",
|
|
29
|
+
"@alint-js/config": "0.0.20"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@pnpm/find-workspace-dir": "^1000.1.5",
|