@ai-ecoverse/biome-jsh 5.66.0 → 5.67.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
@@ -34,14 +34,16 @@ path); this CLI is the binary path.
34
34
 
35
35
  ```sh
36
36
  biome-jsh check [paths...] # lint + format-check (github reporter)
37
+ biome-jsh lint [paths...] # lint only, no format-check
37
38
  biome-jsh format [paths...] # print formatted output to stdout
38
39
  biome-jsh format --write [paths...] # format files in place
39
40
  ```
40
41
 
41
42
  Paths may be files or directories (walked recursively; `node_modules` and
42
43
  `.git` skipped). `check` exits non-zero when any file has an error or is not
43
- formatted, and emits GitHub Actions annotations on stdout so CI surfaces them
44
- inline.
44
+ formatted; `lint` skips the format-check (useful for repos that don't enforce
45
+ formatting on legacy files). Both emit GitHub Actions annotations on stdout so
46
+ CI surfaces them inline.
45
47
 
46
48
  ```sh
47
49
  biome-jsh check skills/
package/biome-jsh.mjs CHANGED
@@ -52,6 +52,7 @@ const HELP = `biome-jsh - a jsh-aware Biome runner
52
52
 
53
53
  Usage:
54
54
  biome-jsh check [paths...] Lint + format-check (--reporter=github)
55
+ biome-jsh lint [paths...] Lint only, no format-check (--reporter=github)
55
56
  biome-jsh format [paths...] Print formatted output to stdout
56
57
  biome-jsh format --write [paths...] Format files in place
57
58
 
@@ -99,7 +100,7 @@ function parseArgs(argv) {
99
100
  if (arg === '-h' || arg === '--help') parsed.help = true;
100
101
  else if (arg === '-v' || arg === '--version') parsed.version = true;
101
102
  else if (arg === '--write') parsed.write = true;
102
- else if (parsed.subcommand === null && (arg === 'check' || arg === 'format'))
103
+ else if (parsed.subcommand === null && (arg === 'check' || arg === 'lint' || arg === 'format'))
103
104
  parsed.subcommand = arg;
104
105
  else if (arg.startsWith('-')) fail(`unknown option: ${arg}`);
105
106
  else parsed.paths.push(arg);
@@ -155,7 +156,7 @@ function formatWrapped(bin, source, dir, tempBase, tempPath) {
155
156
  return { safe, changed: safe !== source, failed: false };
156
157
  }
157
158
 
158
- function processWrappedCheck(bin, file) {
159
+ function processWrappedLint(bin, file) {
159
160
  const dir = dirname(file);
160
161
  const source = readFileSync(file, 'utf8');
161
162
  const tempBase = tempName(file);
@@ -173,6 +174,19 @@ function processWrappedCheck(bin, file) {
173
174
  out.errorCount++;
174
175
  out.lines.push(makeStderrLines(lint.stderr));
175
176
  }
177
+ } finally {
178
+ safeUnlink(tempPath);
179
+ }
180
+ return out;
181
+ }
182
+
183
+ function processWrappedCheck(bin, file) {
184
+ const out = processWrappedLint(bin, file);
185
+ const dir = dirname(file);
186
+ const source = readFileSync(file, 'utf8');
187
+ const tempBase = tempName(file);
188
+ const tempPath = join(dir, tempBase);
189
+ try {
176
190
  const fmt = formatWrapped(bin, source, dir, tempBase, tempPath);
177
191
  if (fmt.failed) {
178
192
  out.lines.push(
@@ -226,6 +240,17 @@ function processPlainCheck(bin, file) {
226
240
  return remapped;
227
241
  }
228
242
 
243
+ function processPlainLint(bin, file) {
244
+ const dir = dirname(file);
245
+ const result = runBiome(bin, ['lint', '--reporter=github', basename(file)], dir);
246
+ const remapped = remapGithubOutput(result.stdout, file, 0);
247
+ if (result.status !== 0 && remapped.errorCount === 0 && remapped.warningCount === 0) {
248
+ remapped.errorCount++;
249
+ remapped.lines.push(makeStderrLines(result.stderr));
250
+ }
251
+ return remapped;
252
+ }
253
+
229
254
  function processPlainFormat(bin, file, write) {
230
255
  const dir = dirname(file);
231
256
  if (write) {
@@ -284,14 +309,14 @@ function fail(message) {
284
309
  process.exit(2);
285
310
  }
286
311
 
287
- function runCheck(bin, files, missing) {
312
+ // Shared reporter for `check`/`lint`: run a per-file processor, aggregate the
313
+ // github annotations + counts, and set the exit code (1 if any errors).
314
+ function runReport(bin, files, missing, wrappedFn, plainFn) {
288
315
  const outLines = [];
289
316
  let errorCount = missing.length;
290
317
  let warningCount = 0;
291
318
  for (const file of files) {
292
- const r = shouldWrapForBiome(file)
293
- ? processWrappedCheck(bin, file)
294
- : processPlainCheck(bin, file);
319
+ const r = shouldWrapForBiome(file) ? wrappedFn(bin, file) : plainFn(bin, file);
295
320
  outLines.push(...r.lines);
296
321
  errorCount += r.errorCount;
297
322
  warningCount += r.warningCount;
@@ -303,6 +328,14 @@ function runCheck(bin, files, missing) {
303
328
  process.exitCode = errorCount > 0 ? 1 : 0;
304
329
  }
305
330
 
331
+ function runCheck(bin, files, missing) {
332
+ runReport(bin, files, missing, processWrappedCheck, processPlainCheck);
333
+ }
334
+
335
+ function runLint(bin, files, missing) {
336
+ runReport(bin, files, missing, processWrappedLint, processPlainLint);
337
+ }
338
+
306
339
  function runFormat(bin, files, write, hadMissing) {
307
340
  const stdoutChunks = [];
308
341
  let failed = 0;
@@ -329,13 +362,14 @@ function main() {
329
362
  process.stdout.write(v.stdout || v.stderr);
330
363
  return;
331
364
  }
332
- if (!parsed.subcommand) fail('missing subcommand (expected check or format)');
365
+ if (!parsed.subcommand) fail('missing subcommand (expected check, lint, or format)');
333
366
  if (parsed.paths.length === 0) fail('no files or directories specified');
334
367
 
335
368
  const { files, missing } = expandPaths(parsed.paths);
336
369
  for (const m of missing) process.stderr.write(`biome-jsh: ${m}: no such file or directory\n`);
337
370
 
338
371
  if (parsed.subcommand === 'check') runCheck(bin, files, missing);
372
+ else if (parsed.subcommand === 'lint') runLint(bin, files, missing);
339
373
  else runFormat(bin, files, parsed.write, missing.length > 0);
340
374
  }
341
375
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/biome-jsh",
3
- "version": "5.66.0",
3
+ "version": "5.67.0",
4
4
  "description": "A jsh-aware Biome runner: lint/format .jsh/.bsh shell scripts (AsyncFunction bodies) without false return/await parse errors.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "bin": {
8
- "biome-jsh": "./biome-jsh.mjs"
8
+ "biome-jsh": "biome-jsh.mjs"
9
9
  },
10
10
  "main": "./lib.mjs",
11
11
  "files": [
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "https://github.com/ai-ecoverse/slicc",
25
+ "url": "git+https://github.com/ai-ecoverse/slicc.git",
26
26
  "directory": "packages/dev-tools/biome-jsh"
27
27
  },
28
28
  "publishConfig": {