@crimsonsunset/jsg-logger 1.2.0 โ†’ 1.5.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/CHANGELOG.md CHANGED
@@ -16,6 +16,202 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
  ### Fixed
17
17
  - None
18
18
 
19
+ ## [1.5.2] - 2025-10-25 ๐Ÿ› **PATCH: CLI Formatter Custom Component Display**
20
+
21
+ ### Fixed
22
+ - **CLI formatter custom component names** - Formatter was using hardcoded `COMPONENT_SCHEME` instead of `configManager`, causing custom component names to display as `[JSG-CORE]` instead of user-defined names like `[SETUP]`
23
+ - **Browser formatter** - Removed redundant component name transformation
24
+
25
+ ### Technical Changes
26
+ - `formatters/cli-formatter.js` - Use `configManager.getComponentConfig()` instead of static `COMPONENT_SCHEME`
27
+ - `formatters/browser-formatter.js` - Remove redundant name transformation
28
+ - `tests/custom-components.test.js` - Added Test 6 for formatter output validation
29
+
30
+ ## [1.5.1] - 2025-10-25 ๐Ÿ”ง **PATCH: Component Initialization Optimization**
31
+
32
+ ### Fixed
33
+ - **Component initialization pollution** - `getAvailableComponents()` no longer initializes all 13 default COMPONENT_SCHEME components when user defines custom components (3 defined โ†’ 3 initialized instead of 16)
34
+ - **Component name formatting** - Changed from PascalCase (`MyComponent`) to uppercase with separators (`MY-COMPONENT`)
35
+
36
+ ### Technical Changes
37
+ - `config/config-manager.js` - Return only user components when defined, fallback to COMPONENT_SCHEME if empty; components replaced instead of merged; enhanced `_formatComponentName()`
38
+ - `index.js` - Clean reinitialization: reset config, clear loggers, normalize inline config
39
+ - `tests/custom-components.test.js` - New comprehensive test suite (5 tests)
40
+
41
+ ## [1.5.0] - 2025-10-25 ๐ŸŽฏ **CRITICAL FIX: CLI Tool Support**
42
+
43
+ ### ๐Ÿšจ **Critical Fixes**
44
+ These fixes resolve major blockers for CLI tool usage reported in production.
45
+
46
+ #### **Fixed: CLI Formatter Context Data Display** (Critical)
47
+ - **Replaced pino-colada** with custom formatter that displays context data
48
+ - Context objects now render as indented tree format in terminal
49
+ - Example output:
50
+ ```
51
+ 21:32:11.6 โœจ [SYSTEM] โœ“ macOS version compatible
52
+ โ”œโ”€ version: 14.2
53
+ โ”œโ”€ build: 23C64
54
+ โ””โ”€ command: sw_vers
55
+ ```
56
+ - **Problem solved**: Context data was being silently ignored by pino-colada
57
+ - **Impact**: Terminal applications now show full diagnostic information, not just messages
58
+
59
+ #### **Fixed: Environment Detection for CLI Tools** (Critical)
60
+ - **Enhanced `isCLI()` detection** - Now checks multiple signals:
61
+ - `process.stdout.isTTY` OR `process.stderr.isTTY` (not just stdout)
62
+ - `process.env.TERM` or `process.env.COLORTERM` environment variables
63
+ - Not running in CI/GitHub Actions context
64
+ - **Problem solved**: CLI tools were being detected as "server" mode โ†’ outputting JSON instead of pretty terminal formatting
65
+ - **Impact**: Terminal applications now properly display colored, formatted output instead of raw JSON blobs
66
+
67
+ #### **Added: Force Environment Override** (Critical)
68
+ - **New config option**: `forceEnvironment: 'cli' | 'browser' | 'server'`
69
+ - Allows explicit environment override when auto-detection fails
70
+ - Works in both inline config and `logger-config.json`
71
+ - **Use case**: Essential for CLI tools in non-TTY contexts (piped output, automation scripts, etc.)
72
+
73
+ #### **Added: Custom Component Name Support** (High Priority)
74
+ - **Auto-create loggers for ANY component name** - No longer restricted to `COMPONENT_SCHEME`
75
+ - Components not in config get auto-generated with sensible defaults:
76
+ - Default emoji: ๐Ÿ“ฆ
77
+ - Default color: #999999
78
+ - Uppercase display name
79
+ - Global level inheritance
80
+ - **Problem solved**: Custom components like 'system', 'installer', 'nvm' now work without pre-definition
81
+ - **Impact**: True zero-configuration for component names
82
+
83
+ ### โœจ **API Enhancements**
84
+
85
+ #### **Updated: `getComponent()` Method**
86
+ - Now auto-creates loggers for undefined components instead of returning error loggers
87
+ - Adds new components to auto-discovery getters dynamically
88
+ - Seamless experience for custom component names
89
+
90
+ #### **Updated: `getComponentConfig()` Method**
91
+ - Added 3-tier priority system:
92
+ 1. Config components (project-defined)
93
+ 2. COMPONENT_SCHEME defaults (built-in)
94
+ 3. Auto-generated (for custom components)
95
+ - Always returns valid config, never null/undefined
96
+
97
+ #### **Updated: `init()` and `initSync()` Methods**
98
+ - Now load config BEFORE environment detection
99
+ - Apply `forceEnvironment` config before determining environment
100
+ - `initSync()` properly handles inline config objects
101
+
102
+ ### ๐Ÿ“š **Documentation**
103
+ - **Updated README** - New v1.5.0 Quick Start section highlighting CLI tool fixes
104
+ - **Added Force Environment docs** - When and how to override environment detection
105
+ - **Added Custom Components docs** - Examples of using arbitrary component names
106
+ - **Updated Environment Detection section** - Document enhanced CLI detection logic
107
+
108
+ ### ๐ŸŽฏ **Real-World Impact**
109
+ **Before v1.5.0 (Broken for CLI tools):**
110
+ ```javascript
111
+ const logger = JSGLogger.getInstanceSync({ components: { system: {...} } });
112
+ logger.getComponent('system').info('โœ“ macOS compatible', { version: '14.2', build: '23C64' });
113
+ // Output: {"level":30,"time":...,"msg":"โœ“ macOS compatible"} โŒ JSON blob
114
+ // Component 'system' not found error โŒ
115
+ // Context data not visible โŒ
116
+ ```
117
+
118
+ **After v1.5.0 (All Fixed!):**
119
+ ```javascript
120
+ const logger = JSGLogger.getInstanceSync({
121
+ forceEnvironment: 'cli',
122
+ components: { system: { emoji: 'โš™๏ธ' } }
123
+ });
124
+ logger.getComponent('system').info('โœ“ macOS compatible', { version: '14.2', build: '23C64' });
125
+ // Output:
126
+ // 21:32:11.6 โš™๏ธ [SYSTEM] โœ“ macOS compatible โœ… Pretty formatted
127
+ // โ”œโ”€ version: 14.2 โœ… Context data visible
128
+ // โ””โ”€ build: 23C64 โœ… Tree formatting
129
+ // Custom component works โœ…
130
+ ```
131
+
132
+ ### ๐Ÿ”ง **Technical Changes**
133
+ - **File**: `formatters/cli-formatter.js` โญ NEW FIX
134
+ - Removed pino-colada dependency (wasn't showing context data)
135
+ - Implemented custom formatter with context tree rendering
136
+ - Context data now displays with tree formatting (โ”œโ”€ and โ””โ”€)
137
+ - Filters out pino internal fields (level, time, msg, pid, hostname, name, v, environment)
138
+
139
+ - **File**: `utils/environment-detector.js`
140
+ - Added `forceEnvironment()` function for manual override
141
+ - Enhanced `isCLI()` with multi-signal detection
142
+ - All detection functions now respect forced environment
143
+
144
+ - **File**: `config/config-manager.js`
145
+ - `getComponentConfig()` now has 3-tier fallback with auto-generation
146
+
147
+ - **File**: `index.js`
148
+ - Import `forceEnvironment` from environment detector
149
+ - Config loading moved BEFORE environment detection
150
+ - `getComponent()` auto-creates loggers instead of error loggers
151
+ - Added dynamic auto-discovery getter registration
152
+
153
+ - **File**: `package.json`
154
+ - Removed pino-colada from dependencies (no longer required)
155
+
156
+ ### ๐Ÿ“‹ **Migration Guide**
157
+ **No breaking changes** - This is a backward-compatible enhancement.
158
+
159
+ **Recommended for CLI tools:**
160
+ ```javascript
161
+ // Add this to your config for reliable terminal output
162
+ const logger = JSGLogger.getInstanceSync({
163
+ forceEnvironment: 'cli', // โ† Add this line
164
+ // ... rest of your config
165
+ });
166
+ ```
167
+
168
+ ## [1.2.0] - 2025-08-21 ๐ŸŽฏ **MAJOR: Fully Generic Logger**
169
+
170
+ ### ๐Ÿš€ **BREAKING CHANGES**
171
+ - **Minimal default config**: Only 'core' component included by default
172
+ - **Projects must define components**: Custom components now required in logger-config.json
173
+ - **Legacy component removal**: All 10 hardcoded legacy components removed
174
+ - **Core component rename**: 'cacp' โ†’ 'core' throughout functional code
175
+
176
+ ### โœจ **Added**
177
+ - **100% Generic Design**: Zero legacy/project-specific references
178
+ - **Dynamic Alias Generation**: Auto-generate camelCase from kebab-case component names
179
+ - **Smart Component Creation**: Missing components auto-created with sensible defaults
180
+ - **Enhanced Config Normalization**: Better handling of various config formats
181
+ - **Generic Examples**: Updated advanced-config.json with modern component examples
182
+
183
+ ### ๐Ÿ”ง **Changed**
184
+ - **Default Configuration**: Minimal config with only 'core' component
185
+ - **Component Schemes**: Cleaned to minimal generic set
186
+ - **Class Names**: CACPLogger โ†’ JSGLogger throughout (completed in 1.1.4-1.1.7)
187
+ - **Browser Global**: window.CACP_Logger โ†’ window.JSG_Logger
188
+ - **Fallback Logic**: Uses 'core' component instead of hardcoded 'cacp'
189
+
190
+ ### ๐Ÿ—‘๏ธ **Removed**
191
+ - **Legacy Components**: soundcloud, youtube, site-detector, websocket, popup, background, priority-manager, settings, test
192
+ - **Hardcoded Aliases**: Replaced siteDetector/priorityManager with dynamic generation
193
+ - **Project-Specific Logic**: All hardcoded references to specific use cases
194
+
195
+ ### ๐Ÿ“š **Documentation**
196
+ - **Updated Roadmap**: Phase 9 complete, Phase 10 DX enhancements planned
197
+ - **Migration Guide**: Clear upgrade path for existing projects
198
+ - **Generic Examples**: Modern component examples for common project types
199
+
200
+ ### ๐ŸŽฏ **Migration Notes**
201
+ Existing projects need to update their logger-config.json to define components:
202
+
203
+ ```json
204
+ {
205
+ "components": {
206
+ "core": { "emoji": "๐ŸŽฏ", "level": "info" },
207
+ "api": { "emoji": "๐ŸŒ", "level": "debug" },
208
+ "ui": { "emoji": "๐ŸŽจ", "level": "info" }
209
+ }
210
+ }
211
+ ```
212
+
213
+ The logger will auto-create missing components, but explicit definition is recommended.
214
+
19
215
  ## [1.0.8] - 2025-08-06
20
216
 
21
217
  ### Changed
package/README.md CHANGED
@@ -1,16 +1,19 @@
1
1
  # JSG Logger
2
2
 
3
- **Intelligent Multi-Environment Logger with Advanced Configuration**
3
+ **100% Generic Multi-Environment Logger with Advanced Configuration**
4
4
 
5
- A sophisticated logging system that automatically detects its environment (browser, CLI, server) and provides optimal logging experience for each, with powerful file-level overrides and granular control.
5
+ A sophisticated, fully generic logging system that automatically detects its environment (browser, CLI, server) and provides optimal logging experience for any JavaScript project, with powerful file-level overrides and granular control.
6
6
 
7
7
  ## โœจ Features
8
8
 
9
- - ๐Ÿš€ **Zero-Boilerplate Integration** - *New in v1.1.0!* Eliminates 200+ lines of project setup code
10
- - ๐Ÿ”ง **Auto-Discovery Components** - *New!* Both camelCase and kebab-case component access
11
- - โšก **Built-in Performance Logging** - *New!* Static utilities with auto-getInstance
12
- - ๐Ÿ›ก๏ธ **Non-Destructive Error Handling** - *New!* Missing components log but don't break apps
13
- - ๐Ÿง  **Smart Environment Detection** - Auto-adapts to browser, CLI, or server
9
+ - ๐ŸŽฏ **100% Generic** - *New in v1.2.0!* Zero hardcoded assumptions, works with any project type
10
+ - ๐Ÿš€ **Zero-Boilerplate Integration** - Eliminates 200+ lines of project setup code
11
+ - ๐Ÿ”ง **Auto-Discovery Components** - Both camelCase and kebab-case component access
12
+ - โšก **Built-in Performance Logging** - Static utilities with auto-getInstance
13
+ - ๐Ÿ›ก๏ธ **Non-Destructive Error Handling** - Missing components log but don't break apps
14
+ - ๐ŸŽจ **Custom Component Names** - *New in v1.5.0!* Use ANY component name, auto-generated styling
15
+ - ๐Ÿ”ง **Force Environment Override** - *New in v1.5.0!* Override auto-detection for CLI tools
16
+ - ๐Ÿง  **Enhanced Environment Detection** - *New in v1.5.0!* Robust CLI detection with fallbacks
14
17
  - ๐ŸŽจ **Beautiful Visual Output** - Emoji, colors, and structured context display
15
18
  - ๐Ÿ“ฑ **Multi-Environment** - Browser console, terminal, and production JSON
16
19
  - ๐Ÿช **Log Store** - In-memory storage for debugging and popup interfaces
@@ -24,28 +27,66 @@ A sophisticated logging system that automatically detects its environment (brows
24
27
 
25
28
  ## ๐Ÿš€ Quick Start
26
29
 
27
- ### **New in v1.1.0: Zero-Boilerplate Project Integration**
30
+ ### **v1.5.0: Custom Components & Force Environment - Perfect for CLI Tools!**
31
+
32
+ > **โœจ New in v1.5.0:** Use ANY component name (not just pre-defined ones) and force CLI mode for terminal applications!
33
+
34
+ ```javascript
35
+ import JSGLogger from '@crimsonsunset/jsg-logger';
36
+
37
+ // โœจ NEW: Force environment for CLI tools (fixes terminal detection)
38
+ const logger = JSGLogger.getInstanceSync({
39
+ forceEnvironment: 'cli', // Forces pretty terminal output
40
+ globalLevel: 'info',
41
+ components: {
42
+ system: { emoji: 'โš™๏ธ', level: 'info' }, // Custom component names!
43
+ installer: { emoji: '๐Ÿ“ฆ', level: 'info' }, // No need to pre-define
44
+ ssh: { emoji: '๐Ÿ”‘', level: 'info' }, // Auto-generated styling
45
+ nvm: { emoji: '๐ŸŸข', level: 'info' }
46
+ }
47
+ });
48
+
49
+ // โœจ NEW: Custom components work immediately
50
+ const sysLog = logger.getComponent('system');
51
+ sysLog.info('โœ“ macOS version compatible', { version: '14.2', build: '23C64' });
52
+ // Output: Pretty formatted terminal output with colors AND context data!
53
+ // 21:32:11.6 โš™๏ธ [SYSTEM] โœ“ macOS version compatible
54
+ // โ”œโ”€ version: 14.2
55
+ // โ””โ”€ build: 23C64
56
+
57
+ const installLog = logger.getComponent('installer');
58
+ installLog.info('โœ“ Applications installed', { installed: 25, duration: '5m' });
59
+ // 21:32:11.8 ๐Ÿ“ฆ [INSTALLER] โœ“ Applications installed
60
+ // โ”œโ”€ installed: 25
61
+ // โ””โ”€ duration: 5m
62
+ // No more JSON blobs in terminal! ๐ŸŽ‰
63
+ ```
64
+
65
+ ### **v1.2.0: Fully Generic Design - Works with Any Project!**
66
+
67
+ > **โš ๏ธ Breaking Change:** v1.2.0 requires defining components in your logger-config.json. The logger is now 100% generic with no hardcoded assumptions.
28
68
 
29
69
  ```javascript
30
70
  import JSGLogger from '@crimsonsunset/jsg-logger';
31
71
 
32
72
  // Enhanced singleton with built-in configuration loading
33
- const logger = JSGLogger.getInstance({
73
+ const logger = await JSGLogger.getInstance({
34
74
  configPath: './logger-config.json'
35
75
  });
36
76
 
37
- // Auto-discovery component access (both naming conventions)
38
- logger.components.astroBuild().info('Build started');
39
- logger.components['astro-build']().info('Same component, different syntax');
77
+ // Use your project-specific components immediately
78
+ logger.api.info('Server started on port 3000');
79
+ logger.database.debug('Query executed', { query: 'SELECT * FROM users' });
80
+ logger.ui.info('Component mounted', { component: 'UserProfile' });
40
81
 
41
- // Built-in static performance logging
82
+ // Built-in static performance logging
42
83
  const startTime = performance.now();
43
84
  // ... do work ...
44
- JSGLogger.logPerformance('Page Generation', startTime, 'astro-build');
85
+ JSGLogger.logPerformance('Page Generation', startTime, 'api');
45
86
 
46
- // Non-destructive error handling
47
- const maybeLogger = logger.getComponent('missing-component');
48
- maybeLogger.info('Still works!'); // Logs: [MISSING-COMPONENT] โš ๏ธ Component not configured - Still works!
87
+ // โœจ NEW: Custom components auto-created on demand
88
+ const dynamicLogger = logger.getComponent('new-feature');
89
+ dynamicLogger.info('Auto-created component!'); // Works immediately
49
90
  ```
50
91
 
51
92
  ### **Traditional Usage (Still Supported)**
@@ -78,10 +119,68 @@ This allows surgical debugging - you can turn on trace logging for just one prob
78
119
 
79
120
  ## โš™๏ธ **Advanced Configuration**
80
121
 
122
+ ### **Force Environment Override** โœจ *New in v1.5.0*
123
+
124
+ Perfect for CLI tools that get mis-detected as "server" mode:
125
+
126
+ ```javascript
127
+ // Inline config approach (recommended for CLI tools)
128
+ const logger = JSGLogger.getInstanceSync({
129
+ forceEnvironment: 'cli', // Options: 'browser', 'cli', 'server'
130
+ globalLevel: 'info',
131
+ components: {
132
+ system: { emoji: 'โš™๏ธ', level: 'info' }
133
+ }
134
+ });
135
+ ```
136
+
137
+ Or in `logger-config.json`:
138
+
139
+ ```json
140
+ {
141
+ "forceEnvironment": "cli",
142
+ "projectName": "My CLI Tool",
143
+ "globalLevel": "info",
144
+ "components": {
145
+ "system": { "emoji": "โš™๏ธ", "level": "info" }
146
+ }
147
+ }
148
+ ```
149
+
150
+ **When to use `forceEnvironment`:**
151
+ - CLI tools running in non-TTY contexts (CI, piped output, etc.)
152
+ - Override incorrect environment detection
153
+ - Testing different output formats
154
+ - Production deployments with specific requirements
155
+
156
+ ### **Custom Component Names** โœจ *New in v1.5.0*
157
+
158
+ Use ANY component name - no need to pre-define in COMPONENT_SCHEME:
159
+
160
+ ```javascript
161
+ const logger = JSGLogger.getInstanceSync({
162
+ components: {
163
+ 'my-custom-component': { emoji: '๐ŸŽฏ', level: 'debug' },
164
+ 'another-one': { emoji: '๐Ÿš€', level: 'info' },
165
+ 'system-checker': { emoji: 'โš™๏ธ', level: 'trace' }
166
+ }
167
+ });
168
+
169
+ // All these work immediately - auto-created with sensible defaults
170
+ const log1 = logger.getComponent('my-custom-component');
171
+ const log2 = logger.getComponent('another-one');
172
+ const log3 = logger.getComponent('system-checker');
173
+
174
+ // Even undefined components work (auto-generated with ๐Ÿ“ฆ emoji)
175
+ const log4 = logger.getComponent('undefined-component');
176
+ log4.info('This works!'); // Uses auto-generated styling
177
+ ```
178
+
81
179
  ### **Full Configuration Example**
82
180
 
83
181
  ```json
84
182
  {
183
+ "forceEnvironment": "cli",
85
184
  "projectName": "My Advanced Project",
86
185
  "globalLevel": "info",
87
186
  "timestampMode": "absolute",
@@ -251,6 +350,9 @@ logger.controls.addFileOverride('src/popup.js', {
251
350
  ```
252
351
 
253
352
  ### **Context Data**
353
+
354
+ โœจ **New in v1.5.0:** Context data now displays in CLI/terminal mode with tree formatting!
355
+
254
356
  ```javascript
255
357
  logger.api.error('Request failed', {
256
358
  url: window.location.href,
@@ -263,7 +365,15 @@ logger.api.error('Request failed', {
263
365
  userAgent: navigator.userAgent
264
366
  });
265
367
 
266
- // With file override for src/sites/soundcloud.js level: "trace":
368
+ // CLI/Terminal output (v1.5.0+):
369
+ // 22:15:30.1 ๐Ÿšจ [API] Request failed
370
+ // โ”œโ”€ url: https://soundcloud.com/track/example
371
+ // โ”œโ”€ selectors: {"title":".track-title","artist":".track-artist"}
372
+ // โ”œโ”€ retryCount: 3
373
+ // โ”œโ”€ lastError: Element not found
374
+ // โ””โ”€ userAgent: Mozilla/5.0...
375
+
376
+ // Browser Console output:
267
377
  // 22:15:30.123 ๐Ÿšจ [API] Request failed
268
378
  // โ”œโ”€ url: https://soundcloud.com/track/example
269
379
  // โ”œโ”€ selectors: {title: ".track-title", artist: ".track-artist"}
@@ -389,7 +499,7 @@ const stats = logger.controls.getStats();
389
499
  npm install @crimsonsunset/jsg-logger
390
500
  ```
391
501
 
392
- **Latest**: v1.1.0 includes major project simplification enhancements!
502
+ **Latest**: v1.5.0 includes critical CLI tool fixes and custom component support!
393
503
 
394
504
  ## ๐ŸŽฏ Environment Detection
395
505
 
@@ -399,6 +509,26 @@ The logger automatically detects its environment and uses optimal implementation
399
509
  - **CLI**: Uses pino-colada for beautiful terminal output
400
510
  - **Server**: Uses structured JSON for production logging
401
511
 
512
+ ### **Enhanced CLI Detection** โœจ *Improved in v1.5.0*
513
+
514
+ The CLI detection now checks multiple signals:
515
+ 1. **TTY Check**: `process.stdout.isTTY` or `process.stderr.isTTY`
516
+ 2. **Terminal Environment**: `process.env.TERM` or `process.env.COLORTERM`
517
+ 3. **Non-CI Context**: Not running in CI/GitHub Actions
518
+
519
+ This fixes detection issues in various terminal contexts where `isTTY` may be undefined.
520
+
521
+ ### **Force Environment Override** โœจ *New in v1.5.0*
522
+
523
+ If auto-detection fails, you can force the environment:
524
+
525
+ ```javascript
526
+ const logger = JSGLogger.getInstanceSync({
527
+ forceEnvironment: 'cli', // Override auto-detection
528
+ // ... rest of config
529
+ });
530
+ ```
531
+
402
532
  **Why Browser is Different:**
403
533
  Our testing revealed that Pino's browser detection was interfering with custom formatters, especially in Chrome extensions. By creating a custom direct browser logger that bypasses Pino entirely, we achieved:
404
534
  - Perfect emoji and color display
@@ -4,7 +4,19 @@
4
4
  */
5
5
 
6
6
  export const COMPONENT_SCHEME = {
7
- 'core': { emoji: '๐ŸŽฏ', color: '#8E44AD', name: 'JSG-CORE' }
7
+ 'core': { emoji: '๐ŸŽฏ', color: '#4A90E2', name: 'JSG-CORE' },
8
+ 'api': { emoji: '๐Ÿ”Œ', color: '#FF5500', name: 'API' },
9
+ 'ui': { emoji: '๐ŸŽจ', color: '#FF6B6B', name: 'UI' },
10
+ 'database': { emoji: '๐Ÿ’พ', color: '#00C896', name: 'DATABASE' },
11
+ 'test': { emoji: '๐Ÿงช', color: '#FFEAA7', name: 'TEST' },
12
+ 'preact': { emoji: 'โš›๏ธ', color: '#673ab8', name: 'PREACT' },
13
+ 'auth': { emoji: '๐Ÿ”', color: '#E67E22', name: 'AUTH' },
14
+ 'analytics': { emoji: '๐Ÿ“Š', color: '#9B59B6', name: 'ANALYTICS' },
15
+ 'performance': { emoji: 'โšก', color: '#F39C12', name: 'PERFORMANCE' },
16
+ 'websocket': { emoji: '๐Ÿ”—', color: '#1ABC9C', name: 'WEBSOCKET' },
17
+ 'notification': { emoji: '๐Ÿ””', color: '#E74C3C', name: 'NOTIFICATION' },
18
+ 'router': { emoji: '๐Ÿ›ฃ๏ธ', color: '#3498DB', name: 'ROUTER' },
19
+ 'cache': { emoji: '๐Ÿ’จ', color: '#95A5A6', name: 'CACHE' }
8
20
  };
9
21
 
10
22
  export const LEVEL_SCHEME = {
@@ -292,10 +292,16 @@ export class ConfigManager {
292
292
  * @private
293
293
  */
294
294
  _formatComponentName(componentName) {
295
+ // If already uppercase, return as-is
296
+ if (componentName === componentName.toUpperCase()) {
297
+ return componentName;
298
+ }
299
+
300
+ // Convert to uppercase and preserve separators for readability
295
301
  return componentName
296
- .split('-')
297
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
298
- .join('');
302
+ .replace(/([a-z])([A-Z])/g, '$1-$2') // camelCase โ†’ kebab-case
303
+ .replace(/_/g, '-') // snake_case โ†’ kebab-case
304
+ .toUpperCase();
299
305
  }
300
306
 
301
307
  /**
@@ -315,7 +321,11 @@ export class ConfigManager {
315
321
 
316
322
  for (const key in override) {
317
323
  if (override.hasOwnProperty(key)) {
318
- if (typeof override[key] === 'object' && !Array.isArray(override[key])) {
324
+ // Special case: 'components' should be replaced, not merged
325
+ // This allows users to define their own components without getting defaults
326
+ if (key === 'components' && typeof override[key] === 'object') {
327
+ merged[key] = override[key];
328
+ } else if (typeof override[key] === 'object' && !Array.isArray(override[key])) {
319
329
  merged[key] = this.mergeConfigs(merged[key] || {}, override[key]);
320
330
  } else {
321
331
  merged[key] = override[key];
@@ -406,7 +416,23 @@ export class ConfigManager {
406
416
  * @returns {Object} Component configuration
407
417
  */
408
418
  getComponentConfig(componentName, filePath = null) {
409
- const baseComponent = this.config.components?.[componentName] || COMPONENT_SCHEME[componentName] || COMPONENT_SCHEME['core'];
419
+ // Priority 1: Config components
420
+ let baseComponent = this.config.components?.[componentName];
421
+
422
+ // Priority 2: COMPONENT_SCHEME defaults
423
+ if (!baseComponent) {
424
+ baseComponent = COMPONENT_SCHEME[componentName];
425
+ }
426
+
427
+ // Priority 3: Auto-generate for custom components
428
+ if (!baseComponent) {
429
+ baseComponent = {
430
+ emoji: '๐Ÿ“ฆ',
431
+ color: '#999999',
432
+ name: this._formatComponentName(componentName),
433
+ level: this.config.globalLevel || 'info'
434
+ };
435
+ }
410
436
 
411
437
  // Check for file-specific overrides
412
438
  const checkFile = filePath || this.currentFile;
@@ -523,10 +549,14 @@ export class ConfigManager {
523
549
  */
524
550
  getAvailableComponents() {
525
551
  const configComponents = Object.keys(this.config.components || {});
526
- const schemeComponents = Object.keys(COMPONENT_SCHEME);
527
-
528
- // Combine and deduplicate
529
- return [...new Set([...configComponents, ...schemeComponents])];
552
+
553
+ // If user has defined components, only return those
554
+ if (configComponents.length > 0) {
555
+ return configComponents;
556
+ }
557
+
558
+ // Fallback to COMPONENT_SCHEME if no components configured (backward compatibility)
559
+ return Object.keys(COMPONENT_SCHEME);
530
560
  }
531
561
 
532
562
  /**
@@ -29,8 +29,7 @@
29
29
  "core": {
30
30
  "emoji": "๐ŸŽฏ",
31
31
  "color": "#4A90E2",
32
- "name": "JSG-CORE",
33
- "level": "info"
32
+ "name": "JSG-CORE"
34
33
  }
35
34
  },
36
35
  "fileOverrides": {