@tigerdata/mcp-boilerplate 1.6.0 → 1.6.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.
- package/dist/skills/utils.d.ts +1 -0
- package/dist/skills/utils.js +15 -2
- package/package.json +1 -1
package/dist/skills/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Octokit } from '@octokit/rest';
|
|
2
2
|
import { type McpFeatureFlags } from '@tigerdata/mcp-boilerplate';
|
|
3
3
|
import { type CollectionFlags, type CollectionFlagsCfg, type Skill, type SkillCfgMap, type SkillMatter, type SkillsFlags } from './types.js';
|
|
4
|
+
export declare const setSkillConfigReadOverride: (fn: (() => Promise<SkillCfgMap>) | null) => void;
|
|
4
5
|
export declare const getSkillConfig: (configFilePath?: string) => Promise<SkillCfgMap>;
|
|
5
6
|
export declare const parseSkillFile: (fileContent: string) => Promise<{
|
|
6
7
|
matter: SkillMatter;
|
package/dist/skills/utils.js
CHANGED
|
@@ -10,11 +10,24 @@ const TTL = process.env.SKILLS_TTL
|
|
|
10
10
|
: 5 * 60 * 1000;
|
|
11
11
|
let lastFetchCfg = 0;
|
|
12
12
|
let skillCfgMap = null;
|
|
13
|
+
let getSkillOverride = null;
|
|
14
|
+
// added so that the consumer can control where the skill config comes from
|
|
15
|
+
// e.g. programmatically, rather than from a file
|
|
16
|
+
// chose to use a setter pattern to minimize changing signatures everywhere,
|
|
17
|
+
// this approach has a minimal footprint
|
|
18
|
+
export const setSkillConfigReadOverride = (fn) => {
|
|
19
|
+
getSkillOverride = fn;
|
|
20
|
+
};
|
|
13
21
|
export const getSkillConfig = async (configFilePath = process.env.SKILLS_FILE || './skills.yaml') => {
|
|
14
22
|
if (skillCfgMap && Date.now() - lastFetchCfg < TTL)
|
|
15
23
|
return skillCfgMap;
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
if (getSkillOverride !== null) {
|
|
25
|
+
skillCfgMap = await getSkillOverride();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const data = await readFile(configFilePath, 'utf-8');
|
|
29
|
+
skillCfgMap = zSkillCfgMap.parse(YAML.parse(data));
|
|
30
|
+
}
|
|
18
31
|
lastFetchCfg = Date.now();
|
|
19
32
|
return skillCfgMap;
|
|
20
33
|
};
|