🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(cli): list stored values, not scoped ones, in the default-scope config_list (#4354)
kevindd5b97d3c0a5
diff --git a/v3/@claude-flow/cli/__tests__/config-list-scope-precedence.test.ts b/v3/@claude-flow/cli/__tests__/config-list-scope-precedence.test.tsnew file mode 100644index 0000000000..988457a039--- /dev/null+++ b/v3/@claude-flow/cli/__tests__/config-list-scope-precedence.test.ts@@ -0,0 +1,43 @@+import { beforeEach, afterEach, it, expect, vi } from 'vitest';+import { mkdirSync, mkdtempSync, writeFileSync, rmSync } from 'node:fs';+import { join } from 'node:path';+import { tmpdir } from 'node:os';+import { configTools } from '../src/mcp-tools/config-tools.js';++let root: string;+const invoke = async (name: string, input: Record<string, unknown>): Promise<any> =>+ configTools.find(tool => tool.name === name)!.handler(input);+const entry = (result: any, key: string) => result.configs.find((c: any) => c.key === key);++beforeEach(async () => {+ root = mkdtempSync(join(tmpdir(), 'ruflo-config-scope-'));+ mkdirSync(join(root, '.claude-flow'));+ writeFileSync(join(root, '.claude-flow', 'config.json'), '{}');+ vi.stubEnv('CLAUDE_FLOW_CWD', root);+ vi.stubEnv('CLAUDE_FLOW_CONFIG', '');+ await invoke('config_set', { key: 'swarm.maxAgents', value: 23 });+ await invoke('config_set', { key: 'swarm.maxAgents', value: 7, scope: 'project' });+ await invoke('config_set', { key: 'project.only', value: 'p', scope: 'project' });+});+afterEach(() => {+ vi.unstubAllEnvs();+ rmSync(root, { recursive: true, force: true });+});++it('lists the stored value, not a scoped one, for the default scope', async () => {+ const listed = await invoke('config_list', { includeDefaults: false });+ const got = await invoke('config_get', { key: 'swarm.maxAgents' });+ const exported = await invoke('config_export', { includeDefaults: false });++ expect(got.value).toBe(23);+ expect(exported.config['swarm.maxAgents']).toBe(23);+ expect(entry(listed, 'swarm.maxAgents')).toEqual({ key: 'swarm.maxAgents', value: 23, source: 'stored' });+ // Scoped keys that nothing shadows are still listed.+ expect(entry(listed, 'project.only')).toEqual({ key: 'project.only', value: 'p', source: 'scope:project' });+});++it('lets the requested scope win', async () => {+ const listed = await invoke('config_list', { includeDefaults: false, scope: 'project' });+ expect(entry(listed, 'swarm.maxAgents')).toEqual({ key: 'swarm.maxAgents', value: 7, source: 'scope:project' });+ expect((await invoke('config_get', { key: 'swarm.maxAgents', scope: 'project' })).value).toBe(7);+});diff --git a/v3/@claude-flow/cli/src/mcp-tools/config-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/config-tools.tsindex 89f574757b..9a61421cbc 100644--- a/v3/@claude-flow/cli/src/mcp-tools/config-tools.ts+++ b/v3/@claude-flow/cli/src/mcp-tools/config-tools.ts@@ -368,10 +368,12 @@ export const configTools: MCPTool[] = [merged.set(key, { value, source: 'stored' });}// Always include keys from every scope so they're discoverable; the- // scope filter only narrows which set is used as the *winner*.+ // scope filter only narrows which set is used as the *winner*. The+ // default scope has no scope of its own, so stored values win there,+ // as in config_get and config_export.for (const [scopeName, scopeValues] of Object.entries(store.scopes)) {for (const [key, value] of Object.entries(scopeValues)) {- if (scope === scopeName || scope === 'default') {+ if (scope === scopeName) {merged.set(key, { value, source: `scope:${scopeName}` });} else if (!merged.has(key)) {// Surface scoped keys that aren't shadowed when listing default scope