@atlashub/smartstack-cli 1.5.1 → 1.5.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 (147) hide show
  1. package/.documentation/css/styles.css +2168 -2168
  2. package/.documentation/js/app.js +794 -794
  3. package/config/default-config.json +86 -86
  4. package/config/settings.json +53 -53
  5. package/config/settings.local.example.json +16 -16
  6. package/dist/index.js +0 -0
  7. package/dist/index.js.map +1 -1
  8. package/package.json +88 -88
  9. package/templates/agents/action.md +36 -36
  10. package/templates/agents/efcore/conflicts.md +84 -84
  11. package/templates/agents/efcore/db-deploy.md +51 -51
  12. package/templates/agents/efcore/db-reset.md +59 -59
  13. package/templates/agents/efcore/db-seed.md +56 -56
  14. package/templates/agents/efcore/db-status.md +64 -64
  15. package/templates/agents/efcore/migration.md +85 -85
  16. package/templates/agents/efcore/rebase-snapshot.md +62 -62
  17. package/templates/agents/efcore/scan.md +90 -90
  18. package/templates/agents/efcore/squash.md +67 -67
  19. package/templates/agents/explore-codebase.md +65 -65
  20. package/templates/agents/explore-docs.md +97 -97
  21. package/templates/agents/fix-grammar.md +49 -49
  22. package/templates/agents/gitflow/abort.md +45 -45
  23. package/templates/agents/gitflow/cleanup.md +85 -85
  24. package/templates/agents/gitflow/commit.md +40 -40
  25. package/templates/agents/gitflow/exec.md +48 -48
  26. package/templates/agents/gitflow/finish.md +92 -92
  27. package/templates/agents/gitflow/init.md +139 -139
  28. package/templates/agents/gitflow/merge.md +62 -62
  29. package/templates/agents/gitflow/plan.md +42 -42
  30. package/templates/agents/gitflow/pr.md +78 -78
  31. package/templates/agents/gitflow/review.md +49 -49
  32. package/templates/agents/gitflow/start.md +61 -61
  33. package/templates/agents/gitflow/status.md +32 -32
  34. package/templates/agents/snipper.md +36 -36
  35. package/templates/agents/websearch.md +46 -46
  36. package/templates/commands/_resources/formatting-guide.md +124 -124
  37. package/templates/commands/ai-prompt.md +315 -315
  38. package/templates/commands/apex/1-analyze.md +100 -100
  39. package/templates/commands/apex/2-plan.md +145 -145
  40. package/templates/commands/apex/3-execute.md +171 -171
  41. package/templates/commands/apex/4-examine.md +116 -116
  42. package/templates/commands/apex/5-tasks.md +209 -209
  43. package/templates/commands/apex.md +76 -76
  44. package/templates/commands/application/create.md +362 -362
  45. package/templates/commands/application/templates-backend.md +463 -463
  46. package/templates/commands/application/templates-frontend.md +517 -517
  47. package/templates/commands/application/templates-i18n.md +478 -478
  48. package/templates/commands/application/templates-seed.md +362 -362
  49. package/templates/commands/application.md +303 -303
  50. package/templates/commands/business-analyse/0-orchestrate.md +640 -640
  51. package/templates/commands/business-analyse/1-init.md +269 -269
  52. package/templates/commands/business-analyse/2-discover.md +520 -520
  53. package/templates/commands/business-analyse/3-analyse.md +408 -408
  54. package/templates/commands/business-analyse/4-specify.md +598 -598
  55. package/templates/commands/business-analyse/5-validate.md +326 -326
  56. package/templates/commands/business-analyse/6-handoff.md +746 -746
  57. package/templates/commands/business-analyse/7-doc-html.md +602 -602
  58. package/templates/commands/business-analyse/bug.md +325 -325
  59. package/templates/commands/business-analyse/change-request.md +368 -368
  60. package/templates/commands/business-analyse/hotfix.md +200 -200
  61. package/templates/commands/business-analyse.md +640 -640
  62. package/templates/commands/controller/create.md +216 -216
  63. package/templates/commands/controller/postman-templates.md +528 -528
  64. package/templates/commands/controller/templates.md +600 -600
  65. package/templates/commands/controller.md +337 -337
  66. package/templates/commands/create/agent.md +138 -138
  67. package/templates/commands/create/command.md +166 -166
  68. package/templates/commands/create/hook.md +234 -234
  69. package/templates/commands/create/plugin.md +329 -329
  70. package/templates/commands/create/project.md +507 -507
  71. package/templates/commands/create/skill.md +199 -199
  72. package/templates/commands/create.md +220 -220
  73. package/templates/commands/debug.md +95 -95
  74. package/templates/commands/documentation/module.md +202 -202
  75. package/templates/commands/documentation/templates.md +432 -432
  76. package/templates/commands/documentation.md +190 -190
  77. package/templates/commands/efcore/_env-check.md +153 -153
  78. package/templates/commands/efcore/conflicts.md +186 -186
  79. package/templates/commands/efcore/db-deploy.md +193 -193
  80. package/templates/commands/efcore/db-reset.md +426 -426
  81. package/templates/commands/efcore/db-seed.md +326 -326
  82. package/templates/commands/efcore/db-status.md +226 -226
  83. package/templates/commands/efcore/migration.md +400 -400
  84. package/templates/commands/efcore/rebase-snapshot.md +264 -264
  85. package/templates/commands/efcore/scan.md +198 -198
  86. package/templates/commands/efcore/squash.md +298 -298
  87. package/templates/commands/efcore.md +224 -224
  88. package/templates/commands/epct.md +69 -69
  89. package/templates/commands/explain.md +186 -186
  90. package/templates/commands/explore.md +45 -45
  91. package/templates/commands/feature-full.md +267 -267
  92. package/templates/commands/gitflow/1-init.md +1038 -1038
  93. package/templates/commands/gitflow/10-start.md +768 -768
  94. package/templates/commands/gitflow/11-finish.md +457 -457
  95. package/templates/commands/gitflow/12-cleanup.md +276 -276
  96. package/templates/commands/gitflow/13-sync.md +216 -216
  97. package/templates/commands/gitflow/14-rebase.md +251 -251
  98. package/templates/commands/gitflow/2-status.md +277 -277
  99. package/templates/commands/gitflow/3-commit.md +344 -344
  100. package/templates/commands/gitflow/4-plan.md +145 -145
  101. package/templates/commands/gitflow/5-exec.md +147 -147
  102. package/templates/commands/gitflow/6-abort.md +344 -344
  103. package/templates/commands/gitflow/7-pull-request.md +453 -355
  104. package/templates/commands/gitflow/8-review.md +240 -176
  105. package/templates/commands/gitflow/9-merge.md +451 -365
  106. package/templates/commands/gitflow.md +128 -128
  107. package/templates/commands/implement.md +663 -663
  108. package/templates/commands/init.md +567 -567
  109. package/templates/commands/mcp-integration.md +330 -330
  110. package/templates/commands/notification.md +129 -129
  111. package/templates/commands/oneshot.md +57 -57
  112. package/templates/commands/quick-search.md +72 -72
  113. package/templates/commands/ralph-loop/cancel-ralph.md +18 -18
  114. package/templates/commands/ralph-loop/help.md +126 -126
  115. package/templates/commands/ralph-loop/ralph-loop.md +18 -18
  116. package/templates/commands/review.md +106 -106
  117. package/templates/commands/utils/test-web-config.md +160 -160
  118. package/templates/commands/utils/test-web.md +151 -151
  119. package/templates/commands/validate.md +233 -233
  120. package/templates/commands/workflow.md +193 -193
  121. package/templates/gitflow/config.json +138 -138
  122. package/templates/hooks/ef-migration-check.md +139 -139
  123. package/templates/hooks/hooks.json +25 -25
  124. package/templates/hooks/stop-hook.sh +177 -177
  125. package/templates/skills/ai-prompt/SKILL.md +778 -778
  126. package/templates/skills/application/SKILL.md +563 -563
  127. package/templates/skills/application/templates-backend.md +450 -450
  128. package/templates/skills/application/templates-frontend.md +531 -531
  129. package/templates/skills/application/templates-i18n.md +520 -520
  130. package/templates/skills/application/templates-seed.md +647 -647
  131. package/templates/skills/business-analyse/SKILL.md +191 -191
  132. package/templates/skills/business-analyse/questionnaire.md +283 -283
  133. package/templates/skills/business-analyse/templates-frd.md +477 -477
  134. package/templates/skills/business-analyse/templates-react.md +580 -580
  135. package/templates/skills/controller/SKILL.md +240 -240
  136. package/templates/skills/controller/postman-templates.md +614 -614
  137. package/templates/skills/controller/templates.md +1468 -1468
  138. package/templates/skills/documentation/SKILL.md +133 -133
  139. package/templates/skills/documentation/templates.md +476 -476
  140. package/templates/skills/feature-full/SKILL.md +838 -838
  141. package/templates/skills/notification/SKILL.md +555 -555
  142. package/templates/skills/ui-components/SKILL.md +870 -870
  143. package/templates/skills/workflow/SKILL.md +582 -582
  144. package/templates/test-web/api-health.json +38 -38
  145. package/templates/test-web/minimal.json +19 -19
  146. package/templates/test-web/npm-package.json +46 -46
  147. package/templates/test-web/seo-check.json +54 -54
@@ -1,794 +1,794 @@
1
- /* ============================================
2
- CLAUDE TOOLS DOCUMENTATION - APP
3
- ============================================ */
4
-
5
- document.addEventListener('DOMContentLoaded', function() {
6
- initSidebar();
7
- initLanguageSwitch();
8
- initCopyButtons();
9
- initMobileMenu();
10
- initSidebarToc();
11
- initScrollSpy();
12
- initInteractiveDiagram();
13
- initSearch();
14
- initCopyableCommands();
15
- });
16
-
17
- /* ============================================
18
- SIDEBAR
19
- ============================================ */
20
-
21
- function initSidebar() {
22
- const sidebar = document.querySelector('.sidebar');
23
- const toggle = document.querySelector('.sidebar-toggle');
24
-
25
- if (!sidebar || !toggle) return;
26
-
27
- // Load saved state
28
- const isCollapsed = localStorage.getItem('sidebar-collapsed') === 'true';
29
- if (isCollapsed) {
30
- sidebar.classList.add('collapsed');
31
- }
32
-
33
- toggle.addEventListener('click', function() {
34
- sidebar.classList.toggle('collapsed');
35
- localStorage.setItem('sidebar-collapsed', sidebar.classList.contains('collapsed'));
36
- });
37
-
38
- // Set active nav item
39
- const currentPage = window.location.pathname.split('/').pop() || 'index.html';
40
- document.querySelectorAll('.nav-item').forEach(item => {
41
- if (item.getAttribute('href') === currentPage) {
42
- item.classList.add('active');
43
- }
44
- });
45
- }
46
-
47
- /* ============================================
48
- LANGUAGE SWITCH
49
- ============================================ */
50
-
51
- function initLanguageSwitch() {
52
- const langSelect = document.getElementById('lang-select');
53
-
54
- // Load saved language
55
- const savedLang = localStorage.getItem('doc-language') || 'fr';
56
- setLanguage(savedLang);
57
-
58
- // Set dropdown to saved value
59
- if (langSelect) {
60
- langSelect.value = savedLang;
61
- }
62
-
63
- // Setup language button handlers (sidebar footer)
64
- document.querySelectorAll('.lang-btn').forEach(btn => {
65
- btn.addEventListener('click', function() {
66
- const lang = this.dataset.lang;
67
- setLanguage(lang);
68
- localStorage.setItem('doc-language', lang);
69
-
70
- // Update active state
71
- document.querySelectorAll('.lang-btn').forEach(b => b.classList.remove('active'));
72
- this.classList.add('active');
73
- });
74
- });
75
- }
76
-
77
- function setLanguage(lang) {
78
- // Update body class
79
- document.body.classList.remove('lang-fr', 'lang-en');
80
- document.body.classList.add('lang-' + lang);
81
-
82
- // Update dropdown value (if exists)
83
- const langSelect = document.getElementById('lang-select');
84
- if (langSelect) {
85
- langSelect.value = lang;
86
- }
87
-
88
- // Update HTML lang attribute
89
- document.documentElement.lang = lang;
90
-
91
- // Update search placeholder
92
- const searchInput = document.getElementById('search-input');
93
- if (searchInput) {
94
- const placeholder = lang === 'en' ? searchInput.dataset.placeholderEn : searchInput.dataset.placeholderFr;
95
- if (placeholder) {
96
- searchInput.placeholder = placeholder;
97
- }
98
- }
99
- }
100
-
101
- /* ============================================
102
- COPY BUTTONS
103
- ============================================ */
104
-
105
- function initCopyButtons() {
106
- document.querySelectorAll('.copy-btn').forEach(btn => {
107
- btn.addEventListener('click', async function() {
108
- const code = this.closest('.code-block').querySelector('code').textContent;
109
-
110
- try {
111
- await navigator.clipboard.writeText(code);
112
- const originalText = this.textContent;
113
- this.textContent = 'Copied!';
114
- this.style.background = 'var(--success)';
115
-
116
- setTimeout(() => {
117
- this.textContent = originalText;
118
- this.style.background = '';
119
- }, 2000);
120
- } catch (err) {
121
- console.error('Failed to copy:', err);
122
- }
123
- });
124
- });
125
- }
126
-
127
- /* ============================================
128
- MOBILE MENU
129
- ============================================ */
130
-
131
- function initMobileMenu() {
132
- const menuBtn = document.querySelector('.mobile-menu-btn');
133
- const sidebar = document.querySelector('.sidebar');
134
- const overlay = document.querySelector('.overlay');
135
-
136
- if (!menuBtn || !sidebar) return;
137
-
138
- menuBtn.addEventListener('click', function() {
139
- sidebar.classList.toggle('open');
140
- overlay?.classList.toggle('active');
141
- });
142
-
143
- overlay?.addEventListener('click', function() {
144
- sidebar.classList.remove('open');
145
- overlay.classList.remove('active');
146
- });
147
-
148
- // Close on nav item click (mobile)
149
- document.querySelectorAll('.nav-item').forEach(item => {
150
- item.addEventListener('click', function() {
151
- if (window.innerWidth <= 1024) {
152
- sidebar.classList.remove('open');
153
- overlay?.classList.remove('active');
154
- }
155
- });
156
- });
157
- }
158
-
159
- /* ============================================
160
- SIDEBAR TABLE OF CONTENTS
161
- ============================================ */
162
-
163
- function initSidebarToc() {
164
- const sidebarToc = document.querySelector('.sidebar-toc');
165
- const tocToggle = document.querySelector('.toc-toggle');
166
-
167
- if (!sidebarToc) return;
168
-
169
- // Auto-open TOC on current page
170
- sidebarToc.classList.add('open');
171
- if (tocToggle) tocToggle.classList.add('open');
172
-
173
- // Toggle handler
174
- if (tocToggle) {
175
- tocToggle.addEventListener('click', function(e) {
176
- e.preventDefault();
177
- e.stopPropagation();
178
- sidebarToc.classList.toggle('open');
179
- tocToggle.classList.toggle('open');
180
- });
181
- }
182
-
183
- // Smooth scroll for sidebar TOC links
184
- document.querySelectorAll('.sidebar-toc-link').forEach(link => {
185
- link.addEventListener('click', function(e) {
186
- e.preventDefault();
187
- const targetId = this.getAttribute('href');
188
- const target = document.querySelector(targetId);
189
- if (target) {
190
- target.scrollIntoView({ behavior: 'smooth', block: 'start' });
191
- // Update active state immediately
192
- document.querySelectorAll('.sidebar-toc-link').forEach(l => l.classList.remove('active'));
193
- this.classList.add('active');
194
- }
195
- });
196
- });
197
- }
198
-
199
- /* ============================================
200
- SCROLL SPY
201
- ============================================ */
202
-
203
- function initScrollSpy() {
204
- const headings = document.querySelectorAll('h2[id], h3[id]');
205
- const sidebarTocLinks = document.querySelectorAll('.sidebar-toc-link');
206
-
207
- if (!headings.length || !sidebarTocLinks.length) return;
208
-
209
- const observer = new IntersectionObserver(entries => {
210
- entries.forEach(entry => {
211
- if (entry.isIntersecting) {
212
- const id = entry.target.id;
213
- sidebarTocLinks.forEach(link => {
214
- link.classList.toggle('active', link.getAttribute('href') === '#' + id);
215
- });
216
- }
217
- });
218
- }, { rootMargin: '-20% 0px -80% 0px' });
219
-
220
- headings.forEach(heading => observer.observe(heading));
221
- }
222
-
223
- /* ============================================
224
- UTILITIES
225
- ============================================ */
226
-
227
- // Smooth scroll for anchor links
228
- document.querySelectorAll('a[href^="#"]').forEach(anchor => {
229
- anchor.addEventListener('click', function(e) {
230
- e.preventDefault();
231
- const target = document.querySelector(this.getAttribute('href'));
232
- if (target) {
233
- target.scrollIntoView({ behavior: 'smooth', block: 'start' });
234
- }
235
- });
236
- });
237
-
238
- // Add animation class on scroll
239
- const observerOptions = {
240
- threshold: 0.1,
241
- rootMargin: '0px 0px -50px 0px'
242
- };
243
-
244
- const fadeObserver = new IntersectionObserver((entries) => {
245
- entries.forEach(entry => {
246
- if (entry.isIntersecting) {
247
- entry.target.classList.add('fade-in');
248
- fadeObserver.unobserve(entry.target);
249
- }
250
- });
251
- }, observerOptions);
252
-
253
- document.querySelectorAll('.card, .alert, .best-practice').forEach(el => {
254
- fadeObserver.observe(el);
255
- });
256
-
257
- /* ============================================
258
- INTERACTIVE DIAGRAM
259
- ============================================ */
260
-
261
- function initInteractiveDiagram() {
262
- const diagram = document.getElementById('gitflow-diagram');
263
- const tooltip = document.getElementById('diagram-tooltip');
264
-
265
- if (!diagram || !tooltip) return;
266
-
267
- const clickableElements = diagram.querySelectorAll('.clickable-element');
268
- let activeElement = null;
269
-
270
- // Get current language
271
- function getLang() {
272
- return document.body.classList.contains('lang-en') ? 'en' : 'fr';
273
- }
274
-
275
- // Show tooltip for an element
276
- function showTooltip(element, event) {
277
- const lang = getLang();
278
- const title = element.dataset['title' + lang.charAt(0).toUpperCase() + lang.slice(1)] || element.dataset.titleFr;
279
- const desc = element.dataset['desc' + lang.charAt(0).toUpperCase() + lang.slice(1)] || element.dataset.descFr;
280
- const cmd = element.dataset.cmd || '';
281
-
282
- // Set tooltip content
283
- tooltip.querySelector('.tooltip-title').textContent = title;
284
- tooltip.querySelector('.tooltip-desc').textContent = desc;
285
-
286
- const cmdElement = tooltip.querySelector('.tooltip-cmd');
287
- if (cmd) {
288
- cmdElement.textContent = cmd;
289
- cmdElement.style.display = 'inline-block';
290
- } else {
291
- cmdElement.style.display = 'none';
292
- }
293
-
294
- // Position tooltip
295
- const diagramRect = diagram.getBoundingClientRect();
296
- const svgRect = diagram.querySelector('svg').getBoundingClientRect();
297
-
298
- // Calculate position relative to the diagram
299
- let left = event.clientX - diagramRect.left + 15;
300
- let top = event.clientY - diagramRect.top + 15;
301
-
302
- // Make tooltip visible to measure it
303
- tooltip.style.left = left + 'px';
304
- tooltip.style.top = top + 'px';
305
- tooltip.classList.add('visible');
306
-
307
- // Adjust if overflowing right edge
308
- const tooltipRect = tooltip.getBoundingClientRect();
309
- if (tooltipRect.right > diagramRect.right - 10) {
310
- left = event.clientX - diagramRect.left - tooltipRect.width - 15;
311
- tooltip.style.left = left + 'px';
312
- }
313
-
314
- // Adjust if overflowing bottom edge
315
- if (tooltipRect.bottom > window.innerHeight - 10) {
316
- top = event.clientY - diagramRect.top - tooltipRect.height - 15;
317
- tooltip.style.top = top + 'px';
318
- }
319
-
320
- // Mark element as active
321
- if (activeElement) {
322
- activeElement.classList.remove('active');
323
- }
324
- element.classList.add('active');
325
- activeElement = element;
326
- }
327
-
328
- // Hide tooltip
329
- function hideTooltip() {
330
- tooltip.classList.remove('visible');
331
- if (activeElement) {
332
- activeElement.classList.remove('active');
333
- activeElement = null;
334
- }
335
- }
336
-
337
- // Add click handlers to clickable elements
338
- clickableElements.forEach(element => {
339
- element.addEventListener('click', function(e) {
340
- e.stopPropagation();
341
-
342
- // If clicking the same element, toggle off
343
- if (activeElement === this) {
344
- hideTooltip();
345
- } else {
346
- showTooltip(this, e);
347
- }
348
- });
349
- });
350
-
351
- // Close tooltip when clicking outside
352
- document.addEventListener('click', function(e) {
353
- if (!diagram.contains(e.target) || (!e.target.closest('.clickable-element') && !e.target.closest('.diagram-tooltip'))) {
354
- hideTooltip();
355
- }
356
- });
357
-
358
- // Close on escape key
359
- document.addEventListener('keydown', function(e) {
360
- if (e.key === 'Escape') {
361
- hideTooltip();
362
- }
363
- });
364
-
365
- // Update tooltip language when language changes
366
- const langSelect = document.getElementById('lang-select');
367
- if (langSelect) {
368
- langSelect.addEventListener('change', function() {
369
- if (activeElement && tooltip.classList.contains('visible')) {
370
- // Re-show tooltip with new language
371
- const event = { clientX: parseFloat(tooltip.style.left) + diagram.getBoundingClientRect().left,
372
- clientY: parseFloat(tooltip.style.top) + diagram.getBoundingClientRect().top };
373
- setTimeout(() => showTooltip(activeElement, event), 50);
374
- }
375
- });
376
- }
377
- }
378
-
379
- /* ============================================
380
- SEARCH (Full-Text with Static Fallback)
381
- ============================================ */
382
-
383
- function initSearch() {
384
- const searchInput = document.getElementById('search-input');
385
- const searchResults = document.getElementById('search-results');
386
-
387
- if (!searchInput || !searchResults) return;
388
-
389
- // Static search index (works without server, file:// protocol)
390
- const staticIndex = [
391
- // Index - Accueil
392
- { page: 'index.html', icon: '🏠', title: { fr: 'Accueil', en: 'Home' }, section: '', anchor: '',
393
- keywords: 'accueil home documentation claude tools atlashub cli automatisation gitflow apex ef core migration hooks agents commandes installation npm' },
394
-
395
- // Installation
396
- { page: 'installation.html', icon: '📦', title: { fr: 'Installation', en: 'Installation' }, section: '', anchor: '',
397
- keywords: 'installation install npm registry nodejs node prérequis requirements setup configuration package global' },
398
- { page: 'installation.html', icon: '📦', title: { fr: 'Installation', en: 'Installation' }, section: { fr: 'Prérequis', en: 'Prerequisites' }, anchor: 'prerequisites',
399
- keywords: 'prérequis prerequisites nodejs node version 18 npm git' },
400
- { page: 'installation.html', icon: '📦', title: { fr: 'Installation', en: 'Installation' }, section: { fr: 'Installation globale', en: 'Global Installation' }, anchor: 'global-install',
401
- keywords: 'npm install global atlashub claude-tools registry package' },
402
-
403
- // GitFlow
404
- { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: '', anchor: '',
405
- keywords: 'gitflow git workflow branch branche feature release hotfix develop main master merge fusion version semver' },
406
- { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Branches principales', en: 'Main Branches' }, anchor: 'main-branches',
407
- keywords: 'main master develop development production branches principales' },
408
- { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Feature branches', en: 'Feature branches' }, anchor: 'feature',
409
- keywords: 'feature branch nouvelle fonctionnalité develop merge création git checkout' },
410
- { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Release branches', en: 'Release branches' }, anchor: 'release',
411
- keywords: 'release branch version livraison production tag semver minor major patch' },
412
- { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Hotfix branches', en: 'Hotfix branches' }, anchor: 'hotfix',
413
- keywords: 'hotfix branch correction bug urgent production patch fix' },
414
- { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Commandes', en: 'Commands' }, anchor: 'commands',
415
- keywords: 'commandes commands gitflow init start finish status plan exec commit abort' },
416
- { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Versioning SemVer', en: 'SemVer Versioning' }, anchor: 'semver',
417
- keywords: 'semver semantic versioning version major minor patch auto increment package.json' },
418
-
419
- // EF Core
420
- { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: '', anchor: '',
421
- keywords: 'ef core entity framework migration database dotnet .net sql model orm microsoft' },
422
- { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: { fr: 'Structure des migrations', en: 'Migration Structure' }, anchor: 'structure',
423
- keywords: 'migration structure fichier file timestamp designer snapshot model context dbcontext' },
424
- { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: { fr: 'Conflits', en: 'Conflicts' }, anchor: 'conflicts',
425
- keywords: 'conflit conflict merge migration snapshot résolution resolution gitflow' },
426
- { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: { fr: 'Bonnes pratiques', en: 'Best Practices' }, anchor: 'best-practices',
427
- keywords: 'bonnes pratiques best practices migration naming convention idempotent script sql' },
428
- { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: { fr: 'Commandes', en: 'Commands' }, anchor: 'commands',
429
- keywords: 'commandes commands dotnet ef migrations add remove update database script' },
430
-
431
- // APEX
432
- { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: '', anchor: '',
433
- keywords: 'apex methodology méthodologie analyze plan execute examine implementation implémentation workflow' },
434
- { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: { fr: 'Analyze', en: 'Analyze' }, anchor: 'analyze',
435
- keywords: 'analyze analyse context contexte codebase exploration recherche understanding' },
436
- { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: { fr: 'Plan', en: 'Plan' }, anchor: 'plan',
437
- keywords: 'plan planning planification strategy stratégie architecture design conception' },
438
- { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: { fr: 'Execute', en: 'Execute' }, anchor: 'execute',
439
- keywords: 'execute exécution implementation implémentation code coding développement development' },
440
- { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: { fr: 'Examine', en: 'Examine' }, anchor: 'examine',
441
- keywords: 'examine test testing validation vérification review revue quality qualité' },
442
-
443
- // Business Analyse
444
- { page: 'business-analyse.html', icon: '📊', title: { fr: 'Business Analyse', en: 'Business Analyse' }, section: '', anchor: '',
445
- keywords: 'business analyse analysis specification brd frd requirements exigences babok' },
446
- { page: 'business-analyse.html', icon: '📊', title: { fr: 'Business Analyse', en: 'Business Analyse' }, section: { fr: 'Discovery', en: 'Discovery' }, anchor: 'phase-2',
447
- keywords: 'discover discovery questionnaire questions adaptatives ultrathink elicitation' },
448
- { page: 'business-analyse.html', icon: '📊', title: { fr: 'Business Analyse', en: 'Business Analyse' }, section: { fr: 'Specification', en: 'Specification' }, anchor: 'phase-4',
449
- keywords: 'specify specification frd use cases wireframes gherkin acceptance criteria' },
450
- { page: 'business-analyse.html', icon: '📊', title: { fr: 'Business Analyse', en: 'Business Analyse' }, section: { fr: 'Handoff', en: 'Handoff' }, anchor: 'phase-6',
451
- keywords: 'handoff dev prompt developer implementation autonome autonomous' },
452
-
453
- // Agents
454
- { page: 'agents.html', icon: '🤖', title: { fr: 'Agents', en: 'Agents' }, section: '', anchor: '',
455
- keywords: 'agents subagent task tool automation automatisation ai ia claude specialized spécialisé' },
456
- { page: 'agents.html', icon: '🤖', title: { fr: 'Agents', en: 'Agents' }, section: { fr: 'GitFlow Agents', en: 'GitFlow Agents' }, anchor: 'gitflow-agents',
457
- keywords: 'gitflow agents plan exec commit status abort rollback recovery' },
458
- { page: 'agents.html', icon: '🤖', title: { fr: 'Agents', en: 'Agents' }, section: { fr: 'Explore Agent', en: 'Explore Agent' }, anchor: 'explore',
459
- keywords: 'explore agent codebase search recherche exploration quick thorough' },
460
-
461
- // Commands
462
- { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: '', anchor: '',
463
- keywords: 'commandes commands slash cli terminal prompt gitflow apex commit review deploy' },
464
- { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: { fr: 'GitFlow Commands', en: 'GitFlow Commands' }, anchor: 'gitflow-commands',
465
- keywords: 'gitflow commands init start finish status commit plan exec' },
466
- { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: { fr: 'APEX Commands', en: 'APEX Commands' }, anchor: 'apex-commands',
467
- keywords: 'apex commands analyze plan execute examine quick' },
468
- { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: { fr: 'Commit', en: 'Commit' }, anchor: 'commit',
469
- keywords: 'commit git message conventional commits push' },
470
- { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: { fr: 'Deploy', en: 'Deploy' }, anchor: 'deploy',
471
- keywords: 'deploy deployment déploiement build test lint push production' },
472
-
473
- // Hooks
474
- { page: 'hooks.html', icon: '🔗', title: { fr: 'Hooks', en: 'Hooks' }, section: '', anchor: '',
475
- keywords: 'hooks pre-commit post-commit validation automation automatisation script event événement' },
476
- { page: 'hooks.html', icon: '🔗', title: { fr: 'Hooks', en: 'Hooks' }, section: { fr: 'Types de hooks', en: 'Hook Types' }, anchor: 'types',
477
- keywords: 'types hooks PreToolUse PostToolUse Stop SessionStart UserPromptSubmit' },
478
- { page: 'hooks.html', icon: '🔗', title: { fr: 'Hooks', en: 'Hooks' }, section: { fr: 'Configuration', en: 'Configuration' }, anchor: 'configuration',
479
- keywords: 'configuration hooks settings.json matcher command timeout' }
480
- ];
481
-
482
- let searchIndex = null;
483
- let activeIndex = -1;
484
-
485
- function getLang() {
486
- return document.body.classList.contains('lang-en') ? 'en' : 'fr';
487
- }
488
-
489
- // Build search index from static data
490
- function buildIndex() {
491
- const lang = getLang();
492
-
493
- return staticIndex.map(item => {
494
- const pageTitle = typeof item.title === 'object' ? item.title[lang] : item.title;
495
- const sectionTitle = typeof item.section === 'object' ? item.section[lang] : item.section;
496
-
497
- return {
498
- page: item.page,
499
- pageTitle: pageTitle,
500
- icon: item.icon,
501
- sectionTitle: sectionTitle || '',
502
- content: (pageTitle + ' ' + sectionTitle + ' ' + item.keywords).toLowerCase(),
503
- contentRaw: item.keywords,
504
- anchor: item.anchor,
505
- url: item.anchor ? `${item.page}#${item.anchor}` : item.page
506
- };
507
- });
508
- }
509
-
510
- // Search through index
511
- function search(query) {
512
- if (!query || query.length < 2) return [];
513
-
514
- // Build index if not ready
515
- if (!searchIndex) {
516
- searchIndex = buildIndex();
517
- }
518
-
519
- const normalizedQuery = query.toLowerCase().trim();
520
- const words = normalizedQuery.split(/\s+/).filter(w => w.length >= 2);
521
- const results = [];
522
- const seenPages = new Set();
523
-
524
- searchIndex.forEach(item => {
525
- // Check if any word matches
526
- const anyWordMatch = words.some(word => item.content.includes(word));
527
- if (!anyWordMatch) return;
528
-
529
- // Calculate relevance score
530
- let score = 0;
531
- words.forEach(word => {
532
- if (item.content.includes(word)) {
533
- // Title match is worth more
534
- if (item.pageTitle.toLowerCase().includes(word)) score += 10;
535
- if (item.sectionTitle.toLowerCase().includes(word)) score += 5;
536
- // Count occurrences in content
537
- const matches = (item.content.match(new RegExp(word, 'g')) || []).length;
538
- score += matches;
539
- }
540
- });
541
-
542
- // Generate excerpt from keywords
543
- let excerpt = item.contentRaw;
544
- if (excerpt.length > 80) {
545
- // Find first matching word position
546
- const firstWord = words.find(w => item.contentRaw.toLowerCase().includes(w));
547
- if (firstWord) {
548
- const idx = item.contentRaw.toLowerCase().indexOf(firstWord);
549
- const start = Math.max(0, idx - 20);
550
- const end = Math.min(item.contentRaw.length, idx + 60);
551
- excerpt = (start > 0 ? '...' : '') + item.contentRaw.substring(start, end) + (end < item.contentRaw.length ? '...' : '');
552
- } else {
553
- excerpt = item.contentRaw.substring(0, 80) + '...';
554
- }
555
- }
556
-
557
- // Avoid duplicate pages for same section
558
- const key = item.page + '#' + item.anchor;
559
- if (!seenPages.has(key)) {
560
- seenPages.add(key);
561
- results.push({
562
- ...item,
563
- score,
564
- excerpt
565
- });
566
- }
567
- });
568
-
569
- // Sort by score and limit results
570
- return results
571
- .sort((a, b) => b.score - a.score)
572
- .slice(0, 10);
573
- }
574
-
575
- // Escape regex special chars
576
- function escapeRegex(str) {
577
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
578
- }
579
-
580
- // Highlight matches in text
581
- function highlightMatch(text, query) {
582
- const words = query.toLowerCase().split(/\s+/).filter(w => w.length >= 2);
583
- let result = text;
584
- words.forEach(word => {
585
- const regex = new RegExp(`(${escapeRegex(word)})`, 'gi');
586
- result = result.replace(regex, '<mark>$1</mark>');
587
- });
588
- return result;
589
- }
590
-
591
- function renderResults(results, query) {
592
- const lang = getLang();
593
-
594
- if (results.length === 0) {
595
- const emptyMsg = lang === 'fr' ? 'Aucun résultat trouvé' : 'No results found';
596
- searchResults.innerHTML = `<div class="search-results-empty">${emptyMsg}</div>`;
597
- } else {
598
- searchResults.innerHTML = results.map((item, index) => `
599
- <a href="${item.url}" class="search-result-item${index === activeIndex ? ' active' : ''}" data-index="${index}">
600
- <div class="search-result-icon">${item.icon}</div>
601
- <div class="search-result-content">
602
- <div class="search-result-title">${highlightMatch(item.pageTitle, query)}${item.sectionTitle ? ' <span class="search-result-section">› ' + highlightMatch(item.sectionTitle, query) + '</span>' : ''}</div>
603
- <div class="search-result-excerpt">${highlightMatch(item.excerpt, query)}</div>
604
- <div class="search-result-path">${item.url}</div>
605
- </div>
606
- </a>
607
- `).join('');
608
- }
609
-
610
- searchResults.classList.add('visible');
611
- }
612
-
613
- function hideResults() {
614
- searchResults.classList.remove('visible');
615
- activeIndex = -1;
616
- }
617
-
618
- // Input handler with debounce
619
- let debounceTimer;
620
- searchInput.addEventListener('input', function() {
621
- clearTimeout(debounceTimer);
622
- const query = this.value.trim();
623
-
624
- if (query.length >= 2) {
625
- debounceTimer = setTimeout(() => {
626
- const results = search(query);
627
- activeIndex = -1;
628
- renderResults(results, query);
629
- }, 150);
630
- } else {
631
- hideResults();
632
- }
633
- });
634
-
635
- // Keyboard navigation
636
- searchInput.addEventListener('keydown', function(e) {
637
- const items = searchResults.querySelectorAll('.search-result-item');
638
-
639
- if (e.key === 'ArrowDown') {
640
- e.preventDefault();
641
- activeIndex = Math.min(activeIndex + 1, items.length - 1);
642
- updateActiveItem(items);
643
- } else if (e.key === 'ArrowUp') {
644
- e.preventDefault();
645
- activeIndex = Math.max(activeIndex - 1, 0);
646
- updateActiveItem(items);
647
- } else if (e.key === 'Enter') {
648
- e.preventDefault();
649
- if (activeIndex >= 0 && items[activeIndex]) {
650
- window.location.href = items[activeIndex].getAttribute('href');
651
- }
652
- } else if (e.key === 'Escape') {
653
- hideResults();
654
- searchInput.blur();
655
- }
656
- });
657
-
658
- function updateActiveItem(items) {
659
- items.forEach((item, index) => {
660
- item.classList.toggle('active', index === activeIndex);
661
- });
662
-
663
- if (items[activeIndex]) {
664
- items[activeIndex].scrollIntoView({ block: 'nearest' });
665
- }
666
- }
667
-
668
- // Focus handler
669
- searchInput.addEventListener('focus', function() {
670
- if (this.value.length >= 2) {
671
- const results = search(this.value);
672
- renderResults(results, this.value);
673
- }
674
- });
675
-
676
- // Click outside to close
677
- document.addEventListener('click', function(e) {
678
- if (!e.target.closest('.header-search')) {
679
- hideResults();
680
- }
681
- });
682
-
683
- // Keyboard shortcut (Ctrl/Cmd + K)
684
- document.addEventListener('keydown', function(e) {
685
- if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
686
- e.preventDefault();
687
- searchInput.focus();
688
- searchInput.select();
689
- }
690
- });
691
- }
692
-
693
- /* ============================================
694
- COPYABLE COMMANDS (SVG Diagram)
695
- ============================================ */
696
-
697
- function initCopyableCommands() {
698
- const copyableElements = document.querySelectorAll('.cmd-copyable');
699
-
700
- if (copyableElements.length === 0) return;
701
-
702
- // Get current language
703
- function getLang() {
704
- return document.body.classList.contains('lang-en') ? 'en' : 'fr';
705
- }
706
-
707
- // Create floating tooltip for feedback
708
- const tooltip = document.createElement('div');
709
- tooltip.className = 'copy-tooltip';
710
- tooltip.style.cssText = `
711
- position: fixed;
712
- background: #22c55e;
713
- color: white;
714
- padding: 0.5rem 1rem;
715
- border-radius: 6px;
716
- font-size: 0.85rem;
717
- font-weight: 500;
718
- z-index: 10000;
719
- pointer-events: none;
720
- opacity: 0;
721
- transition: opacity 0.2s ease;
722
- box-shadow: 0 4px 12px rgba(0,0,0,0.3);
723
- `;
724
- document.body.appendChild(tooltip);
725
-
726
- copyableElements.forEach(element => {
727
- // Add hover effect
728
- element.addEventListener('mouseenter', function() {
729
- const rect = this.querySelector('rect');
730
- if (rect) {
731
- rect.style.filter = 'brightness(1.2)';
732
- rect.style.transition = 'filter 0.2s ease';
733
- }
734
- });
735
-
736
- element.addEventListener('mouseleave', function() {
737
- const rect = this.querySelector('rect');
738
- if (rect) {
739
- rect.style.filter = '';
740
- }
741
- });
742
-
743
- // Add click handler
744
- element.addEventListener('click', function(e) {
745
- e.stopPropagation();
746
-
747
- const cmd = this.dataset.cmd;
748
- if (!cmd) return;
749
-
750
- // Copy to clipboard
751
- navigator.clipboard.writeText(cmd).then(() => {
752
- // Show tooltip
753
- const lang = getLang();
754
- tooltip.textContent = lang === 'fr' ? '✓ Copié !' : '✓ Copied!';
755
-
756
- // Position tooltip near cursor
757
- tooltip.style.left = e.clientX + 10 + 'px';
758
- tooltip.style.top = e.clientY - 30 + 'px';
759
- tooltip.style.opacity = '1';
760
-
761
- // Flash effect on element
762
- const rect = this.querySelector('rect');
763
- if (rect) {
764
- const originalStroke = rect.getAttribute('stroke');
765
- rect.setAttribute('stroke', '#22c55e');
766
- rect.style.filter = 'brightness(1.4)';
767
-
768
- setTimeout(() => {
769
- rect.setAttribute('stroke', originalStroke);
770
- rect.style.filter = '';
771
- }, 300);
772
- }
773
-
774
- // Hide tooltip after delay
775
- setTimeout(() => {
776
- tooltip.style.opacity = '0';
777
- }, 1500);
778
- }).catch(err => {
779
- console.error('Failed to copy:', err);
780
- const lang = getLang();
781
- tooltip.textContent = lang === 'fr' ? '✗ Erreur' : '✗ Error';
782
- tooltip.style.background = '#ef4444';
783
- tooltip.style.left = e.clientX + 10 + 'px';
784
- tooltip.style.top = e.clientY - 30 + 'px';
785
- tooltip.style.opacity = '1';
786
-
787
- setTimeout(() => {
788
- tooltip.style.opacity = '0';
789
- tooltip.style.background = '#22c55e';
790
- }, 1500);
791
- });
792
- });
793
- });
794
- }
1
+ /* ============================================
2
+ CLAUDE TOOLS DOCUMENTATION - APP
3
+ ============================================ */
4
+
5
+ document.addEventListener('DOMContentLoaded', function() {
6
+ initSidebar();
7
+ initLanguageSwitch();
8
+ initCopyButtons();
9
+ initMobileMenu();
10
+ initSidebarToc();
11
+ initScrollSpy();
12
+ initInteractiveDiagram();
13
+ initSearch();
14
+ initCopyableCommands();
15
+ });
16
+
17
+ /* ============================================
18
+ SIDEBAR
19
+ ============================================ */
20
+
21
+ function initSidebar() {
22
+ const sidebar = document.querySelector('.sidebar');
23
+ const toggle = document.querySelector('.sidebar-toggle');
24
+
25
+ if (!sidebar || !toggle) return;
26
+
27
+ // Load saved state
28
+ const isCollapsed = localStorage.getItem('sidebar-collapsed') === 'true';
29
+ if (isCollapsed) {
30
+ sidebar.classList.add('collapsed');
31
+ }
32
+
33
+ toggle.addEventListener('click', function() {
34
+ sidebar.classList.toggle('collapsed');
35
+ localStorage.setItem('sidebar-collapsed', sidebar.classList.contains('collapsed'));
36
+ });
37
+
38
+ // Set active nav item
39
+ const currentPage = window.location.pathname.split('/').pop() || 'index.html';
40
+ document.querySelectorAll('.nav-item').forEach(item => {
41
+ if (item.getAttribute('href') === currentPage) {
42
+ item.classList.add('active');
43
+ }
44
+ });
45
+ }
46
+
47
+ /* ============================================
48
+ LANGUAGE SWITCH
49
+ ============================================ */
50
+
51
+ function initLanguageSwitch() {
52
+ const langSelect = document.getElementById('lang-select');
53
+
54
+ // Load saved language
55
+ const savedLang = localStorage.getItem('doc-language') || 'fr';
56
+ setLanguage(savedLang);
57
+
58
+ // Set dropdown to saved value
59
+ if (langSelect) {
60
+ langSelect.value = savedLang;
61
+ }
62
+
63
+ // Setup language button handlers (sidebar footer)
64
+ document.querySelectorAll('.lang-btn').forEach(btn => {
65
+ btn.addEventListener('click', function() {
66
+ const lang = this.dataset.lang;
67
+ setLanguage(lang);
68
+ localStorage.setItem('doc-language', lang);
69
+
70
+ // Update active state
71
+ document.querySelectorAll('.lang-btn').forEach(b => b.classList.remove('active'));
72
+ this.classList.add('active');
73
+ });
74
+ });
75
+ }
76
+
77
+ function setLanguage(lang) {
78
+ // Update body class
79
+ document.body.classList.remove('lang-fr', 'lang-en');
80
+ document.body.classList.add('lang-' + lang);
81
+
82
+ // Update dropdown value (if exists)
83
+ const langSelect = document.getElementById('lang-select');
84
+ if (langSelect) {
85
+ langSelect.value = lang;
86
+ }
87
+
88
+ // Update HTML lang attribute
89
+ document.documentElement.lang = lang;
90
+
91
+ // Update search placeholder
92
+ const searchInput = document.getElementById('search-input');
93
+ if (searchInput) {
94
+ const placeholder = lang === 'en' ? searchInput.dataset.placeholderEn : searchInput.dataset.placeholderFr;
95
+ if (placeholder) {
96
+ searchInput.placeholder = placeholder;
97
+ }
98
+ }
99
+ }
100
+
101
+ /* ============================================
102
+ COPY BUTTONS
103
+ ============================================ */
104
+
105
+ function initCopyButtons() {
106
+ document.querySelectorAll('.copy-btn').forEach(btn => {
107
+ btn.addEventListener('click', async function() {
108
+ const code = this.closest('.code-block').querySelector('code').textContent;
109
+
110
+ try {
111
+ await navigator.clipboard.writeText(code);
112
+ const originalText = this.textContent;
113
+ this.textContent = 'Copied!';
114
+ this.style.background = 'var(--success)';
115
+
116
+ setTimeout(() => {
117
+ this.textContent = originalText;
118
+ this.style.background = '';
119
+ }, 2000);
120
+ } catch (err) {
121
+ console.error('Failed to copy:', err);
122
+ }
123
+ });
124
+ });
125
+ }
126
+
127
+ /* ============================================
128
+ MOBILE MENU
129
+ ============================================ */
130
+
131
+ function initMobileMenu() {
132
+ const menuBtn = document.querySelector('.mobile-menu-btn');
133
+ const sidebar = document.querySelector('.sidebar');
134
+ const overlay = document.querySelector('.overlay');
135
+
136
+ if (!menuBtn || !sidebar) return;
137
+
138
+ menuBtn.addEventListener('click', function() {
139
+ sidebar.classList.toggle('open');
140
+ overlay?.classList.toggle('active');
141
+ });
142
+
143
+ overlay?.addEventListener('click', function() {
144
+ sidebar.classList.remove('open');
145
+ overlay.classList.remove('active');
146
+ });
147
+
148
+ // Close on nav item click (mobile)
149
+ document.querySelectorAll('.nav-item').forEach(item => {
150
+ item.addEventListener('click', function() {
151
+ if (window.innerWidth <= 1024) {
152
+ sidebar.classList.remove('open');
153
+ overlay?.classList.remove('active');
154
+ }
155
+ });
156
+ });
157
+ }
158
+
159
+ /* ============================================
160
+ SIDEBAR TABLE OF CONTENTS
161
+ ============================================ */
162
+
163
+ function initSidebarToc() {
164
+ const sidebarToc = document.querySelector('.sidebar-toc');
165
+ const tocToggle = document.querySelector('.toc-toggle');
166
+
167
+ if (!sidebarToc) return;
168
+
169
+ // Auto-open TOC on current page
170
+ sidebarToc.classList.add('open');
171
+ if (tocToggle) tocToggle.classList.add('open');
172
+
173
+ // Toggle handler
174
+ if (tocToggle) {
175
+ tocToggle.addEventListener('click', function(e) {
176
+ e.preventDefault();
177
+ e.stopPropagation();
178
+ sidebarToc.classList.toggle('open');
179
+ tocToggle.classList.toggle('open');
180
+ });
181
+ }
182
+
183
+ // Smooth scroll for sidebar TOC links
184
+ document.querySelectorAll('.sidebar-toc-link').forEach(link => {
185
+ link.addEventListener('click', function(e) {
186
+ e.preventDefault();
187
+ const targetId = this.getAttribute('href');
188
+ const target = document.querySelector(targetId);
189
+ if (target) {
190
+ target.scrollIntoView({ behavior: 'smooth', block: 'start' });
191
+ // Update active state immediately
192
+ document.querySelectorAll('.sidebar-toc-link').forEach(l => l.classList.remove('active'));
193
+ this.classList.add('active');
194
+ }
195
+ });
196
+ });
197
+ }
198
+
199
+ /* ============================================
200
+ SCROLL SPY
201
+ ============================================ */
202
+
203
+ function initScrollSpy() {
204
+ const headings = document.querySelectorAll('h2[id], h3[id]');
205
+ const sidebarTocLinks = document.querySelectorAll('.sidebar-toc-link');
206
+
207
+ if (!headings.length || !sidebarTocLinks.length) return;
208
+
209
+ const observer = new IntersectionObserver(entries => {
210
+ entries.forEach(entry => {
211
+ if (entry.isIntersecting) {
212
+ const id = entry.target.id;
213
+ sidebarTocLinks.forEach(link => {
214
+ link.classList.toggle('active', link.getAttribute('href') === '#' + id);
215
+ });
216
+ }
217
+ });
218
+ }, { rootMargin: '-20% 0px -80% 0px' });
219
+
220
+ headings.forEach(heading => observer.observe(heading));
221
+ }
222
+
223
+ /* ============================================
224
+ UTILITIES
225
+ ============================================ */
226
+
227
+ // Smooth scroll for anchor links
228
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
229
+ anchor.addEventListener('click', function(e) {
230
+ e.preventDefault();
231
+ const target = document.querySelector(this.getAttribute('href'));
232
+ if (target) {
233
+ target.scrollIntoView({ behavior: 'smooth', block: 'start' });
234
+ }
235
+ });
236
+ });
237
+
238
+ // Add animation class on scroll
239
+ const observerOptions = {
240
+ threshold: 0.1,
241
+ rootMargin: '0px 0px -50px 0px'
242
+ };
243
+
244
+ const fadeObserver = new IntersectionObserver((entries) => {
245
+ entries.forEach(entry => {
246
+ if (entry.isIntersecting) {
247
+ entry.target.classList.add('fade-in');
248
+ fadeObserver.unobserve(entry.target);
249
+ }
250
+ });
251
+ }, observerOptions);
252
+
253
+ document.querySelectorAll('.card, .alert, .best-practice').forEach(el => {
254
+ fadeObserver.observe(el);
255
+ });
256
+
257
+ /* ============================================
258
+ INTERACTIVE DIAGRAM
259
+ ============================================ */
260
+
261
+ function initInteractiveDiagram() {
262
+ const diagram = document.getElementById('gitflow-diagram');
263
+ const tooltip = document.getElementById('diagram-tooltip');
264
+
265
+ if (!diagram || !tooltip) return;
266
+
267
+ const clickableElements = diagram.querySelectorAll('.clickable-element');
268
+ let activeElement = null;
269
+
270
+ // Get current language
271
+ function getLang() {
272
+ return document.body.classList.contains('lang-en') ? 'en' : 'fr';
273
+ }
274
+
275
+ // Show tooltip for an element
276
+ function showTooltip(element, event) {
277
+ const lang = getLang();
278
+ const title = element.dataset['title' + lang.charAt(0).toUpperCase() + lang.slice(1)] || element.dataset.titleFr;
279
+ const desc = element.dataset['desc' + lang.charAt(0).toUpperCase() + lang.slice(1)] || element.dataset.descFr;
280
+ const cmd = element.dataset.cmd || '';
281
+
282
+ // Set tooltip content
283
+ tooltip.querySelector('.tooltip-title').textContent = title;
284
+ tooltip.querySelector('.tooltip-desc').textContent = desc;
285
+
286
+ const cmdElement = tooltip.querySelector('.tooltip-cmd');
287
+ if (cmd) {
288
+ cmdElement.textContent = cmd;
289
+ cmdElement.style.display = 'inline-block';
290
+ } else {
291
+ cmdElement.style.display = 'none';
292
+ }
293
+
294
+ // Position tooltip
295
+ const diagramRect = diagram.getBoundingClientRect();
296
+ const svgRect = diagram.querySelector('svg').getBoundingClientRect();
297
+
298
+ // Calculate position relative to the diagram
299
+ let left = event.clientX - diagramRect.left + 15;
300
+ let top = event.clientY - diagramRect.top + 15;
301
+
302
+ // Make tooltip visible to measure it
303
+ tooltip.style.left = left + 'px';
304
+ tooltip.style.top = top + 'px';
305
+ tooltip.classList.add('visible');
306
+
307
+ // Adjust if overflowing right edge
308
+ const tooltipRect = tooltip.getBoundingClientRect();
309
+ if (tooltipRect.right > diagramRect.right - 10) {
310
+ left = event.clientX - diagramRect.left - tooltipRect.width - 15;
311
+ tooltip.style.left = left + 'px';
312
+ }
313
+
314
+ // Adjust if overflowing bottom edge
315
+ if (tooltipRect.bottom > window.innerHeight - 10) {
316
+ top = event.clientY - diagramRect.top - tooltipRect.height - 15;
317
+ tooltip.style.top = top + 'px';
318
+ }
319
+
320
+ // Mark element as active
321
+ if (activeElement) {
322
+ activeElement.classList.remove('active');
323
+ }
324
+ element.classList.add('active');
325
+ activeElement = element;
326
+ }
327
+
328
+ // Hide tooltip
329
+ function hideTooltip() {
330
+ tooltip.classList.remove('visible');
331
+ if (activeElement) {
332
+ activeElement.classList.remove('active');
333
+ activeElement = null;
334
+ }
335
+ }
336
+
337
+ // Add click handlers to clickable elements
338
+ clickableElements.forEach(element => {
339
+ element.addEventListener('click', function(e) {
340
+ e.stopPropagation();
341
+
342
+ // If clicking the same element, toggle off
343
+ if (activeElement === this) {
344
+ hideTooltip();
345
+ } else {
346
+ showTooltip(this, e);
347
+ }
348
+ });
349
+ });
350
+
351
+ // Close tooltip when clicking outside
352
+ document.addEventListener('click', function(e) {
353
+ if (!diagram.contains(e.target) || (!e.target.closest('.clickable-element') && !e.target.closest('.diagram-tooltip'))) {
354
+ hideTooltip();
355
+ }
356
+ });
357
+
358
+ // Close on escape key
359
+ document.addEventListener('keydown', function(e) {
360
+ if (e.key === 'Escape') {
361
+ hideTooltip();
362
+ }
363
+ });
364
+
365
+ // Update tooltip language when language changes
366
+ const langSelect = document.getElementById('lang-select');
367
+ if (langSelect) {
368
+ langSelect.addEventListener('change', function() {
369
+ if (activeElement && tooltip.classList.contains('visible')) {
370
+ // Re-show tooltip with new language
371
+ const event = { clientX: parseFloat(tooltip.style.left) + diagram.getBoundingClientRect().left,
372
+ clientY: parseFloat(tooltip.style.top) + diagram.getBoundingClientRect().top };
373
+ setTimeout(() => showTooltip(activeElement, event), 50);
374
+ }
375
+ });
376
+ }
377
+ }
378
+
379
+ /* ============================================
380
+ SEARCH (Full-Text with Static Fallback)
381
+ ============================================ */
382
+
383
+ function initSearch() {
384
+ const searchInput = document.getElementById('search-input');
385
+ const searchResults = document.getElementById('search-results');
386
+
387
+ if (!searchInput || !searchResults) return;
388
+
389
+ // Static search index (works without server, file:// protocol)
390
+ const staticIndex = [
391
+ // Index - Accueil
392
+ { page: 'index.html', icon: '🏠', title: { fr: 'Accueil', en: 'Home' }, section: '', anchor: '',
393
+ keywords: 'accueil home documentation claude tools atlashub cli automatisation gitflow apex ef core migration hooks agents commandes installation npm' },
394
+
395
+ // Installation
396
+ { page: 'installation.html', icon: '📦', title: { fr: 'Installation', en: 'Installation' }, section: '', anchor: '',
397
+ keywords: 'installation install npm registry nodejs node prérequis requirements setup configuration package global' },
398
+ { page: 'installation.html', icon: '📦', title: { fr: 'Installation', en: 'Installation' }, section: { fr: 'Prérequis', en: 'Prerequisites' }, anchor: 'prerequisites',
399
+ keywords: 'prérequis prerequisites nodejs node version 18 npm git' },
400
+ { page: 'installation.html', icon: '📦', title: { fr: 'Installation', en: 'Installation' }, section: { fr: 'Installation globale', en: 'Global Installation' }, anchor: 'global-install',
401
+ keywords: 'npm install global atlashub claude-tools registry package' },
402
+
403
+ // GitFlow
404
+ { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: '', anchor: '',
405
+ keywords: 'gitflow git workflow branch branche feature release hotfix develop main master merge fusion version semver' },
406
+ { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Branches principales', en: 'Main Branches' }, anchor: 'main-branches',
407
+ keywords: 'main master develop development production branches principales' },
408
+ { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Feature branches', en: 'Feature branches' }, anchor: 'feature',
409
+ keywords: 'feature branch nouvelle fonctionnalité develop merge création git checkout' },
410
+ { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Release branches', en: 'Release branches' }, anchor: 'release',
411
+ keywords: 'release branch version livraison production tag semver minor major patch' },
412
+ { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Hotfix branches', en: 'Hotfix branches' }, anchor: 'hotfix',
413
+ keywords: 'hotfix branch correction bug urgent production patch fix' },
414
+ { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Commandes', en: 'Commands' }, anchor: 'commands',
415
+ keywords: 'commandes commands gitflow init start finish status plan exec commit abort' },
416
+ { page: 'gitflow.html', icon: '🔀', title: { fr: 'GitFlow', en: 'GitFlow' }, section: { fr: 'Versioning SemVer', en: 'SemVer Versioning' }, anchor: 'semver',
417
+ keywords: 'semver semantic versioning version major minor patch auto increment package.json' },
418
+
419
+ // EF Core
420
+ { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: '', anchor: '',
421
+ keywords: 'ef core entity framework migration database dotnet .net sql model orm microsoft' },
422
+ { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: { fr: 'Structure des migrations', en: 'Migration Structure' }, anchor: 'structure',
423
+ keywords: 'migration structure fichier file timestamp designer snapshot model context dbcontext' },
424
+ { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: { fr: 'Conflits', en: 'Conflicts' }, anchor: 'conflicts',
425
+ keywords: 'conflit conflict merge migration snapshot résolution resolution gitflow' },
426
+ { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: { fr: 'Bonnes pratiques', en: 'Best Practices' }, anchor: 'best-practices',
427
+ keywords: 'bonnes pratiques best practices migration naming convention idempotent script sql' },
428
+ { page: 'efcore.html', icon: '📄', title: { fr: 'EF Core', en: 'EF Core' }, section: { fr: 'Commandes', en: 'Commands' }, anchor: 'commands',
429
+ keywords: 'commandes commands dotnet ef migrations add remove update database script' },
430
+
431
+ // APEX
432
+ { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: '', anchor: '',
433
+ keywords: 'apex methodology méthodologie analyze plan execute examine implementation implémentation workflow' },
434
+ { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: { fr: 'Analyze', en: 'Analyze' }, anchor: 'analyze',
435
+ keywords: 'analyze analyse context contexte codebase exploration recherche understanding' },
436
+ { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: { fr: 'Plan', en: 'Plan' }, anchor: 'plan',
437
+ keywords: 'plan planning planification strategy stratégie architecture design conception' },
438
+ { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: { fr: 'Execute', en: 'Execute' }, anchor: 'execute',
439
+ keywords: 'execute exécution implementation implémentation code coding développement development' },
440
+ { page: 'apex.html', icon: '🎯', title: { fr: 'APEX', en: 'APEX' }, section: { fr: 'Examine', en: 'Examine' }, anchor: 'examine',
441
+ keywords: 'examine test testing validation vérification review revue quality qualité' },
442
+
443
+ // Business Analyse
444
+ { page: 'business-analyse.html', icon: '📊', title: { fr: 'Business Analyse', en: 'Business Analyse' }, section: '', anchor: '',
445
+ keywords: 'business analyse analysis specification brd frd requirements exigences babok' },
446
+ { page: 'business-analyse.html', icon: '📊', title: { fr: 'Business Analyse', en: 'Business Analyse' }, section: { fr: 'Discovery', en: 'Discovery' }, anchor: 'phase-2',
447
+ keywords: 'discover discovery questionnaire questions adaptatives ultrathink elicitation' },
448
+ { page: 'business-analyse.html', icon: '📊', title: { fr: 'Business Analyse', en: 'Business Analyse' }, section: { fr: 'Specification', en: 'Specification' }, anchor: 'phase-4',
449
+ keywords: 'specify specification frd use cases wireframes gherkin acceptance criteria' },
450
+ { page: 'business-analyse.html', icon: '📊', title: { fr: 'Business Analyse', en: 'Business Analyse' }, section: { fr: 'Handoff', en: 'Handoff' }, anchor: 'phase-6',
451
+ keywords: 'handoff dev prompt developer implementation autonome autonomous' },
452
+
453
+ // Agents
454
+ { page: 'agents.html', icon: '🤖', title: { fr: 'Agents', en: 'Agents' }, section: '', anchor: '',
455
+ keywords: 'agents subagent task tool automation automatisation ai ia claude specialized spécialisé' },
456
+ { page: 'agents.html', icon: '🤖', title: { fr: 'Agents', en: 'Agents' }, section: { fr: 'GitFlow Agents', en: 'GitFlow Agents' }, anchor: 'gitflow-agents',
457
+ keywords: 'gitflow agents plan exec commit status abort rollback recovery' },
458
+ { page: 'agents.html', icon: '🤖', title: { fr: 'Agents', en: 'Agents' }, section: { fr: 'Explore Agent', en: 'Explore Agent' }, anchor: 'explore',
459
+ keywords: 'explore agent codebase search recherche exploration quick thorough' },
460
+
461
+ // Commands
462
+ { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: '', anchor: '',
463
+ keywords: 'commandes commands slash cli terminal prompt gitflow apex commit review deploy' },
464
+ { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: { fr: 'GitFlow Commands', en: 'GitFlow Commands' }, anchor: 'gitflow-commands',
465
+ keywords: 'gitflow commands init start finish status commit plan exec' },
466
+ { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: { fr: 'APEX Commands', en: 'APEX Commands' }, anchor: 'apex-commands',
467
+ keywords: 'apex commands analyze plan execute examine quick' },
468
+ { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: { fr: 'Commit', en: 'Commit' }, anchor: 'commit',
469
+ keywords: 'commit git message conventional commits push' },
470
+ { page: 'commands.html', icon: '⚡', title: { fr: 'Commandes', en: 'Commands' }, section: { fr: 'Deploy', en: 'Deploy' }, anchor: 'deploy',
471
+ keywords: 'deploy deployment déploiement build test lint push production' },
472
+
473
+ // Hooks
474
+ { page: 'hooks.html', icon: '🔗', title: { fr: 'Hooks', en: 'Hooks' }, section: '', anchor: '',
475
+ keywords: 'hooks pre-commit post-commit validation automation automatisation script event événement' },
476
+ { page: 'hooks.html', icon: '🔗', title: { fr: 'Hooks', en: 'Hooks' }, section: { fr: 'Types de hooks', en: 'Hook Types' }, anchor: 'types',
477
+ keywords: 'types hooks PreToolUse PostToolUse Stop SessionStart UserPromptSubmit' },
478
+ { page: 'hooks.html', icon: '🔗', title: { fr: 'Hooks', en: 'Hooks' }, section: { fr: 'Configuration', en: 'Configuration' }, anchor: 'configuration',
479
+ keywords: 'configuration hooks settings.json matcher command timeout' }
480
+ ];
481
+
482
+ let searchIndex = null;
483
+ let activeIndex = -1;
484
+
485
+ function getLang() {
486
+ return document.body.classList.contains('lang-en') ? 'en' : 'fr';
487
+ }
488
+
489
+ // Build search index from static data
490
+ function buildIndex() {
491
+ const lang = getLang();
492
+
493
+ return staticIndex.map(item => {
494
+ const pageTitle = typeof item.title === 'object' ? item.title[lang] : item.title;
495
+ const sectionTitle = typeof item.section === 'object' ? item.section[lang] : item.section;
496
+
497
+ return {
498
+ page: item.page,
499
+ pageTitle: pageTitle,
500
+ icon: item.icon,
501
+ sectionTitle: sectionTitle || '',
502
+ content: (pageTitle + ' ' + sectionTitle + ' ' + item.keywords).toLowerCase(),
503
+ contentRaw: item.keywords,
504
+ anchor: item.anchor,
505
+ url: item.anchor ? `${item.page}#${item.anchor}` : item.page
506
+ };
507
+ });
508
+ }
509
+
510
+ // Search through index
511
+ function search(query) {
512
+ if (!query || query.length < 2) return [];
513
+
514
+ // Build index if not ready
515
+ if (!searchIndex) {
516
+ searchIndex = buildIndex();
517
+ }
518
+
519
+ const normalizedQuery = query.toLowerCase().trim();
520
+ const words = normalizedQuery.split(/\s+/).filter(w => w.length >= 2);
521
+ const results = [];
522
+ const seenPages = new Set();
523
+
524
+ searchIndex.forEach(item => {
525
+ // Check if any word matches
526
+ const anyWordMatch = words.some(word => item.content.includes(word));
527
+ if (!anyWordMatch) return;
528
+
529
+ // Calculate relevance score
530
+ let score = 0;
531
+ words.forEach(word => {
532
+ if (item.content.includes(word)) {
533
+ // Title match is worth more
534
+ if (item.pageTitle.toLowerCase().includes(word)) score += 10;
535
+ if (item.sectionTitle.toLowerCase().includes(word)) score += 5;
536
+ // Count occurrences in content
537
+ const matches = (item.content.match(new RegExp(word, 'g')) || []).length;
538
+ score += matches;
539
+ }
540
+ });
541
+
542
+ // Generate excerpt from keywords
543
+ let excerpt = item.contentRaw;
544
+ if (excerpt.length > 80) {
545
+ // Find first matching word position
546
+ const firstWord = words.find(w => item.contentRaw.toLowerCase().includes(w));
547
+ if (firstWord) {
548
+ const idx = item.contentRaw.toLowerCase().indexOf(firstWord);
549
+ const start = Math.max(0, idx - 20);
550
+ const end = Math.min(item.contentRaw.length, idx + 60);
551
+ excerpt = (start > 0 ? '...' : '') + item.contentRaw.substring(start, end) + (end < item.contentRaw.length ? '...' : '');
552
+ } else {
553
+ excerpt = item.contentRaw.substring(0, 80) + '...';
554
+ }
555
+ }
556
+
557
+ // Avoid duplicate pages for same section
558
+ const key = item.page + '#' + item.anchor;
559
+ if (!seenPages.has(key)) {
560
+ seenPages.add(key);
561
+ results.push({
562
+ ...item,
563
+ score,
564
+ excerpt
565
+ });
566
+ }
567
+ });
568
+
569
+ // Sort by score and limit results
570
+ return results
571
+ .sort((a, b) => b.score - a.score)
572
+ .slice(0, 10);
573
+ }
574
+
575
+ // Escape regex special chars
576
+ function escapeRegex(str) {
577
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
578
+ }
579
+
580
+ // Highlight matches in text
581
+ function highlightMatch(text, query) {
582
+ const words = query.toLowerCase().split(/\s+/).filter(w => w.length >= 2);
583
+ let result = text;
584
+ words.forEach(word => {
585
+ const regex = new RegExp(`(${escapeRegex(word)})`, 'gi');
586
+ result = result.replace(regex, '<mark>$1</mark>');
587
+ });
588
+ return result;
589
+ }
590
+
591
+ function renderResults(results, query) {
592
+ const lang = getLang();
593
+
594
+ if (results.length === 0) {
595
+ const emptyMsg = lang === 'fr' ? 'Aucun résultat trouvé' : 'No results found';
596
+ searchResults.innerHTML = `<div class="search-results-empty">${emptyMsg}</div>`;
597
+ } else {
598
+ searchResults.innerHTML = results.map((item, index) => `
599
+ <a href="${item.url}" class="search-result-item${index === activeIndex ? ' active' : ''}" data-index="${index}">
600
+ <div class="search-result-icon">${item.icon}</div>
601
+ <div class="search-result-content">
602
+ <div class="search-result-title">${highlightMatch(item.pageTitle, query)}${item.sectionTitle ? ' <span class="search-result-section">› ' + highlightMatch(item.sectionTitle, query) + '</span>' : ''}</div>
603
+ <div class="search-result-excerpt">${highlightMatch(item.excerpt, query)}</div>
604
+ <div class="search-result-path">${item.url}</div>
605
+ </div>
606
+ </a>
607
+ `).join('');
608
+ }
609
+
610
+ searchResults.classList.add('visible');
611
+ }
612
+
613
+ function hideResults() {
614
+ searchResults.classList.remove('visible');
615
+ activeIndex = -1;
616
+ }
617
+
618
+ // Input handler with debounce
619
+ let debounceTimer;
620
+ searchInput.addEventListener('input', function() {
621
+ clearTimeout(debounceTimer);
622
+ const query = this.value.trim();
623
+
624
+ if (query.length >= 2) {
625
+ debounceTimer = setTimeout(() => {
626
+ const results = search(query);
627
+ activeIndex = -1;
628
+ renderResults(results, query);
629
+ }, 150);
630
+ } else {
631
+ hideResults();
632
+ }
633
+ });
634
+
635
+ // Keyboard navigation
636
+ searchInput.addEventListener('keydown', function(e) {
637
+ const items = searchResults.querySelectorAll('.search-result-item');
638
+
639
+ if (e.key === 'ArrowDown') {
640
+ e.preventDefault();
641
+ activeIndex = Math.min(activeIndex + 1, items.length - 1);
642
+ updateActiveItem(items);
643
+ } else if (e.key === 'ArrowUp') {
644
+ e.preventDefault();
645
+ activeIndex = Math.max(activeIndex - 1, 0);
646
+ updateActiveItem(items);
647
+ } else if (e.key === 'Enter') {
648
+ e.preventDefault();
649
+ if (activeIndex >= 0 && items[activeIndex]) {
650
+ window.location.href = items[activeIndex].getAttribute('href');
651
+ }
652
+ } else if (e.key === 'Escape') {
653
+ hideResults();
654
+ searchInput.blur();
655
+ }
656
+ });
657
+
658
+ function updateActiveItem(items) {
659
+ items.forEach((item, index) => {
660
+ item.classList.toggle('active', index === activeIndex);
661
+ });
662
+
663
+ if (items[activeIndex]) {
664
+ items[activeIndex].scrollIntoView({ block: 'nearest' });
665
+ }
666
+ }
667
+
668
+ // Focus handler
669
+ searchInput.addEventListener('focus', function() {
670
+ if (this.value.length >= 2) {
671
+ const results = search(this.value);
672
+ renderResults(results, this.value);
673
+ }
674
+ });
675
+
676
+ // Click outside to close
677
+ document.addEventListener('click', function(e) {
678
+ if (!e.target.closest('.header-search')) {
679
+ hideResults();
680
+ }
681
+ });
682
+
683
+ // Keyboard shortcut (Ctrl/Cmd + K)
684
+ document.addEventListener('keydown', function(e) {
685
+ if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
686
+ e.preventDefault();
687
+ searchInput.focus();
688
+ searchInput.select();
689
+ }
690
+ });
691
+ }
692
+
693
+ /* ============================================
694
+ COPYABLE COMMANDS (SVG Diagram)
695
+ ============================================ */
696
+
697
+ function initCopyableCommands() {
698
+ const copyableElements = document.querySelectorAll('.cmd-copyable');
699
+
700
+ if (copyableElements.length === 0) return;
701
+
702
+ // Get current language
703
+ function getLang() {
704
+ return document.body.classList.contains('lang-en') ? 'en' : 'fr';
705
+ }
706
+
707
+ // Create floating tooltip for feedback
708
+ const tooltip = document.createElement('div');
709
+ tooltip.className = 'copy-tooltip';
710
+ tooltip.style.cssText = `
711
+ position: fixed;
712
+ background: #22c55e;
713
+ color: white;
714
+ padding: 0.5rem 1rem;
715
+ border-radius: 6px;
716
+ font-size: 0.85rem;
717
+ font-weight: 500;
718
+ z-index: 10000;
719
+ pointer-events: none;
720
+ opacity: 0;
721
+ transition: opacity 0.2s ease;
722
+ box-shadow: 0 4px 12px rgba(0,0,0,0.3);
723
+ `;
724
+ document.body.appendChild(tooltip);
725
+
726
+ copyableElements.forEach(element => {
727
+ // Add hover effect
728
+ element.addEventListener('mouseenter', function() {
729
+ const rect = this.querySelector('rect');
730
+ if (rect) {
731
+ rect.style.filter = 'brightness(1.2)';
732
+ rect.style.transition = 'filter 0.2s ease';
733
+ }
734
+ });
735
+
736
+ element.addEventListener('mouseleave', function() {
737
+ const rect = this.querySelector('rect');
738
+ if (rect) {
739
+ rect.style.filter = '';
740
+ }
741
+ });
742
+
743
+ // Add click handler
744
+ element.addEventListener('click', function(e) {
745
+ e.stopPropagation();
746
+
747
+ const cmd = this.dataset.cmd;
748
+ if (!cmd) return;
749
+
750
+ // Copy to clipboard
751
+ navigator.clipboard.writeText(cmd).then(() => {
752
+ // Show tooltip
753
+ const lang = getLang();
754
+ tooltip.textContent = lang === 'fr' ? '✓ Copié !' : '✓ Copied!';
755
+
756
+ // Position tooltip near cursor
757
+ tooltip.style.left = e.clientX + 10 + 'px';
758
+ tooltip.style.top = e.clientY - 30 + 'px';
759
+ tooltip.style.opacity = '1';
760
+
761
+ // Flash effect on element
762
+ const rect = this.querySelector('rect');
763
+ if (rect) {
764
+ const originalStroke = rect.getAttribute('stroke');
765
+ rect.setAttribute('stroke', '#22c55e');
766
+ rect.style.filter = 'brightness(1.4)';
767
+
768
+ setTimeout(() => {
769
+ rect.setAttribute('stroke', originalStroke);
770
+ rect.style.filter = '';
771
+ }, 300);
772
+ }
773
+
774
+ // Hide tooltip after delay
775
+ setTimeout(() => {
776
+ tooltip.style.opacity = '0';
777
+ }, 1500);
778
+ }).catch(err => {
779
+ console.error('Failed to copy:', err);
780
+ const lang = getLang();
781
+ tooltip.textContent = lang === 'fr' ? '✗ Erreur' : '✗ Error';
782
+ tooltip.style.background = '#ef4444';
783
+ tooltip.style.left = e.clientX + 10 + 'px';
784
+ tooltip.style.top = e.clientY - 30 + 'px';
785
+ tooltip.style.opacity = '1';
786
+
787
+ setTimeout(() => {
788
+ tooltip.style.opacity = '0';
789
+ tooltip.style.background = '#22c55e';
790
+ }, 1500);
791
+ });
792
+ });
793
+ });
794
+ }