nanos-lint 3.2.1 → 3.4.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 +117 -19
- package/action.yml +28 -1
- package/dist/{cli-I16SeKRK.js → cli-DN7ZhC9e.js} +301 -98
- package/dist/cli-DN7ZhC9e.js.map +1 -0
- package/dist/cli-dxsaVVVq.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/cli-I16SeKRK.js.map +0 -1
package/README.md
CHANGED
|
@@ -73,6 +73,23 @@ To pre-populate all required assets (both LuaLS binary and nanos world annotatio
|
|
|
73
73
|
npx nanos-lint warmup
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
Offline execution uses only local dependencies and skips all nanos-lint network requests:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
nanos-lint warmup # provision online
|
|
80
|
+
nanos-lint check Packages/events --offline
|
|
81
|
+
npx --offline nanos-lint check Packages/events --offline
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For `latest`, offline mode selects the highest usable cached version (numeric tag order)
|
|
85
|
+
and reports it, then tries a bundled binary or PATH. `LUALS_BIN` overrides discovery.
|
|
86
|
+
Pinned versions require a matching cache or local executable. Custom annotations
|
|
87
|
+
(`--annotations` or `NANOS_ANNOTATIONS_PATH`), bundled annotations, and valid stale
|
|
88
|
+
cached annotations work offline. `warmup --offline` verifies local assets without
|
|
89
|
+
downloading them. Missing assets fail with provisioning instructions.
|
|
90
|
+
The flag controls nanos-lint; npm/npx may access the registry before it starts. Use
|
|
91
|
+
a preinstalled executable or npm's own `--offline` with an already cached package.
|
|
92
|
+
|
|
76
93
|
---
|
|
77
94
|
|
|
78
95
|
## GitHub Actions Integration
|
|
@@ -104,20 +121,23 @@ jobs:
|
|
|
104
121
|
|
|
105
122
|
### Action Inputs
|
|
106
123
|
|
|
107
|
-
| Input
|
|
108
|
-
|
|
|
109
|
-
| `path`
|
|
110
|
-
| `paths`
|
|
111
|
-
| `dep`
|
|
112
|
-
| `checklevel`
|
|
113
|
-
| `config`
|
|
114
|
-
| `annotations`
|
|
115
|
-
| `ignore`
|
|
116
|
-
| `luals-version`
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
124
|
+
| Input | Description | Default |
|
|
125
|
+
| :---------------- | :------------------------------------------------------------------------------------ | :-------- |
|
|
126
|
+
| `path` | Path to workspace directory or Lua file to check | `.` |
|
|
127
|
+
| `paths` | One or more workspace target paths or Lua files to check (newline or comma-separated) | `""` |
|
|
128
|
+
| `dep` | External package dependency paths or definition files (newline or comma-separated) | `""` |
|
|
129
|
+
| `checklevel` | Minimum severity to report (`Error`, `Warning`, `Information`, `Hint`) | `Warning` |
|
|
130
|
+
| `config` | Path to a custom `.luarc.json` configuration file | `""` |
|
|
131
|
+
| `annotations` | Path to a custom `annotations.lua` file | `""` |
|
|
132
|
+
| `ignore` | Files or directories to ignore (supports glob patterns, newline or comma separated) | `""` |
|
|
133
|
+
| `luals-version` | Version of `lua-language-server` to use | `latest` |
|
|
134
|
+
| `baseline` | Accepted diagnostic baseline; only new diagnostics fail | `""` |
|
|
135
|
+
| `write-baseline` | Record current diagnostics and exit successfully | `""` |
|
|
136
|
+
| `baseline-strict` | Also fail when baseline entries disappear (requires `baseline`) | `false` |
|
|
137
|
+
| `fail-on-error` | Fail the workflow step if diagnostics are found | `true` |
|
|
138
|
+
| `log-level` | Logging level (`error`, `warn`, `info`, `debug`, `silent`) | `warn` |
|
|
139
|
+
| `realm` | Execution realm to check (`all`, `client`, `server`, `shared`) | `all` |
|
|
140
|
+
| `cache` | Whether to cache the LuaLS binary and annotations across workflow runs | `true` |
|
|
121
141
|
|
|
122
142
|
`paths` takes precedence over `path` when both are set; `path` is kept for backwards compatibility with the single-target form.
|
|
123
143
|
|
|
@@ -134,7 +154,8 @@ nanos-lint [command] [options] [paths...]
|
|
|
134
154
|
|
|
135
155
|
COMMANDS:
|
|
136
156
|
check [paths...] Check workspace files or directories (default)
|
|
137
|
-
init [path] Scaffold a .luarc.json configuration in the workspace (
|
|
157
|
+
init [path] Scaffold a .luarc.json configuration in the workspace (supports --vendor, --force)
|
|
158
|
+
copy-annotations [dest] Copy cached annotations.lua definitions into a target file or directory (alias: export-annotations; targets not ending in .lua are treated as directories)
|
|
138
159
|
warmup, download Pre-fetch and cache both LuaLS binary and annotations for offline execution
|
|
139
160
|
cache status, cache info Show cache status, installed versions, and disk usage (supports --json)
|
|
140
161
|
cache clean Clear the nanos-lint cache directory
|
|
@@ -153,14 +174,56 @@ OPTIONS:
|
|
|
153
174
|
debug adds diagnostic tracing
|
|
154
175
|
--checklevel=<level> Minimum diagnostic level: Error, Warning, Information, Hint (default: Warning)
|
|
155
176
|
--config=<path> Path to custom .luarc.json configuration file
|
|
156
|
-
--annotations=<path> Path to custom annotations.lua file (applies to
|
|
177
|
+
--annotations=<path> Path to custom annotations.lua file (applies to check, init --vendor, and copy-annotations)
|
|
157
178
|
--format=<format> Output format: pretty, json, github (default: pretty)
|
|
158
179
|
--github Output in GitHub Actions format (shortcut for --format=github)
|
|
159
180
|
--luals-version=<ver> Version of LuaLS to use (default: latest, falling back to 3.19.1 when offline)
|
|
181
|
+
--baseline <path> Report and fail only on new diagnostics
|
|
182
|
+
--write-baseline <path> Record diagnostics and exit 0
|
|
183
|
+
--baseline-strict Also fail on stale entries (requires --baseline)
|
|
160
184
|
--no-fail Do not exit with code 1 if diagnostics are found
|
|
161
185
|
--realm <realm> Execution realm to check: all, client, server, shared (default: all)
|
|
186
|
+
--offline Use local dependencies only; never access the network
|
|
162
187
|
--no-progress Disable the interactive download, extraction and realm derivation progress display
|
|
163
|
-
-
|
|
188
|
+
-t, --template <path> (init command only) Use a custom JSONC scaffold template
|
|
189
|
+
--vendor (init command only) Vendor annotations.lua into .nanos-lint/ inside workspace
|
|
190
|
+
-f, --force (init and copy-annotations only) Overwrite existing files
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Diagnostic Baselines
|
|
194
|
+
|
|
195
|
+
Use a diagnostic baseline to accept an existing backlog and fail on new problems:
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
nanos-lint check . --write-baseline .nanos-lint/baseline.json
|
|
199
|
+
nanos-lint check . --baseline .nanos-lint/baseline.json
|
|
200
|
+
nanos-lint check . --baseline .nanos-lint/baseline.json --baseline-strict
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Recording writes all reported diagnostics in a deterministic versioned JSON file,
|
|
204
|
+
creates parent directories, and exits 0 (also with `--no-fail`). Comparison shows
|
|
205
|
+
only new diagnostics with a summary such as `12 new, 154 baselined, 166 total`.
|
|
206
|
+
JSON output retains every diagnostic and adds `baseline: true|false` plus
|
|
207
|
+
`baselineSummary` counts. GitHub annotations are emitted only for new diagnostics.
|
|
208
|
+
|
|
209
|
+
Matches use paths relative to the checked root, diagnostic code, whitespace-normalized
|
|
210
|
+
message, severity, and occurrence counts. Line changes preserve matches; additional
|
|
211
|
+
occurrences or severity changes are new problems. Removed occurrences are stale and
|
|
212
|
+
only fail with `--baseline-strict`. `--no-fail` suppresses diagnostic failure, including
|
|
213
|
+
strict staleness; invalid baseline files still fail. Missing, invalid, or incompatible
|
|
214
|
+
files require regeneration with `--write-baseline`. Recording and comparison are
|
|
215
|
+
mutually exclusive. Keep targets, realm, check level, configuration, and LuaLS version
|
|
216
|
+
consistent between runs; pin `--luals-version` to avoid diagnostic changes from upgrades.
|
|
217
|
+
Relative baseline paths are resolved from the working directory.
|
|
218
|
+
|
|
219
|
+
The GitHub Action exposes the same options as `baseline`, `write-baseline`, and
|
|
220
|
+
`baseline-strict` inputs:
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
- uses: vugi99/nanos-lint@v3
|
|
224
|
+
with:
|
|
225
|
+
baseline: .nanos-lint/baseline.json
|
|
226
|
+
baseline-strict: "false"
|
|
164
227
|
```
|
|
165
228
|
|
|
166
229
|
### Progress Display
|
|
@@ -223,7 +286,7 @@ If your project already has a `.luarc.json`, `nanos-lint` automatically merges i
|
|
|
223
286
|
}
|
|
224
287
|
```
|
|
225
288
|
|
|
226
|
-
To scaffold a
|
|
289
|
+
To scaffold a `.luarc.json` configuration in your project:
|
|
227
290
|
|
|
228
291
|
```bash
|
|
229
292
|
npx nanos-lint init
|
|
@@ -231,6 +294,41 @@ npx nanos-lint init
|
|
|
231
294
|
npx nanos-lint init --force
|
|
232
295
|
```
|
|
233
296
|
|
|
297
|
+
By default `init` writes no annotations reference at all: `workspace.library` stays empty and
|
|
298
|
+
`nanos-lint check` injects the managed cache path into its own temporary merged configuration at
|
|
299
|
+
runtime, so a later cache update is picked up without touching repository files. Editors that read
|
|
300
|
+
`.luarc.json` directly need a pinned copy, which is always an explicit opt-in:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
# Initialize with annotations vendored into .nanos-lint/ and pinned in workspace.library
|
|
304
|
+
npx nanos-lint init --vendor
|
|
305
|
+
|
|
306
|
+
# Or copy the cached annotations to a custom file, or to any target that does not end in
|
|
307
|
+
# ".lua" (treated as a directory). Copying alone does not pin anything: add the resulting
|
|
308
|
+
# path to workspace.library yourself.
|
|
309
|
+
npx nanos-lint copy-annotations
|
|
310
|
+
npx nanos-lint copy-annotations ./types
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
`copy-annotations` refuses to overwrite an existing file unless `--force` is passed.
|
|
314
|
+
|
|
315
|
+
### Custom Init Templates
|
|
316
|
+
|
|
317
|
+
Initialize packages from a shared configuration template:
|
|
318
|
+
|
|
319
|
+
```sh
|
|
320
|
+
nanos-lint init Packages/events --template tools/team-luarc.json
|
|
321
|
+
nanos-lint init Packages/events -t tools/team-luarc.json --vendor --annotations tools/annotations.lua
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
The custom JSON/JSONC file becomes the base configuration. Relative paths in its
|
|
325
|
+
settings are interpreted relative to the target workspace, so shared templates can
|
|
326
|
+
use entries such as `nanos.deps: ["../collider"]`. Custom settings and realm mappings
|
|
327
|
+
are preserved, including `{}` to disable realms. Omitted realm mappings receive
|
|
328
|
+
the conventional Server/Client/Shared defaults. Vendoring adds its annotation
|
|
329
|
+
library, ignore and exclusion entries without discarding template entries. Existing
|
|
330
|
+
`.luarc.json` files still require `--force` to overwrite.
|
|
331
|
+
|
|
234
332
|
### Realm Mapping (`nanos.realms`)
|
|
235
333
|
|
|
236
334
|
nanos world runs two isolated Lua VMs: the server executes `Server/**` + `Shared/**`, the client executes `Client/**` + `Shared/**`. `nanos-lint` mirrors that split and lets you describe a non-standard layout in `.luarc.json`:
|
|
@@ -369,7 +467,7 @@ npm run check:all
|
|
|
369
467
|
npm run format:check # Prettier code formatting (auto-fix via npm run format:fix)
|
|
370
468
|
npm run lint # ESLint
|
|
371
469
|
npm run lint:deps # Dependency architecture & license checks (dependency-cruiser)
|
|
372
|
-
npm run lint:comments # Comment density limit (<=
|
|
470
|
+
npm run lint:comments # Comment density limit (<= 10%)
|
|
373
471
|
npm run lint:docstrings # Docstring coverage (>= 90% top-level/exported function coverage per file in src/)
|
|
374
472
|
npm run typecheck # TypeScript typecheck
|
|
375
473
|
npm run build # Build distribution bundle
|
package/action.yml
CHANGED
|
@@ -34,6 +34,18 @@ inputs:
|
|
|
34
34
|
description: 'Version of LuaLS to use (or "latest")'
|
|
35
35
|
required: false
|
|
36
36
|
default: "latest"
|
|
37
|
+
baseline:
|
|
38
|
+
description: "Path to an accepted diagnostic baseline; only new diagnostics fail"
|
|
39
|
+
required: false
|
|
40
|
+
default: ""
|
|
41
|
+
write-baseline:
|
|
42
|
+
description: "Record current diagnostics to this baseline path and exit successfully"
|
|
43
|
+
required: false
|
|
44
|
+
default: ""
|
|
45
|
+
baseline-strict:
|
|
46
|
+
description: "Also fail on stale baseline entries (requires baseline)"
|
|
47
|
+
required: false
|
|
48
|
+
default: "false"
|
|
37
49
|
fail-on-error:
|
|
38
50
|
description: "Whether to fail the action step if diagnostic errors/warnings are found"
|
|
39
51
|
required: false
|
|
@@ -93,6 +105,9 @@ runs:
|
|
|
93
105
|
INPUT_CONFIG: ${{ inputs.config }}
|
|
94
106
|
INPUT_ANNOTATIONS: ${{ inputs.annotations }}
|
|
95
107
|
INPUT_LUALS_VERSION: ${{ inputs.luals-version }}
|
|
108
|
+
INPUT_BASELINE: ${{ inputs.baseline }}
|
|
109
|
+
INPUT_WRITE_BASELINE: ${{ inputs.write-baseline }}
|
|
110
|
+
INPUT_BASELINE_STRICT: ${{ inputs.baseline-strict }}
|
|
96
111
|
INPUT_FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
|
|
97
112
|
INPUT_LOG_LEVEL: ${{ inputs.log-level }}
|
|
98
113
|
INPUT_REALM: ${{ inputs.realm }}
|
|
@@ -153,6 +168,18 @@ runs:
|
|
|
153
168
|
done <<< "$INPUT_IGNORE"
|
|
154
169
|
fi
|
|
155
170
|
|
|
171
|
+
if [ -n "$INPUT_BASELINE" ]; then
|
|
172
|
+
ARGS+=("--baseline=$INPUT_BASELINE")
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
if [ -n "$INPUT_WRITE_BASELINE" ]; then
|
|
176
|
+
ARGS+=("--write-baseline=$INPUT_WRITE_BASELINE")
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
if [ "$INPUT_BASELINE_STRICT" = "true" ]; then
|
|
180
|
+
ARGS+=("--baseline-strict")
|
|
181
|
+
fi
|
|
182
|
+
|
|
156
183
|
if [ "$INPUT_FAIL_ON_ERROR" = "false" ]; then
|
|
157
184
|
ARGS+=("--no-fail")
|
|
158
185
|
fi
|
|
@@ -172,5 +199,5 @@ runs:
|
|
|
172
199
|
else
|
|
173
200
|
# Exact version: a range could run a different release than the pinned
|
|
174
201
|
# tag. Bump together with "version" in package.json.
|
|
175
|
-
npx --yes nanos-lint@3.
|
|
202
|
+
npx --yes nanos-lint@3.4.0 "${ARGS[@]}"
|
|
176
203
|
fi
|