MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / findTrellisRoot

Function findTrellisRoot

src/context/trellis.ts:46–59  ·  view source on GitHub ↗

Find the nearest ancestor dir that contains a `.trellis/` folder.

(cwd: string)

Source from the content-addressed store, hash-verified

44
45/** Find the nearest ancestor dir that contains a `.trellis/` folder. */
46async function findTrellisRoot(cwd: string): Promise<string | null> {
47 let dir = path.resolve(cwd);
48 const root = path.parse(dir).root;
49 while (true) {
50 try {
51 const st = await fs.stat(path.join(dir, '.trellis'));
52 if (st.isDirectory()) return dir;
53 } catch { /* keep walking */ }
54 const parent = path.dirname(dir);
55 if (parent === dir || dir === root) break;
56 dir = parent;
57 }
58 return null;
59}
60
61/** Read every markdown file directly under `dir` (one level), oldest→newest by name. */
62async function readMarkdownDir(dir: string): Promise<Array<{ name: string; content: string; mtimeMs: number }>> {

Callers 1

loadTrellisContextFunction · 0.85

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected