@hublo/sentinel 1.1.6 → 1.2.0-alpha.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
@@ -43,8 +43,8 @@ A large monorepo accumulates:
43
43
 
44
44
  sentinel writes **standard config files** into a project (each just `extends` a sentinel preset) and runs the checks. Your editor and the tools read those **normal files natively**, they never call sentinel at runtime, so nothing is coupled to it or brittle.
45
45
 
46
- > **Shipped today:** the **TypeScript**, **lint** and **format** tools. The `--test` / `--build`
47
- > snippets below illustrate the end state and land with their own ticket.
46
+ > **Shipped today:** the **TypeScript**, **lint**, **format**, **build** and **dev** tools. The
47
+ > `--test` snippets below illustrate the end state and land with their own ticket.
48
48
 
49
49
  **Step 1 — put a module on sentinel** (once per module, by a dev; the files are committed). Run from the app dir; `--init` does it all, nothing is hand-edited:
50
50
 
@@ -151,6 +151,7 @@ pnpm dlx @hublo/sentinel@<exact-version> --inspect --typescript --module <name>
151
151
  - [`docs/using-sentinel.md`](docs/using-sentinel.md) — every verb for every role, scoping a run to some files, what a fully adopted module looks like, and how versions move between modules.
152
152
  - [`docs/lint-adoption.md`](docs/lint-adoption.md) — migrating a module from ESLint to Oxlint: the two steps, what `--init` writes and removes, the two react tiers, and the failures worth recognising.
153
153
  - [`docs/format-adoption.md`](docs/format-adoption.md) — migrating a module from Prettier to oxfmt: why this config is materialized rather than a stub, how a module keeps its own formatting, and what did not survive the move.
154
+ - [`docs/build-adoption.md`](docs/build-adoption.md) — moving a React app's Vite toolchain into sentinel: what the config becomes, what sentinel owns versus what stays the app's, why overriding merges instead of spreading, and why an existing config is not rewritten.
154
155
  - [`docs/typescript-adoption.md`](docs/typescript-adoption.md) — the adoption cheat sheet: the two adoption steps, the command model (verb x type x location), options, reading a report, and troubleshooting.
155
156
  - [`docs/typescript-traces.md`](docs/typescript-traces.md) — a **generated, versioned** reference of live command + output traces (every verb, option, config result and edge case) against the mock monorepo. Regenerate after CLI changes with `pnpm docs:traces`.
156
157
 
@@ -376,9 +377,9 @@ VERBS --run execute the target's tool (--json for metrics + diagnosti
376
377
  --report deprecated → --run --json
377
378
  --status deprecated → --inspect
378
379
 
379
- TYPES --lint --format --typescript --build --test
380
+ TYPES --lint --format --typescript --build --dev --test
380
381
  --static-analysis --runtime-analysis --arch
381
- (omit a type → ALL types; or --all)
382
+ (omit a type → every type that TERMINATES; --dev never sweeps)
382
383
 
383
384
  LOCATION in a MODULE dir → that module (do NOT pass --module)
384
385
  at the workspace ROOT → --module <name> (one) · --ci (affected) · else all
@@ -1,10 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  PRESET_NAMES,
4
+ PresetUnsupportedError,
5
+ SWEEPABLE_TARGETS,
4
6
  TARGETS,
5
7
  VERBS,
6
8
  WORKSPACE_ROOT_MARKER,
7
9
  availableTargets,
10
+ declaredPresetFor,
8
11
  describeFramework,
9
12
  dispatch,
10
13
  ensureWorkspacePrep,
@@ -17,7 +20,8 @@ import {
17
20
  registerAdapters,
18
21
  resolve,
19
22
  resolveBin
20
- } from "../chunk-RGIEWANO.js";
23
+ } from "../chunk-TWL6T237.js";
24
+ import "../chunk-XSCDJZDY.js";
21
25
 
22
26
  // bin/sentinel.ts
23
27
  import { program } from "commander";
@@ -145,6 +149,17 @@ async function runInit(ctx) {
145
149
  });
146
150
  worst = Math.max(worst, code);
147
151
  } catch (error) {
152
+ if (error instanceof PresetUnsupportedError) {
153
+ if (ctx.targetsExplicit) {
154
+ process.stderr.write(
155
+ `
156
+ sentinel (${type}): this module's preset is "${error.preset}", and --${type} has no adapter for it. Pass --preset if it was detected wrongly (hoisted dependencies make detection fall back to "node").
157
+ `
158
+ );
159
+ worst = Math.max(worst, 1);
160
+ }
161
+ continue;
162
+ }
148
163
  process.stderr.write(`
149
164
  sentinel (${type}): ${asMessage(error)}
150
165
  `);
@@ -197,8 +212,9 @@ async function analyse(params) {
197
212
  }
198
213
  for (const target of params.targets) {
199
214
  let adapter;
215
+ const resolutionPreset = params.preset ?? declaredPresetFor(target, module.root) ?? preset2;
200
216
  try {
201
- adapter = resolve(target, preset2, params.runner);
217
+ adapter = resolve(target, resolutionPreset, params.runner);
202
218
  } catch (error) {
203
219
  if (params.targetsExplicit) {
204
220
  const reason = error instanceof Error ? error.message : String(error);
@@ -417,7 +433,7 @@ function statusCoverage(items) {
417
433
  };
418
434
  }
419
435
  function presetShort(preset2) {
420
- return typeof preset2 === "string" ? preset2.replace("@hublo/sentinel/tsconfig/", "") : "?";
436
+ return typeof preset2 === "string" ? preset2.replace(/@hublo\/sentinel\/(typescript|tsconfig)\//, "") : "?";
421
437
  }
422
438
  function renderStatusRow(item, p) {
423
439
  if (item.status === "unsupported") return renderUnsupportedRow(item, p);
@@ -650,7 +666,7 @@ if (opts.all && namedTargets.length > 0) {
650
666
  `--all runs every target; drop the specific one(s): ${namedTargets.map((t) => `--${t}`).join(", ")}.`
651
667
  );
652
668
  }
653
- var targets = opts.all || namedTargets.length === 0 ? [...TARGETS] : namedTargets;
669
+ var targets = opts.all || namedTargets.length === 0 ? [...SWEEPABLE_TARGETS] : namedTargets;
654
670
  var targetsExplicit = !(opts.all || namedTargets.length === 0);
655
671
  var maxDiagnostics = Number(opts.maxDiagnostics);
656
672
  if (!Number.isInteger(maxDiagnostics) || maxDiagnostics < 0) {