@sudosandwich/limps-radix 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +255 -0
- package/dist/cache/index.d.ts +110 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +176 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/storage.d.ts +73 -0
- package/dist/cache/storage.d.ts.map +1 -0
- package/dist/cache/storage.js +176 -0
- package/dist/cache/storage.js.map +1 -0
- package/dist/cache/ttl.d.ts +62 -0
- package/dist/cache/ttl.d.ts.map +1 -0
- package/dist/cache/ttl.js +96 -0
- package/dist/cache/ttl.js.map +1 -0
- package/dist/extractor/classifier.d.ts +30 -0
- package/dist/extractor/classifier.d.ts.map +1 -0
- package/dist/extractor/classifier.js +150 -0
- package/dist/extractor/classifier.js.map +1 -0
- package/dist/extractor/forward-ref.d.ts +28 -0
- package/dist/extractor/forward-ref.d.ts.map +1 -0
- package/dist/extractor/forward-ref.js +134 -0
- package/dist/extractor/forward-ref.js.map +1 -0
- package/dist/extractor/index.d.ts +25 -0
- package/dist/extractor/index.d.ts.map +1 -0
- package/dist/extractor/index.js +43 -0
- package/dist/extractor/index.js.map +1 -0
- package/dist/extractor/interface.d.ts +40 -0
- package/dist/extractor/interface.d.ts.map +1 -0
- package/dist/extractor/interface.js +233 -0
- package/dist/extractor/interface.js.map +1 -0
- package/dist/extractor/jsdoc.d.ts +24 -0
- package/dist/extractor/jsdoc.d.ts.map +1 -0
- package/dist/extractor/jsdoc.js +74 -0
- package/dist/extractor/jsdoc.js.map +1 -0
- package/dist/extractor/project.d.ts +17 -0
- package/dist/extractor/project.d.ts.map +1 -0
- package/dist/extractor/project.js +33 -0
- package/dist/extractor/project.js.map +1 -0
- package/dist/extractor/props.d.ts +24 -0
- package/dist/extractor/props.d.ts.map +1 -0
- package/dist/extractor/props.js +78 -0
- package/dist/extractor/props.js.map +1 -0
- package/dist/extractor/type-resolver.d.ts +32 -0
- package/dist/extractor/type-resolver.d.ts.map +1 -0
- package/dist/extractor/type-resolver.js +129 -0
- package/dist/extractor/type-resolver.js.map +1 -0
- package/dist/fetcher/index.d.ts +7 -0
- package/dist/fetcher/index.d.ts.map +1 -0
- package/dist/fetcher/index.js +7 -0
- package/dist/fetcher/index.js.map +1 -0
- package/dist/fetcher/npm-registry.d.ts +45 -0
- package/dist/fetcher/npm-registry.d.ts.map +1 -0
- package/dist/fetcher/npm-registry.js +217 -0
- package/dist/fetcher/npm-registry.js.map +1 -0
- package/dist/fetcher/unified-package.d.ts +27 -0
- package/dist/fetcher/unified-package.d.ts.map +1 -0
- package/dist/fetcher/unified-package.js +99 -0
- package/dist/fetcher/unified-package.js.map +1 -0
- package/dist/fetcher/unpkg.d.ts +20 -0
- package/dist/fetcher/unpkg.d.ts.map +1 -0
- package/dist/fetcher/unpkg.js +57 -0
- package/dist/fetcher/unpkg.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/signatures/disambiguation.d.ts +30 -0
- package/dist/signatures/disambiguation.d.ts.map +1 -0
- package/dist/signatures/disambiguation.js +99 -0
- package/dist/signatures/disambiguation.js.map +1 -0
- package/dist/signatures/distinguishing.d.ts +29 -0
- package/dist/signatures/distinguishing.d.ts.map +1 -0
- package/dist/signatures/distinguishing.js +108 -0
- package/dist/signatures/distinguishing.js.map +1 -0
- package/dist/signatures/generator.d.ts +20 -0
- package/dist/signatures/generator.d.ts.map +1 -0
- package/dist/signatures/generator.js +147 -0
- package/dist/signatures/generator.js.map +1 -0
- package/dist/signatures/index.d.ts +10 -0
- package/dist/signatures/index.d.ts.map +1 -0
- package/dist/signatures/index.js +10 -0
- package/dist/signatures/index.js.map +1 -0
- package/dist/signatures/inference.d.ts +37 -0
- package/dist/signatures/inference.d.ts.map +1 -0
- package/dist/signatures/inference.js +132 -0
- package/dist/signatures/inference.js.map +1 -0
- package/dist/tools/extract-primitive.d.ts +49 -0
- package/dist/tools/extract-primitive.d.ts.map +1 -0
- package/dist/tools/extract-primitive.js +103 -0
- package/dist/tools/extract-primitive.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-primitives.d.ts +40 -0
- package/dist/tools/list-primitives.d.ts.map +1 -0
- package/dist/tools/list-primitives.js +53 -0
- package/dist/tools/list-primitives.js.map +1 -0
- package/dist/types/index.d.ts +83 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool for listing all available Radix UI primitives.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { listPrimitives, resolvePackage } from '../fetcher/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Input schema for radix_list_primitives tool.
|
|
8
|
+
*/
|
|
9
|
+
export const listPrimitivesInputSchema = z.object({
|
|
10
|
+
version: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.default('latest')
|
|
14
|
+
.describe('Radix version (default: latest)'),
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Handler for the radix_list_primitives tool.
|
|
18
|
+
*
|
|
19
|
+
* @param input - Tool input parameters
|
|
20
|
+
* @returns List of primitives with metadata
|
|
21
|
+
*/
|
|
22
|
+
export async function handleListPrimitives(input) {
|
|
23
|
+
const parsed = listPrimitivesInputSchema.parse(input);
|
|
24
|
+
const versionHint = parsed.version || 'latest';
|
|
25
|
+
// Detect if unified package is available for this version
|
|
26
|
+
const resolved = await resolvePackage('dialog', versionHint);
|
|
27
|
+
const resolvedVersion = resolved.version;
|
|
28
|
+
const useUnified = resolved.source === 'unified';
|
|
29
|
+
// Get all primitives
|
|
30
|
+
const primitives = await listPrimitives(resolvedVersion);
|
|
31
|
+
const output = {
|
|
32
|
+
version: resolvedVersion,
|
|
33
|
+
primitives: primitives.map((p) => ({
|
|
34
|
+
name: p.name,
|
|
35
|
+
// Use unified package name if available, otherwise individual package
|
|
36
|
+
package: useUnified ? 'radix-ui' : p.package,
|
|
37
|
+
description: p.description,
|
|
38
|
+
})),
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* MCP tool definition for listing Radix primitives.
|
|
46
|
+
*/
|
|
47
|
+
export const listPrimitivesTool = {
|
|
48
|
+
name: 'radix_list_primitives',
|
|
49
|
+
description: 'List all available Radix UI primitives with their package names and descriptions',
|
|
50
|
+
inputSchema: listPrimitivesInputSchema,
|
|
51
|
+
handler: handleListPrimitives,
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=list-primitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-primitives.js","sourceRoot":"","sources":["../../src/tools/list-primitives.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,OAAO,CAAC,QAAQ,CAAC;SACjB,QAAQ,CAAC,iCAAiC,CAAC;CAC/C,CAAC,CAAC;AAgBH;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAc;IAEd,MAAM,MAAM,GAAG,yBAAyB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC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: string;
|
|
10
|
+
version: string;
|
|
11
|
+
extractedAt: string;
|
|
12
|
+
rootProps: PropDefinition[];
|
|
13
|
+
subComponents: SubComponentDefinition[];
|
|
14
|
+
exports: string[];
|
|
15
|
+
usesContext: boolean;
|
|
16
|
+
contextShape?: PropDefinition[];
|
|
17
|
+
}
|
|
18
|
+
export interface SubComponentDefinition {
|
|
19
|
+
name: string;
|
|
20
|
+
props: PropDefinition[];
|
|
21
|
+
isRequired: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface PropDefinition {
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
required: boolean;
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
isStateControl: boolean;
|
|
30
|
+
isEventHandler: boolean;
|
|
31
|
+
isConfiguration: boolean;
|
|
32
|
+
isComposition: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Raw prop before classification
|
|
36
|
+
*/
|
|
37
|
+
export interface RawProp {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
required: boolean;
|
|
41
|
+
defaultValue?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Semantic behavioral contract - what we compare components against
|
|
46
|
+
*/
|
|
47
|
+
export interface BehaviorSignature {
|
|
48
|
+
primitive: string;
|
|
49
|
+
package: string;
|
|
50
|
+
version: string;
|
|
51
|
+
statePattern: StatePattern;
|
|
52
|
+
compositionPattern: CompositionPattern;
|
|
53
|
+
renderingPattern: RenderingPattern;
|
|
54
|
+
distinguishingProps: string[];
|
|
55
|
+
antiPatternProps: string[];
|
|
56
|
+
subComponents: {
|
|
57
|
+
name: string;
|
|
58
|
+
role: 'trigger' | 'content' | 'overlay' | 'item' | 'indicator' | 'other';
|
|
59
|
+
required: boolean;
|
|
60
|
+
}[];
|
|
61
|
+
similarTo: string[];
|
|
62
|
+
disambiguationRule?: string;
|
|
63
|
+
}
|
|
64
|
+
export type StatePattern = 'binary' | 'single-value' | 'multi-value' | 'range' | 'text' | 'none';
|
|
65
|
+
export type CompositionPattern = 'monolithic' | 'compound' | 'provider';
|
|
66
|
+
export type RenderingPattern = 'inline' | 'portal' | 'conditional' | 'portal-conditional';
|
|
67
|
+
/**
|
|
68
|
+
* Package info from npm registry
|
|
69
|
+
*/
|
|
70
|
+
export interface PackageInfo {
|
|
71
|
+
name: string;
|
|
72
|
+
version: string;
|
|
73
|
+
distTags: Record<string, string>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Primitive info for listing
|
|
77
|
+
*/
|
|
78
|
+
export interface PrimitiveInfo {
|
|
79
|
+
name: string;
|
|
80
|
+
package: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IAEpB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY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ACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sudosandwich/limps-radix",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "limps extension for Radix UI contract extraction, semantic analysis, and drift detection",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"dev": "tsc --watch",
|
|
11
|
+
"type-check": "tsc --noEmit",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"test:watch": "vitest"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"limps",
|
|
17
|
+
"radix-ui",
|
|
18
|
+
"mcp",
|
|
19
|
+
"extension"
|
|
20
|
+
],
|
|
21
|
+
"author": "Paul Breuler",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/paulbreuler/limps.git",
|
|
26
|
+
"directory": "packages/limps-radix"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@sudosandwich/limps": "^2.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@sudosandwich/limps": "*",
|
|
38
|
+
"@types/node": "^25.0.0",
|
|
39
|
+
"typescript": "^5.9.0",
|
|
40
|
+
"vitest": "^4.0.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"ts-morph": "^24.0.0",
|
|
44
|
+
"zod": "^4.3.6"
|
|
45
|
+
}
|
|
46
|
+
}
|