@mks2508/better-logger 5.0.0 → 5.0.2

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 (162) hide show
  1. package/dist/chunks/{Logger-Cbi1f10o.js → Logger-CKqzXDh3.js} +2 -2
  2. package/dist/chunks/{Logger-Cbi1f10o.js.map → Logger-CKqzXDh3.js.map} +1 -1
  3. package/dist/chunks/{Logger-BZ7B7OXE.js → Logger-D_vuKP4l.js} +2 -2
  4. package/dist/chunks/{Logger-BZ7B7OXE.js.map → Logger-D_vuKP4l.js.map} +1 -1
  5. package/dist/chunks/cli-module-B-njrTWb.js +2 -0
  6. package/dist/chunks/cli-module-B-njrTWb.js.map +1 -0
  7. package/dist/chunks/{cli-module-ClIJmaT8.js → cli-module-Cx7qotPY.js} +16 -9
  8. package/dist/chunks/cli-module-Cx7qotPY.js.map +1 -0
  9. package/dist/cli.cjs +1 -1
  10. package/dist/cli.js +1 -1
  11. package/dist/exports.cjs +1 -1
  12. package/dist/exports.js +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +3 -3
  15. package/dist/styling.cjs +1 -1
  16. package/dist/styling.js +2 -2
  17. package/dist/terminal/formatter.d.ts.map +1 -1
  18. package/package.json +5 -1
  19. package/.claude/settings.local.json +0 -48
  20. package/.github/workflows/ci-quality.yml +0 -357
  21. package/.github/workflows/docs-demo.yml +0 -119
  22. package/.github/workflows/releases-core.yml +0 -512
  23. package/.github/workflows/releases-full.yml +0 -582
  24. package/.github/workflows-backup/ci.yml +0 -221
  25. package/.github/workflows-backup/nightly.yml +0 -196
  26. package/.github/workflows-backup/release-optimized.yml +0 -373
  27. package/.github/workflows-backup/release.yml +0 -269
  28. package/.release-notes-0.2.0.md +0 -129
  29. package/.yamllint +0 -28
  30. package/CHANGELOG.json +0 -1076
  31. package/CHANGELOG.md +0 -209
  32. package/CLAUDE.md +0 -217
  33. package/bun.lock +0 -333
  34. package/demo.html +0 -847
  35. package/dist/chunks/cli-module-CadqgZ1Z.js +0 -2
  36. package/dist/chunks/cli-module-CadqgZ1Z.js.map +0 -1
  37. package/dist/chunks/cli-module-ClIJmaT8.js.map +0 -1
  38. package/docs/API.md +0 -918
  39. package/docs/CORE.md +0 -264
  40. package/docs/DEVELOPMENT.md +0 -731
  41. package/docs/EXPORTS.md +0 -467
  42. package/docs/PACKAGES.md +0 -244
  43. package/docs/STYLING.md +0 -405
  44. package/docs/_config.yml +0 -36
  45. package/docs/index.md +0 -179
  46. package/examples/README.md +0 -208
  47. package/examples/basic-logging.js +0 -75
  48. package/examples/data-export.js +0 -234
  49. package/examples/package.json +0 -16
  50. package/examples/performance-timing.js +0 -170
  51. package/examples/simplified-api.js +0 -124
  52. package/examples/styling-themes.js +0 -207
  53. package/index.html +0 -358
  54. package/packages/core/package.json +0 -57
  55. package/packages/exports/package.json +0 -41
  56. package/packages/nodejs-opentui/README.md +0 -232
  57. package/packages/nodejs-opentui/package.json +0 -72
  58. package/packages/nodejs-opentui/src/LogRenderer.ts +0 -171
  59. package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +0 -178
  60. package/packages/nodejs-opentui/src/components/LogBadge.tsx +0 -131
  61. package/packages/nodejs-opentui/src/index.ts +0 -133
  62. package/packages/nodejs-opentui/src/types.ts +0 -158
  63. package/packages/nodejs-opentui/tsconfig.json +0 -20
  64. package/packages/styling/package.json +0 -41
  65. package/playground/demo-all.ts +0 -95
  66. package/playground/demo-box.ts +0 -85
  67. package/playground/demo-levels.ts +0 -56
  68. package/playground/demo-real-world.ts +0 -98
  69. package/playground/demo-spinner.ts +0 -77
  70. package/playground/demo-steps.ts +0 -72
  71. package/playground/demo-table.ts +0 -83
  72. package/project-utils/README.md +0 -172
  73. package/project-utils/auto-release-gemini.ts +0 -1193
  74. package/project-utils/auto-release-ui.ts +0 -1329
  75. package/project-utils/commit-generator.ts +0 -1385
  76. package/project-utils/commit-ui.ts +0 -264
  77. package/project-utils/git-utils.ts +0 -199
  78. package/project-utils/github-release-manager.ts +0 -466
  79. package/project-utils/project-config.ts +0 -260
  80. package/project-utils/prompt-templates.js +0 -345
  81. package/project-utils/prompt-templates.ts +0 -422
  82. package/project-utils/version-manager.ts +0 -1078
  83. package/public/vite.svg +0 -1
  84. package/src/Logger.ts +0 -1858
  85. package/src/ScopedLogger.ts +0 -256
  86. package/src/cli/CommandProcessor.ts +0 -248
  87. package/src/cli/commands/ConfigCommand.ts +0 -93
  88. package/src/cli/commands/ExportCommand.ts +0 -276
  89. package/src/cli/commands/HistoryCommand.ts +0 -117
  90. package/src/cli/commands/StatusCommand.ts +0 -112
  91. package/src/cli/commands/ThemeCommand.ts +0 -88
  92. package/src/cli/help.ts +0 -127
  93. package/src/cli/index.ts +0 -71
  94. package/src/cli-module.ts +0 -21
  95. package/src/cli-primitives/box.ts +0 -86
  96. package/src/cli-primitives/cli-table.ts +0 -62
  97. package/src/cli-primitives/divider.ts +0 -17
  98. package/src/cli-primitives/header.ts +0 -18
  99. package/src/cli-primitives/index.ts +0 -13
  100. package/src/cli-primitives/server-fallback.ts +0 -54
  101. package/src/cli-primitives/spinner.ts +0 -133
  102. package/src/cli-primitives/step.ts +0 -22
  103. package/src/constants.ts +0 -313
  104. package/src/core.ts +0 -397
  105. package/src/example.ts +0 -210
  106. package/src/exports-module.ts +0 -311
  107. package/src/handlers/AnalyticsLogHandler.ts +0 -22
  108. package/src/handlers/ExportLogHandler.ts +0 -610
  109. package/src/handlers/FileLogHandler.ts +0 -169
  110. package/src/handlers/RemoteLogHandler.ts +0 -42
  111. package/src/handlers/index.ts +0 -8
  112. package/src/hooks/HookManager.ts +0 -177
  113. package/src/hooks/index.ts +0 -1
  114. package/src/index.ts +0 -395
  115. package/src/main.ts +0 -196
  116. package/src/serializers/SerializerRegistry.ts +0 -173
  117. package/src/serializers/index.ts +0 -1
  118. package/src/style.css +0 -96
  119. package/src/styling/LogStyleBuilder.ts +0 -355
  120. package/src/styling/SemanticStyles.ts +0 -380
  121. package/src/styling/SmartPresets.ts +0 -288
  122. package/src/styling/StyleBuilder.ts +0 -319
  123. package/src/styling/StyleCache.ts +0 -131
  124. package/src/styling/banners.ts +0 -168
  125. package/src/styling/index.ts +0 -27
  126. package/src/styling/themes.ts +0 -235
  127. package/src/styling-module.ts +0 -244
  128. package/src/terminal/color-converter.ts +0 -315
  129. package/src/terminal/formatter.ts +0 -236
  130. package/src/terminal/terminal-renderer.ts +0 -342
  131. package/src/transports/ConsoleTransport.ts +0 -28
  132. package/src/transports/FileTransport.ts +0 -53
  133. package/src/transports/HttpTransport.ts +0 -56
  134. package/src/transports/TransportManager.ts +0 -130
  135. package/src/transports/index.ts +0 -4
  136. package/src/types/core.ts +0 -417
  137. package/src/types/handlers.ts +0 -95
  138. package/src/types/hooks.ts +0 -45
  139. package/src/types/index.ts +0 -83
  140. package/src/types/serializers.ts +0 -30
  141. package/src/types/transports.ts +0 -52
  142. package/src/typescript.svg +0 -1
  143. package/src/utils/adapter.ts +0 -291
  144. package/src/utils/ansi-colors.ts +0 -333
  145. package/src/utils/environment-detector.ts +0 -170
  146. package/src/utils/environment.ts +0 -94
  147. package/src/utils/formatting.ts +0 -332
  148. package/src/utils/index.ts +0 -33
  149. package/src/utils/opentui-detection.ts +0 -138
  150. package/src/utils/output.ts +0 -227
  151. package/src/utils/stackTrace.ts +0 -144
  152. package/src/utils/timestamps.ts +0 -80
  153. package/src/vite-env.d.ts +0 -1
  154. package/src/writers/BufferWriter.ts +0 -157
  155. package/src/writers/index.ts +0 -6
  156. package/test-core-browser.html +0 -237
  157. package/test-core-node.js +0 -63
  158. package/tests/test-conflict-resolution.ts +0 -391
  159. package/tests/validate-workflows.sh +0 -131
  160. package/tests/yaml-autofix.sh +0 -146
  161. package/tsconfig.json +0 -50
  162. package/vite.config.ts +0 -256
@@ -1,391 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Script de Testing para Validación de Resolución de Conflictos
5
- * Simula escenarios de conflictos de git y valida que la resolución automática funcione
6
- */
7
-
8
- import { execSync, spawnSync } from 'child_process';
9
- import { existsSync, writeFileSync, readFileSync } from 'fs';
10
- import { join } from 'path';
11
-
12
- interface TestResult {
13
- name: string;
14
- passed: boolean;
15
- message: string;
16
- duration: number;
17
- }
18
-
19
- class ConflictResolutionTester {
20
- private projectRoot: string;
21
- private testBranch: string = 'test-conflict-resolution';
22
- private results: TestResult[] = [];
23
-
24
- constructor() {
25
- this.projectRoot = process.cwd();
26
- }
27
-
28
- private log(message: string): void {
29
- console.log(`🧪 ${message}`);
30
- }
31
-
32
- private logSuccess(message: string): void {
33
- console.log(`✅ ${message}`);
34
- }
35
-
36
- private logError(message: string): void {
37
- console.log(`❌ ${message}`);
38
- }
39
-
40
- private logWarning(message: string): void {
41
- console.log(`⚠️ ${message}`);
42
- }
43
-
44
- private async gitCommand(args: string[]): Promise<string> {
45
- const result = spawnSync('git', args, {
46
- cwd: this.projectRoot,
47
- encoding: 'utf-8',
48
- stdio: ['pipe', 'pipe', 'pipe']
49
- });
50
-
51
- if (result.status !== 0) {
52
- const error = result.stderr || 'Git command failed';
53
- throw new Error(`Git error: ${error}`);
54
- }
55
-
56
- return (result.stdout || '').trim();
57
- }
58
-
59
- private async runTest(testName: string, testFn: () => Promise<void>): Promise<void> {
60
- const startTime = Date.now();
61
- this.log(`Ejecutando: ${testName}`);
62
-
63
- try {
64
- await testFn();
65
- const duration = Date.now() - startTime;
66
- this.results.push({
67
- name: testName,
68
- passed: true,
69
- message: 'Test pasó exitosamente',
70
- duration
71
- });
72
- this.logSuccess(`${testName} - PASSED (${duration}ms)`);
73
- } catch (error) {
74
- const duration = Date.now() - startTime;
75
- this.results.push({
76
- name: testName,
77
- passed: false,
78
- message: error instanceof Error ? error.message : String(error),
79
- duration
80
- });
81
- this.logError(`${testName} - FAILED (${duration}ms): ${error}`);
82
- }
83
- }
84
-
85
- /**
86
- * Test 1: Validar detección de contexto de release
87
- */
88
- private async testReleaseContextDetection(): Promise<void> {
89
- // Simular archivos de release
90
- const testFiles = ['package.json', 'CHANGELOG.json', 'packages/core/package.json'];
91
-
92
- // Stage archivos relacionados con release
93
- for (const file of testFiles) {
94
- if (existsSync(join(this.projectRoot, file))) {
95
- await this.gitCommand(['add', file]);
96
- }
97
- }
98
-
99
- // Verificar que commit-generator detecta contexto de release
100
- const testEnv = {
101
- ...process.env,
102
- RELEASE_WORKFLOW: 'true',
103
- GITHUB_WORKFLOW: 'test-workflow'
104
- };
105
-
106
- // Note: Este test es conceptual ya que necesitaríamos importar la clase CommitGenerator
107
- // En un entorno real, podríamos extraer la lógica de detección a una función utilitaria
108
- this.log('Detección de contexto de release - conceptualmente validado');
109
- }
110
-
111
- /**
112
- * Test 2: Validar concurrency control en workflows
113
- */
114
- private async testConcurrencyControl(): Promise<void> {
115
- const workflowFiles = [
116
- '.github/workflows/releases-full.yml',
117
- '.github/workflows/releases-core.yml'
118
- ];
119
-
120
- for (const workflowFile of workflowFiles) {
121
- const fullPath = join(this.projectRoot, workflowFile);
122
- if (existsSync(fullPath)) {
123
- const content = readFileSync(fullPath, 'utf-8');
124
-
125
- // Verificar que contiene concurrency control
126
- if (!content.includes('concurrency:')) {
127
- throw new Error(`${workflowFile} no contiene concurrency control`);
128
- }
129
-
130
- if (!content.includes('group: release-pipeline-')) {
131
- throw new Error(`${workflowFile} no contiene group correcto`);
132
- }
133
-
134
- if (!content.includes('cancel-in-progress: true')) {
135
- throw new Error(`${workflowFile} no contiene cancel-in-progress`);
136
- }
137
-
138
- this.log(`✓ ${workflowFile} - Concurrency control validado`);
139
- }
140
- }
141
- }
142
-
143
- /**
144
- * Test 3: Validar estrategia pull-rebase-push en workflows
145
- */
146
- private async testPullRebasePushStrategy(): Promise<void> {
147
- const workflowFiles = [
148
- '.github/workflows/releases-full.yml',
149
- '.github/workflows/releases-core.yml'
150
- ];
151
-
152
- for (const workflowFile of workflowFiles) {
153
- const fullPath = join(this.projectRoot, workflowFile);
154
- if (existsSync(fullPath)) {
155
- const content = readFileSync(fullPath, 'utf-8');
156
-
157
- // Verificar elementos de la estrategia
158
- const requiredElements = [
159
- 'git fetch origin main',
160
- 'git rebase origin/main',
161
- 'git rebase --abort',
162
- 'git reset --hard origin/main',
163
- 'MAX_RETRIES=3',
164
- 'RETRY_COUNT=0'
165
- ];
166
-
167
- for (const element of requiredElements) {
168
- if (!content.includes(element)) {
169
- throw new Error(`${workflowFile} no contiene: ${element}`);
170
- }
171
- }
172
-
173
- this.log(`✓ ${workflowFile} - Estrategia pull-rebase-push validada`);
174
- }
175
- }
176
- }
177
-
178
- /**
179
- * Test 4: Validar integración de project-utils
180
- */
181
- private async testProjectUtilsIntegration(): Promise<void> {
182
- const workflowFiles = [
183
- '.github/workflows/releases-full.yml',
184
- '.github/workflows/releases-core.yml'
185
- ];
186
-
187
- for (const workflowFile of workflowFiles) {
188
- const fullPath = join(this.projectRoot, workflowFile);
189
- if (existsSync(fullPath)) {
190
- const content = readFileSync(fullPath, 'utf-8');
191
-
192
- // Verificar elementos de integración
193
- const requiredElements = [
194
- 'bun project-utils/commit-generator.ts',
195
- 'RELEASE_WORKFLOW=true',
196
- 'GITHUB_WORKFLOW=',
197
- '--auto-approve',
198
- '--quiet',
199
- 'estrategia de fallback'
200
- ];
201
-
202
- for (const element of requiredElements) {
203
- if (!content.includes(element)) {
204
- throw new Error(`${workflowFile} no contiene integración: ${element}`);
205
- }
206
- }
207
-
208
- this.log(`✓ ${workflowFile} - Integración project-utils validada`);
209
- }
210
- }
211
- }
212
-
213
- /**
214
- * Test 5: Validar que commit-generator tiene funciones anti-conflictos
215
- */
216
- private async testCommitGeneratorAntiConflict(): Promise<void> {
217
- const commitGeneratorPath = join(this.projectRoot, 'project-utils/commit-generator.ts');
218
-
219
- if (!existsSync(commitGeneratorPath)) {
220
- throw new Error('commit-generator.ts no existe');
221
- }
222
-
223
- const content = readFileSync(commitGeneratorPath, 'utf-8');
224
-
225
- const requiredMethods = [
226
- 'isReleaseWorkflowContext',
227
- 'handleReleaseWorkflowCommit',
228
- 'hasReleaseRelatedFiles',
229
- 'hasUnpushedCommits',
230
- 'getAllStagedFiles',
231
- 'analyzeConflictType',
232
- 'getConflictedFiles',
233
- 'autoResolveConflicts',
234
- 'createSafetyBackup',
235
- 'getCurrentBranch'
236
- ];
237
-
238
- for (const method of requiredMethods) {
239
- if (!content.includes(method)) {
240
- throw new Error(`commit-generator.ts no contiene método: ${method}`);
241
- }
242
- }
243
-
244
- // Verificar lógica específica
245
- const requiredLogic = [
246
- 'GITHUB_ACTIONS === \'true\'',
247
- 'RELEASE_WORKFLOW === \'true\'',
248
- 'git fetch origin',
249
- 'git rebase',
250
- 'MAX_RETRIES=3',
251
- 'releasePatterns',
252
- 'conflictType:',
253
- 'canAutoResolve',
254
- 'requiresManualIntervention',
255
- 'backup-before-conflict-resolution',
256
- 'type-check'
257
- ];
258
-
259
- for (const logic of requiredLogic) {
260
- if (!content.includes(logic)) {
261
- throw new Error(`commit-generator.ts no contiene lógica: ${logic}`);
262
- }
263
- }
264
-
265
- this.log('✓ commit-generator.ts - Funciones anti-conflictos validadas');
266
- }
267
-
268
- /**
269
- * Test 6: Simular escenario de conflicto (test conceptual)
270
- */
271
- private async testConflictSimulation(): Promise<void> {
272
- this.log('Simulación de conflicto - test conceptual');
273
-
274
- // En un entorno real, esto crearía una situación de conflicto y verificaría la resolución
275
- // Por ahora, validamos que todos los componentes estén en su lugar
276
-
277
- const components = [
278
- 'project-utils/commit-generator.ts',
279
- '.github/workflows/releases-full.yml',
280
- '.github/workflows/releases-core.yml'
281
- ];
282
-
283
- for (const component of components) {
284
- if (!existsSync(join(this.projectRoot, component))) {
285
- throw new Error(`Componente faltante: ${component}`);
286
- }
287
- }
288
-
289
- this.log('✓ Todos los componentes están presentes para resolución de conflictos');
290
- }
291
-
292
- /**
293
- * Ejecuta todos los tests
294
- */
295
- async runAllTests(): Promise<void> {
296
- this.log('🚀 Iniciando testing de resolución de conflictos...\n');
297
-
298
- await this.runTest(
299
- 'Detección de contexto de release',
300
- () => this.testReleaseContextDetection()
301
- );
302
-
303
- await this.runTest(
304
- 'Concurrency control en workflows',
305
- () => this.testConcurrencyControl()
306
- );
307
-
308
- await this.runTest(
309
- 'Estrategia pull-rebase-push',
310
- () => this.testPullRebasePushStrategy()
311
- );
312
-
313
- await this.runTest(
314
- 'Integración project-utils',
315
- () => this.testProjectUtilsIntegration()
316
- );
317
-
318
- await this.runTest(
319
- 'Funciones anti-conflictos en commit-generator',
320
- () => this.testCommitGeneratorAntiConflict()
321
- );
322
-
323
- await this.runTest(
324
- 'Simulación de conflicto',
325
- () => this.testConflictSimulation()
326
- );
327
-
328
- this.printResults();
329
- }
330
-
331
- private printResults(): void {
332
- const passed = this.results.filter(r => r.passed).length;
333
- const failed = this.results.filter(r => r.passed === false).length;
334
- const totalDuration = this.results.reduce((sum, r) => sum + r.duration, 0);
335
-
336
- console.log('\n' + '='.repeat(60));
337
- console.log('📊 RESUMEN DE TESTING - RESOLUCIÓN DE CONFLICTOS');
338
- console.log('='.repeat(60));
339
- console.log(`✅ Tests pasados: ${passed}`);
340
- console.log(`❌ Tests fallidos: ${failed}`);
341
- console.log(`⏱️ Duración total: ${totalDuration}ms`);
342
- console.log('='.repeat(60));
343
-
344
- if (failed > 0) {
345
- console.log('\n❌ TESTS FALLIDOS:');
346
- this.results
347
- .filter(r => !r.passed)
348
- .forEach(r => {
349
- console.log(` - ${r.name}: ${r.message}`);
350
- });
351
- }
352
-
353
- if (passed === this.results.length) {
354
- console.log('\n🎉 TODOS LOS TESTS PASARON - Resolución de conflictos implementada correctamente');
355
- process.exit(0);
356
- } else {
357
- console.log('\n⚠️ ALGUNOS TESTS FALLARON - Revisar implementación');
358
- process.exit(1);
359
- }
360
- }
361
- }
362
-
363
- // Ejecutar tests si se llama directamente
364
- if (import.meta.main) {
365
- const tester = new ConflictResolutionTester();
366
-
367
- if (process.argv.includes('--help') || process.argv.includes('-h')) {
368
- console.log(`
369
- 🧪 Test de Resolución de Conflictos
370
-
371
- Valida que la implementación de resolución automática de conflictos esté correcta.
372
-
373
- Uso:
374
- bun project-utils/test-conflict-resolution.ts
375
-
376
- Tests incluidos:
377
- 1. Detección de contexto de release
378
- 2. Concurrency control en workflows
379
- 3. Estrategia pull-rebase-push
380
- 4. Integración project-utils
381
- 5. Funciones anti-conflictos
382
- 6. Simulación de conflicto
383
-
384
- Opciones:
385
- --help, -h Mostrar esta ayuda
386
- `);
387
- process.exit(0);
388
- }
389
-
390
- await tester.runAllTests();
391
- }
@@ -1,131 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Script de validación de workflows YAML
4
- # Valida sintaxis y estructura de workflows de GitHub Actions
5
-
6
- set -e
7
-
8
- echo "🔍 Validando workflows YAML..."
9
-
10
- WORKFLOW_DIR=".github/workflows"
11
- EXIT_CODE=0
12
-
13
- # Función para validar un archivo YAML
14
- validate_yaml() {
15
- local file="$1"
16
- echo "📄 Validando: $file"
17
-
18
- # Validar sintaxis YAML básica
19
- if command -v yamllint >/dev/null 2>&1; then
20
- echo " 🔧 Verificando sintaxis con yamllint..."
21
- if yamllint -c .yamllint "$file"; then
22
- echo " ✅ Sintaxis YAML válida"
23
- else
24
- echo " ❌ Error de sintaxis YAML"
25
- EXIT_CODE=1
26
- fi
27
- else
28
- echo " ⚠️ yamllint no disponible, saltando validación de sintaxis"
29
- fi
30
-
31
- # Validar estructura de workflow específica
32
- echo " 🔍 Verificando estructura de workflow..."
33
-
34
- # Verificar elementos obligatorios
35
- if ! grep -q "^name:" "$file"; then
36
- echo " ❌ Falta campo 'name'"
37
- EXIT_CODE=1
38
- fi
39
-
40
- if ! grep -q "^on:" "$file"; then
41
- echo " ❌ Falta campo 'on'"
42
- EXIT_CODE=1
43
- fi
44
-
45
- if ! grep -q "^jobs:" "$file"; then
46
- echo " ❌ Falta campo 'jobs'"
47
- EXIT_CODE=1
48
- fi
49
-
50
- # Verificar concurrency control en workflows de release
51
- if [[ "$file" == *"release"* ]]; then
52
- if ! grep -q "^concurrency:" "$file"; then
53
- echo " ❌ Workflow de release falta concurrency control"
54
- EXIT_CODE=1
55
- fi
56
-
57
- if ! grep -q "group: release-pipeline-" "$file"; then
58
- echo " ❌ Falta group correcto en concurrency"
59
- EXIT_CODE=1
60
- fi
61
-
62
- if ! grep -q "cancel-in-progress: true" "$file"; then
63
- echo " ❌ Falta cancel-in-progress en concurrency"
64
- EXIT_CODE=1
65
- fi
66
-
67
- echo " ✅ Concurrency control verificado"
68
- fi
69
-
70
- # Verificar estrategia anti-conflictos en releases
71
- if [[ "$file" == *"release"* ]]; then
72
- if grep -q "git fetch origin" "$file" &&
73
- grep -q "git rebase" "$file" &&
74
- grep -q "MAX_RETRIES" "$file"; then
75
- echo " ✅ Estrategia anti-conflictos verificada"
76
- else
77
- echo " ❌ Estrategia anti-conflictos incompleta"
78
- EXIT_CODE=1
79
- fi
80
- fi
81
-
82
- # Verificar integración project-utils en releases
83
- if [[ "$file" == *"release"* ]]; then
84
- if grep -q "bun project-utils/commit-generator.ts" "$file" &&
85
- grep -q "RELEASE_WORKFLOW=true" "$file"; then
86
- echo " ✅ Integración project-utils verificada"
87
- else
88
- echo " ❌ Integración project-utils incompleta"
89
- EXIT_CODE=1
90
- fi
91
- fi
92
-
93
- echo " ✅ Validación de $file completada"
94
- echo ""
95
- }
96
-
97
- # Verificar que existe el directorio de workflows
98
- if [ ! -d "$WORKFLOW_DIR" ]; then
99
- echo "❌ Directorio $WORKFLOW_DIR no encontrado"
100
- exit 1
101
- fi
102
-
103
- # Validar todos los archivos YAML en el directorio
104
- echo "🚀 Iniciando validación de workflows..."
105
- echo ""
106
-
107
- for file in "$WORKFLOW_DIR"/*.yml "$WORKFLOW_DIR"/*.yaml; do
108
- if [ -f "$file" ]; then
109
- validate_yaml "$file"
110
- fi
111
- done
112
-
113
- # Resumen final
114
- echo "============================================================"
115
- echo "📊 RESUMEN DE VALIDACIÓN YAML"
116
- echo "============================================================"
117
-
118
- if [ $EXIT_CODE -eq 0 ]; then
119
- echo "✅ TODOS LOS WORKFLOWS SON VÁLIDOS"
120
- echo "🎉 Sintaxis YAML correcta"
121
- echo "🎉 Estructura de workflows completa"
122
- echo "🎉 Concurrency control implementado"
123
- echo "🎉 Estrategias anti-conflictos verificadas"
124
- echo "🎉 Integración project-utils confirmada"
125
- else
126
- echo "❌ SE ENCONTRARON ERRORES EN WORKFLOWS"
127
- echo "⚠️ Revisar los mensajes de error anteriores"
128
- fi
129
-
130
- echo "============================================================"
131
- exit $EXIT_CODE
@@ -1,146 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Script de auto-fix para archivos YAML
4
- # Corrige automáticamente problemas comunes de sintaxis y formato
5
-
6
- set -e
7
-
8
- echo "🔧 Auto-fixing YAML files..."
9
-
10
- WORKFLOW_DIR=".github/workflows"
11
- EXIT_CODE=0
12
- FIXED_FILES=0
13
-
14
- # Función para auto-fix un archivo YAML
15
- autofix_yaml() {
16
- local file="$1"
17
- echo "🔧 Auto-fixing: $file"
18
-
19
- local temp_file=$(mktemp)
20
- local changes_made=false
21
-
22
- # 1. Remover trailing spaces
23
- if sed 's/[[:space:]]*$//' "$file" > "$temp_file"; then
24
- if ! cmp -s "$file" "$temp_file"; then
25
- echo " ✓ Removed trailing spaces"
26
- changes_made=true
27
- fi
28
- cp "$temp_file" "$file"
29
- fi
30
-
31
- # 2. Corregir líneas demasiado largas en comentarios
32
- if sed -E 's/^([[:space:]]*#.{75}).+$/\1.../' "$file" > "$temp_file"; then
33
- if ! cmp -s "$file" "$temp_file"; then
34
- echo " ✓ Truncated long comment lines"
35
- changes_made=true
36
- fi
37
- cp "$temp_file" "$file"
38
- fi
39
-
40
- # 3. Escapar emojis y caracteres especiales en names
41
- if sed -E 's/^([[:space:]]*- name: )([^"]*[🔧📄🚀✅❌⚠️🎉📋🔄📥📦🏗️🧪🤖🏷️📤][^"]*)/\1"\2"/' "$file" > "$temp_file"; then
42
- if ! cmp -s "$file" "$temp_file"; then
43
- echo " ✓ Quoted names with special characters"
44
- changes_made=true
45
- fi
46
- cp "$temp_file" "$file"
47
- fi
48
-
49
- # 4. Normalizar boolean values (on -> true/false)
50
- if sed -E 's/^([[:space:]]*[a-zA-Z_-]+:[[:space:]]*)on([[:space:]]*$)/\1true\2/' "$file" > "$temp_file"; then
51
- if ! cmp -s "$file" "$temp_file"; then
52
- echo " ✓ Normalized boolean values"
53
- changes_made=true
54
- fi
55
- cp "$temp_file" "$file"
56
- fi
57
-
58
- # 5. Corregir indentación básica (2 spaces)
59
- if sed -E 's/^( )+/ /' "$file" > "$temp_file"; then
60
- # Solo aplicar si mejora la indentación
61
- if yamllint --format parsable "$temp_file" 2>/dev/null | grep -q "wrong indentation"; then
62
- # Revertir si empeora
63
- cp "$file" "$temp_file"
64
- else
65
- if ! cmp -s "$file" "$temp_file"; then
66
- echo " ✓ Fixed basic indentation"
67
- changes_made=true
68
- fi
69
- fi
70
- cp "$temp_file" "$file"
71
- fi
72
-
73
- # 6. Skip advanced line splitting for now (needs improvement)
74
- # TODO: Implement smarter line breaking for YAML multiline strings
75
-
76
- # Cleanup
77
- rm -f "$temp_file"
78
-
79
- if [ "$changes_made" = true ]; then
80
- echo " ✅ Auto-fixes applied to $file"
81
- FIXED_FILES=$((FIXED_FILES + 1))
82
- else
83
- echo " ℹ️ No fixes needed for $file"
84
- fi
85
-
86
- # Validar después de los fixes
87
- if command -v yamllint >/dev/null 2>&1; then
88
- if yamllint "$file" >/dev/null 2>&1; then
89
- echo " ✅ YAML syntax valid after fixes"
90
- else
91
- echo " ⚠️ Manual intervention may be needed"
92
- EXIT_CODE=1
93
- fi
94
- fi
95
-
96
- echo ""
97
- }
98
-
99
- # Verificar que existe el directorio de workflows
100
- if [ ! -d "$WORKFLOW_DIR" ]; then
101
- echo "❌ Directorio $WORKFLOW_DIR no encontrado"
102
- exit 1
103
- fi
104
-
105
- # Auto-fix todos los archivos YAML en el directorio
106
- echo "🚀 Starting YAML auto-fix..."
107
- echo ""
108
-
109
- for file in "$WORKFLOW_DIR"/*.yml "$WORKFLOW_DIR"/*.yaml; do
110
- if [ -f "$file" ]; then
111
- autofix_yaml "$file"
112
- fi
113
- done
114
-
115
- # También fix archivos YAML en root si existen
116
- for file in .yamllint .github/dependabot.yml; do
117
- if [ -f "$file" ]; then
118
- autofix_yaml "$file"
119
- fi
120
- done
121
-
122
- # Resumen final
123
- echo "============================================================"
124
- echo "🔧 YAML AUTO-FIX SUMMARY"
125
- echo "============================================================"
126
- echo "📄 Files processed: $(find "$WORKFLOW_DIR" -name "*.yml" -o -name "*.yaml" | wc -l | tr -d ' ')"
127
- echo "🔧 Files fixed: $FIXED_FILES"
128
-
129
- if [ $EXIT_CODE -eq 0 ]; then
130
- echo "✅ ALL FILES AUTO-FIXED SUCCESSFULLY"
131
- echo "💡 Run 'npm run validate:workflows' to verify fixes"
132
- else
133
- echo "⚠️ SOME FILES MAY NEED MANUAL INTERVENTION"
134
- echo "💡 Check yamllint output for remaining issues"
135
- fi
136
-
137
- echo "============================================================"
138
-
139
- # Mostrar comandos útiles
140
- echo ""
141
- echo "🚀 Next steps:"
142
- echo " npm run lint:yaml # Check syntax"
143
- echo " npm run validate:workflows # Full validation"
144
- echo " git diff # Review changes"
145
-
146
- exit $EXIT_CODE