@autotelic/protocol 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +183 -2
- package/dist/baseline.d.ts +41 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +62 -0
- package/dist/baseline.js.map +1 -0
- package/dist/catalog.d.ts +275 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +437 -0
- package/dist/catalog.js.map +1 -0
- package/dist/compat.d.ts +12 -0
- package/dist/compat.d.ts.map +1 -0
- package/dist/compat.js +104 -0
- package/dist/compat.js.map +1 -0
- package/dist/config.d.ts +179 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +302 -0
- package/dist/config.js.map +1 -0
- package/dist/decode.d.ts +32 -0
- package/dist/decode.d.ts.map +1 -0
- package/dist/decode.js +71 -0
- package/dist/decode.js.map +1 -0
- package/dist/doc.d.ts +105 -0
- package/dist/doc.d.ts.map +1 -0
- package/dist/doc.js +159 -0
- package/dist/doc.js.map +1 -0
- package/dist/graph.d.ts +139 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +258 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/intent.d.ts +32 -0
- package/dist/intent.d.ts.map +1 -0
- package/dist/intent.js +54 -0
- package/dist/intent.js.map +1 -0
- package/dist/json.d.ts +3 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +18 -0
- package/dist/json.js.map +1 -0
- package/dist/lexicon.d.ts +58 -0
- package/dist/lexicon.d.ts.map +1 -0
- package/dist/lexicon.js +176 -0
- package/dist/lexicon.js.map +1 -0
- package/dist/patterns.d.ts +65 -0
- package/dist/patterns.d.ts.map +1 -0
- package/dist/patterns.js +166 -0
- package/dist/patterns.js.map +1 -0
- package/dist/recipes.d.ts +34 -0
- package/dist/recipes.d.ts.map +1 -0
- package/dist/recipes.js +74 -0
- package/dist/recipes.js.map +1 -0
- package/dist/report.d.ts +218 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +330 -0
- package/dist/report.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +9 -0
- package/dist/version.js.map +1 -0
- package/package.json +45 -3
- package/schema/baseline.json +29 -0
- package/schema/catalog.json +206 -0
- package/schema/cutlist.config.json +103 -0
- package/schema/intent.json +43 -0
- package/schema/jig.config.json +56 -0
- package/schema/manifest.json +67 -0
- package/schema/menu.json +169 -0
- package/schema/onboarding.json +25 -0
- package/schema/patterns.json +141 -0
- package/schema/recipes.json +57 -0
- package/schema/report.json +141 -0
package/dist/doc.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Catalog, CatalogFeature, CatalogHealth, DuplicateCluster, PartRole } from "./catalog.ts";
|
|
2
|
+
import { type Intent, type PartStatus } from "./intent.ts";
|
|
3
|
+
import { type LexiconRef } from "./lexicon.ts";
|
|
4
|
+
import type { TierName } from "./config.ts";
|
|
5
|
+
import type { DuplicateCandidate } from "./catalog.ts";
|
|
6
|
+
export { decodeIntent, hasIntent, type Intent, type PartStatus } from "./intent.ts";
|
|
7
|
+
/** One component's row in the menu. */
|
|
8
|
+
export interface MenuEntry {
|
|
9
|
+
/** The stable path-derived identity, when the catalog carries one. */
|
|
10
|
+
readonly id?: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly tier: TierName;
|
|
14
|
+
/** What the part is: component, hook, context, provider, barrel, route, module. */
|
|
15
|
+
readonly kind?: PartRole;
|
|
16
|
+
/** Every role it carries; `kind` is the one it is listed under. */
|
|
17
|
+
readonly roles?: ReadonlyArray<PartRole>;
|
|
18
|
+
/** The composition feature's directory, when the part belongs to one. */
|
|
19
|
+
readonly feature?: string;
|
|
20
|
+
/** The public names a consumer imports from this module, types excluded. */
|
|
21
|
+
readonly exports?: ReadonlyArray<string>;
|
|
22
|
+
/** How many modules import it. The adoption signal, beside the inventory one. */
|
|
23
|
+
readonly usedBy?: number;
|
|
24
|
+
/** Authored: one line on what this part is for. */
|
|
25
|
+
readonly summary?: string;
|
|
26
|
+
/** Authored: the situation this part is the right answer for. */
|
|
27
|
+
readonly whenToUse?: string;
|
|
28
|
+
/** Authored: the situation it is the wrong answer for. */
|
|
29
|
+
readonly whenNotToUse?: string;
|
|
30
|
+
/** Authored: named states the part handles. */
|
|
31
|
+
readonly states?: ReadonlyArray<string>;
|
|
32
|
+
/** Authored: the lifecycle a consumer can rely on. */
|
|
33
|
+
readonly status?: PartStatus;
|
|
34
|
+
/** Authored: real call sites or canonical snippets showing approved use. */
|
|
35
|
+
readonly examples?: ReadonlyArray<string>;
|
|
36
|
+
/** Derived: the primitive/sub-components and hooks this is composed of. */
|
|
37
|
+
readonly composedOf: ReadonlyArray<string>;
|
|
38
|
+
/** Authored: what to use instead, when a near-duplicate or a retirement exists. */
|
|
39
|
+
readonly useInstead?: ReadonlyArray<string>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The catalog's health, plus the two numbers only authored intent can supply.
|
|
43
|
+
*
|
|
44
|
+
* Inventory is not adoption. A repo can have four hundred parts and almost no UI built
|
|
45
|
+
* from them, and the menu should say so in the same breath as the count.
|
|
46
|
+
*/
|
|
47
|
+
export interface MenuHealth extends CatalogHealth {
|
|
48
|
+
/** Parts carrying any authored intent. */
|
|
49
|
+
readonly documented: number;
|
|
50
|
+
/** Parts marked retired that something still imports. */
|
|
51
|
+
readonly deprecatedInUse: number;
|
|
52
|
+
}
|
|
53
|
+
/** `MENU.md`'s model: the parts list an engineer works from. */
|
|
54
|
+
export interface Menu {
|
|
55
|
+
readonly lexicon: LexiconRef;
|
|
56
|
+
readonly title: string;
|
|
57
|
+
readonly hash: string;
|
|
58
|
+
readonly entries: ReadonlyArray<MenuEntry>;
|
|
59
|
+
/** Composition features, so a renderer never reaches past the menu into the catalog. */
|
|
60
|
+
readonly features?: ReadonlyArray<CatalogFeature>;
|
|
61
|
+
/** Adoption and pressure, in one place a reader can act on. */
|
|
62
|
+
readonly health?: MenuHealth;
|
|
63
|
+
/** Near-duplicate clusters, each with the most-used member as its canonical. */
|
|
64
|
+
readonly clusters?: ReadonlyArray<DuplicateCluster>;
|
|
65
|
+
readonly orphans: ReadonlyArray<string>;
|
|
66
|
+
readonly duplicates: ReadonlyArray<DuplicateCandidate>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The agent door: a repo-local prompt that is simultaneously the client engineer's
|
|
70
|
+
* documentation, the client agent's system-prompt fragment, and the thing a review
|
|
71
|
+
* surface diffs. One artifact, three readers.
|
|
72
|
+
*/
|
|
73
|
+
export interface Onboarding {
|
|
74
|
+
readonly lexicon: LexiconRef;
|
|
75
|
+
readonly title: string;
|
|
76
|
+
readonly prompt: string;
|
|
77
|
+
}
|
|
78
|
+
/** What a component is made of, from its skeleton: rendered tags and called hooks. */
|
|
79
|
+
export declare const composedOf: (signature: ReadonlyArray<string>) => ReadonlyArray<string>;
|
|
80
|
+
/** What `projectMenu` needs: the derived model, and whatever a person has written about it. */
|
|
81
|
+
export interface MenuProjection {
|
|
82
|
+
readonly catalog: Catalog;
|
|
83
|
+
/**
|
|
84
|
+
* Authored intent, keyed by the part's id (or its name in a catalog that predates ids).
|
|
85
|
+
* Absent means every entry is undocumented.
|
|
86
|
+
*/
|
|
87
|
+
readonly intent?: ReadonlyMap<string, Intent>;
|
|
88
|
+
readonly title?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The derived half of the menu, joined with the authored half.
|
|
92
|
+
*
|
|
93
|
+
* `id` is the join key: it is derived from the path, so two parts that share a `name`
|
|
94
|
+
* (`Comments`, `types`) do not overwrite each other's intent. The name fallback keeps
|
|
95
|
+
* intent written before ids landed readable; a rebuild only rewrites the generated menu,
|
|
96
|
+
* never a sentence a person wrote.
|
|
97
|
+
*/
|
|
98
|
+
export declare const projectMenu: ({ catalog, intent, title }: MenuProjection) => Menu;
|
|
99
|
+
/** Read one menu entry, or `undefined` when malformed. */
|
|
100
|
+
export declare const decodeMenuEntry: (value: unknown) => MenuEntry | undefined;
|
|
101
|
+
/** Read a menu, or `undefined` when the model is malformed. */
|
|
102
|
+
export declare const decodeMenu: (value: unknown) => Menu | undefined;
|
|
103
|
+
/** Read the onboarding prompt, or `undefined` when malformed. */
|
|
104
|
+
export declare const decodeOnboarding: (value: unknown) => Onboarding | undefined;
|
|
105
|
+
//# sourceMappingURL=doc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../src/doc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACT,MAAM,cAAc,CAAA;AASrB,OAAO,EAA2B,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AACnF,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAmBnF,uCAAuC;AACvC,MAAM,WAAW,SAAS;IACxB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,mFAAmF;IACnF,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,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AW,OAAO,KAAG,UAAU,GAAG,SAO9D,CAAA"}
|
package/dist/doc.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { decodeDuplicate, decodeFeature, decodeHealth, decodeCluster, PART_ROLES, } from "./catalog.js";
|
|
2
|
+
import { arrayOf, isRecord, num, oneOf, readLexiconRef, str, strings } from "./decode.js";
|
|
3
|
+
import { decodeIntent, hasIntent } from "./intent.js";
|
|
4
|
+
import { lexiconRef } from "./lexicon.js";
|
|
5
|
+
export { decodeIntent, hasIntent } from "./intent.js";
|
|
6
|
+
/** What a component is made of, from its skeleton: rendered tags and called hooks. */
|
|
7
|
+
export const composedOf = (signature) => {
|
|
8
|
+
const parts = new Set();
|
|
9
|
+
for (const part of signature) {
|
|
10
|
+
if (part.startsWith("tag:"))
|
|
11
|
+
parts.add(part.slice(4));
|
|
12
|
+
else if (part.startsWith("hook:"))
|
|
13
|
+
parts.add(part.slice(5));
|
|
14
|
+
}
|
|
15
|
+
return [...parts];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The derived half of the menu, joined with the authored half.
|
|
19
|
+
*
|
|
20
|
+
* `id` is the join key: it is derived from the path, so two parts that share a `name`
|
|
21
|
+
* (`Comments`, `types`) do not overwrite each other's intent. The name fallback keeps
|
|
22
|
+
* intent written before ids landed readable; a rebuild only rewrites the generated menu,
|
|
23
|
+
* never a sentence a person wrote.
|
|
24
|
+
*/
|
|
25
|
+
export const projectMenu = ({ catalog, intent, title = "UI menu" }) => {
|
|
26
|
+
const entries = catalog.components.map((component) => {
|
|
27
|
+
const authored = (component.id === undefined ? undefined : intent?.get(component.id)) ??
|
|
28
|
+
intent?.get(component.name);
|
|
29
|
+
return {
|
|
30
|
+
...(component.id === undefined ? {} : { id: component.id }),
|
|
31
|
+
name: component.name,
|
|
32
|
+
path: component.path,
|
|
33
|
+
tier: component.tier,
|
|
34
|
+
...(component.kind === undefined ? {} : { kind: component.kind }),
|
|
35
|
+
...(component.roles === undefined ? {} : { roles: component.roles }),
|
|
36
|
+
...(component.feature === undefined ? {} : { feature: component.feature }),
|
|
37
|
+
...(component.exports === undefined ? {} : { exports: component.exports }),
|
|
38
|
+
...(component.usedBy === undefined ? {} : { usedBy: component.usedBy }),
|
|
39
|
+
...(authored === undefined ? {} : authored),
|
|
40
|
+
composedOf: composedOf(component.signature),
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
const documented = entries.filter((entry) => hasIntent(entry)).length;
|
|
44
|
+
const deprecatedInUse = entries.filter((entry) => entry.status === "deprecated" && (entry.usedBy ?? 0) > 0).length;
|
|
45
|
+
return {
|
|
46
|
+
lexicon: lexiconRef("menu"),
|
|
47
|
+
title,
|
|
48
|
+
hash: catalog.hash,
|
|
49
|
+
features: catalog.features ?? [],
|
|
50
|
+
...(catalog.health === undefined
|
|
51
|
+
? {}
|
|
52
|
+
: {
|
|
53
|
+
health: {
|
|
54
|
+
...catalog.health,
|
|
55
|
+
documented,
|
|
56
|
+
deprecatedInUse,
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
...(catalog.clusters === undefined ? {} : { clusters: catalog.clusters }),
|
|
60
|
+
entries,
|
|
61
|
+
orphans: catalog.orphans,
|
|
62
|
+
duplicates: catalog.duplicates,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/*
|
|
66
|
+
* Decoders — untrusted input in, a model or an empty one out.
|
|
67
|
+
*
|
|
68
|
+
* The menu carries authored fields, so a malformed row must not silently drop an author's
|
|
69
|
+
* sentence. `decodeMenu` returns `undefined` for a malformed model rather than an empty
|
|
70
|
+
* menu: "there is no menu" and "this menu is unreadable" are different facts, and the
|
|
71
|
+
* caller decides which is safe.
|
|
72
|
+
*/
|
|
73
|
+
const TIERS_NAMES = ["primitive", "shared", "local"];
|
|
74
|
+
/** Read one menu entry, or `undefined` when malformed. */
|
|
75
|
+
export const decodeMenuEntry = (value) => {
|
|
76
|
+
if (!isRecord(value))
|
|
77
|
+
return undefined;
|
|
78
|
+
const id = str(value.id);
|
|
79
|
+
const kind = oneOf(value.kind, PART_ROLES);
|
|
80
|
+
const roles = arrayOf(value.roles, (role) => oneOf(role, PART_ROLES));
|
|
81
|
+
const feature = str(value.feature);
|
|
82
|
+
const exports = strings(value.exports);
|
|
83
|
+
const usedBy = num(value.usedBy);
|
|
84
|
+
const name = str(value.name);
|
|
85
|
+
const path = str(value.path);
|
|
86
|
+
const tier = oneOf(value.tier, TIERS_NAMES);
|
|
87
|
+
const composedOf = strings(value.composedOf);
|
|
88
|
+
if (name === undefined || path === undefined || tier === undefined || composedOf === undefined) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
...(id === undefined ? {} : { id }),
|
|
93
|
+
...(kind === undefined ? {} : { kind }),
|
|
94
|
+
...(roles === undefined ? {} : { roles }),
|
|
95
|
+
...(feature === undefined ? {} : { feature }),
|
|
96
|
+
...(exports === undefined ? {} : { exports }),
|
|
97
|
+
...(usedBy === undefined ? {} : { usedBy }),
|
|
98
|
+
...decodeIntent(value),
|
|
99
|
+
name,
|
|
100
|
+
path,
|
|
101
|
+
tier,
|
|
102
|
+
composedOf,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
const decodeMenuHealth = (value) => {
|
|
106
|
+
const base = decodeHealth(value);
|
|
107
|
+
if (base === undefined || !isRecord(value))
|
|
108
|
+
return undefined;
|
|
109
|
+
const documented = num(value.documented);
|
|
110
|
+
const deprecatedInUse = num(value.deprecatedInUse);
|
|
111
|
+
if (documented === undefined || deprecatedInUse === undefined)
|
|
112
|
+
return undefined;
|
|
113
|
+
return { ...base, documented, deprecatedInUse };
|
|
114
|
+
};
|
|
115
|
+
/** Read a menu, or `undefined` when the model is malformed. */
|
|
116
|
+
export const decodeMenu = (value) => {
|
|
117
|
+
if (!isRecord(value))
|
|
118
|
+
return undefined;
|
|
119
|
+
const lexicon = readLexiconRef(value, "menu");
|
|
120
|
+
const title = str(value.title);
|
|
121
|
+
const hash = str(value.hash);
|
|
122
|
+
const entries = arrayOf(value.entries, decodeMenuEntry);
|
|
123
|
+
const features = arrayOf(value.features, decodeFeature);
|
|
124
|
+
const health = decodeMenuHealth(value.health);
|
|
125
|
+
const clusters = arrayOf(value.clusters, decodeCluster);
|
|
126
|
+
const orphans = strings(value.orphans);
|
|
127
|
+
const duplicates = arrayOf(value.duplicates, decodeDuplicate);
|
|
128
|
+
if (lexicon === undefined ||
|
|
129
|
+
title === undefined ||
|
|
130
|
+
hash === undefined ||
|
|
131
|
+
entries === undefined ||
|
|
132
|
+
orphans === undefined ||
|
|
133
|
+
duplicates === undefined) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
lexicon,
|
|
138
|
+
title,
|
|
139
|
+
hash,
|
|
140
|
+
entries,
|
|
141
|
+
...(features === undefined ? {} : { features }),
|
|
142
|
+
...(health === undefined ? {} : { health }),
|
|
143
|
+
...(clusters === undefined ? {} : { clusters }),
|
|
144
|
+
orphans,
|
|
145
|
+
duplicates,
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
/** Read the onboarding prompt, or `undefined` when malformed. */
|
|
149
|
+
export const decodeOnboarding = (value) => {
|
|
150
|
+
if (!isRecord(value))
|
|
151
|
+
return undefined;
|
|
152
|
+
const lexicon = readLexiconRef(value, "onboarding");
|
|
153
|
+
const title = str(value.title);
|
|
154
|
+
const prompt = str(value.prompt);
|
|
155
|
+
if (lexicon === undefined || title === undefined || prompt === undefined)
|
|
156
|
+
return undefined;
|
|
157
|
+
return { lexicon, title, prompt };
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=doc.js.map
|
package/dist/doc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.js","sourceRoot":"","sources":["../src/doc.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,cAAc,CAAA;AAC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AAK,CAAC,MAAM,CAAC,CAAA;IAChC,IAAI,OAAO,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC1F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AACnC,CAAC,CAAA"}
|
package/dist/graph.d.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { type Catalog, type CatalogComponent, type PartRole } from "./catalog.ts";
|
|
2
|
+
/** A part addressed by the two fields a reader has: what it is called, and where it lives. */
|
|
3
|
+
export interface PartRef {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
}
|
|
7
|
+
/** A part reached from another, and the edge that reached it. */
|
|
8
|
+
export interface ReachedPart extends PartRef {
|
|
9
|
+
/** The tag as the reaching module spelled it. */
|
|
10
|
+
readonly tag: string;
|
|
11
|
+
/** One-based line in the reaching module. */
|
|
12
|
+
readonly line: number;
|
|
13
|
+
/**
|
|
14
|
+
* The direct child the walk passed through, when the part is not a direct child.
|
|
15
|
+
* Absent on a direct edge: there is nothing between the page and what it renders.
|
|
16
|
+
*/
|
|
17
|
+
readonly via?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Whether this catalog carries render edges at all — a catalog written before they landed does not. */
|
|
20
|
+
export declare const hasRenderEdges: (catalog: Catalog) => boolean;
|
|
21
|
+
/** What a page renders, read as two lists rather than one graph. */
|
|
22
|
+
export interface PageView {
|
|
23
|
+
readonly page: PartRef;
|
|
24
|
+
/** Parts the page's own JSX names. */
|
|
25
|
+
readonly direct: ReadonlyArray<ReachedPart>;
|
|
26
|
+
/** Parts reached through those, closest first. A page's parts are not only its tags. */
|
|
27
|
+
readonly transitive: ReadonlyArray<ReachedPart>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the catalog could answer at all.
|
|
30
|
+
*
|
|
31
|
+
* An empty `direct` is ambiguous — a leaf renders nothing, and a catalog built before
|
|
32
|
+
* edges existed renders nothing *for every part*. Reporting the second as the first is a
|
|
33
|
+
* false finding, so the view carries the distinction instead of leaving it to a reader.
|
|
34
|
+
*/
|
|
35
|
+
readonly edges: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** One route that mounts a part, and the chain of parts between them. */
|
|
38
|
+
export interface RouteReach extends PartRef {
|
|
39
|
+
/** Child-to-parent chain from the route down, excluding the route and the subject. */
|
|
40
|
+
readonly via: ReadonlyArray<string>;
|
|
41
|
+
}
|
|
42
|
+
/** Where a part appears on screen. */
|
|
43
|
+
export interface PartView {
|
|
44
|
+
readonly part: PartRef;
|
|
45
|
+
/** Modules whose JSX names it: the direct renderers, routes included. */
|
|
46
|
+
readonly direct: ReadonlyArray<PartRef>;
|
|
47
|
+
/** Routes that mount it, directly or through other parts. */
|
|
48
|
+
readonly routes: ReadonlyArray<RouteReach>;
|
|
49
|
+
/** See `PageView.edges`: an empty answer is not the same as an answer we could not give. */
|
|
50
|
+
readonly edges: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** One candidate for "does something like this already exist?". */
|
|
53
|
+
export interface SimilarPart extends PartRef {
|
|
54
|
+
readonly score: number;
|
|
55
|
+
/**
|
|
56
|
+
* Which evidence produced the score.
|
|
57
|
+
*
|
|
58
|
+
* A name that reads alike and a skeleton that composes alike are different arguments.
|
|
59
|
+
* Keeping them apart lets the answer say "they render the same parts" instead of "0.62",
|
|
60
|
+
* which is the difference between reviewable evidence and a number to argue with.
|
|
61
|
+
*/
|
|
62
|
+
readonly basis: "name" | "skeleton" | "name+skeleton";
|
|
63
|
+
readonly nameScore: number;
|
|
64
|
+
readonly skeletonScore: number;
|
|
65
|
+
/** Composition the two share: the evidence for a skeleton match. */
|
|
66
|
+
readonly shared: ReadonlyArray<string>;
|
|
67
|
+
/** Composition the subject has that the candidate lacks. */
|
|
68
|
+
readonly unshared: ReadonlyArray<string>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Every part the query could mean, most specific tier first.
|
|
72
|
+
*
|
|
73
|
+
* Tiers rather than one fuzzy score: an id or a path is an address, a name is a guess, and
|
|
74
|
+
* a suffix is a guess with an address's tail. Keeping them apart is what lets a caller say
|
|
75
|
+
* "three parts are called Button" instead of picking one silently.
|
|
76
|
+
*/
|
|
77
|
+
export declare const findParts: (catalog: Catalog, query: string) => ReadonlyArray<CatalogComponent>;
|
|
78
|
+
/**
|
|
79
|
+
* `page -> parts`, as a person asks it: "what does this screen render today?"
|
|
80
|
+
*
|
|
81
|
+
* Direct children are what the route's own JSX names. The transitive list is the rest of
|
|
82
|
+
* what appears on screen — a mock author who stops at the direct list re-invents `Table`
|
|
83
|
+
* because `SetupTable` renders it one level down. Breadth-first, edge order preserved, so
|
|
84
|
+
* the answer is the reading order of the file rather than a hash's.
|
|
85
|
+
*/
|
|
86
|
+
export declare const partsOfPage: ({ catalog, page, }: {
|
|
87
|
+
readonly catalog: Catalog;
|
|
88
|
+
readonly page: string;
|
|
89
|
+
}) => PageView | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* `part -> pages`, as a mock reviewer asks it: "where does this appear on screen?"
|
|
92
|
+
*
|
|
93
|
+
* The import graph answers with modules; a reviewer wants routes. Walking the render edges
|
|
94
|
+
* upward stops at the route rather than continuing into whatever imports it, because a
|
|
95
|
+
* route is where the question ends — it is the thing a person can open.
|
|
96
|
+
*/
|
|
97
|
+
export declare const pagesOfPart: ({ catalog, part, }: {
|
|
98
|
+
readonly catalog: Catalog;
|
|
99
|
+
readonly part: string;
|
|
100
|
+
}) => PartView | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* How much two names share, 0–1.
|
|
103
|
+
*
|
|
104
|
+
* The denominator is the smaller name, not the union: `TablePanel` after `Table` is not a
|
|
105
|
+
* worse match because it added a word, and a union would punish exactly that. A token
|
|
106
|
+
* counts when the other side has it or a word containing it (`map` in `mapbox`), because
|
|
107
|
+
* a compound spelling is how this vocabulary grows.
|
|
108
|
+
*/
|
|
109
|
+
export declare const nameSimilarity: ({ left, right, }: {
|
|
110
|
+
readonly left: string;
|
|
111
|
+
readonly right: string;
|
|
112
|
+
}) => number;
|
|
113
|
+
/**
|
|
114
|
+
* Rank the catalog against a signature.
|
|
115
|
+
*
|
|
116
|
+
* The structural metric is the duplicate join's, not a second one: if `similar` used props,
|
|
117
|
+
* or the raw skeleton with React's own hooks, it would answer differently from the duplicate
|
|
118
|
+
* report a reviewer already trusts. `shared` is returned because "why" is what a person acts
|
|
119
|
+
* on; a score alone is not reviewable.
|
|
120
|
+
*/
|
|
121
|
+
export declare const similarToSignature: ({ catalog, signature, name, exclude, kinds, limit, threshold, }: {
|
|
122
|
+
readonly catalog: Catalog;
|
|
123
|
+
readonly signature: ReadonlyArray<string>;
|
|
124
|
+
/** The subject's name, when it has one. A sketch's declaration name is the other signal. */
|
|
125
|
+
readonly name?: string;
|
|
126
|
+
readonly exclude?: string;
|
|
127
|
+
/** Restrict the field of comparison. Default: components and providers. */
|
|
128
|
+
readonly kinds?: ReadonlyArray<PartRole>;
|
|
129
|
+
readonly limit?: number;
|
|
130
|
+
readonly threshold?: number;
|
|
131
|
+
}) => ReadonlyArray<SimilarPart>;
|
|
132
|
+
/** `similar <part>`, the catalog-only case: the subject is a part the crawler already saw. */
|
|
133
|
+
export declare const similarParts: ({ catalog, part, limit, threshold, }: {
|
|
134
|
+
readonly catalog: Catalog;
|
|
135
|
+
readonly part: string;
|
|
136
|
+
readonly limit?: number;
|
|
137
|
+
readonly threshold?: number;
|
|
138
|
+
}) => ReadonlyArray<SimilarPart>;
|
|
139
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EAEd,MAAM,cAAc,CAAA;AAkBrB,8FAA8F;AAC9F,MAAM,WAAW,OAAO;IACtB,QAAQ,CAA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