@lucasacoutinho/archer 0.0.0-stage → 0.2.1

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 (50) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +459 -2
  4. package/dist/bun/plugin.cjs +85 -0
  5. package/dist/bun/plugin.d.cts +7 -0
  6. package/dist/bun/plugin.d.ts +7 -0
  7. package/dist/bun/plugin.js +11 -0
  8. package/dist/bun.cjs +2238 -0
  9. package/dist/bun.d.cts +13 -0
  10. package/dist/bun.d.ts +13 -0
  11. package/dist/bun.js +28 -0
  12. package/dist/chunk-2AKMBLHG.js +2165 -0
  13. package/dist/chunk-67YEOTXP.js +25 -0
  14. package/dist/chunk-IDVLHNL2.js +46 -0
  15. package/dist/chunk-ZZ6TR4PO.js +201 -0
  16. package/dist/cli.js +2643 -0
  17. package/dist/index.cjs +2484 -0
  18. package/dist/index.d.cts +45 -0
  19. package/dist/index.d.ts +45 -0
  20. package/dist/index.js +54 -0
  21. package/dist/jest/plugin.cjs +85 -0
  22. package/dist/jest/plugin.d.cts +7 -0
  23. package/dist/jest/plugin.d.ts +7 -0
  24. package/dist/jest/plugin.js +11 -0
  25. package/dist/jest.cjs +2237 -0
  26. package/dist/jest.d.cts +13 -0
  27. package/dist/jest.d.ts +13 -0
  28. package/dist/jest.js +27 -0
  29. package/dist/matchers-Cqnbsyxe.d.cts +11 -0
  30. package/dist/matchers-Cqnbsyxe.d.ts +11 -0
  31. package/dist/node.cjs +2237 -0
  32. package/dist/node.d.cts +13 -0
  33. package/dist/node.d.ts +13 -0
  34. package/dist/node.js +27 -0
  35. package/dist/reporters-BbAXMpuW.d.cts +6 -0
  36. package/dist/reporters-xh-HQneS.d.ts +6 -0
  37. package/dist/suite-BwnPDCvU.d.cts +337 -0
  38. package/dist/suite-BwnPDCvU.d.ts +337 -0
  39. package/dist/vitest/plugin.cjs +85 -0
  40. package/dist/vitest/plugin.d.cts +7 -0
  41. package/dist/vitest/plugin.d.ts +7 -0
  42. package/dist/vitest/plugin.js +11 -0
  43. package/dist/vitest.cjs +2531 -0
  44. package/dist/vitest.d.cts +37 -0
  45. package/dist/vitest.d.ts +37 -0
  46. package/dist/vitest.js +139 -0
  47. package/package.json +216 -4
  48. package/skills/archer/SKILL.md +81 -0
  49. package/skills/archer/agents/openai.yaml +4 -0
  50. package/skills/archer/references/rules.md +87 -0
@@ -0,0 +1,85 @@
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/bun/plugin.ts
21
+ var plugin_exports = {};
22
+ __export(plugin_exports, {
23
+ archerMatchers: () => archerMatchers
24
+ });
25
+ module.exports = __toCommonJS(plugin_exports);
26
+ var import_bun_test = require("bun:test");
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/bun/plugin.ts
81
+ import_bun_test.expect.extend(archerMatchers);
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ archerMatchers
85
+ });
@@ -0,0 +1,7 @@
1
+ export { a as archerMatchers } from '../matchers-Cqnbsyxe.cjs';
2
+
3
+ declare module 'bun:test' {
4
+ interface Matchers<T = unknown> {
5
+ toRespectArchitecture(): Promise<void>;
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ export { a as archerMatchers } from '../matchers-Cqnbsyxe.js';
2
+
3
+ declare module 'bun:test' {
4
+ interface Matchers<T = unknown> {
5
+ toRespectArchitecture(): Promise<void>;
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ import {
2
+ archerMatchers
3
+ } from "../chunk-67YEOTXP.js";
4
+ import "../chunk-IDVLHNL2.js";
5
+
6
+ // src/adapters/bun/plugin.ts
7
+ import { expect } from "bun:test";
8
+ expect.extend(archerMatchers);
9
+ export {
10
+ archerMatchers
11
+ };