@mu-cabin/muc-cli 0.6.2 → 0.6.3

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/README.md CHANGED
@@ -8,6 +8,34 @@
8
8
 
9
9
  图片和文件可下载到操作系统允许写入的目录,包括 macOS `/tmp`、共享目录和目录符号链接。路径无效或目标文件已存在时返回明确错误与修复提示,不再误报后台不支持操作。下载仍不覆盖已有文件。
10
10
 
11
+ ## 0.6.3 Windows 兼容修复
12
+
13
+ 修复 Windows 已有后台锁文件被 Unix 权限检查误判,导致 `login` 等命令无法启动后台的问题;单实例互斥继续由 Windows 命名管道保证。JSON stdin 支持 UTF-8 BOM 和 CRLF。源码清理和离线打包不再需要 Bash 或 `rm`。
14
+
15
+ ### Windows 安装与运行
16
+
17
+ 安装 Node.js 22.16 或更新版本,在 PowerShell 中运行(`npm.cmd` / `muc.cmd` 可避开 `.ps1` 执行策略限制):
18
+
19
+ ```powershell
20
+ node --version
21
+ npm.cmd install -g @mu-cabin/muc-cli@0.6.3
22
+ muc.cmd --version
23
+ muc.cmd login --account YOUR_ACCOUNT --profile-id default --remember
24
+ muc.cmd whoami --profile-id default
25
+ ```
26
+
27
+ 默认数据目录为 `%USERPROFILE%\.muc`。首次使用仍需管理员通过受保护 stdin 完成 `init`;升级已有配置无需重新初始化。更新前运行 `muc.cmd daemon stop`,安装后下次登录或查询会启动新版后台;使用自定义配置根时,停止和启动都指定同一 `--config-root`。
28
+
29
+ PowerShell 不支持 Bash 的 `<<'JSON'`。JSON 可用单引号字符串通过管道传入;Windows PowerShell 5.1 先设置 UTF-8,防止中文被转换为问号:
30
+
31
+ ```powershell
32
+ $OutputEncoding = [System.Text.UTF8Encoding]::new($false)
33
+ '{"limit":20}' | muc.cmd exec chats.list --profile-id default
34
+ '{"includeSelf":false}' | muc.cmd --output jsonl exec events.watch --profile-id default
35
+ ```
36
+
37
+ CMD 可使用 `echo {"limit":20} | muc.cmd exec chats.list --profile-id default`。复杂 JSON 使用 UTF-8 文件重定向:`muc.cmd exec chats.list --profile-id default < request.json`。JSON 中的 Windows 路径使用 `C:/Users/NAME/Downloads/file.png` 或双反斜杠,含空格的命令行路径用双引号包围。密码仍只在用户终端的隐藏提示或受保护 stdin 输入。
38
+
11
39
  ## 配置和登录
12
40
 
13
41
  默认数据目录为 `~/.muc`;`MUC_CONFIG_DIR` 或全局 `--config-root` 可指定隔离目录。首次部署用 `muc init` 从受保护 stdin 接收管理员提供的租户和端点配置。
@@ -61,3 +89,5 @@ pnpm --filter @mu-cabin/muc-cli build
61
89
  ```
62
90
 
63
91
  仓库内的 `AGENTS.md` 与 `docs/development.md` 记录开发约定和验收证据;它们不属于安装包。Skill 源码随包发布,全局安装副本需另行安装。
92
+
93
+ `pnpm --filter @mu-cabin/muc-cli clean` 和 `pack:offline` 支持 Windows、macOS、Linux。MUC 的运行时依赖已内嵌,`pack:offline` 直接生成普通 npm tarball `mu-cabin-muc-cli-<version>.tgz`,目标机器可用 `npm install -g --offline <tarball>` 安装,无需另行捆绑依赖。
package/REFERENCE.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # MUC 命令契约
2
2
 
3
- 本文件描述 0.6.2 的命令契约。旧的 `send/history/daemon-*` 命令已移除。
3
+ 本文件描述 0.6.3 的命令契约。旧的 `send/history/daemon-*` 命令已移除。
4
4
 
5
5
  ## 命令结构
6
6
 
7
7
  全局参数放在命令之前:`muc [--config-root <绝对路径>] [--output json|jsonl|text] <命令>`。默认 JSON。配置根也可由 `MUC_CONFIG_DIR` 提供。
8
8
 
9
+ Windows 默认配置根为 `%USERPROFILE%\.muc`。PowerShell 若阻止 npm 生成的 `muc.ps1`,使用 `muc.cmd`;无须修改执行策略。业务 JSON 输入使用 UTF-8,允许开头的 UTF-8 BOM 与 CRLF。PowerShell 5.1 管道应先设置 `$OutputEncoding = [System.Text.UTF8Encoding]::new($false)`;不要直接复制 Bash 的 `<<'JSON'` 语法。示例见 README 的 Windows 章节。
10
+
9
11
  | 命令 | 用途 |
10
12
  | --- | --- |
11
13
  | `init` | 从受保护 stdin 配置租户与初始 profile |
package/dist/muc.mjs CHANGED
@@ -11446,7 +11446,7 @@ async function readJsonObject(io) {
11446
11446
  }
11447
11447
  let parsed;
11448
11448
  try {
11449
- parsed = JSON.parse(text2);
11449
+ parsed = JSON.parse(text2.replace(/^\uFEFF/u, ""));
11450
11450
  } catch {
11451
11451
  throw new CliInputError("Operation input must be one valid JSON object.");
11452
11452
  }
@@ -11698,7 +11698,10 @@ async function ensureSafeLockFile(path) {
11698
11698
  throw error;
11699
11699
  }
11700
11700
  const entry = await lstat2(path);
11701
- if (!entry.isFile() || entry.isSymbolicLink() || (entry.mode & 63) !== 0) {
11701
+ if (!entry.isFile() || entry.isSymbolicLink() || // Windows exposes synthetic mode bits; chmod cannot clear group/other
11702
+ // access there. Keep the file/type checks and let the named pipe own
11703
+ // mutual exclusion, as with the other private Windows state files.
11704
+ process.platform !== "win32" && (entry.mode & 63) !== 0) {
11702
11705
  throw new SingleInstanceError();
11703
11706
  }
11704
11707
  if (typeof process.getuid === "function" && entry.uid !== process.getuid()) {
@@ -12323,7 +12326,7 @@ async function assertLegacyStopped(root) {
12323
12326
  // package.json
12324
12327
  var package_default = {
12325
12328
  name: "@mu-cabin/muc-cli",
12326
- version: "0.6.2",
12329
+ version: "0.6.3",
12327
12330
  description: "Standalone agent-first MUC CLI with an embedded background daemon",
12328
12331
  license: "MIT",
12329
12332
  type: "module",
@@ -12350,11 +12353,11 @@ var package_default = {
12350
12353
  dev: "tsx src/index.ts",
12351
12354
  test: "pnpm build && vitest run",
12352
12355
  typecheck: "tsc --noEmit",
12353
- clean: "rm -rf dist",
12356
+ clean: `node -e "require('node:fs').rmSync('dist', { recursive: true, force: true })"`,
12354
12357
  build: "node scripts/build.mjs",
12355
12358
  prepack: "pnpm typecheck && pnpm test",
12356
12359
  verify: "npm pack --dry-run",
12357
- "pack:offline": "bash ../../scripts/pack-offline.sh"
12360
+ "pack:offline": "npm pack"
12358
12361
  },
12359
12362
  devDependencies: {
12360
12363
  "@types/node": "^22.19.15",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mu-cabin/muc-cli",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Standalone agent-first MUC CLI with an embedded background daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  "dev": "tsx src/index.ts",
28
28
  "test": "pnpm build && vitest run",
29
29
  "typecheck": "tsc --noEmit",
30
- "clean": "rm -rf dist",
30
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
31
31
  "build": "node scripts/build.mjs",
32
32
  "prepack": "pnpm typecheck && pnpm test",
33
33
  "verify": "npm pack --dry-run",
34
- "pack:offline": "bash ../../scripts/pack-offline.sh"
34
+ "pack:offline": "npm pack"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^22.19.15",
@@ -23,6 +23,15 @@ muc --output json exec chats.list --profile-id profile-id <<'JSON'
23
23
  JSON
24
24
  ```
25
25
 
26
+ On Windows PowerShell use `muc.cmd` if the npm `muc.ps1` shim is blocked; do not change execution policy. Bash heredocs are not PowerShell syntax. Set UTF-8 output in Windows PowerShell 5.1 before piping JSON, especially Chinese text:
27
+
28
+ ```powershell
29
+ $OutputEncoding = [System.Text.UTF8Encoding]::new($false)
30
+ '{"limit":20}' | muc.cmd --output json exec chats.list --profile-id profile-id
31
+ ```
32
+
33
+ CMD accepts `muc.cmd exec chats.list --profile-id profile-id < request.json` with a UTF-8 JSON file. A leading UTF-8 BOM and CRLF are supported. Use forward slashes or escaped backslashes inside JSON Windows paths. Windows storage defaults to `%USERPROFILE%\.muc`; stop the daemon for the same config root before upgrading.
34
+
26
35
  Default storage is `~/.muc`, overridden by `MUC_CONFIG_DIR` or `--config-root`. Normal commands may start the bundled daemon for this exact root. Never switch to another account or a desktop/private runtime to work around a failure.
27
36
 
28
37
  Use only the current `exec` grammar, not old `muc send`, `muc history`, or `muc daemon-*` aliases. Listening uses `events.watch`; the daemon keeps receiving after a consumer exits. Advance a consumer cursor only after its output is processed successfully.