@wwkit/opm 1.0.10 → 1.0.11
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 +4 -4
- package/package.json +2 -3
- package/src/cli/index.js +13 -1
- package/src/harnesses/opencode/index.js +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ pnpm opm <command> [args] [options]
|
|
|
68
68
|
| `ensure <runtime> [version]` | 确保运行时已安装(node/php/python) |
|
|
69
69
|
| `ping <host|proxy|registry>` | 验证主机、代理或所有 registry 的可访问性 |
|
|
70
70
|
| `config [section]` | 查看常用配置(proxy + 各 registry 段,段名动态生成) |
|
|
71
|
-
| `opencode <action>` | opencode 运维命令(安装/升级/清理/env
|
|
71
|
+
| `opencode <action>` | opencode 运维命令(安装/升级/清理/env);裸 `opm opencode` 启动 TUI |
|
|
72
72
|
| `harness <action>` | @wwkit/harness 插件管理(安装/升级/list/status/env/dir) |
|
|
73
73
|
|
|
74
74
|
## Managers
|
|
@@ -120,7 +120,7 @@ pnpm opm <command> [args] [options]
|
|
|
120
120
|
| `opencode config` | 显示配置文件内容 |
|
|
121
121
|
| `opencode dir` | 显示 data/db/log/config 路径 |
|
|
122
122
|
| `opencode env` | 显示环境变量(OPENCODE_CONFIG_DIR / CONTENT) |
|
|
123
|
-
| `opencode
|
|
123
|
+
| `opencode [-d <dir>]` | 启动 TUI(默认 cwd),自动注入环境变量;可透传 args 给 opencode |
|
|
124
124
|
| `opencode clear` | 清理过期会话并 VACUUM 压缩数据库(缺省 `-d 1`,只保留今天) |
|
|
125
125
|
| `opencode clear -d, --days <n>` | 保留最近 n 天(对齐本地零点,含今天) |
|
|
126
126
|
| `opencode clear -h, --hours <n>` | 保留最近 n 小时(滚动窗口) |
|
|
@@ -542,8 +542,8 @@ opm opencode upgrade # 升级到最新
|
|
|
542
542
|
opm opencode config # 显示配置文件内容
|
|
543
543
|
opm opencode dir # 查看数据/日志/DB路径
|
|
544
544
|
opm opencode env # 查看环境变量
|
|
545
|
-
opm opencode
|
|
546
|
-
opm opencode
|
|
545
|
+
opm opencode # 在当前目录启动 TUI
|
|
546
|
+
opm opencode -d /path/to/project # 在指定目录启动 TUI
|
|
547
547
|
opm opencode clear # 只保留今天创建的会话
|
|
548
548
|
opm opencode clear -d 7 # 保留最近 7 天会话
|
|
549
549
|
opm opencode clear -h 24 # 保留最近 24 小时会话
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wwkit/opm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"author": "bluesliu <langcai163@163.com>",
|
|
5
5
|
"description": "Unified CLI — package management (npm/pip/dnf/apt) + config view + opencode maintenance",
|
|
6
6
|
"type": "module",
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
"basic-ftp": "^6.2.1",
|
|
36
36
|
"extract-zip": "^2.0.1",
|
|
37
37
|
"systeminformation": "^5.23.0",
|
|
38
|
-
"@wwkit/
|
|
39
|
-
"@wwkit/shared": "1.0.14"
|
|
38
|
+
"@wwkit/shared": "1.0.15"
|
|
40
39
|
},
|
|
41
40
|
"publishConfig": {
|
|
42
41
|
"registry": "https://registry.npmjs.org/",
|
package/src/cli/index.js
CHANGED
|
@@ -77,12 +77,23 @@ class CLI {
|
|
|
77
77
|
return
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
if (groupName === 'version' || groupName === '-v' || groupName === '--version') {
|
|
81
81
|
const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'))
|
|
82
82
|
console.log(pkg.version)
|
|
83
83
|
return
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
if (groupName === 'upgrade') {
|
|
87
|
+
const { NpmManager } = await import('../managers/npm.js')
|
|
88
|
+
const { getActiveProxy } = await import('../config.js')
|
|
89
|
+
const npm = new NpmManager()
|
|
90
|
+
const proxy = getActiveProxy()
|
|
91
|
+
await npm.upgrade('@wwkit/harness', { global: true, proxy })
|
|
92
|
+
const result = await npm.upgrade('@wwkit/opm', { global: true, proxy })
|
|
93
|
+
console.log(`opm upgraded to ${result.version || 'latest'}`)
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
if (groupName === 'doc') {
|
|
87
98
|
generateDocHtml()
|
|
88
99
|
return
|
|
@@ -114,6 +125,7 @@ Usage: opm <command> [args] [options]
|
|
|
114
125
|
Commands:
|
|
115
126
|
${groupLines}
|
|
116
127
|
version Show opm version
|
|
128
|
+
upgrade Upgrade opm itself (npm install -g @wwkit/opm@latest)
|
|
117
129
|
doc Build docs HTML and open in browser
|
|
118
130
|
|
|
119
131
|
Options:
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* opencode 是 AI coding agent,通过 npm 全局包 opencode-ai 安装(binary: opencode)。
|
|
5
5
|
* 数据目录跨平台(db.js),会话清理复用 clear.js。
|
|
6
6
|
* env 命令管理 OPENCODE_CONFIG_DIR / OPENCODE_CONFIG_CONTENT 环境变量。
|
|
7
|
-
*
|
|
7
|
+
* 裸 `opm opencode`(或带透传 args)在指定工作目录启动 opencode TUI(自动注入 env 变量)。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import fs from 'node:fs'
|