@yahoo/uds 3.109.0 → 3.110.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/dist/cli/commands/sync.cjs +4 -0
- package/dist/cli/commands/sync.js +5 -1
- package/dist/cli/dist/commands/editor-rules.cjs +19 -16
- package/dist/cli/dist/commands/editor-rules.js +20 -17
- package/dist/cli/dist/lib/box.cjs +44 -0
- package/dist/cli/dist/lib/box.js +44 -0
- package/dist/cli/dist/lib/colors.cjs +2 -0
- package/dist/cli/dist/lib/colors.js +2 -1
- package/dist/cli/dist/utils/rules/config.cjs +136 -52
- package/dist/cli/dist/utils/rules/config.js +137 -54
- package/dist/cli/rules/claude/uds/components.md +50 -0
- package/dist/cli/rules/claude/uds/elevation.md +33 -0
- package/dist/cli/rules/claude/uds/icons.md +4 -0
- package/dist/cli/rules/claude/uds/styling.md +18 -0
- package/dist/cli/rules/claude/uds/tailwind.md +5 -0
- package/dist/components/client/Avatar/AvatarImage.cjs +1 -0
- package/dist/components/client/Avatar/AvatarImage.js +1 -0
- package/dist/components/client/Toast/ToastContainer.cjs +5 -1
- package/dist/components/client/Toast/ToastContainer.js +5 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +7 -0
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +7 -0
- package/dist/config/dist/index.cjs +22707 -22707
- package/dist/config/dist/index.js +22707 -22707
- package/dist/runtime/toastConfig.cjs +2 -1
- package/dist/runtime/toastConfig.d.cts +3 -0
- package/dist/runtime/toastConfig.d.ts +3 -0
- package/dist/runtime/toastConfig.js +2 -1
- package/dist/styles/styler.d.cts +29 -29
- package/dist/styles/styler.d.ts +29 -29
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.d.ts +1 -1
- package/dist/uds/generated/componentData.cjs +1181 -1181
- package/dist/uds/generated/componentData.js +1181 -1181
- package/dist/uds/generated/tailwindPurge.cjs +31 -1
- package/dist/uds/generated/tailwindPurge.js +31 -1
- package/dist/uds/package.cjs +1 -1
- package/dist/uds/package.js +1 -1
- package/dist/utils/isElevationAlias.cjs +12 -0
- package/dist/utils/isElevationAlias.d.cts +7 -0
- package/dist/utils/isElevationAlias.d.ts +7 -0
- package/dist/utils/isElevationAlias.js +11 -0
- package/package.json +2 -2
|
@@ -8,6 +8,8 @@ const require_runtime_tooltipConfig = require('../../runtime/tooltipConfig.cjs')
|
|
|
8
8
|
const require_analytics = require('../dist/utils/analytics.cjs');
|
|
9
9
|
const require_colors = require('../dist/lib/colors.cjs');
|
|
10
10
|
const require_print = require('../dist/lib/print.cjs');
|
|
11
|
+
const require_box = require('../dist/lib/box.cjs');
|
|
12
|
+
const require_config = require('../dist/utils/rules/config.cjs');
|
|
11
13
|
const require_cli_commands_utils_sortKeys = require('./utils/sortKeys.cjs');
|
|
12
14
|
let node_path = require("node:path");
|
|
13
15
|
node_path = require_runtime.__toESM(node_path);
|
|
@@ -87,6 +89,8 @@ const syncCommand = {
|
|
|
87
89
|
const configContentJs = `${exportsJS.join("\n\n")}\n`;
|
|
88
90
|
(0, node_fs.writeFileSync)(fullPath, outFileExtension === "js" ? configContentJs : configContentTs);
|
|
89
91
|
require_print.print(require_colors.green(`✅ Synced UDS config ${id} to ${fullPath}`));
|
|
92
|
+
const staleEditors = require_config.getEditorsWithStaleRules(process.cwd());
|
|
93
|
+
if (staleEditors.length > 0) require_box.printBox([require_colors.bold(`Updated UDS rules are available for ${staleEditors.join(" and ")}.`), `Run ${require_colors.cyan("`uds editor-rules`")} to update.`]);
|
|
90
94
|
await require_analytics.trackEvent("sync", { id });
|
|
91
95
|
} catch (error) {
|
|
92
96
|
require_print.print(require_colors.red(`❌ ${error.message}`));
|
|
@@ -4,8 +4,10 @@ import { configToBreakpointsConfigContext } from "../../runtime/breakpointsConfi
|
|
|
4
4
|
import { configToToastConfigContext } from "../../runtime/toastConfig.js";
|
|
5
5
|
import { configToTooltipConfigContext } from "../../runtime/tooltipConfig.js";
|
|
6
6
|
import { trackEvent } from "../dist/utils/analytics.js";
|
|
7
|
-
import { green, magenta, red, yellow } from "../dist/lib/colors.js";
|
|
7
|
+
import { bold, cyan, green, magenta, red, yellow } from "../dist/lib/colors.js";
|
|
8
8
|
import { print } from "../dist/lib/print.js";
|
|
9
|
+
import { printBox } from "../dist/lib/box.js";
|
|
10
|
+
import { getEditorsWithStaleRules } from "../dist/utils/rules/config.js";
|
|
9
11
|
import { sortKeys } from "./utils/sortKeys.js";
|
|
10
12
|
import path from "node:path";
|
|
11
13
|
import { writeFileSync } from "node:fs";
|
|
@@ -84,6 +86,8 @@ const syncCommand = {
|
|
|
84
86
|
const configContentJs = `${exportsJS.join("\n\n")}\n`;
|
|
85
87
|
writeFileSync(fullPath, outFileExtension === "js" ? configContentJs : configContentTs);
|
|
86
88
|
print(green(`✅ Synced UDS config ${id} to ${fullPath}`));
|
|
89
|
+
const staleEditors = getEditorsWithStaleRules(process.cwd());
|
|
90
|
+
if (staleEditors.length > 0) printBox([bold(`Updated UDS rules are available for ${staleEditors.join(" and ")}.`), `Run ${cyan("`uds editor-rules`")} to update.`]);
|
|
87
91
|
await trackEvent("sync", { id });
|
|
88
92
|
} catch (error) {
|
|
89
93
|
print(red(`❌ ${error.message}`));
|
|
@@ -20,7 +20,6 @@ var editor_rules_default = {
|
|
|
20
20
|
require_print.print(require_colors.green("Description: Generate editor rules for various code editors and AI tools"));
|
|
21
21
|
require_print.print("");
|
|
22
22
|
require_print.print(require_colors.yellow("Options:"));
|
|
23
|
-
require_print.print(" --force, -f Force overwrite existing rules directory");
|
|
24
23
|
require_print.print(" --output, -o Output directory (defaults to workspace root)");
|
|
25
24
|
require_print.print(" --editor, -e Specific editor/tool (defaults to all)");
|
|
26
25
|
require_print.print("");
|
|
@@ -34,17 +33,17 @@ var editor_rules_default = {
|
|
|
34
33
|
require_print.print(require_colors.blue("Examples:"));
|
|
35
34
|
require_print.print(" uds editor-rules # Generate all rules in current directory");
|
|
36
35
|
require_print.print(" uds editor-rules --editor cursor # Generate only Cursor rules");
|
|
36
|
+
require_print.print(" uds editor-rules --editor claude # Generate only Claude Code rules");
|
|
37
37
|
require_print.print(" uds editor-rules --output /path # Generate rules in specific directory");
|
|
38
|
-
require_print.print(" uds editor-rules --force # Force overwrite existing rules");
|
|
39
38
|
require_print.print("");
|
|
40
39
|
require_print.print(require_colors.green("What it generates:"));
|
|
41
|
-
require_print.print(" • Cursor Rules (.cursor/uds/)");
|
|
40
|
+
require_print.print(" • Cursor Rules (.cursor/rules/uds/)");
|
|
41
|
+
require_print.print(" • Claude Code Rules (.claude/rules/uds/)");
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
try {
|
|
45
45
|
const outputDir = options.output || process.cwd();
|
|
46
46
|
const selectedEditor = options.editor?.toLowerCase();
|
|
47
|
-
const force = options.force === "true" || options.force === true;
|
|
48
47
|
require_print.print(require_colors.blue(`📁 Generating editor rules in: ${outputDir}`));
|
|
49
48
|
if (selectedEditor) {
|
|
50
49
|
const editorConfig = require_config.getEditorConfig(selectedEditor);
|
|
@@ -58,19 +57,18 @@ var editor_rules_default = {
|
|
|
58
57
|
}
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
61
|
-
await generateEditorRules(outputDir,
|
|
60
|
+
await generateEditorRules(outputDir, editorConfig);
|
|
62
61
|
} else {
|
|
63
62
|
const editors = require_config.getAvailableEditors();
|
|
64
63
|
for (const editor of editors) {
|
|
65
64
|
const editorConfig = require_config.getEditorConfig(editor);
|
|
66
|
-
if (editorConfig) await generateEditorRules(outputDir,
|
|
65
|
+
if (editorConfig) await generateEditorRules(outputDir, editorConfig);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
require_print.print(require_colors.green("🎉 Editor rules generated successfully!"));
|
|
70
69
|
require_print.print(require_colors.blue("📝 Rules are now available for your development environment"));
|
|
71
70
|
await require_analytics.trackEvent("editor_rules_generated", {
|
|
72
71
|
output_dir: outputDir,
|
|
73
|
-
force: force || false,
|
|
74
72
|
editor: selectedEditor || "all"
|
|
75
73
|
});
|
|
76
74
|
} catch (error) {
|
|
@@ -79,7 +77,7 @@ var editor_rules_default = {
|
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
|
-
async function generateEditorRules(outputDir,
|
|
80
|
+
async function generateEditorRules(outputDir, editorConfig) {
|
|
83
81
|
require_print.print(require_colors.blue(`\n🔧 Generating ${editorConfig.name} rules...`));
|
|
84
82
|
for (const rule of editorConfig.rules) {
|
|
85
83
|
require_print.print(require_colors.yellow(` 📝 ${rule.name}: ${rule.description}`));
|
|
@@ -87,15 +85,20 @@ async function generateEditorRules(outputDir, editorName, editorConfig, force =
|
|
|
87
85
|
const targetPath = (0, node_path.join)(outputDir, file.target);
|
|
88
86
|
const targetDir = (0, node_path.join)(targetPath, "..");
|
|
89
87
|
if (!(0, node_fs.existsSync)(targetDir)) (0, node_fs.mkdirSync)(targetDir, { recursive: true });
|
|
90
|
-
|
|
91
|
-
else {
|
|
92
|
-
require_print.print(require_colors.red(` ❌ File already exists: ${file.target}`));
|
|
93
|
-
require_print.print(require_colors.yellow(" Use --force to overwrite existing files"));
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
88
|
+
const exists = (0, node_fs.existsSync)(targetPath);
|
|
96
89
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
const content = require_config.getRuleContent(file.source);
|
|
91
|
+
if (exists) {
|
|
92
|
+
if ((0, node_fs.readFileSync)(targetPath, "utf-8") === content) {
|
|
93
|
+
require_print.print(require_colors.green(` ✅ Up to date: ${file.target}`));
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
(0, node_fs.writeFileSync)(targetPath, content);
|
|
97
|
+
require_print.print(require_colors.green(` ✅ Updated: ${file.target}`));
|
|
98
|
+
} else {
|
|
99
|
+
(0, node_fs.writeFileSync)(targetPath, content);
|
|
100
|
+
require_print.print(require_colors.green(` ✅ Created: ${file.target}`));
|
|
101
|
+
}
|
|
99
102
|
} catch (error) {
|
|
100
103
|
require_print.print(require_colors.red(` ❌ Error creating ${file.target}: ${error}`));
|
|
101
104
|
}
|
|
@@ -4,7 +4,7 @@ import { blue, green, red, yellow } from "../lib/colors.js";
|
|
|
4
4
|
import { print } from "../lib/print.js";
|
|
5
5
|
import { getAvailableEditors, getEditorConfig, getRuleContent } from "../utils/rules/config.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
|
|
9
9
|
//#region ../cli/dist/commands/editor-rules.mjs
|
|
10
10
|
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
@@ -19,7 +19,6 @@ var editor_rules_default = {
|
|
|
19
19
|
print(green("Description: Generate editor rules for various code editors and AI tools"));
|
|
20
20
|
print("");
|
|
21
21
|
print(yellow("Options:"));
|
|
22
|
-
print(" --force, -f Force overwrite existing rules directory");
|
|
23
22
|
print(" --output, -o Output directory (defaults to workspace root)");
|
|
24
23
|
print(" --editor, -e Specific editor/tool (defaults to all)");
|
|
25
24
|
print("");
|
|
@@ -33,17 +32,17 @@ var editor_rules_default = {
|
|
|
33
32
|
print(blue("Examples:"));
|
|
34
33
|
print(" uds editor-rules # Generate all rules in current directory");
|
|
35
34
|
print(" uds editor-rules --editor cursor # Generate only Cursor rules");
|
|
35
|
+
print(" uds editor-rules --editor claude # Generate only Claude Code rules");
|
|
36
36
|
print(" uds editor-rules --output /path # Generate rules in specific directory");
|
|
37
|
-
print(" uds editor-rules --force # Force overwrite existing rules");
|
|
38
37
|
print("");
|
|
39
38
|
print(green("What it generates:"));
|
|
40
|
-
print(" • Cursor Rules (.cursor/uds/)");
|
|
39
|
+
print(" • Cursor Rules (.cursor/rules/uds/)");
|
|
40
|
+
print(" • Claude Code Rules (.claude/rules/uds/)");
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
try {
|
|
44
44
|
const outputDir = options.output || process.cwd();
|
|
45
45
|
const selectedEditor = options.editor?.toLowerCase();
|
|
46
|
-
const force = options.force === "true" || options.force === true;
|
|
47
46
|
print(blue(`📁 Generating editor rules in: ${outputDir}`));
|
|
48
47
|
if (selectedEditor) {
|
|
49
48
|
const editorConfig = getEditorConfig(selectedEditor);
|
|
@@ -57,19 +56,18 @@ var editor_rules_default = {
|
|
|
57
56
|
}
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
|
-
await generateEditorRules(outputDir,
|
|
59
|
+
await generateEditorRules(outputDir, editorConfig);
|
|
61
60
|
} else {
|
|
62
61
|
const editors = getAvailableEditors();
|
|
63
62
|
for (const editor of editors) {
|
|
64
63
|
const editorConfig = getEditorConfig(editor);
|
|
65
|
-
if (editorConfig) await generateEditorRules(outputDir,
|
|
64
|
+
if (editorConfig) await generateEditorRules(outputDir, editorConfig);
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
print(green("🎉 Editor rules generated successfully!"));
|
|
69
68
|
print(blue("📝 Rules are now available for your development environment"));
|
|
70
69
|
await trackEvent("editor_rules_generated", {
|
|
71
70
|
output_dir: outputDir,
|
|
72
|
-
force: force || false,
|
|
73
71
|
editor: selectedEditor || "all"
|
|
74
72
|
});
|
|
75
73
|
} catch (error) {
|
|
@@ -78,7 +76,7 @@ var editor_rules_default = {
|
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
};
|
|
81
|
-
async function generateEditorRules(outputDir,
|
|
79
|
+
async function generateEditorRules(outputDir, editorConfig) {
|
|
82
80
|
print(blue(`\n🔧 Generating ${editorConfig.name} rules...`));
|
|
83
81
|
for (const rule of editorConfig.rules) {
|
|
84
82
|
print(yellow(` 📝 ${rule.name}: ${rule.description}`));
|
|
@@ -86,15 +84,20 @@ async function generateEditorRules(outputDir, editorName, editorConfig, force =
|
|
|
86
84
|
const targetPath = join(outputDir, file.target);
|
|
87
85
|
const targetDir = join(targetPath, "..");
|
|
88
86
|
if (!existsSync(targetDir)) mkdirSync(targetDir, { recursive: true });
|
|
89
|
-
|
|
90
|
-
else {
|
|
91
|
-
print(red(` ❌ File already exists: ${file.target}`));
|
|
92
|
-
print(yellow(" Use --force to overwrite existing files"));
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
87
|
+
const exists = existsSync(targetPath);
|
|
95
88
|
try {
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
const content = getRuleContent(file.source);
|
|
90
|
+
if (exists) {
|
|
91
|
+
if (readFileSync(targetPath, "utf-8") === content) {
|
|
92
|
+
print(green(` ✅ Up to date: ${file.target}`));
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
writeFileSync(targetPath, content);
|
|
96
|
+
print(green(` ✅ Updated: ${file.target}`));
|
|
97
|
+
} else {
|
|
98
|
+
writeFileSync(targetPath, content);
|
|
99
|
+
print(green(` ✅ Created: ${file.target}`));
|
|
100
|
+
}
|
|
98
101
|
} catch (error) {
|
|
99
102
|
print(red(` ❌ Error creating ${file.target}: ${error}`));
|
|
100
103
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_colors = require('./colors.cjs');
|
|
3
|
+
const require_print = require('./print.cjs');
|
|
4
|
+
|
|
5
|
+
//#region ../cli/dist/lib/box.mjs
|
|
6
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
7
|
+
/**
|
|
8
|
+
* Strips ANSI escape codes from a string to get the visible character length.
|
|
9
|
+
*/
|
|
10
|
+
function stripAnsi(str) {
|
|
11
|
+
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Prints lines inside a bordered box, similar to npm/turbo update notifications.
|
|
15
|
+
*
|
|
16
|
+
* Example output:
|
|
17
|
+
* ╭──────────────────────────────────────────────────────╮
|
|
18
|
+
* │ │
|
|
19
|
+
* │ Updated UDS rules are available for Cursor and │
|
|
20
|
+
* │ Claude Code. Run `uds editor-rules` to update. │
|
|
21
|
+
* │ │
|
|
22
|
+
* ╰──────────────────────────────────────────────────────╯
|
|
23
|
+
*/
|
|
24
|
+
function printBox(lines) {
|
|
25
|
+
const padding = 3;
|
|
26
|
+
const innerWidth = Math.max(...lines.map((l) => stripAnsi(l).length)) + padding * 2;
|
|
27
|
+
const top = require_colors.yellow(`╭${"─".repeat(innerWidth)}╮`);
|
|
28
|
+
const bottom = require_colors.yellow(`╰${"─".repeat(innerWidth)}╯`);
|
|
29
|
+
const emptyLine = require_colors.yellow("│") + " ".repeat(innerWidth) + require_colors.yellow("│");
|
|
30
|
+
require_print.print("");
|
|
31
|
+
require_print.print(top);
|
|
32
|
+
require_print.print(emptyLine);
|
|
33
|
+
for (const line of lines) {
|
|
34
|
+
const visibleLength = stripAnsi(line).length;
|
|
35
|
+
const rightPad = innerWidth - padding - visibleLength;
|
|
36
|
+
require_print.print(require_colors.yellow("│") + " ".repeat(padding) + line + " ".repeat(rightPad) + require_colors.yellow("│"));
|
|
37
|
+
}
|
|
38
|
+
require_print.print(emptyLine);
|
|
39
|
+
require_print.print(bottom);
|
|
40
|
+
require_print.print("");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.printBox = printBox;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { yellow } from "./colors.js";
|
|
3
|
+
import { print } from "./print.js";
|
|
4
|
+
|
|
5
|
+
//#region ../cli/dist/lib/box.mjs
|
|
6
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
7
|
+
/**
|
|
8
|
+
* Strips ANSI escape codes from a string to get the visible character length.
|
|
9
|
+
*/
|
|
10
|
+
function stripAnsi(str) {
|
|
11
|
+
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Prints lines inside a bordered box, similar to npm/turbo update notifications.
|
|
15
|
+
*
|
|
16
|
+
* Example output:
|
|
17
|
+
* ╭──────────────────────────────────────────────────────╮
|
|
18
|
+
* │ │
|
|
19
|
+
* │ Updated UDS rules are available for Cursor and │
|
|
20
|
+
* │ Claude Code. Run `uds editor-rules` to update. │
|
|
21
|
+
* │ │
|
|
22
|
+
* ╰──────────────────────────────────────────────────────╯
|
|
23
|
+
*/
|
|
24
|
+
function printBox(lines) {
|
|
25
|
+
const padding = 3;
|
|
26
|
+
const innerWidth = Math.max(...lines.map((l) => stripAnsi(l).length)) + padding * 2;
|
|
27
|
+
const top = yellow(`╭${"─".repeat(innerWidth)}╮`);
|
|
28
|
+
const bottom = yellow(`╰${"─".repeat(innerWidth)}╯`);
|
|
29
|
+
const emptyLine = yellow("│") + " ".repeat(innerWidth) + yellow("│");
|
|
30
|
+
print("");
|
|
31
|
+
print(top);
|
|
32
|
+
print(emptyLine);
|
|
33
|
+
for (const line of lines) {
|
|
34
|
+
const visibleLength = stripAnsi(line).length;
|
|
35
|
+
const rightPad = innerWidth - padding - visibleLength;
|
|
36
|
+
print(yellow("│") + " ".repeat(padding) + line + " ".repeat(rightPad) + yellow("│"));
|
|
37
|
+
}
|
|
38
|
+
print(emptyLine);
|
|
39
|
+
print(bottom);
|
|
40
|
+
print("");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { printBox };
|
|
@@ -14,9 +14,11 @@ const magenta = (text) => `\x1b[35m${text}\x1b[0m`;
|
|
|
14
14
|
const cyan = (text) => `\x1b[36m${text}\x1b[0m`;
|
|
15
15
|
const white = (text) => `\x1b[37m${text}\x1b[0m`;
|
|
16
16
|
const gray = (text) => `\x1b[2m${text}\x1b[0m`;
|
|
17
|
+
const bold = (text) => `\x1b[1m${text}\x1b[0m`;
|
|
17
18
|
|
|
18
19
|
//#endregion
|
|
19
20
|
exports.blue = blue;
|
|
21
|
+
exports.bold = bold;
|
|
20
22
|
exports.cyan = cyan;
|
|
21
23
|
exports.gray = gray;
|
|
22
24
|
exports.green = green;
|
|
@@ -13,6 +13,7 @@ const magenta = (text) => `\x1b[35m${text}\x1b[0m`;
|
|
|
13
13
|
const cyan = (text) => `\x1b[36m${text}\x1b[0m`;
|
|
14
14
|
const white = (text) => `\x1b[37m${text}\x1b[0m`;
|
|
15
15
|
const gray = (text) => `\x1b[2m${text}\x1b[0m`;
|
|
16
|
+
const bold = (text) => `\x1b[1m${text}\x1b[0m`;
|
|
16
17
|
|
|
17
18
|
//#endregion
|
|
18
|
-
export { blue, cyan, gray, green, magenta, red, white, yellow };
|
|
19
|
+
export { blue, bold, cyan, gray, green, magenta, red, white, yellow };
|
|
@@ -7,68 +7,152 @@ let node_url = require("node:url");
|
|
|
7
7
|
//#region ../cli/dist/utils/rules/config.mjs
|
|
8
8
|
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
9
9
|
const __dirname$1 = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
10
|
-
const EDITOR_CONFIGS = {
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
10
|
+
const EDITOR_CONFIGS = {
|
|
11
|
+
cursor: {
|
|
12
|
+
name: "Cursor",
|
|
13
|
+
description: "AI-powered coding assistant rules for UDS development",
|
|
14
|
+
rules: [
|
|
15
|
+
{
|
|
16
|
+
name: "UDS Components",
|
|
17
|
+
description: "Component development guidelines and patterns",
|
|
18
|
+
files: [{
|
|
19
|
+
source: "rules/cursor/uds/components.mdc",
|
|
20
|
+
target: ".cursor/rules/uds/components.mdc",
|
|
21
|
+
type: "file"
|
|
22
|
+
}]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "UDS Tailwind",
|
|
26
|
+
description: "Tailwind CSS configuration and setup guidelines",
|
|
27
|
+
files: [{
|
|
28
|
+
source: "rules/cursor/uds/tailwind.mdc",
|
|
29
|
+
target: ".cursor/rules/uds/tailwind.mdc",
|
|
30
|
+
type: "file"
|
|
31
|
+
}]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "UDS Icons",
|
|
35
|
+
description: "Icon usage and documentation guidelines",
|
|
36
|
+
files: [{
|
|
37
|
+
source: "rules/cursor/uds/icons.mdc",
|
|
38
|
+
target: ".cursor/rules/uds/icons.mdc",
|
|
39
|
+
type: "file"
|
|
40
|
+
}]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "UDS Elevation",
|
|
44
|
+
description: "Elevation prop usage for layered surfaces",
|
|
45
|
+
files: [{
|
|
46
|
+
source: "rules/cursor/uds/elevation.mdc",
|
|
47
|
+
target: ".cursor/rules/uds/elevation.mdc",
|
|
48
|
+
type: "file"
|
|
49
|
+
}]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "UDS Styling",
|
|
53
|
+
description: "Color palette and styling guidelines",
|
|
54
|
+
files: [{
|
|
55
|
+
source: "rules/cursor/uds/styling.mdc",
|
|
56
|
+
target: ".cursor/rules/uds/styling.mdc",
|
|
57
|
+
type: "file"
|
|
58
|
+
}]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
claude: {
|
|
63
|
+
name: "Claude Code",
|
|
64
|
+
description: "AI-powered coding assistant rules for UDS development",
|
|
65
|
+
rules: [
|
|
66
|
+
{
|
|
67
|
+
name: "UDS Components",
|
|
68
|
+
description: "Component development guidelines and patterns",
|
|
69
|
+
files: [{
|
|
70
|
+
source: "rules/claude/uds/components.md",
|
|
71
|
+
target: ".claude/rules/uds/components.md",
|
|
72
|
+
type: "file"
|
|
73
|
+
}]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "UDS Tailwind",
|
|
77
|
+
description: "Tailwind CSS configuration and setup guidelines",
|
|
78
|
+
files: [{
|
|
79
|
+
source: "rules/claude/uds/tailwind.md",
|
|
80
|
+
target: ".claude/rules/uds/tailwind.md",
|
|
81
|
+
type: "file"
|
|
82
|
+
}]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "UDS Icons",
|
|
86
|
+
description: "Icon usage and documentation guidelines",
|
|
87
|
+
files: [{
|
|
88
|
+
source: "rules/claude/uds/icons.md",
|
|
89
|
+
target: ".claude/rules/uds/icons.md",
|
|
90
|
+
type: "file"
|
|
91
|
+
}]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "UDS Elevation",
|
|
95
|
+
description: "Elevation prop usage for layered surfaces",
|
|
96
|
+
files: [{
|
|
97
|
+
source: "rules/claude/uds/elevation.md",
|
|
98
|
+
target: ".claude/rules/uds/elevation.md",
|
|
99
|
+
type: "file"
|
|
100
|
+
}]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "UDS Styling",
|
|
104
|
+
description: "Color palette and styling guidelines",
|
|
105
|
+
files: [{
|
|
106
|
+
source: "rules/claude/uds/styling.md",
|
|
107
|
+
target: ".claude/rules/uds/styling.md",
|
|
108
|
+
type: "file"
|
|
109
|
+
}]
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
};
|
|
61
114
|
function getAvailableEditors() {
|
|
62
115
|
return Object.keys(EDITOR_CONFIGS);
|
|
63
116
|
}
|
|
64
117
|
function getEditorConfig(editor) {
|
|
65
118
|
return EDITOR_CONFIGS[editor];
|
|
66
119
|
}
|
|
120
|
+
const AUTO_GENERATED_HEADER = "<!-- Auto-generated by UDS CLI (`uds editor-rules`). Do not edit manually. -->";
|
|
67
121
|
function getRuleContent(rulePath) {
|
|
68
|
-
return (0, node_fs.readFileSync)((0, node_path.join)(__dirname$1, "..", "..", "..", rulePath), "utf-8");
|
|
122
|
+
return addAutoGeneratedHeader((0, node_fs.readFileSync)((0, node_path.join)(__dirname$1, "..", "..", "..", rulePath), "utf-8"));
|
|
123
|
+
}
|
|
124
|
+
function addAutoGeneratedHeader(content) {
|
|
125
|
+
if (content.startsWith("---\n")) {
|
|
126
|
+
const closingIndex = content.indexOf("\n---\n", 4);
|
|
127
|
+
if (closingIndex !== -1) return `${content.slice(0, closingIndex + 5)}${AUTO_GENERATED_HEADER}\n${content.slice(closingIndex + 5)}`;
|
|
128
|
+
}
|
|
129
|
+
return `${AUTO_GENERATED_HEADER}\n\n${content}`;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Checks which editors have installed UDS rules that are out of date
|
|
133
|
+
* compared to the latest rules shipped with the CLI.
|
|
134
|
+
* Only checks editors whose rule directories already exist.
|
|
135
|
+
*/
|
|
136
|
+
function getEditorsWithStaleRules(projectDir) {
|
|
137
|
+
const staleEditors = [];
|
|
138
|
+
for (const [_editorId, editorConfig] of Object.entries(EDITOR_CONFIGS)) {
|
|
139
|
+
let hasAnyRule = false;
|
|
140
|
+
let hasStaleRule = false;
|
|
141
|
+
for (const rule of editorConfig.rules) for (const file of rule.files) {
|
|
142
|
+
const targetPath = (0, node_path.join)(projectDir, file.target);
|
|
143
|
+
if (!(0, node_fs.existsSync)(targetPath)) continue;
|
|
144
|
+
hasAnyRule = true;
|
|
145
|
+
try {
|
|
146
|
+
if ((0, node_fs.readFileSync)(targetPath, "utf-8") !== getRuleContent(file.source)) hasStaleRule = true;
|
|
147
|
+
} catch {}
|
|
148
|
+
}
|
|
149
|
+
if (hasAnyRule && hasStaleRule) staleEditors.push(editorConfig.name);
|
|
150
|
+
}
|
|
151
|
+
return staleEditors;
|
|
69
152
|
}
|
|
70
153
|
|
|
71
154
|
//#endregion
|
|
72
155
|
exports.getAvailableEditors = getAvailableEditors;
|
|
73
156
|
exports.getEditorConfig = getEditorConfig;
|
|
157
|
+
exports.getEditorsWithStaleRules = getEditorsWithStaleRules;
|
|
74
158
|
exports.getRuleContent = getRuleContent;
|