feat: add generic user-level agent install target

Signed-off-by: betterlmy <betterlmy@icloud.com>
This commit is contained in:
betterlmy 2026-07-17 11:26:20 +08:00
parent 2e4a69d590
commit 8b84201516
2 changed files with 33 additions and 0 deletions

View file

@ -68,6 +68,18 @@ async function resolveScopedTargets(
}
candidates = dedupeByRoot(candidates)
if (scope === 'user' && agentList.length === 0 && options.interactive && !options.json) {
candidates = dedupeByRoot([
...candidates,
{
agent: 'generic',
rootDir: `${scopedHome}/.agents/skills`,
scope: 'user',
source: 'fallback'
}
])
}
if (candidates.length === 0) {
const fallbackRoot = scope === 'user'
? `${scopedHome}/.agents/skills`

View file

@ -33,4 +33,25 @@ describe('resolveInstallTargets interactive prompt', () => {
expect(targets).toEqual([highlighted])
})
test('offers the generic user target alongside detected agent targets', async () => {
const targets = await resolveInstallTargets({
cwd: '/repo',
home: '/home/u',
agents: [],
scope: 'user',
json: false,
interactive: true,
detected: [
{ agent: 'codex', rootDir: '/home/u/.codex/skills', scope: 'user', source: 'detected' }
]
})
expect(targets).toEqual([{
agent: 'generic',
rootDir: '/home/u/.agents/skills',
scope: 'user',
source: 'fallback'
}])
})
})