agentic-sdlc 1.5.1 → 1.8.1
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/.agent/rules/agent-execution.md +55 -0
- package/.agent/rules/ai-enforcement.md +4 -3
- package/.agent/rules/artifacts.md +79 -77
- package/.agent/rules/auto-learning.md +78 -0
- package/.agent/rules/code-quality.md +40 -0
- package/.agent/rules/git-workflow.md +44 -24
- package/.agent/rules/global.md +10 -6
- package/.agent/rules/naming-conventions.md +55 -0
- package/.agent/skills/role-ba.md +6 -2
- package/.agent/skills/role-brain.md +5 -1
- package/.agent/skills/role-cloud.md +38 -0
- package/.agent/skills/role-dev.md +31 -5
- package/.agent/skills/role-devops.md +9 -0
- package/.agent/skills/role-game.md +35 -0
- package/.agent/skills/role-mobile.md +55 -0
- package/.agent/skills/role-orchestrator.md +4 -0
- package/.agent/skills/role-pm.md +4 -0
- package/.agent/skills/role-po.md +4 -0
- package/.agent/skills/role-reporter.md +4 -0
- package/.agent/skills/role-research.md +78 -0
- package/.agent/skills/role-sa.md +4 -0
- package/.agent/skills/role-seca.md +4 -0
- package/.agent/skills/role-stakeholder.md +4 -0
- package/.agent/skills/role-tester.md +15 -3
- package/.agent/skills/role-uiux.md +4 -0
- package/.agent/templates/CHANGELOG-Template.md +2 -2
- package/.agent/templates/Design-Verification-Report-Template.md +4 -4
- package/.agent/templates/DevOps-Plan-Template.md +7 -0
- package/.agent/templates/Specification-Template.md +38 -0
- package/.agent/templates/ab-comparison-report.md +175 -0
- package/.agent/templates/observer-report.md +131 -0
- package/.agent/templates/quality-score-report.md +197 -0
- package/.agent/templates/self-learning-digest.md +268 -0
- package/.agent/templates/system-health-report.md +330 -0
- package/.agent/workflows/ab.md +101 -0
- package/.agent/workflows/autogen.md +65 -0
- package/.agent/workflows/brain.md +52 -42
- package/.agent/workflows/commit.md +61 -0
- package/.agent/workflows/cycle.md +36 -15
- package/.agent/workflows/debug.md +123 -0
- package/.agent/workflows/deep-search.md +82 -0
- package/.agent/workflows/docs.md +144 -0
- package/.agent/workflows/emergency.md +17 -15
- package/.agent/workflows/explore.md +15 -9
- package/.agent/workflows/housekeeping.md +24 -11
- package/.agent/workflows/metrics.md +14 -12
- package/.agent/workflows/monitor.md +98 -0
- package/.agent/workflows/observe.md +84 -0
- package/.agent/workflows/onboarding.md +135 -0
- package/.agent/workflows/orchestrator.md +21 -14
- package/.agent/workflows/planning.md +126 -0
- package/.agent/workflows/refactor.md +132 -0
- package/.agent/workflows/release.md +19 -12
- package/.agent/workflows/review.md +99 -0
- package/.agent/workflows/score.md +104 -0
- package/.agent/workflows/sprint.md +16 -14
- package/.agent/workflows/validate.md +13 -11
- package/.agent/workflows/worktree.md +154 -0
- package/CHANGELOG.md +88 -0
- package/README.md +12 -4
- package/bin/cli.js +143 -13
- package/docs/.brain-health-history.json +42 -0
- package/docs/.brain-improvements.json +53 -0
- package/docs/.brain-learner-log.json +27 -0
- package/docs/.brain-scores.json +310 -0
- package/docs/architecture/system-flow.mermaid +81 -0
- package/docs/artifacts/2026-01-05-enforcement-gates-plan.md +80 -0
- package/docs/artifacts/2026-01-05-workflow-analysis.md +231 -0
- package/docs/artifacts/README.md +26 -0
- package/docs/guides/MCP-GUIDE.md +1 -0
- package/docs/reports/2026-01-05-autogen-evaluation.md +64 -0
- package/docs/reports/2026-01-05-brain-layer-analysis.md +109 -0
- package/docs/reports/2026-01-05-repository-audit.md +253 -0
- package/docs/reports/Metrics-Dashboard-2026-01-08.md +29 -0
- package/docs/reports/Metrics-Dashboard-Final.md +29 -0
- package/docs/reports/Validation-Report-2026-01-05.md +40 -0
- package/docs/reports/Validation-Report-2026-01-08.md +40 -0
- package/docs/reports/worktrunk-audit.md +94 -0
- package/docs/solutions/README.md +96 -0
- package/docs/walkthroughs/2026-01-05-audit-implementation.md +36 -0
- package/docs/walkthroughs/2026-01-05-autonomy-release.md +54 -0
- package/docs/walkthroughs/2026-01-05-enforcement-gates.md +33 -0
- package/docs/walkthroughs/2026-01-05-judge-enhancement.md +30 -0
- package/docs/walkthroughs/2026-01-05-landing-page-orchestrator.md +52 -0
- package/docs/walkthroughs/2026-01-05-validation.md +32 -0
- package/docs/walkthroughs/2026-01-05-workflow-audit.md +89 -0
- package/docs/walkthroughs/2026-01-05-workflow-refactoring.md +44 -0
- package/docs/walkthroughs/2026-01-06-worktrunk-integration.md +41 -0
- package/docs/walkthroughs/README.md +25 -0
- package/package.json +33 -19
- package/.agent/knowledge-base/AUTO-LEARNING-GUIDE.md +0 -327
- package/.agent/knowledge-base/HOW-IT-WORKS.md +0 -365
- package/.agent/knowledge-base/INDEX.md +0 -43
- package/.agent/knowledge-base/README.md +0 -242
- package/.agent/knowledge-base/architecture/.gitkeep +0 -1
- package/.agent/knowledge-base/architecture/KB-2026-01-01-003-neo4j-graph-database-skills.md +0 -1146
- package/.agent/knowledge-base/architecture/README.md +0 -98
- package/.agent/knowledge-base/bugs/.gitkeep +0 -1
- package/.agent/knowledge-base/bugs/KB-2026-01-02-yaml-special-character-escaping.md +0 -56
- package/.agent/knowledge-base/bugs/medium/KB-2026-01-01-001-example-auto-learned.md +0 -198
- package/.agent/knowledge-base/features/.gitkeep +0 -1
- package/.agent/knowledge-base/features/KB-2026-01-01-001-landing-page-design-trends-2026.md +0 -646
- package/.agent/knowledge-base/features/KB-2026-01-01-004-uiux-design-skills-2026.md +0 -945
- package/.agent/knowledge-base/features/KB-2026-01-01-005-modern-ai-landing-page-ui.md +0 -310
- package/.agent/knowledge-base/features/KB-2026-01-01-006-award-winning-landing-page-patterns.md +0 -324
- package/.agent/knowledge-base/features/KB-2026-01-02-001-cleanup-workflow.md +0 -242
- package/.agent/knowledge-base/features/KB-2026-01-02-002-landing-page-monorepo-architecture.md +0 -148
- package/.agent/knowledge-base/features/KB-2026-01-02-003-premium-glassmorphism-patterns.md +0 -58
- package/.agent/knowledge-base/features/KB-2026-01-04-ai-agent-enforcement.md +0 -46
- package/.agent/knowledge-base/features/README.md +0 -83
- package/.agent/knowledge-base/features/figma-landing-page-workflow.md +0 -311
- package/.agent/knowledge-base/features/figma-mcp-sa-guide.md +0 -673
- package/.agent/knowledge-base/features/figma-mcp-uiux-guide.md +0 -459
- package/.agent/knowledge-base/performance/.gitkeep +0 -1
- package/.agent/knowledge-base/performance/KB-2026-01-02-lazy-loading-optimization.md +0 -80
- package/.agent/knowledge-base/platform-specific/.gitkeep +0 -1
- package/.agent/knowledge-base/platform-specific/KB-2026-01-02-windows-console-encoding.md +0 -56
- package/.agent/knowledge-base/role-guides/DEV-KB-Guide.md +0 -527
- package/.agent/knowledge-base/role-guides/DEVOPS-KB-Guide.md +0 -491
- package/.agent/knowledge-base/role-guides/PM-KB-Guide.md +0 -299
- package/.agent/knowledge-base/role-guides/SECA-KB-Guide.md +0 -555
- package/.agent/knowledge-base/role-guides/TESTER-KB-Guide.md +0 -519
- package/.agent/knowledge-base/security/.gitkeep +0 -1
- package/.agent/knowledge-base/security/KB-2026-01-02-input-validation-sanitization.md +0 -74
- package/.agent/rules/AUTO-LEARNING.md +0 -418
- package/.agent/rules/KNOWLEDGE-BASE.md +0 -45
- package/.agent/skills/role-qa.md +0 -81
- package/.agent/workflows/compound.md +0 -51
- package/.agent/workflows/preflight.md +0 -35
- package/.agent/workflows/route.md +0 -160
- package/bin/kb +0 -34
- package/bin/kb.bat +0 -28
- package/bin/kb_cli.py +0 -226
- package/bin/lib/README.md +0 -411
- package/bin/lib/__init__.py +0 -7
- package/bin/lib/__pycache__/kb_add.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_common.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_compound.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_index.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_list.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_search.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_stats.cpython-313.pyc +0 -0
- package/bin/lib/kb_add.py +0 -203
- package/bin/lib/kb_common.py +0 -224
- package/bin/lib/kb_compound.py +0 -250
- package/bin/lib/kb_index.py +0 -193
- package/bin/lib/kb_list.py +0 -144
- package/bin/lib/kb_search.py +0 -121
- package/bin/lib/kb_stats.py +0 -153
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: [Support] Route - Workflow Selection Helper
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# /route - Intelligent Request Routing
|
|
6
|
-
|
|
7
|
-
## ⚠️ PURPOSE
|
|
8
|
-
Analyzes user requests and routes to the appropriate workflow or role. Use when unsure which workflow to invoke.
|
|
9
|
-
|
|
10
|
-
## Quick Reference
|
|
11
|
-
|
|
12
|
-
### By Request Type
|
|
13
|
-
|
|
14
|
-
| Request Type | Recommended Route |
|
|
15
|
-
|--------------|-------------------|
|
|
16
|
-
| "Build a new feature" | `/orchestrator` or `/pm` → full SDLC |
|
|
17
|
-
| "Fix this bug" | `/dev` or `/emergency` (if P0) |
|
|
18
|
-
| "Review this design" | `/tester` + `/seca` |
|
|
19
|
-
| "Set up infrastructure" | `/devops` |
|
|
20
|
-
| "Create user stories" | `/ba` |
|
|
21
|
-
| "Design the UI" | `/uiux` |
|
|
22
|
-
| "Design the API" | `/sa` |
|
|
23
|
-
| "How do I..." | `/explore` first, then appropriate role |
|
|
24
|
-
|
|
25
|
-
### By Urgency
|
|
26
|
-
|
|
27
|
-
| Urgency | Route |
|
|
28
|
-
|---------|-------|
|
|
29
|
-
| 🔴 Production down | `/emergency --severity P0` |
|
|
30
|
-
| 🟠 Major bug | `/emergency --severity P1` |
|
|
31
|
-
| 🟡 Normal task | `/cycle` |
|
|
32
|
-
| 🟢 Investigation | `/explore` |
|
|
33
|
-
|
|
34
|
-
### By Phase
|
|
35
|
-
|
|
36
|
-
| SDLC Phase | Route |
|
|
37
|
-
|------------|-------|
|
|
38
|
-
| Planning | `/pm` |
|
|
39
|
-
| Requirements | `/ba` |
|
|
40
|
-
| Design | `/sa` + `/uiux` |
|
|
41
|
-
| Verification | `/tester` + `/seca` |
|
|
42
|
-
| Implementation | `/dev` |
|
|
43
|
-
| Testing | `/tester` |
|
|
44
|
-
| Deployment | `/devops` |
|
|
45
|
-
| Closure | `/pm` |
|
|
46
|
-
|
|
47
|
-
## Decision Tree
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
Is this an emergency?
|
|
51
|
-
├── Yes → /emergency
|
|
52
|
-
└── No → Continue
|
|
53
|
-
|
|
54
|
-
Is this a full project/feature?
|
|
55
|
-
├── Yes → /orchestrator (full automation)
|
|
56
|
-
└── No → Continue
|
|
57
|
-
|
|
58
|
-
Is this a single task?
|
|
59
|
-
├── Yes → /cycle
|
|
60
|
-
└── No → Continue
|
|
61
|
-
|
|
62
|
-
What phase are you in?
|
|
63
|
-
├── Planning → /pm
|
|
64
|
-
├── Requirements → /ba
|
|
65
|
-
├── Design → /sa or /uiux
|
|
66
|
-
├── Review → /tester or /seca
|
|
67
|
-
├── Development → /dev
|
|
68
|
-
├── Testing → /tester
|
|
69
|
-
└── Deployment → /devops
|
|
70
|
-
|
|
71
|
-
Need maintenance?
|
|
72
|
-
├── Brain sync → /brain
|
|
73
|
-
├── Cleanup → /housekeeping
|
|
74
|
-
├── Validation → /validate
|
|
75
|
-
├── Metrics → /metrics
|
|
76
|
-
└── Release → /release
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Role Selection Guide
|
|
80
|
-
|
|
81
|
-
### @PM - Project Manager
|
|
82
|
-
**Use when:**
|
|
83
|
-
- Starting a new project
|
|
84
|
-
- Creating project plans
|
|
85
|
-
- Tracking sprint progress
|
|
86
|
-
- Generating reports
|
|
87
|
-
|
|
88
|
-
### @BA - Business Analyst
|
|
89
|
-
**Use when:**
|
|
90
|
-
- Gathering requirements
|
|
91
|
-
- Writing user stories
|
|
92
|
-
- Defining acceptance criteria
|
|
93
|
-
|
|
94
|
-
### @SA - System Analyst
|
|
95
|
-
**Use when:**
|
|
96
|
-
- Designing architecture
|
|
97
|
-
- Creating API specifications
|
|
98
|
-
- Making technical decisions
|
|
99
|
-
|
|
100
|
-
### @UIUX - UI/UX Designer
|
|
101
|
-
**Use when:**
|
|
102
|
-
- Designing interfaces
|
|
103
|
-
- Creating wireframes
|
|
104
|
-
- Ensuring accessibility
|
|
105
|
-
|
|
106
|
-
### @DEV - Developer
|
|
107
|
-
**Use when:**
|
|
108
|
-
- Implementing features
|
|
109
|
-
- Writing code
|
|
110
|
-
- Fixing bugs
|
|
111
|
-
|
|
112
|
-
### @TESTER - Tester
|
|
113
|
-
**Use when:**
|
|
114
|
-
- Reviewing designs
|
|
115
|
-
- Writing test plans
|
|
116
|
-
- Executing E2E tests
|
|
117
|
-
|
|
118
|
-
### @SECA - Security Analyst
|
|
119
|
-
**Use when:**
|
|
120
|
-
- Security review
|
|
121
|
-
- Threat modeling
|
|
122
|
-
- Compliance checking
|
|
123
|
-
|
|
124
|
-
### @DEVOPS - DevOps Engineer
|
|
125
|
-
**Use when:**
|
|
126
|
-
- Setting up CI/CD
|
|
127
|
-
- Managing deployments
|
|
128
|
-
- Merging PRs
|
|
129
|
-
|
|
130
|
-
## Common Patterns
|
|
131
|
-
|
|
132
|
-
### New Feature Request
|
|
133
|
-
```
|
|
134
|
-
/pm → /ba → /sa + /uiux → /tester + /seca → /dev → /tester → /devops
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Bug Fix
|
|
138
|
-
```
|
|
139
|
-
Minor: /cycle
|
|
140
|
-
Major: /emergency → /dev → /tester → /devops → /compound
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Documentation Update
|
|
144
|
-
```
|
|
145
|
-
/dev (for code docs) or /pm (for project docs)
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Maintenance
|
|
149
|
-
```
|
|
150
|
-
/housekeeping → /validate → /metrics → /brain
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
#route #routing #decision-tree #workflow-selection
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## ENFORCEMENT REMINDER
|
|
159
|
-
Before executing, complete /preflight checks.
|
|
160
|
-
|
package/bin/kb
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Knowledge Base CLI - Cross-platform entry point
|
|
3
|
-
# Works on Linux, macOS, and Windows (Git Bash/WSL)
|
|
4
|
-
|
|
5
|
-
# Detect OS
|
|
6
|
-
if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
|
|
7
|
-
# Windows (Git Bash)
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
-
PLATFORM="windows"
|
|
10
|
-
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
11
|
-
# Linux
|
|
12
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
-
PLATFORM="linux"
|
|
14
|
-
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
15
|
-
# macOS
|
|
16
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
-
PLATFORM="macos"
|
|
18
|
-
else
|
|
19
|
-
echo "Unsupported OS: $OSTYPE"
|
|
20
|
-
exit 1
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# Check if Python is available
|
|
24
|
-
if command -v python3 &> /dev/null; then
|
|
25
|
-
PYTHON_CMD="python3"
|
|
26
|
-
elif command -v python &> /dev/null; then
|
|
27
|
-
PYTHON_CMD="python"
|
|
28
|
-
else
|
|
29
|
-
echo "Error: Python not found. Please install Python 3.7+"
|
|
30
|
-
exit 1
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# Run the Python CLI
|
|
34
|
-
exec "$PYTHON_CMD" "$SCRIPT_DIR/kb_cli.py" "$@"
|
package/bin/kb.bat
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
REM Knowledge Base CLI - Windows batch entry point
|
|
3
|
-
REM Usage: kb.bat [command] [args]
|
|
4
|
-
|
|
5
|
-
setlocal enabledelayedexpansion
|
|
6
|
-
|
|
7
|
-
REM Get script directory
|
|
8
|
-
set "SCRIPT_DIR=%~dp0"
|
|
9
|
-
|
|
10
|
-
REM Check for Python
|
|
11
|
-
where python >nul 2>nul
|
|
12
|
-
if %ERRORLEVEL% EQU 0 (
|
|
13
|
-
set "PYTHON_CMD=python"
|
|
14
|
-
goto :run
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
where python3 >nul 2>nul
|
|
18
|
-
if %ERRORLEVEL% EQU 0 (
|
|
19
|
-
set "PYTHON_CMD=python3"
|
|
20
|
-
goto :run
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
echo Error: Python not found. Please install Python 3.7+
|
|
24
|
-
exit /b 1
|
|
25
|
-
|
|
26
|
-
:run
|
|
27
|
-
REM Run the Python CLI
|
|
28
|
-
"%PYTHON_CMD%" "%SCRIPT_DIR%kb_cli.py" %*
|
package/bin/kb_cli.py
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
Knowledge Base CLI - Cross-platform
|
|
5
|
-
Supports Windows, Linux, and macOS
|
|
6
|
-
|
|
7
|
-
Usage:
|
|
8
|
-
kb [command] [args]
|
|
9
|
-
kb.bat [command] [args] (Windows)
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
import sys
|
|
13
|
-
import os
|
|
14
|
-
import platform
|
|
15
|
-
import argparse
|
|
16
|
-
from pathlib import Path
|
|
17
|
-
|
|
18
|
-
# Set UTF-8 encoding for Windows console
|
|
19
|
-
if sys.platform == 'win32':
|
|
20
|
-
try:
|
|
21
|
-
sys.stdout.reconfigure(encoding='utf-8')
|
|
22
|
-
sys.stderr.reconfigure(encoding='utf-8')
|
|
23
|
-
except:
|
|
24
|
-
pass
|
|
25
|
-
|
|
26
|
-
# Add lib directory to path
|
|
27
|
-
SCRIPT_DIR = Path(__file__).parent
|
|
28
|
-
LIB_DIR = SCRIPT_DIR / "lib"
|
|
29
|
-
sys.path.insert(0, str(LIB_DIR))
|
|
30
|
-
|
|
31
|
-
# Import KB modules
|
|
32
|
-
try:
|
|
33
|
-
from kb_search import search_kb
|
|
34
|
-
from kb_add import add_entry
|
|
35
|
-
from kb_index import update_index
|
|
36
|
-
from kb_stats import show_stats
|
|
37
|
-
from kb_list import list_entries
|
|
38
|
-
from kb_compound import compound_operation
|
|
39
|
-
except ImportError as e:
|
|
40
|
-
print(f"Error: Could not import KB modules: {e}")
|
|
41
|
-
print(f"Make sure all required files are in {LIB_DIR}")
|
|
42
|
-
sys.exit(1)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class Colors:
|
|
46
|
-
"""ANSI color codes that work cross-platform"""
|
|
47
|
-
RESET = '\033[0m'
|
|
48
|
-
BOLD = '\033[1m'
|
|
49
|
-
|
|
50
|
-
# Foreground colors
|
|
51
|
-
BLACK = '\033[30m'
|
|
52
|
-
RED = '\033[31m'
|
|
53
|
-
GREEN = '\033[32m'
|
|
54
|
-
YELLOW = '\033[33m'
|
|
55
|
-
BLUE = '\033[34m'
|
|
56
|
-
MAGENTA = '\033[35m'
|
|
57
|
-
CYAN = '\033[36m'
|
|
58
|
-
WHITE = '\033[37m'
|
|
59
|
-
|
|
60
|
-
# Background colors
|
|
61
|
-
BG_BLACK = '\033[40m'
|
|
62
|
-
BG_RED = '\033[41m'
|
|
63
|
-
BG_GREEN = '\033[42m'
|
|
64
|
-
BG_YELLOW = '\033[43m'
|
|
65
|
-
BG_BLUE = '\033[44m'
|
|
66
|
-
BG_MAGENTA = '\033[45m'
|
|
67
|
-
BG_CYAN = '\033[46m'
|
|
68
|
-
BG_WHITE = '\033[47m'
|
|
69
|
-
|
|
70
|
-
@staticmethod
|
|
71
|
-
def enable_windows_colors():
|
|
72
|
-
"""Enable ANSI colors on Windows"""
|
|
73
|
-
if platform.system() == 'Windows':
|
|
74
|
-
try:
|
|
75
|
-
import ctypes
|
|
76
|
-
kernel32 = ctypes.windll.kernel32
|
|
77
|
-
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
|
|
78
|
-
except:
|
|
79
|
-
pass
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def print_header():
|
|
83
|
-
"""Print CLI header"""
|
|
84
|
-
Colors.enable_windows_colors()
|
|
85
|
-
print(f"{Colors.CYAN}{Colors.BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{Colors.RESET}")
|
|
86
|
-
print(f"{Colors.CYAN}{Colors.BOLD}📚 Knowledge Base - Command Line Interface{Colors.RESET}")
|
|
87
|
-
print(f"{Colors.MAGENTA} 🧠 Integrated with Neo4j Brain{Colors.RESET}")
|
|
88
|
-
print(f"{Colors.CYAN}{Colors.BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{Colors.RESET}")
|
|
89
|
-
print()
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def print_help():
|
|
93
|
-
"""Print help message"""
|
|
94
|
-
print_header()
|
|
95
|
-
print(f"{Colors.WHITE}{Colors.BOLD}Usage:{Colors.RESET} kb [command] [args]")
|
|
96
|
-
print()
|
|
97
|
-
print(f"{Colors.YELLOW}{Colors.BOLD}Commands:{Colors.RESET}")
|
|
98
|
-
print()
|
|
99
|
-
print(f" {Colors.WHITE}search <term>{Colors.RESET} 🔍 Search knowledge base")
|
|
100
|
-
print(f" Example: kb search 'react hydration'")
|
|
101
|
-
print()
|
|
102
|
-
print(f" {Colors.WHITE}add{Colors.RESET} ➕ Add new entry (interactive)")
|
|
103
|
-
print(f" Example: kb add")
|
|
104
|
-
print()
|
|
105
|
-
print(f" {Colors.WHITE}index{Colors.RESET} 📇 Update INDEX.md")
|
|
106
|
-
print(f" Example: kb index")
|
|
107
|
-
print()
|
|
108
|
-
print(f" {Colors.WHITE}stats{Colors.RESET} 📊 Show statistics")
|
|
109
|
-
print(f" Example: kb stats")
|
|
110
|
-
print()
|
|
111
|
-
print(f" {Colors.WHITE}list [category]{Colors.RESET} 📋 List all entries (optional: by category)")
|
|
112
|
-
print(f" Example: kb list bugs")
|
|
113
|
-
print()
|
|
114
|
-
print(f" {Colors.WHITE}recent [n]{Colors.RESET} 📅 Show recent entries (default: 10)")
|
|
115
|
-
print(f" Example: kb recent 5")
|
|
116
|
-
print()
|
|
117
|
-
print(f" {Colors.MAGENTA}{Colors.BOLD}compound <action>{Colors.RESET} 🧠 Compound mode with Neo4j integration")
|
|
118
|
-
print(f" Example: kb compound search 'oauth'")
|
|
119
|
-
print()
|
|
120
|
-
print(f" {Colors.WHITE}help{Colors.RESET} ❓ Show this help")
|
|
121
|
-
print()
|
|
122
|
-
print(f"{Colors.MAGENTA}{Colors.BOLD}Compound Actions:{Colors.RESET}")
|
|
123
|
-
print(f" compound search <term> - Search both file system and Neo4j brain")
|
|
124
|
-
print(f" compound add - Add entry and sync to Neo4j")
|
|
125
|
-
print(f" compound sync - Full sync to Neo4j brain")
|
|
126
|
-
print(f" compound query <term> - Intelligent Neo4j query")
|
|
127
|
-
print(f" compound stats - Show compound system health")
|
|
128
|
-
print()
|
|
129
|
-
print(f"{Colors.YELLOW}{Colors.BOLD}Examples:{Colors.RESET}")
|
|
130
|
-
print(f" kb search oauth")
|
|
131
|
-
print(f" {Colors.MAGENTA}kb compound search oauth{Colors.RESET}")
|
|
132
|
-
print(f" kb add")
|
|
133
|
-
print(f" {Colors.MAGENTA}kb compound add{Colors.RESET}")
|
|
134
|
-
print(f" kb stats")
|
|
135
|
-
print()
|
|
136
|
-
print(f"{Colors.CYAN}{Colors.BOLD}💡 Quick Start:{Colors.RESET}")
|
|
137
|
-
print(f" 1. Search before solving: {Colors.MAGENTA}kb compound search 'your problem'{Colors.RESET}")
|
|
138
|
-
print(f" 2. Add after solving: {Colors.MAGENTA}kb compound add{Colors.RESET}")
|
|
139
|
-
print(f" 3. Sync to brain: {Colors.MAGENTA}kb compound sync{Colors.RESET}")
|
|
140
|
-
print()
|
|
141
|
-
print(f"{Colors.MAGENTA}{Colors.BOLD}🧠 Neo4j Brain:{Colors.RESET}")
|
|
142
|
-
print(f" The compound mode connects KB to Neo4j for intelligent")
|
|
143
|
-
print(f" relationship mapping and contextual queries")
|
|
144
|
-
print()
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def main():
|
|
148
|
-
"""Main CLI entry point"""
|
|
149
|
-
Colors.enable_windows_colors()
|
|
150
|
-
|
|
151
|
-
# Parse arguments
|
|
152
|
-
parser = argparse.ArgumentParser(
|
|
153
|
-
description='Knowledge Base CLI',
|
|
154
|
-
add_help=False
|
|
155
|
-
)
|
|
156
|
-
parser.add_argument('command', nargs='?', default='help')
|
|
157
|
-
parser.add_argument('args', nargs='*')
|
|
158
|
-
|
|
159
|
-
args = parser.parse_args()
|
|
160
|
-
command = args.command.lower()
|
|
161
|
-
command_args = args.args
|
|
162
|
-
|
|
163
|
-
try:
|
|
164
|
-
# Execute command
|
|
165
|
-
if command == 'help' or command == '-h' or command == '--help':
|
|
166
|
-
print_help()
|
|
167
|
-
|
|
168
|
-
elif command == 'search':
|
|
169
|
-
if not command_args:
|
|
170
|
-
print(f"{Colors.RED}❌ Search term required!{Colors.RESET}")
|
|
171
|
-
print(f"{Colors.YELLOW}Usage: kb search 'term'{Colors.RESET}")
|
|
172
|
-
sys.exit(1)
|
|
173
|
-
search_term = ' '.join(command_args)
|
|
174
|
-
search_kb(search_term)
|
|
175
|
-
|
|
176
|
-
elif command == 'add':
|
|
177
|
-
add_entry()
|
|
178
|
-
|
|
179
|
-
elif command == 'index':
|
|
180
|
-
update_index()
|
|
181
|
-
|
|
182
|
-
elif command == 'stats':
|
|
183
|
-
show_stats()
|
|
184
|
-
|
|
185
|
-
elif command == 'list':
|
|
186
|
-
category = command_args[0] if command_args else None
|
|
187
|
-
list_entries(category)
|
|
188
|
-
|
|
189
|
-
elif command == 'recent':
|
|
190
|
-
count = int(command_args[0]) if command_args else 10
|
|
191
|
-
list_entries(recent=count)
|
|
192
|
-
|
|
193
|
-
elif command == 'compound':
|
|
194
|
-
if not command_args:
|
|
195
|
-
print(f"{Colors.RED}❌ Compound action required!{Colors.RESET}")
|
|
196
|
-
print(f"{Colors.YELLOW}Usage: kb compound [search|add|sync|query|stats]{Colors.RESET}")
|
|
197
|
-
sys.exit(1)
|
|
198
|
-
|
|
199
|
-
action = command_args[0].lower()
|
|
200
|
-
action_args = command_args[1:] if len(command_args) > 1 else []
|
|
201
|
-
|
|
202
|
-
if action in ['search', 'query'] and not action_args:
|
|
203
|
-
print(f"{Colors.RED}❌ Search/Query term required!{Colors.RESET}")
|
|
204
|
-
sys.exit(1)
|
|
205
|
-
|
|
206
|
-
search_term = ' '.join(action_args) if action_args else None
|
|
207
|
-
compound_operation(action, search_term)
|
|
208
|
-
|
|
209
|
-
else:
|
|
210
|
-
print(f"{Colors.RED}❌ Unknown command: {command}{Colors.RESET}")
|
|
211
|
-
print()
|
|
212
|
-
print_help()
|
|
213
|
-
sys.exit(1)
|
|
214
|
-
|
|
215
|
-
except KeyboardInterrupt:
|
|
216
|
-
print(f"\n{Colors.YELLOW}⚠️ Operation cancelled by user{Colors.RESET}")
|
|
217
|
-
sys.exit(0)
|
|
218
|
-
except Exception as e:
|
|
219
|
-
print(f"{Colors.RED}❌ Error: {e}{Colors.RESET}")
|
|
220
|
-
import traceback
|
|
221
|
-
traceback.print_exc()
|
|
222
|
-
sys.exit(1)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if __name__ == '__main__':
|
|
226
|
-
main()
|