@ikas/component-cli 0.130.0 → 0.132.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/component-cli",
3
- "version": "0.130.0",
3
+ "version": "0.132.0",
4
4
  "description": "CLI for developing ikas code components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,9 +8,9 @@ Never guess function signatures or type shapes — the MCP server is the source
8
8
 
9
9
  ## CRITICAL: Auto-Generated Files
10
10
 
11
- **NEVER manually create or edit `ikas.config.json`, `types.ts` or `global-types.ts`** — they are auto-generated by CLI commands.
12
- Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage props.
13
- These commands update `ikas.config.json`, `types.ts`, and `global-types.ts` automatically.
11
+ **NEVER manually create or edit `ikas.config.json`, `types.ts`, `global-types.ts`, or `src/components/index.ts`** — they are all auto-generated by CLI commands.
12
+ Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage components and props.
13
+ These commands update `ikas.config.json`, `types.ts`, `global-types.ts`, AND `src/components/index.ts` (including the component export) automatically.
14
14
 
15
15
  **The CLI does NOT edit your component source.** `remove-prop` and `remove-enum` update `ikas.config.json` and the generated `types.ts` / `global-types.ts` only — `index.tsx`, sub-components, and `styles.css` are untouched. After removing a prop or enum, grep the source for the old identifier and clean up dead references yourself before building.
16
16
 
@@ -92,7 +92,7 @@ src/
92
92
  │ ├── ProductList/
93
93
  │ │ ├── index.tsx # imports from ../../sub-components/...
94
94
  │ │ ├── types.ts # auto-generated (CLI-managed)
95
- │ │ └── styles.css # @import "../../sub-components/.../styles.css"
95
+ │ │ └── styles.css
96
96
  │ └── index.ts
97
97
  ├── sub-components/
98
98
  │ ├── ProductCard/
@@ -109,7 +109,6 @@ src/
109
109
  - `src/components/` = registered in ikas.config.json. `src/sub-components/` = internal helpers (NOT in ikas.config.json)
110
110
  - Sub-components do NOT have `types.ts` — define `Props` inline in `index.tsx`
111
111
  - Custom enum types are exported from `src/global-types.ts` (auto-generated). Sub-components can import them: `import type { MyEnum } from "../../global-types";`
112
- - CSS: use `@import "../../sub-components/ProductCard/styles.css";` in parent styles.css
113
112
  - TSX: use `import ProductCard from "../../sub-components/ProductCard";`
114
113
  - Sub-components should be wrapped with `observer()` from `@ikas/component-utils`
115
114
  - Sub-components can be shared across multiple parent sections
@@ -10,9 +10,9 @@ Never guess function signatures or type shapes — the MCP server is the source
10
10
 
11
11
  ## CRITICAL: Auto-Generated Files
12
12
 
13
- **NEVER manually create or edit `types.ts`** — it is auto-generated by CLI commands.
14
- Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage props.
15
- These commands update BOTH `ikas.config.json` AND `types.ts` automatically.
13
+ **NEVER manually create or edit `ikas.config.json`, `types.ts`, `global-types.ts`, or `src/components/index.ts`** — they are all auto-generated by CLI commands.
14
+ Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage components and props.
15
+ These commands update `ikas.config.json`, `types.ts`, `global-types.ts`, AND `src/components/index.ts` (including the component export) automatically.
16
16
 
17
17
  **The CLI does NOT edit your component source.** `remove-prop` and `remove-enum` update `ikas.config.json` and the generated `types.ts` / `global-types.ts` only — `index.tsx`, sub-components, and `styles.css` are untouched. After removing a prop or enum, grep the source for the old identifier and clean up dead references yourself before building.
18
18
 
@@ -96,7 +96,7 @@ src/
96
96
  │ ├── ProductList/
97
97
  │ │ ├── index.tsx # imports from ../../sub-components/...
98
98
  │ │ ├── types.ts # auto-generated (CLI-managed)
99
- │ │ └── styles.css # @import "../../sub-components/.../styles.css"
99
+ │ │ └── styles.css
100
100
  │ └── index.ts
101
101
  └── sub-components/
102
102
  ├── ProductCard/
@@ -111,7 +111,6 @@ src/
111
111
 
112
112
  - `src/components/` = registered in ikas.config.json. `src/sub-components/` = internal helpers (NOT in ikas.config.json)
113
113
  - Sub-components do NOT have `types.ts` — define `Props` inline in `index.tsx`
114
- - CSS: use `@import "../../sub-components/ProductCard/styles.css";` in parent styles.css
115
114
  - TSX: use `import ProductCard from "../../sub-components/ProductCard";`
116
115
  - Sub-components that read MobX stores need `observer()`, others don't
117
116
  - Sub-components can be shared across multiple parent sections
@@ -185,7 +184,6 @@ The `.kombos-icon` base class uses `width: 1em; height: 1em` so icons scale with
185
184
 
186
185
  **CRITICAL: Never write custom button styles in components.** All buttons MUST use `src/sub-components/Button`.
187
186
  Import: `import Button from "../../sub-components/Button";`
188
- CSS import: `@import "../../sub-components/Button/styles.css";` in parent styles.css
189
187
 
190
188
  ### Variants
191
189
 
@@ -226,7 +224,6 @@ When placed in flex containers, add a layout class (e.g. `className="my-section_
226
224
 
227
225
  **CRITICAL: Never write custom input styles in components.** All text inputs MUST use `src/sub-components/Input`.
228
226
  Import: `import Input from "../../sub-components/Input";`
229
- CSS import: `@import "../../sub-components/Input/styles.css";` in parent styles.css
230
227
 
231
228
  Input is a pure input field — no label, no helper text. Wrap with `FormItem` for labels and validation messages.
232
229
 
@@ -267,7 +264,6 @@ import Input from "../../sub-components/Input";
267
264
 
268
265
  Wraps form controls (Input, select, etc.) with a label and helper/error text.
269
266
  Import: `import FormItem from "../../sub-components/FormItem";`
270
- CSS import: `@import "../../sub-components/FormItem/styles.css";` in parent styles.css
271
267
 
272
268
  ### Props
273
269
 
@@ -416,6 +412,25 @@ const CartBadge = observer(function CartBadge() {
416
412
  });
417
413
  ```
418
414
 
415
+ ```tsx
416
+ // ALSO wrap EXTRACTED HELPER COMPONENTS declared inside a component file —
417
+ // especially list items rendered via .map() that read/write MobX state
418
+ // (e.g., offer.isSelected, option.values). Without observer(), the helper
419
+ // won't re-render when the observable changes.
420
+ const OfferCard = observer(function OfferCard({ offer }) {
421
+ const isSelected = offer.isSelected;
422
+ return <div>{isSelected ? "ON" : "OFF"}</div>;
423
+ });
424
+
425
+ export function MySection({ product }: Props) {
426
+ return product.offers.map((offer) => (
427
+ <OfferCard key={offer.id} offer={offer} />
428
+ ));
429
+ }
430
+ ```
431
+
432
+ **Rule of thumb:** if a non-root component reads or writes MobX observables (store fields, `offer.isSelected`, `option.values`, etc.), wrap it with `observer()`. Without it, MobX mutations won't trigger re-renders.
433
+
419
434
  ### Null Safety
420
435
 
421
436
  ```tsx
@@ -69,7 +69,6 @@ These commands update BOTH `ikas.config.json` AND `types.ts` automatically.
69
69
  **ALWAYS create sub-components in `src/sub-components/` with their own folder containing `index.tsx` and `styles.css`.**
70
70
  - `src/components/` = registered in ikas.config.json. `src/sub-components/` = internal helpers (NOT in ikas.config.json)
71
71
  - Sub-components do NOT have `types.ts` — define `Props` inline in `index.tsx`
72
- - CSS: `@import "../../sub-components/ProductCard/styles.css";` in parent styles.css
73
72
  - TSX: `import ProductCard from "../../sub-components/ProductCard";`
74
73
  - Sub-components that read MobX stores need `observer()`, others don't
75
74
  - Sub-components can be shared across multiple parent sections