@nt-ai-lab/opencode-skillz 0.2.5 → 0.2.6

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 (2) hide show
  1. package/index.js +20 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -97,6 +97,25 @@ function loadAgents(commands) {
97
97
 
98
98
  const agents = {}
99
99
 
100
+ function collectPreloadedCommands(agentName, stack = new Set()) {
101
+ const rawAgent = rawAgents[agentName]
102
+ if (!rawAgent) return []
103
+ if (stack.has(agentName)) return parseCsvList(rawAgent.meta.preload_commands)
104
+
105
+ stack.add(agentName)
106
+
107
+ const merged = []
108
+ const parentAgentName = typeof rawAgent.meta.extends === "string" ? rawAgent.meta.extends.trim() : ""
109
+ if (parentAgentName && rawAgents[parentAgentName]) {
110
+ merged.push(...collectPreloadedCommands(parentAgentName, stack))
111
+ }
112
+
113
+ merged.push(...parseCsvList(rawAgent.meta.preload_commands))
114
+ stack.delete(agentName)
115
+
116
+ return [...new Set(merged)]
117
+ }
118
+
100
119
  for (const [name, raw] of Object.entries(rawAgents)) {
101
120
  const { meta, body } = raw
102
121
  const promptParts = []
@@ -111,7 +130,7 @@ function loadAgents(commands) {
111
130
  promptParts.push(body)
112
131
  }
113
132
 
114
- const preloadedCommands = parseCsvList(meta.preload_commands)
133
+ const preloadedCommands = collectPreloadedCommands(name)
115
134
  for (const commandName of preloadedCommands) {
116
135
  const command = commands[commandName]
117
136
  if (!command || !command.template) continue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nt-ai-lab/opencode-skillz",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Bundled OpenCode commands and agents",
5
5
  "type": "module",
6
6
  "main": "index.js",