From 4f733cbbc95d49a65ba0ff94e30e1b93ac207b6b Mon Sep 17 00:00:00 2001 From: dongmucat <1127093059@qq.com> Date: Wed, 9 Sep 2026 14:55:59 +0800 Subject: [PATCH] fix(cli): use stable lowercase AStudio agent id Signed-off-by: dongmucat <1127093059@qq.com> --- cli/CHANGELOG.md | 2 +- cli/README.md | 4 ++-- cli/src/agents/profiles/astudio.ts | 2 +- cli/test/integration/install-command.test.ts | 17 ++++++++++++----- cli/test/unit/agents/profiles.test.ts | 8 ++++---- .../unit/agents/resolver-interactive.test.ts | 2 +- cli/test/unit/agents/resolver.test.ts | 4 ++-- docs/skillhub/en/guide/cli.md | 4 ++-- docs/skillhub/guide/cli.md | 4 ++-- 9 files changed, 27 insertions(+), 20 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 5a06658f..20cb5cf8 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -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 ` selection for non-interactive and JSON workflows, with interactive multi-select in a TTY. diff --git a/cli/README.md b/cli/README.md index 145a7b80..42192b13 100644 --- a/cli/README.md +++ b/cli/README.md @@ -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` | `/.claude/skills/` | `~/.claude/skills/` | | `codex` | `/.codex/skills/` | `~/.codex/skills/` | | `cursor` | `/.cursor/skills/` | `~/.cursor/skills/` | diff --git a/cli/src/agents/profiles/astudio.ts b/cli/src/agents/profiles/astudio.ts index 1114a86b..ed3232e0 100644 --- a/cli/src/agents/profiles/astudio.ts +++ b/cli/src/agents/profiles/astudio.ts @@ -6,7 +6,7 @@ function userSkillsRoot(home: string): string { } export const aStudioProfile: AgentProfile = { - id: 'AStudio', + id: 'astudio', displayName: 'AStudio', projectRoots: () => [], userRoots: home => [userSkillsRoot(home)], diff --git a/cli/test/integration/install-command.test.ts b/cli/test/integration/install-command.test.ts index 25470a1e..f6b6f21c 100644 --- a/cli/test/integration/install-command.test.ts +++ b/cli/test/integration/install-command.test.ts @@ -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 () => { diff --git a/cli/test/unit/agents/profiles.test.ts b/cli/test/unit/agents/profiles.test.ts index 7484b3b7..ec567fe7 100644 --- a/cli/test/unit/agents/profiles.test.ts +++ b/cli/test/unit/agents/profiles.test.ts @@ -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' diff --git a/cli/test/unit/agents/resolver-interactive.test.ts b/cli/test/unit/agents/resolver-interactive.test.ts index 3e042164..d2fdeb37 100644 --- a/cli/test/unit/agents/resolver-interactive.test.ts +++ b/cli/test/unit/agents/resolver-interactive.test.ts @@ -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`, diff --git a/cli/test/unit/agents/resolver.test.ts b/cli/test/unit/agents/resolver.test.ts index 79033f26..2f1e8748 100644 --- a/cli/test/unit/agents/resolver.test.ts +++ b/cli/test/unit/agents/resolver.test.ts @@ -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 () => { diff --git a/docs/skillhub/en/guide/cli.md b/docs/skillhub/en/guide/cli.md index 2055a603..84a211dd 100644 --- a/docs/skillhub/en/guide/cli.md +++ b/docs/skillhub/en/guide/cli.md @@ -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` | `/.claude/skills/` | `~/.claude/skills/` | | `codex` | `/.codex/skills/` | `~/.codex/skills/` | | `cursor` | `/.cursor/skills/` | `~/.cursor/skills/` | diff --git a/docs/skillhub/guide/cli.md b/docs/skillhub/guide/cli.md index 74ee5016..9c7bf3e9 100644 --- a/docs/skillhub/guide/cli.md +++ b/docs/skillhub/guide/cli.md @@ -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` | `/.claude/skills/` | `~/.claude/skills/` | | `codex` | `/.codex/skills/` | `~/.codex/skills/` | | `cursor` | `/.cursor/skills/` | `~/.cursor/skills/` |