Skip to content

Commit b4c0027

Browse files
authored
chore(cli): support "install --skills=agents" (#39842)
1 parent fb0cb45 commit b4c0027

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

packages/playwright-core/src/tools/cli-client/program.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,10 @@ async function install(args: MinimistArgs) {
209209
await fs.promises.mkdir(playwrightDir, { recursive: true });
210210
console.log(`✅ Workspace initialized at \`${cwd}\`.`);
211211

212-
if (args.skills) {
212+
if (args.skills !== undefined) {
213+
const target = args.skills === 'agents' ? 'agents' : 'claude';
213214
const skillSourceDir = path.join(__dirname, 'skill');
214-
const skillDestDir = path.join(cwd, '.claude', 'skills', 'playwright-cli');
215+
const skillDestDir = path.join(cwd, `.${target}`, 'skills', 'playwright-cli');
215216

216217
if (!fs.existsSync(skillSourceDir)) {
217218
console.error('❌ Skills source directory not found:', skillSourceDir);

packages/playwright-core/src/tools/cli-daemon/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ const install = declareCommand({
904904
category: 'install',
905905
args: z.object({}),
906906
options: z.object({
907-
skills: z.boolean().optional().describe('Install skills for Claude / GitHub Copilot'),
907+
skills: z.string().optional().describe('Install skills to ".claude" (default) or ".agents" dir'),
908908
}),
909909
toolName: '',
910910
toolParams: () => ({}),

tests/mcp/cli-misc.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ test('install workspace w/skills', async ({ cli }, testInfo) => {
5252
expect(references.length).toBeGreaterThan(0);
5353
});
5454

55+
test('install workspace w/--skills=agents', async ({ cli }, testInfo) => {
56+
const { output } = await cli('install', '--skills=agents');
57+
expect(output).toContain(`Skills installed to \`.agents${path.sep}skills${path.sep}playwright-cli\`.`);
58+
59+
const skillFile = testInfo.outputPath('.agents', 'skills', 'playwright-cli', 'SKILL.md');
60+
expect(fs.existsSync(skillFile)).toBe(true);
61+
});
62+
5563
test('install handles browser detection', async ({ cli }) => {
5664
const { output } = await cli('install');
5765
// Verify that one of the browser detection outcomes occurred

0 commit comments

Comments
 (0)