@hublo/sentinel 1.5.0-alpha.36 → 1.5.0-alpha.37
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 +8 -7
- package/dist/bin/sentinel.js +1 -1
- package/dist/{chunk-5HM2TYYC.js → chunk-HLRY2VHZ.js} +10 -1
- package/dist/index.js +1 -1
- package/docs/using-sentinel.md +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,20 +171,21 @@ throwaway run wants. Once a module has adopted, nothing is fetched any more: the
|
|
|
171
171
|
- [`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.
|
|
172
172
|
- [`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.
|
|
173
173
|
- [`docs/test-adoption.md`](docs/test-adoption.md) — migrating a module from jest to Vitest: the two steps, what the migration rewrites and what it refuses BY NAME, how the baseline gate proves nothing was lost, and the failures worth recognising.
|
|
174
|
-
- [`docs/static-analysis-adoption.md`](docs/static-analysis-adoption.md) — running the static analysis role on a module: the two steps, the
|
|
174
|
+
- [`docs/static-analysis-adoption.md`](docs/static-analysis-adoption.md) — running the static analysis role on a module: the two steps, the four output shapes, how to read each row and where its threshold comes from, declaring an entry point, and the two limits worth knowing before trusting a number.
|
|
175
175
|
- [`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`.
|
|
176
176
|
|
|
177
177
|
## Architecture: `target → runner → preset`
|
|
178
178
|
|
|
179
179
|
Every check is described by three layers:
|
|
180
180
|
|
|
181
|
-
| Layer | Flag | What it is
|
|
182
|
-
| -------------------- | --------------------------- |
|
|
183
|
-
| **target** (role) | `--lint`, `--typescript`, … | the _kind_ of check, stable
|
|
184
|
-
| **runner** (adapter) | `--runner=<tool>` | the _tool_ behind the target, swappable
|
|
185
|
-
| **
|
|
181
|
+
| Layer | Flag | What it is | Examples |
|
|
182
|
+
| -------------------- | --------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
183
|
+
| **target** (role) | `--lint`, `--typescript`, … | the _kind_ of check, stable | `lint` `format` `typescript` `build` `dev` `test` `static-analysis` `runtime-analysis` |
|
|
184
|
+
| **runner** (adapter) | `--runner=<tool>` | the _tool_ behind the target, swappable | lint: `eslint`/`biome`/`oxlint` · types: `tsc`/`tsgo` · build: `vite` · test: `vitest` |
|
|
185
|
+
| **shape** (output) | `--output=<shape>` | what a reporting role WRITES, not what it measures | `console` (default, writes nothing) `html` `json` `markdown`; roles that do not report ignore it |
|
|
186
|
+
| **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) |
|
|
186
187
|
|
|
187
|
-
A run is `target × runner × preset`, e.g. `sentinel --run --lint --runner=eslint` from the `host-admin` dir.
|
|
188
|
+
A run is `target × runner × preset`, e.g. `sentinel --run --lint --runner=eslint` from the `host-admin` dir. The shape is not part of that identity: it decides what the run WRITES, not what it does.
|
|
188
189
|
|
|
189
190
|
- `--runner` is an **optional override on a central default**. `sentinel --lint` uses the configured default runner, so swapping a tool globally is a one-place change; `--runner=biome` overrides for a single run (great for benchmarking eslint vs biome vs oxlint, and for gradual migration).
|
|
190
191
|
- The **preset is detected** from the module's dependencies (deterministic: a framework dep → its preset, else `node`), and **`--preset` overrides it**. Detection can be wrong where deps are hoisted at the repo root (it returns `node`), so pass `--preset` for `--init` (that is where the preset is chosen). `--run`/`--report` don't depend on it, they run the tool on the committed config.
|
package/dist/bin/sentinel.js
CHANGED
|
@@ -5692,10 +5692,19 @@ async function loadStaticConfig(cwd) {
|
|
|
5692
5692
|
return {
|
|
5693
5693
|
config: defineStaticAnalysis(),
|
|
5694
5694
|
from: null,
|
|
5695
|
-
unreadable: `${STATIC_CONFIG_FILE}: ${
|
|
5695
|
+
unreadable: `${STATIC_CONFIG_FILE}: ${explainUnreadableConfig(error)}`
|
|
5696
5696
|
};
|
|
5697
5697
|
}
|
|
5698
5698
|
}
|
|
5699
|
+
function explainUnreadableConfig(error) {
|
|
5700
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5701
|
+
const code = error.code;
|
|
5702
|
+
if (code !== "ERR_PACKAGE_PATH_NOT_EXPORTED" || !message.includes("@hublo/sentinel")) {
|
|
5703
|
+
return message;
|
|
5704
|
+
}
|
|
5705
|
+
return `${message}
|
|
5706
|
+
The @hublo/sentinel installed in this module does not ship the static-analysis role yet. Bump it to a release that does, then run this again. Until then the role runs on its defaults and this file is ignored, which is why it is reported rather than silently skipped.`;
|
|
5707
|
+
}
|
|
5699
5708
|
function adopt(exported) {
|
|
5700
5709
|
if (exported === null || typeof exported !== "object") return defineStaticAnalysis();
|
|
5701
5710
|
if (Array.isArray(exported.moved)) {
|
package/dist/index.js
CHANGED
package/docs/using-sentinel.md
CHANGED
|
@@ -36,6 +36,12 @@ everywhere (`--run --json` and `--inspect` answer them), and `--migrate` is refu
|
|
|
36
36
|
`--json` works for every verb, and stdout carries **only** the envelope, so `| jq` always
|
|
37
37
|
parses. `--dry-run` applies to `--init` and writes nothing.
|
|
38
38
|
|
|
39
|
+
`--output <shape>` is different, and only a role that WRITES a report reads it: `console` is the
|
|
40
|
+
default and writes no file, `html` is the page you open and send, `json` is for CI and for a
|
|
41
|
+
script, `markdown` is the six lines a workflow posts on a pull request. Today `--static-analysis`
|
|
42
|
+
is the role that has them. ⚠️ `--output html` pays a graph layout the other three skip, which is
|
|
43
|
+
fine for a page somebody opens and wrong for a commit hook.
|
|
44
|
+
|
|
39
45
|
**`--validate` is a verb of its own**, and the proof of a migration lives there rather than on
|
|
40
46
|
`--init` or `--run`. Run before a migration it records what the module does today; run after, it
|
|
41
47
|
compares by test NAME and refuses a run that lost one or invented one. What separates it from
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hublo/sentinel",
|
|
3
|
-
"version": "1.5.0-alpha.
|
|
3
|
+
"version": "1.5.0-alpha.37",
|
|
4
4
|
"description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|