@nggaigc/cli 0.1.0 → 0.1.2

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/dist/bin.js CHANGED
@@ -2,16 +2,18 @@
2
2
  import { CliError } from "./errors.js";
3
3
  import { runInstall } from "./install.js";
4
4
  const messages = {
5
- authorizing: "正在打开浏览器,请在 NGGAIGC 页面确认连接…",
5
+ authorizing: "浏览器已成功启动,请在 NGGAIGC 页面确认连接…",
6
6
  connected: "NGGAIGC Skill 已安装,设备连接验证成功。",
7
7
  installing: "正在安全安装已签名的 NGGAIGC Skill…",
8
+ launching: "正在请求 Windows 打开默认浏览器…",
8
9
  verifying: "正在验证 NGGAIGC 签名安装包…",
9
10
  };
10
11
  const errorMessages = {
11
12
  ARCHIVE_EXTRACTION_FAILED: "安装包无法安全解压,请稍后重试。",
12
13
  BROWSER_AUTHORIZATION_FAILED: "浏览器授权未完成,请重新运行安装命令。",
14
+ BROWSER_OPEN_FAILED: "Windows 未能打开默认浏览器。请确认已设置可用的默认浏览器,然后重新运行安装命令;本次连接未完成。",
13
15
  CONNECTION_VERIFICATION_FAILED: "设备连接验证失败,请重新运行安装命令。",
14
- INSTALLATION_FAILED: "本地安装未完成,已有文件不会被静默覆盖。",
16
+ INSTALLATION_FAILED: "本地安装未完成,请重试;现有文件未被修改。",
15
17
  INVALID_INPUT: "命令格式无效。请仅运行:npx --yes @nggaigc/cli@latest install",
16
18
  PACKAGE_VERIFICATION_FAILED: "安装包签名或完整性验证失败,已停止安装。",
17
19
  RUNTIME_UNSUPPORTED: "请使用 Node.js 22.13 或更高的 22.x 版本。",
package/dist/bundle.js CHANGED
@@ -18,7 +18,7 @@ const manifestKeys = [
18
18
  "version",
19
19
  ];
20
20
  const signatureKeys = ["algorithm", "keyId", "scope", "value"];
21
- const archiveName = "nggaigc-plugin-1.1.1.zip";
21
+ const archiveName = "nggaigc-plugin-1.1.3.zip";
22
22
  const trustedKeyId = "ngg-signing-skill-release-1";
23
23
  const trustedKeySpkiSha256 = "3d7450a1a26785d900be03e52b4b7d0b2e84fe4e4fcb6f2e903c1371b0b96cee";
24
24
  function record(value) {
@@ -57,7 +57,7 @@ export async function verifyBundle(input) {
57
57
  !exactKeys(manifestValue, manifestKeys) ||
58
58
  manifestValue.schemaVersion !== "nggaigc-plugin-package/v1" ||
59
59
  manifestValue.artifactId !== "plugin.nggaigc" ||
60
- manifestValue.version !== "1.1.1" ||
60
+ manifestValue.version !== "1.1.3" ||
61
61
  manifestValue.artifactPath !== `packages/plugins/${archiveName}` ||
62
62
  typeof manifestValue.sourceCommit !== "string" ||
63
63
  !/^[a-f0-9]{40}$/.test(manifestValue.sourceCommit) ||
package/dist/install.js CHANGED
@@ -8,7 +8,7 @@ import { CliError, fixedErrorCode } from "./errors.js";
8
8
  function defaultBundle() {
9
9
  const vendor = fileURLToPath(new URL("../vendor/", import.meta.url));
10
10
  return {
11
- archive: path.join(vendor, "nggaigc-plugin-1.1.1.zip"),
11
+ archive: path.join(vendor, "nggaigc-plugin-1.1.3.zip"),
12
12
  manifest: path.join(vendor, "manifest.json"),
13
13
  trust: path.join(vendor, "trusted-keys.json"),
14
14
  };
@@ -50,10 +50,11 @@ async function installedVersion(target) {
50
50
  return undefined;
51
51
  }
52
52
  }
53
- async function installSkill(installer, source, profile, expectedVersion, bundleFiles) {
54
- const target = path.join(profile, ".agents", "skills", "nggaigc");
53
+ async function installSkill(installer, source, profile, codexHome, expectedVersion, bundleFiles) {
54
+ const target = path.join(codexHome, "skills", "nggaigc");
55
55
  try {
56
56
  const result = await installer.main(["install", "--profile", profile], {
57
+ codexHome,
57
58
  source,
58
59
  });
59
60
  if (result.status !== "installed" || result.version !== expectedVersion)
@@ -74,6 +75,7 @@ async function installSkill(installer, source, profile, expectedVersion, bundleF
74
75
  }
75
76
  try {
76
77
  const result = await installer.main(["update", "--profile", profile], {
78
+ codexHome,
77
79
  source,
78
80
  });
79
81
  if (result.status !== "updated" || result.version !== expectedVersion)
@@ -108,16 +110,27 @@ async function connect(launcher, options, report, probe) {
108
110
  throw new CliError("CONNECTION_VERIFICATION_FAILED");
109
111
  }
110
112
  if (!configured) {
111
- report("authorizing");
113
+ report("launching");
112
114
  try {
113
- const result = await launcher.main(["login"], options);
115
+ const upstreamBrowserOpened = typeof options?.browserOpened === "function"
116
+ ? options.browserOpened
117
+ : undefined;
118
+ const result = await launcher.main(["login"], {
119
+ ...options,
120
+ browserOpened: () => {
121
+ upstreamBrowserOpened?.();
122
+ report("authorizing");
123
+ },
124
+ });
114
125
  if (result === null ||
115
126
  typeof result !== "object" ||
116
127
  !("status" in result) ||
117
128
  result.status !== "connected")
118
129
  throw new Error();
119
130
  }
120
- catch {
131
+ catch (error) {
132
+ if (fixedErrorCode(error) === "BROWSER_OPEN_FAILED")
133
+ throw new CliError("BROWSER_OPEN_FAILED");
121
134
  throw new CliError("BROWSER_AUTHORIZATION_FAILED");
122
135
  }
123
136
  }
@@ -135,6 +148,7 @@ function assertDisposableRoot(value, expectedParent) {
135
148
  export async function runInstall(options = {}) {
136
149
  validateRuntime(options.platform ?? process.platform, options.architecture ?? process.arch);
137
150
  const profile = safeProfile(options.profile ?? os.homedir());
151
+ const codexHome = safeProfile(options.codexHome ?? process.env.CODEX_HOME ?? path.join(profile, ".codex"));
138
152
  const report = options.reporter ?? (() => undefined);
139
153
  report("verifying");
140
154
  const bundle = await verifyBundle(options.bundle ?? defaultBundle());
@@ -150,8 +164,8 @@ export async function runInstall(options = {}) {
150
164
  const installer = require(path.join(extracted, "installer", "install.cjs"));
151
165
  if (!installer || typeof installer.main !== "function")
152
166
  throw new CliError("INSTALLATION_FAILED");
153
- const installation = await installSkill(installer, path.join(extracted, "skills", "nggaigc"), profile, bundle.version, bundle.files);
154
- const installedScripts = path.join(profile, ".agents", "skills", "nggaigc", "scripts");
167
+ const installation = await installSkill(installer, path.join(extracted, "skills", "nggaigc"), profile, codexHome, bundle.version, bundle.files);
168
+ const installedScripts = path.join(codexHome, "skills", "nggaigc", "scripts");
155
169
  const launcher = require(path.join(installedScripts, "launch-ngg-client.cjs"));
156
170
  if (!launcher ||
157
171
  typeof launcher.main !== "function" ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nggaigc/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Secure one-command NGGAIGC Skill installer for Codex on Windows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,30 +1,33 @@
1
1
  {
2
2
  "schemaVersion": "nggaigc-plugin-package/v1",
3
3
  "artifactId": "plugin.nggaigc",
4
- "version": "1.1.1",
5
- "sourceCommit": "6d6869feb01c935f16250beca0d269eef41a4eaa",
6
- "artifactPath": "packages/plugins/nggaigc-plugin-1.1.1.zip",
7
- "sha256": "f4371dcbfb58d003699ce854472d1a2cb356976c69db633f90b929bae2863bda",
8
- "sizeBytes": 106658,
4
+ "version": "1.1.3",
5
+ "sourceCommit": "14842952f8e8f98b08877543b4465efd70eea03a",
6
+ "artifactPath": "packages/plugins/nggaigc-plugin-1.1.3.zip",
7
+ "sha256": "7000ba048a5e81c6e5863e3c45764a33f6084f11069dc29101f7064001554524",
8
+ "sizeBytes": 114409,
9
9
  "fileCount": 11,
10
- "platforms": ["win32-x64", "win32-arm64"],
10
+ "platforms": [
11
+ "win32-x64",
12
+ "win32-arm64"
13
+ ],
11
14
  "files": {
12
- ".codex-plugin/plugin.json": "705fd28fa3bd4b9ced198cad482bcf7af65144c368b8abcd6aa1504a47b2d25e",
13
- "installer/install.cjs": "79b0b610965211dd2faf3f569d93d4f5f84b1055fc2bd11483bfdaf413edea10",
15
+ ".codex-plugin/plugin.json": "ab6a0ca539d051556d9ef626091d4062dd82cd9fb436c719746cad70ef8e4236",
16
+ "installer/install.cjs": "d4e03432a23f01019e65ff5c322dfb18ffc8fcf4979666af581190d6e56862f9",
17
+ "skills/nggaigc/SKILL.md": "0def06e6b06564c7d55640b5eaf6e05fb071785ad89cb1b667e422c12e784c21",
14
18
  "skills/nggaigc/agents/openai.yaml": "4a71357d3904a2dc69b8b495f7c2f83f01d0a3c231558d7d0f10c46cd98aa301",
15
19
  "skills/nggaigc/references/catalog-and-updates.md": "c0ee74bfe9b75dc8ee818f2db55d4fd7d581927ec037452b5971c9b3a9412e93",
16
- "skills/nggaigc/references/source.json": "e315fb2f4fe35ce4fefb2c1bed60bb464cc764c3a7c69e3f3c70b7ca8a623051",
17
- "skills/nggaigc/scripts/bootstrap-public.json": "ce699de3afa18941cbf9964a4e20b493a3a631f0edc1e0017a45668a9bee21a9",
18
- "skills/nggaigc/scripts/launch-ngg-client.cjs": "ab96625cd10194172c18c225ba8eff0e27f1680d826ae6578645f63bcd252146",
19
- "skills/nggaigc/scripts/ngg_client.mjs": "252d652b8f853fd0e610deb74a924f2143f7d17e4a34f9d35ee2bbcd800c7011",
20
- "skills/nggaigc/scripts/ngg-session.mjs": "5cdcdbcf25b4852b66346f29dc8f77837bda7f680ce97f0ff1d33dc404dfb752",
21
- "skills/nggaigc/scripts/windows-credential.ps1": "8b6e323bebd3f86f19e0c2ae5366f4dc68005d57c07d6f699aece366661be6a0",
22
- "skills/nggaigc/SKILL.md": "5545ed96d9ab9facc241b0e6d2a18800e693d012190f08037134e9930d21fa8e"
20
+ "skills/nggaigc/references/source.json": "2a2e13120ea5a44d0f39797ea6bd4c9c3c4cb1cfc4750f9de01ea61a2c8300cb",
21
+ "skills/nggaigc/scripts/bootstrap-public.json": "c32c19cd556aa1096bd341d25ac35724f9a38fbaca825e81122afcd63ff8ec44",
22
+ "skills/nggaigc/scripts/launch-ngg-client.cjs": "a1a457af61bd5ca3cca15777d3f6147c83de8312e67d43309212e5baa7512451",
23
+ "skills/nggaigc/scripts/ngg-session.mjs": "03c748a419b42010834ad5c0c564d2dd73702d8feb672d3530f1761b67ff670b",
24
+ "skills/nggaigc/scripts/ngg_client.mjs": "b5702493708875274ec6ad7061c1aee4aff733f0f65680f21d39b357f10b892e",
25
+ "skills/nggaigc/scripts/windows-credential.ps1": "8b6e323bebd3f86f19e0c2ae5366f4dc68005d57c07d6f699aece366661be6a0"
23
26
  },
24
27
  "signature": {
25
28
  "algorithm": "ed25519",
26
29
  "keyId": "ngg-signing-skill-release-1",
27
30
  "scope": "artifact-bytes",
28
- "value": "yN8E8C4SfPMSZiOaBI4rDFJKb7EIU+5m2+dKEDGHNn/f/15xOLGiYjS0kCRoCGEDneG4GhpgF1gpX1sL/AeqDg=="
31
+ "value": "mW5dDyO1xfTFDYjGLuYuzYfgrq5foJvukCTd8+GOyCrlxBLgc+uVndv+EBHlqrnPLhCkDX8x/XlzQf9fro+WDA=="
29
32
  }
30
33
  }
package/README.md DELETED
@@ -1,11 +0,0 @@
1
- # @nggaigc/cli
2
-
3
- NGGAIGC Codex Skill 的 Windows 一命令安装器。
4
-
5
- ```powershell
6
- npx --yes @nggaigc/cli@latest install
7
- ```
8
-
9
- 安装器会先验证内置 Plugin 的 Ed25519 签名、归档哈希和逐文件哈希,再原子安装 Skill。首次运行会打开 NGGAIGC 浏览器授权页;短期授权值只通过浏览器片段和本机回环请求返回,设备凭据只通过标准输入进入 Windows Credential Manager。安装器不接受 API Key、授权码或设备凭据参数,也不从环境变量读取这些值。
10
-
11
- 当前候选支持 Windows x64/arm64,并要求 Node.js 22.13 或更高的 22.x 版本。