|
1 | 1 | ## Core Rules |
2 | 2 |
|
3 | | -- Current project is a Kotlin multiplatform project, always consider the multiplatform aspect, JS, WASM, Desktop JVM, Android, iOS |
4 | | -- Current project is a Kotlin multiplatform project, always consider the multiplatform aspect, JS, WASM, Desktop JVM, Android, iOS |
5 | | -- Current project is a Kotlin multiplatform project, always consider the multiplatform aspect, JS, WASM, Desktop JVM, Android, iOS |
| 3 | +- **Kotlin Multiplatform**: Always consider all platforms: JS, WASM, Desktop JVM, Android, iOS |
| 4 | +- **Build & Test**: Always run build and tests before completing tasks |
| 5 | +- **Preserve Intent**: If existing solution doesn't work, preserve its intent |
| 6 | +- **Module Clean**: Use `./gradlew :module:clean` instead of global clean |
| 7 | +- **Test Scripts**: Put temporary scripts under `docs/test-scripts` |
| 8 | +- **Logs**: Check `~/.autodev/logs/autodev-app.log` for debugging |
6 | 9 |
|
7 | | -Rest: |
| 10 | +## KMP Best Practices |
8 | 11 |
|
9 | | -- Always run the build and tests before completing a task, making sure they pass. |
10 | | -- If an existing request/solution does not work, preserve its intent. |
11 | | -- Do not run `./gradlew clean`. Clean only the specific module, e.g., `./gradlew :mpp-core:clean`. |
12 | | -- Put temporary test scripts under `docs/test-scripts`. |
| 12 | +- Use `expect`/`actual` for platform-specific code, for example `Platform` |
| 13 | +- **@JsExport**: Use concrete classes (not interfaces), `Promise` (not `Flow`) |
| 14 | +- **WASM**: Avoid emoji and UTF-8 in code |
| 15 | +- **i18n**: Run `./gradlew :mpp-ui:generateI18n4kFiles` |
13 | 16 |
|
14 | | -## Debug |
| 17 | +## Renderer System |
15 | 18 |
|
16 | | -- Log save in `~/.autodev/logs/autodev-app.log` |
17 | | - |
18 | | -## Summary |
19 | | - |
20 | | -- Omit a summary if the problem is simple. For bug fixes, summarize as: Problem → Root Cause → Solution. Keep summary |
21 | | - short if need. Use Mermaid for long chat only. |
22 | | - |
23 | | -## Kotlin Multiplatform \(KMP\) Best Practices for `mpp-core` and `mpp-ui` |
24 | | - |
25 | | -- Use `expect`/`actual` for platform-specific code \(e.g., file I/O on JVM/JS/Wasm\). |
26 | | -- Check export first, if some functions not working well with CLI (TypeScript) |
27 | | -- 在 Kotlin/JS 的 @JsExport 中: |
28 | | - - Avoid `Flow`, use `Promise` |
29 | | - - ✅ 使用具体类作为返回类型和参数类型 |
30 | | - - ❌ 避免使用接口类型(JS 端无法正确处理接口的类型转换) |
31 | | -- For WASM platform, we should not use emoji and utf8 in code. |
32 | | -- Use ./gradlew :mpp-ui:generateI18n4kFiles for i18n |
33 | | - |
34 | | -## CodingAgentRenderer Implementations |
35 | | - |
36 | | -When modifying `CodingAgentRenderer` interface, **ALL** renderer implementations must be updated: |
| 19 | +When modifying `CodingAgentRenderer`, update ALL implementations: |
37 | 20 | - **Kotlin**: `DefaultCodingAgentRenderer`, `ComposeRenderer`, `JewelRenderer`, `ServerSideRenderer`, `JsRendererAdapter` |
38 | 21 | - **TypeScript**: `BaseRenderer.ts`, `CliRenderer.ts`, `ServerRenderer.ts`, `TuiRenderer.ts` |
39 | | -- **VSCode**: `mpp-vscode/src/bridge/mpp-core.ts` (VSCodeRenderer), `mpp-vscode/src/providers/chat-view.ts` |
40 | | -- **JVM CLI**: `CodingCliRenderer` (mpp-ui/src/jvmMain/.../CodingCli.kt), `ConsoleRenderer` (mpp-ui/src/jvmMain/.../DocumentCli.kt) |
41 | | - |
42 | | -## Design System \(Color & Theme\) |
| 22 | +- **VSCode**: `mpp-vscode/src/bridge/mpp-core.ts`, `mpp-vscode/src/providers/chat-view.ts` |
| 23 | +- **JVM CLI**: `CodingCliRenderer`, `ConsoleRenderer` |
43 | 24 |
|
44 | | -- **CLI/TUI (TypeScript)**: Use `mpp-ui/src/jsMain/typescript/design-system/` → Import `semanticInk` / `semanticChalk` |
45 | | -- **Compose (Desktop/Android)**: Use `AutoDevColors` from `cc.unitmesh.devins.ui.compose.theme` → Or `MaterialTheme.colorScheme` |
46 | | -- **DO NOT hardcode colors** \(e.g., `Color(0xFF...)` or `#hex`\). Always use design tokens for consistency across platforms. |
47 | | -- **Docs**: See `docs/design-system-color.md` (TypeScript) and `docs/design-system-compose.md` (Kotlin Compose) |
| 25 | +## Design System |
48 | 26 |
|
49 | | -## AutoDev CLI Quick Test |
| 27 | +- **CLI/TUI**: Use `semanticInk`/`semanticChalk` from `mpp-ui/src/jsMain/typescript/design-system/` |
| 28 | +- **Compose**: Use `AutoDevColors` or `MaterialTheme.colorScheme` |
| 29 | +- **NO hardcoded colors** - always use design tokens |
| 30 | +- **Docs**: `docs/design-system-color.md`, `docs/design-system-compose.md` |
50 | 31 |
|
51 | | -1. Build MPP Core: `cd /Volumes/source/ai/autocrud && ./gradlew :mpp-core:assembleJsPackage` |
52 | | -2. Build and run MPP CLI: `cd mpp-ui && npm run build && npm run start` |
| 32 | +## Quick Commands |
53 | 33 |
|
54 | | -## IntelliJ IDEA Plugin (mpp-idea) |
| 34 | +**CLI Test:** |
| 35 | +```bash |
| 36 | +./gradlew :mpp-core:assembleJsPackage |
| 37 | +cd mpp-ui && npm run build && npm run start |
| 38 | +``` |
55 | 39 |
|
56 | | -`mpp-idea` is a standalone Gradle project with `includeBuild` dependency on parent project. |
| 40 | +**IDEA Plugin:** |
57 | 41 |
|
58 | | -**Build Commands:** |
59 | 42 | ```bash |
60 | | -# Compile (from project root) |
61 | 43 | cd mpp-idea && ../gradlew compileKotlin |
62 | | - |
63 | | -# Run tests (JewelRendererTest uses JUnit 5, no IntelliJ Platform required) |
64 | 44 | cd mpp-idea && ../gradlew test --tests "cc.unitmesh.devins.idea.renderer.JewelRendererTest" |
65 | | - |
66 | | -# Build plugin |
67 | 45 | cd mpp-idea && ../gradlew buildPlugin |
68 | 46 | ``` |
69 | 47 |
|
70 | | -**Notes:** |
71 | | -- Do NOT use `./gradlew :mpp-idea:compileKotlin` from root - use `cd mpp-idea && ../gradlew` instead |
72 | | -- `IdeaAgentViewModelTest` requires IntelliJ Platform Test Framework |
73 | | -- `JewelRendererTest` can run standalone with JUnit 5 |
74 | | - |
75 | | -## VSCode Plugin (mpp-vscode) |
76 | | - |
77 | | -`mpp-vscode` is a standalone npm package with `devDependencies` on parent project. |
78 | | - |
79 | | -## Release |
| 48 | +**Release:** |
80 | 49 |
|
81 | | -1. modify version in `gradle.properties` |
82 | | -2. publish cli version: `cd mpp-ui && npm publish:remote` |
83 | | - |
84 | | -### Desktop Compose App |
85 | | - |
86 | | -1. publish Desktop: `git tag compose-vVersion` (same in `gradle.properties`), `git push origin compose-vVersion` |
87 | | -2. draft release in GitHub, run gh cli: `gh release create compose-vVersion --draft` |
| 50 | +```bash |
| 51 | +# 1. Update version in gradle.properties |
| 52 | +# 2. CLI: cd mpp-ui && npm publish:remote |
| 53 | +# 3. Desktop: git tag compose-vX.X.X && git push origin compose-vX.X.X |
| 54 | +# 4. gh release create compose-vX.X.X --draft |
| 55 | +``` |
88 | 56 |
|
0 commit comments