MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / resolveTarget

Function resolveTarget

apps/desktop/src/cli/commands/open.ts:28–41  ·  view source on GitHub ↗

Resolve one target against cwd, then the vault root. Files only.

(vault: string, target: string)

Source from the content-addressed store, hash-verified

26
27/** Resolve one target against cwd, then the vault root. Files only. */
28async function resolveTarget(vault: string, target: string): Promise<string | null> {
29 const candidates = [path.resolve(target)]
30 if (vault) candidates.push(path.resolve(vault, target))
31
32 for (const candidate of candidates) {
33 try {
34 const stat = await fsp.stat(candidate)
35 if (stat.isFile()) return candidate
36 } catch {
37 // try the next candidate
38 }
39 }
40 return null
41}
42
43function assertMarkdown(abs: string): void {
44 if (!isMarkdownFilePath(abs)) {

Callers 1

cmdOpenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected