//#region src/bootstrap/CodemationBootstrapRequest.ts
var CodemationBootstrapRequest = class {
	consumerRoot;
	repoRoot;
	workflowSources;
	env;
	constructor(args) {
		this.consumerRoot = args.consumerRoot;
		this.repoRoot = args.repoRoot;
		this.workflowSources = [...args.workflowSources ?? []];
		this.env = args.env;
	}
	resolveEnvironment() {
		return {
			...process.env,
			...this.env ?? {}
		};
	}
};

//#endregion
//#region src/presentation/config/CodemationPluginListMerger.ts
/**
* Merges explicitly configured plugins with auto-discovered plugins.
* Configured plugins are applied first; discovered plugins fill in gaps.
* Plugins discovered from package.json manifests are deduped by npm package name so the same package is not
* registered twice when the consumer config lists a discovered plugin explicitly and auto-discovery also finds it.
*/
var CodemationPluginListMerger = class {
	constructor(packageMetadata) {
		this.packageMetadata = packageMetadata;
	}
	merge(configuredPlugins, discoveredPlugins) {
		const pluginsByPackageId = /* @__PURE__ */ new Map();
		const pluginsByReference = /* @__PURE__ */ new Set();
		const result = [];
		for (const plugin of configuredPlugins) this.tryAdd(plugin, pluginsByPackageId, pluginsByReference, result);
		for (const plugin of discoveredPlugins) this.tryAdd(plugin, pluginsByPackageId, pluginsByReference, result);
		return result;
	}
	tryAdd(plugin, pluginsByPackageId, pluginsByReference, result) {
		const packageId = this.packageMetadata.readPackageName(plugin);
		if (packageId) {
			if (pluginsByPackageId.has(packageId)) return;
			pluginsByPackageId.set(packageId, plugin);
			result.push(plugin);
			return;
		}
		if (pluginsByReference.has(plugin)) return;
		pluginsByReference.add(plugin);
		result.push(plugin);
	}
};

//#endregion
export { CodemationBootstrapRequest as n, CodemationPluginListMerger as t };
//# sourceMappingURL=CodemationPluginListMerger-D1B1IEbt.js.map