Files
orca/src/main/ipc/markdown-documents.ts
T
Neil 7a9170cf77 refactor(main): import filesystem-auth, markdown-documents and preflight seams from their defining modules (#30440)
The three ipc modules re-exported symbols owned elsewhere. Importers and test mocks now name the
defining module, and the re-export lines are gone (no barrels).
2026-10-18 15:41:29 -07:00

29 lines
1.1 KiB
TypeScript

import { spawnBundledRipgrep } from '../ripgrep/bundled-ripgrep-spawn'
import { stopBundledRipgrep } from '../ripgrep/bundled-ripgrep-stop'
import { resolveBundledRipgrepWslRouting } from '../ripgrep/bundled-ripgrep-wsl-routing'
import {
collectMarkdownDocuments,
MARKDOWN_DOCUMENT_LISTING_ARGS
} from '../../shared/node-markdown-document-listing'
import type { MarkdownDocument } from '../../shared/filesystem-entry-types'
export async function listMarkdownDocuments(
rootPath: string,
options: { wslDistro?: string; signal?: AbortSignal } = {}
): Promise<MarkdownDocument[]> {
options.signal?.throwIfAborted()
const { wslDistro, wslDistroForOutput: distro } = resolveBundledRipgrepWslRouting(
rootPath,
options.wslDistro
)
const child = spawnBundledRipgrep(MARKDOWN_DOCUMENT_LISTING_ARGS, {
cwd: rootPath,
wslDistro,
wslDistroForOutput: distro,
stdio: ['ignore', 'pipe', 'pipe']
})
return collectMarkdownDocuments(child, rootPath, Boolean(distro), options.signal, {
stopProcess: () => stopBundledRipgrep(child, Boolean(distro))
})
}