@datamini/passmem-cli 0.1.0 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datamini/passmem-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "PassMem CLI and Skill for memory channels",
5
5
  "type": "module",
6
6
  "repository": {
@@ -32,7 +32,7 @@ const help = `PassMem CLI
32
32
 
33
33
  get-skill [--install 技能目录] 输出或安装 PassMem Skill
34
34
  login (--email 邮箱 | --key-stdin) 验证邮箱或导入网页生成的 API Key
35
- whoami 查看账号和组织
35
+ whoami 查看当前账号
36
36
  logout 撤销个人 Agent Key
37
37
  send (--mem-id-file 路径 | --mem-id-stdin) [--body 文本 | --body-file 路径]
38
38
  [--file 路径]... [--signed] [--request-id UUID]
@@ -51,7 +51,7 @@ const help = `PassMem CLI
51
51
  shared download (--link-file 路径 | --link-stdin) --out 路径
52
52
 
53
53
  收件命令用 --key-file 或 PASSMEM_CHANNEL_KEY 提供连接凭证。终端直接显示来件,程序可用 --json。
54
- 通道命令可用 --org 指定组织。凭证只从私有文件、环境变量或标准输入读取。`;
54
+ 凭证只从私有文件、环境变量或标准输入读取。`;
55
55
 
56
56
  function siteOrigin(value) {
57
57
  const url = URL.parse(value);
@@ -274,18 +274,10 @@ async function deliver(site, options) {
274
274
  }
275
275
  }
276
276
 
277
- async function orgScope(site, options) {
278
- const key = await accountKey(site);
279
- if (options.org) return { key, org: uuid(options.org, '组织 ID') };
280
- const { organizations } = await readJson(site, agent + '/me', { key });
281
- if (organizations?.length !== 1) throw new CommandError('请用 passmem whoami 查看组织,并用 --org 指定组织 ID。');
282
- return { key, org: uuid(organizations[0].id, '组织 ID') };
283
- }
284
-
285
277
  async function channelCommand(site, options, [action, channel, child]) {
286
- const { key, org } = await orgScope(site, options);
287
- const base = `${agent}/organizations/${org}/channels`;
288
- const pageLink = (channelId) => `${site}/?org=${org}&channel=${uuid(channelId, '通道 ID')}`;
278
+ const key = await accountKey(site);
279
+ const base = `${agent}/channels`;
280
+ const pageLink = (channelId) => `${site}/?channel=${uuid(channelId, '通道 ID')}`;
289
281
  const get = (path) => readJson(site, path, { key });
290
282
  const post = (path, json = {}) => readJson(site, path, { key, json });
291
283
  const details = ({ memId: secret, ...info }) => ({ secret, ...info, url: pageLink(info.id) });
@@ -378,7 +370,7 @@ async function main(argv) {
378
370
  options: {
379
371
  help: { type: 'boolean', short: 'h' }, site: { type: 'string' }, email: { type: 'string' },
380
372
  'key-stdin': { type: 'boolean' }, json: { type: 'boolean' },
381
- name: { type: 'string' }, org: { type: 'string' }, out: { type: 'string' }, before: { type: 'string' },
373
+ name: { type: 'string' }, out: { type: 'string' }, before: { type: 'string' },
382
374
  'mem-id-file': { type: 'string' }, 'mem-id-stdin': { type: 'boolean' }, signed: { type: 'boolean' },
383
375
  body: { type: 'string' }, 'body-file': { type: 'string' }, file: { type: 'string', multiple: true },
384
376
  'request-id': { type: 'string' }, 'link-file': { type: 'string' }, 'link-stdin': { type: 'boolean' },
@@ -5,7 +5,7 @@ description: 使用 PassMem CLI 创建记忆通道、投递消息和文件、代
5
5
 
6
6
  # PassMem
7
7
 
8
- 在终端使用 PassMem CLI 执行业务操作。网页用于登录、查看通道、预览和下载附件及管理组织。用下面的命令投递、管理通道和分享文件。
8
+ 在终端使用 PassMem CLI 执行业务操作。网页用于登录、查看通道以及预览和下载附件。用下面的命令投递、管理通道和分享文件。
9
9
 
10
10
  ## 运行 CLI 和登录
11
11
 
@@ -21,7 +21,7 @@ curl --fail --silent --show-error "$PASSMEM_SITE/passmem-cli.mjs" -o "$HOME/.pas
21
21
  passmem() { node "$HOME/.passmem/passmem-cli.mjs" "$@"; }
22
22
  ```
23
23
 
24
- 站点不同可用 `--site` 指定。CLI 禁止 HTTP 重定向。匿名投递和用链接读取单个文件无需登录。其他账号操作需要个人 API Key。用户可在工作台右上角点「API Key」直接查看和复制 Key,也可在页面生成,再亲自在终端执行 `passmem login --key-stdin` 并隐藏粘贴。也可运行 `passmem login --email 注册邮箱`,在终端隐藏输入 8 位验证码。CLI 把 Key 保存到权限为 `0600` 的站点专用文件,也支持从私有环境变量 `PASSMEM_AGENT_KEY` 读取。用 `passmem whoami` 核对账号和组织,多个组织时用 `--org 组织ID`。任何入口生成的新 Key 都会替换旧 Key,`passmem logout` 可撤销当前 Key。
24
+ 站点不同可用 `--site` 指定。CLI 禁止 HTTP 重定向。匿名投递和用链接读取单个文件无需登录。其他账号操作需要个人 API Key。用户可在工作台「Agent 接入」点「API Key」直接查看和复制 Key,也可在页面生成,再亲自在终端执行 `passmem login --key-stdin` 并隐藏粘贴。也可运行 `passmem login --email 注册邮箱`,在终端隐藏输入 8 位验证码。CLI 把 Key 保存到权限为 `0600` 的站点专用文件,也支持从私有环境变量 `PASSMEM_AGENT_KEY` 读取。用 `passmem whoami` 核对当前账号。通道归创建它的账号。任何入口生成的新 Key 都会替换旧 Key,`passmem logout` 可撤销当前 Key。
25
25
 
26
26
  将 Mem ID、验证码、Key 和完整文件分享链接视为私有凭证。用权限为 `0600` 的文件、私有环境变量或隐藏终端输入传递。凭证不得进入聊天、命令参数或日志。输出文件放在可控目录。获得用户明确授权后再执行发送、修改、分享或删除。
27
27