MCPcopy Index your code
hub / github.com/anomalyco/opencode / containsPath

Function containsPath

packages/opencode/src/project/instance-context.ts:18–24  ·  view source on GitHub ↗
(filepath: string, ctx: InstanceContext)

Source from the content-addressed store, hash-verified

16 * Paths within the worktree but outside the working directory should not trigger external_directory permission.
17 */
18export function containsPath(filepath: string, ctx: InstanceContext): boolean {
19 if (FSUtil.contains(ctx.directory, filepath)) return true
20 // Non-git projects set worktree to "/" which would match ANY absolute path.
21 // Skip worktree check in this case to preserve external_directory permissions.
22 if (ctx.worktree === "/") return false
23 return FSUtil.contains(ctx.worktree, filepath)
24}

Callers 4

lsp.tsFile · 0.90
config.tsFile · 0.90
shell.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected