@brad-frost-web/eddie-brain 0.32.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 +109 -0
- package/dist/analyze/drift-detector.d.ts +30 -0
- package/dist/analyze/drift-detector.d.ts.map +1 -0
- package/dist/analyze/drift-detector.js +310 -0
- package/dist/analyze/drift-detector.js.map +1 -0
- package/dist/analyze/health-scorer.d.ts +71 -0
- package/dist/analyze/health-scorer.d.ts.map +1 -0
- package/dist/analyze/health-scorer.js +420 -0
- package/dist/analyze/health-scorer.js.map +1 -0
- package/dist/analyze/index.d.ts +11 -0
- package/dist/analyze/index.d.ts.map +1 -0
- package/dist/analyze/index.js +11 -0
- package/dist/analyze/index.js.map +1 -0
- package/dist/analyze/naming-validator.d.ts +99 -0
- package/dist/analyze/naming-validator.d.ts.map +1 -0
- package/dist/analyze/naming-validator.js +430 -0
- package/dist/analyze/naming-validator.js.map +1 -0
- package/dist/analyze/slot-contract-validator.d.ts +68 -0
- package/dist/analyze/slot-contract-validator.d.ts.map +1 -0
- package/dist/analyze/slot-contract-validator.js +232 -0
- package/dist/analyze/slot-contract-validator.js.map +1 -0
- package/dist/analyze/token-validator.d.ts +62 -0
- package/dist/analyze/token-validator.d.ts.map +1 -0
- package/dist/analyze/token-validator.js +348 -0
- package/dist/analyze/token-validator.js.map +1 -0
- package/dist/cli/brain.d.ts +12 -0
- package/dist/cli/brain.d.ts.map +1 -0
- package/dist/cli/brain.js +641 -0
- package/dist/cli/brain.js.map +1 -0
- package/dist/cli/formatters/json.d.ts +15 -0
- package/dist/cli/formatters/json.d.ts.map +1 -0
- package/dist/cli/formatters/json.js +18 -0
- package/dist/cli/formatters/json.js.map +1 -0
- package/dist/cli/formatters/terminal.d.ts +19 -0
- package/dist/cli/formatters/terminal.d.ts.map +1 -0
- package/dist/cli/formatters/terminal.js +125 -0
- package/dist/cli/formatters/terminal.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +7 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/data/governance-rules.json +94 -0
- package/dist/governance/audit-log.d.ts +17 -0
- package/dist/governance/audit-log.d.ts.map +1 -0
- package/dist/governance/audit-log.js +44 -0
- package/dist/governance/audit-log.js.map +1 -0
- package/dist/governance/index.d.ts +8 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +8 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/permissions.d.ts +26 -0
- package/dist/governance/permissions.d.ts.map +1 -0
- package/dist/governance/permissions.js +75 -0
- package/dist/governance/permissions.js.map +1 -0
- package/dist/governance/rules-engine.d.ts +24 -0
- package/dist/governance/rules-engine.d.ts.map +1 -0
- package/dist/governance/rules-engine.js +111 -0
- package/dist/governance/rules-engine.js.map +1 -0
- package/dist/governance/trust-manager.d.ts +34 -0
- package/dist/governance/trust-manager.d.ts.map +1 -0
- package/dist/governance/trust-manager.js +148 -0
- package/dist/governance/trust-manager.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge-graph/component-index.d.ts +320 -0
- package/dist/knowledge-graph/component-index.d.ts.map +1 -0
- package/dist/knowledge-graph/component-index.js +1033 -0
- package/dist/knowledge-graph/component-index.js.map +1 -0
- package/dist/knowledge-graph/index.d.ts +134 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph/index.js +249 -0
- package/dist/knowledge-graph/index.js.map +1 -0
- package/dist/knowledge-graph/learning-history.d.ts +77 -0
- package/dist/knowledge-graph/learning-history.d.ts.map +1 -0
- package/dist/knowledge-graph/learning-history.js +187 -0
- package/dist/knowledge-graph/learning-history.js.map +1 -0
- package/dist/knowledge-graph/relationship-map.d.ts +55 -0
- package/dist/knowledge-graph/relationship-map.d.ts.map +1 -0
- package/dist/knowledge-graph/relationship-map.js +238 -0
- package/dist/knowledge-graph/relationship-map.js.map +1 -0
- package/dist/knowledge-graph/token-taxonomy.d.ts +127 -0
- package/dist/knowledge-graph/token-taxonomy.d.ts.map +1 -0
- package/dist/knowledge-graph/token-taxonomy.js +357 -0
- package/dist/knowledge-graph/token-taxonomy.js.map +1 -0
- package/dist/loop/fix-agent.d.ts +55 -0
- package/dist/loop/fix-agent.d.ts.map +1 -0
- package/dist/loop/fix-agent.js +344 -0
- package/dist/loop/fix-agent.js.map +1 -0
- package/dist/loop/index.d.ts +8 -0
- package/dist/loop/index.d.ts.map +1 -0
- package/dist/loop/index.js +8 -0
- package/dist/loop/index.js.map +1 -0
- package/dist/loop/issue-fetcher.d.ts +51 -0
- package/dist/loop/issue-fetcher.d.ts.map +1 -0
- package/dist/loop/issue-fetcher.js +188 -0
- package/dist/loop/issue-fetcher.js.map +1 -0
- package/dist/loop/observer.d.ts +42 -0
- package/dist/loop/observer.d.ts.map +1 -0
- package/dist/loop/observer.js +220 -0
- package/dist/loop/observer.js.map +1 -0
- package/dist/loop/pacer.d.ts +44 -0
- package/dist/loop/pacer.d.ts.map +1 -0
- package/dist/loop/pacer.js +90 -0
- package/dist/loop/pacer.js.map +1 -0
- package/dist/loop/reporter.d.ts +9 -0
- package/dist/loop/reporter.d.ts.map +1 -0
- package/dist/loop/reporter.js +119 -0
- package/dist/loop/reporter.js.map +1 -0
- package/dist/loop/runner.d.ts +57 -0
- package/dist/loop/runner.d.ts.map +1 -0
- package/dist/loop/runner.js +390 -0
- package/dist/loop/runner.js.map +1 -0
- package/dist/loop/types.d.ts +151 -0
- package/dist/loop/types.d.ts.map +1 -0
- package/dist/loop/types.js +22 -0
- package/dist/loop/types.js.map +1 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +12 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +618 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/pipeline/agent-runner.d.ts +34 -0
- package/dist/pipeline/agent-runner.d.ts.map +1 -0
- package/dist/pipeline/agent-runner.js +323 -0
- package/dist/pipeline/agent-runner.js.map +1 -0
- package/dist/pipeline/agents/accessibility-auditor.d.ts +10 -0
- package/dist/pipeline/agents/accessibility-auditor.d.ts.map +1 -0
- package/dist/pipeline/agents/accessibility-auditor.js +69 -0
- package/dist/pipeline/agents/accessibility-auditor.js.map +1 -0
- package/dist/pipeline/agents/code-reviewer.d.ts +10 -0
- package/dist/pipeline/agents/code-reviewer.d.ts.map +1 -0
- package/dist/pipeline/agents/code-reviewer.js +75 -0
- package/dist/pipeline/agents/code-reviewer.js.map +1 -0
- package/dist/pipeline/agents/code-writer.d.ts +10 -0
- package/dist/pipeline/agents/code-writer.d.ts.map +1 -0
- package/dist/pipeline/agents/code-writer.js +103 -0
- package/dist/pipeline/agents/code-writer.js.map +1 -0
- package/dist/pipeline/agents/component-architect.d.ts +13 -0
- package/dist/pipeline/agents/component-architect.d.ts.map +1 -0
- package/dist/pipeline/agents/component-architect.js +81 -0
- package/dist/pipeline/agents/component-architect.js.map +1 -0
- package/dist/pipeline/agents/index.d.ts +16 -0
- package/dist/pipeline/agents/index.d.ts.map +1 -0
- package/dist/pipeline/agents/index.js +24 -0
- package/dist/pipeline/agents/index.js.map +1 -0
- package/dist/pipeline/agents/library-researcher.d.ts +12 -0
- package/dist/pipeline/agents/library-researcher.d.ts.map +1 -0
- package/dist/pipeline/agents/library-researcher.js +85 -0
- package/dist/pipeline/agents/library-researcher.js.map +1 -0
- package/dist/pipeline/agents/quality-gate.d.ts +9 -0
- package/dist/pipeline/agents/quality-gate.d.ts.map +1 -0
- package/dist/pipeline/agents/quality-gate.js +71 -0
- package/dist/pipeline/agents/quality-gate.js.map +1 -0
- package/dist/pipeline/agents/spec-analyst.d.ts +10 -0
- package/dist/pipeline/agents/spec-analyst.d.ts.map +1 -0
- package/dist/pipeline/agents/spec-analyst.js +72 -0
- package/dist/pipeline/agents/spec-analyst.js.map +1 -0
- package/dist/pipeline/agents/story-author.d.ts +9 -0
- package/dist/pipeline/agents/story-author.d.ts.map +1 -0
- package/dist/pipeline/agents/story-author.js +65 -0
- package/dist/pipeline/agents/story-author.js.map +1 -0
- package/dist/pipeline/artifact-store.d.ts +27 -0
- package/dist/pipeline/artifact-store.d.ts.map +1 -0
- package/dist/pipeline/artifact-store.js +77 -0
- package/dist/pipeline/artifact-store.js.map +1 -0
- package/dist/pipeline/conversational-gate.d.ts +26 -0
- package/dist/pipeline/conversational-gate.d.ts.map +1 -0
- package/dist/pipeline/conversational-gate.js +122 -0
- package/dist/pipeline/conversational-gate.js.map +1 -0
- package/dist/pipeline/index.d.ts +14 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +17 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/iteration-tracker.d.ts +29 -0
- package/dist/pipeline/iteration-tracker.d.ts.map +1 -0
- package/dist/pipeline/iteration-tracker.js +102 -0
- package/dist/pipeline/iteration-tracker.js.map +1 -0
- package/dist/pipeline/learning-bridge.d.ts +37 -0
- package/dist/pipeline/learning-bridge.d.ts.map +1 -0
- package/dist/pipeline/learning-bridge.js +118 -0
- package/dist/pipeline/learning-bridge.js.map +1 -0
- package/dist/pipeline/orchestrator.d.ts +45 -0
- package/dist/pipeline/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestrator.js +473 -0
- package/dist/pipeline/orchestrator.js.map +1 -0
- package/dist/pipeline/templates/architecture.d.ts +27 -0
- package/dist/pipeline/templates/architecture.d.ts.map +1 -0
- package/dist/pipeline/templates/architecture.js +111 -0
- package/dist/pipeline/templates/architecture.js.map +1 -0
- package/dist/pipeline/templates/brief.d.ts +22 -0
- package/dist/pipeline/templates/brief.d.ts.map +1 -0
- package/dist/pipeline/templates/brief.js +121 -0
- package/dist/pipeline/templates/brief.js.map +1 -0
- package/dist/pipeline/templates/component-rules.d.ts +25 -0
- package/dist/pipeline/templates/component-rules.d.ts.map +1 -0
- package/dist/pipeline/templates/component-rules.js +93 -0
- package/dist/pipeline/templates/component-rules.js.map +1 -0
- package/dist/pipeline/templates/index.d.ts +9 -0
- package/dist/pipeline/templates/index.d.ts.map +1 -0
- package/dist/pipeline/templates/index.js +7 -0
- package/dist/pipeline/templates/index.js.map +1 -0
- package/dist/pipeline/tool-handler.d.ts +25 -0
- package/dist/pipeline/tool-handler.d.ts.map +1 -0
- package/dist/pipeline/tool-handler.js +392 -0
- package/dist/pipeline/tool-handler.js.map +1 -0
- package/dist/pipeline/types.d.ts +146 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/pipeline/types.js +27 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/plan/action-types.d.ts +31 -0
- package/dist/plan/action-types.d.ts.map +1 -0
- package/dist/plan/action-types.js +83 -0
- package/dist/plan/action-types.js.map +1 -0
- package/dist/plan/decision-engine.d.ts +57 -0
- package/dist/plan/decision-engine.d.ts.map +1 -0
- package/dist/plan/decision-engine.js +162 -0
- package/dist/plan/decision-engine.js.map +1 -0
- package/dist/plan/index.d.ts +6 -0
- package/dist/plan/index.d.ts.map +1 -0
- package/dist/plan/index.js +6 -0
- package/dist/plan/index.js.map +1 -0
- package/dist/types.d.ts +351 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +26 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/anthropic.d.ts +15 -0
- package/dist/utils/anthropic.d.ts.map +1 -0
- package/dist/utils/anthropic.js +40 -0
- package/dist/utils/anthropic.js.map +1 -0
- package/dist/utils/id.d.ts +8 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +14 -0
- package/dist/utils/id.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ComponentIndex — Auto-discover and catalog Eddie components
|
|
3
|
+
*
|
|
4
|
+
* Scans the Eddie monorepo to build a registry of all components,
|
|
5
|
+
* extracting metadata from TypeScript decorators and Storybook stories.
|
|
6
|
+
*/
|
|
7
|
+
import type { AtomicLevel, ComponentEntry } from '../types.js';
|
|
8
|
+
export declare class ComponentIndex {
|
|
9
|
+
private components;
|
|
10
|
+
/**
|
|
11
|
+
* Build the component registry by scanning the Eddie codebase.
|
|
12
|
+
*
|
|
13
|
+
* Scans four packages:
|
|
14
|
+
*
|
|
15
|
+
* eddie-web-components — core Lit components (depth 1: <name>/<name>.ts)
|
|
16
|
+
* eddie-recipes — recipe components (depth 2: <project>/<name>/<name>.ts)
|
|
17
|
+
* eddie-pages — full-page templates (depth 2: <project>/<name>/<name>.ts)
|
|
18
|
+
* eddie-charts — chart recipe components (depth 2: <project>/<name>/<name>.ts)
|
|
19
|
+
*
|
|
20
|
+
* All four are walked by scanPackage, which handles depth-agnostic traversal
|
|
21
|
+
* and enforces the basename-matches-containing-dir convention. eddie-charts
|
|
22
|
+
* is a category recipe library: its components share the `ed-r-*` tag prefix
|
|
23
|
+
* and `ed-r-*` CSS class prefix with eddie-recipes, but live in a separate
|
|
24
|
+
* package so that the Chart.js runtime is opt-in for consumers who don't
|
|
25
|
+
* need chart surfaces.
|
|
26
|
+
*/
|
|
27
|
+
build(rootDir: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Scan a package directory for components.
|
|
30
|
+
*
|
|
31
|
+
* Walks any depth under the package root and picks up files that follow
|
|
32
|
+
* the Eddie component convention: every component file lives at
|
|
33
|
+
* `<component-dir>/<component-name>.ts` where the file's basename matches
|
|
34
|
+
* its containing directory's basename. That gives us:
|
|
35
|
+
*
|
|
36
|
+
* eddie-web-components: components/button/button.ts
|
|
37
|
+
* components/card/card.ts
|
|
38
|
+
* → depth 1 under pkgDir
|
|
39
|
+
*
|
|
40
|
+
* eddie-recipes: recipes/common/project-card/project-card.ts
|
|
41
|
+
* recipes/we-are-here/wah-logo/wah-logo.ts
|
|
42
|
+
* → depth 2 under pkgDir (extra project-name level)
|
|
43
|
+
*
|
|
44
|
+
* Historic bug: the previous glob was a two-level pattern (star slash star
|
|
45
|
+
* dot ts) which only matched depth 1, so the entire eddie-recipes catalog
|
|
46
|
+
* was invisible to the indexer. `ed-r-project-card` and 11 other real,
|
|
47
|
+
* shipping recipe components never made it into components.json. Fix: walk
|
|
48
|
+
* any depth via a double-star glob, then enforce the basename-matches-
|
|
49
|
+
* containing-directory convention to filter helpers, types, and barrel
|
|
50
|
+
* files that happen to sit next to real components.
|
|
51
|
+
*/
|
|
52
|
+
private scanPackage;
|
|
53
|
+
/**
|
|
54
|
+
* Parse a single component file and extract metadata.
|
|
55
|
+
*
|
|
56
|
+
* @param componentName The component's base name (e.g. "button", "project-card")
|
|
57
|
+
* @param filePath Absolute path to the component's .ts file
|
|
58
|
+
* @param componentDir Absolute path to the component's own directory
|
|
59
|
+
* (contains the .ts, .scss, .stories.ts, and test/)
|
|
60
|
+
* @param relativeDir Path from the package root to the component dir,
|
|
61
|
+
* e.g. "button" (eddie-web-components) or
|
|
62
|
+
* "common/project-card" (eddie-recipes)
|
|
63
|
+
* @param pkgName Which package this component lives in
|
|
64
|
+
* @param rootDir Repo root (unused today but passed for future use)
|
|
65
|
+
*/
|
|
66
|
+
private parseComponent;
|
|
67
|
+
/**
|
|
68
|
+
* Extract the list of Eddie component tag names referenced via `import`
|
|
69
|
+
* statements in the source.
|
|
70
|
+
*
|
|
71
|
+
* Recognizes the canonical Eddie import paths:
|
|
72
|
+
*
|
|
73
|
+
* import '@brad-frost-web/eddie-web-components/components/button/button';
|
|
74
|
+
* → ed-button
|
|
75
|
+
* import '@brad-frost-web/eddie-recipes/recipes/common/site-header/site-header';
|
|
76
|
+
* → ed-r-site-header
|
|
77
|
+
* import '@brad-frost-web/eddie-pages/pages/common/homepage/homepage';
|
|
78
|
+
* → ed-p-homepage
|
|
79
|
+
*
|
|
80
|
+
* The trailing `/<name>/<name>` segment is the convention enforced by
|
|
81
|
+
* scanPackage (component basename matches its containing directory). We
|
|
82
|
+
* map the basename to a tag name using the same package → prefix table
|
|
83
|
+
* the indexer uses for cssClassName.
|
|
84
|
+
*
|
|
85
|
+
* Imports that don't match this shape (e.g. `import { html } from 'lit'`,
|
|
86
|
+
* `import styles from './foo.scss?inline'`, EdElement base-class imports)
|
|
87
|
+
* are ignored. Side-effect imports without a `from` (the most common form
|
|
88
|
+
* for Eddie component registration) and named/default imports are both
|
|
89
|
+
* matched.
|
|
90
|
+
*
|
|
91
|
+
* The resulting list is deduplicated and sorted for stable output across
|
|
92
|
+
* builds (eliminates a class of dirty-diff in the catalog snapshot).
|
|
93
|
+
*/
|
|
94
|
+
private extractComposesWith;
|
|
95
|
+
/**
|
|
96
|
+
* Map a `@brad-frost-web/<pkg>/<path>` import specifier to its Eddie tag
|
|
97
|
+
* name, or return null if the specifier doesn't resolve to a component.
|
|
98
|
+
*
|
|
99
|
+
* Handles the three component-bearing packages:
|
|
100
|
+
*
|
|
101
|
+
* eddie-web-components/components/<X>/<X> → ed-<X>
|
|
102
|
+
* eddie-recipes/recipes/<scope>/<X>/<X> → ed-r-<X>
|
|
103
|
+
* eddie-pages/pages/<scope>/<X>/<X> → ed-p-<X>
|
|
104
|
+
*
|
|
105
|
+
* Returns null for non-component imports such as the `EdElement` base
|
|
106
|
+
* class, theme/token CSS, asset paths, or any other shape we don't
|
|
107
|
+
* recognize as a registered Eddie tag.
|
|
108
|
+
*/
|
|
109
|
+
private importPathToTagName;
|
|
110
|
+
/**
|
|
111
|
+
* Extract `use` / `dontUse` / `accessibility` guidelines from the class-level
|
|
112
|
+
* JSDoc. Recognizes three custom tag forms:
|
|
113
|
+
*
|
|
114
|
+
* @use <text> → adds one entry to guidelines.use
|
|
115
|
+
* @dontuse <text> → adds one entry to guidelines.dontUse
|
|
116
|
+
* @a11y <text> → adds one entry to guidelines.accessibility
|
|
117
|
+
*
|
|
118
|
+
* Tags can appear multiple times in the same JSDoc block, with each
|
|
119
|
+
* occurrence becoming a separate bullet in the corresponding array. The
|
|
120
|
+
* tag text is everything from after the tag name to the end of the line.
|
|
121
|
+
* Trailing-line continuations are not currently supported — each guideline
|
|
122
|
+
* must fit on one line.
|
|
123
|
+
*
|
|
124
|
+
* This is the counterpart to authoring-side guidelines in the component
|
|
125
|
+
* source files. Today the Eddie catalog is sparse on guidelines; this
|
|
126
|
+
* parser is the mechanism that lets new guidelines actually land in
|
|
127
|
+
* eddie-brain's output.
|
|
128
|
+
*/
|
|
129
|
+
private extractGuidelines;
|
|
130
|
+
/**
|
|
131
|
+
* Extract `@overridableSlot` and `@overridableProp` tags from class-level
|
|
132
|
+
* JSDoc. These mark the specific slots/props a consumer is expected to use
|
|
133
|
+
* to customize the component — distinct from `slots` (which lists every
|
|
134
|
+
* slot that exists) and `properties` (which lists everything the class
|
|
135
|
+
* declares). See #642 for why we need both.
|
|
136
|
+
*
|
|
137
|
+
* Tag shapes:
|
|
138
|
+
* `@overridableSlot name — purpose`
|
|
139
|
+
* `@overridableSlot `name` purpose`
|
|
140
|
+
* `@overridableProp name — purpose`
|
|
141
|
+
* (any of em-dash, en-dash, or hyphen between name and purpose; optional)
|
|
142
|
+
*/
|
|
143
|
+
private extractOverridableSurface;
|
|
144
|
+
/**
|
|
145
|
+
* Extract the canonical invocation of the component.
|
|
146
|
+
*
|
|
147
|
+
* Sourced from two places:
|
|
148
|
+
* - Optional `@canonicalUsage` JSDoc tag on the class → prose `note`
|
|
149
|
+
* - The `Default` export in the component's stories file → `default`
|
|
150
|
+
* markup (only when the story uses `html\`...\`` — imperative
|
|
151
|
+
* `document.createElement` stories are skipped because they have no
|
|
152
|
+
* static markup to extract)
|
|
153
|
+
*
|
|
154
|
+
* The goal (per #642): when a consumer asks "use the default site header",
|
|
155
|
+
* an agent can call `eddie_get_component` and get back the exact markup to
|
|
156
|
+
* paste. No interpretation, no guessing.
|
|
157
|
+
*/
|
|
158
|
+
private extractCanonicalUsage;
|
|
159
|
+
/**
|
|
160
|
+
* Extract a `@contentApi { ... }` JSDoc tag from the class-level comment.
|
|
161
|
+
*
|
|
162
|
+
* The tag value is a JSON-ish object literal (single quotes or double quotes
|
|
163
|
+
* accepted, trailing commas tolerated). Three keys are recognized:
|
|
164
|
+
*
|
|
165
|
+
* contentVia — string description of the primary content path
|
|
166
|
+
* labelVia — "prop" | "slot" | "none"
|
|
167
|
+
* labelVisibility — "visible" | "hidden" | "accessible-only"
|
|
168
|
+
*
|
|
169
|
+
* Components that don't declare the tag get `undefined`. See #627: this is
|
|
170
|
+
* the structural answer to "where does this component's content come from?",
|
|
171
|
+
* letting consumers and validators detect prop-vs-slot mismatches before
|
|
172
|
+
* they render as silent drops.
|
|
173
|
+
*/
|
|
174
|
+
private extractContentApi;
|
|
175
|
+
/**
|
|
176
|
+
* Parse the `Default` story template literal out of a stories file.
|
|
177
|
+
*
|
|
178
|
+
* Recognizes the common Eddie story shape:
|
|
179
|
+
*
|
|
180
|
+
* export const Default = () => html`<ed-foo></ed-foo>`;
|
|
181
|
+
* export const Default = (args: Args) => html`<ed-foo>...</ed-foo>`;
|
|
182
|
+
* export const Default = () => html`
|
|
183
|
+
* <ed-foo>
|
|
184
|
+
* ...
|
|
185
|
+
* </ed-foo>
|
|
186
|
+
* `;
|
|
187
|
+
*
|
|
188
|
+
* Returns undefined for imperative stories (`document.createElement(...)`)
|
|
189
|
+
* which have no extractable markup — consumers of those recipes interact
|
|
190
|
+
* via JS properties rather than markup and don't benefit from a canonical
|
|
191
|
+
* markup string.
|
|
192
|
+
*/
|
|
193
|
+
private extractDefaultStoryMarkup;
|
|
194
|
+
/**
|
|
195
|
+
* Extract @property decorated properties
|
|
196
|
+
*/
|
|
197
|
+
private extractProperties;
|
|
198
|
+
/**
|
|
199
|
+
* Extract enum options from union types
|
|
200
|
+
*/
|
|
201
|
+
private extractEnumOptions;
|
|
202
|
+
/**
|
|
203
|
+
* Extract slot definitions from JSDoc comments.
|
|
204
|
+
*
|
|
205
|
+
* Parses the Eddie JSDoc slot convention, which comes in these forms:
|
|
206
|
+
*
|
|
207
|
+
* @slot - The default slot description. (default slot, leading dash)
|
|
208
|
+
* @slot header - Optional header content (named slot, name before dash)
|
|
209
|
+
* @slot `header` Optional header content (named slot, backticked name)
|
|
210
|
+
* @slot Just a default description (default slot, no dash, bare prose)
|
|
211
|
+
*
|
|
212
|
+
* Also looks for `<slot name="x">` in the render template as a secondary
|
|
213
|
+
* source for slots that weren't explicitly documented in JSDoc.
|
|
214
|
+
*
|
|
215
|
+
* Historic bug: the previous regex `/@slot\s*(?:-\s*)?([^\n]*)/` consumed
|
|
216
|
+
* the optional leading `- ` and then an inner regex `/^`?(\w+)`?/` grabbed
|
|
217
|
+
* the first word of the remaining text as the slot name. For a default slot
|
|
218
|
+
* like `@slot - The grid items`, this produced slot name "The" (the first
|
|
219
|
+
* word of "The grid items") instead of "default". Bug fix: distinguish the
|
|
220
|
+
* four cases above explicitly.
|
|
221
|
+
*/
|
|
222
|
+
private extractSlots;
|
|
223
|
+
/**
|
|
224
|
+
* Returns true if the given string has balanced parens, braces, and
|
|
225
|
+
* brackets. Used to reject truncated expressions (like multi-line method
|
|
226
|
+
* calls that span past the regex capture boundary) from being emitted as
|
|
227
|
+
* property default values.
|
|
228
|
+
*/
|
|
229
|
+
private hasBalancedDelimiters;
|
|
230
|
+
/**
|
|
231
|
+
* Extract custom events from dispatch calls
|
|
232
|
+
*/
|
|
233
|
+
private extractEvents;
|
|
234
|
+
/**
|
|
235
|
+
* Extract CSS custom properties referenced
|
|
236
|
+
*/
|
|
237
|
+
private extractCssCustomProperties;
|
|
238
|
+
/**
|
|
239
|
+
* Extract intent/purpose from JSDoc comment.
|
|
240
|
+
*
|
|
241
|
+
* Parses the class-level JSDoc preceding `export class` and returns the
|
|
242
|
+
* first real description paragraph. A "paragraph" is a sequence of
|
|
243
|
+
* consecutive non-blank, non-@tag lines joined with spaces.
|
|
244
|
+
*
|
|
245
|
+
* Heading detection: Eddie components sometimes begin their JSDoc with a
|
|
246
|
+
* one-word title line (e.g. "Grid", "Button") on its own, separated from
|
|
247
|
+
* the actual description by a blank line. In that case the first paragraph
|
|
248
|
+
* is just the single heading word, which is not a useful intent. If the
|
|
249
|
+
* first paragraph is a short heading-like line AND a second paragraph
|
|
250
|
+
* exists, return the second paragraph instead.
|
|
251
|
+
*
|
|
252
|
+
* Historic bug: the previous implementation used `.slice(0, 1)` on the
|
|
253
|
+
* filtered lines, which returned only the first non-blank non-@ line
|
|
254
|
+
* regardless of context — so `ed-grid`'s intent came back as literally the
|
|
255
|
+
* single word "Grid" while its real description lived on the next
|
|
256
|
+
* paragraph. Bug fix: paragraph-aware extraction.
|
|
257
|
+
*/
|
|
258
|
+
private extractIntent;
|
|
259
|
+
/**
|
|
260
|
+
* Get atomic level from the component's own stories file.
|
|
261
|
+
*
|
|
262
|
+
* `componentDir` is the component's actual directory (e.g.
|
|
263
|
+
* `packages/eddie-web-components/components/button` or
|
|
264
|
+
* `packages/eddie-recipes/recipes/common/project-card`). The stories file
|
|
265
|
+
* lives directly inside it as `<componentName>.stories.ts`.
|
|
266
|
+
*/
|
|
267
|
+
private getAtomicLevel;
|
|
268
|
+
/**
|
|
269
|
+
* Determine parent/child relationships for compound components
|
|
270
|
+
*/
|
|
271
|
+
private determineCompoundRelationship;
|
|
272
|
+
/**
|
|
273
|
+
* Convert class name to display name
|
|
274
|
+
*/
|
|
275
|
+
private classNameToDisplayName;
|
|
276
|
+
/**
|
|
277
|
+
* Get a component by tag name
|
|
278
|
+
*/
|
|
279
|
+
getComponent(tagName: string): ComponentEntry | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Get all components
|
|
282
|
+
*/
|
|
283
|
+
getAll(): ComponentEntry[];
|
|
284
|
+
/**
|
|
285
|
+
* Search components by query string
|
|
286
|
+
*/
|
|
287
|
+
/**
|
|
288
|
+
* Search components by natural-language query.
|
|
289
|
+
*
|
|
290
|
+
* Historic bug (#610): used naive `.includes()` substring matching against
|
|
291
|
+
* only tagName / displayName / intent. A multi-word query like "marketing
|
|
292
|
+
* homepage" never matched `ed-p-marketing-homepage` because the literal
|
|
293
|
+
* substring "marketing homepage" (with a space) is not anywhere in the
|
|
294
|
+
* tagName, displayName, or single-sentence intent. Pages were effectively
|
|
295
|
+
* invisible to any query an agent would actually type.
|
|
296
|
+
*
|
|
297
|
+
* Fix: tokenize the query, drop stopwords and very short terms, and score
|
|
298
|
+
* each candidate against the full set of fields that carry meaning —
|
|
299
|
+
* tagName, displayName, intent, guidelines.use, property names and
|
|
300
|
+
* descriptions, slot names and descriptions. Pages get a ranking boost
|
|
301
|
+
* when the query contains page-intent keywords ("page", "template",
|
|
302
|
+
* "dashboard", "homepage", "login", "article", etc.) because in that
|
|
303
|
+
* case the agent is looking for a full composition starting point, not
|
|
304
|
+
* a primitive.
|
|
305
|
+
*/
|
|
306
|
+
search(query: string): ComponentEntry[];
|
|
307
|
+
/**
|
|
308
|
+
* Get components by atomic level
|
|
309
|
+
*/
|
|
310
|
+
getByAtomicLevel(level: AtomicLevel): ComponentEntry[];
|
|
311
|
+
/**
|
|
312
|
+
* Serialize to JSON
|
|
313
|
+
*/
|
|
314
|
+
toJSON(): Record<string, ComponentEntry>;
|
|
315
|
+
/**
|
|
316
|
+
* Deserialize from JSON
|
|
317
|
+
*/
|
|
318
|
+
static fromJSON(obj: Record<string, ComponentEntry>): ComponentIndex;
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=component-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-index.d.ts","sourceRoot":"","sources":["../../src/knowledge-graph/component-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EAKf,MAAM,aAAa,CAAC;AAErB,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAA0C;IAE5D;;;;;;;;;;;;;;;;OAgBG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc3C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;YACW,WAAW;IA2DzB;;;;;;;;;;;;OAYG;YACW,cAAc;IAsL5B;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,OAAO,CAAC,mBAAmB;IAgB3B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,mBAAmB;IA+B3B;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,iBAAiB;IA8BzB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,yBAAyB;IA6BjC;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,qBAAqB;IAmB7B;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,iBAAiB;IA6BzB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,yBAAyB;IAejC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2FzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAQ1B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,YAAY;IAuDpB;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAgB7B;;OAEG;IACH,OAAO,CAAC,aAAa;IAoBrB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAclC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,aAAa;IA4CrB;;;;;;;OAOG;YACW,cAAc;IA0B5B;;OAEG;IACH,OAAO,CAAC,6BAA6B;IA6BrC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIzD;;OAEG;IACH,MAAM,IAAI,cAAc,EAAE;IAI1B;;OAEG;IACH;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE;IA2DvC;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,EAAE;IAItD;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;IAQxC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,cAAc;CAOrE"}
|