Skip to content

feat(meta): 添加依赖与能力目录语义匹配功能#1356

Merged
henry-hub merged 3 commits into
ihub-pub:mainfrom
henry-hub:agent
May 4, 2026
Merged

feat(meta): 添加依赖与能力目录语义匹配功能#1356
henry-hub merged 3 commits into
ihub-pub:mainfrom
henry-hub:agent

Conversation

@henry-hub
Copy link
Copy Markdown
Member

支持将项目依赖与 IHub 能力目录进行语义匹配,在输出 JSON 中附加组件语义信息。新增 includeCatalogContext 和 catalogFile 配置项,分别控制是否启用语义匹配和指定目录文件路径。当启用时,输出依赖信息将包含对应组件的 description、use_case、domain 等字段。

henry-hub and others added 3 commits May 3, 2026 18:55
…Config

Add explicit task dependency so Gradle 9.5+ implicit dependency validation
passes. The Lombok plugin's generateEffectiveLombokConfig reads
lombok.config produced by iHubLombokConfig but didn't declare it as input.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
支持将项目依赖与 IHub 能力目录进行语义匹配,在输出 JSON 中附加组件语义信息。新增 includeCatalogContext 和 catalogFile 配置项,分别控制是否启用语义匹配和指定目录文件路径。当启用时,输出依赖信息将包含对应组件的 description、use_case、domain 等字段。
重构文件路径处理,使用更安全的project.file方法来创建File对象
捕获更具体的异常类型以提供更精确的错误处理
Copilot AI review requested due to automatic review settings May 4, 2026 10:01
@henry-hub henry-hub added the enhancement New feature or request label May 4, 2026
@ihub-bot ihub-bot Bot modified the milestone: 1.9.7 May 4, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.01%. Comparing base (8e088ce) to head (3ff7a21).
⚠️ Report is 618 commits behind head on main.

Files with missing lines Patch % Lines
...in/groovy/pub/ihub/plugin/meta/IHubMetaTask.groovy 14.28% 22 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1356      +/-   ##
============================================
- Coverage     98.90%   95.01%   -3.89%     
- Complexity      288      352      +64     
============================================
  Files            52       63      +11     
  Lines          1372     1686     +314     
  Branches        155      203      +48     
============================================
+ Hits           1357     1602     +245     
- Misses           10       45      +35     
- Partials          5       39      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

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

该 PR 为 ihub-metaiHubMeta 元数据输出引入“依赖与 IHub 能力目录(catalog.json)语义匹配”的可选能力,在依赖条目中附加 catalog 组件上下文信息;同时在 ihub-java 中补充 Lombok 相关任务依赖声明以消除 Gradle 隐式依赖警告。

Changes:

  • iHubMeta 新增 includeCatalogContextcatalogFile 配置,并在生成元数据时尝试加载 catalog 建索引。
  • 依赖输出从字符串 GAV 列表扩展为对象结构(包含 gav 与可选 catalog 字段)。
  • 为 Lombok 的 generateEffectiveLombokConfig 相关任务显式增加对 iHubLombokConfig 的依赖。

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
ihub-meta/src/main/groovy/pub/ihub/plugin/meta/IHubMetaTask.groovy 加载 catalog 并在依赖输出中注入组件语义信息(新增任务输入)。
ihub-meta/src/main/groovy/pub/ihub/plugin/meta/IHubMetaPlugin.groovy 将新扩展配置映射到任务属性。
ihub-meta/src/main/groovy/pub/ihub/plugin/meta/IHubMetaExtension.groovy 新增扩展项与对应说明文档。
ihub-java/src/main/groovy/pub/ihub/plugin/java/IHubJavaPlugin.groovy 为 Lombok 生成 effective config 相关任务补充 dependsOn,避免隐式依赖告警。

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

Comment on lines +251 to +254
Map<String, Object> entry = [gav: "${dep.group}:${dep.name}:${dep.version}"]
if (catalogIndex) {
def match = catalogIndex[dep.name]
if (match) {
Comment on lines +107 to +111
File cf = catalogFile.orNull?.asFile
if (!cf?.exists()) {
// 尝试默认位置:rootProject/gradle/ihub-catalog/catalog.json
cf = project.rootProject.file('gradle/ihub-catalog/catalog.json')
}
Comment on lines +118 to +123
Map<String, Map<String, Object>> index = [:]
(parsed.components as List<Map<String, Object>>).each { entry ->
def ref = entry.gradle_ref
List<String> refs = ref instanceof List ? ref as List<String> : [ref as String]
refs.each { r ->
if (r) { index[r] = entry }
Comment on lines +255 to +260
entry.catalog = [
id : match.id,
domain : match.domain,
description: match.description,
status : match.status,
]
Comment on lines +54 to +55
* 是否将项目已解析依赖与 IHub 能力目录进行语义匹配,并在输出中附加组件语义信息(默认关闭)。
* 启用后,输出 JSON 中每条依赖将附加 catalog 中对应组件的 description、use_case、domain 等字段。
Comment on lines +73 to +78
// 预加载 catalog(仅当启用语义注入时)
Map<String, Map<String, Object>> catalogIndex = [:]
if (includeCatalogContext.get()) {
catalogIndex = loadCatalogIndex()
logger.lifecycle('IHub Meta: catalog loaded, {} components indexed', catalogIndex.size())
}
@henry-hub henry-hub merged commit d857063 into ihub-pub:main May 4, 2026
32 of 34 checks passed
@henry-hub henry-hub deleted the agent branch May 4, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants