@getmikie/cli 1.1.126 → 1.1.127

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/bin/mikie.mjs CHANGED
@@ -59,34 +59,37 @@ function updateGuidance(message) {
59
59
  }
60
60
  const packageMetadata = require("../package.json");
61
61
  const arguments_ = process.argv.slice(2);
62
+ // Updating Codex/Claude Code registrations can wait for a busy client; the
63
+ // command itself still runs and the update is retried on the next command.
64
+ const CLIENT_REPAIR_DEFERRED =
65
+ "mikie: Mikie will finish updating its Codex and Claude Code setup next time. If Mikie stops working there, run `mikie setup codex` or `mikie setup claude`.";
62
66
  const singleFlag = arguments_.length === 1 ? arguments_[0].toLowerCase() : null;
63
67
 
64
68
  if (["--version", "-v"].includes(singleFlag)) {
65
69
  console.log(packageMetadata.version);
66
- } else if (["--help", "-h"].includes(singleFlag)) {
70
+ } else if (["--help", "-h", "help"].includes(singleFlag)) {
67
71
  console.log(`Mikie ${packageMetadata.version}
68
72
 
69
- Usage:
70
- mikie activity --mode solo|ai_assisted|unknown --language <category>
71
- mikie savings history [options]
72
- mikie savings export-meter-history
73
- mikie mcp [--adapter codex|claude_code]
74
- mikie login
75
- mikie logout
76
- mikie connect .|<absolute-directory>
77
- mikie privacy review
78
- mikie setup codex
79
- mikie setup claude
80
- mikie mode codex [active|shadow] [--json]
81
- mikie control run --request <absolute-json> --json
82
- mikie doctor [--client codex]
83
- mikie update
84
- mikie device revoke
85
- mikie uninstall
86
- mikie --help
87
- mikie --version
73
+ Get started:
74
+ mikie login Sign in
75
+ mikie setup codex Add Mikie to Codex
76
+ mikie setup claude Add Mikie to Claude Code
77
+ mikie connect . Connect the project in this folder
88
78
 
89
- All commands execute the compiled Mikie native engine.`);
79
+ Everyday:
80
+ mikie doctor Check that Mikie is working (--json for details)
81
+ mikie savings history See what Mikie has saved you
82
+ mikie mode codex Show or switch Mikie's Codex mode (active or shadow)
83
+ mikie privacy review See what Mikie can read in your project
84
+ mikie update Update Mikie
85
+
86
+ Account:
87
+ mikie logout Sign out
88
+ mikie device revoke Remove this computer from your account
89
+ mikie uninstall Remove Mikie
90
+
91
+ mikie --help Show this help
92
+ mikie --version Show the installed version`);
90
93
  } else if (arguments_.length === 1 && arguments_[0].toLowerCase() === "update") {
91
94
  try {
92
95
  const commands = createCommandAdapter();
@@ -322,7 +325,7 @@ All commands execute the compiled Mikie native engine.`);
322
325
  allowDeferred: nativeArguments[0] === "serve",
323
326
  });
324
327
  if (clients.status === "deferred") {
325
- console.error("mikie: client repair deferred; relay startup continues. Run `mikie doctor` to inspect client registration.");
328
+ console.error(CLIENT_REPAIR_DEFERRED);
326
329
  }
327
330
  } else if (shouldCompleteSkippedInstall(nativeArguments)) {
328
331
  // An invalid install fails here, once, before any client repair.
@@ -330,7 +333,7 @@ All commands execute the compiled Mikie native engine.`);
330
333
  try {
331
334
  const clients = await completeSkippedInstall({ version: packageMetadata.version });
332
335
  if (clients.status === "deferred") {
333
- console.error("mikie: client repair deferred; run `mikie doctor` to inspect client registration.");
336
+ console.error(CLIENT_REPAIR_DEFERRED);
334
337
  }
335
338
  } catch (error) {
336
339
  const reason = error instanceof Error ? error.message : "unavailable";
package/lib/update.mjs CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  readdir,
12
12
  rename,
13
13
  rm,
14
+ rmdir,
14
15
  stat,
15
16
  } from "node:fs/promises";
16
17
  import path from "node:path";
@@ -449,6 +450,10 @@ export async function setAsideUpdateTransaction(
449
450
  } catch (error) {
450
451
  if (error?.message === "another Mikie update transaction is active") throw error;
451
452
  }
453
+ return renameTransactionAside(transactionRoot, now);
454
+ }
455
+
456
+ async function renameTransactionAside(transactionRoot, now = new Date()) {
452
457
  const stamp = now.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
453
458
  for (let attempt = 0; attempt < 100; attempt += 1) {
454
459
  const target = `${transactionRoot}.set-aside-${stamp}${attempt ? `-${attempt}` : ""}`;
@@ -2634,6 +2639,21 @@ export function createFilesystemAdapter({
2634
2639
  if (error?.code === "ENOENT") return;
2635
2640
  throw error;
2636
2641
  }
2642
+ try {
2643
+ await lstat(journalPath);
2644
+ } catch (error) {
2645
+ if (error?.code !== "ENOENT") throw error;
2646
+ // The journal is written when the snapshot completes, before any live
2647
+ // change, and a failed snapshot removes its own root. A root without a
2648
+ // journal therefore never recorded a mutation: nothing to roll back.
2649
+ // An empty one is removed; anything else is kept aside byte for byte.
2650
+ if ((await readdir(transactionRoot)).length === 0) {
2651
+ await rmdir(transactionRoot);
2652
+ } else {
2653
+ await renameTransactionAside(transactionRoot);
2654
+ }
2655
+ return;
2656
+ }
2637
2657
  const snapshot = await hydrateJournal(lease, expectedJournalToken);
2638
2658
  if (snapshot.phase === "commit_decided_retain_runtime") {
2639
2659
  const activationMatches = await committedActivationMatches(snapshot);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getmikie/cli",
3
- "version": "1.1.126",
3
+ "version": "1.1.127",
4
4
  "description": "Native Mikie relay launcher for MCP clients",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -24,9 +24,9 @@
24
24
  "node": ">=22"
25
25
  },
26
26
  "optionalDependencies": {
27
- "@getmikie/darwin-arm64": "1.1.126",
28
- "@getmikie/linux-x64-gnu": "1.1.126",
29
- "@getmikie/win32-x64": "1.1.126"
27
+ "@getmikie/darwin-arm64": "1.1.127",
28
+ "@getmikie/linux-x64-gnu": "1.1.127",
29
+ "@getmikie/win32-x64": "1.1.127"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public",
@@ -624,7 +624,7 @@ if (scriptIdentity !== null && scriptIdentity === invokedIdentity) {
624
624
  allowDeferred: true,
625
625
  });
626
626
  if (clients.status === "deferred") {
627
- console.warn("Mikie install client repair deferred; run `mikie setup` or `mikie doctor`.");
627
+ console.warn("Mikie will finish updating its Codex and Claude Code setup next time. If Mikie stops working there, run `mikie setup codex` or `mikie setup claude`.");
628
628
  }
629
629
  } catch (error) {
630
630
  console.error(`Mikie install reconciliation failed: ${error.message}`);