Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(cli): wire acceptance skill into every detected harness dir (#19884)

AmAzing-d2c2163e588e
diff --git a/apps/cli/src/commands/acceptanceInstall.test.ts b/apps/cli/src/commands/acceptanceInstall.test.ts
index 42813f290e1..6273b0c019d 100644
--- a/apps/cli/src/commands/acceptanceInstall.test.ts
+++ b/apps/cli/src/commands/acceptanceInstall.test.ts
@@ -77,6 +77,37 @@ describe('acceptance skill installation', () => {
});
});
+ it('emits links[] plus the legacy link alias for the Claude result', async () => {
+ await mkdir(path.join(directory, '.claude'));
+ await mkdir(path.join(directory, '.roo'));
+
+ await run('install');
+
+ const result = JSON.parse(vi.mocked(console.log).mock.calls.at(-1)![0] as string);
+ expect(result.links).toEqual([
+ { kind: 'linked', link: '.claude/skills', target: '../.agents/skills' },
+ { kind: 'linked', link: '.roo/skills', target: '../.agents/skills' },
+ ]);
+ // Legacy alias keeps reporting the Claude wiring result, not links[0].
+ expect(result.link).toEqual({
+ kind: 'linked',
+ link: '.claude/skills',
+ target: '../.agents/skills',
+ });
+ });
+
+ it('emits link { kind: none } when no Claude signal exists', async () => {
+ await mkdir(path.join(directory, '.roo'));
+
+ await run('install');
+
+ const result = JSON.parse(vi.mocked(console.log).mock.calls.at(-1)![0] as string);
+ expect(result.link).toEqual({ kind: 'none' });
+ expect(result.links).toEqual([
+ { kind: 'linked', link: '.roo/skills', target: '../.agents/skills' },
+ ]);
+ });
+
it('leaves the existing skill and stale resources untouched when an update cannot download', async () => {
const skillDir = path.join(directory, '.agents/skills/acceptance');
await mkdir(skillDir, { recursive: true });
diff --git a/apps/cli/src/commands/acceptanceRun.ts b/apps/cli/src/commands/acceptanceRun.ts
index 9f25bcc8e37..69bc6ce48c7 100644
--- a/apps/cli/src/commands/acceptanceRun.ts
+++ b/apps/cli/src/commands/acceptanceRun.ts
@@ -127,7 +127,12 @@ async function installAction(options: InstallOptions): Promise<void> {
}
}
- const link = linkHarnessSkills(baseDir, bundle.identifier);
+ const links = linkHarnessSkills(baseDir, bundle.identifier);
+ // `link` predates `links` and stays as a compatibility alias for the Claude
+ // result β€” `install --json link` and `.link.kind` readers keep working.
+ const link: LinkResult = links.find((l) => 'link' in l && l.link.startsWith('.claude')) ?? {
+ kind: 'none',
+ };
// The skill is committed; its OUTPUT is not. Seed the artifact directory's own
// self-ignoring file now, so the first run's screenshots never land as
// untracked noise in a repo that has never heard of us.
@@ -137,6 +142,7 @@ async function installAction(options: InstallOptions): Promise<void> {
dir: skillDir,
ignored,
link,
+ links,
removed,
skill: bundle.identifier,
skipped,
@@ -158,27 +164,32 @@ async function installAction(options: InstallOptions): Promise<void> {
` ${written.length} written${skipped.length ? `, ${skipped.length} skipped` : ''}${removed.length ? `, ${removed.length} stale removed` : ''}`,
);
if (skipped.length > 0) console.log(pc.dim(` (skipped existing β€” pass --force to overwrite)`));
- printWiring(link);
+ printWiring(links);
}
-function printWiring(link: LinkResult): void {
+function printWiring(links: LinkResult[]): void {
const arrow = pc.dim(' ↳');
- switch (link.kind) {
- case 'linked':
- case 'linked-single': {
- console.log(`${arrow} linked ${link.link} β†’ ${pc.dim(link.target)}`);
- break;
- }
- case 'already': {
- console.log(`${arrow} ${pc.dim(`${link.link} already linked`)}`);
- break;
- }
- case 'skipped': {
- console.log(`${arrow} ${pc.yellow(`skipped ${link.link}: ${link.reason}`)}`);
- break;
- }
- default: {
- break;
+ for (const link of links) {
+ switch (link.kind) {
+ case 'linked':
+ case 'linked-single': {
+ console.log(`${arrow} linked ${link.link} β†’ ${pc.dim(link.target)}`);
+ break;
+ }
+ case 'already': {
+ console.log(`${arrow} ${pc.dim(`${link.link} already linked`)}`);
+ break;
+ }
+ case 'skipped': {
+ console.log(`${arrow} ${pc.yellow(`skipped ${link.link}: ${link.reason}`)}`);
+ break;
+ }
+ default: {
+ console.log(
+ `${arrow} ${pc.dim('no harness dirs detected β€” agents that read .agents/skills pick it up automatically')}`,
+ );
+ break;
+ }
}
}
}
diff --git a/apps/cli/src/utils/skillWiring.test.ts b/apps/cli/src/utils/skillWiring.test.ts
index 6df45da3df6..8e064e87fbc 100644
--- a/apps/cli/src/utils/skillWiring.test.ts
+++ b/apps/cli/src/utils/skillWiring.test.ts
@@ -47,8 +47,8 @@ describe('detectClaudeHarness', () => {
});
describe('linkHarnessSkills', () => {
- it('does nothing when no Claude harness is present', () => {
- expect(linkHarnessSkills(root, 'acceptance')).toEqual({ kind: 'none' });
+ it('does nothing when no harness is present', () => {
+ expect(linkHarnessSkills(root, 'acceptance')).toEqual([{ kind: 'none' }]);
expect(existsSync(path.join(root, '.claude'))).toBe(false);
});
@@ -57,11 +57,13 @@ describe('linkHarnessSkills', () => {
const result = linkHarnessSkills(root, 'acceptance');
- expect(result).toEqual({
- kind: 'linked',
- link: path.join('.claude', 'skills'),
- target: path.join('..', '.agents', 'skills'),
- });
+ expect(result).toEqual([
+ {
+ kind: 'linked',
+ link: path.join('.claude', 'skills'),
+ target: path.join('..', '.agents', 'skills'),
+ },
+ ]);
const link = path.join(root, '.claude', 'skills');
expect(lstatSync(link).isSymbolicLink()).toBe(true);
expect(readlinkSync(link)).toBe(path.join('..', '.agents', 'skills'));
@@ -71,10 +73,12 @@ describe('linkHarnessSkills', () => {
mkdirSync(path.join(root, '.claude'), { recursive: true });
symlinkSync(path.join('..', '.agents', 'skills'), path.join(root, '.claude', 'skills'), 'dir');
- expect(linkHarnessSkills(root, 'acceptance')).toEqual({
- kind: 'already',
- link: path.join('.claude', 'skills'),
- });
+ expect(linkHarnessSkills(root, 'acceptance')).toEqual([
+ {
+ kind: 'already',
+ link: path.join('.claude', 'skills'),
+ },
+ ]);
});
it('leaves a symlink pointing somewhere else alone', () => {
@@ -83,7 +87,7 @@ describe('linkHarnessSkills', () => {
const result = linkHarnessSkills(root, 'acceptance');
- expect(result.kind).toBe('skipped');
+ expect(result[0].kind).toBe('skipped');
expect(readlinkSync(path.join(root, '.claude', 'skills'))).toBe(path.join('..', 'elsewhere'));
});
@@ -92,13 +96,81 @@ describe('linkHarnessSkills', () => {
const result = linkHarnessSkills(root, 'acceptance');
- expect(result).toEqual({
- kind: 'linked-single',
- link: path.join('.claude', 'skills', 'acceptance'),
- target: path.join('..', '..', '.agents', 'skills', 'acceptance'),
- });
+ expect(result).toEqual([
+ {
+ kind: 'linked-single',
+ link: path.join('.claude', 'skills', 'acceptance'),
+ target: path.join('..', '..', '.agents', 'skills', 'acceptance'),
+ },
+ ]);
expect(existsSync(path.join(root, '.claude', 'skills', 'my-own-skill'))).toBe(true);
});
+
+ it.each(['.cursor', '.codex', '.roo', '.windsurf'])(
+ 'wires %s/skills when the harness dir exists',
+ (dir) => {
+ mkdirSync(path.join(root, dir), { recursive: true });
+
+ const result = linkHarnessSkills(root, 'acceptance');
+
+ expect(result).toEqual([
+ {
+ kind: 'linked',
+ link: path.join(dir, 'skills'),
+ target: path.join('..', '.agents', 'skills'),
+ },
+ ]);
+ expect(readlinkSync(path.join(root, dir, 'skills'))).toBe(
+ path.join('..', '.agents', 'skills'),
+ );
+ },
+ );
+
+ it('wires .opencode/skill (singular) for OpenCode', () => {
+ mkdirSync(path.join(root, '.opencode'), { recursive: true });
+
+ const result = linkHarnessSkills(root, 'acceptance');
+
+ expect(result).toEqual([
+ {
+ kind: 'linked',
+ link: path.join('.opencode', 'skill'),
+ target: path.join('..', '.agents', 'skills'),
+ },
+ ]);
+ expect(readlinkSync(path.join(root, '.opencode', 'skill'))).toBe(
+ path.join('..', '.agents', 'skills'),
+ );
+ });
+
+ it('detects GEMINI.md as a Gemini signal', () => {
+ writeFileSync(path.join(root, 'GEMINI.md'), '# project');
+
+ expect(linkHarnessSkills(root, 'acceptance')).toEqual([
+ {
+ kind: 'linked',
+ link: path.join('.gemini', 'skills'),
+ target: path.join('..', '.agents', 'skills'),
+ },
+ ]);
+ });
+
+ it('wires every detected harness in one pass', () => {
+ mkdirSync(path.join(root, '.claude'));
+ mkdirSync(path.join(root, '.cursor'));
+
+ const result = linkHarnessSkills(root, 'acceptance');
+
+ expect(result.map((r) => r.link).sort()).toEqual([
+ path.join('.claude', 'skills'),
+ path.join('.cursor', 'skills'),
+ ]);
+ for (const dir of ['.claude', '.cursor']) {
+ expect(readlinkSync(path.join(root, dir, 'skills'))).toBe(
+ path.join('..', '.agents', 'skills'),
+ );
+ }
+ });
});
describe('install wiring never writes .gitignore', () => {
diff --git a/apps/cli/src/utils/skillWiring.ts b/apps/cli/src/utils/skillWiring.ts
index ad8094c4908..8a6d897799d 100644
--- a/apps/cli/src/utils/skillWiring.ts
+++ b/apps/cli/src/utils/skillWiring.ts
@@ -10,8 +10,51 @@ export type LinkResult =
| { kind: 'none' }
| { kind: 'skipped'; link: string; reason: string };
+type Harness = {
+ /** Dot directory that receives the `skills` symlink. */
+ dir: string;
+ name: string;
+ /** Marker files/dirs that prove this harness is used in the repo. */
+ signals: string[];
+ /** Subdirectory the harness scans for skills ('skill' for OpenCode). */
+ skillsSubdir: string;
+};
+
+/**
+ * Harness dirs wired onto `.agents/skills`. Two reasons a dir is listed:
+ *
+ * - the harness does not scan `.agents/skills` natively (Claude Code's
+ * `.claude/skills`, OpenCode's `.opencode/skill`, Windsurf's
+ * `.windsurf/skills`, Roo Code's `.roo/skills`), or
+ * - another harness compatibility-reads it (Cursor reads `.codex/skills` and
+ * `.claude/skills`, so a repo already carrying `.codex` config gets wired).
+ *
+ * Codex, Cursor, Gemini CLI, Copilot/VS Code and Amp all read `.agents/skills`
+ * directly (Cursor additionally reads its own `.cursor/skills`, wired above).
+ * `.github` is deliberately absent: it exists in almost every repo (workflows)
+ * and Copilot already reads `.agents/skills`, so wiring it would be pure noise.
+ */
+const HARNESSES: Harness[] = [
+ { dir: '.claude', name: 'claude', signals: ['CLAUDE.md', '.claude'], skillsSubdir: 'skills' },
+ { dir: '.codex', name: 'codex', signals: ['.codex'], skillsSubdir: 'skills' },
+ { dir: '.cursor', name: 'cursor', signals: ['.cursor'], skillsSubdir: 'skills' },
+ { dir: '.gemini', name: 'gemini', signals: ['.gemini', 'GEMINI.md'], skillsSubdir: 'skills' },
+ {
+ dir: '.opencode',
+ name: 'opencode',
+ signals: ['.opencode', 'opencode.json', 'opencode.jsonc'],
+ skillsSubdir: 'skill',
+ },
+ { dir: '.roo', name: 'roo', signals: ['.roo'], skillsSubdir: 'skills' },
+ { dir: '.windsurf', name: 'windsurf', signals: ['.windsurf'], skillsSubdir: 'skills' },
+];
+
+export function detectHarness(baseDir: string, harness: Harness): boolean {
+ return harness.signals.some((signal) => existsSync(path.join(baseDir, signal)));
+}
+
export function detectClaudeHarness(baseDir: string): boolean {
- return existsSync(path.join(baseDir, 'CLAUDE.md')) || existsSync(path.join(baseDir, '.claude'));
+ return detectHarness(baseDir, HARNESSES[0]);
}
function isSymlink(target: string): boolean {
@@ -22,20 +65,14 @@ function isSymlink(target: string): boolean {
}
}
-/**
- * `.agents/skills` is the single materialized copy; every other harness dir is a
- * symlink onto it, so one install/update reaches all of them.
- */
-export function linkHarnessSkills(baseDir: string, skillId: string): LinkResult {
- if (!detectClaudeHarness(baseDir)) return { kind: 'none' };
-
- const claudeDir = path.join(baseDir, '.claude');
- const link = path.join(claudeDir, 'skills');
- const rel = path.join('.claude', 'skills');
+function linkOneHarness(baseDir: string, skillId: string, harness: Harness): LinkResult {
+ const harnessDir = path.join(baseDir, harness.dir);
+ const link = path.join(harnessDir, harness.skillsSubdir);
+ const rel = path.join(harness.dir, harness.skillsSubdir);
if (isSymlink(link)) {
const current = readlinkSync(link);
- const resolved = path.resolve(claudeDir, current);
+ const resolved = path.resolve(harnessDir, current);
if (resolved === path.join(baseDir, AGENTS_SKILLS_DIR)) return { kind: 'already', link: rel };
return {
kind: 'skipped',
@@ -44,10 +81,10 @@ export function linkHarnessSkills(baseDir: string, skillId: string): LinkResult
};
}
- mkdirSync(claudeDir, { recursive: true });
+ mkdirSync(harnessDir, { recursive: true });
- // A real directory means the user keeps Claude-only skills there; never clobber
- // it β€” link just this one skill inside instead.
+ // A real directory means the user keeps harness-only skills there; never
+ // clobber it β€” link just this one skill inside instead.
if (existsSync(link)) {
const single = path.join(link, skillId);
if (isSymlink(single) || existsSync(single))
@@ -69,3 +106,13 @@ export function linkHarnessSkills(baseDir: string, skillId: string): LinkResult
}
return { kind: 'linked', link: rel, target };
}
+
+/**
+ * `.agents/skills` is the single materialized copy; every detected harness dir
+ * is a symlink onto it, so one install/update reaches all of them.
+ */
+export function linkHarnessSkills(baseDir: string, skillId: string): LinkResult[] {
+ const detected = HARNESSES.filter((harness) => detectHarness(baseDir, harness));
+ if (detected.length === 0) return [{ kind: 'none' }];
+ return detected.map((harness) => linkOneHarness(baseDir, skillId, harness));
+}