@easyops-cn/a2ui-react 0.0.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.
Files changed (161) hide show
  1. package/.claude/commands/speckit.analyze.md +184 -0
  2. package/.claude/commands/speckit.checklist.md +294 -0
  3. package/.claude/commands/speckit.clarify.md +181 -0
  4. package/.claude/commands/speckit.constitution.md +82 -0
  5. package/.claude/commands/speckit.implement.md +135 -0
  6. package/.claude/commands/speckit.plan.md +89 -0
  7. package/.claude/commands/speckit.specify.md +256 -0
  8. package/.claude/commands/speckit.tasks.md +137 -0
  9. package/.claude/commands/speckit.taskstoissues.md +30 -0
  10. package/.github/workflows/deploy.yml +69 -0
  11. package/.husky/pre-commit +1 -0
  12. package/.prettierignore +4 -0
  13. package/.prettierrc +7 -0
  14. package/.specify/memory/constitution.md +73 -0
  15. package/.specify/scripts/bash/check-prerequisites.sh +166 -0
  16. package/.specify/scripts/bash/common.sh +156 -0
  17. package/.specify/scripts/bash/create-new-feature.sh +297 -0
  18. package/.specify/scripts/bash/setup-plan.sh +61 -0
  19. package/.specify/scripts/bash/update-agent-context.sh +799 -0
  20. package/.specify/templates/agent-file-template.md +28 -0
  21. package/.specify/templates/checklist-template.md +40 -0
  22. package/.specify/templates/plan-template.md +105 -0
  23. package/.specify/templates/spec-template.md +115 -0
  24. package/.specify/templates/tasks-template.md +250 -0
  25. package/CLAUDE.md +105 -0
  26. package/CONTRIBUTING.md +97 -0
  27. package/README.md +126 -0
  28. package/components.json +21 -0
  29. package/eslint.config.js +25 -0
  30. package/netlify.toml +50 -0
  31. package/package.json +94 -0
  32. package/playground/README.md +75 -0
  33. package/playground/index.html +22 -0
  34. package/playground/package.json +32 -0
  35. package/playground/public/favicon.svg +8 -0
  36. package/playground/src/App.css +256 -0
  37. package/playground/src/App.tsx +115 -0
  38. package/playground/src/assets/react.svg +1 -0
  39. package/playground/src/components/ErrorDisplay.tsx +13 -0
  40. package/playground/src/components/ExampleSelector.tsx +64 -0
  41. package/playground/src/components/Header.tsx +47 -0
  42. package/playground/src/components/JsonEditor.tsx +32 -0
  43. package/playground/src/components/Preview.tsx +78 -0
  44. package/playground/src/components/ThemeToggle.tsx +19 -0
  45. package/playground/src/data/examples.ts +1571 -0
  46. package/playground/src/hooks/useTheme.ts +55 -0
  47. package/playground/src/index.css +220 -0
  48. package/playground/src/main.tsx +10 -0
  49. package/playground/tsconfig.app.json +34 -0
  50. package/playground/tsconfig.json +13 -0
  51. package/playground/tsconfig.node.json +26 -0
  52. package/playground/vite.config.ts +31 -0
  53. package/specs/001-a2ui-renderer/checklists/requirements.md +41 -0
  54. package/specs/001-a2ui-renderer/data-model.md +140 -0
  55. package/specs/001-a2ui-renderer/plan.md +123 -0
  56. package/specs/001-a2ui-renderer/quickstart.md +141 -0
  57. package/specs/001-a2ui-renderer/research.md +140 -0
  58. package/specs/001-a2ui-renderer/spec.md +165 -0
  59. package/specs/001-a2ui-renderer/tasks.md +310 -0
  60. package/specs/002-playground/checklists/requirements.md +37 -0
  61. package/specs/002-playground/contracts/components.md +120 -0
  62. package/specs/002-playground/data-model.md +149 -0
  63. package/specs/002-playground/plan.md +73 -0
  64. package/specs/002-playground/quickstart.md +158 -0
  65. package/specs/002-playground/research.md +117 -0
  66. package/specs/002-playground/spec.md +109 -0
  67. package/specs/002-playground/tasks.md +224 -0
  68. package/src/0.8/A2UIRender.test.tsx +793 -0
  69. package/src/0.8/A2UIRender.tsx +142 -0
  70. package/src/0.8/components/ComponentRenderer.test.tsx +373 -0
  71. package/src/0.8/components/ComponentRenderer.tsx +163 -0
  72. package/src/0.8/components/UnknownComponent.tsx +49 -0
  73. package/src/0.8/components/display/AudioPlayerComponent.tsx +37 -0
  74. package/src/0.8/components/display/DividerComponent.tsx +23 -0
  75. package/src/0.8/components/display/IconComponent.tsx +137 -0
  76. package/src/0.8/components/display/ImageComponent.tsx +57 -0
  77. package/src/0.8/components/display/TextComponent.tsx +56 -0
  78. package/src/0.8/components/display/VideoComponent.tsx +31 -0
  79. package/src/0.8/components/display/display.test.tsx +660 -0
  80. package/src/0.8/components/display/index.ts +10 -0
  81. package/src/0.8/components/index.ts +14 -0
  82. package/src/0.8/components/interactive/ButtonComponent.tsx +44 -0
  83. package/src/0.8/components/interactive/CheckBoxComponent.tsx +45 -0
  84. package/src/0.8/components/interactive/DateTimeInputComponent.tsx +176 -0
  85. package/src/0.8/components/interactive/MultipleChoiceComponent.tsx +157 -0
  86. package/src/0.8/components/interactive/SliderComponent.tsx +53 -0
  87. package/src/0.8/components/interactive/TextFieldComponent.tsx +65 -0
  88. package/src/0.8/components/interactive/index.ts +10 -0
  89. package/src/0.8/components/interactive/interactive.test.tsx +618 -0
  90. package/src/0.8/components/layout/CardComponent.tsx +30 -0
  91. package/src/0.8/components/layout/ColumnComponent.tsx +93 -0
  92. package/src/0.8/components/layout/ListComponent.tsx +81 -0
  93. package/src/0.8/components/layout/ModalComponent.tsx +41 -0
  94. package/src/0.8/components/layout/RowComponent.tsx +94 -0
  95. package/src/0.8/components/layout/TabsComponent.tsx +59 -0
  96. package/src/0.8/components/layout/index.ts +10 -0
  97. package/src/0.8/components/layout/layout.test.tsx +558 -0
  98. package/src/0.8/contexts/A2UIProvider.test.tsx +226 -0
  99. package/src/0.8/contexts/A2UIProvider.tsx +54 -0
  100. package/src/0.8/contexts/ActionContext.test.tsx +242 -0
  101. package/src/0.8/contexts/ActionContext.tsx +105 -0
  102. package/src/0.8/contexts/ComponentsMapContext.tsx +125 -0
  103. package/src/0.8/contexts/DataModelContext.test.tsx +335 -0
  104. package/src/0.8/contexts/DataModelContext.tsx +184 -0
  105. package/src/0.8/contexts/SurfaceContext.test.tsx +339 -0
  106. package/src/0.8/contexts/SurfaceContext.tsx +197 -0
  107. package/src/0.8/hooks/useA2UIMessageHandler.test.tsx +399 -0
  108. package/src/0.8/hooks/useA2UIMessageHandler.ts +123 -0
  109. package/src/0.8/hooks/useComponent.test.tsx +148 -0
  110. package/src/0.8/hooks/useComponent.ts +39 -0
  111. package/src/0.8/hooks/useDataBinding.test.tsx +334 -0
  112. package/src/0.8/hooks/useDataBinding.ts +99 -0
  113. package/src/0.8/hooks/useDispatchAction.test.tsx +83 -0
  114. package/src/0.8/hooks/useDispatchAction.ts +35 -0
  115. package/src/0.8/hooks/useSurface.test.tsx +114 -0
  116. package/src/0.8/hooks/useSurface.ts +34 -0
  117. package/src/0.8/index.ts +38 -0
  118. package/src/0.8/schemas/client_to_server.json +50 -0
  119. package/src/0.8/schemas/server_to_client.json +148 -0
  120. package/src/0.8/schemas/standard_catalog_definition.json +661 -0
  121. package/src/0.8/types/index.ts +448 -0
  122. package/src/0.8/utils/dataBinding.test.ts +443 -0
  123. package/src/0.8/utils/dataBinding.ts +212 -0
  124. package/src/0.8/utils/pathUtils.test.ts +353 -0
  125. package/src/0.8/utils/pathUtils.ts +200 -0
  126. package/src/components/ui/button.tsx +62 -0
  127. package/src/components/ui/calendar.tsx +220 -0
  128. package/src/components/ui/card.tsx +92 -0
  129. package/src/components/ui/checkbox.tsx +30 -0
  130. package/src/components/ui/dialog.tsx +141 -0
  131. package/src/components/ui/input.tsx +21 -0
  132. package/src/components/ui/label.tsx +22 -0
  133. package/src/components/ui/native-select.tsx +53 -0
  134. package/src/components/ui/popover.tsx +46 -0
  135. package/src/components/ui/select.tsx +188 -0
  136. package/src/components/ui/separator.tsx +26 -0
  137. package/src/components/ui/slider.tsx +61 -0
  138. package/src/components/ui/tabs.tsx +64 -0
  139. package/src/components/ui/textarea.tsx +18 -0
  140. package/src/index.ts +1 -0
  141. package/src/lib/utils.ts +6 -0
  142. package/tsconfig.json +28 -0
  143. package/vite.config.ts +29 -0
  144. package/vitest.config.ts +22 -0
  145. package/vitest.setup.ts +8 -0
  146. package/website/README.md +4 -0
  147. package/website/assets/favicon.svg +8 -0
  148. package/website/content/.gitkeep +0 -0
  149. package/website/content/index.md +122 -0
  150. package/website/global.d.ts +9 -0
  151. package/website/package.json +17 -0
  152. package/website/plain.config.js +28 -0
  153. package/website/serve.json +6 -0
  154. package/website/src/client/color-mode-switch.css +47 -0
  155. package/website/src/client/index.js +61 -0
  156. package/website/src/client/moon.svg +1 -0
  157. package/website/src/client/sun.svg +1 -0
  158. package/website/src/components/Footer.jsx +9 -0
  159. package/website/src/components/Header.jsx +44 -0
  160. package/website/src/components/Page.jsx +28 -0
  161. package/website/src/global.css +423 -0
@@ -0,0 +1,28 @@
1
+ # [PROJECT NAME] Development Guidelines
2
+
3
+ Auto-generated from all feature plans. Last updated: [DATE]
4
+
5
+ ## Active Technologies
6
+
7
+ [EXTRACTED FROM ALL PLAN.MD FILES]
8
+
9
+ ## Project Structure
10
+
11
+ ```text
12
+ [ACTUAL STRUCTURE FROM PLANS]
13
+ ```
14
+
15
+ ## Commands
16
+
17
+ [ONLY COMMANDS FOR ACTIVE TECHNOLOGIES]
18
+
19
+ ## Code Style
20
+
21
+ [LANGUAGE-SPECIFIC, ONLY FOR LANGUAGES IN USE]
22
+
23
+ ## Recent Changes
24
+
25
+ [LAST 3 FEATURES AND WHAT THEY ADDED]
26
+
27
+ <!-- MANUAL ADDITIONS START -->
28
+ <!-- MANUAL ADDITIONS END -->
@@ -0,0 +1,40 @@
1
+ # [CHECKLIST TYPE] Checklist: [FEATURE NAME]
2
+
3
+ **Purpose**: [Brief description of what this checklist covers]
4
+ **Created**: [DATE]
5
+ **Feature**: [Link to spec.md or relevant documentation]
6
+
7
+ **Note**: This checklist is generated by the `/speckit.checklist` command based on feature context and requirements.
8
+
9
+ <!--
10
+ ============================================================================
11
+ IMPORTANT: The checklist items below are SAMPLE ITEMS for illustration only.
12
+
13
+ The /speckit.checklist command MUST replace these with actual items based on:
14
+ - User's specific checklist request
15
+ - Feature requirements from spec.md
16
+ - Technical context from plan.md
17
+ - Implementation details from tasks.md
18
+
19
+ DO NOT keep these sample items in the generated checklist file.
20
+ ============================================================================
21
+ -->
22
+
23
+ ## [Category 1]
24
+
25
+ - [ ] CHK001 First checklist item with clear action
26
+ - [ ] CHK002 Second checklist item
27
+ - [ ] CHK003 Third checklist item
28
+
29
+ ## [Category 2]
30
+
31
+ - [ ] CHK004 Another category item
32
+ - [ ] CHK005 Item with specific criteria
33
+ - [ ] CHK006 Final item in this category
34
+
35
+ ## Notes
36
+
37
+ - Check items off as completed: `[x]`
38
+ - Add comments or findings inline
39
+ - Link to relevant resources or documentation
40
+ - Items are numbered sequentially for easy reference
@@ -0,0 +1,105 @@
1
+ # Implementation Plan: [FEATURE]
2
+
3
+ **Branch**: `[###-feature-name]` | **Date**: [DATE] | **Spec**: [link]
4
+ **Input**: Feature specification from `/specs/[###-feature-name]/spec.md`
5
+
6
+ **Note**: This template is filled in by the `/speckit.plan` command. See `.specify/templates/commands/plan.md` for the execution workflow.
7
+
8
+ ## Summary
9
+
10
+ [Extract from feature spec: primary requirement + technical approach from research]
11
+
12
+ ## Technical Context
13
+
14
+ <!--
15
+ ACTION REQUIRED: Replace the content in this section with the technical details
16
+ for the project. The structure here is presented in advisory capacity to guide
17
+ the iteration process.
18
+ -->
19
+
20
+ **Language/Version**: [e.g., Python 3.11, Swift 5.9, Rust 1.75 or NEEDS CLARIFICATION]
21
+ **Primary Dependencies**: [e.g., FastAPI, UIKit, LLVM or NEEDS CLARIFICATION]
22
+ **Storage**: [if applicable, e.g., PostgreSQL, CoreData, files or N/A]
23
+ **Testing**: [e.g., pytest, XCTest, cargo test or NEEDS CLARIFICATION]
24
+ **Target Platform**: [e.g., Linux server, iOS 15+, WASM or NEEDS CLARIFICATION]
25
+ **Project Type**: [single/web/mobile - determines source structure]
26
+ **Performance Goals**: [domain-specific, e.g., 1000 req/s, 10k lines/sec, 60 fps or NEEDS CLARIFICATION]
27
+ **Constraints**: [domain-specific, e.g., <200ms p95, <100MB memory, offline-capable or NEEDS CLARIFICATION]
28
+ **Scale/Scope**: [domain-specific, e.g., 10k users, 1M LOC, 50 screens or NEEDS CLARIFICATION]
29
+
30
+ ## Constitution Check
31
+
32
+ _GATE: Must pass before Phase 0 research. Re-check after Phase 1 design._
33
+
34
+ [Gates determined based on constitution file]
35
+
36
+ ## Project Structure
37
+
38
+ ### Documentation (this feature)
39
+
40
+ ```text
41
+ specs/[###-feature]/
42
+ ├── plan.md # This file (/speckit.plan command output)
43
+ ├── research.md # Phase 0 output (/speckit.plan command)
44
+ ├── data-model.md # Phase 1 output (/speckit.plan command)
45
+ ├── quickstart.md # Phase 1 output (/speckit.plan command)
46
+ ├── contracts/ # Phase 1 output (/speckit.plan command)
47
+ └── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan)
48
+ ```
49
+
50
+ ### Source Code (repository root)
51
+
52
+ <!--
53
+ ACTION REQUIRED: Replace the placeholder tree below with the concrete layout
54
+ for this feature. Delete unused options and expand the chosen structure with
55
+ real paths (e.g., apps/admin, packages/something). The delivered plan must
56
+ not include Option labels.
57
+ -->
58
+
59
+ ```text
60
+ # [REMOVE IF UNUSED] Option 1: Single project (DEFAULT)
61
+ src/
62
+ ├── models/
63
+ ├── services/
64
+ ├── cli/
65
+ └── lib/
66
+
67
+ tests/
68
+ ├── contract/
69
+ ├── integration/
70
+ └── unit/
71
+
72
+ # [REMOVE IF UNUSED] Option 2: Web application (when "frontend" + "backend" detected)
73
+ backend/
74
+ ├── src/
75
+ │ ├── models/
76
+ │ ├── services/
77
+ │ └── api/
78
+ └── tests/
79
+
80
+ frontend/
81
+ ├── src/
82
+ │ ├── components/
83
+ │ ├── pages/
84
+ │ └── services/
85
+ └── tests/
86
+
87
+ # [REMOVE IF UNUSED] Option 3: Mobile + API (when "iOS/Android" detected)
88
+ api/
89
+ └── [same as backend above]
90
+
91
+ ios/ or android/
92
+ └── [platform-specific structure: feature modules, UI flows, platform tests]
93
+ ```
94
+
95
+ **Structure Decision**: [Document the selected structure and reference the real
96
+ directories captured above]
97
+
98
+ ## Complexity Tracking
99
+
100
+ > **Fill ONLY if Constitution Check has violations that must be justified**
101
+
102
+ | Violation | Why Needed | Simpler Alternative Rejected Because |
103
+ | -------------------------- | ------------------ | ------------------------------------ |
104
+ | [e.g., 4th project] | [current need] | [why 3 projects insufficient] |
105
+ | [e.g., Repository pattern] | [specific problem] | [why direct DB access insufficient] |
@@ -0,0 +1,115 @@
1
+ # Feature Specification: [FEATURE NAME]
2
+
3
+ **Feature Branch**: `[###-feature-name]`
4
+ **Created**: [DATE]
5
+ **Status**: Draft
6
+ **Input**: User description: "$ARGUMENTS"
7
+
8
+ ## User Scenarios & Testing _(mandatory)_
9
+
10
+ <!--
11
+ IMPORTANT: User stories should be PRIORITIZED as user journeys ordered by importance.
12
+ Each user story/journey must be INDEPENDENTLY TESTABLE - meaning if you implement just ONE of them,
13
+ you should still have a viable MVP (Minimum Viable Product) that delivers value.
14
+
15
+ Assign priorities (P1, P2, P3, etc.) to each story, where P1 is the most critical.
16
+ Think of each story as a standalone slice of functionality that can be:
17
+ - Developed independently
18
+ - Tested independently
19
+ - Deployed independently
20
+ - Demonstrated to users independently
21
+ -->
22
+
23
+ ### User Story 1 - [Brief Title] (Priority: P1)
24
+
25
+ [Describe this user journey in plain language]
26
+
27
+ **Why this priority**: [Explain the value and why it has this priority level]
28
+
29
+ **Independent Test**: [Describe how this can be tested independently - e.g., "Can be fully tested by [specific action] and delivers [specific value]"]
30
+
31
+ **Acceptance Scenarios**:
32
+
33
+ 1. **Given** [initial state], **When** [action], **Then** [expected outcome]
34
+ 2. **Given** [initial state], **When** [action], **Then** [expected outcome]
35
+
36
+ ---
37
+
38
+ ### User Story 2 - [Brief Title] (Priority: P2)
39
+
40
+ [Describe this user journey in plain language]
41
+
42
+ **Why this priority**: [Explain the value and why it has this priority level]
43
+
44
+ **Independent Test**: [Describe how this can be tested independently]
45
+
46
+ **Acceptance Scenarios**:
47
+
48
+ 1. **Given** [initial state], **When** [action], **Then** [expected outcome]
49
+
50
+ ---
51
+
52
+ ### User Story 3 - [Brief Title] (Priority: P3)
53
+
54
+ [Describe this user journey in plain language]
55
+
56
+ **Why this priority**: [Explain the value and why it has this priority level]
57
+
58
+ **Independent Test**: [Describe how this can be tested independently]
59
+
60
+ **Acceptance Scenarios**:
61
+
62
+ 1. **Given** [initial state], **When** [action], **Then** [expected outcome]
63
+
64
+ ---
65
+
66
+ [Add more user stories as needed, each with an assigned priority]
67
+
68
+ ### Edge Cases
69
+
70
+ <!--
71
+ ACTION REQUIRED: The content in this section represents placeholders.
72
+ Fill them out with the right edge cases.
73
+ -->
74
+
75
+ - What happens when [boundary condition]?
76
+ - How does system handle [error scenario]?
77
+
78
+ ## Requirements _(mandatory)_
79
+
80
+ <!--
81
+ ACTION REQUIRED: The content in this section represents placeholders.
82
+ Fill them out with the right functional requirements.
83
+ -->
84
+
85
+ ### Functional Requirements
86
+
87
+ - **FR-001**: System MUST [specific capability, e.g., "allow users to create accounts"]
88
+ - **FR-002**: System MUST [specific capability, e.g., "validate email addresses"]
89
+ - **FR-003**: Users MUST be able to [key interaction, e.g., "reset their password"]
90
+ - **FR-004**: System MUST [data requirement, e.g., "persist user preferences"]
91
+ - **FR-005**: System MUST [behavior, e.g., "log all security events"]
92
+
93
+ _Example of marking unclear requirements:_
94
+
95
+ - **FR-006**: System MUST authenticate users via [NEEDS CLARIFICATION: auth method not specified - email/password, SSO, OAuth?]
96
+ - **FR-007**: System MUST retain user data for [NEEDS CLARIFICATION: retention period not specified]
97
+
98
+ ### Key Entities _(include if feature involves data)_
99
+
100
+ - **[Entity 1]**: [What it represents, key attributes without implementation]
101
+ - **[Entity 2]**: [What it represents, relationships to other entities]
102
+
103
+ ## Success Criteria _(mandatory)_
104
+
105
+ <!--
106
+ ACTION REQUIRED: Define measurable success criteria.
107
+ These must be technology-agnostic and measurable.
108
+ -->
109
+
110
+ ### Measurable Outcomes
111
+
112
+ - **SC-001**: [Measurable metric, e.g., "Users can complete account creation in under 2 minutes"]
113
+ - **SC-002**: [Measurable metric, e.g., "System handles 1000 concurrent users without degradation"]
114
+ - **SC-003**: [User satisfaction metric, e.g., "90% of users successfully complete primary task on first attempt"]
115
+ - **SC-004**: [Business metric, e.g., "Reduce support tickets related to [X] by 50%"]
@@ -0,0 +1,250 @@
1
+ ---
2
+ description: 'Task list template for feature implementation'
3
+ ---
4
+
5
+ # Tasks: [FEATURE NAME]
6
+
7
+ **Input**: Design documents from `/specs/[###-feature-name]/`
8
+ **Prerequisites**: plan.md (required), spec.md (required for user stories), research.md, data-model.md, contracts/
9
+
10
+ **Tests**: The examples below include test tasks. Tests are OPTIONAL - only include them if explicitly requested in the feature specification.
11
+
12
+ **Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.
13
+
14
+ ## Format: `[ID] [P?] [Story] Description`
15
+
16
+ - **[P]**: Can run in parallel (different files, no dependencies)
17
+ - **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
18
+ - Include exact file paths in descriptions
19
+
20
+ ## Path Conventions
21
+
22
+ - **Single project**: `src/`, `tests/` at repository root
23
+ - **Web app**: `backend/src/`, `frontend/src/`
24
+ - **Mobile**: `api/src/`, `ios/src/` or `android/src/`
25
+ - Paths shown below assume single project - adjust based on plan.md structure
26
+
27
+ <!--
28
+ ============================================================================
29
+ IMPORTANT: The tasks below are SAMPLE TASKS for illustration purposes only.
30
+
31
+ The /speckit.tasks command MUST replace these with actual tasks based on:
32
+ - User stories from spec.md (with their priorities P1, P2, P3...)
33
+ - Feature requirements from plan.md
34
+ - Entities from data-model.md
35
+ - Endpoints from contracts/
36
+
37
+ Tasks MUST be organized by user story so each story can be:
38
+ - Implemented independently
39
+ - Tested independently
40
+ - Delivered as an MVP increment
41
+
42
+ DO NOT keep these sample tasks in the generated tasks.md file.
43
+ ============================================================================
44
+ -->
45
+
46
+ ## Phase 1: Setup (Shared Infrastructure)
47
+
48
+ **Purpose**: Project initialization and basic structure
49
+
50
+ - [ ] T001 Create project structure per implementation plan
51
+ - [ ] T002 Initialize [language] project with [framework] dependencies
52
+ - [ ] T003 [P] Configure linting and formatting tools
53
+
54
+ ---
55
+
56
+ ## Phase 2: Foundational (Blocking Prerequisites)
57
+
58
+ **Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented
59
+
60
+ **⚠️ CRITICAL**: No user story work can begin until this phase is complete
61
+
62
+ Examples of foundational tasks (adjust based on your project):
63
+
64
+ - [ ] T004 Setup database schema and migrations framework
65
+ - [ ] T005 [P] Implement authentication/authorization framework
66
+ - [ ] T006 [P] Setup API routing and middleware structure
67
+ - [ ] T007 Create base models/entities that all stories depend on
68
+ - [ ] T008 Configure error handling and logging infrastructure
69
+ - [ ] T009 Setup environment configuration management
70
+
71
+ **Checkpoint**: Foundation ready - user story implementation can now begin in parallel
72
+
73
+ ---
74
+
75
+ ## Phase 3: User Story 1 - [Title] (Priority: P1) 🎯 MVP
76
+
77
+ **Goal**: [Brief description of what this story delivers]
78
+
79
+ **Independent Test**: [How to verify this story works on its own]
80
+
81
+ ### Tests for User Story 1 (OPTIONAL - only if tests requested) ⚠️
82
+
83
+ > **NOTE: Write these tests FIRST, ensure they FAIL before implementation**
84
+
85
+ - [ ] T010 [P] [US1] Contract test for [endpoint] in tests/contract/test\_[name].py
86
+ - [ ] T011 [P] [US1] Integration test for [user journey] in tests/integration/test\_[name].py
87
+
88
+ ### Implementation for User Story 1
89
+
90
+ - [ ] T012 [P] [US1] Create [Entity1] model in src/models/[entity1].py
91
+ - [ ] T013 [P] [US1] Create [Entity2] model in src/models/[entity2].py
92
+ - [ ] T014 [US1] Implement [Service] in src/services/[service].py (depends on T012, T013)
93
+ - [ ] T015 [US1] Implement [endpoint/feature] in src/[location]/[file].py
94
+ - [ ] T016 [US1] Add validation and error handling
95
+ - [ ] T017 [US1] Add logging for user story 1 operations
96
+
97
+ **Checkpoint**: At this point, User Story 1 should be fully functional and testable independently
98
+
99
+ ---
100
+
101
+ ## Phase 4: User Story 2 - [Title] (Priority: P2)
102
+
103
+ **Goal**: [Brief description of what this story delivers]
104
+
105
+ **Independent Test**: [How to verify this story works on its own]
106
+
107
+ ### Tests for User Story 2 (OPTIONAL - only if tests requested) ⚠️
108
+
109
+ - [ ] T018 [P] [US2] Contract test for [endpoint] in tests/contract/test\_[name].py
110
+ - [ ] T019 [P] [US2] Integration test for [user journey] in tests/integration/test\_[name].py
111
+
112
+ ### Implementation for User Story 2
113
+
114
+ - [ ] T020 [P] [US2] Create [Entity] model in src/models/[entity].py
115
+ - [ ] T021 [US2] Implement [Service] in src/services/[service].py
116
+ - [ ] T022 [US2] Implement [endpoint/feature] in src/[location]/[file].py
117
+ - [ ] T023 [US2] Integrate with User Story 1 components (if needed)
118
+
119
+ **Checkpoint**: At this point, User Stories 1 AND 2 should both work independently
120
+
121
+ ---
122
+
123
+ ## Phase 5: User Story 3 - [Title] (Priority: P3)
124
+
125
+ **Goal**: [Brief description of what this story delivers]
126
+
127
+ **Independent Test**: [How to verify this story works on its own]
128
+
129
+ ### Tests for User Story 3 (OPTIONAL - only if tests requested) ⚠️
130
+
131
+ - [ ] T024 [P] [US3] Contract test for [endpoint] in tests/contract/test\_[name].py
132
+ - [ ] T025 [P] [US3] Integration test for [user journey] in tests/integration/test\_[name].py
133
+
134
+ ### Implementation for User Story 3
135
+
136
+ - [ ] T026 [P] [US3] Create [Entity] model in src/models/[entity].py
137
+ - [ ] T027 [US3] Implement [Service] in src/services/[service].py
138
+ - [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py
139
+
140
+ **Checkpoint**: All user stories should now be independently functional
141
+
142
+ ---
143
+
144
+ [Add more user story phases as needed, following the same pattern]
145
+
146
+ ---
147
+
148
+ ## Phase N: Polish & Cross-Cutting Concerns
149
+
150
+ **Purpose**: Improvements that affect multiple user stories
151
+
152
+ - [ ] TXXX [P] Documentation updates in docs/
153
+ - [ ] TXXX Code cleanup and refactoring
154
+ - [ ] TXXX Performance optimization across all stories
155
+ - [ ] TXXX [P] Additional unit tests (if requested) in tests/unit/
156
+ - [ ] TXXX Security hardening
157
+ - [ ] TXXX Run quickstart.md validation
158
+
159
+ ---
160
+
161
+ ## Dependencies & Execution Order
162
+
163
+ ### Phase Dependencies
164
+
165
+ - **Setup (Phase 1)**: No dependencies - can start immediately
166
+ - **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories
167
+ - **User Stories (Phase 3+)**: All depend on Foundational phase completion
168
+ - User stories can then proceed in parallel (if staffed)
169
+ - Or sequentially in priority order (P1 → P2 → P3)
170
+ - **Polish (Final Phase)**: Depends on all desired user stories being complete
171
+
172
+ ### User Story Dependencies
173
+
174
+ - **User Story 1 (P1)**: Can start after Foundational (Phase 2) - No dependencies on other stories
175
+ - **User Story 2 (P2)**: Can start after Foundational (Phase 2) - May integrate with US1 but should be independently testable
176
+ - **User Story 3 (P3)**: Can start after Foundational (Phase 2) - May integrate with US1/US2 but should be independently testable
177
+
178
+ ### Within Each User Story
179
+
180
+ - Tests (if included) MUST be written and FAIL before implementation
181
+ - Models before services
182
+ - Services before endpoints
183
+ - Core implementation before integration
184
+ - Story complete before moving to next priority
185
+
186
+ ### Parallel Opportunities
187
+
188
+ - All Setup tasks marked [P] can run in parallel
189
+ - All Foundational tasks marked [P] can run in parallel (within Phase 2)
190
+ - Once Foundational phase completes, all user stories can start in parallel (if team capacity allows)
191
+ - All tests for a user story marked [P] can run in parallel
192
+ - Models within a story marked [P] can run in parallel
193
+ - Different user stories can be worked on in parallel by different team members
194
+
195
+ ---
196
+
197
+ ## Parallel Example: User Story 1
198
+
199
+ ```bash
200
+ # Launch all tests for User Story 1 together (if tests requested):
201
+ Task: "Contract test for [endpoint] in tests/contract/test_[name].py"
202
+ Task: "Integration test for [user journey] in tests/integration/test_[name].py"
203
+
204
+ # Launch all models for User Story 1 together:
205
+ Task: "Create [Entity1] model in src/models/[entity1].py"
206
+ Task: "Create [Entity2] model in src/models/[entity2].py"
207
+ ```
208
+
209
+ ---
210
+
211
+ ## Implementation Strategy
212
+
213
+ ### MVP First (User Story 1 Only)
214
+
215
+ 1. Complete Phase 1: Setup
216
+ 2. Complete Phase 2: Foundational (CRITICAL - blocks all stories)
217
+ 3. Complete Phase 3: User Story 1
218
+ 4. **STOP and VALIDATE**: Test User Story 1 independently
219
+ 5. Deploy/demo if ready
220
+
221
+ ### Incremental Delivery
222
+
223
+ 1. Complete Setup + Foundational → Foundation ready
224
+ 2. Add User Story 1 → Test independently → Deploy/Demo (MVP!)
225
+ 3. Add User Story 2 → Test independently → Deploy/Demo
226
+ 4. Add User Story 3 → Test independently → Deploy/Demo
227
+ 5. Each story adds value without breaking previous stories
228
+
229
+ ### Parallel Team Strategy
230
+
231
+ With multiple developers:
232
+
233
+ 1. Team completes Setup + Foundational together
234
+ 2. Once Foundational is done:
235
+ - Developer A: User Story 1
236
+ - Developer B: User Story 2
237
+ - Developer C: User Story 3
238
+ 3. Stories complete and integrate independently
239
+
240
+ ---
241
+
242
+ ## Notes
243
+
244
+ - [P] tasks = different files, no dependencies
245
+ - [Story] label maps task to specific user story for traceability
246
+ - Each user story should be independently completable and testable
247
+ - Verify tests fail before implementing
248
+ - Commit after each task or logical group
249
+ - Stop at any checkpoint to validate story independently
250
+ - Avoid: vague tasks, same file conflicts, cross-story dependencies that break independence
package/CLAUDE.md ADDED
@@ -0,0 +1,105 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ A2UI React Renderer Library (`@easyops-cn/a2ui-react`) - A React implementation for rendering A2UI protocol. This is a library package (not an application) that downstream developers consume.
8
+
9
+ ## Monorepo Structure
10
+
11
+ This is an npm workspaces monorepo:
12
+
13
+ - Root package: `@easyops-cn/a2ui-react` - The main library
14
+ - `website/` - Documentation site using plain-blog
15
+ - `playground/` - Live demo workspace for real-time A2UI rendering development
16
+
17
+ ## Commands
18
+
19
+ ### Library (root)
20
+
21
+ ```bash
22
+ npm run build # TypeScript compile + Vite build (outputs to dist/)
23
+ npm run dev # Start Vite dev server for local development
24
+ npm test # Run Vitest in watch mode
25
+ npm run test:run # Run tests once
26
+ npm run lint # Run ESLint
27
+ npm run lint:fix # ESLint with auto-fix
28
+ ```
29
+
30
+ ### Website
31
+
32
+ ```bash
33
+ npm run build -w website # Build website (outputs to website/dist/)
34
+ npm run serve -w website # Serve built website locally
35
+ ```
36
+
37
+ ### Playground
38
+
39
+ ```bash
40
+ npm run dev -w playground # Start playground dev server for live A2UI demos
41
+ npm run build -w playground # Build playground
42
+ ```
43
+
44
+ ## Library Usage (Downstream API)
45
+
46
+ The primary entry point is `A2UIRender` component:
47
+
48
+ ```tsx
49
+ import { A2UIRender, A2UIMessage, A2UIAction } from '@easyops-cn/a2ui-react/0.8'
50
+ ;<A2UIRender messages={messages} onAction={handleAction} />
51
+ ```
52
+
53
+ Custom components can override defaults or add new ones via `components` prop (Map<string, React.ComponentType>).
54
+
55
+ Custom components use hooks: `useDispatchAction`, `useDataBinding`, `useFormBinding`, and `ComponentRenderer` for rendering children.
56
+
57
+ ## Package Exports
58
+
59
+ ```javascript
60
+ import { v0_8 } from '@easyops-cn/a2ui-react' // Main namespace export
61
+ import { ... } from '@easyops-cn/a2ui-react/0.8' // Core module (A2UIRender, hooks, types)
62
+ ```
63
+
64
+ ## Architecture
65
+
66
+ ### Message Flow
67
+
68
+ A2UI messages processed in order:
69
+
70
+ 1. `beginRendering` - Initialize Surface with ID, root component, styles
71
+ 2. `surfaceUpdate` - Add/update components in Surface's component tree
72
+ 3. `dataModelUpdate` - Update hierarchical data model at paths
73
+ 4. `deleteSurface` - Remove Surface
74
+
75
+ ### Core Concepts
76
+
77
+ - **Surface**: Top-level container with `surfaceId`, `root` component ID, component tree, and styles
78
+ - **Data Model**: Hierarchical key-value store. Components reference via paths like `/user/name`
79
+ - **ValueSource**: `{ literalString: "..." }` for static, `{ path: "/data/path" }` for data binding
80
+ - **Actions**: User interactions dispatch actions with resolved context values
81
+
82
+ ### Key Directories
83
+
84
+ - `src/0.8/contexts/` - React context providers (Surface, DataModel, Action)
85
+ - `src/0.8/hooks/` - Custom hooks for data binding and actions
86
+ - `src/0.8/components/` - Component implementations (display/, layout/, interactive/)
87
+ - `src/0.8/schemas/` - JSON schemas for A2UI protocol
88
+ - `src/components/ui/` - shadcn/ui primitives
89
+
90
+ ## Testing
91
+
92
+ Tests co-located with source (`*.test.tsx`). Uses Vitest + React Testing Library + jsdom.
93
+
94
+ ## Technologies
95
+
96
+ TypeScript 5.9, React 19, Radix UI (for UI primitives), Tailwind CSS (via class-variance-authority)
97
+
98
+ ## Active Technologies
99
+
100
+ - TypeScript 5.9, React 19 + @uiw/react-codemirror (CodeMirror 6), @codemirror/lang-json, @easyops-cn/a2ui-react, Tailwind CSS 4 (002-playground)
101
+ - localStorage (theme preference only) (002-playground)
102
+
103
+ ## Recent Changes
104
+
105
+ - 002-playground: Added TypeScript 5.9, React 19 + @uiw/react-codemirror (CodeMirror 6), @codemirror/lang-json, @easyops-cn/a2ui-react, Tailwind CSS 4