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

@@ -41,16 +41,23 @@ export class PrettierFormatter extends BaseFormatter {
// Add files from TypeScript directories
for (const dir of includeDirs) {
const globPattern = `${dir}/**/*.${extensions}`;
const dirFiles = await plugins.smartfile.fs.listFileTree(
'.',
globPattern,
);
const dirEntries = await plugins.smartfs
.directory('.')
.recursive()
.filter(globPattern)
.list();
const dirFiles = dirEntries.map((entry) => entry.path);
allFiles.push(...dirFiles);
}
// Add root config files
for (const pattern of rootConfigFiles) {
const rootFiles = await plugins.smartfile.fs.listFileTree('.', pattern);
const rootEntries = await plugins.smartfs
.directory('.')
.recursive()
.filter(pattern)
.list();
const rootFiles = rootEntries.map((entry) => entry.path);
// Only include files at root level (no slashes in path)
const rootLevelFiles = rootFiles.filter((f) => !f.includes('/'));
allFiles.push(...rootLevelFiles);
@@ -66,8 +73,8 @@ export class PrettierFormatter extends BaseFormatter {
const validFiles: string[] = [];
for (const file of files) {
try {
const stats = await plugins.smartfile.fs.stat(file);
if (!stats.isDirectory()) {
const stats = await plugins.smartfs.file(file).stat();
if (!stats.isDirectory) {
validFiles.push(file);
}
} catch (error) {
@@ -148,7 +155,10 @@ export class PrettierFormatter extends BaseFormatter {
}
// Read current content
const content = plugins.smartfile.fs.toStringSync(change.path);
const content = (await plugins.smartfs
.file(change.path)
.encoding('utf8')
.read()) as string;
// Format with prettier
const prettier = await import('prettier');