(list: Info[], opts: { verbose: boolean })
| 319 | ) |
| 320 | |
| 321 | export 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 | |
| 348 | export const node = LayerNode.make({ |
| 349 | service: Service, |
nothing calls this directly
no test coverage detected