Skip to content

Extract copilot library service into standalone copilot module#851

Open
RNViththagan wants to merge 4 commits intoballerina-platform:1.7.xfrom
RNViththagan:1.7.x
Open

Extract copilot library service into standalone copilot module#851
RNViththagan wants to merge 4 commits intoballerina-platform:1.7.xfrom
RNViththagan:1.7.x

Conversation

@RNViththagan
Copy link
Copy Markdown
Member

@RNViththagan RNViththagan commented Apr 9, 2026

Description

Extracts the copilot library search and retrieval functionality from flow-model-generator
into a new dedicated copilot module following the standard -core/-ls-extension split.

New module structure

copilot/
modules/
copilot-library-core/
copilot-library-ls-extension/

Changes

  • Repackaged all copilot library classes from io.ballerina.flowmodelgenerator.core.copilot
    to io.ballerina.copilot.library
  • Moved SQLite indexes and copilot/ instruction resources to copilot-library-core
  • Moved CopilotLibraryService and request/response types to copilot-library-ls-extension
  • Migrated all tests accordingly
  • Removed sqlite-jdbc dependency and copilot exports from flow-model-generator-core
  • Incorporates weighted BM25 ranking improvements from Improve library search with weighted BM25 ranking and keyword priority  #844

API compatibility

The following endpoints remain unchanged:

  • copilotLibraryManager/getLibrariesList
  • copilotLibraryManager/getFilteredLibraries
  • copilotLibraryManager/getLibrariesBySearch

This PR extracts the Copilot library search and retrieval functionality from the flow-model-generator module into a dedicated copilot module, splitting it into a core library and a language-server extension, and applies related refactors and build updates.

Key changes

  • New modules

    • copilot-library-core: core search, SQLite indexes, database access, model/conversion utilities, instruction resources, and tests. Declares Java module io.ballerina.copilot.library and includes sqlite-jdbc.
    • copilot-library-ls-extension: language-server integration, JSON-RPC request/response types, service SPI registration, and tests. Declares Java module io.ballerina.copilot.library.extension.
  • Packaging and API surface

    • Repackaged copilot classes from io.ballerina.flowmodelgenerator.core.copilot.* to io.ballerina.copilot.library.* (model, database, util, builder, adapters, service).
    • Request/response types and CopilotLibraryService moved to the ls-extension module.
    • flow-model-generator-core no longer exports the copilot packages and no longer requires sqlite-jdbc.
  • Search ranking and behavior

    • Library search ranking migrated to a weighted BM25 strategy: per-source weighting, primary-keyword boost, package-name coverage, and refined score aggregation. Improvements from a prior PR were incorporated.
  • Build and dependency updates

    • sqlite-jdbc dependency removed from flow-model-generator-core and provided by copilot-library-core.
    • settings.gradle updated to include the two new subprojects.
    • copilot-library-ls-extension build adds tooling/stdlib unpacking tasks and test configuration adjustments.
  • Tests and service registration

    • Copilot-related tests moved/renamed into the new module layout; flow-model-generator test suite entries for those tests were removed.
    • Old SPI registration for the service was removed from flow-model-generator; new SPI entry was added under copilot-library-ls-extension.
  • Minor API change

    • GetAllLibrariesResponse no longer extends AbstractFlowModelResponse and now exposes explicit error fields (errorMsg, stackTrace) with a setError(Throwable) helper.
    • JSON-RPC endpoints remain backward compatible: copilotLibraryManager/getLibrariesList, copilotLibraryManager/getFilteredLibraries, copilotLibraryManager/getLibrariesBySearch.

Intent

  • Modularize and decouple Copilot functionality to improve separation of concerns, maintainability, and dependency isolation, while enhancing search relevance and preserving existing LS-facing JSON-RPC APIs.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a35f4f0-59ec-4c81-a2f4-d5e5ff5b3243

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Refactors Copilot components into a new module io.ballerina.copilot.library, adding build scripts and module descriptors, moving 30+ Java files to the new package hierarchy, and enhancing LibraryDatabaseAccessor search logic with a weighted BM25 scoring approach and configurable MAX_SEARCH_RESULTS.

Changes

Cohort / File(s) Summary
Build & Project Files
copilot/modules/copilot-library-core/build.gradle, copilot/modules/copilot-library-ls-extension/build.gradle, settings.gradle
Add two copilot subprojects with new Gradle scripts, custom balTools config, dependency declarations, and projectDir mappings.
Module Descriptors
copilot/.../module-info.java, copilot/.../module-info.java
New Java module descriptors for io.ballerina.copilot.library and io.ballerina.copilot.library.extension with requires/exports.
Core package moves
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/... (many files, see model/, builder/, adapters/, util/, service/, database/)
Relocate ~30+ source files from io.ballerina.flowmodelgenerator.core.copilot.* to io.ballerina.copilot.library.*, updating package declarations and imports.
Models
copilot/.../model/*
Move model classes (Client, Library, Type, TypeDef, Service, StringPath, etc.) to io.ballerina.copilot.library.model (package rename only).
LibraryDatabaseAccessor
copilot/.../database/LibraryDatabaseAccessor.java
Significant search logic changes: add MAX_SEARCH_RESULTS = 9, replace static LIMIT 9 with parameter, expand FTS queries to include package_name, introduce weighted BM25 queries (primary-keyword bias + all-keywords), per-table weights and source multipliers, change score aggregation to MIN(weighted_score) - (COUNT(*) - 1)*0.2, and adjust prepared-statement bindings accordingly.
Extensions & SPI
copilot/modules/copilot-library-ls-extension/src/main/java/.../CopilotLibraryService.java, .../request/*, .../response/GetAllLibrariesResponse.java, src/main/resources/META-INF/services/...
Move LS extension classes to io.ballerina.copilot.library.extension; update request/response types. GetAllLibrariesResponse no longer extends AbstractFlowModelResponse, adds errorMsg, stacktrace, and setError(Throwable)/accessors. Register new SPI entry for CopilotLibraryService.
Tests
copilot/.../src/test/java/io/ballerina/copilot/library/extension/*
Update test packages and imports, rename several test classes to the new namespace/names.
Flow-model-generator cleanup
flow-model-generator/.../build.gradle, flow-model-generator/.../module-info.java, flow-model-generator/.../META-INF/services/..., flow-model-generator/.../testng.xml
Remove sqlite-jdbc dependency, remove copilot-related exports from module descriptor, unregister old CopilotLibraryService SPI entry, and remove related TestNG test entries.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • KavinduZoysa
  • nipunayf

Poem

🐰 I hopped through packages, tidy and spry,
Moved models and services, gave names a new sky,
Weighing BM25 with a careful paw,
Nine results now, neat as a straw,
A rabbit cheers — the code hops high! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description provides a clear overview of changes, new module structure, and API compatibility. However, it does not follow the provided template structure with explicit sections like Purpose, Goals, Approach, User stories, etc. Consider restructuring the description to follow the repository template format with explicit Purpose, Goals, Approach, and other required sections for consistency and completeness.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: extracting copilot library functionality into a standalone module with the new module structure.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@RNViththagan RNViththagan marked this pull request as ready for review April 9, 2026 08:40
@RNViththagan
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/response/GetAllLibrariesResponse.java (1)

49-60: Minor: Inconsistent blank lines inside methods.

The getLibraries() and setLibraries() methods have unnecessary blank lines after the opening brace, unlike the error handling methods above. Consider removing for consistency.

♻️ Proposed formatting fix
     public GetAllLibrariesResponse() {
     }

     public JsonArray getLibraries() {
-
         return libraries;
     }

     public void setLibraries(JsonArray libraries) {
-
         this.libraries = libraries;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/response/GetAllLibrariesResponse.java`
around lines 49 - 60, Remove the unnecessary blank lines inside the accessor
methods of GetAllLibrariesResponse: collapse the extra empty lines immediately
after the opening brace in getLibraries() and setLibraries() so the methods read
consistently like the other methods (returning/assigning the field libraries
directly inside the method body).
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/database/LibraryDatabaseAccessor.java (2)

127-128: Consider documenting the MAX_SEARCH_RESULTS value choice.

The constant MAX_SEARCH_RESULTS = 9 appears arbitrary. A brief comment explaining why 9 results was chosen (e.g., UI constraints, UX considerations) would help future maintainers understand the rationale.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/database/LibraryDatabaseAccessor.java`
around lines 127 - 128, The constant MAX_SEARCH_RESULTS in
LibraryDatabaseAccessor is undocumented and its value (9) seems arbitrary; add a
brief comment next to the declaration explaining the rationale (e.g., UI
row/column constraints, UX reasons, pagination behavior, or alignment with
frontend components) so future maintainers know why 9 was chosen and when it may
be changed. Reference the MAX_SEARCH_RESULTS constant in LibraryDatabaseAccessor
and ensure the comment mentions the specific UI or UX constraint that drove the
choice.

212-214: Clarify the ConnectorFTS source multiplier rationale.

The comment describes ConnectorFTS as "primary library entry points," yet it has the lowest source multiplier (0.8) compared to Package (1.0), Type (0.9), and Function (1.0). This seems counterintuitive. Consider updating the comment to explain why primary entry points are de-prioritized, or adjust the multiplier if this is unintended.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/database/LibraryDatabaseAccessor.java`
around lines 212 - 214, The ConnectorFTS source multiplier (0.8) is inconsistent
with the comment that labels ConnectorFTS as "primary library entry points";
either update the SQL/comment or the multiplier to remove the contradiction:
locate the SQL fragment using ConnectorFTS in LibraryDatabaseAccessor (the
SELECT p.id, bm25(ConnectorFTS, 10.0, 2.0, 5.0) * 0.8 AS weighted_score
expression), then either change the multiplier to match other primary sources
(e.g., 1.0) or revise the inline comment to explain why ConnectorFTS is
intentionally de-prioritized (e.g., lower relevance due to noise or broader
matches), ensuring the comment and multiplier reflect the same rationale.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionAugmentationTest.java`:
- Line 38: The TestNG suite still references the old fully-qualified class name
for the renamed test class; update the testng.xml TestNG suite entry to point to
the new FQCN for InstructionAugmentationTest (the class declared as
InstructionAugmentationTest in package io.ballerina.copilot.library.extension)
so TestNG can discover and run the test; locate the old FQCN reference in the
testng.xml suite configuration and replace it with
io.ballerina.copilot.library.extension.InstructionAugmentationTest.

In
`@copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryListTest.java`:
- Line 38: Update the TestNG suite entries that reference the old migrated test
class FQCNs: replace
io.ballerina.flowmodelgenerator.extension.CopilotLibraryListTest with
io.ballerina.copilot.library.extension.LibraryListTest and replace
io.ballerina.flowmodelgenerator.extension.CopilotLibraryFilterTest with
io.ballerina.copilot.library.extension.LibraryFilterTest in the testng.xml so
TestNG can discover the renamed classes (verify the class names match the actual
test classes LibraryListTest and LibraryFilterTest).

---

Nitpick comments:
In
`@copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/database/LibraryDatabaseAccessor.java`:
- Around line 127-128: The constant MAX_SEARCH_RESULTS in
LibraryDatabaseAccessor is undocumented and its value (9) seems arbitrary; add a
brief comment next to the declaration explaining the rationale (e.g., UI
row/column constraints, UX reasons, pagination behavior, or alignment with
frontend components) so future maintainers know why 9 was chosen and when it may
be changed. Reference the MAX_SEARCH_RESULTS constant in LibraryDatabaseAccessor
and ensure the comment mentions the specific UI or UX constraint that drove the
choice.
- Around line 212-214: The ConnectorFTS source multiplier (0.8) is inconsistent
with the comment that labels ConnectorFTS as "primary library entry points";
either update the SQL/comment or the multiplier to remove the contradiction:
locate the SQL fragment using ConnectorFTS in LibraryDatabaseAccessor (the
SELECT p.id, bm25(ConnectorFTS, 10.0, 2.0, 5.0) * 0.8 AS weighted_score
expression), then either change the multiplier to match other primary sources
(e.g., 1.0) or revise the inline comment to explain why ConnectorFTS is
intentionally de-prioritized (e.g., lower relevance due to noise or broader
matches), ensuring the comment and multiplier reflect the same rationale.

In
`@copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/response/GetAllLibrariesResponse.java`:
- Around line 49-60: Remove the unnecessary blank lines inside the accessor
methods of GetAllLibrariesResponse: collapse the extra empty lines immediately
after the opening brace in getLibraries() and setLibraries() so the methods read
consistently like the other methods (returning/assigning the field libraries
directly inside the method body).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e6a3c13c-d48c-4730-aa8b-b2a2e48bf74e

📥 Commits

Reviewing files that changed from the base of the PR and between f9744db and ade67dd.

📒 Files selected for processing (71)
  • copilot/modules/copilot-library-core/build.gradle
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/CopilotLibraryManager.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/InstructionLoader.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/adapters/StringPathAdapter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/builder/TypeDefDataBuilder.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/builder/TypeLinkBuilder.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/database/LibraryDatabaseAccessor.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Client.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/EnumValue.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Field.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Library.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/LibraryFunction.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Listener.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/ModelToJsonConverter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Parameter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/PathElement.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/PathSegment.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Return.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Service.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/ServiceRemoteFunction.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/StringPath.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Type.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeDef.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeDefMember.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeLink.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/UnionValue.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/service/ServiceLoader.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/LibraryModelConverter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/SymbolProcessor.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/TypeSymbolExtractor.java
  • copilot/modules/copilot-library-core/src/main/java/module-info.java
  • copilot/modules/copilot-library-core/src/main/resources/central-index.sqlite
  • copilot/modules/copilot-library-core/src/main/resources/copilot/exclusion.json
  • copilot/modules/copilot-library-core/src/main/resources/copilot/generic-services.json
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/README.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/ai/library.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/ai/service.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/graphql/service.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/http/service.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/http/test.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/test/library.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerinax/client.config/library.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerinax/mailchimp.transactional/library.md
  • copilot/modules/copilot-library-core/src/main/resources/search-index.sqlite
  • copilot/modules/copilot-library-ls-extension/build.gradle
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/CopilotLibraryService.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetAllLibrariesRequest.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetLibrariesBySearchRequest.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetSelectedLibrariesRequest.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/response/GetAllLibrariesResponse.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/module-info.java
  • copilot/modules/copilot-library-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/GetFilteredLibrariesFromSemanticModel.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/GetLibrariesListFromSearchIndex.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionAugmentationTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionLoaderTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryExclusionTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryFilterTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryListTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_from_semantic_api.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_salesforce.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_trigger_github.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_trigger_salesforce.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_libraries_list.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_libraries_list_from_database.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_libraries_list_healthcare.json
  • flow-model-generator/modules/flow-model-generator-core/build.gradle
  • flow-model-generator/modules/flow-model-generator-core/src/main/java/module-info.java
  • flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService
  • settings.gradle
💤 Files with no reviewable changes (3)
  • flow-model-generator/modules/flow-model-generator-core/build.gradle
  • flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService
  • flow-model-generator/modules/flow-model-generator-core/src/main/java/module-info.java

@RNViththagan
Copy link
Copy Markdown
Member Author

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
copilot/modules/copilot-library-ls-extension/build.gradle (1)

99-103: Use append operator for compiler args to align with codebase patterns and defend against future upstream configurations.

The current assignment options.compilerArgs = [...] can drop args if added upstream, though gradle/javaProject.gradle doesn't currently configure them. Several modules in the codebase use the safer append operator (<<) instead. Prefer the refactored approach for consistency and defensiveness:

Proposed refactor
 compileJava {
     doFirst {
-        options.compilerArgs = [
-                '--module-path', classpath.asPath,
-        ]
+        def existingArgs = options.compilerArgs ?: []
+        options.compilerArgs = existingArgs + [
+                '--module-path', classpath.asPath,
+        ]
         classpath = files()
     }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@copilot/modules/copilot-library-ls-extension/build.gradle` around lines 99 -
103, Replace the assignment to options.compilerArgs inside the
compileJava.doFirst block with append operations so existing upstream args
aren’t overwritten; specifically, in the compileJava closure change
options.compilerArgs = ['--module-path', classpath.asPath] to append the two
elements (e.g., options.compilerArgs << '--module-path' << classpath.asPath) so
compileJava and options.compilerArgs keep prior entries while adding these
flags.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/database/LibraryDatabaseAccessor.java`:
- Around line 154-166: The primary subquery branches (primaryPackageQuery and
primaryNameDescQuery produced by formatForPackageFTS and
formatForNameDescriptionFTS) must be omitted when they are identical to their
fallbacks (allPackageQuery / allNameDescQuery) to avoid duplicating hits and
inflating score; update the query construction logic that builds the
UNION/priority-boosting clauses so it only appends/emits the primary subquery
pieces if primaryPackageQuery != allPackageQuery and primaryNameDescQuery !=
allNameDescQuery (respectively), keeping the existing fallback assignments but
preventing duplicate MATCH terms from being added to the final SQL when they
collapse to the same value.
- Around line 168-256: The query in LibraryDatabaseAccessor.java (the sql String
building the weighted union that creates the combined subquery and uses COUNT(*)
to compute the multi-match bonus) lets large packages gain bonus by counting
many symbol rows; fix by collapsing each source to one row per package before
final aggregation and counting distinct sources instead of raw rows: in each
SELECT inside the UNION ALL (PackageFTS/TypeFTS/ConnectorFTS/FunctionFTS) group
by p.id and emit a source label (e.g., 'pkg','type','connector','func') and a
single per-package score (MIN(weighted_score) or AVG as appropriate), then in
the outer query join that aggregated combined result and replace COUNT(*) with
COUNT(DISTINCT source_label) and subtract (COUNT(DISTINCT source_label) - 1) *
0.2 when computing combined_score; locate the sql variable and the combined
subquery/alias to implement these changes.

In `@copilot/modules/copilot-library-ls-extension/build.gradle`:
- Around line 86-87: The build script hardcodes
"build/extracted-distribution/..." when defining ballerinaDist; change it to use
the existing project.buildDir (or the balDistribution variable if present) so
the path respects overridden buildDir. Locate the declaration for def
ballerinaDist and replace the hardcoded "build/..." string with a path
constructed from project.buildDir (or reuse balDistribution) so tests copy
stdlibs into the correct distribution directory when buildDir is customized.

---

Nitpick comments:
In `@copilot/modules/copilot-library-ls-extension/build.gradle`:
- Around line 99-103: Replace the assignment to options.compilerArgs inside the
compileJava.doFirst block with append operations so existing upstream args
aren’t overwritten; specifically, in the compileJava closure change
options.compilerArgs = ['--module-path', classpath.asPath] to append the two
elements (e.g., options.compilerArgs << '--module-path' << classpath.asPath) so
compileJava and options.compilerArgs keep prior entries while adding these
flags.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6d0eebe9-24fe-47ec-8b04-293832c460aa

📥 Commits

Reviewing files that changed from the base of the PR and between ade67dd and 31c0cea.

📒 Files selected for processing (72)
  • copilot/modules/copilot-library-core/build.gradle
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/CopilotLibraryManager.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/InstructionLoader.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/adapters/StringPathAdapter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/builder/TypeDefDataBuilder.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/builder/TypeLinkBuilder.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/database/LibraryDatabaseAccessor.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Client.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/EnumValue.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Field.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Library.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/LibraryFunction.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Listener.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/ModelToJsonConverter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Parameter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/PathElement.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/PathSegment.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Return.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Service.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/ServiceRemoteFunction.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/StringPath.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Type.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeDef.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeDefMember.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeLink.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/UnionValue.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/service/ServiceLoader.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/LibraryModelConverter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/SymbolProcessor.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/TypeSymbolExtractor.java
  • copilot/modules/copilot-library-core/src/main/java/module-info.java
  • copilot/modules/copilot-library-core/src/main/resources/central-index.sqlite
  • copilot/modules/copilot-library-core/src/main/resources/copilot/exclusion.json
  • copilot/modules/copilot-library-core/src/main/resources/copilot/generic-services.json
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/README.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/ai/library.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/ai/service.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/graphql/service.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/http/service.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/http/test.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/test/library.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerinax/client.config/library.md
  • copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerinax/mailchimp.transactional/library.md
  • copilot/modules/copilot-library-core/src/main/resources/search-index.sqlite
  • copilot/modules/copilot-library-ls-extension/build.gradle
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/CopilotLibraryService.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetAllLibrariesRequest.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetLibrariesBySearchRequest.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetSelectedLibrariesRequest.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/response/GetAllLibrariesResponse.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/module-info.java
  • copilot/modules/copilot-library-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/GetFilteredLibrariesFromSemanticModel.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/GetLibrariesListFromSearchIndex.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionAugmentationTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionLoaderTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryExclusionTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryFilterTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryListTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_from_semantic_api.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_salesforce.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_trigger_github.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_trigger_salesforce.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_libraries_list.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_libraries_list_from_database.json
  • copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_libraries_list_healthcare.json
  • flow-model-generator/modules/flow-model-generator-core/build.gradle
  • flow-model-generator/modules/flow-model-generator-core/src/main/java/module-info.java
  • flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService
  • flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/testng.xml
  • settings.gradle
💤 Files with no reviewable changes (4)
  • flow-model-generator/modules/flow-model-generator-core/build.gradle
  • flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/testng.xml
  • flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService
  • flow-model-generator/modules/flow-model-generator-core/src/main/java/module-info.java
✅ Files skipped from review due to trivial changes (24)
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/LibraryFunction.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Field.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/EnumValue.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Parameter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Library.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Return.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionLoaderTest.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/InstructionLoader.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeDefMember.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/PathElement.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Service.java
  • copilot/modules/copilot-library-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/ServiceRemoteFunction.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/adapters/StringPathAdapter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/CopilotLibraryManager.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetLibrariesBySearchRequest.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/service/ServiceLoader.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/TypeSymbolExtractor.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryListTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/GetLibrariesListFromSearchIndex.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/SymbolProcessor.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/module-info.java
  • copilot/modules/copilot-library-core/build.gradle
  • copilot/modules/copilot-library-core/src/main/java/module-info.java
🚧 Files skipped from review as they are similar to previous changes (21)
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetSelectedLibrariesRequest.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/PathSegment.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeLink.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeDef.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/GetFilteredLibrariesFromSemanticModel.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/StringPath.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/builder/TypeDefDataBuilder.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/ModelToJsonConverter.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/UnionValue.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetAllLibrariesRequest.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Type.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Client.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryFilterTest.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionAugmentationTest.java
  • settings.gradle
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/LibraryModelConverter.java
  • copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryExclusionTest.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/response/GetAllLibrariesResponse.java
  • copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/CopilotLibraryService.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Listener.java
  • copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/builder/TypeLinkBuilder.java

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extracts the Copilot library search/retrieval feature set from flow-model-generator into a new standalone copilot module, split into a reusable core library and a dedicated LS-extension module, while also carrying forward the weighted BM25 search improvements.

Changes:

  • Added new Gradle subprojects copilot-library-core and copilot-library-ls-extension, and wired them into the build.
  • Moved/repackaged Copilot library core + resources (SQLite index usage, instruction resources, exclusions, generic services) into io.ballerina.copilot.library.
  • Moved the JSON-RPC LS service + request/response types and associated tests into the new LS-extension module.

Reviewed changes

Copilot reviewed 51 out of 72 changed files in this pull request and generated no comments.

Show a summary per file
File Description
settings.gradle Registers the new copilot subprojects in the multi-project build.
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/testng.xml Removes Copilot-related test classes from the old LS-extension test suite.
flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService Unregisters the Copilot library service from the old LS extension.
flow-model-generator/modules/flow-model-generator-core/src/main/java/module-info.java Removes sqlite-jdbc requirement and Copilot package exports from the old core module descriptor.
flow-model-generator/modules/flow-model-generator-core/build.gradle Drops sqlite-jdbc dependency from the old core module.
copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_libraries_list.json Adds LS test fixture for listing libraries (empty expectation).
copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_libraries_list_healthcare.json Adds LS test fixture for listing libraries in HEALTHCARE mode.
copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_trigger_salesforce.json Adds LS test fixture for exclusion behavior (trigger.salesforce).
copilot/modules/copilot-library-ls-extension/src/test/resources/copilot_library/get_filtered_libraries_salesforce.json Adds large LS test fixture validating filtered library details for Salesforce.
copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryListTest.java Migrates/renames list test into the new Copilot LS-extension package.
copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryFilterTest.java Migrates/renames filter test into the new Copilot LS-extension package.
copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/LibraryExclusionTest.java Migrates/renames exclusion test to use the new Copilot core package.
copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionLoaderTest.java Migrates instruction loader test to the new Copilot core API.
copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/InstructionAugmentationTest.java Migrates/renames instruction augmentation test to the new Copilot LS-extension package.
copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/GetLibrariesListFromSearchIndex.java Migrates list-from-index LS test to the new Copilot LS-extension package.
copilot/modules/copilot-library-ls-extension/src/test/java/io/ballerina/copilot/library/extension/GetFilteredLibrariesFromSemanticModel.java Migrates semantic-model filtering LS test to the new Copilot LS-extension package.
copilot/modules/copilot-library-ls-extension/src/main/resources/META-INF/services/org.ballerinalang.langserver.commons.service.spi.ExtendedLanguageServerService Registers the new CopilotLibraryService via SPI in the new LS-extension module.
copilot/modules/copilot-library-ls-extension/src/main/java/module-info.java Introduces the JPMS descriptor for the new Copilot LS-extension module.
copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/response/GetAllLibrariesResponse.java Introduces/migrates response type for the LS endpoints in the new module namespace.
copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetSelectedLibrariesRequest.java Migrates request type to the new module namespace.
copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetLibrariesBySearchRequest.java Migrates request type to the new module namespace.
copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/request/GetAllLibrariesRequest.java Migrates request type to the new module namespace.
copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/CopilotLibraryService.java Migrates LS JSON-RPC service implementation to the new module namespace.
copilot/modules/copilot-library-ls-extension/build.gradle Adds Gradle build for the new Copilot LS-extension module (including stdlib unpacking for tests).
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/README.md Adds contribution guide for custom library instruction resources.
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerinax/mailchimp.transactional/library.md Adds library-specific instruction override for reserved keyword import.
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerinax/client.config/library.md Adds library-specific instruction override for reserved keyword import.
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/test/library.md Adds testing guidance instruction bundle for Copilot augmentation.
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/http/test.md Adds HTTP test-generation instructions for Copilot augmentation.
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/http/service.md Adds HTTP service/client authoring instructions for Copilot augmentation.
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/graphql/service.md Adds GraphQL service authoring instructions for Copilot augmentation.
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/ai/service.md Adds AI service/agent/RAG authoring instructions for Copilot augmentation.
copilot/modules/copilot-library-core/src/main/resources/copilot/instructions/ballerina/ai/library.md Adds AI library overview instructions for Copilot augmentation.
copilot/modules/copilot-library-core/src/main/resources/copilot/generic-services.json Adds generic service templates metadata for selected standard libraries.
copilot/modules/copilot-library-core/src/main/resources/copilot/exclusion.json Adds exclusion rules for libraries/functions not to surface.
copilot/modules/copilot-library-core/src/main/java/module-info.java Introduces the JPMS descriptor for the new Copilot core module and its exported packages.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/TypeSymbolExtractor.java Migrates type link extraction utility to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/SymbolProcessor.java Migrates symbol processing logic to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/util/LibraryModelConverter.java Migrates model conversion utilities to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/service/ServiceLoader.java Migrates service definition loader to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/UnionValue.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeLink.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeDefMember.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/TypeDef.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Type.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/StringPath.java Migrates model type and adapter reference to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/ServiceRemoteFunction.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Service.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Return.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/PathSegment.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/PathElement.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Parameter.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/ModelToJsonConverter.java Migrates model JSON conversion helper to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Listener.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/LibraryFunction.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Library.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Field.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/EnumValue.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/model/Client.java Migrates model type to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/InstructionLoader.java Migrates instruction loader to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/database/LibraryDatabaseAccessor.java Migrates DB accessor and includes the weighted BM25 query updates.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/CopilotLibraryManager.java Migrates the manager façade to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/builder/TypeLinkBuilder.java Migrates builder utility to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/builder/TypeDefDataBuilder.java Migrates builder utility to the new module namespace.
copilot/modules/copilot-library-core/src/main/java/io/ballerina/copilot/library/adapters/StringPathAdapter.java Migrates Gson adapter to the new module namespace.
copilot/modules/copilot-library-core/build.gradle Adds Gradle build for the new Copilot core module (incl. sqlite-jdbc).
Comments suppressed due to low confidence (1)

copilot/modules/copilot-library-ls-extension/src/main/java/io/ballerina/copilot/library/extension/response/GetAllLibrariesResponse.java:39

  • This response class now defines errorMsg/stacktrace and a setError(Throwable) helper, but there are currently no call sites in this module that populate these fields (the service methods construct a response and only set libraries). As a result, clients will never receive structured error details through this type. Consider either wiring setError(...) into the service implementation or removing these unused fields/method to avoid a misleading API surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RNViththagan RNViththagan force-pushed the 1.7.x branch 5 times, most recently from 5fe3020 to 3a5c718 Compare April 10, 2026 08:34
Move the copilot library search and retrieval code out of flow-model-generator
into a new first-class copilot module with the standard -core/-ls-extension split:

- copilot/modules/copilot-library-core: pure Java, no LS dependency
- copilot/modules/copilot-library-ls-extension: LSP endpoint + tests

Repackages all classes from io.ballerina.flowmodelgenerator.core.copilot
to io.ballerina.copilot.library. The JSON-RPC API surface is unchanged
(@JsonSegment("copilotLibraryManager") and all three @JsonRequest endpoints).
- Remove stale copilot test class entries from flow-model-generator-ls-extension testng.xml
- Remove unnecessary blank lines in GetAllLibrariesResponse accessor methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants