sfcc-dev-mcp
Version:
MCP server for Salesforce B2C Commerce Cloud development assistance including logs, debugging, and development tools
46 lines • 1.53 kB
JavaScript
/**
* Path Resolver Helper
*
* Provides utilities for resolving file and directory paths based on the current working directory.
* This abstraction allows for easier path management and testing.
*/
import path from 'path';
import { fileURLToPath } from 'url';
export class PathResolver {
/**
* Get the current working directory (project root)
*/
static getCurrentWorkingDir() {
// Get the directory of the current module file
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Return the parent directory (project root)
return path.resolve(__dirname, '..');
}
/**
* Get a path relative to the current working directory
*/
static getRelativePath(...pathSegments) {
const currentDir = this.getCurrentWorkingDir();
return path.join(currentDir, ...pathSegments);
}
/**
* Get the docs directory path relative to the current working directory
*/
static getDocsPath() {
return this.getRelativePath('docs');
}
/**
* Get the best practices docs directory path relative to the current working directory
*/
static getBestPracticesPath() {
return this.getRelativePath('docs', 'best-practices');
}
/**
* Get the SFRA docs directory path relative to the current working directory
*/
static getSFRADocsPath() {
return this.getRelativePath('docs', 'sfra');
}
}
//# sourceMappingURL=path-resolver.js.map