opencode-idea 0.0.22 → 0.0.24

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.
@@ -22,11 +22,14 @@
22
22
  // The frontmatter reader below handles only the flat `key: value` form this
23
23
  // package writes. It is not a YAML engine and must not grow into one.
24
24
  //
25
- // One frontmatter key is the loader's own rather than OpenCode's: `requires`, a
26
- // comma-separated list of the tools the skill is written around. It is read here
27
- // and deliberately kept OUT of the registered definition — the caller filters on
28
- // it instead (see `readSkills`), because a skill whose tools are absent must not
29
- // be registered at all.
25
+ // The skills used to carry a `requires:` key (the tools each one is written
26
+ // around), and the plugin registered a skill only when those tools were being
27
+ // served. That gate is gone, together with the key: skills are registered once,
28
+ // when the plugin loads (see `plugin.js`), and a missing tool is handled inside
29
+ // the skill text. Registering only after the tools appeared made the skill
30
+ // invisible until the client reloaded the page. A key left behind would look
31
+ // like it still decided something — it does not: OpenCode never reads it, and
32
+ // nothing in this package does either.
30
33
  //
31
34
  // The other key is OpenCode's own, written in the portable frontmatter spelling
32
35
  // OpenCode documents: a nested `metadata:` block holding
@@ -80,20 +83,6 @@ export function parseSkillFrontmatter(text, source) {
80
83
  return fields;
81
84
  }
82
85
 
83
- /**
84
- * Split a frontmatter list value: `a, b` -> `['a', 'b']`.
85
- *
86
- * @param {string | undefined} value
87
- * @returns {string[]}
88
- */
89
- function splitList(value) {
90
- if (!value) return [];
91
- return value
92
- .split(',')
93
- .map((entry) => entry.trim())
94
- .filter((entry) => entry !== '');
95
- }
96
-
97
86
  /**
98
87
  * Read `opencode/autoinvoke` out of the frontmatter, or `undefined` when absent.
99
88
  *
@@ -131,11 +120,10 @@ export function readSkill(id) {
131
120
  }
132
121
 
133
122
  /**
134
- * A skill plus the tools it needs before it is worth offering.
123
+ * One skill package.
135
124
  *
136
- * The two are kept apart on purpose: `skill` must satisfy `Skill.Info` exactly,
137
- * while `requires` is this package's own metadata and must NOT be registered —
138
- * it is what the caller filters on.
125
+ * `skill` must satisfy `Skill.Info` exactly — nothing of this package's own
126
+ * metadata rides along into the definition OpenCode validates.
139
127
  *
140
128
  * `autoinvoke` is OpenCode's, so it goes the other way: it ships in the
141
129
  * frontmatter as `opencode/autoinvoke` and is translated onto the definition,
@@ -143,7 +131,7 @@ export function readSkill(id) {
143
131
  * frontmatter asks for it, so a skill that says nothing keeps the plain shape.
144
132
  *
145
133
  * @param {string} id Directory name, used as the skill id.
146
- * @returns {{ skill: { id: string, name: string, description: string, autoinvoke?: boolean, path: string, content: string }, requires: string[] }}
134
+ * @returns {{ skill: { id: string, name: string, description: string, autoinvoke?: boolean, path: string, content: string } }}
147
135
  */
148
136
  export function readSkillPackage(id) {
149
137
  const file = new URL(`${id}/${SKILL_FILE_NAME}`, SKILLS_DIR);
@@ -164,14 +152,13 @@ export function readSkillPackage(id) {
164
152
  path: fileURLToPath(file),
165
153
  content: text.replace(FRONTMATTER, '').replace(/^\s+/, '').trimEnd(),
166
154
  },
167
- requires: splitList(fields.requires),
168
155
  };
169
156
  }
170
157
 
171
158
  /**
172
- * Every shipped skill, sorted by id, each with the tools it requires.
159
+ * Every shipped skill, sorted by id.
173
160
  *
174
- * @returns {Array<{ skill: { id: string, name: string, description: string, autoinvoke?: boolean, path: string, content: string }, requires: string[] }>}
161
+ * @returns {Array<{ skill: { id: string, name: string, description: string, autoinvoke?: boolean, path: string, content: string } }>}
175
162
  */
176
163
  export function readSkills() {
177
164
  return readdirSync(SKILLS_DIR, { withFileTypes: true })