@lucasacoutinho/archer 0.2.0 → 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.
- package/README.md +145 -387
- package/dist/analyzer/Analyzer.d.ts +17 -0
- package/dist/analyzer/Analyzer.d.ts.map +1 -0
- package/dist/analyzer/Analyzer.js +15 -0
- package/dist/analyzer/Analyzer.js.map +1 -0
- package/dist/analyzer/bindings.d.ts +26 -0
- package/dist/analyzer/bindings.d.ts.map +1 -0
- package/dist/analyzer/bindings.js +61 -0
- package/dist/analyzer/bindings.js.map +1 -0
- package/dist/analyzer/errors.d.ts +34 -0
- package/dist/analyzer/errors.d.ts.map +1 -0
- package/dist/analyzer/errors.js +20 -0
- package/dist/analyzer/errors.js.map +1 -0
- package/dist/analyzer/graph-file.d.ts +13 -0
- package/dist/analyzer/graph-file.d.ts.map +1 -0
- package/dist/analyzer/graph-file.js +22 -0
- package/dist/analyzer/graph-file.js.map +1 -0
- package/dist/analyzer/paths.d.ts +12 -0
- package/dist/analyzer/paths.d.ts.map +1 -0
- package/dist/analyzer/paths.js +26 -0
- package/dist/analyzer/paths.js.map +1 -0
- package/dist/analyzer/server-exit.d.ts +19 -0
- package/dist/analyzer/server-exit.d.ts.map +1 -0
- package/dist/analyzer/server-exit.js +70 -0
- package/dist/analyzer/server-exit.js.map +1 -0
- package/dist/analyzer/source.d.ts +29 -0
- package/dist/analyzer/source.d.ts.map +1 -0
- package/dist/analyzer/source.js +58 -0
- package/dist/analyzer/source.js.map +1 -0
- package/dist/analyzer/syntax.d.ts +29 -0
- package/dist/analyzer/syntax.d.ts.map +1 -0
- package/dist/analyzer/syntax.js +226 -0
- package/dist/analyzer/syntax.js.map +1 -0
- package/dist/analyzer/targets.d.ts +26 -0
- package/dist/analyzer/targets.d.ts.map +1 -0
- package/dist/analyzer/targets.js +84 -0
- package/dist/analyzer/targets.js.map +1 -0
- package/dist/analyzer/typescript.d.ts +5 -0
- package/dist/analyzer/typescript.d.ts.map +1 -0
- package/dist/analyzer/typescript.js +221 -0
- package/dist/analyzer/typescript.js.map +1 -0
- package/dist/analyzer/workspace.d.ts +24 -0
- package/dist/analyzer/workspace.d.ts.map +1 -0
- package/dist/analyzer/workspace.js +9 -0
- package/dist/analyzer/workspace.js.map +1 -0
- package/dist/cli/explain.d.ts +3 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +21 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +159 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/config/input.d.ts +59 -0
- package/dist/config/input.d.ts.map +1 -0
- package/dist/config/input.js +115 -0
- package/dist/config/input.js.map +1 -0
- package/dist/config/rules.d.ts +94 -0
- package/dist/config/rules.d.ts.map +1 -0
- package/dist/config/rules.js +130 -0
- package/dist/config/rules.js.map +1 -0
- package/dist/core/baseline.d.ts +16 -0
- package/dist/core/baseline.d.ts.map +1 -0
- package/dist/core/baseline.js +25 -0
- package/dist/core/baseline.js.map +1 -0
- package/dist/core/check.d.ts +16 -0
- package/dist/core/check.d.ts.map +1 -0
- package/dist/core/check.js +271 -0
- package/dist/core/check.js.map +1 -0
- package/dist/core/config.d.ts +72 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +78 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/fingerprint.d.ts +54 -0
- package/dist/core/fingerprint.d.ts.map +1 -0
- package/dist/core/fingerprint.js +182 -0
- package/dist/core/fingerprint.js.map +1 -0
- package/dist/core/keys.d.ts +10 -0
- package/dist/core/keys.d.ts.map +1 -0
- package/dist/core/keys.js +16 -0
- package/dist/core/keys.js.map +1 -0
- package/dist/core/lower.d.ts +13 -0
- package/dist/core/lower.d.ts.map +1 -0
- package/dist/core/lower.js +82 -0
- package/dist/core/lower.js.map +1 -0
- package/dist/core/model.d.ts +155 -0
- package/dist/core/model.d.ts.map +1 -0
- package/dist/core/model.js +116 -0
- package/dist/core/model.js.map +1 -0
- package/dist/core/pattern.d.ts +13 -0
- package/dist/core/pattern.d.ts.map +1 -0
- package/dist/core/pattern.js +29 -0
- package/dist/core/pattern.js.map +1 -0
- package/dist/core/reach.d.ts +10 -0
- package/dist/core/reach.d.ts.map +1 -0
- package/dist/core/reach.js +81 -0
- package/dist/core/reach.js.map +1 -0
- package/dist/core/rule.d.ts +200 -0
- package/dist/core/rule.d.ts.map +1 -0
- package/dist/core/rule.js +162 -0
- package/dist/core/rule.js.map +1 -0
- package/dist/core/selector.d.ts +7 -0
- package/dist/core/selector.d.ts.map +1 -0
- package/dist/core/selector.js +27 -0
- package/dist/core/selector.js.map +1 -0
- package/dist/core/structural.d.ts +10 -0
- package/dist/core/structural.d.ts.map +1 -0
- package/dist/core/structural.js +24 -0
- package/dist/core/structural.js.map +1 -0
- package/dist/core/text.d.ts +26 -0
- package/dist/core/text.d.ts.map +1 -0
- package/dist/core/text.js +144 -0
- package/dist/core/text.js.map +1 -0
- package/dist/effect.d.ts +19 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +21 -0
- package/dist/effect.js.map +1 -0
- package/dist/index.d.ts +24 -44
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -52
- package/dist/index.js.map +1 -0
- package/dist/report/agent.d.ts +3 -0
- package/dist/report/agent.d.ts.map +1 -0
- package/dist/report/agent.js +35 -0
- package/dist/report/agent.js.map +1 -0
- package/dist/report/dot.d.ts +4 -0
- package/dist/report/dot.d.ts.map +1 -0
- package/dist/report/dot.js +15 -0
- package/dist/report/dot.js.map +1 -0
- package/dist/report/github.d.ts +3 -0
- package/dist/report/github.d.ts.map +1 -0
- package/dist/report/github.js +18 -0
- package/dist/report/github.js.map +1 -0
- package/dist/report/json.d.ts +3 -0
- package/dist/report/json.d.ts.map +1 -0
- package/dist/report/json.js +4 -0
- package/dist/report/json.js.map +1 -0
- package/dist/report/message.d.ts +20 -0
- package/dist/report/message.d.ts.map +1 -0
- package/dist/report/message.js +73 -0
- package/dist/report/message.js.map +1 -0
- package/dist/report/pretty.d.ts +8 -0
- package/dist/report/pretty.d.ts.map +1 -0
- package/dist/report/pretty.js +89 -0
- package/dist/report/pretty.js.map +1 -0
- package/dist/report/render.d.ts +9 -0
- package/dist/report/render.d.ts.map +1 -0
- package/dist/report/render.js +10 -0
- package/dist/report/render.js.map +1 -0
- package/dist/report/report.d.ts +44 -0
- package/dist/report/report.d.ts.map +1 -0
- package/dist/report/report.js +49 -0
- package/dist/report/report.js.map +1 -0
- package/dist/report/sarif.d.ts +3 -0
- package/dist/report/sarif.d.ts.map +1 -0
- package/dist/report/sarif.js +68 -0
- package/dist/report/sarif.js.map +1 -0
- package/dist/run.d.ts +49 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +87 -0
- package/dist/run.js.map +1 -0
- package/dist/shell/baseline-file.d.ts +20 -0
- package/dist/shell/baseline-file.d.ts.map +1 -0
- package/dist/shell/baseline-file.js +46 -0
- package/dist/shell/baseline-file.js.map +1 -0
- package/dist/shell/load-config.d.ts +19 -0
- package/dist/shell/load-config.d.ts.map +1 -0
- package/dist/shell/load-config.js +39 -0
- package/dist/shell/load-config.js.map +1 -0
- package/package.json +29 -177
- package/skills/archer/SKILL.md +127 -45
- package/skills/archer/agents/openai.yaml +2 -2
- package/skills/archer/references/rules.md +267 -54
- package/dist/bun/plugin.cjs +0 -85
- package/dist/bun/plugin.d.cts +0 -7
- package/dist/bun/plugin.d.ts +0 -7
- package/dist/bun/plugin.js +0 -11
- package/dist/bun.cjs +0 -2238
- package/dist/bun.d.cts +0 -13
- package/dist/bun.d.ts +0 -13
- package/dist/bun.js +0 -28
- package/dist/chunk-2AKMBLHG.js +0 -2165
- package/dist/chunk-67YEOTXP.js +0 -25
- package/dist/chunk-IDVLHNL2.js +0 -46
- package/dist/chunk-ZZ6TR4PO.js +0 -201
- package/dist/cli.js +0 -2643
- package/dist/index.cjs +0 -2484
- package/dist/index.d.cts +0 -45
- package/dist/jest/plugin.cjs +0 -85
- package/dist/jest/plugin.d.cts +0 -7
- package/dist/jest/plugin.d.ts +0 -7
- package/dist/jest/plugin.js +0 -11
- package/dist/jest.cjs +0 -2237
- package/dist/jest.d.cts +0 -13
- package/dist/jest.d.ts +0 -13
- package/dist/jest.js +0 -27
- package/dist/matchers-Cqnbsyxe.d.cts +0 -11
- package/dist/matchers-Cqnbsyxe.d.ts +0 -11
- package/dist/node.cjs +0 -2237
- package/dist/node.d.cts +0 -13
- package/dist/node.d.ts +0 -13
- package/dist/node.js +0 -27
- package/dist/reporters-BbAXMpuW.d.cts +0 -6
- package/dist/reporters-xh-HQneS.d.ts +0 -6
- package/dist/suite-BwnPDCvU.d.cts +0 -337
- package/dist/suite-BwnPDCvU.d.ts +0 -337
- package/dist/vitest/plugin.cjs +0 -85
- package/dist/vitest/plugin.d.cts +0 -7
- package/dist/vitest/plugin.d.ts +0 -7
- package/dist/vitest/plugin.js +0 -11
- package/dist/vitest.cjs +0 -2531
- package/dist/vitest.d.cts +0 -37
- package/dist/vitest.d.ts +0 -37
- 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 };
|
package/dist/jest/plugin.cjs
DELETED
|
@@ -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
|
-
});
|
package/dist/jest/plugin.d.cts
DELETED
package/dist/jest/plugin.d.ts
DELETED
package/dist/jest/plugin.js
DELETED