akbo-cli 0.0.0-stage โ 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +706 -2
- package/dist/catalog_store.d.ts +78 -0
- package/dist/catalog_store.js +375 -0
- package/dist/cleaner.d.ts +11 -0
- package/dist/cleaner.js +92 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1596 -0
- package/dist/extractors/base.d.ts +35 -0
- package/dist/extractors/base.js +17 -0
- package/dist/extractors/custom_extractor.d.ts +55 -0
- package/dist/extractors/custom_extractor.js +198 -0
- package/dist/extractors/dotnet_extractor.d.ts +11 -0
- package/dist/extractors/dotnet_extractor.js +579 -0
- package/dist/extractors/golang_extractor.d.ts +11 -0
- package/dist/extractors/golang_extractor.js +73 -0
- package/dist/extractors/index.d.ts +14 -0
- package/dist/extractors/index.js +30 -0
- package/dist/extractors/jvm_extractor.d.ts +11 -0
- package/dist/extractors/jvm_extractor.js +319 -0
- package/dist/extractors/node_extractor.d.ts +11 -0
- package/dist/extractors/node_extractor.js +306 -0
- package/dist/extractors/proto_graphql_extractor.d.ts +11 -0
- package/dist/extractors/proto_graphql_extractor.js +125 -0
- package/dist/extractors/python_extractor.d.ts +11 -0
- package/dist/extractors/python_extractor.js +298 -0
- package/dist/extractors/rust_extractor.d.ts +11 -0
- package/dist/extractors/rust_extractor.js +66 -0
- package/dist/graph_builder.d.ts +87 -0
- package/dist/graph_builder.js +1498 -0
- package/dist/harvester.d.ts +38 -0
- package/dist/harvester.js +461 -0
- package/dist/hook_generator.d.ts +26 -0
- package/dist/hook_generator.js +203 -0
- package/dist/importers/skill_importer.d.ts +43 -0
- package/dist/importers/skill_importer.js +470 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/dist/indexer.d.ts +19 -0
- package/dist/indexer.js +108 -0
- package/dist/init_service.d.ts +37 -0
- package/dist/init_service.js +246 -0
- package/dist/mcp_server.d.ts +10 -0
- package/dist/mcp_server.js +632 -0
- package/dist/pool_resolver.d.ts +40 -0
- package/dist/pool_resolver.js +84 -0
- package/dist/provider.d.ts +135 -0
- package/dist/provider.js +880 -0
- package/dist/query_service.d.ts +33 -0
- package/dist/query_service.js +161 -0
- package/dist/schema_generator.d.ts +236 -0
- package/dist/schema_generator.js +264 -0
- package/dist/standards_loader.d.ts +7 -0
- package/dist/standards_loader.js +33 -0
- package/dist/types.d.ts +265 -0
- package/dist/types.js +105 -0
- package/dist/unit_synthesizer.d.ts +22 -0
- package/dist/unit_synthesizer.js +196 -0
- package/dist/validator.d.ts +13 -0
- package/dist/validator.js +152 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.js +16 -0
- package/dist/watcher.d.ts +38 -0
- package/dist/watcher.js +132 -0
- package/package.json +56 -6
- package/schemas/index-schema.json +98 -0
- package/schemas/knowledge-unit.json +154 -0
package/README.md
CHANGED
|
@@ -1,3 +1,707 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ๐ง akbo-cli โ AI-Native Knowledge Base Oracle & Operator
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/akbo-cli)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://modelcontextprotocol.io/)
|
|
6
|
+
[](https://vitest.dev/)
|
|
7
|
+
[](https://www.npmjs.com/package/akbo-cli)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
> **Deterministic AST Harvester, Codebase Knowledge Graph (CKG) Engine & Native MCP Server**
|
|
11
|
+
> Empowers AI coding assistants (**Google Antigravity, Cursor, Claude Code, Gemini CLI, Windsurf, Copilot, Codex**) with zero-token topological context slices, cross-lingual GraphRAG query grounding, and strict architectural invariant enforcement.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ๐ฏ Why AKBO?
|
|
16
|
+
|
|
17
|
+
AI agents modifying large, polyglot, or enterprise codebases frequently suffer from:
|
|
18
|
+
1. **Speculative Grepping & Hallucination**: Blindly querying code files without understanding high-level architectural patterns, database schemas, or messaging boundaries.
|
|
19
|
+
2. **Context Dilution**: Flooding LLM context windows with thousands of lines of irrelevant source code instead of focused architectural rules.
|
|
20
|
+
3. **Cross-Lingual Mismatch**: Inability to map English developer prompts to codebases named in Spanish (`Factura`, `Pedido`), Chinese (`ๅ็ฅจ`, `็จๆท`), German (`Rechnung`, `Kunde`), or domain-specific jargon.
|
|
21
|
+
4. **Tool Incompatibility**: Agents lack standardized interfaces to query architecture invariants dynamically prior to code execution.
|
|
22
|
+
5. **Heavy SDK Bloat**: Traditional CLI tools pull in hundreds of megabytes of third-party vendor SDKs. AKBO uses **100% Node 20+ native `fetch`** across all providers, completely eliminating heavy AI SDKs and transitive bloat.
|
|
23
|
+
|
|
24
|
+
**AKBO (AI Knowledge Base Oracle & Operator)** solves this through a **6-stage deterministic pipeline** and a native **Model Context Protocol (MCP)** server:
|
|
25
|
+
|
|
26
|
+
```mermaid
|
|
27
|
+
flowchart LR
|
|
28
|
+
A["Source Codebase"] --> B["Stage 1: Deterministic Harvester<br/>(0 Tokens AST)"]
|
|
29
|
+
B --> C["Codebase Knowledge Graph<br/>(CKG Engine)"]
|
|
30
|
+
C --> D["Stage 2 & 3: Master Planner & Synthesizer<br/>(Multi-LLM / CLI)"]
|
|
31
|
+
D --> E["knowledge/ Standard Catalogs<br/>(Atomic Invariant YAMLs)"]
|
|
32
|
+
E --> F["Stage 4: Multi-Agent Hooks<br/>(AGENTS.md, CLAUDE.md, .cursorrules)"]
|
|
33
|
+
E --> G["Stage 5: Runtime Schema Validator<br/>(Zod Federation)"]
|
|
34
|
+
C & E --> H["Stage 6: Native MCP Server & CLI<br/>(0-Token Context & GraphRAG)"]
|
|
35
|
+
H --> I["AI Agents: Antigravity, Cursor, Claude Code, Gemini CLI"]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## โจ Key Features
|
|
41
|
+
|
|
42
|
+
- **๐ก๏ธ External Knowledge Pool (Zero-Touch Monorepo Isolation)**: Completely separates scanned code (`targetDir`) from knowledge bases and caches (`poolDir`) via `--pool <path>` or `AKBO_POOL_DIR`. Zero files (`.akb`, `cache.json`, `AGENTS.md`) are ever created in your target repository or subprojects. Caches are safely keyed by target directory inside `poolDir/.akb/caches/${scopeSlug}-${hash8}.json`, walks ancestor `.gitignore` files up to the git repository root with rebasing, supports zero-touch exclusions via `poolDir/.akb/ignore`, and dual-path `applies_to` matching ensures central architectural rules match when scanning any subproject.
|
|
43
|
+
- **โก Native Model Context Protocol (MCP 2.0) Server**: Built on `@modelcontextprotocol/sdk` over STDIO (`akbo mcp` / `akbo-mcp`), exposing 13 high-performance tools (`akbo_search`, `akbo_impact`, `akbo_context`, `akbo_query`, `akbo_harvest`, `akbo_validate`, `akbo_graph`, `akbo_list_invariants`, `akbo_upsert_unit`, `akbo_upsert_units`, `akbo_get_unit`, `akbo_delete_unit`, `akbo_import_skills`) and direct catalog resources with native Google Antigravity CLI (`agy`) support, tool allowlist/denylist flags (`--disable-tools`, `--zero-token-only`, `--disallow-root-scan`), `summaryOnly` payload capping, and recursive agent spawning protection (`AKBO_NESTED_AGENT: '1'`).
|
|
44
|
+
- **๐ฆ Atomic Knowledge Store & Batch Upserts (`akbo upsert`, `akbo get-unit`, `akbo delete-unit`)**: Exposes programmatic and CLI-driven atomic knowledge unit management powered by `CatalogStore`. Supports single or batch JSON/YAML unit arrays, automatic PowerShell UTF-8 BOM stripping, path normalization on `applies_to`, atomic `knowledge/index.yaml` updates via rename, built-in validation, and Windows CRLF line ending preservation.
|
|
45
|
+
- **๐ค Windows-1252 (CP1252) Source File Decoding**: Decodes non-UTF-8 legacy C# source files (e.g. Western European Windows-1252/CP1252 files with `รฑ`, `รฉ`, `รผ`, `รค`, `รถ`) using native `TextDecoder` fallback, preventing Unicode replacement character corruption and regex breakdown.
|
|
46
|
+
- **๐ Interface-to-Class `IMPLEMENTS` Edge Wiring**: Connects interface symbols directly to their concrete implementation classes (`implementsGroup` in custom extractors and Pass 2 graph linking), enabling bidirectional blast-radius impact analysis across interface abstraction layers.
|
|
47
|
+
- **๐ 0-Token Symbol Search & Directional Blast-Radius (`akbo_search` & `akbo_impact`)**: Sub-5ms in-memory substring/token search across all indexed symbols, endpoints, schemas, and invariants without LLM token consumption. Directional blast-radius calculation tracing inbound callers and dependents with topological build order and interface traversal.
|
|
48
|
+
- **๐ธ๏ธ Deterministic Codebase Knowledge Graph (CKG)**: 2-pass deterministic graph construction linking projects, controllers, endpoints, serverless triggers, messages, schemas, and invariants with 0 LLM tokens, supporting domain-clustered Mermaid subgraphs (`subgraph Domain`), $O(1)$ edge deduplication, $O(\text{depth})$ project ownership lookups, inverted schema model indexing eliminating $O(R \times S \times M)$ loops, two-tier in-memory + persistent caching (`.akb/cache.json`), in-memory mtime Knowledge Unit caching, and dot-guarded non-endpoint file fallback to owning project nodes.
|
|
49
|
+
- **๐ 0-Token Topological Neighborhood & Invariant Lookup (`akbo context` & `akbo invariants`)**: Sub-second BFS extraction of 1-hop and 2-hop topological subgraphs surrounding any entity or file, alongside instant pre-execution invariant lookup (`akbo_list_invariants`) to eliminate hallucinations before code edits.
|
|
50
|
+
- **๐ Cross-Lingual & Multi-Seed Semantic GraphRAG (`akbo query` / `akbo ask`)**: Polyglot entity resolver with punctuation-trimmed tokenization that strips trailing sentence periods, filters question stopwords, and fuses multi-entity topological neighborhoods across codebases written in Spanish, Chinese, German, or domain dialects.
|
|
51
|
+
- **๐ Zero-SDK Native Fetch Engine**: Zero third-party AI SDKs! All generative operations (Gemini, OpenAI, Anthropic, DeepSeek, Groq, Mistral, Ollama) execute over Node 20+ native `fetch`, eliminating 40+ transitive packages and deprecated dependencies.
|
|
52
|
+
- **๐ช Windows-Safe NDJSON Stdin Streaming & Error Resilience**: Headless `agy` and `gemini` CLI integration piping prompts via NDJSON stdin streaming with defensive `EPIPE`/`EOF` error listeners, completely bypassing Windows `CreateProcess` 32,767-character command-line limits (`ENAMETOOLONG`) and preventing stream crashes on early child process exit.
|
|
53
|
+
- **๐ฏ First-Class Curated Skill Ingestion (`akbo import-skills`)**: Converts `.agents/skills/**/SKILL.md` into protected Knowledge Units with targeted directory glob inference (filtering prose shorthand slashes and capturing description paths) and hierarchical workflow gate heading prioritization (`##`, `####`, nested steps).
|
|
54
|
+
- **๐ Enterprise Polyglot Harvester**: Deterministically extracts manifests, schemas, endpoints, serverless triggers, and messaging abstractions across .NET (Modern .NET 8/9, legacy .NET Framework 4.x, ASP.NET MVC 5, Web API 2, Azure Functions, WCF, EF Core, Dapper, FluentValidation, MassTransit, NServiceBus, Wolverine, MediatR, gRPC/Protobuf), Java & Kotlin (Maven, Gradle, Spring Boot, Quarkus, JPA/Hibernate, Spring Data Repositories, Spring Kafka, Spring RabbitMQ), TypeScript & Node.js (NestJS, Next.js App Router, Express, Prisma, BullMQ, pnpm/turbo/nx workspaces), Python (FastAPI, Flask, Django, SQLAlchemy, Pydantic, Celery, Dramatiq), Rust, and Go.
|
|
55
|
+
- **๐ข Enterprise Bounded Contexts (DDD Federated Catalogs)**: Two-tier Namespaced Central Hub architecture (`--domain core`, `--domain billing`) avoiding context bloat in 100+ project enterprise repositories.
|
|
56
|
+
- **๐ค Universal Agent Pre-Execution Hooks**: Emits synchronized instruction hooks across `AGENTS.md`, `GEMINI.md`, `CLAUDE.md`, `.cursorrules`, `.cursor/mcp.json`, and `.vscode/mcp.json`.
|
|
57
|
+
- **๐ป Machine-Readable `--json` Output**: Clean, banner-free JSON output modes across all primary commands for automated agent terminal tool execution.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## ๐ Quick Start
|
|
62
|
+
|
|
63
|
+
### Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Global installation via npm
|
|
67
|
+
npm install -g akbo-cli
|
|
68
|
+
|
|
69
|
+
# Or run instantly with npx (zero installation)
|
|
70
|
+
npx akbo-cli harvest .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Development Setup
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Clone the repository
|
|
77
|
+
git clone https://github.com/sureshjsreddy/akb-cli.git
|
|
78
|
+
cd akb-cli
|
|
79
|
+
|
|
80
|
+
# Install dependencies & build
|
|
81
|
+
npm install
|
|
82
|
+
npm run build
|
|
83
|
+
|
|
84
|
+
# Link CLI locally for testing
|
|
85
|
+
npm link
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Provider & Authentication Configuration
|
|
89
|
+
|
|
90
|
+
AKBO supports **Multi-LLM execution providers** via native Node 20+ `fetch` or local system CLIs:
|
|
91
|
+
|
|
92
|
+
#### 1. Google Antigravity CLI (`--agy`, Recommended for Local AGY Users)
|
|
93
|
+
Zero API key required; connects directly to your authenticated Antigravity CLI session:
|
|
94
|
+
```bash
|
|
95
|
+
akbo init . --agy
|
|
96
|
+
akbo query "Explain the billing flow" --agy
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### 2. Direct Gemini API (Fast, Zero SDK)
|
|
100
|
+
Configure a `.env` file or export your API key:
|
|
101
|
+
```ini
|
|
102
|
+
GEMINI_API_KEY=your_gemini_api_key_here
|
|
103
|
+
GEMINI_MODEL=gemini-3.5-flash
|
|
104
|
+
```
|
|
105
|
+
*(Also automatically resolves `GOOGLE_API_KEY` or `GOOGLE_GENAI_API_KEY`)*
|
|
106
|
+
|
|
107
|
+
#### 3. System Gemini CLI (Zero API Key Setup)
|
|
108
|
+
```bash
|
|
109
|
+
akbo plan . --cli
|
|
110
|
+
akbo generate . --cli
|
|
111
|
+
akbo query "Explain the billing flow" --cli
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### 4. OpenAI, Anthropic, DeepSeek, Groq & Ollama
|
|
115
|
+
```bash
|
|
116
|
+
# OpenAI
|
|
117
|
+
export OPENAI_API_KEY=sk-...
|
|
118
|
+
akbo ask "Explain the architecture" -p openai -m gpt-4o
|
|
119
|
+
|
|
120
|
+
# Anthropic Claude
|
|
121
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
122
|
+
akbo ask "Explain the architecture" -p anthropic -m claude-3-7-sonnet
|
|
123
|
+
|
|
124
|
+
# DeepSeek
|
|
125
|
+
export DEEPSEEK_API_KEY=...
|
|
126
|
+
akbo ask "Explain the architecture" -p deepseek -m deepseek-chat
|
|
127
|
+
|
|
128
|
+
# Ollama (100% Offline, Zero Cost)
|
|
129
|
+
akbo query "Explain the architecture" -p ollama
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## ๐ Model Context Protocol (MCP) Server Integration
|
|
135
|
+
|
|
136
|
+
AKBO includes a native MCP server (`src/mcp_server.ts`) operating over STDIO. It allows autonomous AI agents to introspect codebase architecture, query invariants, and harvest topology directly.
|
|
137
|
+
|
|
138
|
+
### Running the MCP Server
|
|
139
|
+
```bash
|
|
140
|
+
# Direct CLI command
|
|
141
|
+
akbo mcp [dir]
|
|
142
|
+
|
|
143
|
+
# Executable binary alias
|
|
144
|
+
akbo-mcp [dir]
|
|
145
|
+
|
|
146
|
+
# Or via npx
|
|
147
|
+
npx -y akbo-cli mcp
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Agent Configuration Matrix
|
|
151
|
+
|
|
152
|
+
| AI Tool / IDE | Setup Method | Configuration File |
|
|
153
|
+
| :--- | :--- | :--- |
|
|
154
|
+
| **Google Antigravity** | Native MCP Server Settings | Add command `akbo mcp` in Antigravity MCP settings |
|
|
155
|
+
| **Cursor AI** | Auto-detected Project MCP | Generated at [`.cursor/mcp.json`](.cursor/mcp.json) |
|
|
156
|
+
| **Claude Code** | Global or Project CLI Command | Run `claude mcp add akbo -- npx -y akbo-cli mcp` |
|
|
157
|
+
| **VS Code / Copilot** | VS Code MCP Extension | Generated at [`.vscode/mcp.json`](.vscode/mcp.json) |
|
|
158
|
+
| **Gemini CLI** | Pre-Execution Terminal Hooks | Configured via [`GEMINI.md`](GEMINI.md) calling `akbo context <target> --json` |
|
|
159
|
+
|
|
160
|
+
### MCP Configuration with External Knowledge Pool
|
|
161
|
+
For enterprise monorepos, configure your AI coding agent (e.g. `~/.gemini/config/mcp_config.json` or project MCP settings) with an external pool:
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"mcpServers": {
|
|
166
|
+
"akbo": {
|
|
167
|
+
"command": "akbo-mcp",
|
|
168
|
+
"args": ["C:/repos/EnterpriseApp/Services"],
|
|
169
|
+
"env": {
|
|
170
|
+
"AKBO_POOL_DIR": "C:/AKBO/EnterprisePool",
|
|
171
|
+
"AKB_PROVIDER": "agy"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
- **Zero repository files**: All knowledge YAMLs, standards, and per-target caches live in the external pool.
|
|
178
|
+
- **Cross-subfolder flexibility**: Run from any subfolder (e.g. `Services/Billing`); AKBO matches central rules and keeps caches cleanly separated.
|
|
179
|
+
|
|
180
|
+
### Auto-Generated MCP Configuration
|
|
181
|
+
Running `akbo init-hooks .` or `akbo generate .` automatically generates `.cursor/mcp.json` and `.vscode/mcp.json`:
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"mcpServers": {
|
|
186
|
+
"akbo": {
|
|
187
|
+
"command": "npx",
|
|
188
|
+
"args": ["-y", "akbo-cli", "mcp"],
|
|
189
|
+
"env": {}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Exposed MCP 2.0 Tools & Resources
|
|
196
|
+
|
|
197
|
+
| Tool / Resource | Type | Description |
|
|
198
|
+
| :--- | :--- | :--- |
|
|
199
|
+
| **`akbo_search`** | Tool | Fast, zero-token in-memory symbol search across symbols, endpoints, schemas (<5ms). |
|
|
200
|
+
| **`akbo_impact`** | Tool | Directional blast-radius and inbound dependent calculation with topological build ordering and `IMPLEMENTS` interface traversal. |
|
|
201
|
+
| **`akbo_context`** | Tool | Extracts 0-token topological neighborhood (1โ2 hops) & active invariants for an entity, class, file, or endpoint. |
|
|
202
|
+
| **`akbo_query`** | Tool | Executes GraphRAG query strictly grounded in the CKG (supports `provider: 'agy'`, Gemini, OpenAI, Claude). |
|
|
203
|
+
| **`akbo_harvest`** | Tool | Deterministically scans codebase topology, manifests, schemas, endpoints, and validation rules (0 tokens). |
|
|
204
|
+
| **`akbo_validate`** | Tool | Validates `knowledge/` directory against runtime Zod schemas and cross-reference standards. |
|
|
205
|
+
| **`akbo_graph`** | Tool | Deterministically builds and exports CKG with `nodeTypes`, `domain`, and `maxNodes` filtering. |
|
|
206
|
+
| **`akbo_list_invariants`** | Tool | Retrieves active architectural invariants filtered by target file, domain, or search query (`query`) with complete metadata (0 tokens). |
|
|
207
|
+
| **`akbo_upsert_unit`** | Tool | Atomically adds or updates a knowledge standard or decision in the central pool (supports single unit or batch array with built-in validation). |
|
|
208
|
+
| **`akbo_upsert_units`** | Tool | Batch upserts multiple knowledge units atomically into the pool and returns catalog validation. |
|
|
209
|
+
| **`akbo_get_unit`** | Tool | Fetches complete knowledge unit YAML and metadata by unique ID. |
|
|
210
|
+
| **`akbo_delete_unit`** | Tool | Deletes a knowledge unit from the pool, updates `index.yaml`, decrements counts, and clears caches. |
|
|
211
|
+
| **`akbo_import_skills`** | Tool | Ingests agent skills (`.agents/skills/**/SKILL.md`) directly into the external knowledge pool. |
|
|
212
|
+
| **`akbo://knowledge/index`** | Resource | Provides real-time read access to the project's master `knowledge/index.yaml` catalog. |
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## ๐ ๏ธ Complete CLI Command Reference
|
|
217
|
+
|
|
218
|
+
### Staged Pipeline & Onboarding Commands
|
|
219
|
+
|
|
220
|
+
#### 0. `akbo init [dir] [-m <model>] [--cli] [-d <domain>] [--no-clean] [-j, --json]` (All-In-One Onboarding)
|
|
221
|
+
Executes the full automated 5-stage setup: harvest -> plan -> generate -> hooks -> schemas -> validate in one single command:
|
|
222
|
+
```bash
|
|
223
|
+
# Initialize current workspace with default Gemini Flash
|
|
224
|
+
akbo init .
|
|
225
|
+
|
|
226
|
+
# Initialize using local Gemini CLI (0 API key required)
|
|
227
|
+
akbo init . --cli
|
|
228
|
+
|
|
229
|
+
# Initialize a specific bounded context domain
|
|
230
|
+
akbo init src/Billing --domain billing
|
|
231
|
+
|
|
232
|
+
# Machine-readable JSON output for automated agent tooling
|
|
233
|
+
akbo init . --json
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### 1. `akbo harvest [dir] [-o <path>] [-j, --json]` (Stage 1)
|
|
237
|
+
Deterministically harvests repository manifests, schemas, endpoints, serverless triggers, and messaging handlers with **0 LLM tokens**:
|
|
238
|
+
```bash
|
|
239
|
+
akbo harvest .
|
|
240
|
+
akbo harvest . --json
|
|
241
|
+
akbo harvest src/Billing -o .akb/billing-skeleton.json
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
#### 2. `akbo plan [dir] [-d <domain>] [--pool <path>] [--cli]` (Stage 2)
|
|
245
|
+
Synthesizes a proposed master index (`.akb/proposed-index.yaml`) proposing 4 to 8 high-impact atomic Knowledge Units using Gemini Flash (~3k tokens):
|
|
246
|
+
```bash
|
|
247
|
+
akbo plan .
|
|
248
|
+
akbo plan src/Billing --domain billing
|
|
249
|
+
akbo plan . --pool C:/AKBO/Pool
|
|
250
|
+
akbo plan . --cli
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### 3. `akbo generate [dir] [-d <domain>] [--clean] [--cli]` (Stage 3 & 4)
|
|
254
|
+
Synthesizes atomic YAML knowledge units with strict `rule`, `do`, and `dont` directives, runs runtime validation, and bootstraps multi-agent pre-execution hooks:
|
|
255
|
+
```bash
|
|
256
|
+
akbo generate .
|
|
257
|
+
akbo generate . --clean
|
|
258
|
+
akbo generate src/Billing --domain billing --clean
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### 4. `akbo validate [dir] [--pool <path>] [-j, --json]` (Stage 5)
|
|
262
|
+
Verifies that all knowledge units strictly conform to runtime Zod schemas, path normalization rules, and cross-references:
|
|
263
|
+
```bash
|
|
264
|
+
akbo validate .
|
|
265
|
+
akbo validate . --pool C:/AKBO/Enterprise
|
|
266
|
+
akbo validate . --json
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
#### 5. `akbo init-hooks [dir]` (Multi-Agent Bootstrapper)
|
|
270
|
+
Bootstraps or updates multi-agent instruction files and MCP configurations across `AGENTS.md`, `GEMINI.md`, `CLAUDE.md`, `.cursorrules`, `.cursor/mcp.json`, and `.vscode/mcp.json`:
|
|
271
|
+
```bash
|
|
272
|
+
akbo init-hooks .
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
#### 6. `akbo mcp [dir] [--pool <path>] [--disable-tools <csv>] [--zero-token-only] [--disallow-root-scan] [--disallow-dirs <csv>]` (Stage 6)
|
|
276
|
+
Launches the native Model Context Protocol (MCP) server over STDIO for AI agent integration with configurable tool allowlists and monorepo root scan guards:
|
|
277
|
+
```bash
|
|
278
|
+
# Standard MCP server launch
|
|
279
|
+
akbo mcp .
|
|
280
|
+
|
|
281
|
+
# MCP server with external knowledge pool
|
|
282
|
+
akbo mcp . --pool C:/AKBO/EnterprisePool
|
|
283
|
+
|
|
284
|
+
# Zero-token mode (disables LLM-backed akbo_query) and protects root directory from accidental scans
|
|
285
|
+
akbo mcp . --zero-token-only --disallow-root-scan
|
|
286
|
+
|
|
287
|
+
# Selective tool disabling via CLI flag or AKBO_DISABLE_TOOLS environment variable
|
|
288
|
+
akbo mcp . --disable-tools akbo_query,akbo_import_skills
|
|
289
|
+
|
|
290
|
+
# Executable alias
|
|
291
|
+
akbo-mcp --pool C:/AKBO/EnterprisePool
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
#### 7. `akbo upsert [dir] --pool <path> --from-file <file> [--stdin] [--validate] [-j, --json]` (Knowledge Unit Upsert)
|
|
295
|
+
Atomically upserts 1 to $N$ knowledge units or architecture decisions into the external pool, updates `knowledge/index.yaml` once via atomic rename, and runs validation:
|
|
296
|
+
```bash
|
|
297
|
+
# Upsert single standard from JSON file
|
|
298
|
+
akbo upsert . --pool C:/AKBO/EnterprisePool --from-file unit.json
|
|
299
|
+
|
|
300
|
+
# Upsert batch of units with machine-readable JSON output
|
|
301
|
+
akbo upsert . --pool C:/AKBO/EnterprisePool --from-file batch-units.json -j
|
|
302
|
+
|
|
303
|
+
# Stream unit via STDIN (PowerShell UTF-8 BOM automatically stripped)
|
|
304
|
+
cat new-standard.yaml | akbo upsert . --pool C:/AKBO/EnterprisePool --stdin
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
#### 8. `akbo get-unit <id> [dir] [--pool <path>] [-j, --json]` (Knowledge Unit Retrieval)
|
|
308
|
+
Fetches the full YAML definition or parsed JSON representation of any knowledge unit or decision by ID:
|
|
309
|
+
```bash
|
|
310
|
+
# Fetch full unit YAML
|
|
311
|
+
akbo get-unit ARCH-SYS-001 . --pool C:/AKBO/EnterprisePool
|
|
312
|
+
|
|
313
|
+
# Fetch unit in machine-readable JSON
|
|
314
|
+
akbo get-unit ARCH-SYS-001 . --pool C:/AKBO/EnterprisePool -j
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
#### 9. `akbo delete-unit <id> [dir] [--pool <path>] [--validate] [-j, --json]` (Knowledge Unit Deletion)
|
|
318
|
+
Deletes `knowledge/<domain>/<id>.yaml`, removes its entry from `knowledge/index.yaml`, decrements `knowledge_units_count`, clears caches, and re-validates:
|
|
319
|
+
```bash
|
|
320
|
+
akbo delete-unit DEV-OLD-001 . --pool C:/AKBO/EnterprisePool
|
|
321
|
+
akbo delete-unit DEV-OLD-001 . --pool C:/AKBO/EnterprisePool -j
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
#### 10. External Knowledge Pool & Monorepo Isolation (`--pool <path>`)
|
|
325
|
+
Pass `--pool <path>` (or set `AKBO_POOL_DIR`) on any command to keep the scanned code directory 100% clean and untouched:
|
|
326
|
+
```bash
|
|
327
|
+
# Harvest subproject into external pool
|
|
328
|
+
akbo harvest src/Billing --pool C:/AKBO/Enterprise
|
|
329
|
+
|
|
330
|
+
# Extract context for an endpoint using rules from external pool
|
|
331
|
+
akbo context "POST /api/invoices" --pool C:/AKBO/Enterprise
|
|
332
|
+
|
|
333
|
+
# Validate external knowledge pool
|
|
334
|
+
akbo validate . --pool C:/AKBO/Enterprise
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
### GraphRAG & Pre-Execution Engine Commands
|
|
340
|
+
|
|
341
|
+
#### 11. `akbo graph [dir] [--format json|mermaid|markdown] [--no-cluster] [--no-cache] [--pool <path>] [-o <path>] [-j, --json]`
|
|
342
|
+
Deterministically builds the Codebase Knowledge Graph (CKG) linking projects, endpoints, handlers, messages, schemas, validators, and invariants:
|
|
343
|
+
```bash
|
|
344
|
+
# Export raw JSON AST (with mtime caching)
|
|
345
|
+
akbo graph . --json
|
|
346
|
+
|
|
347
|
+
# Export domain-clustered Mermaid diagram (subgraphs by bounded context)
|
|
348
|
+
akbo graph . --format mermaid -o docs/architecture.mmd
|
|
349
|
+
|
|
350
|
+
# Export using external pool for caches
|
|
351
|
+
akbo graph . --pool C:/AKBO/EnterprisePool --format mermaid -o docs/architecture.mmd
|
|
352
|
+
|
|
353
|
+
# Export flat Mermaid diagram without subgraphs
|
|
354
|
+
akbo graph . --format mermaid --no-cluster
|
|
355
|
+
|
|
356
|
+
# Export full Markdown report with Mermaid diagram and entity table
|
|
357
|
+
akbo graph . --format markdown -o docs/architecture-graph.md
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
#### 12. `akbo invariants [dir] [-f <file>] [-d <domain>] [-q <query>] [--pool <path>] [-j, --json]`
|
|
361
|
+
Retrieves active architectural standards and invariants directly from knowledge units with 0 LLM tokens, supporting file-pattern, domain, and substring/keyword query filtering:
|
|
362
|
+
```bash
|
|
363
|
+
# Inspect all loaded invariants
|
|
364
|
+
akbo invariants .
|
|
365
|
+
|
|
366
|
+
# Find invariants strictly applicable to a target file
|
|
367
|
+
akbo invariants . -f src/cli.ts
|
|
368
|
+
|
|
369
|
+
# Fast substring / keyword search across rules, titles, and directives (0ms)
|
|
370
|
+
akbo invariants . -q Invoice -j
|
|
371
|
+
|
|
372
|
+
# Query invariants using an external knowledge pool
|
|
373
|
+
akbo invariants . -f src/cli.ts --pool C:/AKBO/EnterprisePool
|
|
374
|
+
|
|
375
|
+
# Filter invariants by domain in machine-readable JSON (includes reason, type, status, authority)
|
|
376
|
+
akbo invariants . -d architecture --json
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
#### 13. `akbo context <target> [dir] [-h <hops>] [--no-cache] [--pool <path>] [-j, --json]`
|
|
380
|
+
Extracts the 0-token topological neighborhood (1 or 2 hops) and active invariants around a target entity before modifying code:
|
|
381
|
+
```bash
|
|
382
|
+
# Target controller or class
|
|
383
|
+
akbo context InvoicesController.cs
|
|
384
|
+
|
|
385
|
+
# Target controller with external pool
|
|
386
|
+
akbo context InvoicesController.cs --pool C:/AKBO/EnterprisePool
|
|
387
|
+
|
|
388
|
+
# Target HTTP endpoint with machine-readable JSON
|
|
389
|
+
akbo context "POST /api/invoices" -h 2 --json
|
|
390
|
+
|
|
391
|
+
# Target database context or validator
|
|
392
|
+
akbo context BillingDbContext -h 1
|
|
393
|
+
akbo context CreateInvoiceValidator
|
|
394
|
+
|
|
395
|
+
# Target localized or non-English identifiers
|
|
396
|
+
akbo context FacturaController
|
|
397
|
+
akbo context "ObtenerFactura"
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
#### 14. `akbo query <prompt> [dir] [-m <model>] [--cli] [--agy] [--no-cache] [--pool <path>] [-j, --json]` (Alias: `akbo ask`)
|
|
401
|
+
Answers architectural questions strictly grounded in the Codebase Knowledge Graph with zero hallucinations and cross-lingual seed resolution:
|
|
402
|
+
```bash
|
|
403
|
+
# English architectural query
|
|
404
|
+
akbo query "How are invoices created and what data models are used?"
|
|
405
|
+
|
|
406
|
+
# Query with external pool
|
|
407
|
+
akbo query "How are invoices created and what data models are used?" --pool C:/AKBO/EnterprisePool
|
|
408
|
+
|
|
409
|
+
# Query with machine-readable JSON output
|
|
410
|
+
akbo query "What validation rules are enforced for CreateInvoiceCommand?" --json
|
|
411
|
+
|
|
412
|
+
# Local Antigravity CLI query (0 API key)
|
|
413
|
+
akbo ask "Explain the customer billing architecture" --agy
|
|
414
|
+
|
|
415
|
+
# Local Gemini CLI query (0 API key)
|
|
416
|
+
akbo ask "Explain the customer billing architecture" --cli
|
|
417
|
+
|
|
418
|
+
# Query non-English codebase in English
|
|
419
|
+
akbo query "Which Azure Functions consume ServiceBus messages?"
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
#### 15. `akbo clean [dir] [-a, --all] [--pool <path>]`
|
|
423
|
+
Purges intermediate `.akb/` artifacts to keep private repositories lean and save disk space:
|
|
424
|
+
```bash
|
|
425
|
+
# Clean .akb/ temporary skeletons and plans
|
|
426
|
+
akbo clean .
|
|
427
|
+
|
|
428
|
+
# Clean .akb/ in external pool
|
|
429
|
+
akbo clean . --pool C:/AKBO/EnterprisePool
|
|
430
|
+
|
|
431
|
+
# Clean .akb/ and compiled TypeScript build files (dist/)
|
|
432
|
+
akbo clean . --all
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
#### 16. `akbo watch [dir] [-o <path>] [--format <format>] [--no-cluster] [--pool <path>]`
|
|
436
|
+
Continuously watches the codebase filesystem for changes and auto-regenerates the Codebase Knowledge Graph and live architecture diagrams:
|
|
437
|
+
```bash
|
|
438
|
+
# Live watch and auto-render Mermaid architecture
|
|
439
|
+
akbo watch . -o docs/architecture.mmd
|
|
440
|
+
|
|
441
|
+
# Live watch using external pool for caches
|
|
442
|
+
akbo watch . --pool C:/AKBO/Pool -o docs/architecture.mmd
|
|
443
|
+
|
|
444
|
+
# Live watch and auto-render Markdown graph document
|
|
445
|
+
akbo watch . --format markdown -o docs/architecture-graph.md
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
#### 17. `akbo schema [dir] [--pool <path>] [-j, --json]`
|
|
449
|
+
Emits standard JSON Schemas (`schemas/knowledge-unit.json` and `schemas/index-schema.json`) and configures `.vscode/settings.json` with `yaml.schemas` associations to provide real-time IDE hover docs, validation, and autocompletion:
|
|
450
|
+
```bash
|
|
451
|
+
# Generate schemas and configure VS Code / Cursor IDE settings
|
|
452
|
+
akbo schema .
|
|
453
|
+
|
|
454
|
+
# Generate schemas inside an external knowledge pool
|
|
455
|
+
akbo schema . --pool C:/AKBO/Pool
|
|
456
|
+
|
|
457
|
+
# Output schemas as JSON
|
|
458
|
+
akbo schema . --json
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
#### 18. `akbo import-skills [dir] [--domain <domain>] [--pool <path>] [-j, --json]`
|
|
462
|
+
Ingests and converts curated agent skills (`.agents/skills/**/SKILL.md` or custom skill trees) into first-class **Skill Pointer Knowledge Units**:
|
|
463
|
+
- Preserves explicit references (`skill_file`, `reference_files`) without duplicating markdown bodies.
|
|
464
|
+
- Intelligently infers targeted `applies_to` directory globs from backticked paths and descriptions before falling back to language wildcards.
|
|
465
|
+
- Restricts and prioritizes workflow gate checklists extracted from dedicated verification sections (`## Implementation Gates`, `## Completion Gates`, etc.).
|
|
466
|
+
- Sets `authority.level: human_curated` to protect human-authored skills from overwrites during automatic regeneration.
|
|
467
|
+
```bash
|
|
468
|
+
# Import all repository skills into knowledge units
|
|
469
|
+
akbo import-skills .
|
|
470
|
+
|
|
471
|
+
# Import into an external knowledge pool
|
|
472
|
+
akbo import-skills . --pool C:/AKBO/Enterprise
|
|
473
|
+
|
|
474
|
+
# Import into a specific domain
|
|
475
|
+
akbo import-skills . --domain billing
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
#### 19. Standards & Deprecation Enforcement (`.akb/standards.yaml`)
|
|
479
|
+
Enforce modern architecture patterns and flag deprecated anti-patterns across the Codebase Knowledge Graph. When defined in `.akb/standards.yaml`, `akbo context` and `akbo query` automatically surface proactive warnings and guidance:
|
|
480
|
+
```yaml
|
|
481
|
+
standards:
|
|
482
|
+
- name: Modern Async Repository Pattern
|
|
483
|
+
target: "Use IAsyncRepository<T> and async EF Core operations"
|
|
484
|
+
deprecated: "Synchronous DbContext queries or direct SQL execution without parameters"
|
|
485
|
+
applies_to:
|
|
486
|
+
- "**/*Repository.cs"
|
|
487
|
+
- "**/*Service.cs"
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
### ๐ค Execution Providers (Multi-LLM & CLI Engines)
|
|
493
|
+
|
|
494
|
+
`akbo-cli` supports seamless synthesis and GraphRAG querying across cloud API keys, local offline models, and system CLIs without heavy third-party SDK dependencies (powered by Node 20+ native `fetch`):
|
|
495
|
+
|
|
496
|
+
| Provider | Flags / Environment | Supported Models / Notes |
|
|
497
|
+
| :--- | :--- | :--- |
|
|
498
|
+
| **Gemini (Default)** | `--provider gemini` or `GEMINI_API_KEY` | `gemini-3.5-flash`, `gemini-2.5-pro` |
|
|
499
|
+
| **Google Antigravity CLI** | `--agy` or `--provider agy` | Uses local `agy` session on PATH (0 API key required) |
|
|
500
|
+
| **System Gemini CLI** | `--cli` or `--provider cli` | Uses local `gemini` CLI on PATH (0 API key required) |
|
|
501
|
+
| **OpenAI** | `--provider openai` or `OPENAI_API_KEY` | `gpt-4o`, `gpt-4o-mini`, `o1`, `o3-mini` (auto-detected via `-m gpt-*`) |
|
|
502
|
+
| **Anthropic Claude** | `--provider anthropic` or `ANTHROPIC_API_KEY` | `claude-3-7-sonnet`, `claude-3-5-haiku` (auto-detected via `-m claude-*`) |
|
|
503
|
+
| **DeepSeek** | `--provider deepseek` or `DEEPSEEK_API_KEY` | `deepseek-chat`, `deepseek-reasoner` (auto-detected via `-m deepseek-*`) |
|
|
504
|
+
| **Groq** | `--provider groq` or `GROQ_API_KEY` | `llama-3.3-70b-versatile`, `mixtral-8x7b-32768` |
|
|
505
|
+
| **Ollama / Local** | `--provider ollama` `[--base-url <url>]` | `http://localhost:11434/v1` (100% offline, zero-token cost) |
|
|
506
|
+
| **OpenAI-Compatible** | `--provider openai-compatible --base-url <url>` | Any custom or enterprise private endpoint |
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
# Query via OpenAI
|
|
510
|
+
akbo ask "Explain the customer billing architecture" -p openai -m gpt-4o
|
|
511
|
+
|
|
512
|
+
# Query via Anthropic Claude
|
|
513
|
+
akbo query "Explain the customer billing architecture" -p anthropic -m claude-3-7-sonnet
|
|
514
|
+
|
|
515
|
+
# Query via Google Antigravity CLI (0 API key)
|
|
516
|
+
akbo query "Explain the customer billing architecture" --agy
|
|
517
|
+
|
|
518
|
+
# Query via local Ollama
|
|
519
|
+
akbo query "What validation rules are enforced for CreateInvoiceCommand?" -p ollama
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## ๐ Multi-Ecosystem Harvester Matrix
|
|
525
|
+
|
|
526
|
+
AKBO extracts topology, schemas, and routes deterministically with 0 tokens across diverse language ecosystems:
|
|
527
|
+
|
|
528
|
+
| Ecosystem / Framework | Discovered Manifests & Schemas | Discovered Routes, Triggers & RPCs |
|
|
529
|
+
| :--- | :--- | :--- |
|
|
530
|
+
| **Java & Kotlin (JVM)** | Maven (`pom.xml` with reactor modules), Gradle (`build.gradle.kts`, `settings.gradle.kts`), JPA / Hibernate (`@Entity`, `@Table`), Spring Data (`JpaRepository<T, ID>`) | Spring Boot (`@RestController`, `@RequestMapping`, `@GetMapping`, `@PostMapping`), Quarkus / JAX-RS (`@Path`), Spring Kafka (`@KafkaListener`), Spring RabbitMQ (`@RabbitListener`) |
|
|
531
|
+
| **Modern .NET (8/9)** | `*.sln`, `*.csproj`, `Directory.Build.props`, `Directory.Packages.props`, EF Core (`DbContext`, `DbSet<T>`, `IEntityTypeConfiguration<T>`, `ToTable`) | ASP.NET Core Controllers, Minimal APIs (`app.MapGet`), Route tokens (`[controller]`, `[action]`), MediatR commands/queries |
|
|
532
|
+
| **Legacy .NET Framework (4.x)** | Legacy `*.csproj` (`v4.x`), NuGet `packages.config`, `web.config` (connection strings, auth), EDMX (`*.edmx`) Database-First models | ASP.NET MVC 5 Controllers (`ActionResult`), ASP.NET Web API 2 (`ApiController`), `Global.asax.cs` entry points |
|
|
533
|
+
| **Serverless & Functions** | Trigger bindings across in-process and isolated worker models | Azure Functions (`[FunctionName]`, `[Function]`) with `HttpTrigger`, `ServiceBusTrigger`, `QueueTrigger`, `BlobTrigger`, `CosmosDBTrigger`, `TimerTrigger` |
|
|
534
|
+
| **Enterprise Persistence** | EF Core Fluent API table mappings (`ToTable("table_name")`), Dapper raw SQL queries (`SELECT ... FROM ...`) | Relational data persistence wiring (`PERSISTED_BY` graph edges) |
|
|
535
|
+
| **Validation & Messaging** | FluentValidation (`AbstractValidator<T>`, `RuleFor(...)`) | MassTransit (`IConsumer<T>`), NServiceBus (`IHandleMessages<T>`), Wolverine conventional handlers (`Handle`, `Consume`), MediatR notifications |
|
|
536
|
+
| **gRPC & Protobuf** | Direct `*.proto` schema extraction (services, RPCs, messages) | Overridden C# gRPC service implementations (`*GrpcBase`), Java gRPC service implementations (`*Grpc.*ImplBase`), and cross-language gRPC client calls |
|
|
537
|
+
| **Node.js & TypeScript** | `package.json` workspaces, `pnpm-workspace.yaml`, `turbo.json`, `nx.json`, Prisma (`schema.prisma` models & enums), Drizzle ORM (`pgTable`), TypeORM (`@Entity`) | NestJS (`@Controller`, `@MessagePattern`), Next.js App Router (`route.ts`) & Pages Router (`pages/api`), Express/Fastify routes, BullMQ workers & queues (`new Worker`, `new Queue`, `@Processor`, `@Process`), `fetch()` and `axios` client calls |
|
|
538
|
+
| **Rust** | `Cargo.toml`, DB entity structs | Tauri commands (`#[tauri::command]`), Actix-web, Axum |
|
|
539
|
+
| **Python** | `pyproject.toml` (Poetry & PEP 621), `requirements.txt`, `Pipfile`, SQLAlchemy (models & `__tablename__`), Pydantic (`BaseModel`), SQLModel, Django models | FastAPI (`@app.get`, `@router.post`), Flask (Blueprints, `@app.route`), Django (`urls.py`, ViewSets), Celery tasks (`@app.task`, `@shared_task`), Dramatiq actors (`@dramatiq.actor`), `requests` and `httpx` client calls |
|
|
540
|
+
| **Go** | `go.mod`, GORM models | Gin, Echo, Chi, Fiber HTTP routers |
|
|
541
|
+
| **Polyglot Cross-Boundary Wiring** | Cross-language HTTP calls (`fetch`, `axios`, `HttpClient`, `requests`, `httpx`, `WebClient`, `RestTemplate`), cross-language gRPC calls (`stub.Method`, `client.MethodAsync`), canonical event normalization | Directed `CALLS_HTTP` and `CALLS_GRPC` graph edges connecting client callers and projects to server endpoints across boundaries; `RELATES_TO` unifying canonical events (`InvoiceCreated` โ `invoice-created` โ `invoice_created`) with `CONSUMES_EVENT` and `DISPATCHES` |
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## ๐ Polyglot Monorepo Graphs & Cross-Boundary Wiring
|
|
546
|
+
|
|
547
|
+
In modern enterprise architectures, services written in different programming languages interact over network boundaries via HTTP APIs, gRPC contracts, and distributed message brokers.
|
|
548
|
+
|
|
549
|
+
AKBO constructs a unified, multi-ecosystem **Codebase Knowledge Graph (CKG)** with **0 LLM tokens**, deterministically connecting callers, servers, publishers, and subscribers across language boundaries:
|
|
550
|
+
|
|
551
|
+
```mermaid
|
|
552
|
+
flowchart LR
|
|
553
|
+
subgraph Frontend["TypeScript / Next.js"]
|
|
554
|
+
NEXT["fetch('/api/invoices')<br/><i>[HTTP Client]</i>"]
|
|
555
|
+
end
|
|
556
|
+
|
|
557
|
+
subgraph BackendAPI[".NET 9 ASP.NET Core"]
|
|
558
|
+
API["InvoicesController<br/>[HttpPost] CreateInvoice"]
|
|
559
|
+
BUS["MassTransit<br/>Publish<InvoiceCreated>"]
|
|
560
|
+
end
|
|
561
|
+
|
|
562
|
+
subgraph WorkerService["Java / Spring Boot"]
|
|
563
|
+
KAFKA["@KafkaListener<br/>topic = 'invoice-created'"]
|
|
564
|
+
JPA["InvoiceRepository.save()"]
|
|
565
|
+
end
|
|
566
|
+
|
|
567
|
+
subgraph AIService["Python / FastAPI & Celery"]
|
|
568
|
+
PY_EP["@app.post('/api/ai/audit')<br/>def audit_invoice(...)"]
|
|
569
|
+
CELERY["@celery.task<br/>invoice_created"]
|
|
570
|
+
end
|
|
571
|
+
|
|
572
|
+
NEXT -->|CALLS_HTTP| API
|
|
573
|
+
API -->|EXPOSES| BUS
|
|
574
|
+
BUS -->|DISPATCHES| KAFKA
|
|
575
|
+
BUS -->|DISPATCHES| CELERY
|
|
576
|
+
KAFKA -->|PERSISTS| JPA
|
|
577
|
+
API -.->|CALLS_HTTP| PY_EP
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Key Capabilities:
|
|
581
|
+
1. **HTTP/REST Call Bridging (`CALLS_HTTP`)**:
|
|
582
|
+
- Detects client-side HTTP calls across languages: `fetch()`, `axios`, C# `HttpClient` (`GetAsync`, `PostAsync`), Python `requests`/`httpx`, and Java `WebClient`/`RestTemplate`.
|
|
583
|
+
- Supports wildcard and parameterized route matching (e.g. `fetch('/api/orders/${id}')` connects directly to `router.get('/api/orders/:id')`).
|
|
584
|
+
- Connects both the client caller node and the caller project node to the target server endpoint.
|
|
585
|
+
2. **gRPC Cross-Language Linking (`CALLS_GRPC`)**:
|
|
586
|
+
- Matches Python stubs (`stub.CreateInvoice`), TypeScript clients (`client.CreateInvoice`), and Java stubs (`blockingStub.createInvoice`) to C# and Java service implementations (`*GrpcBase`, `*Grpc.*ImplBase`) via shared `.proto` definitions.
|
|
587
|
+
3. **Canonical Event Matching (`RELATES_TO`)**:
|
|
588
|
+
- Unifies disparate naming conventions across languages:
|
|
589
|
+
- .NET: `InvoiceCreated` (PascalCase)
|
|
590
|
+
- Java / Kafka: `invoice-created` (kebab-case)
|
|
591
|
+
- Python / Celery: `invoice_created` (snake_case)
|
|
592
|
+
- Wires bidirectional `RELATES_TO` edges between message variants, allowing 2-hop neighborhood extraction (`akbo context`) to trace the entire lifecycle from producer to consumers across all languages in **0 tokens**.
|
|
593
|
+
|
|
594
|
+
### Cross-Boundary Context Extraction:
|
|
595
|
+
```bash
|
|
596
|
+
# Trace an endpoint and all upstream frontend callers + downstream services
|
|
597
|
+
akbo context "POST /api/invoices" -h 2 --json
|
|
598
|
+
|
|
599
|
+
# Trace an event across .NET publisher, Java Kafka consumer, and Python Celery worker
|
|
600
|
+
akbo context "InvoiceCreated" -h 2
|
|
601
|
+
|
|
602
|
+
# Grounded GraphRAG query tracing cross-language flows
|
|
603
|
+
akbo query "Trace the full lifecycle of an invoice from the Next.js frontend to background workers"
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
## ๐ข Enterprise Bounded Contexts (DDD Namespaced Central Hub)
|
|
609
|
+
|
|
610
|
+
In large enterprise repositories (e.g. 100+ microservice projects in a single monorepo), a flat `knowledge/index.yaml` causes context window bloat. AKBO addresses this with a two-tier **Namespaced Central Hub**:
|
|
611
|
+
|
|
612
|
+
```
|
|
613
|
+
knowledge/
|
|
614
|
+
โโโ index.yaml # Master Catalog Router (routes to domains)
|
|
615
|
+
โโโ core/
|
|
616
|
+
โ โโโ index.yaml # Core enterprise standards catalog
|
|
617
|
+
โ โโโ ARCH-SYS-001.yaml
|
|
618
|
+
โ โโโ DEV-TS-001.yaml
|
|
619
|
+
โโโ domains/
|
|
620
|
+
โโโ billing/
|
|
621
|
+
โ โโโ index.yaml # Billing bounded context catalog
|
|
622
|
+
โ โโโ ARCH-BILLING-001.yaml
|
|
623
|
+
โโโ ordering/
|
|
624
|
+
โโโ index.yaml # Ordering bounded context catalog
|
|
625
|
+
โโโ ARCH-ORDER-001.yaml
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
```bash
|
|
629
|
+
# 1. Harvest & generate enterprise core catalog (applies to all code)
|
|
630
|
+
akbo harvest . -o .akb/core-skeleton.json
|
|
631
|
+
akbo plan . --domain core
|
|
632
|
+
akbo generate . --domain core --clean
|
|
633
|
+
|
|
634
|
+
# 2. Harvest & generate a Bounded Context (scoped via applies_to)
|
|
635
|
+
akbo harvest src/Billing -o .akb/billing-skeleton.json
|
|
636
|
+
akbo plan src/Billing --domain billing
|
|
637
|
+
akbo generate src/Billing --domain billing --clean
|
|
638
|
+
|
|
639
|
+
# 3. Validate entire federated catalog hierarchy
|
|
640
|
+
akbo validate .
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
## ๐ Knowledge Unit Standard Specification
|
|
646
|
+
|
|
647
|
+
Every knowledge unit is persisted as an atomic YAML file adhering to runtime Zod validation:
|
|
648
|
+
|
|
649
|
+
```yaml
|
|
650
|
+
id: ARCH-SYS-001
|
|
651
|
+
type: architecture_standard
|
|
652
|
+
title: CLI Command Engine & Dependency Architecture
|
|
653
|
+
domain: architecture
|
|
654
|
+
status: approved
|
|
655
|
+
version: 1.1.0
|
|
656
|
+
authority:
|
|
657
|
+
level: official
|
|
658
|
+
confidence: high
|
|
659
|
+
owner:
|
|
660
|
+
team: core_architecture
|
|
661
|
+
applies_to:
|
|
662
|
+
- cli
|
|
663
|
+
- backend
|
|
664
|
+
- tooling
|
|
665
|
+
rule: "The CLI application must strictly operate as a native ES Module ('type': 'module') using NodeNext module resolution, requiring explicit '.js' file extensions on all relative TypeScript imports, top-level executable shebang bindings, dual CLI/MCP dispatch (akbo mcp / akbo-mcp), and machine-readable --json output modes."
|
|
666
|
+
do:
|
|
667
|
+
- Include '#!/usr/bin/env node' at line 1 of 'src/cli.ts' and load 'dotenv/config' at top-level initialization.
|
|
668
|
+
- Append explicit '.js' relative path extensions for all local module imports.
|
|
669
|
+
- Normalize cross-platform directory paths using path.resolve() and backslash normalization.
|
|
670
|
+
- Expose native Model Context Protocol (MCP) server over STDIO via 'akbo mcp [dir]' and executable binary alias 'akbo-mcp'.
|
|
671
|
+
- Support machine-readable '-j, --json' output flags across pipeline commands, suppressing console decorative banners.
|
|
672
|
+
dont:
|
|
673
|
+
- Do not use CommonJS require() or omit '.js' file extensions in relative import specifiers.
|
|
674
|
+
- Do not write un-normalized Windows-style path strings containing raw backslashes into target configuration files.
|
|
675
|
+
- Do not print chalk or decorative text to stdout when --json mode is activated.
|
|
676
|
+
reason: Explicit ES module resolution prevents module runtime errors in modern Node.js environments, path normalization ensures deterministic cross-platform execution (Windows vs POSIX), and dual CLI/MCP stdio interfaces allow autonomous AI agents to execute tools deterministically.
|
|
677
|
+
related_items:
|
|
678
|
+
- ARCH-GRAPH-001
|
|
679
|
+
- PROD-TOOL-001
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
---
|
|
683
|
+
|
|
684
|
+
## ๐งช Testing & Verification
|
|
685
|
+
|
|
686
|
+
AKBO enforces strict quality gates using **Vitest** in single-pass ESM mode:
|
|
687
|
+
|
|
688
|
+
```bash
|
|
689
|
+
# Run the complete test suite (194 tests across 32 test files)
|
|
690
|
+
npm test
|
|
691
|
+
|
|
692
|
+
# Run tests in watch mode during development
|
|
693
|
+
npx vitest
|
|
694
|
+
|
|
695
|
+
# Run CLI directly during development via tsx
|
|
696
|
+
npx tsx src/cli.ts --help
|
|
697
|
+
npx tsx src/cli.ts context ARCH-SYS-001 --json
|
|
698
|
+
|
|
699
|
+
# Build TypeScript
|
|
700
|
+
npm run build
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
---
|
|
704
|
+
|
|
705
|
+
## ๐ License
|
|
706
|
+
|
|
707
|
+
MIT ยฉ [akb-cli](LICENSE)
|