cadenlane-cli-2 1.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.
Files changed (206) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +21 -0
  3. package/README.md +333 -0
  4. package/bin.js +2 -0
  5. package/dist/application/config/config.manager.d.ts +62 -0
  6. package/dist/application/config/config.manager.d.ts.map +1 -0
  7. package/dist/application/config/config.manager.js +146 -0
  8. package/dist/application/config/config.manager.js.map +1 -0
  9. package/dist/application/services/application.service.d.ts +35 -0
  10. package/dist/application/services/application.service.d.ts.map +1 -0
  11. package/dist/application/services/application.service.js +174 -0
  12. package/dist/application/services/application.service.js.map +1 -0
  13. package/dist/application/services/download.service.d.ts +27 -0
  14. package/dist/application/services/download.service.d.ts.map +1 -0
  15. package/dist/application/services/download.service.js +197 -0
  16. package/dist/application/services/download.service.js.map +1 -0
  17. package/dist/application/services/file-naming.service.d.ts +34 -0
  18. package/dist/application/services/file-naming.service.d.ts.map +1 -0
  19. package/dist/application/services/file-naming.service.js +142 -0
  20. package/dist/application/services/file-naming.service.js.map +1 -0
  21. package/dist/application/services/queue.service.d.ts +53 -0
  22. package/dist/application/services/queue.service.d.ts.map +1 -0
  23. package/dist/application/services/queue.service.js +82 -0
  24. package/dist/application/services/queue.service.js.map +1 -0
  25. package/dist/cli/commands/start.command.d.ts +39 -0
  26. package/dist/cli/commands/start.command.d.ts.map +1 -0
  27. package/dist/cli/commands/start.command.js +196 -0
  28. package/dist/cli/commands/start.command.js.map +1 -0
  29. package/dist/cli/index.d.ts +3 -0
  30. package/dist/cli/index.d.ts.map +1 -0
  31. package/dist/cli/index.js +86 -0
  32. package/dist/cli/index.js.map +1 -0
  33. package/dist/domain/constants/config.constants.d.ts +54 -0
  34. package/dist/domain/constants/config.constants.d.ts.map +1 -0
  35. package/dist/domain/constants/config.constants.js +142 -0
  36. package/dist/domain/constants/config.constants.js.map +1 -0
  37. package/dist/domain/dtos/index.d.ts +4 -0
  38. package/dist/domain/dtos/index.d.ts.map +1 -0
  39. package/dist/domain/dtos/index.js +10 -0
  40. package/dist/domain/dtos/index.js.map +1 -0
  41. package/dist/domain/dtos/log-entry.dto.d.ts +15 -0
  42. package/dist/domain/dtos/log-entry.dto.d.ts.map +1 -0
  43. package/dist/domain/dtos/log-entry.dto.js +64 -0
  44. package/dist/domain/dtos/log-entry.dto.js.map +1 -0
  45. package/dist/domain/dtos/message.dto.d.ts +27 -0
  46. package/dist/domain/dtos/message.dto.d.ts.map +1 -0
  47. package/dist/domain/dtos/message.dto.js +140 -0
  48. package/dist/domain/dtos/message.dto.js.map +1 -0
  49. package/dist/domain/dtos/queue-message.dto.d.ts +10 -0
  50. package/dist/domain/dtos/queue-message.dto.d.ts.map +1 -0
  51. package/dist/domain/dtos/queue-message.dto.js +39 -0
  52. package/dist/domain/dtos/queue-message.dto.js.map +1 -0
  53. package/dist/domain/entities/cli-instance.entity.d.ts +55 -0
  54. package/dist/domain/entities/cli-instance.entity.d.ts.map +1 -0
  55. package/dist/domain/entities/cli-instance.entity.js +132 -0
  56. package/dist/domain/entities/cli-instance.entity.js.map +1 -0
  57. package/dist/domain/entities/index.d.ts +3 -0
  58. package/dist/domain/entities/index.d.ts.map +1 -0
  59. package/dist/domain/entities/index.js +8 -0
  60. package/dist/domain/entities/index.js.map +1 -0
  61. package/dist/domain/entities/log-entry.entity.d.ts +60 -0
  62. package/dist/domain/entities/log-entry.entity.d.ts.map +1 -0
  63. package/dist/domain/entities/log-entry.entity.js +101 -0
  64. package/dist/domain/entities/log-entry.entity.js.map +1 -0
  65. package/dist/domain/entities/message.entity.d.ts +64 -0
  66. package/dist/domain/entities/message.entity.d.ts.map +1 -0
  67. package/dist/domain/entities/message.entity.js +110 -0
  68. package/dist/domain/entities/message.entity.js.map +1 -0
  69. package/dist/domain/enums/error-category.enum.d.ts +11 -0
  70. package/dist/domain/enums/error-category.enum.d.ts.map +1 -0
  71. package/dist/domain/enums/error-category.enum.js +15 -0
  72. package/dist/domain/enums/error-category.enum.js.map +1 -0
  73. package/dist/domain/enums/index.d.ts +4 -0
  74. package/dist/domain/enums/index.d.ts.map +1 -0
  75. package/dist/domain/enums/index.js +10 -0
  76. package/dist/domain/enums/index.js.map +1 -0
  77. package/dist/domain/enums/log-level.enum.d.ts +11 -0
  78. package/dist/domain/enums/log-level.enum.d.ts.map +1 -0
  79. package/dist/domain/enums/log-level.enum.js +15 -0
  80. package/dist/domain/enums/log-level.enum.js.map +1 -0
  81. package/dist/domain/enums/message-status.enum.d.ts +11 -0
  82. package/dist/domain/enums/message-status.enum.d.ts.map +1 -0
  83. package/dist/domain/enums/message-status.enum.js +15 -0
  84. package/dist/domain/enums/message-status.enum.js.map +1 -0
  85. package/dist/domain/interfaces/adapters/ifilesystem.adapter.d.ts +34 -0
  86. package/dist/domain/interfaces/adapters/ifilesystem.adapter.d.ts.map +1 -0
  87. package/dist/domain/interfaces/adapters/ifilesystem.adapter.js +3 -0
  88. package/dist/domain/interfaces/adapters/ifilesystem.adapter.js.map +1 -0
  89. package/dist/domain/interfaces/adapters/ihttp.adapter.d.ts +22 -0
  90. package/dist/domain/interfaces/adapters/ihttp.adapter.d.ts.map +1 -0
  91. package/dist/domain/interfaces/adapters/ihttp.adapter.js +3 -0
  92. package/dist/domain/interfaces/adapters/ihttp.adapter.js.map +1 -0
  93. package/dist/domain/interfaces/adapters/index.d.ts +4 -0
  94. package/dist/domain/interfaces/adapters/index.d.ts.map +1 -0
  95. package/dist/domain/interfaces/adapters/index.js +3 -0
  96. package/dist/domain/interfaces/adapters/index.js.map +1 -0
  97. package/dist/domain/interfaces/adapters/isupabase.adapter.d.ts +27 -0
  98. package/dist/domain/interfaces/adapters/isupabase.adapter.d.ts.map +1 -0
  99. package/dist/domain/interfaces/adapters/isupabase.adapter.js +3 -0
  100. package/dist/domain/interfaces/adapters/isupabase.adapter.js.map +1 -0
  101. package/dist/domain/interfaces/repositories/ilog.repository.d.ts +32 -0
  102. package/dist/domain/interfaces/repositories/ilog.repository.d.ts.map +1 -0
  103. package/dist/domain/interfaces/repositories/ilog.repository.js +3 -0
  104. package/dist/domain/interfaces/repositories/ilog.repository.js.map +1 -0
  105. package/dist/domain/interfaces/repositories/imessage.repository.d.ts +39 -0
  106. package/dist/domain/interfaces/repositories/imessage.repository.d.ts.map +1 -0
  107. package/dist/domain/interfaces/repositories/imessage.repository.js +3 -0
  108. package/dist/domain/interfaces/repositories/imessage.repository.js.map +1 -0
  109. package/dist/domain/interfaces/repositories/index.d.ts +4 -0
  110. package/dist/domain/interfaces/repositories/index.d.ts.map +1 -0
  111. package/dist/domain/interfaces/repositories/index.js +3 -0
  112. package/dist/domain/interfaces/repositories/index.js.map +1 -0
  113. package/dist/domain/interfaces/repositories/iqueue.repository.d.ts +75 -0
  114. package/dist/domain/interfaces/repositories/iqueue.repository.d.ts.map +1 -0
  115. package/dist/domain/interfaces/repositories/iqueue.repository.js +3 -0
  116. package/dist/domain/interfaces/repositories/iqueue.repository.js.map +1 -0
  117. package/dist/domain/interfaces/services/idownload.service.d.ts +28 -0
  118. package/dist/domain/interfaces/services/idownload.service.d.ts.map +1 -0
  119. package/dist/domain/interfaces/services/idownload.service.js +3 -0
  120. package/dist/domain/interfaces/services/idownload.service.js.map +1 -0
  121. package/dist/domain/interfaces/services/iqueue.service.d.ts +35 -0
  122. package/dist/domain/interfaces/services/iqueue.service.d.ts.map +1 -0
  123. package/dist/domain/interfaces/services/iqueue.service.js +3 -0
  124. package/dist/domain/interfaces/services/iqueue.service.js.map +1 -0
  125. package/dist/domain/services/path-resolver.service.d.ts +94 -0
  126. package/dist/domain/services/path-resolver.service.d.ts.map +1 -0
  127. package/dist/domain/services/path-resolver.service.js +332 -0
  128. package/dist/domain/services/path-resolver.service.js.map +1 -0
  129. package/dist/domain/validators/index.d.ts +4 -0
  130. package/dist/domain/validators/index.d.ts.map +1 -0
  131. package/dist/domain/validators/index.js +10 -0
  132. package/dist/domain/validators/index.js.map +1 -0
  133. package/dist/domain/validators/message.validator.d.ts +20 -0
  134. package/dist/domain/validators/message.validator.d.ts.map +1 -0
  135. package/dist/domain/validators/message.validator.js +31 -0
  136. package/dist/domain/validators/message.validator.js.map +1 -0
  137. package/dist/domain/validators/path.validator.d.ts +44 -0
  138. package/dist/domain/validators/path.validator.d.ts.map +1 -0
  139. package/dist/domain/validators/path.validator.js +156 -0
  140. package/dist/domain/validators/path.validator.js.map +1 -0
  141. package/dist/domain/validators/url.validator.d.ts +19 -0
  142. package/dist/domain/validators/url.validator.d.ts.map +1 -0
  143. package/dist/domain/validators/url.validator.js +46 -0
  144. package/dist/domain/validators/url.validator.js.map +1 -0
  145. package/dist/index.d.ts +11 -0
  146. package/dist/index.d.ts.map +1 -0
  147. package/dist/index.js +27 -0
  148. package/dist/index.js.map +1 -0
  149. package/dist/infrastructure/adapters/filesystem.adapter.d.ts +35 -0
  150. package/dist/infrastructure/adapters/filesystem.adapter.d.ts.map +1 -0
  151. package/dist/infrastructure/adapters/filesystem.adapter.js +103 -0
  152. package/dist/infrastructure/adapters/filesystem.adapter.js.map +1 -0
  153. package/dist/infrastructure/adapters/http.adapter.d.ts +15 -0
  154. package/dist/infrastructure/adapters/http.adapter.d.ts.map +1 -0
  155. package/dist/infrastructure/adapters/http.adapter.js +80 -0
  156. package/dist/infrastructure/adapters/http.adapter.js.map +1 -0
  157. package/dist/infrastructure/adapters/index.d.ts +4 -0
  158. package/dist/infrastructure/adapters/index.d.ts.map +1 -0
  159. package/dist/infrastructure/adapters/index.js +10 -0
  160. package/dist/infrastructure/adapters/index.js.map +1 -0
  161. package/dist/infrastructure/adapters/pgmq.adapter.d.ts +29 -0
  162. package/dist/infrastructure/adapters/pgmq.adapter.d.ts.map +1 -0
  163. package/dist/infrastructure/adapters/pgmq.adapter.js +84 -0
  164. package/dist/infrastructure/adapters/pgmq.adapter.js.map +1 -0
  165. package/dist/infrastructure/adapters/supabase.adapter.d.ts +79 -0
  166. package/dist/infrastructure/adapters/supabase.adapter.d.ts.map +1 -0
  167. package/dist/infrastructure/adapters/supabase.adapter.js +97 -0
  168. package/dist/infrastructure/adapters/supabase.adapter.js.map +1 -0
  169. package/dist/infrastructure/database/supabase.client.d.ts +20 -0
  170. package/dist/infrastructure/database/supabase.client.d.ts.map +1 -0
  171. package/dist/infrastructure/database/supabase.client.js +36 -0
  172. package/dist/infrastructure/database/supabase.client.js.map +1 -0
  173. package/dist/infrastructure/di/container.d.ts +18 -0
  174. package/dist/infrastructure/di/container.d.ts.map +1 -0
  175. package/dist/infrastructure/di/container.js +103 -0
  176. package/dist/infrastructure/di/container.js.map +1 -0
  177. package/dist/infrastructure/repositories/cli-instance.repository.d.ts +64 -0
  178. package/dist/infrastructure/repositories/cli-instance.repository.d.ts.map +1 -0
  179. package/dist/infrastructure/repositories/cli-instance.repository.js +154 -0
  180. package/dist/infrastructure/repositories/cli-instance.repository.js.map +1 -0
  181. package/dist/infrastructure/repositories/config.repository.d.ts +52 -0
  182. package/dist/infrastructure/repositories/config.repository.d.ts.map +1 -0
  183. package/dist/infrastructure/repositories/config.repository.js +130 -0
  184. package/dist/infrastructure/repositories/config.repository.js.map +1 -0
  185. package/dist/infrastructure/repositories/index.d.ts +4 -0
  186. package/dist/infrastructure/repositories/index.d.ts.map +1 -0
  187. package/dist/infrastructure/repositories/index.js +10 -0
  188. package/dist/infrastructure/repositories/index.js.map +1 -0
  189. package/dist/infrastructure/repositories/log.repository.d.ts +44 -0
  190. package/dist/infrastructure/repositories/log.repository.d.ts.map +1 -0
  191. package/dist/infrastructure/repositories/log.repository.js +108 -0
  192. package/dist/infrastructure/repositories/log.repository.js.map +1 -0
  193. package/dist/infrastructure/repositories/message.repository.d.ts +51 -0
  194. package/dist/infrastructure/repositories/message.repository.d.ts.map +1 -0
  195. package/dist/infrastructure/repositories/message.repository.js +161 -0
  196. package/dist/infrastructure/repositories/message.repository.js.map +1 -0
  197. package/dist/infrastructure/repositories/queue.repository.d.ts +69 -0
  198. package/dist/infrastructure/repositories/queue.repository.d.ts.map +1 -0
  199. package/dist/infrastructure/repositories/queue.repository.js +130 -0
  200. package/dist/infrastructure/repositories/queue.repository.js.map +1 -0
  201. package/dist/infrastructure/utils/connection-health.util.d.ts +23 -0
  202. package/dist/infrastructure/utils/connection-health.util.d.ts.map +1 -0
  203. package/dist/infrastructure/utils/connection-health.util.js +64 -0
  204. package/dist/infrastructure/utils/connection-health.util.js.map +1 -0
  205. package/package.json +105 -0
  206. package/pm2.config.js +104 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Cadenlane
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,333 @@
1
+ # 🚀 Cadenlane CLI - Multi-Instance File Download System
2
+
3
+ > A production-ready, cross-platform TypeScript CLI application that processes file downloads from a Supabase PGMQ queue using event-driven architecture. Supports multiple distributed instances across Windows, macOS, and Linux with comprehensive monitoring, health tracking, and real-time observability.
4
+
5
+ **✅ 324+ Tests Passing | ⚡ Event-Driven | 🌐 Cross-Platform | 🔄 Multi-Instance | 🏗️ Clean Architecture | 🔒 Type-Safe | 📊 92.4% Coverage | 🤖 CI/CD Automated**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/cadenlane-cli-2.svg)](https://www.npmjs.com/package/cadenlane-cli-2)
8
+ [![npm downloads](https://img.shields.io/npm/dm/cadenlane-cli-2.svg)](https://www.npmjs.com/package/cadenlane-cli-2)
9
+ [![CI](https://github.com/Shiphero-Yolo/cadenlane-cli-2/workflows/CI/badge.svg)](https://github.com/Shiphero-Yolo/cadenlane-cli-2/actions)
10
+ [![Tests](https://img.shields.io/badge/tests-324%20passing-brightgreen)]()
11
+ [![Coverage](https://img.shields.io/badge/coverage-92.4%25-brightgreen)]()
12
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue)]()
13
+ [![Platforms](https://img.shields.io/badge/platforms-Windows%20%7C%20macOS%20%7C%20Linux-blue)]()
14
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
15
+
16
+ ---
17
+
18
+ ## 🚀 Quick Navigation
19
+
20
+ | Task | Section |
21
+ |------|---------|
22
+ | **Install the CLI** | [Installation & Setup](#-installation--setup) |
23
+ | **Complete setup guide** | [ONBOARDING.md](docs/ONBOARDING.md) |
24
+ | **Run with PM2** | [PM2_GUIDE.md](docs/PM2_GUIDE.md) |
25
+ | **Deploy to production** | [DEPLOYMENT.md](docs/DEPLOYMENT.md) |
26
+ | **View all features** | [Features](#-features) |
27
+ | **Read documentation** | [Documentation](#-documentation) |
28
+ | **Visual diagrams** | [DIAGRAMS.md](docs/diagrams/DIAGRAMS.md) |
29
+
30
+ ---
31
+
32
+ ## 📦 Installation & Setup
33
+
34
+ ```bash
35
+ # Install globally via npm
36
+ npm install -g cadenlane-cli-2
37
+
38
+ # Or use directly with npx
39
+ npx cadenlane-cli-2 start
40
+ ```
41
+
42
+ **📖 Complete Setup Guide**: [ONBOARDING.md](docs/ONBOARDING.md)
43
+ - Install from npm (for users)
44
+ - Local development setup (for developers)
45
+ - Configuration and environment setup
46
+ - Platform-specific instructions
47
+
48
+ **🔄 Production Deployment**: [PM2_GUIDE.md](docs/PM2_GUIDE.md)
49
+ - PM2 process manager setup
50
+ - Auto-start on system boot
51
+ - Monitoring and log management
52
+
53
+ ## ✨ Features
54
+
55
+ ### 🌐 Cross-Platform Support
56
+ - **Windows, macOS, Linux**: Single codebase runs on all platforms
57
+ - **Platform-Aware Paths**: Automatic validation for drive letters (Windows) and Unix paths
58
+ - **Path Resolution**: Home directory expansion (`~`, `%USERPROFILE%`), environment variables
59
+ - **Absolute Paths Only**: Clear, unambiguous file locations
60
+ - **Reserved Name Detection**: Windows reserved names (CON, PRN, etc.) automatically blocked
61
+
62
+ ### 🔄 Multi-Instance Architecture
63
+ - **Distributed Processing**: Run multiple CLI instances across different computers
64
+ - **Instance Registration**: Automatic registration with unique identity
65
+ - **Health Monitoring**: Heartbeat system tracks instance health (5-minute intervals)
66
+ - **Workload Tracking**: Per-instance statistics (jobs processed, failures, bytes downloaded)
67
+ - **Configuration Hierarchy**: Global config with instance-specific overrides
68
+ - **Platform Distribution**: Track workload across Windows, Mac, and Linux instances
69
+
70
+ ### Core Functionality
71
+ - 📥 **File Download**: Downloads files from any public URL to specified folders
72
+ - 📬 **Queue-Based Processing**: Uses Supabase PGMQ for reliable, scalable message handling
73
+ - ⚡ **Event-Driven**: Blocking reads eliminate polling - instant message processing
74
+ - 🚀 **Fail-Fast Design**: No retry mechanism - immediate, clear failure handling
75
+ - 📊 **Complete Observability**: All logs and metrics stored in Supabase
76
+ - 🎯 **Single Processing**: Each message processed exactly once with ACID guarantees
77
+
78
+ ### Architecture & Quality
79
+ - 🏗️ **Clean Architecture**: SOLID principles with clear layer separation (Domain, Application, Infrastructure)
80
+ - 💉 **Dependency Injection**: TSyringe IoC container for testability
81
+ - 🧪 **Test-Driven Development**: 324+ tests with 92.4% coverage
82
+ - 🔒 **Type-Safe**: Full TypeScript with strict mode
83
+ - 🛡️ **Security**: Path traversal protection, input validation, RLS policies
84
+ - 📐 **Interface-Driven Design**: All adapters implement domain interfaces (IPgmqAdapter, IHttpAdapter, etc.)
85
+
86
+ ### Admin UI
87
+ - 🎨 **Web Dashboard**: Real-time monitoring and management interface
88
+ - 📈 **Live Statistics**: Track completed, processing, and failed jobs
89
+ - 📝 **Detailed Logs**: View execution logs with expandable data and stack traces
90
+ - 🔄 **Auto-Refresh**: Real-time updates every 3 seconds
91
+ - ✉️ **Queue Management**: Send test messages directly from the UI
92
+
93
+ ## 📚 Documentation
94
+
95
+ Welcome to the CLI Base documentation! This streamlined index helps you find exactly what you need.
96
+
97
+ ### 🚀 Getting Started
98
+
99
+ **New to the project?** Follow this path:
100
+
101
+ 1. **[README](README.md)** - Project overview and quick start (you are here!)
102
+ 2. **[ONBOARDING.md](docs/ONBOARDING.md)** - Complete setup and first-time guide
103
+ 3. **[ADMIN_UI_GUIDE.md](docs/ADMIN_UI_GUIDE.md)** - Using the web dashboard
104
+
105
+ ### 📖 Core Documentation
106
+
107
+ #### For Developers
108
+
109
+ **[ONBOARDING.md](docs/ONBOARDING.md)** - Your first stop
110
+ - Prerequisites and installation
111
+ - Local development setup
112
+ - Configuration guide
113
+ - Running the application
114
+ - Verification and testing
115
+
116
+ **[DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md)** - Deep dive into the codebase
117
+ - Clean Architecture principles
118
+ - Core components and services
119
+ - Design patterns
120
+ - Testing strategy (291 tests)
121
+ - Debugging techniques
122
+ - Contributing guidelines
123
+
124
+ #### For Operators
125
+
126
+ **[OPERATIONS.md](docs/OPERATIONS.md)** - Running in production
127
+ - Multi-instance architecture
128
+ - Cross-platform support (Windows, Mac, Linux)
129
+ - Monitoring and health checks
130
+ - Troubleshooting guide
131
+ - Performance tuning
132
+
133
+ **[DEPLOYMENT.md](docs/DEPLOYMENT.md)** - Production deployment
134
+ - Supabase deployment
135
+ - Worker deployment (PM2, Docker, Systemd)
136
+ - CI/CD setup (GitHub Actions, GitLab CI)
137
+ - Publishing to npm
138
+ - Migration guide
139
+
140
+ **[PM2_GUIDE.md](docs/PM2_GUIDE.md)** - PM2 process manager
141
+ - Complete PM2 setup for Windows, macOS, and Linux
142
+ - Auto-start on system boot configuration
143
+ - Process management and monitoring
144
+ - Log management and rotation
145
+ - Troubleshooting guide
146
+
147
+ #### Reference
148
+
149
+ **[ADMIN_UI_GUIDE.md](docs/ADMIN_UI_GUIDE.md)** - Web interface guide
150
+ - Sending messages to queue
151
+ - Viewing messages and logs
152
+ - Dashboard statistics
153
+ - API endpoints
154
+
155
+ **[PRD-CLI-BASE.md](docs/PRD-CLI-BASE.md)** - Product requirements
156
+ - Full feature specifications
157
+ - Technical requirements
158
+ - Use cases
159
+
160
+ **[DIAGRAMS.md](docs/diagrams/DIAGRAMS.md)** - Visual diagrams
161
+ - Architecture diagrams (Clean Architecture, System Context, Multi-Instance)
162
+ - Component diagrams (Services, Repositories, Adapters)
163
+ - Sequence diagrams (Message processing, Configuration, Path resolution)
164
+ - E2E flow diagrams (Complete workflows, Admin UI, Monitoring)
165
+ - Database schema (ERD, PGMQ structure)
166
+
167
+ ### 📋 Quick Reference
168
+
169
+ #### Common Tasks
170
+
171
+ | Task | Documentation |
172
+ |------|---------------|
173
+ | **First-time setup** | [ONBOARDING.md](docs/ONBOARDING.md) |
174
+ | **Understand architecture** | [DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md) |
175
+ | **Run tests** | [DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md#testing) |
176
+ | **Deploy to production** | [DEPLOYMENT.md](docs/DEPLOYMENT.md) |
177
+ | **Troubleshoot issues** | [OPERATIONS.md](docs/OPERATIONS.md#troubleshooting) |
178
+ | **Multi-instance setup** | [OPERATIONS.md](docs/OPERATIONS.md#multi-instance-architecture) |
179
+ | **Use Admin UI** | [ADMIN_UI_GUIDE.md](docs/ADMIN_UI_GUIDE.md) |
180
+
181
+ #### Learning Path
182
+
183
+ **Week 1: Basics**
184
+ 1. Read [ONBOARDING.md](docs/ONBOARDING.md)
185
+ 2. Complete local setup
186
+ 3. Run the application
187
+ 4. Send test messages via Admin UI
188
+
189
+ **Week 2: Development**
190
+ 1. Read [DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md)
191
+ 2. Explore the codebase
192
+ 3. Run tests: `npm test`
193
+ 4. Make a small code change
194
+
195
+ **Week 3: Production**
196
+ 1. Read [OPERATIONS.md](docs/OPERATIONS.md)
197
+ 2. Read [DEPLOYMENT.md](docs/DEPLOYMENT.md)
198
+ 3. Set up multi-instance deployment
199
+ 4. Configure monitoring
200
+
201
+ #### By Role
202
+
203
+ **New Developer:**
204
+ 1. [ONBOARDING.md](docs/ONBOARDING.md) - Get started
205
+ 2. [DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md) - Learn the codebase
206
+ 3. [ADMIN_UI_GUIDE.md](docs/ADMIN_UI_GUIDE.md) - Test your changes
207
+
208
+ **DevOps Engineer:**
209
+ 1. [DEPLOYMENT.md](docs/DEPLOYMENT.md) - Deploy to production
210
+ 2. [OPERATIONS.md](docs/OPERATIONS.md) - Monitor and maintain
211
+ 3. [ONBOARDING.md](docs/ONBOARDING.md#configuration) - Configuration reference
212
+
213
+ **Product Manager:**
214
+ 1. [README](README.md) - Feature overview (you are here!)
215
+ 2. [PRD-CLI-BASE.md](docs/PRD-CLI-BASE.md) - Full requirements
216
+ 3. [ADMIN_UI_GUIDE.md](docs/ADMIN_UI_GUIDE.md) - User interface
217
+
218
+ ### 🔍 What's New
219
+
220
+ **Version 2.0.0 Documentation Consolidation**:
221
+ - ✅ Streamlined from 23 files to 6 core documents
222
+ - ✅ Removed redundancy and overlap
223
+ - ✅ Clear learning path for new developers
224
+ - ✅ Comprehensive coverage of all features
225
+ - ✅ Better organization by role and task
226
+
227
+ ### 🆘 Need Help?
228
+
229
+ **Quick Troubleshooting**:
230
+ 1. Check [OPERATIONS.md - Troubleshooting](docs/OPERATIONS.md#troubleshooting)
231
+ 2. Review logs in Admin UI or Supabase Studio
232
+ 3. Verify setup in [ONBOARDING.md](docs/ONBOARDING.md)
233
+
234
+ **Common Issues**:
235
+ - Worker not processing? → [OPERATIONS.md](docs/OPERATIONS.md#issue-worker-not-processing-messages)
236
+ - Database connection issues? → [OPERATIONS.md](docs/OPERATIONS.md#issue-database-connection-terminated)
237
+ - Path validation errors? → [OPERATIONS.md](docs/OPERATIONS.md#issue-path-validation-fails)
238
+ - Deployment problems? → [DEPLOYMENT.md](docs/DEPLOYMENT.md)
239
+
240
+ ## 🏗️ Architecture
241
+
242
+ Built with **Clean Architecture** principles:
243
+ - **Domain Layer**: Business entities and rules
244
+ - **Application Layer**: Use cases and services
245
+ - **Infrastructure Layer**: External integrations (Supabase, PGMQ, File System)
246
+ - **CLI Layer**: Command-line interface
247
+
248
+ **📊 Visual Diagrams**: [DIAGRAMS.md](docs/diagrams/DIAGRAMS.md)
249
+ - System architecture and component diagrams
250
+ - Sequence diagrams for key workflows
251
+ - Database schema (ERD)
252
+
253
+ **📖 Detailed Architecture**: [DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md)
254
+
255
+ ## 🧪 Development & Testing
256
+
257
+ **Testing**: 324+ tests with 92.4% coverage
258
+ ```bash
259
+ npm test # Run all tests
260
+ npm run test:coverage # Coverage report
261
+ ```
262
+
263
+ **Code Quality**:
264
+ ```bash
265
+ npm run lint # Lint code
266
+ npm run format # Format code
267
+ npm run type-check # TypeScript checks
268
+ ```
269
+
270
+ **📖 Development Guide**: [DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md)
271
+ - Testing strategy and best practices
272
+ - Debugging techniques
273
+ - Contributing guidelines
274
+
275
+ ## 📝 Usage
276
+
277
+ **Sending Messages**: Use the Admin UI or API
278
+ - **Admin UI**: http://127.0.0.1:54321/functions/v1/admin-ui
279
+ - **API Examples**: See [ADMIN_UI_GUIDE.md](docs/ADMIN_UI_GUIDE.md)
280
+
281
+ **Monitoring**: View logs in Supabase Studio or Admin UI
282
+ - **Studio**: http://127.0.0.1:54323
283
+ - **Tables**: `messages`, `job_logs`, `cli_instances`
284
+
285
+ **Configuration**: Environment variables and database config
286
+ - **Setup Guide**: [ONBOARDING.md](docs/ONBOARDING.md#configuration)
287
+ - **Config Priority**: Instance > Global > ENV > Default
288
+
289
+ ## 🔧 Troubleshooting
290
+
291
+ **Common Issues**:
292
+ - Worker not processing? → [OPERATIONS.md](docs/OPERATIONS.md#troubleshooting)
293
+ - Database connection issues? → [OPERATIONS.md](docs/OPERATIONS.md#issue-database-connection-terminated)
294
+ - Path validation errors? → [OPERATIONS.md](docs/OPERATIONS.md#issue-path-validation-fails)
295
+ - Windows command not recognized? → [ONBOARDING.md](docs/ONBOARDING.md)
296
+
297
+ **📖 Complete Guide**: [OPERATIONS.md](docs/OPERATIONS.md#troubleshooting)
298
+
299
+ ## 📦 Deployment
300
+
301
+ **Production Deployment**: [DEPLOYMENT.md](docs/DEPLOYMENT.md)
302
+ - Supabase deployment
303
+ - Worker deployment (PM2, Docker, Systemd)
304
+ - CI/CD setup
305
+ - Publishing to npm
306
+
307
+ **Process Management**: [PM2_GUIDE.md](docs/PM2_GUIDE.md)
308
+ - PM2 setup and auto-start
309
+ - Monitoring and logs
310
+
311
+ ## 🤝 Contributing
312
+
313
+ Contributions are welcome! Please see [DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md) for:
314
+ - Development setup
315
+ - Testing requirements
316
+ - Code quality standards
317
+ - Contributing guidelines
318
+
319
+ ## 📄 License
320
+
321
+ MIT License - see LICENSE file for details
322
+
323
+ ## 🆘 Support
324
+
325
+ **Documentation**: See [Documentation](#-documentation) section above for complete guides
326
+
327
+ **Issues**: Check [OPERATIONS.md](docs/OPERATIONS.md#troubleshooting) for troubleshooting
328
+
329
+ **npm Package**: https://www.npmjs.com/package/cadenlane-cli-2
330
+
331
+ ---
332
+
333
+ **Built with ❤️ using TypeScript, Supabase, and Clean Architecture principles**
package/bin.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('./dist/cli/index.js');
@@ -0,0 +1,62 @@
1
+ import { ConfigRepository } from '../../infrastructure/repositories/config.repository';
2
+ /**
3
+ * Application Configuration
4
+ */
5
+ export interface AppConfig {
6
+ supabase: {
7
+ url: string;
8
+ serviceRoleKey: string;
9
+ };
10
+ queue: {
11
+ name: string;
12
+ visibilityTimeoutSeconds: number;
13
+ pollIntervalMs: number;
14
+ };
15
+ download: {
16
+ timeoutMs: number;
17
+ maxRetries: number;
18
+ defaultPath: string;
19
+ fallbackPath?: string;
20
+ };
21
+ platform: {
22
+ name: string;
23
+ isWindows: boolean;
24
+ isMac: boolean;
25
+ isLinux: boolean;
26
+ separator: string;
27
+ };
28
+ instance: {
29
+ id: string;
30
+ name: string;
31
+ };
32
+ }
33
+ /**
34
+ * Configuration Manager
35
+ * Loads and validates application configuration
36
+ */
37
+ export declare class ConfigManager {
38
+ private configRepository;
39
+ private config;
40
+ constructor(configRepository: ConfigRepository);
41
+ /**
42
+ * Loads configuration from database with fallback to environment variables
43
+ * @param instanceId - Optional instance ID (for testing or pre-registered instances)
44
+ * @throws Error if required variables are missing
45
+ */
46
+ load(instanceId?: string): Promise<AppConfig>;
47
+ /**
48
+ * Gets the current configuration
49
+ * @throws Error if configuration not loaded
50
+ */
51
+ get(): AppConfig;
52
+ /**
53
+ * Validates that all required environment variables are present
54
+ * @throws Error if any required variable is missing
55
+ */
56
+ private validateRequiredEnvVars;
57
+ /**
58
+ * Get configuration value with priority: DB > ENV > Default
59
+ */
60
+ private getConfigValue;
61
+ }
62
+ //# sourceMappingURL=config.manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.manager.d.ts","sourceRoot":"","sources":["../../../src/application/config/config.manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,wBAAwB,EAAE,MAAM,CAAC;QACjC,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,OAAO,CAAC;QACf,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;;GAGG;AACH,qBACa,aAAa;IAII,OAAO,CAAC,gBAAgB;IAHpD,OAAO,CAAC,MAAM,CAA0B;gBAGJ,gBAAgB,EAAE,gBAAgB;IAGtE;;;;OAIG;IACG,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAiGnD;;;OAGG;IACH,GAAG,IAAI,SAAS;IAOhB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;OAEG;IACH,OAAO,CAAC,cAAc;CA2BvB"}
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ConfigManager = void 0;
16
+ const tsyringe_1 = require("tsyringe");
17
+ const os_1 = require("os");
18
+ const config_constants_1 = require("../../domain/constants/config.constants");
19
+ const config_repository_1 = require("../../infrastructure/repositories/config.repository");
20
+ /**
21
+ * Configuration Manager
22
+ * Loads and validates application configuration
23
+ */
24
+ let ConfigManager = class ConfigManager {
25
+ configRepository;
26
+ config = null;
27
+ constructor(configRepository) {
28
+ this.configRepository = configRepository;
29
+ }
30
+ /**
31
+ * Loads configuration from database with fallback to environment variables
32
+ * @param instanceId - Optional instance ID (for testing or pre-registered instances)
33
+ * @throws Error if required variables are missing
34
+ */
35
+ async load(instanceId) {
36
+ this.validateRequiredEnvVars();
37
+ // Load configuration from database
38
+ const dbConfig = await this.configRepository.getAll();
39
+ // Get platform information
40
+ const platformInfo = config_constants_1.PLATFORM_DEFAULTS.getPlatformInfo();
41
+ // Get default download path (DB > ENV > Platform Default)
42
+ const defaultDownloadPath = this.getConfigValue(dbConfig, config_constants_1.CONFIG_KEYS.DOWNLOAD_DEFAULT_PATH, process.env.DOWNLOAD_DEFAULT_PATH, config_constants_1.PLATFORM_DEFAULTS.getDefaultDownloadPath());
43
+ // Get fallback download path (optional)
44
+ const fallbackDownloadPath = this.getConfigValue(dbConfig, config_constants_1.CONFIG_KEYS.DOWNLOAD_FALLBACK_PATH, process.env.DOWNLOAD_FALLBACK_PATH, undefined);
45
+ // Get instance ID from ENV (CLI_INSTANCE_ID)
46
+ // Fallback: provided instanceId param > hostname-platform
47
+ const finalInstanceId = instanceId ||
48
+ process.env.CLI_INSTANCE_ID ||
49
+ `${(0, os_1.hostname)()}-${platformInfo.platform}`;
50
+ // Use instance ID for both identification and display
51
+ const instanceName = finalInstanceId;
52
+ // Sanitize instance ID for use as queue name (PostgreSQL identifier rules)
53
+ // Replace spaces and special chars with underscores, lowercase
54
+ const sanitizedInstanceId = finalInstanceId
55
+ .toLowerCase()
56
+ .replace(/[^a-z0-9_-]/g, '_')
57
+ .replace(/_+/g, '_')
58
+ .replace(/^_|_$/g, '');
59
+ // Use CLI_INSTANCE_ID directly as the queue name
60
+ const instanceQueueName = sanitizedInstanceId;
61
+ this.config = {
62
+ supabase: {
63
+ url: process.env.SUPABASE_URL,
64
+ serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY,
65
+ },
66
+ queue: {
67
+ name: instanceQueueName,
68
+ visibilityTimeoutSeconds: this.getConfigValue(dbConfig, 'queue.visibility_timeout_seconds', process.env.QUEUE_VISIBILITY_TIMEOUT_SECONDS, config_constants_1.CONFIG_CONSTANTS.DEFAULT_VISIBILITY_TIMEOUT_SECONDS),
69
+ pollIntervalMs: this.getConfigValue(dbConfig, 'queue.poll_interval_ms', process.env.QUEUE_POLL_INTERVAL_MS, config_constants_1.CONFIG_CONSTANTS.DEFAULT_POLL_INTERVAL_MS),
70
+ },
71
+ download: {
72
+ timeoutMs: this.getConfigValue(dbConfig, 'download.timeout_ms', process.env.DOWNLOAD_TIMEOUT_MS, config_constants_1.CONFIG_CONSTANTS.DEFAULT_DOWNLOAD_TIMEOUT_MS),
73
+ maxRetries: this.getConfigValue(dbConfig, 'download.max_retries', process.env.MAX_RETRIES, config_constants_1.CONFIG_CONSTANTS.DEFAULT_MAX_RETRIES),
74
+ defaultPath: defaultDownloadPath,
75
+ fallbackPath: fallbackDownloadPath,
76
+ },
77
+ platform: {
78
+ name: platformInfo.platform,
79
+ isWindows: platformInfo.isWindows,
80
+ isMac: platformInfo.isMac,
81
+ isLinux: platformInfo.isLinux,
82
+ separator: platformInfo.separator,
83
+ },
84
+ instance: {
85
+ id: finalInstanceId,
86
+ name: instanceName,
87
+ },
88
+ };
89
+ return this.config;
90
+ }
91
+ /**
92
+ * Gets the current configuration
93
+ * @throws Error if configuration not loaded
94
+ */
95
+ get() {
96
+ if (!this.config) {
97
+ throw new Error('Configuration not loaded. Call load() first.');
98
+ }
99
+ return this.config;
100
+ }
101
+ /**
102
+ * Validates that all required environment variables are present
103
+ * @throws Error if any required variable is missing
104
+ */
105
+ validateRequiredEnvVars() {
106
+ const missing = [];
107
+ for (const varName of config_constants_1.REQUIRED_ENV_VARS) {
108
+ if (!process.env[varName]) {
109
+ missing.push(varName);
110
+ }
111
+ }
112
+ if (missing.length > 0) {
113
+ throw new Error(`Missing required environment variables: ${missing.join(', ')}`);
114
+ }
115
+ }
116
+ /**
117
+ * Get configuration value with priority: DB > ENV > Default
118
+ */
119
+ getConfigValue(dbConfig, dbKey, envValue, defaultValue) {
120
+ // Priority 1: Database
121
+ if (dbConfig[dbKey] !== undefined) {
122
+ const dbValue = dbConfig[dbKey];
123
+ // Ensure we return string or number, not boolean
124
+ if (typeof dbValue === 'boolean') {
125
+ return dbValue ? 1 : 0;
126
+ }
127
+ return dbValue;
128
+ }
129
+ // Priority 2: Environment variable
130
+ if (envValue !== undefined && envValue !== '') {
131
+ if (defaultValue === undefined) {
132
+ return envValue;
133
+ }
134
+ return typeof defaultValue === 'number' ? parseInt(envValue, 10) : envValue;
135
+ }
136
+ // Priority 3: Default value
137
+ return defaultValue;
138
+ }
139
+ };
140
+ exports.ConfigManager = ConfigManager;
141
+ exports.ConfigManager = ConfigManager = __decorate([
142
+ (0, tsyringe_1.injectable)(),
143
+ __param(0, (0, tsyringe_1.inject)(config_repository_1.ConfigRepository)),
144
+ __metadata("design:paramtypes", [config_repository_1.ConfigRepository])
145
+ ], ConfigManager);
146
+ //# sourceMappingURL=config.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.manager.js","sourceRoot":"","sources":["../../../src/application/config/config.manager.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,35 @@
1
+ import { QueueService } from './queue.service';
2
+ import { DownloadService } from './download.service';
3
+ import { MessageRepository } from '../../infrastructure/repositories/message.repository';
4
+ import { LogRepository } from '../../infrastructure/repositories/log.repository';
5
+ /**
6
+ * Application Service
7
+ * Main orchestrator for message processing workflow
8
+ */
9
+ export declare class ApplicationService {
10
+ private queueService;
11
+ private downloadService;
12
+ private messageRepository;
13
+ private logRepository;
14
+ constructor(queueService: QueueService, downloadService: DownloadService, messageRepository: MessageRepository, logRepository: LogRepository);
15
+ /**
16
+ * Processes the next message from the queue
17
+ * @returns true if a message was processed, false if queue is empty
18
+ */
19
+ processNextMessage(): Promise<boolean>;
20
+ /**
21
+ * Processes a specific message (used when message is pre-fetched)
22
+ * @param queueMessage - The PGMQ message to process
23
+ * @returns true if processed successfully
24
+ */
25
+ processMessage(queueMessage: any): Promise<boolean>;
26
+ /**
27
+ * Logs an info message
28
+ */
29
+ private logInfo;
30
+ /**
31
+ * Logs an error message
32
+ */
33
+ private logError;
34
+ }
35
+ //# sourceMappingURL=application.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.service.d.ts","sourceRoot":"","sources":["../../../src/application/services/application.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAI7E;;;GAGG;AACH,qBACa,kBAAkB;IAEL,OAAO,CAAC,YAAY;IACjB,OAAO,CAAC,eAAe;IACrB,OAAO,CAAC,iBAAiB;IAC7B,OAAO,CAAC,aAAa;gBAHd,YAAY,EAAE,YAAY,EACvB,eAAe,EAAE,eAAe,EAC9B,iBAAiB,EAAE,iBAAiB,EACxC,aAAa,EAAE,aAAa;IAG7D;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAiB5C;;;;OAIG;IACG,cAAc,CAAC,YAAY,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IA2GzD;;OAEG;YACW,OAAO;IASrB;;OAEG;YACW,QAAQ;CAavB"}