refac tools part 1

This commit is contained in:
Brian Madison 2025-12-22 13:12:25 +08:00
parent 1e721f7fd0
commit 34cfdddd3a
8 changed files with 36 additions and 56 deletions

View File

@ -297,14 +297,7 @@ 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,
);
if (needsPrompts) {
// Get IDE handler and collect configuration
// Get IDE handler and check if it needs interactive configuration
try {
// Dynamically load the IDE setup module
const ideModule = require(`../ide/${ide}`);
@ -327,7 +320,7 @@ class Installer {
const ideSetup = new SetupClass();
// Check if this IDE has a collectConfiguration method
// 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({
@ -342,7 +335,6 @@ class Installer {
}
}
}
}
// Log which IDEs are already configured and being kept
const keptIdes = toolConfig.ides.filter((ide) => previouslyConfiguredIdes.includes(ide));

View File

@ -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

View File

@ -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');
// }
// }

View File

@ -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 = {
/**

View File

@ -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

View 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,

View File

@ -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') {