Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(maker-core): include Claude commands in Learn attestation
xd-bobo5b0b1ebc1a9a
diff --git a/packages/maker-core/src/agents/claude-code/customization-scanner.test.ts b/packages/maker-core/src/agents/claude-code/customization-scanner.test.tsindex cae4d71df7..2ac7e57ae3 100644--- a/packages/maker-core/src/agents/claude-code/customization-scanner.test.ts+++ b/packages/maker-core/src/agents/claude-code/customization-scanner.test.ts@@ -17,6 +17,13 @@ function writeSkill(root: string, name: string): string {return skillDir;}+function writeCommand(root: string, name: string): string {+ const command = path.join(root, 'commands', `${name}.md`);+ fs.mkdirSync(path.dirname(command), { recursive: true });+ fs.writeFileSync(command, `---\ndescription: ${name}\n---\n`);+ return command;+}+afterEach(() => {vi.restoreAllMocks();for (const root of roots.splice(0)) fs.rmSync(root, { recursive: true, force: true });@@ -67,4 +74,30 @@ describe('scanClaudeRuntimeSkills', () => {]);expect(result.items.map((item) => item.absolutePath)).not.toContain(fs.realpathSync(outsideLearn));});++ it('includes legacy commands that compete in the runtime slash-command namespace', async () => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'claude-runtime-commands-'));+ roots.push(root);+ const isolatedConfig = path.join(root, 'claude-home');+ const repository = path.join(root, 'repository');+ const workingDir = path.join(repository, 'packages', 'app');+ fs.mkdirSync(path.join(repository, '.git'), { recursive: true });+ fs.mkdirSync(workingDir, { recursive: true });+ const globalLearnSkill = writeSkill(isolatedConfig, 'learn');+ const globalLearnCommand = writeCommand(isolatedConfig, 'learn');+ const repositoryLearnCommand = writeCommand(path.join(repository, '.claude'), 'learn');+ const outsideLearnCommand = writeCommand(path.join(root, '.claude'), 'outside');++ const result = await scanClaudeRuntimeSkills(workingDir, isolatedConfig);++ expect(result.items.filter((item) => item.name === 'learn').map((item) => ({+ kind: item.kind,+ path: item.absolutePath,+ }))).toEqual([+ { kind: 'skill', path: globalLearnSkill },+ { kind: 'command', path: globalLearnCommand },+ { kind: 'command', path: fs.realpathSync(repositoryLearnCommand) },+ ]);+ expect(result.items.map((item) => item.absolutePath)).not.toContain(outsideLearnCommand);+ });});diff --git a/packages/maker-core/src/agents/claude-code/customization-scanner.ts b/packages/maker-core/src/agents/claude-code/customization-scanner.tsindex 45119f73fb..f00dd3e318 100644--- a/packages/maker-core/src/agents/claude-code/customization-scanner.ts+++ b/packages/maker-core/src/agents/claude-code/customization-scanner.ts@@ -87,8 +87,10 @@ function scanClaudeCustomizationsAtConfig(return result;}-/** Native project discovery walks to the nearest Git root (or filesystem root).+/** Native slash-command discovery walks to the nearest Git root (or filesystem root).* Keep this runtime view separate from SkillHub's explicitly owned project list.+ * Legacy commands and Skills share Claude's slash-command namespace, so callers+ * making authorization decisions must see both kinds.* Ancestors precede descendants so same-name winner selection keeps the closest source.*/export async function scanClaudeRuntimeSkills(@@ -105,7 +107,7 @@ export async function scanClaudeRuntimeSkills(current = parent;}return scanClaudeCustomizationsAtConfig(- { workingDirs, kinds: ['skill'] },+ { workingDirs, kinds: ['skill', 'command'] },configDir,);}diff --git a/packages/maker-core/src/agents/claude-code/index.ts b/packages/maker-core/src/agents/claude-code/index.tsindex df3b5a1702..aa26f74d4a 100644--- a/packages/maker-core/src/agents/claude-code/index.ts+++ b/packages/maker-core/src/agents/claude-code/index.ts@@ -1037,7 +1037,7 @@ export class ClaudeCodeAgent extends BaseAgent {kind: 'agent-skill' as const,name: item.name,description: item.description,- source: 'skill' as const,+ source: item.kind === 'skill' ? 'skill' as const : 'user' as const,path: item.mdPath,scope: item.scope === 'project' ? 'project' as const : 'global' as const,enabled: true,