@techwavedev/agi-agent-kit 1.1.3

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 (196) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +147 -0
  3. package/bin/init.js +471 -0
  4. package/package.json +36 -0
  5. package/templates/.agent/agents/backend-specialist.md +263 -0
  6. package/templates/.agent/agents/code-archaeologist.md +106 -0
  7. package/templates/.agent/agents/database-architect.md +226 -0
  8. package/templates/.agent/agents/debugger.md +225 -0
  9. package/templates/.agent/agents/devops-engineer.md +242 -0
  10. package/templates/.agent/agents/documentation-writer.md +104 -0
  11. package/templates/.agent/agents/explorer-agent.md +73 -0
  12. package/templates/.agent/agents/frontend-specialist.md +556 -0
  13. package/templates/.agent/agents/game-developer.md +162 -0
  14. package/templates/.agent/agents/mobile-developer.md +377 -0
  15. package/templates/.agent/agents/orchestrator.md +416 -0
  16. package/templates/.agent/agents/penetration-tester.md +188 -0
  17. package/templates/.agent/agents/performance-optimizer.md +187 -0
  18. package/templates/.agent/agents/product-manager.md +112 -0
  19. package/templates/.agent/agents/project-planner.md +403 -0
  20. package/templates/.agent/agents/qa-automation-engineer.md +109 -0
  21. package/templates/.agent/agents/security-auditor.md +170 -0
  22. package/templates/.agent/agents/seo-specialist.md +111 -0
  23. package/templates/.agent/agents/test-engineer.md +158 -0
  24. package/templates/.agent/rules/GEMINI.md +253 -0
  25. package/templates/.agent/workflows/brainstorm.md +113 -0
  26. package/templates/.agent/workflows/create.md +59 -0
  27. package/templates/.agent/workflows/debug.md +103 -0
  28. package/templates/.agent/workflows/deploy.md +176 -0
  29. package/templates/.agent/workflows/enhance.md +63 -0
  30. package/templates/.agent/workflows/orchestrate.md +237 -0
  31. package/templates/.agent/workflows/plan.md +89 -0
  32. package/templates/.agent/workflows/preview.md +81 -0
  33. package/templates/.agent/workflows/status.md +86 -0
  34. package/templates/.agent/workflows/test.md +144 -0
  35. package/templates/.agent/workflows/ui-ux-pro-max.md +296 -0
  36. package/templates/base/.env.example +54 -0
  37. package/templates/base/AGENTS.md +463 -0
  38. package/templates/base/requirements.txt +6 -0
  39. package/templates/base/skill-creator/LICENSE.txt +202 -0
  40. package/templates/base/skill-creator/SKILL_skillcreator.md +389 -0
  41. package/templates/base/skill-creator/references/output-patterns.md +82 -0
  42. package/templates/base/skill-creator/references/workflows.md +28 -0
  43. package/templates/base/skill-creator/scripts/init_skill.py +304 -0
  44. package/templates/base/skill-creator/scripts/package_skill.py +110 -0
  45. package/templates/base/skill-creator/scripts/quick_validate.py +95 -0
  46. package/templates/base/skill-creator/scripts/update_catalog.py +371 -0
  47. package/templates/skills/core/README.md +21 -0
  48. package/templates/skills/core/documentation/SKILL.md +351 -0
  49. package/templates/skills/core/documentation/references/best_practices.md +201 -0
  50. package/templates/skills/core/documentation/scripts/analyze_code.py +307 -0
  51. package/templates/skills/core/documentation/scripts/detect_changes.py +460 -0
  52. package/templates/skills/core/documentation/scripts/generate_changelog.py +312 -0
  53. package/templates/skills/core/documentation/scripts/sync_docs.py +272 -0
  54. package/templates/skills/core/documentation/scripts/update_skill_docs.py +366 -0
  55. package/templates/skills/core/pdf-reader/SKILL.md +104 -0
  56. package/templates/skills/core/pdf-reader/references/pdf_libraries.md +83 -0
  57. package/templates/skills/core/pdf-reader/scripts/extract_text.py +295 -0
  58. package/templates/skills/core/qdrant-memory/SKILL.md +435 -0
  59. package/templates/skills/core/qdrant-memory/references/advanced_patterns.md +375 -0
  60. package/templates/skills/core/qdrant-memory/references/collection_schemas.md +229 -0
  61. package/templates/skills/core/qdrant-memory/references/complete_guide.md +724 -0
  62. package/templates/skills/core/qdrant-memory/references/embedding_models.md +325 -0
  63. package/templates/skills/core/qdrant-memory/scripts/benchmark_token_savings.py +640 -0
  64. package/templates/skills/core/qdrant-memory/scripts/embedding_utils.py +323 -0
  65. package/templates/skills/core/qdrant-memory/scripts/hybrid_search.py +214 -0
  66. package/templates/skills/core/qdrant-memory/scripts/init_collection.py +193 -0
  67. package/templates/skills/core/qdrant-memory/scripts/memory_retrieval.py +345 -0
  68. package/templates/skills/core/qdrant-memory/scripts/semantic_cache.py +282 -0
  69. package/templates/skills/core/qdrant-memory/scripts/test_skill.py +655 -0
  70. package/templates/skills/core/webcrawler/SKILL.md +292 -0
  71. package/templates/skills/core/webcrawler/references/advanced_crawling.md +181 -0
  72. package/templates/skills/core/webcrawler/scripts/crawl_docs.py +532 -0
  73. package/templates/skills/core/webcrawler/scripts/extract_page.py +189 -0
  74. package/templates/skills/core/webcrawler/scripts/filter_docs.py +200 -0
  75. package/templates/skills/knowledge/api-patterns/SKILL.md +81 -0
  76. package/templates/skills/knowledge/api-patterns/api-style.md +42 -0
  77. package/templates/skills/knowledge/api-patterns/auth.md +24 -0
  78. package/templates/skills/knowledge/api-patterns/documentation.md +26 -0
  79. package/templates/skills/knowledge/api-patterns/graphql.md +41 -0
  80. package/templates/skills/knowledge/api-patterns/rate-limiting.md +31 -0
  81. package/templates/skills/knowledge/api-patterns/response.md +37 -0
  82. package/templates/skills/knowledge/api-patterns/rest.md +40 -0
  83. package/templates/skills/knowledge/api-patterns/scripts/api_validator.py +211 -0
  84. package/templates/skills/knowledge/api-patterns/security-testing.md +122 -0
  85. package/templates/skills/knowledge/api-patterns/trpc.md +41 -0
  86. package/templates/skills/knowledge/api-patterns/versioning.md +22 -0
  87. package/templates/skills/knowledge/app-builder/SKILL.md +75 -0
  88. package/templates/skills/knowledge/app-builder/agent-coordination.md +71 -0
  89. package/templates/skills/knowledge/app-builder/feature-building.md +53 -0
  90. package/templates/skills/knowledge/app-builder/project-detection.md +34 -0
  91. package/templates/skills/knowledge/app-builder/scaffolding.md +118 -0
  92. package/templates/skills/knowledge/app-builder/tech-stack.md +40 -0
  93. package/templates/skills/knowledge/app-builder/templates/SKILL.md +39 -0
  94. package/templates/skills/knowledge/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  95. package/templates/skills/knowledge/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  96. package/templates/skills/knowledge/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  97. package/templates/skills/knowledge/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  98. package/templates/skills/knowledge/app-builder/templates/express-api/TEMPLATE.md +83 -0
  99. package/templates/skills/knowledge/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  100. package/templates/skills/knowledge/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  101. package/templates/skills/knowledge/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
  102. package/templates/skills/knowledge/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
  103. package/templates/skills/knowledge/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
  104. package/templates/skills/knowledge/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
  105. package/templates/skills/knowledge/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  106. package/templates/skills/knowledge/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
  107. package/templates/skills/knowledge/architecture/SKILL.md +55 -0
  108. package/templates/skills/knowledge/architecture/context-discovery.md +43 -0
  109. package/templates/skills/knowledge/architecture/examples.md +94 -0
  110. package/templates/skills/knowledge/architecture/pattern-selection.md +68 -0
  111. package/templates/skills/knowledge/architecture/patterns-reference.md +50 -0
  112. package/templates/skills/knowledge/architecture/trade-off-analysis.md +77 -0
  113. package/templates/skills/knowledge/bash-linux/SKILL.md +199 -0
  114. package/templates/skills/knowledge/behavioral-modes/SKILL.md +242 -0
  115. package/templates/skills/knowledge/brainstorming/SKILL.md +163 -0
  116. package/templates/skills/knowledge/brainstorming/dynamic-questioning.md +350 -0
  117. package/templates/skills/knowledge/clean-code/SKILL.md +201 -0
  118. package/templates/skills/knowledge/code-review-checklist/SKILL.md +109 -0
  119. package/templates/skills/knowledge/database-design/SKILL.md +52 -0
  120. package/templates/skills/knowledge/database-design/database-selection.md +43 -0
  121. package/templates/skills/knowledge/database-design/indexing.md +39 -0
  122. package/templates/skills/knowledge/database-design/migrations.md +48 -0
  123. package/templates/skills/knowledge/database-design/optimization.md +36 -0
  124. package/templates/skills/knowledge/database-design/orm-selection.md +30 -0
  125. package/templates/skills/knowledge/database-design/schema-design.md +56 -0
  126. package/templates/skills/knowledge/database-design/scripts/schema_validator.py +172 -0
  127. package/templates/skills/knowledge/deployment-procedures/SKILL.md +241 -0
  128. package/templates/skills/knowledge/doc.md +177 -0
  129. package/templates/skills/knowledge/documentation-templates/SKILL.md +194 -0
  130. package/templates/skills/knowledge/frontend-design/SKILL.md +396 -0
  131. package/templates/skills/knowledge/frontend-design/animation-guide.md +331 -0
  132. package/templates/skills/knowledge/frontend-design/color-system.md +311 -0
  133. package/templates/skills/knowledge/frontend-design/decision-trees.md +418 -0
  134. package/templates/skills/knowledge/frontend-design/motion-graphics.md +306 -0
  135. package/templates/skills/knowledge/frontend-design/scripts/accessibility_checker.py +183 -0
  136. package/templates/skills/knowledge/frontend-design/scripts/ux_audit.py +722 -0
  137. package/templates/skills/knowledge/frontend-design/typography-system.md +345 -0
  138. package/templates/skills/knowledge/frontend-design/ux-psychology.md +541 -0
  139. package/templates/skills/knowledge/frontend-design/visual-effects.md +383 -0
  140. package/templates/skills/knowledge/game-development/2d-games/SKILL.md +119 -0
  141. package/templates/skills/knowledge/game-development/3d-games/SKILL.md +135 -0
  142. package/templates/skills/knowledge/game-development/SKILL.md +167 -0
  143. package/templates/skills/knowledge/game-development/game-art/SKILL.md +185 -0
  144. package/templates/skills/knowledge/game-development/game-audio/SKILL.md +190 -0
  145. package/templates/skills/knowledge/game-development/game-design/SKILL.md +129 -0
  146. package/templates/skills/knowledge/game-development/mobile-games/SKILL.md +108 -0
  147. package/templates/skills/knowledge/game-development/multiplayer/SKILL.md +132 -0
  148. package/templates/skills/knowledge/game-development/pc-games/SKILL.md +144 -0
  149. package/templates/skills/knowledge/game-development/vr-ar/SKILL.md +123 -0
  150. package/templates/skills/knowledge/game-development/web-games/SKILL.md +150 -0
  151. package/templates/skills/knowledge/geo-fundamentals/SKILL.md +156 -0
  152. package/templates/skills/knowledge/geo-fundamentals/scripts/geo_checker.py +289 -0
  153. package/templates/skills/knowledge/i18n-localization/SKILL.md +154 -0
  154. package/templates/skills/knowledge/i18n-localization/scripts/i18n_checker.py +241 -0
  155. package/templates/skills/knowledge/intelligent-routing/SKILL.md +334 -0
  156. package/templates/skills/knowledge/lint-and-validate/SKILL.md +45 -0
  157. package/templates/skills/knowledge/lint-and-validate/scripts/lint_runner.py +172 -0
  158. package/templates/skills/knowledge/lint-and-validate/scripts/type_coverage.py +173 -0
  159. package/templates/skills/knowledge/mcp-builder/SKILL.md +176 -0
  160. package/templates/skills/knowledge/mobile-design/SKILL.md +394 -0
  161. package/templates/skills/knowledge/mobile-design/decision-trees.md +516 -0
  162. package/templates/skills/knowledge/mobile-design/mobile-backend.md +491 -0
  163. package/templates/skills/knowledge/mobile-design/mobile-color-system.md +420 -0
  164. package/templates/skills/knowledge/mobile-design/mobile-debugging.md +122 -0
  165. package/templates/skills/knowledge/mobile-design/mobile-design-thinking.md +357 -0
  166. package/templates/skills/knowledge/mobile-design/mobile-navigation.md +458 -0
  167. package/templates/skills/knowledge/mobile-design/mobile-performance.md +767 -0
  168. package/templates/skills/knowledge/mobile-design/mobile-testing.md +356 -0
  169. package/templates/skills/knowledge/mobile-design/mobile-typography.md +433 -0
  170. package/templates/skills/knowledge/mobile-design/platform-android.md +666 -0
  171. package/templates/skills/knowledge/mobile-design/platform-ios.md +561 -0
  172. package/templates/skills/knowledge/mobile-design/scripts/mobile_audit.py +670 -0
  173. package/templates/skills/knowledge/mobile-design/touch-psychology.md +537 -0
  174. package/templates/skills/knowledge/nextjs-best-practices/SKILL.md +203 -0
  175. package/templates/skills/knowledge/nodejs-best-practices/SKILL.md +333 -0
  176. package/templates/skills/knowledge/parallel-agents/SKILL.md +175 -0
  177. package/templates/skills/knowledge/performance-profiling/SKILL.md +143 -0
  178. package/templates/skills/knowledge/performance-profiling/scripts/lighthouse_audit.py +76 -0
  179. package/templates/skills/knowledge/plan-writing/SKILL.md +152 -0
  180. package/templates/skills/knowledge/powershell-windows/SKILL.md +167 -0
  181. package/templates/skills/knowledge/python-patterns/SKILL.md +441 -0
  182. package/templates/skills/knowledge/react-patterns/SKILL.md +198 -0
  183. package/templates/skills/knowledge/red-team-tactics/SKILL.md +199 -0
  184. package/templates/skills/knowledge/seo-fundamentals/SKILL.md +129 -0
  185. package/templates/skills/knowledge/seo-fundamentals/scripts/seo_checker.py +219 -0
  186. package/templates/skills/knowledge/server-management/SKILL.md +161 -0
  187. package/templates/skills/knowledge/systematic-debugging/SKILL.md +109 -0
  188. package/templates/skills/knowledge/tailwind-patterns/SKILL.md +269 -0
  189. package/templates/skills/knowledge/tdd-workflow/SKILL.md +149 -0
  190. package/templates/skills/knowledge/testing-patterns/SKILL.md +178 -0
  191. package/templates/skills/knowledge/testing-patterns/scripts/test_runner.py +219 -0
  192. package/templates/skills/knowledge/vulnerability-scanner/SKILL.md +276 -0
  193. package/templates/skills/knowledge/vulnerability-scanner/checklists.md +121 -0
  194. package/templates/skills/knowledge/vulnerability-scanner/scripts/security_scan.py +458 -0
  195. package/templates/skills/knowledge/webapp-testing/SKILL.md +187 -0
  196. package/templates/skills/knowledge/webapp-testing/scripts/playwright_runner.py +173 -0
@@ -0,0 +1,460 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Change Detection Engine for Documentation Skill
4
+
5
+ Scans the repository or specific directories to detect code changes
6
+ since the last documentation update. Uses git for accurate change tracking.
7
+
8
+ Usage:
9
+ python detect_changes.py --scope <path> [options]
10
+
11
+ Arguments:
12
+ --scope Directory to scan (required)
13
+ --since Compare since commit/date (default: HEAD~10)
14
+ --output Output report file (default: stdout)
15
+ --format Output format: md, json (default: md)
16
+ --include-git Use git diff for precise changes (default: true)
17
+
18
+ Exit Codes:
19
+ 0 - Success
20
+ 1 - Invalid arguments
21
+ 2 - Directory not found
22
+ 3 - Git error
23
+ """
24
+
25
+ import argparse
26
+ import json
27
+ import os
28
+ import subprocess
29
+ import sys
30
+ from datetime import datetime
31
+ from pathlib import Path
32
+ from typing import Dict, List, Optional, Tuple
33
+
34
+
35
+ # File patterns to track for documentation updates
36
+ TRACKED_PATTERNS = {
37
+ 'skill_definition': ['*/SKILL.md', 'SKILL_*.md'],
38
+ 'skill_scripts': ['skills/*/scripts/*.py'],
39
+ 'skill_references': ['skills/*/references/*.md'],
40
+ 'execution_scripts': ['execution/*.py'],
41
+ 'directives': ['directives/*.md'],
42
+ 'core_docs': ['AGENTS.md', 'README.md', 'SKILLS_CATALOG.md'],
43
+ 'python_modules': ['**/*.py'],
44
+ }
45
+
46
+ # Patterns to ignore
47
+ IGNORE_PATTERNS = [
48
+ '.tmp/',
49
+ '.git/',
50
+ '__pycache__/',
51
+ '*.pyc',
52
+ '.DS_Store',
53
+ 'node_modules/',
54
+ '.env',
55
+ '*.egg-info/',
56
+ ]
57
+
58
+
59
+ def run_git_command(args: List[str], cwd: Path) -> Tuple[bool, str]:
60
+ """Execute a git command and return (success, output)."""
61
+ try:
62
+ result = subprocess.run(
63
+ ['git'] + args,
64
+ cwd=cwd,
65
+ capture_output=True,
66
+ text=True,
67
+ timeout=30
68
+ )
69
+ return result.returncode == 0, result.stdout.strip()
70
+ except subprocess.TimeoutExpired:
71
+ return False, "Git command timed out"
72
+ except Exception as e:
73
+ return False, str(e)
74
+
75
+
76
+ def get_git_root(path: Path) -> Optional[Path]:
77
+ """Find the git repository root."""
78
+ success, output = run_git_command(['rev-parse', '--show-toplevel'], path)
79
+ if success:
80
+ return Path(output)
81
+ return None
82
+
83
+
84
+ def get_changed_files(scope: Path, since: str) -> Dict[str, List[str]]:
85
+ """
86
+ Get files changed since a specific commit or date.
87
+
88
+ Returns:
89
+ Dict with keys: 'added', 'modified', 'deleted'
90
+ """
91
+ git_root = get_git_root(scope)
92
+ if not git_root:
93
+ print("⚠️ Not a git repository, using file scan fallback", file=sys.stderr)
94
+ return get_files_by_scan(scope)
95
+
96
+ changes = {
97
+ 'added': [],
98
+ 'modified': [],
99
+ 'deleted': [],
100
+ }
101
+
102
+ # Get diff with names and status
103
+ success, output = run_git_command(
104
+ ['diff', '--name-status', since, '--', str(scope.relative_to(git_root))],
105
+ git_root
106
+ )
107
+
108
+ if not success:
109
+ # Try with HEAD if since ref doesn't exist
110
+ success, output = run_git_command(
111
+ ['diff', '--name-status', 'HEAD~5', '--', str(scope.relative_to(git_root))],
112
+ git_root
113
+ )
114
+
115
+ if not success:
116
+ print(f"⚠️ Git diff failed, using file scan fallback", file=sys.stderr)
117
+ return get_files_by_scan(scope)
118
+
119
+ # Parse git diff output
120
+ for line in output.split('\n'):
121
+ if not line.strip():
122
+ continue
123
+
124
+ parts = line.split('\t')
125
+ if len(parts) < 2:
126
+ continue
127
+
128
+ status, filepath = parts[0], parts[1]
129
+
130
+ # Filter by ignore patterns
131
+ if should_ignore(filepath):
132
+ continue
133
+
134
+ if status.startswith('A'):
135
+ changes['added'].append(filepath)
136
+ elif status.startswith('M'):
137
+ changes['modified'].append(filepath)
138
+ elif status.startswith('D'):
139
+ changes['deleted'].append(filepath)
140
+ elif status.startswith('R'):
141
+ # Renamed: treat as delete + add
142
+ if len(parts) >= 3:
143
+ changes['deleted'].append(filepath)
144
+ changes['added'].append(parts[2])
145
+
146
+ # Also check for untracked files in scope
147
+ success, untracked = run_git_command(
148
+ ['ls-files', '--others', '--exclude-standard', str(scope.relative_to(git_root))],
149
+ git_root
150
+ )
151
+
152
+ if success and untracked:
153
+ for filepath in untracked.split('\n'):
154
+ if filepath and not should_ignore(filepath):
155
+ changes['added'].append(filepath)
156
+
157
+ return changes
158
+
159
+
160
+ def get_files_by_scan(scope: Path) -> Dict[str, List[str]]:
161
+ """Fallback: scan directory for all files (no change detection)."""
162
+ files = []
163
+ for pattern in ['**/*.py', '**/*.md']:
164
+ for f in scope.glob(pattern):
165
+ if not should_ignore(str(f)):
166
+ files.append(str(f.relative_to(scope)))
167
+
168
+ return {
169
+ 'added': [],
170
+ 'modified': files, # Treat all as modified when we can't detect
171
+ 'deleted': [],
172
+ }
173
+
174
+
175
+ def should_ignore(filepath: str) -> bool:
176
+ """Check if a file should be ignored."""
177
+ for pattern in IGNORE_PATTERNS:
178
+ if pattern.endswith('/'):
179
+ if pattern[:-1] in filepath:
180
+ return True
181
+ elif pattern.startswith('*'):
182
+ if filepath.endswith(pattern[1:]):
183
+ return True
184
+ elif pattern in filepath:
185
+ return True
186
+ return False
187
+
188
+
189
+ def categorize_file(filepath: str) -> Tuple[str, str]:
190
+ """
191
+ Categorize a file and determine its documentation impact.
192
+
193
+ Returns:
194
+ (category, doc_impact)
195
+ """
196
+ path = Path(filepath)
197
+
198
+ if 'SKILL.md' in filepath or filepath.startswith('SKILL_'):
199
+ return 'skill_definition', 'Update SKILLS_CATALOG.md'
200
+
201
+ if '/scripts/' in filepath and filepath.endswith('.py'):
202
+ skill_match = filepath.split('/scripts/')[0]
203
+ skill_name = Path(skill_match).name
204
+ return 'skill_scripts', f'Update {skill_name} SKILL.md scripts section'
205
+
206
+ if '/references/' in filepath and filepath.endswith('.md'):
207
+ skill_match = filepath.split('/references/')[0]
208
+ skill_name = Path(skill_match).name
209
+ return 'skill_references', f'Update {skill_name} SKILL.md references section'
210
+
211
+ if filepath.startswith('execution/') and filepath.endswith('.py'):
212
+ return 'execution_scripts', 'Update execution documentation'
213
+
214
+ if filepath.startswith('directives/') and filepath.endswith('.md'):
215
+ return 'directives', 'Update directives catalog if exists'
216
+
217
+ if path.name in ['AGENTS.md', 'README.md', 'SKILLS_CATALOG.md']:
218
+ return 'core_docs', 'Core documentation changed - review manually'
219
+
220
+ if filepath.endswith('.py'):
221
+ return 'python_modules', 'Potential module documentation update'
222
+
223
+ if filepath.endswith('.md'):
224
+ return 'markdown', 'Documentation file changed'
225
+
226
+ return 'other', 'No documentation action required'
227
+
228
+
229
+ def analyze_impact(changes: Dict[str, List[str]]) -> Dict[str, List[Dict]]:
230
+ """
231
+ Analyze the documentation impact of detected changes.
232
+
233
+ Returns:
234
+ Dict with documentation update recommendations
235
+ """
236
+ impact = {
237
+ 'skills_catalog_update': False,
238
+ 'skill_updates': {},
239
+ 'other_updates': [],
240
+ 'files': []
241
+ }
242
+
243
+ all_files = []
244
+ for status, files in changes.items():
245
+ for filepath in files:
246
+ category, doc_impact = categorize_file(filepath)
247
+
248
+ file_info = {
249
+ 'path': filepath,
250
+ 'status': status,
251
+ 'category': category,
252
+ 'impact': doc_impact
253
+ }
254
+ all_files.append(file_info)
255
+
256
+ # Track specific impacts
257
+ if category == 'skill_definition':
258
+ impact['skills_catalog_update'] = True
259
+
260
+ if category in ['skill_scripts', 'skill_references']:
261
+ # Extract skill name
262
+ if '/scripts/' in filepath:
263
+ skill = filepath.split('/scripts/')[0].split('/')[-1]
264
+ elif '/references/' in filepath:
265
+ skill = filepath.split('/references/')[0].split('/')[-1]
266
+ else:
267
+ skill = 'unknown'
268
+
269
+ if skill not in impact['skill_updates']:
270
+ impact['skill_updates'][skill] = []
271
+ impact['skill_updates'][skill].append(file_info)
272
+
273
+ impact['files'] = all_files
274
+ return impact
275
+
276
+
277
+ def format_markdown_report(changes: Dict, impact: Dict, scope: str, since: str) -> str:
278
+ """Generate a markdown report of changes and their documentation impact."""
279
+ now = datetime.now().strftime("%Y-%m-%d %H:%M")
280
+
281
+ added_count = len(changes['added'])
282
+ modified_count = len(changes['modified'])
283
+ deleted_count = len(changes['deleted'])
284
+ total = added_count + modified_count + deleted_count
285
+
286
+ lines = [
287
+ "# Documentation Change Report",
288
+ "",
289
+ f"> **Generated:** {now}",
290
+ f"> **Scope:** `{scope}`",
291
+ f"> **Since:** `{since}`",
292
+ "",
293
+ "---",
294
+ "",
295
+ "## Summary",
296
+ "",
297
+ f"- **Added:** {added_count} files",
298
+ f"- **Modified:** {modified_count} files",
299
+ f"- **Deleted:** {deleted_count} files",
300
+ f"- **Total Changes:** {total}",
301
+ "",
302
+ ]
303
+
304
+ if total == 0:
305
+ lines.append("✅ No changes detected requiring documentation updates.")
306
+ return '\n'.join(lines)
307
+
308
+ # Documentation Impact Section
309
+ lines.extend([
310
+ "---",
311
+ "",
312
+ "## Documentation Impact",
313
+ "",
314
+ ])
315
+
316
+ if impact['skills_catalog_update']:
317
+ lines.append("- [x] **SKILLS_CATALOG.md** — Skill definitions changed, catalog update required")
318
+
319
+ for skill, files in impact['skill_updates'].items():
320
+ lines.append(f"- [ ] **skills/{skill}/SKILL.md** — {len(files)} file(s) changed")
321
+
322
+ lines.extend(["", "---", ""])
323
+
324
+ # Detailed Changes
325
+ lines.append("## Detailed Changes")
326
+ lines.append("")
327
+
328
+ if changes['added']:
329
+ lines.extend([
330
+ "### Added Files",
331
+ "",
332
+ "| File | Category | Documentation Impact |",
333
+ "|------|----------|---------------------|",
334
+ ])
335
+ for filepath in sorted(changes['added']):
336
+ category, doc_impact = categorize_file(filepath)
337
+ lines.append(f"| `{filepath}` | {category} | {doc_impact} |")
338
+ lines.append("")
339
+
340
+ if changes['modified']:
341
+ lines.extend([
342
+ "### Modified Files",
343
+ "",
344
+ "| File | Category | Documentation Impact |",
345
+ "|------|----------|---------------------|",
346
+ ])
347
+ for filepath in sorted(changes['modified']):
348
+ category, doc_impact = categorize_file(filepath)
349
+ lines.append(f"| `{filepath}` | {category} | {doc_impact} |")
350
+ lines.append("")
351
+
352
+ if changes['deleted']:
353
+ lines.extend([
354
+ "### Deleted Files",
355
+ "",
356
+ "| File | Category | Documentation Impact |",
357
+ "|------|----------|---------------------|",
358
+ ])
359
+ for filepath in sorted(changes['deleted']):
360
+ category, doc_impact = categorize_file(filepath)
361
+ lines.append(f"| `{filepath}` | {category} | {doc_impact} |")
362
+ lines.append("")
363
+
364
+ # Recommended Actions
365
+ lines.extend([
366
+ "---",
367
+ "",
368
+ "## Recommended Actions",
369
+ "",
370
+ ])
371
+
372
+ if impact['skills_catalog_update']:
373
+ lines.append("```bash")
374
+ lines.append("# Update the skills catalog")
375
+ lines.append("python skill-creator/scripts/update_catalog.py --skills-dir skills/")
376
+ lines.append("```")
377
+ lines.append("")
378
+
379
+ for skill in impact['skill_updates'].keys():
380
+ lines.append("```bash")
381
+ lines.append(f"# Update documentation for {skill} skill")
382
+ lines.append(f"python skills/documentation/scripts/update_skill_docs.py --skill {skill}")
383
+ lines.append("```")
384
+ lines.append("")
385
+
386
+ return '\n'.join(lines)
387
+
388
+
389
+ def format_json_report(changes: Dict, impact: Dict, scope: str, since: str) -> str:
390
+ """Generate a JSON report of changes."""
391
+ report = {
392
+ 'generated': datetime.now().isoformat(),
393
+ 'scope': str(scope),
394
+ 'since': since,
395
+ 'summary': {
396
+ 'added': len(changes['added']),
397
+ 'modified': len(changes['modified']),
398
+ 'deleted': len(changes['deleted']),
399
+ },
400
+ 'changes': changes,
401
+ 'impact': {
402
+ 'skills_catalog_update_required': impact['skills_catalog_update'],
403
+ 'skill_updates_required': list(impact['skill_updates'].keys()),
404
+ 'files': impact['files'],
405
+ }
406
+ }
407
+ return json.dumps(report, indent=2)
408
+
409
+
410
+ def main():
411
+ parser = argparse.ArgumentParser(
412
+ description='Detect code changes for documentation updates',
413
+ formatter_class=argparse.RawDescriptionHelpFormatter,
414
+ epilog=__doc__
415
+ )
416
+ parser.add_argument('--scope', required=True, help='Directory to scan')
417
+ parser.add_argument('--since', default='HEAD~10', help='Compare since commit/date')
418
+ parser.add_argument('--output', help='Output file (default: stdout)')
419
+ parser.add_argument('--format', choices=['md', 'json'], default='md', help='Output format')
420
+ parser.add_argument('--include-git', type=bool, default=True, help='Use git for detection')
421
+ args = parser.parse_args()
422
+
423
+ scope = Path(args.scope).resolve()
424
+
425
+ if not scope.exists():
426
+ print(f"❌ Error: Directory not found: {scope}", file=sys.stderr)
427
+ sys.exit(2)
428
+
429
+ print(f"🔍 Scanning for changes in: {scope}", file=sys.stderr)
430
+ print(f" Since: {args.since}", file=sys.stderr)
431
+
432
+ # Detect changes
433
+ changes = get_changed_files(scope, args.since)
434
+
435
+ total = sum(len(v) for v in changes.values())
436
+ print(f" Found: {total} changed file(s)", file=sys.stderr)
437
+
438
+ # Analyze impact
439
+ impact = analyze_impact(changes)
440
+
441
+ # Generate report
442
+ if args.format == 'json':
443
+ report = format_json_report(changes, impact, str(scope), args.since)
444
+ else:
445
+ report = format_markdown_report(changes, impact, str(scope), args.since)
446
+
447
+ # Output
448
+ if args.output:
449
+ output_path = Path(args.output)
450
+ output_path.parent.mkdir(parents=True, exist_ok=True)
451
+ output_path.write_text(report)
452
+ print(f"✅ Report saved to: {args.output}", file=sys.stderr)
453
+ else:
454
+ print(report)
455
+
456
+ sys.exit(0)
457
+
458
+
459
+ if __name__ == '__main__':
460
+ main()