@utilitywarehouse/hearth-react 0.28.6 → 0.29.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 +34 -20
- package/SKILL.md +355 -0
- package/dist/{chunk-O7RBVBMN.cjs → chunk-LWHIBSW2.cjs} +2 -2
- package/dist/{chunk-O7RBVBMN.cjs.map → chunk-LWHIBSW2.cjs.map} +1 -1
- package/dist/{chunk-JRVYOIXR.js → chunk-MIVYZGEV.js} +2 -2
- package/dist/components/CardAccordion/CardAccordion.context.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.cjs +1 -1
- package/dist/components/Combobox/Combobox.js +1 -1
- package/dist/components/ExpandableCard/ExpandableCard.cjs +1 -1
- package/dist/components/ExpandableCard/ExpandableCard.js +1 -1
- package/dist/helpers/get-classname-styles.d.ts.map +1 -1
- package/dist/helpers/logger.d.ts.map +1 -1
- package/dist/helpers/merge-ids.d.ts.map +1 -1
- package/dist/hooks/use-ids.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +18 -12
- package/public/llms/components/accordion.md +321 -0
- package/public/llms/components/alert.md +217 -0
- package/public/llms/components/avatar.md +112 -0
- package/public/llms/components/badge.md +158 -0
- package/public/llms/components/body-text.md +200 -0
- package/public/llms/components/box.md +148 -0
- package/public/llms/components/breadcrumbs.md +97 -0
- package/public/llms/components/button.md +595 -0
- package/public/llms/components/card-accordion.md +277 -0
- package/public/llms/components/card.md +985 -0
- package/public/llms/components/checkbox-group.md +193 -0
- package/public/llms/components/checkbox-tile.md +116 -0
- package/public/llms/components/checkbox.md +108 -0
- package/public/llms/components/combobox.md +360 -0
- package/public/llms/components/container.md +162 -0
- package/public/llms/components/currency-input.md +85 -0
- package/public/llms/components/date-input.md +90 -0
- package/public/llms/components/date-picker.md +159 -0
- package/public/llms/components/description-list.md +149 -0
- package/public/llms/components/detail-text.md +89 -0
- package/public/llms/components/divider.md +88 -0
- package/public/llms/components/em.md +43 -0
- package/public/llms/components/expandable-card.md +231 -0
- package/public/llms/components/flex.md +197 -0
- package/public/llms/components/grid.md +244 -0
- package/public/llms/components/heading.md +65 -0
- package/public/llms/components/helper-text.md +27 -0
- package/public/llms/components/highlight-banner.md +94 -0
- package/public/llms/components/icon-button.md +516 -0
- package/public/llms/components/icon-container.md +247 -0
- package/public/llms/components/inline-link.md +190 -0
- package/public/llms/components/label.md +28 -0
- package/public/llms/components/link.md +236 -0
- package/public/llms/components/list.md +715 -0
- package/public/llms/components/menu.md +270 -0
- package/public/llms/components/modal.md +328 -0
- package/public/llms/components/pagination.md +138 -0
- package/public/llms/components/password-input.md +93 -0
- package/public/llms/components/progress-bar.md +139 -0
- package/public/llms/components/progress-stepper.md +147 -0
- package/public/llms/components/radio-group.md +487 -0
- package/public/llms/components/search-input.md +132 -0
- package/public/llms/components/section-header.md +82 -0
- package/public/llms/components/select.md +148 -0
- package/public/llms/components/skeleton.md +282 -0
- package/public/llms/components/spinner.md +59 -0
- package/public/llms/components/strong.md +49 -0
- package/public/llms/components/switch.md +106 -0
- package/public/llms/components/table.md +230 -0
- package/public/llms/components/tabs.md +320 -0
- package/public/llms/components/text-area.md +141 -0
- package/public/llms/components/text-input.md +228 -0
- package/public/llms/components/toast.md +323 -0
- package/public/llms/components/toggle-button-card.md +513 -0
- package/public/llms/components/tooltip.md +188 -0
- package/public/llms/components/unstyled-icon-button.md +175 -0
- package/public/llms/components/validation-text.md +29 -0
- package/public/llms/components/verification-input.md +96 -0
- package/public/llms/docs/changelog.md +1430 -0
- package/public/llms/docs/common-props/align-self.md +90 -0
- package/public/llms/docs/common-props/border.md +308 -0
- package/public/llms/docs/common-props/colour.md +221 -0
- package/public/llms/docs/common-props/flex-items.md +91 -0
- package/public/llms/docs/common-props/gap.md +111 -0
- package/public/llms/docs/common-props/grid-items.md +96 -0
- package/public/llms/docs/common-props/margin.md +105 -0
- package/public/llms/docs/common-props/opacity.md +100 -0
- package/public/llms/docs/common-props/order.md +90 -0
- package/public/llms/docs/common-props/overflow.md +89 -0
- package/public/llms/docs/common-props/padding.md +102 -0
- package/public/llms/docs/common-props/position.md +92 -0
- package/public/llms/docs/common-props/size.md +93 -0
- package/public/llms/docs/common-props/spacing.md +97 -0
- package/public/llms/docs/common-props/text.md +35 -0
- package/public/llms/docs/common-props/z-index.md +88 -0
- package/public/llms/docs/design-tokens.md +72 -0
- package/public/llms/docs/getting-started.md +117 -0
- package/public/llms/docs/layout.md +135 -0
- package/public/llms/docs/migrating.md +302 -0
- package/public/llms/docs/responsive-design/breakpoints.md +119 -0
- package/public/llms/docs/responsive-design/media-queries.md +89 -0
- package/public/llms/docs/responsive-design/responsive-props.md +37 -0
- package/public/llms.txt +97 -0
- package/scripts/init-ai.js +142 -0
- package/styles.css +2 -2
- /package/dist/{chunk-JRVYOIXR.js.map → chunk-MIVYZGEV.js.map} +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* init-ai.js
|
|
5
|
+
* Adds the @utilitywarehouse/hearth-react AI skill reference to the
|
|
6
|
+
* project's AI assistant config file.
|
|
7
|
+
*
|
|
8
|
+
* Usage: npx @utilitywarehouse/hearth-react init-ai
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const PACKAGE_NAME = '@utilitywarehouse/hearth-react';
|
|
14
|
+
const SKILL_PATH = `node_modules/${PACKAGE_NAME}/SKILL.md`;
|
|
15
|
+
|
|
16
|
+
// Config files for each tool, in detection priority order
|
|
17
|
+
const AI_TOOLS = [
|
|
18
|
+
{
|
|
19
|
+
name: 'Claude Code',
|
|
20
|
+
files: ['CLAUDE.md'],
|
|
21
|
+
line: `@${SKILL_PATH}`,
|
|
22
|
+
supportsAtImport: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Cursor',
|
|
26
|
+
files: ['.cursorrules'],
|
|
27
|
+
line: `@${SKILL_PATH}`,
|
|
28
|
+
supportsAtImport: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Windsurf',
|
|
32
|
+
files: ['.windsurfrules'],
|
|
33
|
+
line: `@${SKILL_PATH}`,
|
|
34
|
+
supportsAtImport: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Cline / Roo',
|
|
38
|
+
files: ['.clinerules'],
|
|
39
|
+
line: `@${SKILL_PATH}`,
|
|
40
|
+
supportsAtImport: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Codex / OpenAI agents',
|
|
44
|
+
files: ['AGENTS.md'],
|
|
45
|
+
line: `See ${SKILL_PATH} for ${PACKAGE_NAME} component usage guidelines.`,
|
|
46
|
+
supportsAtImport: false,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'GitHub Copilot',
|
|
50
|
+
files: ['.github/copilot-instructions.md'],
|
|
51
|
+
line: `See ${SKILL_PATH} for ${PACKAGE_NAME} component usage guidelines.`,
|
|
52
|
+
supportsAtImport: false,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const COMMENT = `# ${PACKAGE_NAME} — AI skill for component library usage guidance\n# Added by: npx ${PACKAGE_NAME} init-ai`;
|
|
57
|
+
|
|
58
|
+
function findProjectRoot() {
|
|
59
|
+
let dir = process.cwd();
|
|
60
|
+
while (dir !== path.parse(dir).root) {
|
|
61
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) return dir;
|
|
62
|
+
dir = path.dirname(dir);
|
|
63
|
+
}
|
|
64
|
+
return process.cwd();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function alreadyAdded(content, line) {
|
|
68
|
+
return content.includes(line.trim());
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function appendToFile(filePath, line) {
|
|
72
|
+
const dir = path.dirname(filePath);
|
|
73
|
+
if (!fs.existsSync(dir)) {
|
|
74
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let content = '';
|
|
78
|
+
let existed = false;
|
|
79
|
+
if (fs.existsSync(filePath)) {
|
|
80
|
+
content = fs.readFileSync(filePath, 'utf8');
|
|
81
|
+
existed = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (alreadyAdded(content, line)) {
|
|
85
|
+
return { existed, alreadyPresent: true };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const separator = content.length > 0 && !content.endsWith('\n') ? '\n' : '';
|
|
89
|
+
fs.appendFileSync(filePath, `${separator}\n${COMMENT}\n${line}\n`);
|
|
90
|
+
return { existed, alreadyPresent: false };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function detectAndUpdate(projectRoot) {
|
|
94
|
+
const results = [];
|
|
95
|
+
for (const tool of AI_TOOLS) {
|
|
96
|
+
for (const file of tool.files) {
|
|
97
|
+
const filePath = path.join(projectRoot, file);
|
|
98
|
+
if (fs.existsSync(filePath)) {
|
|
99
|
+
const { alreadyPresent } = appendToFile(filePath, tool.line);
|
|
100
|
+
results.push({ tool: tool.name, file, alreadyPresent, created: false });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return results;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function promptCreate(projectRoot) {
|
|
108
|
+
const readline = require('readline');
|
|
109
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
110
|
+
rl.question('\nNo AI assistant config file detected. Create CLAUDE.md? (Y/n) ', answer => {
|
|
111
|
+
rl.close();
|
|
112
|
+
if (answer.trim().toLowerCase() !== 'n') {
|
|
113
|
+
const tool = AI_TOOLS.find(t => t.name === 'Claude Code');
|
|
114
|
+
const filePath = path.join(projectRoot, 'CLAUDE.md');
|
|
115
|
+
appendToFile(filePath, tool.line);
|
|
116
|
+
console.log(`\n✅ Created CLAUDE.md with ${PACKAGE_NAME} skill reference.`);
|
|
117
|
+
} else {
|
|
118
|
+
console.log('\nSkipped. You can add the skill manually — see the README for instructions.');
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ── Main ──────────────────────────────────────────────────────────────────────
|
|
124
|
+
|
|
125
|
+
const projectRoot = findProjectRoot();
|
|
126
|
+
|
|
127
|
+
console.log(`\n🔍 Scanning for AI assistant config files in ${projectRoot}...\n`);
|
|
128
|
+
|
|
129
|
+
const results = detectAndUpdate(projectRoot);
|
|
130
|
+
|
|
131
|
+
if (results.length === 0) {
|
|
132
|
+
promptCreate(projectRoot);
|
|
133
|
+
} else {
|
|
134
|
+
for (const r of results) {
|
|
135
|
+
if (r.alreadyPresent) {
|
|
136
|
+
console.log(`⏭ ${r.tool} (${r.file}) — skill already present, skipped`);
|
|
137
|
+
} else {
|
|
138
|
+
console.log(`✅ ${r.tool} (${r.file}) — skill reference added`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
console.log(`\nDone! Your AI assistant will now use the ${PACKAGE_NAME} skill.\n`);
|
|
142
|
+
}
|