create-fluxstack 1.19.0 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/LLMD/INDEX.md +1 -1
  2. package/LLMD/MAINTENANCE.md +197 -197
  3. package/LLMD/MIGRATION.md +44 -1
  4. package/LLMD/agent.md +20 -7
  5. package/LLMD/config/declarative-system.md +268 -268
  6. package/LLMD/config/environment-vars.md +3 -6
  7. package/LLMD/config/runtime-reload.md +401 -401
  8. package/LLMD/core/build-system.md +599 -599
  9. package/LLMD/core/framework-lifecycle.md +249 -229
  10. package/LLMD/core/plugin-system.md +154 -100
  11. package/LLMD/patterns/anti-patterns.md +397 -397
  12. package/LLMD/patterns/project-structure.md +264 -264
  13. package/LLMD/patterns/type-safety.md +61 -5
  14. package/LLMD/reference/cli-commands.md +31 -7
  15. package/LLMD/reference/plugin-hooks.md +4 -2
  16. package/LLMD/reference/troubleshooting.md +364 -364
  17. package/LLMD/resources/controllers.md +465 -465
  18. package/LLMD/resources/live-auth.md +178 -1
  19. package/LLMD/resources/live-binary-delta.md +3 -1
  20. package/LLMD/resources/live-components.md +1192 -1041
  21. package/LLMD/resources/live-logging.md +3 -1
  22. package/LLMD/resources/live-rooms.md +1 -1
  23. package/LLMD/resources/live-upload.md +228 -181
  24. package/LLMD/resources/plugins-external.md +8 -7
  25. package/LLMD/resources/rest-auth.md +290 -290
  26. package/LLMD/resources/routes-eden.md +254 -254
  27. package/app/client/.live-stubs/LiveAdminPanel.js +15 -0
  28. package/app/client/.live-stubs/LiveCounter.js +9 -0
  29. package/app/client/.live-stubs/LiveForm.js +11 -0
  30. package/app/client/.live-stubs/LiveLocalCounter.js +8 -0
  31. package/app/client/.live-stubs/LivePingPong.js +10 -0
  32. package/app/client/.live-stubs/LiveRoomChat.js +11 -0
  33. package/app/client/.live-stubs/LiveSharedCounter.js +10 -0
  34. package/app/client/.live-stubs/LiveUpload.js +15 -0
  35. package/app/server/live/auto-generated-components.ts +1 -1
  36. package/core/utils/version.ts +6 -6
  37. package/package.json +108 -108
@@ -1,268 +1,268 @@
1
- # Declarative Configuration System
2
-
3
- **Version:** 1.11.0 | **Updated:** 2025-02-08
4
-
5
- ## Quick Facts
6
-
7
- - Laravel-inspired schema-based configuration with automatic validation
8
- - Type-safe config with full TypeScript inference
9
- - Environment variable mapping with type casting
10
- - Runtime reload support via `ReactiveConfig`
11
- - Located in `config/system/*.config.ts`
12
- - Core implementation: `core/utils/config-schema.ts`
13
-
14
- ## defineConfig Function
15
-
16
- Creates a static configuration object from a schema:
17
-
18
- ```typescript
19
- import { defineConfig, config } from '@core/utils/config-schema'
20
-
21
- const appConfig = defineConfig({
22
- name: config.string('APP_NAME', 'MyApp', true),
23
- port: config.number('PORT', 3000, true),
24
- env: config.enum('NODE_ENV', ['development', 'production'] as const, 'development')
25
- })
26
-
27
- // Type-safe access
28
- appConfig.name // string
29
- appConfig.port // number
30
- appConfig.env // "development" | "production"
31
- ```
32
-
33
- ## ConfigField Types
34
-
35
- ### string
36
-
37
- ```typescript
38
- {
39
- type: 'string',
40
- env: 'VAR_NAME',
41
- default: 'value',
42
- required: false
43
- }
44
-
45
- // Shorthand
46
- config.string('VAR_NAME', 'default', required)
47
- ```
48
-
49
- ### number
50
-
51
- ```typescript
52
- {
53
- type: 'number',
54
- env: 'PORT',
55
- default: 3000,
56
- required: true,
57
- validate: (value) => value > 0 && value < 65536
58
- }
59
-
60
- // Shorthand
61
- config.number('PORT', 3000, true)
62
- ```
63
-
64
- Casts string env vars to numbers automatically.
65
-
66
- ### boolean
67
-
68
- ```typescript
69
- {
70
- type: 'boolean',
71
- env: 'ENABLE_FEATURE',
72
- default: false
73
- }
74
-
75
- // Shorthand
76
- config.boolean('ENABLE_FEATURE', false)
77
- ```
78
-
79
- Accepts: `true`, `1`, `yes`, `on` (case-insensitive) as true.
80
-
81
- ### array
82
-
83
- ```typescript
84
- {
85
- type: 'array',
86
- env: 'ALLOWED_HOSTS',
87
- default: ['localhost']
88
- }
89
-
90
- // Shorthand
91
- config.array('ALLOWED_HOSTS', ['localhost'])
92
- ```
93
-
94
- Parses comma-separated strings: `"host1,host2,host3"` → `['host1', 'host2', 'host3']`
95
-
96
- ### object
97
-
98
- ```typescript
99
- {
100
- type: 'object',
101
- env: 'METADATA',
102
- default: {}
103
- }
104
- ```
105
-
106
- Parses JSON strings from env vars.
107
-
108
- ### enum
109
-
110
- ```typescript
111
- {
112
- type: 'enum',
113
- env: 'NODE_ENV',
114
- values: ['development', 'production', 'test'] as const,
115
- default: 'development',
116
- validate: (value) => value !== 'test' || 'Test mode not allowed'
117
- }
118
-
119
- // Shorthand
120
- config.enum('NODE_ENV', ['development', 'production'] as const, 'development')
121
- ```
122
-
123
- Validates value is in allowed list. TypeScript infers union type.
124
-
125
- ## Validation
126
-
127
- ### Built-in Validation
128
-
129
- - **Required fields**: Throws error if missing
130
- - **Type casting**: Automatic conversion from env strings
131
- - **Enum validation**: Ensures value in allowed list
132
-
133
- ### Custom Validation
134
-
135
- ```typescript
136
- {
137
- type: 'number',
138
- env: 'PORT',
139
- default: 3000,
140
- validate: (value: number) => {
141
- if (value < 1 || value > 65535) {
142
- return 'Port must be between 1 and 65535'
143
- }
144
- return true
145
- }
146
- }
147
- ```
148
-
149
- Return `true` for valid, `false` or error string for invalid.
150
-
151
- ### Validation Errors
152
-
153
- ```typescript
154
- // Throws on startup if validation fails:
155
- // ❌ Configuration validation failed:
156
- // - Field 'port' is required but not provided
157
- // - Field 'env' must be one of: development, production (got: "staging")
158
- ```
159
-
160
- ## ReactiveConfig (Runtime Reload)
161
-
162
- For configs that need runtime updates:
163
-
164
- ```typescript
165
- import { defineReactiveConfig } from '@core/utils/config-schema'
166
-
167
- const reactiveConfig = defineReactiveConfig({
168
- feature: config.boolean('FEATURE_FLAG', false)
169
- })
170
-
171
- // Access values
172
- reactiveConfig.values.feature // false
173
-
174
- // Watch for changes
175
- const unwatch = reactiveConfig.watch((newConfig) => {
176
- console.log('Config updated:', newConfig.feature)
177
- })
178
-
179
- // Reload from environment
180
- reactiveConfig.reload()
181
-
182
- // Stop watching
183
- unwatch()
184
- ```
185
-
186
- See [runtime-reload.md](./runtime-reload.md) for detailed usage.
187
-
188
- ## Nested Configuration
189
-
190
- Group related configs:
191
-
192
- ```typescript
193
- import { defineNestedConfig } from '@core/utils/config-schema'
194
-
195
- const serverConfig = defineNestedConfig({
196
- server: {
197
- port: config.number('PORT', 3000),
198
- host: config.string('HOST', 'localhost')
199
- },
200
- cors: {
201
- origins: config.array('CORS_ORIGINS', ['http://localhost:3000']),
202
- credentials: config.boolean('CORS_CREDENTIALS', false)
203
- }
204
- })
205
-
206
- // Access nested
207
- serverConfig.server.port // 3000
208
- serverConfig.cors.origins // ['http://localhost:3000']
209
- ```
210
-
211
- ## Helper Functions
212
-
213
- ```typescript
214
- import { config } from '@core/utils/config-schema'
215
-
216
- // All helpers: (envVar, default, required)
217
- config.string('VAR', 'default', false)
218
- config.number('VAR', 42, true)
219
- config.boolean('VAR', false)
220
- config.array('VAR', ['item'])
221
- config.enum('VAR', ['a', 'b'] as const, 'a')
222
- ```
223
-
224
- ## Custom Transformers
225
-
226
- Apply custom logic before validation:
227
-
228
- ```typescript
229
- {
230
- type: 'string',
231
- env: 'API_URL',
232
- default: 'http://localhost:3000',
233
- transform: (value) => value.endsWith('/') ? value.slice(0, -1) : value
234
- }
235
- ```
236
-
237
- ## Configuration Files
238
-
239
- All system configs in `config/system/`:
240
-
241
- - `app.config.ts` - Application metadata
242
- - `server.config.ts` - Server and CORS settings
243
- - `client.config.ts` - Frontend configuration
244
- - `build.config.ts` - Build settings
245
- - `database.config.ts` - Database connection
246
- - `plugins.config.ts` - Plugin system settings
247
- - `services.config.ts` - External services
248
- - `monitoring.config.ts` - Logging and metrics
249
-
250
- ## Type Inference
251
-
252
- Full TypeScript type safety:
253
-
254
- ```typescript
255
- const config = defineConfig({
256
- port: config.number('PORT', 3000),
257
- env: config.enum('NODE_ENV', ['dev', 'prod'] as const, 'dev')
258
- })
259
-
260
- // Inferred types:
261
- config.port // number
262
- config.env // "dev" | "prod"
263
- ```
264
-
265
- ## Related
266
-
267
- - [Environment Variables](./environment-vars.md) - Complete env var reference
268
- - [Runtime Reload](./runtime-reload.md) - ReactiveConfig usage patterns
1
+ # Declarative Configuration System
2
+
3
+ **Version:** 1.19.0 | **Updated:** 2026-04-14
4
+
5
+ ## Quick Facts
6
+
7
+ - Laravel-inspired schema-based configuration with automatic validation
8
+ - Type-safe config with full TypeScript inference
9
+ - Environment variable mapping with type casting
10
+ - Runtime reload support via `ReactiveConfig`
11
+ - Located in `config/system/*.config.ts`
12
+ - Core implementation: `core/utils/config-schema.ts`
13
+
14
+ ## defineConfig Function
15
+
16
+ Creates a static configuration object from a schema:
17
+
18
+ ```typescript
19
+ import { defineConfig, config } from '@core/utils/config-schema'
20
+
21
+ const appConfig = defineConfig({
22
+ name: config.string('APP_NAME', 'MyApp', true),
23
+ port: config.number('PORT', 3000, true),
24
+ env: config.enum('NODE_ENV', ['development', 'production'] as const, 'development')
25
+ })
26
+
27
+ // Type-safe access
28
+ appConfig.name // string
29
+ appConfig.port // number
30
+ appConfig.env // "development" | "production"
31
+ ```
32
+
33
+ ## ConfigField Types
34
+
35
+ ### string
36
+
37
+ ```typescript
38
+ {
39
+ type: 'string',
40
+ env: 'VAR_NAME',
41
+ default: 'value',
42
+ required: false
43
+ }
44
+
45
+ // Shorthand
46
+ config.string('VAR_NAME', 'default', required)
47
+ ```
48
+
49
+ ### number
50
+
51
+ ```typescript
52
+ {
53
+ type: 'number',
54
+ env: 'PORT',
55
+ default: 3000,
56
+ required: true,
57
+ validate: (value) => value > 0 && value < 65536
58
+ }
59
+
60
+ // Shorthand
61
+ config.number('PORT', 3000, true)
62
+ ```
63
+
64
+ Casts string env vars to numbers automatically.
65
+
66
+ ### boolean
67
+
68
+ ```typescript
69
+ {
70
+ type: 'boolean',
71
+ env: 'ENABLE_FEATURE',
72
+ default: false
73
+ }
74
+
75
+ // Shorthand
76
+ config.boolean('ENABLE_FEATURE', false)
77
+ ```
78
+
79
+ Accepts: `true`, `1`, `yes`, `on` (case-insensitive) as true.
80
+
81
+ ### array
82
+
83
+ ```typescript
84
+ {
85
+ type: 'array',
86
+ env: 'ALLOWED_HOSTS',
87
+ default: ['localhost']
88
+ }
89
+
90
+ // Shorthand
91
+ config.array('ALLOWED_HOSTS', ['localhost'])
92
+ ```
93
+
94
+ Parses comma-separated strings: `"host1,host2,host3"` → `['host1', 'host2', 'host3']`
95
+
96
+ ### object
97
+
98
+ ```typescript
99
+ {
100
+ type: 'object',
101
+ env: 'METADATA',
102
+ default: {}
103
+ }
104
+ ```
105
+
106
+ Parses JSON strings from env vars.
107
+
108
+ ### enum
109
+
110
+ ```typescript
111
+ {
112
+ type: 'enum',
113
+ env: 'NODE_ENV',
114
+ values: ['development', 'production', 'test'] as const,
115
+ default: 'development',
116
+ validate: (value) => value !== 'test' || 'Test mode not allowed'
117
+ }
118
+
119
+ // Shorthand
120
+ config.enum('NODE_ENV', ['development', 'production'] as const, 'development')
121
+ ```
122
+
123
+ Validates value is in allowed list. TypeScript infers union type.
124
+
125
+ ## Validation
126
+
127
+ ### Built-in Validation
128
+
129
+ - **Required fields**: Throws error if missing
130
+ - **Type casting**: Automatic conversion from env strings
131
+ - **Enum validation**: Ensures value in allowed list
132
+
133
+ ### Custom Validation
134
+
135
+ ```typescript
136
+ {
137
+ type: 'number',
138
+ env: 'PORT',
139
+ default: 3000,
140
+ validate: (value: number) => {
141
+ if (value < 1 || value > 65535) {
142
+ return 'Port must be between 1 and 65535'
143
+ }
144
+ return true
145
+ }
146
+ }
147
+ ```
148
+
149
+ Return `true` for valid, `false` or error string for invalid.
150
+
151
+ ### Validation Errors
152
+
153
+ ```typescript
154
+ // Throws on startup if validation fails:
155
+ // ❌ Configuration validation failed:
156
+ // - Field 'port' is required but not provided
157
+ // - Field 'env' must be one of: development, production (got: "staging")
158
+ ```
159
+
160
+ ## ReactiveConfig (Runtime Reload)
161
+
162
+ For configs that need runtime updates:
163
+
164
+ ```typescript
165
+ import { defineReactiveConfig } from '@core/utils/config-schema'
166
+
167
+ const reactiveConfig = defineReactiveConfig({
168
+ feature: config.boolean('FEATURE_FLAG', false)
169
+ })
170
+
171
+ // Access values
172
+ reactiveConfig.values.feature // false
173
+
174
+ // Watch for changes
175
+ const unwatch = reactiveConfig.watch((newConfig) => {
176
+ console.log('Config updated:', newConfig.feature)
177
+ })
178
+
179
+ // Reload from environment
180
+ reactiveConfig.reload()
181
+
182
+ // Stop watching
183
+ unwatch()
184
+ ```
185
+
186
+ See [runtime-reload.md](./runtime-reload.md) for detailed usage.
187
+
188
+ ## Nested Configuration
189
+
190
+ Group related configs:
191
+
192
+ ```typescript
193
+ import { defineNestedConfig } from '@core/utils/config-schema'
194
+
195
+ const serverConfig = defineNestedConfig({
196
+ server: {
197
+ port: config.number('PORT', 3000),
198
+ host: config.string('HOST', 'localhost')
199
+ },
200
+ cors: {
201
+ origins: config.array('CORS_ORIGINS', ['http://localhost:3000']),
202
+ credentials: config.boolean('CORS_CREDENTIALS', false)
203
+ }
204
+ })
205
+
206
+ // Access nested
207
+ serverConfig.server.port // 3000
208
+ serverConfig.cors.origins // ['http://localhost:3000']
209
+ ```
210
+
211
+ ## Helper Functions
212
+
213
+ ```typescript
214
+ import { config } from '@core/utils/config-schema'
215
+
216
+ // All helpers: (envVar, default, required)
217
+ config.string('VAR', 'default', false)
218
+ config.number('VAR', 42, true)
219
+ config.boolean('VAR', false)
220
+ config.array('VAR', ['item'])
221
+ config.enum('VAR', ['a', 'b'] as const, 'a')
222
+ ```
223
+
224
+ ## Custom Transformers
225
+
226
+ Apply custom logic before validation:
227
+
228
+ ```typescript
229
+ {
230
+ type: 'string',
231
+ env: 'API_URL',
232
+ default: 'http://localhost:3000',
233
+ transform: (value) => value.endsWith('/') ? value.slice(0, -1) : value
234
+ }
235
+ ```
236
+
237
+ ## Configuration Files
238
+
239
+ All system configs in `config/system/`:
240
+
241
+ - `app.config.ts` - Application metadata
242
+ - `server.config.ts` - Server and CORS settings
243
+ - `client.config.ts` - Frontend configuration
244
+ - `build.config.ts` - Build settings
245
+ - `database.config.ts` - Database connection
246
+ - `plugins.config.ts` - Plugin system settings
247
+ - `services.config.ts` - External services
248
+ - `monitoring.config.ts` - Logging and metrics
249
+
250
+ ## Type Inference
251
+
252
+ Full TypeScript type safety:
253
+
254
+ ```typescript
255
+ const config = defineConfig({
256
+ port: config.number('PORT', 3000),
257
+ env: config.enum('NODE_ENV', ['dev', 'prod'] as const, 'dev')
258
+ })
259
+
260
+ // Inferred types:
261
+ config.port // number
262
+ config.env // "dev" | "prod"
263
+ ```
264
+
265
+ ## Related
266
+
267
+ - [Environment Variables](./environment-vars.md) - Complete env var reference
268
+ - [Runtime Reload](./runtime-reload.md) - ReactiveConfig usage patterns
@@ -1,6 +1,6 @@
1
1
  # Environment Variables Reference
2
2
 
3
- **Version:** 1.11.0 | **Updated:** 2025-02-08
3
+ **Version:** 1.19.0 | **Updated:** 2026-04-14
4
4
 
5
5
  ## Quick Facts
6
6
 
@@ -137,15 +137,12 @@
137
137
 
138
138
  ## Plugins
139
139
 
140
+ > **v1.19.0**: Auto-discovery de plugins foi removida. Plugins agora devem ser registrados explicitamente via `.use()` no bootstrap da aplicação. As variáveis `PLUGINS_AUTO_DISCOVER`, `PLUGINS_DISCOVER_NPM`, `PLUGINS_DISCOVER_PROJECT`, `PLUGINS_ALLOWED` e `FLUXSTACK_PLUGINS_ENABLED` foram removidas.
141
+
140
142
  | Variable | Type | Default | Description | Config File |
141
143
  |----------|------|---------|-------------|-------------|
142
- | `FLUXSTACK_PLUGINS_ENABLED` | array | `['logger', 'swagger', 'vite', 'cors', 'static-files']` | Enabled plugins | plugins.config.ts |
143
144
  | `FLUXSTACK_PLUGINS_DISABLED` | array | `[]` | Disabled plugins | plugins.config.ts |
144
- | `PLUGINS_AUTO_DISCOVER` | boolean | `true` | Auto-discover plugins | plugins.config.ts |
145
145
  | `PLUGINS_DIR` | string | `'plugins'` | Plugins directory | plugins.config.ts |
146
- | `PLUGINS_DISCOVER_NPM` | boolean | `false` | Discover npm plugins | plugins.config.ts |
147
- | `PLUGINS_DISCOVER_PROJECT` | boolean | `true` | Discover project plugins | plugins.config.ts |
148
- | `PLUGINS_ALLOWED` | array | `[]` | Whitelist of allowed plugins | plugins.config.ts |
149
146
  | `LOGGER_PLUGIN_ENABLED` | boolean | `true` | Enable logger plugin | plugins.config.ts |
150
147
 
151
148
  ## Swagger