archprint 0.5.0 → 0.6.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/CHANGELOG.md +10 -0
- package/README.md +54 -46
- package/dist/cli/adoption-readme.d.ts +7 -0
- package/dist/cli/adoption-readme.d.ts.map +1 -0
- package/dist/cli/adoption-readme.js +76 -0
- package/dist/cli/adoption-readme.js.map +1 -0
- package/dist/cli/archprint-config.d.ts +33 -0
- package/dist/cli/archprint-config.d.ts.map +1 -0
- package/dist/cli/archprint-config.js +83 -0
- package/dist/cli/archprint-config.js.map +1 -0
- package/dist/cli/generate.d.ts +39 -43
- package/dist/cli/generate.d.ts.map +1 -1
- package/dist/cli/generate.js +143 -283
- package/dist/cli/generate.js.map +1 -1
- package/dist/cli/ignore-file.d.ts +8 -0
- package/dist/cli/ignore-file.d.ts.map +1 -0
- package/dist/cli/ignore-file.js +37 -0
- package/dist/cli/ignore-file.js.map +1 -0
- package/dist/cli/layout.d.ts +24 -0
- package/dist/cli/layout.d.ts.map +1 -0
- package/dist/cli/layout.js +74 -0
- package/dist/cli/layout.js.map +1 -0
- package/dist/cli/migrate.d.ts +27 -0
- package/dist/cli/migrate.d.ts.map +1 -0
- package/dist/cli/migrate.js +177 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli/outputs-manifest.d.ts +0 -6
- package/dist/cli/outputs-manifest.d.ts.map +1 -1
- package/dist/cli/outputs-manifest.js +2 -29
- package/dist/cli/outputs-manifest.js.map +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +131 -61
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/report.d.ts +3 -2
- package/dist/cli/report.d.ts.map +1 -1
- package/dist/cli/report.js +19 -11
- package/dist/cli/report.js.map +1 -1
- package/dist/cli/wiring.d.ts +2 -13
- package/dist/cli/wiring.d.ts.map +1 -1
- package/dist/cli/wiring.js +18 -89
- package/dist/cli/wiring.js.map +1 -1
- package/dist/generator/eslint-preset-emitter.d.ts +4 -1
- package/dist/generator/eslint-preset-emitter.d.ts.map +1 -1
- package/dist/generator/eslint-preset-emitter.js +6 -4
- package/dist/generator/eslint-preset-emitter.js.map +1 -1
- package/package.json +5 -5
- package/dist/cli/init.d.ts +0 -21
- package/dist/cli/init.d.ts.map +0 -1
- package/dist/cli/init.js +0 -19
- package/dist/cli/init.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# archprint
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Archprint now writes a minimal `.archprint/` directory instead of a folder of per-family files. `generate` and `init` emit one self-contained rules file per linter you actually use (`.archprint/eslint.mjs` and/or `.archprint/dependency-cruiser.json`) plus a `.archprint/config.json` that records what is enforced and what Archprint manages. The plain-language summary that used to be `ADOPTION.md` is now a managed section in your `README.md`, and a managed `.prettierignore` entry keeps the generated files out of your formatter.
|
|
8
|
+
|
|
9
|
+
- `--expand` writes the granular artifacts (per-family configs, per-rule cards and fixtures, the eslint-plugin, ts-arch tests, and the layer graph) inside `.archprint/` for anyone who wants to inspect or vendor individual rules.
|
|
10
|
+
- New `archprint migrate` (alias `upgrade`) moves an older `archprint-rules/` setup to the new layout and rewrites the reference in your linter config in place, writing the new files before removing the old ones so the config never points at a deleted file. `generate` and `init` stop and point you to it if they detect the old layout.
|
|
11
|
+
- `wire` imports the single rules file with an ESM-safe relative specifier, and `eject` removes the files, the config, the managed README section, and every wired reference.
|
|
12
|
+
|
|
3
13
|
## 0.5.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -32,11 +32,12 @@ families held for human review by default, emitted only with `--include-structur
|
|
|
32
32
|
server/client, feature-slice and app isolation), plus dependency hygiene, whose enforcement can over-flag.
|
|
33
33
|
Nothing that could be wrong is written as enforcement without you opting in.
|
|
34
34
|
|
|
35
|
-
> Status: published on npm and safe to
|
|
35
|
+
> Status: published on npm and safe to run on your real repo. Every rule is review-gated by default,
|
|
36
36
|
> reversible in one command (`archprint eject`), and deterministic, and a rule archprint marks
|
|
37
37
|
> "enforce now" is checked to pass on your code before it says so. `scan` and `recommend` are stable;
|
|
38
|
-
> the structural families stay review-only while they are hardened. Versioning is 0.x
|
|
39
|
-
> and rule
|
|
38
|
+
> the structural families stay review-only while they are hardened. Versioning is still 0.x, so the CLI
|
|
39
|
+
> surface and rule format can refine between minor versions (the 0.6.0 release moved output to the
|
|
40
|
+
> `.archprint/` layout; run `archprint migrate` to upgrade), but the analysis is not experimental.
|
|
40
41
|
|
|
41
42
|
## What makes it different
|
|
42
43
|
|
|
@@ -75,15 +76,15 @@ package such as `apps/web`; a monorepo root is fine too, Archprint discovers the
|
|
|
75
76
|
|
|
76
77
|
```bash
|
|
77
78
|
# One-shot setup: detect the stack, enforce the rules your code already follows,
|
|
78
|
-
# and record what to adopt next in archprint.json
|
|
79
|
+
# and record what to adopt next in .archprint/config.json
|
|
79
80
|
archprint init apps/web
|
|
80
81
|
|
|
81
82
|
# See the rules your repo already follows, with the evidence
|
|
82
83
|
archprint scan apps/web
|
|
83
84
|
|
|
84
|
-
# Write the auto-trusted (mechanical) rules to
|
|
85
|
+
# Write the auto-trusted (mechanical) rules to .archprint/, only for the linters your repo uses.
|
|
85
86
|
# Structural-inference rules are held for review; add --include-structural to emit them too.
|
|
86
|
-
archprint generate apps/web
|
|
87
|
+
archprint generate apps/web
|
|
87
88
|
|
|
88
89
|
# Confirm the generated rules pass on your repo before wiring
|
|
89
90
|
archprint generate apps/web --check
|
|
@@ -102,9 +103,12 @@ archprint wire
|
|
|
102
103
|
|
|
103
104
|
# Remove archprint's files and any wired references (clean uninstall)
|
|
104
105
|
archprint eject
|
|
106
|
+
|
|
107
|
+
# Upgrading from 0.5.x? move an older archprint-rules/ setup to the .archprint layout
|
|
108
|
+
archprint migrate
|
|
105
109
|
```
|
|
106
110
|
|
|
107
|
-
Re-running `generate` (or `init`) refreshes the files in
|
|
111
|
+
Re-running `generate` (or `init`) refreshes the files in `.archprint/` and removes any rule the
|
|
108
112
|
evidence no longer supports, so the output never drifts from the current codebase. `wire` detects the
|
|
109
113
|
enforcement tools your repo already uses (a flat eslint config, a `.dependency-cruiser.json`) and inserts a
|
|
110
114
|
single managed reference into each, one that survives those regenerations; `eject` removes archprint's files
|
|
@@ -206,31 +210,32 @@ zero rules.
|
|
|
206
210
|
|
|
207
211
|
## Output formats
|
|
208
212
|
|
|
209
|
-
`archprint generate` writes
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
-
|
|
219
|
-
import-
|
|
220
|
-
-
|
|
221
|
-
|
|
222
|
-
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
-
|
|
230
|
-
|
|
213
|
+
`archprint generate` writes a minimal `.archprint/` directory: one self-contained rules file per linter your
|
|
214
|
+
repo actually uses, plus a `config.json` that records what is enforced and what Archprint manages. It detects
|
|
215
|
+
ESLint and dependency-cruiser and emits each rule for a tool you already run, so you are not left with config
|
|
216
|
+
for a tool you do not have. `--emit <eslint|dependency-cruiser|all>` forces the format. The default output:
|
|
217
|
+
|
|
218
|
+
- **`.archprint/eslint.mjs`**: one self-contained ESLint flat-config file that inlines every inferred ESLint
|
|
219
|
+
rule (marker-based forbidden imports, `no-restricted-imports` import-style boundaries, console isolation) and
|
|
220
|
+
needs only eslint, so you can commit it, publish it, or hand it to another repo and adopt it in one line
|
|
221
|
+
(`import archprint from './.archprint/eslint.mjs'`). It self-ignores `**/.archprint/**`.
|
|
222
|
+
- **`.archprint/dependency-cruiser.json`** (when dependency-cruiser is present): one `forbidden` ruleset with
|
|
223
|
+
the mechanical boundaries (public-API deep-import, test-isolation); the review-held ones (layer, role-layering,
|
|
224
|
+
feature-slice, app-isolation, entry-purity, dependency-internals, phantom deps) are added only with
|
|
225
|
+
`--include-structural`, after you review them.
|
|
226
|
+
- **`.archprint/config.json`**: the system file, what is enforced / held / worth adopting, and the managed
|
|
227
|
+
outputs list `eject` uses.
|
|
228
|
+
- **A managed README section** summarizing what is enforced now, held for review, and worth adopting (written
|
|
229
|
+
by `init`, or `generate --readme`), plus a managed `.prettierignore` entry so the generated files stay out of
|
|
230
|
+
your formatter.
|
|
231
|
+
|
|
232
|
+
`--expand` additionally writes the granular artifacts inside `.archprint/`: the per-family ESLint and
|
|
233
|
+
dependency-cruiser JSON, per-rule cards (`.md`) with passing and failing fixtures, the
|
|
234
|
+
eslint-plugin-boundaries element-types config, ts-arch tests, and the Mermaid and Graphviz DOT layer graph.
|
|
231
235
|
|
|
232
236
|
`generate --check` runs the generated ESLint rules against your repo and reports whether they pass, so you
|
|
233
|
-
can confirm before wiring.
|
|
237
|
+
can confirm before wiring. Upgrading from 0.5.x? `archprint migrate` moves an older `archprint-rules/` setup to
|
|
238
|
+
this layout and rewires your configs in place.
|
|
234
239
|
|
|
235
240
|
## How it compares
|
|
236
241
|
|
|
@@ -254,15 +259,16 @@ orphans, reachability) and knip (dead code); rather than compete, it emits into
|
|
|
254
259
|
|
|
255
260
|
## Commands
|
|
256
261
|
|
|
257
|
-
| Command | What it does
|
|
258
|
-
| ------------------------------- |
|
|
259
|
-
| `archprint init [path]` | Zero-config setup: detect the stack, enforce the rules the code already follows, and write
|
|
260
|
-
| `archprint scan [path]` | Report the rules the repo already follows, with evidence. `--deep` resolves through barrels and aliases.
|
|
261
|
-
| `archprint generate [path]` | Write the auto-trusted mechanical rules for the linters your repo uses; structural rules held for review. `--emit <eslint\|dependency-cruiser\|all>` forces the format, `--only <family>` and `--rules <ids>` narrow the output, `--check` runs the generated rules against your repo, `--readme`
|
|
262
|
-
| `archprint
|
|
263
|
-
| `archprint
|
|
264
|
-
| `archprint
|
|
265
|
-
| `archprint
|
|
262
|
+
| Command | What it does |
|
|
263
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
264
|
+
| `archprint init [path]` | Zero-config setup: detect the stack, enforce the rules the code already follows, and write `.archprint/` plus a managed README section. `--expand`, `--include-structural`, `--out <dir>`, `--fast`, `--force`. |
|
|
265
|
+
| `archprint scan [path]` | Report the rules the repo already follows, with evidence. `--deep` resolves through barrels and aliases. |
|
|
266
|
+
| `archprint generate [path]` | Write the auto-trusted mechanical rules to `.archprint/` for the linters your repo uses; structural rules held for review. `--emit <eslint\|dependency-cruiser\|all>` forces the format, `--only <family>` and `--rules <ids>` narrow the output, `--check` runs the generated rules against your repo, `--readme` adds the README section, `--expand` also writes the per-family files/cards/fixtures/graph, `--rule <id>` emits one reviewed rule. Also `--include-structural`, `--no-graph`, `--out <dir>`, `--fast`. |
|
|
267
|
+
| `archprint migrate` (`upgrade`) | Move an older `archprint-rules/` setup to the `.archprint/` layout and rewire your configs in place. `--dry-run`. |
|
|
268
|
+
| `archprint explain <id> [path]` | Show the gate breakdown for one rule, with a codeframe per exception plus how-to-fix, when-not-to-use, and how-to-enforce. |
|
|
269
|
+
| `archprint recommend [path]` | Recommend a rule set from the repo's evidence and detected stack (works on a fresh repo too); names the installed tool that will enforce each rule. |
|
|
270
|
+
| `archprint wire` | Reference the generated rules from the enforcement tools your repo uses (flat eslint config, `.dependency-cruiser.json`) via a managed, reversible reference. `--out <dir>`, `--dry-run`. |
|
|
271
|
+
| `archprint eject` | Remove archprint's generated files, its config, the managed README section, and any wired references. `--out <dir>`, `--dry-run`. |
|
|
266
272
|
|
|
267
273
|
## Documentation
|
|
268
274
|
|
|
@@ -285,13 +291,15 @@ Same repo plus same version produces the same output. Analysis is pure and sorte
|
|
|
285
291
|
|
|
286
292
|
## Status and roadmap
|
|
287
293
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
294
|
+
Archprint is safe to adopt today: every rule is review-gated and reversible via `archprint eject`, the analysis
|
|
295
|
+
is deterministic, and `scan`/`recommend` are battle-tested at census scale. The engine (twenty detectors, the
|
|
296
|
+
confidence gate, and emitters for a self-contained ESLint file, dependency-cruiser, ts-arch, and the layer
|
|
297
|
+
graph) is in place and tested, and an adversarial correctness audit (three rounds, four real repositories) drove
|
|
298
|
+
the false-positive rate on auto-generated rules to zero for the mechanical families, which is why those
|
|
299
|
+
auto-enforce while the structural-inference families are held for review. Versioning is still 0.x, so the CLI
|
|
300
|
+
surface and rule format can refine between minor versions, that is a maturing surface, not experimental
|
|
301
|
+
analysis; the 0.6.0 release moved the output to the compact `.archprint/` layout, and `archprint migrate`
|
|
302
|
+
upgrades an older setup in place.
|
|
295
303
|
|
|
296
304
|
Production-ready today: `scan` and `recommend` (insight), and auto-enforcement of the mechanical families,
|
|
297
305
|
with a self-consistency check at generate time, an `init` scaffolder for fresh repos, and framework coverage
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ReadmeResult {
|
|
2
|
+
status: 'created' | 'updated' | 'skipped';
|
|
3
|
+
reason?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function injectAdoptionSection(readmePath: string, body: string): ReadmeResult;
|
|
6
|
+
export declare function stripAdoptionSection(readmePath: string, createdByArchprint: boolean): ReadmeResult;
|
|
7
|
+
//# sourceMappingURL=adoption-readme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adoption-readme.d.ts","sourceRoot":"","sources":["../../src/cli/adoption-readme.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAsBD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CA6BpF;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,OAAO,GAC1B,YAAY,CAwBd"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
const START = '<!-- archprint:start -->';
|
|
3
|
+
const END = '<!-- archprint:end -->';
|
|
4
|
+
function detectLayout(content) {
|
|
5
|
+
const bom = content.startsWith('') ? '' : '';
|
|
6
|
+
const eol = /\r\n/.test(content) ? '\r\n' : '\n';
|
|
7
|
+
return { eol, bom };
|
|
8
|
+
}
|
|
9
|
+
function block(body, eol) {
|
|
10
|
+
const lines = [
|
|
11
|
+
'## Architecture rules (managed by archprint, do not edit between the markers)',
|
|
12
|
+
'',
|
|
13
|
+
body.trim(),
|
|
14
|
+
];
|
|
15
|
+
return [START, ...lines, END].join(eol);
|
|
16
|
+
}
|
|
17
|
+
export function injectAdoptionSection(readmePath, body) {
|
|
18
|
+
try {
|
|
19
|
+
if (!existsSync(readmePath)) {
|
|
20
|
+
writeFileSync(readmePath, `${block(body, '\n')}\n`);
|
|
21
|
+
return { status: 'created' };
|
|
22
|
+
}
|
|
23
|
+
const raw = readFileSync(readmePath, 'utf8');
|
|
24
|
+
const { eol, bom } = detectLayout(raw);
|
|
25
|
+
const content = bom ? raw.slice(bom.length) : raw;
|
|
26
|
+
const start = content.indexOf(START);
|
|
27
|
+
const end = content.indexOf(END);
|
|
28
|
+
if ((start !== -1) !== (end !== -1) || (start !== -1 && end < start)) {
|
|
29
|
+
return { status: 'skipped', reason: 'unpaired archprint markers in README; left untouched' };
|
|
30
|
+
}
|
|
31
|
+
const normalized = content.replace(/\r\n/g, '\n');
|
|
32
|
+
const fresh = block(body, '\n');
|
|
33
|
+
let next;
|
|
34
|
+
if (start !== -1) {
|
|
35
|
+
const s = normalized.indexOf(START);
|
|
36
|
+
const e = normalized.indexOf(END) + END.length;
|
|
37
|
+
next = normalized.slice(0, s) + fresh + normalized.slice(e);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
next = `${normalized.replace(/\n+$/, '')}\n\n${fresh}\n`;
|
|
41
|
+
}
|
|
42
|
+
writeFileSync(readmePath, bom + (eol === '\r\n' ? next.replace(/\n/g, '\r\n') : next));
|
|
43
|
+
return { status: 'updated' };
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
return { status: 'skipped', reason: `could not write README (${error.message})` };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function stripAdoptionSection(readmePath, createdByArchprint) {
|
|
50
|
+
try {
|
|
51
|
+
if (!existsSync(readmePath))
|
|
52
|
+
return { status: 'skipped', reason: 'no README' };
|
|
53
|
+
const raw = readFileSync(readmePath, 'utf8');
|
|
54
|
+
const { eol, bom } = detectLayout(raw);
|
|
55
|
+
const content = (bom ? raw.slice(bom.length) : raw).replace(/\r\n/g, '\n');
|
|
56
|
+
const start = content.indexOf(START);
|
|
57
|
+
const end = content.indexOf(END);
|
|
58
|
+
if (start === -1 || end === -1 || end < start) {
|
|
59
|
+
return { status: 'skipped', reason: 'no archprint section' };
|
|
60
|
+
}
|
|
61
|
+
const head = content.slice(0, start).replace(/\n+$/, '');
|
|
62
|
+
const tail = content.slice(end + END.length).replace(/^\n+/, '');
|
|
63
|
+
const without = head === '' ? tail : tail === '' ? head : `${head}\n\n${tail}`;
|
|
64
|
+
if (createdByArchprint && without.trim() === '') {
|
|
65
|
+
rmSync(readmePath, { force: true });
|
|
66
|
+
return { status: 'updated', reason: 'removed archprint-created README' };
|
|
67
|
+
}
|
|
68
|
+
const out = without.trim() === '' ? '' : `${without.replace(/\n+$/, '')}\n`;
|
|
69
|
+
writeFileSync(readmePath, bom + (eol === '\r\n' ? out.replace(/\n/g, '\r\n') : out));
|
|
70
|
+
return { status: 'updated' };
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return { status: 'skipped', reason: `could not update README (${error.message})` };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=adoption-readme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adoption-readme.js","sourceRoot":"","sources":["../../src/cli/adoption-readme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1E,MAAM,KAAK,GAAG,0BAA0B,CAAC;AACzC,MAAM,GAAG,GAAG,wBAAwB,CAAC;AAYrC,SAAS,YAAY,CAAC,OAAe;IACnC,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtB,CAAC;AAED,SAAS,KAAK,CAAC,IAAY,EAAE,GAAW;IACtC,MAAM,KAAK,GAAG;QACZ,+EAA+E;QAC/E,EAAE;QACF,IAAI,CAAC,IAAI,EAAE;KACZ,CAAC;IACF,OAAO,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,UAAkB,EAAE,IAAY;IACpE,IAAI,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5B,aAAa,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACpD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAC/B,CAAC;QACD,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,EAAE,MAA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@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Recommendation, Recommendations } from './recommend.js';
|
|
2
|
+
export declare const CONFIG_FILE = "config.json";
|
|
3
|
+
export interface ManagedOutputs {
|
|
4
|
+
files: string[];
|
|
5
|
+
readme: boolean;
|
|
6
|
+
readmeCreated: boolean;
|
|
7
|
+
prettierignore: boolean;
|
|
8
|
+
prettierignoreCreated: boolean;
|
|
9
|
+
npmignore: boolean;
|
|
10
|
+
npmignoreCreated: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ArchprintConfig {
|
|
13
|
+
archprintVersion: string;
|
|
14
|
+
app: string;
|
|
15
|
+
stack: string[];
|
|
16
|
+
rulesDir: string;
|
|
17
|
+
enforced: Recommendation[];
|
|
18
|
+
review: Recommendation[];
|
|
19
|
+
adopt: Recommendation[];
|
|
20
|
+
evidence: {
|
|
21
|
+
apps: number;
|
|
22
|
+
asOf: string;
|
|
23
|
+
};
|
|
24
|
+
managed: ManagedOutputs;
|
|
25
|
+
}
|
|
26
|
+
export declare function buildConfig(recommendations: Recommendations, version: string, location: {
|
|
27
|
+
app: string;
|
|
28
|
+
rulesDir: string;
|
|
29
|
+
}, managed: ManagedOutputs): ArchprintConfig;
|
|
30
|
+
export declare function writeConfig(outDir: string, config: ArchprintConfig): string;
|
|
31
|
+
export declare function recordManagedFiles(outDir: string, cwd: string, version: string, absoluteFiles: readonly string[]): void;
|
|
32
|
+
export declare function readConfig(outDir: string): ArchprintConfig | null;
|
|
33
|
+
//# sourceMappingURL=archprint-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archprint-config.d.ts","sourceRoot":"","sources":["../../src/cli/archprint-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtE,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC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= 'config.json';
|
|
4
|
+
const EMPTY_MANAGED = {
|
|
5
|
+
files: [],
|
|
6
|
+
readme: false,
|
|
7
|
+
readmeCreated: false,
|
|
8
|
+
prettierignore: false,
|
|
9
|
+
prettierignoreCreated: false,
|
|
10
|
+
npmignore: false,
|
|
11
|
+
npmignoreCreated: false,
|
|
12
|
+
};
|
|
13
|
+
function configPath(outDir) {
|
|
14
|
+
return path.join(outDir, CONFIG_FILE);
|
|
15
|
+
}
|
|
16
|
+
export function buildConfig(recommendations, version, location, managed) {
|
|
17
|
+
return {
|
|
18
|
+
archprintVersion: version,
|
|
19
|
+
app: location.app,
|
|
20
|
+
stack: recommendations.stack,
|
|
21
|
+
rulesDir: location.rulesDir,
|
|
22
|
+
enforced: recommendations.enforceNow,
|
|
23
|
+
review: recommendations.review,
|
|
24
|
+
adopt: recommendations.adopt,
|
|
25
|
+
evidence: recommendations.evidence,
|
|
26
|
+
managed,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function writeConfig(outDir, config) {
|
|
30
|
+
mkdirSync(outDir, { recursive: true });
|
|
31
|
+
const file = configPath(outDir);
|
|
32
|
+
writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`);
|
|
33
|
+
return file;
|
|
34
|
+
}
|
|
35
|
+
export function recordManagedFiles(outDir, cwd, version, absoluteFiles) {
|
|
36
|
+
const relative = absoluteFiles.map((file) => path.relative(cwd, file));
|
|
37
|
+
const existing = readConfig(outDir);
|
|
38
|
+
if (existing) {
|
|
39
|
+
const files = [...new Set([...existing.managed.files, ...relative])];
|
|
40
|
+
writeConfig(outDir, { ...existing, managed: { ...existing.managed, files } });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
writeConfig(outDir, {
|
|
44
|
+
archprintVersion: version,
|
|
45
|
+
app: '.',
|
|
46
|
+
stack: [],
|
|
47
|
+
rulesDir: path.relative(cwd, outDir) || outDir,
|
|
48
|
+
enforced: [],
|
|
49
|
+
review: [],
|
|
50
|
+
adopt: [],
|
|
51
|
+
evidence: { apps: 0, asOf: '' },
|
|
52
|
+
managed: { ...EMPTY_MANAGED, files: relative },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export function readConfig(outDir) {
|
|
56
|
+
const file = configPath(outDir);
|
|
57
|
+
if (!existsSync(file))
|
|
58
|
+
return null;
|
|
59
|
+
try {
|
|
60
|
+
const parsed = JSON.parse(readFileSync(file, 'utf8'));
|
|
61
|
+
if (typeof parsed.archprintVersion !== 'string')
|
|
62
|
+
return null;
|
|
63
|
+
return {
|
|
64
|
+
archprintVersion: parsed.archprintVersion,
|
|
65
|
+
app: parsed.app ?? '.',
|
|
66
|
+
stack: parsed.stack ?? [],
|
|
67
|
+
rulesDir: parsed.rulesDir ?? '.archprint',
|
|
68
|
+
enforced: parsed.enforced ?? [],
|
|
69
|
+
review: parsed.review ?? [],
|
|
70
|
+
adopt: parsed.adopt ?? [],
|
|
71
|
+
evidence: parsed.evidence ?? { apps: 0, asOf: '' },
|
|
72
|
+
managed: {
|
|
73
|
+
...EMPTY_MANAGED,
|
|
74
|
+
...(parsed.managed ?? {}),
|
|
75
|
+
files: Array.isArray(parsed.managed?.files) ? parsed.managed.files : [],
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=archprint-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archprint-config.js","sourceRoot":"","sources":["../../src/cli/archprint-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AAwBzC,MAAM,aAAa,GAAmB;IACpC,KAAK,EAAE,EAAE;IACT,MAAM,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G;YACtB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,YAAY;YACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE;YAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YAClD,OAAO,EAAE;gBACP,GAAG,aAAa;gBAChB,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;gBACzB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;aACxE;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/cli/generate.d.ts
CHANGED
|
@@ -1,52 +1,48 @@
|
|
|
1
|
-
import type { GenerationStatus } from '../detector/confidence-gate.js';
|
|
2
1
|
import type { InstalledEnforcers } from '../scanner/enforcers.js';
|
|
3
|
-
import { type
|
|
2
|
+
import { type BoundaryRule } from '../generator/tsarch-emitter.js';
|
|
3
|
+
import { type ForbiddenImportSpec } from '../generator/eslint-plugin-emitter.js';
|
|
4
4
|
import type { ScannedPattern, ScanResult } from './scan.js';
|
|
5
|
-
export declare
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
8
|
-
export declare function writePublicApiConfig(scan: ScanResult, outDir: string, statuses?: readonly GenerationStatus[]): string[];
|
|
9
|
-
export declare function writeFeatureSliceConfig(scan: ScanResult, outDir: string, statuses?: readonly GenerationStatus[]): string[];
|
|
10
|
-
export declare function writeAppIsolationConfig(scan: ScanResult, outDir: string, statuses?: readonly GenerationStatus[]): string[];
|
|
11
|
-
export declare function writeTestIsolationConfig(scan: ScanResult, outDir: string): string[];
|
|
12
|
-
export declare function writeRoleLayeringConfig(scan: ScanResult, outDir: string, statuses?: readonly GenerationStatus[]): string[];
|
|
13
|
-
export declare function writeConsoleIsolationConfig(scan: ScanResult, outDir: string): string[];
|
|
14
|
-
export declare function writeMergedNoRestrictedImports(blocks: readonly (NoRestrictedImportsBlock | null)[], outDir: string): string[];
|
|
15
|
-
export declare function writeServerClientConfig(scan: ScanResult, outDir: string): string[];
|
|
16
|
-
export declare function writeUiDataConfig(scan: ScanResult, outDir: string): string[];
|
|
17
|
-
export declare function writeStoriesIsolationConfig(scan: ScanResult, outDir: string): string[];
|
|
18
|
-
export declare function writeEnvAccessConfig(scan: ScanResult, outDir: string): string[];
|
|
19
|
-
export declare function writePhantomDependencyConfig(scan: ScanResult, outDir: string): string[];
|
|
20
|
-
export declare function writeEntryPurityConfig(scan: ScanResult, outDir: string): string[];
|
|
21
|
-
export declare function writeDependencyInternalsConfig(scan: ScanResult, outDir: string): string[];
|
|
22
|
-
export declare function writeEslintPreset(scan: ScanResult, outDir: string, options?: {
|
|
23
|
-
structural?: boolean;
|
|
24
|
-
}): string[];
|
|
25
|
-
export declare function writeEslintPlugin(scan: ScanResult, outDir: string): string[];
|
|
26
|
-
export declare function writeTsArchTests(scan: ScanResult, outDir: string, statuses?: readonly GenerationStatus[]): string[];
|
|
27
|
-
export declare function writeGraph(scan: ScanResult, outDir: string): string[];
|
|
28
|
-
export interface WrittenConfig {
|
|
29
|
-
files: string[];
|
|
30
|
-
label: string | null;
|
|
31
|
-
}
|
|
5
|
+
export declare const ESLINT_FILE = "eslint.mjs";
|
|
6
|
+
export declare const DEPCRUISE_FILE = "dependency-cruiser.json";
|
|
7
|
+
export declare const ARCHPRINT_DIR = ".archprint";
|
|
32
8
|
export declare const FAMILY_NAMES: readonly ["forbidden-imports", "layer", "role-layering", "public-api", "feature-slice", "app-isolation", "test-isolation", "dependency-hygiene", "entry-purity", "phantom-deps", "import-style", "console", "env-access", "workspace-package", "stories-isolation", "ui-data", "server-client"];
|
|
33
|
-
|
|
9
|
+
interface DependencyCruiserRule {
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
interface EslintFamilyBlock {
|
|
13
|
+
family: string;
|
|
14
|
+
block: unknown;
|
|
15
|
+
}
|
|
16
|
+
interface DependencyCruiserFamily {
|
|
17
|
+
family: string;
|
|
18
|
+
forbidden: DependencyCruiserRule[];
|
|
19
|
+
}
|
|
20
|
+
export interface CollectedEnforcement {
|
|
21
|
+
eslintSpecs: ForbiddenImportSpec[];
|
|
22
|
+
eslintBlocks: EslintFamilyBlock[];
|
|
23
|
+
depcruise: DependencyCruiserFamily[];
|
|
24
|
+
boundaries: unknown | null;
|
|
25
|
+
tsArchRules: BoundaryRule[];
|
|
26
|
+
hasGraph: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface CollectOptions {
|
|
34
29
|
structural?: boolean;
|
|
35
30
|
enforcers: InstalledEnforcers;
|
|
36
|
-
graph?: boolean;
|
|
37
31
|
only?: string;
|
|
38
32
|
ruleIds?: readonly string[];
|
|
39
|
-
}
|
|
40
|
-
export declare function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
}
|
|
34
|
+
export declare function collectEnforcement(scan: ScanResult, options: CollectOptions): CollectedEnforcement;
|
|
35
|
+
export declare function writeArchprintEslint(collected: CollectedEnforcement, outDir: string): string | null;
|
|
36
|
+
export declare function writeArchprintDepcruise(collected: CollectedEnforcement, outDir: string): string | null;
|
|
37
|
+
export interface EmitResult {
|
|
38
|
+
eslint: string | null;
|
|
39
|
+
depcruise: string | null;
|
|
40
|
+
expanded: string[];
|
|
41
|
+
}
|
|
42
|
+
export declare function emitLayout(scan: ScanResult, outDir: string, options: CollectOptions & {
|
|
43
|
+
expand?: boolean;
|
|
44
44
|
graph?: boolean;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}): {
|
|
49
|
-
configs: WrittenConfig[];
|
|
50
|
-
removed: string[];
|
|
51
|
-
};
|
|
45
|
+
}): EmitResult;
|
|
46
|
+
export declare function emitOne(pattern: ScannedPattern, appDir: string, outDir: string): string;
|
|
47
|
+
export {};
|
|
52
48
|
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AASlE,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEtF,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,uCAAuC,CAAC;AAM/C,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5D,eAAO,MAAM,WAAW,eAAe,CAAC;AACxC,eAAO,MAAM,cAAc,4BAA4B,CAAC;AACxD,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C,eAAO,MAAM,YAAY,iSAkBf,CAAC;AAEX,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,qBAAqB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,SAAS,EAAE,uBAAuB,EAAE,CAAC;IACrC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE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