@lucasacoutinho/archer 0.2.1 → 0.3.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.
Files changed (214) hide show
  1. package/README.md +144 -387
  2. package/dist/analyzer/Analyzer.d.ts +17 -0
  3. package/dist/analyzer/Analyzer.d.ts.map +1 -0
  4. package/dist/analyzer/Analyzer.js +15 -0
  5. package/dist/analyzer/Analyzer.js.map +1 -0
  6. package/dist/analyzer/bindings.d.ts +26 -0
  7. package/dist/analyzer/bindings.d.ts.map +1 -0
  8. package/dist/analyzer/bindings.js +61 -0
  9. package/dist/analyzer/bindings.js.map +1 -0
  10. package/dist/analyzer/errors.d.ts +34 -0
  11. package/dist/analyzer/errors.d.ts.map +1 -0
  12. package/dist/analyzer/errors.js +20 -0
  13. package/dist/analyzer/errors.js.map +1 -0
  14. package/dist/analyzer/graph-file.d.ts +13 -0
  15. package/dist/analyzer/graph-file.d.ts.map +1 -0
  16. package/dist/analyzer/graph-file.js +22 -0
  17. package/dist/analyzer/graph-file.js.map +1 -0
  18. package/dist/analyzer/paths.d.ts +12 -0
  19. package/dist/analyzer/paths.d.ts.map +1 -0
  20. package/dist/analyzer/paths.js +26 -0
  21. package/dist/analyzer/paths.js.map +1 -0
  22. package/dist/analyzer/server-exit.d.ts +19 -0
  23. package/dist/analyzer/server-exit.d.ts.map +1 -0
  24. package/dist/analyzer/server-exit.js +70 -0
  25. package/dist/analyzer/server-exit.js.map +1 -0
  26. package/dist/analyzer/source.d.ts +29 -0
  27. package/dist/analyzer/source.d.ts.map +1 -0
  28. package/dist/analyzer/source.js +58 -0
  29. package/dist/analyzer/source.js.map +1 -0
  30. package/dist/analyzer/syntax.d.ts +29 -0
  31. package/dist/analyzer/syntax.d.ts.map +1 -0
  32. package/dist/analyzer/syntax.js +226 -0
  33. package/dist/analyzer/syntax.js.map +1 -0
  34. package/dist/analyzer/targets.d.ts +26 -0
  35. package/dist/analyzer/targets.d.ts.map +1 -0
  36. package/dist/analyzer/targets.js +84 -0
  37. package/dist/analyzer/targets.js.map +1 -0
  38. package/dist/analyzer/typescript.d.ts +5 -0
  39. package/dist/analyzer/typescript.d.ts.map +1 -0
  40. package/dist/analyzer/typescript.js +221 -0
  41. package/dist/analyzer/typescript.js.map +1 -0
  42. package/dist/analyzer/workspace.d.ts +24 -0
  43. package/dist/analyzer/workspace.d.ts.map +1 -0
  44. package/dist/analyzer/workspace.js +9 -0
  45. package/dist/analyzer/workspace.js.map +1 -0
  46. package/dist/cli/explain.d.ts +3 -0
  47. package/dist/cli/explain.d.ts.map +1 -0
  48. package/dist/cli/explain.js +21 -0
  49. package/dist/cli/explain.js.map +1 -0
  50. package/dist/cli/main.d.ts +3 -0
  51. package/dist/cli/main.d.ts.map +1 -0
  52. package/dist/cli/main.js +159 -0
  53. package/dist/cli/main.js.map +1 -0
  54. package/dist/config/input.d.ts +59 -0
  55. package/dist/config/input.d.ts.map +1 -0
  56. package/dist/config/input.js +115 -0
  57. package/dist/config/input.js.map +1 -0
  58. package/dist/config/rules.d.ts +94 -0
  59. package/dist/config/rules.d.ts.map +1 -0
  60. package/dist/config/rules.js +130 -0
  61. package/dist/config/rules.js.map +1 -0
  62. package/dist/core/baseline.d.ts +16 -0
  63. package/dist/core/baseline.d.ts.map +1 -0
  64. package/dist/core/baseline.js +25 -0
  65. package/dist/core/baseline.js.map +1 -0
  66. package/dist/core/check.d.ts +16 -0
  67. package/dist/core/check.d.ts.map +1 -0
  68. package/dist/core/check.js +271 -0
  69. package/dist/core/check.js.map +1 -0
  70. package/dist/core/config.d.ts +72 -0
  71. package/dist/core/config.d.ts.map +1 -0
  72. package/dist/core/config.js +78 -0
  73. package/dist/core/config.js.map +1 -0
  74. package/dist/core/fingerprint.d.ts +54 -0
  75. package/dist/core/fingerprint.d.ts.map +1 -0
  76. package/dist/core/fingerprint.js +182 -0
  77. package/dist/core/fingerprint.js.map +1 -0
  78. package/dist/core/keys.d.ts +10 -0
  79. package/dist/core/keys.d.ts.map +1 -0
  80. package/dist/core/keys.js +16 -0
  81. package/dist/core/keys.js.map +1 -0
  82. package/dist/core/lower.d.ts +13 -0
  83. package/dist/core/lower.d.ts.map +1 -0
  84. package/dist/core/lower.js +82 -0
  85. package/dist/core/lower.js.map +1 -0
  86. package/dist/core/model.d.ts +155 -0
  87. package/dist/core/model.d.ts.map +1 -0
  88. package/dist/core/model.js +116 -0
  89. package/dist/core/model.js.map +1 -0
  90. package/dist/core/pattern.d.ts +13 -0
  91. package/dist/core/pattern.d.ts.map +1 -0
  92. package/dist/core/pattern.js +29 -0
  93. package/dist/core/pattern.js.map +1 -0
  94. package/dist/core/reach.d.ts +10 -0
  95. package/dist/core/reach.d.ts.map +1 -0
  96. package/dist/core/reach.js +81 -0
  97. package/dist/core/reach.js.map +1 -0
  98. package/dist/core/rule.d.ts +200 -0
  99. package/dist/core/rule.d.ts.map +1 -0
  100. package/dist/core/rule.js +162 -0
  101. package/dist/core/rule.js.map +1 -0
  102. package/dist/core/selector.d.ts +7 -0
  103. package/dist/core/selector.d.ts.map +1 -0
  104. package/dist/core/selector.js +27 -0
  105. package/dist/core/selector.js.map +1 -0
  106. package/dist/core/structural.d.ts +10 -0
  107. package/dist/core/structural.d.ts.map +1 -0
  108. package/dist/core/structural.js +24 -0
  109. package/dist/core/structural.js.map +1 -0
  110. package/dist/core/text.d.ts +26 -0
  111. package/dist/core/text.d.ts.map +1 -0
  112. package/dist/core/text.js +144 -0
  113. package/dist/core/text.js.map +1 -0
  114. package/dist/effect.d.ts +19 -0
  115. package/dist/effect.d.ts.map +1 -0
  116. package/dist/effect.js +21 -0
  117. package/dist/effect.js.map +1 -0
  118. package/dist/index.d.ts +24 -44
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +59 -52
  121. package/dist/index.js.map +1 -0
  122. package/dist/report/agent.d.ts +3 -0
  123. package/dist/report/agent.d.ts.map +1 -0
  124. package/dist/report/agent.js +35 -0
  125. package/dist/report/agent.js.map +1 -0
  126. package/dist/report/dot.d.ts +4 -0
  127. package/dist/report/dot.d.ts.map +1 -0
  128. package/dist/report/dot.js +15 -0
  129. package/dist/report/dot.js.map +1 -0
  130. package/dist/report/github.d.ts +3 -0
  131. package/dist/report/github.d.ts.map +1 -0
  132. package/dist/report/github.js +18 -0
  133. package/dist/report/github.js.map +1 -0
  134. package/dist/report/json.d.ts +3 -0
  135. package/dist/report/json.d.ts.map +1 -0
  136. package/dist/report/json.js +4 -0
  137. package/dist/report/json.js.map +1 -0
  138. package/dist/report/message.d.ts +20 -0
  139. package/dist/report/message.d.ts.map +1 -0
  140. package/dist/report/message.js +73 -0
  141. package/dist/report/message.js.map +1 -0
  142. package/dist/report/pretty.d.ts +8 -0
  143. package/dist/report/pretty.d.ts.map +1 -0
  144. package/dist/report/pretty.js +89 -0
  145. package/dist/report/pretty.js.map +1 -0
  146. package/dist/report/render.d.ts +9 -0
  147. package/dist/report/render.d.ts.map +1 -0
  148. package/dist/report/render.js +10 -0
  149. package/dist/report/render.js.map +1 -0
  150. package/dist/report/report.d.ts +44 -0
  151. package/dist/report/report.d.ts.map +1 -0
  152. package/dist/report/report.js +49 -0
  153. package/dist/report/report.js.map +1 -0
  154. package/dist/report/sarif.d.ts +3 -0
  155. package/dist/report/sarif.d.ts.map +1 -0
  156. package/dist/report/sarif.js +68 -0
  157. package/dist/report/sarif.js.map +1 -0
  158. package/dist/run.d.ts +49 -0
  159. package/dist/run.d.ts.map +1 -0
  160. package/dist/run.js +87 -0
  161. package/dist/run.js.map +1 -0
  162. package/dist/shell/baseline-file.d.ts +20 -0
  163. package/dist/shell/baseline-file.d.ts.map +1 -0
  164. package/dist/shell/baseline-file.js +46 -0
  165. package/dist/shell/baseline-file.js.map +1 -0
  166. package/dist/shell/load-config.d.ts +19 -0
  167. package/dist/shell/load-config.d.ts.map +1 -0
  168. package/dist/shell/load-config.js +39 -0
  169. package/dist/shell/load-config.js.map +1 -0
  170. package/package.json +29 -177
  171. package/skills/archer/SKILL.md +127 -45
  172. package/skills/archer/agents/openai.yaml +2 -2
  173. package/skills/archer/references/rules.md +267 -54
  174. package/dist/bun/plugin.cjs +0 -85
  175. package/dist/bun/plugin.d.cts +0 -7
  176. package/dist/bun/plugin.d.ts +0 -7
  177. package/dist/bun/plugin.js +0 -11
  178. package/dist/bun.cjs +0 -2238
  179. package/dist/bun.d.cts +0 -13
  180. package/dist/bun.d.ts +0 -13
  181. package/dist/bun.js +0 -28
  182. package/dist/chunk-2AKMBLHG.js +0 -2165
  183. package/dist/chunk-67YEOTXP.js +0 -25
  184. package/dist/chunk-IDVLHNL2.js +0 -46
  185. package/dist/chunk-ZZ6TR4PO.js +0 -201
  186. package/dist/cli.js +0 -2643
  187. package/dist/index.cjs +0 -2484
  188. package/dist/index.d.cts +0 -45
  189. package/dist/jest/plugin.cjs +0 -85
  190. package/dist/jest/plugin.d.cts +0 -7
  191. package/dist/jest/plugin.d.ts +0 -7
  192. package/dist/jest/plugin.js +0 -11
  193. package/dist/jest.cjs +0 -2237
  194. package/dist/jest.d.cts +0 -13
  195. package/dist/jest.d.ts +0 -13
  196. package/dist/jest.js +0 -27
  197. package/dist/matchers-Cqnbsyxe.d.cts +0 -11
  198. package/dist/matchers-Cqnbsyxe.d.ts +0 -11
  199. package/dist/node.cjs +0 -2237
  200. package/dist/node.d.cts +0 -13
  201. package/dist/node.d.ts +0 -13
  202. package/dist/node.js +0 -27
  203. package/dist/reporters-BbAXMpuW.d.cts +0 -6
  204. package/dist/reporters-xh-HQneS.d.ts +0 -6
  205. package/dist/suite-BwnPDCvU.d.cts +0 -337
  206. package/dist/suite-BwnPDCvU.d.ts +0 -337
  207. package/dist/vitest/plugin.cjs +0 -85
  208. package/dist/vitest/plugin.d.cts +0 -7
  209. package/dist/vitest/plugin.d.ts +0 -7
  210. package/dist/vitest/plugin.js +0 -11
  211. package/dist/vitest.cjs +0 -2531
  212. package/dist/vitest.d.cts +0 -37
  213. package/dist/vitest.d.ts +0 -37
  214. package/dist/vitest.js +0 -139
package/dist/node.d.cts DELETED
@@ -1,13 +0,0 @@
1
- import { TestOptions } from 'node:test';
2
- import { A as ArcherOptions, a as ArchitectureSuite } from './suite-BwnPDCvU.cjs';
3
- export { S as Selector } from './suite-BwnPDCvU.cjs';
4
-
5
- interface NodeArchTestOptions extends ArcherOptions {
6
- readonly test?: TestOptions;
7
- }
8
- /**
9
- * Registers an architecture test in node:test and returns its rule builder.
10
- */
11
- declare function arch(name: string, options?: NodeArchTestOptions): ArchitectureSuite;
12
-
13
- export { ArcherOptions, type NodeArchTestOptions, arch };
package/dist/node.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { TestOptions } from 'node:test';
2
- import { A as ArcherOptions, a as ArchitectureSuite } from './suite-BwnPDCvU.js';
3
- export { S as Selector } from './suite-BwnPDCvU.js';
4
-
5
- interface NodeArchTestOptions extends ArcherOptions {
6
- readonly test?: TestOptions;
7
- }
8
- /**
9
- * Registers an architecture test in node:test and returns its rule builder.
10
- */
11
- declare function arch(name: string, options?: NodeArchTestOptions): ArchitectureSuite;
12
-
13
- export { ArcherOptions, type NodeArchTestOptions, arch };
package/dist/node.js DELETED
@@ -1,27 +0,0 @@
1
- import {
2
- ArchitectureSuite
3
- } from "./chunk-2AKMBLHG.js";
4
- import {
5
- ArchitectureError
6
- } from "./chunk-IDVLHNL2.js";
7
-
8
- // src/adapters/node/index.ts
9
- import { createRequire } from "module";
10
- import path from "path";
11
- var { test } = createRequire(path.join(process.cwd(), "__archer.cjs"))(
12
- "node:test"
13
- );
14
- function arch(name, options = {}) {
15
- const { test: testOptions, ...archerOptions } = options;
16
- const suite = new ArchitectureSuite(archerOptions);
17
- test(name, testOptions ?? {}, async () => {
18
- const result = await suite.check();
19
- if (!result.ok) {
20
- throw new ArchitectureError(result);
21
- }
22
- });
23
- return suite;
24
- }
25
- export {
26
- arch
27
- };
@@ -1,6 +0,0 @@
1
- import { c as ArchitectureResult, b as ArchitectureGraph } from './suite-BwnPDCvU.cjs';
2
-
3
- type ReporterName = 'agent' | 'dot' | 'github' | 'json' | 'llm' | 'pretty' | 'sarif';
4
- declare function report(name: ReporterName, result: ArchitectureResult, graph?: ArchitectureGraph): string;
5
-
6
- export { type ReporterName as R, report as r };
@@ -1,6 +0,0 @@
1
- import { c as ArchitectureResult, b as ArchitectureGraph } from './suite-BwnPDCvU.js';
2
-
3
- type ReporterName = 'agent' | 'dot' | 'github' | 'json' | 'llm' | 'pretty' | 'sarif';
4
- declare function report(name: ReporterName, result: ArchitectureResult, graph?: ArchitectureGraph): string;
5
-
6
- export { type ReporterName as R, report as r };
@@ -1,337 +0,0 @@
1
- type Selector = string | readonly string[];
2
- type DependencyKind = 'dynamic' | 'require' | 'static' | 'type';
3
- type DependencyResolution = 'bun' | 'dynamic' | 'file' | 'local' | 'node' | 'npm' | 'unresolved';
4
- type RuleSeverity = 'error' | 'info' | 'warning';
5
- interface SourceLocation {
6
- readonly column: number;
7
- readonly line: number;
8
- }
9
- interface Dependency extends SourceLocation {
10
- readonly external: boolean;
11
- readonly from: string;
12
- readonly kind: DependencyKind;
13
- readonly packageName?: string;
14
- readonly resolution: DependencyResolution;
15
- readonly resolved: boolean;
16
- readonly specifier: string;
17
- readonly target: string;
18
- }
19
- type DeclarationKind = 'class' | 'enum' | 'function' | 'interface' | 'type' | 'variable';
20
- interface MethodInfo {
21
- readonly name: string;
22
- readonly static: boolean;
23
- readonly visibility: 'private' | 'protected' | 'public';
24
- }
25
- interface DeclarationInfo extends SourceLocation {
26
- readonly abstract: boolean;
27
- readonly decorators: readonly string[];
28
- readonly defaultExport: boolean;
29
- readonly exported: boolean;
30
- readonly extends: readonly string[];
31
- readonly implements: readonly string[];
32
- readonly kind: DeclarationKind;
33
- readonly methods: readonly MethodInfo[];
34
- readonly name: string;
35
- readonly readonlyProperties: boolean;
36
- }
37
- interface SourceUse extends SourceLocation {
38
- readonly kind: 'call' | 'loose-equality';
39
- readonly importedFrom?: string;
40
- readonly importedName?: string;
41
- readonly name: string;
42
- }
43
- interface SourceModule {
44
- readonly absolutePath: string;
45
- readonly declarations: readonly DeclarationInfo[];
46
- readonly dependencies: readonly Dependency[];
47
- readonly exports: readonly string[];
48
- readonly lines: number;
49
- readonly path: string;
50
- readonly project?: string;
51
- readonly sourceLines: readonly string[];
52
- readonly uses: readonly SourceUse[];
53
- }
54
- interface ProjectInfo {
55
- readonly name: string;
56
- readonly root: string;
57
- readonly tsconfig: string;
58
- }
59
- interface ArchitectureGraph {
60
- readonly dependencies: readonly Dependency[];
61
- readonly modules: readonly SourceModule[];
62
- readonly projects: readonly ProjectInfo[];
63
- readonly root: string;
64
- }
65
- interface ArcherProjectOptions {
66
- /** Globs, relative to the project directory, that replace the global include list. */
67
- readonly include?: readonly string[];
68
- /** Path to a tsconfig file, relative to Archer's root. */
69
- readonly tsconfig: string;
70
- }
71
- interface ArcherOptions {
72
- /** Reuse graphs while source and project-configuration signatures remain unchanged. Defaults to true. */
73
- readonly cache?: boolean;
74
- /** Globs, relative to root, for source files to analyze. */
75
- readonly include?: readonly string[];
76
- /** Include .d.ts files as selectable source modules. Defaults to false. */
77
- readonly includeTypeDeclarations?: boolean;
78
- /** Globs, relative to root, that should not be analyzed. */
79
- readonly exclude?: readonly string[];
80
- /** Follow symlinks when identifying workspace files. Defaults to true. */
81
- readonly followSymlinks?: boolean;
82
- /** Additional tsconfig projects or project-specific settings. */
83
- readonly projects?: readonly (ArcherProjectOptions | string)[];
84
- /** Project root. Defaults to process.cwd(). */
85
- readonly root?: string;
86
- /** tsconfig used for module resolution. Set false to use TypeScript defaults. */
87
- readonly tsconfig?: string | false;
88
- /** Discover package-workspace tsconfigs. Defaults to true. */
89
- readonly workspaces?: boolean;
90
- }
91
- interface ArchitectureViolation {
92
- readonly column?: number;
93
- readonly dependency?: string;
94
- readonly file?: string;
95
- readonly importChain?: readonly string[];
96
- readonly line?: number;
97
- readonly message: string;
98
- readonly reason?: string;
99
- readonly rule: string;
100
- readonly ruleId?: string;
101
- readonly severity: RuleSeverity;
102
- readonly sourceLine?: string;
103
- }
104
- interface ArchitectureResult {
105
- readonly dependenciesAnalyzed: number;
106
- readonly errors: number;
107
- readonly filesAnalyzed: number;
108
- readonly infos: number;
109
- readonly ok: boolean;
110
- readonly violations: readonly ArchitectureViolation[];
111
- readonly warnings: number;
112
- }
113
- interface CustomRuleContext {
114
- readonly graph: ArchitectureGraph;
115
- readonly modules: readonly SourceModule[];
116
- }
117
- type CustomRuleResult = ArchitectureViolation | readonly ArchitectureViolation[] | undefined | void;
118
- type CustomRule = (context: CustomRuleContext) => CustomRuleResult | Promise<CustomRuleResult>;
119
- interface RuleMetadata {
120
- readonly id?: string;
121
- readonly reason?: string;
122
- readonly severity?: RuleSeverity;
123
- }
124
-
125
- interface LayerArchExpectation {
126
- readonly not: LayerArchExpectation;
127
- localDependencies(): LayerArchExpectation;
128
- toDependOn(target: Selector): LayerArchExpectation;
129
- toOnlyBeDependedOnBy(target: Selector): LayerArchExpectation;
130
- toOnlyDependOn(target: Selector): LayerArchExpectation;
131
- toSatisfy(id: string, evaluator: CustomRule, metadata?: Omit<RuleMetadata, 'id'>): LayerArchExpectation;
132
- }
133
- interface LayerSuite {
134
- expect(selector: Selector): LayerArchExpectation;
135
- rule(id: string, evaluator: CustomRule, metadata?: Omit<RuleMetadata, 'id'>): LayerSuite;
136
- }
137
- declare class ArchitectureLayers {
138
- #private;
139
- constructor(suite: LayerSuite, definitions: Readonly<Record<string, Selector>>);
140
- where(name: string): LayerExpectation;
141
- toBeFreeOfCycles(): this;
142
- }
143
- declare class LayerExpectation {
144
- #private;
145
- constructor(suite: LayerSuite, definitions: Readonly<Record<string, Selector>>, name: string);
146
- mayDependOn(...names: readonly string[]): this;
147
- mayOnlyDependOn(...names: readonly string[]): this;
148
- mayNotDependOn(...names: readonly string[]): this;
149
- mayOnlyBeUsedBy(...names: readonly string[]): this;
150
- exposeThrough(...barrels: readonly string[]): this;
151
- private selectors;
152
- }
153
-
154
- interface Selection {
155
- readonly ignored: string[];
156
- readonly selector: Selector;
157
- }
158
- interface RuleBase {
159
- id?: string;
160
- readonly kind: string;
161
- reason?: string;
162
- readonly selection: Selection;
163
- severity: RuleSeverity;
164
- }
165
- interface DependencyRule extends RuleBase {
166
- readonly dependencyKinds?: readonly DependencyKind[];
167
- readonly kind: 'depend-on' | 'only-depend-on' | 'depended-on-by' | 'only-depended-on-by';
168
- readonly localOnly: boolean;
169
- readonly negated: boolean;
170
- readonly target: Selector;
171
- readonly transitive: boolean;
172
- }
173
- interface CycleRule extends RuleBase {
174
- readonly collapseToFolderDepth?: number;
175
- readonly dependencyKinds?: readonly DependencyKind[];
176
- readonly kind: 'free-of-cycles';
177
- }
178
- interface NameRule extends RuleBase {
179
- readonly kind: 'prefix' | 'suffix';
180
- readonly negated: boolean;
181
- readonly value: string;
182
- }
183
- interface LineCountRule extends RuleBase {
184
- readonly kind: 'line-count-less-than';
185
- readonly negated: boolean;
186
- readonly value: number;
187
- }
188
- interface DeclarationKindRule extends RuleBase {
189
- readonly declarationKind: DeclarationKind;
190
- readonly kind: 'declaration-kind';
191
- readonly negated: boolean;
192
- }
193
- interface DeclarationModifierRule extends RuleBase {
194
- readonly kind: 'abstract' | 'exported';
195
- readonly negated: boolean;
196
- }
197
- interface HeritageRule extends RuleBase {
198
- readonly kind: 'extend' | 'implement';
199
- readonly negated: boolean;
200
- readonly value: string;
201
- }
202
- interface DecoratorRule extends RuleBase {
203
- readonly kind: 'decorator';
204
- readonly negated: boolean;
205
- readonly value: string;
206
- }
207
- interface ExportRule extends RuleBase {
208
- readonly kind: 'only-export';
209
- readonly names: readonly string[];
210
- readonly negated: boolean;
211
- }
212
- interface ReadonlyRule extends RuleBase {
213
- readonly kind: 'readonly-properties';
214
- readonly negated: boolean;
215
- }
216
- interface StrictEqualityRule extends RuleBase {
217
- readonly kind: 'strict-equality';
218
- }
219
- interface GlobalUseRule extends RuleBase {
220
- readonly globals: readonly string[];
221
- readonly kind: 'use-globals';
222
- readonly negated: boolean;
223
- }
224
- interface ImportedSymbolUseRule extends RuleBase {
225
- readonly importedFrom: string;
226
- readonly kind: 'use-imported-symbols';
227
- readonly negated: boolean;
228
- readonly symbols: readonly string[];
229
- }
230
- interface MethodRule extends RuleBase {
231
- readonly kind: 'have-methods' | 'have-visible-methods' | 'only-public-methods';
232
- readonly names: readonly string[];
233
- readonly negated: boolean;
234
- readonly visibility?: 'private' | 'protected' | 'public';
235
- }
236
- interface ResolutionRule extends RuleBase {
237
- readonly allowDynamic: boolean;
238
- readonly kind: 'resolvable-dependencies';
239
- }
240
- interface PublicApiRule extends RuleBase {
241
- readonly kind: 'public-api';
242
- readonly negated: boolean;
243
- }
244
- interface CustomRuleDefinition extends RuleBase {
245
- readonly evaluator: CustomRule;
246
- readonly kind: 'custom';
247
- }
248
- type ArchitectureRule = CustomRuleDefinition | CycleRule | DeclarationKindRule | DeclarationModifierRule | DecoratorRule | DependencyRule | ExportRule | GlobalUseRule | HeritageRule | ImportedSymbolUseRule | LineCountRule | MethodRule | NameRule | PublicApiRule | ReadonlyRule | ResolutionRule | StrictEqualityRule;
249
-
250
- interface CycleOptions {
251
- readonly collapseToFolderDepth?: number;
252
- readonly dependencyKinds?: readonly DependencyKind[];
253
- }
254
- interface ResolutionOptions {
255
- readonly allowDynamic?: boolean;
256
- }
257
- type ArcherPreset = (suite: ArchitectureSuite, options?: unknown) => void;
258
- declare class ArchitectureSuite {
259
- #private;
260
- readonly options: ArcherOptions;
261
- constructor(options?: ArcherOptions);
262
- expect(selector: Selector): ArchExpectation;
263
- layers(definitions: Readonly<Record<string, Selector>>): ArchitectureLayers;
264
- preset(name: string, options?: unknown): this;
265
- rule(id: string, evaluator: CustomRule, ruleMetadata?: Omit<RuleMetadata, 'id'>): this;
266
- add(rule: ArchitectureRule): void;
267
- decorateLast(values: RuleMetadata): void;
268
- check(graph?: ArchitectureGraph): Promise<ArchitectureResult>;
269
- }
270
- declare class ArchExpectation {
271
- #private;
272
- constructor(suite: ArchitectureSuite, selection: Selection);
273
- get and(): this;
274
- get not(): this;
275
- expect(selector: Selector): ArchExpectation;
276
- ignoring(...selectors: readonly string[]): this;
277
- includingDependencyKinds(...kinds: readonly DependencyKind[]): this;
278
- runtimeDependencies(): this;
279
- typeDependencies(): this;
280
- dynamicDependencies(): this;
281
- localDependencies(): this;
282
- transitively(): this;
283
- toDependOn(target: Selector): this;
284
- toTransitivelyDependOn(target: Selector): this;
285
- toUse(target: Selector): this;
286
- toOnlyDependOn(target: Selector): this;
287
- toOnlyUse(target: Selector): this;
288
- toUseNothing(): this;
289
- toBeDependedOnBy(target: Selector): this;
290
- toTransitivelyBeDependedOnBy(target: Selector): this;
291
- toBeUsedIn(target: Selector): this;
292
- toBeUsed(): this;
293
- toOnlyBeDependedOnBy(target: Selector): this;
294
- toOnlyBeUsedIn(target: Selector): this;
295
- toBeFreeOfCycles(options?: CycleOptions): this;
296
- toBeFreeOfFolderCycles(depth?: number): this;
297
- toHavePrefix(value: string): this;
298
- toHaveSuffix(value: string): this;
299
- toHaveLineCountLessThan(value: number): this;
300
- toBeClasses(): this;
301
- toBeEnums(): this;
302
- toBeFunctions(): this;
303
- toBeInterfaces(): this;
304
- toBeTypes(): this;
305
- toBeAbstract(): this;
306
- toBeExported(): this;
307
- toExtend(value: string): this;
308
- toImplement(value: string): this;
309
- toHaveDecorator(value: string): this;
310
- toOnlyExport(...names: readonly string[]): this;
311
- toHaveReadonlyProperties(): this;
312
- toUseStrictEquality(): this;
313
- toUseGlobals(...globals: readonly string[]): this;
314
- toUseImportedSymbols(importedFrom: string, ...symbols: readonly string[]): this;
315
- toHaveMethods(...names: readonly string[]): this;
316
- toHavePublicMethods(...names: readonly string[]): this;
317
- toHaveProtectedMethods(...names: readonly string[]): this;
318
- toHavePrivateMethods(...names: readonly string[]): this;
319
- toOnlyHavePublicMethods(...names: readonly string[]): this;
320
- toHaveResolvableDependencies(options?: ResolutionOptions): this;
321
- toBePublicApi(): this;
322
- toSatisfy(id: string, evaluator: CustomRule, ruleMetadata?: Omit<RuleMetadata, 'id'>): this;
323
- because(reason: string): this;
324
- as(id: string): this;
325
- withSeverity(severity: RuleSeverity): this;
326
- private addDeclarationKind;
327
- private addVisibleMethods;
328
- private addSimple;
329
- private consumeNegation;
330
- private addDependencyRule;
331
- }
332
- declare function createArcher(options?: ArcherOptions): ArchitectureSuite;
333
- declare function registerPreset(name: string, preset: ArcherPreset): void;
334
- declare function applyPreset(name: string, suite: ArchitectureSuite, options?: unknown): void;
335
- declare function availablePresets(): readonly string[];
336
-
337
- export { type ArcherOptions as A, type CustomRule as C, type DeclarationInfo as D, LayerExpectation as L, type MethodInfo as M, type ProjectInfo as P, type ResolutionOptions as R, type Selector as S, ArchitectureSuite as a, type ArchitectureGraph as b, type ArchitectureResult as c, type ArchitectureViolation as d, ArchExpectation as e, type ArcherPreset as f, type ArcherProjectOptions as g, ArchitectureLayers as h, type CustomRuleContext as i, type CustomRuleResult as j, type CycleOptions as k, type DeclarationKind as l, type Dependency as m, type DependencyKind as n, type DependencyResolution as o, type RuleMetadata as p, type RuleSeverity as q, type SourceLocation as r, type SourceModule as s, type SourceUse as t, applyPreset as u, availablePresets as v, createArcher as w, registerPreset as x };