@qoder-ai/qmind-cli 1.1.2 → 3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # @qoder-ai/qmind-cli
2
2
 
3
+ English (default) | [简体中文](CHANGELOG.zh-CN.md)
4
+
5
+ Published versions below describe the Global CLI/shared implementation, not historical CN releases. CN will join the shared history with the future joint release.
6
+
7
+ ## 3.0.0
8
+
9
+ ### Major Changes
10
+
11
+ - 28508e5: Release QMind CLI as one shared-version Global/CN cohort. Keep `@qoder-ai/qmind-cli` / `qmind` for Qoder Global and introduce `@qodercn-ai/qmind-cli` / `qmind-cn` for Qoder China. Each distribution now has a build-time-fixed product identity and production target, isolated product/target file credentials, bilingual package documentation and changelog, and an immutable dual-distribution candidate that is published automatically after its Changeset reaches `main`. The CLI no longer reads legacy root state or OS Keyring entries; upgrade the Global package and sign in again, and install the CN package separately when it is published.
12
+
13
+ ### Changes without version bumps
14
+
15
+ - Fix the CLI product at build time and isolate config, file credentials and sync mappings by product/target under `QMIND_HOME/cli/`. Use `--env` or paired `--sash`/`--dashboard` for debug targets and `QMIND_DEBUG_TOKEN` for debug tokens. Legacy address hints only warn when matching and fail before requests otherwise; old root files and `.qmind-env` are not read. Sign in again in the new partition. The shared major release delivers the CN package from the same versioned source.
16
+ - Use the file credential vault exclusively; do not install, load, read, write, or delete OS Keyring entries. Device/refresh tokens remain plaintext files with existing permissions, atomic writes, locks, and compare-and-swap protection. No old authentication state is imported.
17
+ - Remove obsolete CLI-internal Node Host forwarding/updater layers, harden Agent release evidence, and align package, security, and acceptance documentation with the current topology.
18
+
19
+ - Settle CLI English and Chinese changelogs together from one Changeset and version, validate matching history and references, and include both files in settlement and local artifact checks. Keep publication deferred.
20
+ - Add an opt-in frozen CLI candidate tag stage with strict annotated tag identity and tarball digest checks, immutable per-attempt evidence, and remote readback for retries. Keep production CI and npm publication unchanged.
21
+ - Add the internal per-distribution publisher for frozen CLI candidates: reconcile exact versions, publish original tarballs under release tags, verify anonymously, and resume latest promotion without downgrading newer releases. Production publishing remains disconnected.
22
+ - Prepare independently compiled Global/CN CLI tarballs from one version and dependency snapshot, with normal co-installation and fixed-product authentication checks. Defer formal candidate integration and publication to the joint major release.
23
+ - Add opt-in dual CLI candidate preparation and read-only frozen artifact verification. Bind both distributions to one settled source and bilingual release, while keeping the existing publication pipeline disabled for the new candidate schema.
24
+ - Prepare fixed CLI product routing, explicit debug targets, legacy-address diagnostics and partitioned file state. Keep shared Host defaults unchanged and defer versioning/publication to the joint Global/CN major release.
25
+ - Archive schema 8 dual CLI candidates from main settlement and add an explicit production promotion pipeline with candidate-bound acceptance, tag, isolated Global/CN publisher, recovery, summary, and notification gates. No release is executed by this change.
26
+ - Add opt-in anonymous exact-version verification for frozen Global/CN CLI candidates, including downloaded bytes, isolated npm installation, installed commands and immutable verification receipts. Keep production publishing and latest promotion unchanged.
27
+ - Add a tokenless internal dual-release summary that validates Global/CN publisher evidence and anonymously rechecks current latest versions without mutating registry or Git state. Production release assembly remains disconnected.
28
+
29
+ ## 2.0.0
30
+
31
+ ### Major Changes
32
+
33
+ - a317ae9: Tighten the QMind Client domain contract: remove the ineffective `userId` client option and the Node Host/CLI `userId`, `--user`, and `QMIND_USER_ID` configuration surface; accept real empty lists, zero pagination, and RepoWiki snake_case wire shapes; complete known Card facet and ChatMessage fields; and advertise only capabilities callable through the public interface. Export strict domain decoders for host routes not yet exposed by the Client. Add Fetch Transport stream connect/idle timeouts and make Zod a compatible host-provided peer to avoid duplicate schema type universes.
34
+
35
+ ## 1.1.3
36
+
37
+ ### Patch Changes
38
+
39
+ - d2dcbb6: Add the QMind Agent Contract v1 Core, per-Query Qoder Agent SDK adapter, shared Node host, canonical Qoder Plugin runtime and deterministic Plugin artifact flow. The CLI now consumes the extracted Node host without changing its command surface.
40
+
41
+ ### Changes without version bumps
42
+
43
+ - Enable Node.js module compile caching before loading the CLI application on supported runtimes while preserving Node 20 compatibility.
44
+
3
45
  ## 1.1.2
4
46
 
5
47
  ### Patch Changes
@@ -0,0 +1,70 @@
1
+ # @qoder-ai/qmind-cli
2
+
3
+ [English (default)](CHANGELOG.md) | 简体中文
4
+
5
+ 以下已发布版本属于 Global CLI / 共享实现,不代表 CN 曾发布过这些版本。CN 将在后续共同发行版加入同一历史。
6
+
7
+ ## 3.0.0
8
+
9
+ ### Major Changes
10
+
11
+ - 28508e5: 将 QMind CLI 作为共享版本的 Global/CN 共同发行版发布:Qoder Global 继续使用 `@qoder-ai/qmind-cli` / `qmind`,Qoder 中国版新增 `@qodercn-ai/qmind-cli` / `qmind-cn`。每个发行版都具有构建时固定的产品身份与正式目标、按产品/目标隔离的文件凭证、中英文 package 文档与 changelog,以及一个在 Changeset 进入 `main` 后自动发布的双发行物不可变候选。CLI 不再读取旧根目录状态或 OS Keyring 项;Global 用户升级后需要重新登录,CN 包正式发布后需单独安装。
12
+
13
+ ### Changes without version bumps
14
+
15
+ - 构建时固定 CLI 产品,config、文件凭证与同步映射按产品/目标隔离在 `QMIND_HOME/cli/` 下。调试使用 `--env` 或成对 `--sash`/`--dashboard`,Token 使用 `QMIND_DEBUG_TOKEN`。旧地址仅同值警告、冲突则在请求前停止;不读取旧根文件与 `.qmind-env`,请在新分区重新登录。共同 major 发行版从同一份版本化源码交付 CN 包。
16
+ - 只使用文件 credential vault,不安装、加载、读取、写入或删除 OS Keyring 项。device/refresh token 仍为明文文件,保留现有权限、原子写、文件锁与 compare-and-swap 保护,不导入旧认证状态。
17
+ - 移除过时的 CLI 内部 Node Host 转发及 updater 层,强化 Agent 发布证据,并使 package、安全和验收文档与当前结构一致。
18
+
19
+ - 从同一 Changeset 与版本共同结算 CLI 中英文 changelog,校验历史及引用一致,并将两份文档纳入结算和本地制品检查。仍不触发发布。
20
+ - 增加显式冻结 CLI 候选 tag 阶段,严格校验 annotated tag 身份和 tarball 摘要,逐次保留不可覆盖的尝试记录,并通过远端读回支持重试。生产 CI 与 npm 发布流程保持不变。
21
+ - 增加冻结 CLI 候选的内部按发行物发布模块:精确版本对账、以 release 标签发布原始 tarball、匿名验证,以及不会降级新版的 latest 恢复。生产发布入口仍不接通。
22
+ - 从同一版本与依赖快照分别编译 Global/CN CLI tarball,验证普通并装及固定产品认证。正式候选接入与发布留至共同 major 发行版。
23
+ - 增加显式双 CLI 候选准备与冻结制品只读验证入口,将两种发行物绑定到同一已结算源码和双语版本;现有发布流水线仍不接受新的候选格式。
24
+ - 准备固定的 CLI 产品路由、显式调试目标、旧地址诊断与分区文件状态。保持共享 Host 默认行为不变,版本升级与发布留至 Global/CN 共同 major 发行版。
25
+ - 从 main 结算归档 schema 8 双 CLI 候选,并增加显式生产 promotion pipeline,串联候选绑定认证、tag、Global/CN 隔离 publisher、恢复、汇总与通知门禁。本改动不执行发布。
26
+ - 增加冻结 Global/CN CLI 候选的显式匿名精确版本验证,覆盖下载字节、隔离 npm 安装、安装后命令与不可覆盖的验证回执。生产发布及 latest 推进保持不变。
27
+ - 增加无 token 的内部双发行汇总:验证 Global/CN publisher 证据并匿名复核当前 latest,不修改 registry 或 Git 状态。生产发布装配仍未接通。
28
+
29
+ ## 2.0.0
30
+
31
+ ### Major Changes
32
+
33
+ - a317ae9: 收紧 QMind Client 领域合同:移除无效的 `userId` client option,以及 Node Host / CLI 的 `userId`、`--user`、`QMIND_USER_ID` 配置面;兼容真实空列表、零分页与 RepoWiki snake_case wire shape,补齐 Card facet、ChatMessage 等已知字段,并让 capability 只声明当前公开 interface 可调用的领域能力。SDK 同时公开严格领域 decoder,供尚未进入 Client interface 的宿主 route 复用同一合同;官方 Fetch Transport 新增 stream connect/idle timeout,且将 Zod 改为由宿主提供的兼容 peer,避免 SDK 安装出第二套 schema 类型世界。
34
+
35
+ ## 1.1.3
36
+
37
+ ### Patch Changes
38
+
39
+ - d2dcbb6: 新增 QMind Agent Contract v1 Core、按 Query 创建的 Qoder Agent SDK adapter、共享 Node Host、canonical Qoder Plugin runtime 和确定性的 Plugin artifact 流程。CLI 改用提取出的 Node Host,命令面不变。
40
+
41
+ ### Changes without version bumps
42
+
43
+ - 在支持的 Node.js runtime 上,加载 CLI application 前启用 module compile cache,同时保持 Node 20 兼容性。
44
+
45
+ ## 1.1.2
46
+
47
+ ### Patch Changes
48
+
49
+ - c3a3a0f: 从 CLI package README 中移除冗余的 module boundary 说明。
50
+
51
+ ## 1.1.1
52
+
53
+ ### Patch Changes
54
+
55
+ - 711c3b9: 面向 package 使用者重写各包 README,将公共 QMind CLI 明确为 bin-only,移除原 workspace module exports。
56
+
57
+ ## 1.1.0
58
+
59
+ ### Minor Changes
60
+
61
+ - 858c2f4: QMind CLI 以 `@qoder-ai/qmind-cli` 发布到 npm。使用 `npm install --global @qoder-ai/qmind-cli` 安装后,通过 `qmind` 登录、管理知识库和来源、检索知识、运行 RAG/编译流程和安全同步目录。支持适合自动化的 JSON/NDJSON 输出、稳定退出码以及 npm 管理的升级,适用于 macOS、Linux、Windows 和 Node.js 20.18.1 及以上版本。
62
+
63
+ ## 1.0.0
64
+
65
+ ### Initial release
66
+
67
+ - 引入面向 QMind 知识工作流的 `qmind` 命令。
68
+ - 新增浏览器登录与安全的本地凭证管理,支持自动化环境及 Token 配置。
69
+ - 新增 notebook 创建/列表/读取/删除、card 列表/搜索、检索、RAG、编译、校验、source 创建/列表/读取/上传/下载/移动/内容/删除、网站导入、图片预签名与目录上传流程。
70
+ - 新增人类可读的表格、JSON、agent、NDJSON 输出,以及结构化错误和适合脚本的退出码。
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
- # `@qoder-ai/qmind-cli`
1
+ # QMind CLI for Qoder Global
2
2
 
3
- QMind 命令行工具,可用于登录、管理知识库和来源、检索内容、运行 RAG/编译任务,以及把本地目录同步到知识库。
3
+ [简体中文](./README.zh-CN.md)
4
4
 
5
- ## 安装
5
+ The QMind command-line interface for Qoder Global lets you sign in, manage knowledge bases and sources, retrieve content, run RAG and compilation workflows, and synchronize local directories.
6
6
 
7
- 需要 Node.js `>=20.18.1`:
7
+ Package: `@qoder-ai/qmind-cli` · command: `qmind`
8
+
9
+ ## Install
10
+
11
+ Node.js `>=20.18.1` is required.
8
12
 
9
13
  ```sh
10
14
  npm install --global @qoder-ai/qmind-cli
@@ -12,99 +16,76 @@ qmind version
12
16
  qmind --help
13
17
  ```
14
18
 
15
- 升级和卸载也交给 npm
19
+ Upgrade and uninstall through npm. `qmind self-update` only prints the npm upgrade command and never modifies npm-managed files.
16
20
 
17
21
  ```sh
18
22
  npm update --global @qoder-ai/qmind-cli
19
23
  npm uninstall --global @qoder-ai/qmind-cli
20
24
  ```
21
25
 
22
- `qmind self-update` 仅用于提示 npm 升级方式,不会修改 npm 管理的文件。
23
-
24
- ## 快速开始
25
-
26
- 交互式登录会打开浏览器完成授权,并把凭证安全保存到本机:
26
+ ## Quick start
27
27
 
28
28
  ```sh
29
29
  qmind login
30
30
  qmind notebook list
31
31
  qmind source list --nb <notebook-id>
32
- qmind retrieve --nb <notebook-id> "部署流程是什么?"
32
+ qmind retrieve --nb <notebook-id> "What must be checked before release?"
33
33
  ```
34
34
 
35
- CI Agent 场景建议使用环境变量和结构化输出:
35
+ Interactive login opens a browser and stores the session in a local file vault. For CI and agents, prefer an environment variable and structured output:
36
36
 
37
37
  ```sh
38
38
  export QMIND_TOKEN='<token>'
39
39
  qmind notebook list --non-interactive --format json
40
- qmind retrieve --nb <notebook-id> --format agent "发布前要检查什么?"
40
+ qmind retrieve --nb <notebook-id> --format agent "What is the deployment process?"
41
41
  ```
42
42
 
43
- 不要把 token 写进脚本参数、仓库或日志。使用完本机凭证后可执行:
43
+ Do not put tokens in command arguments, repositories, or logs. Run `qmind logout` to remove the current local session.
44
44
 
45
- ```sh
46
- qmind logout
47
- ```
45
+ ## Commands
46
+
47
+ | Command | Purpose |
48
+ | --------------------------- | ---------------------------------------- |
49
+ | `login` / `logout` | Sign in or remove local credentials |
50
+ | `notebook` | Manage knowledge bases |
51
+ | `cards` / `list` / `search` | List or search cards |
52
+ | `source` | Manage knowledge-base sources |
53
+ | `retrieve` | Retrieve context without invoking an LLM |
54
+ | `rag` | Ask questions using a knowledge base |
55
+ | `compile` / `lint` | Run compilation or validation workflows |
56
+ | `task` | Manage task runs |
57
+ | `upload-folder` / `sync` | Synchronize a local directory |
58
+ | `image` | Obtain image upload or access URLs |
59
+ | `version` | Print version and build information |
48
60
 
49
- ## 命令
61
+ Run `qmind <command> --help` for complete options. Domain commands support formats such as `table`, `json`, `agent`, and `ndjson`. stdout contains results; progress and diagnostics go to stderr. Exit codes are `0` for success, `1` for runtime failure/partial success/cancellation, and `2` for invalid usage.
50
62
 
51
- | 命令 | 用途 |
52
- | --------------------------- | -------------------------------------- |
53
- | `login` / `logout` | 登录或清除本机凭证 |
54
- | `notebook` | 创建、列出、查看、删除知识库 |
55
- | `cards` / `list` / `search` | 列出或搜索卡片 |
56
- | `source` | 创建、上传、下载、移动、读取或删除来源 |
57
- | `retrieve` | 检索知识库上下文,不发起 LLM 调用 |
58
- | `rag` | 基于知识库提问 |
59
- | `compile` / `lint` | 启动编译或检查工作流 |
60
- | `task` | 创建、查询或列出任务运行 |
61
- | `upload-folder` / `sync` | 将本地目录同步到知识库 |
62
- | `image` | 获取图片上传地址或访问地址 |
63
- | `version` | 查看版本和构建信息 |
63
+ ## Directory synchronization
64
64
 
65
- 使用 `qmind <command> --help` 查看完整参数。例如:
65
+ Review the plan before allowing remote deletions:
66
66
 
67
67
  ```sh
68
- qmind source upload --help
69
- qmind upload-folder --help
68
+ qmind upload-folder --nb <notebook-id> --dir ./docs --mode if-changed --dry-run
70
69
  ```
71
70
 
72
- ## 输出与退出码
73
-
74
- 领域命令支持 `table`、`json`、`agent`、`ndjson` 等输出格式;具体可用值以命令的 `--help` 为准。
75
-
76
- - stdout 只输出命令结果,进度与诊断信息输出到 stderr;
77
- - `0` 表示成功或正常显示帮助;
78
- - `1` 表示运行失败、部分成功或用户取消;
79
- - `2` 表示参数用法错误或 `INVALID_ARGUMENT`。
80
-
81
- JSON 错误使用稳定的 `error` envelope,包含 `code`、`message`,以及服务端提供时的 `status`、`errorCode`、`requestId` 和 `details`。
71
+ Removing `--dry-run` enables writes. `--delete` treats the remote source root as a mirror of the local directory and removes extra remote entries. Concurrency must be between `1` and `10`.
82
72
 
83
- ## 同步目录
73
+ ## Configuration and authentication
84
74
 
85
- 先用 `--dry-run` 审阅计划,再决定是否执行删除:
75
+ This package has a fixed Qoder Global identity. Renaming the executable, changing its install path, or setting product-selection environment variables cannot switch products. Production is the default; `--env test` and `--env daily` select supported debug presets. A custom target requires both `--sash` and `--dashboard` and cannot be combined with an explicit `--env`.
86
76
 
87
77
  ```sh
88
- qmind upload-folder \
89
- --nb <notebook-id> \
90
- --dir ./docs \
91
- --mode if-changed \
92
- --ignore '**/drafts/**' \
93
- --dry-run
78
+ qmind login --env test
79
+ QMIND_DEBUG_TOKEN='<debug-token>' qmind notebook list --env test --non-interactive --format json
80
+ qmind login --sash http://localhost:8080 --dashboard http://localhost:3000
94
81
  ```
95
82
 
96
- 移除 `--dry-run` 后才会写入远端。`--delete` 会把知识库的来源根目录视为本地目录的镜像,并删除远端多余项;使用前请确认 dry-run 结果。并发范围为 `1..10`。
83
+ Production token priority is `--token > QMIND_TOKEN > current production vault`. Debug token priority is `--token > QMIND_DEBUG_TOKEN > current debug vault`; credentials are never borrowed across targets.
97
84
 
98
- ## 配置与网络
85
+ State is stored under `<state-root>/cli/global/<target>/`, where the state root is `QMIND_HOME` or `~/.qmind`. The CLI does not install, load, or access the OS Keyring. Credential files are plaintext JSON, not encrypted storage. On POSIX, partition directories use mode `0700` and files use `0600`; these modes do not represent Windows ACLs. Writes use atomic replacement, file locking, and compare-and-swap protection for refreshes.
99
86
 
100
- 常用环境变量:
87
+ After upgrading from the legacy unpartitioned store, sign in again. Root-level config/credential files, `~/.qmind-env`, and old Keyring entries are not read, imported, or deleted automatically.
101
88
 
102
- - `QMIND_TOKEN`:非交互 token;
103
- - `QMIND_ENV`:`prod`、`daily` 或 `test`;
104
- - `QMIND_SASH_URL` / `QMIND_DASHBOARD_URL`:覆盖服务 origin;
105
- - `QMIND_HOME`:覆盖配置与凭证目录,默认 `~/.qmind`;
106
- - `QMIND_NON_INTERACTIVE=1`:禁止打开浏览器;
107
- - `QMIND_REQUEST_TIMEOUT_MS` / `QMIND_STREAM_IDLE_TIMEOUT_MS`:请求与流空闲超时;
108
- - `QMIND_TLS_CA_FILE`:私有 CA 文件。
89
+ The shared 3.x Global/CN release is a breaking upgrade from Global 2.x. Upgrade this package with npm, then run `qmind login`; do not copy legacy credentials into the new partition. Existing versions before the shared release describe the Global/shared implementation only and do not imply a historical CN publication.
109
90
 
110
- CLI 支持 `HTTP_PROXY`、`HTTPS_PROXY` `NO_PROXY`。TLS 默认严格校验;上传到签名对象地址时不会携带 QMind Authorization、Cookie、CSRF 或代理凭证。
91
+ Common variables include `QMIND_TOKEN`, `QMIND_DEBUG_TOKEN`, `QMIND_HOME`, `QMIND_CLIENT`, `QMIND_NON_INTERACTIVE`, `QMIND_REQUEST_TIMEOUT_MS`, `QMIND_STREAM_IDLE_TIMEOUT_MS`, and `QMIND_TLS_CA_FILE`. `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` are supported. TLS verification is strict by default, and credentials are not forwarded to signed object-storage URLs.
@@ -0,0 +1,91 @@
1
+ # Qoder Global QMind CLI
2
+
3
+ [English](./README.md)
4
+
5
+ 面向 Qoder Global 的 QMind 命令行工具,可用于登录、管理知识库和来源、检索内容、运行 RAG/编译任务,以及把本地目录同步到知识库。
6
+
7
+ npm 包:`@qoder-ai/qmind-cli` · 命令:`qmind`
8
+
9
+ ## 安装
10
+
11
+ 需要 Node.js `>=20.18.1`。
12
+
13
+ ```sh
14
+ npm install --global @qoder-ai/qmind-cli
15
+ qmind version
16
+ qmind --help
17
+ ```
18
+
19
+ 升级和卸载交给 npm。`qmind self-update` 只提示 npm 升级命令,不会修改 npm 管理的文件。
20
+
21
+ ```sh
22
+ npm update --global @qoder-ai/qmind-cli
23
+ npm uninstall --global @qoder-ai/qmind-cli
24
+ ```
25
+
26
+ ## 快速开始
27
+
28
+ ```sh
29
+ qmind login
30
+ qmind notebook list
31
+ qmind source list --nb <notebook-id>
32
+ qmind retrieve --nb <notebook-id> "发布前要检查什么?"
33
+ ```
34
+
35
+ 交互式登录会打开浏览器并把登录态保存到本机文件 vault。CI 或 Agent 场景建议使用环境变量和结构化输出:
36
+
37
+ ```sh
38
+ export QMIND_TOKEN='<token>'
39
+ qmind notebook list --non-interactive --format json
40
+ qmind retrieve --nb <notebook-id> --format agent "部署流程是什么?"
41
+ ```
42
+
43
+ 不要把 token 写进命令参数、仓库或日志。使用完本机凭证后执行 `qmind logout`。
44
+
45
+ ## 命令
46
+
47
+ | 命令 | 用途 |
48
+ | --------------------------- | --------------------------- |
49
+ | `login` / `logout` | 登录或清除本机凭证 |
50
+ | `notebook` | 管理知识库 |
51
+ | `cards` / `list` / `search` | 列出或搜索卡片 |
52
+ | `source` | 管理知识库来源 |
53
+ | `retrieve` | 检索上下文,不发起 LLM 调用 |
54
+ | `rag` | 基于知识库提问 |
55
+ | `compile` / `lint` | 运行编译或检查工作流 |
56
+ | `task` | 管理任务运行 |
57
+ | `upload-folder` / `sync` | 同步本地目录 |
58
+ | `image` | 获取图片上传地址或访问地址 |
59
+ | `version` | 查看版本和构建信息 |
60
+
61
+ 使用 `qmind <command> --help` 查看完整参数。领域命令支持 `table`、`json`、`agent`、`ndjson` 等输出格式。stdout 只输出结果,进度与诊断信息输出到 stderr。退出码 `0` 表示成功,`1` 表示运行失败、部分成功或取消,`2` 表示参数错误。
62
+
63
+ ## 同步目录
64
+
65
+ 先审阅计划,再决定是否执行远端删除:
66
+
67
+ ```sh
68
+ qmind upload-folder --nb <notebook-id> --dir ./docs --mode if-changed --dry-run
69
+ ```
70
+
71
+ 移除 `--dry-run` 后才会写入远端。`--delete` 会把远端来源根目录视为本地目录镜像,并删除多余项。并发范围为 `1..10`。
72
+
73
+ ## 配置与认证
74
+
75
+ 本包固定为 Qoder Global 产品身份。不能通过改名、安装路径或产品选择环境变量切换产品。默认使用正式环境;`--env test` 和 `--env daily` 选择受支持的调试环境。自定义目标必须同时提供 `--sash` 与 `--dashboard`,且不能与显式 `--env` 组合。
76
+
77
+ ```sh
78
+ qmind login --env test
79
+ QMIND_DEBUG_TOKEN='<debug-token>' qmind notebook list --env test --non-interactive --format json
80
+ qmind login --sash http://localhost:8080 --dashboard http://localhost:3000
81
+ ```
82
+
83
+ 正式环境 Token 优先级为 `--token > QMIND_TOKEN > 当前正式 vault`;调试环境为 `--token > QMIND_DEBUG_TOKEN > 当前调试 vault`,不会跨目标借用凭证。
84
+
85
+ 状态保存在 `<状态根>/cli/global/<目标>/`,状态根为 `QMIND_HOME` 或 `~/.qmind`。CLI 不安装、加载或访问 OS Keyring。凭证文件是明文 JSON,不是加密存储。POSIX 平台分区目录为 `0700`、文件为 `0600`;这些 mode 不代表 Windows ACL。写入使用原子替换、文件锁及 refresh compare-and-swap 保护。
86
+
87
+ 从旧版未分区存储升级后需要重新登录。旧根目录 config/credentials、`~/.qmind-env` 和旧 Keyring 项不会被读取、导入或自动删除。
88
+
89
+ 共享 3.x Global/CN 发行版相对 Global 2.x 是 breaking upgrade。通过 npm 升级本包后执行 `qmind login`,不要把旧凭证复制到新分区。共同发行版之前的历史版本只描述 Global/共享实现,不代表 CN 曾经发布。
90
+
91
+ 常用变量包括 `QMIND_TOKEN`、`QMIND_DEBUG_TOKEN`、`QMIND_HOME`、`QMIND_CLIENT`、`QMIND_NON_INTERACTIVE`、`QMIND_REQUEST_TIMEOUT_MS`、`QMIND_STREAM_IDLE_TIMEOUT_MS` 和 `QMIND_TLS_CA_FILE`。支持 `HTTP_PROXY`、`HTTPS_PROXY` 和 `NO_PROXY`。TLS 默认严格校验,访问签名对象存储地址时不会转发凭证。
package/bin/cli.js CHANGED
@@ -1,3 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import '../dist/qmind.js';
3
+ import * as nodeModule from 'node:module';
4
+
5
+ // Keep Node 20 compatibility while enabling the cache before the application graph is loaded.
6
+ nodeModule.enableCompileCache?.();
7
+
8
+ await import('../dist/qmind.js');
@@ -0,0 +1,75 @@
1
+ import { b as cardListSchema, d as pagination, h as stringList, m as requiredString, n as call, p as queryPath, u as optionalTrimmedString, v as batchMutationResultSchema, x as cardSchema } from "./shared-DwycozMA.js";
2
+ //#region ../sdk/src/operations/cards.ts
3
+ function createCardOperations(context) {
4
+ const listCards = async (notebookId, input = {}, options, featured = false) => {
5
+ const notebook = requiredString(notebookId, "notebookId");
6
+ const normalizedPage = pagination({
7
+ page: input.page ?? 1,
8
+ pageSize: input.pageSize ?? 20
9
+ });
10
+ const category = optionalTrimmedString(input.category, "category");
11
+ const query = optionalTrimmedString(input.query, "query");
12
+ const root = context.profile.apiPath(featured ? "featured-notebooks" : "notebooks", notebook, "cards");
13
+ const path = queryPath(root, [
14
+ ["category", category],
15
+ ["query", query],
16
+ ["page", normalizedPage.page],
17
+ ["page_size", normalizedPage.pageSize]
18
+ ]);
19
+ return call(context, {
20
+ callOptions: options,
21
+ capability: featured ? "featuredNotebooks.read" : "cards.read",
22
+ idempotent: true,
23
+ method: "GET",
24
+ operation: featured ? "featuredCards.list" : "cards.list",
25
+ path,
26
+ schema: cardListSchema
27
+ });
28
+ };
29
+ return {
30
+ async batchDeleteCards(notebookId, cardIds, options) {
31
+ const notebook = requiredString(notebookId, "notebookId");
32
+ const ids = stringList(cardIds, "cardIds", { min: 1 });
33
+ return call(context, {
34
+ body: { cardIds: ids },
35
+ callOptions: options,
36
+ capability: "cards.write",
37
+ idempotent: false,
38
+ method: "POST",
39
+ operation: "cards.batchDelete",
40
+ path: context.profile.apiPath("notebooks", notebook, "cards", "batch-delete"),
41
+ schema: batchMutationResultSchema
42
+ });
43
+ },
44
+ async deleteCard(notebookId, cardId, options) {
45
+ const notebook = requiredString(notebookId, "notebookId");
46
+ const card = requiredString(cardId, "cardId");
47
+ return call(context, {
48
+ callOptions: options,
49
+ capability: "cards.write",
50
+ idempotent: false,
51
+ method: "DELETE",
52
+ operation: "cards.delete",
53
+ path: context.profile.apiPath("notebooks", notebook, "cards", card),
54
+ schema: batchMutationResultSchema
55
+ });
56
+ },
57
+ async getCard(notebookId, cardId, options) {
58
+ const notebook = requiredString(notebookId, "notebookId");
59
+ const card = requiredString(cardId, "cardId");
60
+ return call(context, {
61
+ callOptions: options,
62
+ capability: "cards.read",
63
+ idempotent: true,
64
+ method: "GET",
65
+ operation: "cards.get",
66
+ path: context.profile.apiPath("notebooks", notebook, "cards", card),
67
+ schema: cardSchema
68
+ });
69
+ },
70
+ listCards: (notebookId, input, options) => listCards(notebookId, input, options),
71
+ listFeaturedCards: (notebookId, input, options) => listCards(notebookId, input, options, true)
72
+ };
73
+ }
74
+ //#endregion
75
+ export { createCardOperations };
@@ -0,0 +1,126 @@
1
+ import { D as importProvidersSchema, Q as assertCapability, _ as aliDingImportRunSchema, a as invalidArgument, d as pagination, g as aliDingImportRunItemListSchema, m as requiredString, n as call, p as queryPath } from "./shared-DwycozMA.js";
2
+ //#region ../sdk/src/operations/imports.ts
3
+ const aliDingHost = "alidocs.dingtalk.com";
4
+ const requestIdPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
5
+ /**
6
+ * A canonical AliDing URL identifies exactly one node or knowledge base. Share links, short links,
7
+ * query strings and fragments are aliases, so they are rejected rather than silently trimmed.
8
+ */
9
+ function canonicalAliDingUrl(value, scope) {
10
+ const raw = requiredString(value, "url");
11
+ let url;
12
+ try {
13
+ url = new URL(raw);
14
+ } catch (cause) {
15
+ throw invalidArgument("url must be a canonical AliDing HTTPS URL", "url", { cause });
16
+ }
17
+ if (url.protocol !== "https:" || url.hostname !== aliDingHost) throw invalidArgument(`url must be an https://${aliDingHost} address`, "url");
18
+ if (url.search.length > 0 || url.hash.length > 0 || url.username.length > 0) throw invalidArgument("url must not carry a query, fragment or credentials", "url");
19
+ const prefix = scope === "nodeSubtree" ? "/i/nodes/" : "/i/spaces/";
20
+ if (!url.pathname.startsWith(prefix) || url.pathname === prefix) throw invalidArgument(`url must be an AliDing ${prefix} address for this import scope`, "url");
21
+ return url.toString();
22
+ }
23
+ function importRunBody(input, scope) {
24
+ const requestId = requiredString(input?.requestId, "requestId");
25
+ if (!requestIdPattern.test(requestId.toLowerCase())) throw invalidArgument("requestId must be a UUID", "requestId");
26
+ return {
27
+ requestId,
28
+ url: canonicalAliDingUrl(input?.url, scope)
29
+ };
30
+ }
31
+ function createImportOperations(context) {
32
+ return {
33
+ async getAliDingImportRun(notebookId, runId, options) {
34
+ const notebook = requiredString(notebookId, "notebookId");
35
+ const run = requiredString(runId, "runId");
36
+ assertCapability(context.profile, "imports.aliDing", "imports.aliDing.getRun");
37
+ return call(context, {
38
+ callOptions: options,
39
+ capability: "imports.aliDing",
40
+ idempotent: true,
41
+ method: "GET",
42
+ operation: "imports.aliDing.getRun",
43
+ path: context.profile.mindPath("notebooks", notebook, "aliding", "import-runs", run),
44
+ schema: aliDingImportRunSchema
45
+ });
46
+ },
47
+ async listAliDingImportRunItems(notebookId, runId, input = {}, options) {
48
+ const notebook = requiredString(notebookId, "notebookId");
49
+ const run = requiredString(runId, "runId");
50
+ const normalizedPage = pagination(input);
51
+ assertCapability(context.profile, "imports.aliDing", "imports.aliDing.listRunItems");
52
+ const base = context.profile.mindPath("notebooks", notebook, "aliding", "import-runs", run, "items");
53
+ return call(context, {
54
+ callOptions: options,
55
+ capability: "imports.aliDing",
56
+ idempotent: true,
57
+ method: "GET",
58
+ operation: "imports.aliDing.listRunItems",
59
+ path: queryPath(base, [
60
+ ["pagination.currentPage", normalizedPage.page],
61
+ ["pagination.pageSize", normalizedPage.pageSize],
62
+ ["status", wireItemStatus(input.status)],
63
+ ["contentStatus", wireContentStatus(input.contentStatus)],
64
+ ["descendantsStatus", wireDescendantsStatus(input.descendantsStatus)]
65
+ ]),
66
+ schema: aliDingImportRunItemListSchema
67
+ });
68
+ },
69
+ async listImportProviders(options) {
70
+ assertCapability(context.profile, "imports.discover", "imports.discover");
71
+ return call(context, {
72
+ callOptions: options,
73
+ capability: "imports.discover",
74
+ idempotent: true,
75
+ method: "GET",
76
+ operation: "imports.discover",
77
+ path: context.profile.mindPath("import-sources"),
78
+ schema: importProvidersSchema
79
+ });
80
+ },
81
+ async startAliDingKnowledgeBaseImport(notebookId, input, options) {
82
+ const notebook = requiredString(notebookId, "notebookId");
83
+ const body = importRunBody(input, "knowledgeBase");
84
+ assertCapability(context.profile, "imports.aliDing", "imports.aliDing.createKnowledgeBaseRun");
85
+ return call(context, {
86
+ body,
87
+ callOptions: options,
88
+ capability: "imports.aliDing",
89
+ idempotent: false,
90
+ method: "POST",
91
+ operation: "imports.aliDing.createKnowledgeBaseRun",
92
+ path: context.profile.mindPath("notebooks", notebook, "aliding", "knowledge-base-import-runs"),
93
+ schema: aliDingImportRunSchema
94
+ });
95
+ },
96
+ async startAliDingNodeSubtreeImport(notebookId, input, options) {
97
+ const notebook = requiredString(notebookId, "notebookId");
98
+ const body = importRunBody(input, "nodeSubtree");
99
+ assertCapability(context.profile, "imports.aliDing", "imports.aliDing.createNodeSubtreeRun");
100
+ return call(context, {
101
+ body,
102
+ callOptions: options,
103
+ capability: "imports.aliDing",
104
+ idempotent: false,
105
+ method: "POST",
106
+ operation: "imports.aliDing.createNodeSubtreeRun",
107
+ path: context.profile.mindPath("notebooks", notebook, "aliding", "node-subtree-import-runs"),
108
+ schema: aliDingImportRunSchema
109
+ });
110
+ }
111
+ };
112
+ }
113
+ function wireItemStatus(value) {
114
+ return value === void 0 ? void 0 : `ALI_DING_IMPORT_ITEM_STATUS_${screamingCase(value)}`;
115
+ }
116
+ function wireContentStatus(value) {
117
+ return value === void 0 ? void 0 : `ALI_DING_IMPORT_CONTENT_STATUS_${screamingCase(value)}`;
118
+ }
119
+ function wireDescendantsStatus(value) {
120
+ return value === void 0 ? void 0 : `ALI_DING_IMPORT_DESCENDANTS_STATUS_${screamingCase(value)}`;
121
+ }
122
+ function screamingCase(value) {
123
+ return value.replace(/([a-z0-9])([A-Z])/gu, "$1_$2").toUpperCase();
124
+ }
125
+ //#endregion
126
+ export { createImportOperations };