aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
38
akode-rs/ext/git-attribution/src/lib.rs
Normal file
38
akode-rs/ext/git-attribution/src/lib.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
mod world_state;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use akode_extension_api::ContextContributor;
|
||||
use akode_extension_api::ExtensionFuture;
|
||||
use akode_extension_api::ExtensionRegistryBuilder;
|
||||
use akode_extension_api::WorldStateContributionInput;
|
||||
use akode_extension_api::WorldStateSectionContribution;
|
||||
|
||||
use crate::world_state::git_attribution_world_state_section;
|
||||
|
||||
/// Local default for commit and pull request attribution. aKode never fetches a
|
||||
/// remote workspace policy, so attribution stays disabled.
|
||||
const ATTRIBUTION_ENABLED_BY_DEFAULT: bool = false;
|
||||
|
||||
/// Contributes model instructions for agent-created git commits and pull requests.
|
||||
#[derive(Clone)]
|
||||
struct GitAttributionExtension {
|
||||
enabled: bool,
|
||||
}
|
||||
|
||||
impl ContextContributor for GitAttributionExtension {
|
||||
fn contribute_world_state<'a>(
|
||||
&'a self,
|
||||
_input: WorldStateContributionInput<'a>,
|
||||
) -> ExtensionFuture<'a, Vec<WorldStateSectionContribution>> {
|
||||
let enabled = self.enabled;
|
||||
Box::pin(async move { vec![git_attribution_world_state_section(enabled)] })
|
||||
}
|
||||
}
|
||||
|
||||
/// Installs the git-attribution contributor into the extension registry.
|
||||
pub fn install<C: Sync>(registry: &mut ExtensionRegistryBuilder<C>) {
|
||||
registry.prompt_contributor(Arc::new(GitAttributionExtension {
|
||||
enabled: ATTRIBUTION_ENABLED_BY_DEFAULT,
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user