Skip to content

Commit 4fc0b2f

Browse files
committed
refactor: update skill installation commands to use pnpm
- Changed all instances of 'npx' to 'pnpm dlx' for skill installation commands in tests and workflow functions. - Updated viewport height calculation in EditorLayout to use the correct variable. - Simplified runtime state initialization in SkillsInterface by using a constant for skill IDs.
1 parent 2728264 commit 4fc0b2f

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed

__tests__/skills-workflow.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ describe('skills workflow', () => {
1111
it('seeds the bundled catalog with superpowers plus find-skills', () => {
1212
expect(SKILLS_CATALOG).toHaveLength(15)
1313
expect(getSkillBySlug('brainstorming')?.installCommand).toBe(
14-
'npx skills add https://github.com/obra/superpowers --skill brainstorming -g -y',
14+
'pnpm dlx skills add https://github.com/obra/superpowers --skill brainstorming -g -y',
1515
)
1616
expect(getSkillBySlug('find-skills')?.installCommand).toBe(
17-
'npx skills add https://github.com/vercel-labs/skills --skill find-skills -g -y',
17+
'pnpm dlx skills add https://github.com/vercel-labs/skills --skill find-skills -g -y',
1818
)
1919
})
2020

2121
it('quotes ecosystem search queries for shell execution', () => {
22-
expect(buildSkillsFindCommand('react performance')).toBe("npx skills find 'react performance'")
22+
expect(buildSkillsFindCommand('react performance')).toBe(
23+
"pnpm dlx skills find 'react performance'",
24+
)
2325
expect(buildSkillsFindCommand("author's workflow")).toBe(
24-
"npx skills find 'author'\\''s workflow'",
26+
"pnpm dlx skills find 'author'\\''s workflow'",
2527
)
2628
})
2729

@@ -52,15 +54,16 @@ describe('skills workflow', () => {
5254
expect(installPlan).toMatchObject({
5355
kind: 'install',
5456
target: 'terminal',
55-
command: 'npx skills add https://github.com/obra/superpowers --skill brainstorming -g -y',
57+
command:
58+
'pnpm dlx skills add https://github.com/obra/superpowers --skill brainstorming -g -y',
5659
})
5760

5861
const findPlan = buildExecutionPlan(
5962
{ kind: 'find', query: 'react performance' },
6063
{ preferTerminal: false },
6164
)
6265
expect(findPlan?.target).toBe('gateway-chat')
63-
expect(findPlan?.message).toContain("npx skills find 'react performance'")
66+
expect(findPlan?.message).toContain("pnpm dlx skills find 'react performance'")
6467
})
6568

6669
it('hydrates runtime state with defaults for every bundled skill', () => {

app/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export default function EditorLayout() {
120120
const terminalVisible = layout.isVisible('terminal')
121121
const terminalHeight = layout.getSize('terminal')
122122
const terminalFloating = layout.isFloating('terminal')
123+
const viewportHeight = layout.viewport.height
123124
const terminalRefreshToken = mode
124125
const terminalStartupCommand = modeSpec.terminalCenter ? 'openclaw tui' : undefined
125126

@@ -654,7 +655,7 @@ export default function EditorLayout() {
654655
{
655656
'--height': Math.min(
656657
Math.max(terminalHeight, 260),
657-
Math.floor(window.innerHeight * 0.72),
658+
Math.floor(viewportHeight * 0.72),
658659
),
659660
} as React.CSSProperties
660661
}

components/skills/skills-interface.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import {
2626
parseSkillSlashCommand,
2727
} from '@/lib/skills/workflow'
2828

29+
const SKILL_IDS = SKILLS_CATALOG.map((skill) => skill.id)
30+
2931
interface SkillsInterfaceProps {
3032
variant?: 'page' | 'settings'
3133
}
@@ -53,10 +55,7 @@ export function SkillsInterface({ variant = 'page' }: SkillsInterfaceProps) {
5355
const [actionNote, setActionNote] = useState<string | null>(null)
5456
const [busyAction, setBusyAction] = useState<string | null>(null)
5557
const [runtimeState, setRuntimeState] = useState<SkillsRuntimeMap>(() =>
56-
mergeRuntimeState(
57-
SKILLS_CATALOG.map((skill) => skill.id),
58-
loadStoredRuntimeState(),
59-
),
58+
mergeRuntimeState(SKILL_IDS, loadStoredRuntimeState()),
6059
)
6160
const [composer, setComposer] = useState<{ skillId: string | null; request: string }>({
6261
skillId: null,
@@ -70,12 +69,7 @@ export function SkillsInterface({ variant = 'page' }: SkillsInterfaceProps) {
7069
}, [runtimeState])
7170

7271
const refreshState = useCallback(() => {
73-
setRuntimeState(
74-
mergeRuntimeState(
75-
SKILLS_CATALOG.map((skill) => skill.id),
76-
loadStoredRuntimeState(),
77-
),
78-
)
72+
setRuntimeState(mergeRuntimeState(SKILL_IDS, loadStoredRuntimeState()))
7973
setActionNote('Refreshed local skill state.')
8074
}, [])
8175

lib/skills/catalog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const VERCEL_SKILLS_REPO_URL = 'https://github.com/vercel-labs/skills'
66
const VERCEL_SKILLS_PAGE_URL = 'https://skills.sh/vercel-labs/skills'
77

88
function buildRepoInstallCommand(repoUrl: string, skillSlug: string): string {
9-
return `npx skills add ${repoUrl} --skill ${skillSlug} -g -y`
9+
return `pnpm dlx skills add ${repoUrl} --skill ${skillSlug} -g -y`
1010
}
1111

1212
function superpower(

lib/skills/workflow.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {
88
} from '@/lib/skills/types'
99

1010
export const SKILLS_RUNTIME_STORAGE_KEY = 'knot-code:skills:runtime'
11+
const SKILLS_CLI = 'pnpm dlx skills'
1112

1213
function escapeSingleQuotes(value: string): string {
1314
return value.replace(/'/g, `'\\''`)
@@ -19,15 +20,15 @@ export function shellQuote(value: string): string {
1920
}
2021

2122
export function buildSkillsFindCommand(query: string): string {
22-
return `npx skills find ${shellQuote(query.trim())}`
23+
return `${SKILLS_CLI} find ${shellQuote(query.trim())}`
2324
}
2425

2526
export function buildSkillsCheckCommand(): string {
26-
return 'npx skills check'
27+
return `${SKILLS_CLI} check`
2728
}
2829

2930
export function buildSkillsUpdateCommand(): string {
30-
return 'npx skills update'
31+
return `${SKILLS_CLI} update`
3132
}
3233

3334
export function buildSkillInstallCommand(skill: SkillCatalogItem): string {

0 commit comments

Comments
 (0)