@1memory/cli 0.2.47 → 1.0.0

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +17 -1
  3. package/package.json +3 -10
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @1memory/cli
2
2
 
3
- 1memory 记忆 CLI(Rust 二进制分发)——跨设备跨软件统一 AI 记忆系统,端到端加密,服务器只见密文。
3
+ 1memory 记忆 CLI(Rust 二进制分发)——跨设备跨软件统一 AI 记忆系统,端到端加密,服务器只见密文。源码与发版在仓库 [1memory-cli](https://github.com/one-memory/1memory-cli)。六仓组织见 [docs/repos.md](https://github.com/one-memory/1memory-docs/blob/main/docs/repos.md)。
4
4
 
5
5
  ## 安装
6
6
 
package/bin/cli.js CHANGED
@@ -2,6 +2,8 @@
2
2
  'use strict';
3
3
  // 1memory CLI npm 包装器:定位平台子包中的二进制并转发执行。
4
4
  const { spawnSync } = require('child_process');
5
+ const path = require('path');
6
+ const { existsSync } = require('fs');
5
7
 
6
8
  const PKGS = {
7
9
  'linux-x64': '@1memory/cli-linux-x64',
@@ -35,7 +37,21 @@ try {
35
37
  process.exit(1);
36
38
  }
37
39
 
38
- const r = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
40
+ // 前端产物解耦(2026-09-20):CLI 运行时按 ONEMEMORY_WEB_DIST 查找 tree-ui 产物。
41
+ // 此处解析 @1memory/web-dist 的实际位置并注入——Rust 侧无需知道 npm 布局,
42
+ // 亦便于用户自备前端(自己设 ONEMEMORY_WEB_DIST 即覆盖,此处不覆盖已有值)。
43
+ const env = { ...process.env };
44
+ if (!env.ONEMEMORY_WEB_DIST) {
45
+ try {
46
+ const pkgJson = require.resolve('@1memory/web-dist/package.json');
47
+ const distDir = path.join(path.dirname(pkgJson), 'dist');
48
+ if (existsSync(path.join(distDir, 'index.html'))) env.ONEMEMORY_WEB_DIST = distDir;
49
+ } catch {
50
+ // 未装 web-dist:不阻断。仅 `1memory web` 会给出明确指引,其余命令照常。
51
+ }
52
+ }
53
+
54
+ const r = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit', env });
39
55
  if (r.error) {
40
56
  console.error(`1memory: ${r.error.message}`);
41
57
  process.exit(1);
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@1memory/cli",
3
- "version": "0.2.47",
4
- "description": "1memory 记忆 CLI — 跨设备跨软件统一 AI 记忆系统(纯记忆核心,二进制分发)",
3
+ "version": "1.0.0",
4
+ "description": "1memory CLI — encrypted cross-device AI memory",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/one-memory/1memory.git"
8
+ "url": "git+https://github.com/one-memory/1memory-cli.git"
9
9
  },
10
10
  "bin": {
11
11
  "1memory": "./bin/cli.js"
@@ -16,12 +16,5 @@
16
16
  ],
17
17
  "engines": {
18
18
  "node": ">=16"
19
- },
20
- "optionalDependencies": {
21
- "@1memory/cli-linux-x64": "0.2.47",
22
- "@1memory/cli-linux-arm64": "0.2.47",
23
- "@1memory/cli-darwin-arm64": "0.2.47",
24
- "@1memory/cli-win32-x64": "0.2.47",
25
- "@1memory/cli-win32-arm64": "0.2.47"
26
19
  }
27
20
  }