@uidbai/mcp-server 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -62
- package/dist/cli.js +0 -0
- package/dist/core/auth.d.ts +4 -3
- package/dist/core/auth.d.ts.map +1 -1
- package/dist/core/auth.js +37 -4
- package/dist/core/auth.js.map +1 -1
- package/dist/core/local-fs.d.ts +174 -0
- package/dist/core/local-fs.d.ts.map +1 -0
- package/dist/core/local-fs.js +263 -0
- package/dist/core/local-fs.js.map +1 -0
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/templates/index.d.ts +22 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +19 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/minimal.d.ts +9 -0
- package/dist/templates/minimal.d.ts.map +1 -0
- package/dist/templates/minimal.js +115 -0
- package/dist/templates/minimal.js.map +1 -0
- package/dist/templates/standard.d.ts +9 -0
- package/dist/templates/standard.d.ts.map +1 -0
- package/dist/templates/standard.js +527 -0
- package/dist/templates/standard.js.map +1 -0
- package/dist/tools/detect-pattern.d.ts +8 -5
- package/dist/tools/detect-pattern.d.ts.map +1 -1
- package/dist/tools/detect-pattern.js +151 -18
- package/dist/tools/detect-pattern.js.map +1 -1
- package/dist/tools/get-config.d.ts +1 -1
- package/dist/tools/get-config.d.ts.map +1 -1
- package/dist/tools/get-config.js +45 -10
- package/dist/tools/get-config.js.map +1 -1
- package/dist/tools/guide.d.ts +65 -0
- package/dist/tools/guide.d.ts.map +1 -0
- package/dist/tools/guide.js +304 -0
- package/dist/tools/guide.js.map +1 -0
- package/dist/tools/index.d.ts +4 -5
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -5
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/init.d.ts +73 -0
- package/dist/tools/init.d.ts.map +1 -0
- package/dist/tools/init.js +149 -0
- package/dist/tools/init.js.map +1 -0
- package/dist/tools/list-components.d.ts +18 -3
- package/dist/tools/list-components.d.ts.map +1 -1
- package/dist/tools/list-components.js +86 -11
- package/dist/tools/list-components.js.map +1 -1
- package/dist/tools/list-patterns.d.ts +18 -3
- package/dist/tools/list-patterns.d.ts.map +1 -1
- package/dist/tools/list-patterns.js +85 -10
- package/dist/tools/list-patterns.js.map +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +14 -15
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/status.d.ts +1 -1
- package/dist/tools/status.d.ts.map +1 -1
- package/dist/tools/status.js +54 -42
- package/dist/tools/status.js.map +1 -1
- package/dist/tools/submit-pattern.d.ts +13 -11
- package/dist/tools/submit-pattern.d.ts.map +1 -1
- package/dist/tools/submit-pattern.js +90 -19
- package/dist/tools/submit-pattern.js.map +1 -1
- package/dist/tools/update-config.d.ts +16 -8
- package/dist/tools/update-config.d.ts.map +1 -1
- package/dist/tools/update-config.js +93 -39
- package/dist/tools/update-config.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* UIDB MCP Tool: uidb_submit_pattern
|
|
3
3
|
*
|
|
4
|
-
* Submit a new reusable pattern to the design system.
|
|
4
|
+
* Submit a new reusable pattern to the local .uidb design system.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { formatErrorResponse } from "../core/errors.js";
|
|
6
|
+
import { readPatternsIndex, writePatternsIndex, writePattern, UIDBNotFoundError, } from "../core/local-fs.js";
|
|
8
7
|
export const submitPatternTool = {
|
|
9
8
|
name: "uidb_submit_pattern",
|
|
10
|
-
description: `Submit a new reusable pattern to the
|
|
9
|
+
description: `Submit a new reusable pattern to the design system.
|
|
11
10
|
|
|
12
11
|
Use this after uidb_detect_pattern confirms that your UI composition is a pattern.
|
|
13
|
-
Patterns
|
|
12
|
+
Patterns are saved to .uidb/patterns/ for future reuse.
|
|
14
13
|
|
|
15
14
|
Categories: identity, navigation, data-display, feedback, layout, forms`,
|
|
16
15
|
inputSchema: {
|
|
@@ -18,7 +17,7 @@ Categories: identity, navigation, data-display, feedback, layout, forms`,
|
|
|
18
17
|
properties: {
|
|
19
18
|
name: {
|
|
20
19
|
type: "string",
|
|
21
|
-
description: "Pattern name (e.g., '
|
|
20
|
+
description: "Pattern name (e.g., 'ProfileCard', 'NavigationHeader')",
|
|
22
21
|
},
|
|
23
22
|
description: {
|
|
24
23
|
type: "string",
|
|
@@ -51,39 +50,111 @@ Categories: identity, navigation, data-display, feedback, layout, forms`,
|
|
|
51
50
|
description: "Where this pattern should be used (e.g., ['Dropdown menus', 'Sidebars'])",
|
|
52
51
|
},
|
|
53
52
|
},
|
|
54
|
-
required: [
|
|
55
|
-
"name",
|
|
56
|
-
"description",
|
|
57
|
-
"components",
|
|
58
|
-
"code_template",
|
|
59
|
-
"category",
|
|
60
|
-
],
|
|
53
|
+
required: ["name", "description", "components", "code_template", "category"],
|
|
61
54
|
},
|
|
62
55
|
async execute(args) {
|
|
63
56
|
try {
|
|
64
|
-
|
|
57
|
+
// Generate pattern ID from name
|
|
58
|
+
const patternId = args.name
|
|
59
|
+
.toLowerCase()
|
|
60
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
61
|
+
.replace(/^-|-$/g, "");
|
|
62
|
+
// Read current index
|
|
63
|
+
const index = await readPatternsIndex();
|
|
64
|
+
// Check if pattern already exists
|
|
65
|
+
if (index.patterns.some((p) => p.id === patternId)) {
|
|
66
|
+
return {
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: "text",
|
|
70
|
+
text: JSON.stringify({
|
|
71
|
+
error: "PATTERN_EXISTS",
|
|
72
|
+
message: `Pattern "${args.name}" already exists`,
|
|
73
|
+
suggestion: "Use a different name or update the existing pattern",
|
|
74
|
+
}, null, 2),
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
isError: true,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Create pattern definition
|
|
81
|
+
const pattern = {
|
|
82
|
+
$schema: "https://uidb.ai/schemas/pattern.json",
|
|
83
|
+
id: patternId,
|
|
65
84
|
name: args.name,
|
|
66
85
|
description: args.description,
|
|
67
|
-
components: args.components,
|
|
68
|
-
code_template: args.code_template,
|
|
69
86
|
category: args.category,
|
|
70
|
-
|
|
87
|
+
components_used: args.components,
|
|
88
|
+
variants: {
|
|
89
|
+
default: {
|
|
90
|
+
description: args.description,
|
|
91
|
+
code: args.code_template,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
guidelines: args.use_cases
|
|
95
|
+
? args.use_cases.map((uc) => `Use in: ${uc}`)
|
|
96
|
+
: undefined,
|
|
97
|
+
};
|
|
98
|
+
// Write pattern file
|
|
99
|
+
await writePattern(patternId, pattern);
|
|
100
|
+
// Update index
|
|
101
|
+
index.patterns.push({
|
|
102
|
+
id: patternId,
|
|
103
|
+
name: args.name,
|
|
104
|
+
category: args.category,
|
|
105
|
+
description: args.description,
|
|
106
|
+
file: `${patternId}.json`,
|
|
71
107
|
});
|
|
108
|
+
await writePatternsIndex(index);
|
|
72
109
|
return {
|
|
73
110
|
content: [
|
|
74
111
|
{
|
|
75
112
|
type: "text",
|
|
76
|
-
text: JSON.stringify(
|
|
113
|
+
text: JSON.stringify({
|
|
114
|
+
success: true,
|
|
115
|
+
message: `Pattern "${args.name}" added to design system`,
|
|
116
|
+
pattern: {
|
|
117
|
+
id: patternId,
|
|
118
|
+
name: args.name,
|
|
119
|
+
category: args.category,
|
|
120
|
+
file: `.uidb/patterns/${patternId}.json`,
|
|
121
|
+
},
|
|
122
|
+
components: args.components,
|
|
123
|
+
next_steps: [
|
|
124
|
+
"Pattern is now available via uidb_list_patterns",
|
|
125
|
+
"Use uidb_guide to get recommendations including this pattern",
|
|
126
|
+
"Consider adding more variants for different use cases",
|
|
127
|
+
],
|
|
128
|
+
}, null, 2),
|
|
77
129
|
},
|
|
78
130
|
],
|
|
79
131
|
};
|
|
80
132
|
}
|
|
81
133
|
catch (error) {
|
|
134
|
+
if (error instanceof UIDBNotFoundError) {
|
|
135
|
+
return {
|
|
136
|
+
content: [
|
|
137
|
+
{
|
|
138
|
+
type: "text",
|
|
139
|
+
text: JSON.stringify({
|
|
140
|
+
error: "NOT_INITIALIZED",
|
|
141
|
+
message: "No .uidb folder found. Run uidb_init first.",
|
|
142
|
+
}, null, 2),
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
isError: true,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
82
148
|
return {
|
|
83
149
|
content: [
|
|
84
150
|
{
|
|
85
151
|
type: "text",
|
|
86
|
-
text:
|
|
152
|
+
text: JSON.stringify({
|
|
153
|
+
error: "SUBMIT_FAILED",
|
|
154
|
+
message: error instanceof Error
|
|
155
|
+
? error.message
|
|
156
|
+
: "Failed to submit pattern",
|
|
157
|
+
}, null, 2),
|
|
87
158
|
},
|
|
88
159
|
],
|
|
89
160
|
isError: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-pattern.js","sourceRoot":"","sources":["../../src/tools/submit-pattern.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"submit-pattern.js","sourceRoot":"","sources":["../../src/tools/submit-pattern.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,GAElB,MAAM,qBAAqB,CAAC;AAW7B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE;;;;;wEAKyD;IAEtE,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wDAAwD;aACtE;YACD,WAAW,EAAE;gBACX,IAAI,E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0BAA0B;4BACxD,OAAO,EAAE;gCACP,EAAE,EAAE,SAAS;gCACb,IAAI,EAAE,IAAI,CAAC,IAAI;gCACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;gCACvB,IAAI,EAAE,kBAAkB,SAAS,OAAO;6BACzC;4BACD,UAAU,EAAE,IAAI,CAAC,UAAU;4BAC3B,UAAU,EAAE;gCACV,iDAAiD;gCACjD,8DAA8D;gCAC9D,uDAAuD;6BACxD;yBACF,EACD,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;gBACvC,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;gCACE,KAAK,EAAE,iBAAiB;gCACxB,OAAO,EAAE,6CAA6C;6BACvD,EACD,IAAI,EACJ,CAAC,CACF;yBACF;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;4BACE,KAAK,EAAE,eAAe;4BACtB,OAAO,EACL,KAAK,YAAY,KAAK;gCACpB,CAAC,CAAC,KAAK,CAAC,OAAO;gCACf,CAAC,CAAC,0BAA0B;yBACjC,EACD,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* UIDB MCP Tool: uidb_update_config
|
|
3
3
|
*
|
|
4
|
-
* Update the project's design system configuration.
|
|
4
|
+
* Update the project's design system configuration in the local .uidb folder.
|
|
5
5
|
*/
|
|
6
|
+
interface UpdateConfigInput {
|
|
7
|
+
accent_color?: string;
|
|
8
|
+
gray_color?: string;
|
|
9
|
+
radius?: string;
|
|
10
|
+
appearance?: "light" | "dark";
|
|
11
|
+
}
|
|
6
12
|
export declare const updateConfigTool: {
|
|
7
13
|
name: string;
|
|
8
14
|
description: string;
|
|
9
15
|
inputSchema: {
|
|
10
16
|
type: "object";
|
|
11
17
|
properties: {
|
|
12
|
-
|
|
18
|
+
accent_color: {
|
|
13
19
|
type: string;
|
|
14
20
|
enum: ("gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky")[];
|
|
15
21
|
description: string;
|
|
16
22
|
};
|
|
17
|
-
|
|
23
|
+
gray_color: {
|
|
18
24
|
type: string;
|
|
19
25
|
enum: ("gray" | "mauve" | "slate" | "sage" | "olive" | "sand")[];
|
|
20
26
|
description: string;
|
|
@@ -24,14 +30,15 @@ export declare const updateConfigTool: {
|
|
|
24
30
|
enum: ("medium" | "none" | "small" | "large" | "full")[];
|
|
25
31
|
description: string;
|
|
26
32
|
};
|
|
33
|
+
appearance: {
|
|
34
|
+
type: string;
|
|
35
|
+
enum: string[];
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
27
38
|
};
|
|
28
39
|
required: never[];
|
|
29
40
|
};
|
|
30
|
-
execute(args: {
|
|
31
|
-
accentColor?: string;
|
|
32
|
-
grayColor?: string;
|
|
33
|
-
radius?: string;
|
|
34
|
-
}): Promise<{
|
|
41
|
+
execute(args: UpdateConfigInput): Promise<{
|
|
35
42
|
content: {
|
|
36
43
|
type: "text";
|
|
37
44
|
text: string;
|
|
@@ -45,4 +52,5 @@ export declare const updateConfigTool: {
|
|
|
45
52
|
isError: boolean;
|
|
46
53
|
}>;
|
|
47
54
|
};
|
|
55
|
+
export {};
|
|
48
56
|
//# sourceMappingURL=update-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-config.d.ts","sourceRoot":"","sources":["../../src/tools/update-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"update-config.d.ts","sourceRoot":"","sources":["../../src/tools/update-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,UAAU,iBAAiB;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAuCP,iBAAiB;;;;;;;;;;;;;CA+HtC,CAAC"}
|
|
@@ -1,89 +1,143 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* UIDB MCP Tool: uidb_update_config
|
|
3
3
|
*
|
|
4
|
-
* Update the project's design system configuration.
|
|
4
|
+
* Update the project's design system configuration in the local .uidb folder.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { readConfig, writeConfig, UIDBNotFoundError, } from "../core/local-fs.js";
|
|
7
7
|
import { VALID_ACCENT_COLORS, VALID_GRAY_COLORS, VALID_RADIUS_VALUES, } from "../core/types.js";
|
|
8
|
-
import { formatErrorResponse, ValidationError } from "../core/errors.js";
|
|
9
|
-
import { loadCredentials } from "../core/auth.js";
|
|
10
8
|
export const updateConfigTool = {
|
|
11
9
|
name: "uidb_update_config",
|
|
12
|
-
description: `Update the design system configuration
|
|
10
|
+
description: `Update the design system configuration in .uidb/config.json.
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- radius:
|
|
12
|
+
Modifies theme settings:
|
|
13
|
+
- accent_color: Primary brand color
|
|
14
|
+
- gray_color: Neutral color palette
|
|
15
|
+
- radius: Border radius scale
|
|
16
|
+
- appearance: Color scheme (light/dark)
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
After updating, the app will use the new values when the Theme component reads from config.`,
|
|
20
19
|
inputSchema: {
|
|
21
20
|
type: "object",
|
|
22
21
|
properties: {
|
|
23
|
-
|
|
22
|
+
accent_color: {
|
|
24
23
|
type: "string",
|
|
25
24
|
enum: [...VALID_ACCENT_COLORS],
|
|
26
|
-
description: "Primary
|
|
25
|
+
description: "Primary accent color for the theme",
|
|
27
26
|
},
|
|
28
|
-
|
|
27
|
+
gray_color: {
|
|
29
28
|
type: "string",
|
|
30
29
|
enum: [...VALID_GRAY_COLORS],
|
|
31
|
-
description: "
|
|
30
|
+
description: "Gray color palette for neutral elements",
|
|
32
31
|
},
|
|
33
32
|
radius: {
|
|
34
33
|
type: "string",
|
|
35
34
|
enum: [...VALID_RADIUS_VALUES],
|
|
36
|
-
description: "Border radius scale",
|
|
35
|
+
description: "Border radius scale for components",
|
|
36
|
+
},
|
|
37
|
+
appearance: {
|
|
38
|
+
type: "string",
|
|
39
|
+
enum: ["light", "dark"],
|
|
40
|
+
description: "Default color scheme",
|
|
37
41
|
},
|
|
38
42
|
},
|
|
39
43
|
required: [],
|
|
40
44
|
},
|
|
41
45
|
async execute(args) {
|
|
42
46
|
try {
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
// Read current config
|
|
48
|
+
const currentConfig = await readConfig();
|
|
49
|
+
// Track changes
|
|
50
|
+
const changes = {};
|
|
51
|
+
// Apply updates
|
|
52
|
+
if (args.accent_color && args.accent_color !== currentConfig.theme.accentColor) {
|
|
53
|
+
changes.accentColor = {
|
|
54
|
+
from: currentConfig.theme.accentColor,
|
|
55
|
+
to: args.accent_color,
|
|
56
|
+
};
|
|
57
|
+
currentConfig.theme.accentColor = args.accent_color;
|
|
46
58
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
if (args.gray_color && args.gray_color !== currentConfig.theme.grayColor) {
|
|
60
|
+
changes.grayColor = {
|
|
61
|
+
from: currentConfig.theme.grayColor,
|
|
62
|
+
to: args.gray_color,
|
|
63
|
+
};
|
|
64
|
+
currentConfig.theme.grayColor = args.gray_color;
|
|
51
65
|
}
|
|
52
|
-
if (args.
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
if (args.radius && args.radius !== currentConfig.theme.radius) {
|
|
67
|
+
changes.radius = {
|
|
68
|
+
from: currentConfig.theme.radius,
|
|
69
|
+
to: args.radius,
|
|
70
|
+
};
|
|
71
|
+
currentConfig.theme.radius = args.radius;
|
|
55
72
|
}
|
|
56
|
-
if (args.
|
|
57
|
-
|
|
73
|
+
if (args.appearance && args.appearance !== currentConfig.appearance) {
|
|
74
|
+
changes.appearance = {
|
|
75
|
+
from: currentConfig.appearance || "light",
|
|
76
|
+
to: args.appearance,
|
|
77
|
+
};
|
|
78
|
+
currentConfig.appearance = args.appearance;
|
|
58
79
|
}
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
// Check if any changes were made
|
|
81
|
+
if (Object.keys(changes).length === 0) {
|
|
82
|
+
return {
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: JSON.stringify({
|
|
87
|
+
message: "No changes made - values are the same",
|
|
88
|
+
current: currentConfig.theme,
|
|
89
|
+
}, null, 2),
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
63
93
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
...(args.grayColor && { grayColor: args.grayColor }),
|
|
67
|
-
...(args.radius && { radius: args.radius }),
|
|
68
|
-
});
|
|
94
|
+
// Write updated config
|
|
95
|
+
await writeConfig(currentConfig);
|
|
69
96
|
return {
|
|
70
97
|
content: [
|
|
71
98
|
{
|
|
72
99
|
type: "text",
|
|
73
100
|
text: JSON.stringify({
|
|
74
|
-
|
|
75
|
-
|
|
101
|
+
success: true,
|
|
102
|
+
message: "Configuration updated",
|
|
103
|
+
changes,
|
|
104
|
+
current: {
|
|
105
|
+
accentColor: currentConfig.theme.accentColor,
|
|
106
|
+
grayColor: currentConfig.theme.grayColor,
|
|
107
|
+
radius: currentConfig.theme.radius,
|
|
108
|
+
appearance: currentConfig.appearance,
|
|
109
|
+
},
|
|
110
|
+
note: "Changes saved to .uidb/config.json. Restart dev server to see changes.",
|
|
76
111
|
}, null, 2),
|
|
77
112
|
},
|
|
78
113
|
],
|
|
79
114
|
};
|
|
80
115
|
}
|
|
81
116
|
catch (error) {
|
|
117
|
+
if (error instanceof UIDBNotFoundError) {
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{
|
|
121
|
+
type: "text",
|
|
122
|
+
text: JSON.stringify({
|
|
123
|
+
error: "NOT_INITIALIZED",
|
|
124
|
+
message: "No .uidb folder found. Run uidb_init first.",
|
|
125
|
+
}, null, 2),
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
isError: true,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
82
131
|
return {
|
|
83
132
|
content: [
|
|
84
133
|
{
|
|
85
134
|
type: "text",
|
|
86
|
-
text:
|
|
135
|
+
text: JSON.stringify({
|
|
136
|
+
error: "UPDATE_FAILED",
|
|
137
|
+
message: error instanceof Error
|
|
138
|
+
? error.message
|
|
139
|
+
: "Failed to update config",
|
|
140
|
+
}, null, 2),
|
|
87
141
|
},
|
|
88
142
|
],
|
|
89
143
|
isError: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-config.js","sourceRoot":"","sources":["../../src/tools/update-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"update-config.js","sourceRoot":"","sources":["../../src/tools/update-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,UAAU,EACV,WAAW,EACX,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,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