@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.
- package/dist/chunks/{Logger-Cbi1f10o.js → Logger-CKqzXDh3.js} +2 -2
- package/dist/chunks/{Logger-Cbi1f10o.js.map → Logger-CKqzXDh3.js.map} +1 -1
- package/dist/chunks/{Logger-BZ7B7OXE.js → Logger-D_vuKP4l.js} +2 -2
- package/dist/chunks/{Logger-BZ7B7OXE.js.map → Logger-D_vuKP4l.js.map} +1 -1
- package/dist/chunks/cli-module-B-njrTWb.js +2 -0
- package/dist/chunks/cli-module-B-njrTWb.js.map +1 -0
- package/dist/chunks/{cli-module-ClIJmaT8.js → cli-module-Cx7qotPY.js} +16 -9
- package/dist/chunks/cli-module-Cx7qotPY.js.map +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/exports.cjs +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/styling.cjs +1 -1
- package/dist/styling.js +2 -2
- package/dist/terminal/formatter.d.ts.map +1 -1
- package/package.json +5 -1
- package/.claude/settings.local.json +0 -48
- package/.github/workflows/ci-quality.yml +0 -357
- package/.github/workflows/docs-demo.yml +0 -119
- package/.github/workflows/releases-core.yml +0 -512
- package/.github/workflows/releases-full.yml +0 -582
- package/.github/workflows-backup/ci.yml +0 -221
- package/.github/workflows-backup/nightly.yml +0 -196
- package/.github/workflows-backup/release-optimized.yml +0 -373
- package/.github/workflows-backup/release.yml +0 -269
- package/.release-notes-0.2.0.md +0 -129
- package/.yamllint +0 -28
- package/CHANGELOG.json +0 -1076
- package/CHANGELOG.md +0 -209
- package/CLAUDE.md +0 -217
- package/bun.lock +0 -333
- package/demo.html +0 -847
- package/dist/chunks/cli-module-CadqgZ1Z.js +0 -2
- package/dist/chunks/cli-module-CadqgZ1Z.js.map +0 -1
- package/dist/chunks/cli-module-ClIJmaT8.js.map +0 -1
- package/docs/API.md +0 -918
- package/docs/CORE.md +0 -264
- package/docs/DEVELOPMENT.md +0 -731
- package/docs/EXPORTS.md +0 -467
- package/docs/PACKAGES.md +0 -244
- package/docs/STYLING.md +0 -405
- package/docs/_config.yml +0 -36
- package/docs/index.md +0 -179
- package/examples/README.md +0 -208
- package/examples/basic-logging.js +0 -75
- package/examples/data-export.js +0 -234
- package/examples/package.json +0 -16
- package/examples/performance-timing.js +0 -170
- package/examples/simplified-api.js +0 -124
- package/examples/styling-themes.js +0 -207
- package/index.html +0 -358
- package/packages/core/package.json +0 -57
- package/packages/exports/package.json +0 -41
- package/packages/nodejs-opentui/README.md +0 -232
- package/packages/nodejs-opentui/package.json +0 -72
- package/packages/nodejs-opentui/src/LogRenderer.ts +0 -171
- package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +0 -178
- package/packages/nodejs-opentui/src/components/LogBadge.tsx +0 -131
- package/packages/nodejs-opentui/src/index.ts +0 -133
- package/packages/nodejs-opentui/src/types.ts +0 -158
- package/packages/nodejs-opentui/tsconfig.json +0 -20
- package/packages/styling/package.json +0 -41
- package/playground/demo-all.ts +0 -95
- package/playground/demo-box.ts +0 -85
- package/playground/demo-levels.ts +0 -56
- package/playground/demo-real-world.ts +0 -98
- package/playground/demo-spinner.ts +0 -77
- package/playground/demo-steps.ts +0 -72
- package/playground/demo-table.ts +0 -83
- package/project-utils/README.md +0 -172
- package/project-utils/auto-release-gemini.ts +0 -1193
- package/project-utils/auto-release-ui.ts +0 -1329
- package/project-utils/commit-generator.ts +0 -1385
- package/project-utils/commit-ui.ts +0 -264
- package/project-utils/git-utils.ts +0 -199
- package/project-utils/github-release-manager.ts +0 -466
- package/project-utils/project-config.ts +0 -260
- package/project-utils/prompt-templates.js +0 -345
- package/project-utils/prompt-templates.ts +0 -422
- package/project-utils/version-manager.ts +0 -1078
- package/public/vite.svg +0 -1
- package/src/Logger.ts +0 -1858
- package/src/ScopedLogger.ts +0 -256
- package/src/cli/CommandProcessor.ts +0 -248
- package/src/cli/commands/ConfigCommand.ts +0 -93
- package/src/cli/commands/ExportCommand.ts +0 -276
- package/src/cli/commands/HistoryCommand.ts +0 -117
- package/src/cli/commands/StatusCommand.ts +0 -112
- package/src/cli/commands/ThemeCommand.ts +0 -88
- package/src/cli/help.ts +0 -127
- package/src/cli/index.ts +0 -71
- package/src/cli-module.ts +0 -21
- package/src/cli-primitives/box.ts +0 -86
- package/src/cli-primitives/cli-table.ts +0 -62
- package/src/cli-primitives/divider.ts +0 -17
- package/src/cli-primitives/header.ts +0 -18
- package/src/cli-primitives/index.ts +0 -13
- package/src/cli-primitives/server-fallback.ts +0 -54
- package/src/cli-primitives/spinner.ts +0 -133
- package/src/cli-primitives/step.ts +0 -22
- package/src/constants.ts +0 -313
- package/src/core.ts +0 -397
- package/src/example.ts +0 -210
- package/src/exports-module.ts +0 -311
- package/src/handlers/AnalyticsLogHandler.ts +0 -22
- package/src/handlers/ExportLogHandler.ts +0 -610
- package/src/handlers/FileLogHandler.ts +0 -169
- package/src/handlers/RemoteLogHandler.ts +0 -42
- package/src/handlers/index.ts +0 -8
- package/src/hooks/HookManager.ts +0 -177
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +0 -395
- package/src/main.ts +0 -196
- package/src/serializers/SerializerRegistry.ts +0 -173
- package/src/serializers/index.ts +0 -1
- package/src/style.css +0 -96
- package/src/styling/LogStyleBuilder.ts +0 -355
- package/src/styling/SemanticStyles.ts +0 -380
- package/src/styling/SmartPresets.ts +0 -288
- package/src/styling/StyleBuilder.ts +0 -319
- package/src/styling/StyleCache.ts +0 -131
- package/src/styling/banners.ts +0 -168
- package/src/styling/index.ts +0 -27
- package/src/styling/themes.ts +0 -235
- package/src/styling-module.ts +0 -244
- package/src/terminal/color-converter.ts +0 -315
- package/src/terminal/formatter.ts +0 -236
- package/src/terminal/terminal-renderer.ts +0 -342
- package/src/transports/ConsoleTransport.ts +0 -28
- package/src/transports/FileTransport.ts +0 -53
- package/src/transports/HttpTransport.ts +0 -56
- package/src/transports/TransportManager.ts +0 -130
- package/src/transports/index.ts +0 -4
- package/src/types/core.ts +0 -417
- package/src/types/handlers.ts +0 -95
- package/src/types/hooks.ts +0 -45
- package/src/types/index.ts +0 -83
- package/src/types/serializers.ts +0 -30
- package/src/types/transports.ts +0 -52
- package/src/typescript.svg +0 -1
- package/src/utils/adapter.ts +0 -291
- package/src/utils/ansi-colors.ts +0 -333
- package/src/utils/environment-detector.ts +0 -170
- package/src/utils/environment.ts +0 -94
- package/src/utils/formatting.ts +0 -332
- package/src/utils/index.ts +0 -33
- package/src/utils/opentui-detection.ts +0 -138
- package/src/utils/output.ts +0 -227
- package/src/utils/stackTrace.ts +0 -144
- package/src/utils/timestamps.ts +0 -80
- package/src/vite-env.d.ts +0 -1
- package/src/writers/BufferWriter.ts +0 -157
- package/src/writers/index.ts +0 -6
- package/test-core-browser.html +0 -237
- package/test-core-node.js +0 -63
- package/tests/test-conflict-resolution.ts +0 -391
- package/tests/validate-workflows.sh +0 -131
- package/tests/yaml-autofix.sh +0 -146
- package/tsconfig.json +0 -50
- package/vite.config.ts +0 -256
package/CHANGELOG.md
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
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).
|
|
7
|
-
|
|
8
|
-
## [3.0.0] - 2024-12-28
|
|
9
|
-
|
|
10
|
-
### 💥 Breaking Changes
|
|
11
|
-
- `ScopedLogger` ya no hereda de `Logger` - usa delegación para ~50-100x menos memoria
|
|
12
|
-
- Métodos `component()`, `api()`, `scope()` ahora son síncronos (antes devolvían Promise)
|
|
13
|
-
- `LogEntry` de hooks renombrado a `HookLogEntry` para evitar conflicto con handlers
|
|
14
|
-
|
|
15
|
-
### ✨ Features
|
|
16
|
-
|
|
17
|
-
#### Custom Serializers
|
|
18
|
-
Sistema de serialización extensible para objetos personalizados:
|
|
19
|
-
```typescript
|
|
20
|
-
logger.addSerializer(Error, (err) => ({
|
|
21
|
-
name: err.name,
|
|
22
|
-
message: err.message,
|
|
23
|
-
stack: err.stack?.split('\n').slice(0, 5)
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
logger.addSerializer(User, (user) => ({
|
|
27
|
-
id: user.id,
|
|
28
|
-
email: user.email // password omitido por seguridad
|
|
29
|
-
}));
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
#### Hooks & Middleware
|
|
33
|
-
Sistema de eventos y middleware para interceptar logs:
|
|
34
|
-
```typescript
|
|
35
|
-
// Hooks
|
|
36
|
-
logger.on('beforeLog', (entry) => {
|
|
37
|
-
entry.correlationId = getCorrelationId();
|
|
38
|
-
return entry;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
logger.on('afterLog', (entry) => {
|
|
42
|
-
metrics.increment(`logs.${entry.level}`);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Middleware
|
|
46
|
-
logger.use((entry, next) => {
|
|
47
|
-
entry.requestId = asyncLocalStorage.getStore()?.requestId;
|
|
48
|
-
next();
|
|
49
|
-
});
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
#### Transports System
|
|
53
|
-
Sistema de transports similar a Pino para envío de logs:
|
|
54
|
-
```typescript
|
|
55
|
-
// File transport
|
|
56
|
-
logger.addTransport({
|
|
57
|
-
target: 'file',
|
|
58
|
-
options: { destination: '/var/log/app.log' }
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// HTTP transport con batching
|
|
62
|
-
logger.addTransport({
|
|
63
|
-
target: 'http',
|
|
64
|
-
options: {
|
|
65
|
-
url: 'https://logs.example.com',
|
|
66
|
-
batchSize: 100,
|
|
67
|
-
flushInterval: 5000
|
|
68
|
-
},
|
|
69
|
-
level: 'warn'
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// Custom transport
|
|
73
|
-
logger.addTransport({
|
|
74
|
-
target: {
|
|
75
|
-
name: 'elasticsearch',
|
|
76
|
-
write: async (record) => {
|
|
77
|
-
await esClient.index({ index: 'logs', body: record });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
#### Badges System
|
|
84
|
-
Sistema de badges para etiquetar logs:
|
|
85
|
-
```typescript
|
|
86
|
-
logger.badges(['v3', 'stable']).info('Release publicado');
|
|
87
|
-
logger.badge('DEBUG').info('Modo debug activo');
|
|
88
|
-
logger.clearBadges();
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
#### Interface Bindings
|
|
92
|
-
Nueva interfaz `Bindings` para contexto de logs:
|
|
93
|
-
```typescript
|
|
94
|
-
interface Bindings {
|
|
95
|
-
scope?: string;
|
|
96
|
-
badges?: string[];
|
|
97
|
-
context?: Record<string, any>;
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 🚀 Performance
|
|
102
|
-
- **~50-100x menos memoria** en child loggers (delegación vs herencia)
|
|
103
|
-
- **~10-20x más rápido** creación de child loggers
|
|
104
|
-
- **Style Cache** con LRU y TTL para estilos computados
|
|
105
|
-
- Serialización automática con detección de tipos
|
|
106
|
-
|
|
107
|
-
### 📦 New Exports
|
|
108
|
-
```typescript
|
|
109
|
-
// Classes
|
|
110
|
-
export { SerializerRegistry, HookManager, TransportManager };
|
|
111
|
-
export { ConsoleTransport, FileTransport, HttpTransport };
|
|
112
|
-
export { StyleCache, getStyleCache };
|
|
113
|
-
|
|
114
|
-
// Types
|
|
115
|
-
export type { SerializerFn, SerializerContext, ISerializerRegistry };
|
|
116
|
-
export type { HookLogEntry, HookEvent, HookCallback, MiddlewareFn, IHookManager };
|
|
117
|
-
export type { TransportRecord, TransportTarget, ITransport, StyleCacheConfig };
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## [2.0.0] - 2024-12-20
|
|
123
|
-
|
|
124
|
-
### ✨ Features
|
|
125
|
-
- **ScopedLogger con delegación**: Arquitectura ligera sin herencia
|
|
126
|
-
- **Métodos síncronos**: `component()`, `api()`, `scope()` ya no son async
|
|
127
|
-
- **logWithBindings()**: Método para logging con contexto de bindings
|
|
128
|
-
|
|
129
|
-
### 🔧 Internal
|
|
130
|
-
- Refactorizado sistema de child loggers para mejor performance
|
|
131
|
-
- Reducido footprint de memoria en aplicaciones con muchos loggers
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## [1.2.0] - 2024-10-28
|
|
136
|
-
|
|
137
|
-
### ✨ Added
|
|
138
|
-
- **🌟 Dual Environment Support**: Automatic detection and adaptation between browser and terminal environments
|
|
139
|
-
- **🎨 ANSI Color Support**: Full terminal color support using ANSI escape sequences
|
|
140
|
-
- **🖥️ Terminal Renderer**: Dedicated rendering engine for terminal/servers with optimized formatting
|
|
141
|
-
- **🔄 Smart Adapter System**: Converts CSS-based styles to ANSI formatting automatically
|
|
142
|
-
- **🔍 Environment Detection**: Robust detection of browser, terminal, server, and Node.js environments
|
|
143
|
-
- **📱 All Presets Adapted**: All existing presets (cyberpunk, production, minimal, debug, glassmorphism) now work in terminal
|
|
144
|
-
- **⚡ Performance Optimized**: Zero configuration required - automatic adaptation based on environment
|
|
145
|
-
|
|
146
|
-
### 🔧 Technical Changes
|
|
147
|
-
- **New Modules**:
|
|
148
|
-
- `src/terminal/terminal-renderer.ts` - ANSI rendering engine
|
|
149
|
-
- `src/utils/environment-detector.ts` - Environment detection system
|
|
150
|
-
- `src/utils/adapter.ts` - CSS to ANSI adapter
|
|
151
|
-
- **Enhanced Core**:
|
|
152
|
-
- Updated `createStyledOutput()` to support dual rendering
|
|
153
|
-
- Modified Logger class to pass preset information to terminal renderer
|
|
154
|
-
- Added smart preset message handling (verbose logs only in browser)
|
|
155
|
-
|
|
156
|
-
### 🎯 Features
|
|
157
|
-
- **Automatic Environment Detection**: Detects browser vs terminal vs server automatically
|
|
158
|
-
- **Seamless Presets**: Same presets work in both environments with appropriate styling
|
|
159
|
-
- **Color Capability Detection**: Supports full color, basic 16-color, and no-color modes
|
|
160
|
-
- **Terminal Optimized**: Cyberpunk preset with vibrant ANSI colors in terminal
|
|
161
|
-
- **Clean Production Logs**: Professional formatting optimized for server logs
|
|
162
|
-
|
|
163
|
-
### 📚 Enhanced Documentation
|
|
164
|
-
- Updated package.json with new keywords: terminal, ansi, chalk, server, nodejs
|
|
165
|
-
- Enhanced description highlighting dual environment support
|
|
166
|
-
|
|
167
|
-
## [1.2.1] - 2024-10-28
|
|
168
|
-
|
|
169
|
-
### 🔧 Fixes
|
|
170
|
-
- **Enhanced Domain Badges**: Domain/scope now displays as proper badges with background color (e.g., `[CONNECTION]` instead of plain text)
|
|
171
|
-
- **Improved Stack Trace**: Better filtering of minified/bundle files to show TypeScript source locations
|
|
172
|
-
- **Cleaner File Names**: Transforms minified filenames like `Logger-BynuRJQf.js` to clean names like `logger.ts`
|
|
173
|
-
- **Consistent Styling**: All badges (level and domain) now use consistent visual styling
|
|
174
|
-
|
|
175
|
-
### 🎨 Visual Improvements
|
|
176
|
-
- Domain badges use background color + text styling similar to level badges
|
|
177
|
-
- Uppercase domain names for better visibility
|
|
178
|
-
- Enhanced cyberpunk preset with more vibrant badge styling
|
|
179
|
-
- Better visual hierarchy in terminal logs
|
|
180
|
-
|
|
181
|
-
### 🐛 Bug Fixes
|
|
182
|
-
- Fixed undefined filename handling in stack trace parsing
|
|
183
|
-
- Improved TypeScript type safety in stack trace functions
|
|
184
|
-
- Better error handling for malformed stack traces
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## [1.1.0] - Previous
|
|
189
|
-
|
|
190
|
-
### ✨ Added
|
|
191
|
-
- Advanced styling system with CSS gradients and animations
|
|
192
|
-
- Smart presets (cyberpunk, glassmorphism, minimal, debug, production)
|
|
193
|
-
- Scoped loggers with automatic prefix management
|
|
194
|
-
- Performance monitoring with timing capabilities
|
|
195
|
-
- CLI integration with interactive commands
|
|
196
|
-
- Export handlers for file and remote logging
|
|
197
|
-
- SVG and animation support
|
|
198
|
-
- Theme detection and automatic adaptation
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
## [1.0.0] - Initial Release
|
|
203
|
-
|
|
204
|
-
### ✨ Added
|
|
205
|
-
- Core logging functionality with multiple log levels
|
|
206
|
-
- Style Builder with fluent API
|
|
207
|
-
- Browser DevTools integration
|
|
208
|
-
- TypeScript definitions
|
|
209
|
-
- Basic theming system
|
package/CLAUDE.md
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
This is an **Advanced Logger** TypeScript library that provides state-of-the-art console logging with advanced CSS styling, performance monitoring, and extensible architecture. The project is built with modern TypeScript patterns and targets browser environments.
|
|
8
|
-
|
|
9
|
-
### Core Architecture
|
|
10
|
-
|
|
11
|
-
- **Main Logger Class**: `src/Logger.ts` contains the primary Logger class with advanced styling capabilities
|
|
12
|
-
- **Style System**: Built around a fluent `StyleBuilder` class that creates CSS-in-JS console styles
|
|
13
|
-
- **Handler Architecture**: Extensible system with `ILogHandler` interface for custom log destinations (File, Remote, Analytics)
|
|
14
|
-
- **Scoped Logging**: Support for prefixed logger instances for different modules/components
|
|
15
|
-
- **Performance Monitoring**: Built-in timing capabilities with `time()` and `timeEnd()`
|
|
16
|
-
|
|
17
|
-
### Key Components
|
|
18
|
-
|
|
19
|
-
- **Logger Core** (`src/Logger.ts:373-732`): Main logger implementation with hierarchical log levels
|
|
20
|
-
- **Style Builder** (`src/Logger.ts:141-226`): Chainable CSS styling system
|
|
21
|
-
- **Log Handlers** (`src/Logger.ts:737-971`): FileLogHandler, RemoteLogHandler, AnalyticsLogHandler
|
|
22
|
-
- **Demo/Test Interface** (`index.html`): Interactive test page with styled buttons
|
|
23
|
-
- **Usage Examples** (`src/example.ts`, `src/main.ts`): Comprehensive usage demonstrations
|
|
24
|
-
|
|
25
|
-
## Development Commands
|
|
26
|
-
|
|
27
|
-
### Build & Development
|
|
28
|
-
```bash
|
|
29
|
-
npm run dev # Start Vite dev server (runs on http://localhost:5173)
|
|
30
|
-
npm run build # TypeScript compilation + Vite production build
|
|
31
|
-
npm run preview # Preview production build
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Testing the Logger
|
|
35
|
-
- Open `index.html` in development server
|
|
36
|
-
- Use browser DevTools console to see styled output
|
|
37
|
-
- Click buttons to test different log levels and features
|
|
38
|
-
|
|
39
|
-
### Testing & Validation
|
|
40
|
-
```bash
|
|
41
|
-
# Validar workflows YAML y estructura
|
|
42
|
-
npm run validate:workflows
|
|
43
|
-
|
|
44
|
-
# Test completo de resolución de conflictos
|
|
45
|
-
npm run test:workflows
|
|
46
|
-
|
|
47
|
-
# Lint YAML con configuración personalizada
|
|
48
|
-
npm run lint:yaml
|
|
49
|
-
|
|
50
|
-
# Auto-fix problemas YAML comunes
|
|
51
|
-
npm run fix:yaml
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**IMPORTANTE**: Siempre ejecutar `npm run test:workflows` antes de commits que modifiquen workflows para verificar que la resolución de conflictos esté intacta.
|
|
55
|
-
|
|
56
|
-
### Commits Locales Anti-Conflictos
|
|
57
|
-
Para evitar conflictos localmente, **SIEMPRE usa los comandos project-utils** en lugar de `git commit` manual:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# Commit automático con AI (RECOMENDADO)
|
|
61
|
-
npm run commit:auto
|
|
62
|
-
|
|
63
|
-
# Commit interactivo con UI
|
|
64
|
-
npm run commit:ui
|
|
65
|
-
|
|
66
|
-
# Para releases específicos
|
|
67
|
-
npm run commit:auto --context "fix critical bug" --work-type "fix"
|
|
68
|
-
npm run commit:auto --context "new feature" --work-type "feature"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Parámetros disponibles para commit-generator:**
|
|
72
|
-
```bash
|
|
73
|
-
bun project-utils/commit-generator.ts [opciones]
|
|
74
|
-
|
|
75
|
-
--auto-approve # Ejecutar automáticamente sin confirmación
|
|
76
|
-
--quiet # Ejecución silenciosa
|
|
77
|
-
--context <texto> # Contexto del trabajo
|
|
78
|
-
--work-type <tipo> # feature|fix|refactor|docs|test
|
|
79
|
-
--affected-components <lista> # Componentes: core,styling,exports,cli,docs
|
|
80
|
-
--performance-impact <tipo> # none|minor|major
|
|
81
|
-
--no-push # Solo commit, no push
|
|
82
|
-
--proposal-file <ruta> # Usar propuesta existente
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**Detección automática de conflictos:**
|
|
86
|
-
- ✅ **Local**: Detecta automáticamente archivos de release (package.json, CHANGELOG.json)
|
|
87
|
-
- ✅ **GitHub Actions**: Detecta contexto de workflow via RELEASE_WORKFLOW=true
|
|
88
|
-
- ✅ **Estrategia dual**: Pull-rebase-push con MAX_RETRIES=3 + fallback manual
|
|
89
|
-
- ✅ **Smart push**: Sincronización inteligente antes de push
|
|
90
|
-
|
|
91
|
-
## Architecture Patterns
|
|
92
|
-
|
|
93
|
-
### Log Level Hierarchy
|
|
94
|
-
```typescript
|
|
95
|
-
LOG_LEVELS = {
|
|
96
|
-
debug: 0, // Lowest priority
|
|
97
|
-
info: 1,
|
|
98
|
-
warn: 2,
|
|
99
|
-
error: 3,
|
|
100
|
-
critical: 4 // Highest priority
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Styling System
|
|
105
|
-
The project uses a sophisticated CSS-in-JS approach:
|
|
106
|
-
- **StyleBuilder**: Chainable pattern for building console CSS styles
|
|
107
|
-
- **LEVEL_STYLES**: Pre-configured gradients, colors, and shadows for each log level
|
|
108
|
-
- **Dynamic Styling**: Uses `%c` console formatting with built CSS strings
|
|
109
|
-
|
|
110
|
-
### Handler Pattern
|
|
111
|
-
Extensible logging through the `ILogHandler` interface:
|
|
112
|
-
- Handlers receive log metadata including timestamps, stack traces, and prefixes
|
|
113
|
-
- Multiple handlers can be registered simultaneously
|
|
114
|
-
- Built-in handlers for file logging, remote logging, and analytics
|
|
115
|
-
|
|
116
|
-
### Performance Features
|
|
117
|
-
- **Stack Trace Parsing**: Automatic caller location detection
|
|
118
|
-
- **Performance Timers**: Built-in timing with `performance.now()`
|
|
119
|
-
- **Grouping**: Console grouping with automatic indentation
|
|
120
|
-
- **Table Display**: Formatted data tables in console
|
|
121
|
-
|
|
122
|
-
## Code Conventions
|
|
123
|
-
|
|
124
|
-
### TypeScript Patterns
|
|
125
|
-
- Uses modern ES2022+ features with strict typing
|
|
126
|
-
- Leverages `as const` for readonly object typing
|
|
127
|
-
- Interface-based extensibility patterns
|
|
128
|
-
- Generic types for flexible APIs (`logGrouped<T>`)
|
|
129
|
-
|
|
130
|
-
### Styling Conventions
|
|
131
|
-
- All styles use CSS gradients and modern properties
|
|
132
|
-
- Consistent color palette across log levels
|
|
133
|
-
- Responsive design patterns in HTML interface
|
|
134
|
-
- CSS Grid for layout with modern browser features
|
|
135
|
-
|
|
136
|
-
### Error Handling
|
|
137
|
-
- Graceful degradation when browser features unavailable
|
|
138
|
-
- Try-catch blocks around experimental features
|
|
139
|
-
- Silent failure for log handlers to prevent infinite loops
|
|
140
|
-
|
|
141
|
-
## Browser Compatibility
|
|
142
|
-
|
|
143
|
-
### Modern Features Used
|
|
144
|
-
- **CSS Gradients**: Extensive use of `linear-gradient()`
|
|
145
|
-
- **Performance API**: `performance.now()` for timing
|
|
146
|
-
- **Modern Console**: `%c` formatting, `console.table()`, `console.group()`
|
|
147
|
-
- **ES2022 Features**: Object.groupBy (with fallback)
|
|
148
|
-
- **Fetch API**: Used in RemoteLogHandler
|
|
149
|
-
|
|
150
|
-
### Fallback Patterns
|
|
151
|
-
- Stack trace parsing handles different browser formats (Chrome/Firefox)
|
|
152
|
-
- Object.groupBy fallback to reduce()
|
|
153
|
-
- Modern Date API with ISO formatting fallback
|
|
154
|
-
|
|
155
|
-
## Key Files Structure
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
src/
|
|
159
|
-
├── Logger.ts # Main logger implementation (972 lines)
|
|
160
|
-
├── example.ts # Comprehensive usage examples
|
|
161
|
-
├── main.ts # Test functions for HTML interface
|
|
162
|
-
└── style.css # Basic Vite styling (not logger-related)
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
The logger is designed as a single-file library with comprehensive TypeScript documentation and can be imported as individual functions or as a class instance.
|
|
166
|
-
|
|
167
|
-
## Advanced Anti-Conflict System
|
|
168
|
-
|
|
169
|
-
### Intelligent Conflict Detection
|
|
170
|
-
The project includes an advanced conflict resolution system in `project-utils/commit-generator.ts` that:
|
|
171
|
-
|
|
172
|
-
- **Type Analysis**: Detects different types of conflicts (merge, rebase, tmp-files, manual)
|
|
173
|
-
- **Auto-Resolution**: Automatically resolves conflicts in temporary files
|
|
174
|
-
- **Safety Backups**: Creates backup branches before dangerous operations
|
|
175
|
-
- **Context Awareness**: Different strategies for local vs GitHub Actions environments
|
|
176
|
-
|
|
177
|
-
### Conflict Types Handled
|
|
178
|
-
- `tmp-files`: Conflicts in `.temp`, `tmp`, `.cache` directories - auto-resolvable
|
|
179
|
-
- `merge`: Standard merge conflicts requiring analysis
|
|
180
|
-
- `rebase`: Rebase conflicts with specialized handling
|
|
181
|
-
- `manual`: Critical file conflicts requiring user intervention
|
|
182
|
-
|
|
183
|
-
### Safety Features
|
|
184
|
-
- **TypeCheck Integration**: Both commit-generator and commit-ui run `npm run type-check` before proceeding
|
|
185
|
-
- **Backup Creation**: Automatic backup branches before risky operations (format: `backup-before-conflict-resolution-TIMESTAMP`)
|
|
186
|
-
- **Critical File Protection**: Special handling for `src/`, `package.json`, `tsconfig.json`, `.github/workflows/`
|
|
187
|
-
- **Manual Intervention Detection**: Identifies when user input is required vs auto-resolvable conflicts
|
|
188
|
-
|
|
189
|
-
### Usage Commands
|
|
190
|
-
```bash
|
|
191
|
-
# Auto-commit with conflict resolution
|
|
192
|
-
npm run commit:auto
|
|
193
|
-
|
|
194
|
-
# Interactive UI with conflict handling
|
|
195
|
-
npm run commit:ui
|
|
196
|
-
|
|
197
|
-
# Test conflict resolution system
|
|
198
|
-
npm run test:workflows
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Environment Variables
|
|
202
|
-
- `GITHUB_ACTIONS=true`: Detects CI environment
|
|
203
|
-
- `RELEASE_WORKFLOW=true`: Activates release-specific conflict strategies
|
|
204
|
-
- `GITHUB_WORKFLOW`: Workflow name for logging and context
|
|
205
|
-
|
|
206
|
-
## Code Comments Policy
|
|
207
|
-
|
|
208
|
-
**NO agregar comentarios LLM-generated:**
|
|
209
|
-
- ❌ "estilo Pino", "like Pino", "inspired by X"
|
|
210
|
-
- ❌ "mejorado", "arreglado", "optimizado"
|
|
211
|
-
- ❌ Comentarios obvios que repiten el nombre de la función/interface
|
|
212
|
-
- ❌ "@since 3.0.0" o versiones en JSDoc (ya está en git history)
|
|
213
|
-
|
|
214
|
-
**SÍ agregar cuando sea necesario:**
|
|
215
|
-
- ✅ JSDoc técnico con @param, @returns, @example útiles
|
|
216
|
-
- ✅ Comentarios que explican el "por qué" no obvio
|
|
217
|
-
- ✅ TODO/FIXME con contexto específico
|