mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 21:03:19 +00:00
Return defensive copies from SettingsManager getters
getHookPaths(), getCustomToolPaths(), and getSkillsSettings() now return copies of arrays instead of references to internal state. This prevents callers from accidentally mutating settings without going through setters. Fixes #361
This commit is contained in:
parent
92947a3dc4
commit
0fe9f74b4e
1 changed files with 5 additions and 5 deletions
|
|
@ -314,7 +314,7 @@ export class SettingsManager {
|
|||
}
|
||||
|
||||
getHookPaths(): string[] {
|
||||
return this.settings.hooks ?? [];
|
||||
return [...(this.settings.hooks ?? [])];
|
||||
}
|
||||
|
||||
setHookPaths(paths: string[]): void {
|
||||
|
|
@ -332,7 +332,7 @@ export class SettingsManager {
|
|||
}
|
||||
|
||||
getCustomToolPaths(): string[] {
|
||||
return this.settings.customTools ?? [];
|
||||
return [...(this.settings.customTools ?? [])];
|
||||
}
|
||||
|
||||
setCustomToolPaths(paths: string[]): void {
|
||||
|
|
@ -360,9 +360,9 @@ export class SettingsManager {
|
|||
enableClaudeProject: this.settings.skills?.enableClaudeProject ?? true,
|
||||
enablePiUser: this.settings.skills?.enablePiUser ?? true,
|
||||
enablePiProject: this.settings.skills?.enablePiProject ?? true,
|
||||
customDirectories: this.settings.skills?.customDirectories ?? [],
|
||||
ignoredSkills: this.settings.skills?.ignoredSkills ?? [],
|
||||
includeSkills: this.settings.skills?.includeSkills ?? [],
|
||||
customDirectories: [...(this.settings.skills?.customDirectories ?? [])],
|
||||
ignoredSkills: [...(this.settings.skills?.ignoredSkills ?? [])],
|
||||
includeSkills: [...(this.settings.skills?.includeSkills ?? [])],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue