MCPcopy
hub / github.com/Fission-AI/OpenSpec / getToolVersionStatus

Function getToolVersionStatus

src/core/shared/tool-detection.ts:160–198  ·  view source on GitHub ↗
(
  projectRoot: string,
  toolId: string,
  currentVersion: string
)

Source from the content-addressed store, hash-verified

158 * Gets version status for a tool by reading the first available skill file.
159 */
160export function getToolVersionStatus(
161 projectRoot: string,
162 toolId: string,
163 currentVersion: string
164): ToolVersionStatus {
165 const tool = AI_TOOLS.find((t) => t.value === toolId);
166 if (!tool?.skillsDir) {
167 return {
168 toolId,
169 toolName: toolId,
170 configured: false,
171 generatedByVersion: null,
172 needsUpdate: false,
173 };
174 }
175
176 const skillsDir = path.join(projectRoot, tool.skillsDir, 'skills');
177 let generatedByVersion: string | null = null;
178
179 // Find the first skill file that exists and read its version
180 for (const skillName of SKILL_NAMES) {
181 const skillFile = path.join(skillsDir, skillName, 'SKILL.md');
182 if (fs.existsSync(skillFile)) {
183 generatedByVersion = extractGeneratedByVersion(skillFile);
184 break;
185 }
186 }
187
188 const configured = getToolSkillStatus(projectRoot, toolId).configured;
189 const needsUpdate = configured && (generatedByVersion === null || generatedByVersion !== currentVersion);
190
191 return {
192 toolId,
193 toolName: tool.name,
194 configured,
195 generatedByVersion,
196 needsUpdate,
197 };
198}
199
200/**
201 * Gets all configured tools in the project.

Callers 3

executeMethod · 0.85
getAllToolVersionStatusFunction · 0.85

Calls 2

getToolSkillStatusFunction · 0.85

Tested by

no test coverage detected