routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+108
@@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AiderAgent = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const AgentsMdAgent_1 = require("./AgentsMdAgent");
|
||||
const FileSystemUtils_1 = require("../core/FileSystemUtils");
|
||||
const fs = __importStar(require("fs/promises"));
|
||||
const yaml = __importStar(require("js-yaml"));
|
||||
/**
|
||||
* Aider agent adapter that uses AGENTS.md for instructions and .aider.conf.yml for configuration.
|
||||
*/
|
||||
class AiderAgent {
|
||||
constructor() {
|
||||
this.agentsMdAgent = new AgentsMdAgent_1.AgentsMdAgent();
|
||||
}
|
||||
getIdentifier() {
|
||||
return 'aider';
|
||||
}
|
||||
getName() {
|
||||
return 'Aider';
|
||||
}
|
||||
async applyRulerConfig(concatenatedRules, projectRoot, rulerMcpJson, agentConfig, backup = true) {
|
||||
// First perform idempotent AGENTS.md write via composed AgentsMdAgent
|
||||
await this.agentsMdAgent.applyRulerConfig(concatenatedRules, projectRoot, null, {
|
||||
// Preserve explicit outputPath precedence semantics if provided.
|
||||
outputPath: agentConfig?.outputPath ||
|
||||
agentConfig?.outputPathInstructions ||
|
||||
undefined,
|
||||
}, backup);
|
||||
// Now handle .aider.conf.yml configuration
|
||||
const cfgPath = agentConfig?.outputPathConfig ??
|
||||
this.getDefaultOutputPath(projectRoot).config;
|
||||
let doc = {};
|
||||
try {
|
||||
await fs.access(cfgPath);
|
||||
if (backup) {
|
||||
await (0, FileSystemUtils_1.backupFile)(cfgPath);
|
||||
}
|
||||
const raw = await fs.readFile(cfgPath, 'utf8');
|
||||
doc = (yaml.load(raw) || {});
|
||||
}
|
||||
catch {
|
||||
doc = {};
|
||||
}
|
||||
if (!Array.isArray(doc.read)) {
|
||||
doc.read = [];
|
||||
}
|
||||
// Determine the actual agents file path (AGENTS.md by default, or custom path)
|
||||
const agentsPath = agentConfig?.outputPath ||
|
||||
agentConfig?.outputPathInstructions ||
|
||||
this.getDefaultOutputPath(projectRoot).instructions;
|
||||
const name = path.basename(agentsPath);
|
||||
if (!doc.read.includes(name)) {
|
||||
doc.read.push(name);
|
||||
}
|
||||
const yamlStr = yaml.dump(doc);
|
||||
await (0, FileSystemUtils_1.writeGeneratedFile)(cfgPath, yamlStr);
|
||||
}
|
||||
getDefaultOutputPath(projectRoot) {
|
||||
return {
|
||||
instructions: path.join(projectRoot, 'AGENTS.md'),
|
||||
config: path.join(projectRoot, '.aider.conf.yml'),
|
||||
};
|
||||
}
|
||||
getMcpServerKey() {
|
||||
return this.agentsMdAgent.getMcpServerKey();
|
||||
}
|
||||
supportsMcpStdio() {
|
||||
return true;
|
||||
}
|
||||
supportsMcpRemote() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
exports.AiderAgent = AiderAgent;
|
||||
Reference in New Issue
Block a user