maqcli 0.6.5 → 0.6.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.
@@ -353,7 +353,7 @@ async function connectMobile(rl) {
353
353
  async function launchUi(authKey) {
354
354
  // Reuse the daemon; open its landing page. Import lazily to avoid a cycle.
355
355
  const { createDaemon } = await import("../server/daemon.js");
356
- const daemon = createDaemon({ token: authKey, version: "0.6.5" });
356
+ const daemon = createDaemon({ token: authKey, version: "0.6.6" });
357
357
  try {
358
358
  const { host, port } = await daemon.listen();
359
359
  const url = `http://${host}:${port}/`;
@@ -86,6 +86,8 @@ export declare function detachedInstallCommand(version: string, logPath: string,
86
86
  args: string[];
87
87
  scriptPath: string;
88
88
  scriptContent: string;
89
+ cleanupPath?: string;
90
+ cleanupContent?: string;
89
91
  };
90
92
  /**
91
93
  * Launch the update fully detached and return immediately — the caller
@@ -117,8 +117,24 @@ export function detachedInstallCommand(version, logPath, platform = process.plat
117
117
  const pkg = `maqcli@${version}`;
118
118
  if (platform === "win32") {
119
119
  const scriptPath = join(tmpdir(), `maq-update-${Date.now()}.bat`);
120
- const scriptContent = ["@echo off", `npm install -g ${pkg} > "${logPath}" 2>&1`, `start "" /min cmd.exe /c del "%~f0"`].join("\r\n");
121
- return { cmd: "cmd.exe", args: ["/c", "start", "", "/min", scriptPath], scriptPath, scriptContent };
120
+ const cleanupPath = join(tmpdir(), `maq-update-cleanup-${Date.now()}.bat`);
121
+ // The install script does NOT try to delete itself a .bat can't
122
+ // reliably remove the file cmd.exe is actively interpreting. Instead it
123
+ // launches this second, separate cleanup script (detached, its own
124
+ // process) once npm finishes; THAT script deletes both files after a
125
+ // short delay, by which point neither is open by anything.
126
+ const scriptContent = [
127
+ "@echo off",
128
+ `npm install -g ${pkg} > "${logPath}" 2>&1`,
129
+ `start "" /min "${cleanupPath}"`,
130
+ ].join("\r\n");
131
+ const cleanupContent = [
132
+ "@echo off",
133
+ "ping -n 2 127.0.0.1 >nul",
134
+ `del "${scriptPath}"`,
135
+ `del "%~f0"`,
136
+ ].join("\r\n");
137
+ return { cmd: "cmd.exe", args: ["/c", "start", "", "/min", scriptPath], scriptPath, scriptContent, cleanupPath, cleanupContent };
122
138
  }
123
139
  const scriptPath = join(tmpdir(), `maq-update-${Date.now()}.sh`);
124
140
  const scriptContent = ["#!/bin/sh", `npm install -g ${pkg} > '${logPath}' 2>&1`, `rm -f "$0"`].join("\n");
@@ -132,8 +148,10 @@ export function detachedInstallCommand(version, logPath, platform = process.plat
132
148
  * `writer` is injectable so tests don't touch the real filesystem either.
133
149
  */
134
150
  export function launchDetachedUpdate(version, logPath, spawner = spawn, writer = (path, content) => writeFileSync(path, content, "utf8")) {
135
- const { cmd, args, scriptPath, scriptContent } = detachedInstallCommand(version, logPath);
151
+ const { cmd, args, scriptPath, scriptContent, cleanupPath, cleanupContent } = detachedInstallCommand(version, logPath);
136
152
  writer(scriptPath, scriptContent);
153
+ if (cleanupPath && cleanupContent)
154
+ writer(cleanupPath, cleanupContent);
137
155
  if (process.platform !== "win32") {
138
156
  try {
139
157
  chmodSync(scriptPath, 0o755);
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ import { runOrchestration } from "./core/orchestrator.js";
46
46
  import { performUpdate, installedGlobalVersion } from "./core/update.js";
47
47
  import { checkProtectedPath, scanForInjection, securityLog, securityRules, } from "./core/security.js";
48
48
  import { readFileSync, statSync } from "node:fs";
49
- const VERSION = "0.6.5";
49
+ const VERSION = "0.6.6";
50
50
  async function main(argv) {
51
51
  const [command, ...rest] = argv;
52
52
  switch (command) {
@@ -52,7 +52,7 @@ export function createDaemon(opts = {}) {
52
52
  const host = opts.host ?? process.env.MAQ_HOST ?? "127.0.0.1";
53
53
  const port = opts.port ?? Number(process.env.MAQ_PORT ?? 7717);
54
54
  const token = opts.token ?? process.env.MAQ_TOKEN ?? generateToken();
55
- const version = opts.version ?? "0.6.5";
55
+ const version = opts.version ?? "0.6.6";
56
56
  const corsOrigin = opts.corsOrigin ?? process.env.MAQ_CORS_ORIGIN;
57
57
  const registry = opts.registry ?? new SessionRegistry();
58
58
  const interactive = new InteractiveRegistry();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maqcli",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "description": "MAQ master orchestrator — a token-efficient, agent-agnostic supervisor CLI that sits on top of any worker CLI (AI or not) via a Scout -> Plan -> Execute -> Verify pipeline.",
5
5
  "type": "module",
6
6
  "bin": {