opencode-skills-tracker-plugin 1.0.0

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 -0
  2. package/README.md +36 -0
  3. package/package.json +40 -0
  4. package/tui.tsx +130 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 neoty
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 ADDED
@@ -0,0 +1,36 @@
1
+ # opencode-skills-tracker-plugin
2
+
3
+ An [OpenCode](https://opencode.ai) TUI plugin that displays loaded skills with their load timestamps in the sidebar footer.
4
+
5
+ It watches the current session's tool calls for `skill` invocations and lists each skill that has been loaded, along with the time it was last loaded — so you always know which skills are active in your session.
6
+
7
+ ## Features
8
+
9
+ - Shows every skill loaded in the current session in the sidebar
10
+ - Displays the last load time (`HH:MM:SS`) for each skill
11
+ - Collapsible section — click the `Skills` header to toggle
12
+ - Auto-refreshes every 2 seconds
13
+
14
+ ## Installation
15
+
16
+ Add the plugin to your OpenCode config (`opencode.json`):
17
+
18
+ ```json
19
+ {
20
+ "$schema": "https://opencode.ai/config.json",
21
+ "plugin": ["opencode-skills-tracker-plugin"]
22
+ }
23
+ ```
24
+
25
+ OpenCode installs the package from npm automatically on next launch.
26
+
27
+ ## How it works
28
+
29
+ The plugin registers a `sidebar_content` slot and scans the active session's
30
+ message parts for completed/running `skill` tool calls. For each unique skill
31
+ name it records the most recent start time and renders the list, sorted by most
32
+ recently loaded.
33
+
34
+ ## License
35
+
36
+ [MIT](./LICENSE)
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "name": "opencode-skills-tracker-plugin",
4
+ "version": "1.0.0",
5
+ "description": "An OpenCode TUI plugin that displays loaded skills with their load timestamps in the sidebar footer.",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "exports": {
9
+ "./tui": {
10
+ "default": "./tui.tsx"
11
+ }
12
+ },
13
+ "files": [
14
+ "tui.tsx",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "sideEffects": false,
19
+ "scripts": {
20
+ "typecheck": "tsc -p tsconfig.json --noEmit"
21
+ },
22
+ "keywords": [
23
+ "opencode",
24
+ "plugin",
25
+ "tui",
26
+ "skills",
27
+ "tracker"
28
+ ],
29
+ "dependencies": {
30
+ "@opentui/solid": "^0.2.6",
31
+ "solid-js": "^1.9.12"
32
+ },
33
+ "devDependencies": {
34
+ "@opencode-ai/plugin": "1.14.46",
35
+ "@opentui/solid": "0.2.6",
36
+ "@types/node": "24.12.2",
37
+ "solid-js": "1.9.12",
38
+ "typescript": "6.0.3"
39
+ }
40
+ }
package/tui.tsx ADDED
@@ -0,0 +1,130 @@
1
+ /** @jsxImportSource @opentui/solid */
2
+
3
+ import type { TuiPlugin, TuiPluginApi, TuiPluginModule } from "@opencode-ai/plugin/tui"
4
+ import type { Part } from "@opencode-ai/sdk/v2"
5
+ import { createSignal, For, onCleanup, Show } from "solid-js"
6
+
7
+ const PLUGIN_ID = "opencode-skills-tracker-plugin"
8
+
9
+ type TrackedSkill = {
10
+ name: string
11
+ loadedAt: number
12
+ }
13
+
14
+ const formatTime = (timestamp: number): string => {
15
+ const date = new Date(timestamp)
16
+ const hours = date.getHours().toString().padStart(2, "0")
17
+ const minutes = date.getMinutes().toString().padStart(2, "0")
18
+ const seconds = date.getSeconds().toString().padStart(2, "0")
19
+ return `${hours}:${minutes}:${seconds}`
20
+ }
21
+
22
+ const SkillsTracker = (props: { api: TuiPluginApi; sessionID: string }) => {
23
+ const [skills, setSkills] = createSignal<TrackedSkill[]>([])
24
+ const [collapsed, setCollapsed] = createSignal(false)
25
+
26
+ const extractSkillName = (part: Part): string | undefined => {
27
+ if (part.type !== "tool") return undefined
28
+ const state = part.state
29
+ if ("input" in state && state.input && typeof state.input === "object") {
30
+ const input = state.input as Record<string, unknown>
31
+ if (typeof input["name"] === "string") {
32
+ return input["name"]
33
+ }
34
+ }
35
+ return undefined
36
+ }
37
+
38
+ const getPartTimestamp = (part: Part): number => {
39
+ if (part.type !== "tool") return 0
40
+ const state = part.state
41
+ if (state.status === "completed" || state.status === "running" || state.status === "error") {
42
+ return state.time.start
43
+ }
44
+ return Date.now()
45
+ }
46
+
47
+ const processPartsForSkills = () => {
48
+ const messages = props.api.state.session.messages(props.sessionID)
49
+ const seen = new Map<string, number>()
50
+
51
+ for (const message of messages) {
52
+ const parts = props.api.state.part(message.id)
53
+ for (const part of parts) {
54
+ if (part.type === "tool" && part.tool === "skill") {
55
+ const skillName = extractSkillName(part)
56
+ if (skillName) {
57
+ const time = getPartTimestamp(part)
58
+ const existing = seen.get(skillName)
59
+ if (!existing || time > existing) {
60
+ seen.set(skillName, time)
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ const tracked: TrackedSkill[] = []
68
+ for (const [name, loadedAt] of seen) {
69
+ tracked.push({ name, loadedAt })
70
+ }
71
+ tracked.sort((a, b) => b.loadedAt - a.loadedAt)
72
+ setSkills(tracked)
73
+ }
74
+
75
+ const interval = setInterval(() => {
76
+ processPartsForSkills()
77
+ props.api.renderer.requestRender()
78
+ }, 2000)
79
+ processPartsForSkills()
80
+
81
+ onCleanup(() => {
82
+ clearInterval(interval)
83
+ })
84
+
85
+ const toggle = () => {
86
+ setCollapsed((v) => !v)
87
+ props.api.renderer.requestRender()
88
+ }
89
+
90
+ return (
91
+ <box flexDirection="column" gap={0} flexShrink={0}>
92
+ <box flexDirection="row" gap={0} onClick={toggle}>
93
+ <text fg={props.api.theme.current.text} bold>
94
+ {collapsed() ? "▶ " : "▼ "}
95
+ </text>
96
+ <text fg={props.api.theme.current.text} bold>{"Skills"}</text>
97
+ </box>
98
+ <Show when={!collapsed()}>
99
+ <For each={skills()}>
100
+ {(skill) => (
101
+ <box flexDirection="row" gap={1}>
102
+ <text fg={props.api.theme.current.accent}>{"• " + skill.name}</text>
103
+ <text fg={props.api.theme.current.textMuted}>{formatTime(skill.loadedAt)}</text>
104
+ </box>
105
+ )}
106
+ </For>
107
+ {skills().length === 0 && (
108
+ <text fg={props.api.theme.current.textMuted}>{" no skills loaded"}</text>
109
+ )}
110
+ </Show>
111
+ </box>
112
+ )
113
+ }
114
+
115
+ const tui: TuiPlugin = async (api) => {
116
+ api.slots.register({
117
+ slots: {
118
+ sidebar_content(_ctx, props) {
119
+ return <SkillsTracker api={api} sessionID={props.session_id} />
120
+ },
121
+ },
122
+ })
123
+ }
124
+
125
+ const plugin: TuiPluginModule = {
126
+ id: PLUGIN_ID,
127
+ tui,
128
+ }
129
+
130
+ export default plugin