gitea push
This commit is contained in:
+42
-2
@@ -53,6 +53,23 @@ function resolveSkillsEnabled(cliFlag, configSetting) {
|
||||
? configSetting
|
||||
: true; // default to enabled
|
||||
}
|
||||
/**
|
||||
* Resolves subagents enabled state based on precedence:
|
||||
* CLI flag > ruler.toml > default (disabled).
|
||||
*
|
||||
* When neither `[agents] enabled` (nor the legacy `[subagents] enabled`)
|
||||
* nor a CLI flag is provided, propagation is disabled by default per spec.
|
||||
* Subagent definitions are an opt-in feature — propagating them silently
|
||||
* could leak runtime prompts into native subagent locations on projects
|
||||
* that never intended to use the feature.
|
||||
*/
|
||||
function resolveSubagentsEnabled(cliFlag, configSetting) {
|
||||
return cliFlag !== undefined
|
||||
? cliFlag
|
||||
: configSetting !== undefined
|
||||
? configSetting
|
||||
: false; // default to disabled — see spec: subagents must opt in
|
||||
}
|
||||
/**
|
||||
* Applies ruler configurations for all supported AI agents.
|
||||
* @param projectRoot Root directory of the project
|
||||
@@ -62,7 +79,7 @@ function resolveSkillsEnabled(cliFlag, configSetting) {
|
||||
* @param projectRoot Root directory of the project
|
||||
* @param includedAgents Optional list of agent name filters (case-insensitive substrings)
|
||||
*/
|
||||
async function applyAllAgentConfigs(projectRoot, includedAgents, configPath, cliMcpEnabled = true, cliMcpStrategy, cliGitignoreEnabled, verbose = false, dryRun = false, localOnly = false, nested = false, backup = true, skillsEnabled, cliGitignoreLocal) {
|
||||
async function applyAllAgentConfigs(projectRoot, includedAgents, configPath, cliMcpEnabled = true, cliMcpStrategy, cliGitignoreEnabled, verbose = false, dryRun = false, localOnly = false, nested = false, backup = true, skillsEnabled, cliGitignoreLocal, subagentsEnabled) {
|
||||
// Load configuration and rules
|
||||
(0, constants_1.logVerbose)(`Loading configuration from project root: ${projectRoot}`, verbose);
|
||||
if (configPath) {
|
||||
@@ -100,6 +117,16 @@ async function applyAllAgentConfigs(projectRoot, includedAgents, configPath, cli
|
||||
await propagateSkills(nestedRoot, selectedAgents, skillsEnabledResolved, verbose, dryRun);
|
||||
}
|
||||
}
|
||||
// Propagate subagents (mirrors skills handling for nested mode).
|
||||
const subagentsEnabledResolved = resolveSubagentsEnabled(subagentsEnabled, rootConfig.subagents?.enabled);
|
||||
{
|
||||
const { propagateSubagents } = await Promise.resolve().then(() => __importStar(require('./core/SubagentsProcessor')));
|
||||
for (const configEntry of hierarchicalConfigs) {
|
||||
const nestedRoot = path.dirname(configEntry.rulerDir);
|
||||
(0, constants_1.logVerbose)(`Propagating subagents for nested directory: ${nestedRoot}`, verbose);
|
||||
await propagateSubagents(nestedRoot, selectedAgents, subagentsEnabledResolved, verbose, dryRun);
|
||||
}
|
||||
}
|
||||
generatedPaths = await (0, apply_engine_1.processHierarchicalConfigurations)(selectedAgents, hierarchicalConfigs, verbose, dryRun, cliMcpEnabled, cliMcpStrategy, backup);
|
||||
}
|
||||
else {
|
||||
@@ -117,6 +144,12 @@ async function applyAllAgentConfigs(projectRoot, includedAgents, configPath, cli
|
||||
const { propagateSkills } = await Promise.resolve().then(() => __importStar(require('./core/SkillsProcessor')));
|
||||
await propagateSkills(projectRoot, selectedAgents, skillsEnabledResolved, verbose, dryRun);
|
||||
}
|
||||
// Propagate subagents (mirrors skills handling).
|
||||
const subagentsEnabledResolvedSingle = resolveSubagentsEnabled(subagentsEnabled, singleConfig.config.subagents?.enabled);
|
||||
{
|
||||
const { propagateSubagents } = await Promise.resolve().then(() => __importStar(require('./core/SubagentsProcessor')));
|
||||
await propagateSubagents(projectRoot, selectedAgents, subagentsEnabledResolvedSingle, verbose, dryRun);
|
||||
}
|
||||
generatedPaths = await (0, apply_engine_1.processSingleConfiguration)(selectedAgents, singleConfig, projectRoot, verbose, dryRun, cliMcpEnabled, cliMcpStrategy, backup);
|
||||
}
|
||||
// Add skills-generated paths to gitignore if skills are enabled
|
||||
@@ -126,7 +159,14 @@ async function applyAllAgentConfigs(projectRoot, includedAgents, configPath, cli
|
||||
// Skills enabled by default or explicitly
|
||||
const { getSkillsGitignorePaths } = await Promise.resolve().then(() => __importStar(require('./core/SkillsProcessor')));
|
||||
const skillsPaths = await getSkillsGitignorePaths(projectRoot, selectedAgents);
|
||||
allGeneratedPaths = [...generatedPaths, ...skillsPaths];
|
||||
allGeneratedPaths = [...allGeneratedPaths, ...skillsPaths];
|
||||
}
|
||||
// Add subagents-generated paths to gitignore if subagents are enabled.
|
||||
const subagentsEnabledForGitignore = resolveSubagentsEnabled(subagentsEnabled, loadedConfig.subagents?.enabled);
|
||||
if (subagentsEnabledForGitignore) {
|
||||
const { getSubagentsGitignorePaths } = await Promise.resolve().then(() => __importStar(require('./core/SubagentsProcessor')));
|
||||
const subagentPaths = await getSubagentsGitignorePaths(projectRoot, selectedAgents);
|
||||
allGeneratedPaths = [...allGeneratedPaths, ...subagentPaths];
|
||||
}
|
||||
await (0, apply_engine_1.updateGitignore)(projectRoot, allGeneratedPaths, loadedConfig, cliGitignoreEnabled, dryRun, cliGitignoreLocal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user