refac tools part 1
This commit is contained in:
parent
1e721f7fd0
commit
34cfdddd3a
|
|
@ -297,49 +297,41 @@ class Installer {
|
|||
console.log('\n'); // Add spacing before IDE questions
|
||||
|
||||
for (const ide of newlySelectedIdes) {
|
||||
// List of IDEs that have interactive prompts
|
||||
//TODO: Why is this here, hardcoding this list here is bad, fix me!
|
||||
const needsPrompts = ['claude-code', 'github-copilot', 'roo', 'cline', 'auggie', 'codex', 'qwen', 'gemini', 'rovo-dev'].includes(
|
||||
ide,
|
||||
);
|
||||
// Get IDE handler and check if it needs interactive configuration
|
||||
try {
|
||||
// Dynamically load the IDE setup module
|
||||
const ideModule = require(`../ide/${ide}`);
|
||||
|
||||
if (needsPrompts) {
|
||||
// Get IDE handler and collect configuration
|
||||
try {
|
||||
// Dynamically load the IDE setup module
|
||||
const ideModule = require(`../ide/${ide}`);
|
||||
// Get the setup class (handle different export formats)
|
||||
let SetupClass;
|
||||
const className =
|
||||
ide
|
||||
.split('-')
|
||||
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
||||
.join('') + 'Setup';
|
||||
|
||||
// Get the setup class (handle different export formats)
|
||||
let SetupClass;
|
||||
const className =
|
||||
ide
|
||||
.split('-')
|
||||
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
||||
.join('') + 'Setup';
|
||||
|
||||
if (ideModule[className]) {
|
||||
SetupClass = ideModule[className];
|
||||
} else if (ideModule.default) {
|
||||
SetupClass = ideModule.default;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
const ideSetup = new SetupClass();
|
||||
|
||||
// Check if this IDE has a collectConfiguration method
|
||||
if (typeof ideSetup.collectConfiguration === 'function') {
|
||||
console.log(chalk.cyan(`\nConfiguring ${ide}...`));
|
||||
ideConfigurations[ide] = await ideSetup.collectConfiguration({
|
||||
selectedModules: selectedModules || [],
|
||||
projectDir,
|
||||
bmadDir,
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// IDE doesn't have a setup file or collectConfiguration method
|
||||
console.warn(chalk.yellow(`Warning: Could not load configuration for ${ide}`));
|
||||
if (ideModule[className]) {
|
||||
SetupClass = ideModule[className];
|
||||
} else if (ideModule.default) {
|
||||
SetupClass = ideModule.default;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
const ideSetup = new SetupClass();
|
||||
|
||||
// Check if this IDE has a collectConfiguration method (no hardcoding needed!)
|
||||
if (typeof ideSetup.collectConfiguration === 'function') {
|
||||
console.log(chalk.cyan(`\nConfiguring ${ide}...`));
|
||||
ideConfigurations[ide] = await ideSetup.collectConfiguration({
|
||||
selectedModules: selectedModules || [],
|
||||
projectDir,
|
||||
bmadDir,
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// IDE doesn't have a setup file or collectConfiguration method
|
||||
console.warn(chalk.yellow(`Warning: Could not load configuration for ${ide}`));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -493,11 +493,6 @@ class BaseIdeSetup {
|
|||
// Replace placeholders
|
||||
let processed = content;
|
||||
|
||||
// Inject activation block for agent files FIRST (before replacements)
|
||||
if (metadata.name && content.includes('<agent')) {
|
||||
processed = this.xmlHandler.injectActivationSimple(processed, metadata);
|
||||
}
|
||||
|
||||
// Only replace {project-root} if a specific projectDir is provided
|
||||
// Otherwise leave the placeholder intact
|
||||
// Note: Don't add trailing slash - paths in source include leading slash
|
||||
|
|
|
|||
|
|
@ -952,7 +952,7 @@ class ModuleManager {
|
|||
// // Check if content has agent XML and no activation block
|
||||
// if (content.includes('<agent') && !content.includes('<activation')) {
|
||||
// // Inject the activation block using XML handler
|
||||
// content = this.xmlHandler.injectActivationSimple(content);
|
||||
// // TODO: Reimplement activation injection if needed
|
||||
// await fs.writeFile(agentFile, content, 'utf8');
|
||||
// }
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const path = require('node:path');
|
||||
const fs = require('fs-extra');
|
||||
const { escapeXml } = require('../../lib/xml-utils');
|
||||
const { escapeXml } = require('./xml-utils');
|
||||
|
||||
const AgentPartyGenerator = {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -124,13 +124,6 @@ class XmlHandler {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: DELETE THIS METHOD
|
||||
*/
|
||||
injectActivationSimple(agentContent, metadata = {}) {
|
||||
console.error('Error in simple injection:', error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build agent from YAML source
|
||||
* @param {string} yamlPath - Path to .agent.yaml file
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ const path = require('node:path');
|
|||
const crypto = require('node:crypto');
|
||||
const { AgentAnalyzer } = require('./agent-analyzer');
|
||||
const { ActivationBuilder } = require('./activation-builder');
|
||||
const { escapeXml } = require('../../../lib/xml-utils');
|
||||
const { escapeXml } = require('../xml-utils');
|
||||
const {
|
||||
processAgentYaml,
|
||||
extractInstallConfig,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const fs = require('fs-extra');
|
||||
const { escapeXml } = require('../lib/xml-utils');
|
||||
const { escapeXml } = require('../cli/lib/xml-utils');
|
||||
|
||||
function indentFileContent(content) {
|
||||
if (typeof content !== 'string') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue