@machinemetrics/mm-react-components 1.0.0-rc.1 → 1.0.0-rc.2
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/agent-docs/ai-agent-init-guide.md +3 -3
- package/agent-docs/cursor-skill-mm-carbide.md +14 -12
- package/agent-docs/init-readme.md +8 -4
- package/agent-docs/init-troubleshooting.md +19 -0
- package/dist/cursor-skill/mm-carbide/SKILL.md +25 -2
- package/dist/cursor-skill/mm-carbide/reference.md +13 -0
- package/dist/docs/GETTING_STARTED.md +0 -1
- package/dist/lib/mm-react-components.css +1 -1
- package/dist/scripts/ascii-logo.cjs +1 -1
- package/dist/scripts/init.cjs +159 -72
- package/package.json +3 -2
- package/dist/scripts/npx-init.cjs +0 -479
|
@@ -38,7 +38,8 @@ The init script performs minimal automated setup:
|
|
|
38
38
|
|
|
39
39
|
1. **Installs the component library** - `@machinemetrics/mm-react-components`
|
|
40
40
|
2. **Creates/updates CSS import** - Adds `/styles` import with pre-compiled CSS
|
|
41
|
-
3. **
|
|
41
|
+
3. **Optional: Carbide AI skill** - If you say yes, you choose tool (Cursor, Copilot, Claude, Gemini) and scope: **project** (this repo only) or **user** (global, all projects)
|
|
42
|
+
4. **Done!** - No build tools, no configuration files needed
|
|
42
43
|
|
|
43
44
|
### What's Included
|
|
44
45
|
|
|
@@ -137,7 +138,6 @@ your-project/
|
|
|
137
138
|
├── src/
|
|
138
139
|
│ ├── index.css (with @import '.../styles')
|
|
139
140
|
│ └── App.tsx (root with className="carbide")
|
|
140
|
-
├── mm-components-examples/ (if you ran mm-init)
|
|
141
141
|
├── package.json
|
|
142
142
|
└── node_modules/
|
|
143
143
|
└── @machinemetrics/mm-react-components/
|
|
@@ -303,7 +303,7 @@ npx @machinemetrics/mm-react-components mm-init
|
|
|
303
303
|
// Ensure carbide class is applied to root element
|
|
304
304
|
<div className="carbide">
|
|
305
305
|
<YourApp />
|
|
306
|
-
</div
|
|
306
|
+
</div>
|
|
307
307
|
```
|
|
308
308
|
|
|
309
309
|
### Issue: Build errors with TypeScript
|
|
@@ -38,20 +38,20 @@ npx @machinemetrics/mm-react-components mm-install-skill --target=copilot --scop
|
|
|
38
38
|
|
|
39
39
|
**Options**
|
|
40
40
|
|
|
41
|
-
| Option
|
|
42
|
-
|
|
43
|
-
| `--target` | `cursor`, `copilot`, `claude`, `gemini` | `cursor`
|
|
44
|
-
| `--scope`
|
|
45
|
-
| `--force`
|
|
41
|
+
| Option | Values | Default | Description |
|
|
42
|
+
| ---------- | --------------------------------------- | --------- | -------------------------------------------------------- |
|
|
43
|
+
| `--target` | `cursor`, `copilot`, `claude`, `gemini` | `cursor` | Which tool’s skill directory to use |
|
|
44
|
+
| `--scope` | `project`, `user` | `project` | Project/workspace directory (cwd) or user home |
|
|
45
|
+
| `--force` | — | — | Overwrite even when version matches (skip version check) |
|
|
46
46
|
|
|
47
47
|
**Paths by target (project vs user)**
|
|
48
48
|
|
|
49
|
-
| Target
|
|
50
|
-
|
|
51
|
-
| cursor
|
|
49
|
+
| Target | Project (cwd) | User (home) |
|
|
50
|
+
| ------- | --------------------------- | ------------------------------ |
|
|
51
|
+
| cursor | `.cursor/skills/mm-carbide` | `~/.cursor/skills/mm-carbide` |
|
|
52
52
|
| copilot | `.github/skills/mm-carbide` | `~/.copilot/skills/mm-carbide` |
|
|
53
|
-
| claude
|
|
54
|
-
| gemini
|
|
53
|
+
| claude | `.claude/skills/mm-carbide` | `~/.claude/skills/mm-carbide` |
|
|
54
|
+
| gemini | `.gemini/skills/mm-carbide` | `~/.gemini/skills/mm-carbide` |
|
|
55
55
|
|
|
56
56
|
Re-running the same command checks the installed skill version against the package version and updates the skill if the package is newer. To get the latest skill after upgrading the package, run `npm update @machinemetrics/mm-react-components` (if desired) then `npx @machinemetrics/mm-react-components mm-install-skill` again (with the same `--target`/`--scope` if you use them).
|
|
57
57
|
|
|
@@ -61,7 +61,9 @@ The skill triggers when the user asks to create or generate a UI, widget, screen
|
|
|
61
61
|
|
|
62
62
|
## Contents
|
|
63
63
|
|
|
64
|
-
- **SKILL.md** — Main instructions: components (only library exports, compound components, `cn()`, `data-slot`), widget rules (visual-first, 80/20, insight-driven)
|
|
65
|
-
- **reference.md** —
|
|
64
|
+
- **SKILL.md** — Main instructions: components (only library exports, compound components, `cn()`, `data-slot`); **theme and styling** (CSS variables only, variants, layout, `.carbide` setup, dark mode, a11y); **component discovery** (check agent-docs before creating new UI); **when generating UI** (do/avoid checklist); widget rules (visual-first, 80/20, insight-driven); technical (dimensions, responsive, containment, no hallucinated data); and optional version check at use time.
|
|
65
|
+
- **reference.md** — **Styling and conventions** (tokens, variants, layout, setup); **component discovery** (agent-docs index); key exports and patterns (PageHeader, DataTable, Form, ChartContainer, etc.); short widget rules summary (when to use charts vs metrics, accessibility).
|
|
66
66
|
|
|
67
67
|
Full widget and visualization rules are in the skill as **widget-rules.md** (installed with the skill). In this repo, see [cursor-skill/mm-carbide/widget-rules.md](../cursor-skill/mm-carbide/widget-rules.md).
|
|
68
|
+
|
|
69
|
+
For which app rules were migrated into the skill, see [docs/RULE_MIGRATION_TO_CARBIDE_SKILL.md](../docs/RULE_MIGRATION_TO_CARBIDE_SKILL.md).
|
|
@@ -15,7 +15,7 @@ This directory contains comprehensive documentation and tools for setting up the
|
|
|
15
15
|
|
|
16
16
|
### Scripts and Tools
|
|
17
17
|
|
|
18
|
-
- **mm-init** – Package bin (run via `npx @machinemetrics/mm-react-components mm-init`). Uses `
|
|
18
|
+
- **mm-init** – Package bin (run via `npx @machinemetrics/mm-react-components mm-init`). Uses `scripts/init.cjs`; installs the library, adds `/styles` import, creates examples, and optionally installs the Carbide skill (project or user/global) or runs Chakra migration.
|
|
19
19
|
|
|
20
20
|
## Quick Start
|
|
21
21
|
|
|
@@ -23,7 +23,13 @@ This directory contains comprehensive documentation and tools for setting up the
|
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
# From your React project root (run via npx; no install needed)
|
|
26
|
+
npx @machinemetrics/mm-react-components
|
|
27
|
+
|
|
28
|
+
# Or explicitly:
|
|
26
29
|
npx @machinemetrics/mm-react-components mm-init
|
|
30
|
+
|
|
31
|
+
# If you see "could not determine executable to run", use:
|
|
32
|
+
npx -p @machinemetrics/mm-react-components mm-init
|
|
27
33
|
```
|
|
28
34
|
|
|
29
35
|
### 2. Manual Setup (Complete Control)
|
|
@@ -41,8 +47,7 @@ Follow the detailed instructions in `ai-agent-init-guide.md` for step-by-step ma
|
|
|
41
47
|
### What mm-init Does
|
|
42
48
|
|
|
43
49
|
- Installs the library and adds the pre-compiled CSS import to your `index.css` (or creates it).
|
|
44
|
-
-
|
|
45
|
-
- Optionally installs the Carbide AI skill and offers Chakra UI migration if detected.
|
|
50
|
+
- Optionally installs the Carbide AI skill (project-only or user/global) and offers Chakra UI migration if detected.
|
|
46
51
|
|
|
47
52
|
### Project Structure (zero-config)
|
|
48
53
|
|
|
@@ -51,7 +56,6 @@ your-project/
|
|
|
51
56
|
├── src/
|
|
52
57
|
│ ├── index.css (with @import '.../styles')
|
|
53
58
|
│ └── App.tsx (add className="carbide" to root)
|
|
54
|
-
├── mm-components-examples/ (created by mm-init)
|
|
55
59
|
├── package.json
|
|
56
60
|
└── node_modules/
|
|
57
61
|
└── @machinemetrics/mm-react-components/
|
|
@@ -4,6 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
### 1. Script Execution Issues
|
|
6
6
|
|
|
7
|
+
#### Error: `npm error could not determine executable to run`
|
|
8
|
+
|
|
9
|
+
**Cause**: Some npm/npx versions cannot pick a binary when the package has multiple bin entries and no command is given, or when the package is resolved from a local/cached copy that lacks the expected layout.
|
|
10
|
+
|
|
11
|
+
**Solution**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Option 1: Run without a command (uses default init binary)
|
|
15
|
+
npx @machinemetrics/mm-react-components
|
|
16
|
+
|
|
17
|
+
# Option 2: Explicitly specify the package and command
|
|
18
|
+
npx -p @machinemetrics/mm-react-components mm-init
|
|
19
|
+
|
|
20
|
+
# Option 3: Pin version and run
|
|
21
|
+
npx @machinemetrics/mm-react-components@latest mm-init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If you are inside a project that has `@machinemetrics/mm-react-components` as a dependency, npx may use that copy instead of the registry; the local copy may not have been built with bin scripts. Use Option 2 from the project root or a folder that does not have the package in `node_modules`.
|
|
25
|
+
|
|
7
26
|
#### Error: `npx: command not found`
|
|
8
27
|
|
|
9
28
|
**Cause**: NPX not installed or not in PATH.
|
|
@@ -8,10 +8,31 @@ description: Generate UIs and widgets with Carbide and MachineMetrics React Comp
|
|
|
8
8
|
## Components
|
|
9
9
|
|
|
10
10
|
- Use **only** exports from `@machinemetrics/mm-react-components`. Do not create new components or use other UI libraries.
|
|
11
|
-
- Use compound components as in the library: Dialog + DialogTrigger + DialogContent; Form + FormField; DataTable + column descriptors; Sheet, DropdownMenu, Tabs, etc.
|
|
11
|
+
- Use compound components as in the library: Dialog + DialogTrigger + DialogContent; Form + FormField; DataTable + column descriptors; Card + CardHeader + CardContent + CardFooter; Sheet, DropdownMenu, Tabs, etc. Never replace them with raw divs and custom classes.
|
|
12
12
|
- Use `cn()` from the library and Tailwind for layout and styling. Respect `data-slot` for Carbide theming where applicable.
|
|
13
13
|
- For a component list and patterns, see [reference.md](reference.md). For full widget and visualization rules, see [widget-rules.md](widget-rules.md).
|
|
14
14
|
|
|
15
|
+
## Theme and styling
|
|
16
|
+
|
|
17
|
+
- **CSS variables only.** Never hardcode colors, spacing, radii, or shadows. Use semantic tokens: `--background`, `--foreground`, `--primary`, `--muted`, `--muted-foreground`, `--destructive`, `--border`, `--ring`, etc.
|
|
18
|
+
- **Variants over one-off styles.** Use component variants and sizes (e.g. Button: `variant="default"|"destructive"|"outline"|"secondary"|"ghost"|"link"`, `size="sm"|"md"|"lg"|"icon"`). Do not apply brand colors or one-off Tailwind color classes to components.
|
|
19
|
+
- **Layout.** Use Flexbox/Grid and `gap-*` for spacing; avoid manual margin chains. Prefer `className="flex flex-col gap-4"` (or similar) over stacking margins.
|
|
20
|
+
- **App setup.** Consumers must import the library styles and wrap the app (or Carbide subtree) in an element with class `carbide` so the theme applies. See [reference.md](reference.md) for setup.
|
|
21
|
+
- **Dark mode.** All styling must work in both light and dark mode via CSS variables; do not hardcode colors that break theme switching.
|
|
22
|
+
- **Accessibility.** Use visible focus states, keyboard support, and semantic structure; avoid relying on color alone.
|
|
23
|
+
|
|
24
|
+
## Component discovery
|
|
25
|
+
|
|
26
|
+
**When the package is installed in this project:** Check the package’s **agent-docs** at `node_modules/@machinemetrics/mm-react-components/agent-docs/` (start with **agent-documentation-reference.md**). Prefer using or composing library components over building from scratch.
|
|
27
|
+
|
|
28
|
+
**When the package is not installed in this workspace:** agent-docs will not exist. Use this skill’s [reference.md](reference.md) for components and patterns and [widget-rules.md](widget-rules.md) for widget rules. Recommend the user install the package in the project (`npx @machinemetrics/mm-react-components mm-init` or `npm install @machinemetrics/mm-react-components`) so full docs and setup guides are available.
|
|
29
|
+
|
|
30
|
+
## When generating UI
|
|
31
|
+
|
|
32
|
+
**Do:** Import from the library; use compound components and variants; use Tailwind for layout and spacing; include proper TypeScript types and accessibility (focus, ARIA where needed).
|
|
33
|
+
|
|
34
|
+
**Avoid:** Hardcoded colors (e.g. `bg-blue-600`, `text-gray-500`); inline brand styling; non-semantic HTML; missing focus or labels on interactive elements.
|
|
35
|
+
|
|
15
36
|
## Widget rules
|
|
16
37
|
|
|
17
38
|
- **Visual, not textual**: Every widget must include at least one chart, graph, or visual data representation. Text is for titles, labels, and brief annotations only (80% visuals / 20% text max).
|
|
@@ -26,7 +47,9 @@ description: Generate UIs and widgets with Carbide and MachineMetrics React Comp
|
|
|
26
47
|
|
|
27
48
|
## Setup, init, and migration
|
|
28
49
|
|
|
29
|
-
|
|
50
|
+
**When the package is installed in this project:** Use the package’s **agent-docs** at `node_modules/@machinemetrics/mm-react-components/agent-docs/` for setup, initialization (`mm-init`), Chakra UI migration, and the full doc index. Start with **agent-documentation-reference.md**; use **ai-agent-init-guide.md** for setup and **ai-agent-guide.md** (and chakra-migration-\*) for migration.
|
|
51
|
+
|
|
52
|
+
**When the package is not installed:** agent-docs is not available. Recommend running `npx @machinemetrics/mm-react-components mm-init` from the project root (or `npm install @machinemetrics/mm-react-components` then adding the styles import and `.carbide` class). After install, agent-docs will be in node_modules for full guides.
|
|
30
53
|
|
|
31
54
|
## Version check while using
|
|
32
55
|
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# mm-carbide reference
|
|
2
2
|
|
|
3
|
+
## Styling and conventions
|
|
4
|
+
|
|
5
|
+
- **Colors and tokens:** Use only CSS variables / semantic tokens (e.g. `bg-background`, `text-foreground`, `text-muted-foreground`, `border-border`, `bg-primary`, `text-destructive`). Never use raw Tailwind color classes like `bg-blue-600` or `text-gray-500`.
|
|
6
|
+
- **Variants and sizes:** Use component props: `variant="default"|"destructive"|"outline"|"secondary"|"ghost"|"link"`, `size="sm"|"md"|"lg"|"icon"` where supported. Same variant names apply across Button, Badge, and other components.
|
|
7
|
+
- **Layout:** Use `flex`, `grid`, and `gap-*` for spacing; avoid ad-hoc margins between siblings.
|
|
8
|
+
- **Setup:** Import library styles (e.g. `import '@machinemetrics/mm-react-components/styles'`) and wrap the app (or Carbide root) in `<div className="carbide">` so the theme and fonts apply.
|
|
9
|
+
|
|
10
|
+
## Component discovery
|
|
11
|
+
|
|
12
|
+
**When the package is installed in this project:** Check **agent-docs** at `node_modules/@machinemetrics/mm-react-components/agent-docs/`; use **agent-documentation-reference.md** as the index for existing components and patterns.
|
|
13
|
+
|
|
14
|
+
**When the package is not installed in this workspace:** agent-docs is not present. Use this reference and [widget-rules.md](widget-rules.md); recommend installing the package in the project (`mm-init` or `npm install @machinemetrics/mm-react-components`) for the full doc set.
|
|
15
|
+
|
|
3
16
|
## Key exports (from @machinemetrics/mm-react-components)
|
|
4
17
|
|
|
5
18
|
Import from the package main entry (see `src/index.ts` in the repo for the full list).
|