codeflow-hook 1.3.0 → 2.0.0
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 +140 -122
- package/bin/codeflow-hook.js +280 -71
- package/lib/cli-integration/dist/index.d.ts +128 -0
- package/lib/cli-integration/dist/index.js +585 -0
- package/lib/cli-integration/dist/pipelineConfigs.d.ts +60 -0
- package/lib/cli-integration/dist/pipelineConfigs.js +549 -0
- package/lib/cli-integration/dist/simulationEngine.d.ts +86 -0
- package/lib/cli-integration/dist/simulationEngine.js +475 -0
- package/lib/cli-integration/dist/types.d.ts +156 -0
- package/lib/cli-integration/dist/types.js +15 -0
- package/lib/cli-integration/src/index.ts +748 -0
- package/lib/cli-integration/src/pipelineConfigs.ts +579 -0
- package/lib/cli-integration/src/simulationEngine.ts +622 -0
- package/lib/cli-integration/src/types.ts +175 -0
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -1,116 +1,48 @@
|
|
|
1
1
|
# Codeflow Commander — Nexus Gateway CLI
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**AI-Powered Code Analysis and Git Hook Management**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A lightweight command-line tool that provides AI-driven code analysis, automated git hook installation, and intelligent code review capabilities. This CLI client analyzes your local code changes using advanced AI models and helps maintain code quality through automated pre-commit and pre-push checks.
|
|
6
6
|
|
|
7
|
-
This is the
|
|
7
|
+
**⚠️ Important**: This is the **client-side CLI tool** only. Enterprise features like the Enterprise Knowledge Graph (EKG), Autonomous Agent Network (AAN), and ingestion services are part of the broader Codeflow Commander platform and require separate enterprise deployment.
|
|
8
8
|
|
|
9
|
-
## 🚀
|
|
9
|
+
## 🚀 What This CLI Tool Provides
|
|
10
10
|
|
|
11
|
-
### **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
11
|
+
### **AI-Powered Code Analysis**
|
|
12
|
+
- **Local Code Diff Analysis**: Analyze git diffs using Gemini, OpenAI GPT, or Claude AI models
|
|
13
|
+
- **Quality Assessment**: Get 1-10 quality ratings with detailed feedback on code changes
|
|
14
|
+
- **Security Detection**: Identify potential security vulnerabilities in code changes
|
|
15
|
+
- **Performance Insights**: Receive suggestions for performance optimizations
|
|
16
16
|
|
|
17
|
-
### **
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
17
|
+
### **Git Hook Automation**
|
|
18
|
+
- **Pre-commit Hooks**: Automatic analysis of staged changes before commits
|
|
19
|
+
- **Pre-push Hooks**: Comprehensive code review simulation before pushing to remote
|
|
20
|
+
- **Quality Gates**: Prevent problematic commits and pushes based on AI analysis
|
|
21
|
+
- **Customizable Thresholds**: Configure when to block commits based on quality scores
|
|
22
22
|
|
|
23
|
-
### **
|
|
24
|
-
- **
|
|
25
|
-
- **
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
23
|
+
### **Local Knowledge Base (RAG)**
|
|
24
|
+
- **Project Context Indexing**: Build searchable knowledge base from your project files
|
|
25
|
+
- **Context-Aware Analysis**: AI analysis considers your project's documentation and code patterns
|
|
26
|
+
- **Offline Capability**: Works without internet for local analysis (with indexed knowledge)
|
|
27
|
+
- **Incremental Updates**: Automatically update knowledge base as project evolves
|
|
28
28
|
|
|
29
|
-
### **
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
- **
|
|
29
|
+
### **Multi-Provider AI Support**
|
|
30
|
+
- **Google Gemini**: Default AI provider with latest models (1.5 Pro, 1.5 Flash, Pro)
|
|
31
|
+
- **OpenAI GPT**: Support for GPT-4, GPT-4 Turbo, GPT-3.5 Turbo
|
|
32
|
+
- **Anthropic Claude**: Integration with Claude 3 Opus, Sonnet, and Haiku
|
|
33
|
+
- **Custom Endpoints**: Connect to self-hosted or custom AI model endpoints
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
- **Autonomous Permissions**: Dynamic access control based on context and risk
|
|
37
|
-
- **Real-time Compliance**: Continuous regulatory and policy validation
|
|
38
|
-
- **Emergency Controls**: System-wide safety mechanisms and overrides
|
|
39
|
-
- **Human-in-the-Loop**: Graduated approval workflows for different risk levels
|
|
35
|
+
## 📦 How It Works
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
- **Repository Federation**: Coordinate operations across multiple repositories
|
|
43
|
-
- **Workflow Orchestration**: Complex process execution with dependency management
|
|
44
|
-
- **State Synchronization**: Federated data consistency across the enterprise
|
|
45
|
-
- **Resource Optimization**: Intelligent load balancing and execution management
|
|
37
|
+
The CLI tool operates entirely on your local machine and analyzes your code changes using AI. Here's the workflow:
|
|
46
38
|
|
|
47
|
-
|
|
39
|
+
1. **Local Analysis**: When you run analysis, the tool captures your git diff locally
|
|
40
|
+
2. **AI Processing**: Sends the diff to your configured AI provider (Gemini/OpenAI/Claude)
|
|
41
|
+
3. **Context Enhancement**: Optionally includes your project's indexed knowledge for better analysis
|
|
42
|
+
4. **Feedback Generation**: Returns quality scores, issues, and recommendations
|
|
43
|
+
5. **Hook Integration**: Automatically runs during git operations to maintain code quality
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
┌─────────────────────────────────────────────────────────┐
|
|
53
|
-
│ MULTI-MODAL INTERFACE LAYER (MMIL) │
|
|
54
|
-
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
|
|
55
|
-
│ │ Conversational │ │ Design→Code │ │ IDE │ │
|
|
56
|
-
│ │ Interfaces │ │ Pipeline │ │ Integrations│ │
|
|
57
|
-
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
|
|
58
|
-
└─────────────────────────────────────────────────────────┘
|
|
59
|
-
│
|
|
60
|
-
▼
|
|
61
|
-
┌─────────────────────────────────────────────────────────┐
|
|
62
|
-
│ AUTONOMOUS AGENT NETWORK (AAN) - ORCHESTRATOR │
|
|
63
|
-
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
|
|
64
|
-
│ │ Workflow Agents │ │ Maintenance │ │ Self-Heal │ │
|
|
65
|
-
│ │ │ │ Bots │ │ Agents │ │
|
|
66
|
-
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
|
|
67
|
-
└─────────────────────────────────────────────────────────┘
|
|
68
|
-
│
|
|
69
|
-
▼
|
|
70
|
-
┌─────────────────────────────────────────────────────────┐
|
|
71
|
-
│ GOVERNANCE & SAFETY FRAMEWORK - RISK CONTROL │
|
|
72
|
-
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
|
|
73
|
-
│ │ Permission │ │ Audit & │ │ Emergency │ │
|
|
74
|
-
│ │ Engine │ │ Compliance │ │ Controls │ │
|
|
75
|
-
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
|
|
76
|
-
└─────────────────────────────────────────────────────────┘
|
|
77
|
-
│
|
|
78
|
-
▼
|
|
79
|
-
┌─────────────────────────────────────────────────────────┐
|
|
80
|
-
│ ENTERPRISE KNOWLEDGE GRAPH (EKG) - INTELLIGENCE │
|
|
81
|
-
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
|
|
82
|
-
│ │ Cross-Repo │ │ Semantic │ │ Expert │ │
|
|
83
|
-
│ │ Dependencies │ │ Mapping │ │ Discovery │ │
|
|
84
|
-
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
|
|
85
|
-
└─────────────────────────────────────────────────────────┘
|
|
86
|
-
│
|
|
87
|
-
▼
|
|
88
|
-
┌─────────────────────────────────────────────────────────┐
|
|
89
|
-
│ PREDICTIVE INTELLIGENCE ENGINE (PIE) - FORECASTING │
|
|
90
|
-
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
|
|
91
|
-
│ │ Tech Debt │ │ Performance │ │ Risk │ │
|
|
92
|
-
│ │ Forecasting │ │ Prediction │ │ Analytics │ │
|
|
93
|
-
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
|
|
94
|
-
└─────────────────────────────────────────────────────────┘
|
|
95
|
-
│
|
|
96
|
-
▼
|
|
97
|
-
┌─────────────────────────────────────────────────────────┐
|
|
98
|
-
│ DISTRIBUTED EXECUTION ENGINE (DEE) - RUNTIME │
|
|
99
|
-
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
|
|
100
|
-
│ │ Repository │ │ Workflow │ │ State │ │
|
|
101
|
-
│ │ Federation │ │ Orchestration │ │ Sync │ │
|
|
102
|
-
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
|
|
103
|
-
└─────────────────────────────────────────────────────────┘
|
|
104
|
-
│
|
|
105
|
-
▼
|
|
106
|
-
┌─────────────────────────────────────────────────────────┐
|
|
107
|
-
│ EXTERNAL SYSTEMS INTEGRATION │
|
|
108
|
-
│ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │
|
|
109
|
-
│ │GitHub│ │GitLab│ │JIRA │ │Slack│ │Jenkins│ │
|
|
110
|
-
│ │Actions│ │ │ │ │ │ │ │ │ │
|
|
111
|
-
│ └─────┘ └─────┘ └─────┘ └─────┘ └─────┘ │
|
|
112
|
-
└─────────────────────────────────────────────────────────┘
|
|
113
|
-
```
|
|
45
|
+
**No data is sent to external servers** except for AI API calls to your configured provider. Your code stays on your machine.
|
|
114
46
|
|
|
115
47
|
## 📦 Installation
|
|
116
48
|
|
|
@@ -269,33 +201,117 @@ codeflow-hook analyze-diff --help # Analysis options
|
|
|
269
201
|
- Best practice recommendations
|
|
270
202
|
- Maintainability evaluation
|
|
271
203
|
|
|
272
|
-
##
|
|
204
|
+
## 💡 Usage Examples
|
|
205
|
+
|
|
206
|
+
### Standard Development Workflow
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Stage your changes
|
|
210
|
+
git add .
|
|
211
|
+
|
|
212
|
+
# Pre-commit hook automatically runs AI analysis
|
|
213
|
+
git commit -m "feat: add new authentication"
|
|
214
|
+
|
|
215
|
+
# Pre-push hook runs tests and full AI review
|
|
216
|
+
git push origin main
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Manual Analysis
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# Analyze uncommitted changes
|
|
223
|
+
git diff | codeflow-hook analyze-diff
|
|
224
|
+
|
|
225
|
+
# Analyze specific files
|
|
226
|
+
git diff path/to/file.js | codeflow-hook analyze-diff
|
|
227
|
+
|
|
228
|
+
# Analyze between commits
|
|
229
|
+
git diff HEAD~1 HEAD | codeflow-hook analyze-diff
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 🎯 AI Analysis Output
|
|
233
|
+
|
|
234
|
+
The tool provides:
|
|
235
|
+
|
|
236
|
+
- **Rating**: 1-10 quality score with color coding
|
|
237
|
+
- **Summary**: Brief assessment of changes
|
|
238
|
+
- **Issues**: Specific problems with solutions
|
|
239
|
+
- **Recommendations**: Improvement suggestions
|
|
240
|
+
|
|
241
|
+
Example output:
|
|
242
|
+
```
|
|
243
|
+
⭐ **Rating:** 9/10
|
|
244
|
+
📝 **Summary:** Clean implementation with good separation of concerns
|
|
245
|
+
|
|
246
|
+
⚠️ **Issues:**
|
|
247
|
+
- Consider adding input validation for edge cases
|
|
273
248
|
|
|
274
|
-
|
|
275
|
-
|
|
249
|
+
💡 **Recommendations:**
|
|
250
|
+
- Add comprehensive error handling
|
|
251
|
+
- Consider extracting common logic to a utility function
|
|
252
|
+
```
|
|
276
253
|
|
|
277
|
-
|
|
278
|
-
**🎨 Design-to-Code Pipeline**: Computer vision and ML models for design artifact ingestion
|
|
279
|
-
**📊 Predictive Analytics Engine**: Time-series analysis and machine learning for trend forecasting
|
|
280
|
-
**🔍 Semantic Code Analysis**: Advanced NLP for code understanding and pattern recognition
|
|
254
|
+
## 🔧 Configuration
|
|
281
255
|
|
|
282
|
-
|
|
283
|
-
The core platform intelligence is delivered through specialized agent networks:
|
|
256
|
+
Configuration is stored in `~/.codeflow-hook/config.json`:
|
|
284
257
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
-
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"provider": "gemini",
|
|
261
|
+
"apiKey": "your-api-key",
|
|
262
|
+
"apiUrl": "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent",
|
|
263
|
+
"model": "gemini-pro"
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Supported AI Providers
|
|
289
268
|
|
|
290
|
-
|
|
291
|
-
-
|
|
292
|
-
-
|
|
293
|
-
|
|
269
|
+
- **Gemini**: `provider: "gemini"` - Default, uses Google AI
|
|
270
|
+
- **OpenAI**: `provider: "openai"` - GPT models
|
|
271
|
+
- **Claude**: `provider: "claude"` - Anthropic models
|
|
272
|
+
|
|
273
|
+
Each provider has optimized prompts and supports custom endpoints.
|
|
294
274
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
275
|
+
## 📋 Requirements
|
|
276
|
+
|
|
277
|
+
- Node.js 16+
|
|
278
|
+
- Git repository
|
|
279
|
+
- Gemini API key
|
|
280
|
+
|
|
281
|
+
## Security
|
|
282
|
+
|
|
283
|
+
- API keys stored locally (not in your repo)
|
|
284
|
+
- Have to make an .env file for the credentials
|
|
285
|
+
- No data sent to third parties except Google Gemini
|
|
286
|
+
- Code diffs analyzed locally before sending
|
|
287
|
+
|
|
288
|
+
## 🐛 Troubleshooting
|
|
289
|
+
|
|
290
|
+
### Common Issues
|
|
291
|
+
|
|
292
|
+
**"No configuration found"**
|
|
293
|
+
```bash
|
|
294
|
+
codeflow-hook config -k YOUR_API_KEY
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Hooks not running**
|
|
298
|
+
```bash
|
|
299
|
+
- **Design Pattern Compliance**: Validation against organizational architectural standards
|
|
300
|
+
- **Coupling Analysis**: Detection of tight coupling and circular dependencies
|
|
301
|
+
- **Layer Architecture**: Enforcement of proper separation between presentation, business logic, and data layers
|
|
302
|
+
- **Complexity Assessment**: Monitoring of code complexity and maintainability metrics
|
|
303
|
+
|
|
304
|
+
**⚡ Performance Agent**:
|
|
305
|
+
- **Algorithm Analysis**: Detection of inefficient algorithms and time/space complexity issues
|
|
306
|
+
- **Memory Optimization**: Identification of memory leaks and inefficient data structures
|
|
307
|
+
- **I/O Optimization**: Analysis of database queries, file operations, and network calls
|
|
308
|
+
- **Caching Opportunities**: Recommendations for implementing caching strategies
|
|
309
|
+
|
|
310
|
+
**✨ Quality Agent**:
|
|
311
|
+
- **Code Style Enforcement**: Automated linting and formatting consistency checks
|
|
312
|
+
- **Documentation Analysis**: Validation of code comments, JSDoc, and README completeness
|
|
313
|
+
- **Test Coverage Assessment**: Analysis of unit test coverage and quality
|
|
314
|
+
- **Dead Code Detection**: Identification of unused functions, variables, and imports
|
|
299
315
|
|
|
300
316
|
### **Federated Data Architecture**
|
|
301
317
|
Enterprise-scale data management across distributed repositories:
|
|
@@ -482,7 +498,9 @@ Built with ❤️ using enterprise-grade technologies:
|
|
|
482
498
|
|
|
483
499
|
### **Core Intelligence Stack**
|
|
484
500
|
- **Multi-Modal AI Integration**: Google Gemini, OpenAI GPT-4, Anthropic Claude
|
|
485
|
-
- **Distributed Graph Database**:
|
|
501
|
+
- **Distributed Graph Database**: Amazon Neptune for Enterprise Knowledge Graph operations
|
|
502
|
+
- **Ingestion & Query Services**: Microservices architecture with GraphQL APIs
|
|
503
|
+
- **Autonomous Agent Network**: Specialized agents for Security, Architecture, Performance, and Quality analysis
|
|
486
504
|
- **Federated Learning Infrastructure**: PyTorch and TensorFlow for ML model training
|
|
487
505
|
- **Container Orchestration**: Kubernetes for enterprise-scale deployment
|
|
488
506
|
|