You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e3a002a
Browse filesBrowse the repository at this point in the historyBrowse files
> - Use **`library-insight scan <jar|aar|klib|directory|maven-coordinate>`** to index compiled libraries.
29
-
> -**BOM & KMP Scanning:** For Bill of Materials (BOM) coordinates (e.g. `androidx.compose:compose-bom:2024.09.00` or `com.google.firebase:firebase-bom`) and KMP libraries, `library-insight scan` automatically resolves member libraries and applies target platform filtering (`-p, --platform android` by default) to filter out non-target KMP variants (iOS, JS, Wasm), stubs, and lints in seconds. Pass `--platform all` to scan all variants.
30
-
> -**Zero-Knowledge Version Discovery:** If the user does not specify a library version, inspect `gradle/libs.versions.toml` or `build.gradle.kts` to discover the project's declared version. If not present in the project, run **`library-insight search-central <query>`** to query the latest coordinate from Maven Central.
29
+
> -**BOM & KMP Scanning:** For Bill of Materials (BOM) coordinates (e.g. `androidx.compose:compose-bom:2024.09.00` or `com.google.firebase:firebase-bom`) and KMP libraries, `library-insight scan` automatically resolves member libraries and applies target platform filtering (`-p, --platform android` by default) to filter out non-target KMP variants (iOS, JS, Wasm), stubs, and lints in seconds. Pass `--platform all` to scan all variants. Use **`-i, --include <pattern>`** (e.g. `-i "*foundation*"` or `-i "*ui*"`) to selectively scan matching member artifacts. **AI Agent Rule:** Use surrounding wildcards like `-i "*foundation*"` for include filters to match full group/artifact coordinates. Automatically infer and append missing `-i` and `-p` flags based on intent.
30
+
> -**Zero-Knowledge Version Discovery:** If the user does not specify a library version, inspect `gradle/libs.versions.toml` or `build.gradle.kts` to discover the project's declared version. For standard open-source dependencies not declared in the project, run **`library-insight search-central <query>`** to query Maven Central. (Note: AndroidX and Compose libraries are hosted on Google Maven, so check `libs.versions.toml` or `build.gradle.kts` directly).
31
31
> - Use **`library-insight scan-source <directory>`** to index a local Java/Kotlin source project without compilation.
32
32
>
33
33
> **Querying**
34
34
>
35
35
> - Use **`library-insight search <query>`** to locate packages, classes, methods, or properties.
36
36
> - Use **`library-insight explain <class|function|member> [--deep]`** to inspect a class or top-level Kotlin symbol. Always pass **`--deep`** (or **`-d`**) when exploring DSLs or multi-type APIs (e.g. `library-insight explain Grid --deep` auto-resolves top-level `GridKt` and recursively includes all referenced receiver scopes like `GridScope` and `GridConfigurationScope` in 1 single turn).
37
-
> - Use **`library-insight examples <class>`** to generate typical usage examples.
37
+
> -**Inner & Companion Class Shell Escaping:** When querying nested or Companion classes in bash/zsh shell, escape the dollar sign with quotes (e.g. `library-insight explain "GridTrackSize\$Companion"`).
38
+
> - Use **`library-insight examples <class>`** to generate typical usage examples (for top-level Kotlin functions, pass the facade class name e.g. `examples GridKt`).
38
39
>
39
40
> **Analysis**
40
41
>
@@ -154,15 +155,13 @@ or
154
155
155
156
## Additional Guidance for AI Agents
156
157
157
-
When answering questions about a library or project:
158
+
When answering questions or generating code for a library or project, AI agents MUST follow this mandatory step-by-step workflow:
158
159
159
-
1. Index the target if it has not already been indexed.
160
-
2. Search before explaining.
161
-
3. Explain only the symbols relevant to the user's request.
162
-
4. Avoid loading the full index into context.
163
-
5. Prefer focused symbol lookups over large exports.
164
-
6. Generate AI context (`ai-export`) only when broad project understanding is required.
165
-
7. When an MCP server is available, prefer MCP tools over spawning CLI processes.
160
+
1.**Step 1: Version & Coordinates Discovery:** Check `gradle/libs.versions.toml` or `build.gradle.kts` to discover declared library versions. For undeclared libraries, run `library-insight search-central <query>` on Maven Central.
161
+
2.**Step 2: Indexing:** Run `library-insight scan <coordinate> -i "<include-pattern>" -p android` (or `scan-source`) to index the target library.
162
+
3.**Step 3: Mandatory Symbol Search:** ALWAYS run `library-insight search <query>` (e.g. `library-insight search Grid`) FIRST to discover all matching packages, classes, methods, and properties in the index. **DO NOT skip `search` or jump directly to `explain` without searching first.**
163
+
4.**Step 4: Exact Symbol Priority Rule:** Run `library-insight explain <ExactSymbol> --deep` on the exact requested symbol (e.g. `Grid`) or top match from `search` before considering secondary alternatives.
164
+
5.**Step 5: Code Generation & File Edits Rule:** Directly modify or create the target source file in the user's project with the version-matched code instead of only outputting raw code snippets in the chat response.
> - Use **`library-insight scan <jar|aar|klib|directory|maven-coordinate>`** to index compiled libraries.
29
-
> -**BOM & KMP Scanning:** For Bill of Materials (BOM) coordinates (e.g. `androidx.compose:compose-bom:2024.09.00` or `com.google.firebase:firebase-bom`) and KMP libraries, `library-insight scan` automatically resolves member libraries and applies target platform filtering (`-p, --platform android` by default) to filter out non-target KMP variants (iOS, JS, Wasm), stubs, and lints in seconds. Pass `--platform all` to scan all variants.
30
-
> -**Zero-Knowledge Version Discovery:** If the user does not specify a library version, inspect `gradle/libs.versions.toml` or `build.gradle.kts` to discover the project's declared version. If not present in the project, run **`library-insight search-central <query>`** to query the latest coordinate from Maven Central.
29
+
> -**BOM & KMP Scanning:** For Bill of Materials (BOM) coordinates (e.g. `androidx.compose:compose-bom:2024.09.00` or `com.google.firebase:firebase-bom`) and KMP libraries, `library-insight scan` automatically resolves member libraries and applies target platform filtering (`-p, --platform android` by default) to filter out non-target KMP variants (iOS, JS, Wasm), stubs, and lints in seconds. Pass `--platform all` to scan all variants. Use **`-i, --include <pattern>`** (e.g. `-i "*foundation*"` or `-i "*ui*"`) to selectively scan matching member artifacts. **AI Agent Rule:** Use surrounding wildcards like `-i "*foundation*"` for include filters to match full group/artifact coordinates. Automatically infer and append missing `-i` and `-p` flags based on intent.
30
+
> -**Zero-Knowledge Version Discovery:** If the user does not specify a library version, inspect `gradle/libs.versions.toml` or `build.gradle.kts` to discover the project's declared version. For standard open-source dependencies not declared in the project, run **`library-insight search-central <query>`** to query Maven Central. (Note: AndroidX and Compose libraries are hosted on Google Maven, so check `libs.versions.toml` or `build.gradle.kts` directly).
31
31
> - Use **`library-insight scan-source <directory>`** to index a local Java/Kotlin source project without compilation.
32
32
>
33
33
> **Querying**
34
34
>
35
35
> - Use **`library-insight search <query>`** to locate packages, classes, methods, or properties.
36
36
> - Use **`library-insight explain <class|function|member> [--deep]`** to inspect a class or top-level Kotlin symbol. Always pass **`--deep`** (or **`-d`**) when exploring DSLs or multi-type APIs (e.g. `library-insight explain Grid --deep` auto-resolves top-level `GridKt` and recursively includes all referenced receiver scopes like `GridScope` and `GridConfigurationScope` in 1 single turn).
37
-
> - Use **`library-insight examples <class>`** to generate typical usage examples.
37
+
> -**Inner & Companion Class Shell Escaping:** When querying nested or Companion classes in bash/zsh shell, escape the dollar sign with quotes (e.g. `library-insight explain "GridTrackSize\$Companion"`).
38
+
> - Use **`library-insight examples <class>`** to generate typical usage examples (for top-level Kotlin functions, pass the facade class name e.g. `examples GridKt`).
38
39
>
39
40
> **Analysis**
40
41
>
@@ -154,14 +155,12 @@ or
154
155
155
156
## Additional Guidance for AI Agents
156
157
157
-
When answering questions about a library or project:
158
+
When answering questions or generating code for a library or project, AI agents MUST follow this mandatory step-by-step workflow:
158
159
159
-
1. Index the target if it has not already been indexed.
160
-
2. Search before explaining.
161
-
3. Explain only the symbols relevant to the user's request.
162
-
4. Avoid loading the full index into context.
163
-
5. Prefer focused symbol lookups over large exports.
164
-
6. Generate AI context (`ai-export`) only when broad project understanding is required.
165
-
7. When an MCP server is available, prefer MCP tools over spawning CLI processes.
160
+
1.**Step 1: Version & Coordinates Discovery:** Check `gradle/libs.versions.toml` or `build.gradle.kts` to discover declared library versions. For undeclared libraries, run `library-insight search-central <query>` on Maven Central.
161
+
2.**Step 2: Indexing:** Run `library-insight scan <coordinate> -i "<include-pattern>" -p android` (or `scan-source`) to index the target library.
162
+
3.**Step 3: Mandatory Symbol Search:** ALWAYS run `library-insight search <query>` (e.g. `library-insight search Grid`) FIRST to discover all matching packages, classes, methods, and properties in the index. **DO NOT skip `search` or jump directly to `explain` without searching first.**
163
+
4.**Step 4: Exact Symbol Priority Rule:** Run `library-insight explain <ExactSymbol> --deep` on the exact requested symbol (e.g. `Grid`) or top match from `search` before considering secondary alternatives.
164
+
5.**Step 5: Code Generation & File Edits Rule:** Directly modify or create the target source file in the user's project with the version-matched code instead of only outputting raw code snippets in the chat response.
Copy file name to clipboardExpand all lines: docs/ai-agents.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,12 +112,15 @@ Here are concrete examples of how you can prompt AI coding assistants (Cursor, C
112
112
### Example 5: Version Catalog Auto-Discovery & Zero-Knowledge Scanning
113
113
114
114
> **Developer Prompt:**
115
-
> _"I want to create a grid layout using Compose, but I don't know the exact library version. Find the library name and version from our project's version catalog (`gradle/libs.versions.toml`), scan it with `library-insight`, and generate the code for me."_
115
+
> _"I want to create a grid layout using Compose BOM in our project, but I don't know the exact library version. Find the library name and version from our project's version catalog (`gradle/libs.versions.toml`), scan it with `library-insight`, and implement the grid component inside a new file `app/src/main/java/com/example/app/ComplexGridLayout.kt`."_
116
116
117
117
**AI Agent Response Workflow:**
118
118
119
119
1.**Version Catalog Inspection**: The AI Agent inspects `gradle/libs.versions.toml` or `build.gradle.kts` to locate the project's declared library coordinates or BOM references (e.g. `androidx.compose.foundation:foundation-layout` or `compose-bom = "2024.09.00"`).
120
120
_(If not declared in the project, the agent runs `library-insight search-central "foundation-layout"` to query the latest release on Maven Central)._
121
-
2.**Recommends & Executes Scan**: The agent recommends the exact command (`library-insight scan androidx.compose.foundation:foundation-layout:1.12.0` or `library-insight scan androidx.compose:compose-bom:2024.09.00`) and executes it immediately.
122
-
3.**Explores & Explains**: Runs `library-insight explain Grid --deep` to verify `GridScope`, `GridConfigurationScope`, and parameter signatures for that specific version.
123
-
4.**Generates Precise Code**: Delivers exact, version-matched Kotlin code tailored to the developer's project configuration!
121
+
2.**Auto-Infers Options & Executes Scan**: The agent automatically infers missing parameters (such as adding `-i "foundation*"` or `-p android` for BOM coordinates) to avoid downloading unnecessary member libraries or platform variants, recommending and executing:
3.**Mandatory Symbol Search & Explanation**: The agent FIRST executes `library-insight search Grid` to discover all matching symbols across indexed packages, followed by `library-insight explain Grid --deep` to verify `GridScope`, `GridConfigurationScope`, and parameter signatures for that specific version.
126
+
4.**Writes Project File**: Automatically creates `app/src/main/java/com/example/app/ComplexGridLayout.kt` with 100% version-matched, working Kotlin code tailored to the developer's project configuration!
*(Filters out non-Android/non-JVM KMP targets like iOS, JS, Wasm, stubs, and lints by default. Use `--platform all` to scan all 200+ variants).*
79
+
*(Filters out non-Android KMP targets by default. Use `-i, --include <pattern>` to selectively target specific BOM member artifacts like `-i "compose-ui*"` or `-i "*animation*"`).*
80
80
81
81
-**Scan Local Source Code:**
82
82
@@ -131,7 +131,7 @@ Here is how developers and AI coding agents use Library Insight step-by-step:
131
131
```bash
132
132
library-insight mcp
133
133
```
134
-
_(Integrates natively with Cursor, Windsurf, or Claude Desktop)._
134
+
_(Integrates natively with Android Studio Gemini, Codex, Cursor, Windsurf, or Claude Desktop)._
0 commit comments