MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / loadLocalPlugins

Function loadLocalPlugins

apps/local/src/executor.ts:71–100  ·  view source on GitHub ↗
(options: LocalExecutorOptions = {})

Source from the content-addressed store, hash-verified

69}
70
71const loadLocalPlugins = (options: LocalExecutorOptions = {}) =>
72 Effect.gen(function* () {
73 const cwd = process.env.EXECUTOR_SCOPE_DIR || process.cwd();
74 const staticPlugins = executorConfig.plugins({
75 activeToolkitSlug: options.activeToolkitSlug,
76 });
77 const dynamicPlugins =
78 (yield* Effect.promise(() => loadPluginsFromJsonc({ path: resolvePluginConfigPath(cwd) }))) ??
79 [];
80
81 const staticPackageNames = new Set(
82 staticPlugins.map((plugin) => plugin.packageName).filter((name): name is string => !!name),
83 );
84 const dedupedDynamic = dynamicPlugins.filter((plugin) => {
85 if (plugin.packageName && staticPackageNames.has(plugin.packageName)) {
86 console.warn(
87 `[executor] plugin "${plugin.packageName}" appears in both ` +
88 `executor.config.ts and executor.jsonc#plugins. The static ` +
89 `entry wins; the jsonc entry is ignored.`,
90 );
91 return false;
92 }
93 return true;
94 });
95
96 return {
97 cwd,
98 plugins: [...staticPlugins, ...dedupedDynamic] as LocalPlugins,
99 };
100 });
101
102interface LocalExecutorBundle {
103 readonly executor: Executor<LocalPlugins>;

Callers 1

createLocalExecutorLayerFunction · 0.85

Calls 3

loadPluginsFromJsoncFunction · 0.90
resolvePluginConfigPathFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected