MCPcopy
hub / github.com/codedogQBY/ReadAny / updateSkill

Function updateSkill

packages/core/src/db/skill-queries.ts:98–137  ·  view source on GitHub ↗
(id: string, updates: Partial<Skill>)

Source from the content-addressed store, hash-verified

96}
97
98export async function updateSkill(id: string, updates: Partial<Skill>): Promise<void> {
99 const database = await getDB();
100 const sets: string[] = [];
101 const values: unknown[] = [];
102
103 if (updates.name !== undefined) {
104 sets.push("name = ?");
105 values.push(updates.name);
106 }
107 if (updates.description !== undefined) {
108 sets.push("description = ?");
109 values.push(updates.description);
110 }
111 if (updates.enabled !== undefined) {
112 sets.push("enabled = ?");
113 values.push(updates.enabled ? 1 : 0);
114 }
115 if (updates.parameters !== undefined) {
116 sets.push("parameters = ?");
117 values.push(JSON.stringify(updates.parameters));
118 }
119 if (updates.prompt !== undefined) {
120 sets.push("prompt = ?");
121 values.push(updates.prompt);
122 }
123 // Add sync tracking
124 const deviceId = await getDeviceId();
125 const syncVersion = await nextSyncVersion(database, "skills");
126 const updatedAt = await nextUpdatedAt(database, "skills", id);
127 sets.push("updated_at = ?");
128 values.push(updatedAt);
129 sets.push("sync_version = ?");
130 values.push(syncVersion);
131 sets.push("last_modified_by = ?");
132 values.push(deviceId);
133
134 if (sets.length === 0) return;
135 values.push(id);
136 await database.execute(`UPDATE skills SET ${sets.join(", ")} WHERE id = ?`, values);
137}
138
139export async function deleteSkill(id: string): Promise<void> {
140 const database = await getDB();

Callers 1

Calls 6

getDBFunction · 0.90
getDeviceIdFunction · 0.90
nextSyncVersionFunction · 0.90
nextUpdatedAtFunction · 0.90
pushMethod · 0.80
executeMethod · 0.65

Tested by

no test coverage detected