@creact-labs/creact 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +212 -0
  2. package/README.md +379 -0
  3. package/dist/cli/commands/BuildCommand.d.ts +40 -0
  4. package/dist/cli/commands/BuildCommand.js +151 -0
  5. package/dist/cli/commands/DeployCommand.d.ts +38 -0
  6. package/dist/cli/commands/DeployCommand.js +194 -0
  7. package/dist/cli/commands/DevCommand.d.ts +52 -0
  8. package/dist/cli/commands/DevCommand.js +385 -0
  9. package/dist/cli/commands/PlanCommand.d.ts +39 -0
  10. package/dist/cli/commands/PlanCommand.js +164 -0
  11. package/dist/cli/commands/index.d.ts +36 -0
  12. package/dist/cli/commands/index.js +43 -0
  13. package/dist/cli/core/ArgumentParser.d.ts +46 -0
  14. package/dist/cli/core/ArgumentParser.js +127 -0
  15. package/dist/cli/core/BaseCommand.d.ts +75 -0
  16. package/dist/cli/core/BaseCommand.js +95 -0
  17. package/dist/cli/core/CLIContext.d.ts +68 -0
  18. package/dist/cli/core/CLIContext.js +183 -0
  19. package/dist/cli/core/CommandRegistry.d.ts +64 -0
  20. package/dist/cli/core/CommandRegistry.js +89 -0
  21. package/dist/cli/core/index.d.ts +36 -0
  22. package/dist/cli/core/index.js +43 -0
  23. package/dist/cli/index.d.ts +35 -0
  24. package/dist/cli/index.js +100 -0
  25. package/dist/cli/output.d.ts +204 -0
  26. package/dist/cli/output.js +437 -0
  27. package/dist/cli/utils.d.ts +59 -0
  28. package/dist/cli/utils.js +76 -0
  29. package/dist/context/createContext.d.ts +90 -0
  30. package/dist/context/createContext.js +113 -0
  31. package/dist/context/index.d.ts +30 -0
  32. package/dist/context/index.js +35 -0
  33. package/dist/core/CReact.d.ts +409 -0
  34. package/dist/core/CReact.js +1127 -0
  35. package/dist/core/CloudDOMBuilder.d.ts +429 -0
  36. package/dist/core/CloudDOMBuilder.js +1198 -0
  37. package/dist/core/ContextDependencyTracker.d.ts +165 -0
  38. package/dist/core/ContextDependencyTracker.js +448 -0
  39. package/dist/core/ErrorRecoveryManager.d.ts +145 -0
  40. package/dist/core/ErrorRecoveryManager.js +443 -0
  41. package/dist/core/EventBus.d.ts +91 -0
  42. package/dist/core/EventBus.js +185 -0
  43. package/dist/core/ProviderOutputTracker.d.ts +211 -0
  44. package/dist/core/ProviderOutputTracker.js +476 -0
  45. package/dist/core/ReactiveUpdateQueue.d.ts +76 -0
  46. package/dist/core/ReactiveUpdateQueue.js +121 -0
  47. package/dist/core/Reconciler.d.ts +415 -0
  48. package/dist/core/Reconciler.js +1037 -0
  49. package/dist/core/RenderScheduler.d.ts +153 -0
  50. package/dist/core/RenderScheduler.js +519 -0
  51. package/dist/core/Renderer.d.ts +276 -0
  52. package/dist/core/Renderer.js +791 -0
  53. package/dist/core/Runtime.d.ts +246 -0
  54. package/dist/core/Runtime.js +640 -0
  55. package/dist/core/StateBindingManager.d.ts +121 -0
  56. package/dist/core/StateBindingManager.js +309 -0
  57. package/dist/core/StateMachine.d.ts +424 -0
  58. package/dist/core/StateMachine.js +787 -0
  59. package/dist/core/StructuralChangeDetector.d.ts +140 -0
  60. package/dist/core/StructuralChangeDetector.js +363 -0
  61. package/dist/core/Validator.d.ts +127 -0
  62. package/dist/core/Validator.js +279 -0
  63. package/dist/core/errors.d.ts +153 -0
  64. package/dist/core/errors.js +202 -0
  65. package/dist/core/index.d.ts +38 -0
  66. package/dist/core/index.js +64 -0
  67. package/dist/core/types.d.ts +263 -0
  68. package/dist/core/types.js +48 -0
  69. package/dist/hooks/context.d.ts +147 -0
  70. package/dist/hooks/context.js +334 -0
  71. package/dist/hooks/useContext.d.ts +113 -0
  72. package/dist/hooks/useContext.js +169 -0
  73. package/dist/hooks/useEffect.d.ts +105 -0
  74. package/dist/hooks/useEffect.js +540 -0
  75. package/dist/hooks/useInstance.d.ts +139 -0
  76. package/dist/hooks/useInstance.js +441 -0
  77. package/dist/hooks/useState.d.ts +120 -0
  78. package/dist/hooks/useState.js +298 -0
  79. package/dist/index.d.ts +46 -0
  80. package/dist/index.js +70 -0
  81. package/dist/jsx.d.ts +64 -0
  82. package/dist/jsx.js +76 -0
  83. package/dist/providers/DummyBackendProvider.d.ts +193 -0
  84. package/dist/providers/DummyBackendProvider.js +189 -0
  85. package/dist/providers/DummyCloudProvider.d.ts +128 -0
  86. package/dist/providers/DummyCloudProvider.js +157 -0
  87. package/dist/providers/IBackendProvider.d.ts +177 -0
  88. package/dist/providers/IBackendProvider.js +31 -0
  89. package/dist/providers/ICloudProvider.d.ts +146 -0
  90. package/dist/providers/ICloudProvider.js +31 -0
  91. package/dist/providers/index.d.ts +31 -0
  92. package/dist/providers/index.js +31 -0
  93. package/dist/test-event-callbacks.d.ts +0 -0
  94. package/dist/test-event-callbacks.js +1 -0
  95. package/dist/utils/Logger.d.ts +144 -0
  96. package/dist/utils/Logger.js +220 -0
  97. package/dist/utils/Output.d.ts +161 -0
  98. package/dist/utils/Output.js +401 -0
  99. package/dist/utils/deepEqual.d.ts +71 -0
  100. package/dist/utils/deepEqual.js +276 -0
  101. package/dist/utils/naming.d.ts +241 -0
  102. package/dist/utils/naming.js +376 -0
  103. package/package.json +87 -0
@@ -0,0 +1,177 @@
1
+ /**
2
+
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+
5
+ * you may not use this file except in compliance with the License.
6
+
7
+ * You may obtain a copy of the License at
8
+
9
+ *
10
+
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ *
14
+
15
+ * Unless required by applicable law or agreed to in writing, software
16
+
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+
21
+ * See the License for the specific language governing permissions and
22
+
23
+ * limitations under the License.
24
+
25
+ *
26
+
27
+ * Copyright 2025 Daniel Coutinho Ribeiro
28
+
29
+ */
30
+ /**
31
+ * Lock information for state locking
32
+ * REQ-O02: State locking to prevent concurrent deployments
33
+ */
34
+ export interface LockInfo {
35
+ /** Process/user holding the lock */
36
+ holder: string;
37
+ /** Timestamp when lock was acquired (milliseconds since epoch) */
38
+ acquiredAt: number;
39
+ /** Time-to-live in seconds */
40
+ ttl: number;
41
+ }
42
+ /**
43
+ * IBackendProvider defines the interface for state storage backends.
44
+ * Implementations manage persistent state for CloudDOM trees and outputs.
45
+ *
46
+ * This interface supports dependency injection, allowing different backends
47
+ * (e.g., DummyBackendProvider for testing, S3BackendProvider for production)
48
+ * to be swapped without changing core CReact logic.
49
+ *
50
+ * @template TState - Type of state object stored (defaults to any for flexibility)
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * class DummyBackendProvider implements IBackendProvider {
55
+ * private state = new Map<string, any>();
56
+ * private locks = new Map<string, LockInfo>();
57
+ *
58
+ * async initialize() {
59
+ * console.log('Backend initialized');
60
+ * }
61
+ *
62
+ * async getState(stackName: string): Promise<any | undefined> {
63
+ * return this.state.get(stackName);
64
+ * }
65
+ *
66
+ * async saveState(stackName: string, state: any): Promise<void> {
67
+ * this.state.set(stackName, state);
68
+ * }
69
+ *
70
+ * async acquireLock(stackName: string, holder: string, ttl: number): Promise<void> {
71
+ * // Implementation
72
+ * }
73
+ *
74
+ * async releaseLock(stackName: string): Promise<void> {
75
+ * this.locks.delete(stackName);
76
+ * }
77
+ *
78
+ * async checkLock(stackName: string): Promise<LockInfo | null> {
79
+ * return this.locks.get(stackName) || null;
80
+ * }
81
+ * }
82
+ * ```
83
+ */
84
+ export interface IBackendProvider<TState = any> {
85
+ /**
86
+ * Optional async initialization for remote connections (S3, DynamoDB, etc.)
87
+ * Called before any other provider methods.
88
+ *
89
+ * REQ-04.4: Support async initialization for providers that need to
90
+ * establish remote connections or load configuration.
91
+ *
92
+ * @returns Promise that resolves when initialization is complete
93
+ */
94
+ initialize?(): Promise<void>;
95
+ /**
96
+ * Retrieve state for a given stack.
97
+ * Returns undefined if no state exists for the stack.
98
+ *
99
+ * REQ-04: Core provider interface for state retrieval
100
+ * REQ-05: State management for deployment tracking and idempotency
101
+ * REQ-06: Universal output access across stacks
102
+ *
103
+ * @param stackName - Name of the stack to retrieve state for
104
+ * @returns Promise resolving to stack state, or undefined if not found
105
+ */
106
+ getState(stackName: string): Promise<TState | undefined>;
107
+ /**
108
+ * Save state for a given stack.
109
+ * State typically includes CloudDOM tree, outputs, and metadata.
110
+ *
111
+ * REQ-04: Core provider interface for state persistence
112
+ * REQ-05: State management for deployment tracking and idempotency
113
+ * REQ-08.5: Store migration map versions in backend state
114
+ *
115
+ * @param stackName - Name of the stack to save state for
116
+ * @param state - State object to persist (CloudDOM, outputs, metadata)
117
+ * @returns Promise that resolves when state is saved
118
+ */
119
+ saveState(stackName: string, state: TState): Promise<void>;
120
+ /**
121
+ * Acquire lock for a stack to prevent concurrent deployments.
122
+ * Locking mechanism is backend-specific:
123
+ * - File backend: flock on .creact/.lock
124
+ * - S3 backend: DynamoDB conditional writes
125
+ * - Redis backend: SETNX with TTL
126
+ *
127
+ * REQ-O02: State locking to prevent concurrent deployments
128
+ * REQ-O02.1: WHEN deployment starts THEN CReact SHALL call acquireLock
129
+ * REQ-O02.2: WHEN lock is held THEN acquireLock SHALL throw error with lock holder info
130
+ *
131
+ * @param stackName - Name of the stack to lock
132
+ * @param holder - Identifier of the lock holder (user/process)
133
+ * @param ttl - Time-to-live in seconds (lock auto-expires after this duration)
134
+ * @throws Error if lock is already held and not expired
135
+ */
136
+ acquireLock?(stackName: string, holder: string, ttl: number): Promise<void>;
137
+ /**
138
+ * Release lock for a stack.
139
+ *
140
+ * REQ-O02: State locking to prevent concurrent deployments
141
+ * REQ-O02.5: WHEN deployment completes THEN CReact SHALL call releaseLock
142
+ *
143
+ * @param stackName - Name of the stack to unlock
144
+ */
145
+ releaseLock?(stackName: string): Promise<void>;
146
+ /**
147
+ * Check lock status for a stack.
148
+ * Returns lock info if lock exists, null otherwise.
149
+ *
150
+ * REQ-O02: State locking to prevent concurrent deployments
151
+ * REQ-O02.3: WHEN process crashes THEN lock SHALL have TTL and auto-expire
152
+ *
153
+ * @param stackName - Name of the stack to check
154
+ * @returns Lock info if lock exists, null otherwise
155
+ */
156
+ checkLock?(stackName: string): Promise<LockInfo | null>;
157
+ /**
158
+ * Append audit log entry for compliance and debugging.
159
+ * Optional method for backends that support audit logging.
160
+ *
161
+ * REQ-O05: Audit log for compliance and debugging
162
+ *
163
+ * @param stackName - Name of the stack
164
+ * @param entry - Audit log entry to append
165
+ */
166
+ appendAuditLog?(stackName: string, entry: any): Promise<void>;
167
+ /**
168
+ * Save state snapshot for time-travel debugging.
169
+ * Optional method for backends that support snapshots.
170
+ *
171
+ * REQ-O01: State snapshots for time-travel debugging
172
+ *
173
+ * @param stackName - Name of the stack
174
+ * @param state - State snapshot to save
175
+ */
176
+ saveSnapshot?(stackName: string, state: TState): Promise<void>;
177
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+
6
+ * you may not use this file except in compliance with the License.
7
+
8
+ * You may obtain a copy of the License at
9
+
10
+ *
11
+
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ *
15
+
16
+ * Unless required by applicable law or agreed to in writing, software
17
+
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+
22
+ * See the License for the specific language governing permissions and
23
+
24
+ * limitations under the License.
25
+
26
+ *
27
+
28
+ * Copyright 2025 Daniel Coutinho Ribeiro
29
+
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,146 @@
1
+ /**
2
+
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+
5
+ * you may not use this file except in compliance with the License.
6
+
7
+ * You may obtain a copy of the License at
8
+
9
+ *
10
+
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ *
14
+
15
+ * Unless required by applicable law or agreed to in writing, software
16
+
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+
21
+ * See the License for the specific language governing permissions and
22
+
23
+ * limitations under the License.
24
+
25
+ *
26
+
27
+ * Copyright 2025 Daniel Coutinho Ribeiro
28
+
29
+ */
30
+ import { CloudDOMNode } from '../core/types';
31
+ /**
32
+ * OutputChangeEvent represents a provider output change notification
33
+ * Emitted when a resource's outputs become available or change
34
+ */
35
+ export interface OutputChangeEvent {
36
+ /** CloudDOM node ID that changed */
37
+ nodeId: string;
38
+ /** New output values */
39
+ outputs: Record<string, any>;
40
+ /** Timestamp of the change */
41
+ timestamp: number;
42
+ }
43
+ /**
44
+ * ICloudProvider defines the interface for cloud infrastructure providers.
45
+ * Implementations materialize CloudDOM trees into actual cloud resources.
46
+ *
47
+ * This interface supports dependency injection, allowing different providers
48
+ * (e.g., DummyCloudProvider for testing, CDKTFProvider for production) to be
49
+ * swapped without changing core CReact logic.
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * class DummyCloudProvider implements ICloudProvider {
54
+ * async initialize() {
55
+ * console.log('Provider initialized');
56
+ * }
57
+ *
58
+ * materialize(cloudDOM: CloudDOMNode[], scope: any): void {
59
+ * console.log('Materializing:', cloudDOM);
60
+ * }
61
+ * }
62
+ * ```
63
+ */
64
+ export interface ICloudProvider {
65
+ /**
66
+ * Optional async initialization for remote connections (AWS, Vault, etc.)
67
+ * Called before any other provider methods.
68
+ *
69
+ * REQ-04.4: Support async initialization for providers that need to
70
+ * establish remote connections or load configuration.
71
+ *
72
+ * @returns Promise that resolves when initialization is complete
73
+ */
74
+ initialize?(): Promise<void>;
75
+ /**
76
+ * Materialize CloudDOM tree into actual cloud resources.
77
+ * This is the core method that deploys infrastructure.
78
+ *
79
+ * REQ-04: Core provider interface for cloud resource creation
80
+ *
81
+ * @param cloudDOM - Array of CloudDOM nodes to materialize
82
+ * @param scope - Optional provider-specific scope object (e.g., CDKTF App)
83
+ */
84
+ materialize(cloudDOM: CloudDOMNode[], scope?: any): void;
85
+ /**
86
+ * Optional lifecycle hook called before deployment begins.
87
+ * Use for validation, logging, or pre-deployment checks.
88
+ *
89
+ * REQ-09.1: preDeploy lifecycle hook for auditing and validation
90
+ *
91
+ * @param cloudDOM - CloudDOM tree about to be deployed
92
+ * @returns Promise that resolves when pre-deployment tasks complete
93
+ * @throws Error if pre-deployment checks fail (halts deployment)
94
+ */
95
+ preDeploy?(cloudDOM: CloudDOMNode[]): Promise<void>;
96
+ /**
97
+ * Optional lifecycle hook called after successful deployment.
98
+ * Use for logging, metrics collection, or post-deployment actions.
99
+ *
100
+ * REQ-09.2: postDeploy lifecycle hook for observability
101
+ *
102
+ * @param cloudDOM - CloudDOM tree that was deployed
103
+ * @param outputs - Collected outputs from deployed resources
104
+ * @returns Promise that resolves when post-deployment tasks complete
105
+ */
106
+ postDeploy?(cloudDOM: CloudDOMNode[], outputs: Record<string, any>): Promise<void>;
107
+ /**
108
+ * Optional lifecycle hook called when deployment fails.
109
+ * Use for error logging, cleanup, or alerting.
110
+ *
111
+ * REQ-09.3: onError lifecycle hook for error handling
112
+ *
113
+ * @param error - Error that caused deployment to fail
114
+ * @param cloudDOM - CloudDOM tree that failed to deploy
115
+ * @returns Promise that resolves when error handling completes
116
+ */
117
+ onError?(error: Error, cloudDOM: CloudDOMNode[]): Promise<void>;
118
+ /**
119
+ * Subscribe to output change events (optional - for event-driven reactivity)
120
+ * Providers can emit events when resource outputs become available
121
+ *
122
+ * This enables real-time reactivity without polling:
123
+ * - Provider emits when outputs are ready
124
+ * - Orchestrator subscribes and triggers re-renders
125
+ * - useEffect callbacks can react to specific output changes
126
+ *
127
+ * @param event - Event type to subscribe to
128
+ * @param handler - Callback function to handle the event
129
+ */
130
+ on?(event: 'outputsChanged', handler: (change: OutputChangeEvent) => void): void;
131
+ /**
132
+ * Unsubscribe from output change events
133
+ *
134
+ * @param event - Event type to unsubscribe from
135
+ * @param handler - Callback function to remove
136
+ */
137
+ off?(event: 'outputsChanged', handler: (change: OutputChangeEvent) => void): void;
138
+ /**
139
+ * Emit output change event (used by provider implementations)
140
+ * Internal method for providers to notify subscribers
141
+ *
142
+ * @param event - Event type
143
+ * @param change - Output change details
144
+ */
145
+ emit?(event: 'outputsChanged', change: OutputChangeEvent): void;
146
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+
6
+ * you may not use this file except in compliance with the License.
7
+
8
+ * You may obtain a copy of the License at
9
+
10
+ *
11
+
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ *
15
+
16
+ * Unless required by applicable law or agreed to in writing, software
17
+
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+
22
+ * See the License for the specific language governing permissions and
23
+
24
+ * limitations under the License.
25
+
26
+ *
27
+
28
+ * Copyright 2025 Daniel Coutinho Ribeiro
29
+
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,31 @@
1
+ /**
2
+
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+
5
+ * you may not use this file except in compliance with the License.
6
+
7
+ * You may obtain a copy of the License at
8
+
9
+ *
10
+
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ *
14
+
15
+ * Unless required by applicable law or agreed to in writing, software
16
+
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+
21
+ * See the License for the specific language governing permissions and
22
+
23
+ * limitations under the License.
24
+
25
+ *
26
+
27
+ * Copyright 2025 Daniel Coutinho Ribeiro
28
+
29
+ */
30
+ export { ICloudProvider } from './ICloudProvider';
31
+ export { IBackendProvider } from './IBackendProvider';
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+
6
+ * you may not use this file except in compliance with the License.
7
+
8
+ * You may obtain a copy of the License at
9
+
10
+ *
11
+
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ *
15
+
16
+ * Unless required by applicable law or agreed to in writing, software
17
+
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+
22
+ * See the License for the specific language governing permissions and
23
+
24
+ * limitations under the License.
25
+
26
+ *
27
+
28
+ * Copyright 2025 Daniel Coutinho Ribeiro
29
+
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,144 @@
1
+ /**
2
+
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+
5
+ * you may not use this file except in compliance with the License.
6
+
7
+ * You may obtain a copy of the License at
8
+
9
+ *
10
+
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ *
14
+
15
+ * Unless required by applicable law or agreed to in writing, software
16
+
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+
21
+ * See the License for the specific language governing permissions and
22
+
23
+ * limitations under the License.
24
+
25
+ *
26
+
27
+ * Copyright 2025 Daniel Coutinho Ribeiro
28
+
29
+ */
30
+ /**
31
+ * Logger - Internal debugging and diagnostics only
32
+ *
33
+ * IMPORTANT: This logger is for INTERNAL debugging only, not user-facing output.
34
+ * - All output goes to stderr (not stdout)
35
+ * - Controlled by --verbose flag or CREACT_DEBUG environment variable
36
+ * - For user-facing messages, use OutputManager (src/utils/Output.ts)
37
+ *
38
+ * Usage:
39
+ * - logger.debug() - Internal state tracking, algorithm steps
40
+ * - logger.info() - Internal lifecycle events (not user messages)
41
+ * - logger.warn() - Internal warnings
42
+ * - logger.error() - Internal errors with stack traces
43
+ */
44
+ /**
45
+ * Log levels in order of severity
46
+ */
47
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
48
+ /**
49
+ * Standard log scopes for CReact subsystems
50
+ */
51
+ export type LogScope = 'renderer' | 'reconciler' | 'validator' | 'clouddom' | 'state-machine' | 'provider' | 'hooks' | 'cli' | 'runtime' | 'parallel';
52
+ /**
53
+ * Logger configuration
54
+ */
55
+ export interface LoggerConfig {
56
+ /** Enabled scopes (or ['*'] for all) */
57
+ scopes: string[];
58
+ /** Minimum log level */
59
+ level: LogLevel;
60
+ }
61
+ /**
62
+ * Scoped logger with level filtering
63
+ */
64
+ export declare class Logger {
65
+ private readonly scope;
66
+ private readonly config;
67
+ private readonly context;
68
+ private readonly enabled;
69
+ constructor(scope: LogScope, config: LoggerConfig, context?: Record<string, any>);
70
+ /**
71
+ * Log a debug message
72
+ */
73
+ debug(message: string, ...args: any[]): void;
74
+ /**
75
+ * Log an info message
76
+ */
77
+ info(message: string, ...args: any[]): void;
78
+ /**
79
+ * Log a warning message
80
+ */
81
+ warn(message: string, ...args: any[]): void;
82
+ /**
83
+ * Log an error message
84
+ */
85
+ error(message: string, ...args: any[]): void;
86
+ /**
87
+ * Create a child logger with additional context
88
+ */
89
+ child(additionalContext: Record<string, any>): Logger;
90
+ /**
91
+ * Internal log method with filtering
92
+ */
93
+ private log;
94
+ }
95
+ /**
96
+ * Logger factory for creating scoped loggers
97
+ */
98
+ export declare class LoggerFactory {
99
+ private static config;
100
+ /**
101
+ * Configure the logger factory
102
+ */
103
+ static configure(config: Partial<LoggerConfig>): void;
104
+ /**
105
+ * Get a logger for a specific scope
106
+ */
107
+ static getLogger(scope: LogScope): Logger;
108
+ /**
109
+ * Parse configuration from environment variables
110
+ * Supports CREACT_LOG=scope1,scope2 or CREACT_LOG=*
111
+ * Supports CREACT_LOG_LEVEL=debug|info|warn|error
112
+ */
113
+ static configureFromEnv(): void;
114
+ /**
115
+ * Parse configuration from CLI flags
116
+ * Supports --log=scope1,scope2 or --log=*
117
+ * Supports --log-level=debug|info|warn|error
118
+ */
119
+ static configureFromCLI(args: {
120
+ log?: string;
121
+ logLevel?: string;
122
+ }): void;
123
+ /**
124
+ * Parse configuration from config file
125
+ */
126
+ static configureFromFile(fileConfig: {
127
+ log?: {
128
+ scopes?: string[];
129
+ level?: string;
130
+ };
131
+ }): void;
132
+ /**
133
+ * Get current configuration
134
+ */
135
+ static getConfig(): LoggerConfig;
136
+ /**
137
+ * Reset configuration to defaults
138
+ */
139
+ static reset(): void;
140
+ /**
141
+ * Check if a string is a valid log level
142
+ */
143
+ private static isValidLogLevel;
144
+ }