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.
Files changed (149) hide show
  1. package/.agent/rules/agent-execution.md +55 -0
  2. package/.agent/rules/ai-enforcement.md +4 -3
  3. package/.agent/rules/artifacts.md +79 -77
  4. package/.agent/rules/auto-learning.md +78 -0
  5. package/.agent/rules/code-quality.md +40 -0
  6. package/.agent/rules/git-workflow.md +44 -24
  7. package/.agent/rules/global.md +10 -6
  8. package/.agent/rules/naming-conventions.md +55 -0
  9. package/.agent/skills/role-ba.md +6 -2
  10. package/.agent/skills/role-brain.md +5 -1
  11. package/.agent/skills/role-cloud.md +38 -0
  12. package/.agent/skills/role-dev.md +31 -5
  13. package/.agent/skills/role-devops.md +9 -0
  14. package/.agent/skills/role-game.md +35 -0
  15. package/.agent/skills/role-mobile.md +55 -0
  16. package/.agent/skills/role-orchestrator.md +4 -0
  17. package/.agent/skills/role-pm.md +4 -0
  18. package/.agent/skills/role-po.md +4 -0
  19. package/.agent/skills/role-reporter.md +4 -0
  20. package/.agent/skills/role-research.md +78 -0
  21. package/.agent/skills/role-sa.md +4 -0
  22. package/.agent/skills/role-seca.md +4 -0
  23. package/.agent/skills/role-stakeholder.md +4 -0
  24. package/.agent/skills/role-tester.md +15 -3
  25. package/.agent/skills/role-uiux.md +4 -0
  26. package/.agent/templates/CHANGELOG-Template.md +2 -2
  27. package/.agent/templates/Design-Verification-Report-Template.md +4 -4
  28. package/.agent/templates/DevOps-Plan-Template.md +7 -0
  29. package/.agent/templates/Specification-Template.md +38 -0
  30. package/.agent/templates/ab-comparison-report.md +175 -0
  31. package/.agent/templates/observer-report.md +131 -0
  32. package/.agent/templates/quality-score-report.md +197 -0
  33. package/.agent/templates/self-learning-digest.md +268 -0
  34. package/.agent/templates/system-health-report.md +330 -0
  35. package/.agent/workflows/ab.md +101 -0
  36. package/.agent/workflows/autogen.md +65 -0
  37. package/.agent/workflows/brain.md +52 -42
  38. package/.agent/workflows/commit.md +61 -0
  39. package/.agent/workflows/cycle.md +36 -15
  40. package/.agent/workflows/debug.md +123 -0
  41. package/.agent/workflows/deep-search.md +82 -0
  42. package/.agent/workflows/docs.md +144 -0
  43. package/.agent/workflows/emergency.md +17 -15
  44. package/.agent/workflows/explore.md +15 -9
  45. package/.agent/workflows/housekeeping.md +24 -11
  46. package/.agent/workflows/metrics.md +14 -12
  47. package/.agent/workflows/monitor.md +98 -0
  48. package/.agent/workflows/observe.md +84 -0
  49. package/.agent/workflows/onboarding.md +135 -0
  50. package/.agent/workflows/orchestrator.md +21 -14
  51. package/.agent/workflows/planning.md +126 -0
  52. package/.agent/workflows/refactor.md +132 -0
  53. package/.agent/workflows/release.md +19 -12
  54. package/.agent/workflows/review.md +99 -0
  55. package/.agent/workflows/score.md +104 -0
  56. package/.agent/workflows/sprint.md +16 -14
  57. package/.agent/workflows/validate.md +13 -11
  58. package/.agent/workflows/worktree.md +154 -0
  59. package/CHANGELOG.md +88 -0
  60. package/README.md +12 -4
  61. package/bin/cli.js +143 -13
  62. package/docs/.brain-health-history.json +42 -0
  63. package/docs/.brain-improvements.json +53 -0
  64. package/docs/.brain-learner-log.json +27 -0
  65. package/docs/.brain-scores.json +310 -0
  66. package/docs/architecture/system-flow.mermaid +81 -0
  67. package/docs/artifacts/2026-01-05-enforcement-gates-plan.md +80 -0
  68. package/docs/artifacts/2026-01-05-workflow-analysis.md +231 -0
  69. package/docs/artifacts/README.md +26 -0
  70. package/docs/guides/MCP-GUIDE.md +1 -0
  71. package/docs/reports/2026-01-05-autogen-evaluation.md +64 -0
  72. package/docs/reports/2026-01-05-brain-layer-analysis.md +109 -0
  73. package/docs/reports/2026-01-05-repository-audit.md +253 -0
  74. package/docs/reports/Metrics-Dashboard-2026-01-08.md +29 -0
  75. package/docs/reports/Metrics-Dashboard-Final.md +29 -0
  76. package/docs/reports/Validation-Report-2026-01-05.md +40 -0
  77. package/docs/reports/Validation-Report-2026-01-08.md +40 -0
  78. package/docs/reports/worktrunk-audit.md +94 -0
  79. package/docs/solutions/README.md +96 -0
  80. package/docs/walkthroughs/2026-01-05-audit-implementation.md +36 -0
  81. package/docs/walkthroughs/2026-01-05-autonomy-release.md +54 -0
  82. package/docs/walkthroughs/2026-01-05-enforcement-gates.md +33 -0
  83. package/docs/walkthroughs/2026-01-05-judge-enhancement.md +30 -0
  84. package/docs/walkthroughs/2026-01-05-landing-page-orchestrator.md +52 -0
  85. package/docs/walkthroughs/2026-01-05-validation.md +32 -0
  86. package/docs/walkthroughs/2026-01-05-workflow-audit.md +89 -0
  87. package/docs/walkthroughs/2026-01-05-workflow-refactoring.md +44 -0
  88. package/docs/walkthroughs/2026-01-06-worktrunk-integration.md +41 -0
  89. package/docs/walkthroughs/README.md +25 -0
  90. package/package.json +33 -19
  91. package/.agent/knowledge-base/AUTO-LEARNING-GUIDE.md +0 -327
  92. package/.agent/knowledge-base/HOW-IT-WORKS.md +0 -365
  93. package/.agent/knowledge-base/INDEX.md +0 -43
  94. package/.agent/knowledge-base/README.md +0 -242
  95. package/.agent/knowledge-base/architecture/.gitkeep +0 -1
  96. package/.agent/knowledge-base/architecture/KB-2026-01-01-003-neo4j-graph-database-skills.md +0 -1146
  97. package/.agent/knowledge-base/architecture/README.md +0 -98
  98. package/.agent/knowledge-base/bugs/.gitkeep +0 -1
  99. package/.agent/knowledge-base/bugs/KB-2026-01-02-yaml-special-character-escaping.md +0 -56
  100. package/.agent/knowledge-base/bugs/medium/KB-2026-01-01-001-example-auto-learned.md +0 -198
  101. package/.agent/knowledge-base/features/.gitkeep +0 -1
  102. package/.agent/knowledge-base/features/KB-2026-01-01-001-landing-page-design-trends-2026.md +0 -646
  103. package/.agent/knowledge-base/features/KB-2026-01-01-004-uiux-design-skills-2026.md +0 -945
  104. package/.agent/knowledge-base/features/KB-2026-01-01-005-modern-ai-landing-page-ui.md +0 -310
  105. package/.agent/knowledge-base/features/KB-2026-01-01-006-award-winning-landing-page-patterns.md +0 -324
  106. package/.agent/knowledge-base/features/KB-2026-01-02-001-cleanup-workflow.md +0 -242
  107. package/.agent/knowledge-base/features/KB-2026-01-02-002-landing-page-monorepo-architecture.md +0 -148
  108. package/.agent/knowledge-base/features/KB-2026-01-02-003-premium-glassmorphism-patterns.md +0 -58
  109. package/.agent/knowledge-base/features/KB-2026-01-04-ai-agent-enforcement.md +0 -46
  110. package/.agent/knowledge-base/features/README.md +0 -83
  111. package/.agent/knowledge-base/features/figma-landing-page-workflow.md +0 -311
  112. package/.agent/knowledge-base/features/figma-mcp-sa-guide.md +0 -673
  113. package/.agent/knowledge-base/features/figma-mcp-uiux-guide.md +0 -459
  114. package/.agent/knowledge-base/performance/.gitkeep +0 -1
  115. package/.agent/knowledge-base/performance/KB-2026-01-02-lazy-loading-optimization.md +0 -80
  116. package/.agent/knowledge-base/platform-specific/.gitkeep +0 -1
  117. package/.agent/knowledge-base/platform-specific/KB-2026-01-02-windows-console-encoding.md +0 -56
  118. package/.agent/knowledge-base/role-guides/DEV-KB-Guide.md +0 -527
  119. package/.agent/knowledge-base/role-guides/DEVOPS-KB-Guide.md +0 -491
  120. package/.agent/knowledge-base/role-guides/PM-KB-Guide.md +0 -299
  121. package/.agent/knowledge-base/role-guides/SECA-KB-Guide.md +0 -555
  122. package/.agent/knowledge-base/role-guides/TESTER-KB-Guide.md +0 -519
  123. package/.agent/knowledge-base/security/.gitkeep +0 -1
  124. package/.agent/knowledge-base/security/KB-2026-01-02-input-validation-sanitization.md +0 -74
  125. package/.agent/rules/AUTO-LEARNING.md +0 -418
  126. package/.agent/rules/KNOWLEDGE-BASE.md +0 -45
  127. package/.agent/skills/role-qa.md +0 -81
  128. package/.agent/workflows/compound.md +0 -51
  129. package/.agent/workflows/preflight.md +0 -35
  130. package/.agent/workflows/route.md +0 -160
  131. package/bin/kb +0 -34
  132. package/bin/kb.bat +0 -28
  133. package/bin/kb_cli.py +0 -226
  134. package/bin/lib/README.md +0 -411
  135. package/bin/lib/__init__.py +0 -7
  136. package/bin/lib/__pycache__/kb_add.cpython-313.pyc +0 -0
  137. package/bin/lib/__pycache__/kb_common.cpython-313.pyc +0 -0
  138. package/bin/lib/__pycache__/kb_compound.cpython-313.pyc +0 -0
  139. package/bin/lib/__pycache__/kb_index.cpython-313.pyc +0 -0
  140. package/bin/lib/__pycache__/kb_list.cpython-313.pyc +0 -0
  141. package/bin/lib/__pycache__/kb_search.cpython-313.pyc +0 -0
  142. package/bin/lib/__pycache__/kb_stats.cpython-313.pyc +0 -0
  143. package/bin/lib/kb_add.py +0 -203
  144. package/bin/lib/kb_common.py +0 -224
  145. package/bin/lib/kb_compound.py +0 -250
  146. package/bin/lib/kb_index.py +0 -193
  147. package/bin/lib/kb_list.py +0 -144
  148. package/bin/lib/kb_search.py +0 -121
  149. package/bin/lib/kb_stats.py +0 -153
package/bin/lib/README.md DELETED
@@ -1,411 +0,0 @@
1
- # Knowledge Base CLI Library
2
-
3
- This directory contains the Python library modules for the **Knowledge Base CLI**.
4
-
5
- ## Overview
6
-
7
- The KB CLI is a cross-platform command-line tool for managing the TeamLifecycle knowledge base with optional Neo4j brain integration.
8
-
9
- ## Architecture
10
-
11
- ```
12
- kb_cli.py # Main CLI entry point
13
-
14
- ├── kb_common.py # Common utilities
15
- ├── kb_search.py # Search functionality
16
- ├── kb_add.py # Add entries
17
- ├── kb_index.py # Index generation
18
- ├── kb_stats.py # Statistics
19
- ├── kb_list.py # List entries
20
- └── kb_compound.py # Neo4j integration
21
- ```
22
-
23
- ## Modules
24
-
25
- ### `kb_common.py`
26
- **Purpose:** Common utilities and shared functions
27
-
28
- **Exports:**
29
- - `get_kb_path()` - Get knowledge base directory path
30
- - `parse_yaml_frontmatter()` - Parse YAML frontmatter from markdown
31
- - `format_date()` - Format dates consistently
32
- - `get_editor()` - Get platform-specific default editor
33
- - `Colors` - ANSI color codes class
34
-
35
- **Usage:**
36
- ```python
37
- from kb_common import get_kb_path, Colors
38
-
39
- kb_path = get_kb_path()
40
- print(f"{Colors.GREEN}Success!{Colors.RESET}")
41
- ```
42
-
43
- ### `kb_search.py`
44
- **Purpose:** Search knowledge base entries
45
-
46
- **Exports:**
47
- - `search_kb(term: str)` - Search for entries matching term
48
-
49
- **Features:**
50
- - Searches INDEX.md first
51
- - Falls back to full file search
52
- - Shows context around matches
53
- - Displays metadata
54
-
55
- **Usage:**
56
- ```python
57
- from kb_search import search_kb
58
-
59
- search_kb("react hydration")
60
- ```
61
-
62
- ### `kb_add.py`
63
- **Purpose:** Add new knowledge base entries
64
-
65
- **Exports:**
66
- - `add_entry()` - Interactive entry creation wizard
67
-
68
- **Features:**
69
- - Interactive prompts
70
- - YAML frontmatter generation
71
- - Unique filename generation
72
- - Auto-open in editor
73
- - Category/priority selection
74
-
75
- **Usage:**
76
- ```python
77
- from kb_add import add_entry
78
-
79
- add_entry() # Interactive wizard
80
- ```
81
-
82
- ### `kb_index.py`
83
- **Purpose:** Generate and update INDEX.md
84
-
85
- **Exports:**
86
- - `update_index()` - Scan entries and regenerate INDEX.md
87
-
88
- **Features:**
89
- - Scans all KB entries
90
- - Extracts metadata
91
- - Groups by category, priority, date
92
- - Generates searchable index
93
- - Shows statistics
94
-
95
- **Usage:**
96
- ```python
97
- from kb_index import update_index
98
-
99
- update_index()
100
- ```
101
-
102
- ### `kb_stats.py`
103
- **Purpose:** Display knowledge base statistics
104
-
105
- **Exports:**
106
- - `show_stats()` - Calculate and display KB metrics
107
-
108
- **Features:**
109
- - Total entries count
110
- - Breakdown by category
111
- - Breakdown by priority
112
- - Total attempts
113
- - Time saved calculations
114
- - Growth trends
115
-
116
- **Usage:**
117
- ```python
118
- from kb_stats import show_stats
119
-
120
- show_stats()
121
- ```
122
-
123
- ### `kb_list.py`
124
- **Purpose:** List knowledge base entries
125
-
126
- **Exports:**
127
- - `list_entries(category: str = None, recent: int = None)` - List entries
128
-
129
- **Features:**
130
- - List all entries
131
- - Filter by category
132
- - Show recent entries
133
- - Display metadata
134
-
135
- **Usage:**
136
- ```python
137
- from kb_list import list_entries
138
-
139
- list_entries() # All entries
140
- list_entries("bugs") # Bugs only
141
- list_entries(recent=10) # Last 10 entries
142
- ```
143
-
144
- ### `kb_compound.py`
145
- **Purpose:** Neo4j brain integration
146
-
147
- **Exports:**
148
- - `compound_operation(action: str, term: str = None)` - Execute compound operations
149
-
150
- **Actions:**
151
- - `search` - Search file system + Neo4j
152
- - `add` - Add entry + sync to Neo4j
153
- - `sync` - Full sync to Neo4j
154
- - `query` - Intelligent Neo4j queries
155
- - `stats` - Compound system health
156
-
157
- **Features:**
158
- - Neo4j connection management
159
- - Graceful fallback if Neo4j unavailable
160
- - Cross-platform subprocess handling
161
- - Relationship mapping
162
-
163
- **Usage:**
164
- ```python
165
- from kb_compound import compound_operation
166
-
167
- compound_operation("search", "authentication")
168
- compound_operation("sync")
169
- compound_operation("stats")
170
- ```
171
-
172
- ## Dependencies
173
-
174
- ### Required
175
- - Python 3.7+
176
- - Standard library modules:
177
- - `os`, `sys`, `pathlib`
178
- - `json`, `yaml`
179
- - `datetime`, `re`
180
- - `subprocess`
181
-
182
- ### Optional
183
- - `neo4j` - For Neo4j brain integration
184
- - `python-dotenv` - For environment variables
185
-
186
- Install optional dependencies:
187
- ```bash
188
- pip install neo4j python-dotenv
189
- ```
190
-
191
- ## Configuration
192
-
193
- ### Environment Variables
194
- Create `.env` file in project root:
195
- ```bash
196
- # Neo4j Configuration (optional)
197
- NEO4J_URI=neo4j+s://your-instance.databases.neo4j.io
198
- NEO4J_USERNAME=neo4j
199
- NEO4J_PASSWORD=your_password
200
- NEO4J_DATABASE=neo4j
201
- ```
202
-
203
- ### Knowledge Base Path
204
- Default: `.agent/knowledge-base/`
205
-
206
- Override with environment variable:
207
- ```bash
208
- KB_PATH=/custom/path/to/kb
209
- ```
210
-
211
- ## Entry Format
212
-
213
- All KB entries use YAML frontmatter:
214
-
215
- ```yaml
216
- ---
217
- title: "Entry Title"
218
- category: bug|feature|architecture|security|performance|platform
219
- priority: critical|high|medium|low
220
- sprint: sprint-N
221
- date: YYYY-MM-DD
222
- tags: [tag1, tag2, tag3]
223
- related_files: [path/to/file1, path/to/file2]
224
- attempts: 3
225
- time_saved: "2 hours"
226
- ---
227
-
228
- ## Problem
229
- Description of the issue
230
-
231
- ## Solution
232
- How it was solved
233
-
234
- ## Prevention
235
- How to avoid in future
236
- ```
237
-
238
- ## File Naming Convention
239
-
240
- Format: `KB-YYYY-MM-DD-###-title-slug.md`
241
-
242
- Example: `KB-2026-01-02-001-react-hydration-error.md`
243
-
244
- Components:
245
- - `YYYY-MM-DD` - Creation date
246
- - `###` - Sequential ID for that day (001, 002, etc.)
247
- - `title-slug` - URL-friendly title
248
-
249
- ## Directory Structure
250
-
251
- ```
252
- .agent/knowledge-base/
253
- ├── INDEX.md # Generated index
254
- ├── bugs/
255
- │ ├── critical/
256
- │ ├── high/
257
- │ ├── medium/
258
- │ └── low/
259
- ├── features/
260
- │ ├── authentication/
261
- │ ├── performance/
262
- │ ├── integration/
263
- │ └── ui-ux/
264
- ├── architecture/
265
- ├── security/
266
- ├── performance/
267
- └── platform-specific/
268
- ├── web/
269
- ├── mobile/
270
- ├── desktop/
271
- └── cli/
272
- ```
273
-
274
- ## Error Handling
275
-
276
- All modules use consistent error handling:
277
-
278
- ```python
279
- try:
280
- # Operation
281
- pass
282
- except FileNotFoundError:
283
- print(f"{Colors.RED}❌ File not found{Colors.RESET}")
284
- except PermissionError:
285
- print(f"{Colors.RED}❌ Permission denied{Colors.RESET}")
286
- except Exception as e:
287
- print(f"{Colors.RED}❌ Error: {e}{Colors.RESET}")
288
- import traceback
289
- traceback.print_exc()
290
- ```
291
-
292
- ## Color Support
293
-
294
- Cross-platform ANSI color support:
295
-
296
- ```python
297
- from kb_common import Colors
298
-
299
- print(f"{Colors.GREEN}✅ Success{Colors.RESET}")
300
- print(f"{Colors.RED}❌ Error{Colors.RESET}")
301
- print(f"{Colors.YELLOW}⚠️ Warning{Colors.RESET}")
302
- print(f"{Colors.CYAN}ℹ️ Info{Colors.RESET}")
303
- ```
304
-
305
- Colors automatically enabled on Windows 10+.
306
-
307
- ## Testing
308
-
309
- ### Unit Tests
310
- ```bash
311
- # Test individual modules
312
- python -c "from kb_search import search_kb; search_kb('test')"
313
- python -c "from kb_stats import show_stats; show_stats()"
314
- ```
315
-
316
- ### Integration Tests
317
- ```bash
318
- # Test full workflow
319
- ./bin/kb search test
320
- ./bin/kb add
321
- ./bin/kb index
322
- ./bin/kb stats
323
- ```
324
-
325
- ## Adding New Modules
326
-
327
- 1. Create new file: `kb_newfeature.py`
328
- 2. Follow module structure:
329
- ```python
330
- #!/usr/bin/env python3
331
- """
332
- Module description
333
- """
334
- from kb_common import Colors, get_kb_path
335
-
336
- def new_feature():
337
- """Feature implementation"""
338
- pass
339
- ```
340
- 3. Import in `kb_cli.py`
341
- 4. Add command handler
342
- 5. Update this README
343
-
344
- ## Platform Support
345
-
346
- ### Windows
347
- - ✅ Command Prompt
348
- - ✅ PowerShell
349
- - ✅ Git Bash
350
- - ✅ ANSI colors (Windows 10+)
351
-
352
- ### Linux
353
- - ✅ Bash
354
- - ✅ Zsh
355
- - ✅ Fish
356
- - ✅ Full ANSI colors
357
-
358
- ### macOS
359
- - ✅ Bash
360
- - ✅ Zsh
361
- - ✅ Full ANSI colors
362
-
363
- ## Performance
364
-
365
- - **Startup:** ~100-200ms
366
- - **Search:** ~50-100ms for 100 entries
367
- - **Index:** ~200-500ms for 100 entries
368
- - **Neo4j:** +100-300ms for queries
369
-
370
- ## Troubleshooting
371
-
372
- ### Import Errors
373
- ```bash
374
- # Ensure lib directory is in Python path
375
- export PYTHONPATH="${PYTHONPATH}:/path/to/bin/lib"
376
- ```
377
-
378
- ### Permission Errors
379
- ```bash
380
- # Make scripts executable (Linux/macOS)
381
- chmod +x bin/kb
382
- chmod +x bin/kb_cli.py
383
- ```
384
-
385
- ### Neo4j Connection Issues
386
- ```bash
387
- # Test connection
388
- python -c "from neo4j import GraphDatabase; print('Neo4j available')"
389
-
390
- # Check .env file
391
- cat .env | grep NEO4J
392
- ```
393
-
394
- ## Related Files
395
-
396
- - `../kb` - Bash entry point
397
- - `../kb.bat` - Windows entry point
398
- - `../kb_cli.py` - Main CLI
399
- - `../../tools/neo4j/` - Neo4j integration scripts
400
- - `../../.agent/knowledge-base/` - KB entries
401
-
402
- ## Documentation
403
-
404
- - **Main README:** `../README.md`
405
- - **Cross-Platform Guide:** `../CROSS-PLATFORM-CLI.md`
406
- - **KB Guide:** `../../docs/KNOWLEDGE-BASE-GUIDE.md`
407
- - **Neo4j Integration:** `../../docs/NEO4J-COMPOUND-INTEGRATION.md`
408
-
409
- ---
410
-
411
- **Note:** This is the **Python KB CLI library**. For the Node.js project CLI, see `../commands/README.md`.
@@ -1,7 +0,0 @@
1
- """
2
- Knowledge Base Library
3
- Cross-platform Python modules for KB operations
4
- """
5
-
6
- __version__ = '1.0.0'
7
- __author__ = 'TeamLifecycle'
package/bin/lib/kb_add.py DELETED
@@ -1,203 +0,0 @@
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}")