@hai3/react 0.4.0-alpha.0 → 0.4.0-alpha.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/commands/hai3-new-component.md +20 -48
- package/commands/hai3-new-mfe.md +2 -3
- package/commands/hai3-new-screen.md +11 -53
- package/commands/hai3-new-screenset.md +13 -51
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,75 +2,47 @@
|
|
|
2
2
|
# hai3:new-component - Add New UI Component
|
|
3
3
|
|
|
4
4
|
## AI WORKFLOW (REQUIRED)
|
|
5
|
-
1) Check
|
|
5
|
+
1) Check for existing equivalent in project (e.g. components/ui/) and configured UI library first.
|
|
6
6
|
2) Gather requirements from user.
|
|
7
|
-
3)
|
|
8
|
-
4) Create OpenSpec proposal for approval.
|
|
9
|
-
5) After approval, apply implementation.
|
|
7
|
+
3) Implement.
|
|
10
8
|
|
|
11
|
-
## CHECK
|
|
12
|
-
- REQUIRED:
|
|
13
|
-
-
|
|
9
|
+
## CHECK EXISTING COMPONENTS FIRST
|
|
10
|
+
- REQUIRED: Read `hai3.config.json` to find the `uikit` value.
|
|
11
|
+
- If uikit is a third-party package (not `shadcn` or `none`): read its exports from `node_modules/<package>/` to check for existing components.
|
|
12
|
+
- REQUIRED: Before creating a new component, scan the project AND the configured UI library for existing equivalents.
|
|
13
|
+
- REQUIRED: Reuse existing components if equivalent exists.
|
|
14
14
|
|
|
15
15
|
## GATHER REQUIREMENTS
|
|
16
16
|
Ask user for:
|
|
17
17
|
- Component name (e.g., "DataTable", "ColorPicker").
|
|
18
|
-
- Component type: screenset composite (default) | screenset base (rare).
|
|
19
18
|
- Component description and props.
|
|
20
|
-
- If screenset base: justification why composite is insufficient.
|
|
21
19
|
|
|
22
20
|
## IF SCREENSET COMPONENT
|
|
23
21
|
|
|
24
22
|
### STEP 0: Determine Subfolder
|
|
25
|
-
-
|
|
26
|
-
-
|
|
23
|
+
- components/ui/: Base UI primitives (shadcn components or custom).
|
|
24
|
+
- screens/{screen}/components/: Screen-specific components.
|
|
25
|
+
- components/: Shared composites used across screens.
|
|
27
26
|
|
|
28
|
-
### STEP 1:
|
|
29
|
-
Create openspec/changes/add-{screenset}-{component}/ with:
|
|
27
|
+
### STEP 1: Implementation
|
|
30
28
|
|
|
31
|
-
####
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
#### tasks.md
|
|
38
|
-
- Create component file in uikit/{base|composite}/.
|
|
39
|
-
- Implement props interface.
|
|
40
|
-
- Add theme token styling (or inline for base/).
|
|
41
|
-
- Export from local index if needed.
|
|
42
|
-
- Validate: npm run arch:check.
|
|
43
|
-
- Test in UI.
|
|
44
|
-
|
|
45
|
-
### STEP 2: Wait for Approval
|
|
46
|
-
Tell user: "Review proposal at openspec/changes/add-{screenset}-{component}/."
|
|
47
|
-
Tell user: "Run /openspec:apply add-{screenset}-{component} to implement."
|
|
48
|
-
|
|
49
|
-
### STEP 3: Apply Implementation (after approval)
|
|
50
|
-
When user runs /openspec:apply:
|
|
51
|
-
|
|
52
|
-
#### 3.1 Create Component
|
|
53
|
-
File: src/screensets/{screenset}/uikit/{base|composite}/{ComponentName}.tsx
|
|
54
|
-
- composite/: Use theme tokens only (no inline styles).
|
|
55
|
-
- base/: May use inline styles (rare, needs justification).
|
|
56
|
-
- Must be reusable within the screenset.
|
|
57
|
-
- NO @hai3/uicore imports (except types).
|
|
29
|
+
#### 1.1 Create Component
|
|
30
|
+
File: src/components/ui/{ComponentName}.tsx (base primitives)
|
|
31
|
+
or: src/screens/{screen}/components/{ComponentName}.tsx (screen-specific)
|
|
32
|
+
or: src/components/{ComponentName}.tsx (shared composites)
|
|
33
|
+
- Must be reusable within the MFE.
|
|
58
34
|
- NO Redux or state management.
|
|
59
35
|
- Accept value/onChange pattern for state.
|
|
60
36
|
|
|
61
|
-
####
|
|
37
|
+
#### 1.2 Export
|
|
62
38
|
Export from local index if needed.
|
|
63
39
|
|
|
64
|
-
####
|
|
40
|
+
#### 1.3 Validation
|
|
65
41
|
Run: npm run arch:check && npm run dev
|
|
66
42
|
Test component in UI.
|
|
67
43
|
|
|
68
|
-
#### 3.4 Mark Tasks Complete
|
|
69
|
-
Update tasks.md to mark all completed tasks.
|
|
70
|
-
|
|
71
44
|
## RULES
|
|
72
|
-
- REQUIRED: Check
|
|
73
|
-
- REQUIRED: Screenset base components need strong justification.
|
|
45
|
+
- REQUIRED: Check existing project UI components first; create new only if missing.
|
|
74
46
|
- FORBIDDEN: Redux, business logic, side effects in components.
|
|
75
|
-
- FORBIDDEN: Inline styles outside
|
|
47
|
+
- FORBIDDEN: Inline styles outside components/ui/.
|
|
76
48
|
- REQUIRED: Accept value/onChange pattern for state.
|
package/commands/hai3-new-mfe.md
CHANGED
|
@@ -76,9 +76,8 @@ class Lifecycle extends ThemeAwareReactLifecycle {
|
|
|
76
76
|
const div = document.createElement('div');
|
|
77
77
|
shadowRoot.appendChild(div);
|
|
78
78
|
|
|
79
|
-
// Initialize Tailwind/UIKit styles
|
|
80
79
|
const style = document.createElement('style');
|
|
81
|
-
style.textContent = tailwindStyles;
|
|
80
|
+
style.textContent = tailwindStyles;
|
|
82
81
|
shadowRoot.appendChild(style);
|
|
83
82
|
|
|
84
83
|
// Render component
|
|
@@ -151,7 +150,7 @@ npm run dev:all
|
|
|
151
150
|
- Set `preview` script with `--port NNNN` for port auto-discovery
|
|
152
151
|
- Use mock data with useState for UI-only MFEs
|
|
153
152
|
- Keep MFE logic isolated and simple
|
|
154
|
-
- Use
|
|
153
|
+
- Use local components (e.g. components/ui/)
|
|
155
154
|
- Run `npm run generate:mfe-manifests` after creating the MFE
|
|
156
155
|
|
|
157
156
|
❌ **DON'T:**
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
<!-- @standalone -->
|
|
2
2
|
# hai3:new-screen - Add New Screen
|
|
3
3
|
|
|
4
|
-
## PREREQUISITES (CRITICAL - STOP IF FAILED)
|
|
5
|
-
FORBIDDEN: Proceeding without proposal.
|
|
6
|
-
FORBIDDEN: Creating screen manually without OpenSpec workflow.
|
|
7
|
-
|
|
8
4
|
## AI WORKFLOW (REQUIRED)
|
|
9
5
|
1) Read .ai/targets/SCREENSETS.md and .ai/targets/EVENTS.md before starting.
|
|
10
6
|
2) Gather requirements from user (including UI sections).
|
|
11
|
-
3)
|
|
12
|
-
4) After approval, implement via `.claude/commands/openspec-apply.md` (REQUIRED).
|
|
7
|
+
3) Implement.
|
|
13
8
|
|
|
14
9
|
## GATHER REQUIREMENTS
|
|
15
10
|
Ask user for:
|
|
@@ -18,53 +13,7 @@ Ask user for:
|
|
|
18
13
|
- UI sections (e.g., "header, form, data table").
|
|
19
14
|
- Add to menu? (Y/N)
|
|
20
15
|
|
|
21
|
-
## STEP 1:
|
|
22
|
-
Execute openspec:proposal command (see `.claude/commands/openspec-proposal.md`).
|
|
23
|
-
Proposal name: `add-{screenset}-{screen}`
|
|
24
|
-
|
|
25
|
-
### proposal.md content
|
|
26
|
-
```
|
|
27
|
-
# Proposal: Add {ScreenName} Screen
|
|
28
|
-
|
|
29
|
-
## Summary
|
|
30
|
-
Add new screen "{screenName}" to {screenset} screenset.
|
|
31
|
-
|
|
32
|
-
## Details
|
|
33
|
-
- Screenset: {screenset}
|
|
34
|
-
- Screen name: {screenName}
|
|
35
|
-
- Add to menu: {Y/N}
|
|
36
|
-
|
|
37
|
-
## Component Plan
|
|
38
|
-
- REQUIRED: Use @hai3/uikit components first; local uikit only if missing.
|
|
39
|
-
- uikit/base/: rare primitives (inline styles allowed, needs justification)
|
|
40
|
-
- uikit/composite/: screenset composites (theme tokens only)
|
|
41
|
-
- screens/{screen}/components/: screen-specific components
|
|
42
|
-
|
|
43
|
-
## Data Flow
|
|
44
|
-
- Uses existing screenset events/slices per EVENTS.md
|
|
45
|
-
- Screen dispatches actions, never direct slice updates
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### tasks.md minimum required tasks
|
|
49
|
-
NOTE: Proposal may include additional tasks, but MUST include these:
|
|
50
|
-
```
|
|
51
|
-
- [ ] Add screen ID to ids.ts
|
|
52
|
-
- [ ] Create components per Component Plan (BEFORE screen file)
|
|
53
|
-
- [ ] Create screen (orchestrates components, follows EVENTS.md data flow)
|
|
54
|
-
- [ ] Add i18n files for all languages
|
|
55
|
-
- [ ] Add to menu (if requested)
|
|
56
|
-
- [ ] Validate: `npm run type-check && npm run lint`
|
|
57
|
-
- [ ] Test via Chrome DevTools MCP
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## STEP 2: Wait for Approval
|
|
61
|
-
Tell user: "Review proposal at `openspec/changes/add-{screenset}-{screen}/`."
|
|
62
|
-
Tell user: "Execute openspec:apply command to implement."
|
|
63
|
-
|
|
64
|
-
## STEP 3: Implementation (via openspec:apply)
|
|
65
|
-
BEFORE executing openspec:apply, verify tasks.md contains all minimum required tasks above.
|
|
66
|
-
Execute openspec:apply command (see `.claude/commands/openspec-apply.md`).
|
|
67
|
-
Follow tasks.md strictly:
|
|
16
|
+
## STEP 1: Implementation
|
|
68
17
|
1) Add screen ID to ids.ts.
|
|
69
18
|
2) Create components BEFORE screen file per Component Plan.
|
|
70
19
|
3) Create screen following data flow rules from .ai/targets/EVENTS.md:
|
|
@@ -79,3 +28,12 @@ Follow tasks.md strictly:
|
|
|
79
28
|
- Test UI interactions and data flow
|
|
80
29
|
- Verify translations load correctly
|
|
81
30
|
- STOP if MCP connection fails
|
|
31
|
+
|
|
32
|
+
## COMPONENT PLAN
|
|
33
|
+
- REQUIRED: Use local components (e.g. `components/ui/`) — no shared UI kit package.
|
|
34
|
+
- components/ui/: base UI primitives (shadcn components or custom)
|
|
35
|
+
- screens/{screen}/components/: screen-specific components
|
|
36
|
+
|
|
37
|
+
## DATA FLOW
|
|
38
|
+
- Uses existing screenset events/slices per EVENTS.md
|
|
39
|
+
- Screen dispatches actions, never direct slice updates
|
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
## PREREQUISITES (CRITICAL - STOP IF FAILED)
|
|
5
5
|
Run `hai3 --version`.
|
|
6
6
|
STOP: If fails, tell user to install.
|
|
7
|
-
FORBIDDEN: Proceeding without CLI tools.
|
|
8
7
|
FORBIDDEN: Creating screenset manually or by copying peers.
|
|
9
8
|
|
|
10
9
|
## AI WORKFLOW (REQUIRED)
|
|
11
10
|
1) Check prerequisites above.
|
|
12
11
|
2) Read .ai/targets/SCREENSETS.md and .ai/targets/EVENTS.md before starting.
|
|
13
12
|
3) Gather requirements from user (including UI sections).
|
|
14
|
-
4)
|
|
15
|
-
5) After approval, implement via `.claude/commands/openspec-apply.md` (REQUIRED).
|
|
13
|
+
4) Implement.
|
|
16
14
|
|
|
17
15
|
## GATHER REQUIREMENTS
|
|
18
16
|
Ask user for:
|
|
@@ -21,54 +19,7 @@ Ask user for:
|
|
|
21
19
|
- Initial screens.
|
|
22
20
|
- UI sections per screen (e.g., "stats cards, charts, activity feed").
|
|
23
21
|
|
|
24
|
-
## STEP 1:
|
|
25
|
-
Execute openspec:proposal command (see `.claude/commands/openspec-proposal.md`).
|
|
26
|
-
Proposal name: `add-{screenset-name}`
|
|
27
|
-
|
|
28
|
-
### proposal.md content
|
|
29
|
-
```
|
|
30
|
-
# Proposal: Add {ScreensetName} Screenset
|
|
31
|
-
|
|
32
|
-
## Summary
|
|
33
|
-
Add new {category} screenset "{screensetName}" with {screens} screen(s).
|
|
34
|
-
|
|
35
|
-
## Details
|
|
36
|
-
- Name: {screensetName}
|
|
37
|
-
- Category: {category}
|
|
38
|
-
- Initial screens: {screens}
|
|
39
|
-
|
|
40
|
-
## Component Plan
|
|
41
|
-
- REQUIRED: Use @hai3/uikit components first; local uikit only if missing.
|
|
42
|
-
- uikit/base/: rare primitives (inline styles allowed, needs justification)
|
|
43
|
-
- uikit/composite/: screenset composites (theme tokens only)
|
|
44
|
-
- components/: multi-screen components
|
|
45
|
-
- screens/{screen}/components/: screen-specific components
|
|
46
|
-
|
|
47
|
-
## Data Flow
|
|
48
|
-
- Events: {domain events per EVENTS.md}
|
|
49
|
-
- State: slices/, events/, effects/, actions/
|
|
50
|
-
- API: api/{Name}ApiService.ts with mocks
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### tasks.md minimum required tasks
|
|
54
|
-
NOTE: Proposal may include additional tasks, but MUST include these:
|
|
55
|
-
```
|
|
56
|
-
- [ ] Create screenset: `hai3 screenset create {name} --category={category}`
|
|
57
|
-
- [ ] Create components per Component Plan (BEFORE screen file)
|
|
58
|
-
- [ ] Implement data flow per EVENTS.md (actions emit events, effects update slices)
|
|
59
|
-
- [ ] Add API service with mocks
|
|
60
|
-
- [ ] Validate: `npm run type-check && npm run arch:check && npm run lint`
|
|
61
|
-
- [ ] Test via Chrome DevTools MCP
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## STEP 2: Wait for Approval
|
|
65
|
-
Tell user: "Review proposal at `openspec/changes/add-{screenset-name}/`."
|
|
66
|
-
Tell user: "Execute openspec:apply command to implement."
|
|
67
|
-
|
|
68
|
-
## STEP 3: Implementation (via openspec:apply)
|
|
69
|
-
BEFORE executing openspec:apply, verify tasks.md contains all minimum required tasks above.
|
|
70
|
-
Execute openspec:apply command (see `.claude/commands/openspec-apply.md`).
|
|
71
|
-
Follow tasks.md strictly:
|
|
22
|
+
## STEP 1: Implementation
|
|
72
23
|
1) Create screenset via `hai3 screenset create` (REQUIRED).
|
|
73
24
|
2) Create components BEFORE screen file per Component Plan.
|
|
74
25
|
3) Implement data flow per .ai/targets/EVENTS.md:
|
|
@@ -83,3 +34,14 @@ Follow tasks.md strictly:
|
|
|
83
34
|
- Test user interactions trigger correct events
|
|
84
35
|
- Verify state updates via Redux DevTools
|
|
85
36
|
- STOP if MCP connection fails
|
|
37
|
+
|
|
38
|
+
## COMPONENT PLAN
|
|
39
|
+
- REQUIRED: Use local components (e.g. `components/ui/`) — no shared UI kit package.
|
|
40
|
+
- components/ui/: base UI primitives (shadcn components or custom)
|
|
41
|
+
- components/: multi-screen shared components
|
|
42
|
+
- screens/{screen}/components/: screen-specific components
|
|
43
|
+
|
|
44
|
+
## DATA FLOW
|
|
45
|
+
- Events: {domain events per EVENTS.md}
|
|
46
|
+
- State: slices/, events/, effects/, actions/
|
|
47
|
+
- API: api/{Name}ApiService.ts with mocks
|
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ __export(src_exports, {
|
|
|
32
32
|
HAI3_ACTION_LOAD_EXT: () => import_framework13.HAI3_ACTION_LOAD_EXT,
|
|
33
33
|
HAI3_ACTION_MOUNT_EXT: () => import_framework13.HAI3_ACTION_MOUNT_EXT,
|
|
34
34
|
HAI3_ACTION_UNMOUNT_EXT: () => import_framework13.HAI3_ACTION_UNMOUNT_EXT,
|
|
35
|
+
HAI3_MFE_ENTRY_MF: () => import_framework12.HAI3_MFE_ENTRY_MF,
|
|
35
36
|
HAI3_OVERLAY_DOMAIN: () => import_framework11.HAI3_OVERLAY_DOMAIN,
|
|
36
37
|
HAI3_POPUP_DOMAIN: () => import_framework11.HAI3_POPUP_DOMAIN,
|
|
37
38
|
HAI3_SCREEN_DOMAIN: () => import_framework11.HAI3_SCREEN_DOMAIN,
|
|
@@ -80,13 +81,14 @@ __export(src_exports, {
|
|
|
80
81
|
createHAI3: () => import_framework6.createHAI3,
|
|
81
82
|
createHAI3App: () => import_framework6.createHAI3App,
|
|
82
83
|
createI18nRegistry: () => import_framework6.createI18nRegistry,
|
|
83
|
-
createShadowRoot: () =>
|
|
84
|
+
createShadowRoot: () => import_framework18.createShadowRoot,
|
|
84
85
|
createSlice: () => import_framework6.createSlice,
|
|
85
86
|
createStore: () => import_framework6.createStore,
|
|
86
87
|
createThemeRegistry: () => import_framework6.createThemeRegistry,
|
|
87
88
|
effects: () => import_framework6.effects,
|
|
88
89
|
eventBus: () => eventBus,
|
|
89
|
-
|
|
90
|
+
extensionScreenSchema: () => import_framework17.extensionScreenSchema,
|
|
91
|
+
extractGtsPackage: () => import_framework18.extractGtsPackage,
|
|
90
92
|
footerActions: () => import_framework6.footerActions,
|
|
91
93
|
footerSlice: () => import_framework6.footerSlice,
|
|
92
94
|
getLanguageMetadata: () => import_framework6.getLanguageMetadata,
|
|
@@ -100,11 +102,12 @@ __export(src_exports, {
|
|
|
100
102
|
i18nRegistry: () => import_framework6.i18nRegistry,
|
|
101
103
|
initMockEffects: () => import_framework6.initMockEffects,
|
|
102
104
|
initTenantEffects: () => import_framework6.initTenantEffects,
|
|
103
|
-
injectCssVariables: () =>
|
|
105
|
+
injectCssVariables: () => import_framework18.injectCssVariables,
|
|
104
106
|
isMockPlugin: () => import_framework6.isMockPlugin,
|
|
105
107
|
isRestShortCircuit: () => import_framework6.isRestShortCircuit,
|
|
106
108
|
isShortCircuit: () => import_framework6.isShortCircuit,
|
|
107
109
|
isSseShortCircuit: () => import_framework6.isSseShortCircuit,
|
|
110
|
+
languageSchema: () => import_framework17.languageSchema,
|
|
108
111
|
layout: () => import_framework6.layout,
|
|
109
112
|
layoutDomainReducers: () => import_framework6.layoutDomainReducers,
|
|
110
113
|
layoutReducer: () => import_framework6.layoutReducer,
|
|
@@ -164,6 +167,7 @@ __export(src_exports, {
|
|
|
164
167
|
tenantActions: () => import_framework6.tenantActions,
|
|
165
168
|
tenantReducer: () => import_framework6.tenantReducer,
|
|
166
169
|
tenantSlice: () => import_framework6.tenantSlice,
|
|
170
|
+
themeSchema: () => import_framework17.themeSchema,
|
|
167
171
|
themes: () => import_framework6.themes,
|
|
168
172
|
toggleMenu: () => import_framework6.toggleMenu,
|
|
169
173
|
toggleMockMode: () => import_framework6.toggleMockMode,
|
|
@@ -723,7 +727,8 @@ var import_framework15 = require("@hai3/framework");
|
|
|
723
727
|
var import_framework16 = require("@hai3/framework");
|
|
724
728
|
var import_framework17 = require("@hai3/framework");
|
|
725
729
|
var import_framework18 = require("@hai3/framework");
|
|
726
|
-
var
|
|
730
|
+
var import_framework19 = require("@hai3/framework");
|
|
731
|
+
var eventBus = import_framework19.eventBus;
|
|
727
732
|
// Annotate the CommonJS export names for ESM import in node:
|
|
728
733
|
0 && (module.exports = {
|
|
729
734
|
ACCOUNTS_DOMAIN,
|
|
@@ -738,6 +743,7 @@ var eventBus = import_framework18.eventBus;
|
|
|
738
743
|
HAI3_ACTION_LOAD_EXT,
|
|
739
744
|
HAI3_ACTION_MOUNT_EXT,
|
|
740
745
|
HAI3_ACTION_UNMOUNT_EXT,
|
|
746
|
+
HAI3_MFE_ENTRY_MF,
|
|
741
747
|
HAI3_OVERLAY_DOMAIN,
|
|
742
748
|
HAI3_POPUP_DOMAIN,
|
|
743
749
|
HAI3_SCREEN_DOMAIN,
|
|
@@ -792,6 +798,7 @@ var eventBus = import_framework18.eventBus;
|
|
|
792
798
|
createThemeRegistry,
|
|
793
799
|
effects,
|
|
794
800
|
eventBus,
|
|
801
|
+
extensionScreenSchema,
|
|
795
802
|
extractGtsPackage,
|
|
796
803
|
footerActions,
|
|
797
804
|
footerSlice,
|
|
@@ -811,6 +818,7 @@ var eventBus = import_framework18.eventBus;
|
|
|
811
818
|
isRestShortCircuit,
|
|
812
819
|
isShortCircuit,
|
|
813
820
|
isSseShortCircuit,
|
|
821
|
+
languageSchema,
|
|
814
822
|
layout,
|
|
815
823
|
layoutDomainReducers,
|
|
816
824
|
layoutReducer,
|
|
@@ -870,6 +878,7 @@ var eventBus = import_framework18.eventBus;
|
|
|
870
878
|
tenantActions,
|
|
871
879
|
tenantReducer,
|
|
872
880
|
tenantSlice,
|
|
881
|
+
themeSchema,
|
|
873
882
|
themes,
|
|
874
883
|
toggleMenu,
|
|
875
884
|
toggleMockMode,
|