agentic-sdlc 1.0.0 → 1.5.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.
Files changed (227) hide show
  1. package/.agent/ide-integration/INTEGRATION-SUMMARY.md +309 -0
  2. package/.agent/ide-integration/KIRO-IDE.md +381 -0
  3. package/.agent/ide-integration/README.md +256 -209
  4. package/.agent/knowledge-base/AUTO-LEARNING-GUIDE.md +327 -0
  5. package/.agent/knowledge-base/HOW-IT-WORKS.md +365 -0
  6. package/.agent/knowledge-base/INDEX.md +43 -0
  7. package/.agent/knowledge-base/README.md +47 -7
  8. package/.agent/knowledge-base/architecture/KB-2026-01-01-003-neo4j-graph-database-skills.md +1146 -0
  9. package/.agent/knowledge-base/architecture/README.md +98 -0
  10. package/.agent/knowledge-base/bugs/KB-2026-01-02-yaml-special-character-escaping.md +56 -0
  11. package/.agent/knowledge-base/bugs/medium/KB-2026-01-01-001-example-auto-learned.md +198 -0
  12. package/.agent/knowledge-base/features/KB-2026-01-01-001-landing-page-design-trends-2026.md +646 -0
  13. package/.agent/knowledge-base/features/KB-2026-01-01-004-uiux-design-skills-2026.md +945 -0
  14. package/.agent/knowledge-base/features/KB-2026-01-01-005-modern-ai-landing-page-ui.md +310 -0
  15. package/.agent/knowledge-base/features/KB-2026-01-01-006-award-winning-landing-page-patterns.md +324 -0
  16. package/.agent/knowledge-base/features/KB-2026-01-02-001-cleanup-workflow.md +242 -0
  17. package/.agent/knowledge-base/features/KB-2026-01-02-002-landing-page-monorepo-architecture.md +148 -0
  18. package/.agent/knowledge-base/features/KB-2026-01-02-003-premium-glassmorphism-patterns.md +58 -0
  19. package/.agent/knowledge-base/features/KB-2026-01-04-ai-agent-enforcement.md +46 -0
  20. package/.agent/knowledge-base/features/README.md +83 -0
  21. package/.agent/knowledge-base/features/figma-landing-page-workflow.md +311 -0
  22. package/.agent/knowledge-base/features/figma-mcp-sa-guide.md +673 -0
  23. package/.agent/knowledge-base/features/figma-mcp-uiux-guide.md +459 -0
  24. package/.agent/knowledge-base/performance/KB-2026-01-02-lazy-loading-optimization.md +80 -0
  25. package/.agent/knowledge-base/platform-specific/KB-2026-01-02-windows-console-encoding.md +56 -0
  26. package/.agent/knowledge-base/role-guides/DEV-KB-Guide.md +527 -0
  27. package/.agent/knowledge-base/role-guides/DEVOPS-KB-Guide.md +491 -0
  28. package/.agent/knowledge-base/role-guides/PM-KB-Guide.md +299 -0
  29. package/.agent/knowledge-base/role-guides/SECA-KB-Guide.md +555 -0
  30. package/.agent/knowledge-base/role-guides/TESTER-KB-Guide.md +519 -0
  31. package/.agent/knowledge-base/security/KB-2026-01-02-input-validation-sanitization.md +74 -0
  32. package/.agent/rules/AUTO-LEARNING.md +418 -0
  33. package/.agent/rules/ai-enforcement.md +11 -0
  34. package/.agent/rules/artifacts.md +77 -58
  35. package/.agent/rules/git-workflow.md +25 -65
  36. package/.agent/rules/global.md +18 -13
  37. package/.agent/skills/role-ba.md +76 -0
  38. package/.agent/skills/role-brain.md +470 -0
  39. package/.agent/skills/role-dev.md +338 -0
  40. package/.agent/skills/role-devops.md +122 -0
  41. package/.agent/skills/role-orchestrator.md +223 -0
  42. package/.agent/skills/role-pm.md +258 -0
  43. package/.agent/skills/role-po.md +237 -0
  44. package/.agent/skills/role-qa.md +81 -0
  45. package/.agent/skills/role-reporter.md +117 -0
  46. package/.agent/skills/role-sa.md +277 -0
  47. package/.agent/skills/role-seca.md +294 -0
  48. package/.agent/skills/role-stakeholder.md +105 -0
  49. package/.agent/skills/role-tester.md +294 -0
  50. package/.agent/skills/role-uiux.md +264 -0
  51. package/.agent/templates/CHANGELOG-Template.md +83 -0
  52. package/.agent/templates/Knowledge-Entry-Template.md +3 -0
  53. package/.agent/workflows/brain.md +84 -53
  54. package/.agent/workflows/compound.md +51 -0
  55. package/.agent/workflows/cycle.md +61 -0
  56. package/.agent/workflows/emergency.md +114 -0
  57. package/.agent/workflows/explore.md +147 -0
  58. package/.agent/workflows/housekeeping.md +105 -0
  59. package/.agent/workflows/metrics.md +179 -0
  60. package/.agent/workflows/orchestrator.md +68 -0
  61. package/.agent/workflows/preflight.md +35 -0
  62. package/.agent/workflows/release.md +153 -0
  63. package/.agent/workflows/route.md +160 -0
  64. package/.agent/workflows/sprint.md +125 -0
  65. package/.agent/workflows/validate.md +146 -0
  66. package/CHANGELOG.md +349 -6
  67. package/README.md +171 -86
  68. package/bin/CROSS-PLATFORM-CLI.md +526 -0
  69. package/bin/README.md +525 -0
  70. package/bin/cli.js +65 -90
  71. package/bin/kb +34 -0
  72. package/bin/kb.bat +28 -0
  73. package/bin/kb_cli.py +226 -0
  74. package/bin/lib/README.md +411 -0
  75. package/bin/lib/__init__.py +7 -0
  76. package/bin/lib/__pycache__/kb_add.cpython-313.pyc +0 -0
  77. package/bin/lib/__pycache__/kb_common.cpython-313.pyc +0 -0
  78. package/bin/lib/__pycache__/kb_compound.cpython-313.pyc +0 -0
  79. package/bin/lib/__pycache__/kb_index.cpython-313.pyc +0 -0
  80. package/bin/lib/__pycache__/kb_list.cpython-313.pyc +0 -0
  81. package/bin/lib/__pycache__/kb_search.cpython-313.pyc +0 -0
  82. package/bin/lib/__pycache__/kb_stats.cpython-313.pyc +0 -0
  83. package/bin/lib/kb_add.py +203 -0
  84. package/bin/lib/kb_common.py +224 -0
  85. package/bin/lib/kb_compound.py +250 -0
  86. package/bin/lib/kb_index.py +193 -0
  87. package/bin/lib/kb_list.py +144 -0
  88. package/bin/lib/kb_search.py +121 -0
  89. package/bin/lib/kb_stats.py +153 -0
  90. package/docs/AGENT-MANAGEMENT-GUIDE.md +298 -0
  91. package/docs/ARCHITECTURE-OVERVIEW.md +350 -0
  92. package/docs/BRAIN-ARCHITECTURE.md +396 -0
  93. package/docs/COMPOUND-ENGINEERING-SETUP.md +326 -0
  94. package/docs/KNOWLEDGE-BASE-GUIDE.md +330 -0
  95. package/docs/KNOWLEDGE-BASE-SIMPLE.md +248 -0
  96. package/docs/MONOREPO-ARCHITECTURE.md +492 -0
  97. package/docs/PROJECT-DOCUMENTATION-INDEX.md +540 -0
  98. package/docs/SDLC-Diagram.md +235 -0
  99. package/docs/analysis/Workflow-Optimization-Diagram.md +524 -0
  100. package/docs/analysis/Workflows-Deep-Analysis-2026-01-03.md +604 -0
  101. package/docs/architecture/{brain.md → BRAIN.md} +1 -1
  102. package/docs/global/Master-Documentation.md +307 -0
  103. package/docs/global/reports/Final-Approval-Report.md +257 -0
  104. package/docs/guides/AUTO-LEARNING-COMPLETE-GUIDE.md +519 -0
  105. package/docs/guides/AUTO-LEARNING-SYSTEM.md +322 -0
  106. package/docs/guides/LEARNING-FLOW.md +0 -0
  107. package/docs/guides/MCP-QUICK-REFERENCE.md +104 -0
  108. package/docs/guides/MCP-SETUP.md +139 -0
  109. package/docs/guides/QUICK-START.md +4 -0
  110. package/docs/guides/ROLE-COMMUNICATION-SYSTEM.md +71 -0
  111. package/docs/reports/Metrics-Dashboard-2026-01-02.md +66 -0
  112. package/docs/reports/Metrics-Dashboard-2026-01-04.md +68 -0
  113. package/docs/reports/UIUX-Design-Skills-Research-Report-2026.md +91 -0
  114. package/docs/reports/Validation-Report-2026-01-04.md +23 -0
  115. package/docs/research-reports/research-20260103-101315.json +95 -0
  116. package/docs/research-reports/research-20260103-101315.md +78 -0
  117. package/docs/research-reports/research-20260103-183837.json +95 -0
  118. package/docs/research-reports/research-20260103-183837.md +78 -0
  119. package/docs/research-reports/research-20260103-190346.json +100 -0
  120. package/docs/research-reports/research-20260103-190346.md +83 -0
  121. package/docs/setup/{github-management.md → GITHUB-MANAGEMENT.md} +1 -1
  122. package/docs/setup/RESEARCH-AGENT-SETUP.md +575 -0
  123. package/docs/sprints/{sprint-github-issues.md → SPRINT-GITHUB-ISSUES.md} +1 -1
  124. package/docs/sprints/{sprint-leann-integration.md → SPRINT-LEANN-INTEGRATION.md} +1 -1
  125. package/docs/sprints/sprint-1/designs/Backend-Design-Spec-Sprint-1-v1.md +1206 -0
  126. package/docs/sprints/sprint-1/designs/System-Design-Spec-Sprint-1-v1.md +439 -0
  127. package/docs/sprints/sprint-1/designs/System-Design-Spec-v1.0.md +425 -0
  128. package/docs/sprints/sprint-1/designs/UIUX-Design-Spec-Sprint-1-v1.md +55 -0
  129. package/docs/sprints/sprint-1/designs/UIUX-Design-Spec-v1.0.md +644 -0
  130. package/docs/sprints/sprint-1/logs/DevOps-Plan-and-Log-Sprint-1-v1.md +253 -0
  131. package/docs/sprints/sprint-1/logs/Development-Log-Phase1.md +433 -0
  132. package/docs/sprints/sprint-1/logs/Development-Log-Sprint-1-v1.md +181 -0
  133. package/docs/sprints/sprint-1/logs/Development-Log-Sprint-1.md +548 -0
  134. package/docs/sprints/sprint-1/logs/Orchestration-Log-Sprint-1.md +46 -0
  135. package/docs/sprints/sprint-1/logs/Phase1-Summary.md +84 -0
  136. package/docs/sprints/sprint-1/plans/Product-Backlog-Sprint-1-v1.md +40 -0
  137. package/docs/sprints/sprint-1/plans/Product-Backlog-v1.0.md +613 -0
  138. package/docs/sprints/sprint-1/plans/Project-Plan-Sprint-1-v1.0.md +210 -0
  139. package/docs/sprints/sprint-1/plans/Project-Plan-Sprint-1-v1.md +377 -0
  140. package/docs/sprints/sprint-1/reports/Design-Verification-Report-v1.0.md +220 -0
  141. package/docs/sprints/sprint-1/reports/Phase-Report-Sprint-1-v1.md +238 -0
  142. package/docs/sprints/sprint-1/reports/Security-Review-Report-v1.0.md +285 -0
  143. package/docs/sprints/sprint-1/reports/Sprint-Report-Sprint-1.md +74 -0
  144. package/docs/sprints/sprint-1/reports/Test-Report-v1.0.md +346 -0
  145. package/docs/sprints/sprint-1/reviews/Design-Verification-Report.md +508 -0
  146. package/docs/sprints/sprint-1/reviews/Security-Review-Report.md +589 -0
  147. package/docs/sprints/sprint-1/sprint-current/logs/WORKFLOW-CLEANUP-FINAL.md +121 -0
  148. package/docs/sprints/sprint-1/sprint-current/logs/WORKFLOW-OPTIMIZATION-COMPLETE.md +224 -0
  149. package/docs/sprints/sprint-1/sprint-current/logs/Workflow-Optimization-Progress.md +310 -0
  150. package/docs/sprints/sprint-1/sprint-current/logs/Workflow-Optimization-Session-Summary.md +420 -0
  151. package/docs/sprints/sprint-1/sprint-current/plans/Workflow-Optimization-Implementation-Plan.md +1124 -0
  152. package/docs/sprints/sprint-2/SPRINT-SUMMARY.md +150 -0
  153. package/docs/sprints/sprint-2/designs/UIUX-Design-Spec-Sprint-2-v1.md +352 -0
  154. package/docs/sprints/sprint-2/logs/Development-Log-Sprint-2-v1.md +293 -0
  155. package/docs/sprints/sprint-2/plans/Product-Backlog-Sprint-2-v1.md +62 -0
  156. package/docs/sprints/sprint-2/plans/Project-Plan-Sprint-2-v1.md +228 -0
  157. package/docs/sprints/sprint-2/reports/Phase-Report-Sprint-2-v1.md +303 -0
  158. package/docs/sprints/sprint-3/designs/UIUX-Design-Spec-Sprint-3-v1.md +160 -0
  159. package/docs/sprints/sprint-3/logs/Development-Log-Sprint-3-v1.md +249 -0
  160. package/docs/sprints/sprint-3/logs/Testing-Report-Sprint-3-v1.md +244 -0
  161. package/docs/sprints/sprint-3/plans/Product-Backlog-Sprint-3-v1.md +95 -0
  162. package/docs/sprints/sprint-3/reports/Final-Approval-Report-Sprint-3-v1.md +299 -0
  163. package/docs/sprints/sprint-3/reports/Sprint-Summary-Sprint-3-v1.md +276 -0
  164. package/docs/sprints/sprint-3/reviews/Design-Verification-Report-Sprint-3-v1.md +122 -0
  165. package/docs/sprints/sprint-3/reviews/Security-Review-Report-Sprint-3-v1.md +67 -0
  166. package/docs/sprints/sprint-5/designs/Backend-Design-Spec-Sprint-5-v1.md +1734 -0
  167. package/docs/sprints/sprint-5/designs/Design-Verification-Report.md +101 -0
  168. package/docs/sprints/sprint-5/designs/Security-Review-Report.md +84 -0
  169. package/docs/sprints/sprint-6/.brain-state.json +29 -0
  170. package/package.json +92 -16
  171. package/.agent/ide-integration/aider-commands.md +0 -40
  172. package/.agent/ide-integration/cline-config.json +0 -108
  173. package/.agent/ide-integration/cursor-rules.md +0 -63
  174. package/.agent/ide-integration/github-copilot-instructions.md +0 -75
  175. package/.agent/ide-integration/vscode-commands.json +0 -190
  176. package/.agent/ide-integration/windsurf-cascade.md +0 -125
  177. package/.agent/knowledge-base/index.md +0 -202
  178. package/.agent/legacy/roles/designer.md +0 -311
  179. package/.agent/legacy/roles/dev.md +0 -177
  180. package/.agent/legacy/roles/devops.md +0 -146
  181. package/.agent/legacy/roles/orchestrator.md +0 -339
  182. package/.agent/legacy/roles/pm.md +0 -120
  183. package/.agent/legacy/roles/po.md +0 -89
  184. package/.agent/legacy/roles/qa.md +0 -108
  185. package/.agent/legacy/roles/reporter.md +0 -70
  186. package/.agent/legacy/roles/sa.md +0 -118
  187. package/.agent/legacy/roles/seca.md +0 -112
  188. package/.agent/legacy/roles/stakeholder.md +0 -111
  189. package/.agent/legacy/roles/tester.md +0 -129
  190. package/.agent/rules/global.md.bak +0 -154
  191. package/.agent/usage.md +0 -653
  192. package/.agent/workflows/auto.md +0 -35
  193. package/.agent/workflows/dev.md +0 -30
  194. package/.agent/workflows/devops.md +0 -28
  195. package/.agent/workflows/kb-search.md +0 -22
  196. package/.agent/workflows/pm.md +0 -42
  197. package/.agent/workflows/po.md +0 -21
  198. package/.agent/workflows/qa.md +0 -31
  199. package/.agent/workflows/reporter.md +0 -21
  200. package/.agent/workflows/sa.md +0 -51
  201. package/.agent/workflows/seca.md +0 -21
  202. package/.agent/workflows/stakeholder.md +0 -26
  203. package/.agent/workflows/tester.md +0 -21
  204. package/.agent/workflows/uiux.md +0 -38
  205. package/.cursorrules +0 -49
  206. package/.env.template +0 -10
  207. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -47
  208. package/.github/ISSUE_TEMPLATE/config.yml +0 -8
  209. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -33
  210. package/.github/ISSUE_TEMPLATE/security_alert.yml +0 -28
  211. package/.github/ISSUE_TEMPLATE/task_implementation.yml +0 -37
  212. package/.github/copilot-instructions.md +0 -60
  213. package/bin/commands/create.js +0 -96
  214. package/bin/commands/help.js +0 -69
  215. package/bin/commands/ide.js +0 -116
  216. package/bin/commands/init-kb.js +0 -74
  217. package/bin/commands/install.js +0 -68
  218. package/bin/commands/list.js +0 -35
  219. package/bin/graph_brain.py +0 -86
  220. package/bin/sync_github.py +0 -75
  221. package/bin/utils/args-parser.js +0 -33
  222. package/bin/utils/colors.js +0 -21
  223. package/bin/verify_neo4j.py +0 -25
  224. /package/.agent/rules/{knowledge-base.md → KNOWLEDGE-BASE.md} +0 -0
  225. /package/docs/architecture/{neo4j-learning-queries.md → NEO4J-LEARNING-QUERIES.md} +0 -0
  226. /package/docs/reports/{comparison-leann-neo4j.md → COMPARISON-LEANN-NEO4J.md} +0 -0
  227. /package/docs/sprints/{sprint-neo4j-brain.md → SPRINT-NEO4J-BRAIN.md} +0 -0
@@ -0,0 +1,203 @@
1
+ """
2
+ KB Add Module
3
+ Cross-platform entry creation
4
+ """
5
+
6
+ import os
7
+ import subprocess
8
+ from pathlib import Path
9
+ from datetime import datetime
10
+ from kb_common import (
11
+ KBConfig, Colors, print_header, print_success, print_error, print_info
12
+ )
13
+
14
+
15
+ def add_entry():
16
+ """Add new KB entry interactively"""
17
+ config = KBConfig()
18
+ Colors.enable_windows()
19
+
20
+ print_header("📝 Knowledge Base - Add New Entry", "Interactive Entry Creation")
21
+
22
+ # Get entry details
23
+ print(f"{Colors.CYAN}Enter entry details:{Colors.RESET}")
24
+ print()
25
+
26
+ title = input(f"{Colors.WHITE}Title: {Colors.RESET}").strip()
27
+ if not title:
28
+ print_error("Title is required!")
29
+ return
30
+
31
+ print()
32
+ print(f"{Colors.YELLOW}Categories:{Colors.RESET}")
33
+ print(" 1. bug - Bug fixes")
34
+ print(" 2. feature - Complex features")
35
+ print(" 3. architecture - Architecture decisions")
36
+ print(" 4. security - Security fixes")
37
+ print(" 5. performance - Performance optimizations")
38
+ print(" 6. platform - Platform-specific issues")
39
+ print()
40
+
41
+ category_map = {
42
+ '1': 'bug',
43
+ '2': 'feature',
44
+ '3': 'architecture',
45
+ '4': 'security',
46
+ '5': 'performance',
47
+ '6': 'platform'
48
+ }
49
+
50
+ category_choice = input(f"{Colors.WHITE}Category (1-6): {Colors.RESET}").strip()
51
+ category = category_map.get(category_choice, 'feature')
52
+
53
+ print()
54
+ print(f"{Colors.YELLOW}Priorities:{Colors.RESET}")
55
+ print(" 1. critical - System breaking")
56
+ print(" 2. high - Major issues")
57
+ print(" 3. medium - Moderate issues")
58
+ print(" 4. low - Minor issues")
59
+ print()
60
+
61
+ priority_map = {
62
+ '1': 'critical',
63
+ '2': 'high',
64
+ '3': 'medium',
65
+ '4': 'low'
66
+ }
67
+
68
+ priority_choice = input(f"{Colors.WHITE}Priority (1-4): {Colors.RESET}").strip()
69
+ priority = priority_map.get(priority_choice, 'medium')
70
+
71
+ print()
72
+ tags = input(f"{Colors.WHITE}Tags (comma-separated): {Colors.RESET}").strip()
73
+ attempts = input(f"{Colors.WHITE}Attempts to solve (default: 1): {Colors.RESET}").strip() or "1"
74
+ time_saved = input(f"{Colors.WHITE}Time saved (e.g., '2 hours'): {Colors.RESET}").strip() or "1 hour"
75
+
76
+ # Generate filename
77
+ date_str = datetime.now().strftime('%Y-%m-%d')
78
+ title_slug = title.lower().replace(' ', '-')[:50]
79
+ title_slug = ''.join(c for c in title_slug if c.isalnum() or c == '-')
80
+
81
+ # Find next ID for today
82
+ kb_path = config.get_kb_path()
83
+ existing = list(kb_path.rglob(f"KB-{date_str}-*.md"))
84
+ next_id = len(existing) + 1
85
+
86
+ filename = f"KB-{date_str}-{next_id:03d}-{title_slug}.md"
87
+
88
+ # Determine folder based on category and priority
89
+ if category == 'bug':
90
+ folder = kb_path / 'bugs' / priority
91
+ elif category == 'feature':
92
+ folder = kb_path / 'features'
93
+ else:
94
+ folder = kb_path / category
95
+
96
+ folder.mkdir(parents=True, exist_ok=True)
97
+ file_path = folder / filename
98
+
99
+ # Create entry content
100
+ tags_list = [t.strip() for t in tags.split(',') if t.strip()]
101
+
102
+ content = f"""---
103
+ title: "{title}"
104
+ category: {category}
105
+ priority: {priority}
106
+ sprint: sprint-current
107
+ date: {date_str}
108
+ tags: [{', '.join(tags_list)}]
109
+ related_files: []
110
+ attempts: {attempts}
111
+ time_saved: "{time_saved}"
112
+ ---
113
+
114
+ # {title}
115
+
116
+ **Date:** {date_str}
117
+ **Category:** {category}
118
+ **Priority:** {priority}
119
+ **Prepared By:** @DEV
120
+
121
+ ---
122
+
123
+ ## Problem
124
+
125
+ [Describe the problem clearly]
126
+
127
+ ## What Didn't Work
128
+
129
+ [Document failed attempts - this is valuable learning!]
130
+
131
+ 1. **Attempt 1:**
132
+ - What was tried
133
+ - Why it failed
134
+
135
+ ## Root Cause
136
+
137
+ [What actually caused the problem]
138
+
139
+ ## Solution
140
+
141
+ [Step-by-step solution that worked]
142
+
143
+ ### Implementation
144
+
145
+ ```
146
+ [Code or configuration that solved it]
147
+ ```
148
+
149
+ ## Prevention
150
+
151
+ [How to avoid this in the future]
152
+
153
+ ## Related Patterns
154
+
155
+ [Links to similar issues or patterns]
156
+
157
+ ---
158
+
159
+ ## Skills Required
160
+
161
+ - **Skill 1** - Description
162
+ - **Skill 2** - Description
163
+
164
+ ## Technologies Used
165
+
166
+ - Technology 1
167
+ - Technology 2
168
+
169
+ ---
170
+
171
+ #{'#'.join(tags_list)}
172
+ """
173
+
174
+ # Write file
175
+ file_path.write_text(content, encoding='utf-8')
176
+
177
+ print()
178
+ print_success("Entry Created Successfully!")
179
+ print()
180
+ print(f"{Colors.CYAN}📄 File: {file_path.relative_to(config.root_dir)}{Colors.RESET}")
181
+ print()
182
+ print(f"{Colors.YELLOW}Next steps:{Colors.RESET}")
183
+ print(f" 1. Edit the file to add details")
184
+ print(f" 2. Run: {Colors.MAGENTA}kb index{Colors.RESET} to update INDEX.md")
185
+ print(f" 3. Or use: {Colors.MAGENTA}kb compound add{Colors.RESET} for auto-sync to Neo4j")
186
+ print()
187
+
188
+ # Try to open in editor
189
+ try:
190
+ if config.is_windows():
191
+ os.startfile(str(file_path))
192
+ elif config.is_macos():
193
+ subprocess.run(['open', str(file_path)])
194
+ else: # Linux
195
+ # Try common editors
196
+ for editor in ['xdg-open', 'gedit', 'nano', 'vim']:
197
+ try:
198
+ subprocess.run([editor, str(file_path)])
199
+ break
200
+ except:
201
+ continue
202
+ except:
203
+ print_info(f"Please edit the file manually: {file_path}")
@@ -0,0 +1,224 @@
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}")
@@ -0,0 +1,250 @@
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)