ModelForge
ModelForge provides model-provider and model-target parsing primitives used by
thesa.
Made by Trevor Knott for Knott Dynamics. ModelForge is part of the thesa archive
stack alongside repoforge, siteforge, Scrin, and Aisling.
The crate normalizes Hugging Face, Ollama, and CivitAI target forms into simple archive targets. It does not call provider APIs and it does not download models; it only turns user-facing target strings into stable Rust enums.
ModelForge is meant to sit at the boundary between CLI/TUI input and provider clients. It keeps parsing rules testable, reusable, and separate from network or filesystem side effects.
What It Does
- Parses Hugging Face organization and model targets.
- Parses Hugging Face model URLs.
- Parses Ollama keyword/model inputs.
- Parses CivitAI numeric IDs and model URLs.
- Normalizes shared presets such as
top,trending,latest, andnewest. - Provides provider labels, short labels, slugs, and slug parsing.
What It Does Not Do
- Does not call Hugging Face, Ollama, or CivitAI APIs.
- Does not download, clone, pull, or write model files.
- Does not store tokens or credentials.
- Does not decide archive output paths.
Install
[]
= "0.1"
Providers
assert_eq!;
assert_eq!;
Supported providers:
ModelProvider::Hf: Hugging Face HubModelProvider::Ollama: local Ollama registry/runtimeModelProvider::Civitai: CivitAI model catalog
Provider aliases accept common separators, so hugging-face, hugging face,
and hugging_face resolve the same way.
API Surface
parse_model_target(input): parse simple Hugging Face-styleownerorowner/modelforms.parse_model_target_for_provider(input, provider): parse with provider-specific rules.ModelProvider::slug(): stable lowercase provider slug.ModelProvider::ALLandModelProvider::all(): stable provider iteration order.ModelProvider::from_slug(value): parse accepted provider aliases.ModelProvider::label(): human-readable provider label.ModelProvider::short_label(): compact provider label.ModelTarget::kind(): target kind label.ModelTarget::value(): borrowed target id forOrgorModelvariants.ModelTarget::org()andModelTarget::model(): variant-specific borrowed values.ModelTarget::is_org()andModelTarget::is_model(): variant checks for caller branching.ModelTarget::is_preset(): whether target isToporLatest.
Core data types:
ModelProvider:Hf,Ollama, orCivitai.ModelTarget:Org,Model,Top, orLatest.ModelForgeError: invalid target errors with the rejected target payload.
Targets
let target = parse_model_target_for_provider?;
assert_eq!;
assert_eq!;
# Ok::
Normalized targets:
ModelTarget::Org(String): namespace, organization, owner, or search keywordModelTarget::Model(String): concrete model idModelTarget::Top: top/trending/popular presetModelTarget::Latest: latest/newest/new preset
Accepted Forms
Hugging Face:
ownerowner/modelhttps://huggingface.co/owner/modelhttps://www.huggingface.co/owner/modelhttps://hf.co/owner/modeltop,trending,popularlatest,newest,new
Ollama:
model-nameor search keywordhttps://ollama.com/library/model-namehttps://www.ollama.com/library/model-nametop,trending,popularlatest,newest,new
CivitAI:
- numeric model id, such as
827184 https://civitai.com/models/827184https://www.civitai.com/models/827184- search keyword
top,trending,popularlatest,newest,new
Design
ModelForge keeps parsing separate from provider API clients. Consumers such as
thesa can use the normalized target enum to decide whether to fetch a single
model, list a namespace, or run a provider-specific preset query.
Package Contents
Cargo releases are explicitly whitelisted to avoid shipping sessions, notes, build output, or local artifacts. The package contains only:
Cargo.tomlCargo.lockREADME.mdLICENSECHANGELOG.mdsrc/**
Role In Thesa
thesa uses ModelForge before calling provider APIs. The CLI and TUI collect a
target string, ModelForge normalizes it, and thesa then runs the provider flow
with Scrin/Aisling status panels and .thesa integrity manifests.