|
| 1 | +# Gemini-Flow Architecture & Roadmap |
| 2 | + |
| 3 | +## Milestone 1 – Codebase Scanning & Architecture Mapping |
| 4 | +- **Entry Point:** `src/index.ts` re-exports CLI, auth, and interactive modules, forming the public API surface【F:src/index.ts†L1-L16】 |
| 5 | +- **CLI Components:** `GeminiCLI` wires commander-based commands and pulls in `SimpleAuth`, `SimpleInteractive`, and logging utilities for orchestration【F:src/cli/gemini-cli.ts†L8-L118】 |
| 6 | +- **Authentication:** `SimpleAuth` resolves API keys from env/config and offers testing, save, and status helpers【F:src/core/simple-auth.ts†L1-L104】 |
| 7 | +- **Interactive Mode:** `SimpleInteractive` manages readline I/O, session history, and welcome flows【F:src/cli/simple-interactive.ts†L1-L118】 |
| 8 | +- **Memory Layer:** `SQLiteMemoryManager` abstracts persistent namespaces with a three-tier fallback: `better-sqlite3 → sqlite3 → sql.js` and WAL tuning【F:src/memory/sqlite-manager.ts†L1-L22】【F:src/memory/sqlite-manager.ts†L68-L110】 |
| 9 | +- **Protocol Handling:** `A2AProtocolManager` queues and routes JSON‑RPC messages with metrics, validation, and shutdown semantics【F:src/protocols/a2a/core/a2a-protocol-manager.ts†L1-L142】 |
| 10 | +- **GitHub A2A PR System:** coordinates multi-agent review strategies and scoring【F:src/core/github-a2a-pr-system.ts†L1-L152】 |
| 11 | + |
| 12 | +```mermaid |
| 13 | +graph TD |
| 14 | + subgraph CLI |
| 15 | + A[GeminiCLI] |
| 16 | + B[SimpleInteractive] |
| 17 | + end |
| 18 | + subgraph Core |
| 19 | + C[SimpleAuth] |
| 20 | + D[A2AProtocolManager] |
| 21 | + E[GitHub PR System] |
| 22 | + end |
| 23 | + subgraph Memory |
| 24 | + F[SQLiteMemoryManager] |
| 25 | + end |
| 26 | + A -->|auth| C |
| 27 | + A -->|interactive| B |
| 28 | + D --> F |
| 29 | + E --> D |
| 30 | +``` |
| 31 | + |
| 32 | +```mermaid |
| 33 | +sequenceDiagram |
| 34 | + participant User |
| 35 | + participant CLI as GeminiCLI |
| 36 | + participant Auth as SimpleAuth |
| 37 | + participant Inter as SimpleInteractive |
| 38 | + User->>CLI: gemini chat |
| 39 | + CLI->>Auth: loadAuth() |
| 40 | + Auth-->>CLI: key status |
| 41 | + CLI->>Inter: start() |
| 42 | + Inter->>Auth: isAuthenticated() |
| 43 | + Inter-->>User: interactive session |
| 44 | +``` |
| 45 | + |
| 46 | +## Milestone 2 – Key Modules & Dependencies |
| 47 | +- **Node Engine:** `>=18 <=24`【F:package.json†L12-L14】 |
| 48 | +- **Test Scripts:** unit, integration, performance, protocol, Google services, live integration【F:package.json†L21-L40】 |
| 49 | +- **Dependency Matrix (excerpt):** |
| 50 | + |
| 51 | +| Type | Modules | |
| 52 | +| --- | --- | |
| 53 | +| Prod | axios, eventemitter3, express, redis, pg, ws | |
| 54 | +| Dev | jest, eslint(+security plugin), typedoc, rollup | |
| 55 | +| Optional | canvas, puppeteer, sharp | |
| 56 | + |
| 57 | +- **Key Module Roles:** |
| 58 | + - `sqlite-manager.ts`: namespaced persistent storage with normalization utilities and periodic cleanup hooks【F:src/memory/sqlite-manager.ts†L44-L66】 |
| 59 | + - `a2a-protocol-manager.ts`: priority queues, retry policies, and transport hooks for agent messaging【F:src/protocols/a2a/core/a2a-protocol-manager.ts†L50-L108】 |
| 60 | + - `github-a2a-pr-system.ts`: strategy-driven PR review sessions across specialized agents【F:src/core/github-a2a-pr-system.ts†L88-L152】 |
| 61 | + |
| 62 | +## Milestone 3 – Technical Debt, Security, Risk |
| 63 | +- **SQLite Persistence:** WAL pragmas enabled but no concurrent write guards or cross-platform fallback tests. |
| 64 | +- **A2A Manager:** lacks input sanitization for payload sizes and graceful shutdown if transports hang. |
| 65 | +- **Dependency Audit:** `npm audit` flags 13 vulnerabilities across `braces`, `lodash`, `minimist`, `shelljs`, etc.【685528†L1-L66】 |
| 66 | +- **CI Recommendation:** enforce `npm audit`, `eslint-plugin-security`, and upgrade vulnerable packages. |
| 67 | + |
| 68 | +## Milestone 4 – Build/Test/Deployment Reliability |
| 69 | + - **Test Status:** `npm test` → 20 failing suites (protocol translation, auth, agent counts)【120e9a†L1-L71】 |
| 70 | +- **Scripts:** Docker/Kubernetes deploy, Grafana import, health checks, enterprise optimization【F:package.json†L41-L90】 |
| 71 | +- **Docs:** `tests/TESTING_GUIDE.md` exists; expand for Node 18–24 parity and cross-platform steps. |
| 72 | + |
| 73 | +## Milestone 5 – Agentic Orchestration/Swarm |
| 74 | +- `AGENT_DEFINITIONS` enumerates 64 agents across 16 categories, extending Claude-flow taxonomy with Google roles【F:src/agents/agent-definitions.ts†L1-L74】 |
| 75 | +- Recommend priority/consensus hooks in A2A manager and additional Google service agents for GitHub PR system. |
| 76 | + |
| 77 | +## Milestone 6 – Database & Memory Integration |
| 78 | +- Implement automated tests for SQLite fallbacks (`better-sqlite3 → sqlite3 → sql.js`) and namespace hierarchies. |
| 79 | +- Add connection pooling, WAL metrics, and adapters for Postgres/Redis to reach Claude-flow parity. |
| 80 | + |
| 81 | +## Milestone 7 – Documentation & Onboarding |
| 82 | +- Merge existing `README.md`, `GEMINI.md`, `CLAUDE.md`, and migration guides into a unified onboarding tutorial. |
| 83 | +- Provide CLI walkthroughs, swarm demos, and contribution/security guides aligned with Google & Claude flows. |
| 84 | + |
| 85 | +--- |
| 86 | +### Roadmap Checklist |
| 87 | +- [ ] Harden SQLite manager for concurrency & cross-platform WAL |
| 88 | +- [ ] Add payload validation and transport timeouts to A2A protocol manager |
| 89 | +- [ ] Resolve `npm audit` vulnerabilities & pin critical deps |
| 90 | +- [ ] Fix failing unit tests and ensure Node 18–24 matrix |
| 91 | +- [ ] Extend agent taxonomy and PR review agents |
| 92 | +- [ ] Implement DB fallback tests and Postgres/Redis adapters |
| 93 | +- [ ] Consolidate onboarding documentation with guided tutorials |
| 94 | + |
0 commit comments