-
Notifications
You must be signed in to change notification settings - Fork 0
feat: グローバル + プロジェクト階層ルールファイル読み込み #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,191 @@ | ||||
| import { describe, expect, test } from "bun:test" | ||||
| import path from "path" | ||||
| import { Instruction } from "../../src/session/instruction" | ||||
| import { Instance } from "../../src/project/instance" | ||||
| import { Global } from "../../src/global" | ||||
|
||||
| import { Global } from "../../src/global" |
Copilot
AI
Apr 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test suite doesn’t currently cover the common case where OpenCode is invoked from a subdirectory: Instance.directory is nested but rules live in {worktree}/.opencode/rules/*.md. Add a test that provides an instance rooted in a nested directory and verifies project rules in the worktree root are still loaded (and still override globals by filename).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Project rules are globbed from
path.join(Instance.directory, ".opencode", "rules"), which only works when the instance directory is the project root. If the user runs OpenCode from a subdirectory, rules placed at{worktree}/.opencode/rules/*.mdwon’t be discovered. Consider usingInstance.worktree(git root) for the project rules directory, orfs.findUp(".opencode/rules", Instance.directory, Instance.worktree)to locate the rules dir within the project boundary.