Skip to content

Commit add789a

Browse files
Brian MadisonBrian Madison
authored andcommitted
remove unused code
1 parent ae9851a commit add789a

File tree

4 files changed

+0
-234
lines changed

4 files changed

+0
-234
lines changed

tools/cli/installers/lib/core/installer.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,55 +1920,6 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
19201920
console.log(chalk.dim(` Created customize: ${moduleName}-${agentName}.customize.yaml`));
19211921
}
19221922
}
1923-
1924-
// Read the existing .md file to check for sidecar info
1925-
let hasSidecar = false;
1926-
try {
1927-
const content = await fs.readFile(mdPath, 'utf8');
1928-
// Look for sidecar metadata in the frontmatter or content
1929-
hasSidecar = content.includes('hasSidecar') && content.includes('true');
1930-
} catch {
1931-
// Continue without sidecar processing
1932-
}
1933-
1934-
// Copy sidecar files if agent has hasSidecar flag
1935-
if (hasSidecar) {
1936-
const { copyAgentSidecarFiles } = require('../../../lib/agent/installer');
1937-
1938-
// Get agent sidecar folder from core config
1939-
const coreConfigPath = path.join(bmadDir, 'bmb', 'config.yaml');
1940-
let agentSidecarFolder;
1941-
1942-
if (await fs.pathExists(coreConfigPath)) {
1943-
const yamlLib = require('yaml');
1944-
const coreConfigContent = await fs.readFile(coreConfigPath, 'utf8');
1945-
const coreConfig = yamlLib.parse(coreConfigContent);
1946-
agentSidecarFolder = coreConfig.agent_sidecar_folder || agentSidecarFolder;
1947-
}
1948-
1949-
// Resolve path variables
1950-
const resolvedSidecarFolder = agentSidecarFolder
1951-
.replaceAll('{project-root}', projectDir)
1952-
.replaceAll('_bmad', this.bmadFolderName || 'bmad');
1953-
1954-
// Create sidecar directory for this agent
1955-
const agentSidecarDir = path.join(resolvedSidecarFolder, agentName);
1956-
await fs.ensureDir(agentSidecarDir);
1957-
1958-
// Find and copy sidecar folder from source module
1959-
const sourceModulePath = moduleName === 'core' ? getModulePath('core') : getSourcePath(`modules/${moduleName}`);
1960-
const sourceAgentPath = path.join(sourceModulePath, 'agents');
1961-
1962-
// Copy sidecar files (preserve existing, add new)
1963-
const sidecarResult = copyAgentSidecarFiles(sourceAgentPath, agentSidecarDir, null);
1964-
1965-
if (sidecarResult.copied.length > 0) {
1966-
console.log(chalk.dim(` Copied ${sidecarResult.copied.length} new sidecar file(s) to: ${agentSidecarDir}`));
1967-
}
1968-
if (sidecarResult.preserved.length > 0) {
1969-
console.log(chalk.dim(` Preserved ${sidecarResult.preserved.length} existing sidecar file(s)`));
1970-
}
1971-
}
19721923
}
19731924
}
19741925

tools/cli/installers/lib/custom/handler.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ class CustomHandler {
318318
const { getSourcePath } = require('../../../lib/project-root');
319319
const genericTemplatePath = getSourcePath('utility', 'agent-components', 'agent.customize.template.yaml');
320320
if (await fs.pathExists(genericTemplatePath)) {
321-
// Copy with placeholder replacement
322321
let templateContent = await fs.readFile(genericTemplatePath, 'utf8');
323322
await fs.writeFile(customizePath, templateContent, 'utf8');
324323
console.log(chalk.dim(` Created customize: custom-${agentName}.customize.yaml`));
@@ -337,41 +336,6 @@ class CustomHandler {
337336
// Write the compiled MD file
338337
await fs.writeFile(targetMdPath, processedXml, 'utf8');
339338

340-
// Check if agent has sidecar
341-
let hasSidecar = false;
342-
try {
343-
const yamlLib = require('yaml');
344-
const agentYaml = yamlLib.parse(yamlContent);
345-
hasSidecar = agentYaml?.agent?.metadata?.hasSidecar === true;
346-
} catch {
347-
// Continue without sidecar processing
348-
}
349-
350-
// Copy sidecar files if agent has hasSidecar flag
351-
if (hasSidecar && config.agent_sidecar_folder) {
352-
const { copyAgentSidecarFiles } = require('../../../lib/agent/installer');
353-
354-
// Resolve agent sidecar folder path
355-
const projectDir = path.dirname(bmadDir);
356-
const resolvedSidecarFolder = config.agent_sidecar_folder
357-
.replaceAll('{project-root}', projectDir)
358-
.replaceAll('_bmad', path.basename(bmadDir));
359-
360-
// Create sidecar directory for this agent
361-
const agentSidecarDir = path.join(resolvedSidecarFolder, agentName);
362-
await fs.ensureDir(agentSidecarDir);
363-
364-
// Copy sidecar files
365-
const sidecarResult = copyAgentSidecarFiles(path.dirname(agentFile), agentSidecarDir, agentFile);
366-
367-
if (sidecarResult.copied.length > 0) {
368-
console.log(chalk.dim(` Copied ${sidecarResult.copied.length} sidecar file(s) to: ${agentSidecarDir}`));
369-
}
370-
if (sidecarResult.preserved.length > 0) {
371-
console.log(chalk.dim(` Preserved ${sidecarResult.preserved.length} existing sidecar file(s)`));
372-
}
373-
}
374-
375339
// Track the file
376340
if (fileTrackingCallback) {
377341
fileTrackingCallback(targetMdPath);

tools/cli/installers/lib/modules/manager.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -905,35 +905,6 @@ class ModuleManager {
905905
await fs.writeFile(targetMdPath, xml, 'utf8');
906906
}
907907

908-
// Copy sidecar files if agent has hasSidecar flag
909-
if (hasSidecar) {
910-
const { copyAgentSidecarFiles } = require('../../../lib/agent/installer');
911-
912-
// Get agent sidecar folder from core config (should always be set)
913-
const agentSidecarFolder = this.coreConfig?.agent_sidecar_folder;
914-
915-
// Resolve path variables
916-
const projectDir = path.dirname(bmadDir);
917-
const resolvedSidecarFolder = agentSidecarFolder
918-
.replaceAll('{project-root}', projectDir)
919-
.replaceAll('_bmad', path.basename(bmadDir));
920-
921-
// Create sidecar directory for this agent
922-
const agentSidecarDir = path.join(resolvedSidecarFolder, agentName);
923-
await fs.ensureDir(agentSidecarDir);
924-
925-
// Copy sidecar files (preserve existing, add new)
926-
const sidecarResult = copyAgentSidecarFiles(path.dirname(sourceYamlPath), agentSidecarDir, sourceYamlPath);
927-
const totalFiles = sidecarResult.copied.length + sidecarResult.preserved.length;
928-
929-
if (sidecarResult.copied.length > 0) {
930-
console.log(chalk.dim(` Copied ${sidecarResult.copied.length} new sidecar file(s) to: ${agentSidecarDir}`));
931-
}
932-
if (sidecarResult.preserved.length > 0) {
933-
console.log(chalk.dim(` Preserved ${sidecarResult.preserved.length} existing sidecar file(s)`));
934-
}
935-
}
936-
937908
console.log(
938909
chalk.dim(` Compiled agent: ${agentName} -> ${path.relative(targetPath, targetMdPath)}${hasSidecar ? ' (with sidecar)' : ''}`),
939910
);

tools/cli/lib/agent/installer.js

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -262,129 +262,11 @@ function installAgent(agentInfo, answers, targetPath, options = {}) {
262262
agentName: metadata.name || agentInfo.name,
263263
targetDir: agentTargetDir,
264264
compiledFile: compiledPath,
265-
sidecarCopied: false,
266265
};
267266

268-
// Handle sidecar files for agents with hasSidecar flag
269-
if (agentInfo.hasSidecar === true && agentInfo.type === 'expert') {
270-
// Get agent sidecar folder from config or use default
271-
const agentSidecarFolder = options.config?.agent_sidecar_folder || '{project-root}/.myagent-data';
272-
273-
// Resolve path variables
274-
const resolvedSidecarFolder = agentSidecarFolder
275-
.replaceAll('{project-root}', options.projectRoot || process.cwd())
276-
.replaceAll('_bmad', options_bmadFolder || '_bmad');
277-
278-
// Create sidecar directory for this agent
279-
const agentSidecarDir = path.join(resolvedSidecarFolder, agentFolderName);
280-
if (!fs.existsSync(agentSidecarDir)) {
281-
fs.mkdirSync(agentSidecarDir, { recursive: true });
282-
}
283-
284-
// Find and copy sidecar folder
285-
const sidecarFiles = copyAgentSidecarFiles(agentInfo.path, agentSidecarDir, agentInfo.yamlFile);
286-
result.sidecarCopied = true;
287-
result.sidecarFiles = sidecarFiles;
288-
result.sidecarDir = agentSidecarDir;
289-
}
290-
291267
return result;
292268
}
293269

294-
/**
295-
* Recursively copy sidecar files (everything except the .agent.yaml)
296-
* @param {string} sourceDir - Source agent directory
297-
* @param {string} targetDir - Target agent directory
298-
* @param {string} excludeYaml - The .agent.yaml file to exclude
299-
* @returns {Array} List of copied files
300-
*/
301-
function copySidecarFiles(sourceDir, targetDir, excludeYaml) {
302-
const copied = [];
303-
304-
function copyDir(src, dest) {
305-
if (!fs.existsSync(dest)) {
306-
fs.mkdirSync(dest, { recursive: true });
307-
}
308-
309-
const entries = fs.readdirSync(src, { withFileTypes: true });
310-
for (const entry of entries) {
311-
const srcPath = path.join(src, entry.name);
312-
const destPath = path.join(dest, entry.name);
313-
314-
// Skip the source YAML file
315-
if (srcPath === excludeYaml) {
316-
continue;
317-
}
318-
319-
if (entry.isDirectory()) {
320-
copyDir(srcPath, destPath);
321-
} else {
322-
fs.copyFileSync(srcPath, destPath);
323-
copied.push(destPath);
324-
}
325-
}
326-
}
327-
328-
copyDir(sourceDir, targetDir);
329-
return copied;
330-
}
331-
332-
/**
333-
* Find and copy agent sidecar folders
334-
* @param {string} sourceDir - Source agent directory
335-
* @param {string} targetSidecarDir - Target sidecar directory for the agent
336-
* @param {string} excludeYaml - The .agent.yaml file to exclude
337-
* @returns {Array} List of copied files
338-
*/
339-
function copyAgentSidecarFiles(sourceDir, targetSidecarDir, excludeYaml) {
340-
const copied = [];
341-
const preserved = [];
342-
343-
// Find folders with "sidecar" in the name
344-
const entries = fs.readdirSync(sourceDir, { withFileTypes: true });
345-
346-
for (const entry of entries) {
347-
if (entry.isDirectory() && entry.name.toLowerCase().includes('sidecar')) {
348-
const sidecarSourcePath = path.join(sourceDir, entry.name);
349-
350-
// Recursively sync the sidecar folder contents (preserve existing, add new)
351-
function syncSidecarDir(src, dest) {
352-
if (!fs.existsSync(dest)) {
353-
fs.mkdirSync(dest, { recursive: true });
354-
}
355-
356-
// Get all files in source
357-
const sourceEntries = fs.readdirSync(src, { withFileTypes: true });
358-
359-
for (const sourceEntry of sourceEntries) {
360-
const srcPath = path.join(src, sourceEntry.name);
361-
const destPath = path.join(dest, sourceEntry.name);
362-
363-
if (sourceEntry.isDirectory()) {
364-
// Recursively sync subdirectories
365-
syncSidecarDir(srcPath, destPath);
366-
} else {
367-
// Check if file already exists in destination
368-
if (fs.existsSync(destPath)) {
369-
// File exists - preserve it
370-
preserved.push(destPath);
371-
} else {
372-
// File doesn't exist - copy it
373-
fs.copyFileSync(srcPath, destPath);
374-
copied.push(destPath);
375-
}
376-
}
377-
}
378-
}
379-
380-
syncSidecarDir(sidecarSourcePath, targetSidecarDir);
381-
}
382-
}
383-
384-
// Return info about what was preserved and what was copied
385-
return { copied, preserved };
386-
}
387-
388270
/**
389271
* Update agent metadata ID to reflect installed location
390272
* @param {string} compiledContent - Compiled XML content
@@ -820,8 +702,6 @@ module.exports = {
820702
loadAgentConfig,
821703
promptInstallQuestions,
822704
installAgent,
823-
copySidecarFiles,
824-
copyAgentSidecarFiles,
825705
updateAgentId,
826706
detectBmadProject,
827707
addToManifest,

0 commit comments

Comments
 (0)