Skip to content

Commit bcd346a

Browse files
authored
Add files via upload
0 parents  commit bcd346a

File tree

4 files changed

+679
-0
lines changed

4 files changed

+679
-0
lines changed

Cargo.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
name = "ollama-rename"
3+
version = "0.1.0"
4+
edition = "2021"
5+
description = "Rename Ollama models via interactive cli."
6+
license = "MIT"
7+
categories = ["command-line-utilities"]
8+
repository = "https://example.com/your/repo" # update if publishing
9+
10+
[dependencies]
11+
clap = { version = "4.5.47", features = ["derive"] }
12+
dialoguer = { version = "0.12.0", features = ["fuzzy-select"] }
13+
serde = { version = "1.0", features = ["derive"] }
14+
serde_json = "1.0.143"
15+
regex = "1.11.2"
16+
anyhow = "1.0.99"
17+
reqwest = { version = "0.12.23", default-features = false, features = [
18+
"json",
19+
"rustls-tls",
20+
"blocking",
21+
] }
22+
console = "0.16.0"
23+
24+
[profile.release]
25+
lto = true
26+
codegen-units = 1
27+
panic = "abort"
28+
strip = true

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# ollama-rename
2+
3+
Interactive, safe “rename” for Ollama models. Under the hood it **copies** a model to a new name, then (optionally) **deletes** the original.
4+
5+
## Features
6+
- Lists local models, fuzzy-pick one, suggests a short clean name.
7+
- Copy → optional delete (i.e., move). Checks if model is loaded before delete.
8+
- Overwrite guard (interactive prompt or `--overwrite` flag).
9+
- Works via Ollama HTTP API; can fall back to `ollama cp`/`ollama rm`.
10+
- Windows & Linux.
11+
12+
## Requirements
13+
- Ollama installed and running (`OLLAMA_HOST` honored, defaults to `http://127.0.0.1:11434`).
14+
- Rust toolchain (for building from source).
15+
16+
## Install (Windows)
17+
Double-click `install.bat` or run:
18+
```powershell
19+
.\install.bat
20+
```
21+
22+
It builds the binary and places it in `%USERPROFILE%\bin` (adds to PATH if needed).
23+
24+
## Install (Linux, from source)
25+
26+
```bash
27+
cargo build --release
28+
install -Dm755 target/release/ollama-rename ~/.local/bin/ollama-rename
29+
```
30+
31+
## Usage
32+
33+
Interactive (recommended):
34+
35+
```bash
36+
ollama-rename
37+
```
38+
39+
Non-interactive:
40+
41+
```bash
42+
# copy
43+
ollama-rename rename --from "hf.co/NikolayKozloff/NextCoder-14B-Q4_K_M-GGUF:Q4_K_M" --to "NextCoder"
44+
45+
# move (copy + delete original)
46+
ollama-rename rename --from "qwen3-coder:latest" --to "qwen3-coder" --delete-original
47+
48+
# replace destination if it exists
49+
ollama-rename rename --from "gpt-oss:latest" --to "gpt-oss" --overwrite
50+
```
51+
52+
Useful flags: `--host <URL>`, `--use-cli-fallback`, `--force` (delete even if loaded), `--dry-run`.

install.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@echo off
2+
REM Build the release binary from this folder.
3+
cd /d "%~dp0"
4+
cargo build --release
5+
6+
IF ERRORLEVEL 1 (
7+
echo.
8+
echo [ERROR] Build failed.
9+
) ELSE (
10+
echo.
11+
echo [OK] Built: "%CD%\target\release\ollama-rename.exe"
12+
)
13+
14+
echo.
15+
echo Press any key to close...
16+
pause >nul

0 commit comments

Comments
 (0)