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
package/bin/lib/kb_common.py
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Common utilities for KB operations
|
|
3
|
-
Cross-platform helper functions
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
import os
|
|
7
|
-
import re
|
|
8
|
-
import platform
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
from datetime import datetime
|
|
11
|
-
from typing import Dict, List, Optional
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class KBConfig:
|
|
15
|
-
"""KB configuration"""
|
|
16
|
-
def __init__(self):
|
|
17
|
-
self.root_dir = self._find_project_root()
|
|
18
|
-
self.kb_path = self.root_dir / ".agent" / "knowledge-base"
|
|
19
|
-
self.docs_path = self.root_dir / "docs"
|
|
20
|
-
self.index_path = self.kb_path / "INDEX.md"
|
|
21
|
-
self.platform = platform.system()
|
|
22
|
-
|
|
23
|
-
def _find_project_root(self) -> Path:
|
|
24
|
-
"""Find project root by searching for .agent directory"""
|
|
25
|
-
# Start from cwd
|
|
26
|
-
current = Path.cwd()
|
|
27
|
-
|
|
28
|
-
# Search up to 10 levels
|
|
29
|
-
for _ in range(10):
|
|
30
|
-
if (current / ".agent").exists():
|
|
31
|
-
return current
|
|
32
|
-
if (current / ".git").exists():
|
|
33
|
-
return current
|
|
34
|
-
parent = current.parent
|
|
35
|
-
if parent == current: # Reached root
|
|
36
|
-
break
|
|
37
|
-
current = parent
|
|
38
|
-
|
|
39
|
-
# Fallback: try from script location
|
|
40
|
-
script_dir = Path(__file__).parent.parent.parent # lib -> bin -> root
|
|
41
|
-
if (script_dir / ".agent").exists():
|
|
42
|
-
return script_dir
|
|
43
|
-
|
|
44
|
-
# Last resort: use cwd
|
|
45
|
-
return Path.cwd()
|
|
46
|
-
|
|
47
|
-
def get_kb_path(self) -> Path:
|
|
48
|
-
"""Get KB path"""
|
|
49
|
-
return self.kb_path
|
|
50
|
-
|
|
51
|
-
def get_docs_path(self) -> Path:
|
|
52
|
-
"""Get docs path"""
|
|
53
|
-
return self.docs_path
|
|
54
|
-
|
|
55
|
-
def get_all_kb_paths(self) -> List[Path]:
|
|
56
|
-
"""Get all knowledge base paths (KB + docs)"""
|
|
57
|
-
return [self.kb_path, self.docs_path]
|
|
58
|
-
|
|
59
|
-
def get_index_path(self) -> Path:
|
|
60
|
-
"""Get INDEX.md path"""
|
|
61
|
-
return self.index_path
|
|
62
|
-
|
|
63
|
-
def is_windows(self) -> bool:
|
|
64
|
-
"""Check if running on Windows"""
|
|
65
|
-
return self.platform == 'Windows'
|
|
66
|
-
|
|
67
|
-
def is_linux(self) -> bool:
|
|
68
|
-
"""Check if running on Linux"""
|
|
69
|
-
return self.platform == 'Linux'
|
|
70
|
-
|
|
71
|
-
def is_macos(self) -> bool:
|
|
72
|
-
"""Check if running on macOS"""
|
|
73
|
-
return self.platform == 'Darwin'
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class Colors:
|
|
77
|
-
"""ANSI color codes"""
|
|
78
|
-
RESET = '\033[0m'
|
|
79
|
-
BOLD = '\033[1m'
|
|
80
|
-
|
|
81
|
-
RED = '\033[31m'
|
|
82
|
-
GREEN = '\033[32m'
|
|
83
|
-
YELLOW = '\033[33m'
|
|
84
|
-
BLUE = '\033[34m'
|
|
85
|
-
MAGENTA = '\033[35m'
|
|
86
|
-
CYAN = '\033[36m'
|
|
87
|
-
WHITE = '\033[37m'
|
|
88
|
-
GRAY = '\033[90m'
|
|
89
|
-
|
|
90
|
-
@staticmethod
|
|
91
|
-
def enable_windows():
|
|
92
|
-
"""Enable ANSI colors on Windows"""
|
|
93
|
-
if platform.system() == 'Windows':
|
|
94
|
-
try:
|
|
95
|
-
import ctypes
|
|
96
|
-
kernel32 = ctypes.windll.kernel32
|
|
97
|
-
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
|
|
98
|
-
except:
|
|
99
|
-
pass
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def parse_frontmatter(content: str) -> Dict:
|
|
103
|
-
"""Parse YAML frontmatter from markdown"""
|
|
104
|
-
metadata = {}
|
|
105
|
-
|
|
106
|
-
# Extract frontmatter
|
|
107
|
-
frontmatter_match = re.search(r'^---\s*\n(.*?)\n---\s*\n', content, re.DOTALL)
|
|
108
|
-
if frontmatter_match:
|
|
109
|
-
frontmatter = frontmatter_match.group(1)
|
|
110
|
-
|
|
111
|
-
# Parse simple YAML
|
|
112
|
-
for line in frontmatter.split('\n'):
|
|
113
|
-
if ':' in line:
|
|
114
|
-
key, value = line.split(':', 1)
|
|
115
|
-
key = key.strip()
|
|
116
|
-
value = value.strip().strip('"\'')
|
|
117
|
-
|
|
118
|
-
# Handle arrays
|
|
119
|
-
if value.startswith('[') and value.endswith(']'):
|
|
120
|
-
value = [v.strip().strip('"\'') for v in value[1:-1].split(',')]
|
|
121
|
-
|
|
122
|
-
metadata[key] = value
|
|
123
|
-
|
|
124
|
-
return metadata
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
def get_kb_entries(kb_path: Path, pattern: str = "KB-*.md") -> List[Path]:
|
|
128
|
-
"""Get all KB entries"""
|
|
129
|
-
return list(kb_path.rglob(pattern))
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def get_all_kb_entries(paths: List[Path]) -> List[Path]:
|
|
133
|
-
"""Get all KB entries from multiple paths"""
|
|
134
|
-
entries = []
|
|
135
|
-
for path in paths:
|
|
136
|
-
if path.exists():
|
|
137
|
-
# Get KB-*.md files from knowledge-base
|
|
138
|
-
if path.name == "knowledge-base":
|
|
139
|
-
entries.extend(list(path.rglob("KB-*.md")))
|
|
140
|
-
|
|
141
|
-
# Get all markdown files from docs/ (excluding sprints)
|
|
142
|
-
elif path.name == "docs":
|
|
143
|
-
for md_file in path.rglob("*.md"):
|
|
144
|
-
# Skip sprint artifacts
|
|
145
|
-
if "sprints" in str(md_file):
|
|
146
|
-
continue
|
|
147
|
-
entries.append(md_file)
|
|
148
|
-
|
|
149
|
-
return entries
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def format_time_ago(file_path: Path) -> str:
|
|
153
|
-
"""Format time ago string"""
|
|
154
|
-
mtime = datetime.fromtimestamp(file_path.stat().st_mtime)
|
|
155
|
-
now = datetime.now()
|
|
156
|
-
delta = now - mtime
|
|
157
|
-
|
|
158
|
-
days = delta.days
|
|
159
|
-
if days == 0:
|
|
160
|
-
return "Today"
|
|
161
|
-
elif days == 1:
|
|
162
|
-
return "Yesterday"
|
|
163
|
-
else:
|
|
164
|
-
return f"{days} days ago"
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
def get_priority_icon(priority: str) -> str:
|
|
168
|
-
"""Get priority icon"""
|
|
169
|
-
icons = {
|
|
170
|
-
'critical': '🔴',
|
|
171
|
-
'high': '🟠',
|
|
172
|
-
'medium': '🟡',
|
|
173
|
-
'low': '🟢'
|
|
174
|
-
}
|
|
175
|
-
return icons.get(priority.lower(), '⚪')
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
def get_category_icon(category: str) -> str:
|
|
179
|
-
"""Get category icon"""
|
|
180
|
-
icons = {
|
|
181
|
-
'bug': '🐛',
|
|
182
|
-
'feature': '✨',
|
|
183
|
-
'architecture': '🏗️',
|
|
184
|
-
'security': '🔒',
|
|
185
|
-
'performance': '⚡',
|
|
186
|
-
'platform': '💻'
|
|
187
|
-
}
|
|
188
|
-
return icons.get(category.lower(), '📄')
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
def print_separator(char='━', length=60, color=Colors.CYAN):
|
|
192
|
-
"""Print separator line"""
|
|
193
|
-
print(f"{color}{char * length}{Colors.RESET}")
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
def print_header(title: str, subtitle: str = None):
|
|
197
|
-
"""Print section header"""
|
|
198
|
-
Colors.enable_windows()
|
|
199
|
-
print_separator()
|
|
200
|
-
print(f"{Colors.CYAN}{Colors.BOLD}{title}{Colors.RESET}")
|
|
201
|
-
if subtitle:
|
|
202
|
-
print(f"{Colors.MAGENTA} {subtitle}{Colors.RESET}")
|
|
203
|
-
print_separator()
|
|
204
|
-
print()
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
def print_success(message: str):
|
|
208
|
-
"""Print success message"""
|
|
209
|
-
print(f"{Colors.GREEN}✅ {message}{Colors.RESET}")
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
def print_error(message: str):
|
|
213
|
-
"""Print error message"""
|
|
214
|
-
print(f"{Colors.RED}❌ {message}{Colors.RESET}")
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
def print_warning(message: str):
|
|
218
|
-
"""Print warning message"""
|
|
219
|
-
print(f"{Colors.YELLOW}⚠️ {message}{Colors.RESET}")
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
def print_info(message: str):
|
|
223
|
-
"""Print info message"""
|
|
224
|
-
print(f"{Colors.CYAN}ℹ️ {message}{Colors.RESET}")
|
package/bin/lib/kb_compound.py
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
KB Compound Module
|
|
3
|
-
Cross-platform Neo4j integration
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
import os
|
|
7
|
-
import sys
|
|
8
|
-
import subprocess
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
from kb_common import (
|
|
11
|
-
KBConfig, Colors, print_header, print_success, print_warning, print_error, print_separator
|
|
12
|
-
)
|
|
13
|
-
from kb_search import search_kb
|
|
14
|
-
from kb_add import add_entry
|
|
15
|
-
from kb_index import update_index
|
|
16
|
-
from kb_stats import show_stats
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def compound_operation(action: str, search_term: str = None):
|
|
20
|
-
"""Execute compound operation"""
|
|
21
|
-
config = KBConfig()
|
|
22
|
-
Colors.enable_windows()
|
|
23
|
-
|
|
24
|
-
print_header(
|
|
25
|
-
"🧠 Knowledge Base Compound System",
|
|
26
|
-
"Integrated with Neo4j Brain"
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
if action == 'search':
|
|
30
|
-
compound_search(config, search_term)
|
|
31
|
-
elif action == 'add':
|
|
32
|
-
compound_add(config)
|
|
33
|
-
elif action == 'sync':
|
|
34
|
-
compound_sync(config)
|
|
35
|
-
elif action == 'query':
|
|
36
|
-
compound_query(config, search_term)
|
|
37
|
-
elif action == 'stats':
|
|
38
|
-
compound_stats(config)
|
|
39
|
-
else:
|
|
40
|
-
print_error(f"Unknown compound action: {action}")
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def check_neo4j_available(config: KBConfig) -> bool:
|
|
44
|
-
"""Check if Neo4j tools are available"""
|
|
45
|
-
neo4j_sync = config.root_dir / "tools" / "neo4j" / "sync_skills_to_neo4j.py"
|
|
46
|
-
return neo4j_sync.exists()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def run_neo4j_script(config: KBConfig, script_name: str, args: list = None) -> bool:
|
|
50
|
-
"""Run Neo4j Python script"""
|
|
51
|
-
script_path = config.root_dir / "tools" / "neo4j" / script_name
|
|
52
|
-
|
|
53
|
-
if not script_path.exists():
|
|
54
|
-
return False
|
|
55
|
-
|
|
56
|
-
try:
|
|
57
|
-
cmd = [sys.executable, str(script_path)]
|
|
58
|
-
if args:
|
|
59
|
-
cmd.extend(args)
|
|
60
|
-
|
|
61
|
-
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
62
|
-
|
|
63
|
-
if result.returncode == 0:
|
|
64
|
-
print(result.stdout)
|
|
65
|
-
return True
|
|
66
|
-
else:
|
|
67
|
-
print_warning("Neo4j operation had issues (continuing in file mode)")
|
|
68
|
-
if result.stderr:
|
|
69
|
-
print(f"{Colors.GRAY}{result.stderr}{Colors.RESET}")
|
|
70
|
-
return False
|
|
71
|
-
except Exception as e:
|
|
72
|
-
print_warning(f"Could not connect to Neo4j: {e}")
|
|
73
|
-
return False
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def compound_search(config: KBConfig, search_term: str):
|
|
77
|
-
"""Compound search: Neo4j + File system"""
|
|
78
|
-
print(f"{Colors.CYAN}🔍 Compound Search: '{search_term}'{Colors.RESET}")
|
|
79
|
-
print()
|
|
80
|
-
|
|
81
|
-
# Phase 1: Neo4j Brain Search
|
|
82
|
-
print(f"{Colors.MAGENTA}━━━ Phase 1: Neo4j Brain Search ━━━{Colors.RESET}")
|
|
83
|
-
|
|
84
|
-
if check_neo4j_available(config):
|
|
85
|
-
neo4j_success = run_neo4j_script(
|
|
86
|
-
config,
|
|
87
|
-
'query_skills_neo4j.py',
|
|
88
|
-
['--search', search_term]
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
if neo4j_success:
|
|
92
|
-
print_success("Neo4j query successful!")
|
|
93
|
-
else:
|
|
94
|
-
print_warning("Neo4j not available, using file search only")
|
|
95
|
-
else:
|
|
96
|
-
print_warning("Neo4j tools not found, using file search only")
|
|
97
|
-
|
|
98
|
-
print()
|
|
99
|
-
|
|
100
|
-
# Phase 2: File System Search
|
|
101
|
-
print(f"{Colors.MAGENTA}━━━ Phase 2: File System Search ━━━{Colors.RESET}")
|
|
102
|
-
search_kb(search_term)
|
|
103
|
-
|
|
104
|
-
print()
|
|
105
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
106
|
-
print(f"{Colors.GREEN}{Colors.BOLD}💡 Compound Search Complete!{Colors.RESET}")
|
|
107
|
-
print(f" Searched: Neo4j Brain + File System")
|
|
108
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def compound_add(config: KBConfig):
|
|
112
|
-
"""Compound add: Create + Index + Sync"""
|
|
113
|
-
print(f"{Colors.CYAN}➕ Adding New Knowledge Entry{Colors.RESET}")
|
|
114
|
-
print()
|
|
115
|
-
|
|
116
|
-
# Phase 1: Create Entry
|
|
117
|
-
print(f"{Colors.MAGENTA}━━━ Phase 1: Create Entry ━━━{Colors.RESET}")
|
|
118
|
-
add_entry()
|
|
119
|
-
print()
|
|
120
|
-
|
|
121
|
-
# Phase 2: Update Index
|
|
122
|
-
print(f"{Colors.MAGENTA}━━━ Phase 2: Update Index ━━━{Colors.RESET}")
|
|
123
|
-
update_index()
|
|
124
|
-
print()
|
|
125
|
-
|
|
126
|
-
# Phase 3: Sync to Neo4j
|
|
127
|
-
print(f"{Colors.MAGENTA}━━━ Phase 3: Sync to Neo4j Brain ━━━{Colors.RESET}")
|
|
128
|
-
|
|
129
|
-
if check_neo4j_available(config):
|
|
130
|
-
synced = run_neo4j_script(config, 'sync_skills_to_neo4j.py')
|
|
131
|
-
|
|
132
|
-
if synced:
|
|
133
|
-
print_success("Synced to Neo4j successfully!")
|
|
134
|
-
else:
|
|
135
|
-
print_warning("Neo4j sync failed, entry saved to file system")
|
|
136
|
-
else:
|
|
137
|
-
print_warning("Neo4j tools not available")
|
|
138
|
-
|
|
139
|
-
print()
|
|
140
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
141
|
-
print(f"{Colors.GREEN}{Colors.BOLD}✅ Compound Add Complete!{Colors.RESET}")
|
|
142
|
-
print(f" Entry created, indexed, and synced to brain")
|
|
143
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
144
|
-
|
|
145
|
-
if check_neo4j_available(config):
|
|
146
|
-
print()
|
|
147
|
-
print(f"{Colors.CYAN}🧠 Your knowledge is now in the Neo4j Brain!{Colors.RESET}")
|
|
148
|
-
print(f" It can be queried with relationships and context")
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def compound_sync(config: KBConfig):
|
|
152
|
-
"""Compound sync: Index + Neo4j + Stats"""
|
|
153
|
-
print(f"{Colors.CYAN}🔄 Full Compound Sync{Colors.RESET}")
|
|
154
|
-
print()
|
|
155
|
-
|
|
156
|
-
# Phase 1: Update Index
|
|
157
|
-
print(f"{Colors.MAGENTA}━━━ Phase 1: Update Index ━━━{Colors.RESET}")
|
|
158
|
-
update_index()
|
|
159
|
-
print()
|
|
160
|
-
|
|
161
|
-
# Phase 2: Sync to Neo4j (includes docs/)
|
|
162
|
-
print(f"{Colors.MAGENTA}━━━ Phase 2: Sync to Neo4j Brain ━━━{Colors.RESET}")
|
|
163
|
-
print(f" Syncing: .agent/knowledge-base/ + docs/")
|
|
164
|
-
print()
|
|
165
|
-
|
|
166
|
-
if check_neo4j_available(config):
|
|
167
|
-
synced = run_neo4j_script(config, 'sync_skills_to_neo4j.py')
|
|
168
|
-
|
|
169
|
-
if synced:
|
|
170
|
-
print_success("Synced to Neo4j successfully!")
|
|
171
|
-
else:
|
|
172
|
-
print_warning("Neo4j sync had issues")
|
|
173
|
-
else:
|
|
174
|
-
print_warning("Neo4j tools not available")
|
|
175
|
-
|
|
176
|
-
print()
|
|
177
|
-
|
|
178
|
-
# Phase 3: Show Stats
|
|
179
|
-
print(f"{Colors.MAGENTA}━━━ Phase 3: Compound Stats ━━━{Colors.RESET}")
|
|
180
|
-
show_stats()
|
|
181
|
-
|
|
182
|
-
print()
|
|
183
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
184
|
-
print(f"{Colors.GREEN}{Colors.BOLD}✅ Compound Sync Complete!{Colors.RESET}")
|
|
185
|
-
print(f" All knowledge indexed and synced to brain")
|
|
186
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def compound_query(config: KBConfig, query_term: str):
|
|
190
|
-
"""Compound query: Intelligent Neo4j queries"""
|
|
191
|
-
print(f"{Colors.CYAN}🧠 Intelligent Query via Neo4j Brain{Colors.RESET}")
|
|
192
|
-
print()
|
|
193
|
-
|
|
194
|
-
if not check_neo4j_available(config):
|
|
195
|
-
print_error("Neo4j tools not available")
|
|
196
|
-
print(f" Install Neo4j tools in tools/neo4j/")
|
|
197
|
-
return
|
|
198
|
-
|
|
199
|
-
print(f"Query: '{query_term}'")
|
|
200
|
-
print()
|
|
201
|
-
|
|
202
|
-
# Search skills
|
|
203
|
-
print(f"{Colors.MAGENTA}━━━ Searching Skills ━━━{Colors.RESET}")
|
|
204
|
-
run_neo4j_script(config, 'query_skills_neo4j.py', ['--search', query_term])
|
|
205
|
-
|
|
206
|
-
print()
|
|
207
|
-
|
|
208
|
-
# Related skills
|
|
209
|
-
print(f"{Colors.MAGENTA}━━━ Related Skills ━━━{Colors.RESET}")
|
|
210
|
-
run_neo4j_script(config, 'query_skills_neo4j.py', ['--skill', query_term])
|
|
211
|
-
|
|
212
|
-
print()
|
|
213
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
214
|
-
print(f"{Colors.GREEN}{Colors.BOLD}💡 Neo4j Brain Query Complete!{Colors.RESET}")
|
|
215
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
def compound_stats(config: KBConfig):
|
|
219
|
-
"""Compound stats: File system + Neo4j"""
|
|
220
|
-
print(f"{Colors.CYAN}📊 Compound System Health{Colors.RESET}")
|
|
221
|
-
print()
|
|
222
|
-
|
|
223
|
-
# Phase 1: File System Stats
|
|
224
|
-
print(f"{Colors.MAGENTA}━━━ File System Stats ━━━{Colors.RESET}")
|
|
225
|
-
show_stats()
|
|
226
|
-
|
|
227
|
-
print()
|
|
228
|
-
|
|
229
|
-
# Phase 2: Neo4j Stats
|
|
230
|
-
print(f"{Colors.MAGENTA}━━━ Neo4j Brain Stats ━━━{Colors.RESET}")
|
|
231
|
-
|
|
232
|
-
if check_neo4j_available(config):
|
|
233
|
-
success = run_neo4j_script(config, 'query_skills_neo4j.py', ['--all-skills'])
|
|
234
|
-
|
|
235
|
-
if success:
|
|
236
|
-
print(f" {Colors.GRAY}(Showing first 20 skills){Colors.RESET}")
|
|
237
|
-
else:
|
|
238
|
-
print_warning("Neo4j not available")
|
|
239
|
-
|
|
240
|
-
print()
|
|
241
|
-
print_separator('━', 60, Colors.MAGENTA)
|
|
242
|
-
print(f"{Colors.GREEN}{Colors.BOLD}💡 Compound System Status{Colors.RESET}")
|
|
243
|
-
print(f" File System: ✅ Active")
|
|
244
|
-
|
|
245
|
-
if check_neo4j_available(config):
|
|
246
|
-
print(f" Neo4j Brain: ✅ Connected")
|
|
247
|
-
else:
|
|
248
|
-
print(f" Neo4j Brain: ⚠️ Not Available")
|
|
249
|
-
|
|
250
|
-
print_separator('━', 60, Colors.MAGENTA)
|
package/bin/lib/kb_index.py
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
KB Index Module
|
|
3
|
-
Cross-platform INDEX.md generation
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
from datetime import datetime
|
|
8
|
-
from collections import defaultdict
|
|
9
|
-
from kb_common import (
|
|
10
|
-
KBConfig, Colors, parse_frontmatter, get_kb_entries, get_all_kb_entries,
|
|
11
|
-
print_header, print_success, get_priority_icon, get_category_icon
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def update_index():
|
|
16
|
-
"""Update INDEX.md"""
|
|
17
|
-
config = KBConfig()
|
|
18
|
-
Colors.enable_windows()
|
|
19
|
-
|
|
20
|
-
print_header("📇 Updating Knowledge Base Index", "Scanning KB + docs directories...")
|
|
21
|
-
|
|
22
|
-
all_paths = config.get_all_kb_paths()
|
|
23
|
-
entries = get_all_kb_entries(all_paths)
|
|
24
|
-
|
|
25
|
-
# Parse all entries
|
|
26
|
-
parsed_entries = []
|
|
27
|
-
for entry_path in entries:
|
|
28
|
-
try:
|
|
29
|
-
content = entry_path.read_text(encoding='utf-8')
|
|
30
|
-
metadata = parse_frontmatter(content)
|
|
31
|
-
|
|
32
|
-
if metadata:
|
|
33
|
-
metadata['path'] = entry_path
|
|
34
|
-
metadata['filename'] = entry_path.name
|
|
35
|
-
parsed_entries.append(metadata)
|
|
36
|
-
except Exception as e:
|
|
37
|
-
continue
|
|
38
|
-
|
|
39
|
-
# Group entries
|
|
40
|
-
by_category = defaultdict(list)
|
|
41
|
-
by_priority = defaultdict(list)
|
|
42
|
-
by_date = defaultdict(list)
|
|
43
|
-
|
|
44
|
-
for entry in parsed_entries:
|
|
45
|
-
category = entry.get('category', 'unknown')
|
|
46
|
-
priority = entry.get('priority', 'unknown')
|
|
47
|
-
date = entry.get('date', 'unknown')
|
|
48
|
-
|
|
49
|
-
by_category[category].append(entry)
|
|
50
|
-
by_priority[priority].append(entry)
|
|
51
|
-
by_date[date].append(entry)
|
|
52
|
-
|
|
53
|
-
# Generate INDEX.md
|
|
54
|
-
index_content = generate_index_content(parsed_entries, by_category, by_priority, by_date)
|
|
55
|
-
|
|
56
|
-
# Write INDEX.md
|
|
57
|
-
index_path = config.get_index_path()
|
|
58
|
-
index_path.write_text(index_content, encoding='utf-8')
|
|
59
|
-
|
|
60
|
-
print_success(f"INDEX.md Updated Successfully!")
|
|
61
|
-
print()
|
|
62
|
-
print(f"{Colors.CYAN}📊 Statistics:{Colors.RESET}")
|
|
63
|
-
print(f" Total Entries: {len(parsed_entries)}")
|
|
64
|
-
print(f" Categories: {len(by_category)}")
|
|
65
|
-
print(f" Priorities: {len(by_priority)}")
|
|
66
|
-
print()
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def generate_index_content(entries, by_category, by_priority, by_date):
|
|
70
|
-
"""Generate INDEX.md content"""
|
|
71
|
-
content = f"""# Knowledge Base Index
|
|
72
|
-
|
|
73
|
-
**Last Updated:** {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
|
|
74
|
-
**Total Entries:** {len(entries)}
|
|
75
|
-
|
|
76
|
-
This index provides a searchable overview of all knowledge base entries.
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## 📊 Quick Stats
|
|
81
|
-
|
|
82
|
-
- **Total Entries:** {len(entries)}
|
|
83
|
-
- **Categories:** {len(by_category)}
|
|
84
|
-
- **Priorities:** {len(by_priority)}
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## 📁 By Category
|
|
89
|
-
|
|
90
|
-
"""
|
|
91
|
-
|
|
92
|
-
# Add entries by category
|
|
93
|
-
for category in sorted(by_category.keys()):
|
|
94
|
-
icon = get_category_icon(category)
|
|
95
|
-
entries_list = by_category[category]
|
|
96
|
-
content += f"\n### {icon} {category.title()} ({len(entries_list)} entries)\n\n"
|
|
97
|
-
|
|
98
|
-
for entry in sorted(entries_list, key=lambda x: x.get('date', ''), reverse=True):
|
|
99
|
-
title = entry.get('title', 'Unknown')
|
|
100
|
-
filename = entry.get('filename', '')
|
|
101
|
-
priority = entry.get('priority', 'unknown')
|
|
102
|
-
date = entry.get('date', 'unknown')
|
|
103
|
-
tags = entry.get('tags', [])
|
|
104
|
-
|
|
105
|
-
priority_icon = get_priority_icon(priority)
|
|
106
|
-
tags_str = ', '.join(tags) if isinstance(tags, list) else tags
|
|
107
|
-
|
|
108
|
-
content += f"- {priority_icon} **{title}**\n"
|
|
109
|
-
content += f" - File: `{filename}`\n"
|
|
110
|
-
content += f" - Date: {date} | Priority: {priority}\n"
|
|
111
|
-
if tags_str:
|
|
112
|
-
content += f" - Tags: {tags_str}\n"
|
|
113
|
-
content += "\n"
|
|
114
|
-
|
|
115
|
-
# Add by priority
|
|
116
|
-
content += "\n---\n\n## ⚠️ By Priority\n\n"
|
|
117
|
-
|
|
118
|
-
priority_order = ['critical', 'high', 'medium', 'low']
|
|
119
|
-
for priority in priority_order:
|
|
120
|
-
if priority in by_priority:
|
|
121
|
-
icon = get_priority_icon(priority)
|
|
122
|
-
entries_list = by_priority[priority]
|
|
123
|
-
content += f"\n### {icon} {priority.title()} ({len(entries_list)} entries)\n\n"
|
|
124
|
-
|
|
125
|
-
for entry in sorted(entries_list, key=lambda x: x.get('date', ''), reverse=True)[:10]:
|
|
126
|
-
title = entry.get('title', 'Unknown')
|
|
127
|
-
filename = entry.get('filename', '')
|
|
128
|
-
category = entry.get('category', 'unknown')
|
|
129
|
-
|
|
130
|
-
content += f"- **{title}** ({category})\n"
|
|
131
|
-
content += f" - `{filename}`\n"
|
|
132
|
-
|
|
133
|
-
# Add recent entries
|
|
134
|
-
content += "\n---\n\n## 📅 Recent Entries (Last 20)\n\n"
|
|
135
|
-
|
|
136
|
-
recent = sorted(entries, key=lambda x: x.get('date', ''), reverse=True)[:20]
|
|
137
|
-
for entry in recent:
|
|
138
|
-
title = entry.get('title', 'Unknown')
|
|
139
|
-
filename = entry.get('filename', '')
|
|
140
|
-
category = entry.get('category', 'unknown')
|
|
141
|
-
priority = entry.get('priority', 'unknown')
|
|
142
|
-
date = entry.get('date', 'unknown')
|
|
143
|
-
|
|
144
|
-
icon = get_priority_icon(priority)
|
|
145
|
-
content += f"- {icon} **{title}**\n"
|
|
146
|
-
content += f" - `{filename}`\n"
|
|
147
|
-
content += f" - {date} | {category} | {priority}\n\n"
|
|
148
|
-
|
|
149
|
-
# Add search tips
|
|
150
|
-
content += """
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
## 🔍 How to Search
|
|
154
|
-
|
|
155
|
-
### Using CLI
|
|
156
|
-
```bash
|
|
157
|
-
# Search by keyword
|
|
158
|
-
kb search "react hydration"
|
|
159
|
-
|
|
160
|
-
# Compound search (file + Neo4j)
|
|
161
|
-
kb compound search "authentication"
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Using Scripts
|
|
165
|
-
```bash
|
|
166
|
-
# PowerShell (Windows)
|
|
167
|
-
.\\bin\\kb.ps1 search "term"
|
|
168
|
-
|
|
169
|
-
# Bash (Linux/Mac)
|
|
170
|
-
./bin/kb search "term"
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## 📝 Adding Entries
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
# Interactive add
|
|
179
|
-
kb add
|
|
180
|
-
|
|
181
|
-
# Compound add (auto-sync to Neo4j)
|
|
182
|
-
kb compound add
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
**Generated by:** Knowledge Base Index Generator
|
|
188
|
-
**Platform:** Cross-platform (Windows/Linux/macOS)
|
|
189
|
-
|
|
190
|
-
#knowledge-base #index #searchable
|
|
191
|
-
"""
|
|
192
|
-
|
|
193
|
-
return content
|