opencode-skill-tracker-tui 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +116 -120
  3. package/README.zh-CN.md +116 -120
  4. package/package.json +50 -50
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 aihaipeng
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 aihaipeng
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,120 +1,116 @@
1
- # opencode-skill-tracker
2
-
3
- English | [简体中文](README.zh-CN.md)
4
-
5
- An [OpenCode](https://opencode.ai) TUI plugin that adds a `Skills` section to the right sidebar: every skill visible to OpenCode is listed per session, loaded ones are highlighted and sorted first, and individual skills can be hidden from the sidebar.
6
-
7
- Formerly `opencode-skills-sidebar`; saved state (collapsed / hidden skills) migrates automatically.
8
-
9
- ## Features
10
-
11
- - `Skills` section in the session sidebar, discovery via OpenCode itself (`client.app.skills()`), deduplicated and sorted by name
12
- - Loaded state per session, detected from three sources: `skill` tool parts (`input.name`), text parts carrying the `<skill_content name="...">` tag injected by opencode, and TUI slash-command expansion (skill body pasted as a plain user text part, matched against known skill content)
13
- - Loaded skills are highlighted (green bullet) and sorted first, both in the sidebar and in `/skills-status`
14
- - Collapsible panel header with a live summary — `(X loaded Y available)` (`+Z` when skills are hidden)
15
- - Hide individual skills via the `/hide-skills` dialog; `Show all hidden` restores everything in one step, and an `N hidden (show all)` footer in the sidebar does the same
16
- - Collapsed state and hidden set persist across restarts (plugin kv), with automatic migration from the legacy `opencode-skills-sidebar` keys
17
- - Incremental per-session scanning (message watermark), so long sessions do not trigger repeated full rescans
18
-
19
- ## Requirements
20
-
21
- - OpenCode with TUI plugin support (`slots.sidebar_content`)
22
- - [Bun](https://bun.sh) to build from source
23
-
24
- ## Installation
25
-
26
- This is a **TUI plugin**, so it must be configured in `~/.config/opencode/tui.json`, not in `opencode.json`.
27
-
28
- ### Option A: from npm
29
-
30
- Reference the package name (see step 2) — no build needed.
31
-
32
- ### Option B: build from source
33
-
34
- ```bash
35
- git clone <this-repo>
36
- cd opencode-skill-tracker
37
- bun install
38
- bun run build
39
- ```
40
-
41
- That produces `dist/tui.js`.
42
-
43
- ### 2. Register it in OpenCode
44
-
45
- npm installs go by package name; source builds use the absolute path to `dist/tui.js`. Add it to `~/.config/opencode/tui.json`:
46
-
47
- ```json
48
- {
49
- "$schema": "https://opencode.ai/tui.json",
50
- "plugin": [
51
- "opencode-skill-tracker-tui"
52
- ]
53
- }
54
- ```
55
-
56
- or, for a source build:
57
-
58
- ```json
59
- {
60
- "$schema": "https://opencode.ai/tui.json",
61
- "plugin": [
62
- "C:\\path\\to\\opencode-skill-tracker\\dist\\tui.js"
63
- ]
64
- }
65
- ```
66
-
67
- Keep any existing entries in the `plugin` array it can hold multiple plugins.
68
-
69
- ### 3. Restart OpenCode
70
-
71
- TUI plugins are loaded at startup; there is no hot reload. Restart `opencode` after building or updating.
72
-
73
- ## Usage
74
-
75
- | Action | Result |
76
- | --- | --- |
77
- | Click the `Skills` header | Collapse / expand the panel |
78
- | Click a skill row | Nothing (by design) |
79
- | Click `N hidden (show all)` | Restore all hidden skills |
80
- | `/skills-status` | Dialog with every non-hidden skill, `Loaded` / `Unloaded` state, loaded first |
81
- | `/hide-skills` | Dialog to hide / restore individual skills, with search |
82
-
83
- Notes:
84
-
85
- - `/skills-status` reflects the currently open session and needs one to be open.
86
- - In the collapsed header, `X` counts loaded skills that are not hidden, `Y` counts all discovered skills, `Z` counts hidden ones.
87
- - A skill loaded via a slash command (`/some-skill`) counts as loaded once the skill body has been pasted into the session.
88
-
89
- ## How it works
90
-
91
- - Registers a `sidebar_content` slot via the OpenCode TUI plugin API (`@opencode-ai/plugin/tui`), slot `order: 250` (between the built-in `MCP` at 200 and `LSP` at 300)
92
- - Skill discovery comes from `client.app.skills()`; the loaded set is tracked per session
93
- - Loaded detection scans message parts incrementally (per-message watermark), and re-scans when the skill list refreshes (content matching needs the list)
94
- - Refresh sources: `message.part.updated`, `message.updated`, `session.updated` (incremental), `session.created`, `project.updated`, `workspace.ready`, `worktree.ready` (skill list refetch), plus a 250ms startup retry and a 500ms backfill after opening a session
95
- - Prose that merely quotes the literal `<skill_content>` tag (e.g. in assistant messages) is ignored: tag matches must name a known skill
96
-
97
- ## Troubleshooting
98
-
99
- - **No `Skills` section**: check the path in `tui.json` is absolute and correct, then restart. `opencode --pure` skips all external plugins.
100
- - **A skill was loaded but shows as unloaded**: slash-command loading is detected by matching the pasted skill body, which requires the skill list to be loaded first. It backfills automatically; collapsing and re-expanding the panel, or switching sessions, forces an immediate rescan.
101
- - **Updated the plugin but nothing changed**: TUI plugins load at startup — restart `opencode`.
102
-
103
- ## Development
104
-
105
- ```bash
106
- bun run build # bundle to dist/tui.js + declarations
107
- bun run typecheck # tsc --noEmit
108
- ```
109
-
110
- Source layout:
111
-
112
- - `src/tui.tsx` — plugin entry: slot registration, event wiring, per-session loaded tracking, kv persistence
113
- - `src/skill-data.ts` — skill discovery, loaded-state extraction (tool part / tag / content matching), incremental scanning, loaded-first sorting
114
- - `src/components/skills-panel.tsx` — sidebar panel rendering
115
- - `src/components/skills-status-dialog.tsx` — `/skills-status` dialog
116
- - `src/components/skills-filter-dialog.tsx` — `/hide-skills` dialog
117
-
118
- ## License
119
-
120
- [MIT](LICENSE) — the npm package is published as [`opencode-skill-tracker-tui`](https://www.npmjs.com/package/opencode-skill-tracker-tui).
1
+ # opencode-skill-tracker
2
+
3
+ English | [简体中文](README.zh-CN.md)
4
+
5
+ An [OpenCode](https://opencode.ai) TUI plugin that adds a `Skills` section to the right sidebar: every skill visible to OpenCode is listed per session, loaded ones are highlighted and sorted first, and individual skills can be hidden from the sidebar.
6
+
7
+ Formerly `opencode-skills-sidebar`; saved state (collapsed / hidden skills) migrates automatically.
8
+
9
+ ## Features
10
+
11
+ - `Skills` section in the session sidebar, discovery via OpenCode itself (`client.app.skills()`), deduplicated and sorted by name
12
+ - Loaded state per session, detected from three sources: `skill` tool parts (`input.name`), text parts carrying the `<skill_content name="...">` tag injected by opencode, and TUI slash-command expansion (skill body pasted as a plain user text part, matched against known skill content)
13
+ - Loaded skills are highlighted (green bullet) and sorted first, both in the sidebar and in `/skills-status`
14
+ - Collapsible panel header with a live summary — `(X loaded Y available)` (`+Z` when skills are hidden)
15
+ - Hide individual skills via the `/hide-skills` dialog; `Show all hidden` restores everything in one step, and an `N hidden (show all)` footer in the sidebar does the same
16
+ - Collapsed state and hidden set persist across restarts (plugin kv), with automatic migration from the legacy `opencode-skills-sidebar` keys
17
+ - Incremental per-session scanning (message watermark), so long sessions do not trigger repeated full rescans
18
+
19
+ ## Requirements
20
+
21
+ - OpenCode with TUI plugin support (`slots.sidebar_content`)
22
+ - [Bun](https://bun.sh) to build from source
23
+
24
+ ## Installation
25
+
26
+ This is a **TUI plugin**, so it must be configured in `~/.config/opencode/tui.json`, not in `opencode.json`.
27
+
28
+ ### Option A: from npm (recommended)
29
+
30
+ Add the package name to `~/.config/opencode/tui.json`:
31
+
32
+ ```json
33
+ {
34
+ "$schema": "https://opencode.ai/tui.json",
35
+ "plugin": [
36
+ "opencode-skill-tracker-tui"
37
+ ]
38
+ }
39
+ ```
40
+
41
+ No manual install is needed — OpenCode installs npm plugins automatically with Bun at startup (cached in `~/.cache/opencode/node_modules/`).
42
+
43
+ ### Option B: build from source
44
+
45
+ ```bash
46
+ git clone https://github.com/aihaipeng/opencode-skill-tracker.git
47
+ cd opencode-skill-tracker
48
+ bun install
49
+ bun run build
50
+ ```
51
+
52
+ That produces `dist/tui.js`. Register its absolute path in `~/.config/opencode/tui.json`:
53
+
54
+ ```json
55
+ {
56
+ "$schema": "https://opencode.ai/tui.json",
57
+ "plugin": [
58
+ "C:\\path\\to\\opencode-skill-tracker\\dist\\tui.js"
59
+ ]
60
+ }
61
+ ```
62
+
63
+ Keep any existing entries in the `plugin` array — it can hold multiple plugins.
64
+
65
+ ### Restart OpenCode
66
+
67
+ TUI plugins are loaded at startup; there is no hot reload. Restart `opencode` after installing or updating.
68
+
69
+ ## Usage
70
+
71
+ | Action | Result |
72
+ | --- | --- |
73
+ | Click the `Skills` header | Collapse / expand the panel |
74
+ | Click a skill row | Nothing (by design) |
75
+ | Click `N hidden (show all)` | Restore all hidden skills |
76
+ | `/skills-status` | Dialog with every non-hidden skill, `Loaded` / `Unloaded` state, loaded first |
77
+ | `/hide-skills` | Dialog to hide / restore individual skills, with search |
78
+
79
+ Notes:
80
+
81
+ - `/skills-status` reflects the currently open session and needs one to be open.
82
+ - In the collapsed header, `X` counts loaded skills that are not hidden, `Y` counts all discovered skills, `Z` counts hidden ones.
83
+ - A skill loaded via a slash command (`/some-skill`) counts as loaded once the skill body has been pasted into the session.
84
+
85
+ ## How it works
86
+
87
+ - Registers a `sidebar_content` slot via the OpenCode TUI plugin API (`@opencode-ai/plugin/tui`), slot `order: 250` (between the built-in `MCP` at 200 and `LSP` at 300)
88
+ - Skill discovery comes from `client.app.skills()`; the loaded set is tracked per session
89
+ - Loaded detection scans message parts incrementally (per-message watermark), and re-scans when the skill list refreshes (content matching needs the list)
90
+ - Refresh sources: `message.part.updated`, `message.updated`, `session.updated` (incremental), `session.created`, `project.updated`, `workspace.ready`, `worktree.ready` (skill list refetch), plus a 250ms startup retry and a 500ms backfill after opening a session
91
+ - Prose that merely quotes the literal `<skill_content>` tag (e.g. in assistant messages) is ignored: tag matches must name a known skill
92
+
93
+ ## Troubleshooting
94
+
95
+ - **No `Skills` section**: check the path in `tui.json` is absolute and correct, then restart. `opencode --pure` skips all external plugins.
96
+ - **A skill was loaded but shows as unloaded**: slash-command loading is detected by matching the pasted skill body, which requires the skill list to be loaded first. It backfills automatically; collapsing and re-expanding the panel, or switching sessions, forces an immediate rescan.
97
+ - **Updated the plugin but nothing changed**: TUI plugins load at startup — restart `opencode`.
98
+
99
+ ## Development
100
+
101
+ ```bash
102
+ bun run build # bundle to dist/tui.js + declarations
103
+ bun run typecheck # tsc --noEmit
104
+ ```
105
+
106
+ Source layout:
107
+
108
+ - `src/tui.tsx` — plugin entry: slot registration, event wiring, per-session loaded tracking, kv persistence
109
+ - `src/skill-data.ts` — skill discovery, loaded-state extraction (tool part / tag / content matching), incremental scanning, loaded-first sorting
110
+ - `src/components/skills-panel.tsx` — sidebar panel rendering
111
+ - `src/components/skills-status-dialog.tsx` — `/skills-status` dialog
112
+ - `src/components/skills-filter-dialog.tsx` — `/hide-skills` dialog
113
+
114
+ ## License
115
+
116
+ [MIT](LICENSE) — the npm package is published as [`opencode-skill-tracker-tui`](https://www.npmjs.com/package/opencode-skill-tracker-tui).
package/README.zh-CN.md CHANGED
@@ -1,120 +1,116 @@
1
- # opencode-skill-tracker
2
-
3
- [English](README.md) | 简体中文
4
-
5
- 一个 [OpenCode](https://opencode.ai) TUI 插件:在右侧边栏增加 `Skills` 区块,按会话列出 OpenCode 可见的全部技能,已加载的高亮并排在最前,还可隐藏个别技能。
6
-
7
- 原 `opencode-skills-sidebar`,已保存状态(折叠 / 隐藏列表)自动迁移。
8
-
9
- ## 功能
10
-
11
- - 会话侧边栏 `Skills` 区块,技能发现来自 OpenCode 本体(`client.app.skills()`),去重后按名称排序
12
- - 按会话跟踪加载状态,三路检测:`skill` 工具 part(`input.name`)、opencode 注入的 `<skill_content name="...">` 标签 text part、TUI 斜杠命令展开(技能正文以纯文本用户消息注入,按已知技能正文匹配)
13
- - 已加载技能绿色圆点高亮并置顶,侧栏与 `/skills-status` 一致
14
- - 面板头可折叠,实时摘要 `(X loaded Y available)`(有隐藏技能时追加 `+Z`)
15
- - `/hide-skills` 对话框可隐藏个别技能;`Show all hidden` 一步恢复全部,侧栏 `N hidden (show all)` 页脚点击同效
16
- - 折叠状态与隐藏列表跨重启持久化(插件 kv),并从旧 `opencode-skills-sidebar` 键自动迁移
17
- - 按会话增量扫描(消息水位线),长会话不重复全量重扫
18
-
19
- ## 环境要求
20
-
21
- - 支持 TUI 插件(`slots.sidebar_content`)的 OpenCode
22
- - 从源码构建需要 [Bun](https://bun.sh)
23
-
24
- ## 安装
25
-
26
- 这是 **TUI 插件**,必须配置在 `~/.config/opencode/tui.json`,不是 `opencode.json`。
27
-
28
- ### 方式 A:npm
29
-
30
- 直接引用包名(见第 2 步),无需构建。
31
-
32
- ### 方式 B:源码构建
33
-
34
- ```bash
35
- git clone <this-repo>
36
- cd opencode-skill-tracker
37
- bun install
38
- bun run build
39
- ```
40
-
41
- 产出 `dist/tui.js`。
42
-
43
- ### 2. 注册到 OpenCode
44
-
45
- npm 安装用包名;源码构建用 `dist/tui.js` 绝对路径。加入 `~/.config/opencode/tui.json`:
46
-
47
- ```json
48
- {
49
- "$schema": "https://opencode.ai/tui.json",
50
- "plugin": [
51
- "opencode-skill-tracker-tui"
52
- ]
53
- }
54
- ```
55
-
56
- 源码构建则用:
57
-
58
- ```json
59
- {
60
- "$schema": "https://opencode.ai/tui.json",
61
- "plugin": [
62
- "C:\\path\\to\\opencode-skill-tracker\\dist\\tui.js"
63
- ]
64
- }
65
- ```
66
-
67
- `plugin` 数组可同时装多个插件,保留已有条目即可。
68
-
69
- ### 3. 重启 OpenCode
70
-
71
- TUI 插件随启动加载,无热重载。构建或更新后请重启 `opencode`。
72
-
73
- ## 使用
74
-
75
- | 操作 | 效果 |
76
- | --- | --- |
77
- | 点击 `Skills` 标题 | 折叠 / 展开面板 |
78
- | 点击技能行 | 无操作(设计如此) |
79
- | 点击 `N hidden (show all)` | 恢复全部隐藏技能 |
80
- | `/skills-status` | 对话框列出全部未隐藏技能与 `Loaded` / `Unloaded` 状态,已加载在前 |
81
- | `/hide-skills` | 对话框隐藏 / 恢复个别技能,支持搜索 |
82
-
83
- 说明:
84
-
85
- - `/skills-status` 反映当前打开的会话,需先打开会话。
86
- - 折叠摘要中 `X` 为未隐藏的已加载数,`Y` 为发现的全部技能数,`Z` 为隐藏数。
87
- - 斜杠命令(`/某技能`)加载的技能,正文注入会话后即计为已加载。
88
-
89
- ## 工作原理
90
-
91
- - 通过 OpenCode TUI 插件 API(`@opencode-ai/plugin/tui`)注册 `sidebar_content` 插槽,`order: 250`(位于内置 `MCP` 200 与 `LSP` 300 之间)
92
- - 技能发现来自 `client.app.skills()`;已加载集合按会话维护
93
- - 加载检测按消息水位线增量扫描;技能列表刷新时重扫(正文匹配依赖列表)
94
- - 刷新来源:`message.part.updated`、`message.updated`、`session.updated`(增量),`session.created`、`project.updated`、`workspace.ready`、`worktree.ready`(重取技能列表),外加启动 250ms 重试与打开会话后 500ms 兜底重扫
95
- - 仅在散文里引用字面 `<skill_content>` 标签(如 assistant 消息)不计为加载:标签命中必须对应已知技能名
96
-
97
- ## 故障排查
98
-
99
- - **没有 `Skills` 区块**:检查 `tui.json` 路径为绝对路径且正确,然后重启。`opencode --pure` 会跳过所有外部插件。
100
- - **加载了技能但显示未加载**:斜杠命令加载按注入正文匹配,需技能列表先就绪;会自动回填。折叠再展开面板或切换会话可立即触发重扫。
101
- - **更新插件后无变化**:TUI 插件随启动加载,重启 `opencode`。
102
-
103
- ## 开发
104
-
105
- ```bash
106
- bun run build # 打包到 dist/tui.js + 声明
107
- bun run typecheck # tsc --noEmit
108
- ```
109
-
110
- 源码结构:
111
-
112
- - `src/tui.tsx` — 插件入口:插槽注册、事件接线、按会话加载跟踪、kv 持久化
113
- - `src/skill-data.ts` — 技能发现、加载检测(工具 part / 标签 / 正文匹配)、增量扫描、加载优先排序
114
- - `src/components/skills-panel.tsx` — 侧边栏面板渲染
115
- - `src/components/skills-status-dialog.tsx` — `/skills-status` 对话框
116
- - `src/components/skills-filter-dialog.tsx` — `/hide-skills` 对话框
117
-
118
- ## 许可证
119
-
120
- [MIT](LICENSE) — npm 包名为 [`opencode-skill-tracker-tui`](https://www.npmjs.com/package/opencode-skill-tracker-tui)。
1
+ # opencode-skill-tracker
2
+
3
+ [English](README.md) | 简体中文
4
+
5
+ 一个 [OpenCode](https://opencode.ai) TUI 插件:在右侧边栏增加 `Skills` 区块,按会话列出 OpenCode 可见的全部技能,已加载的高亮并排在最前,还可隐藏个别技能。
6
+
7
+ 原 `opencode-skills-sidebar`,已保存状态(折叠 / 隐藏列表)自动迁移。
8
+
9
+ ## 功能
10
+
11
+ - 会话侧边栏 `Skills` 区块,技能发现来自 OpenCode 本体(`client.app.skills()`),去重后按名称排序
12
+ - 按会话跟踪加载状态,三路检测:`skill` 工具 part(`input.name`)、opencode 注入的 `<skill_content name="...">` 标签 text part、TUI 斜杠命令展开(技能正文以纯文本用户消息注入,按已知技能正文匹配)
13
+ - 已加载技能绿色圆点高亮并置顶,侧栏与 `/skills-status` 一致
14
+ - 面板头可折叠,实时摘要 `(X loaded Y available)`(有隐藏技能时追加 `+Z`)
15
+ - `/hide-skills` 对话框可隐藏个别技能;`Show all hidden` 一步恢复全部,侧栏 `N hidden (show all)` 页脚点击同效
16
+ - 折叠状态与隐藏列表跨重启持久化(插件 kv),并从旧 `opencode-skills-sidebar` 键自动迁移
17
+ - 按会话增量扫描(消息水位线),长会话不重复全量重扫
18
+
19
+ ## 环境要求
20
+
21
+ - 支持 TUI 插件(`slots.sidebar_content`)的 OpenCode
22
+ - 从源码构建需要 [Bun](https://bun.sh)
23
+
24
+ ## 安装
25
+
26
+ 这是 **TUI 插件**,必须配置在 `~/.config/opencode/tui.json`,不是 `opencode.json`。
27
+
28
+ ### 方式一:npm 安装(推荐)
29
+
30
+ `~/.config/opencode/tui.json` 中写入包名:
31
+
32
+ ```json
33
+ {
34
+ "$schema": "https://opencode.ai/tui.json",
35
+ "plugin": [
36
+ "opencode-skill-tracker-tui"
37
+ ]
38
+ }
39
+ ```
40
+
41
+ 无需手动安装——OpenCode 启动时会用 Bun 自动安装 npm 插件(缓存在 `~/.cache/opencode/node_modules/`)。
42
+
43
+ ### 方式二:源码构建
44
+
45
+ ```bash
46
+ git clone https://github.com/aihaipeng/opencode-skill-tracker.git
47
+ cd opencode-skill-tracker
48
+ bun install
49
+ bun run build
50
+ ```
51
+
52
+ 产出 `dist/tui.js`。在 `~/.config/opencode/tui.json` 中注册其绝对路径:
53
+
54
+ ```json
55
+ {
56
+ "$schema": "https://opencode.ai/tui.json",
57
+ "plugin": [
58
+ "C:\\path\\to\\opencode-skill-tracker\\dist\\tui.js"
59
+ ]
60
+ }
61
+ ```
62
+
63
+ `plugin` 数组可同时装多个插件,保留已有条目即可。
64
+
65
+ ### 重启 OpenCode
66
+
67
+ TUI 插件随启动加载,无热重载。安装或更新后请重启 `opencode`。
68
+
69
+ ## 使用
70
+
71
+ | 操作 | 效果 |
72
+ | --- | --- |
73
+ | 点击 `Skills` 标题 | 折叠 / 展开面板 |
74
+ | 点击技能行 | 无操作(设计如此) |
75
+ | 点击 `N hidden (show all)` | 恢复全部隐藏技能 |
76
+ | `/skills-status` | 对话框列出全部未隐藏技能与 `Loaded` / `Unloaded` 状态,已加载在前 |
77
+ | `/hide-skills` | 对话框隐藏 / 恢复个别技能,支持搜索 |
78
+
79
+ 说明:
80
+
81
+ - `/skills-status` 反映当前打开的会话,需先打开会话。
82
+ - 折叠摘要中 `X` 为未隐藏的已加载数,`Y` 为发现的全部技能数,`Z` 为隐藏数。
83
+ - 斜杠命令(`/某技能`)加载的技能,正文注入会话后即计为已加载。
84
+
85
+ ## 工作原理
86
+
87
+ - 通过 OpenCode TUI 插件 API(`@opencode-ai/plugin/tui`)注册 `sidebar_content` 插槽,`order: 250`(位于内置 `MCP` 200 与 `LSP` 300 之间)
88
+ - 技能发现来自 `client.app.skills()`;已加载集合按会话维护
89
+ - 加载检测按消息水位线增量扫描;技能列表刷新时重扫(正文匹配依赖列表)
90
+ - 刷新来源:`message.part.updated`、`message.updated`、`session.updated`(增量),`session.created`、`project.updated`、`workspace.ready`、`worktree.ready`(重取技能列表),外加启动 250ms 重试与打开会话后 500ms 兜底重扫
91
+ - 仅在散文里引用字面 `<skill_content>` 标签(如 assistant 消息)不计为加载:标签命中必须对应已知技能名
92
+
93
+ ## 故障排查
94
+
95
+ - **没有 `Skills` 区块**:检查 `tui.json` 路径为绝对路径且正确,然后重启。`opencode --pure` 会跳过所有外部插件。
96
+ - **加载了技能但显示未加载**:斜杠命令加载按注入正文匹配,需技能列表先就绪;会自动回填。折叠再展开面板或切换会话可立即触发重扫。
97
+ - **更新插件后无变化**:TUI 插件随启动加载,重启 `opencode`。
98
+
99
+ ## 开发
100
+
101
+ ```bash
102
+ bun run build # 打包到 dist/tui.js + 声明
103
+ bun run typecheck # tsc --noEmit
104
+ ```
105
+
106
+ 源码结构:
107
+
108
+ - `src/tui.tsx` — 插件入口:插槽注册、事件接线、按会话加载跟踪、kv 持久化
109
+ - `src/skill-data.ts` — 技能发现、加载检测(工具 part / 标签 / 正文匹配)、增量扫描、加载优先排序
110
+ - `src/components/skills-panel.tsx` — 侧边栏面板渲染
111
+ - `src/components/skills-status-dialog.tsx` — `/skills-status` 对话框
112
+ - `src/components/skills-filter-dialog.tsx` — `/hide-skills` 对话框
113
+
114
+ ## 许可证
115
+
116
+ [MIT](LICENSE) — npm 包名为 [`opencode-skill-tracker-tui`](https://www.npmjs.com/package/opencode-skill-tracker-tui)。
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "opencode-skill-tracker-tui",
3
- "version": "0.1.0",
4
- "description": "OpenCode TUI plugin that shows skills and loaded state in the sidebar",
5
- "type": "module",
6
- "license": "MIT",
7
- "author": "aihaipeng",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/aihaipeng/opencode-skill-tracker.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/aihaipeng/opencode-skill-tracker/issues"
14
- },
15
- "homepage": "https://github.com/aihaipeng/opencode-skill-tracker#readme",
16
- "keywords": [
17
- "opencode",
18
- "opencode-plugin",
19
- "tui",
20
- "skills",
21
- "sidebar"
22
- ],
23
- "files": [
24
- "dist"
25
- ],
26
- "exports": {
27
- ".": {
28
- "import": "./dist/tui.js",
29
- "types": "./dist/tui.d.ts"
30
- },
31
- "./tui": {
32
- "import": "./dist/tui.js",
33
- "types": "./dist/tui.d.ts"
34
- }
35
- },
36
- "scripts": {
37
- "build": "bun run scripts/build.mjs && tsc --emitDeclarationOnly",
38
- "typecheck": "tsc --noEmit",
39
- "prepare": "bun run build"
40
- },
41
- "dependencies": {
42
- "@opencode-ai/plugin": "^1.14.29",
43
- "@opentui/core": "^0.1.105",
44
- "@opentui/solid": "^0.1.105",
45
- "solid-js": "^1.9.11"
46
- },
47
- "devDependencies": {
48
- "typescript": "^5.8.2"
49
- }
50
- }
1
+ {
2
+ "name": "opencode-skill-tracker-tui",
3
+ "version": "0.1.1",
4
+ "description": "OpenCode TUI plugin that shows skills and loaded state in the sidebar",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "aihaipeng",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/aihaipeng/opencode-skill-tracker.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/aihaipeng/opencode-skill-tracker/issues"
14
+ },
15
+ "homepage": "https://github.com/aihaipeng/opencode-skill-tracker#readme",
16
+ "keywords": [
17
+ "opencode",
18
+ "opencode-plugin",
19
+ "tui",
20
+ "skills",
21
+ "sidebar"
22
+ ],
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "exports": {
27
+ ".": {
28
+ "import": "./dist/tui.js",
29
+ "types": "./dist/tui.d.ts"
30
+ },
31
+ "./tui": {
32
+ "import": "./dist/tui.js",
33
+ "types": "./dist/tui.d.ts"
34
+ }
35
+ },
36
+ "scripts": {
37
+ "build": "bun run scripts/build.mjs && tsc --emitDeclarationOnly",
38
+ "typecheck": "tsc --noEmit",
39
+ "prepare": "bun run build"
40
+ },
41
+ "dependencies": {
42
+ "@opencode-ai/plugin": "^1.14.29",
43
+ "@opentui/core": "^0.1.105",
44
+ "@opentui/solid": "^0.1.105",
45
+ "solid-js": "^1.9.11"
46
+ },
47
+ "devDependencies": {
48
+ "typescript": "^5.8.2"
49
+ }
50
+ }