@nielspeter/eess-ts 0.2.0 → 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.
package/README.md
CHANGED
|
@@ -13,6 +13,33 @@ Inspired by Java's [ArchUnit](https://www.archunit.org/). Powered by [ts-morph](
|
|
|
13
13
|
|
|
14
14
|
[Documentation](https://nielspeter.github.io/ts-archunit/) · [Getting Started](https://nielspeter.github.io/ts-archunit/getting-started) · [What Can It Check?](https://nielspeter.github.io/ts-archunit/what-to-check)
|
|
15
15
|
|
|
16
|
+
## Quickstart — zero to a red gate
|
|
17
|
+
|
|
18
|
+
A green check you've never seen fail proves nothing. This path takes you to a
|
|
19
|
+
**real, correct violation** — timed at seconds on a warm npm cache, minutes
|
|
20
|
+
cold:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -D @nielspeter/eess-ts # Node >= 24; your project may be ESM or CJS
|
|
24
|
+
npx eess-ts init # scaffolds arch.rules.ts — editable guardrail rules
|
|
25
|
+
npx eess-ts check # runs them against your source
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
On most existing codebases the floor fires immediately (a silent `catch {}`,
|
|
29
|
+
an empty stub body, an `eval`). If yours comes up clean — good; now **prove
|
|
30
|
+
the gate is real** the same way eess proves its own gates in CI: introduce a
|
|
31
|
+
violation, watch it go red, revert.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
echo 'export function probe(s: string): unknown { return eval(s) }' >> src/probe.ts
|
|
35
|
+
npx eess-ts check # ✗ red — preset/recommended/no-eval, with why + fix
|
|
36
|
+
rm src/probe.ts # green again — and now you trust the green
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then wire the rules into your agent's loop — CI annotations, a Claude Code
|
|
40
|
+
hook, and an AGENTS.md block regenerated from the actual rules:
|
|
41
|
+
[agent integration recipes](../../docs/agent-integration.md).
|
|
42
|
+
|
|
16
43
|
## The Problem
|
|
17
44
|
|
|
18
45
|
AI coding agents don't know your architecture. They generate code that compiles, passes type checks, and looks correct in isolation — but violates the structural decisions your team spent months establishing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config.d.ts","sourceRoot":"","sources":["../../src/cli/resolve-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-config.d.ts","sourceRoot":"","sources":["../../src/cli/resolve-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAK5C;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAgB7E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
+
import { createJiti } from 'jiti';
|
|
3
4
|
// Config file names, in resolution order. First match wins.
|
|
4
5
|
const CONFIG_FILENAMES = ['eess-ts.config.ts', 'eess-ts.config.js'];
|
|
5
6
|
/**
|
|
@@ -14,7 +15,16 @@ export async function resolveConfig(explicitPath) {
|
|
|
14
15
|
const configPath = explicitPath ?? findConfigFile();
|
|
15
16
|
if (configPath === undefined)
|
|
16
17
|
return {};
|
|
17
|
-
|
|
18
|
+
// jiti, not raw import(): Node decides a .ts file's module-ness from the
|
|
19
|
+
// CONSUMER project's package.json `type` field, so an ESM-syntax config
|
|
20
|
+
// crashes in a "type": "commonjs" project (what `npm init -y` writes) —
|
|
21
|
+
// bug 0074. Rule files already load via jiti (load-rules.ts); the config
|
|
22
|
+
// must behave identically regardless of the host package's type.
|
|
23
|
+
// interopDefault: false — extractDefault reads `.default` itself, and the
|
|
24
|
+
// interop proxy breaks on `export default null` (its `then` probe during
|
|
25
|
+
// await dereferences the null default).
|
|
26
|
+
const jiti = createJiti(import.meta.url, { interopDefault: false });
|
|
27
|
+
const mod = await jiti.import(path.resolve(configPath));
|
|
18
28
|
return extractDefault(mod);
|
|
19
29
|
}
|
|
20
30
|
function findConfigFile() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config.js","sourceRoot":"","sources":["../../src/cli/resolve-config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"resolve-config.js","sourceRoot":"","sources":["../../src/cli/resolve-config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGjC,4DAA4D;AAC5D,MAAM,gBAAgB,GAAG,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAA;AAEnE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,YAAqB;IACvD,MAAM,UAAU,GAAG,YAAY,IAAI,cAAc,EAAE,CAAA;IAEnD,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAEvC,yEAAyE;IACzE,wEAAwE;IACxE,wEAAwE;IACxE,yEAAyE;IACzE,iEAAiE;IACjE,0EAA0E;IAC1E,yEAAyE;IACzE,wCAAwC;IACxC,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAA;IACnE,MAAM,GAAG,GAAY,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;IAChE,OAAO,cAAc,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IACzB,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;QACpC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,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AI,aAAa,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC;QAChE,MAAM,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAA;IACtF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nielspeter/eess-ts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Architecture testing for TypeScript — the TS dialect of the eess family (formerly ts-archunit)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@nielspeter/eess": "^0.2.
|
|
116
|
+
"@nielspeter/eess": "^0.2.1",
|
|
117
117
|
"jiti": "^2.6.1",
|
|
118
118
|
"picomatch": "^4.0.4",
|
|
119
119
|
"ts-morph": "^27.0.2"
|