Skip to content

Commit 12b89e4

Browse files
authored
Merge pull request #520 from synonymdev/feat/restore-claude-review
feat: AI agents dev setup
2 parents 57c789f + 7266315 commit 12b89e4

File tree

11 files changed

+495
-11
lines changed

11 files changed

+495
-11
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash",
5+
"Read",
6+
"Edit",
7+
"Write",
8+
"WebFetch",
9+
"mcp__ide__getDiagnostics",
10+
"WebSearch",
11+
"mcp__github__pull_request_read",
12+
"mcp__github__search_pull_requests",
13+
"mcp__github__list_pull_requests",
14+
"mcp__github__get_me",
15+
"mcp__github__get_file_contents"
16+
],
17+
"deny": [],
18+
"ask": [
19+
"Bash(rm -rf:*)",
20+
"Bash(git commit:*)",
21+
"Bash(git push:*)"
22+
],
23+
"additionalDirectories": [
24+
]
25+
}
26+
}

.cursor/notes/libs.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Android Libraries Documentation Reference
2+
3+
This document provides a comprehensive reference for all libraries used in the bitkit-android project, including their documentation links and key usage patterns.
4+
5+
## Core Android Libraries
6+
7+
### Kotlin
8+
- **Documentation**: https://kotlinlang.org/docs/
9+
- **API Reference**: https://kotlinlang.org/api/latest/jvm/stdlib/
10+
11+
### Android Core
12+
- **Core KTX**: https://developer.android.com/kotlin/ktx
13+
- **AppCompat**: https://developer.android.com/jetpack/androidx/releases/appcompat
14+
- **Material Design**: https://material.io/develop/android
15+
- **Core Splashscreen**: https://developer.android.com/develop/ui/views/launch/splash-screen
16+
17+
## UI Framework
18+
19+
### Jetpack Compose
20+
- **Main Documentation**: https://developer.android.com/jetpack/compose
21+
- **BOM Mapping**: https://developer.android.com/develop/ui/compose/bom/bom-mapping
22+
- **Material 3**: https://developer.android.com/jetpack/compose/designsystems/material3
23+
- **Navigation**: https://developer.android.com/jetpack/compose/navigation
24+
- **Tooling**: https://developer.android.com/jetpack/compose/tooling
25+
26+
### Accompanist
27+
- **Documentation**: https://google.github.io/accompanist/
28+
- **Permissions**: https://google.github.io/accompanist/permissions/
29+
- **Pager Indicators**: https://google.github.io/accompanist/pager/
30+
31+
### Layout
32+
- **ConstraintLayout Compose**: https://developer.android.com/jetpack/compose/layouts/constraintlayout
33+
34+
## Architecture & Dependency Injection
35+
36+
### Hilt
37+
- **Documentation**: https://dagger.dev/hilt/
38+
- **Android Guide**: https://developer.android.com/training/dependency-injection/hilt-android
39+
- **Compose Integration**: https://developer.android.com/jetpack/compose/libraries#hilt
40+
41+
### Lifecycle Components
42+
- **Documentation**: https://developer.android.com/jetpack/androidx/releases/lifecycle
43+
- **ViewModel**: https://developer.android.com/topic/libraries/architecture/viewmodel
44+
- **Compose Integration**: https://developer.android.com/jetpack/compose/libraries#viewmodel
45+
46+
### Data Persistence
47+
- **DataStore Preferences**: https://developer.android.com/topic/libraries/architecture/datastore
48+
- **Room**: https://developer.android.com/training/data-storage/room
49+
50+
## Networking & Serialization
51+
52+
### Ktor
53+
- **Documentation**: https://ktor.io/docs/
54+
- **Client Documentation**: https://ktor.io/docs/getting-started-ktor-client.html
55+
- **Android Guide**: https://ktor.io/docs/client-engines.html#android
56+
57+
### Serialization
58+
- **Kotlinx Serialization**: https://kotlinlang.org/docs/serialization.html
59+
- **Protobuf**: https://protobuf.dev/
60+
61+
## Bitcoin & Lightning Network
62+
63+
### LDK Node Android
64+
- **GitHub**: https://github.com/synonymdev/ldk-node (Fork)
65+
- **Upstream Docs**: https://lightningdevkit.org/
66+
- **API Reference**: https://docs.rs/ldk-node/latest/ldk_node/
67+
68+
### Bitkit Core
69+
- **GitHub**: https://github.com/synonymdev/bitkit-core
70+
- **Custom Android bindings for Bitcoin operations**
71+
72+
### Cryptography
73+
- **BouncyCastle**: https://www.bouncycastle.org/java.html
74+
- **Provider Documentation**: https://www.bouncycastle.org/documentation.html
75+
76+
## Media & Scanning
77+
78+
### Camera
79+
- **CameraX**: https://developer.android.com/training/camerax
80+
- **Camera2 API**: https://developer.android.com/training/camerax/architecture
81+
82+
### Barcode/QR Scanning
83+
- **ZXing**: https://github.com/zxing/zxing
84+
- **ML Kit Barcode**: https://developers.google.com/ml-kit/vision/barcode-scanning
85+
86+
### Animations
87+
- **Lottie Compose**: https://airbnb.io/lottie/#/android-compose
88+
89+
## Firebase
90+
91+
### Firebase Platform
92+
- **Documentation**: https://firebase.google.com/docs/android/setup
93+
- **Messaging**: https://firebase.google.com/docs/cloud-messaging/android/client
94+
- **Analytics**: https://firebase.google.com/docs/analytics/get-started?platform=android
95+
96+
## Security & Authentication
97+
98+
### Biometric
99+
- **Documentation**: https://developer.android.com/jetpack/androidx/releases/biometric
100+
- **Guide**: https://developer.android.com/training/sign-in/biometric-auth
101+
102+
## Background Processing
103+
104+
### WorkManager
105+
- **Documentation**: https://developer.android.com/topic/libraries/architecture/workmanager
106+
- **Hilt Integration**: https://developer.android.com/training/dependency-injection/hilt-jetpack
107+
108+
## Utilities
109+
110+
### Date/Time
111+
- **Kotlinx DateTime**: https://github.com/Kotlin/kotlinx-datetime
112+
113+
### Charts
114+
- **Compose Charts**: https://github.com/ehsannarmani/ComposeCharts
115+
116+
### Native Libraries
117+
- **JNA**: https://github.com/java-native-access/jna
118+
119+
## Testing Libraries
120+
121+
### Unit Testing
122+
- **JUnit**: https://junit.org/junit4/
123+
- **Mockito Kotlin**: https://github.com/mockito/mockito-kotlin
124+
- **Robolectric**: http://robolectric.org/
125+
- **Turbine**: https://github.com/cashapp/turbine
126+
127+
### Android Testing
128+
- **Espresso**: https://developer.android.com/training/testing/espresso
129+
- **Compose Testing**: https://developer.android.com/jetpack/compose/testing
130+
- **Hilt Testing**: https://developer.android.com/training/dependency-injection/hilt-testing
131+
132+
## Key Configuration Notes
133+
134+
### Compose Compiler Flags
135+
- StrongSkipping is disabled
136+
- OptimizeNonSkippingGroups is enabled
137+
138+
### Build Configuration
139+
- Minimum SDK: 28
140+
- Target SDK: 35
141+
- Kotlin JVM Target: 11
142+
- Compose BOM manages all Compose library versions
143+
144+
## Development Guidelines
145+
146+
### When Adding New Libraries
147+
1. Check if functionality exists in current libraries first
148+
2. Prefer AndroidX/Jetpack libraries when available
149+
3. Ensure compatibility with current Compose BOM version
150+
4. Add to libs.versions.toml for version management
151+
5. Update this documentation with links and usage notes
152+
153+
### Version Management
154+
- All versions are centralized in `gradle/libs.versions.toml`
155+
- Use BOM (Bill of Materials) for related library groups
156+
- Keep major dependencies (Compose, Kotlin, Hilt) aligned
157+
158+
### Testing Strategy
159+
- Unit tests: JUnit + Mockito + Robolectric
160+
- Integration tests: Hilt testing + Room testing
161+
- UI tests: Compose testing + Espresso
162+
- Flow testing: Turbine for StateFlow/Flow testing

.cursor/rules/rules.arch.mdc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
### Business Layer Design Principles
7+
- Always prefer creating specialized methods over complex inline logic
8+
- If a feature implementation requires >5 lines of method chaining, extract to a new method
9+
- New feature implementations should read like the business requirement
10+
11+
### API Design Guidelines
12+
- Create domain-specific methods that match the business language
13+
- Method names should describe WHAT, not HOW
14+
- Hide complexity behind simple, single-purpose APIs
15+
16+
### Refactoring Triggers
17+
- When implementing new features, always ask: "Does the business layer need a new method to support this cleanly?"
18+
- If you see repeated patterns across different features, extract them into reusable methods
19+
- Prefer failing fast with meaningful defaults over complex null handling in business logic
20+
21+
### Business Logic Method Design
22+
- Service methods should handle their own error cases and return simple types
23+
- Let callers focus on business logic, not infrastructure concerns
24+
25+
### Implementation Priority
26+
- Before writing complex feature logic, spend time designing the ideal API first
27+
- Ask: "What would the cleanest possible calling code look like?" then work backwards
28+
- Create the relevant methods needed to achieve that clean calling code

.cursor/rules/rules.main.mdc

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
## Setup rules:
7+
- you're a senior kotlin android developer with very good knowledge of react native and swift, and you're also an expert in bitcoin and lightning network developer, especially with ldk and ldk-node.
8+
- do not add code comments, except for math, complex logic, docs
9+
- do not remove existing code comments
10+
- when working with libraries, always check `.cursor/notes/libs.md` for documentation links and usage patterns
11+
12+
## Rules for communication:
13+
- don't be overly enthusiastic in your words, be terse, plain and factual
14+
- do not reply with arguments why the changes are better
15+
16+
---
17+
18+
## Rules for Android code:
19+
- use official kotlin code guide
20+
- always use trailing commas in parameters list, except after modifiers parameter
21+
- when invoking any composable function, always pass the modifier argument last in the call, sse named parameters if needed to ensure this order, and omit trailing commas after it.
22+
- never modify `strings.xml`
23+
- always keep compose preview at end of file
24+
- split screen composables into stateful wrapper parent and stateless child which can be rendered in the previews.
25+
- wrap previews in `AppThemeSurface` composable, and name them simple, like `Preview`, `Preview2`.
26+
- In every ViewModel file, declare the UiState data class immediately AFTER the ViewModel class (never above it)
27+
- prefer to use `_uiState.update {}` for updating ui state flow value
28+
- prefer to add business logic to UI via viewmodels, which can delegate to repositories/service classes
29+
- avoid creating intermediate tuples/triples variables in UI, instead inline logic to the components properties
30+
- do not wire navigation through viewmodel
31+
- do not add logs to viewmodels
32+
- never add any viewmodel as dependency to another viewmodel
33+
- name composable callback parameters with prefix `onClick`, like `onClickSomething` not `onSomethingClick`
34+
- when possible, pass entire `uiState` to the inner Content composable, not individual parameters for each uiState param
35+
- use existing components from `to.bitkit.ui.components` package
36+
- prefer `Dp` unit for new composable parameters
37+
- prefer notation `5000u` and `5000uL` for unsigned integers and long, avoid using `5000U` and `5000UL`
38+
- logging should happen at repository level, viewmodel methods should not re-log if repository already logs the same thing
39+
- prefer list condition check using `in`, i.e. use `myElement in myList` instead of `myList.contains(myElement)`
40+
- for localization use `getString(resId).replace("{param}", hostParam)`
41+
- always trim user input strings, apply the `userInput.trim()` in the viewmodel
42+
- prefer `runCatching` over try/catch
43+
- in compose callbacks, instead of calling `stringResource()` declare `val context = LocalContext.current` and use `context.getString()`
44+
- prefer using `ULong` wherever possible and write ULong values as `1000u` instead of `1000UL`
45+
- prefer to expression body for potential one-line methods
46+
47+
### Rules for Compose Navigation:
48+
- we use strongly typed navigation in compose, most routes are in `ContentView.kt` file, package `to.bitkit.ui.Routes`
49+
- you should use navigation like: `navController.navigate(Routes.ExternalConnection)`
50+
51+
## Rules to map RN (react native) to Compose:
52+
- use `docs/screens-map.md` for mapping screens
53+
- map `color = "secondary"` to `color = Colors.White64`
54+
- map colors to `Colors.kt`
55+
- map `Pressable` or `TouchableOpacity` to `Modifier.clickableAlpha { onClick() } `
56+
- map text components to compose components from `ui/components/Text.kt`
57+
- map settings components to compose components from from `ui/components/settings/*.kt`
58+
- use spacer components from `ui/components/Spacers.kt`
59+
- map `EChannelStatus.open` from react native to `channelDetails.isChannelReady` in kotlin
60+
- map `EChannelStatus.pending` from react native to `!channelDetails.isChannelReady` in kotlin
61+
- map border to `HorizontalDivider()`, without color or thickness params, default color is already White10.
62+
63+
---
64+
65+
## Rules for Android Unit tests and Instrumentation tests:
66+
- run unit tests for specific files like this: `./gradlew :app:testDevDebugUnitTest --tests "to.bitkit.repositories.LightningRepoTest"`
67+
- write unit tests in the same style and using same libraries as: `CurrencyRepoTest`, `LightningRepoTest`, `WalletRepoTest`
68+
- in unit tests, use asserts from `kotlin.test` and mockito-kotlin for mocks

.github/workflows/claude-code-review.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ jobs:
5151
5252
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
5353
54-
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55-
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
56-
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
54+
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
5755
56+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
57+
# or https://code.claude.com/docs/en/cli-reference for available options
58+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'

.github/workflows/claude.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ on:
1313
jobs:
1414
claude:
1515
if: |
16-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18-
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19-
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') &&
17+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
18+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') &&
19+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
20+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') &&
21+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)) ||
22+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
23+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association))
2024
runs-on: ubuntu-latest
2125
permissions:
2226
contents: write # Allow creating branches/commits
@@ -45,6 +49,5 @@ jobs:
4549

4650
# Optional: Add claude_args to customize behavior and configuration
4751
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48-
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
52+
# or https://code.claude.com/docs/en/cli-reference for available options
4953
# claude_args: '--allowed-tools Bash(gh pr:*)'
50-

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
local.properties
1212
# AI
1313
.ai
14-
.cursor
1514
*.local.*
16-
CLAUDE.md
15+
!*.local.template*
1716
# Secrets
1817
google-services.json
1918
.env

0 commit comments

Comments
 (0)