🌊 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(github): read dotted repo names from the origin remote in github_repo_analyze (#4571)
kevineb51293ddd6b
diff --git a/v3/@claude-flow/cli/__tests__/github-repo-analyze-dotted-name.test.ts b/v3/@claude-flow/cli/__tests__/github-repo-analyze-dotted-name.test.tsnew file mode 100644index 0000000000..fa4d2a9189--- /dev/null+++ b/v3/@claude-flow/cli/__tests__/github-repo-analyze-dotted-name.test.ts@@ -0,0 +1,71 @@+/**+ * github_repo_analyze reads owner/repo from `git remote get-url origin` when+ * they are not passed. The pattern stopped the repo name at the first dot, so+ * remotes such as vercel/next.js or socketio/socket.io did not match and the+ * repository was reported (and stored) as local/repo.+ *+ * Mocks `node:child_process` like github-tools-false-success-4424.test.ts.+ */+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { mkdirSync, mkdtempSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';++const execSyncMock = vi.fn();++vi.mock('node:child_process', () => ({+ execFileSync: vi.fn(),+ execSync: (...args: unknown[]) => execSyncMock(...args),+}));++const originalProjectCwd = process.env.CLAUDE_FLOW_CWD;++function gitWithRemote(remoteUrl: string) {+ execSyncMock.mockImplementation((cmd: string) => {+ if (cmd === 'git remote get-url origin') return `${remoteUrl}\n`;+ if (cmd === 'git rev-list --count HEAD') return '42\n';+ if (cmd.startsWith('git ')) return '1\n';+ // No gh CLI: skip the issue/PR counts.+ throw new Error('not found');+ });+}++async function analyze(input: Record<string, unknown> = {}) {+ const { githubTools } = await import('../src/mcp-tools/github-tools.js');+ const t = githubTools.find((c) => c.name === 'github_repo_analyze')!;+ return (await t.handler(input)) as Record<string, unknown>;+}++beforeEach(() => {+ execSyncMock.mockReset();+ const scratch = mkdtempSync(join(tmpdir(), 'ruflo-repo-analyze-'));+ process.env.CLAUDE_FLOW_CWD = scratch;+ mkdirSync(join(scratch, '.claude-flow', 'github'), { recursive: true });+});++afterEach(() => {+ if (originalProjectCwd === undefined) delete process.env.CLAUDE_FLOW_CWD;+ else process.env.CLAUDE_FLOW_CWD = originalProjectCwd;+});++describe('github_repo_analyze owner/repo from the origin remote', () => {+ it.each([+ ['https://github.com/vercel/next.js.git', 'vercel/next.js'],+ ['https://github.com/vercel/next.js', 'vercel/next.js'],+ ['[email protected]:socketio/socket.io.git', 'socketio/socket.io'],+ ['[email protected]:mrdoob/three.js', 'mrdoob/three.js'],+ ['https://github.com/ruvnet/ruflo.git', 'ruvnet/ruflo'],+ ['[email protected]:ruvnet/ruflo', 'ruvnet/ruflo'],+ ])('%s is %s', async (remoteUrl, expected) => {+ gitWithRemote(remoteUrl);+ const r = await analyze();+ expect(r.success).toBe(true);+ expect(r.repository).toBe(expected);+ });++ it('keeps an explicitly passed owner and repo', async () => {+ gitWithRemote('https://github.com/vercel/next.js.git');+ const r = await analyze({ owner: 'acme', repo: 'widgets' });+ expect(r.repository).toBe('acme/widgets');+ });+});diff --git a/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/github-tools.tsindex 2d3b69ec2b..97c58ba18b 100644--- a/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts+++ b/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts@@ -181,7 +181,7 @@ export const githubTools: MCPTool[] = [let owner = (input.owner as string) || '';let repo = (input.repo as string) || '';if (remoteUrl && (!owner || !repo)) {- const m = remoteUrl.match(/[:/]([^/]+)\/([^/.]+?)(?:\.git)?$/);+ const m = remoteUrl.match(/[:/]([^/]+)\/([^/]+?)(?:\.git)?$/);if (m) { owner = owner || m[1]; repo = repo || m[2]; }}const repoKey = `${owner || 'local'}/${repo || 'repo'}`;