feat(sdk,plugins): API publique d'accès fichiers/workspace + analyse structure (#124,#129)

This commit is contained in:
2026-08-02 13:34:54 +02:00
parent 033e9a86d5
commit dce61ae1aa
27 changed files with 5895 additions and 94 deletions

View File

@ -9,7 +9,7 @@ use std::io;
use std::path::Path;
use async_trait::async_trait;
use domain::ports::{DirEntry, FileSystem, FsError, RemotePath};
use domain::ports::{DirEntry, FileMetadata, FileSystem, FsError, RemotePath};
use tokio::fs;
/// Filesystem adapter backed by the local OS via `tokio::fs`.
@ -54,6 +54,17 @@ impl FileSystem for LocalFileSystem {
}
}
async fn metadata(&self, path: &RemotePath) -> Result<FileMetadata, FsError> {
let meta = fs::metadata(path.as_str())
.await
.map_err(|e| map_io(path, &e))?;
Ok(FileMetadata {
is_file: meta.is_file(),
is_dir: meta.is_dir(),
len: Some(meta.len()),
})
}
async fn remove_file(&self, path: &RemotePath) -> Result<(), FsError> {
match fs::remove_file(path.as_str()).await {
Ok(()) => Ok(()),