@hublo/sentinel 1.4.0-alpha.10 → 1.4.0-alpha.11

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.
@@ -16,7 +16,7 @@ import {
16
16
  registerAdapters,
17
17
  resolve,
18
18
  resolveBin
19
- } from "../chunk-L7WS36XV.js";
19
+ } from "../chunk-2S2VYRUM.js";
20
20
  import {
21
21
  WORKSPACE_ROOT_MARKER,
22
22
  ensureWorkspacePrep,
@@ -7272,7 +7272,7 @@ function rewriteSpyInstanceType(source, program) {
7272
7272
  if (args === void 0 || args.length === 0) return;
7273
7273
  const text = (argument) => source.slice(argument.start, argument.end);
7274
7274
  const returns = text(args[0]);
7275
- const parameters = args.length > 1 ? `...args: ${text(args[1])}` : "...args: any[]";
7275
+ const parameters = args.length > 1 ? `...args: ${text(args[1])}` : "...args: never[]";
7276
7276
  edits.push({
7277
7277
  start: node.start,
7278
7278
  end: node.end,
@@ -8340,7 +8340,7 @@ function planJestMigration(context, adoption) {
8340
8340
  );
8341
8341
  }
8342
8342
  notes.push(
8343
- `run this module's own formatter (or lint --fix) on what this wrote, after installing. Two things need it: the Vitest type imports are written beside the existing ones, and a rewritten call is often SHORTER than the one it replaced, so the line breaks around it are no longer the ones your formatter would pick. Neither is a defect, and both fail a format check. Layout is a repository setting, so sentinel leaves it to the tool that owns it.`
8343
+ `the files this rewrote were run through this module's own formatter afterwards. Two things needed it: the Vitest type imports land beside the existing ones, and a rewritten call is often SHORTER than the one it replaced, so the line breaks around it are no longer the ones your config would pick. Neither is a defect, and both would have failed your format check.`
8344
8344
  );
8345
8345
  notes.push(
8346
8346
  `then run this module's TYPECHECK, not only its tests. The migration rewrites types as well as calls, and a wrong type is invisible to a green suite: measured on a real module, \`--run --test\` passed while \`--run --typescript\` reported ten errors it had not had before.`
@@ -8837,6 +8837,44 @@ var VitestAdapter = class extends BaseAdapter {
8837
8837
  this.say(captureReference(ctx.cwd, config).message);
8838
8838
  return Promise.resolve();
8839
8839
  }
8840
+ /**
8841
+ * Hand what was just written to the module's OWN formatter.
8842
+ *
8843
+ * ⚠️ Not a style sentinel imposes: the module adopted `.oxfmtrc.json`, and this runs that
8844
+ * config over the files this role created. Without it, `--init --test` leaves a module whose
8845
+ * own `--run --format` fails on a file the module never wrote.
8846
+ *
8847
+ * Measured on `apps/nest/microservices/agency`, in this repository's CI:
8848
+ *
8849
+ * agency:format 12 files, including vitest.config.mts and
8850
+ * vitest.integration.config.mts, both generated here
8851
+ *
8852
+ * The generator cannot avoid it by wrapping at a fixed width, because the width is the
8853
+ * MODULE's decision: `printWidth` lives in its own config, and 12 modules already set their
8854
+ * own. Guessing it is how a tool starts owning a setting it does not own.
8855
+ *
8856
+ * The same delegation the build role asks a human to do by hand, done. A module that has not
8857
+ * adopted the format role has no formatter to invoke, and this says nothing rather than
8858
+ * choosing one for it.
8859
+ */
8860
+ async afterInit(ctx) {
8861
+ const oxfmt = resolveOxfmt(ctx.cwd);
8862
+ if (oxfmt === void 0) {
8863
+ this.say(
8864
+ `no formatter adopted here, so what was written keeps the shape it was written in. Run your own formatter over it before committing.`
8865
+ );
8866
+ return Promise.resolve();
8867
+ }
8868
+ const pass = spawnSync5(oxfmt, ["--write", "."], { cwd: ctx.cwd, encoding: "utf8" });
8869
+ this.say(
8870
+ pass.status === 0 ? `formatted what this wrote with the module's own oxfmt config, so its \`--run --format\` passes on files it did not write itself.` : (
8871
+ // Adoption SUCCEEDED; only the tidy-up did not. Failing here would revert a migration
8872
+ // over a formatting pass, which is the wrong trade.
8873
+ `the module's formatter could not run over what this wrote (${pass.status ?? "no exit code"}). Adoption itself is applied; run \`sentinel --run --format --fix\` before committing.`
8874
+ )
8875
+ );
8876
+ return Promise.resolve();
8877
+ }
8840
8878
  plan(context) {
8841
8879
  return plan3(context);
8842
8880
  }
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  registerAdapters,
8
8
  resolve,
9
9
  setDefaultRunner
10
- } from "./chunk-L7WS36XV.js";
10
+ } from "./chunk-2S2VYRUM.js";
11
11
  import "./chunk-WLFE5RUU.js";
12
12
  export {
13
13
  BaseAdapter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.4.0-alpha.10",
3
+ "version": "1.4.0-alpha.11",
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",