Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

Checkpoint: File edits

rUv203d62bb2b73
diff --git a/v3/@claude-flow/cli/agents/architect.yaml b/v3/@claude-flow/cli/agents/architect.yaml
index 214f6e98a4..74ad67df81 100644
--- a/v3/@claude-flow/cli/agents/architect.yaml
+++ b/v3/@claude-flow/cli/agents/architect.yaml
@@ -8,4 +8,4 @@ capabilities:
optimizations:
- context-caching
- memory-persistence
-createdAt: "2026-01-07T16:48:49.140Z"
+createdAt: "2026-01-07T20:59:19.495Z"
diff --git a/v3/@claude-flow/cli/agents/coder.yaml b/v3/@claude-flow/cli/agents/coder.yaml
index 45449d24bf..f7d3bd96b7 100644
--- a/v3/@claude-flow/cli/agents/coder.yaml
+++ b/v3/@claude-flow/cli/agents/coder.yaml
@@ -8,4 +8,4 @@ capabilities:
optimizations:
- flash-attention
- token-reduction
-createdAt: "2026-01-07T16:48:49.140Z"
+createdAt: "2026-01-07T20:59:19.495Z"
diff --git a/v3/@claude-flow/cli/agents/reviewer.yaml b/v3/@claude-flow/cli/agents/reviewer.yaml
index a3121aaf97..fa988c87d3 100644
--- a/v3/@claude-flow/cli/agents/reviewer.yaml
+++ b/v3/@claude-flow/cli/agents/reviewer.yaml
@@ -7,4 +7,4 @@ capabilities:
- best-practices
optimizations:
- incremental-analysis
-createdAt: "2026-01-07T16:48:49.140Z"
+createdAt: "2026-01-07T20:59:19.495Z"
diff --git a/v3/@claude-flow/cli/agents/security-architect.yaml b/v3/@claude-flow/cli/agents/security-architect.yaml
index d2f340ddc8..94c4d9228c 100644
--- a/v3/@claude-flow/cli/agents/security-architect.yaml
+++ b/v3/@claude-flow/cli/agents/security-architect.yaml
@@ -7,4 +7,4 @@ capabilities:
- security-review
optimizations:
- pattern-matching
-createdAt: "2026-01-07T16:48:49.140Z"
+createdAt: "2026-01-07T20:59:19.495Z"
diff --git a/v3/@claude-flow/cli/agents/tester.yaml b/v3/@claude-flow/cli/agents/tester.yaml
index 4ef91c50ac..c69c49b098 100644
--- a/v3/@claude-flow/cli/agents/tester.yaml
+++ b/v3/@claude-flow/cli/agents/tester.yaml
@@ -7,4 +7,4 @@ capabilities:
- coverage
optimizations:
- parallel-execution
-createdAt: "2026-01-07T16:48:49.140Z"
+createdAt: "2026-01-07T20:59:19.495Z"
diff --git a/v3/@claude-flow/cli/src/services/claim-service.ts b/v3/@claude-flow/cli/src/services/claim-service.ts
index 5ac5df6f12..f9f6f6be21 100644
--- a/v3/@claude-flow/cli/src/services/claim-service.ts
+++ b/v3/@claude-flow/cli/src/services/claim-service.ts
@@ -741,6 +741,248 @@ export class ClaimService extends EventEmitter {
}
}
+// ============================================================================
+// GitHub Sync Implementation
+// ============================================================================
+
+const DEFAULT_GITHUB_CONFIG: GitHubSyncConfig = {
+ enabled: false,
+ syncLabels: true,
+ claimLabel: 'claimed',
+ autoAssign: true,
+ commentOnClaim: true,
+ commentOnRelease: true,
+};
+
+export class GitHubSync {
+ private config: GitHubSyncConfig;
+ private claimService: ClaimService;
+
+ constructor(claimService: ClaimService, config?: Partial<GitHubSyncConfig>) {
+ this.claimService = claimService;
+ this.config = { ...DEFAULT_GITHUB_CONFIG, ...config };
+ }
+
+ /**
+ * Check if GitHub CLI is available
+ */
+ isGhAvailable(): boolean {
+ try {
+ execSync('gh --version', { stdio: 'ignore' });
+ return true;
+ } catch {
+ return false;
+ }
+ }
+
+ /**
+ * Get the current repository from git remote
+ */
+ getRepo(): string | null {
+ if (this.config.repo) return this.config.repo;
+ try {
+ const remote = execSync('git remote get-url origin', { encoding: 'utf-8' }).trim();
+ const match = remote.match(/github\.com[/:]([\w-]+\/[\w-]+)/);
+ return match ? match[1].replace('.git', '') : null;
+ } catch {
+ return null;
+ }
+ }
+
+ /**
+ * Sync issues from GitHub
+ */
+ async syncIssues(state: 'open' | 'closed' | 'all' = 'open'): Promise<GitHubSyncResult> {
+ const errors: string[] = [];
+ const issues: GitHubIssue[] = [];
+
+ if (!this.isGhAvailable()) {
+ return { success: false, synced: 0, errors: ['GitHub CLI (gh) not installed'] };
+ }
+
+ const repo = this.getRepo();
+ if (!repo) {
+ return { success: false, synced: 0, errors: ['Could not determine GitHub repository'] };
+ }
+
+ try {
+ const issuesJson = execSync(
+ `gh issue list --repo ${repo} --state ${state} --json number,title,body,state,labels,assignees,url,createdAt,updatedAt --limit 100`,
+ { encoding: 'utf-8' }
+ );
+ const rawIssues = JSON.parse(issuesJson);
+
+ for (const raw of rawIssues) {
+ issues.push({
+ number: raw.number,
+ title: raw.title,
+ body: raw.body || '',
+ state: raw.state === 'OPEN' ? 'open' : 'closed',
+ labels: raw.labels?.map((l: { name: string }) => l.name) || [],
+ assignees: raw.assignees?.map((a: { login: string }) => a.login) || [],
+ url: raw.url,
+ createdAt: new Date(raw.createdAt),
+ updatedAt: new Date(raw.updatedAt),
+ });
+ }
+
+ return { success: true, synced: issues.length, errors, issues };
+ } catch (error) {
+ errors.push(`Failed to fetch issues: ${(error as Error).message}`);
+ return { success: false, synced: 0, errors };
+ }
+ }
+
+ /**
+ * Sync a local claim to GitHub (add label/assignee/comment)
+ */
+ async claimOnGitHub(issueNumber: number, claimant: Claimant): Promise<GitHubSyncResult> {
+ const errors: string[] = [];
+
+ if (!this.config.enabled) {
+ return { success: true, synced: 0, errors: ['GitHub sync not enabled'] };
+ }
+
+ if (!this.isGhAvailable()) {
+ return { success: false, synced: 0, errors: ['GitHub CLI (gh) not installed'] };
+ }
+
+ const repo = this.getRepo();
+ if (!repo) {
+ return { success: false, synced: 0, errors: ['Could not determine repository'] };
+ }
+
+ try {
+ // Add claim label
+ if (this.config.syncLabels) {
+ try {
+ execSync(`gh issue edit ${issueNumber} --repo ${repo} --add-label "${this.config.claimLabel}"`, { stdio: 'ignore' });
+ } catch {
+ errors.push('Failed to add claim label (label may not exist)');
+ }
+ }
+
+ // Auto-assign if human claimant
+ if (this.config.autoAssign && claimant.type === 'human') {
+ try {
+ execSync(`gh issue edit ${issueNumber} --repo ${repo} --add-assignee "${claimant.name}"`, { stdio: 'ignore' });
+ } catch {
+ errors.push('Failed to assign issue');
+ }
+ }
+
+ // Add comment
+ if (this.config.commentOnClaim) {
+ const claimantStr = claimant.type === 'human' ? `@${claimant.name}` : `Agent: ${claimant.agentType}`;
+ const comment = `🤖 **Issue claimed** by ${claimantStr}\n\n_Coordinated by Claude Flow V3_`;
+ try {
+ execSync(`gh issue comment ${issueNumber} --repo ${repo} --body "${comment.replace(/"/g, '\\"')}"`, { stdio: 'ignore' });
+ } catch {
+ errors.push('Failed to add comment');
+ }
+ }
+
+ return { success: errors.length === 0, synced: 1, errors };
+ } catch (error) {
+ errors.push(`GitHub sync failed: ${(error as Error).message}`);
+ return { success: false, synced: 0, errors };
+ }
+ }
+
+ /**
+ * Release claim on GitHub (remove label/assignee/comment)
+ */
+ async releaseOnGitHub(issueNumber: number, claimant: Claimant): Promise<GitHubSyncResult> {
+ const errors: string[] = [];
+
+ if (!this.config.enabled) {
+ return { success: true, synced: 0, errors: ['GitHub sync not enabled'] };
+ }
+
+ if (!this.isGhAvailable()) {
+ return { success: false, synced: 0, errors: ['GitHub CLI (gh) not installed'] };
+ }
+
+ const repo = this.getRepo();
+ if (!repo) {
+ return { success: false, synced: 0, errors: ['Could not determine repository'] };
+ }
+
+ try {
+ // Remove claim label
+ if (this.config.syncLabels) {
+ try {
+ execSync(`gh issue edit ${issueNumber} --repo ${repo} --remove-label "${this.config.claimLabel}"`, { stdio: 'ignore' });
+ } catch {
+ // Label might not exist
+ }
+ }
+
+ // Remove assignee if human claimant
+ if (this.config.autoAssign && claimant.type === 'human') {
+ try {
+ execSync(`gh issue edit ${issueNumber} --repo ${repo} --remove-assignee "${claimant.name}"`, { stdio: 'ignore' });
+ } catch {
+ errors.push('Failed to remove assignee');
+ }
+ }
+
+ // Add release comment
+ if (this.config.commentOnRelease) {
+ const claimantStr = claimant.type === 'human' ? `@${claimant.name}` : `Agent: ${claimant.agentType}`;
+ const comment = `🔓 **Issue released** by ${claimantStr}\n\n_This issue is now available for others to claim._`;
+ try {
+ execSync(`gh issue comment ${issueNumber} --repo ${repo} --body "${comment.replace(/"/g, '\\"')}"`, { stdio: 'ignore' });
+ } catch {
+ errors.push('Failed to add release comment');
+ }
+ }
+
+ return { success: errors.length === 0, synced: 1, errors };
+ } catch (error) {
+ errors.push(`GitHub release sync failed: ${(error as Error).message}`);
+ return { success: false, synced: 0, errors };
+ }
+ }
+
+ /**
+ * Bulk sync all local claims to GitHub
+ */
+ async syncAllClaimsToGitHub(): Promise<GitHubSyncResult> {
+ const errors: string[] = [];
+ let synced = 0;
+
+ const claims = await this.claimService.getAllClaims();
+ for (const claim of claims) {
+ // Extract issue number from issueId (assumes format like "123" or "issue-123")
+ const issueMatch = claim.issueId.match(/(\d+)/);
+ if (issueMatch) {
+ const result = await this.claimOnGitHub(parseInt(issueMatch[1], 10), claim.claimant);
+ if (result.success) synced++;
+ else errors.push(...result.errors);
+ }
+ }
+
+ return { success: errors.length === 0, synced, errors };
+ }
+
+ /**
+ * Get GitHub issues that are claimed locally
+ */
+ async getClaimedGitHubIssues(): Promise<GitHubIssue[]> {
+ const syncResult = await this.syncIssues('open');
+ if (!syncResult.success || !syncResult.issues) return [];
+
+ const localClaims = await this.claimService.getAllClaims();
+ const claimedIds = new Set(localClaims.map(c => {
+ const match = c.issueId.match(/(\d+)/);
+ return match ? parseInt(match[1], 10) : null;
+ }).filter(Boolean));
+
+ return syncResult.issues.filter(issue => claimedIds.has(issue.number));
+ }
+}
+
// ============================================================================
// Factory
// ============================================================================
@@ -752,4 +994,11 @@ export function createClaimService(
return new ClaimService(projectRoot, config);
}
+export function createGitHubSync(
+ claimService: ClaimService,
+ config?: Partial<GitHubSyncConfig>
+): GitHubSync {
+ return new GitHubSync(claimService, config);
+}
+
export default ClaimService;