@hublo/sentinel 1.2.0-alpha.0 → 1.2.0-alpha.2

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
@@ -151,7 +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
+ - [`docs/build-adoption.md`](docs/build-adoption.md) — moving a React app's Vite toolchain into sentinel: adoption changes the config's IMPORTS and nothing else, what sentinel owns versus what stays the app's, and why reading nothing is what makes losing nothing a guarantee.
155
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.
156
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`.
157
157
 
@@ -161,7 +161,7 @@ Every check is described by three layers:
161
161
 
162
162
  | Layer | Flag | What it is | Examples |
163
163
  | -------------------- | --------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
164
- | **target** (role) | `--lint`, `--typescript`, … | the _kind_ of check, stable | `lint` `format` `typescript` `build` `test` `static-analysis` `runtime-analysis` |
164
+ | **target** (role) | `--lint`, `--typescript`, … | the _kind_ of check, stable | `lint` `format` `typescript` `build` `dev` `test` `static-analysis` `runtime-analysis` |
165
165
  | **runner** (adapter) | `--runner=<tool>` | the _tool_ behind the target, swappable | lint: `eslint`/`biome`/`oxlint` · types: `tsc`/`tsgo` · build: `vite` · test: `vitest` |
166
166
  | **preset** (preset) | detected / `--preset` | the _variant_ per stack (strict by default) | `react` `nest` `node` `svelte` (svelte: lint + format; no tsconfig preset yet, so the TypeScript role stands aside on those modules and the other two adopt) |
167
167
 
@@ -1 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import '@tailwindcss/vite';
3
+ import '@vitejs/plugin-react';
4
+ import 'nitro/vite';
5
+ import 'vite-plugin-svgr';
6
+ import 'vite';
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ LONG_RUNNING_TARGETS,
3
4
  PRESET_NAMES,
4
5
  PresetUnsupportedError,
5
6
  SWEEPABLE_TARGETS,
@@ -20,8 +21,7 @@ import {
20
21
  registerAdapters,
21
22
  resolve,
22
23
  resolveBin
23
- } from "../chunk-TWL6T237.js";
24
- import "../chunk-XSCDJZDY.js";
24
+ } from "../chunk-SA2RMTVI.js";
25
25
 
26
26
  // bin/sentinel.ts
27
27
  import { program } from "commander";
@@ -463,6 +463,15 @@ async function runVerb(ctx) {
463
463
  const { modules, scope } = resolveContext(ctx.cwd, { module: ctx.module, ci: ctx.ci });
464
464
  const out = palette(process.stdout);
465
465
  const err = palette(process.stderr);
466
+ const longRunning = ctx.targets.filter((target) => LONG_RUNNING_TARGETS.includes(target));
467
+ if (longRunning.length > 0 && modules.length > 1) {
468
+ process.stderr.write(
469
+ err.fail(
470
+ `sentinel: ${longRunning.map((t) => `--${t}`).join(", ")} starts a server that does not return, so it runs against ONE module. This resolved to ${modules.length} [${scope}]. Run it from inside the module's directory, or pass --module <name>.`
471
+ ) + "\n"
472
+ );
473
+ return 1;
474
+ }
466
475
  const shaped = ctx.verb === "run" && ctx.json ? "report" : ctx.verb;
467
476
  const replacement = {
468
477
  report: "--run --json",
@@ -579,6 +588,17 @@ registerAdapters();
579
588
  var separator = process.argv.indexOf("--");
580
589
  var toolArgs = separator === -1 ? [] : process.argv.slice(separator + 1);
581
590
  var cliArgv = separator === -1 ? process.argv : process.argv.slice(0, separator);
591
+ var TARGET_HELP = {
592
+ lint: "linting",
593
+ format: "formatting",
594
+ typescript: "type checking",
595
+ build: "build",
596
+ dev: "dev server (long-running: never swept by an unqualified --run)",
597
+ test: "tests",
598
+ "static-analysis": "cycles, complexity, duplication, centrality",
599
+ "runtime-analysis": "bundle, Lighthouse, web vitals",
600
+ arch: "architecture boundaries"
601
+ };
582
602
  program.name("sentinel").description("One CLI that guards code health: presets, analysis, and arch checks.").version(readOwnVersion()).configureHelp({ sortOptions: false }).showSuggestionAfterError(true).showHelpAfterError('(run "sentinel --help" for usage)').addHelpText(
583
603
  "before",
584
604
  [
@@ -589,7 +609,7 @@ program.name("sentinel").description("One CLI that guards code health: presets,
589
609
  " --ci (affected), or all modules. --init targets one module only.",
590
610
  ""
591
611
  ].join("\n")
592
- ).option("--run", "execute the target tool").option("--inspect", "show the resolved configuration").option("--init", "set up a module: write its config stubs + the workspace prep it needs").option("--migrate", "planned: change an already-initialized setup (not available yet)").option("--report", "deprecated: use --run --json").option("--status", "deprecated: use --inspect").option("--lint", "linting").option("--format", "formatting").option("--typescript", "type checking").option("--build", "build").option("--test", "tests").option("--static-analysis", "cycles, complexity, duplication, centrality").option("--runtime-analysis", "bundle, Lighthouse, web vitals").option("--arch", "architecture boundaries").option("--all", "every target").option(
612
+ ).option("--run", "execute the target tool").option("--inspect", "show the resolved configuration").option("--init", "set up a module: write its config stubs + the workspace prep it needs").option("--migrate", "planned: change an already-initialized setup (not available yet)").option("--report", "deprecated: use --run --json").option("--status", "deprecated: use --inspect").option(
593
613
  "--module <name>",
594
614
  "from the workspace root: scope to one module (omit = all; inside a module dir, drop this)"
595
615
  ).option("--preset <name>", `the stack preset to apply (${PRESET_NAMES.join(", ")})`).option("--flavour <name>", "deprecated: use --preset").option("--runner <tool>", "override the default runner (e.g. eslint, biome)").option("--ci", "CI mode: from the root, only the affected modules; non-zero exit on failure").option("--fix", "auto-fix where applicable").option("--dry-run", "preview the changes without writing (--init)").option("--json", "machine-readable output, for every verb").option(
@@ -621,7 +641,10 @@ program.name("sentinel").description("One CLI that guards code health: presets,
621
641
  `Available now: ${available.length ? available.map((t) => `--${t}`).join(", ") : "(none yet)"}`,
622
642
  planned.length ? `Planned (ship in later tickets): ${planned.map((t) => `--${t}`).join(", ")}` : ""
623
643
  ].filter(Boolean).join("\n");
624
- }).parse(cliArgv);
644
+ });
645
+ for (const target of TARGETS) program.option(`--${target}`, TARGET_HELP[target]);
646
+ program.option("--all", "every target");
647
+ program.parse(cliArgv);
625
648
  var opts = program.opts();
626
649
  function toCamel(flag) {
627
650
  return flag.replace(/-([a-z])/g, (_, c) => c.toUpperCase());