@hublo/sentinel 1.0.1 → 1.1.0-alpha.1

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.
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ FLAVOURS,
4
+ TARGETS,
5
+ VERBS,
3
6
  availableTargets,
4
7
  describeFramework,
5
8
  dispatch,
@@ -11,7 +14,7 @@ import {
11
14
  registerAdapters,
12
15
  resolve,
13
16
  resolveBin
14
- } from "../chunk-HKGCWPRT.js";
17
+ } from "../chunk-RLMXN2ZJ.js";
15
18
 
16
19
  // bin/sentinel.ts
17
20
  import { program } from "commander";
@@ -106,20 +109,6 @@ function resolveContext(cwd2, opts2) {
106
109
  );
107
110
  }
108
111
 
109
- // src/core/domain.ts
110
- var VERBS = ["run", "inspect", "init", "migrate", "report", "status"];
111
- var TARGETS = [
112
- "lint",
113
- "format",
114
- "typescript",
115
- "build",
116
- "test",
117
- "static-analysis",
118
- "runtime-analysis",
119
- "arch"
120
- ];
121
- var FLAVOURS = ["react", "nest", "svelte", "node"];
122
-
123
112
  // src/core/orchestrate.ts
124
113
  async function analyse(params) {
125
114
  const results = [];
@@ -141,14 +130,6 @@ async function analyse(params) {
141
130
  );
142
131
  }
143
132
  }
144
- const ctx = {
145
- module: module.name,
146
- cwd: module.root,
147
- flavour: flavour2,
148
- ci: params.ci,
149
- fix: params.fix,
150
- maxDiagnostics: params.maxDiagnostics
151
- };
152
133
  for (const target of params.targets) {
153
134
  let adapter;
154
135
  try {
@@ -167,13 +148,22 @@ async function analyse(params) {
167
148
  }
168
149
  continue;
169
150
  }
151
+ const effectiveFlavour = params.flavour ?? adapter.declaredFlavour?.(module.root) ?? flavour2;
152
+ const ctx = {
153
+ module: module.name,
154
+ cwd: module.root,
155
+ flavour: effectiveFlavour,
156
+ ci: params.ci,
157
+ fix: params.fix,
158
+ maxDiagnostics: params.maxDiagnostics
159
+ };
170
160
  try {
171
161
  if (params.verb === "run") {
172
162
  if (params.modules.length > 1) {
173
163
  const err = palette(process.stderr);
174
164
  process.stderr.write(
175
165
  `
176
- ${err.accent("\u25B6")} ${err.strong(module.name)} ${err.dim(`(${flavour2})`)} ${target}
166
+ ${err.accent("\u25B6")} ${err.strong(module.name)} ${err.dim(`(${effectiveFlavour})`)} ${target}
177
167
  `
178
168
  );
179
169
  }
@@ -181,7 +171,7 @@ async function analyse(params) {
181
171
  results.push({
182
172
  project: module.name,
183
173
  target,
184
- flavour: flavour2,
174
+ flavour: effectiveFlavour,
185
175
  ok: result.ok,
186
176
  status: result.ok ? "ok" : "failed",
187
177
  data: {}
@@ -192,7 +182,7 @@ async function analyse(params) {
192
182
  results.push({
193
183
  project: module.name,
194
184
  target,
195
- flavour: flavour2,
185
+ flavour: effectiveFlavour,
196
186
  ok: result.ok,
197
187
  status: result.ok ? "ok" : "failed",
198
188
  data: result.metrics ?? {}
@@ -203,7 +193,7 @@ async function analyse(params) {
203
193
  results.push({
204
194
  project: module.name,
205
195
  target,
206
- flavour: flavour2,
196
+ flavour: effectiveFlavour,
207
197
  ok: true,
208
198
  status: "ok",
209
199
  data: config
@@ -214,7 +204,7 @@ async function analyse(params) {
214
204
  results.push({
215
205
  project: module.name,
216
206
  target,
217
- flavour: flavour2,
207
+ flavour: effectiveFlavour,
218
208
  ok,
219
209
  status: ok ? "ok" : "failed",
220
210
  data: status
@@ -226,7 +216,7 @@ async function analyse(params) {
226
216
  results.push({
227
217
  project: module.name,
228
218
  target,
229
- flavour: flavour2,
219
+ flavour: effectiveFlavour,
230
220
  ok: false,
231
221
  status: "failed",
232
222
  data: { error: message }
@@ -529,8 +519,13 @@ async function runVerb() {
529
519
  maxDiagnostics,
530
520
  ci: Boolean(opts.ci),
531
521
  fix: Boolean(opts.fix),
532
- onProgress: (done, total, name) => process.stderr.write(err.dim(` [${done}/${total}] ${name}
533
- `))
522
+ // Per-module progress is a HUMAN affordance: it tells someone staring at a slow sweep
523
+ // that it is alive. On this monorepo's 441 projects it is 441 lines that bury the four
524
+ // that matter, and it is pure noise in a captured log. So emit it only for an
525
+ // interactive terminal; a pipe, CI, or a generated trace gets the results and the
526
+ // one-line summary, which is all any of them can use.
527
+ onProgress: process.stderr.isTTY ? (done, total, name) => process.stderr.write(err.dim(` [${done}/${total}] ${name}
528
+ `)) : void 0
534
529
  });
535
530
  const summary = generateSummaries(results, targets);
536
531
  if (opts.json && verb !== "run") {