Skip to content

Commit 5e82360

Browse files
committed
refactor: Consolidate documentation into /docs
- Move module structure, version management, and architectural pattern documentation from `CONTRIBUTING.md` and `AI_AGENT_GUIDE.md` into the `/docs` directory. - Update `CONTRIBUTING.md` and `AI_AGENT_GUIDE.md` to link to the new centralized documentation in `docs/README.md` and `docs/ARCHITECTURE.md`. - Remove redundant sections (Key Concepts, Build Commands, Platform Support, etc.) from the main `docs/README.md` to streamline its content. - Add a new link for "Web Development" to `docs/README.md`.
1 parent 8ef4f7a commit 5e82360

File tree

3 files changed

+6
-203
lines changed

3 files changed

+6
-203
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -341,31 +341,7 @@ class FeatureViewModelTest {
341341

342342
## Module Structure
343343

344-
### Core Modules
345-
346-
- **core:domain** - Pure business logic, no dependencies
347-
- **core:presentation** - ViewModels, state management
348-
- **core:data:db-sqldelight** - SQLDelight data implementation (default)
349-
- **core:data:db-room** - Room data implementation (alternative)
350-
- **core:test** - Shared test utilities
351-
352-
### UI Modules
353-
354-
- **ui:shared** - Shared Compose UI (100% shared)
355-
- **ui:test-jvm** - UI testing framework (Kaspresso-inspired)
356-
357-
### App Modules
358-
359-
- **app:android** - Android application
360-
- **app:desktop** - Desktop JVM application
361-
- **app:web** - Web/Wasm application
362-
- **app:ios-kit** - iOS framework (CocoaPods)
363-
- **app:iosApp** - iOS application (Swift/SwiftUI)
364-
365-
### Build Modules
366-
367-
- **build-logic** - Gradle convention plugins
368-
- **thirdparty** - Vendored dependencies
344+
**See [docs/README.md](docs/README.md#module-documentation) for the list of modules and their documentation.**
369345

370346
### Module Guidelines
371347

docs/AI_AGENT_GUIDE.md

Lines changed: 4 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,9 @@ This guide is specifically written for AI agents working on the NoteDelight code
1919
./gradlew :app:web:wasmJsBrowserDevelopmentRun --continuous # Web app
2020
```
2121

22-
### Version Management Quick Reference
22+
### Version Management
2323

24-
```bash
25-
# Update versions in all platform files, then:
26-
git add app/*/build.gradle.kts app/iosApp/iosApp.xcodeproj/project.pbxproj app/iosApp/iosApp/Info.plist
27-
git commit -m "chore: bump version to X.Y.Z"
28-
29-
# Trigger CI/CD workflows:
30-
git tag android/vX.Y.Z && git push origin android/vX.Y.Z
31-
git tag desktop/vX.Y.Z && git push origin desktop/vX.Y.Z
32-
git tag ios/vX.Y.Z && git push origin ios/vX.Y.Z
33-
```
34-
35-
**See [VERSION_MANAGEMENT_GUIDE.md](VERSION_MANAGEMENT_GUIDE.md) for detailed instructions.**
24+
**See [VERSION_MANAGEMENT_GUIDE.md](VERSION_MANAGEMENT_GUIDE.md) for detailed instructions and commands.**
3625

3726
## Understanding the Codebase
3827

@@ -285,83 +274,9 @@ sealed class FeatureResult {
285274

286275
#### Screen Pattern with Action Interface
287276

288-
**All ViewModels in this project use the Action interface pattern** to avoid callback hell and reduce `@Composable` function signatures:
289-
290-
```kotlin
291-
// 1. Define Action Interface (in Result.kt)
292-
sealed interface FeatureAction {
293-
data class Save(val title: String, val text: String) : FeatureAction
294-
data object Delete : FeatureAction
295-
data object NavigateBack : FeatureAction
296-
}
297-
298-
// 2. Define State (in Result.kt)
299-
data class FeatureResult(
300-
val loading: Boolean = false,
301-
val data: String? = null,
302-
) {
303-
fun showLoading(): FeatureResult = copy(loading = true)
304-
fun hideLoading(): FeatureResult = copy(loading = false)
305-
}
306-
307-
// 3. ViewModel with onAction dispatcher
308-
class FeatureViewModel(...) : ViewModel() {
309-
private val mutableStateFlow = MutableStateFlow(FeatureResult())
310-
val stateFlow: StateFlow<FeatureResult> = mutableStateFlow
311-
312-
fun onAction(action: FeatureAction) = when (action) {
313-
is FeatureAction.Save -> saveData(action.title, action.text)
314-
is FeatureAction.Delete -> deleteData()
315-
is FeatureAction.NavigateBack -> router.popBackStack()
316-
}
317-
318-
private fun saveData(title: String, text: String) { /* ... */ }
319-
private fun deleteData() { /* ... */ }
320-
}
321-
322-
// 4. Composable Screen - Single onAction parameter
323-
@Composable
324-
fun FeatureScreen(viewModel: FeatureViewModel = koinViewModel()) {
325-
val state by viewModel.stateFlow.collectAsState()
326-
327-
FeatureContent(
328-
state = state,
329-
onAction = viewModel::onAction // Single action handler
330-
)
331-
}
332-
333-
@Composable
334-
private fun FeatureContent(
335-
state: FeatureResult,
336-
onAction: (FeatureAction) -> Unit = {} // Simplified signature
337-
) {
338-
// Use actions in UI events
339-
Button(onClick = { onAction(FeatureAction.Save("title", "text")) })
340-
IconButton(onClick = { onAction(FeatureAction.Delete) })
341-
}
342-
```
277+
**All ViewModels in this project use the Action interface pattern** to avoid callback hell and reduce `@Composable` function signatures.
343278

344-
**Key Points**:
345-
- ✅ One `onAction()` method instead of multiple callbacks
346-
- ✅ Type-safe actions with sealed interfaces
347-
- ✅ Actions defined in same file as State (`*Result.kt`)
348-
- ✅ Private implementation methods in ViewModel
349-
- ✅ Simpler Composable function signatures
350-
- ✅ Easier to test - mock single `onAction()` method
351-
352-
**When to Use Action Interfaces (Important!)**:
353-
- ✅ Use for screens with **3+ different actions** passed through Composables
354-
- ✅ Use when actions need to be passed down multiple layers
355-
-**Don't use** for simple 1-2 action cases (call ViewModel methods directly)
356-
-**Don't use** for methods called directly where ViewModel is obtained (e.g., `disposeOneTimeEvents()`)
357-
-**Don't use** for simple dialog ViewModels not passed down
358-
359-
**Examples**:
360-
-`NoteViewModel.onAction(NoteAction.Save)` - Complex screen with 4+ actions
361-
-`SignInViewModel.signIn()` - Simple screen, call directly
362-
-`noteViewModel.disposeOneTimeEvents()` - Called in same LaunchedEffect
363-
364-
**Rule of Thumb**: The goal is to write **less code**, not more. Only use Actions where they genuinely simplify Composable signatures.
279+
**Refer to [docs/ARCHITECTURE.md](ARCHITECTURE.md#presentation-layer) for the full pattern definition, code examples, and guidelines on when to use it.**
365280

366281
## Debugging Strategies
367282

docs/README.md

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -54,96 +54,8 @@ Each module has its own detailed README.md:
5454
- **AI Agent Tasks**[AI_AGENT_GUIDE.md](AI_AGENT_GUIDE.md)
5555
- **Manual Build & Install**[MANUAL_BUILD_INSTALL.md](MANUAL_BUILD_INSTALL.md)
5656
- **Version Management & CI/CD**[VERSION_MANAGEMENT_GUIDE.md](VERSION_MANAGEMENT_GUIDE.md)
57+
- **Web Development**[WEB_DEVELOPMENT_WORKFLOW.md](WEB_DEVELOPMENT_WORKFLOW.md)
5758
- **Platform-Specific** → Module READMEs in `app/` directories
5859
- **Data & Persistence** → Module READMEs in `core/data/` directories
5960

60-
## Key Concepts
61-
62-
### Project Structure
63-
```
64-
NoteDelight/
65-
├── core/ # Core business logic and presentation
66-
│ ├── domain/ # Pure business logic (no dependencies)
67-
│ ├── presentation/ # ViewModels, state management
68-
│ ├── data/ # Database implementations
69-
│ └── test/ # Shared test utilities
70-
├── ui/ # User interface
71-
│ ├── shared/ # 100% shared Compose UI
72-
│ ├── test/ # Multiplatform Compose UI tests
73-
│ └── test-jvm/ # JVM-specific UI test utilities
74-
├── app/ # Platform-specific applications
75-
│ ├── android/ # Android app
76-
│ ├── desktop/ # Desktop app
77-
│ ├── web/ # Web app (Wasm)
78-
│ ├── ios-kit/ # iOS framework
79-
│ └── iosApp/ # iOS app (Swift)
80-
├── build-logic/ # Gradle convention plugins
81-
├── thirdparty/ # Vendored dependencies
82-
└── docs/ # This documentation
83-
```
84-
85-
### Technology Stack
86-
87-
**Languages:**
88-
- Kotlin (multiplatform shared code)
89-
- Swift (iOS app shell)
90-
91-
**UI:**
92-
- Compose Multiplatform (100% shared UI)
93-
94-
**Database:**
95-
- SQLDelight (default, multiplatform)
96-
- Room (alternative, experimental KMP)
97-
- SQLCipher (encryption for Android/iOS/Desktop JVM)
98-
99-
**Architecture:**
100-
- Clean Architecture
101-
- MVVM pattern
102-
- Unidirectional data flow
103-
104-
**DI:**
105-
- Koin (multiplatform dependency injection)
106-
107-
**Testing:**
108-
- Kotlin Test (multiplatform)
109-
- JUnit (Android)
110-
- Mockito (mocking)
111-
- Compose Test (UI)
112-
- Kaspresso-inspired pattern (UI tests)
113-
114-
## Build Commands
115-
116-
```bash
117-
./gradlew build # Build everything
118-
./gradlew test # Run tests
119-
./gradlew :app:android:installDebug # Android app
120-
./gradlew :app:desktop:run # Desktop app
121-
./gradlew :app:web:wasmJsBrowserDevelopmentRun --continuous # Web app
122-
```
123-
124-
## Platform Support
125-
126-
| Platform | Status | Encryption | UI | Testing | Adaptive |
127-
|----------|--------|------------|----|---------|----------|
128-
| Android | ✅ Production | ✅ SQLCipher | ✅ Compose | ✅ Full ||
129-
| iOS | ✅ Production | ✅ SQLCipher | ✅ Compose | ⚠️ Manual ||
130-
| Desktop | ✅ Production | ✅ SQLCipher | ✅ Compose | ✅ Full ||
131-
| Web | ⚠️ Experimental | ❌ Browser limitation | ✅ Compose | ⚠️ Limited ||
132-
133-
## Contributing
134-
135-
- **General guidelines**[CONTRIBUTING.md](../CONTRIBUTING.md)
136-
- **Module-specific** → Check module READMEs
137-
- **Testing**[TESTING_GUIDE.md](TESTING_GUIDE.md)
138-
139-
## Diagrams
140-
141-
Visual documentation:
142-
- [Architecture Diagram](diagrams/architecture.png) - System architecture overview
143-
- [CI/CD Diagram](diagrams/ci_cd.png) - Continuous integration/deployment workflows
144-
145-
## Additional Resources
146-
147-
- [Main README](../README.md) - Project overview
148-
- [GitHub Repository](https://github.com/softartdev/NoteDelight)
14961

0 commit comments

Comments
 (0)