github source v1

This commit is contained in:
stoorps 2026-03-19 20:14:39 +00:00
parent 71f89dde9c
commit caf870d05e
Signed by: stoorps
SSH key fingerprint: SHA256:AZlPfu9hTu042EGtZElmDQoy+KvMOeShLDan/fYLoNI
50 changed files with 4139 additions and 131 deletions

View file

@ -1,4 +1,5 @@
use crate::domain::app::{AppIdentity, IdentityConfidence};
use crate::source::input::classify_input;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum IdentityFallback {
@ -34,6 +35,18 @@ pub fn resolve_identity(
});
}
if let Some(source_url) = source_url.filter(|value| !value.trim().is_empty())
&& let Ok(classified) = classify_input(source_url)
&& let Some(repo) = classified.canonical_locator
{
let display_name = repo.split('/').next_back().unwrap_or(&repo).to_owned();
return Ok(AppIdentity {
stable_id: normalize_identifier(&repo),
display_name,
confidence: IdentityConfidence::Confident,
});
}
if let Some(source_url) = source_url.filter(|value| !value.trim().is_empty())
&& fallback == IdentityFallback::AllowRawUrl
{