MCPcopy Index your code
hub / github.com/Fission-AI/OpenSpec / removeCommandFiles

Method removeCommandFiles

src/core/update.ts:456–480  ·  view source on GitHub ↗

* Removes command files for workflows when delivery changed to skills-only. * Returns the number of files removed.

(
    projectPath: string,
    toolId: string,
  )

Source from the content-addressed store, hash-verified

454 * Returns the number of files removed.
455 */
456 private async removeCommandFiles(
457 projectPath: string,
458 toolId: string,
459 ): Promise<number> {
460 let removed = 0;
461
462 const adapter = CommandAdapterRegistry.get(toolId);
463 if (!adapter) return 0;
464
465 for (const workflow of ALL_WORKFLOWS) {
466 const cmdPath = adapter.getFilePath(workflow);
467 const fullPath = path.isAbsolute(cmdPath) ? cmdPath : path.join(projectPath, cmdPath);
468
469 try {
470 if (fs.existsSync(fullPath)) {
471 await fs.promises.unlink(fullPath);
472 removed++;
473 }
474 } catch {
475 // Ignore errors
476 }
477 }
478
479 return removed;
480 }
481
482 /**
483 * Removes command files for workflows that are no longer selected in the active profile.

Callers 1

executeMethod · 0.95

Calls 2

getMethod · 0.80
getFilePathMethod · 0.80

Tested by

no test coverage detected