@codelia/config 0.1.91 → 0.1.94
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 +98 -12
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +98 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -327,12 +327,14 @@ var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
|
|
|
327
327
|
experimental: "global",
|
|
328
328
|
permissions: "project",
|
|
329
329
|
mcp: "project",
|
|
330
|
+
agents: "project",
|
|
330
331
|
skills: "project",
|
|
331
332
|
execution_environment: "project",
|
|
332
333
|
search: "project",
|
|
333
334
|
image_generation: "global",
|
|
334
335
|
tui: "global",
|
|
335
|
-
update: "global"
|
|
336
|
+
update: "global",
|
|
337
|
+
worktree: "global"
|
|
336
338
|
};
|
|
337
339
|
var CONFIG_VERSION = 1;
|
|
338
340
|
var MCP_SERVER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
@@ -655,14 +657,56 @@ var parseSubagentConfig = (value, source) => {
|
|
|
655
657
|
};
|
|
656
658
|
var parseAuthConfig = (value, source) => {
|
|
657
659
|
if (!isRecord(value)) return void 0;
|
|
658
|
-
const
|
|
659
|
-
if (storage
|
|
660
|
-
|
|
661
|
-
|
|
660
|
+
const result = {};
|
|
661
|
+
if (value.storage !== void 0) {
|
|
662
|
+
const storage = value.storage;
|
|
663
|
+
if (storage === "auto" || storage === "keyring" || storage === "file") {
|
|
664
|
+
result.storage = storage;
|
|
665
|
+
} else {
|
|
666
|
+
throw new Error(
|
|
667
|
+
`${source}: auth.storage must be "auto", "keyring", or "file"`
|
|
668
|
+
);
|
|
669
|
+
}
|
|
662
670
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
671
|
+
if (value.oauth_browser !== void 0) {
|
|
672
|
+
const browser = value.oauth_browser;
|
|
673
|
+
if (browser === "auto" || browser === "manual") {
|
|
674
|
+
result.oauth_browser = browser;
|
|
675
|
+
} else {
|
|
676
|
+
throw new Error(
|
|
677
|
+
`${source}: auth.oauth_browser must be "auto" or "manual"`
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
682
|
+
};
|
|
683
|
+
var parseTuiConfig = (value, source) => {
|
|
684
|
+
if (!isRecord(value)) return void 0;
|
|
685
|
+
const result = {};
|
|
686
|
+
const theme = pickString(value.theme);
|
|
687
|
+
if (theme) result.theme = theme;
|
|
688
|
+
if (value.color_scheme !== void 0) {
|
|
689
|
+
if (value.color_scheme === "dark" || value.color_scheme === "light") {
|
|
690
|
+
result.color_scheme = value.color_scheme;
|
|
691
|
+
} else {
|
|
692
|
+
throw new Error(`${source}: tui.color_scheme must be "dark" or "light"`);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
if (value.image_protocol !== void 0) {
|
|
696
|
+
if (value.image_protocol === "halfblocks" || value.image_protocol === "kitty") {
|
|
697
|
+
result.image_protocol = value.image_protocol;
|
|
698
|
+
} else {
|
|
699
|
+
throw new Error(
|
|
700
|
+
`${source}: tui.image_protocol must be "halfblocks" or "kitty"`
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
705
|
+
};
|
|
706
|
+
var parseAgentsConfig = (value) => {
|
|
707
|
+
if (!isRecord(value)) return void 0;
|
|
708
|
+
const enabled = pickBoolean(value.enabled);
|
|
709
|
+
return enabled !== void 0 ? { enabled } : void 0;
|
|
666
710
|
};
|
|
667
711
|
var parseUpdateConfig = (value, source) => {
|
|
668
712
|
if (!isRecord(value)) return void 0;
|
|
@@ -684,6 +728,36 @@ var parseUpdateConfig = (value, source) => {
|
|
|
684
728
|
}
|
|
685
729
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
686
730
|
};
|
|
731
|
+
function parseWorktreeConfig(value, source) {
|
|
732
|
+
if (!isRecord(value))
|
|
733
|
+
throw new Error(`${source}: worktree must be an object`);
|
|
734
|
+
const { include_files, use_worktreeinclude, setup_command } = value;
|
|
735
|
+
const config = {};
|
|
736
|
+
if (include_files !== void 0) {
|
|
737
|
+
if (!Array.isArray(include_files) || include_files.some(
|
|
738
|
+
(entry) => typeof entry !== "string" || !entry.trim() || /[\r\n\0]/.test(entry)
|
|
739
|
+
))
|
|
740
|
+
throw new Error(
|
|
741
|
+
`${source}: worktree.include_files must contain nonempty single-line patterns`
|
|
742
|
+
);
|
|
743
|
+
config.include_files = include_files;
|
|
744
|
+
}
|
|
745
|
+
if (use_worktreeinclude !== void 0) {
|
|
746
|
+
if (typeof use_worktreeinclude !== "boolean")
|
|
747
|
+
throw new Error(
|
|
748
|
+
`${source}: worktree.use_worktreeinclude must be boolean`
|
|
749
|
+
);
|
|
750
|
+
config.use_worktreeinclude = use_worktreeinclude;
|
|
751
|
+
}
|
|
752
|
+
if (setup_command !== void 0) {
|
|
753
|
+
if (typeof setup_command !== "string" || !setup_command.trim() || setup_command.includes("\0"))
|
|
754
|
+
throw new Error(
|
|
755
|
+
`${source}: worktree.setup_command must be a nonempty command`
|
|
756
|
+
);
|
|
757
|
+
config.setup_command = setup_command;
|
|
758
|
+
}
|
|
759
|
+
return config;
|
|
760
|
+
}
|
|
687
761
|
var parseConfig = (value, sourceLabel) => {
|
|
688
762
|
if (!isRecord(value)) {
|
|
689
763
|
throw new Error(`${sourceLabel}: config must be an object`);
|
|
@@ -703,15 +777,14 @@ var parseConfig = (value, sourceLabel) => {
|
|
|
703
777
|
} : void 0;
|
|
704
778
|
const hasPermissions = permissions && (permissions.allow || permissions.deny) ? permissions : void 0;
|
|
705
779
|
const mcp = parseMcpConfig(value.mcp);
|
|
780
|
+
const agents = parseAgentsConfig(value.agents);
|
|
706
781
|
const skills = parseSkillsConfig(value.skills);
|
|
707
782
|
const executionEnvironment = parseExecutionEnvironmentConfig(
|
|
708
783
|
value.execution_environment
|
|
709
784
|
);
|
|
710
785
|
const experimental = parseExperimentalConfig(value.experimental);
|
|
711
786
|
const search = parseSearchConfig(value.search);
|
|
712
|
-
const tui =
|
|
713
|
-
...pickString(value.tui.theme) ? { theme: pickString(value.tui.theme) } : {}
|
|
714
|
-
} : void 0;
|
|
787
|
+
const tui = parseTuiConfig(value.tui, sourceLabel);
|
|
715
788
|
const result = { version, model };
|
|
716
789
|
if (auth) result.auth = auth;
|
|
717
790
|
if (value.providers !== void 0)
|
|
@@ -727,6 +800,9 @@ var parseConfig = (value, sourceLabel) => {
|
|
|
727
800
|
if (mcp) {
|
|
728
801
|
result.mcp = mcp;
|
|
729
802
|
}
|
|
803
|
+
if (agents) {
|
|
804
|
+
result.agents = agents;
|
|
805
|
+
}
|
|
730
806
|
if (skills) {
|
|
731
807
|
result.skills = skills;
|
|
732
808
|
}
|
|
@@ -739,10 +815,12 @@ var parseConfig = (value, sourceLabel) => {
|
|
|
739
815
|
if (search) {
|
|
740
816
|
result.search = search;
|
|
741
817
|
}
|
|
742
|
-
if (tui
|
|
818
|
+
if (tui) {
|
|
743
819
|
result.tui = tui;
|
|
744
820
|
}
|
|
745
821
|
if (update) result.update = update;
|
|
822
|
+
if (value.worktree !== void 0)
|
|
823
|
+
result.worktree = parseWorktreeConfig(value.worktree, sourceLabel);
|
|
746
824
|
return result;
|
|
747
825
|
};
|
|
748
826
|
var ConfigRegistry = class {
|
|
@@ -810,6 +888,9 @@ var ConfigRegistry = class {
|
|
|
810
888
|
}
|
|
811
889
|
};
|
|
812
890
|
}
|
|
891
|
+
if (layer?.agents) {
|
|
892
|
+
merged.agents = { ...merged.agents ?? {}, ...layer.agents };
|
|
893
|
+
}
|
|
813
894
|
if (layer?.skills) {
|
|
814
895
|
const nextSkills = layer.skills;
|
|
815
896
|
merged.skills ??= {};
|
|
@@ -889,6 +970,11 @@ var ConfigRegistry = class {
|
|
|
889
970
|
if (layer?.update) {
|
|
890
971
|
merged.update = { ...merged.update ?? {}, ...layer.update };
|
|
891
972
|
}
|
|
973
|
+
if (layer?.worktree)
|
|
974
|
+
merged.worktree = {
|
|
975
|
+
...merged.worktree,
|
|
976
|
+
...structuredClone(layer.worktree)
|
|
977
|
+
};
|
|
892
978
|
}
|
|
893
979
|
return merged;
|
|
894
980
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -176,12 +176,21 @@ type SearchConfig = {
|
|
|
176
176
|
};
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
+
type TuiColorScheme = "dark" | "light";
|
|
180
|
+
type TuiImageProtocol = "halfblocks" | "kitty";
|
|
179
181
|
type TuiConfig = {
|
|
180
182
|
theme?: string;
|
|
183
|
+
color_scheme?: TuiColorScheme;
|
|
184
|
+
image_protocol?: TuiImageProtocol;
|
|
181
185
|
};
|
|
182
186
|
type AuthStorageMode = "auto" | "keyring" | "file";
|
|
187
|
+
type OAuthBrowserMode = "auto" | "manual";
|
|
183
188
|
type AuthConfig = {
|
|
184
189
|
storage?: AuthStorageMode;
|
|
190
|
+
oauth_browser?: OAuthBrowserMode;
|
|
191
|
+
};
|
|
192
|
+
type AgentsFileConfig = {
|
|
193
|
+
enabled?: boolean;
|
|
185
194
|
};
|
|
186
195
|
type UpdateMode = "auto" | "notify" | "off";
|
|
187
196
|
/** Launcher-only self-update settings; read from the global config only. */
|
|
@@ -192,6 +201,11 @@ type UpdateConfig = {
|
|
|
192
201
|
};
|
|
193
202
|
declare const isValidUpdateChannel: (value: string) => boolean;
|
|
194
203
|
declare const parseUpdateMode: (value: unknown) => UpdateMode | undefined;
|
|
204
|
+
type WorktreeConfig = {
|
|
205
|
+
include_files?: string[];
|
|
206
|
+
use_worktreeinclude?: boolean;
|
|
207
|
+
setup_command?: string;
|
|
208
|
+
};
|
|
195
209
|
type CodeliaConfig = {
|
|
196
210
|
providers?: Record<string, ResponsesProviderConfig>;
|
|
197
211
|
image_generation?: ImageGenerationConfig;
|
|
@@ -202,11 +216,13 @@ type CodeliaConfig = {
|
|
|
202
216
|
experimental?: ExperimentalConfig;
|
|
203
217
|
permissions?: PermissionsConfig;
|
|
204
218
|
mcp?: McpConfig;
|
|
219
|
+
agents?: AgentsFileConfig;
|
|
205
220
|
skills?: SkillsConfig;
|
|
206
221
|
execution_environment?: ExecutionEnvironmentConfig;
|
|
207
222
|
search?: SearchConfig;
|
|
208
223
|
tui?: TuiConfig;
|
|
209
224
|
update?: UpdateConfig;
|
|
225
|
+
worktree?: WorktreeConfig;
|
|
210
226
|
};
|
|
211
227
|
type ConfigWriteScope = "global" | "project";
|
|
212
228
|
type ConfigWriteGroup = Exclude<keyof CodeliaConfig, "version">;
|
|
@@ -224,11 +240,13 @@ type ConfigLayer = {
|
|
|
224
240
|
experimental?: ExperimentalConfig;
|
|
225
241
|
permissions?: PermissionsConfig;
|
|
226
242
|
mcp?: McpConfig;
|
|
243
|
+
agents?: AgentsFileConfig;
|
|
227
244
|
skills?: SkillsConfig;
|
|
228
245
|
execution_environment?: ExecutionEnvironmentConfig;
|
|
229
246
|
search?: SearchConfig;
|
|
230
247
|
tui?: TuiConfig;
|
|
231
248
|
update?: UpdateConfig;
|
|
249
|
+
worktree?: WorktreeConfig;
|
|
232
250
|
};
|
|
233
251
|
declare class ConfigRegistry {
|
|
234
252
|
private readonly defaults;
|
|
@@ -237,4 +255,4 @@ declare class ConfigRegistry {
|
|
|
237
255
|
}
|
|
238
256
|
declare const configRegistry: ConfigRegistry;
|
|
239
257
|
|
|
240
|
-
export { type AuthConfig, type AuthStorageMode, BUILTIN_PROVIDER_NAMES, CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, GOOGLE_IMAGE_MODELS, type GoogleImageOptions, type ImageGenerationConfig, type ImageProviderOptions, type McpConfig, type McpServerConfig, type ModelConfig, OPENAI_CODEX_IMAGE_MODELS, OPENAI_IMAGE_MODELS, type OpenAiExperimentalConfig, type OpenAiImageOptions, type OpenRouterImageOptions, type PermissionRule, type PermissionsConfig, type ResponsesModelConfig, type ResponsesProviderConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiConfig, type UpdateConfig, type UpdateMode, configRegistry, isValidUpdateChannel, normalizePermissionRule, parseConfig, parseImageGenerationConfig, parseResponsesProviders, parseUpdateMode };
|
|
258
|
+
export { type AgentsFileConfig, type AuthConfig, type AuthStorageMode, BUILTIN_PROVIDER_NAMES, CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, GOOGLE_IMAGE_MODELS, type GoogleImageOptions, type ImageGenerationConfig, type ImageProviderOptions, type McpConfig, type McpServerConfig, type ModelConfig, type OAuthBrowserMode, OPENAI_CODEX_IMAGE_MODELS, OPENAI_IMAGE_MODELS, type OpenAiExperimentalConfig, type OpenAiImageOptions, type OpenRouterImageOptions, type PermissionRule, type PermissionsConfig, type ResponsesModelConfig, type ResponsesProviderConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiColorScheme, type TuiConfig, type TuiImageProtocol, type UpdateConfig, type UpdateMode, type WorktreeConfig, configRegistry, isValidUpdateChannel, normalizePermissionRule, parseConfig, parseImageGenerationConfig, parseResponsesProviders, parseUpdateMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -176,12 +176,21 @@ type SearchConfig = {
|
|
|
176
176
|
};
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
+
type TuiColorScheme = "dark" | "light";
|
|
180
|
+
type TuiImageProtocol = "halfblocks" | "kitty";
|
|
179
181
|
type TuiConfig = {
|
|
180
182
|
theme?: string;
|
|
183
|
+
color_scheme?: TuiColorScheme;
|
|
184
|
+
image_protocol?: TuiImageProtocol;
|
|
181
185
|
};
|
|
182
186
|
type AuthStorageMode = "auto" | "keyring" | "file";
|
|
187
|
+
type OAuthBrowserMode = "auto" | "manual";
|
|
183
188
|
type AuthConfig = {
|
|
184
189
|
storage?: AuthStorageMode;
|
|
190
|
+
oauth_browser?: OAuthBrowserMode;
|
|
191
|
+
};
|
|
192
|
+
type AgentsFileConfig = {
|
|
193
|
+
enabled?: boolean;
|
|
185
194
|
};
|
|
186
195
|
type UpdateMode = "auto" | "notify" | "off";
|
|
187
196
|
/** Launcher-only self-update settings; read from the global config only. */
|
|
@@ -192,6 +201,11 @@ type UpdateConfig = {
|
|
|
192
201
|
};
|
|
193
202
|
declare const isValidUpdateChannel: (value: string) => boolean;
|
|
194
203
|
declare const parseUpdateMode: (value: unknown) => UpdateMode | undefined;
|
|
204
|
+
type WorktreeConfig = {
|
|
205
|
+
include_files?: string[];
|
|
206
|
+
use_worktreeinclude?: boolean;
|
|
207
|
+
setup_command?: string;
|
|
208
|
+
};
|
|
195
209
|
type CodeliaConfig = {
|
|
196
210
|
providers?: Record<string, ResponsesProviderConfig>;
|
|
197
211
|
image_generation?: ImageGenerationConfig;
|
|
@@ -202,11 +216,13 @@ type CodeliaConfig = {
|
|
|
202
216
|
experimental?: ExperimentalConfig;
|
|
203
217
|
permissions?: PermissionsConfig;
|
|
204
218
|
mcp?: McpConfig;
|
|
219
|
+
agents?: AgentsFileConfig;
|
|
205
220
|
skills?: SkillsConfig;
|
|
206
221
|
execution_environment?: ExecutionEnvironmentConfig;
|
|
207
222
|
search?: SearchConfig;
|
|
208
223
|
tui?: TuiConfig;
|
|
209
224
|
update?: UpdateConfig;
|
|
225
|
+
worktree?: WorktreeConfig;
|
|
210
226
|
};
|
|
211
227
|
type ConfigWriteScope = "global" | "project";
|
|
212
228
|
type ConfigWriteGroup = Exclude<keyof CodeliaConfig, "version">;
|
|
@@ -224,11 +240,13 @@ type ConfigLayer = {
|
|
|
224
240
|
experimental?: ExperimentalConfig;
|
|
225
241
|
permissions?: PermissionsConfig;
|
|
226
242
|
mcp?: McpConfig;
|
|
243
|
+
agents?: AgentsFileConfig;
|
|
227
244
|
skills?: SkillsConfig;
|
|
228
245
|
execution_environment?: ExecutionEnvironmentConfig;
|
|
229
246
|
search?: SearchConfig;
|
|
230
247
|
tui?: TuiConfig;
|
|
231
248
|
update?: UpdateConfig;
|
|
249
|
+
worktree?: WorktreeConfig;
|
|
232
250
|
};
|
|
233
251
|
declare class ConfigRegistry {
|
|
234
252
|
private readonly defaults;
|
|
@@ -237,4 +255,4 @@ declare class ConfigRegistry {
|
|
|
237
255
|
}
|
|
238
256
|
declare const configRegistry: ConfigRegistry;
|
|
239
257
|
|
|
240
|
-
export { type AuthConfig, type AuthStorageMode, BUILTIN_PROVIDER_NAMES, CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, GOOGLE_IMAGE_MODELS, type GoogleImageOptions, type ImageGenerationConfig, type ImageProviderOptions, type McpConfig, type McpServerConfig, type ModelConfig, OPENAI_CODEX_IMAGE_MODELS, OPENAI_IMAGE_MODELS, type OpenAiExperimentalConfig, type OpenAiImageOptions, type OpenRouterImageOptions, type PermissionRule, type PermissionsConfig, type ResponsesModelConfig, type ResponsesProviderConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiConfig, type UpdateConfig, type UpdateMode, configRegistry, isValidUpdateChannel, normalizePermissionRule, parseConfig, parseImageGenerationConfig, parseResponsesProviders, parseUpdateMode };
|
|
258
|
+
export { type AgentsFileConfig, type AuthConfig, type AuthStorageMode, BUILTIN_PROVIDER_NAMES, CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, GOOGLE_IMAGE_MODELS, type GoogleImageOptions, type ImageGenerationConfig, type ImageProviderOptions, type McpConfig, type McpServerConfig, type ModelConfig, type OAuthBrowserMode, OPENAI_CODEX_IMAGE_MODELS, OPENAI_IMAGE_MODELS, type OpenAiExperimentalConfig, type OpenAiImageOptions, type OpenRouterImageOptions, type PermissionRule, type PermissionsConfig, type ResponsesModelConfig, type ResponsesProviderConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiColorScheme, type TuiConfig, type TuiImageProtocol, type UpdateConfig, type UpdateMode, type WorktreeConfig, configRegistry, isValidUpdateChannel, normalizePermissionRule, parseConfig, parseImageGenerationConfig, parseResponsesProviders, parseUpdateMode };
|
package/dist/index.js
CHANGED
|
@@ -287,12 +287,14 @@ var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
|
|
|
287
287
|
experimental: "global",
|
|
288
288
|
permissions: "project",
|
|
289
289
|
mcp: "project",
|
|
290
|
+
agents: "project",
|
|
290
291
|
skills: "project",
|
|
291
292
|
execution_environment: "project",
|
|
292
293
|
search: "project",
|
|
293
294
|
image_generation: "global",
|
|
294
295
|
tui: "global",
|
|
295
|
-
update: "global"
|
|
296
|
+
update: "global",
|
|
297
|
+
worktree: "global"
|
|
296
298
|
};
|
|
297
299
|
var CONFIG_VERSION = 1;
|
|
298
300
|
var MCP_SERVER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
@@ -615,14 +617,56 @@ var parseSubagentConfig = (value, source) => {
|
|
|
615
617
|
};
|
|
616
618
|
var parseAuthConfig = (value, source) => {
|
|
617
619
|
if (!isRecord(value)) return void 0;
|
|
618
|
-
const
|
|
619
|
-
if (storage
|
|
620
|
-
|
|
621
|
-
|
|
620
|
+
const result = {};
|
|
621
|
+
if (value.storage !== void 0) {
|
|
622
|
+
const storage = value.storage;
|
|
623
|
+
if (storage === "auto" || storage === "keyring" || storage === "file") {
|
|
624
|
+
result.storage = storage;
|
|
625
|
+
} else {
|
|
626
|
+
throw new Error(
|
|
627
|
+
`${source}: auth.storage must be "auto", "keyring", or "file"`
|
|
628
|
+
);
|
|
629
|
+
}
|
|
622
630
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
631
|
+
if (value.oauth_browser !== void 0) {
|
|
632
|
+
const browser = value.oauth_browser;
|
|
633
|
+
if (browser === "auto" || browser === "manual") {
|
|
634
|
+
result.oauth_browser = browser;
|
|
635
|
+
} else {
|
|
636
|
+
throw new Error(
|
|
637
|
+
`${source}: auth.oauth_browser must be "auto" or "manual"`
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
642
|
+
};
|
|
643
|
+
var parseTuiConfig = (value, source) => {
|
|
644
|
+
if (!isRecord(value)) return void 0;
|
|
645
|
+
const result = {};
|
|
646
|
+
const theme = pickString(value.theme);
|
|
647
|
+
if (theme) result.theme = theme;
|
|
648
|
+
if (value.color_scheme !== void 0) {
|
|
649
|
+
if (value.color_scheme === "dark" || value.color_scheme === "light") {
|
|
650
|
+
result.color_scheme = value.color_scheme;
|
|
651
|
+
} else {
|
|
652
|
+
throw new Error(`${source}: tui.color_scheme must be "dark" or "light"`);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
if (value.image_protocol !== void 0) {
|
|
656
|
+
if (value.image_protocol === "halfblocks" || value.image_protocol === "kitty") {
|
|
657
|
+
result.image_protocol = value.image_protocol;
|
|
658
|
+
} else {
|
|
659
|
+
throw new Error(
|
|
660
|
+
`${source}: tui.image_protocol must be "halfblocks" or "kitty"`
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
665
|
+
};
|
|
666
|
+
var parseAgentsConfig = (value) => {
|
|
667
|
+
if (!isRecord(value)) return void 0;
|
|
668
|
+
const enabled = pickBoolean(value.enabled);
|
|
669
|
+
return enabled !== void 0 ? { enabled } : void 0;
|
|
626
670
|
};
|
|
627
671
|
var parseUpdateConfig = (value, source) => {
|
|
628
672
|
if (!isRecord(value)) return void 0;
|
|
@@ -644,6 +688,36 @@ var parseUpdateConfig = (value, source) => {
|
|
|
644
688
|
}
|
|
645
689
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
646
690
|
};
|
|
691
|
+
function parseWorktreeConfig(value, source) {
|
|
692
|
+
if (!isRecord(value))
|
|
693
|
+
throw new Error(`${source}: worktree must be an object`);
|
|
694
|
+
const { include_files, use_worktreeinclude, setup_command } = value;
|
|
695
|
+
const config = {};
|
|
696
|
+
if (include_files !== void 0) {
|
|
697
|
+
if (!Array.isArray(include_files) || include_files.some(
|
|
698
|
+
(entry) => typeof entry !== "string" || !entry.trim() || /[\r\n\0]/.test(entry)
|
|
699
|
+
))
|
|
700
|
+
throw new Error(
|
|
701
|
+
`${source}: worktree.include_files must contain nonempty single-line patterns`
|
|
702
|
+
);
|
|
703
|
+
config.include_files = include_files;
|
|
704
|
+
}
|
|
705
|
+
if (use_worktreeinclude !== void 0) {
|
|
706
|
+
if (typeof use_worktreeinclude !== "boolean")
|
|
707
|
+
throw new Error(
|
|
708
|
+
`${source}: worktree.use_worktreeinclude must be boolean`
|
|
709
|
+
);
|
|
710
|
+
config.use_worktreeinclude = use_worktreeinclude;
|
|
711
|
+
}
|
|
712
|
+
if (setup_command !== void 0) {
|
|
713
|
+
if (typeof setup_command !== "string" || !setup_command.trim() || setup_command.includes("\0"))
|
|
714
|
+
throw new Error(
|
|
715
|
+
`${source}: worktree.setup_command must be a nonempty command`
|
|
716
|
+
);
|
|
717
|
+
config.setup_command = setup_command;
|
|
718
|
+
}
|
|
719
|
+
return config;
|
|
720
|
+
}
|
|
647
721
|
var parseConfig = (value, sourceLabel) => {
|
|
648
722
|
if (!isRecord(value)) {
|
|
649
723
|
throw new Error(`${sourceLabel}: config must be an object`);
|
|
@@ -663,15 +737,14 @@ var parseConfig = (value, sourceLabel) => {
|
|
|
663
737
|
} : void 0;
|
|
664
738
|
const hasPermissions = permissions && (permissions.allow || permissions.deny) ? permissions : void 0;
|
|
665
739
|
const mcp = parseMcpConfig(value.mcp);
|
|
740
|
+
const agents = parseAgentsConfig(value.agents);
|
|
666
741
|
const skills = parseSkillsConfig(value.skills);
|
|
667
742
|
const executionEnvironment = parseExecutionEnvironmentConfig(
|
|
668
743
|
value.execution_environment
|
|
669
744
|
);
|
|
670
745
|
const experimental = parseExperimentalConfig(value.experimental);
|
|
671
746
|
const search = parseSearchConfig(value.search);
|
|
672
|
-
const tui =
|
|
673
|
-
...pickString(value.tui.theme) ? { theme: pickString(value.tui.theme) } : {}
|
|
674
|
-
} : void 0;
|
|
747
|
+
const tui = parseTuiConfig(value.tui, sourceLabel);
|
|
675
748
|
const result = { version, model };
|
|
676
749
|
if (auth) result.auth = auth;
|
|
677
750
|
if (value.providers !== void 0)
|
|
@@ -687,6 +760,9 @@ var parseConfig = (value, sourceLabel) => {
|
|
|
687
760
|
if (mcp) {
|
|
688
761
|
result.mcp = mcp;
|
|
689
762
|
}
|
|
763
|
+
if (agents) {
|
|
764
|
+
result.agents = agents;
|
|
765
|
+
}
|
|
690
766
|
if (skills) {
|
|
691
767
|
result.skills = skills;
|
|
692
768
|
}
|
|
@@ -699,10 +775,12 @@ var parseConfig = (value, sourceLabel) => {
|
|
|
699
775
|
if (search) {
|
|
700
776
|
result.search = search;
|
|
701
777
|
}
|
|
702
|
-
if (tui
|
|
778
|
+
if (tui) {
|
|
703
779
|
result.tui = tui;
|
|
704
780
|
}
|
|
705
781
|
if (update) result.update = update;
|
|
782
|
+
if (value.worktree !== void 0)
|
|
783
|
+
result.worktree = parseWorktreeConfig(value.worktree, sourceLabel);
|
|
706
784
|
return result;
|
|
707
785
|
};
|
|
708
786
|
var ConfigRegistry = class {
|
|
@@ -770,6 +848,9 @@ var ConfigRegistry = class {
|
|
|
770
848
|
}
|
|
771
849
|
};
|
|
772
850
|
}
|
|
851
|
+
if (layer?.agents) {
|
|
852
|
+
merged.agents = { ...merged.agents ?? {}, ...layer.agents };
|
|
853
|
+
}
|
|
773
854
|
if (layer?.skills) {
|
|
774
855
|
const nextSkills = layer.skills;
|
|
775
856
|
merged.skills ??= {};
|
|
@@ -849,6 +930,11 @@ var ConfigRegistry = class {
|
|
|
849
930
|
if (layer?.update) {
|
|
850
931
|
merged.update = { ...merged.update ?? {}, ...layer.update };
|
|
851
932
|
}
|
|
933
|
+
if (layer?.worktree)
|
|
934
|
+
merged.worktree = {
|
|
935
|
+
...merged.worktree,
|
|
936
|
+
...structuredClone(layer.worktree)
|
|
937
|
+
};
|
|
852
938
|
}
|
|
853
939
|
return merged;
|
|
854
940
|
}
|