Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"dependencies": {
"chalk": "^5",
"commander": "^13",
"gray-matter": "^4"
"gray-matter": "^4",
"wrap-ansi": "^9.0.2"
}
}
3 changes: 2 additions & 1 deletion src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import chalk from 'chalk'
import { findSkill, discoverSkills } from '../skills.ts'
import { resolveAgents } from '../agents.ts'
import { installSkill } from '../installer.ts'
import { wrapText } from '../format.ts'

export function addCommand(
skillNames: string[],
Expand Down Expand Up @@ -57,7 +58,7 @@ export function addCommand(

console.log()
console.log(` ${chalk.bold('Installing:')} ${skill.name}`)
console.log(` ${chalk.dim('→')} ${skill.description}`)
console.log(wrapText(`${chalk.dim('→')} ${skill.description}`, 4))
console.log()

for (const agent of targetAgents) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/info.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import chalk from 'chalk'
import { findSkill } from '../skills.ts'
import { wrapText } from '../format.ts'

export function infoCommand(skillName: string): void {
const skill = findSkill(skillName)
Expand All @@ -15,7 +16,7 @@ export function infoCommand(skillName: string): void {
console.log()
console.log(chalk.bold(skill.name))
console.log()
console.log(` ${skill.description}`)
console.log(wrapText(skill.description, 2))
console.log()

if (skill.metadata) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export function listCommand(): void {
const maxNameLen = Math.max(...skills.map((s) => s.name.length))
const indent = 2
const gap = 2
const maxDescLen = 80 - indent - maxNameLen - gap
const termWidth = process.stdout.columns || 80
const maxDescLen = termWidth - indent - maxNameLen - gap

for (const skill of skills) {
const name = chalk.cyan(skill.name.padEnd(maxNameLen + gap))
Expand Down
12 changes: 12 additions & 0 deletions src/format.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import wrapAnsi from 'wrap-ansi'

export function wrapText(text: string, indent: number): string {
const columns = process.stdout.columns || 80
const width = Math.max(columns - indent, 20)
const wrapped = wrapAnsi(text, width, { hard: true })
const pad = ' '.repeat(indent)
return wrapped
.split('\n')
.map((line) => `${pad}${line}`)
.join('\n')
}