opencode-novel 0.0.1 → 0.0.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 +61 -0
- package/dist/cli.js +10 -3
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -40,6 +40,67 @@ bun run script/install-opencode.ts -- --target=global
|
|
|
40
40
|
/novel-export docx
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
## 安装指南(npm 全局)
|
|
44
|
+
|
|
45
|
+
适用于“直接使用发布包”的场景(不从源码构建)。
|
|
46
|
+
|
|
47
|
+
### 1) 安装 Bun(必需)
|
|
48
|
+
|
|
49
|
+
`opencode-novel` 的 CLI 通过 `bun` 运行,请先安装 Bun 并确保终端可执行:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
bun --version
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Windows 建议使用官方安装方式(确保有 `bun.exe`),安装后重启终端。
|
|
56
|
+
|
|
57
|
+
### 2) 全局安装插件 CLI
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm i -g opencode-novel
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
验证命令可用:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
opencode-novel --help
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3) 安装到 OpenCode(全局配置)
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
opencode-novel install --target=global
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
成功后会输出 `install done`,并写入以下目录:
|
|
76
|
+
|
|
77
|
+
- `~/.config/opencode/plugins/opencode-novel.js`
|
|
78
|
+
- `~/.config/opencode/commands`
|
|
79
|
+
- `~/.config/opencode/skill`
|
|
80
|
+
- `~/.config/opencode/novel.jsonc`
|
|
81
|
+
|
|
82
|
+
安装完成后请重启 OpenCode。
|
|
83
|
+
|
|
84
|
+
### 4) 卸载(可选)
|
|
85
|
+
|
|
86
|
+
先从 OpenCode 配置中移除:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
opencode-novel uninstall --target=global
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
再卸载全局 npm 包:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm uninstall -g opencode-novel
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 5) 常见问题(Windows)
|
|
99
|
+
|
|
100
|
+
- **PowerShell 提示 `bun.exe` 找不到**:通常是 Bun 安装方式导致 PATH 中只有 `bun.cmd`。请安装官方 Bun 并重启终端。
|
|
101
|
+
- **命令执行后看起来“卡住”**:若输出已出现 `[opencode-novel] install done`,通常已完成;按一次回车确认提示符是否返回。
|
|
102
|
+
- **`cmd` 正常、PowerShell 异常**:可先使用 `opencode-novel.cmd install --target=global` 作为临时方案。
|
|
103
|
+
|
|
43
104
|
## 输出协议(对接方)
|
|
44
105
|
|
|
45
106
|
所有 `/novel-*` 工具命令统一输出四段:
|
package/dist/cli.js
CHANGED
|
@@ -3293,6 +3293,11 @@ function writeTextFile(filePath, content, options) {
|
|
|
3293
3293
|
}
|
|
3294
3294
|
|
|
3295
3295
|
// src/cli.ts
|
|
3296
|
+
function printExitHintAndExit() {
|
|
3297
|
+
console.log("[opencode-novel] command finished. Exiting now.");
|
|
3298
|
+
console.log("[opencode-novel] if the prompt does not return, press Enter once.");
|
|
3299
|
+
process.exit(0);
|
|
3300
|
+
}
|
|
3296
3301
|
function printRootHelpAndExit() {
|
|
3297
3302
|
console.log(`
|
|
3298
3303
|
opencode-novel CLI
|
|
@@ -3702,11 +3707,13 @@ function main() {
|
|
|
3702
3707
|
const [command, ...rest] = process.argv.slice(2);
|
|
3703
3708
|
if (!command)
|
|
3704
3709
|
printRootHelpAndExit();
|
|
3705
|
-
if (command === "install")
|
|
3710
|
+
if (command === "install") {
|
|
3706
3711
|
runInstall(rest);
|
|
3707
|
-
|
|
3712
|
+
printExitHintAndExit();
|
|
3713
|
+
} else if (command === "uninstall") {
|
|
3708
3714
|
runUninstall(rest);
|
|
3709
|
-
|
|
3715
|
+
printExitHintAndExit();
|
|
3716
|
+
} else if (command === "help" || command === "--help" || command === "-h")
|
|
3710
3717
|
printRootHelpAndExit();
|
|
3711
3718
|
else {
|
|
3712
3719
|
console.error(`[opencode-novel] unknown command: ${command}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-novel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Novel writing workflow plugin for OpenCode (Bun/TypeScript).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"uninstall:opencode": "bun run script/uninstall-opencode.ts -- --target=global",
|
|
28
28
|
"benchmark:index": "bun run script/perf-index-benchmark.ts",
|
|
29
29
|
"check:code-rules": "bun run script/check-code-rules.ts",
|
|
30
|
+
"check:tag-version": "bun run script/check-tag-version.ts",
|
|
30
31
|
"lint": "biome check --error-on-warnings .",
|
|
31
32
|
"lint:fix": "biome check --write .",
|
|
32
33
|
"typecheck": "tsc --noEmit",
|