mother-brain 0.7.5 → 0.7.6

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 CHANGED
@@ -61,7 +61,10 @@ async function init(options = {}) {
61
61
  const pkg = await fs.readJSON(path.join(packageRoot, "package.json"));
62
62
  await fs.writeJSON(versionFile, {
63
63
  installed: pkg.version,
64
- installedAt: (/* @__PURE__ */ new Date()).toISOString()
64
+ installedAt: (/* @__PURE__ */ new Date()).toISOString(),
65
+ // Startup can use this to avoid hitting the network every run.
66
+ lastUpdateCheckAt: (/* @__PURE__ */ new Date()).toISOString(),
67
+ lastKnownLatest: pkg.version
65
68
  }, { spaces: 2 });
66
69
  const sessionFile = path.join(motherBrainDir, "session-state.json");
67
70
  if (!await fs.pathExists(sessionFile)) {
@@ -205,6 +208,11 @@ async function update() {
205
208
  console.log(chalk2.dim(`Latest: v${latestVersion}
206
209
  `));
207
210
  if (currentVersion.installed === latestVersion) {
211
+ await fs2.writeJSON(versionFile, {
212
+ ...currentVersion,
213
+ lastUpdateCheckAt: (/* @__PURE__ */ new Date()).toISOString(),
214
+ lastKnownLatest: latestVersion
215
+ }, { spaces: 2 });
208
216
  console.log(chalk2.green("\u2705 Already on the latest version!\n"));
209
217
  return;
210
218
  }
@@ -257,7 +265,9 @@ ${markerEnd}`;
257
265
  await fs2.writeJSON(versionFile, {
258
266
  installed: latestVersion,
259
267
  installedAt: (/* @__PURE__ */ new Date()).toISOString(),
260
- previousVersion: currentVersion.installed
268
+ previousVersion: currentVersion.installed,
269
+ lastUpdateCheckAt: (/* @__PURE__ */ new Date()).toISOString(),
270
+ lastKnownLatest: latestVersion
261
271
  }, { spaces: 2 });
262
272
  console.log(chalk2.cyan(`
263
273
  \u2705 Updated to v${latestVersion}!
@@ -798,7 +808,7 @@ async function uninstall(options) {
798
808
  // src/cli.ts
799
809
  import { exec as exec3 } from "child_process";
800
810
  var program = new Command();
801
- var VERSION = "0.7.5";
811
+ var VERSION = "0.7.6";
802
812
  program.name("mother-brain").description("AI-powered project management framework for GitHub Copilot CLI and Codex CLI").version(VERSION);
803
813
  program.command("init").description("Initialize Mother Brain in the current project").option("-f, --force", "Overwrite existing skills").action(init);
804
814
  program.command("update").description("Update Mother Brain skills to the latest version").action(update);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mother-brain",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "AI-powered project management framework for GitHub Copilot CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -43,8 +43,14 @@ allowed-tools: powershell view grep glob web_search ask_user create edit skill
43
43
  This ensures Mother Brain works across ALL agent runtimes (GitHub Copilot CLI, Codex CLI, IDE extensions, etc.) even when interactive UI tools are unavailable.
44
44
 
45
45
  ### RULE 3: VERSION CHECK FIRST
46
- - Before showing ANY menu, run: `npm view mother-brain version --json 2>$null`
47
- - Compare to local version
46
+ - Before showing ANY menu, perform a version check (fast-first):
47
+ - Read `.mother-brain/version.json` to get the installed version
48
+ - If `.mother-brain/version.json` contains a fresh cached update check:
49
+ - Fields: `lastUpdateCheckAt` + `lastKnownLatest`
50
+ - TTL: 24 hours
51
+ - Then you may skip the network call and treat `lastKnownLatest` as the latest version for this startup
52
+ - Otherwise, run: `npm view mother-brain version --json 2>$null`
53
+ - Compare installed vs latest
48
54
  - If newer version exists → notify user BEFORE proceeding
49
55
  - **To update**: Run `npx -y mother-brain update` — the CLI handles everything automatically
50
56
 
@@ -6,13 +6,20 @@
6
6
  - Read `references/boot-screen.md`
7
7
  - Print ONLY the short user-facing startup lines from the template
8
8
  - Do NOT print commands or internal reasoning
9
- - Run version check:
10
- ```powershell
11
- npm view mother-brain version --json 2>$null
12
- ```
13
- - Compare against:
14
- - If in framework repo: `cli/package.json` version field (source repo version)
15
- - If in project: `.mother-brain/version.json` installed field (installed/tracked version)
9
+ - **Fast-first version check (cache before network)**:
10
+ 1. Read installed version from `.mother-brain/version.json` (project) or `cli/package.json` (framework repo)
11
+ 2. If in a project folder, check whether `.mother-brain/version.json` has a fresh cached update check:
12
+ - Fields: `lastUpdateCheckAt` + `lastKnownLatest`
13
+ - TTL: 24 hours
14
+ - If fresh: treat `lastKnownLatest` as "Latest" for this startup and SKIP the network call
15
+ 3. If no cache or cache is stale: run the network check:
16
+ ```powershell
17
+ npm view mother-brain version --json 2>$null
18
+ ```
19
+ - After a successful check, update `.mother-brain/version.json` with:
20
+ - `lastUpdateCheckAt`: now
21
+ - `lastKnownLatest`: the npm version
22
+ - If check fails (offline), continue silently without blocking startup
16
23
  - **If newer version exists**:
17
24
  - **If in a project folder** (has `.mother-brain/version.json`):
18
25
  ```