Skip to content

feat(rules): add OpenCode project rules for LLM context injection#82

Merged
terisuke merged 2 commits intodevfrom
feat/opencode-rules-placement
Apr 5, 2026
Merged

feat(rules): add OpenCode project rules for LLM context injection#82
terisuke merged 2 commits intodevfrom
feat/opencode-rules-placement

Conversation

@terisuke
Copy link
Copy Markdown

@terisuke terisuke commented Apr 5, 2026

Summary

  • .opencode/rules/ に6つのルールファイルを追加(coding-style, git-workflow, quality, testing, security, delegation)
  • instruction.ts が自動的にglob読み込みするため、コード変更なし

What

OpenCode のプロジェクトルール .opencode/rules/ ディレクトリに、LLMコンテキストに注入されるルールファイルを配置。

Type

  • Feature

Verify

  • instruction.ts:152-160 のglob *.md が6ファイルすべてを読み込むことを確認
  • プロジェクトルールがグローバルルールをファイル名でオーバーライドすることを確認

Checklist

  • ルールファイル作成
  • 読み込みパス検証
  • 各ルール30行以内

Issue

Closes #81

🤖 Generated with Claude Code

Place 6 rule files in .opencode/rules/ to be loaded by instruction.ts
as project-level LLM instructions: coding-style, git-workflow, quality,
testing, security, and delegation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 5, 2026 12:31
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

The following comment was made by an LLM, it may be inaccurate:

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

Adds OpenCode project-scoped rule files under .opencode/rules/ so they are automatically injected into LLM context via the existing *.md glob loader.

Changes:

  • Added coding style rules for TypeScript and formatting.
  • Added workflow/quality/testing/security/delegation rules to standardize contributor/agent behavior.
  • Scoped these as project rules intended to override global rules by filename.

Reviewed changes

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

Show a summary per file
File Description
.opencode/rules/coding-style.md Adds coding/style/formatting guidance intended for agent + contributor consistency
.opencode/rules/delegation.md Adds guidance for when/how to delegate tasks to agents/workers
.opencode/rules/git-workflow.md Adds branch/commit/PR/merge workflow rules
.opencode/rules/quality.md Adds “definition of done” and pre-merge checklist expectations
.opencode/rules/security.md Adds baseline secure-development expectations (secrets, authz, CSRF/XSS)
.opencode/rules/testing.md Adds testing level definitions + coverage/TDD expectations

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

Comment on lines +7 to +8
- Unit: `bun test` — isolated logic, pure functions
- Integration: HTTP client tests — API endpoints, service interactions
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

bun test from the repo root is intentionally blocked (root package.json script test exits 1). This rule should clarify that tests must be run from a package directory (e.g., packages/opencode / packages/app) or via bun --cwd ..., otherwise it will produce incorrect guidance.

Suggested change
- Unit: `bun test` — isolated logic, pure functions
- Integration: HTTP client tests — API endpoints, service interactions
- Unit: run `bun test` from a package directory (for example `packages/opencode` or `packages/app`) or use `bun --cwd <package-dir> test` — isolated logic, pure functions. Do not run `bun test` from the repo root; the root `test` script is intentionally blocked and exits 1.
- Integration: HTTP client tests — API endpoints, service interactions; when using Bun test commands, run them from the relevant package directory or via `bun --cwd <package-dir> ...`

Copilot uses AI. Check for mistakes.
- Use `namespace` + `interface` pattern consistent with this codebase (e.g., `Foo.Info`)

## Formatting
- Run `bun format` before committing
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

bun format is not defined at the repo root (no format script in root package.json). To avoid directing contributors/agents to a non-existent command, update this to the actual formatting command(s) used in this repo (e.g., bun --cwd packages/opencode format and/or the repo-wide Prettier invocation).

Suggested change
- Run `bun format` before committing
- Run the actual formatter used in this repo before committing (for example, `bun --cwd packages/opencode format` and/or the repo-wide Prettier invocation)

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +14
- Types: feat / fix / refactor / docs / test / chore / perf / ci / release
- One intent per commit — do not mix unrelated changes

## Pull Requests
- 1 PR = 1 intent; branch name type must match PR title type
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

The allowed PR title types enforced by automation are currently limited (see .github/workflows/pr-standards.yml title regex: feat|fix|docs|chore|refactor|test). Listing additional types here (perf/ci/release) is likely to cause failed PR-standards checks; align this list with the enforced set or explicitly distinguish “commit types” vs “PR title types”.

Suggested change
- Types: feat / fix / refactor / docs / test / chore / perf / ci / release
- One intent per commit — do not mix unrelated changes
## Pull Requests
- 1 PR = 1 intent; branch name type must match PR title type
- Commit types: feat / fix / refactor / docs / test / chore / perf / ci / release
- One intent per commit — do not mix unrelated changes
## Pull Requests
- 1 PR = 1 intent; PR title types are limited to: feat / fix / docs / chore / refactor / test
- Branch names for PRs should use the same allowed PR title type prefix

Copilot uses AI. Check for mistakes.
#82)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@terisuke terisuke merged commit 9668c56 into dev Apr 5, 2026
3 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Claude Code → OpenCode 機能ギャップ解消計画

2 participants