@vortex-ai/cli 0.1.2

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/.vortex.db ADDED
Binary file
package/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # Vortex - Developer Intelligence & PR Review Engine
2
+
3
+ ![npm version](https://img.shields.io/npm/v/vortex-cli)
4
+ ![Node.js Version](https://img.shields.io/node/v/vortex-cli)
5
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
6
+
7
+ **Vortex** is an autonomous, AI-powered developer assistant and CLI tool that combines semantic code search, Git integration, and LLM-based intelligence. It provides contextual code reviews, deeply technical issue analysis, interactive semantic search, and an autonomous coding agent to help you solve tasks right in your terminal.
8
+
9
+ ---
10
+
11
+ ## Quick Start
12
+
13
+ ### Installation
14
+
15
+ Install Vortex globally via npm:
16
+ ```bash
17
+ npm install -g vortex-cli
18
+ ```
19
+
20
+ ### Configuration
21
+
22
+ Vortex requires an API key for its LLM engine (e.g., Google Gemini or Groq). Set up a global configuration in your home directory:
23
+
24
+ ```bash
25
+ echo "GEMINI_API_KEY=your_gemini_key_here" > ~/.vortexenv
26
+ ```
27
+
28
+ You can also use project-specific `.env` files or inline environment variables.
29
+
30
+ ### Your First Commands
31
+
32
+ ```bash
33
+ # 1. Initialize the local vector and BM25 indexes for your repository
34
+ vortex init
35
+
36
+ # 2. Ask the autonomous agent to solve a task
37
+ vortex solve "Refactor the authentication middleware to use JWT"
38
+
39
+ # 3. Perform a multi-agent review on a pull request
40
+ vortex review --pr 42
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Core Features
46
+
47
+ - **`vortex solve <prompt>`**: Autonomous AI agent that explores your codebase, writes code, and executes terminal commands to solve your task.
48
+ - **`vortex solve-issue --id <id>`**: Seamlessly connects GitHub issues with the Autonomous Agent. Fetches the issue, runs RAG to find relevant local code, and automatically writes the fix.
49
+ - **`vortex review --pr <id>`**: Multi-agent PR review analyzing security, architecture, and logic.
50
+ - **`vortex search -q <query>`**: Semantic, natural language code search backed by AI explanations.
51
+ - **`vortex issue --id <id>`**: Analyzes GitHub issues and proposes step-by-step local code fixes.
52
+ - **`vortex graph`**: Automatically generates Mermaid dependency graphs of your files or entire project.
53
+ - **`vortex fix-nitbits`**: AI-powered auto-fixer for linting, formatting, and minor structural issues.
54
+
55
+ *Note: Most read-only analysis commands automatically cache LLM requests to speed up subsequent runs and save API costs.*
56
+
57
+ ---
58
+
59
+ ## Real-world Examples
60
+
61
+ **Scenario 1: Refactoring Code Autonomously**
62
+ ```bash
63
+ vortex solve "Refactor the authentication middleware to use JWT instead of sessions, making sure it aligns with the existing User model"
64
+ ```
65
+
66
+ **Scenario 2: Pre-Merge Security & Architecture Review**
67
+ ```bash
68
+ vortex review --pr 104 --deep
69
+ # Output: The Security Agent flags a data leak, the Architecture Agent suggests abstracting the API call, and the Synthesizer provides the exact diff to fix it.
70
+ ```
71
+
72
+ **Scenario 3: Fully Autonomously Solving a GitHub Issue**
73
+ ```bash
74
+ vortex solve-issue --id 45
75
+ # Output: Fetches Issue #45, grabs local RAG context, and hands it directly to the ReAct agent which actively writes the code to fix the bug.
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Architecture Overview
81
+
82
+ Vortex runs on a sophisticated **Multi-Agent Cognitive Architecture** backed by **Hybrid RAG** (Retrieval-Augmented Generation).
83
+
84
+ ### Multi-Agent System
85
+ Instead of passing code blindly to an LLM, Vortex uses specialized agents:
86
+ - **Security Agent**: Scans for vulnerabilities and insecure patterns.
87
+ - **Architecture Agent**: Checks code for design consistency against your repo's existing patterns.
88
+ - **Synthesizer Agent**: Combines outputs into an actionable, unified review.
89
+ - **Base Agent (ReAct Loop)**: An autonomous loop that can execute file system tools, read code, and run terminal commands to iteratively solve tasks.
90
+
91
+ ### Memory & Retrieval
92
+ Vortex utilizes a multi-layered memory architecture to maintain context without exceeding token limits or sacrificing privacy.
93
+
94
+ 1. **Persistent Agentic Memory (`MemoryService`)**: Acts as episodic memory. Stores review history, architectural decisions, and known bugs in a local SQLite database for cross-PR consistency.
95
+ 2. **Hybrid RAG Indexing (`HybridRetriever`)**: Uses AST-aware chunking, on-device Xenova Transformer dense vector embeddings, and sparse lexical BM25 indexing. Cross-encoder reranking ensures only the most relevant context is fed to the LLM.
96
+
97
+ ```mermaid
98
+ graph TD
99
+ User((User / Developer)) -->|CLI Commands| CLI[Vortex CLI Interface]
100
+ CLI -->|Task & State Context| Engine[Intelligence Engine Core]
101
+
102
+ subgraph Multi-Agent Cognitive Architecture
103
+ Engine -->|Delegates to| Orchestrator[ReAct Base Agent / Review Orchestrator]
104
+ Orchestrator <-->|Zero-Shot Analysis| Sec[Security Vulnerability Agent]
105
+ Orchestrator <-->|Pattern Recognition| Arch[Architectural Consistency Agent]
106
+ Orchestrator <-->|Context Aggregation| Synth[Synthesizer / Response Generation Agent]
107
+ end
108
+
109
+ subgraph Hybrid RAG Pipeline
110
+ Engine -->|Semantic Queries| Retriever[Hybrid Semantic Retriever]
111
+ Retriever -->|Dense Embeddings| VectorStore[(Prisma SQLite Vector DB)]
112
+ Retriever -->|Sparse Lexical| BM25[(BM25 Keyword Index)]
113
+ Retriever -->|Structural Parse| Chunking[AST-Aware Semantic Chunker]
114
+ Retriever -->|On-Device Inference| Embedder[Local Xenova Transformers]
115
+ end
116
+
117
+ Engine <-->|Few-Shot Prompts / Tool Calling| AI((Google Gemini API / Groq LLMs))
118
+ Orchestrator -->|Autonomous Execution| FileSystem[Local File System & Git Operations]
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Security & Safety Boundaries
124
+
125
+ Running autonomous agents on your local machine requires strict safety rails. Vortex includes:
126
+ - **Interactive Diff Approvals**: The `solve` command will pause and ask for your permission (Y/n) before running any terminal commands or overwriting files. You can bypass this in CI pipelines with the `--auto-approve` flag.
127
+ - **Rollback Backups**: Whenever the agent modifies a file, the original version is automatically backed up to `.vortex_backup/` to prevent data loss.
128
+ - **Command Blacklist**: Dangerous commands like `rm`, `sudo`, `chmod`, and `chown` are instantly rejected if the agent attempts to run them.
129
+ - **Real-Time Visuals**: See what the agent is doing with inline `git diff` outputs as files are successfully edited.
130
+
131
+ ---
132
+
133
+ ## Performance & Privacy
134
+
135
+ Vortex is engineered for speed and cost-efficiency, keeping the heavy lifting local to your machine:
136
+ - **Zero-Cost Indexing**: Generating embeddings for your repository runs entirely on-device via Xenova Transformers, meaning **no API costs** and **complete privacy**.
137
+ - **Token Efficiency**: By intelligently chunking code (AST-aware) and only sending the most relevant segments to the LLM, Vortex uses significantly fewer tokens.
138
+
139
+ ---
140
+
141
+ ## Contributing
142
+
143
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to set up the development environment, run tests, and submit pull requests.
144
+
145
+ ### Development Setup
146
+ ```bash
147
+ git clone https://github.com/your-org/vortex.git
148
+ cd vortex
149
+ npm install
150
+ npm run build
151
+ ```
152
+
153
+ ## License
154
+
155
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,41 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __esm = (fn, res) => function __init() {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ };
16
+ var __commonJS = (cb, mod) => function __require2() {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
32
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
+ mod
34
+ ));
35
+
36
+ export {
37
+ __require,
38
+ __esm,
39
+ __commonJS,
40
+ __toESM
41
+ };
@@ -0,0 +1,119 @@
1
+ import {
2
+ __commonJS,
3
+ __require
4
+ } from "./chunk-C6P2IO65.mjs";
5
+
6
+ // ../db/dist/index.js
7
+ var require_dist = __commonJS({
8
+ "../db/dist/index.js"(exports, module) {
9
+ var __create = Object.create;
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __getProtoOf = Object.getPrototypeOf;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var index_exports = {};
38
+ __export(index_exports, {
39
+ initDatabase: () => initDatabase,
40
+ prisma: () => prisma
41
+ });
42
+ module.exports = __toCommonJS(index_exports);
43
+ var import_client = __require("@prisma/client");
44
+ var path = __toESM(__require("path"));
45
+ __reExport(index_exports, __require("@prisma/client"), module.exports);
46
+ var prisma = new import_client.PrismaClient({
47
+ datasources: {
48
+ db: {
49
+ url: `file:${path.resolve(process.cwd(), ".vortex.db")}`
50
+ }
51
+ }
52
+ });
53
+ async function initDatabase() {
54
+ await prisma.$executeRawUnsafe(`
55
+ CREATE TABLE IF NOT EXISTS "Chunk" (
56
+ "id" TEXT NOT NULL PRIMARY KEY,
57
+ "file" TEXT NOT NULL,
58
+ "language" TEXT NOT NULL,
59
+ "name" TEXT NOT NULL,
60
+ "symbolPath" TEXT NOT NULL,
61
+ "kind" TEXT NOT NULL,
62
+ "parent" TEXT,
63
+ "isExported" BOOLEAN NOT NULL,
64
+ "isAsync" BOOLEAN NOT NULL,
65
+ "signature" TEXT,
66
+ "dependencies" TEXT NOT NULL,
67
+ "startLine" INTEGER NOT NULL,
68
+ "endLine" INTEGER NOT NULL,
69
+ "hash" TEXT NOT NULL,
70
+ "content" TEXT NOT NULL,
71
+ "embedding" TEXT,
72
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
73
+ "updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
74
+ );
75
+ `);
76
+ await prisma.$executeRawUnsafe(`
77
+ CREATE TABLE IF NOT EXISTS "Memory" (
78
+ "id" TEXT NOT NULL PRIMARY KEY,
79
+ "type" TEXT NOT NULL,
80
+ "content" TEXT NOT NULL,
81
+ "source" TEXT NOT NULL,
82
+ "tags" TEXT NOT NULL,
83
+ "embedding" TEXT,
84
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
85
+ "updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
86
+ );
87
+ `);
88
+ await prisma.$executeRawUnsafe(`
89
+ CREATE TABLE IF NOT EXISTS "ReviewHistory" (
90
+ "id" TEXT NOT NULL PRIMARY KEY,
91
+ "prNumber" INTEGER NOT NULL,
92
+ "owner" TEXT NOT NULL,
93
+ "repo" TEXT NOT NULL,
94
+ "verdict" TEXT NOT NULL,
95
+ "summary" TEXT NOT NULL,
96
+ "findings" TEXT NOT NULL,
97
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
98
+ );
99
+ `);
100
+ await prisma.$executeRawUnsafe(`
101
+ CREATE TABLE IF NOT EXISTS "LLMCache" (
102
+ "key" TEXT NOT NULL PRIMARY KEY,
103
+ "model" TEXT NOT NULL,
104
+ "response" TEXT NOT NULL,
105
+ "promptHash" TEXT NOT NULL,
106
+ "contextHash" TEXT NOT NULL,
107
+ "commitHash" TEXT,
108
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
109
+ "lastAccessedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
110
+ "hitCount" INTEGER NOT NULL DEFAULT 0
111
+ );
112
+ `);
113
+ }
114
+ }
115
+ });
116
+
117
+ export {
118
+ require_dist
119
+ };