Skip to content

fix: add globalRuleFile for Kilo Code platform for rules scanning - #158

Merged
legeling merged 1 commit into
legeling:mainfrom
chung1912:fix/kilo-code-rules-support
May 29, 2026
Merged

fix: add globalRuleFile for Kilo Code platform for rules scanning#158
legeling merged 1 commit into
legeling:mainfrom
chung1912:fix/kilo-code-rules-support

Conversation

@chung1912

@chung1912 chung1912 commented May 28, 2026

Copy link
Copy Markdown
Contributor

问题

Kilo Code 平台在 PromptHub 的 Rules 工作区中无法扫描到全局规则,data/rules/global/kilo/ 目录也不会被创建。

根因

Kilo Code 在 platforms.ts 中只有 skillsRelativePath: "skills"(用于 Skill 安装),缺少 globalRuleFile 属性。因此:

  • getPlatformGlobalRulePath() 返回 null → Rules 工作区跳过 Kilo Code
  • KNOWN_RULE_FILE_TEMPLATES 中没有 "kilo-global" 条目 → 不创建规则目录
  • RULE_PLATFORM_ORDER 中没有 "kilo" → 侧边栏不显示 Kilo Code

修复

  1. platforms.ts: 为 Kilo Code 添加 globalRuleFile: "rules/global.md"
  2. rules.ts: 添加 "kilo"RULE_PLATFORM_ORDER,添加 "kilo-global"KNOWN_RULE_FILE_TEMPLATES

为什么选择 rules/global.md

Kilo Code 从 ~/.kilo/rules/ 目录读取所有 .md 文件作为全局规则(目录模型)。PromptHub 的 Rules 工作区目前只支持单文件模型。选择 rules/global.md 作为 globalRuleFile 是最合理的折中:

  • PromptHub 管理 ~/.kilo/rules/global.md 这一个文件
  • Kilo Code 会读取它,因为它扫描 ~/.kilo/rules/ 下的所有 .md 文件
  • 文件名 global.md 描述性强,不会与其他规则文件冲突

测试

  • pnpm typecheck
  • pnpm lint

Summary by CodeRabbit

发布说明

  • 新增功能
    • Kilo Code 平台现已支持全局规则文件配置。
    • 规则系统中新增对 Kilo 平台的支持和相关规则模板。

Review Change Stack

- platforms.ts: 为 kilo 平台添加 globalRuleFile: "rules/global.md"
- rules.ts: 添加 kilo-global 到 KNOWN_RULE_FILE_TEMPLATES 和 RULE_PLATFORM_ORDER

Kilo Code 从 ~/.kilo/rules/ 目录读取所有 .md 文件作为全局规则,
选择 rules/global.md 作为 globalRuleFile 使得 PromptHub 管理的单文件
能被 Kilo Code 自动发现和加载。
@vercel

vercel Bot commented May 28, 2026

Copy link
Copy Markdown

@chung1912 is attempting to deploy a commit to the legeling's projects Team on Vercel.

A member of the Team first needs to authorize it.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f591e89a-821f-4f8a-86f7-4e1fb4423bae

📥 Commits

Reviewing files that changed from the base of the PR and between 4079d7e and 4e4e737.

📒 Files selected for processing (2)
  • packages/shared/constants/platforms.ts
  • packages/shared/constants/rules.ts

📝 Walkthrough

总览

此更改为 Kilo Code 平台增加全局规则文件支持。在 SKILL_PLATFORMS 中定义平台配置,在 RULE_PLATFORM_ORDERKNOWN_RULE_FILE_TEMPLATES 中注册平台元数据和规则模板。

变更内容

Kilo 平台全局规则支持

Layer / File(s) 摘要
平台全局规则文件配置
packages/shared/constants/platforms.ts
在 kilo 平台配置中新增 globalRuleFile: "rules/global.md" 字段,为全局规则模板生成逻辑提供文件路径。
规则模板和平台顺序注册
packages/shared/constants/rules.ts
通过 requirePlatform("kilo") 加载平台元数据,在 RULE_PLATFORM_ORDER 中注册平台,在 KNOWN_RULE_FILE_TEMPLATES 中添加 kilo-global 模板条目,配置其平台身份、分组归属(tooling)和文件名(global.md)。

🎯 1 (Trivial) | ⏱️ ~5 minutes

🐰 小小代码添双行,
Kilo 规则齐整装。
平台有序又有方,
全局文件指路帮!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确总结了主要变更:为 Kilo Code 平台添加 globalRuleFile 配置以支持规则扫描,完全对应 PR 的核心目标。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Actionable comments posted: 0

@legeling
legeling merged commit 2ff6f05 into legeling:main May 29, 2026
2 of 5 checks passed
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.

2 participants