@chrisdudek/yg 5.0.3 → 5.1.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.
@@ -44,6 +44,12 @@ interface Ctx {
44
44
  node: GraphNode$1;
45
45
  /** alias for node.files (own node files with child carve-out) */
46
46
  files: File[];
47
+ /**
48
+ * the unit's subject file(s): per:file → single; per:node → the node's
49
+ * subject set (same array reference as `files` for the deterministic
50
+ * whole-node case).
51
+ */
52
+ subject: File[];
47
53
  fs: {
48
54
  exists(path: string): 'file' | 'dir' | false;
49
55
  list(dir: string): FsEntry[];
@@ -72,6 +78,12 @@ interface Violation {
72
78
  }
73
79
  /** check.mjs export signature (synchronous) */
74
80
  type CheckFunction = (ctx: Ctx) => Violation[];
81
+ interface CompanionDescriptor {
82
+ path: string;
83
+ label?: string;
84
+ }
85
+ /** companion.mjs export — MAY be async (unlike sync-only check). Returns paths, never content. */
86
+ type CompanionFunction = (ctx: Ctx) => CompanionDescriptor[] | Promise<CompanionDescriptor[]>;
75
87
 
76
88
  /**
77
89
  * Applicability filter. Evaluated by the CLI against the graph before an aspect
@@ -330,6 +342,12 @@ interface AspectDef {
330
342
  * Forbidden on aggregate aspects (no rule source to scope).
331
343
  */
332
344
  scope?: ScopeDef;
345
+ /**
346
+ * True when companion.mjs is present beside the aspect's rule sources.
347
+ * Valid only when reviewer.type === 'llm'. Set by the loader when companion.mjs
348
+ * is detected in the aspect directory.
349
+ */
350
+ hasCompanion?: boolean;
333
351
  }
334
352
  interface FlowDef {
335
353
  /** Directory name under flows/, e.g. "checkout-flow" */
@@ -344,10 +362,6 @@ interface FlowDef {
344
362
  /** Per-aspect explicit status override for aspects listed in `aspects` (channel 5) */
345
363
  aspectStatus?: Record<string, AspectStatus>;
346
364
  }
347
- interface SchemaDef {
348
- /** Inferred from filename: 'node' | 'aspect' | 'flow' */
349
- schemaType: string;
350
- }
351
365
  /**
352
366
  * Architecture file load error.
353
367
  *
@@ -391,7 +405,6 @@ interface Graph {
391
405
  nodes: Map<string, GraphNode>;
392
406
  aspects: AspectDef[];
393
407
  flows: FlowDef[];
394
- schemas: SchemaDef[];
395
408
  /** Absolute path to the .yggdrasil/ directory */
396
409
  rootPath: string;
397
410
  }
@@ -402,6 +415,17 @@ type ParseCache = Map<string, {
402
415
  ast: Tree;
403
416
  }>;
404
417
 
418
+ /**
419
+ * Raised by the shared hook loader and the deterministic structure runner.
420
+ * Defined here (not in runner.ts) so both the loader and the runner can throw it
421
+ * without a circular import; runner.ts re-exports it for backward compatibility.
422
+ */
423
+ declare class StructureRunnerError extends Error {
424
+ readonly code: string;
425
+ readonly messageData: IssueMessage;
426
+ constructor(code: string, data: IssueMessage);
427
+ }
428
+
405
429
  interface RunStructureAspectParams {
406
430
  aspectDir: string;
407
431
  aspectId: string;
@@ -434,11 +458,6 @@ interface RunStructureAspectResult {
434
458
  * (file changed mid-run) — a tainted result must never be cached. */
435
459
  observationsTainted: boolean;
436
460
  }
437
- declare class StructureRunnerError extends Error {
438
- readonly code: string;
439
- readonly messageData: IssueMessage;
440
- constructor(code: string, data: IssueMessage);
441
- }
442
461
  declare function runStructureAspect(params: RunStructureAspectParams): Promise<RunStructureAspectResult>;
443
462
 
444
- export { type CheckFunction, type Ctx, type File, type FsEntry, type GraphNode$1 as GraphNode, type Port, type Relation$1 as Relation, type RelationType$1 as RelationType, StructureRunnerError, type Violation, runStructureAspect };
463
+ export { type CheckFunction, type CompanionDescriptor, type CompanionFunction, type Ctx, type File, type FsEntry, type GraphNode$1 as GraphNode, type Port, type Relation$1 as Relation, type RelationType$1 as RelationType, StructureRunnerError, type Violation, runStructureAspect };