@pure-ds/core 0.7.59 → 0.7.61
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/dist/types/pds.d.ts +10 -0
- package/dist/types/public/assets/pds/components/pds-render.d.ts +21 -0
- package/dist/types/public/assets/pds/components/pds-render.d.ts.map +1 -0
- package/dist/types/src/js/pds-core/pds-config.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-enhancers-meta.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-enhancers.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -1
- package/dist/types/src/js/pds.d.ts +1 -1
- package/dist/types/src/js/pds.d.ts.map +1 -1
- package/package.json +1 -1
- package/packages/pds-cli/bin/pds-setup-mcp.js +27 -115
- package/packages/pds-cli/bin/postinstall.mjs +16 -0
- package/packages/pds-cli/lib/pds-mcp-core.js +150 -3
- package/packages/pds-cli/lib/setup-mcp-config.js +72 -0
- package/public/assets/js/app.js +1 -1
- package/public/assets/js/pds-enhancers.js +1 -1
- package/public/assets/js/pds-manager.js +89 -54
- package/public/assets/pds/components/pds-render.js +768 -0
- package/public/assets/pds/core/pds-enhancers.js +1 -1
- package/public/assets/pds/core/pds-manager.js +89 -54
- package/public/assets/pds/icons/pds-icons.svg +8 -0
- package/src/js/pds-core/pds-config.js +2 -0
- package/src/js/pds-core/pds-enhancers-meta.js +6 -0
- package/src/js/pds-core/pds-enhancers.js +60 -0
- package/src/js/pds-core/pds-generator.js +35 -0
- package/src/js/pds.d.ts +10 -0
- package/src/js/pds.js +2 -2
package/dist/types/pds.d.ts
CHANGED
|
@@ -461,6 +461,8 @@ export class PDS extends EventTarget {
|
|
|
461
461
|
/**
|
|
462
462
|
* Reactive state container class for building reactive components.
|
|
463
463
|
* Fires custom events ('change' and 'change:propertyName') when state properties are modified.
|
|
464
|
+
*
|
|
465
|
+
* @experimental API shape and event patterns may evolve.
|
|
464
466
|
*/
|
|
465
467
|
static State: typeof State;
|
|
466
468
|
|
|
@@ -771,12 +773,20 @@ export class SchemaForm extends HTMLElement {
|
|
|
771
773
|
}
|
|
772
774
|
|
|
773
775
|
export function parse(html: PDSParseInput, ...values: unknown[]): NodeListOf<ChildNode>;
|
|
776
|
+
/**
|
|
777
|
+
* Experimental tagged-template helper for building DOM fragments without Lit.
|
|
778
|
+
* Supports attribute, event, boolean, and property-style bindings.
|
|
779
|
+
*
|
|
780
|
+
* @experimental API shape and binding semantics may evolve.
|
|
781
|
+
*/
|
|
774
782
|
export function html(html: PDSParseInput, ...values: unknown[]): DocumentFragment;
|
|
775
783
|
|
|
776
784
|
/**
|
|
777
785
|
* Reactive state container that fires custom events on property mutations.
|
|
778
786
|
* When properties change, it emits "change" and "change:propertyName" events.
|
|
779
787
|
*
|
|
788
|
+
* @experimental API shape and event patterns may evolve.
|
|
789
|
+
*
|
|
780
790
|
* @example
|
|
781
791
|
* ```javascript
|
|
782
792
|
* const state = new State({ count: 0 });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type PdsRenderContent = {
|
|
2
|
+
/**
|
|
3
|
+
* HTML string rendered in the iframe body.
|
|
4
|
+
*/
|
|
5
|
+
html?: string;
|
|
6
|
+
/**
|
|
7
|
+
* CSS text injected into the iframe user stylesheet.
|
|
8
|
+
*/
|
|
9
|
+
css?: string;
|
|
10
|
+
/**
|
|
11
|
+
* JavaScript module source evaluated in the iframe runtime.
|
|
12
|
+
*/
|
|
13
|
+
js?: string;
|
|
14
|
+
};
|
|
15
|
+
export type PdsRenderSetContentOptions = {
|
|
16
|
+
/**
|
|
17
|
+
* Force full iframe rebuild after applying content.
|
|
18
|
+
*/
|
|
19
|
+
reload?: boolean;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=pds-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pds-render.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-render.js"],"names":[],"mappings":";;;;WA+Cc,MAAM;;;;UACN,MAAM;;;;SACN,MAAM;;;;;;aAKN,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-config.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-config.js"],"names":[],"mappings":"AAu+CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCC;AAED,qEAEC;AAED;;UAUC;AAED;;UAUC;
|
|
1
|
+
{"version":3,"file":"pds-config.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-config.js"],"names":[],"mappings":"AAu+CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCC;AAED,qEAEC;AAED;;UAUC;AAED;;UAUC;AA+nCD;;;;;;GAMG;AACH,kCAJW,MAAM,WACN,MAAM,WACH,GAAG,EAAA,QAuBhB;AAhwDD;;;GAGG;AACH,sCAGE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"pds-enhancers-meta.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-enhancers-meta.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;KAoIE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-enhancers.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-enhancers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds-enhancers.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-enhancers.js"],"names":[],"mappings":"AAo4BA;;;;;GAKG;AACH;;;IAGI;AA92BJ,mDAmBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-generator.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-generator.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds-generator.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-generator.js"],"names":[],"mappings":"AAojMA;;;;;;;;;;;GAWG;AACH,8CAPW,MAAM,YAEd;IAAyB,WAAW,GAA5B,MAAM;IACY,cAAc,GAAhC,OAAO;IACU,WAAW,GAA5B,MAAM;CACd,GAAU;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAC,OAAO,EAAC,MAAM,CAAC;QAAC,KAAK,EAAC,MAAM,CAAC;QAAC,GAAG,EAAC,MAAM,CAAC;QAAC,OAAO,CAAC,EAAC,MAAM,CAAA;KAAC,CAAC,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAC,OAAO,EAAC,MAAM,CAAC;QAAC,OAAO,CAAC,EAAC,MAAM,CAAA;KAAC,CAAC,CAAA;CAAE,CA0VrL;AAED;;;;;;;GAOG;AACH,0CAJW,KAAK,CAAC,MAAM,CAAC,YACb,MAAM,GACJ;IAAE,EAAE,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEC;IAGD,oBAEC;IA8yBD,qBAEC;IACD,yBAEC;IACD,yBAEC;IACD,wBAEC;IACD,yBAMC;IAED;;;;;;OAMG;IACH,oBA6JC;IAGD,4BAEC;IACD,gCAEC;IACD,gCAEC;IACD,+BAEC;IAmBD;;;OAGG;IACH;;;;;;MAoBC;;CAkBF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Parse HTML strings or tagged templates into a NodeList */
|
|
2
2
|
export const parse: typeof common.parseHTML;
|
|
3
|
-
/**
|
|
3
|
+
/** Experimental: parse HTML or tagged templates into a DocumentFragment */
|
|
4
4
|
export const html: typeof common.parseFragment;
|
|
5
5
|
export function applyResolvedTheme(raw: any): void;
|
|
6
6
|
export function setupSystemListenerIfNeeded(raw: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../src/js/pds.js"],"names":[],"mappings":"AAioBA,6DAA6D;AAC7D,4CAAsC;AAGtC,
|
|
1
|
+
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../src/js/pds.js"],"names":[],"mappings":"AAioBA,6DAA6D;AAC7D,4CAAsC;AAGtC,2EAA2E;AAC3E,+CAAyC;AA+IzC,mDAsBC;AAGD,4DAuCC;;;;;;;;;;;;;;;;;;;;;;;;;cA9zBa,OAAO,4BAA4B,EAAE,WAAW;;;;iBAChD,CAAC,SAAS,CAAC,EAAE,OAAO,6BAA6B,EAAE,SAAS,KAAK,IAAI;;;;iBACrE,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,gBAAgB,CAAC,EAAE,aAAa,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;;;;qBAChG,CAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,CAAC,EAAE,aAAa,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;;;;sBAC7E,CAAC,GAAG,EAAC,MAAM,KAAK,aAAa;;wBAqCnB,oBAAoB;oBAhCxB,oBAAoB;AA0PxC,sDAOC;AAED,yDAMC;AAED,yDA+CC;AAED,sDAGC;AAED,mEAGC;AAED,4CAUC;AAED,0DA+EC;sBAlXyD,mBAAmB;wCAAnB,mBAAmB;0BAAnB,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -1,116 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return path.join(projectRoot, candidatePaths[0]);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const serverArgs = [resolveServerScriptPath()];
|
|
34
|
-
|
|
35
|
-
async function readJsonIfExists(filePath) {
|
|
36
|
-
try {
|
|
37
|
-
await access(filePath);
|
|
38
|
-
const text = await readFile(filePath, 'utf8');
|
|
39
|
-
return JSON.parse(text);
|
|
40
|
-
} catch {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function writeJson(filePath, value) {
|
|
46
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
47
|
-
await writeFile(filePath, `${JSON.stringify(value, null, 2)}\n`, 'utf8');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function setupVSCodeConfig() {
|
|
51
|
-
const configPath = path.join(projectRoot, '.vscode', 'mcp.json');
|
|
52
|
-
const current = (await readJsonIfExists(configPath)) || {};
|
|
53
|
-
|
|
54
|
-
const servers = current.servers && typeof current.servers === 'object' ? current.servers : {};
|
|
55
|
-
servers['pure-ds'] = {
|
|
56
|
-
type: 'stdio',
|
|
57
|
-
command: serverCommand,
|
|
58
|
-
args: serverArgs,
|
|
59
|
-
...(debugMode
|
|
60
|
-
? {
|
|
61
|
-
env: {
|
|
62
|
-
PDS_MCP_DEBUG: '1',
|
|
63
|
-
PDS_MCP_LOG_FILE: './.pds-mcp.log',
|
|
64
|
-
},
|
|
65
|
-
}
|
|
66
|
-
: {}),
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
await writeJson(configPath, { ...current, servers });
|
|
70
|
-
return configPath;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async function setupCursorConfig() {
|
|
74
|
-
const configPath = path.join(projectRoot, '.cursor', 'mcp.json');
|
|
75
|
-
const current = (await readJsonIfExists(configPath)) || {};
|
|
76
|
-
|
|
77
|
-
const mcpServers = current.mcpServers && typeof current.mcpServers === 'object' ? current.mcpServers : {};
|
|
78
|
-
mcpServers['pure-ds'] = {
|
|
79
|
-
command: serverCommand,
|
|
80
|
-
args: serverArgs,
|
|
81
|
-
...(debugMode
|
|
82
|
-
? {
|
|
83
|
-
env: {
|
|
84
|
-
PDS_MCP_DEBUG: '1',
|
|
85
|
-
PDS_MCP_LOG_FILE: './.pds-mcp.log',
|
|
86
|
-
},
|
|
87
|
-
}
|
|
88
|
-
: {}),
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
await writeJson(configPath, { ...current, mcpServers });
|
|
92
|
-
return configPath;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async function main() {
|
|
96
|
-
console.log('🔌 Setting up local PDS MCP server configuration...');
|
|
97
|
-
|
|
98
|
-
const [vscodePath, cursorPath] = await Promise.all([
|
|
99
|
-
setupVSCodeConfig(),
|
|
100
|
-
setupCursorConfig(),
|
|
101
|
-
]);
|
|
102
|
-
|
|
103
|
-
console.log('✅ MCP configuration updated');
|
|
104
|
-
console.log(` • VS Code: ${path.relative(projectRoot, vscodePath)}`);
|
|
105
|
-
console.log(` • Cursor: ${path.relative(projectRoot, cursorPath)}`);
|
|
106
|
-
if (debugMode) {
|
|
107
|
-
console.log(' • Debug mode: enabled (logs to .pds-mcp.log)');
|
|
108
|
-
}
|
|
109
|
-
console.log('');
|
|
110
|
-
console.log('ℹ️ Restart your AI extension/IDE so it re-reads MCP server config.');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
main().catch((error) => {
|
|
114
|
-
console.error('❌ Failed to set up MCP:', error?.message || error);
|
|
115
|
-
process.exit(1);
|
|
116
|
-
});
|
|
2
|
+
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { setupMcpConfig } from '../lib/setup-mcp-config.js';
|
|
5
|
+
|
|
6
|
+
const projectRoot = process.cwd();
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const debugMode = args.includes('--debug');
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
console.log('🔌 Setting up local PDS MCP server configuration...');
|
|
12
|
+
|
|
13
|
+
const { vscodePath, cursorPath } = await setupMcpConfig(projectRoot, { debugMode, silent: false });
|
|
14
|
+
|
|
15
|
+
console.log('✅ MCP configuration updated');
|
|
16
|
+
console.log(` • VS Code: ${path.relative(projectRoot, vscodePath)}`);
|
|
17
|
+
console.log(` • Cursor: ${path.relative(projectRoot, cursorPath)}`);
|
|
18
|
+
if (debugMode) {
|
|
19
|
+
console.log(' • Debug mode: enabled (logs to .pds-mcp.log)');
|
|
20
|
+
}
|
|
21
|
+
console.log('');
|
|
22
|
+
console.log('ℹ️ Restart your AI extension/IDE so it re-reads MCP server config.');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
main().catch((error) => {
|
|
26
|
+
console.error('❌ Failed to set up MCP:', error?.message || error);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
});
|
|
@@ -11,6 +11,7 @@ import { createHash } from 'crypto';
|
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
13
13
|
import { buildStarterPdsConfig } from './templates/starter-templates.js';
|
|
14
|
+
import { setupMcpConfig } from '../lib/setup-mcp-config.js';
|
|
14
15
|
|
|
15
16
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
16
17
|
const repoRoot = path.resolve(__dirname, '../../../');
|
|
@@ -277,6 +278,18 @@ async function copyCopilotInstructions(consumerRoot) {
|
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Auto-configure MCP server for AI IDE integrations (VS Code + Cursor)
|
|
283
|
+
*/
|
|
284
|
+
async function ensureMcpConfig(consumerRoot) {
|
|
285
|
+
try {
|
|
286
|
+
await setupMcpConfig(consumerRoot, { silent: true });
|
|
287
|
+
console.log('🔌 MCP server configured (.vscode/mcp.json, .cursor/mcp.json)');
|
|
288
|
+
} catch (e) {
|
|
289
|
+
console.warn('⚠️ Could not configure MCP server:', e?.message || e);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
280
293
|
/**
|
|
281
294
|
* Discover the web root directory using common patterns
|
|
282
295
|
*/
|
|
@@ -423,6 +436,9 @@ async function copyPdsAssets() {
|
|
|
423
436
|
// Copy Copilot instructions to consumer project
|
|
424
437
|
await copyCopilotInstructions(consumerRoot);
|
|
425
438
|
|
|
439
|
+
// Auto-configure MCP server for AI IDE integrations
|
|
440
|
+
await ensureMcpConfig(consumerRoot);
|
|
441
|
+
|
|
426
442
|
// Proactively add build & build-icons scripts to consumer package.json (still helpful)
|
|
427
443
|
await ensureBuildScript(consumerRoot);
|
|
428
444
|
try {
|
|
@@ -584,7 +584,7 @@ function getToolSchema() {
|
|
|
584
584
|
},
|
|
585
585
|
{
|
|
586
586
|
name: 'validate_pds_snippet',
|
|
587
|
-
description: 'Validate HTML snippet for unknown classes, tokens, and pds-* tags against SSoT.',
|
|
587
|
+
description: 'Validate HTML snippet for unknown classes, tokens, and pds-* tags against SSoT. Also flags anti-patterns: inline style attributes, <style> injection, and browser dialog calls.',
|
|
588
588
|
inputSchema: {
|
|
589
589
|
type: 'object',
|
|
590
590
|
required: ['html'],
|
|
@@ -593,6 +593,18 @@ function getToolSchema() {
|
|
|
593
593
|
},
|
|
594
594
|
},
|
|
595
595
|
},
|
|
596
|
+
{
|
|
597
|
+
name: 'get_best_match',
|
|
598
|
+
description: 'Given a UI intent (e.g. "dropdown nav menu", "spinner button", "accordion"), returns ranked PDS matches across all layers: web components (pds-*) > data-* enhancers > CSS primitives/utilities. Use this FIRST when deciding which PDS element to use.',
|
|
599
|
+
inputSchema: {
|
|
600
|
+
type: 'object',
|
|
601
|
+
required: ['intent'],
|
|
602
|
+
properties: {
|
|
603
|
+
intent: { type: 'string', description: 'UI intent or concept, e.g. "dropdown menu in a nav", "collapsible sections", "loading spinner on a button".' },
|
|
604
|
+
limit: { type: 'number', minimum: 1, maximum: 20, default: 8 },
|
|
605
|
+
},
|
|
606
|
+
},
|
|
607
|
+
},
|
|
596
608
|
];
|
|
597
609
|
}
|
|
598
610
|
|
|
@@ -866,11 +878,25 @@ async function handleGetComponentApi(ctx, args = {}) {
|
|
|
866
878
|
}
|
|
867
879
|
}
|
|
868
880
|
|
|
881
|
+
const components = declarations.slice(0, limit).map((comp) => {
|
|
882
|
+
// Components with CSS parts use shadow DOM — surface the adoptLayers requirement
|
|
883
|
+
const hasShadowDom = comp.cssParts && comp.cssParts.length > 0;
|
|
884
|
+
return {
|
|
885
|
+
...comp,
|
|
886
|
+
...(hasShadowDom
|
|
887
|
+
? {
|
|
888
|
+
shadowDomNote:
|
|
889
|
+
'This component uses a shadow DOM. When extending or wrapping it in a custom element, call PDS.adoptLayers(this) in the constructor to inherit all PDS adopted stylesheets. NEVER inject <style> blocks into shadow DOM.',
|
|
890
|
+
}
|
|
891
|
+
: {}),
|
|
892
|
+
};
|
|
893
|
+
});
|
|
894
|
+
|
|
869
895
|
return {
|
|
870
896
|
ssoTRoot: normalizePath(ctx.ssoTRoot),
|
|
871
897
|
source: normalizePath(path.relative(ctx.ssoTRoot, ctx.files.customElements)),
|
|
872
898
|
totalMatches: declarations.length,
|
|
873
|
-
components
|
|
899
|
+
components,
|
|
874
900
|
};
|
|
875
901
|
}
|
|
876
902
|
|
|
@@ -982,9 +1008,43 @@ async function handleValidateSnippet(ctx, args = {}) {
|
|
|
982
1008
|
const unknownTokens = [...usedTokens].filter((token) => !knownTokens.has(token));
|
|
983
1009
|
const unknownComponents = [...usedComponents].filter((tag) => !knownComponents.has(tag));
|
|
984
1010
|
|
|
1011
|
+
// Anti-pattern detection
|
|
1012
|
+
const antiPatterns = [];
|
|
1013
|
+
|
|
1014
|
+
// Inline style attributes
|
|
1015
|
+
if (/\bstyle\s*=\s*["'][^"']+["']/.test(html)) {
|
|
1016
|
+
antiPatterns.push({
|
|
1017
|
+
rule: 'no-inline-styles',
|
|
1018
|
+
message: 'Inline style attributes detected. Use CSS custom property tokens (var(--token-name)) instead.',
|
|
1019
|
+
fix: 'Replace style="..." with CSS custom properties. Use get_tokens to find the right token.',
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
// <style> tag injection (especially dangerous in shadow DOM)
|
|
1024
|
+
if (/<style[\s>]/i.test(html)) {
|
|
1025
|
+
antiPatterns.push({
|
|
1026
|
+
rule: 'no-style-injection',
|
|
1027
|
+
message: '<style> tag detected. In PDS web components, always use PDS.adoptLayers(this) in the constructor — never inject <style> blocks.',
|
|
1028
|
+
fix: 'Remove <style> and call PDS.adoptLayers(this) in the shadow root constructor.',
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
// Browser dialog calls
|
|
1033
|
+
if (/\b(alert|confirm|prompt)\s*\(/.test(html)) {
|
|
1034
|
+
antiPatterns.push({
|
|
1035
|
+
rule: 'no-browser-dialogs',
|
|
1036
|
+
message: 'Browser dialog (alert/confirm/prompt) detected.',
|
|
1037
|
+
fix: 'Use PDS.toast() for notifications and PDS.ask() for confirmations/prompts.',
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
const hasAntiPatterns = antiPatterns.length > 0;
|
|
1042
|
+
const valid = unknownClasses.length === 0 && unknownTokens.length === 0 && unknownComponents.length === 0 && !hasAntiPatterns;
|
|
1043
|
+
|
|
985
1044
|
return {
|
|
986
1045
|
ssoTRoot: normalizePath(ctx.ssoTRoot),
|
|
987
|
-
valid
|
|
1046
|
+
valid,
|
|
1047
|
+
antiPatterns,
|
|
988
1048
|
unknown: {
|
|
989
1049
|
classes: unknownClasses.map((className) => ({
|
|
990
1050
|
name: className,
|
|
@@ -1002,6 +1062,92 @@ async function handleValidateSnippet(ctx, args = {}) {
|
|
|
1002
1062
|
};
|
|
1003
1063
|
}
|
|
1004
1064
|
|
|
1065
|
+
async function handleGetBestMatch(ctx, args = {}) {
|
|
1066
|
+
const intent = String(args.intent || '').trim();
|
|
1067
|
+
if (!intent) throw new Error('The "intent" argument is required.');
|
|
1068
|
+
const limit = Math.min(Math.max(Number(args.limit || 8), 1), 20);
|
|
1069
|
+
const needle = normalize(intent);
|
|
1070
|
+
|
|
1071
|
+
const [ontology, enhancerMeta, customElements] = await Promise.all([
|
|
1072
|
+
getOntology(ctx),
|
|
1073
|
+
getEnhancerMeta(ctx),
|
|
1074
|
+
getCustomElements(ctx),
|
|
1075
|
+
]);
|
|
1076
|
+
|
|
1077
|
+
const results = [];
|
|
1078
|
+
|
|
1079
|
+
// Layer 3: web components
|
|
1080
|
+
for (const moduleEntry of customElements.modules || []) {
|
|
1081
|
+
for (const declaration of moduleEntry.declarations || []) {
|
|
1082
|
+
if (!declaration.customElement || !declaration.tagName) continue;
|
|
1083
|
+
const hay = normalize(`${declaration.tagName} ${declaration.description || ''}`);
|
|
1084
|
+
if (!hay.includes(needle)) continue;
|
|
1085
|
+
results.push({
|
|
1086
|
+
layer: 3,
|
|
1087
|
+
type: 'web-component',
|
|
1088
|
+
selector: declaration.tagName,
|
|
1089
|
+
description: declaration.description || '',
|
|
1090
|
+
usage: `<${declaration.tagName}></${declaration.tagName}>`,
|
|
1091
|
+
note: 'Use get_component_api for full API details.',
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
// Layer 2: data-* enhancers
|
|
1097
|
+
for (const item of enhancerMeta) {
|
|
1098
|
+
const hay = normalize(`${item.selector} ${item.description || ''}`);
|
|
1099
|
+
if (!hay.includes(needle)) continue;
|
|
1100
|
+
results.push({
|
|
1101
|
+
layer: 2,
|
|
1102
|
+
type: 'enhancer',
|
|
1103
|
+
selector: item.selector,
|
|
1104
|
+
description: item.description || '',
|
|
1105
|
+
usage: item.demoHtml || item.selector,
|
|
1106
|
+
note: 'Use get_enhancer_metadata for full details and demo HTML.',
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
// Layer 1: primitives and layout patterns
|
|
1111
|
+
const ontologyGroups = [
|
|
1112
|
+
...(ontology.primitives || []),
|
|
1113
|
+
...(ontology.layoutPatterns || []),
|
|
1114
|
+
...(ontology.components || []),
|
|
1115
|
+
];
|
|
1116
|
+
for (const item of ontologyGroups) {
|
|
1117
|
+
const hay = normalize(`${item.name || ''} ${item.description || ''} ${(item.selectors || []).join(' ')}`);
|
|
1118
|
+
if (!hay.includes(needle)) continue;
|
|
1119
|
+
const firstSelector = (item.selectors || [])[0] || '';
|
|
1120
|
+
const firstClass = getSelectorClasses(firstSelector)[0] || firstSelector;
|
|
1121
|
+
results.push({
|
|
1122
|
+
layer: 1,
|
|
1123
|
+
type: item.category || 'primitive',
|
|
1124
|
+
selector: firstSelector,
|
|
1125
|
+
description: item.description || '',
|
|
1126
|
+
usage: firstClass ? `<element class="${firstClass}">...</element>` : firstSelector,
|
|
1127
|
+
note: 'Use find_utility_class for all selectors in this group.',
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
// Sort layer desc, deduplicate by selector
|
|
1132
|
+
const seen = new Set();
|
|
1133
|
+
const ranked = results
|
|
1134
|
+
.sort((a, b) => b.layer - a.layer)
|
|
1135
|
+
.filter((item) => {
|
|
1136
|
+
if (!item.selector || seen.has(item.selector)) return false;
|
|
1137
|
+
seen.add(item.selector);
|
|
1138
|
+
return true;
|
|
1139
|
+
})
|
|
1140
|
+
.slice(0, limit);
|
|
1141
|
+
|
|
1142
|
+
return {
|
|
1143
|
+
ssoTRoot: normalizePath(ctx.ssoTRoot),
|
|
1144
|
+
intent,
|
|
1145
|
+
layerGuide: 'Prefer the LOWEST sufficient layer: Layer 1 (CSS primitive/utility) > Layer 2 (data-* enhancer) > Layer 3 (pds-* web component). Only escalate when the lower layer cannot satisfy the requirement.',
|
|
1146
|
+
totalMatches: ranked.length,
|
|
1147
|
+
matches: ranked,
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1005
1151
|
const TOOL_HANDLERS = {
|
|
1006
1152
|
get_tokens: handleGetTokens,
|
|
1007
1153
|
find_utility_class: handleFindUtilityClass,
|
|
@@ -1010,6 +1156,7 @@ const TOOL_HANDLERS = {
|
|
|
1010
1156
|
get_enhancer_metadata: handleGetEnhancerMetadata,
|
|
1011
1157
|
get_config_relations: handleGetConfigRelations,
|
|
1012
1158
|
validate_pds_snippet: handleValidateSnippet,
|
|
1159
|
+
get_best_match: handleGetBestMatch,
|
|
1013
1160
|
};
|
|
1014
1161
|
|
|
1015
1162
|
export function getPdsMcpTools() {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared MCP configuration helper — used by both pds-setup-mcp.js (CLI) and postinstall.mjs.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { mkdir, readFile, writeFile, access } from 'fs/promises';
|
|
6
|
+
import { existsSync } from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
|
|
9
|
+
export function getServerScriptCandidates() {
|
|
10
|
+
return [
|
|
11
|
+
'node_modules/@pure-ds/core/packages/pds-cli/bin/pds-mcp-server.js',
|
|
12
|
+
'node_modules/pure-ds/packages/pds-cli/bin/pds-mcp-server.js',
|
|
13
|
+
'packages/pds-cli/bin/pds-mcp-server.js',
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function resolveServerScriptPath(projectRoot) {
|
|
18
|
+
const candidatePaths = getServerScriptCandidates();
|
|
19
|
+
for (const candidate of candidatePaths) {
|
|
20
|
+
const absolutePath = path.join(projectRoot, candidate);
|
|
21
|
+
if (existsSync(absolutePath)) {
|
|
22
|
+
return absolutePath;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return path.join(projectRoot, candidatePaths[0]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function readJsonIfExists(filePath) {
|
|
29
|
+
try {
|
|
30
|
+
await access(filePath);
|
|
31
|
+
const text = await readFile(filePath, 'utf8');
|
|
32
|
+
return JSON.parse(text);
|
|
33
|
+
} catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function writeJson(filePath, value) {
|
|
39
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
40
|
+
await writeFile(filePath, `${JSON.stringify(value, null, 2)}\n`, 'utf8');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Write .vscode/mcp.json and .cursor/mcp.json in the given project root.
|
|
45
|
+
* @param {string} projectRoot
|
|
46
|
+
* @param {{ debugMode?: boolean, silent?: boolean }} options
|
|
47
|
+
* @returns {{ vscodePath: string, cursorPath: string }}
|
|
48
|
+
*/
|
|
49
|
+
export async function setupMcpConfig(projectRoot, { debugMode = false, silent = false } = {}) {
|
|
50
|
+
const serverCommand = process.execPath;
|
|
51
|
+
const serverArgs = [resolveServerScriptPath(projectRoot)];
|
|
52
|
+
const log = silent ? () => {} : (msg) => console.log(msg);
|
|
53
|
+
const envBlock = debugMode ? { env: { PDS_MCP_DEBUG: '1', PDS_MCP_LOG_FILE: './.pds-mcp.log' } } : {};
|
|
54
|
+
|
|
55
|
+
// VS Code
|
|
56
|
+
const vscodePath = path.join(projectRoot, '.vscode', 'mcp.json');
|
|
57
|
+
const vscodeConfig = (await readJsonIfExists(vscodePath)) || {};
|
|
58
|
+
const vscodeServers = (vscodeConfig.servers && typeof vscodeConfig.servers === 'object') ? vscodeConfig.servers : {};
|
|
59
|
+
vscodeServers['pure-ds'] = { type: 'stdio', command: serverCommand, args: serverArgs, ...envBlock };
|
|
60
|
+
await writeJson(vscodePath, { ...vscodeConfig, servers: vscodeServers });
|
|
61
|
+
log(`🔌 MCP: .vscode/mcp.json configured`);
|
|
62
|
+
|
|
63
|
+
// Cursor
|
|
64
|
+
const cursorPath = path.join(projectRoot, '.cursor', 'mcp.json');
|
|
65
|
+
const cursorConfig = (await readJsonIfExists(cursorPath)) || {};
|
|
66
|
+
const cursorServers = (cursorConfig.mcpServers && typeof cursorConfig.mcpServers === 'object') ? cursorConfig.mcpServers : {};
|
|
67
|
+
cursorServers['pure-ds'] = { command: serverCommand, args: serverArgs, ...envBlock };
|
|
68
|
+
await writeJson(cursorPath, { ...cursorConfig, mcpServers: cursorServers });
|
|
69
|
+
log(`🔌 MCP: .cursor/mcp.json configured`);
|
|
70
|
+
|
|
71
|
+
return { vscodePath, cursorPath };
|
|
72
|
+
}
|