MCPcopy Create free account
hub / github.com/cortexkit/magic-context / resolveContextOptionsForProject

Function resolveContextOptionsForProject

packages/pi-plugin/src/index.ts:720–746  ·  view source on GitHub ↗
(
		dir: string,
	)

Source from the content-addressed store, hash-verified

718 },
719 });
720 function resolveContextOptionsForProject(
721 dir: string,
722 ): PiContextHandlerOptions {
723 const cached = contextOptionsByDir.get(dir);
724 if (cached) return cached;
725 // A different checkout: re-resolve config + historian/auto-search from
726 // the new cwd. The launch dir is pre-seeded below so this branch only
727 // runs for genuine switches.
728 ensureConfigLocationsMigrated(dir);
729 const switchedConfig = loadPiConfig({ cwd: dir }).config;
730 const switchedHistorian = resolveHistorianFromConfig(switchedConfig);
731 if (switchedHistorian) {
732 switchedHistorian.onStatusChange = (ctx) => {
733 updateStatusLine(ctx, {
734 db: database,
735 projectIdentity: resolveCurrentProject(ctx).projectIdentity,
736 });
737 };
738 }
739 const built = buildContextOptions(
740 switchedConfig,
741 switchedHistorian,
742 resolveAutoSearchFromConfig(switchedConfig),
743 );
744 contextOptionsByDir.set(dir, built);
745 return built;
746 }
747 const bootContextOptions = buildContextOptions(
748 config,
749 historianConfig,

Callers

nothing calls this directly

Calls 9

loadPiConfigFunction · 0.90
updateStatusLineFunction · 0.90
resolveCurrentProjectFunction · 0.85
buildContextOptionsFunction · 0.85
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected