@nggaigc/cli 0.1.50 → 0.1.51
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 +5 -5
- package/dist/agent-selection.js +13 -4
- package/dist/main.js +5 -5
- package/dist/skill-location.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @nggaigc/cli
|
|
2
2
|
|
|
3
|
-
NGGAIGC Skill 的受信安装器。Codex
|
|
3
|
+
NGGAIGC Skill 的受信安装器。Codex、WorkBuddy 与豆包工作使用同一条安装命令,自动识别当前宿主。
|
|
4
4
|
|
|
5
5
|
```powershell
|
|
6
6
|
npx --yes @nggaigc/cli@latest install
|
|
@@ -14,11 +14,11 @@ macOS arm64 辅助程序沿用已签名 Plugin 中通过完整性校验的字节
|
|
|
14
14
|
|
|
15
15
|
## 统一安装入口(0.1.46 起)
|
|
16
16
|
|
|
17
|
-
不带目录参数时,`install`、`start-skill`、`client` 使用同一套宿主识别:Codex 的当前会话标记,或 WorkBuddy
|
|
17
|
+
不带目录参数时,`install`、`start-skill`、`client` 使用同一套宿主识别:Codex 的当前会话标记,或 WorkBuddy 的会话标记/实际工作会话与专属应用标记组合。豆包工作使用本地命令环境同时提供的 `DOUBAO_OFFICE_APP_ID` 与 `DOUBAO_OFFICE_ANSWER_MESSAGE_ID` 标记,不读取 token。配置目录、已安装应用和通用终端变量本身不代表当前宿主;环境标记只是便利提示,不用于认证或授权。
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
无法识别或同时命中多个宿主时,有交互终端可选择 Codex、WorkBuddy 或豆包工作;非交互调用立即返回 `status: selection-required`、三项 `choices` 和退出码 3,不安装、不打开授权网页。当前 Agent 应让用户选择一次,再由 Agent 将返回的目标值作为 `--agent <所选目标>` 加到原命令继续;`client` 的目标选项放在 `--` 分隔符之前,业务参数保持原样。安装结果始终返回真实 `skillsDirectory` 和 `skillPath`,连接失败也保留该位置,后续继续使用同一位置。
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
豆包工作的本地目录为 `~/DoubaoWork/skills`,根包和后续独立 Skill 统一使用该位置;不会改动另一宿主的安装。豆包工作自动识别从 CLI `0.1.51` 起提供。此次适配依据 macOS 豆包工作 2.32.14 的真实命令环境和已声明技能根目录,其他平台及具体工作流效果须分别验收。旧 `universal` 与自定义目录参数仍兼容。
|
|
22
22
|
|
|
23
23
|
## 显式目标(0.1.45 起)
|
|
24
24
|
|
|
@@ -32,7 +32,7 @@ npx --yes @nggaigc/cli@latest start-skill skill.<id> [version] --skills-dir "/ab
|
|
|
32
32
|
npx --yes @nggaigc/cli@latest client --skills-dir "/absolute/project/.codebuddy/skills" -- <原command> <原args>
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
`install`、`start-skill` 和 `client` 支持互斥的 `--agent codex|workbuddy|universal` 或 `--skills-dir <绝对目录>`。识别或选择 Codex 后使用 `CODEX_HOME/skills`,未设置时为 `~/.codex/skills`。WorkBuddy 优先使用实际进程提供的 `WORKBUDDY_CONFIG_DIR/skills`(其次 `CODEBUDDY_CONFIG_DIR/skills`),否则使用 `~/.workbuddy/skills`;在宿主外升级时,若现代目录没有根 Skill 而旧 `~/.codebuddy/skills` 已安装,则继续使用旧位置。不会删除或迁移旧安装。`--skills-dir` 始终精确指定项目级或其他现有安装。universal 使用 `~/.agents/skills`,不保证所有 Agent 自动识别。`--no-login` 仅跳过安装后的登录,不绕过签名、哈希、路径检查或后续鉴权。
|
|
35
|
+
`install`、`start-skill` 和 `client` 支持互斥的 `--agent codex|workbuddy|doubao-work|universal` 或 `--skills-dir <绝对目录>`。识别或选择 Codex 后使用 `CODEX_HOME/skills`,未设置时为 `~/.codex/skills`。WorkBuddy 优先使用实际进程提供的 `WORKBUDDY_CONFIG_DIR/skills`(其次 `CODEBUDDY_CONFIG_DIR/skills`),否则使用 `~/.workbuddy/skills`;在宿主外升级时,若现代目录没有根 Skill 而旧 `~/.codebuddy/skills` 已安装,则继续使用旧位置。不会删除或迁移旧安装。`--skills-dir` 始终精确指定项目级或其他现有安装。universal 使用 `~/.agents/skills`,不保证所有 Agent 自动识别。`--no-login` 仅跳过安装后的登录,不绕过签名、哈希、路径检查或后续鉴权。
|
|
36
36
|
|
|
37
37
|
根 Skill 按实际读取的 `SKILL.md` 定位父目录及其上一级 `skillsDirectory`;后续升级与 `start-skill` 显式使用同一目录。准备回执增加 `skillsDirectory`、`rootLauncherPath`,保留 `preparedSkills`;宿主应显式读取返回的真实路径。独立包的原客户端调用使用回执的受信根启动器;`client` 是同目录根包验签桥,保留原命令/参数,不增加 API 专用业务分支。安装新包不证明当前宿主热加载,必要时开启新会话。
|
|
38
38
|
|
package/dist/agent-selection.js
CHANGED
|
@@ -3,6 +3,7 @@ import { resolveSkillLocation, } from "./skill-location.js";
|
|
|
3
3
|
export const agentChoices = [
|
|
4
4
|
{ agent: "codex", label: "Codex" },
|
|
5
5
|
{ agent: "workbuddy", label: "WorkBuddy" },
|
|
6
|
+
{ agent: "doubao-work", label: "豆包工作" },
|
|
6
7
|
];
|
|
7
8
|
export class AgentSelectionRequired extends Error {
|
|
8
9
|
reason;
|
|
@@ -23,12 +24,18 @@ export function detectCallingAgent(environment) {
|
|
|
23
24
|
(present(environment.CODEBUDDY_SESSION_ID) &&
|
|
24
25
|
present(environment.WORKBUDDY_APP_VERSION) &&
|
|
25
26
|
present(environment.WORKBUDDY_APP_PATH));
|
|
26
|
-
|
|
27
|
+
// Observed in Doubao Work's local AgentInfraService shell. Neither marker
|
|
28
|
+
// contains a credential; installed directories and token variables are ignored.
|
|
29
|
+
const doubao = present(environment.DOUBAO_OFFICE_APP_ID) &&
|
|
30
|
+
present(environment.DOUBAO_OFFICE_ANSWER_MESSAGE_ID);
|
|
31
|
+
if ([codex, workbuddy, doubao].filter(Boolean).length > 1)
|
|
27
32
|
return { reason: "conflicting" };
|
|
28
33
|
if (codex)
|
|
29
34
|
return { agent: "codex" };
|
|
30
35
|
if (workbuddy)
|
|
31
36
|
return { agent: "workbuddy" };
|
|
37
|
+
if (doubao)
|
|
38
|
+
return { agent: "doubao-work" };
|
|
32
39
|
return { reason: "unknown" };
|
|
33
40
|
}
|
|
34
41
|
async function chooseInTerminal() {
|
|
@@ -41,13 +48,15 @@ async function chooseInTerminal() {
|
|
|
41
48
|
terminal.once("SIGINT", cancel);
|
|
42
49
|
terminal.once("close", cancel);
|
|
43
50
|
try {
|
|
44
|
-
const answer = (await terminal.question("请选择使用 NGGAIGC 的 AI 助手:1. Codex 2. WorkBuddy
|
|
51
|
+
const answer = (await terminal.question("请选择使用 NGGAIGC 的 AI 助手:1. Codex 2. WorkBuddy 3. 豆包工作\n输入 1、2 或 3:", { signal: controller.signal }))
|
|
45
52
|
.trim()
|
|
46
53
|
.toLowerCase();
|
|
47
54
|
if (answer === "1" || answer === "codex")
|
|
48
55
|
return "codex";
|
|
49
56
|
if (answer === "2" || answer === "workbuddy")
|
|
50
57
|
return "workbuddy";
|
|
58
|
+
if (answer === "3" || answer === "doubao-work")
|
|
59
|
+
return "doubao-work";
|
|
51
60
|
return undefined;
|
|
52
61
|
}
|
|
53
62
|
catch {
|
|
@@ -76,7 +85,7 @@ export async function selectCommandLocation(options, runtime = {}) {
|
|
|
76
85
|
? chooseInTerminal
|
|
77
86
|
: undefined);
|
|
78
87
|
const agent = await choose?.();
|
|
79
|
-
if (agent === "codex" || agent === "workbuddy")
|
|
88
|
+
if (agent === "codex" || agent === "workbuddy" || agent === "doubao-work")
|
|
80
89
|
return { ...options, agent };
|
|
81
90
|
throw new AgentSelectionRequired(detected.reason);
|
|
82
91
|
}
|
|
@@ -84,7 +93,7 @@ export function selectionRequiredResult(error) {
|
|
|
84
93
|
return {
|
|
85
94
|
status: "selection-required",
|
|
86
95
|
error: { code: error.code, reason: error.reason },
|
|
87
|
-
message: "请选择当前使用的 AI
|
|
96
|
+
message: "请选择当前使用的 AI 助手,再按所选目标继续;已识别的 Codex、WorkBuddy 和豆包工作均使用统一安装命令,无需增加目标参数。client 命令的选项须放在 -- 分隔符之前。",
|
|
88
97
|
choices: agentChoices,
|
|
89
98
|
nextAction: "select-agent-and-retry",
|
|
90
99
|
};
|
package/dist/main.js
CHANGED
|
@@ -41,11 +41,11 @@ export async function main(args, runtime = {}) {
|
|
|
41
41
|
if (args.length === 1 && ["--help", "-h", "help"].includes(args[0])) {
|
|
42
42
|
output([
|
|
43
43
|
"NGGAIGC CLI",
|
|
44
|
-
"install [--agent codex|workbuddy|universal | --skills-dir <absolute-directory>] [--no-login]",
|
|
45
|
-
"start-skill skill.<id> [version] [--agent codex|workbuddy|universal | --skills-dir <absolute-directory>]",
|
|
46
|
-
"client [--agent codex|workbuddy|universal | --skills-dir <absolute-directory>] -- <command> [arguments]",
|
|
47
|
-
"Default: automatically detect Codex or
|
|
48
|
-
"Codex: existing CODEX_HOME is preserved, otherwise ~/.codex/skills. WorkBuddy: its runtime config directory/skills, otherwise ~/.workbuddy/skills; existing legacy ~/.codebuddy installs are reused. Explicit legacy universal/custom targets remain supported.",
|
|
44
|
+
"install [--agent codex|workbuddy|doubao-work|universal | --skills-dir <absolute-directory>] [--no-login]",
|
|
45
|
+
"start-skill skill.<id> [version] [--agent codex|workbuddy|doubao-work|universal | --skills-dir <absolute-directory>]",
|
|
46
|
+
"client [--agent codex|workbuddy|doubao-work|universal | --skills-dir <absolute-directory>] -- <command> [arguments]",
|
|
47
|
+
"Default: automatically detect Codex, WorkBuddy or Doubao Work. If unknown or conflicting, select one; non-interactive calls return selection-required (exit 3).",
|
|
48
|
+
"Codex: existing CODEX_HOME is preserved, otherwise ~/.codex/skills. WorkBuddy: its runtime config directory/skills, otherwise ~/.workbuddy/skills; existing legacy ~/.codebuddy installs are reused. Doubao Work: ~/DoubaoWork/skills. Explicit legacy universal/custom targets remain supported.",
|
|
49
49
|
"Use the same target for install and subsequent commands. --no-login installs verified files without opening a browser.",
|
|
50
50
|
"client examples: -- status, -- login, -- account-status, -- workflows, -- history, -- disconnect",
|
|
51
51
|
"",
|
package/dist/skill-location.js
CHANGED
|
@@ -54,7 +54,7 @@ export function resolveSkillLocation(options = {}, environment = process.env) {
|
|
|
54
54
|
}
|
|
55
55
|
const profile = absoluteDirectory(options.profile ?? os.homedir());
|
|
56
56
|
const agent = options.agent ?? "codex";
|
|
57
|
-
if (!["codex", "workbuddy", "universal"].includes(agent))
|
|
57
|
+
if (!["codex", "workbuddy", "doubao-work", "universal"].includes(agent))
|
|
58
58
|
throw new CliError("INVALID_INPUT");
|
|
59
59
|
const home = absoluteDirectory(options.codexHome ??
|
|
60
60
|
(agent === "codex"
|
|
@@ -63,7 +63,9 @@ export function resolveSkillLocation(options = {}, environment = process.env) {
|
|
|
63
63
|
: undefined) ?? path.join(profile, ".codex"))
|
|
64
64
|
: agent === "workbuddy"
|
|
65
65
|
? workbuddyHome(profile, options.profile === undefined ? environment : {})
|
|
66
|
-
:
|
|
66
|
+
: agent === "doubao-work"
|
|
67
|
+
? path.join(profile, "DoubaoWork")
|
|
68
|
+
: path.join(profile, ".agents")));
|
|
67
69
|
return {
|
|
68
70
|
skillsDirectory: path.join(home, "skills"),
|
|
69
71
|
// Explicit and named-host calls for the same directory share one journal.
|
|
@@ -85,7 +87,7 @@ export function parseSkillLocation(args) {
|
|
|
85
87
|
if (!argument || argument.startsWith("--"))
|
|
86
88
|
throw new CliError("INVALID_INPUT");
|
|
87
89
|
if (value === "--agent") {
|
|
88
|
-
if (!["codex", "workbuddy", "universal"].includes(argument))
|
|
90
|
+
if (!["codex", "workbuddy", "doubao-work", "universal"].includes(argument))
|
|
89
91
|
throw new CliError("INVALID_INPUT");
|
|
90
92
|
location.agent = argument;
|
|
91
93
|
}
|