MCPcopy Create free account
hub / github.com/Railly/agentfiles / SkillStore

Class SkillStore

src/store.ts:31–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31export class SkillStore extends Events {
32 private items: Map<string, SkillItem> = new Map();
33 private _filter: SidebarFilter = { kind: "all" };
34 private _searchQuery = "";
35 private _deepSearch = false;
36 private _deepSearchScope: DeepSearchScope = "both";
37 private _projectsHomeDir = "";
38
39 get filter(): SidebarFilter {
40 return this._filter;
41 }
42
43 get searchQuery(): string {
44 return this._searchQuery;
45 }
46
47 get deepSearch(): boolean {
48 return this._deepSearch;
49 }
50
51 get allItems(): SkillItem[] {
52 return Array.from(this.items.values());
53 }
54
55 get filteredItems(): SkillItem[] {
56 let result = this.allItems;
57
58 switch (this._filter.kind) {
59 case "favorites":
60 result = result.filter((i) => i.isFavorite);
61 break;
62 case "tool": {
63 const toolId = this._filter.toolId;
64 result = result.filter((i) => i.tools.includes(toolId));
65 break;
66 }
67 case "type": {
68 const type = this._filter.type;
69 result = result.filter((i) => i.type === type);
70 break;
71 }
72 case "collection": {
73 const name = this._filter.name;
74 result = result.filter((i) => i.collections.includes(name));
75 break;
76 }
77 case "project": {
78 const project = this._filter.project;
79 result = result.filter(
80 (i) => getProjectName(i.filePath, this._projectsHomeDir) === project
81 );
82 break;
83 }
84 }
85
86 if (this._searchQuery) {
87 const q = this._searchQuery.toLowerCase();
88 const searchDesc = this._deepSearch && (this._deepSearchScope === "description" || this._deepSearchScope === "both");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected