MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / cacheSourceRoots

Function cacheSourceRoots

scripts/codex-worktree-cache.mjs:159–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157}
158
159function cacheSourceRoots() {
160 const roots = [];
161 const explicitSource = process.env.SIMDECK_CACHE_SOURCE;
162 if (explicitSource) {
163 roots.push(resolve(explicitSource));
164 }
165
166 const commonRoot = mainCheckoutRoot();
167 if (commonRoot) {
168 roots.push(commonRoot);
169 }
170
171 const codexWorktrees = join(homedir(), ".codex", "worktrees");
172 if (existsSync(codexWorktrees)) {
173 for (const id of readdirSync(codexWorktrees)) {
174 const candidate = join(codexWorktrees, id, PROJECT_NAME);
175 if (candidate !== ROOT && existsSync(candidate)) {
176 roots.push(candidate);
177 }
178 }
179 }
180
181 return [...new Set(roots)]
182 .filter((root) => root !== ROOT && existsSync(root))
183 .sort((left, right) => mtimeMs(right) - mtimeMs(left));
184}
185
186function locksMatch(candidateRoot, lockFiles) {
187 for (const lockFile of lockFiles) {

Callers 1

hydrateEntriesFunction · 0.85

Calls 2

mainCheckoutRootFunction · 0.85
mtimeMsFunction · 0.85

Tested by

no test coverage detected