@skylandnpm/octopus-proxy 0.1.1 → 0.1.3
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 -3
- package/dist/cli.js +13 -2
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ Octopus Proxy 是运行在 macOS 或 Linux 主机上的 Octopus 代理,提供
|
|
|
7
7
|
```sh
|
|
8
8
|
npm install -g @skylandnpm/octopus-proxy@latest --registry https://registry.npmjs.org
|
|
9
9
|
octopus-proxy help
|
|
10
|
+
octopus-proxy version
|
|
10
11
|
octopus-proxy onboard
|
|
11
12
|
```
|
|
12
13
|
|
|
@@ -44,11 +45,12 @@ octopus-proxy onboard --tool pi
|
|
|
44
45
|
|
|
45
46
|
## 发布
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
在 `apps/octopus-proxy` 目录执行 `npm run publish`:先递增 `package.json` 的补丁版本,再编译,最后发布。即使编译或发布失败,版本号也会保留递增结果,重试时继续递增。版本更新不会自动创建 Git 提交或标签。先登录有权发布 `@skylandnpm` 包的 npm 账号:
|
|
48
49
|
|
|
49
50
|
```sh
|
|
50
51
|
npm adduser --registry https://registry.npmjs.org
|
|
51
|
-
|
|
52
|
+
cd apps/octopus-proxy
|
|
53
|
+
npm run publish
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
预览包内容可运行 `pnpm build && npm pack --dry-run`。直接运行 `npm publish` 会提示使用 `npm run publish`,以防绕过版本递增和编译。
|
package/dist/cli.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
|
|
22
22
|
// src/cli.ts
|
|
23
23
|
import { spawn } from "node:child_process";
|
|
24
|
+
import { readFileSync } from "node:fs";
|
|
24
25
|
import { access as access4 } from "node:fs/promises";
|
|
25
26
|
|
|
26
27
|
// src/doctor.ts
|
|
@@ -431,7 +432,7 @@ import { promisify as promisify5 } from "node:util";
|
|
|
431
432
|
var DEFAULT_HUB_URL = "https://octopus.wuyehao.com";
|
|
432
433
|
async function ask(rl, question, options = {}) {
|
|
433
434
|
for (; ; ) {
|
|
434
|
-
const suffix = options.default !== void 0 ? `\uFF08\u9ED8\u8BA4 ${options.defaultDisplay ?? options.default}\uFF09` : "";
|
|
435
|
+
const suffix = options.default !== void 0 && options.showDefault !== false ? `\uFF08\u9ED8\u8BA4 ${options.defaultDisplay ?? options.default}\uFF09` : "";
|
|
435
436
|
const answer = (await rl.question(`${question}${suffix}: `)).trim();
|
|
436
437
|
const value = answer || options.default || "";
|
|
437
438
|
const problem = await options.validate?.(value);
|
|
@@ -494,7 +495,7 @@ async function runOnboard(opts) {
|
|
|
494
495
|
console.log("Octopus Proxy \u521D\u59CB\u5316\u5411\u5BFC");
|
|
495
496
|
console.log(`\u914D\u7F6E\u5C06\u5199\u5165 ${opts.configPath}\uFF1B\u6587\u4EF6\u5305\u542B\u673A\u5668\u4EBA Secret\uFF0C\u4F1A\u4EE5 0600 \u6743\u9650\u4FDD\u5B58\u3002
|
|
496
497
|
`);
|
|
497
|
-
hubUrl = await ask(rl,
|
|
498
|
+
hubUrl = await ask(rl, `Hub \u5730\u5740\uFF08${hubUrl} , \u56DE\u8F66\u76F4\u63A5\u786E\u8BA4\uFF09`, { default: hubUrl, showDefault: false, validate: validUrl });
|
|
498
499
|
botId = await ask(rl, "\u673A\u5668\u4EBA ID\uFF08\u5728 Claw \u6216 Taskhub \u4E2D\u521B\u5EFA\u5E76\u590D\u5236\uFF09", { default: botId || void 0, validate: validBotId });
|
|
499
500
|
secretKey = await ask(rl, "\u673A\u5668\u4EBA Secret\uFF08\u5728 Claw \u6216 Taskhub \u521B\u5EFA\uFF1B\u8F93\u5165\u4F1A\u56DE\u663E\u5728\u7EC8\u7AEF\uFF09", { default: secretKey || void 0, defaultDisplay: existing?.secretKey ? "\u5DF2\u914D\u7F6E\uFF0C\u56DE\u8F66\u4FDD\u7559" : "\u5DF2\u63D0\u4F9B\uFF0C\u56DE\u8F66\u4F7F\u7528", validate: (value) => value.length >= 20 ? void 0 : "\u8BF7\u8F93\u5165\u5B8C\u6574\u7684\u673A\u5668\u4EBA Secret" });
|
|
500
501
|
stateDirectory = expandHome(await ask(rl, "\u72B6\u6001\u76EE\u5F55", { default: stateDirectory, validate: (value) => isAbsolute3(expandHome(value)) ? void 0 : "\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84" }));
|
|
@@ -628,6 +629,7 @@ var USAGE = `octopus-proxy \u2014 Octopus \u4E3B\u673A\u4EE3\u7406
|
|
|
628
629
|
doctor \u68C0\u67E5\u914D\u7F6E\u3001OpenCode\u3001node \u4E0E\u670D\u52A1\u5065\u5EB7\uFF08--fix \u81EA\u52A8\u4FEE\u590D\uFF09
|
|
629
630
|
run \u524D\u53F0\u8FD0\u884C\u4EE3\u7406\uFF08\u8C03\u8BD5\u7528\uFF0CCtrl+C \u9000\u51FA\uFF09
|
|
630
631
|
logs \u67E5\u770B\u670D\u52A1\u65E5\u5FD7\uFF08-f \u6301\u7EED\u8DDF\u968F\uFF09
|
|
632
|
+
version \u663E\u793A\u7248\u672C\u53F7
|
|
631
633
|
help \u663E\u793A\u672C\u5E2E\u52A9
|
|
632
634
|
|
|
633
635
|
\u901A\u7528\u9009\u9879:
|
|
@@ -663,6 +665,10 @@ function parse(argv) {
|
|
|
663
665
|
flags2["--help"] = "true";
|
|
664
666
|
continue;
|
|
665
667
|
}
|
|
668
|
+
if (arg === "-v" || arg === "--version") {
|
|
669
|
+
flags2["--version"] = "true";
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
666
672
|
if (arg === "-f") {
|
|
667
673
|
flags2["--follow"] = "true";
|
|
668
674
|
continue;
|
|
@@ -701,6 +707,11 @@ async function showLogs(follow) {
|
|
|
701
707
|
process.exit(code);
|
|
702
708
|
}
|
|
703
709
|
var { command, flags, projectArgs } = parse(process.argv.slice(2));
|
|
710
|
+
if (command === "version" || flags["--version"]) {
|
|
711
|
+
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
712
|
+
console.log(packageJson.version);
|
|
713
|
+
process.exit(0);
|
|
714
|
+
}
|
|
704
715
|
if (!command || command === "help" || flags["--help"]) {
|
|
705
716
|
console.log(USAGE);
|
|
706
717
|
process.exit(command || flags["--help"] ? 0 : 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skylandnpm/octopus-proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Octopus host proxy: OpenCode, Codex, ZCode and Pi adapters with service installer CLI",
|
|
6
6
|
"bin": {
|
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc --noEmit && tsup",
|
|
18
|
-
"
|
|
18
|
+
"prepublishOnly": "node -e \"console.error('请使用 npm run publish'); process.exit(1)\"",
|
|
19
|
+
"publish": "npm version patch --no-git-tag-version && pnpm build && npm publish --ignore-scripts",
|
|
20
|
+
"release": "npm run publish",
|
|
21
|
+
"build:patch:publish": "npm run publish",
|
|
19
22
|
"typecheck": "tsc --noEmit",
|
|
20
23
|
"dev": "tsx src/main.ts",
|
|
21
24
|
"cli": "tsx src/cli.ts",
|
|
22
25
|
"test": "vitest run",
|
|
23
|
-
"help": "echo \"Run 'npm adduser --registry https://registry.npmjs.org' before 'npm run
|
|
26
|
+
"help": "echo \"Run 'npm adduser --registry https://registry.npmjs.org' before 'npm run publish'\""
|
|
24
27
|
},
|
|
25
28
|
"dependencies": {
|
|
26
29
|
"ws": "8.18.0"
|