@beignet/cli 0.0.1 → 0.0.3

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/src/lint.ts CHANGED
@@ -30,6 +30,7 @@ type SourceLayer =
30
30
  | "server"
31
31
  | "test"
32
32
  | "use-case"
33
+ | "workflow"
33
34
  | "unknown";
34
35
 
35
36
  type ImportReference = {
@@ -38,6 +39,9 @@ type ImportReference = {
38
39
  packageName?: string;
39
40
  };
40
41
 
42
+ /**
43
+ * Dependency-direction lint diagnostic.
44
+ */
41
45
  export type LintDiagnostic = {
42
46
  severity: "error";
43
47
  code: string;
@@ -46,12 +50,18 @@ export type LintDiagnostic = {
46
50
  importPath: string;
47
51
  };
48
52
 
53
+ /**
54
+ * Result returned by `beignet lint`.
55
+ */
49
56
  export type LintAppResult = {
50
57
  targetDir: string;
51
58
  config: ResolvedBeignetConfig;
52
59
  diagnostics: LintDiagnostic[];
53
60
  };
54
61
 
62
+ /**
63
+ * Inspect app imports and report dependency-direction violations.
64
+ */
55
65
  export async function lintApp(
56
66
  options: LintAppOptions = {},
57
67
  ): Promise<LintAppResult> {
@@ -82,6 +92,9 @@ export async function lintApp(
82
92
  };
83
93
  }
84
94
 
95
+ /**
96
+ * Format dependency-direction lint diagnostics for CLI output.
97
+ */
85
98
  export function formatLint(result: LintAppResult): string {
86
99
  if (result.diagnostics.length === 0) {
87
100
  return `No Beignet lint issues found in ${result.targetDir}.`;
@@ -504,13 +517,14 @@ function appImportViolation(
504
517
  "route",
505
518
  "server",
506
519
  "use-case",
520
+ "workflow",
507
521
  ].includes(targetLayer)
508
522
  ) {
509
523
  return targetLayer;
510
524
  }
511
525
 
512
526
  if (
513
- sourceLayer === "use-case" &&
527
+ (sourceLayer === "use-case" || sourceLayer === "workflow") &&
514
528
  ["app", "client", "component", "infra", "route", "server"].includes(
515
529
  targetLayer,
516
530
  )
@@ -520,23 +534,31 @@ function appImportViolation(
520
534
 
521
535
  if (
522
536
  ["feature-port", "policy", "port"].includes(sourceLayer) &&
523
- ["app", "client", "component", "infra", "route", "server"].includes(
524
- targetLayer,
525
- )
537
+ [
538
+ "app",
539
+ "client",
540
+ "component",
541
+ "infra",
542
+ "route",
543
+ "server",
544
+ "workflow",
545
+ ].includes(targetLayer)
526
546
  ) {
527
547
  return targetLayer;
528
548
  }
529
549
 
530
550
  if (
531
551
  sourceLayer === "contract" &&
532
- ["app", "client", "component", "infra", "route"].includes(targetLayer)
552
+ ["app", "client", "component", "infra", "route", "workflow"].includes(
553
+ targetLayer,
554
+ )
533
555
  ) {
534
556
  return targetLayer;
535
557
  }
536
558
 
537
559
  if (
538
560
  sourceLayer === "route" &&
539
- ["app", "client", "component", "infra"].includes(targetLayer)
561
+ ["app", "client", "component", "infra", "workflow"].includes(targetLayer)
540
562
  ) {
541
563
  return targetLayer;
542
564
  }
@@ -556,9 +578,14 @@ function packageImportViolation(
556
578
  }
557
579
 
558
580
  if (
559
- ["contract", "feature-port", "policy", "port", "use-case"].includes(
560
- sourceLayer,
561
- )
581
+ [
582
+ "contract",
583
+ "feature-port",
584
+ "policy",
585
+ "port",
586
+ "use-case",
587
+ "workflow",
588
+ ].includes(sourceLayer)
562
589
  ) {
563
590
  return (
564
591
  coreBannedPackages.has(packageName) ||
@@ -716,6 +743,13 @@ function classifyPath(
716
743
  if (layerSegment === "ports") return "feature-port";
717
744
  if (layerSegment === "policy") return "policy";
718
745
  if (layerSegment === "use-cases") return "use-case";
746
+ if (
747
+ ["jobs", "listeners", "notifications", "schedules", "uploads"].includes(
748
+ layerSegment,
749
+ )
750
+ ) {
751
+ return "workflow";
752
+ }
719
753
  if (layerSegment === "components") return "component";
720
754
  }
721
755