lightview 1.8.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/workflows/daisyui-component-migration.md +155 -0
- package/.codacy/cli.sh +149 -0
- package/.codacy/codacy.yaml +15 -0
- package/.github/instructions/codacy.instructions.md +72 -0
- package/.wranglerignore +21 -0
- package/README.md +1330 -19
- package/_headers +4 -0
- package/build.js +70 -0
- package/components/actions/button.js +151 -0
- package/components/actions/dropdown.js +120 -0
- package/components/actions/modal.js +146 -0
- package/components/actions/swap.js +118 -0
- package/components/daisyui.js +288 -0
- package/components/data-display/accordion.js +128 -0
- package/components/data-display/alert.js +112 -0
- package/components/data-display/avatar.js +170 -0
- package/components/data-display/badge.js +82 -0
- package/components/data-display/card.js +151 -0
- package/components/data-display/carousel.js +94 -0
- package/components/data-display/chart.js +220 -0
- package/components/data-display/chat.js +128 -0
- package/components/data-display/collapse.js +103 -0
- package/components/data-display/countdown.js +69 -0
- package/components/data-display/diff.js +111 -0
- package/components/data-display/kbd.js +65 -0
- package/components/data-display/loading.js +75 -0
- package/components/data-display/progress.js +79 -0
- package/components/data-display/radial-progress.js +88 -0
- package/components/data-display/skeleton.js +66 -0
- package/components/data-display/stats.js +159 -0
- package/components/data-display/table.js +146 -0
- package/components/data-display/timeline.js +146 -0
- package/components/data-display/toast.js +72 -0
- package/components/data-display/tooltip.js +74 -0
- package/components/data-input/checkbox.js +253 -0
- package/components/data-input/file-input.js +224 -0
- package/components/data-input/input.js +264 -0
- package/components/data-input/radio.js +338 -0
- package/components/data-input/range.js +204 -0
- package/components/data-input/rating.js +219 -0
- package/components/data-input/select.js +287 -0
- package/components/data-input/textarea.js +287 -0
- package/components/data-input/toggle.js +201 -0
- package/components/index.js +137 -0
- package/components/layout/divider.js +72 -0
- package/components/layout/drawer.js +142 -0
- package/components/layout/footer.js +100 -0
- package/components/layout/hero.js +109 -0
- package/components/layout/indicator.js +90 -0
- package/components/layout/join.js +78 -0
- package/components/layout/navbar.js +110 -0
- package/components/navigation/breadcrumbs.js +91 -0
- package/components/navigation/dock.js +103 -0
- package/components/navigation/menu.js +126 -0
- package/components/navigation/pagination.js +105 -0
- package/components/navigation/steps.js +89 -0
- package/components/navigation/tabs.css +177 -0
- package/components/navigation/tabs.js +123 -0
- package/components/theme/theme-switch.css +65 -0
- package/components/theme/theme-switch.js +177 -0
- package/docs/about.html +164 -0
- package/docs/api/computed.html +184 -0
- package/docs/api/effects.html +173 -0
- package/docs/api/elements.html +180 -0
- package/docs/api/enhance.html +225 -0
- package/docs/api/hypermedia.html +165 -0
- package/docs/api/index.html +178 -0
- package/docs/api/nav.html +18 -0
- package/docs/api/signals.html +136 -0
- package/docs/api/state.html +217 -0
- package/docs/assets/images/logo-favicon.svg +42 -0
- package/docs/assets/images/logo-static.svg +40 -0
- package/docs/assets/images/logo.svg +66 -0
- package/docs/assets/js/examplify.js +395 -0
- package/docs/assets/styles/site.css +1102 -0
- package/docs/assets/styles/themes.css +236 -0
- package/docs/components/accordion.html +439 -0
- package/docs/components/alert.html +528 -0
- package/docs/components/avatar.html +586 -0
- package/docs/components/badge.html +531 -0
- package/docs/components/breadcrumbs.html +278 -0
- package/docs/components/button.html +579 -0
- package/docs/components/card.html +561 -0
- package/docs/components/carousel.html +286 -0
- package/docs/components/chart-area.html +702 -0
- package/docs/components/chart-bar.html +782 -0
- package/docs/components/chart-column.html +735 -0
- package/docs/components/chart-line.html +794 -0
- package/docs/components/chart-pie.html +823 -0
- package/docs/components/chart.html +610 -15
- package/docs/components/chat.html +547 -0
- package/docs/components/checkbox.html +641 -0
- package/docs/components/collapse.html +536 -0
- package/docs/components/component-nav.html +53 -0
- package/docs/components/countdown.html +470 -0
- package/docs/components/diff.html +245 -0
- package/docs/components/divider.html +240 -0
- package/docs/components/dock.html +277 -0
- package/docs/components/drawer.html +515 -0
- package/docs/components/dropdown.html +479 -0
- package/docs/components/file-input.html +591 -0
- package/docs/components/footer.html +301 -0
- package/docs/components/gallery.html +504 -0
- package/docs/components/hero.html +264 -0
- package/docs/components/index.css +840 -0
- package/docs/components/index.html +735 -0
- package/docs/components/indicator.html +342 -0
- package/docs/components/input.html +644 -0
- package/docs/components/join.html +285 -0
- package/docs/components/kbd.html +322 -0
- package/docs/components/loading.html +521 -0
- package/docs/components/menu.html +461 -0
- package/docs/components/modal.html +639 -0
- package/docs/components/navbar.html +321 -0
- package/docs/components/pagination.html +279 -0
- package/docs/components/progress.html +514 -0
- package/docs/components/radial-progress.html +434 -0
- package/docs/components/radio.html +655 -0
- package/docs/components/range.html +611 -0
- package/docs/components/rating.html +642 -0
- package/docs/components/select.html +696 -0
- package/docs/components/sidebar-setup.js +93 -0
- package/docs/components/skeleton.html +447 -0
- package/docs/components/spinner.html +68 -0
- package/docs/components/stats.html +486 -0
- package/docs/components/steps.html +356 -0
- package/docs/components/swap.html +517 -0
- package/docs/components/switch.html +68 -0
- package/docs/components/table.html +668 -0
- package/docs/components/tabs.html +506 -0
- package/docs/components/text-input.html +68 -0
- package/docs/components/textarea.html +603 -0
- package/docs/components/timeline.html +485 -42
- package/docs/components/toast.html +474 -0
- package/docs/components/toggle.html +564 -0
- package/docs/components/tooltip.html +423 -0
- package/docs/examples/getting-started-example.html +40 -0
- package/docs/examples/index.html +93 -0
- package/docs/getting-started/index.html +739 -0
- package/docs/getting-started/reviews.html +23 -0
- package/docs/getting-started/reviews.odom +108 -0
- package/docs/getting-started/reviews.vdom +84 -0
- package/docs/index.html +132 -42
- package/docs/playground.html +416 -0
- package/docs/router.html +285 -0
- package/docs/styles/index.html +190 -0
- package/functions/_middleware.js +32 -0
- package/index.html +309 -0
- package/lightview-router.js +364 -0
- package/lightview-x.js +1577 -0
- package/lightview.js +659 -1200
- package/lightview.js.backup +793 -0
- package/middleware/locale.js +25 -0
- package/middleware/markdown.js +44 -0
- package/middleware/notFound.js +37 -0
- package/package.json +27 -41
- package/watch.js +92 -0
- package/wrangler.toml +12 -0
- package/.idea/lightview.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/LICENSE +0 -21
- package/codepen-no-tabs-embed.css +0 -2
- package/docs/CNAME +0 -1
- package/docs/api.html +0 -674
- package/docs/blank.html +0 -10
- package/docs/comparedto.html +0 -89
- package/docs/components/chart-repl.html +0 -69
- package/docs/components/components.js +0 -113
- package/docs/components/contents.html +0 -17
- package/docs/components/gantt-repl.html +0 -61
- package/docs/components/gantt.html +0 -42
- package/docs/components/gauge-repl.html +0 -66
- package/docs/components/gauge.html +0 -20
- package/docs/components/orgchart-repl.html +0 -64
- package/docs/components/orgchart.html +0 -41
- package/docs/components/repl-as-src.html +0 -17
- package/docs/components/repl-repl.html +0 -95
- package/docs/components/repl.html +0 -527
- package/docs/components/timeline-repl.html +0 -72
- package/docs/components.html +0 -14
- package/docs/css/highlightjs.min.css +0 -9
- package/docs/css/tutorial.css +0 -35
- package/docs/examples/anchor.html +0 -11
- package/docs/examples/chart.html +0 -34
- package/docs/examples/counter.html +0 -26
- package/docs/examples/counter.test.mjs +0 -47
- package/docs/examples/counter2.html +0 -26
- package/docs/examples/directives.html +0 -79
- package/docs/examples/foreign.html +0 -50
- package/docs/examples/forgeinform.html +0 -98
- package/docs/examples/form.html +0 -61
- package/docs/examples/gauge.html +0 -18
- package/docs/examples/invalid-template-literals.html +0 -44
- package/docs/examples/medium/remote.html +0 -60
- package/docs/examples/message.html +0 -18
- package/docs/examples/nested.html +0 -11
- package/docs/examples/object-bound-form.html +0 -34
- package/docs/examples/remote-server.js +0 -51
- package/docs/examples/remote.html +0 -34
- package/docs/examples/remote.json +0 -1
- package/docs/examples/scratch.html +0 -69
- package/docs/examples/sensors/index.html +0 -44
- package/docs/examples/sensors/sensor-server.js +0 -30
- package/docs/examples/shared.html +0 -41
- package/docs/examples/template.html +0 -33
- package/docs/examples/timeline.html +0 -21
- package/docs/examples/todo.html +0 -40
- package/docs/examples/top.html +0 -10
- package/docs/examples/types.html +0 -94
- package/docs/examples/xor.html +0 -62
- package/docs/examples.html +0 -25
- package/docs/javascript/codejar.min.js +0 -8
- package/docs/javascript/highlightjs.min.js +0 -1173
- package/docs/javascript/isomorphic-git.js +0 -9
- package/docs/javascript/json5.min.js +0 -1
- package/docs/javascript/lightning-fs.js +0 -1
- package/docs/javascript/lightview.js +0 -1285
- package/docs/javascript/marked.min.js +0 -6
- package/docs/javascript/peerjs.min.js +0 -70
- package/docs/javascript/turndown.js +0 -973
- package/docs/javascript/types.js +0 -606
- package/docs/javascript/utils.js +0 -45
- package/docs/lightview.html +0 -63
- package/docs/old_index.html +0 -965
- package/docs/old_index.md +0 -1132
- package/docs/slidein.html +0 -51
- package/docs/tutorial/0-getting-started.html +0 -67
- package/docs/tutorial/1-intro-to-variables.html +0 -103
- package/docs/tutorial/10-template-components.html +0 -80
- package/docs/tutorial/11-linked-components.html +0 -76
- package/docs/tutorial/12-imported-components.html +0 -67
- package/docs/tutorial/13-input-binding.html +0 -94
- package/docs/tutorial/14-automatic-variable-creation.html +0 -74
- package/docs/tutorial/15-form-binding.html +0 -110
- package/docs/tutorial/16-if-directive.html +0 -60
- package/docs/tutorial/17-loop-directives.html +0 -83
- package/docs/tutorial/18-sanitizing-and-escaping-input.html +0 -79
- package/docs/tutorial/2-imported-and-exported-variables.html +0 -80
- package/docs/tutorial/3-data-types.html +0 -89
- package/docs/tutorial/4-extended-data-types.html +0 -83
- package/docs/tutorial/5-extended-functional-types.html +0 -96
- package/docs/tutorial/5.1-extended-functional-types.html +0 -79
- package/docs/tutorial/5.2-extended-functional-types.html +0 -70
- package/docs/tutorial/6-conventional-javascript.html +0 -75
- package/docs/tutorial/7-monitoring-with-observers.html +0 -107
- package/docs/tutorial/8-event-listeners.html +0 -65
- package/docs/tutorial/9-intro-to-components.html +0 -91
- package/docs/tutorial/contents.html +0 -32
- package/docs/tutorial/my-component.html +0 -29
- package/docs/tutorial/remote-value.json +0 -4
- package/docs/websiterepl.html +0 -46
- package/jest-puppeteer.config.js +0 -5
- package/jest.config.json +0 -12
- package/lightview.min.js +0 -1
- package/lightview_good.js +0 -1267
- package/lightview_optimized.js +0 -1274
- package/repl_hold.html +0 -320
- package/test/basic.html +0 -104
- package/test/basic.test.mjs +0 -315
- package/test/extended.html +0 -29
- package/test/extended.test.mjs +0 -448
- package/types.js +0 -607
- package/unsplash.key +0 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Migrate all components to DaisyUI styling pattern with examplify docs
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# DaisyUI Component Migration Plan
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
Migrate all Lightview components to use DaisyUI styling (like the reference `input.js` pattern):
|
|
9
|
+
- Use DaisyUI classes directly (no BEM `.lv-*` classes)
|
|
10
|
+
- Remove parallel `.css` files where possible
|
|
11
|
+
- Use custom CSS only for advanced features not in DaisyUI
|
|
12
|
+
- All components support Shadow DOM (global setting with local override)
|
|
13
|
+
- Remove `getIcon()` usage - use inline SVGs or children
|
|
14
|
+
- Update all `.html` docs to use `examplify()` with basic + reactive examples
|
|
15
|
+
- Match DaisyUI directory structure (delete `components/core/`)
|
|
16
|
+
|
|
17
|
+
## Reference Pattern (from input.js)
|
|
18
|
+
```javascript
|
|
19
|
+
// Key patterns:
|
|
20
|
+
// 1. No CSS import - uses DaisyUI classes directly
|
|
21
|
+
// 2. Uses fieldset/legend pattern for form fields
|
|
22
|
+
// 3. Signal-based reactive state
|
|
23
|
+
// 4. Controlled/uncontrolled modes
|
|
24
|
+
// 5. Validation support
|
|
25
|
+
// 6. Shadow DOM support with useShadow prop
|
|
26
|
+
// 7. Auto-register with LightviewX
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Component Status Tracker
|
|
30
|
+
|
|
31
|
+
### Batch 1: Form Inputs ✅ COMPLETE
|
|
32
|
+
- [x] 1. Input (data-input/input.js) - DONE
|
|
33
|
+
- [x] 2. Textarea (data-input/textarea.js) - DONE
|
|
34
|
+
- [x] 3. Select (data-input/select.js) - DONE
|
|
35
|
+
- [x] 4. Checkbox (data-input/checkbox.js) - DONE
|
|
36
|
+
- [x] 5. Radio (data-input/radio.js) - DONE (also added RadioGroup)
|
|
37
|
+
- [x] 6. Toggle (data-input/toggle.js) - DONE
|
|
38
|
+
- [x] 7. Range (data-input/range.js) - DONE
|
|
39
|
+
- [x] 8. Rating (data-input/rating.js) - DONE
|
|
40
|
+
- [x] 9. File Input (data-input/file-input.js) - DONE
|
|
41
|
+
|
|
42
|
+
### Batch 2: Actions & Feedback ✅ COMPLETE
|
|
43
|
+
- [x] 10. Button (actions/button.js) - DONE (docs updated with examplify)
|
|
44
|
+
- [x] 11. Modal (actions/modal.js) - DONE (docs updated with examplify)
|
|
45
|
+
- [x] 12. Drawer (layout/drawer.js) - DONE (docs updated with examplify)
|
|
46
|
+
- [x] 13. Dropdown (actions/dropdown.js) - DONE (docs updated with examplify)
|
|
47
|
+
- [x] 14. Swap (actions/swap.js) - DONE (docs updated with examplify)
|
|
48
|
+
- [x] 15. Alert (data-display/alert.js) - DONE (docs updated with examplify)
|
|
49
|
+
- [x] 16. Toast (data-display/toast.js) - DONE (docs updated with examplify)
|
|
50
|
+
- [x] 17. Loading (data-display/loading.js) - DONE (docs updated with examplify)
|
|
51
|
+
- [x] 18. Progress (data-display/progress.js) - DONE (docs updated with examplify)
|
|
52
|
+
- [x] 19. Tooltip (data-display/tooltip.js) - DONE (docs updated with examplify)
|
|
53
|
+
|
|
54
|
+
### Batch 3: Data Display ✅ COMPLETE
|
|
55
|
+
- [x] 20. Badge (data-display/badge.js) - DONE (docs updated with examplify)
|
|
56
|
+
- [x] 21. Card (data-display/card.js) - DONE (docs updated with examplify)
|
|
57
|
+
- [x] 22. Avatar (data-display/avatar.js) - DONE (docs updated with examplify)
|
|
58
|
+
- [x] 23. Table (data-display/table.js) - DONE (docs updated with examplify)
|
|
59
|
+
- [x] 24. Accordion (data-display/accordion.js) - DONE (docs updated with examplify)
|
|
60
|
+
- [x] 25. Collapse (data-display/collapse.js) - DONE (docs updated with examplify)
|
|
61
|
+
- [x] 26. Carousel (data-display/carousel.js) - DONE (docs updated with examplify)
|
|
62
|
+
- [x] 27. Chat (data-display/chat.js) - DONE (docs updated with examplify)
|
|
63
|
+
- [x] 28. Countdown (data-display/countdown.js) - DONE (docs updated with examplify)
|
|
64
|
+
- [x] 29. Diff (data-display/diff.js) - DONE (docs updated with examplify)
|
|
65
|
+
- [x] 30. Kbd (data-display/kbd.js) - DONE (docs updated with examplify)
|
|
66
|
+
- [x] 31. Stats (data-display/stats.js) - DONE (docs updated with examplify)
|
|
67
|
+
- [x] 32. Timeline (data-display/timeline.js) - DONE (docs updated with examplify)
|
|
68
|
+
- [x] 33. Skeleton (data-display/skeleton.js) - DONE (docs updated with examplify)
|
|
69
|
+
|
|
70
|
+
### Batch 4: Navigation & Layout ✅ COMPLETE
|
|
71
|
+
- [x] 34. Tabs (navigation/tabs.js) - DONE (docs updated with examplify)
|
|
72
|
+
- [x] 35. Menu (navigation/menu.js) - DONE (docs updated with examplify)
|
|
73
|
+
- [x] 36. Breadcrumbs (navigation/breadcrumbs.js) - DONE (docs updated with examplify)
|
|
74
|
+
- [x] 37. Pagination (navigation/pagination.js) - DONE (docs updated with examplify)
|
|
75
|
+
- [x] 38. Steps (navigation/steps.js) - DONE (docs updated with examplify)
|
|
76
|
+
- [x] 39. Dock (navigation/dock.js) - DONE (docs updated with examplify)
|
|
77
|
+
- [x] 40. Navbar (layout/navbar.js) - DONE (docs updated with examplify)
|
|
78
|
+
- [x] 41. Footer (layout/footer.js) - DONE (docs updated with examplify)
|
|
79
|
+
- [x] 42. Hero (layout/hero.js) - DONE (docs updated with examplify)
|
|
80
|
+
- [x] 43. Divider (layout/divider.js) - DONE (docs updated with examplify)
|
|
81
|
+
- [x] 44. Indicator (layout/indicator.js) - DONE (docs updated with examplify)
|
|
82
|
+
- [x] 45. Join (layout/join.js) - DONE (docs updated with examplify)
|
|
83
|
+
|
|
84
|
+
### Batch 5: Specialized ✅ COMPLETE
|
|
85
|
+
- [x] 46. Theme Controller (actions/theme-controller.js) - DONE (docs updated with examplify)
|
|
86
|
+
- [x] 47. Chart (data-display/chart.js) - DONE (docs updated with examplify)
|
|
87
|
+
- [x] 48. Radial Progress (data-display/radial-progress.js) - DONE (docs updated with examplify)
|
|
88
|
+
|
|
89
|
+
### Batch 6: Shadow DOM Support
|
|
90
|
+
Add `useShadow` prop and Shadow DOM rendering to all components following the `input.js` pattern:
|
|
91
|
+
- Check `LightviewX.shouldUseShadow(useShadow)` to determine if shadow DOM should be used
|
|
92
|
+
- Get adopted stylesheets via `LightviewX.getAdoptedStyleSheets()`
|
|
93
|
+
- Get current theme from `document.documentElement.getAttribute('data-theme')`
|
|
94
|
+
- Wrap component in `shadowDOM({ mode: 'open', adoptedStyleSheets }, div({ 'data-theme': currentTheme }, componentEl))`
|
|
95
|
+
|
|
96
|
+
Components to update:
|
|
97
|
+
- [x] Button (actions/button.js) - DONE
|
|
98
|
+
- [x] Dropdown (actions/dropdown.js)
|
|
99
|
+
- [x] Modal (actions/modal.js)
|
|
100
|
+
- [x] Swap (actions/swap.js)
|
|
101
|
+
- [x] Alert (data-display/alert.js)
|
|
102
|
+
- [x] Toast (data-display/toast.js)
|
|
103
|
+
- [x] Loading (data-display/loading.js)
|
|
104
|
+
- [x] Progress (data-display/progress.js)
|
|
105
|
+
- [x] Drawer (layout/drawer.js)
|
|
106
|
+
- [x] Tooltip (data-display/tooltip.js)
|
|
107
|
+
- [x] Badge (data-display/badge.js)
|
|
108
|
+
- [x] Card (data-display/card.js)
|
|
109
|
+
- [x] Avatar (data-display/avatar.js)
|
|
110
|
+
- [x] Table (data-display/table.js)
|
|
111
|
+
- [x] Accordion (data-display/accordion.js)
|
|
112
|
+
- [x] Collapse (data-display/collapse.js)
|
|
113
|
+
- [x] Carousel (data-display/carousel.js)
|
|
114
|
+
- [x] Chat (data-display/chat.js)
|
|
115
|
+
- [x] Countdown (data-display/countdown.js)
|
|
116
|
+
- [x] Diff (data-display/diff.js)
|
|
117
|
+
- [x] Kbd (data-display/kbd.js)
|
|
118
|
+
- [x] Stats (data-display/stats.js)
|
|
119
|
+
- [x] Timeline (data-display/timeline.js)
|
|
120
|
+
- [x] Skeleton (data-display/skeleton.js)
|
|
121
|
+
- [x] Tabs (navigation/tabs.js)
|
|
122
|
+
- [x] Menu (navigation/menu.js)
|
|
123
|
+
- [x] Breadcrumbs (navigation/breadcrumbs.js)
|
|
124
|
+
- [x] Pagination (navigation/pagination.js)
|
|
125
|
+
- [x] Steps (navigation/steps.js)
|
|
126
|
+
- [x] Dock (navigation/dock.js)
|
|
127
|
+
- [x] Navbar (layout/navbar.js)
|
|
128
|
+
- [x] Footer (layout/footer.js)
|
|
129
|
+
- [x] Hero (layout/hero.js)
|
|
130
|
+
- [x] Divider (layout/divider.js)
|
|
131
|
+
- [x] Indicator (layout/indicator.js)
|
|
132
|
+
- [x] Join (layout/join.js)
|
|
133
|
+
- [x] Theme Controller (actions/theme-controller.js)
|
|
134
|
+
- [x] Chart (data-display/chart.js)
|
|
135
|
+
- [x] Radial Progress (data-display/radial-progress.js)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## Cleanup Tasks
|
|
139
|
+
- [x] Delete components/core/ directory
|
|
140
|
+
- [x] Delete components/display/ directory (after consolidation)
|
|
141
|
+
- [x] Delete components/feedback/ directory (after consolidation)
|
|
142
|
+
- [x] Delete unused .css files
|
|
143
|
+
- [x] Delete components/utils/icons.js
|
|
144
|
+
- [x] Update components/index.js exports
|
|
145
|
+
|
|
146
|
+
## Per-Component Checklist
|
|
147
|
+
For each component:
|
|
148
|
+
1. [ ] Refactor .js to use DaisyUI classes
|
|
149
|
+
2. [ ] Add Shadow DOM support (useShadow prop)
|
|
150
|
+
3. [ ] Add validation/error support where applicable
|
|
151
|
+
4. [ ] Add controlled/uncontrolled state support
|
|
152
|
+
5. [ ] Remove getIcon() usage
|
|
153
|
+
6. [ ] Update .html docs with examplify (basic + reactive examples)
|
|
154
|
+
7. [ ] Delete old .css file if no longer needed
|
|
155
|
+
8. [ ] Test in browser
|
package/.codacy/cli.sh
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
set -e +o pipefail
|
|
5
|
+
|
|
6
|
+
# Set up paths first
|
|
7
|
+
bin_name="codacy-cli-v2"
|
|
8
|
+
|
|
9
|
+
# Determine OS-specific paths
|
|
10
|
+
os_name=$(uname)
|
|
11
|
+
arch=$(uname -m)
|
|
12
|
+
|
|
13
|
+
case "$arch" in
|
|
14
|
+
"x86_64")
|
|
15
|
+
arch="amd64"
|
|
16
|
+
;;
|
|
17
|
+
"x86")
|
|
18
|
+
arch="386"
|
|
19
|
+
;;
|
|
20
|
+
"aarch64"|"arm64")
|
|
21
|
+
arch="arm64"
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
if [ -z "$CODACY_CLI_V2_TMP_FOLDER" ]; then
|
|
26
|
+
if [ "$(uname)" = "Linux" ]; then
|
|
27
|
+
CODACY_CLI_V2_TMP_FOLDER="$HOME/.cache/codacy/codacy-cli-v2"
|
|
28
|
+
elif [ "$(uname)" = "Darwin" ]; then
|
|
29
|
+
CODACY_CLI_V2_TMP_FOLDER="$HOME/Library/Caches/Codacy/codacy-cli-v2"
|
|
30
|
+
else
|
|
31
|
+
CODACY_CLI_V2_TMP_FOLDER=".codacy-cli-v2"
|
|
32
|
+
fi
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
version_file="$CODACY_CLI_V2_TMP_FOLDER/version.yaml"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
get_version_from_yaml() {
|
|
39
|
+
if [ -f "$version_file" ]; then
|
|
40
|
+
local version=$(grep -o 'version: *"[^"]*"' "$version_file" | cut -d'"' -f2)
|
|
41
|
+
if [ -n "$version" ]; then
|
|
42
|
+
echo "$version"
|
|
43
|
+
return 0
|
|
44
|
+
fi
|
|
45
|
+
fi
|
|
46
|
+
return 1
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get_latest_version() {
|
|
50
|
+
local response
|
|
51
|
+
if [ -n "$GH_TOKEN" ]; then
|
|
52
|
+
response=$(curl -Lq --header "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null)
|
|
53
|
+
else
|
|
54
|
+
response=$(curl -Lq "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null)
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
handle_rate_limit "$response"
|
|
58
|
+
local version=$(echo "$response" | grep -m 1 tag_name | cut -d'"' -f4)
|
|
59
|
+
echo "$version"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
handle_rate_limit() {
|
|
63
|
+
local response="$1"
|
|
64
|
+
if echo "$response" | grep -q "API rate limit exceeded"; then
|
|
65
|
+
fatal "Error: GitHub API rate limit exceeded. Please try again later"
|
|
66
|
+
fi
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
download_file() {
|
|
70
|
+
local url="$1"
|
|
71
|
+
|
|
72
|
+
echo "Downloading from URL: ${url}"
|
|
73
|
+
if command -v curl > /dev/null 2>&1; then
|
|
74
|
+
curl -# -LS "$url" -O
|
|
75
|
+
elif command -v wget > /dev/null 2>&1; then
|
|
76
|
+
wget "$url"
|
|
77
|
+
else
|
|
78
|
+
fatal "Error: Could not find curl or wget, please install one."
|
|
79
|
+
fi
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
download() {
|
|
83
|
+
local url="$1"
|
|
84
|
+
local output_folder="$2"
|
|
85
|
+
|
|
86
|
+
( cd "$output_folder" && download_file "$url" )
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
download_cli() {
|
|
90
|
+
# OS name lower case
|
|
91
|
+
suffix=$(echo "$os_name" | tr '[:upper:]' '[:lower:]')
|
|
92
|
+
|
|
93
|
+
local bin_folder="$1"
|
|
94
|
+
local bin_path="$2"
|
|
95
|
+
local version="$3"
|
|
96
|
+
|
|
97
|
+
if [ ! -f "$bin_path" ]; then
|
|
98
|
+
echo "📥 Downloading CLI version $version..."
|
|
99
|
+
|
|
100
|
+
remote_file="codacy-cli-v2_${version}_${suffix}_${arch}.tar.gz"
|
|
101
|
+
url="https://github.com/codacy/codacy-cli-v2/releases/download/${version}/${remote_file}"
|
|
102
|
+
|
|
103
|
+
download "$url" "$bin_folder"
|
|
104
|
+
tar xzfv "${bin_folder}/${remote_file}" -C "${bin_folder}"
|
|
105
|
+
fi
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Warn if CODACY_CLI_V2_VERSION is set and update is requested
|
|
109
|
+
if [ -n "$CODACY_CLI_V2_VERSION" ] && [ "$1" = "update" ]; then
|
|
110
|
+
echo "⚠️ Warning: Performing update with forced version $CODACY_CLI_V2_VERSION"
|
|
111
|
+
echo " Unset CODACY_CLI_V2_VERSION to use the latest version"
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# Ensure version.yaml exists and is up to date
|
|
115
|
+
if [ ! -f "$version_file" ] || [ "$1" = "update" ]; then
|
|
116
|
+
echo "ℹ️ Fetching latest version..."
|
|
117
|
+
version=$(get_latest_version)
|
|
118
|
+
mkdir -p "$CODACY_CLI_V2_TMP_FOLDER"
|
|
119
|
+
echo "version: \"$version\"" > "$version_file"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Set the version to use
|
|
123
|
+
if [ -n "$CODACY_CLI_V2_VERSION" ]; then
|
|
124
|
+
version="$CODACY_CLI_V2_VERSION"
|
|
125
|
+
else
|
|
126
|
+
version=$(get_version_from_yaml)
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# Set up version-specific paths
|
|
131
|
+
bin_folder="${CODACY_CLI_V2_TMP_FOLDER}/${version}"
|
|
132
|
+
|
|
133
|
+
mkdir -p "$bin_folder"
|
|
134
|
+
bin_path="$bin_folder"/"$bin_name"
|
|
135
|
+
|
|
136
|
+
# Download the tool if not already installed
|
|
137
|
+
download_cli "$bin_folder" "$bin_path" "$version"
|
|
138
|
+
chmod +x "$bin_path"
|
|
139
|
+
|
|
140
|
+
run_command="$bin_path"
|
|
141
|
+
if [ -z "$run_command" ]; then
|
|
142
|
+
fatal "Codacy cli v2 binary could not be found."
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
if [ "$#" -eq 1 ] && [ "$1" = "download" ]; then
|
|
146
|
+
echo "Codacy cli v2 download succeeded"
|
|
147
|
+
else
|
|
148
|
+
eval "$run_command $*"
|
|
149
|
+
fi
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Configuration for AI behavior when interacting with Codacy's MCP Server
|
|
3
|
+
applyTo: '**'
|
|
4
|
+
---
|
|
5
|
+
---
|
|
6
|
+
# Codacy Rules
|
|
7
|
+
Configuration for AI behavior when interacting with Codacy's MCP Server
|
|
8
|
+
|
|
9
|
+
## CRITICAL: After ANY successful `edit_file` or `reapply` operation
|
|
10
|
+
- YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with:
|
|
11
|
+
- `rootPath`: set to the workspace path
|
|
12
|
+
- `file`: set to the path of the edited file
|
|
13
|
+
- `tool`: leave empty or unset
|
|
14
|
+
- If any issues are found in the new edits, propose and apply fixes for them.
|
|
15
|
+
- > NOTE: Failure to follow this rule is considered a critical error.
|
|
16
|
+
|
|
17
|
+
## When you tried to run the `codacy_cli_analyze` tool and the Codacy CLI is not installed
|
|
18
|
+
- Ask the user 'Codacy CLI is not installed. Would you like me to install it now?'
|
|
19
|
+
- If the user responds with "yes", run the `codacy_cli_install` tool and then continue with the original task
|
|
20
|
+
- If the user responds with "no", instruct the user that they can disable automatic analysis in the extension settings
|
|
21
|
+
- Wait for the user to respond before proceeding with any other actions
|
|
22
|
+
|
|
23
|
+
## After every response
|
|
24
|
+
- If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server
|
|
25
|
+
|
|
26
|
+
## When there are no Codacy MCP Server tools available, or the MCP Server is not reachable
|
|
27
|
+
- Suggest the user the following troubleshooting steps:
|
|
28
|
+
- Try to reset the MCP on the extension
|
|
29
|
+
- If the user is using VSCode, suggest them to review their Copilot > MCP settings in Github, under their organization or personal account. Refer them to Settings > Copilot > Enable MCP servers in Copilot. Suggested URL (https://github.com/settings/copilot/features) or https://github.com/organizations/{organization-name}/settings/copilot/features (This can only be done by their organization admins / owners)
|
|
30
|
+
- If none of the above steps work, suggest the user to contact Codacy support
|
|
31
|
+
|
|
32
|
+
## Trying to call a tool that needs a rootPath as a parameter
|
|
33
|
+
- Always use the standard, non-URL-encoded file system path
|
|
34
|
+
|
|
35
|
+
## CRITICAL: Dependencies and Security Checks
|
|
36
|
+
- IMMEDIATELY after ANY of these actions:
|
|
37
|
+
- Running npm/yarn/pnpm install
|
|
38
|
+
- Adding dependencies to package.json
|
|
39
|
+
- Adding requirements to requirements.txt
|
|
40
|
+
- Adding dependencies to pom.xml
|
|
41
|
+
- Adding dependencies to build.gradle
|
|
42
|
+
- Any other package manager operations
|
|
43
|
+
- You MUST run the `codacy_cli_analyze` tool with:
|
|
44
|
+
- `rootPath`: set to the workspace path
|
|
45
|
+
- `tool`: set to "trivy"
|
|
46
|
+
- `file`: leave empty or unset
|
|
47
|
+
- If any vulnerabilities are found because of the newly added packages:
|
|
48
|
+
- Stop all other operations
|
|
49
|
+
- Propose and apply fixes for the security issues
|
|
50
|
+
- Only continue with the original task after security issues are resolved
|
|
51
|
+
- EXAMPLE:
|
|
52
|
+
- After: npm install react-markdown
|
|
53
|
+
- Do: Run codacy_cli_analyze with trivy
|
|
54
|
+
- Before: Continuing with any other tasks
|
|
55
|
+
|
|
56
|
+
## General
|
|
57
|
+
- Repeat the relevant steps for each modified file.
|
|
58
|
+
- "Propose fixes" means to both suggest and, if possible, automatically apply the fixes.
|
|
59
|
+
- You MUST NOT wait for the user to ask for analysis or remind you to run the tool.
|
|
60
|
+
- Do not run `codacy_cli_analyze` looking for changes in duplicated code or code complexity metrics.
|
|
61
|
+
- Complexity metrics are different from complexity issues. When trying to fix complexity in a repository or file, focus on solving the complexity issues and ignore the complexity metric.
|
|
62
|
+
- Do not run `codacy_cli_analyze` looking for changes in code coverage.
|
|
63
|
+
- Do not try to manually install Codacy CLI using either brew, npm, npx, or any other package manager.
|
|
64
|
+
- If the Codacy CLI is not installed, just run the `codacy_cli_analyze` tool from Codacy's MCP Server.
|
|
65
|
+
- When calling `codacy_cli_analyze`, only send provider, organization and repository if the project is a git repository.
|
|
66
|
+
|
|
67
|
+
## Whenever a call to a Codacy tool that uses `repository` or `organization` as a parameter returns a 404 error
|
|
68
|
+
- Offer to run the `codacy_setup_repository` tool to add the repository to Codacy
|
|
69
|
+
- If the user accepts, run the `codacy_setup_repository` tool
|
|
70
|
+
- Do not ever try to run the `codacy_setup_repository` tool on your own
|
|
71
|
+
- After setup, immediately retry the action that failed (only retry once)
|
|
72
|
+
---
|
package/.wranglerignore
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Exclude node_modules and dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Exclude version control
|
|
5
|
+
.git/
|
|
6
|
+
.github/
|
|
7
|
+
|
|
8
|
+
# Exclude documentation (if you don't need it deployed)
|
|
9
|
+
# Remove the line below if you want to deploy your docs
|
|
10
|
+
# *.md
|
|
11
|
+
|
|
12
|
+
# Exclude package files
|
|
13
|
+
package.json
|
|
14
|
+
package-lock.json
|
|
15
|
+
|
|
16
|
+
# Exclude configuration files
|
|
17
|
+
wrangler.toml
|
|
18
|
+
|
|
19
|
+
# Exclude log files
|
|
20
|
+
*.log
|
|
21
|
+
.wrangler/
|