BREAKING CHANGE(core): Migrate filesystem to smartfs (async) and add Elasticsearch service support; refactor format/commit/meta modules

This commit is contained in:
2025-11-27 21:32:34 +00:00
parent 2f3d67f9e3
commit e1d28bc10a
30 changed files with 2217 additions and 995 deletions

View File

@@ -42,11 +42,15 @@ export const getRandomAvailablePort = async (): Promise<number> => {
/**
* Get the project name from package.json or directory
*/
export const getProjectName = (): string => {
export const getProjectName = async (): Promise<string> => {
try {
const packageJsonPath = plugins.path.join(process.cwd(), 'package.json');
if (plugins.smartfile.fs.fileExistsSync(packageJsonPath)) {
const packageJson = plugins.smartfile.fs.toObjectSync(packageJsonPath);
if (await plugins.smartfs.file(packageJsonPath).exists()) {
const content = (await plugins.smartfs
.file(packageJsonPath)
.encoding('utf8')
.read()) as string;
const packageJson = JSON.parse(content);
if (packageJson.name) {
// Sanitize: @fin.cx/skr → fin-cx-skr
return packageJson.name.replace(/@/g, '').replace(/[\/\.]/g, '-');
@@ -55,7 +59,7 @@ export const getProjectName = (): string => {
} catch (error) {
// Ignore errors and fall back to directory name
}
return plugins.path.basename(process.cwd());
};