@ottocode/sdk 0.1.266 → 0.1.267
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/package.json +1 -1
- package/src/config/src/index.ts +4 -0
- package/src/config/src/manager.ts +8 -14
- package/src/config/src/paths.ts +4 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
package/src/config/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getGlobalConfigPath,
|
|
3
|
+
getGlobalSkillsConfigPath,
|
|
3
4
|
getLocalDataDir,
|
|
4
5
|
ensureDir,
|
|
5
6
|
fileExists,
|
|
@@ -54,13 +55,16 @@ export async function loadConfig(
|
|
|
54
55
|
const dbPath = joinPath(dataDir, 'otto.sqlite');
|
|
55
56
|
const projectConfigPath = joinPath(dataDir, 'config.json');
|
|
56
57
|
const globalConfigPath = getGlobalConfigPath();
|
|
58
|
+
const globalSkillsConfigPath = getGlobalSkillsConfigPath();
|
|
57
59
|
|
|
58
60
|
const projectCfg = await readJsonOptional(projectConfigPath);
|
|
59
61
|
const globalCfg = await readJsonOptional(globalConfigPath);
|
|
62
|
+
const globalSkillsCfg = await readJsonOptional(globalSkillsConfigPath);
|
|
60
63
|
|
|
61
64
|
const merged = deepMerge(
|
|
62
65
|
DEFAULTS,
|
|
63
66
|
globalCfg,
|
|
67
|
+
globalSkillsCfg ? { skills: globalSkillsCfg } : undefined,
|
|
64
68
|
omitGlobalOnlySettings(projectCfg),
|
|
65
69
|
);
|
|
66
70
|
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
import {
|
|
14
14
|
getGlobalConfigDir,
|
|
15
15
|
getGlobalConfigPath,
|
|
16
|
+
getGlobalSkillsConfigPath,
|
|
16
17
|
getGlobalDebugDir,
|
|
17
18
|
getGlobalDebugLogPath,
|
|
18
19
|
getGlobalDebugSessionsDir,
|
|
@@ -151,25 +152,18 @@ export async function writeSkillSettings(
|
|
|
151
152
|
updates: SkillSettings,
|
|
152
153
|
_projectRoot?: string,
|
|
153
154
|
) {
|
|
154
|
-
const filePath =
|
|
155
|
+
const filePath = getGlobalSkillsConfigPath();
|
|
155
156
|
const existing = await readJsonFile(filePath);
|
|
156
|
-
const prevSkills =
|
|
157
|
-
existing && typeof existing.skills === 'object'
|
|
158
|
-
? (existing.skills as Record<string, unknown>)
|
|
159
|
-
: {};
|
|
160
157
|
const prevItems =
|
|
161
|
-
|
|
162
|
-
? (
|
|
158
|
+
existing?.items && typeof existing.items === 'object'
|
|
159
|
+
? (existing.items as Record<string, unknown>)
|
|
163
160
|
: {};
|
|
164
161
|
const next = {
|
|
165
162
|
...existing,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
...
|
|
169
|
-
items
|
|
170
|
-
...prevItems,
|
|
171
|
-
...(updates.items ?? {}),
|
|
172
|
-
},
|
|
163
|
+
...updates,
|
|
164
|
+
items: {
|
|
165
|
+
...prevItems,
|
|
166
|
+
...(updates.items ?? {}),
|
|
173
167
|
},
|
|
174
168
|
};
|
|
175
169
|
await writeConfigFile(filePath, next);
|
package/src/config/src/paths.ts
CHANGED
|
@@ -31,6 +31,10 @@ export function getGlobalConfigPath(): string {
|
|
|
31
31
|
return joinPath(getGlobalConfigDir(), 'config.json');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export function getGlobalSkillsConfigPath(): string {
|
|
35
|
+
return joinPath(getGlobalConfigDir(), 'skills.json');
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
export function getGlobalAuthPath(): string {
|
|
35
39
|
return joinPath(getGlobalConfigDir(), 'auth.json');
|
|
36
40
|
}
|