-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathllms.txt
More file actions
177 lines (141 loc) · 5.37 KB
/
Copy pathllms.txt
File metadata and controls
177 lines (141 loc) · 5.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Summon - Kotlin Multiplatform UI Framework
## Project Overview
Summon is a Kotlin Multiplatform UI framework for building web applications with Jetpack Compose-like declarative syntax. It targets browser (JS/WASM) and JVM (SSR) environments.
- **Package namespace**: `codes.yousef.summon`
- **Current version**: 0.6.3.0
- **Kotlin version**: 2.3.0
- **Status**: Alpha (APIs may change between releases)
## Architecture
### Module Structure
```
summon/
├── summon-core/ # Main library (KMP: commonMain, jvmMain, jsMain, wasmJsMain, webMain)
├── summon-cli/ # Project scaffolding CLI tool
├── diagnostics/ # Stress tests and JMH benchmarks
├── e2e-tests/ # Playwright end-to-end tests
└── docs/ # Documentation
```
### Source Set Hierarchy
```
commonMain
└── webMain (shared JS + WASM code)
├── jsMain (browser JS)
└── wasmJsMain (WebAssembly)
```
### Core Package Structure (`codes.yousef.summon`)
- `components/` - UI components (display, input, layout, feedback, navigation, forms)
- `state/` - Reactive state management (`mutableStateOf`, `remember`)
- `modifier/` - Type-safe CSS styling API
- `routing/` - File-based routing with Next.js-style patterns
- `runtime/` - Platform-specific renderers and composition
- `ssr/` - Server-side rendering and hydration
- `effects/` - Side effects and lifecycle hooks
- `animation/` - Keyframes, transitions, transforms
- `theme/` - Theming with dark mode support
- `i18n/` - Internationalization with RTL support
- `security/` - JWT auth, RBAC, route guards
## Coding Guidelines
### General Principles
1. **Prefer immutable data** - Use `val` over `var`, immutable collections where possible
2. **Compose-style APIs** - Follow Jetpack Compose patterns for components and state
3. **Type-safe styling** - Use Modifier API with type-safe enums, not raw CSS strings
4. **Platform abstraction** - Keep platform-specific code in appropriate source sets
### Component Pattern
```kotlin
@Composable
fun MyComponent(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier()
) {
val renderer = LocalPlatformRenderer.current
// Use renderer methods, not direct DOM manipulation
}
```
### Modifier Pattern (Type-safe CSS)
```kotlin
Modifier()
.padding(16.px)
.backgroundColor(Color.Blue)
.borderRadius(8.px)
.display(Display.Flex)
.alignItems(AlignItems.Center)
```
### State Management
```kotlin
val counter = remember { mutableStateOf(0) }
// Access: counter.value
// Update: counter.value = newValue
```
### JS Interop Guidelines
- Add `@JsName` annotations to public APIs for consistent naming in minified JS
- Avoid capturing mutable state in lambdas passed to renderers (use wrapper functions)
- Use `getPlatformRenderer()` for reliable renderer access in JS contexts
## Build & Test Commands
```bash
# Build all
./gradlew build
# Run tests (excludes slow tests by default)
./gradlew :summon-core:jvmTest
./gradlew :summon-core:jsNodeTest
./gradlew :summon-core:wasmJsNodeTest
# Run slow tests (stress/performance)
./gradlew :summon-core:slowTests
# Publish locally
./gradlew publishLocal
```
## Testing Conventions
1. **Unit tests** - Fast tests in `src/{platform}Test/kotlin/`
2. **Slow tests** - Mark with `@SlowTest` annotation (excluded from default runs)
- Stress tests (SSRPerformanceStressTest)
- Framework integration tests (Ktor, Spring, Quarkus E2E tests)
- GC-dependent tests
- Coroutine/concurrency tests
3. **E2E tests** - Playwright tests in `e2e-tests/`
4. **Benchmarks** - JMH benchmarks in `diagnostics/`
### Test Requirements
- All new public APIs need tests
- Prefer property-based testing with Kotest for edge cases
- JS tests use happy-dom environment
- Browser tests are disabled in CI (headless)
## Key Documentation
- `CLAUDE.md` - Detailed guidance for Claude/AI assistants
- `CHANGELOG.md` - Version history and migration notes
- `docs/README.md` - Documentation index
- `docs/quickstart.md` - Getting started guide
- `docs/components.md` - Component API reference
- `docs/api-reference/` - Detailed API documentation
## Privacy & Boundaries
### Sensitive Files (do not share contents)
- `local.properties` - Local credentials
- `private-key*.asc` - GPG signing keys
- `*.log` files - Build/test logs with potential system info
### Safe to Analyze
- All source code in `src/`
- Documentation in `docs/`
- Build configuration files
- Test files
## Framework Integrations
JVM module includes optional integrations (compile-time dependencies):
- **Ktor** - Server routes, HTML responses
- **Spring Boot** - WebFlux, Thymeleaf
- **Quarkus** - Qute templates, REST endpoints
## Common Pitfalls to Avoid
1. **WASM cache staleness** - Run `./gradlew clean` if WASM builds behave unexpectedly
2. **JS minification issues** - Always add `@JsName` to public functions/callbacks
3. **State in lambdas** - Don't capture mutable state directly in renderer callbacks
4. **Missing hydration** - SSR requires proper hydration setup for interactivity
## Version Management
Version is centralized in `version.properties`:
```
VERSION=0.6.3.0
GROUP=codes.yousef
```
When updating version:
1. Update `version.properties`
2. Add entry to `CHANGELOG.md`
3. Update relevant documentation
## Getting Help
- GitHub Issues: Report bugs and feature requests
- Documentation: `docs/` directory
- Examples: Generated via `summon-cli` tool