Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
62
akode-rs/config/src/filesystem_constraints.rs
Normal file
62
akode-rs/config/src/filesystem_constraints.rs
Normal file
@@ -0,0 +1,62 @@
|
||||
//! Convert resolved filesystem denials into portable policy entries.
|
||||
|
||||
use crate::FilesystemConstraints;
|
||||
use akode_protocol::permissions::FileSystemAccessMode;
|
||||
use akode_protocol::permissions::FileSystemPath;
|
||||
use akode_protocol::permissions::FileSystemSandboxEntry;
|
||||
use akode_protocol::permissions::FileSystemSandboxPolicy;
|
||||
use akode_utils_path_uri::LegacyAppPathString;
|
||||
use akode_utils_path_uri::LegacyAppPathStringError;
|
||||
use akode_utils_path_uri::PathConvention;
|
||||
use akode_utils_path_uri::PathUri;
|
||||
use std::io;
|
||||
|
||||
impl FilesystemConstraints {
|
||||
/// Adds denials without changing existing entries or other policy settings.
|
||||
/// `convention` must match the executor facts used to resolve these requirements.
|
||||
/// Literal paths become URIs; glob spellings and entry order are preserved.
|
||||
/// Invalid denials return an error before the policy is changed.
|
||||
pub fn apply_to_policy(
|
||||
&self,
|
||||
policy: &mut FileSystemSandboxPolicy,
|
||||
convention: PathConvention,
|
||||
) -> io::Result<()> {
|
||||
let entries = self
|
||||
.deny_read
|
||||
.iter()
|
||||
.map(|deny_read| {
|
||||
PathUri::validate_config_path_text(deny_read.as_str(), convention)?;
|
||||
let path = if deny_read.contains_glob() {
|
||||
FileSystemPath::GlobPattern {
|
||||
pattern: deny_read.as_str().to_string(),
|
||||
}
|
||||
} else {
|
||||
let mut path = LegacyAppPathString::from_string(deny_read.as_str())
|
||||
.to_path_uri(convention)?;
|
||||
path.validate_config_path(convention)?;
|
||||
// Match Core's existing URI spelling for UNC share roots.
|
||||
if path.to_url().host_str().is_some() {
|
||||
path = path.join(".")?;
|
||||
}
|
||||
path.into()
|
||||
};
|
||||
Ok(FileSystemSandboxEntry::new(
|
||||
path,
|
||||
FileSystemAccessMode::Deny,
|
||||
))
|
||||
})
|
||||
.collect::<Result<Vec<_>, LegacyAppPathStringError>>()
|
||||
.map_err(|error| {
|
||||
io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
format!("invalid permissions.filesystem.deny_read path: {error}"),
|
||||
)
|
||||
})?;
|
||||
for entry in entries {
|
||||
if !policy.entries.contains(&entry) {
|
||||
policy.entries.push(entry);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user