MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / resolve_for_file

Function resolve_for_file

crates/opencode-session/src/instruction.rs:239–241  ·  view source on GitHub ↗

Resolve instruction files relevant to a concrete file path. Mirrors TS `InstructionPrompt.resolve(...)` behavior at a filesystem level: while walking from the file's directory up to `project_root`, collect the first matching instruction file in each directory (`AGENTS.md`, `CLAUDE.md`, `CONTEXT.md`), skipping duplicates and the target file itself.

(file_path: &Path, project_root: &Path)

Source from the content-addressed store, hash-verified

237/// first matching instruction file in each directory (`AGENTS.md`, `CLAUDE.md`,
238/// `CONTEXT.md`), skipping duplicates and the target file itself.
239pub fn resolve_for_file(file_path: &Path, project_root: &Path) -> Vec<InstructionFile> {
240 resolve_for_file_candidates(file_path, project_root, PROJECT_FILES)
241}
242
243/// Resolve per-file instruction context specifically from `AGENTS.md`.
244///

Calls 1