mother-brain 0.4.7 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +41 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -79,9 +79,26 @@ async function init(options = {}) {
|
|
|
79
79
|
const agentsFile = path.join(cwd, "AGENTS.md");
|
|
80
80
|
const sourceAgentsFile = path.join(packageRoot, "AGENTS.md");
|
|
81
81
|
if (await fs.pathExists(sourceAgentsFile)) {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
const mbContent = await fs.readFile(sourceAgentsFile, "utf-8");
|
|
83
|
+
const markerStart = "<!-- mother-brain:start -->";
|
|
84
|
+
const markerEnd = "<!-- mother-brain:end -->";
|
|
85
|
+
const wrappedContent = `${markerStart}
|
|
86
|
+
${mbContent}
|
|
87
|
+
${markerEnd}`;
|
|
88
|
+
if (await fs.pathExists(agentsFile)) {
|
|
89
|
+
const existing = await fs.readFile(agentsFile, "utf-8");
|
|
90
|
+
const startIdx = existing.indexOf(markerStart);
|
|
91
|
+
const endIdx = existing.indexOf(markerEnd);
|
|
92
|
+
if (startIdx !== -1 && endIdx !== -1) {
|
|
93
|
+
const merged = existing.substring(0, startIdx) + wrappedContent + existing.substring(endIdx + markerEnd.length);
|
|
94
|
+
await fs.writeFile(agentsFile, merged);
|
|
95
|
+
console.log(chalk.green("Updated Mother Brain section in AGENTS.md (user content preserved)"));
|
|
96
|
+
} else {
|
|
97
|
+
await fs.writeFile(agentsFile, existing.trimEnd() + "\n\n" + wrappedContent + "\n");
|
|
98
|
+
console.log(chalk.green("Appended Mother Brain rules to existing AGENTS.md"));
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
await fs.writeFile(agentsFile, wrappedContent + "\n");
|
|
85
102
|
console.log(chalk.green("Created AGENTS.md (always-active rules for Codex/Copilot)"));
|
|
86
103
|
}
|
|
87
104
|
}
|
|
@@ -215,7 +232,26 @@ async function update() {
|
|
|
215
232
|
const extractedAgentsFile = path2.join(tempDir, "package", "AGENTS.md");
|
|
216
233
|
const agentsFile = path2.join(cwd, "AGENTS.md");
|
|
217
234
|
if (await fs2.pathExists(extractedAgentsFile)) {
|
|
218
|
-
await fs2.
|
|
235
|
+
const mbContent = await fs2.readFile(extractedAgentsFile, "utf-8");
|
|
236
|
+
const markerStart = "<!-- mother-brain:start -->";
|
|
237
|
+
const markerEnd = "<!-- mother-brain:end -->";
|
|
238
|
+
const wrappedContent = `${markerStart}
|
|
239
|
+
${mbContent}
|
|
240
|
+
${markerEnd}`;
|
|
241
|
+
if (await fs2.pathExists(agentsFile)) {
|
|
242
|
+
const existing = await fs2.readFile(agentsFile, "utf-8");
|
|
243
|
+
const startIdx = existing.indexOf(markerStart);
|
|
244
|
+
const endIdx = existing.indexOf(markerEnd);
|
|
245
|
+
if (startIdx !== -1 && endIdx !== -1) {
|
|
246
|
+
const merged = existing.substring(0, startIdx) + wrappedContent + existing.substring(endIdx + markerEnd.length);
|
|
247
|
+
await fs2.writeFile(agentsFile, merged);
|
|
248
|
+
} else {
|
|
249
|
+
await fs2.writeFile(agentsFile, existing.trimEnd() + "\n\n" + wrappedContent + "\n");
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
await fs2.writeFile(agentsFile, wrappedContent + "\n");
|
|
253
|
+
}
|
|
254
|
+
console.log(chalk2.green(" \u2713 Updated AGENTS.md (user content preserved)"));
|
|
219
255
|
}
|
|
220
256
|
await fs2.remove(tempDir);
|
|
221
257
|
await fs2.writeJSON(versionFile, {
|
|
@@ -762,7 +798,7 @@ async function uninstall(options) {
|
|
|
762
798
|
// src/cli.ts
|
|
763
799
|
import { exec as exec3 } from "child_process";
|
|
764
800
|
var program = new Command();
|
|
765
|
-
var VERSION = "0.4.
|
|
801
|
+
var VERSION = "0.4.8";
|
|
766
802
|
program.name("mother-brain").description("AI-powered project management framework for GitHub Copilot CLI and Codex CLI").version(VERSION);
|
|
767
803
|
program.command("init").description("Initialize Mother Brain in the current project").option("-f, --force", "Overwrite existing skills").action(init);
|
|
768
804
|
program.command("update").description("Update Mother Brain skills to the latest version").action(update);
|