@texturehq/edges 1.29.1 → 1.30.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/dist/{colors-CkJf6_Bz.d.cts → colors-Dt3zpPN_.d.cts} +5 -1
- package/dist/{colors-DR1jXZhL.d.ts → colors-KgCYfdO9.d.ts} +5 -1
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -4
- package/dist/index.d.ts +39 -4
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/styles.css +5 -0
- package/package.json +4 -5
- package/dist/components.manifest.json +0 -3160
- package/dist/utilities.manifest.json +0 -1222
- package/scripts/generate-edges-docs.js +0 -1127
- package/scripts/setup-cursor-rules-manual.js +0 -163
- package/scripts/setup-cursor-rules.js +0 -277
- package/scripts/setup-cursor-rules.sh +0 -95
- package/templates/cursor-rules/edges-usage.mdc +0 -65
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// setup-cursor-rules-manual.js (manual installer for Cursor rules)
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
|
|
6
|
-
const setupCursorRules = () => {
|
|
7
|
-
const cwd = process.cwd();
|
|
8
|
-
|
|
9
|
-
// Don't run inside the edges package itself
|
|
10
|
-
try {
|
|
11
|
-
const pkgJsonPath = path.join(cwd, "package.json");
|
|
12
|
-
if (fs.existsSync(pkgJsonPath)) {
|
|
13
|
-
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
|
14
|
-
if (pkg.name === "@texturehq/edges") return;
|
|
15
|
-
}
|
|
16
|
-
} catch {
|
|
17
|
-
// ignore
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Try multiple possible locations for the templates directory
|
|
21
|
-
const possibleTemplatePaths = [
|
|
22
|
-
// Yalc path (the actual files)
|
|
23
|
-
path.join(cwd, "node_modules/.yalc/@texturehq/edges/templates/cursor-rules"),
|
|
24
|
-
// Regular npm install path
|
|
25
|
-
path.join(__dirname, "../templates/cursor-rules"),
|
|
26
|
-
// Alternative paths
|
|
27
|
-
path.join(__dirname, "../../templates/cursor-rules"),
|
|
28
|
-
path.join(__dirname, "../../../templates/cursor-rules"),
|
|
29
|
-
// Direct path from node_modules
|
|
30
|
-
path.join(cwd, "node_modules/@texturehq/edges/templates/cursor-rules"),
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
let templatesDir = null;
|
|
34
|
-
for (const templatePath of possibleTemplatePaths) {
|
|
35
|
-
if (fs.existsSync(templatePath)) {
|
|
36
|
-
templatesDir = templatePath;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!templatesDir) {
|
|
42
|
-
console.log("⚠️ Could not find cursor rules templates. Tried paths:");
|
|
43
|
-
possibleTemplatePaths.forEach((path) => console.log(` - ${path}`));
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
console.log(`✅ Found templates at: ${templatesDir}`);
|
|
48
|
-
|
|
49
|
-
// Try to read package version from multiple locations
|
|
50
|
-
const possiblePackageJsonPaths = [
|
|
51
|
-
// Yalc path (the actual files)
|
|
52
|
-
path.join(cwd, "node_modules/.yalc/@texturehq/edges/package.json"),
|
|
53
|
-
// Regular npm install path
|
|
54
|
-
path.join(__dirname, "../package.json"),
|
|
55
|
-
path.join(__dirname, "../../package.json"),
|
|
56
|
-
path.join(__dirname, "../../../package.json"),
|
|
57
|
-
path.join(cwd, "node_modules/@texturehq/edges/package.json"),
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
let packageVersion = "unknown";
|
|
61
|
-
for (const packageJsonPath of possiblePackageJsonPaths) {
|
|
62
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
63
|
-
try {
|
|
64
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
65
|
-
packageVersion = packageJson.version;
|
|
66
|
-
console.log(`📦 Found package version: ${packageVersion}`);
|
|
67
|
-
break;
|
|
68
|
-
} catch (_error) {
|
|
69
|
-
console.log(`⚠️ Could not read package.json at: ${packageJsonPath}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const templateFiles = fs.readdirSync(templatesDir).filter((file) => file.endsWith(".mdc"));
|
|
75
|
-
|
|
76
|
-
if (templateFiles.length === 0) {
|
|
77
|
-
console.log("⚠️ No .mdc files found in templates directory");
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Always use package-level rules for version-specific behavior
|
|
82
|
-
const cursorDir = path.join(cwd, ".cursor");
|
|
83
|
-
const rulesDir = path.join(cursorDir, "rules");
|
|
84
|
-
|
|
85
|
-
// Create directories recursively
|
|
86
|
-
fs.mkdirSync(cursorDir, { recursive: true });
|
|
87
|
-
fs.mkdirSync(rulesDir, { recursive: true });
|
|
88
|
-
|
|
89
|
-
let copiedCount = 0;
|
|
90
|
-
|
|
91
|
-
templateFiles.forEach((file) => {
|
|
92
|
-
const templatePath = path.join(templatesDir, file);
|
|
93
|
-
|
|
94
|
-
// Read template content and inject version info
|
|
95
|
-
let templateContent = fs.readFileSync(templatePath, "utf8");
|
|
96
|
-
|
|
97
|
-
// Add version information to the rule
|
|
98
|
-
const versionHeader = `\n\n<!-- @texturehq/edges version: ${packageVersion} -->\n`;
|
|
99
|
-
templateContent = templateContent + versionHeader;
|
|
100
|
-
|
|
101
|
-
const targetPath = path.join(rulesDir, file);
|
|
102
|
-
|
|
103
|
-
// Always overwrite to ensure version-specific rules
|
|
104
|
-
fs.writeFileSync(targetPath, templateContent, "utf8");
|
|
105
|
-
copiedCount++;
|
|
106
|
-
console.log(`✅ Updated .cursor/rules/${file} for @texturehq/edges v${packageVersion}`);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// Additionally, try to render a components list rule from the manifest if available
|
|
110
|
-
const possibleManifestPaths = [
|
|
111
|
-
path.join(cwd, "node_modules/.yalc/@texturehq/edges/dist/components.manifest.json"),
|
|
112
|
-
path.join(cwd, "node_modules/@texturehq/edges/dist/components.manifest.json"),
|
|
113
|
-
];
|
|
114
|
-
let manifestPath = null;
|
|
115
|
-
for (const p of possibleManifestPaths) {
|
|
116
|
-
if (fs.existsSync(p)) {
|
|
117
|
-
manifestPath = p;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (manifestPath) {
|
|
122
|
-
try {
|
|
123
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
124
|
-
const lines = [
|
|
125
|
-
"---",
|
|
126
|
-
"alwaysApply: true",
|
|
127
|
-
"---",
|
|
128
|
-
"",
|
|
129
|
-
`## @texturehq/edges Components (v${manifest.version || "unknown"})`,
|
|
130
|
-
"",
|
|
131
|
-
];
|
|
132
|
-
for (const c of manifest.components || []) {
|
|
133
|
-
lines.push(`- ${c.name}`);
|
|
134
|
-
if (c.importRoot) lines.push(` - Import: \`import { ${c.name} } from "${c.importRoot}"\``);
|
|
135
|
-
if (c.importPath)
|
|
136
|
-
lines.push(` - Subpath: \`import { ${c.name} } from "${c.importPath}"\``);
|
|
137
|
-
if (c.props && c.props.length) {
|
|
138
|
-
const propNames = c.props
|
|
139
|
-
.slice(0, 8)
|
|
140
|
-
.map((p) => p.name)
|
|
141
|
-
.join(", ");
|
|
142
|
-
lines.push(` - Props: ${propNames}${c.props.length > 8 ? ", …" : ""}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const outPath = path.join(rulesDir, "edges-components.mdc");
|
|
146
|
-
|
|
147
|
-
fs.writeFileSync(outPath, lines.join("\n"), "utf8");
|
|
148
|
-
console.log(
|
|
149
|
-
`✅ Wrote .cursor/rules/edges-components.mdc from manifest (${manifest.components?.length || 0} components)`
|
|
150
|
-
);
|
|
151
|
-
} catch (err) {
|
|
152
|
-
console.log("⚠️ Failed to read components.manifest.json:", err.message);
|
|
153
|
-
}
|
|
154
|
-
} else {
|
|
155
|
-
console.log("ℹ️ No components.manifest.json found; skipping edges-components.mdc generation");
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (copiedCount > 0) {
|
|
159
|
-
console.log(`🎨 Updated ${copiedCount} cursor rule(s) for @texturehq/edges v${packageVersion}`);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
setupCursorRules();
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
// scripts/setup-cursor-rules.js
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
const setupCursorRules = () => {
|
|
6
|
-
const cwd = process.env.INIT_CWD || process.cwd();
|
|
7
|
-
|
|
8
|
-
// Don't run inside the edges package itself
|
|
9
|
-
try {
|
|
10
|
-
const pkgJsonPath = path.join(cwd, "package.json");
|
|
11
|
-
if (fs.existsSync(pkgJsonPath)) {
|
|
12
|
-
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
|
13
|
-
if (pkg.name === "@texturehq/edges") return;
|
|
14
|
-
}
|
|
15
|
-
} catch {
|
|
16
|
-
// ignore
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Clean up legacy generated edges context files
|
|
20
|
-
const legacyFiles = [
|
|
21
|
-
path.join(cwd, ".cursor/rules/edges-components-old.mdc"),
|
|
22
|
-
path.join(cwd, ".claude/edges-components.md"),
|
|
23
|
-
// Add any other legacy file names here as needed
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
legacyFiles.forEach((file) => {
|
|
27
|
-
if (fs.existsSync(file)) {
|
|
28
|
-
try {
|
|
29
|
-
fs.unlinkSync(file);
|
|
30
|
-
console.log(`🧹 Cleaned up legacy file: ${path.relative(cwd, file)}`);
|
|
31
|
-
} catch (_err) {
|
|
32
|
-
// Ignore cleanup errors
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const cursorTemplatesDir = path.join(
|
|
38
|
-
path.dirname(new URL(import.meta.url).pathname),
|
|
39
|
-
"../templates/cursor-rules"
|
|
40
|
-
);
|
|
41
|
-
const claudeTemplatesDir = path.join(
|
|
42
|
-
path.dirname(new URL(import.meta.url).pathname),
|
|
43
|
-
"../templates/claude-rules"
|
|
44
|
-
);
|
|
45
|
-
const codexTemplatesDir = path.join(
|
|
46
|
-
path.dirname(new URL(import.meta.url).pathname),
|
|
47
|
-
"../templates/codex-rules"
|
|
48
|
-
);
|
|
49
|
-
const cursorDir = path.join(cwd, ".cursor");
|
|
50
|
-
const rulesDir = path.join(cursorDir, "rules");
|
|
51
|
-
|
|
52
|
-
// Create directories recursively
|
|
53
|
-
fs.mkdirSync(cursorDir, { recursive: true });
|
|
54
|
-
fs.mkdirSync(rulesDir, { recursive: true });
|
|
55
|
-
|
|
56
|
-
// Setup Cursor rules
|
|
57
|
-
if (fs.existsSync(cursorTemplatesDir)) {
|
|
58
|
-
const templateFiles = fs
|
|
59
|
-
.readdirSync(cursorTemplatesDir)
|
|
60
|
-
.filter((file) => file.endsWith(".mdc"));
|
|
61
|
-
|
|
62
|
-
if (templateFiles.length > 0) {
|
|
63
|
-
let copiedCount = 0;
|
|
64
|
-
|
|
65
|
-
templateFiles.forEach((file) => {
|
|
66
|
-
const templatePath = path.join(cursorTemplatesDir, file);
|
|
67
|
-
const targetPath = path.join(rulesDir, file);
|
|
68
|
-
|
|
69
|
-
// Always copy to ensure latest version
|
|
70
|
-
fs.copyFileSync(templatePath, targetPath);
|
|
71
|
-
copiedCount++;
|
|
72
|
-
console.log(`✅ Updated .cursor/rules/${file}`);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
if (copiedCount > 0) {
|
|
76
|
-
console.log(`🎨 Added ${copiedCount} cursor rule(s) for @texturehq/edges design system`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Setup Claude rules
|
|
82
|
-
if (fs.existsSync(claudeTemplatesDir)) {
|
|
83
|
-
const _claudeTemplateFiles = fs
|
|
84
|
-
.readdirSync(claudeTemplatesDir)
|
|
85
|
-
.filter((file) => file.endsWith(".md"));
|
|
86
|
-
|
|
87
|
-
// Claude template processing is done later with component injection (lines 221-236)
|
|
88
|
-
// so we don't need to copy templates here
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Also render edges-components.mdc from manifest when present
|
|
92
|
-
const manifestPath = [
|
|
93
|
-
path.join(cwd, "node_modules/@texturehq/edges/dist/components.manifest.json"),
|
|
94
|
-
].find((p) => fs.existsSync(p));
|
|
95
|
-
|
|
96
|
-
// Track what we generated for summary
|
|
97
|
-
let cursorComponentCount = 0;
|
|
98
|
-
let claudeComponentCount = 0;
|
|
99
|
-
let codexComponentCount = 0;
|
|
100
|
-
let packageVersion = "unknown";
|
|
101
|
-
|
|
102
|
-
if (manifestPath) {
|
|
103
|
-
try {
|
|
104
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
105
|
-
packageVersion = manifest.version || "unknown";
|
|
106
|
-
// Don't set counts yet - only set them when files are actually written
|
|
107
|
-
|
|
108
|
-
// Generate Cursor components list
|
|
109
|
-
const cursorLines = [
|
|
110
|
-
"---",
|
|
111
|
-
"alwaysApply: true",
|
|
112
|
-
"---",
|
|
113
|
-
"",
|
|
114
|
-
`## @texturehq/edges Components (v${manifest.version || "unknown"})`,
|
|
115
|
-
"",
|
|
116
|
-
"### Quick Reference",
|
|
117
|
-
"",
|
|
118
|
-
];
|
|
119
|
-
|
|
120
|
-
// Add quick reference list
|
|
121
|
-
for (const c of manifest.components || []) {
|
|
122
|
-
cursorLines.push(`- **${c.name}** - ${c.description || "Component"}`);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
cursorLines.push("");
|
|
126
|
-
cursorLines.push("### Detailed Component Reference");
|
|
127
|
-
cursorLines.push("");
|
|
128
|
-
|
|
129
|
-
for (const c of manifest.components || []) {
|
|
130
|
-
cursorLines.push(`#### ${c.name}`);
|
|
131
|
-
if (c.description) {
|
|
132
|
-
cursorLines.push(`${c.description}`);
|
|
133
|
-
}
|
|
134
|
-
cursorLines.push("");
|
|
135
|
-
cursorLines.push("**Imports:**");
|
|
136
|
-
cursorLines.push(`- \`import { ${c.name} } from "@texturehq/edges"\``);
|
|
137
|
-
cursorLines.push(`- \`import { ${c.name} } from "@texturehq/edges/components/${c.name}"\``);
|
|
138
|
-
cursorLines.push("");
|
|
139
|
-
|
|
140
|
-
if (c.props && c.props.length) {
|
|
141
|
-
cursorLines.push("**Props:**");
|
|
142
|
-
// Sort props alphabetically for deterministic output
|
|
143
|
-
const sortedProps = [...c.props].sort((a, b) => a.name.localeCompare(b.name));
|
|
144
|
-
sortedProps.forEach((prop) => {
|
|
145
|
-
cursorLines.push(`- \`${prop.name}: ${prop.type}\``);
|
|
146
|
-
});
|
|
147
|
-
cursorLines.push("");
|
|
148
|
-
}
|
|
149
|
-
cursorLines.push("---");
|
|
150
|
-
cursorLines.push("");
|
|
151
|
-
}
|
|
152
|
-
const cursorOutPath = path.join(rulesDir, "edges-components.mdc");
|
|
153
|
-
|
|
154
|
-
fs.writeFileSync(cursorOutPath, cursorLines.join("\n"), "utf8");
|
|
155
|
-
cursorComponentCount = manifest.components?.length || 0;
|
|
156
|
-
console.log(
|
|
157
|
-
`✅ Wrote .cursor/rules/edges-components.mdc from manifest (${cursorComponentCount} components)`
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
// Generate Claude components list
|
|
161
|
-
const claudeLines = [];
|
|
162
|
-
claudeLines.push("### Quick Reference");
|
|
163
|
-
claudeLines.push("");
|
|
164
|
-
|
|
165
|
-
// Add quick reference list
|
|
166
|
-
for (const c of manifest.components || []) {
|
|
167
|
-
claudeLines.push(`- **${c.name}** - ${c.description || "Component"}`);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
claudeLines.push("");
|
|
171
|
-
claudeLines.push("### Detailed Component Reference");
|
|
172
|
-
claudeLines.push("");
|
|
173
|
-
|
|
174
|
-
for (const c of manifest.components || []) {
|
|
175
|
-
claudeLines.push(`#### ${c.name}`);
|
|
176
|
-
if (c.description) {
|
|
177
|
-
claudeLines.push(`${c.description}`);
|
|
178
|
-
}
|
|
179
|
-
claudeLines.push("");
|
|
180
|
-
claudeLines.push("**Imports:**");
|
|
181
|
-
claudeLines.push(`- \`import { ${c.name} } from "@texturehq/edges"\``);
|
|
182
|
-
claudeLines.push(`- \`import { ${c.name} } from "@texturehq/edges/components/${c.name}"\``);
|
|
183
|
-
claudeLines.push("");
|
|
184
|
-
|
|
185
|
-
if (c.props && c.props.length) {
|
|
186
|
-
claudeLines.push("**Props:**");
|
|
187
|
-
// Sort props alphabetically for deterministic output
|
|
188
|
-
const sortedProps = [...c.props].sort((a, b) => a.name.localeCompare(b.name));
|
|
189
|
-
sortedProps.forEach((prop) => {
|
|
190
|
-
claudeLines.push(`- \`${prop.name}: ${prop.type}\``);
|
|
191
|
-
});
|
|
192
|
-
claudeLines.push("");
|
|
193
|
-
}
|
|
194
|
-
claudeLines.push("---");
|
|
195
|
-
claudeLines.push("");
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Update Claude template with components list
|
|
199
|
-
const claudeTemplatePath = path.join(claudeTemplatesDir, "claude.md");
|
|
200
|
-
if (fs.existsSync(claudeTemplatePath)) {
|
|
201
|
-
const claudeDir = path.join(cwd, ".claude");
|
|
202
|
-
fs.mkdirSync(claudeDir, { recursive: true });
|
|
203
|
-
|
|
204
|
-
let claudeContent = fs.readFileSync(claudeTemplatePath, "utf8");
|
|
205
|
-
claudeContent = claudeContent.split("{{COMPONENTS_LIST}}").join(claudeLines.join("\n"));
|
|
206
|
-
|
|
207
|
-
const claudeOutPath = path.join(claudeDir, "edges.md");
|
|
208
|
-
fs.writeFileSync(claudeOutPath, claudeContent, "utf8");
|
|
209
|
-
claudeComponentCount = manifest.components?.length || 0;
|
|
210
|
-
console.log(
|
|
211
|
-
`✅ Wrote .claude/edges.md with components list (${claudeComponentCount} components)`
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Generate Codex docs using template
|
|
216
|
-
const codexTemplatePath = path.join(codexTemplatesDir, "codex.md");
|
|
217
|
-
if (fs.existsSync(codexTemplatePath)) {
|
|
218
|
-
const codexDir = path.join(cwd, ".codex");
|
|
219
|
-
fs.mkdirSync(codexDir, { recursive: true });
|
|
220
|
-
|
|
221
|
-
let codexContent = fs.readFileSync(codexTemplatePath, "utf8");
|
|
222
|
-
codexContent = codexContent.split("{{COMPONENTS_LIST}}").join(claudeLines.join("\n"));
|
|
223
|
-
|
|
224
|
-
const codexOutPath = path.join(codexDir, "edges.md");
|
|
225
|
-
fs.writeFileSync(codexOutPath, codexContent, "utf8");
|
|
226
|
-
codexComponentCount = manifest.components?.length || 0;
|
|
227
|
-
console.log(
|
|
228
|
-
`✅ Wrote .codex/edges.md with components list (${codexComponentCount} components)`
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
} catch (err) {
|
|
232
|
-
console.log("⚠️ Failed to read components.manifest.json:", err.message);
|
|
233
|
-
console.log(" This might mean:");
|
|
234
|
-
console.log(" 1. @texturehq/edges is not installed");
|
|
235
|
-
console.log(" 2. Package is installed but not built");
|
|
236
|
-
console.log(" 3. Try: cd packages/edges && yarn build");
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Return summary for outer handler
|
|
241
|
-
return {
|
|
242
|
-
cursorCount: cursorComponentCount,
|
|
243
|
-
claudeCount: claudeComponentCount,
|
|
244
|
-
codexCount: codexComponentCount,
|
|
245
|
-
version: packageVersion,
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
try {
|
|
250
|
-
const result = setupCursorRules();
|
|
251
|
-
|
|
252
|
-
// Print summary if we generated context
|
|
253
|
-
if (result && (result.cursorCount > 0 || result.claudeCount > 0 || result.codexCount > 0)) {
|
|
254
|
-
console.log("\n" + "=".repeat(60));
|
|
255
|
-
console.log("🤖 Agent Context Generated Successfully");
|
|
256
|
-
console.log("=".repeat(60));
|
|
257
|
-
|
|
258
|
-
if (result.cursorCount > 0) {
|
|
259
|
-
console.log(` ✅ Cursor: ${result.cursorCount} components (v${result.version})`);
|
|
260
|
-
}
|
|
261
|
-
if (result.claudeCount > 0) {
|
|
262
|
-
console.log(` ✅ Claude: ${result.claudeCount} components (v${result.version})`);
|
|
263
|
-
}
|
|
264
|
-
if (result.codexCount > 0) {
|
|
265
|
-
console.log(` ✅ Codex: ${result.codexCount} components (v${result.version})`);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
console.log(` 📦 Source: @texturehq/edges v${result.version}`);
|
|
269
|
-
console.log("\n💡 Tip: Reload your AI agent to use the latest context");
|
|
270
|
-
console.log(" Cursor: Cmd+Shift+P → 'Developer: Reload Window'");
|
|
271
|
-
console.log(" Claude: Restart Claude Desktop / Reload project");
|
|
272
|
-
console.log("=".repeat(60) + "\n");
|
|
273
|
-
}
|
|
274
|
-
} catch (err) {
|
|
275
|
-
console.warn("⚠️ setup-cursor-rules error:", err);
|
|
276
|
-
console.warn(" Agent context may not be available");
|
|
277
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// scripts/setup-cursor-rules.js
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
const setupCursorRules = () => {
|
|
6
|
-
const cwd = process.cwd();
|
|
7
|
-
|
|
8
|
-
// Don't run in the package itself
|
|
9
|
-
if (cwd.includes('mono/packages/edges')) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const templatesDir = path.join(__dirname, '../templates/cursor-rules');
|
|
14
|
-
const cursorDir = path.join(cwd, '.cursor');
|
|
15
|
-
const rulesDir = path.join(cursorDir, 'rules');
|
|
16
|
-
|
|
17
|
-
// Create directories if they don't exist
|
|
18
|
-
if (!fs.existsSync(cursorDir)) {
|
|
19
|
-
fs.mkdirSync(cursorDir);
|
|
20
|
-
}
|
|
21
|
-
if (!fs.existsSync(rulesDir)) {
|
|
22
|
-
fs.mkdirSync(rulesDir);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Check if templates directory exists
|
|
26
|
-
if (!fs.existsSync(templatesDir)) {
|
|
27
|
-
console.log('⚠️ No cursor rules templates found');
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Copy all .mdc files from templates to the project's cursor rules
|
|
32
|
-
const templateFiles = fs.readdirSync(templatesDir).filter(file => file.endsWith('.mdc'));
|
|
33
|
-
|
|
34
|
-
if (templateFiles.length === 0) {
|
|
35
|
-
console.log('⚠️ No .mdc files found in templates directory');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let copiedCount = 0;
|
|
40
|
-
|
|
41
|
-
templateFiles.forEach(file => {
|
|
42
|
-
const templatePath = path.join(templatesDir, file);
|
|
43
|
-
const targetPath = path.join(rulesDir, file);
|
|
44
|
-
|
|
45
|
-
// Only copy if the target doesn't already exist
|
|
46
|
-
if (!fs.existsSync(targetPath)) {
|
|
47
|
-
fs.copyFileSync(templatePath, targetPath);
|
|
48
|
-
copiedCount++;
|
|
49
|
-
console.log(`✅ Added .cursor/rules/${file}`);
|
|
50
|
-
} else {
|
|
51
|
-
console.log(`⏭️ Skipped .cursor/rules/${file} (already exists)`);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
if (copiedCount > 0) {
|
|
56
|
-
console.log(`🎨 Added ${copiedCount} cursor rule(s) for @texturehq/edges design system`);
|
|
57
|
-
} else {
|
|
58
|
-
console.log('ℹ️ All cursor rules already exist');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Also render edges-components.mdc from manifest when present
|
|
62
|
-
const manifestPath = [
|
|
63
|
-
path.join(cwd, 'node_modules/@texturehq/edges/dist/components.manifest.json')
|
|
64
|
-
].find(p => fs.existsSync(p));
|
|
65
|
-
|
|
66
|
-
if (manifestPath) {
|
|
67
|
-
try {
|
|
68
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
69
|
-
const lines = [
|
|
70
|
-
'---',
|
|
71
|
-
'alwaysApply: true',
|
|
72
|
-
'---',
|
|
73
|
-
'',
|
|
74
|
-
`## @texturehq/edges Components (v${manifest.version || 'unknown'})`,
|
|
75
|
-
''
|
|
76
|
-
];
|
|
77
|
-
for (const c of manifest.components || []) {
|
|
78
|
-
lines.push(`- ${c.name}`);
|
|
79
|
-
if (c.importRoot) lines.push(` - Import: \`import { ${c.name} } from "${c.importRoot}"\``);
|
|
80
|
-
if (c.importPath) lines.push(` - Subpath: \`import { ${c.name} } from "${c.importPath}"\``);
|
|
81
|
-
if (c.props && c.props.length) {
|
|
82
|
-
const propNames = c.props.slice(0, 8).map(p => p.name).join(', ');
|
|
83
|
-
lines.push(` - Props: ${propNames}${c.props.length > 8 ? ', …' : ''}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const outPath = path.join(rulesDir, 'edges-components.mdc');
|
|
87
|
-
fs.writeFileSync(outPath, lines.join('\n'));
|
|
88
|
-
console.log(`✅ Wrote .cursor/rules/edges-components.mdc from manifest (${manifest.components?.length || 0} components)`);
|
|
89
|
-
} catch (err) {
|
|
90
|
-
console.log('⚠️ Failed to read components.manifest.json:', err.message);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
setupCursorRules();
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
alwaysApply: true
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
Usage Context for @texturehq/edges
|
|
6
|
-
|
|
7
|
-
## Setup
|
|
8
|
-
This project uses @texturehq/edges design system with Tailwind 4. The theme CSS file contains all design system variables that automatically become available as Tailwind classes.
|
|
9
|
-
|
|
10
|
-
## Theme Import
|
|
11
|
-
The theme is imported via CSS:
|
|
12
|
-
```css
|
|
13
|
-
@import "@texturehq/edges/theme.css";
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## How It Works
|
|
17
|
-
- CSS variables in the theme file automatically become Tailwind classes
|
|
18
|
-
- `--color-brand-primary` becomes available as `bg-brand-primary`, `text-brand-primary`, `border-brand-primary`, etc.
|
|
19
|
-
- `--spacing-md` becomes available as `p-md`, `m-md`, `gap-md`, etc.
|
|
20
|
-
- `--text-lg` becomes available as `text-lg`
|
|
21
|
-
- `--radius-lg` becomes available as `rounded-lg`
|
|
22
|
-
|
|
23
|
-
## Usage Guidelines
|
|
24
|
-
- **Use semantic classes over arbitrary values**
|
|
25
|
-
- Prefer: `bg-brand-primary`, `text-text-body`, `p-md`, `rounded-lg`
|
|
26
|
-
- Avoid: `bg-[#444ae1]`, `text-[#333333]`, `p-[1rem]`, `rounded-[0.5rem]`
|
|
27
|
-
|
|
28
|
-
## Naming Conventions
|
|
29
|
-
- Brand colors: `brand-primary`, `brand-light`, `brand-dark`
|
|
30
|
-
- Text colors: `text-body`, `text-heading`, `text-muted`, `text-caption`
|
|
31
|
-
- Background colors: `background-body`, `background-surface`, `background-muted`
|
|
32
|
-
- Border colors: `border-default`, `border-focus`, `border-muted`
|
|
33
|
-
- Action colors: `action-primary`, `action-secondary`, `action-destructive`
|
|
34
|
-
- Feedback colors: `feedback-success`, `feedback-error`, `feedback-warning`, `feedback-info`
|
|
35
|
-
- Spacing: `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`
|
|
36
|
-
- Typography: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`, `3xl`, `4xl`
|
|
37
|
-
- Border radius: `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`
|
|
38
|
-
|
|
39
|
-
## Examples
|
|
40
|
-
```html
|
|
41
|
-
<!-- ✅ Good - Uses semantic classes -->
|
|
42
|
-
<div class="bg-brand-primary text-text-on-primary p-md rounded-lg shadow-md">
|
|
43
|
-
<h2 class="text-text-heading text-lg font-medium">Title</h2>
|
|
44
|
-
<p class="text-text-body text-base">Content</p>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<!-- ❌ Avoid - Uses arbitrary values -->
|
|
48
|
-
<div class="bg-[#444ae1] text-[#ffffff] p-[1rem] rounded-[0.5rem]">
|
|
49
|
-
<h2 class="text-[#111827] text-[1.125rem] font-[500]">Title</h2>
|
|
50
|
-
<p class="text-[#333333] text-[1rem]">Content</p>
|
|
51
|
-
</div>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Dark Mode
|
|
55
|
-
All colors automatically adapt to dark mode when `.theme-dark` class is present.
|
|
56
|
-
|
|
57
|
-
## Available Variables
|
|
58
|
-
All CSS variables from the theme file are automatically available. The theme includes:
|
|
59
|
-
- Complete color system (brand, text, background, border, action, feedback, device states, data visualization)
|
|
60
|
-
- Spacing scale
|
|
61
|
-
- Typography scale
|
|
62
|
-
- Border radius scale
|
|
63
|
-
- Shadow system
|
|
64
|
-
- Animation definitions
|
|
65
|
-
- Form control specifications
|