@master/css-mcp 2.0.0-rc.76 → 2.0.0-rc.78
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 +34 -4
- package/dist/bin/index.js +1 -1
- package/dist/classes.d.ts +237 -0
- package/dist/classes.js +224 -0
- package/dist/compare.d.ts +71 -0
- package/dist/compare.js +131 -0
- package/dist/context.js +2 -2
- package/dist/contributor.d.ts +150 -0
- package/dist/contributor.js +497 -0
- package/dist/directives.d.ts +133 -0
- package/dist/directives.js +158 -0
- package/dist/document.d.ts +25 -0
- package/dist/document.js +51 -0
- package/dist/format.d.ts +57 -0
- package/dist/format.js +81 -0
- package/dist/index.d.ts +1 -1
- package/dist/language.js +2 -20
- package/dist/manifest-query.d.ts +149 -0
- package/dist/manifest-query.js +159 -0
- package/dist/manifest-summary.d.ts +48 -0
- package/dist/manifest-summary.js +56 -0
- package/dist/scan.d.ts +1 -1
- package/dist/scan.js +2 -2
- package/dist/server.js +202 -3
- package/dist/setup.d.ts +63 -0
- package/dist/setup.js +168 -0
- package/package.json +11 -9
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { loadWorkspaceManifest } from "./project.js";
|
|
2
|
+
import { compactAtRules, compactUtility, compactVariable, summarizeManifest } from "./manifest-summary.js";
|
|
3
|
+
import { flattenMasterCSSManifestVariables } from "@master/css-engine";
|
|
4
|
+
//#region src/manifest-query.ts
|
|
5
|
+
const MANIFEST_QUERY_VERSION = 1;
|
|
6
|
+
function includesQuery(value, query) {
|
|
7
|
+
if (!query) return true;
|
|
8
|
+
if (value === void 0 || value === null) return false;
|
|
9
|
+
return String(value).toLowerCase().includes(query);
|
|
10
|
+
}
|
|
11
|
+
function matchesAny(values, query) {
|
|
12
|
+
return values.some((value) => includesQuery(value, query));
|
|
13
|
+
}
|
|
14
|
+
function limitResults(items, limit) {
|
|
15
|
+
return items.slice(0, limit);
|
|
16
|
+
}
|
|
17
|
+
function utilitySearchValues(utility) {
|
|
18
|
+
return [
|
|
19
|
+
utility.id,
|
|
20
|
+
utility.name,
|
|
21
|
+
utility.key,
|
|
22
|
+
utility.subkey,
|
|
23
|
+
...utility.keys || [],
|
|
24
|
+
...utility.namespaces || [],
|
|
25
|
+
...utility.aliasGroups || [],
|
|
26
|
+
...utility.variableAliasRefs || [],
|
|
27
|
+
...utility.matchers.flatMap((matcher) => Object.values(matcher))
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
async function queryManifest(context, options = {}) {
|
|
31
|
+
const manifest = await loadWorkspaceManifest(context);
|
|
32
|
+
const query = (options.query || "").toLowerCase();
|
|
33
|
+
const kind = options.kind || "all";
|
|
34
|
+
const namespace = options.namespace;
|
|
35
|
+
const limit = options.limit ?? 50;
|
|
36
|
+
if (manifest.status === "error") return {
|
|
37
|
+
version: MANIFEST_QUERY_VERSION,
|
|
38
|
+
root: context.root,
|
|
39
|
+
manifest: {
|
|
40
|
+
status: manifest.status,
|
|
41
|
+
entries: manifest.entries,
|
|
42
|
+
error: manifest.error
|
|
43
|
+
},
|
|
44
|
+
inputs: {
|
|
45
|
+
query: options.query,
|
|
46
|
+
kind,
|
|
47
|
+
namespace,
|
|
48
|
+
limit
|
|
49
|
+
},
|
|
50
|
+
results: {
|
|
51
|
+
tokens: [],
|
|
52
|
+
utilities: [],
|
|
53
|
+
variants: [],
|
|
54
|
+
modes: [],
|
|
55
|
+
atRules: [],
|
|
56
|
+
aliases: []
|
|
57
|
+
},
|
|
58
|
+
diagnostics: [{
|
|
59
|
+
code: "manifest-load-error",
|
|
60
|
+
severity: "error",
|
|
61
|
+
message: manifest.error,
|
|
62
|
+
source: "Master CSS",
|
|
63
|
+
sourceKind: "manifest"
|
|
64
|
+
}],
|
|
65
|
+
summary: {
|
|
66
|
+
total: 0,
|
|
67
|
+
returned: 0,
|
|
68
|
+
status: "error"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const activeManifest = manifest.manifest;
|
|
72
|
+
const variables = flattenMasterCSSManifestVariables(activeManifest.variables).filter((variable) => !namespace || variable.namespace === namespace).filter((variable) => matchesAny([
|
|
73
|
+
variable.name,
|
|
74
|
+
variable.key,
|
|
75
|
+
variable.namespace,
|
|
76
|
+
variable.value
|
|
77
|
+
], query)).map(compactVariable);
|
|
78
|
+
const utilities = (activeManifest.utilities || []).filter((utility) => !namespace || utility.namespaces?.includes(namespace)).filter((utility) => matchesAny(utilitySearchValues(utility), query)).map(compactUtility);
|
|
79
|
+
const variants = (activeManifest.variants || []).filter((variant) => includesQuery(variant.token, query)).map((variant) => ({
|
|
80
|
+
token: variant.token,
|
|
81
|
+
branches: variant.branches.length,
|
|
82
|
+
layers: [...new Set(variant.branches.map((branch) => branch.layer).filter(Boolean))]
|
|
83
|
+
}));
|
|
84
|
+
const modes = [...activeManifest.settings?.defaultMode ? [activeManifest.settings.defaultMode] : [], ...activeManifest.settings?.modes || []].filter((mode, index, list) => list.indexOf(mode) === index).filter((mode) => includesQuery(mode, query)).map((mode) => ({
|
|
85
|
+
name: mode,
|
|
86
|
+
default: mode === activeManifest.settings?.defaultMode,
|
|
87
|
+
trigger: activeManifest.settings?.modeTrigger
|
|
88
|
+
}));
|
|
89
|
+
const atRules = [
|
|
90
|
+
...compactAtRules(activeManifest.atRules),
|
|
91
|
+
...compactAtRules(activeManifest.breakpointAtRules),
|
|
92
|
+
...compactAtRules(activeManifest.containerAtRules)
|
|
93
|
+
].filter((rule) => matchesAny([rule.name, rule.id], query));
|
|
94
|
+
const aliases = (activeManifest.utilities || []).flatMap((utility) => [
|
|
95
|
+
...(utility.variableAliases || []).map(([key, name]) => ({
|
|
96
|
+
utility: utility.id,
|
|
97
|
+
key,
|
|
98
|
+
name,
|
|
99
|
+
type: "variable-alias"
|
|
100
|
+
})),
|
|
101
|
+
...(utility.variableAliasRefs || []).map((ref) => ({
|
|
102
|
+
utility: utility.id,
|
|
103
|
+
ref,
|
|
104
|
+
type: "variable-alias-ref"
|
|
105
|
+
})),
|
|
106
|
+
...(utility.aliasGroups || []).map((group) => ({
|
|
107
|
+
utility: utility.id,
|
|
108
|
+
group,
|
|
109
|
+
type: "alias-group"
|
|
110
|
+
}))
|
|
111
|
+
]).filter((alias) => matchesAny(Object.values(alias), query));
|
|
112
|
+
const allResults = {
|
|
113
|
+
tokens: kind === "all" || kind === "token" ? variables : [],
|
|
114
|
+
utilities: kind === "all" || kind === "utility" ? utilities : [],
|
|
115
|
+
variants: kind === "all" || kind === "variant" ? variants : [],
|
|
116
|
+
modes: kind === "all" || kind === "mode" ? modes : [],
|
|
117
|
+
atRules: kind === "all" || kind === "at-rule" ? atRules : [],
|
|
118
|
+
aliases: kind === "all" || kind === "alias" ? aliases : []
|
|
119
|
+
};
|
|
120
|
+
const limitedResults = {
|
|
121
|
+
tokens: limitResults(allResults.tokens, limit),
|
|
122
|
+
utilities: limitResults(allResults.utilities, limit),
|
|
123
|
+
variants: limitResults(allResults.variants, limit),
|
|
124
|
+
modes: limitResults(allResults.modes, limit),
|
|
125
|
+
atRules: limitResults(allResults.atRules, limit),
|
|
126
|
+
aliases: limitResults(allResults.aliases, limit)
|
|
127
|
+
};
|
|
128
|
+
const total = Object.values(allResults).reduce((count, items) => count + items.length, 0);
|
|
129
|
+
const returned = Object.values(limitedResults).reduce((count, items) => count + items.length, 0);
|
|
130
|
+
return {
|
|
131
|
+
version: MANIFEST_QUERY_VERSION,
|
|
132
|
+
root: context.root,
|
|
133
|
+
manifest: {
|
|
134
|
+
status: manifest.status,
|
|
135
|
+
entries: manifest.entries,
|
|
136
|
+
summary: summarizeManifest(activeManifest)
|
|
137
|
+
},
|
|
138
|
+
inputs: {
|
|
139
|
+
query: options.query,
|
|
140
|
+
kind,
|
|
141
|
+
namespace,
|
|
142
|
+
limit
|
|
143
|
+
},
|
|
144
|
+
results: limitedResults,
|
|
145
|
+
summary: {
|
|
146
|
+
total,
|
|
147
|
+
returned,
|
|
148
|
+
tokens: variables.length,
|
|
149
|
+
utilities: utilities.length,
|
|
150
|
+
variants: variants.length,
|
|
151
|
+
modes: modes.length,
|
|
152
|
+
atRules: atRules.length,
|
|
153
|
+
aliases: aliases.length,
|
|
154
|
+
status: "ok"
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
export { queryManifest };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MasterCSSManifest, MasterCSSManifestAtRules, MasterCSSManifestUtility, MasterCSSManifestVariableEntry } from "@master/css-engine";
|
|
2
|
+
|
|
3
|
+
//#region src/manifest-summary.d.ts
|
|
4
|
+
declare function summarizeManifest(manifest: MasterCSSManifest): {
|
|
5
|
+
settings: import("@master/css-engine").MasterCSSManifestSettings;
|
|
6
|
+
counts: {
|
|
7
|
+
variables: number;
|
|
8
|
+
variableNamespaces: number;
|
|
9
|
+
utilities: number;
|
|
10
|
+
variants: number;
|
|
11
|
+
atRules: number;
|
|
12
|
+
breakpointAtRules: number;
|
|
13
|
+
containerAtRules: number;
|
|
14
|
+
selectors: number;
|
|
15
|
+
animations: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
declare function compactVariable(variable: MasterCSSManifestVariableEntry): {
|
|
19
|
+
static?: boolean | undefined;
|
|
20
|
+
inline?: boolean | undefined;
|
|
21
|
+
modes?: string[] | undefined;
|
|
22
|
+
numeric?: import("@master/css-engine").MasterCSSManifestVariableNumericValue | undefined;
|
|
23
|
+
name: string;
|
|
24
|
+
key: string;
|
|
25
|
+
namespace: string;
|
|
26
|
+
type: "string" | "number";
|
|
27
|
+
value: import("@master/css-engine").MasterCSSManifestVariableValue | undefined;
|
|
28
|
+
};
|
|
29
|
+
declare function compactUtility(utility: MasterCSSManifestUtility): {
|
|
30
|
+
variableAliasRefs?: string[] | undefined;
|
|
31
|
+
aliasGroups?: string[] | undefined;
|
|
32
|
+
layer: import("@master/css-engine").MasterCSSManifestUtilityLayerName | undefined;
|
|
33
|
+
matcherTypes: ("static" | "pattern" | "key" | "variable" | "value")[];
|
|
34
|
+
emitType: "static" | "declarations" | "template" | "property";
|
|
35
|
+
namespaces?: string[] | undefined;
|
|
36
|
+
keys?: string[] | undefined;
|
|
37
|
+
subkey?: string | undefined;
|
|
38
|
+
key?: string | undefined;
|
|
39
|
+
name?: string | undefined;
|
|
40
|
+
id: string;
|
|
41
|
+
};
|
|
42
|
+
declare function compactAtRules(atRules: MasterCSSManifestAtRules | undefined): {
|
|
43
|
+
name: string;
|
|
44
|
+
id: import("@master/css-engine").MasterCSSManifestAtIdentifier;
|
|
45
|
+
nodes: number;
|
|
46
|
+
}[];
|
|
47
|
+
//#endregion
|
|
48
|
+
export { compactAtRules, compactUtility, compactVariable, summarizeManifest };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { flattenMasterCSSManifestVariables } from "@master/css-engine";
|
|
2
|
+
//#region src/manifest-summary.ts
|
|
3
|
+
function summarizeManifest(manifest) {
|
|
4
|
+
const variables = flattenMasterCSSManifestVariables(manifest.variables);
|
|
5
|
+
return {
|
|
6
|
+
settings: manifest.settings ?? {},
|
|
7
|
+
counts: {
|
|
8
|
+
variables: variables.length,
|
|
9
|
+
variableNamespaces: Object.keys(manifest.variables || {}).length,
|
|
10
|
+
utilities: manifest.utilities?.length ?? 0,
|
|
11
|
+
variants: manifest.variants?.length ?? 0,
|
|
12
|
+
atRules: Object.keys(manifest.atRules || {}).length,
|
|
13
|
+
breakpointAtRules: Object.keys(manifest.breakpointAtRules || {}).length,
|
|
14
|
+
containerAtRules: Object.keys(manifest.containerAtRules || {}).length,
|
|
15
|
+
selectors: Object.keys(manifest.selectors || {}).length,
|
|
16
|
+
animations: Object.keys(manifest.animations || {}).length
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function compactVariable(variable) {
|
|
21
|
+
return {
|
|
22
|
+
name: variable.name,
|
|
23
|
+
key: variable.key,
|
|
24
|
+
namespace: variable.namespace || "",
|
|
25
|
+
type: variable.type,
|
|
26
|
+
value: variable.value,
|
|
27
|
+
...variable.numeric ? { numeric: variable.numeric } : {},
|
|
28
|
+
...variable.modes ? { modes: Object.keys(variable.modes) } : {},
|
|
29
|
+
...variable.inline ? { inline: true } : {},
|
|
30
|
+
...variable.static ? { static: true } : {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function compactUtility(utility) {
|
|
34
|
+
return {
|
|
35
|
+
id: utility.id,
|
|
36
|
+
...utility.name ? { name: utility.name } : {},
|
|
37
|
+
...utility.key ? { key: utility.key } : {},
|
|
38
|
+
...utility.subkey ? { subkey: utility.subkey } : {},
|
|
39
|
+
...utility.keys?.length ? { keys: utility.keys } : {},
|
|
40
|
+
...utility.namespaces?.length ? { namespaces: utility.namespaces } : {},
|
|
41
|
+
layer: utility.layer,
|
|
42
|
+
matcherTypes: utility.matchers.map((matcher) => matcher.type),
|
|
43
|
+
emitType: utility.emit.type,
|
|
44
|
+
...utility.aliasGroups?.length ? { aliasGroups: utility.aliasGroups } : {},
|
|
45
|
+
...utility.variableAliasRefs?.length ? { variableAliasRefs: utility.variableAliasRefs } : {}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function compactAtRules(atRules) {
|
|
49
|
+
return Object.entries(atRules || {}).map(([name, rule]) => ({
|
|
50
|
+
name,
|
|
51
|
+
id: rule.id,
|
|
52
|
+
nodes: rule.nodes.length
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { compactAtRules, compactUtility, compactVariable, summarizeManifest };
|
package/dist/scan.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ declare function inspectClass(context: MasterCSSMCPContext, options: InspectClas
|
|
|
114
114
|
valueToken: string | undefined;
|
|
115
115
|
stateToken: string | undefined;
|
|
116
116
|
important: boolean | undefined;
|
|
117
|
-
matcherTypes: ("
|
|
117
|
+
matcherTypes: ("static" | "pattern" | "key" | "variable" | "value")[];
|
|
118
118
|
variables: {
|
|
119
119
|
key: string;
|
|
120
120
|
variable: import("@master/css-language").Variable;
|
package/dist/scan.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { loadWorkspaceManifest } from "./project.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
+
import { inspectMasterCSSClass } from "@master/css-engine/inspect";
|
|
4
|
+
import { createCSSWithNativeDeclarations } from "@master/css-validator/native-declaration";
|
|
3
5
|
import { resolve } from "node:path";
|
|
4
6
|
import fg from "fast-glob";
|
|
5
7
|
import { createMasterCSSInspectionReport } from "@master/css-diagnostics";
|
|
6
|
-
import { inspectMasterCSSClass } from "@master/css-engine/inspect";
|
|
7
|
-
import { createCSSWithNativeDeclarations } from "@master/css-validator/native-declaration";
|
|
8
8
|
import { parseHTML } from "@master/css-server";
|
|
9
9
|
//#region src/scan.ts
|
|
10
10
|
const DEFAULT_SOURCE_PATTERNS = ["**/*.{html,htm,js,jsx,cjs,ts,tsx,mts,cts,svelte,astro,vue,md,mdx,pug,php}"];
|
package/dist/server.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import MasterCSSMCPContext from "./context.js";
|
|
2
1
|
import { jsonResourceResult, jsonToolResult } from "./result.js";
|
|
3
2
|
import { getWorkspaceInfo, loadWorkspaceManifest } from "./project.js";
|
|
4
3
|
import { inspectClass, previewGeneratedCSS, renderCSS, scanProject } from "./scan.js";
|
|
4
|
+
import { extractClasses, traceClass } from "./classes.js";
|
|
5
|
+
import { compareCSS } from "./compare.js";
|
|
6
|
+
import MasterCSSMCPContext from "./context.js";
|
|
7
|
+
import { getChangeImpact, getPackageGraph, getRepoContext, getTestRouter } from "./contributor.js";
|
|
8
|
+
import { inspectDirectives } from "./directives.js";
|
|
9
|
+
import { previewDirectiveFormat } from "./format.js";
|
|
5
10
|
import { suggestSyntax } from "./language.js";
|
|
6
11
|
import { lintContent, lintProject, previewLintFixes } from "./lint.js";
|
|
7
|
-
import {
|
|
12
|
+
import { auditSetup } from "./setup.js";
|
|
13
|
+
import { queryManifest } from "./manifest-query.js";
|
|
8
14
|
import { dirname, resolve } from "node:path";
|
|
9
15
|
import { fileURLToPath } from "node:url";
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
10
17
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
18
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
12
19
|
import * as z from "zod/v4";
|
|
@@ -72,11 +79,26 @@ function registerPrompts(server) {
|
|
|
72
79
|
role: "user",
|
|
73
80
|
content: {
|
|
74
81
|
type: "text",
|
|
75
|
-
text:
|
|
82
|
+
text: [
|
|
83
|
+
"Use the Master CSS MCP tools to plan an incremental migration to Master CSS before editing.",
|
|
84
|
+
"Inspect the workspace, identify the framework, package manager, current styling systems, stylesheet entries, source extraction coverage, existing theme tokens, component classes, and available validation commands.",
|
|
85
|
+
"Produce a migration plan with the recommended rendering mode, the first reviewable migration batch, CSS output risks, manual visual checks, and the formatter, lint, type-check, test, or build commands to run.",
|
|
86
|
+
"Preserve CSS output unless a deliberate behavior change is requested, keep vendor or generated CSS in place, and use write previews only for safe, scoped changes."
|
|
87
|
+
].join("\n")
|
|
76
88
|
}
|
|
77
89
|
}] }));
|
|
78
90
|
}
|
|
79
91
|
function registerTools(server, context) {
|
|
92
|
+
const rangeSchema = z.object({
|
|
93
|
+
start: z.object({
|
|
94
|
+
line: z.number().int().min(0),
|
|
95
|
+
character: z.number().int().min(0)
|
|
96
|
+
}),
|
|
97
|
+
end: z.object({
|
|
98
|
+
line: z.number().int().min(0),
|
|
99
|
+
character: z.number().int().min(0)
|
|
100
|
+
})
|
|
101
|
+
});
|
|
80
102
|
server.registerTool("mastercss_workspace_info", {
|
|
81
103
|
title: "Master CSS Workspace Info",
|
|
82
104
|
description: "Report workspace roots, resolved Master CSS packages, and project manifest status.",
|
|
@@ -87,6 +109,16 @@ function registerTools(server, context) {
|
|
|
87
109
|
openWorldHint: false
|
|
88
110
|
}
|
|
89
111
|
}, async () => jsonToolResult(await getWorkspaceInfo(context)));
|
|
112
|
+
server.registerTool("mastercss_setup_audit", {
|
|
113
|
+
title: "Audit Master CSS Setup",
|
|
114
|
+
description: "Audit package, entry stylesheet, manifest, integration, and package-resolution setup for a workspace.",
|
|
115
|
+
annotations: {
|
|
116
|
+
readOnlyHint: true,
|
|
117
|
+
destructiveHint: false,
|
|
118
|
+
idempotentHint: true,
|
|
119
|
+
openWorldHint: false
|
|
120
|
+
}
|
|
121
|
+
}, async () => jsonToolResult(await auditSetup(context)));
|
|
90
122
|
server.registerTool("mastercss_inspect_class", {
|
|
91
123
|
title: "Inspect Master CSS Class",
|
|
92
124
|
description: "Inspect one Master CSS class and return semantic parts, generated rules, variables, and CSS text.",
|
|
@@ -101,6 +133,54 @@ function registerTools(server, context) {
|
|
|
101
133
|
openWorldHint: false
|
|
102
134
|
}
|
|
103
135
|
}, async (input) => jsonToolResult(await inspectClass(context, input)));
|
|
136
|
+
server.registerTool("mastercss_trace_class", {
|
|
137
|
+
title: "Trace Master CSS Class",
|
|
138
|
+
description: "Trace one class from project extraction through generated CSS, missing CSS classification, and engine inspection.",
|
|
139
|
+
inputSchema: {
|
|
140
|
+
className: z.string().min(1),
|
|
141
|
+
patterns: z.array(z.string()).optional(),
|
|
142
|
+
includeCss: z.boolean().optional(),
|
|
143
|
+
mode: z.string().optional()
|
|
144
|
+
},
|
|
145
|
+
annotations: {
|
|
146
|
+
readOnlyHint: true,
|
|
147
|
+
destructiveHint: false,
|
|
148
|
+
idempotentHint: true,
|
|
149
|
+
openWorldHint: false
|
|
150
|
+
}
|
|
151
|
+
}, async (input) => jsonToolResult(await traceClass(context, input)));
|
|
152
|
+
server.registerTool("mastercss_extract_classes", {
|
|
153
|
+
title: "Extract Master CSS Classes",
|
|
154
|
+
description: "Extract class positions and validation summaries from project files or an in-memory source buffer.",
|
|
155
|
+
inputSchema: {
|
|
156
|
+
content: z.string().optional(),
|
|
157
|
+
filePath: z.string().optional(),
|
|
158
|
+
patterns: z.array(z.string()).optional(),
|
|
159
|
+
includeRules: z.boolean().optional()
|
|
160
|
+
},
|
|
161
|
+
annotations: {
|
|
162
|
+
readOnlyHint: true,
|
|
163
|
+
destructiveHint: false,
|
|
164
|
+
idempotentHint: true,
|
|
165
|
+
openWorldHint: false
|
|
166
|
+
}
|
|
167
|
+
}, async (input) => jsonToolResult(await extractClasses(context, input)));
|
|
168
|
+
server.registerTool("mastercss_inspect_directives", {
|
|
169
|
+
title: "Inspect Master CSS Directives",
|
|
170
|
+
description: "Inspect CSS-first directives from a stylesheet entry or in-memory CSS content and report manifest/CSS effects.",
|
|
171
|
+
inputSchema: {
|
|
172
|
+
content: z.string().optional(),
|
|
173
|
+
filePath: z.string().optional(),
|
|
174
|
+
entryPath: z.string().optional(),
|
|
175
|
+
preserveNativeCSS: z.boolean().optional()
|
|
176
|
+
},
|
|
177
|
+
annotations: {
|
|
178
|
+
readOnlyHint: true,
|
|
179
|
+
destructiveHint: false,
|
|
180
|
+
idempotentHint: true,
|
|
181
|
+
openWorldHint: false
|
|
182
|
+
}
|
|
183
|
+
}, async (input) => jsonToolResult(await inspectDirectives(context, input)));
|
|
104
184
|
server.registerTool("mastercss_render_css", {
|
|
105
185
|
title: "Render Master CSS",
|
|
106
186
|
description: "Generate CSS from an HTML fragment or a whitespace-separated class list.",
|
|
@@ -130,6 +210,108 @@ function registerTools(server, context) {
|
|
|
130
210
|
openWorldHint: false
|
|
131
211
|
}
|
|
132
212
|
}, async (input) => jsonToolResult(await scanProject(context, input)));
|
|
213
|
+
server.registerTool("mastercss_repo_context", {
|
|
214
|
+
title: "Master CSS Repository Context",
|
|
215
|
+
description: "Route Master CSS repository contributor work to affected packages, required context files, risks, and validation commands.",
|
|
216
|
+
inputSchema: {
|
|
217
|
+
task: z.string().optional(),
|
|
218
|
+
paths: z.array(z.string()).optional(),
|
|
219
|
+
diff: z.string().optional()
|
|
220
|
+
},
|
|
221
|
+
annotations: {
|
|
222
|
+
readOnlyHint: true,
|
|
223
|
+
destructiveHint: false,
|
|
224
|
+
idempotentHint: true,
|
|
225
|
+
openWorldHint: false
|
|
226
|
+
}
|
|
227
|
+
}, async (input) => jsonToolResult(await getRepoContext(context, input)));
|
|
228
|
+
server.registerTool("mastercss_change_impact", {
|
|
229
|
+
title: "Master CSS Change Impact",
|
|
230
|
+
description: "Classify contributor change risk for CSS output, runtime, extraction, language, ESLint, docs, and package boundaries.",
|
|
231
|
+
inputSchema: {
|
|
232
|
+
task: z.string().optional(),
|
|
233
|
+
paths: z.array(z.string()).optional(),
|
|
234
|
+
diff: z.string().optional()
|
|
235
|
+
},
|
|
236
|
+
annotations: {
|
|
237
|
+
readOnlyHint: true,
|
|
238
|
+
destructiveHint: false,
|
|
239
|
+
idempotentHint: true,
|
|
240
|
+
openWorldHint: false
|
|
241
|
+
}
|
|
242
|
+
}, async (input) => jsonToolResult(await getChangeImpact(context, input)));
|
|
243
|
+
server.registerTool("mastercss_test_router", {
|
|
244
|
+
title: "Master CSS Test Router",
|
|
245
|
+
description: "Return focused validation commands for Master CSS repository contributor changes.",
|
|
246
|
+
inputSchema: {
|
|
247
|
+
task: z.string().optional(),
|
|
248
|
+
paths: z.array(z.string()).optional(),
|
|
249
|
+
diff: z.string().optional()
|
|
250
|
+
},
|
|
251
|
+
annotations: {
|
|
252
|
+
readOnlyHint: true,
|
|
253
|
+
destructiveHint: false,
|
|
254
|
+
idempotentHint: true,
|
|
255
|
+
openWorldHint: false
|
|
256
|
+
}
|
|
257
|
+
}, async (input) => jsonToolResult(await getTestRouter(context, input)));
|
|
258
|
+
server.registerTool("mastercss_package_graph", {
|
|
259
|
+
title: "Master CSS Package Graph",
|
|
260
|
+
description: "Report Master CSS workspace package ownership, scripts, exports, workspace dependencies, and dependents.",
|
|
261
|
+
inputSchema: {
|
|
262
|
+
packageName: z.string().optional(),
|
|
263
|
+
includeExamples: z.boolean().optional()
|
|
264
|
+
},
|
|
265
|
+
annotations: {
|
|
266
|
+
readOnlyHint: true,
|
|
267
|
+
destructiveHint: false,
|
|
268
|
+
idempotentHint: true,
|
|
269
|
+
openWorldHint: false
|
|
270
|
+
}
|
|
271
|
+
}, async (input) => jsonToolResult(await getPackageGraph(context, input)));
|
|
272
|
+
server.registerTool("mastercss_manifest_query", {
|
|
273
|
+
title: "Query Master CSS Manifest",
|
|
274
|
+
description: "Query active manifest tokens, utilities, variants, modes, at-rules, and aliases.",
|
|
275
|
+
inputSchema: {
|
|
276
|
+
query: z.string().optional(),
|
|
277
|
+
kind: z.enum([
|
|
278
|
+
"all",
|
|
279
|
+
"token",
|
|
280
|
+
"utility",
|
|
281
|
+
"variant",
|
|
282
|
+
"mode",
|
|
283
|
+
"at-rule",
|
|
284
|
+
"alias"
|
|
285
|
+
]).optional(),
|
|
286
|
+
namespace: z.string().optional(),
|
|
287
|
+
limit: z.number().int().min(1).max(500).optional()
|
|
288
|
+
},
|
|
289
|
+
annotations: {
|
|
290
|
+
readOnlyHint: true,
|
|
291
|
+
destructiveHint: false,
|
|
292
|
+
idempotentHint: true,
|
|
293
|
+
openWorldHint: false
|
|
294
|
+
}
|
|
295
|
+
}, async (input) => jsonToolResult(await queryManifest(context, input)));
|
|
296
|
+
server.registerTool("mastercss_css_compare", {
|
|
297
|
+
title: "Compare Master CSS Output",
|
|
298
|
+
description: "Compare generated CSS for before/after class lists, HTML fragments, or source buffers.",
|
|
299
|
+
inputSchema: {
|
|
300
|
+
beforeClassList: z.string().optional(),
|
|
301
|
+
afterClassList: z.string().optional(),
|
|
302
|
+
beforeHtml: z.string().optional(),
|
|
303
|
+
afterHtml: z.string().optional(),
|
|
304
|
+
beforeContent: z.string().optional(),
|
|
305
|
+
afterContent: z.string().optional(),
|
|
306
|
+
filePath: z.string().optional()
|
|
307
|
+
},
|
|
308
|
+
annotations: {
|
|
309
|
+
readOnlyHint: true,
|
|
310
|
+
destructiveHint: false,
|
|
311
|
+
idempotentHint: true,
|
|
312
|
+
openWorldHint: false
|
|
313
|
+
}
|
|
314
|
+
}, async (input) => jsonToolResult(await compareCSS(context, input)));
|
|
133
315
|
server.registerTool("mastercss_lint_project", {
|
|
134
316
|
title: "Lint Master CSS Project",
|
|
135
317
|
description: "Run Master CSS class-list diagnostics and return fix proposals without writing files.",
|
|
@@ -208,6 +390,23 @@ function registerTools(server, context) {
|
|
|
208
390
|
}
|
|
209
391
|
return jsonToolResult(await previewLintFixes(context, input));
|
|
210
392
|
});
|
|
393
|
+
server.registerTool("mastercss_preview_directive_format", {
|
|
394
|
+
title: "Preview Master CSS Directive Format",
|
|
395
|
+
description: "Create a safe preview for formatting Master CSS directives, or format in-memory content without writing files.",
|
|
396
|
+
inputSchema: {
|
|
397
|
+
content: z.string().optional(),
|
|
398
|
+
filePath: z.string().optional(),
|
|
399
|
+
patterns: z.array(z.string()).optional(),
|
|
400
|
+
range: rangeSchema.optional(),
|
|
401
|
+
ttlMs: z.number().int().min(1e3).max(3600 * 1e3).optional()
|
|
402
|
+
},
|
|
403
|
+
annotations: {
|
|
404
|
+
readOnlyHint: false,
|
|
405
|
+
destructiveHint: false,
|
|
406
|
+
idempotentHint: false,
|
|
407
|
+
openWorldHint: false
|
|
408
|
+
}
|
|
409
|
+
}, async (input) => jsonToolResult(await previewDirectiveFormat(context, input)));
|
|
211
410
|
server.registerTool("mastercss_apply_preview", {
|
|
212
411
|
title: "Apply Master CSS Preview",
|
|
213
412
|
description: "Apply a previously generated preview token after validating hashes and workspace containment.",
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import MasterCSSMCPContext from "./context.js";
|
|
2
|
+
|
|
3
|
+
//#region src/setup.d.ts
|
|
4
|
+
type SetupDiagnosticSeverity = 'error' | 'warning' | 'info';
|
|
5
|
+
interface SetupDiagnostic {
|
|
6
|
+
code: string;
|
|
7
|
+
severity: SetupDiagnosticSeverity;
|
|
8
|
+
message: string;
|
|
9
|
+
data?: unknown;
|
|
10
|
+
}
|
|
11
|
+
declare function auditSetup(context: MasterCSSMCPContext): Promise<{
|
|
12
|
+
version: number;
|
|
13
|
+
root: string;
|
|
14
|
+
status: string;
|
|
15
|
+
packageManager: {
|
|
16
|
+
declared: string | undefined;
|
|
17
|
+
lockfiles: {
|
|
18
|
+
name: string;
|
|
19
|
+
filePath: string;
|
|
20
|
+
}[];
|
|
21
|
+
inferred: string;
|
|
22
|
+
};
|
|
23
|
+
packageJSON: {
|
|
24
|
+
error?: string | undefined;
|
|
25
|
+
filePath: string;
|
|
26
|
+
loaded: boolean;
|
|
27
|
+
};
|
|
28
|
+
packages: {
|
|
29
|
+
declared: {
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
}[];
|
|
33
|
+
resolved: import("@master/css-project/workspace").MasterCSSWorkspacePackageResolution;
|
|
34
|
+
};
|
|
35
|
+
integrations: ({
|
|
36
|
+
type: "package";
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
39
|
+
} | {
|
|
40
|
+
type: "script";
|
|
41
|
+
name: string;
|
|
42
|
+
command: string;
|
|
43
|
+
})[];
|
|
44
|
+
manifest: {
|
|
45
|
+
error?: string | undefined;
|
|
46
|
+
status: "loaded" | "error";
|
|
47
|
+
entries: string[];
|
|
48
|
+
dependencies: string[];
|
|
49
|
+
warnings: string[];
|
|
50
|
+
};
|
|
51
|
+
diagnostics: SetupDiagnostic[];
|
|
52
|
+
summary: {
|
|
53
|
+
status: string;
|
|
54
|
+
entries: number;
|
|
55
|
+
declaredPackages: number;
|
|
56
|
+
integrations: number;
|
|
57
|
+
errors: number;
|
|
58
|
+
warnings: number;
|
|
59
|
+
info: number;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { auditSetup };
|