@codelia/config 0.1.54 → 0.1.56

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/index.cjs CHANGED
@@ -33,6 +33,7 @@ var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
33
33
  permissions: "project",
34
34
  mcp: "project",
35
35
  skills: "project",
36
+ execution_environment: "project",
36
37
  search: "project",
37
38
  tui: "global"
38
39
  };
@@ -56,6 +57,16 @@ var pickStringArray = (value) => {
56
57
  );
57
58
  return values.length ? values : void 0;
58
59
  };
60
+ var pickCommandArray = (value) => {
61
+ if (!Array.isArray(value)) return void 0;
62
+ const values = value.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
63
+ return values.length ? values : void 0;
64
+ };
65
+ var pickCommandMatrix = (value) => {
66
+ if (!Array.isArray(value)) return void 0;
67
+ const commands = value.map((entry) => pickCommandArray(entry)).filter((entry) => Array.isArray(entry));
68
+ return commands.length ? commands : void 0;
69
+ };
59
70
  var pickStringRecord = (value) => {
60
71
  if (!isRecord(value)) return void 0;
61
72
  const entries = Object.entries(value).filter(
@@ -162,6 +173,35 @@ var parseSkillsConfig = (value) => {
162
173
  }
163
174
  return Object.keys(result).length > 0 ? result : void 0;
164
175
  };
176
+ var parseExecutionEnvironmentConfig = (value) => {
177
+ if (!isRecord(value)) return void 0;
178
+ const startupChecks = (() => {
179
+ if (!isRecord(value.startup_checks)) return void 0;
180
+ const enabled = pickBoolean(value.startup_checks.enabled);
181
+ const mode = value.startup_checks.mode === "append" || value.startup_checks.mode === "replace" ? value.startup_checks.mode : void 0;
182
+ const commands = pickCommandMatrix(value.startup_checks.commands);
183
+ const timeoutMs = pickPositiveInt(value.startup_checks.timeout_ms);
184
+ const result2 = {};
185
+ if (enabled !== void 0) {
186
+ result2.enabled = enabled;
187
+ }
188
+ if (mode !== void 0) {
189
+ result2.mode = mode;
190
+ }
191
+ if (commands) {
192
+ result2.commands = commands;
193
+ }
194
+ if (timeoutMs !== void 0) {
195
+ result2.timeout_ms = timeoutMs;
196
+ }
197
+ return Object.keys(result2).length > 0 ? result2 : void 0;
198
+ })();
199
+ const result = {};
200
+ if (startupChecks && Object.keys(startupChecks).length > 0) {
201
+ result.startup_checks = startupChecks;
202
+ }
203
+ return Object.keys(result).length > 0 ? result : void 0;
204
+ };
165
205
  var parseSearchMode = (value) => {
166
206
  if (value !== "auto" && value !== "native" && value !== "local") {
167
207
  return void 0;
@@ -264,6 +304,9 @@ var parseConfig = (value, sourceLabel) => {
264
304
  const hasPermissions = permissions && (permissions.allow || permissions.deny) ? permissions : void 0;
265
305
  const mcp = parseMcpConfig(value.mcp);
266
306
  const skills = parseSkillsConfig(value.skills);
307
+ const executionEnvironment = parseExecutionEnvironmentConfig(
308
+ value.execution_environment
309
+ );
267
310
  const experimental = parseExperimentalConfig(value.experimental);
268
311
  const search = parseSearchConfig(value.search);
269
312
  const tui = isRecord(value.tui) ? {
@@ -279,6 +322,9 @@ var parseConfig = (value, sourceLabel) => {
279
322
  if (skills) {
280
323
  result.skills = skills;
281
324
  }
325
+ if (executionEnvironment) {
326
+ result.execution_environment = executionEnvironment;
327
+ }
282
328
  if (experimental) {
283
329
  result.experimental = experimental;
284
330
  }
@@ -357,6 +403,29 @@ var ConfigRegistry = class {
357
403
  };
358
404
  }
359
405
  }
406
+ if (layer?.execution_environment) {
407
+ const nextExecutionEnvironment = layer.execution_environment;
408
+ merged.execution_environment ??= {};
409
+ if (nextExecutionEnvironment.startup_checks) {
410
+ const nextStartupChecks = nextExecutionEnvironment.startup_checks;
411
+ merged.execution_environment.startup_checks ??= {};
412
+ if (nextStartupChecks.enabled !== void 0) {
413
+ merged.execution_environment.startup_checks.enabled = nextStartupChecks.enabled;
414
+ }
415
+ if (nextStartupChecks.mode !== void 0) {
416
+ merged.execution_environment.startup_checks.mode = nextStartupChecks.mode;
417
+ }
418
+ if (nextStartupChecks.timeout_ms !== void 0) {
419
+ merged.execution_environment.startup_checks.timeout_ms = nextStartupChecks.timeout_ms;
420
+ }
421
+ if (nextStartupChecks.commands) {
422
+ merged.execution_environment.startup_checks.commands = nextStartupChecks.mode === "append" ? [
423
+ ...merged.execution_environment.startup_checks.commands ?? [],
424
+ ...nextStartupChecks.commands
425
+ ] : nextStartupChecks.commands;
426
+ }
427
+ }
428
+ }
360
429
  if (layer?.search) {
361
430
  const nextSearch = layer.search;
362
431
  merged.search ??= {};
package/dist/index.d.cts CHANGED
@@ -53,6 +53,16 @@ type SkillsConfig = {
53
53
  maxLimit?: number;
54
54
  };
55
55
  };
56
+ type ExecutionEnvironmentStartupChecksMode = "append" | "replace";
57
+ type ExecutionEnvironmentStartupChecksConfig = {
58
+ enabled?: boolean;
59
+ mode?: ExecutionEnvironmentStartupChecksMode;
60
+ commands?: string[][];
61
+ timeout_ms?: number;
62
+ };
63
+ type ExecutionEnvironmentConfig = {
64
+ startup_checks?: ExecutionEnvironmentStartupChecksConfig;
65
+ };
56
66
  type SearchMode = "auto" | "native" | "local";
57
67
  type SearchConfig = {
58
68
  mode?: SearchMode;
@@ -82,6 +92,7 @@ type CodeliaConfig = {
82
92
  permissions?: PermissionsConfig;
83
93
  mcp?: McpConfig;
84
94
  skills?: SkillsConfig;
95
+ execution_environment?: ExecutionEnvironmentConfig;
85
96
  search?: SearchConfig;
86
97
  tui?: TuiConfig;
87
98
  };
@@ -96,6 +107,7 @@ type ConfigLayer = {
96
107
  permissions?: PermissionsConfig;
97
108
  mcp?: McpConfig;
98
109
  skills?: SkillsConfig;
110
+ execution_environment?: ExecutionEnvironmentConfig;
99
111
  search?: SearchConfig;
100
112
  tui?: TuiConfig;
101
113
  };
@@ -106,4 +118,4 @@ declare class ConfigRegistry {
106
118
  }
107
119
  declare const configRegistry: ConfigRegistry;
108
120
 
109
- export { CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExperimentalConfig, type McpConfig, type McpServerConfig, type ModelConfig, type OpenAiExperimentalConfig, type PermissionRule, type PermissionsConfig, type SearchConfig, type SearchMode, type SkillsConfig, type TuiConfig, configRegistry, parseConfig };
121
+ export { CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, type McpConfig, type McpServerConfig, type ModelConfig, type OpenAiExperimentalConfig, type PermissionRule, type PermissionsConfig, type SearchConfig, type SearchMode, type SkillsConfig, type TuiConfig, configRegistry, parseConfig };
package/dist/index.d.ts CHANGED
@@ -53,6 +53,16 @@ type SkillsConfig = {
53
53
  maxLimit?: number;
54
54
  };
55
55
  };
56
+ type ExecutionEnvironmentStartupChecksMode = "append" | "replace";
57
+ type ExecutionEnvironmentStartupChecksConfig = {
58
+ enabled?: boolean;
59
+ mode?: ExecutionEnvironmentStartupChecksMode;
60
+ commands?: string[][];
61
+ timeout_ms?: number;
62
+ };
63
+ type ExecutionEnvironmentConfig = {
64
+ startup_checks?: ExecutionEnvironmentStartupChecksConfig;
65
+ };
56
66
  type SearchMode = "auto" | "native" | "local";
57
67
  type SearchConfig = {
58
68
  mode?: SearchMode;
@@ -82,6 +92,7 @@ type CodeliaConfig = {
82
92
  permissions?: PermissionsConfig;
83
93
  mcp?: McpConfig;
84
94
  skills?: SkillsConfig;
95
+ execution_environment?: ExecutionEnvironmentConfig;
85
96
  search?: SearchConfig;
86
97
  tui?: TuiConfig;
87
98
  };
@@ -96,6 +107,7 @@ type ConfigLayer = {
96
107
  permissions?: PermissionsConfig;
97
108
  mcp?: McpConfig;
98
109
  skills?: SkillsConfig;
110
+ execution_environment?: ExecutionEnvironmentConfig;
99
111
  search?: SearchConfig;
100
112
  tui?: TuiConfig;
101
113
  };
@@ -106,4 +118,4 @@ declare class ConfigRegistry {
106
118
  }
107
119
  declare const configRegistry: ConfigRegistry;
108
120
 
109
- export { CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExperimentalConfig, type McpConfig, type McpServerConfig, type ModelConfig, type OpenAiExperimentalConfig, type PermissionRule, type PermissionsConfig, type SearchConfig, type SearchMode, type SkillsConfig, type TuiConfig, configRegistry, parseConfig };
121
+ export { CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, type McpConfig, type McpServerConfig, type ModelConfig, type OpenAiExperimentalConfig, type PermissionRule, type PermissionsConfig, type SearchConfig, type SearchMode, type SkillsConfig, type TuiConfig, configRegistry, parseConfig };
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
5
5
  permissions: "project",
6
6
  mcp: "project",
7
7
  skills: "project",
8
+ execution_environment: "project",
8
9
  search: "project",
9
10
  tui: "global"
10
11
  };
@@ -28,6 +29,16 @@ var pickStringArray = (value) => {
28
29
  );
29
30
  return values.length ? values : void 0;
30
31
  };
32
+ var pickCommandArray = (value) => {
33
+ if (!Array.isArray(value)) return void 0;
34
+ const values = value.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
35
+ return values.length ? values : void 0;
36
+ };
37
+ var pickCommandMatrix = (value) => {
38
+ if (!Array.isArray(value)) return void 0;
39
+ const commands = value.map((entry) => pickCommandArray(entry)).filter((entry) => Array.isArray(entry));
40
+ return commands.length ? commands : void 0;
41
+ };
31
42
  var pickStringRecord = (value) => {
32
43
  if (!isRecord(value)) return void 0;
33
44
  const entries = Object.entries(value).filter(
@@ -134,6 +145,35 @@ var parseSkillsConfig = (value) => {
134
145
  }
135
146
  return Object.keys(result).length > 0 ? result : void 0;
136
147
  };
148
+ var parseExecutionEnvironmentConfig = (value) => {
149
+ if (!isRecord(value)) return void 0;
150
+ const startupChecks = (() => {
151
+ if (!isRecord(value.startup_checks)) return void 0;
152
+ const enabled = pickBoolean(value.startup_checks.enabled);
153
+ const mode = value.startup_checks.mode === "append" || value.startup_checks.mode === "replace" ? value.startup_checks.mode : void 0;
154
+ const commands = pickCommandMatrix(value.startup_checks.commands);
155
+ const timeoutMs = pickPositiveInt(value.startup_checks.timeout_ms);
156
+ const result2 = {};
157
+ if (enabled !== void 0) {
158
+ result2.enabled = enabled;
159
+ }
160
+ if (mode !== void 0) {
161
+ result2.mode = mode;
162
+ }
163
+ if (commands) {
164
+ result2.commands = commands;
165
+ }
166
+ if (timeoutMs !== void 0) {
167
+ result2.timeout_ms = timeoutMs;
168
+ }
169
+ return Object.keys(result2).length > 0 ? result2 : void 0;
170
+ })();
171
+ const result = {};
172
+ if (startupChecks && Object.keys(startupChecks).length > 0) {
173
+ result.startup_checks = startupChecks;
174
+ }
175
+ return Object.keys(result).length > 0 ? result : void 0;
176
+ };
137
177
  var parseSearchMode = (value) => {
138
178
  if (value !== "auto" && value !== "native" && value !== "local") {
139
179
  return void 0;
@@ -236,6 +276,9 @@ var parseConfig = (value, sourceLabel) => {
236
276
  const hasPermissions = permissions && (permissions.allow || permissions.deny) ? permissions : void 0;
237
277
  const mcp = parseMcpConfig(value.mcp);
238
278
  const skills = parseSkillsConfig(value.skills);
279
+ const executionEnvironment = parseExecutionEnvironmentConfig(
280
+ value.execution_environment
281
+ );
239
282
  const experimental = parseExperimentalConfig(value.experimental);
240
283
  const search = parseSearchConfig(value.search);
241
284
  const tui = isRecord(value.tui) ? {
@@ -251,6 +294,9 @@ var parseConfig = (value, sourceLabel) => {
251
294
  if (skills) {
252
295
  result.skills = skills;
253
296
  }
297
+ if (executionEnvironment) {
298
+ result.execution_environment = executionEnvironment;
299
+ }
254
300
  if (experimental) {
255
301
  result.experimental = experimental;
256
302
  }
@@ -329,6 +375,29 @@ var ConfigRegistry = class {
329
375
  };
330
376
  }
331
377
  }
378
+ if (layer?.execution_environment) {
379
+ const nextExecutionEnvironment = layer.execution_environment;
380
+ merged.execution_environment ??= {};
381
+ if (nextExecutionEnvironment.startup_checks) {
382
+ const nextStartupChecks = nextExecutionEnvironment.startup_checks;
383
+ merged.execution_environment.startup_checks ??= {};
384
+ if (nextStartupChecks.enabled !== void 0) {
385
+ merged.execution_environment.startup_checks.enabled = nextStartupChecks.enabled;
386
+ }
387
+ if (nextStartupChecks.mode !== void 0) {
388
+ merged.execution_environment.startup_checks.mode = nextStartupChecks.mode;
389
+ }
390
+ if (nextStartupChecks.timeout_ms !== void 0) {
391
+ merged.execution_environment.startup_checks.timeout_ms = nextStartupChecks.timeout_ms;
392
+ }
393
+ if (nextStartupChecks.commands) {
394
+ merged.execution_environment.startup_checks.commands = nextStartupChecks.mode === "append" ? [
395
+ ...merged.execution_environment.startup_checks.commands ?? [],
396
+ ...nextStartupChecks.commands
397
+ ] : nextStartupChecks.commands;
398
+ }
399
+ }
400
+ }
332
401
  if (layer?.search) {
333
402
  const nextSearch = layer.search;
334
403
  merged.search ??= {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/config",
3
- "version": "0.1.54",
3
+ "version": "0.1.56",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"