@mks2508/better-logger 0.0.2-alpha.2 → 0.11.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/.github/workflows/ci-quality.yml +357 -0
  2. package/.github/workflows/docs-demo.yml +119 -0
  3. package/.github/workflows/releases-core.yml +512 -0
  4. package/.github/workflows/releases-full.yml +582 -0
  5. package/.github/{workflows → workflows-backup}/ci.yml +12 -110
  6. package/.github/workflows-backup/nightly.yml +196 -0
  7. package/.github/workflows-backup/release-optimized.yml +373 -0
  8. package/.release-notes-0.2.0.md +129 -0
  9. package/.yamllint +28 -0
  10. package/CHANGELOG.json +749 -0
  11. package/CLAUDE.md +92 -1
  12. package/README.md +142 -498
  13. package/bun.lock +323 -0
  14. package/demo.html +9 -2
  15. package/dist/Logger.d.ts +176 -0
  16. package/dist/Logger.d.ts.map +1 -0
  17. package/dist/Logger.js +498 -0
  18. package/dist/chunks/Logger-C2-cR3No.js +2 -0
  19. package/dist/chunks/Logger-C2-cR3No.js.map +1 -0
  20. package/dist/chunks/Logger-CVwk8cgA.js +2159 -0
  21. package/dist/chunks/Logger-CVwk8cgA.js.map +1 -0
  22. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +33 -0
  23. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +1 -0
  24. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +2 -0
  25. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +1 -0
  26. package/dist/chunks/StyleBuilder-BoJTmskd.js +361 -0
  27. package/dist/chunks/StyleBuilder-BoJTmskd.js.map +1 -0
  28. package/dist/chunks/StyleBuilder-LPLzsoHY.js +4 -0
  29. package/dist/chunks/StyleBuilder-LPLzsoHY.js.map +1 -0
  30. package/dist/cli/CommandProcessor.d.ts +103 -0
  31. package/dist/cli/CommandProcessor.d.ts.map +1 -0
  32. package/dist/cli/CommandProcessor.js +184 -0
  33. package/dist/cli/commands/ConfigCommand.d.ts +17 -0
  34. package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
  35. package/dist/cli/commands/ConfigCommand.js +88 -0
  36. package/dist/cli/commands/ExportCommand.d.ts +51 -0
  37. package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
  38. package/dist/cli/commands/ExportCommand.js +243 -0
  39. package/dist/cli/commands/HistoryCommand.d.ts +50 -0
  40. package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
  41. package/dist/cli/commands/HistoryCommand.js +96 -0
  42. package/dist/cli/commands/StatusCommand.d.ts +33 -0
  43. package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
  44. package/dist/cli/commands/StatusCommand.js +93 -0
  45. package/dist/cli/commands/ThemeCommand.d.ts +33 -0
  46. package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
  47. package/dist/cli/commands/ThemeCommand.js +79 -0
  48. package/dist/cli/help.d.ts +15 -0
  49. package/dist/cli/help.d.ts.map +1 -0
  50. package/dist/cli/help.js +118 -0
  51. package/dist/cli/index.d.ts +15 -0
  52. package/dist/cli/index.d.ts.map +1 -0
  53. package/dist/cli/index.js +46 -0
  54. package/dist/constants.d.ts +91 -0
  55. package/dist/constants.d.ts.map +1 -0
  56. package/dist/constants.js +80 -0
  57. package/dist/core.cjs +1 -1
  58. package/dist/core.cjs.map +1 -1
  59. package/dist/core.d.ts +130 -0
  60. package/dist/core.d.ts.map +1 -0
  61. package/dist/core.js +258 -242
  62. package/dist/core.js.map +1 -1
  63. package/dist/example.d.ts +18 -0
  64. package/dist/example.d.ts.map +1 -0
  65. package/dist/example.js +154 -0
  66. package/dist/exports-module.d.ts +203 -0
  67. package/dist/exports-module.d.ts.map +1 -0
  68. package/dist/exports-module.js +260 -0
  69. package/dist/exports.cjs +1 -1
  70. package/dist/exports.cjs.map +1 -1
  71. package/dist/exports.js +2 -2
  72. package/dist/handlers/AnalyticsLogHandler.d.ts +11 -0
  73. package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  74. package/dist/handlers/AnalyticsLogHandler.js +19 -0
  75. package/dist/handlers/ExportLogHandler.d.ts +103 -0
  76. package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
  77. package/dist/handlers/ExportLogHandler.js +516 -0
  78. package/dist/handlers/FileLogHandler.d.ts +13 -0
  79. package/dist/handlers/FileLogHandler.d.ts.map +1 -0
  80. package/dist/handlers/FileLogHandler.js +24 -0
  81. package/dist/handlers/RemoteLogHandler.d.ts +14 -0
  82. package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
  83. package/dist/handlers/RemoteLogHandler.js +37 -0
  84. package/dist/handlers/index.d.ts +8 -0
  85. package/dist/handlers/index.d.ts.map +1 -0
  86. package/dist/handlers/index.js +7 -0
  87. package/dist/index.cjs +1 -1
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.ts +86 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +89 -103
  92. package/dist/main.d.ts +2 -0
  93. package/dist/main.d.ts.map +1 -0
  94. package/dist/main.js +139 -0
  95. package/dist/styling/StyleBuilder.d.ts +132 -0
  96. package/dist/styling/StyleBuilder.d.ts.map +1 -0
  97. package/dist/styling/StyleBuilder.js +268 -0
  98. package/dist/styling/banners.d.ts +45 -0
  99. package/dist/styling/banners.d.ts.map +1 -0
  100. package/dist/styling/banners.js +155 -0
  101. package/dist/styling/index.d.ts +7 -0
  102. package/dist/styling/index.d.ts.map +1 -0
  103. package/dist/styling/index.js +6 -0
  104. package/dist/styling/themes.d.ts +10 -0
  105. package/dist/styling/themes.d.ts.map +1 -0
  106. package/dist/styling/themes.js +231 -0
  107. package/dist/styling-module.d.ts +185 -0
  108. package/dist/styling-module.d.ts.map +1 -0
  109. package/dist/styling-module.js +199 -0
  110. package/dist/styling.cjs +1 -1
  111. package/dist/styling.cjs.map +1 -1
  112. package/dist/styling.js +4 -4
  113. package/dist/types/Logger.d.ts +172 -0
  114. package/dist/types/Logger.d.ts.map +1 -0
  115. package/dist/types/cli/CommandProcessor.d.ts +100 -0
  116. package/dist/types/cli/CommandProcessor.d.ts.map +1 -0
  117. package/dist/types/cli/commands/ConfigCommand.d.ts +14 -0
  118. package/dist/types/cli/commands/ConfigCommand.d.ts.map +1 -0
  119. package/dist/types/cli/commands/ExportCommand.d.ts +48 -0
  120. package/dist/types/cli/commands/ExportCommand.d.ts.map +1 -0
  121. package/dist/types/cli/commands/HistoryCommand.d.ts +47 -0
  122. package/dist/types/cli/commands/HistoryCommand.d.ts.map +1 -0
  123. package/dist/types/cli/commands/StatusCommand.d.ts +30 -0
  124. package/dist/types/cli/commands/StatusCommand.d.ts.map +1 -0
  125. package/dist/types/cli/commands/ThemeCommand.d.ts +30 -0
  126. package/dist/types/cli/commands/ThemeCommand.d.ts.map +1 -0
  127. package/dist/types/cli/help.d.ts +12 -0
  128. package/dist/types/cli/help.d.ts.map +1 -0
  129. package/dist/types/cli/index.d.ts +15 -0
  130. package/dist/types/cli/index.d.ts.map +1 -0
  131. package/dist/types/constants.d.ts +88 -0
  132. package/dist/types/constants.d.ts.map +1 -0
  133. package/dist/types/core.d.ts +71 -211
  134. package/dist/types/core.d.ts.map +1 -0
  135. package/dist/types/core.js +13 -0
  136. package/dist/types/example.d.ts +18 -0
  137. package/dist/types/example.d.ts.map +1 -0
  138. package/dist/types/exports-module.d.ts +196 -0
  139. package/dist/types/exports-module.d.ts.map +1 -0
  140. package/dist/types/handlers/AnalyticsLogHandler.d.ts +8 -0
  141. package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  142. package/dist/types/handlers/ExportLogHandler.d.ts +100 -0
  143. package/dist/types/handlers/ExportLogHandler.d.ts.map +1 -0
  144. package/dist/types/handlers/FileLogHandler.d.ts +10 -0
  145. package/dist/types/handlers/FileLogHandler.d.ts.map +1 -0
  146. package/dist/types/handlers/RemoteLogHandler.d.ts +11 -0
  147. package/dist/types/handlers/RemoteLogHandler.d.ts.map +1 -0
  148. package/dist/types/handlers/index.d.ts +8 -0
  149. package/dist/types/handlers/index.d.ts.map +1 -0
  150. package/dist/types/handlers.d.ts +88 -0
  151. package/dist/types/handlers.d.ts.map +1 -0
  152. package/dist/types/handlers.js +4 -0
  153. package/dist/types/index.d.ts +7 -675
  154. package/dist/types/index.d.ts.map +1 -0
  155. package/dist/types/index.js +4 -0
  156. package/dist/types/main.d.ts +2 -0
  157. package/dist/types/main.d.ts.map +1 -0
  158. package/dist/types/styling/StyleBuilder.d.ts +132 -0
  159. package/dist/types/styling/StyleBuilder.d.ts.map +1 -0
  160. package/dist/types/styling/banners.d.ts +42 -0
  161. package/dist/types/styling/banners.d.ts.map +1 -0
  162. package/dist/types/styling/index.d.ts +7 -0
  163. package/dist/types/styling/index.d.ts.map +1 -0
  164. package/dist/types/styling/themes.d.ts +7 -0
  165. package/dist/types/styling/themes.d.ts.map +1 -0
  166. package/dist/types/styling-module.d.ts +178 -0
  167. package/dist/types/styling-module.d.ts.map +1 -0
  168. package/dist/types/types/core.d.ts +71 -0
  169. package/dist/types/types/core.d.ts.map +1 -0
  170. package/dist/types/types/handlers.d.ts +85 -0
  171. package/dist/types/types/handlers.d.ts.map +1 -0
  172. package/dist/types/types/index.d.ts +7 -0
  173. package/dist/types/types/index.d.ts.map +1 -0
  174. package/dist/types/utils/index.d.ts +7 -0
  175. package/dist/types/utils/index.d.ts.map +1 -0
  176. package/dist/types/utils/output.d.ts +29 -0
  177. package/dist/types/utils/output.d.ts.map +1 -0
  178. package/dist/types/utils/stackTrace.d.ts +6 -0
  179. package/dist/types/utils/stackTrace.d.ts.map +1 -0
  180. package/dist/types/utils/timestamps.d.ts +20 -0
  181. package/dist/types/utils/timestamps.d.ts.map +1 -0
  182. package/dist/utils/index.d.ts +7 -0
  183. package/dist/utils/index.d.ts.map +1 -0
  184. package/dist/utils/index.js +6 -0
  185. package/dist/utils/output.d.ts +32 -0
  186. package/dist/utils/output.d.ts.map +1 -0
  187. package/dist/utils/output.js +97 -0
  188. package/dist/utils/stackTrace.d.ts +9 -0
  189. package/dist/utils/stackTrace.d.ts.map +1 -0
  190. package/dist/utils/stackTrace.js +81 -0
  191. package/dist/utils/timestamps.d.ts +20 -0
  192. package/dist/utils/timestamps.d.ts.map +1 -0
  193. package/dist/utils/timestamps.js +71 -0
  194. package/docs/API.md +691 -0
  195. package/docs/DEVELOPMENT.md +731 -0
  196. package/docs/PACKAGES.md +244 -0
  197. package/docs/_config.yml +36 -0
  198. package/docs/index.md +179 -0
  199. package/examples/README.md +208 -0
  200. package/examples/basic-logging.js +75 -0
  201. package/examples/data-export.js +234 -0
  202. package/examples/package.json +16 -0
  203. package/examples/performance-timing.js +170 -0
  204. package/examples/styling-themes.js +207 -0
  205. package/package.json +32 -21
  206. package/packages/core/package.json +35 -0
  207. package/packages/exports/package.json +41 -0
  208. package/packages/styling/package.json +41 -0
  209. package/project-utils/README.md +172 -0
  210. package/project-utils/auto-release-gemini.ts +1193 -0
  211. package/project-utils/commit-generator.ts +1385 -0
  212. package/project-utils/commit-ui.ts +264 -0
  213. package/project-utils/git-utils.ts +199 -0
  214. package/project-utils/github-release-manager.ts +466 -0
  215. package/project-utils/prompt-templates.js +345 -0
  216. package/project-utils/prompt-templates.ts +422 -0
  217. package/project-utils/version-manager.ts +1078 -0
  218. package/src/Logger.ts +2 -1
  219. package/src/cli/CommandProcessor.ts +173 -2
  220. package/src/cli/commands/HistoryCommand.ts +117 -0
  221. package/src/cli/index.ts +12 -0
  222. package/src/handlers/ExportLogHandler.ts +141 -0
  223. package/tests/test-conflict-resolution.ts +391 -0
  224. package/tests/validate-workflows.sh +131 -0
  225. package/tests/yaml-autofix.sh +146 -0
  226. package/vite.config.ts +152 -50
  227. package/.claude/settings.local.json +0 -22
  228. package/.npmrc.bak +0 -1
  229. package/dist/chunks/Logger-BQhMKy_T.js +0 -2
  230. package/dist/chunks/Logger-BQhMKy_T.js.map +0 -1
  231. package/dist/chunks/Logger-BrFKFZcD.js +0 -978
  232. package/dist/chunks/Logger-BrFKFZcD.js.map +0 -1
  233. package/dist/chunks/core-2opW4Pi3.js +0 -194
  234. package/dist/chunks/core-2opW4Pi3.js.map +0 -1
  235. package/dist/chunks/core-DyugwSYZ.js +0 -4
  236. package/dist/chunks/core-DyugwSYZ.js.map +0 -1
  237. package/dist/chunks/exports-BNP3R7dp.js +0 -421
  238. package/dist/chunks/exports-BNP3R7dp.js.map +0 -1
  239. package/dist/chunks/exports-U1xLBXrY.js +0 -2
  240. package/dist/chunks/exports-U1xLBXrY.js.map +0 -1
  241. package/dist/chunks/styling-DhUDzwlE.js +0 -654
  242. package/dist/chunks/styling-DhUDzwlE.js.map +0 -1
  243. package/dist/chunks/styling-tmRDI28D.js +0 -2
  244. package/dist/chunks/styling-tmRDI28D.js.map +0 -1
  245. package/dist/types/exports.d.ts +0 -600
  246. package/dist/types/styling.d.ts +0 -751
  247. /package/.github/{workflows → workflows-backup}/release.yml +0 -0
@@ -0,0 +1,345 @@
1
+ /**
2
+ * Plantillas de prompts estandarizadas para Gemini CLI
3
+ * @description Asegura respuestas consistentes y parseables en todos los scripts
4
+ * @author TPV EL Haido
5
+ */
6
+ /**
7
+ * Configuración base del proyecto OpenTUI
8
+ */
9
+ export const TPV_PROJECT_CONFIG = {
10
+ name: 'OpenTUI',
11
+ description: 'Modern Terminal User Interface Framework',
12
+ version: '0.1.0',
13
+ techStack: ['TypeScript', 'Node.js', 'Terminal UI', 'CLI'],
14
+ targetPlatform: 'Cross-platform (macOS, Linux, Windows)',
15
+ };
16
+ /**
17
+ * Prefijo estándar para todos los prompts de Gemini
18
+ */
19
+ const STANDARD_PROMPT_PREFIX = `# Sistema de Análisis Inteligente - OpenTUI
20
+
21
+ Eres un asistente especializado en análisis de código y automatización para el proyecto OpenTUI. Tu función es proporcionar respuestas estructuradas, precisas y consistentes que puedan ser parseadas automáticamente.
22
+
23
+ ## REGLAS CRÍTICAS DE FORMATO
24
+
25
+ 1. **FORMATO DE RESPUESTA OBLIGATORIO**: Todas tus respuestas deben seguir exactamente el formato especificado más abajo.
26
+ 2. **CONSISTENCIA**: Mantén la misma estructura sin importar la complejidad del análisis.
27
+ 3. **PARSEABLE**: El formato debe ser fácil de procesar automáticamente con expresiones regulares.
28
+ 4. **BLOQUES MARKDOWN**: Usa \`\`\`markdown para bloques de código cuando se especifique.
29
+ 5. **SECCIONES TÉCNICAS**: Siempre incluye las secciones <technical> y <changelog> cuando sea aplicable.
30
+
31
+ ## Contexto del Proyecto
32
+ **Nombre**: ${TPV_PROJECT_CONFIG.name}
33
+ **Descripción**: ${TPV_PROJECT_CONFIG.description}
34
+ **Versión Actual**: ${TPV_PROJECT_CONFIG.version}
35
+ **Stack Tecnológico**: ${TPV_PROJECT_CONFIG.techStack.join(', ')}
36
+ **Plataforma Objetivo**: ${TPV_PROJECT_CONFIG.targetPlatform}
37
+
38
+ ---
39
+ `;
40
+ /**
41
+ * Sufijo estándar con instrucciones de formato
42
+ */
43
+ const STANDARD_PROMPT_SUFFIX = `
44
+
45
+ ---
46
+
47
+ ## INSTRUCCIONES FINALES
48
+
49
+ 1. **Lee cuidadosamente** toda la información proporcionada
50
+ 2. **Analiza el contexto** y los datos específicos
51
+ 3. **Genera una respuesta** siguiendo EXACTAMENTE el formato especificado
52
+ 4. **Mantén consistencia** en la estructura y sintaxis
53
+ 5. **No desvíes** del formato requerido bajo ninguna circunstancia
54
+
55
+ **IMPORTANTE**: La respuesta debe ser parseada automáticamente. Cualquier desviación del formato especificado causará errores en el sistema.`;
56
+ /**
57
+ * Genera prompt para análisis de commits
58
+ */
59
+ export function createCommitPrompt(config) {
60
+ const { data, specificContext } = config;
61
+ return `${STANDARD_PROMPT_PREFIX}
62
+
63
+ # ANÁLISIS DE COMMITS
64
+
65
+ ## Datos del Análisis
66
+ ${JSON.stringify(data, null, 2)}
67
+
68
+ ## Contexto Adicional
69
+ ${specificContext || 'Ninguno proporcionado'}
70
+
71
+ ---
72
+
73
+ ## FORMATO DE RESPUESTA REQUERIDO
74
+
75
+ Tu respuesta debe seguir EXACTAMENTE esta estructura:
76
+
77
+ ### **ANÁLISIS PRINCIPAL**
78
+
79
+ [Descripción general de los cambios detectados]
80
+
81
+ ---
82
+
83
+ ### **Propuesta de Commit #1**
84
+
85
+ \`\`\`markdown
86
+ [prefijo](área - descripción breve)
87
+
88
+ [Descripción completa en castellano de QUÉ se logró y POR QUÉ]
89
+
90
+ <technical>
91
+ [Detalles técnicos específicos: archivos modificados, funciones añadidas, refactorizaciones, etc.]
92
+ </technical>
93
+
94
+ <changelog>
95
+ ## [Tipo] [Emoji]
96
+ [Entrada para changelog de la app, optimizada para mostrar al usuario]
97
+ </changelog>
98
+ \`\`\`
99
+
100
+ ### **Propuesta de Commit #2** (solo si es necesario)
101
+
102
+ [Repetir formato anterior]
103
+
104
+ ---
105
+
106
+ **DECISIÓN**: [Explicación breve de por qué uno o múltiples commits]
107
+
108
+ ${STANDARD_PROMPT_SUFFIX}`;
109
+ }
110
+ /**
111
+ * Genera prompt para asistente de workflow
112
+ */
113
+ export function createWorkflowPrompt(config) {
114
+ const { data, specificContext } = config;
115
+ return `${STANDARD_PROMPT_PREFIX}
116
+
117
+ # ASISTENTE DE WORKFLOW
118
+
119
+ ## Solicitud del Usuario
120
+ "${specificContext}"
121
+
122
+ ## Contexto del Proyecto Actual
123
+ ${JSON.stringify(data, null, 2)}
124
+
125
+ ---
126
+
127
+ ## FORMATO DE RESPUESTA REQUERIDO
128
+
129
+ \`\`\`markdown
130
+ 🎯 **ANÁLISIS**: [Descripción del tipo de trabajo detectado]
131
+ 📊 **IMPACTO**: [Áreas afectadas y alcance del cambio]
132
+ 🚀 **RECOMENDACIÓN**: [Tipo de versión y estrategia recomendada]
133
+
134
+ ## 🖥️ COMANDOS PARA macOS
135
+ \`\`\`bash
136
+ # [Descripción del primer comando]
137
+ [comando exacto con parámetros]
138
+
139
+ # [Descripción del segundo comando]
140
+ [segundo comando exacto]
141
+ \`\`\`
142
+
143
+ ## 🐧 COMANDOS PARA LINUX ARM (después de macOS)
144
+ \`\`\`bash
145
+ # SSH y preparación
146
+ ssh user@raspberry-pi
147
+ git pull origin master && bun install
148
+
149
+ # [Descripción del build ARM]
150
+ [comandos específicos de ARM]
151
+ \`\`\`
152
+
153
+ ## ✅ VERIFICACIONES AUTOMÁTICAS
154
+ - [Lista de verificaciones que se ejecutarán]
155
+ \`\`\`
156
+
157
+ ${STANDARD_PROMPT_SUFFIX}`;
158
+ }
159
+ /**
160
+ * Genera prompt para releases automáticas
161
+ */
162
+ export function createReleasePrompt(config) {
163
+ const { data, specificContext } = config;
164
+ return `${STANDARD_PROMPT_PREFIX}
165
+
166
+ # ANÁLISIS DE RELEASE
167
+
168
+ ## Información de la Release
169
+ ${JSON.stringify(data, null, 2)}
170
+
171
+ ## Contexto Específico
172
+ ${specificContext || 'Release automática'}
173
+
174
+ ---
175
+
176
+ ## FORMATO DE RESPUESTA REQUERIDO
177
+
178
+ \`\`\`markdown
179
+ # 📦 ANÁLISIS DE RELEASE
180
+
181
+ ## 🎯 RESUMEN
182
+ [Descripción de los cambios principales incluidos en esta release]
183
+
184
+ ## 📋 CHANGELOG GENERADO
185
+
186
+ ### ✨ Features
187
+ [Lista de nuevas funcionalidades]
188
+
189
+ ### 🐛 Fixes
190
+ [Lista de correcciones de bugs]
191
+
192
+ ### 🚀 Improvements
193
+ [Lista de mejoras]
194
+
195
+ ### 🔧 Technical
196
+ [Cambios técnicos internos]
197
+
198
+ ## 🏷️ INFORMACIÓN DE VERSIÓN
199
+ - **Versión**: [versión calculada]
200
+ - **Prefijo**: [alpha/beta/rc/stable]
201
+ - **Canal OTA**: [dev/beta/stable]
202
+ - **Tipo de cambio**: [major/minor/patch]
203
+
204
+ ## 📝 NOTAS DE RELEASE
205
+ [Texto descriptivo para usuarios finales]
206
+ \`\`\`
207
+
208
+ ${STANDARD_PROMPT_SUFFIX}`;
209
+ }
210
+ /**
211
+ * Parser genérico para respuestas de Gemini
212
+ */
213
+ export class GeminiResponseParser {
214
+ /**
215
+ * Extrae múltiples propuestas de commit del formato estándar
216
+ */
217
+ static parseCommitProposals(response) {
218
+ const proposals = [];
219
+ // Buscar todas las propuestas con el formato: ### **Propuesta de Commit #N**
220
+ const proposalPattern = /###\s*\*\*Propuesta de Commit #\d+\*\*/g;
221
+ const proposalMatches = Array.from(response.matchAll(proposalPattern));
222
+ if (proposalMatches.length === 0) {
223
+ // Formato de un solo commit sin numeración
224
+ const codeBlock = this.extractCodeBlock(response);
225
+ if (codeBlock) {
226
+ const parsed = this.parseCommitContent(codeBlock);
227
+ if (parsed)
228
+ proposals.push(parsed);
229
+ }
230
+ }
231
+ else {
232
+ // Múltiples propuestas numeradas
233
+ for (let i = 0; i < proposalMatches.length; i++) {
234
+ const startIndex = proposalMatches[i].index;
235
+ const endIndex = proposalMatches[i + 1]?.index || response.length;
236
+ const proposalSection = response.substring(startIndex, endIndex);
237
+ const codeBlock = this.extractCodeBlock(proposalSection);
238
+ if (codeBlock) {
239
+ const parsed = this.parseCommitContent(codeBlock);
240
+ if (parsed)
241
+ proposals.push(parsed);
242
+ }
243
+ }
244
+ }
245
+ return proposals;
246
+ }
247
+ /**
248
+ * Extrae bloque de código markdown
249
+ */
250
+ static extractCodeBlock(text) {
251
+ const patterns = [
252
+ /```markdown\s*\n([\s\S]*?)\n```/, // ```markdown
253
+ /```\s*\n([\s\S]*?)\n```/, // ``` genérico
254
+ /```([\s\S]*?)```/ // sin saltos
255
+ ];
256
+ for (const pattern of patterns) {
257
+ const match = text.match(pattern);
258
+ if (match)
259
+ return match[1].trim();
260
+ }
261
+ return null;
262
+ }
263
+ /**
264
+ * Parsea el contenido de un commit individual
265
+ */
266
+ static parseCommitContent(content) {
267
+ const lines = content.split('\n');
268
+ // Título (primera línea no vacía)
269
+ let title = '';
270
+ let titleIndex = 0;
271
+ for (let i = 0; i < lines.length; i++) {
272
+ if (lines[i].trim()) {
273
+ title = lines[i].trim();
274
+ titleIndex = i;
275
+ break;
276
+ }
277
+ }
278
+ if (!title)
279
+ return null;
280
+ // Extraer secciones
281
+ let description = '';
282
+ let technical = '';
283
+ let changelog = '';
284
+ let currentSection = 'description';
285
+ for (let i = titleIndex + 1; i < lines.length; i++) {
286
+ const line = lines[i];
287
+ if (line.includes('<technical>')) {
288
+ currentSection = 'technical';
289
+ continue;
290
+ }
291
+ else if (line.includes('</technical>')) {
292
+ currentSection = 'none';
293
+ continue;
294
+ }
295
+ else if (line.includes('<changelog>')) {
296
+ currentSection = 'changelog';
297
+ continue;
298
+ }
299
+ else if (line.includes('</changelog>')) {
300
+ currentSection = 'none';
301
+ continue;
302
+ }
303
+ if (currentSection === 'description' && line.trim()) {
304
+ description += line + '\n';
305
+ }
306
+ else if (currentSection === 'technical') {
307
+ technical += line + '\n';
308
+ }
309
+ else if (currentSection === 'changelog') {
310
+ changelog += line + '\n';
311
+ }
312
+ }
313
+ return {
314
+ title,
315
+ description: description.trim(),
316
+ technical: technical.trim(),
317
+ changelog: changelog.trim()
318
+ };
319
+ }
320
+ /**
321
+ * Parsea respuesta de workflow en formato estándar
322
+ */
323
+ static parseWorkflowResponse(response) {
324
+ const analysisMatch = response.match(/🎯\s*\*\*ANÁLISIS\*\*:\s*(.+)/);
325
+ const impactMatch = response.match(/📊\s*\*\*IMPACTO\*\*:\s*(.+)/);
326
+ const recommendationMatch = response.match(/🚀\s*\*\*RECOMENDACIÓN\*\*:\s*(.+)/);
327
+ // Extraer comandos macOS
328
+ const macosSection = response.match(/##\s*🖥️\s*COMANDOS PARA macOS\s*```bash\s*([\s\S]*?)\s*```/);
329
+ const macosCommands = macosSection ? macosSection[1].split('\n').filter(line => line.trim() && !line.startsWith('#')) : [];
330
+ // Extraer comandos Linux ARM
331
+ const linuxSection = response.match(/##\s*🐧\s*COMANDOS PARA LINUX ARM[\s\S]*?```bash\s*([\s\S]*?)\s*```/);
332
+ const linuxCommands = linuxSection ? linuxSection[1].split('\n').filter(line => line.trim() && !line.startsWith('#')) : [];
333
+ // Extraer verificaciones
334
+ const verificationsSection = response.match(/##\s*✅\s*VERIFICACIONES AUTOMÁTICAS\s*([\s\S]*?)```/);
335
+ const verifications = verificationsSection ? verificationsSection[1].split('\n').filter(line => line.trim().startsWith('-')).map(line => line.replace(/^-\s*/, '')) : [];
336
+ return {
337
+ analysis: analysisMatch?.[1] || 'No disponible',
338
+ impact: impactMatch?.[1] || 'No disponible',
339
+ recommendation: recommendationMatch?.[1] || 'No disponible',
340
+ macosCommands,
341
+ linuxCommands,
342
+ verifications
343
+ };
344
+ }
345
+ }