From c7ae7a83f0eb6c840ce443384eb0da11bdbd7264 Mon Sep 17 00:00:00 2001 From: Fabian DEVEL Date: Tue, 31 Mar 2026 08:39:49 +0200 Subject: [PATCH 1/4] chore(Agents): Add AGENTS.md --- AGENTS.md | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..037f6423d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,114 @@ +# Core - Infomaniak Android Library + +## Package Identity + +Modular Android library consumed via Gradle composite builds. Provides shared authentication, networking, UI components, and utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK 35. + +## Setup & Development + +```bash +# Build all Core modules +./gradlew Core:assemble + +# Run Core tests +./gradlew Core:test + +# Lint Core with ktlint +./gradlew Core:ktlintCheck + +# Build specific module +./gradlew Core:Auth:build +./gradlew Core:Network:build +``` + +## Module Categories + +### Authentication & Security +- **Auth**: OAuth2 flow, account management, token storage + - Key: `Auth/src/main/java/com/infomaniak/core/auth/` + - Example: `AuthTokenRepository.kt` for token handling +- **TwoFactorAuth**: 2FA verification UI (Front) and backend (Back) +- **AppIntegrity**: App attestation and integrity checks + +### Networking +- **Network**: Ktor HTTP client with interceptors + - Key: `Network/Ktor/src/main/` + - Models: `Network/Models/src/main/` +- **Ktor**: Low-level Ktor extensions + +### UI Components +- **Ui:Compose**: Modern Compose components + - Theme: `Ui/Compose/Theme/src/main/` + - Components: `Ui/Compose/BottomStickyButtonScaffolds/`, `Basics/` +- **Ui:View**: Legacy XML components (SharedViews, EdgeToEdge) +- **CrossAppLogin**: Cross-application authentication + +### Utilities & Features +- **Common**: Shared extensions, formatters, utilities + - HTTP: `HttpClientProvider.kt` for Ktor client setup + - Formatters: `FormatterFileSize.kt`, date formatters +- **Coil**: Image loading configuration +- **Matomo**: Analytics tracking +- **Sentry**: Error reporting +- **Notifications**: Push notification handling +- **Stores**: In-app review and update support + +### Legacy Support +- **Legacy**: Backward compatibility module + - Use: `implementation(project(":Core:Legacy"))` + - Init in Application: `InfomaniakCore.init(...)` + +## Patterns & Conventions + +- **Module naming**: Descriptive, PascalCase (e.g., `AppVersionChecker`, `TwoFactorAuth`) +- **Composite build**: Consume via Maven coordinates `core.infomaniak.core.` +- **Ktlint**: Version 1.7.1, Android mode enabled +- **No main**: Libraries have no Application class + +## Key Files + +- Build plugin: `build-logic/composite/src/main/kotlin/CoreCompositePlugin.kt` +- Dependency catalog: `gradle/core.versions.toml` +- Shared values: `SharedValues/src/main/` + +## JIT Index + +### Find module implementations +```bash +# Auth utilities +rg -n "AuthToken|AccountManager" Core/Auth/ + +# Network interceptors +rg -n "Interceptor|RequestBuilder" Core/Network/ + +# Compose components +rg -n "@Composable" Core/Ui/Compose/ + +# Common extensions +rg -n "fun|suspend" Core/Common/src/main/java/com/infomaniak/core/common/ +``` + +### Test file locations +```bash +# Unit tests per module +rg -n "@Test" Core/*/src/test/ + +# Example: Auth tests +find Core/Auth/src/test -name "*.kt" + +# Example: Common utils tests +find Core/Common/src/test -name "*.kt" +``` + +## Common Gotchas + +- **Composite build**: Changes in Core are immediately available in consuming projects +- **Dependency mapping**: Modules use Maven coordinates but resolve locally +- **Legacy init**: Must call `InfomaniakCore.init()` in consuming app's Application class +- **Ktor client**: Use `HttpClientProvider` from Common for consistent setup + +## Pre-PR Checks + +```bash +./gradlew Core:test && ./gradlew Core:ktlintCheck +``` From 68e491ca6bf0c5ff20ccd01c028b204ae29ec653 Mon Sep 17 00:00:00 2001 From: Fabian DEVEL Date: Tue, 31 Mar 2026 09:56:11 +0200 Subject: [PATCH 2/4] chore(Agents): Fix maven build --- AGENTS.md | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 037f6423d..e1c2bc2c2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,8 @@ ## Package Identity -Modular Android library consumed via Gradle composite builds. Provides shared authentication, networking, UI components, and utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK 35. +Modular Android library consumed via Gradle composite builds. Provides shared authentication, networking, UI components, and +utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK 35. ## Setup & Development @@ -24,29 +25,33 @@ Modular Android library consumed via Gradle composite builds. Provides shared au ## Module Categories ### Authentication & Security + - **Auth**: OAuth2 flow, account management, token storage - - Key: `Auth/src/main/java/com/infomaniak/core/auth/` - - Example: `AuthTokenRepository.kt` for token handling + - Key: `Auth/src/main/java/com/infomaniak/core/auth/` + - Example: `AuthTokenRepository.kt` for token handling - **TwoFactorAuth**: 2FA verification UI (Front) and backend (Back) - **AppIntegrity**: App attestation and integrity checks ### Networking + - **Network**: Ktor HTTP client with interceptors - - Key: `Network/Ktor/src/main/` - - Models: `Network/Models/src/main/` + - Key: `Network/Ktor/src/main/` + - Models: `Network/Models/src/main/` - **Ktor**: Low-level Ktor extensions ### UI Components + - **Ui:Compose**: Modern Compose components - - Theme: `Ui/Compose/Theme/src/main/` - - Components: `Ui/Compose/BottomStickyButtonScaffolds/`, `Basics/` + - Theme: `Ui/Compose/Theme/src/main/` + - Components: `Ui/Compose/BottomStickyButtonScaffolds/`, `Basics/` - **Ui:View**: Legacy XML components (SharedViews, EdgeToEdge) - **CrossAppLogin**: Cross-application authentication ### Utilities & Features + - **Common**: Shared extensions, formatters, utilities - - HTTP: `HttpClientProvider.kt` for Ktor client setup - - Formatters: `FormatterFileSize.kt`, date formatters + - HTTP: `HttpClientProvider.kt` for Ktor client setup + - Formatters: `FormatterFileSize.kt`, date formatters - **Coil**: Image loading configuration - **Matomo**: Analytics tracking - **Sentry**: Error reporting @@ -54,14 +59,15 @@ Modular Android library consumed via Gradle composite builds. Provides shared au - **Stores**: In-app review and update support ### Legacy Support + - **Legacy**: Backward compatibility module - - Use: `implementation(project(":Core:Legacy"))` - - Init in Application: `InfomaniakCore.init(...)` + - Use: `implementation(project(":Core:Legacy"))` + - Init in Application: `InfomaniakCore.init(...)` ## Patterns & Conventions - **Module naming**: Descriptive, PascalCase (e.g., `AppVersionChecker`, `TwoFactorAuth`) -- **Composite build**: Consume via Maven coordinates `core.infomaniak.core.` +- **Composite build**: Consume via Maven coordinates `com.infomaniak.core:` - **Ktlint**: Version 1.7.1, Android mode enabled - **No main**: Libraries have no Application class @@ -74,6 +80,7 @@ Modular Android library consumed via Gradle composite builds. Provides shared au ## JIT Index ### Find module implementations + ```bash # Auth utilities rg -n "AuthToken|AccountManager" Core/Auth/ @@ -89,6 +96,7 @@ rg -n "fun|suspend" Core/Common/src/main/java/com/infomaniak/core/common/ ``` ### Test file locations + ```bash # Unit tests per module rg -n "@Test" Core/*/src/test/ From 62ad46f17a116709737a5e61d7be2d3bf819d19e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Apr 2026 06:16:51 +0000 Subject: [PATCH 3/4] docs: Fix AGENTS.md paths, clarify Core: prefix, remove version pin Agent-Logs-Url: https://github.com/Infomaniak/android-core/sessions/dd89db9d-1f87-4abe-adf6-e39748ade234 Co-authored-by: FabianDevel <45429131+FabianDevel@users.noreply.github.com> --- AGENTS.md | 53 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index e1c2bc2c2..bc41a152d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,19 +7,23 @@ utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK ## Setup & Development +> **Note**: When this library is included as a Gradle composite build inside another project under the `:Core` path, all +> task paths below should be prefixed with `Core:` (e.g., `./gradlew Core:assemble`). When working in this repository +> standalone, omit the prefix. + ```bash -# Build all Core modules -./gradlew Core:assemble +# Build all modules +./gradlew assemble -# Run Core tests -./gradlew Core:test +# Run all tests +./gradlew test -# Lint Core with ktlint -./gradlew Core:ktlintCheck +# Lint with ktlint +./gradlew ktlintCheck -# Build specific module -./gradlew Core:Auth:build -./gradlew Core:Network:build +# Build a specific module +./gradlew :Auth:build +./gradlew :Network:build ``` ## Module Categories @@ -27,8 +31,8 @@ utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK ### Authentication & Security - **Auth**: OAuth2 flow, account management, token storage - - Key: `Auth/src/main/java/com/infomaniak/core/auth/` - - Example: `AuthTokenRepository.kt` for token handling + - Key: `Auth/src/main/kotlin/com/infomaniak/core/auth/` + - Examples: token/interceptor/authenticator classes (e.g., `TokenInterceptor.kt`, `TokenAuthenticator.kt`, `CredentialManager.kt`) - **TwoFactorAuth**: 2FA verification UI (Front) and backend (Back) - **AppIntegrity**: App attestation and integrity checks @@ -50,7 +54,6 @@ utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK ### Utilities & Features - **Common**: Shared extensions, formatters, utilities - - HTTP: `HttpClientProvider.kt` for Ktor client setup - Formatters: `FormatterFileSize.kt`, date formatters - **Coil**: Image loading configuration - **Matomo**: Analytics tracking @@ -67,13 +70,13 @@ utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK ## Patterns & Conventions - **Module naming**: Descriptive, PascalCase (e.g., `AppVersionChecker`, `TwoFactorAuth`) -- **Composite build**: Consume via Maven coordinates `com.infomaniak.core:` -- **Ktlint**: Version 1.7.1, Android mode enabled +- **Composite build**: Consume via Maven coordinates `com.infomaniak.core:`, where nested Gradle project paths map `:` to `.` in the artifact name (e.g., `:TwoFactorAuth:Front` → `com.infomaniak.core:TwoFactorAuth.Front`) +- **Ktlint**: Android mode enabled (version set in `build.gradle.kts`) - **No main**: Libraries have no Application class ## Key Files -- Build plugin: `build-logic/composite/src/main/kotlin/CoreCompositePlugin.kt` +- Build plugin: `build-logic/composite/src/main/kotlin/com/infomaniak/core/composite/CoreCompositePlugin.kt` - Dependency catalog: `gradle/core.versions.toml` - Shared values: `SharedValues/src/main/` @@ -83,29 +86,29 @@ utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK ```bash # Auth utilities -rg -n "AuthToken|AccountManager" Core/Auth/ +rg -n "AuthToken|AccountManager" Auth/ # Network interceptors -rg -n "Interceptor|RequestBuilder" Core/Network/ +rg -n "Interceptor|RequestBuilder" Network/ # Compose components -rg -n "@Composable" Core/Ui/Compose/ +rg -n "@Composable" Ui/Compose/ # Common extensions -rg -n "fun|suspend" Core/Common/src/main/java/com/infomaniak/core/common/ +rg -n "fun|suspend" Common/src/main/kotlin/com/infomaniak/core/common/ ``` ### Test file locations ```bash # Unit tests per module -rg -n "@Test" Core/*/src/test/ +rg -n "@Test" */src/test/ # Example: Auth tests -find Core/Auth/src/test -name "*.kt" +find Auth/src/test -name "*.kt" # Example: Common utils tests -find Core/Common/src/test -name "*.kt" +find Common/src/test -name "*.kt" ``` ## Common Gotchas @@ -113,10 +116,14 @@ find Core/Common/src/test -name "*.kt" - **Composite build**: Changes in Core are immediately available in consuming projects - **Dependency mapping**: Modules use Maven coordinates but resolve locally - **Legacy init**: Must call `InfomaniakCore.init()` in consuming app's Application class -- **Ktor client**: Use `HttpClientProvider` from Common for consistent setup +- **Ktor client**: Use the canonical `createHttpClient(...)` factory under `Network/Ktor/src/main/kotlin/CreateHttpClient.kt` for consistent setup ## Pre-PR Checks ```bash +# Standalone (in this repository) +./gradlew test && ./gradlew ktlintCheck + +# As composite build (prefix with Core: when consumed from another project) ./gradlew Core:test && ./gradlew Core:ktlintCheck ``` From dc9fe4a17227b914341abe6d298bfacf7594dede Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Apr 2026 06:21:01 +0000 Subject: [PATCH 4/4] docs: Add CreateHttpClient.kt reference in Network section Agent-Logs-Url: https://github.com/Infomaniak/android-core/sessions/f71fbdb5-265a-456b-9894-4fd263a1881c Co-authored-by: FabianDevel <45429131+FabianDevel@users.noreply.github.com> --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index bc41a152d..47cb0ed51 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,6 +40,7 @@ utilities across Infomaniak apps. Designed for JDK 17+, minSdk 27, compiled SDK - **Network**: Ktor HTTP client with interceptors - Key: `Network/Ktor/src/main/` + - HTTP client factory: `Network/Ktor/src/main/kotlin/CreateHttpClient.kt` - Models: `Network/Models/src/main/` - **Ktor**: Low-level Ktor extensions