@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/index.d.cts DELETED
@@ -1,45 +0,0 @@
1
- import { A as ArcherOptions, b as ArchitectureGraph, c as ArchitectureResult, d as ArchitectureViolation, a as ArchitectureSuite } from './suite-BwnPDCvU.cjs';
2
- export { e as ArchExpectation, f as ArcherPreset, g as ArcherProjectOptions, h as ArchitectureLayers, C as CustomRule, i as CustomRuleContext, j as CustomRuleResult, k as CycleOptions, D as DeclarationInfo, l as DeclarationKind, m as Dependency, n as DependencyKind, o as DependencyResolution, L as LayerExpectation, M as MethodInfo, P as ProjectInfo, R as ResolutionOptions, p as RuleMetadata, q as RuleSeverity, S as Selector, r as SourceLocation, s as SourceModule, t as SourceUse, u as applyPreset, v as availablePresets, w as createArcher, x as registerPreset } from './suite-BwnPDCvU.cjs';
3
- import { R as ReporterName } from './reporters-BbAXMpuW.cjs';
4
- export { r as report } from './reporters-BbAXMpuW.cjs';
5
- export { a as archerMatchers } from './matchers-Cqnbsyxe.cjs';
6
-
7
- declare function clearAnalysisCache(): void;
8
- declare function analyze(options?: ArcherOptions): Promise<ArchitectureGraph>;
9
-
10
- interface BaselineEntry {
11
- readonly file?: string;
12
- readonly fingerprint: string;
13
- readonly message: string;
14
- readonly rule: string;
15
- }
16
- interface ArchitectureBaseline {
17
- readonly generatedAt: string;
18
- readonly version: 1;
19
- readonly violations: readonly BaselineEntry[];
20
- }
21
- declare function violationFingerprint(violation: ArchitectureViolation): string;
22
- declare function createBaseline(result: ArchitectureResult): ArchitectureBaseline;
23
- declare function readBaseline(fileName: string): Promise<ArchitectureBaseline>;
24
- declare function writeBaseline(fileName: string, baseline: ArchitectureBaseline): Promise<void>;
25
- declare function applyBaseline(result: ArchitectureResult, baseline: ArchitectureBaseline): ArchitectureResult;
26
-
27
- interface ArcherConfig extends ArcherOptions {
28
- /** Existing violations to suppress while preventing new violations. */
29
- readonly baseline?: string;
30
- /** Default report file. Standard output is used when omitted. */
31
- readonly output?: string;
32
- /** Configure the architecture suite. */
33
- readonly rules: (suite: ArchitectureSuite) => Promise<void> | void;
34
- /** Default CLI reporter. */
35
- readonly reporter?: ReporterName;
36
- }
37
- declare function defineConfig<const T extends ArcherConfig>(config: T): T;
38
-
39
- declare function formatResult(result: ArchitectureResult): string;
40
- declare class ArchitectureError extends Error {
41
- readonly result: ArchitectureResult;
42
- constructor(result: ArchitectureResult);
43
- }
44
-
45
- export { type ArcherConfig, ArcherOptions, type ArchitectureBaseline, ArchitectureError, ArchitectureGraph, ArchitectureResult, ArchitectureSuite, ArchitectureViolation, type BaselineEntry, ReporterName, analyze, applyBaseline, clearAnalysisCache, createBaseline, defineConfig, formatResult, readBaseline, violationFingerprint, writeBaseline };
@@ -1,85 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/adapters/jest/plugin.ts
21
- var plugin_exports = {};
22
- __export(plugin_exports, {
23
- archerMatchers: () => archerMatchers
24
- });
25
- module.exports = __toCommonJS(plugin_exports);
26
- var import_globals = require("@jest/globals");
27
-
28
- // src/reporting/format.ts
29
- function formatLocation(violation) {
30
- if (violation.file === void 0) {
31
- return "";
32
- }
33
- if (violation.line === void 0) {
34
- return violation.file;
35
- }
36
- return `${violation.file}:${violation.line}:${violation.column ?? 1}`;
37
- }
38
- function formatResult(result) {
39
- if (result.violations.length === 0) {
40
- return `Archer checked ${result.filesAnalyzed} files and ${result.dependenciesAnalyzed} dependencies.`;
41
- }
42
- const violations = result.violations.map((violation) => {
43
- const location = formatLocation(violation);
44
- const prefix = location.length > 0 ? ` ${location}
45
- ` : " ";
46
- const source = violation.sourceLine === void 0 ? "" : `
47
- ${violation.sourceLine.trim()}
48
- ${" ".repeat(Math.max(0, (violation.column ?? 1) - 1))}^`;
49
- const chain = violation.importChain === void 0 || violation.importChain.length < 3 ? "" : `
50
- Import chain: ${violation.importChain.join(" -> ")}`;
51
- const reason = violation.reason === void 0 ? "" : `
52
- Because: ${violation.reason}`;
53
- const id = violation.ruleId === void 0 ? "" : ` [${violation.ruleId}]`;
54
- return `${prefix} ${violation.severity.toUpperCase()}${id}: ${violation.message}${source}
55
- Rule: ${violation.rule}${reason}${chain}`;
56
- });
57
- return `${result.violations.length} architecture finding${result.violations.length === 1 ? "" : "s"}:
58
-
59
- ${violations.join("\n\n")}`;
60
- }
61
-
62
- // src/testing/matchers.ts
63
- function isArchitectureCheck(value) {
64
- return typeof value === "object" && value !== null && "check" in value && typeof value.check === "function";
65
- }
66
- async function toRespectArchitecture(received) {
67
- if (!isArchitectureCheck(received)) {
68
- throw new TypeError(
69
- "toRespectArchitecture() expects an Archer suite created by createArcher() or arch()."
70
- );
71
- }
72
- const result = await received.check();
73
- return {
74
- pass: result.ok,
75
- message: () => result.ok ? "Expected the architecture check to report at least one finding." : formatResult(result)
76
- };
77
- }
78
- var archerMatchers = { toRespectArchitecture };
79
-
80
- // src/adapters/jest/plugin.ts
81
- import_globals.expect.extend(archerMatchers);
82
- // Annotate the CommonJS export names for ESM import in node:
83
- 0 && (module.exports = {
84
- archerMatchers
85
- });
@@ -1,7 +0,0 @@
1
- export { a as archerMatchers } from '../matchers-Cqnbsyxe.cjs';
2
-
3
- declare module 'expect' {
4
- interface Matchers<R extends Promise<void> | void, T = unknown> {
5
- toRespectArchitecture(): Promise<void>;
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- export { a as archerMatchers } from '../matchers-Cqnbsyxe.js';
2
-
3
- declare module 'expect' {
4
- interface Matchers<R extends Promise<void> | void, T = unknown> {
5
- toRespectArchitecture(): Promise<void>;
6
- }
7
- }
@@ -1,11 +0,0 @@
1
- import {
2
- archerMatchers
3
- } from "../chunk-67YEOTXP.js";
4
- import "../chunk-IDVLHNL2.js";
5
-
6
- // src/adapters/jest/plugin.ts
7
- import { expect } from "@jest/globals";
8
- expect.extend(archerMatchers);
9
- export {
10
- archerMatchers
11
- };