fix(cli): use stable lowercase AStudio agent id

Signed-off-by: dongmucat <1127093059@qq.com>
This commit is contained in:
dongmucat 2026-09-09 14:55:59 +08:00
parent 1f361f8c69
commit 4f733cbbc9
9 changed files with 27 additions and 20 deletions

View file

@ -6,7 +6,7 @@ All notable CLI behavior changes are documented in this file.
### Added
- Add the user-level `AStudio` agent profile, with automatic detection of
- Add the user-level `astudio` agent profile, displayed as AStudio, with automatic detection of
`~/.acode/skills` on Linux, macOS, and Windows.
- Add repeatable `sync pull --skill <slug>` selection for non-interactive and JSON workflows, with
interactive multi-select in a TTY.

View file

@ -170,7 +170,7 @@ skillhub install pdf-parser --version 1.2.0
skillhub install pdf-parser --agent codex
# Install to AStudio's fixed user-level directory
skillhub install pdf-parser --agent AStudio
skillhub install pdf-parser --agent astudio
# Install to multiple Agents
skillhub install pdf-parser --agent codex --agent claude-code
@ -204,7 +204,7 @@ Most Agents have both project-level and user-level skills directories. Use `--sc
| Agent | Project-level Path | User-level Path |
|-------|-------------------|-----------------|
| `AStudio` | Not supported | `~/.acode/skills/` |
| `astudio` (AStudio) | Not supported | `~/.acode/skills/` |
| `claude-code` | `<project>/.claude/skills/` | `~/.claude/skills/` |
| `codex` | `<project>/.codex/skills/` | `~/.codex/skills/` |
| `cursor` | `<project>/.cursor/skills/` | `~/.cursor/skills/` |

View file

@ -6,7 +6,7 @@ function userSkillsRoot(home: string): string {
}
export const aStudioProfile: AgentProfile = {
id: 'AStudio',
id: 'astudio',
displayName: 'AStudio',
projectRoots: () => [],
userRoots: home => [userSkillsRoot(home)],

View file

@ -667,7 +667,7 @@ describe('install command — server errors', () => {
// ---------------------------------------------------------------------------
describe('install command — multi-agent & auto-detect', () => {
test('--agent AStudio installs into the fixed user-level .acode skills directory', async () => {
test('--agent astudio installs and persists the stable lowercase agent id', async () => {
const env = await createTempHome()
registry = await startFakeRegistry({
token: 'sk_ok',
@ -679,7 +679,7 @@ describe('install command — multi-agent & auto-detect', () => {
const result = await runCli(
[
'install', 'pdf-parser',
'--agent', 'AStudio',
'--agent', 'astudio',
'--registry', registry.url,
'--token', 'sk_ok',
'--json'
@ -690,17 +690,24 @@ describe('install command — multi-agent & auto-detect', () => {
expect(result.exitCode).toBe(0)
const parsed = JSON.parse(result.stdout) as { installed: Array<{ agent: string; dir: string }> }
expect(parsed.installed).toEqual([{
agent: 'AStudio',
agent: 'astudio',
dir: join(env.home, '.acode', 'skills', 'pdf-parser')
}])
expect(await Bun.file(join(
const metadataPath = join(
env.home,
'.acode',
'skills',
'pdf-parser',
'.skillhub',
'metadata.json'
)).exists()).toBe(true)
)
expect(await Bun.file(metadataPath).exists()).toBe(true)
expect(JSON.parse(await readFile(metadataPath, 'utf-8')).agent).toBe('astudio')
const inventory = JSON.parse(await readFile(join(env.home, '.skillhub', 'inventory.json'), 'utf-8')) as {
items: Array<{ targets: Array<{ agent: string }> }>
}
expect(inventory.items[0]?.targets[0]?.agent).toBe('astudio')
})
test('multi --agent installs the same skill into every specified user-level dir', async () => {

View file

@ -16,7 +16,7 @@ describe('agent profiles', () => {
test('profileMap contains all profiles', () => {
expect(profileMap.size).toBe(15)
expect(profileMap.has('AStudio')).toBe(true)
expect(profileMap.has('astudio')).toBe(true)
expect(profileMap.has('claude-code')).toBe(true)
expect(profileMap.has('codex')).toBe(true)
expect(profileMap.has('cursor')).toBe(true)
@ -41,7 +41,7 @@ describe('agent profiles', () => {
})
test('AStudio exposes only its fixed user-level directory on Linux, macOS, and Windows', () => {
const profile = profileMap.get('AStudio')!
const profile = profileMap.get('astudio')!
expect(profile.displayName).toBe('AStudio')
expect(profile.projectRoots('/repo')).toEqual([])
@ -52,7 +52,7 @@ describe('agent profiles', () => {
test('AStudio is detected only when the user .acode skills directory exists', async () => {
const home = await mkdtemp(join(tmpdir(), 'skillhub-astudio-home-'))
const profile = profileMap.get('AStudio')!
const profile = profileMap.get('astudio')!
const nativeRootDir = join(home, '.acode', 'skills')
const profileRootDir = nativeRootDir.replace(/\\/g, '/')
@ -67,7 +67,7 @@ describe('agent profiles', () => {
await mkdir(nativeRootDir, { recursive: true })
expect(await profile.detectInstalled('/repo', home)).toEqual([{
agent: 'AStudio',
agent: 'astudio',
rootDir: profileRootDir,
scope: 'user',
source: 'detected'

View file

@ -73,7 +73,7 @@ describe('resolveInstallTargets interactive prompt', () => {
interactive: true
})
expect(renderedChoices.some(choice => choice.value.agent === 'AStudio')).toBe(false)
expect(renderedChoices.some(choice => choice.value.agent === 'astudio')).toBe(false)
expect(targets).toEqual([{
agent: 'generic',
rootDir: `${home}/.agents/skills`,

View file

@ -132,11 +132,11 @@ describe('resolveInstallTargets', () => {
await expect(resolveInstallTargets({
cwd: '/repo',
home: '/home/u',
agents: ['AStudio'],
agents: ['astudio'],
scope: 'project',
json: false,
interactive: false
})).rejects.toThrow('agent AStudio does not support project scope')
})).rejects.toThrow('agent astudio does not support project scope')
})
test('scope=user + agent codex returns user root with user scope', async () => {

View file

@ -155,7 +155,7 @@ skillhub install pdf-parser --version 1.2.0
skillhub install pdf-parser --agent codex
# Install to AStudio's fixed user-level directory
skillhub install pdf-parser --agent AStudio
skillhub install pdf-parser --agent astudio
# Install to multiple Agents
skillhub install pdf-parser --agent codex --agent claude-code
@ -189,7 +189,7 @@ Most Agents have both project-level and user-level skills directories. Use `--sc
| Agent | Project-level Path | User-level Path |
|-------|-------------------|-----------------|
| `AStudio` | Not supported | `~/.acode/skills/` |
| `astudio` (AStudio) | Not supported | `~/.acode/skills/` |
| `claude-code` | `<project>/.claude/skills/` | `~/.claude/skills/` |
| `codex` | `<project>/.codex/skills/` | `~/.codex/skills/` |
| `cursor` | `<project>/.cursor/skills/` | `~/.cursor/skills/` |

View file

@ -151,7 +151,7 @@ skillhub install pdf-parser --version 1.2.0
skillhub install pdf-parser --agent codex
# 安装到 AStudio 的固定用户级目录
skillhub install pdf-parser --agent AStudio
skillhub install pdf-parser --agent astudio
# 安装到多个 Agent
skillhub install pdf-parser --agent codex --agent claude-code
@ -185,7 +185,7 @@ CLI 按以下逻辑确定安装位置:
| Agent | 项目级路径 | 用户级路径 |
|-------|-----------|-----------|
| `AStudio` | 不支持 | `~/.acode/skills/` |
| `astudio`(AStudio) | 不支持 | `~/.acode/skills/` |
| `claude-code` | `<project>/.claude/skills/` | `~/.claude/skills/` |
| `codex` | `<project>/.codex/skills/` | `~/.codex/skills/` |
| `cursor` | `<project>/.cursor/skills/` | `~/.cursor/skills/` |