@substrate-kit/cli 0.1.2 → 0.2.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/.claude-plugin/plugin.json +1 -1
- package/LICENSE +21 -0
- package/README.md +25 -8
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +10 -41
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.d.ts +1 -0
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +51 -109
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/docs.d.ts +4 -2
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +33 -54
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +158 -122
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +8 -7
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/get-component.d.ts +1 -1
- package/dist/mcp/tools/get-component.d.ts.map +1 -1
- package/dist/mcp/tools/get-component.js +10 -6
- package/dist/mcp/tools/get-component.js.map +1 -1
- package/dist/mcp/tools/get-docs.d.ts +17 -0
- package/dist/mcp/tools/get-docs.d.ts.map +1 -0
- package/dist/mcp/tools/get-docs.js +23 -0
- package/dist/mcp/tools/get-docs.js.map +1 -0
- package/dist/mcp/tools/install.d.ts +2 -1
- package/dist/mcp/tools/install.d.ts.map +1 -1
- package/dist/mcp/tools/install.js +18 -27
- package/dist/mcp/tools/install.js.map +1 -1
- package/dist/mcp/tools/search.d.ts +1 -1
- package/dist/mcp/tools/search.d.ts.map +1 -1
- package/dist/mcp/tools/search.js +2 -4
- package/dist/mcp/tools/search.js.map +1 -1
- package/dist/{mcp/types.d.ts → registry.d.ts} +6 -1
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +48 -0
- package/dist/registry.js.map +1 -0
- package/dist/utils/agents-file.d.ts +4 -0
- package/dist/utils/agents-file.d.ts.map +1 -0
- package/dist/utils/agents-file.js +36 -0
- package/dist/utils/agents-file.js.map +1 -0
- package/dist/utils/docs.d.ts +7 -0
- package/dist/utils/docs.d.ts.map +1 -0
- package/dist/utils/docs.js +28 -0
- package/dist/utils/docs.js.map +1 -0
- package/dist/utils/shadcn.d.ts +6 -1
- package/dist/utils/shadcn.d.ts.map +1 -1
- package/dist/utils/shadcn.js +25 -12
- package/dist/utils/shadcn.js.map +1 -1
- package/dist/utils/version.d.ts +3 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +8 -0
- package/dist/utils/version.js.map +1 -0
- package/docs/components/action.mdx +30 -0
- package/docs/components/alignment-controls.mdx +30 -0
- package/docs/components/badge.mdx +22 -0
- package/docs/components/breadcrumbs.mdx +25 -0
- package/docs/components/collapsible-pane.mdx +35 -0
- package/docs/components/colour-picker.mdx +66 -0
- package/docs/components/command-palette.mdx +36 -0
- package/docs/components/context-menu.mdx +31 -0
- package/docs/components/controls-timeline.mdx +107 -0
- package/docs/components/controls.mdx +168 -0
- package/docs/components/design-canvas.mdx +51 -0
- package/docs/components/document-tabs.mdx +25 -0
- package/docs/components/easing-curve-editor.mdx +85 -0
- package/docs/components/empty-state.mdx +26 -0
- package/docs/components/gallery.mdx +60 -0
- package/docs/components/history-controls.mdx +47 -0
- package/docs/components/image-picker.mdx +50 -0
- package/docs/components/layer-list.mdx +36 -0
- package/docs/components/node.mdx +85 -0
- package/docs/components/number-input.mdx +44 -0
- package/docs/components/number-slider.mdx +32 -0
- package/docs/components/pane.mdx +39 -0
- package/docs/components/panel.mdx +28 -0
- package/docs/components/popover.mdx +32 -0
- package/docs/components/progress-bar.mdx +24 -0
- package/docs/components/resizer.mdx +24 -0
- package/docs/components/select.mdx +31 -0
- package/docs/components/shortcut-overlay.mdx +43 -0
- package/docs/components/slider.mdx +20 -0
- package/docs/components/spring-editor.mdx +85 -0
- package/docs/components/status-bar.mdx +42 -0
- package/docs/components/surface.mdx +47 -0
- package/docs/components/swatch-palette.mdx +36 -0
- package/docs/components/text-area.mdx +26 -0
- package/docs/components/timeline.mdx +96 -0
- package/docs/components/toast.mdx +42 -0
- package/docs/components/toggle-group.mdx +40 -0
- package/docs/components/toggle.mdx +27 -0
- package/docs/components/toolbar.mdx +24 -0
- package/docs/components/tree-list.mdx +46 -0
- package/docs/components/xy-pad.mdx +49 -0
- package/docs/hooks/use-clipboard.mdx +70 -0
- package/docs/hooks/use-drag-reorder.mdx +60 -0
- package/docs/hooks/use-selection.mdx +68 -0
- package/docs/hooks/use-undoable.mdx +83 -0
- package/docs/hooks/use-viewport.mdx +75 -0
- package/docs/utilities/bounding-box.mdx +76 -0
- package/docs/utilities/keyboard-shortcuts.mdx +64 -0
- package/docs/utilities/snap.mdx +73 -0
- package/package.json +6 -4
- package/registry.json +274 -6
- package/skills/3d-scene/SKILL.md +2 -1
- package/skills/animation/SKILL.md +2 -1
- package/skills/canvas-2d/SKILL.md +67 -5
- package/skills/composing-panels/SKILL.md +1 -4
- package/skills/data-visualisation/SKILL.md +2 -1
- package/skills/image-generation/SKILL.md +2 -1
- package/skills/install-components/SKILL.md +22 -16
- package/skills/scaffold-playground/SKILL.md +39 -19
- package/skills/substrate-canvas/SKILL.md +5 -0
- package/skills/substrate-controls/SKILL.md +57 -2
- package/skills/substrate-interaction/SKILL.md +19 -10
- package/skills/substrate-scaffold/SKILL.md +4 -4
- package/skills/theming/SKILL.md +8 -2
- package/skills/wire-interactions/SKILL.md +6 -3
- package/templates/agents-section.md +41 -0
- package/dist/commands/browse.d.ts +0 -2
- package/dist/commands/browse.d.ts.map +0 -1
- package/dist/commands/browse.js +0 -25
- package/dist/commands/browse.js.map +0 -1
- package/dist/commands/create.d.ts +0 -9
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -27
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/variables.d.ts +0 -4
- package/dist/commands/variables.d.ts.map +0 -1
- package/dist/commands/variables.js +0 -111
- package/dist/commands/variables.js.map +0 -1
- package/dist/mcp/registry.d.ts +0 -3
- package/dist/mcp/registry.d.ts.map +0 -1
- package/dist/mcp/registry.js +0 -43
- package/dist/mcp/registry.js.map +0 -1
- package/dist/mcp/tools/theme.d.ts +0 -10
- package/dist/mcp/tools/theme.d.ts.map +0 -1
- package/dist/mcp/tools/theme.js +0 -37
- package/dist/mcp/tools/theme.js.map +0 -1
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -2
- package/dist/mcp/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,WAAW;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAiLD,wBAAsB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCnE"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,65 +1,54 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { copyDir, exists, writeFile, resolveSkillsDir, listDirs, } from "../utils/fs.js";
|
|
4
|
+
import { agentsSection, mergeSection } from "../utils/agents-file.js";
|
|
5
|
+
import { VERSION } from "../utils/version.js";
|
|
4
6
|
import { log } from "../utils/logger.js";
|
|
5
7
|
const CLI_PACKAGE = "@substrate-kit/cli";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# Surface components
|
|
41
|
-
npx substrate-kit add surface timeline gallery colour-picker easing-curve-editor
|
|
42
|
-
|
|
43
|
-
# Interactive picker (no args)
|
|
44
|
-
npx substrate-kit add
|
|
45
|
-
\`\`\`
|
|
46
|
-
|
|
47
|
-
Do **not** run \`npx shadcn@latest add\` directly for Substrate components — always go through \`substrate-kit add\`.
|
|
48
|
-
|
|
49
|
-
## Registry
|
|
50
|
-
|
|
51
|
-
Components are installed from \`substrate.georgedrury.co.uk/r/\` via the Substrate CLI, which wraps shadcn under the hood.
|
|
52
|
-
`;
|
|
8
|
+
const REGISTRY_ENTRY = "https://substrate.georgedrury.co.uk/r/{name}";
|
|
9
|
+
const SKILL_DIRS = [join(".claude", "skills"), join(".agents", "skills")];
|
|
10
|
+
function readJson(path) {
|
|
11
|
+
try {
|
|
12
|
+
const parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
13
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)
|
|
14
|
+
? parsed
|
|
15
|
+
: null;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function asRecord(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
23
|
+
? value
|
|
24
|
+
: {};
|
|
25
|
+
}
|
|
26
|
+
function detectFramework(pkg) {
|
|
27
|
+
const deps = { ...pkg?.dependencies, ...pkg?.devDependencies };
|
|
28
|
+
if (deps["next"])
|
|
29
|
+
return "next";
|
|
30
|
+
if (deps["vite"])
|
|
31
|
+
return "vite";
|
|
32
|
+
return "unknown";
|
|
33
|
+
}
|
|
34
|
+
// The stylesheet shadcn writes theme variables into: the project's own if it
|
|
35
|
+
// has one in the usual place, otherwise the framework's default.
|
|
36
|
+
function detectCssFile(cwd, framework) {
|
|
37
|
+
const candidates = framework === "next"
|
|
38
|
+
? ["app/globals.css", "src/app/globals.css", "styles/globals.css", "src/styles/globals.css"]
|
|
39
|
+
: ["src/index.css", "src/globals.css", "src/styles.css", "src/App.css"];
|
|
40
|
+
return (candidates.find((file) => exists(join(cwd, file))) ??
|
|
41
|
+
(framework === "next" ? "app/globals.css" : "src/globals.css"));
|
|
53
42
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
43
|
+
function newComponentsJson(cwd, framework) {
|
|
44
|
+
return {
|
|
56
45
|
$schema: "https://ui.shadcn.com/schema.json",
|
|
57
46
|
style: "radix-mira",
|
|
58
|
-
rsc:
|
|
47
|
+
rsc: framework === "next",
|
|
59
48
|
tsx: true,
|
|
60
49
|
tailwind: {
|
|
61
50
|
config: "",
|
|
62
|
-
css:
|
|
51
|
+
css: detectCssFile(cwd, framework),
|
|
63
52
|
baseColor: "neutral",
|
|
64
53
|
cssVariables: true,
|
|
65
54
|
prefix: "",
|
|
@@ -72,91 +61,138 @@ function componentsJson() {
|
|
|
72
61
|
lib: "@/lib",
|
|
73
62
|
hooks: "@/hooks",
|
|
74
63
|
},
|
|
75
|
-
registries: {
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
}, null, 2);
|
|
64
|
+
registries: { "@substrate": REGISTRY_ENTRY },
|
|
65
|
+
};
|
|
79
66
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
67
|
+
function writeJson(path, value, indent = 2) {
|
|
68
|
+
writeFile(path, JSON.stringify(value, null, indent) + "\n");
|
|
69
|
+
}
|
|
70
|
+
function initComponentsJson(cwd, framework, force) {
|
|
71
|
+
const path = join(cwd, "components.json");
|
|
72
|
+
if (!exists(path)) {
|
|
73
|
+
writeJson(path, newComponentsJson(cwd, framework));
|
|
74
|
+
log.success(`Created components.json for ${framework === "next" ? "Next.js" : "Vite"}`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const existing = readJson(path);
|
|
78
|
+
if (!existing) {
|
|
79
|
+
log.warn("components.json could not be read as JSON, so it was left alone");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Only the Substrate registry is added; the project's own style choices stay
|
|
83
|
+
const registries = asRecord(existing.registries);
|
|
84
|
+
if (registries["@substrate"] && !force) {
|
|
85
|
+
log.step("components.json already has the @substrate registry");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
writeJson(path, { ...existing, registries: { ...registries, "@substrate": REGISTRY_ENTRY } });
|
|
89
|
+
log.success("Added the @substrate registry to components.json");
|
|
90
|
+
}
|
|
91
|
+
function initMcpJson(cwd, force) {
|
|
92
|
+
const path = join(cwd, ".mcp.json");
|
|
93
|
+
const server = { command: "npx", args: ["-y", CLI_PACKAGE, "mcp"] };
|
|
94
|
+
if (!exists(path)) {
|
|
95
|
+
writeJson(path, { mcpServers: { substrate: server } });
|
|
96
|
+
log.success("Created .mcp.json (Substrate MCP server registered)");
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const existing = readJson(path);
|
|
100
|
+
if (!existing) {
|
|
101
|
+
log.warn(".mcp.json could not be read as JSON, so it was left alone");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const servers = asRecord(existing.mcpServers);
|
|
105
|
+
if (servers["substrate"] && !force) {
|
|
106
|
+
log.step(".mcp.json already registers the Substrate MCP server");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
writeJson(path, { ...existing, mcpServers: { ...servers, substrate: server } });
|
|
110
|
+
log.success("Registered the Substrate MCP server in .mcp.json");
|
|
111
|
+
}
|
|
112
|
+
function describe(file, result) {
|
|
113
|
+
if (result === "created")
|
|
114
|
+
log.success(`Created ${file}`);
|
|
115
|
+
else if (result === "added")
|
|
116
|
+
log.success(`Added a Substrate section to ${file}`);
|
|
117
|
+
else if (result === "updated")
|
|
118
|
+
log.success(`Updated the Substrate section in ${file}`);
|
|
119
|
+
else
|
|
120
|
+
log.step(`${file} is up to date`);
|
|
121
|
+
}
|
|
122
|
+
// CLAUDE.md and AGENTS.md both get the guidance, unless CLAUDE.md just imports
|
|
123
|
+
// AGENTS.md, in which case adding it to both would load it twice.
|
|
124
|
+
function initAgentFiles(cwd) {
|
|
125
|
+
const claude = join(cwd, "CLAUDE.md");
|
|
126
|
+
const agents = join(cwd, "AGENTS.md");
|
|
127
|
+
const section = agentsSection();
|
|
128
|
+
if (!exists(claude) && !exists(agents)) {
|
|
129
|
+
describe("AGENTS.md", mergeSection(agents, section));
|
|
130
|
+
writeFile(claude, "@AGENTS.md\n");
|
|
131
|
+
log.success("Created CLAUDE.md (imports AGENTS.md)");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const claudeImportsAgents = exists(claude) && exists(agents) && /^@AGENTS\.md\s*$/m.test(readFileSync(claude, "utf-8"));
|
|
135
|
+
if (exists(agents))
|
|
136
|
+
describe("AGENTS.md", mergeSection(agents, section));
|
|
137
|
+
if (exists(claude) && !claudeImportsAgents)
|
|
138
|
+
describe("CLAUDE.md", mergeSection(claude, section));
|
|
139
|
+
}
|
|
140
|
+
function initSkills(cwd, force) {
|
|
141
|
+
const source = resolveSkillsDir();
|
|
142
|
+
const skillNames = listDirs(source);
|
|
88
143
|
if (skillNames.length === 0) {
|
|
89
144
|
log.error("No skills found in the bundled skills directory");
|
|
90
145
|
process.exit(1);
|
|
91
146
|
}
|
|
92
|
-
let
|
|
93
|
-
let
|
|
94
|
-
for (const
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
if (copiedCount > 0) {
|
|
105
|
-
log.success(`Installed ${copiedCount} skill${copiedCount === 1 ? "" : "s"}`);
|
|
106
|
-
}
|
|
107
|
-
if (skippedCount > 0) {
|
|
108
|
-
log.warn(`Skipped ${skippedCount} existing skill${skippedCount === 1 ? "" : "s"} (use --force to overwrite)`);
|
|
109
|
-
}
|
|
110
|
-
// 2. Generate CLAUDE.md
|
|
111
|
-
const claudeMdPath = join(cwd, "CLAUDE.md");
|
|
112
|
-
if (exists(claudeMdPath) && !force) {
|
|
113
|
-
log.warn("CLAUDE.md already exists (use --force to overwrite)");
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
writeFile(claudeMdPath, claudeMd());
|
|
117
|
-
log.success("Created CLAUDE.md");
|
|
118
|
-
}
|
|
119
|
-
// 3. Write components.json
|
|
120
|
-
if (!skipComponentsJson) {
|
|
121
|
-
const componentsJsonPath = join(cwd, "components.json");
|
|
122
|
-
if (exists(componentsJsonPath) && !force) {
|
|
123
|
-
log.warn("components.json already exists (use --force to overwrite)");
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
writeFile(componentsJsonPath, componentsJson());
|
|
127
|
-
log.success("Created components.json");
|
|
147
|
+
let copied = 0;
|
|
148
|
+
let skipped = 0;
|
|
149
|
+
for (const dir of SKILL_DIRS) {
|
|
150
|
+
for (const name of skillNames) {
|
|
151
|
+
const dest = join(cwd, dir, name);
|
|
152
|
+
if (exists(dest) && !force) {
|
|
153
|
+
skipped++;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
copyDir(join(source, name), dest);
|
|
157
|
+
copied++;
|
|
128
158
|
}
|
|
129
159
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (exists(mcpJsonPath) && !force) {
|
|
133
|
-
log.warn(".mcp.json already exists (use --force to overwrite)");
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
const mcpConfig = {
|
|
137
|
-
mcpServers: {
|
|
138
|
-
substrate: {
|
|
139
|
-
command: "npx",
|
|
140
|
-
args: ["-y", "@substrate-kit/cli", "mcp"],
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
writeFile(mcpJsonPath, JSON.stringify(mcpConfig, null, 2) + "\n");
|
|
145
|
-
log.success("Created .mcp.json (Substrate MCP server registered)");
|
|
160
|
+
if (copied > 0) {
|
|
161
|
+
log.success(`Installed ${skillNames.length} skills into ${SKILL_DIRS.join(" and ")}`);
|
|
146
162
|
}
|
|
147
|
-
|
|
163
|
+
if (skipped > 0) {
|
|
164
|
+
log.warn(`Skipped ${skipped} existing skill folder${skipped === 1 ? "" : "s"} (use --force to refresh them)`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export async function init(options = {}) {
|
|
168
|
+
const cwd = process.cwd();
|
|
169
|
+
const { force = false, skipComponentsJson = false } = options;
|
|
170
|
+
log.title("Initialising Substrate");
|
|
148
171
|
const packageJsonPath = join(cwd, "package.json");
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
172
|
+
const rawPackageJson = exists(packageJsonPath) ? readFileSync(packageJsonPath, "utf-8") : null;
|
|
173
|
+
const pkg = rawPackageJson ? JSON.parse(rawPackageJson) : null;
|
|
174
|
+
const framework = detectFramework(pkg);
|
|
175
|
+
if (!pkg) {
|
|
176
|
+
log.warn("No package.json here. Run this from the root of your project.");
|
|
177
|
+
}
|
|
178
|
+
else if (framework === "unknown") {
|
|
179
|
+
log.warn("Could not tell whether this is a Next.js or Vite project, so Vite settings are used");
|
|
180
|
+
}
|
|
181
|
+
initSkills(cwd, force);
|
|
182
|
+
initAgentFiles(cwd);
|
|
183
|
+
if (!skipComponentsJson)
|
|
184
|
+
initComponentsJson(cwd, framework === "next" ? "next" : "vite", force);
|
|
185
|
+
initMcpJson(cwd, force);
|
|
186
|
+
// The CLI is added as a dev dependency so `npx substrate-kit` resolves locally
|
|
187
|
+
if (pkg && rawPackageJson) {
|
|
152
188
|
if (!pkg.dependencies?.[CLI_PACKAGE] && !pkg.devDependencies?.[CLI_PACKAGE]) {
|
|
153
|
-
pkg.devDependencies = { ...pkg.devDependencies, [CLI_PACKAGE]:
|
|
154
|
-
const indent =
|
|
189
|
+
pkg.devDependencies = { ...pkg.devDependencies, [CLI_PACKAGE]: `^${VERSION}` };
|
|
190
|
+
const indent = rawPackageJson.includes("\n\t") ? "\t" : 2;
|
|
155
191
|
writeFile(packageJsonPath, JSON.stringify(pkg, null, indent) + "\n");
|
|
156
192
|
log.success(`Added ${CLI_PACKAGE} to devDependencies (install to use npx substrate-kit)`);
|
|
157
193
|
}
|
|
158
194
|
}
|
|
159
195
|
log.blank();
|
|
160
|
-
log.info("Substrate is ready.
|
|
196
|
+
log.info("Substrate is ready. Agents in this project can now use the skills and the MCP server.");
|
|
161
197
|
}
|
|
162
198
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EACN,OAAO,EACP,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,QAAQ,GACR,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAExC,MAAM,WAAW,GAAG,oBAAoB,CAAA;AACxC,MAAM,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EACN,OAAO,EACP,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,QAAQ,GACR,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAoB,MAAM,yBAAyB,CAAA;AACvF,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G,IAAI,CAAC,CAAA;YACpE,GAAG,CAAC,OAAO,CAAC,SAAS,WAAW,wDAAwD,CAAC,CAAA;QAC1F,CAAC;IACF,CAAC;IAED,GAAG,CAAC,KAAK,EAAE,CAAA;IACX,GAAG,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAA;AAClG,CAAC"}
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/mcp/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AAYA,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CA+CjD"}
|
package/dist/mcp/server.js
CHANGED
|
@@ -2,30 +2,31 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { loadRegistry } from "
|
|
5
|
+
import { loadRegistry } from "../registry.js";
|
|
6
|
+
import { VERSION } from "../utils/version.js";
|
|
6
7
|
import { handleSearch } from "./tools/search.js";
|
|
7
8
|
import { handleGetComponent } from "./tools/get-component.js";
|
|
8
9
|
import { handleInstall } from "./tools/install.js";
|
|
9
|
-
import {
|
|
10
|
+
import { handleGetDocs } from "./tools/get-docs.js";
|
|
10
11
|
export async function startServer() {
|
|
11
12
|
const registry = await loadRegistry();
|
|
12
13
|
const server = new McpServer({
|
|
13
14
|
name: "substrate",
|
|
14
|
-
version:
|
|
15
|
+
version: VERSION,
|
|
15
16
|
});
|
|
16
17
|
server.tool("search_components", "Search the Substrate component registry by keyword, category, or description. Returns matching components with name, description, and category.", {
|
|
17
18
|
query: z.string().optional().describe("Free-text search against component name, title, and description"),
|
|
18
19
|
category: z.string().optional().describe("Filter by category: substrate, ui, canvas, lib, store"),
|
|
19
20
|
}, async (args) => handleSearch(registry, args));
|
|
20
|
-
server.tool("get_component", "Get
|
|
21
|
+
server.tool("get_component", "Get details for a Substrate component: CSS variables and the theme override keys, dependencies, usage example, lineage, install command and docs link.", {
|
|
21
22
|
name: z.string().describe("Component name (e.g. design-canvas, toolbar, panel)"),
|
|
22
23
|
}, async (args) => handleGetComponent(registry, args));
|
|
23
24
|
server.tool("install_components", "Install one or more Substrate components from substrate.georgedrury.co.uk into the current project. Runs shadcn add behind the scenes.", {
|
|
24
25
|
components: z.array(z.string()).describe("Component names to install (e.g. ['design-canvas', 'toolbar', 'panel'])"),
|
|
25
26
|
}, async (args) => handleInstall(registry, args));
|
|
26
|
-
server.tool("
|
|
27
|
-
|
|
28
|
-
}, async (args) =>
|
|
27
|
+
server.tool("get_docs", "Get the full documentation page for a component, hook or utility: install, usage, every prop and option, and theme variables. Use after get_component when you need to know how to use it.", {
|
|
28
|
+
name: z.string().describe("Component, hook or utility name (e.g. controls, controls-timeline, use-undoable)"),
|
|
29
|
+
}, async (args) => handleGetDocs(registry, args));
|
|
29
30
|
const transport = new StdioServerTransport();
|
|
30
31
|
await server.connect(transport);
|
|
31
32
|
}
|
package/dist/mcp/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,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CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,yEAAyE,CAAC;KACpH,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAgC,CAAC,CAC1E,CAAA;IAED,MAAM,CAAC,IAAI,CACT,UAAU,EACV,4LAA4L,EAC5L;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kFAAkF,CAAC;KAC9G,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAwB,CAAC,CAClE,CAAA;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACjC,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAA;AAC3D,IAAI,WAAW,EAAE,CAAC;IAChB,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,GAAG,CAAC,CAAA;QAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-component.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/get-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"get-component.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/get-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG/D,wBAAsB,kBAAkB,CACvC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;GA6BtB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { overrideKeys } from "../../registry.js";
|
|
2
|
+
import { docsUrl } from "../../utils/docs.js";
|
|
1
3
|
export async function handleGetComponent(registry, args) {
|
|
2
4
|
const item = registry.items.find((i) => i.name.toLowerCase() === args.name.toLowerCase());
|
|
3
5
|
if (!item) {
|
|
@@ -11,13 +13,15 @@ export async function handleGetComponent(registry, args) {
|
|
|
11
13
|
isError: true,
|
|
12
14
|
};
|
|
13
15
|
}
|
|
16
|
+
// Theme variables ride along so one call answers "how do I restyle this"
|
|
17
|
+
const details = {
|
|
18
|
+
...item,
|
|
19
|
+
overrideKeys: overrideKeys(item),
|
|
20
|
+
docs: docsUrl(item.name),
|
|
21
|
+
install: `npx substrate-kit add ${item.name}`,
|
|
22
|
+
};
|
|
14
23
|
return {
|
|
15
|
-
content: [
|
|
16
|
-
{
|
|
17
|
-
type: "text",
|
|
18
|
-
text: JSON.stringify(item, null, 2),
|
|
19
|
-
},
|
|
20
|
-
],
|
|
24
|
+
content: [{ type: "text", text: JSON.stringify(details, null, 2) }],
|
|
21
25
|
};
|
|
22
26
|
}
|
|
23
27
|
//# sourceMappingURL=get-component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-component.js","sourceRoot":"","sources":["../../../src/mcp/tools/get-component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-component.js","sourceRoot":"","sources":["../../../src/mcp/tools/get-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACvC,QAAkB,EAClB,IAAsB;IAEtB,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAC/B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CACvD,CAAA;IAED,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO;YACN,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,cAAc,IAAI,CAAC,IAAI,2BAA2B,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;iBACtG;aACD;YACD,OAAO,EAAE,IAAI;SACb,CAAA;IACF,CAAC;IAED,yEAAyE;IACzE,MAAM,OAAO,GAAG;QACf,GAAG,IAAI;QACP,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC;QAChC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QACxB,OAAO,EAAE,yBAAyB,IAAI,CAAC,IAAI,EAAE;KAC7C,CAAA;IAED,OAAO;QACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KAC5E,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Registry } from "../../registry.js";
|
|
2
|
+
export declare function handleGetDocs(registry: Registry, args: {
|
|
3
|
+
name: string;
|
|
4
|
+
}): Promise<{
|
|
5
|
+
content: {
|
|
6
|
+
type: "text";
|
|
7
|
+
text: string;
|
|
8
|
+
}[];
|
|
9
|
+
isError: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
content: {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
isError?: undefined;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=get-docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-docs.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/get-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAGjD,wBAAsB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;GAsB7E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { findDocsPage } from "../../utils/docs.js";
|
|
2
|
+
export async function handleGetDocs(registry, args) {
|
|
3
|
+
const name = args.name.toLowerCase();
|
|
4
|
+
const page = findDocsPage(name);
|
|
5
|
+
if (!page) {
|
|
6
|
+
const known = registry.items.some((i) => i.name === name);
|
|
7
|
+
return {
|
|
8
|
+
content: [
|
|
9
|
+
{
|
|
10
|
+
type: "text",
|
|
11
|
+
text: known
|
|
12
|
+
? `No docs page is bundled for "${name}". Use get_component for its details.`
|
|
13
|
+
: `"${args.name}" not found. Use search_components to find a name.`,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
isError: true,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: `Source: ${page.url}\n\n${page.content}` }],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=get-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-docs.js","sourceRoot":"","sources":["../../../src/mcp/tools/get-docs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAkB,EAAE,IAAsB;IAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAA;IACpC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAE/B,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;QACzD,OAAO;YACN,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,KAAK;wBACV,CAAC,CAAC,gCAAgC,IAAI,uCAAuC;wBAC7E,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,oDAAoD;iBACpE;aACD;YACD,OAAO,EAAE,IAAI;SACb,CAAA;IACF,CAAC;IAED,OAAO;QACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,IAAI,CAAC,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;KACpF,CAAA;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Registry } from "../../registry.js";
|
|
2
2
|
export declare function handleInstall(registry: Registry, args: {
|
|
3
3
|
components: string[];
|
|
4
4
|
}): Promise<{
|
|
@@ -6,5 +6,6 @@ export declare function handleInstall(registry: Registry, args: {
|
|
|
6
6
|
type: "text";
|
|
7
7
|
text: string;
|
|
8
8
|
}[];
|
|
9
|
+
isError: boolean;
|
|
9
10
|
}>;
|
|
10
11
|
//# sourceMappingURL=install.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAGhE,wBAAsB,aAAa,CAClC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;;GA0B9B"}
|
|
@@ -1,38 +1,29 @@
|
|
|
1
|
+
import { REGISTRY_BASE } from "../../registry.js";
|
|
1
2
|
import { shadcnAdd } from "../../utils/shadcn.js";
|
|
2
|
-
// SUBSTRATE_REGISTRY_URL points installs at a local registry for testing
|
|
3
|
-
const REGISTRY_BASE = process.env.SUBSTRATE_REGISTRY_URL ?? "https://substrate.georgedrury.co.uk/r";
|
|
4
3
|
export async function handleInstall(registry, args) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
const url = `${REGISTRY_BASE}/${name}`;
|
|
4
|
+
const known = new Set(registry.items.map((i) => i.name));
|
|
5
|
+
const unknown = args.components.filter((name) => !known.has(name));
|
|
6
|
+
const valid = args.components.filter((name) => known.has(name));
|
|
7
|
+
const results = unknown.map((name) => ({
|
|
8
|
+
name,
|
|
9
|
+
status: "not_found",
|
|
10
|
+
error: `Component "${name}" not in registry`,
|
|
11
|
+
}));
|
|
12
|
+
if (valid.length > 0) {
|
|
17
13
|
try {
|
|
18
|
-
shadcnAdd(
|
|
19
|
-
|
|
14
|
+
shadcnAdd(valid.map((name) => `${REGISTRY_BASE}/${name}`), { silent: true });
|
|
15
|
+
for (const name of valid)
|
|
16
|
+
results.push({ name, status: "installed" });
|
|
20
17
|
}
|
|
21
18
|
catch (err) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
status: "failed",
|
|
25
|
-
error: err instanceof Error ? err.message : String(err),
|
|
26
|
-
});
|
|
19
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
20
|
+
for (const name of valid)
|
|
21
|
+
results.push({ name, status: "failed", error });
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
24
|
return {
|
|
30
|
-
content: [
|
|
31
|
-
|
|
32
|
-
type: "text",
|
|
33
|
-
text: JSON.stringify(results, null, 2),
|
|
34
|
-
},
|
|
35
|
-
],
|
|
25
|
+
content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
|
|
26
|
+
isError: results.some((r) => r.status !== "installed"),
|
|
36
27
|
};
|
|
37
28
|
}
|
|
38
29
|
//# sourceMappingURL=install.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/mcp/tools/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/mcp/tools/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,QAAkB,EAClB,IAA8B;IAE9B,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACxD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;IAClE,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;IAE/D,MAAM,OAAO,GAA4D,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/F,IAAI;QACJ,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE,cAAc,IAAI,mBAAmB;KAC5C,CAAC,CAAC,CAAA;IAEH,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,IAAI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