MCPcopy Create free account
hub / github.com/anomalyco/opencode / fmt

Function fmt

packages/opencode/src/skill/index.ts:321–346  ·  view source on GitHub ↗
(list: Info[], opts: { verbose: boolean })

Source from the content-addressed store, hash-verified

319)
320
321export function fmt(list: Info[], opts: { verbose: boolean }) {
322 const described = list.filter((skill) => skill.description !== undefined)
323 if (described.length === 0) return "No skills are currently available."
324 if (opts.verbose) {
325 return [
326 "<available_skills>",
327 ...described
328 .toSorted((a, b) => a.name.localeCompare(b.name))
329 .flatMap((skill) => [
330 " <skill>",
331 ` <name>${skill.name}</name>`,
332 ` <description>${skill.description}</description>`,
333 ` <location>${escapeHtml(skill.location)}</location>`,
334 " </skill>",
335 ]),
336 "</available_skills>",
337 ].join("\n")
338 }
339
340 return [
341 "## Available Skills",
342 ...described
343 .toSorted((a, b) => a.name.localeCompare(b.name))
344 .map((skill) => `- **${skill.name}**: ${skill.description}`),
345 ].join("\n")
346}
347
348export const node = LayerNode.make({
349 service: Service,

Callers

nothing calls this directly

Calls 1

escapeHtmlFunction · 0.90

Tested by

no test coverage detected