@autotelic/cutlist 0.0.0-stage → 0.0.2
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/LICENSE +21 -0
- package/README.md +170 -2
- package/bin/cutlist.js +6 -0
- package/dist/catalog.d.ts +81 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +500 -0
- package/dist/catalog.js.map +1 -0
- package/dist/check.d.ts +48 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +77 -0
- package/dist/check.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +351 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +71 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +112 -0
- package/dist/config.js.map +1 -0
- package/dist/crawl.d.ts +82 -0
- package/dist/crawl.d.ts.map +1 -0
- package/dist/crawl.js +456 -0
- package/dist/crawl.js.map +1 -0
- package/dist/features.d.ts +11 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +113 -0
- package/dist/features.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/intent.d.ts +54 -0
- package/dist/intent.d.ts.map +1 -0
- package/dist/intent.js +92 -0
- package/dist/intent.js.map +1 -0
- package/dist/outputs.d.ts +46 -0
- package/dist/outputs.d.ts.map +1 -0
- package/dist/outputs.js +53 -0
- package/dist/outputs.js.map +1 -0
- package/dist/owners.d.ts +22 -0
- package/dist/owners.d.ts.map +1 -0
- package/dist/owners.js +55 -0
- package/dist/owners.js.map +1 -0
- package/dist/paths.d.ts +66 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +102 -0
- package/dist/paths.js.map +1 -0
- package/dist/patterns.d.ts +7 -0
- package/dist/patterns.d.ts.map +1 -0
- package/dist/patterns.js +300 -0
- package/dist/patterns.js.map +1 -0
- package/dist/render/ask.d.ts +33 -0
- package/dist/render/ask.d.ts.map +1 -0
- package/dist/render/ask.js +116 -0
- package/dist/render/ask.js.map +1 -0
- package/dist/render/authored.d.ts +24 -0
- package/dist/render/authored.d.ts.map +1 -0
- package/dist/render/authored.js +26 -0
- package/dist/render/authored.js.map +1 -0
- package/dist/render/catalog.d.ts +4 -0
- package/dist/render/catalog.d.ts.map +1 -0
- package/dist/render/catalog.js +3 -0
- package/dist/render/catalog.js.map +1 -0
- package/dist/render/diagram.d.ts +74 -0
- package/dist/render/diagram.d.ts.map +1 -0
- package/dist/render/diagram.js +523 -0
- package/dist/render/diagram.js.map +1 -0
- package/dist/render/hooks.d.ts +12 -0
- package/dist/render/hooks.d.ts.map +1 -0
- package/dist/render/hooks.js +37 -0
- package/dist/render/hooks.js.map +1 -0
- package/dist/render/manifest.d.ts +9 -0
- package/dist/render/manifest.d.ts.map +1 -0
- package/dist/render/manifest.js +14 -0
- package/dist/render/manifest.js.map +1 -0
- package/dist/render/menu.d.ts +6 -0
- package/dist/render/menu.d.ts.map +1 -0
- package/dist/render/menu.js +151 -0
- package/dist/render/menu.js.map +1 -0
- package/dist/render/patterns.d.ts +6 -0
- package/dist/render/patterns.d.ts.map +1 -0
- package/dist/render/patterns.js +155 -0
- package/dist/render/patterns.js.map +1 -0
- package/dist/render/recipes.d.ts +38 -0
- package/dist/render/recipes.d.ts.map +1 -0
- package/dist/render/recipes.js +321 -0
- package/dist/render/recipes.js.map +1 -0
- package/dist/render/text.d.ts +9 -0
- package/dist/render/text.d.ts.map +1 -0
- package/dist/render/text.js +16 -0
- package/dist/render/text.js.map +1 -0
- package/dist/render/tokens.d.ts +4 -0
- package/dist/render/tokens.d.ts.map +1 -0
- package/dist/render/tokens.js +18 -0
- package/dist/render/tokens.js.map +1 -0
- package/dist/roles.d.ts +29 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/roles.js +68 -0
- package/dist/roles.js.map +1 -0
- package/dist/signature.d.ts +24 -0
- package/dist/signature.d.ts.map +1 -0
- package/dist/signature.js +73 -0
- package/dist/signature.js.map +1 -0
- package/dist/tier.d.ts +13 -0
- package/dist/tier.d.ts.map +1 -0
- package/dist/tier.js +28 -0
- package/dist/tier.js.map +1 -0
- package/dist/tokens.d.ts +13 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +105 -0
- package/dist/tokens.js.map +1 -0
- package/package.json +56 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 autotelic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,171 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @autotelic/cutlist
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**The vocabulary.** A deterministic generator: it crawls a UI codebase and emits one
|
|
4
|
+
model — the parts inventory — then renders that model several ways. No LLM. Same tree
|
|
5
|
+
in, same bytes out.
|
|
6
|
+
|
|
7
|
+
A cutlist is the carpenter's enumerated parts _with their dimensions_, produced before
|
|
8
|
+
you assemble. The metaphor is honest about the important thing: a cutlist is **derived
|
|
9
|
+
from the project**, not a fixed catalog. That is why it is generated from the tree
|
|
10
|
+
instead of hand-maintained.
|
|
11
|
+
|
|
12
|
+
## What it reads
|
|
13
|
+
|
|
14
|
+
Only what `cutlist.config.json` declares — never shakti's paths hardcoded:
|
|
15
|
+
|
|
16
|
+
- the source tree under `roots` (parsed with the same `oxc-parser` pass joggle uses);
|
|
17
|
+
- the import graph (who imports whom, resolved through the configured `alias`);
|
|
18
|
+
- the token source (`tokens.from` + optional `tokens.vars`);
|
|
19
|
+
- the hook barrel (`hooks.barrel`) — declared in the config schema, but the hook list is
|
|
20
|
+
discovered from the tree; the barrel is not read yet.
|
|
21
|
+
|
|
22
|
+
## The pipeline
|
|
23
|
+
|
|
24
|
+
| Pass | What it does |
|
|
25
|
+
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| 1 · Parse | every module → exports, imports (with bindings), rendered tags (with lines), called hooks, declared props |
|
|
27
|
+
| 2 · Use-graph | for each module, the modules that import it; the same resolver turns its tags into render edges |
|
|
28
|
+
| 3 · Owners | an importer's owner is the **first route segment** (`projects_.$id.sponsors` → `projects`), or `shared` under a shared root; `transitive` follows the importers of importers |
|
|
29
|
+
| 4 · Tier | primitive root → primitive; ≥2 route owners → shared; 1 → local; no route owners under a shared root → shared; otherwise local. Zero owners is an orphan, counted separately |
|
|
30
|
+
| 5 · Signature | the **behavioral skeleton**, not props ∪ tags |
|
|
31
|
+
| 6 · Tokens | closed sets: colors, type, shape, spacing |
|
|
32
|
+
| 7 · Emit | one model, rendered N ways |
|
|
33
|
+
|
|
34
|
+
## One model, several renderings
|
|
35
|
+
|
|
36
|
+
Because every rendering derives from one computed model, they cannot drift from each
|
|
37
|
+
other. The load-bearing output is the **lint manifest** — `plumb-ui.config.json` — which
|
|
38
|
+
must match the shape `plumb/src/ui/manifest.ts` parses, so lint stays a _lookup_ rather
|
|
39
|
+
than a second analysis. `plumb-ui` fails open on a malformed manifest (all rules go
|
|
40
|
+
silent), which is why `cutlist build --check` exists: a stale catalog must be loud.
|
|
41
|
+
|
|
42
|
+
The menu is the one **mixed** record: `menu.json` joins the derived composition with
|
|
43
|
+
authoritative intent from `tools/ui-intent/<name>.json` (configurable; outside the generated
|
|
44
|
+
tree), so regenerating the menu can never overwrite a sentence a person wrote; `MENU.md` is
|
|
45
|
+
its cheap text view. Each catalog part also carries a path-derived `id`, and the join prefers
|
|
46
|
+
it over the colliding `name`. `diagrams/` renders the same model as a graph — the composition
|
|
47
|
+
of each part, the inverse hook view, and ownership — as Mermaid source beside the SVG `pele`
|
|
48
|
+
drew from it, drawn at the largest scope that reads and indexed by a generated table, so the
|
|
49
|
+
shape a list flattens is visible. It is **opt-in** (`output.diagrams`): on a real app the
|
|
50
|
+
projection was 8 MB of a 13 MB artifact for 429 panels, so a repo asks for it rather than
|
|
51
|
+
receiving it. `pele` is a rendering dependency, not a seam: nothing else in the workspace
|
|
52
|
+
reads it, and it never touches the model.
|
|
53
|
+
|
|
54
|
+
## What a part carries
|
|
55
|
+
|
|
56
|
+
A part is a module, not "a component": roles are read from declarations (`createContext`,
|
|
57
|
+
`.Provider`, a `use*` export), so hooks, providers, contexts, barrels, and routes sit in the
|
|
58
|
+
same model as components. A default-exported component is a component even when the binding
|
|
59
|
+
is declared first and exported later. Routes are entries (`routes/foo.tsx`,
|
|
60
|
+
`routes/foo/route.tsx`) while a component under `routes/foo/components/` is owned by that
|
|
61
|
+
route but is not one. Each part also carries the public `exports` (including `default`), how
|
|
62
|
+
many modules `usedBy` it, its `feature` directory, and a `kind`. Features themselves are a
|
|
63
|
+
**query** over those facts — a context plus a provider or barrel — not a classifier with its
|
|
64
|
+
own schema. The menu reports the consequences: `sharedReach`/`localOnly` adoption, duplicate
|
|
65
|
+
clusters with a canonical survivor, orphans, and authored parts still imported after
|
|
66
|
+
retirement.
|
|
67
|
+
|
|
68
|
+
## Multiple roots
|
|
69
|
+
|
|
70
|
+
Tiers, routes, and aliases are written once and matched inside each configured source root.
|
|
71
|
+
That is what lets one catalog cover a monorepo: `apps/auth/ui/app` and `apps/shop/ui/app` both
|
|
72
|
+
have a `components/ui`, a `routes/`, and a `~/*` alias. An alias target is an array because a
|
|
73
|
+
`paths` entry is an array; the graph tries each target and prefers the one in the importer's
|
|
74
|
+
own root. `ownership.entries` declares the entry points nothing imports by design
|
|
75
|
+
(`entry.client.tsx`, `root.tsx`), so they read as routes rather than orphans.
|
|
76
|
+
|
|
77
|
+
## The signature is the whole point
|
|
78
|
+
|
|
79
|
+
The proposal this project comes from claimed `Combobox`/`ComboBoxV2` would surface via
|
|
80
|
+
`props ∪ tags` at Jaccard ≥ 0.8. Measured against the real files, props overlap is
|
|
81
|
+
~0.18 and tags ~0.43 — the metric does not reproduce its own headline example. **Props
|
|
82
|
+
are surface area; they are the wrong signature.** Two components that wrap the same
|
|
83
|
+
headless primitive and render the same skeleton are the same concept however their
|
|
84
|
+
props differ. So cutlist scores the skeleton: wrapped primitive + rendered
|
|
85
|
+
sub-components + called hooks. The frame is removed before scoring: host tags are not
|
|
86
|
+
composition, and React's own hooks (`useState`, `useEffect`, `useRef`, …) are not a
|
|
87
|
+
domain signal. The join compares the remaining composition at Jaccard ≥ 0.7, which is
|
|
88
|
+
what stops a generic-hook pair from scoring a perfect 1.0.
|
|
89
|
+
|
|
90
|
+
## Patterns and recipes
|
|
91
|
+
|
|
92
|
+
`PATTERNS.md` and `patterns.json` are the pattern language view. A pattern has a context
|
|
93
|
+
(tier, owners, feature), forces (adoption, variants, lifecycle), a solution (exports and
|
|
94
|
+
composition), and relations to the parts it uses and the variants around it. The stable
|
|
95
|
+
shape is ranked by a transparent five-factor score — tier 0.35, adoption 0.30, ownership
|
|
96
|
+
0.15, variant status 0.10, documentation 0.10 — and every pattern carries its factors.
|
|
97
|
+
`signals` names where the vocabulary is under pressure — unreached parts, variant families,
|
|
98
|
+
and retired parts still imported. Cutlist does not compress; the signal is for Plumb, Joggle,
|
|
99
|
+
or a person.
|
|
100
|
+
|
|
101
|
+
`RECIPES.md` and `recipes.json` turn the load-bearing patterns into a next turn: the import
|
|
102
|
+
line, a minimal shape with the declared props, the feature's blocks and hook, and a note on
|
|
103
|
+
where the call site may spell the binding differently. They are skeletons, not generated
|
|
104
|
+
applications.
|
|
105
|
+
|
|
106
|
+
Both are agents' first stop. `jig menu` reads the same artifact without importing cutlist:
|
|
107
|
+
`jig menu` shows the stable shape and the files; `jig menu dialog` finds the import and
|
|
108
|
+
shape for a concept. The pi extension exposes it as `jig_menu`, and the OpenCode plugin as
|
|
109
|
+
`jig.menu`.
|
|
110
|
+
|
|
111
|
+
## The render graph
|
|
112
|
+
|
|
113
|
+
Each part carries `renders`: the parts its own JSX names, resolved through its own import
|
|
114
|
+
bindings, with the line of first use. That is the fact `tags` could not carry — a bag of
|
|
115
|
+
names cannot say whether `<Card>` means `./ui/card.tsx` or a different app's `Card` — and it
|
|
116
|
+
turns "what does this screen render?" from a grep into a query.
|
|
117
|
+
|
|
118
|
+
One direction is stored. The page view and the mount view are both projections of the same
|
|
119
|
+
edges, so neither can drift:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
cutlist ask --page 'projects_.$id._index' # direct parts, then what is reached through them
|
|
123
|
+
cutlist ask --part Button # direct renderers, then the routes that mount it
|
|
124
|
+
cutlist ask --similar TablePanel # name and skeleton evidence, ranked
|
|
125
|
+
cutlist ask --file mockups/_shared/proposals.tsx # a sketch that is not in the catalog
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`ask` reads the committed artifact, not the tree: the answer is the answer every consumer
|
|
129
|
+
sees, and `build --check` is what keeps that artifact honest. The queries are pure functions
|
|
130
|
+
in `protocol`, so `jig menu --page …` answers identically without importing cutlist.
|
|
131
|
+
[`docs/render-graph.md`](docs/render-graph.md) records the shape, the measurements, and
|
|
132
|
+
what was deliberately left out.
|
|
133
|
+
|
|
134
|
+
## Commands
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
cutlist build # crawl, render every output, write them
|
|
138
|
+
cutlist build --check # fail if any committed rendering is stale (like prettier --check)
|
|
139
|
+
cutlist build --timing # print the crawl, render, and write (or compare) durations
|
|
140
|
+
cutlist ask --page … # what a page renders, direct and through its children
|
|
141
|
+
cutlist ask --part … # where a part appears on screen
|
|
142
|
+
cutlist ask --similar … # what already exists like this, by name and skeleton
|
|
143
|
+
cutlist ask --file … # compare a sketch per declaration, before it is committed
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`build` and `--check` iterate one table (`src/outputs.ts`), so a file cannot be written and
|
|
147
|
+
left unchecked. That matters most for `plumb-ui.config.json`: `plumb-ui` fails **open** on a
|
|
148
|
+
stale manifest, so a gate that skipped it would disable the tier rules while still printing
|
|
149
|
+
"up to date". The artifact is committed and collapsed in review — [docs/artifact.md](docs/artifact.md#storage-and-cost)
|
|
150
|
+
records why, and the cost measured on a real app.
|
|
151
|
+
|
|
152
|
+
## The artifact (design note)
|
|
153
|
+
|
|
154
|
+
The model is the truth; the artifact is the model made navigable. [docs/artifact.md](docs/artifact.md)
|
|
155
|
+
records the shape it should grow into — one record per part, a stable id, a faceted index,
|
|
156
|
+
a composition graph, and separate agent and human renderings — and separates what ships
|
|
157
|
+
today from what is proposed. It is a decision record, not a commitment.
|
|
158
|
+
|
|
159
|
+
[docs/compression.md](docs/compression.md) records how the vocabulary grows and is
|
|
160
|
+
collected: a walk allocates freely, the change set is the trigger, duplicates are garbage,
|
|
161
|
+
and `joggle` is the marking phase. The menu is a memory, not a fence.
|
|
162
|
+
|
|
163
|
+
## Where it meets the others
|
|
164
|
+
|
|
165
|
+
`cutlist` **produces** the catalog, the menu, and the lint manifest. `plumb-ui` reads the
|
|
166
|
+
manifest now: `no-deprecated-parts` turns an authored `status: deprecated` plus `useInstead`
|
|
167
|
+
into a finding at the import that has not migrated, and fails open when the manifest is
|
|
168
|
+
missing or malformed. `joggle` consumes the duplicate candidates deterministically emitted
|
|
169
|
+
here and decides whether two candidates are one concept; `jig` runs cutlist's staleness gate
|
|
170
|
+
and the other engines through one report. The seam stays the format: neither consumer
|
|
171
|
+
imports `cutlist`, and `decodeCatalog` is what a reader uses when it wants the raw model.
|
package/bin/cutlist.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The installed entry point. It runs the build, not the source, because Node refuses
|
|
3
|
+
// to strip types for files under node_modules — which is exactly where this file lands
|
|
4
|
+
// once the package is installed. `pnpm build` produces dist/; `pnpm cutlist` runs the
|
|
5
|
+
// source directly through the development export condition.
|
|
6
|
+
import "../dist/cli.js"
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Effect, FileSystem, Path } from "effect";
|
|
2
|
+
import { type Catalog, type CatalogComponent, type CatalogHealth, type CutlistConfig, type DuplicateCandidate, type DuplicateCluster, type RenderEdge } from "@autotelic/protocol";
|
|
3
|
+
import { type SourceModule } from "./crawl.ts";
|
|
4
|
+
/** Re-derived from real pairs, not guessed: the known `Combobox`/`ComboBoxV2` sits near 1.0. */
|
|
5
|
+
export declare const DUPLICATE_THRESHOLD = 0.7;
|
|
6
|
+
/**
|
|
7
|
+
* A part's stable identity: the path without its source extension, flattened for a
|
|
8
|
+
* filename. Names collide (`Comments`, `types`), paths do not; the menu's authored half
|
|
9
|
+
* is joined by this id so one part's summary can never land on another.
|
|
10
|
+
*/
|
|
11
|
+
export declare const idOfModule: (path: string) => string;
|
|
12
|
+
/** Pass 2 — for each module, the modules that import it. Exported for the graph's own test. */
|
|
13
|
+
export declare const importerGraph: (modules: ReadonlyArray<SourceModule>, alias: Readonly<Record<string, ReadonlyArray<string>>>, roots?: ReadonlyArray<string>) => ReadonlyMap<string, ReadonlyArray<string>>;
|
|
14
|
+
/**
|
|
15
|
+
* The parts a module's JSX names, resolved through its own import bindings.
|
|
16
|
+
*
|
|
17
|
+
* This is the fact the catalog used to throw away. `tags` keeps the names — a bag where
|
|
18
|
+
* `<Link>`, `<Card>`, and `<StatusStepper>` are indistinguishable — so a page question
|
|
19
|
+
* could only be answered by guessing. The binding is authoritative: if this file imports
|
|
20
|
+
* `Card` from `./ui/card.tsx`, then `<Card>` renders that part, whatever else is called
|
|
21
|
+
* `Card` elsewhere in a multi-app tree.
|
|
22
|
+
*
|
|
23
|
+
* A namespace or unresolved binding produces no edge on purpose. A wrong edge is worse than
|
|
24
|
+
* a missing one: the whole value of the answer is that a mock author can stop looking.
|
|
25
|
+
*/
|
|
26
|
+
export declare const renderEdgesOf: ({ module, byBase, alias, roots, }: {
|
|
27
|
+
readonly module: SourceModule;
|
|
28
|
+
readonly byBase: ReadonlyMap<string, string>;
|
|
29
|
+
readonly alias: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
30
|
+
readonly roots: ReadonlyArray<string>;
|
|
31
|
+
}) => ReadonlyArray<RenderEdge>;
|
|
32
|
+
/**
|
|
33
|
+
* Pass 5b — the all-pairs candidate join. High recall; a judge in `joggle` decides.
|
|
34
|
+
*
|
|
35
|
+
* The join is scoped by kind. A hook and a component are never the same concept however
|
|
36
|
+
* perfectly their skeletons align, and letting them compete is what put `useEffect`-only
|
|
37
|
+
* pairs above real component duplicates. Two parts of different kinds are not compared,
|
|
38
|
+
* so the ranking never has to correct for a category error.
|
|
39
|
+
*
|
|
40
|
+
* @param payload - The components to join and the ownership facts the route check needs.
|
|
41
|
+
*/
|
|
42
|
+
export declare const duplicateCandidates: ({ components, roots, routeDir, entries, }: {
|
|
43
|
+
readonly components: ReadonlyArray<CatalogComponent>;
|
|
44
|
+
readonly roots: ReadonlyArray<string>;
|
|
45
|
+
readonly routeDir: string;
|
|
46
|
+
readonly entries: ReadonlyArray<string>;
|
|
47
|
+
}) => ReadonlyArray<DuplicateCandidate>;
|
|
48
|
+
/**
|
|
49
|
+
* Group candidate pairs into connected clusters and pick a canonical by adoption.
|
|
50
|
+
*
|
|
51
|
+
* A pair list is a set of edges; readers think in components. Finding the connected
|
|
52
|
+
* components is what turns "A≈B, B≈C" into "there are three versions of one thing". The
|
|
53
|
+
* canonical is the most-imported member because that is the version already in use, and
|
|
54
|
+
* a migration that keeps anything else makes every existing call site move.
|
|
55
|
+
*/
|
|
56
|
+
export declare const duplicateClusters: (components: ReadonlyArray<CatalogComponent>, duplicates: ReadonlyArray<DuplicateCandidate>) => ReadonlyArray<DuplicateCluster>;
|
|
57
|
+
/**
|
|
58
|
+
* Adoption, from the reverse import graph.
|
|
59
|
+
*
|
|
60
|
+
* A module "reaches the system" when at least one of its imports resolves to a part that
|
|
61
|
+
* lives in the shared layer — the primitive or shared roots. The test is by LOCATION, not
|
|
62
|
+
* by the tier a file acquired: a component used by one route today is still shared material
|
|
63
|
+
* that route reached for, and counting only multi-owner parts made a well-composed app look
|
|
64
|
+
* unattached.
|
|
65
|
+
*
|
|
66
|
+
* The denominator is UI modules OUTSIDE the shared layer. A primitive importing a utility
|
|
67
|
+
* is the system, not an adopter of the system; counting the library made adoption read as
|
|
68
|
+
* a failure of the library. Type modules stay out for the same reason: documenting a repo
|
|
69
|
+
* should not lower its adoption score.
|
|
70
|
+
*/
|
|
71
|
+
export declare const healthOf: ({ components, graph, roots, primitiveRoots, sharedRoots, entries, }: {
|
|
72
|
+
readonly components: ReadonlyArray<CatalogComponent>;
|
|
73
|
+
readonly graph: ReadonlyMap<string, ReadonlyArray<string>>;
|
|
74
|
+
readonly roots: ReadonlyArray<string>;
|
|
75
|
+
readonly primitiveRoots: ReadonlyArray<string>;
|
|
76
|
+
readonly sharedRoots: ReadonlyArray<string>;
|
|
77
|
+
readonly entries: ReadonlyArray<string>;
|
|
78
|
+
}) => CatalogHealth;
|
|
79
|
+
/** Build the whole model. */
|
|
80
|
+
export declare const buildCatalog: (root: string, config: CutlistConfig) => Effect.Effect<Catalog, never, FileSystem.FileSystem | Path.Path>;
|
|
81
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAiB,IAAI,EAAE,MAAM,QAAQ,CAAA;AAChE,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAErB,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAyBxE,gGAAgG;AAChG,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAUtC;;;;GAIG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,MAI3B,CAAA;AA8Hf,+FAA+F;AAC/F,eAAO,MAAM,aAAa,YACf,aAAa,CAAC,YAAY,CAAC,SAC7B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,UAC/C,aAAa,CAAC,MAAM,CAAC,KAC3B,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAwB3C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,sCAKvB;IACD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IAC/D,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACtC,KAAG,aAAa,CAAC,UAAU,CA4B3B,CAAA;AA4BD;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,8CAK7B;IACD,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;IACpD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACxC,KAAG,aAAa,CAAC,kBAAkB,CA2CnC,CAAA;AAYD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,eAChB,aAAa,CAAC,gBAAgB,CAAC,cAC/B,aAAa,CAAC,kBAAkB,CAAC,KAC5C,aAAa,CAAC,gBAAgB,CA+DhC,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,wEAOlB;IACD,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;IACpD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;IAC1D,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9C,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACxC,KAAG,aAqCH,CAAA;AAED,6BAA6B;AAC7B,eAAO,MAAM,YAAY,SACjB,MAAM,UACJ,aAAa,KACpB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CA0I9D,CAAA"}
|