@nac3/forge-cli 1.20.2 → 1.21.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.
@@ -1,22 +1,84 @@
1
1
  /**
2
- * `yf doctor` -- environment + project health check. Reports
3
- * what's installed, what's missing, what's misconfigured.
2
+ * `yf doctor` -- environment + project health check.
4
3
  *
5
- * v0.2.0-alpha.1 (HITO 0 + HITO 1 closed) -- extended to cover
6
- * vault availability, voice provider keys, reader parser
7
- * dependencies, and project root sanity.
4
+ * THE HONESTY CONTRACT (PND-184, 2026-10-26)
5
+ * ------------------------------------------
6
+ * A check may only assert what it verified, and it must say what it
7
+ * looked at. Every check answers four questions:
8
+ *
9
+ * P1 does it read the source that GOVERNS at runtime -- the file
10
+ * the real component reads -- rather than an adjacent or
11
+ * inherited field?
12
+ * P2 can it go green without having been able to look? (no: that
13
+ * is the false-green half of the defect)
14
+ * P3 can it go red about something the real component does not
15
+ * use? (no: that is the false-red half -- F-01)
16
+ * P4 when it cannot look, does it SAY SO, or does it collapse
17
+ * "could not verify" into one of the other two?
18
+ *
19
+ * Hence `Check.status` is a THIRD state (`ok` | `fail` | `unknown`),
20
+ * not a boolean, and every check carries `source` (what it read),
21
+ * plus `expected` / `found` / `conflict` when they add information.
22
+ *
23
+ * Why this matters enough to restructure the command: the Urazuke
24
+ * method documented this same defect twice in its own history -- a
25
+ * publish check that reported forty failed attempts over thirteen
26
+ * minutes when the publish had in fact succeeded, because it collapsed
27
+ * two outcomes into one message; and a guard that claimed a server had
28
+ * something configured when all it had verified was that a file
29
+ * existed in a repository. `yf doctor` is the face Forge shows when
30
+ * something is wrong: it is the last place that can afford a green it
31
+ * did not earn.
32
+ *
33
+ * SIDE EFFECTS: none on the config dir. A diagnostic command must not
34
+ * change the machine it is diagnosing (PND-188). It does not start the
35
+ * trial, does not create the vault, does not seed voice-config.json.
36
+ *
37
+ * ASCII-only.
8
38
  */
9
39
  import type { Command } from 'commander';
10
40
  export interface DoctorOptions {
11
41
  json?: boolean;
42
+ verbose?: boolean;
12
43
  }
13
- interface Check {
44
+ /** `ok` = verified good. `fail` = verified bad. `unknown` = could NOT
45
+ * verify -- a third outcome, never a synonym for either other one. */
46
+ export type CheckStatus = 'ok' | 'fail' | 'unknown';
47
+ export interface Check {
48
+ /** Stable machine id. Scripts and tests match on this, never on
49
+ * `name` -- the label is prose and may be reworded. */
50
+ id: string;
14
51
  name: string;
52
+ status: CheckStatus;
53
+ /** Back-compat for existing consumers: true only when status==='ok'.
54
+ * An `unknown` is NOT ok -- it is also not a failure, which is why
55
+ * the summary counts the three separately. */
15
56
  ok: boolean;
57
+ /** What this check actually looked at: a path, a module specifier,
58
+ * a URL, an env var. Mandatory. */
59
+ source: string;
60
+ /** What it expected to find there. */
61
+ expected?: string;
62
+ /** What it found instead. */
63
+ found?: string;
16
64
  detail: string;
17
65
  hint?: string;
66
+ /** Another source that says something different, named explicitly so
67
+ * the user is not sent to reconfigure the one that already works. */
68
+ conflict?: string;
69
+ }
70
+ export interface DoctorEnv {
71
+ /** Config dir to inspect. Defaults to configDir(), which honours
72
+ * YF_CONFIG_DIR (PND-190: the brain check used to resolve the home
73
+ * by hand and read a different directory than the keys layer). */
74
+ configDir?: string;
75
+ cwd?: string;
76
+ fetchImpl?: typeof fetch;
77
+ nowMs?: () => number;
78
+ timeoutMs?: number;
18
79
  }
19
80
  export declare function registerDoctorCommand(program: Command): void;
81
+ export declare function runDoctorChecks(env?: DoctorEnv): Promise<Check[]>;
20
82
  /** PND-031 -- 3 HITO 4 doctor probes. Extracted so tests can
21
83
  * exercise them with injected fetch + tmp config dir without
22
84
  * spinning the whole doctor runner. */
@@ -24,9 +86,9 @@ export declare function runHito4DoctorChecks(checks: Check[], opts?: {
24
86
  baseUrl?: string;
25
87
  fetchImpl?: typeof fetch;
26
88
  timeoutMs?: number;
89
+ configDir?: string;
27
90
  /** When set, override license.json staleness comparison.
28
91
  * Defaults to `Date.now()`. */
29
92
  nowMs?: () => number;
30
93
  }): Promise<void>;
31
- export {};
32
94
  //# sourceMappingURL=doctor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyC5D;AAmWD;;wCAEwC;AACxC,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,KAAK,EAAE,EACf,IAAI,GAAE;IACJ,OAAO,CAAC,EAAK,MAAM,CAAC;IACpB,SAAS,CAAC,EAAG,OAAO,KAAK,CAAC;IAC1B,SAAS,CAAC,EAAG,MAAM,CAAC;IACpB;oCACgC;IAChC,KAAK,CAAC,EAAO,MAAM,MAAM,CAAC;CACtB,GACL,OAAO,CAAC,IAAI,CAAC,CAqFf"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;uEACuE;AACvE,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpD,MAAM,WAAW,KAAK;IACpB;4DACwD;IACxD,EAAE,EAAE,MAAM,CAA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