ollanet 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/argv.d.ts +5 -0
- package/dist/argv.js +13 -0
- package/dist/bench.d.ts +1 -0
- package/dist/bench.js +24 -14
- package/dist/chats.d.ts +1 -0
- package/dist/chats.js +9 -7
- package/dist/cli.js +29 -1
- package/dist/compare.d.ts +1 -0
- package/dist/compare.js +9 -7
- package/dist/help.d.ts +7 -0
- package/dist/help.js +51 -0
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +23 -0
- package/dist/prompt.d.ts +1 -0
- package/dist/prompt.js +9 -7
- package/dist/ps.d.ts +1 -0
- package/dist/ps.js +9 -7
- package/dist/pull.d.ts +1 -0
- package/dist/pull.js +9 -7
- package/dist/rm.d.ts +1 -0
- package/dist/rm.js +9 -7
- package/dist/scan.d.ts +1 -0
- package/dist/scan.js +24 -0
- package/dist/show.d.ts +1 -0
- package/dist/show.js +9 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -198,6 +198,7 @@ optimizeDeps: { exclude: ["ollanet"] },
|
|
|
198
198
|
| `ollanet chats` | List or inspect saved transcripts |
|
|
199
199
|
| `ollanet bench …` | Benchmark models for tok/s + lightweight quality checks |
|
|
200
200
|
| `ollanet mcp` | Stdio [MCP](https://modelcontextprotocol.io) server for agents |
|
|
201
|
+
| `ollanet help [command]` | This overview, or one command’s flags (`ollanet help bench`, `ollanet bench help`) |
|
|
201
202
|
|
|
202
203
|
### `scan` options
|
|
203
204
|
|
package/dist/argv.d.ts
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { GenerateSettings } from "./config.js";
|
|
5
5
|
export type UsageFn = () => never;
|
|
6
|
+
export declare function isHelpFlag(arg: string): boolean;
|
|
7
|
+
/** Intentional help: stdout, exit 0. */
|
|
8
|
+
export declare function printHelp(text: string): never;
|
|
9
|
+
/** Usage error: stderr, exit 1. */
|
|
10
|
+
export declare function failUsage(text: string): never;
|
|
6
11
|
export declare function takeValue(args: string[], flag: string, usage: UsageFn): string;
|
|
7
12
|
/** `--name value` or `--name=value`. Returns undefined if `arg` is not this flag. */
|
|
8
13
|
export declare function takeFlag(arg: string, name: string, args: string[], usage: UsageFn): string | undefined;
|
package/dist/argv.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
export function isHelpFlag(arg) {
|
|
2
|
+
return arg === "--help" || arg === "-h";
|
|
3
|
+
}
|
|
4
|
+
/** Intentional help: stdout, exit 0. */
|
|
5
|
+
export function printHelp(text) {
|
|
6
|
+
process.stdout.write(text.endsWith("\n") ? text : `${text}\n`);
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
/** Usage error: stderr, exit 1. */
|
|
10
|
+
export function failUsage(text) {
|
|
11
|
+
console.error(text);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
1
14
|
export function takeValue(args, flag, usage) {
|
|
2
15
|
const value = args.shift();
|
|
3
16
|
if (!value) {
|
package/dist/bench.d.ts
CHANGED
package/dist/bench.js
CHANGED
|
@@ -6,42 +6,50 @@ import { comparabilityKey, getSuiteCases, median, suiteRevision, } from "./bench
|
|
|
6
6
|
import { benchmarksDir, newBenchId, saveBenchmark } from "./bench-store.js";
|
|
7
7
|
import { readFile } from "node:fs/promises";
|
|
8
8
|
import { envInt, ollamaBaseUrl, shortName } from "./hosts.js";
|
|
9
|
-
import { consumeSettingsFlag, parseNumberFlag, takeFlag } from "./argv.js";
|
|
9
|
+
import { consumeSettingsFlag, failUsage, isHelpFlag, parseNumberFlag, printHelp, takeFlag } from "./argv.js";
|
|
10
10
|
import { resolveTarget } from "./target.js";
|
|
11
11
|
import { projectPath } from "./paths.js";
|
|
12
12
|
import { contextLengthForModel, isCompletionCapable, isVisionCapable, ollamaChat, ollamaShow, ollamaTags, ollamaUnload, ollamaVersion, ollamaPs, psHasModel, shouldWarnNoThinking, vramForModel, waitUntilUnloaded, } from "./ollama-chat.js";
|
|
13
13
|
const MODEL_COL = 34;
|
|
14
14
|
const BENCH_TIMEOUT_MS = envInt("OLLAMA_BENCH_TIMEOUT_MS", 60_000);
|
|
15
15
|
const UNLOAD_WAIT_MS = envInt("OLLAMA_BENCH_UNLOAD_WAIT_MS", 60_000);
|
|
16
|
-
function
|
|
17
|
-
|
|
16
|
+
export function helpText() {
|
|
17
|
+
return `Usage:
|
|
18
18
|
ollanet bench <machine|ip> [model...] [options]
|
|
19
19
|
ollanet bench <machine|ip> --all [options]
|
|
20
20
|
|
|
21
21
|
Examples:
|
|
22
22
|
ollanet bench studio gemma3:12b --runs 5
|
|
23
23
|
ollanet bench studio gemma3:12b --hot --runs 5
|
|
24
|
+
ollanet help bench
|
|
25
|
+
|
|
26
|
+
Fixed suite (not compare). Checks run once; throughput repeats --runs times.
|
|
27
|
+
Median tok/s excludes early-stops. Unload is between models, not between repeats.
|
|
24
28
|
|
|
25
29
|
Options:
|
|
26
30
|
--all Every completion-capable model from /api/tags
|
|
27
31
|
--exclude-vision With --all, skip models that advertise vision
|
|
28
32
|
--suite quick|full Prompt suite (default quick)
|
|
29
|
-
--runs <n>
|
|
33
|
+
--runs <n> Counted throughput repeats (default 3)
|
|
30
34
|
--hot Discard first throughput run; keep models loaded
|
|
31
|
-
--warmup
|
|
35
|
+
--warmup Short discarded call before timed cases (default on)
|
|
36
|
+
--no-warmup Skip the short warmup (--hot implies this)
|
|
32
37
|
--cold-load Measure cold load via unload + /api/ps
|
|
33
38
|
--num-predict <n> Pin throughput length (default 256)
|
|
34
|
-
--num-ctx <n>
|
|
35
|
-
--keep-alive <value>
|
|
36
|
-
--think / --no-think
|
|
37
|
-
--judge
|
|
39
|
+
--num-ctx <n> Context window override
|
|
40
|
+
--keep-alive <value> Keep model loaded (e.g. 5m, 0, -1)
|
|
41
|
+
--think / --no-think Thinking tokens (default off)
|
|
42
|
+
--judge Second pass: score check answers 1–5
|
|
43
|
+
--judge-model <name> Required with --judge (no default)
|
|
38
44
|
--json Machine-readable stdout
|
|
39
|
-
--save / --no-save
|
|
40
|
-
--fail-fast
|
|
45
|
+
--save / --no-save Persist under benchmarks/ (default on)
|
|
46
|
+
--fail-fast Stop remaining models after the first hard error
|
|
41
47
|
--fail-on-error Exit 2 if any model/case errored
|
|
42
48
|
|
|
43
|
-
See docs/bench-spec.md for measurement rules
|
|
44
|
-
|
|
49
|
+
See docs/bench-spec.md for measurement rules.`;
|
|
50
|
+
}
|
|
51
|
+
function usage() {
|
|
52
|
+
failUsage(helpText());
|
|
45
53
|
}
|
|
46
54
|
function isLoopback(host) {
|
|
47
55
|
return (host.source === "localhost" ||
|
|
@@ -90,7 +98,9 @@ function parseArgs(argv) {
|
|
|
90
98
|
const positional = [];
|
|
91
99
|
while (args.length > 0) {
|
|
92
100
|
const arg = args.shift();
|
|
93
|
-
if (arg
|
|
101
|
+
if (isHelpFlag(arg))
|
|
102
|
+
printHelp(helpText());
|
|
103
|
+
if (arg === "--")
|
|
94
104
|
usage();
|
|
95
105
|
if (arg === "--all") {
|
|
96
106
|
all = true;
|
package/dist/chats.d.ts
CHANGED
package/dist/chats.js
CHANGED
|
@@ -7,16 +7,18 @@
|
|
|
7
7
|
* ollanet chats --id a1b2c3d4e5f6
|
|
8
8
|
*/
|
|
9
9
|
import { loadChat, listChats, responsesDir, } from "./chat-store.js";
|
|
10
|
-
import { takeFlag } from "./argv.js";
|
|
11
|
-
function
|
|
12
|
-
|
|
10
|
+
import { failUsage, isHelpFlag, printHelp, takeFlag } from "./argv.js";
|
|
11
|
+
export function helpText() {
|
|
12
|
+
return `Usage: ollanet chats [--json] [--id <hash>]
|
|
13
13
|
|
|
14
14
|
Lists transcripts in ${responsesDir()}.
|
|
15
15
|
|
|
16
16
|
Options:
|
|
17
17
|
--json Machine-readable output
|
|
18
|
-
--id <hash> Show one chat (messages included with --json, preview otherwise)
|
|
19
|
-
|
|
18
|
+
--id <hash> Show one chat (messages included with --json, preview otherwise)`;
|
|
19
|
+
}
|
|
20
|
+
function usage() {
|
|
21
|
+
failUsage(helpText());
|
|
20
22
|
}
|
|
21
23
|
function parseArgs(argv) {
|
|
22
24
|
const args = [...argv];
|
|
@@ -26,8 +28,8 @@ function parseArgs(argv) {
|
|
|
26
28
|
const arg = args.shift();
|
|
27
29
|
if (arg === "--")
|
|
28
30
|
continue;
|
|
29
|
-
if (arg
|
|
30
|
-
|
|
31
|
+
if (isHelpFlag(arg))
|
|
32
|
+
printHelp(helpText());
|
|
31
33
|
if (arg === "--json") {
|
|
32
34
|
json = true;
|
|
33
35
|
continue;
|
package/dist/cli.js
CHANGED
|
@@ -28,6 +28,7 @@ Usage:
|
|
|
28
28
|
ollanet chats [--json] [--id <hash>]
|
|
29
29
|
ollanet bench <machine|ip> [model...] [--all] [options]
|
|
30
30
|
ollanet mcp
|
|
31
|
+
ollanet help [command]
|
|
31
32
|
|
|
32
33
|
Examples:
|
|
33
34
|
ollanet scan
|
|
@@ -46,6 +47,7 @@ Examples:
|
|
|
46
47
|
ollanet bench localhost --all
|
|
47
48
|
ollanet bench localhost llama3.2:1b --runs 3
|
|
48
49
|
ollanet bench localhost gemma3:12b --hot --runs 5
|
|
50
|
+
ollanet help bench # flags for one command (also: ollanet bench help)
|
|
49
51
|
ollanet mcp # stdio MCP server for agents
|
|
50
52
|
|
|
51
53
|
Config: ~/.ollanet/config.json when installed, ./config.json in a checkout
|
|
@@ -58,10 +60,36 @@ async function main() {
|
|
|
58
60
|
// pnpm/npm often forward a bare `--`; ignore it.
|
|
59
61
|
const argv = process.argv.slice(2).filter((arg) => arg !== "--");
|
|
60
62
|
const cmd = argv[0];
|
|
61
|
-
if (!cmd || cmd === "-h" || cmd === "--help"
|
|
63
|
+
if (!cmd || cmd === "-h" || cmd === "--help") {
|
|
62
64
|
process.stdout.write(HELP);
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
67
|
+
if (cmd === "help") {
|
|
68
|
+
const topic = argv[1];
|
|
69
|
+
if (!topic || topic === "-h" || topic === "--help") {
|
|
70
|
+
process.stdout.write(HELP);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const { commandHelp, commandNames } = await import("./help.js");
|
|
74
|
+
const text = await commandHelp(topic);
|
|
75
|
+
if (!text) {
|
|
76
|
+
console.error(`Unknown command: ${topic}`);
|
|
77
|
+
console.error(`Try: ollanet help (commands: ${commandNames().join(", ")})`);
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
process.stdout.write(text.endsWith("\n") ? text : `${text}\n`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const rest = argv.slice(1);
|
|
85
|
+
const { isHelpRequest, commandHelp } = await import("./help.js");
|
|
86
|
+
if (isHelpRequest(rest)) {
|
|
87
|
+
const text = await commandHelp(cmd);
|
|
88
|
+
if (text) {
|
|
89
|
+
process.stdout.write(text.endsWith("\n") ? text : `${text}\n`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
65
93
|
if (cmd === "-v" || cmd === "--version" || cmd === "version") {
|
|
66
94
|
const { readFile } = await import("node:fs/promises");
|
|
67
95
|
const { projectPath } = await import("./paths.js");
|
package/dist/compare.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { type AppConfig, type GenerateSettings } from "./config.js";
|
|
8
8
|
/** Used when --prompt, --file, and stdin are all omitted. */
|
|
9
9
|
export declare const DEFAULT_COMPARE_PROMPT: string;
|
|
10
|
+
export declare function helpText(): string;
|
|
10
11
|
export interface CompareModelResult {
|
|
11
12
|
model: string;
|
|
12
13
|
content?: string;
|
package/dist/compare.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { configFromPartial, loadConfig, machineSettingsForHost, mergeSettings, settingsFromEnv, } from "./config.js";
|
|
8
8
|
import { envInt, ollamaBaseUrl, shortName } from "./hosts.js";
|
|
9
|
-
import { consumeSettingsFlag, takeFlag, takeValue } from "./argv.js";
|
|
9
|
+
import { consumeSettingsFlag, failUsage, isHelpFlag, printHelp, takeFlag, takeValue } from "./argv.js";
|
|
10
10
|
import { resolveTarget } from "./target.js";
|
|
11
11
|
import { ollamaChat, ollamaTags, ollamaUnload, waitUntilUnloaded, } from "./ollama-chat.js";
|
|
12
12
|
import { assemblePrompt, readPromptFile } from "./prompt-input.js";
|
|
@@ -23,8 +23,8 @@ function compareTimeoutMs() {
|
|
|
23
23
|
function unloadWaitMs() {
|
|
24
24
|
return envInt("OLLAMA_COMPARE_UNLOAD_WAIT_MS", 60_000);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
26
|
+
export function helpText() {
|
|
27
|
+
return `Usage:
|
|
28
28
|
ollanet compare <machine> <model> <model> [model...]
|
|
29
29
|
ollanet compare <machine> <model> <model> [model...] --prompt <text>
|
|
30
30
|
ollanet compare <machine> <model> <model> [model...] --file <path.txt|.md>
|
|
@@ -49,8 +49,10 @@ Options:
|
|
|
49
49
|
--think / --no-think
|
|
50
50
|
--unload Unload each model before the next (fairer tok/s)
|
|
51
51
|
--no-save Do not write compares/*
|
|
52
|
-
--json Emit the full record on stdout
|
|
53
|
-
|
|
52
|
+
--json Emit the full record on stdout`;
|
|
53
|
+
}
|
|
54
|
+
function usage() {
|
|
55
|
+
failUsage(helpText());
|
|
54
56
|
}
|
|
55
57
|
function parseArgs(argv) {
|
|
56
58
|
const args = [...argv];
|
|
@@ -65,8 +67,8 @@ function parseArgs(argv) {
|
|
|
65
67
|
const arg = args.shift();
|
|
66
68
|
if (arg === "--")
|
|
67
69
|
continue;
|
|
68
|
-
if (arg
|
|
69
|
-
|
|
70
|
+
if (isHelpFlag(arg))
|
|
71
|
+
printHelp(helpText());
|
|
70
72
|
if (arg === "--json") {
|
|
71
73
|
json = true;
|
|
72
74
|
continue;
|
package/dist/help.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-command help: `ollanet help bench` and `ollanet bench help`.
|
|
3
|
+
*/
|
|
4
|
+
export declare function canonicalCommand(name: string): string | undefined;
|
|
5
|
+
export declare function commandNames(): string[];
|
|
6
|
+
export declare function commandHelp(name: string): Promise<string | undefined>;
|
|
7
|
+
export declare function isHelpRequest(args: string[]): boolean;
|
package/dist/help.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-command help: `ollanet help bench` and `ollanet bench help`.
|
|
3
|
+
*/
|
|
4
|
+
const LOADERS = {
|
|
5
|
+
scan: () => import("./scan.js"),
|
|
6
|
+
prompt: () => import("./prompt.js"),
|
|
7
|
+
chats: () => import("./chats.js"),
|
|
8
|
+
pull: () => import("./pull.js"),
|
|
9
|
+
show: () => import("./show.js"),
|
|
10
|
+
rm: () => import("./rm.js"),
|
|
11
|
+
ps: () => import("./ps.js"),
|
|
12
|
+
compare: () => import("./compare.js"),
|
|
13
|
+
bench: () => import("./bench.js"),
|
|
14
|
+
mcp: () => import("./mcp.js"),
|
|
15
|
+
};
|
|
16
|
+
const ALIASES = {
|
|
17
|
+
"ls-servers": "scan",
|
|
18
|
+
ask: "prompt",
|
|
19
|
+
chat: "prompt",
|
|
20
|
+
ls: "chats",
|
|
21
|
+
history: "chats",
|
|
22
|
+
download: "pull",
|
|
23
|
+
inspect: "show",
|
|
24
|
+
delete: "rm",
|
|
25
|
+
loaded: "ps",
|
|
26
|
+
vs: "compare",
|
|
27
|
+
h2h: "compare",
|
|
28
|
+
benchmark: "bench",
|
|
29
|
+
};
|
|
30
|
+
export function canonicalCommand(name) {
|
|
31
|
+
const key = name.trim().toLowerCase();
|
|
32
|
+
if (LOADERS[key])
|
|
33
|
+
return key;
|
|
34
|
+
return ALIASES[key];
|
|
35
|
+
}
|
|
36
|
+
export function commandNames() {
|
|
37
|
+
return Object.keys(LOADERS);
|
|
38
|
+
}
|
|
39
|
+
export async function commandHelp(name) {
|
|
40
|
+
const canon = canonicalCommand(name);
|
|
41
|
+
if (!canon)
|
|
42
|
+
return undefined;
|
|
43
|
+
const load = LOADERS[canon];
|
|
44
|
+
if (!load)
|
|
45
|
+
return undefined;
|
|
46
|
+
const mod = await load();
|
|
47
|
+
return mod.helpText();
|
|
48
|
+
}
|
|
49
|
+
export function isHelpRequest(args) {
|
|
50
|
+
return args.length === 1 && (args[0] === "help" || args[0] === "--help" || args[0] === "-h");
|
|
51
|
+
}
|
package/dist/mcp.d.ts
CHANGED
package/dist/mcp.js
CHANGED
|
@@ -21,6 +21,7 @@ import { removeModel } from "./rm.js";
|
|
|
21
21
|
import { lastScan } from "./scan-store.js";
|
|
22
22
|
import { scanNetwork } from "./scan.js";
|
|
23
23
|
import { showModel } from "./show.js";
|
|
24
|
+
import { isHelpFlag, printHelp } from "./argv.js";
|
|
24
25
|
// Pin to the oldest widely-supported MCP revision. Clients may request a newer
|
|
25
26
|
// date; we still answer with this — legal negotiation, max compatibility.
|
|
26
27
|
const PROTOCOL_VERSION = "2024-11-05";
|
|
@@ -487,7 +488,29 @@ async function handleRequest(msg, version) {
|
|
|
487
488
|
fail(id, -32601, `Method not found: ${method}`);
|
|
488
489
|
}
|
|
489
490
|
}
|
|
491
|
+
export function helpText() {
|
|
492
|
+
return `Usage:
|
|
493
|
+
ollanet mcp
|
|
494
|
+
|
|
495
|
+
Stdio MCP server (no extra npm deps). stdout is JSON-RPC; logs go to stderr.
|
|
496
|
+
|
|
497
|
+
Tools:
|
|
498
|
+
ollanet_scan Discover hosts + models (lan, all, last)
|
|
499
|
+
ollanet_prompt Prompt a host or continue with chat_id
|
|
500
|
+
ollanet_compare Same prompt on 2–5 models
|
|
501
|
+
ollanet_pull Pull / update a model on a host
|
|
502
|
+
ollanet_show Inspect a model
|
|
503
|
+
ollanet_rm Delete a model (confirm: true)
|
|
504
|
+
ollanet_ps Models loaded in VRAM
|
|
505
|
+
ollanet_list_chats Saved transcripts
|
|
506
|
+
ollanet_get_chat One chat by id
|
|
507
|
+
|
|
508
|
+
Example Cursor config: { "command": "npx", "args": ["-y", "ollanet", "mcp"] }`;
|
|
509
|
+
}
|
|
490
510
|
export async function main() {
|
|
511
|
+
if (process.argv.slice(2).some((arg) => isHelpFlag(arg))) {
|
|
512
|
+
printHelp(helpText());
|
|
513
|
+
}
|
|
491
514
|
const version = await packageVersion();
|
|
492
515
|
console.error(`ollanet mcp ${version} (stdio) — tools: ${TOOLS.map((t) => t.name).join(", ")}`);
|
|
493
516
|
const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
package/dist/prompt.d.ts
CHANGED
package/dist/prompt.js
CHANGED
|
@@ -17,14 +17,14 @@ import { configPath, defaultModelForHost, loadConfig, machineSettingsForHost, me
|
|
|
17
17
|
import { envInt, findDiscoveredHost, ollamaBaseUrl, resolveHost, shortName, } from "./hosts.js";
|
|
18
18
|
import { ollamaChat } from "./ollama-chat.js";
|
|
19
19
|
import { assemblePrompt, readPromptFile } from "./prompt-input.js";
|
|
20
|
-
import { consumeSettingsFlag, takeFlag, takeValue } from "./argv.js";
|
|
20
|
+
import { consumeSettingsFlag, failUsage, isHelpFlag, printHelp, takeFlag, takeValue } from "./argv.js";
|
|
21
21
|
import { listTargets, resolveTarget } from "./target.js";
|
|
22
22
|
/** Prompt/chat HTTP timeout (ms). 0 = no timeout. Separate from scan's OLLAMA_TIMEOUT_MS. */
|
|
23
23
|
function promptTimeoutMs() {
|
|
24
24
|
return envInt("OLLAMA_PROMPT_TIMEOUT_MS", 600_000);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
26
|
+
export function helpText() {
|
|
27
|
+
return `Usage:
|
|
28
28
|
ollanet prompt <machine> [model] <prompt...>
|
|
29
29
|
ollanet prompt --chat <hash> <prompt...>
|
|
30
30
|
ollanet prompt <machine> --chat <hash> <prompt...>
|
|
@@ -57,8 +57,10 @@ Options:
|
|
|
57
57
|
--no-think Disable thinking (default) so tokens go to the reply
|
|
58
58
|
--file <path> Prompt from a .txt or .md file (joins argv / stdin)
|
|
59
59
|
--no-stream Wait for the full response
|
|
60
|
-
--json Emit final response JSON (implies --no-stream)
|
|
61
|
-
|
|
60
|
+
--json Emit final response JSON (implies --no-stream)`;
|
|
61
|
+
}
|
|
62
|
+
function usage() {
|
|
63
|
+
failUsage(helpText());
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
64
66
|
* Heuristic for an optional positional model token.
|
|
@@ -136,8 +138,8 @@ function parseArgs(argv) {
|
|
|
136
138
|
const arg = args.shift();
|
|
137
139
|
if (arg === "--")
|
|
138
140
|
continue;
|
|
139
|
-
if (arg
|
|
140
|
-
|
|
141
|
+
if (isHelpFlag(arg))
|
|
142
|
+
printHelp(helpText());
|
|
141
143
|
if (arg === "--no-stream") {
|
|
142
144
|
stream = false;
|
|
143
145
|
continue;
|
package/dist/ps.d.ts
CHANGED
package/dist/ps.js
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
import { configFromPartial, loadConfig } from "./config.js";
|
|
8
8
|
import { discoverHosts, envInt, ollamaBaseUrl, shortName, } from "./hosts.js";
|
|
9
9
|
import { ollamaPs, ollamaPsRequired } from "./ollama-chat.js";
|
|
10
|
-
import { takeFlag } from "./argv.js";
|
|
10
|
+
import { failUsage, isHelpFlag, printHelp, takeFlag } from "./argv.js";
|
|
11
11
|
import { resolveTarget } from "./target.js";
|
|
12
12
|
import { looksTuned } from "./tuned.js";
|
|
13
13
|
function psTimeoutMs() {
|
|
14
14
|
return envInt("OLLAMA_PS_TIMEOUT_MS", 10_000);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
16
|
+
export function helpText() {
|
|
17
|
+
return `Usage:
|
|
18
18
|
ollanet ps [machine]
|
|
19
19
|
ollanet ps --machine <name>
|
|
20
20
|
|
|
@@ -27,8 +27,10 @@ scan lists models on disk. ps lists what is loaded in VRAM right now.
|
|
|
27
27
|
|
|
28
28
|
Options:
|
|
29
29
|
--machine <name> One host (default: every discovered host)
|
|
30
|
-
--json Emit result JSON on stdout
|
|
31
|
-
|
|
30
|
+
--json Emit result JSON on stdout`;
|
|
31
|
+
}
|
|
32
|
+
function usage() {
|
|
33
|
+
failUsage(helpText());
|
|
32
34
|
}
|
|
33
35
|
function parseArgs(argv) {
|
|
34
36
|
const args = [...argv];
|
|
@@ -39,8 +41,8 @@ function parseArgs(argv) {
|
|
|
39
41
|
const arg = args.shift();
|
|
40
42
|
if (arg === "--")
|
|
41
43
|
continue;
|
|
42
|
-
if (arg
|
|
43
|
-
|
|
44
|
+
if (isHelpFlag(arg))
|
|
45
|
+
printHelp(helpText());
|
|
44
46
|
if (arg === "--json") {
|
|
45
47
|
json = true;
|
|
46
48
|
continue;
|
package/dist/pull.d.ts
CHANGED
package/dist/pull.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { envInt, ollamaBaseUrl, shortName } from "./hosts.js";
|
|
10
10
|
import { ollamaPull } from "./ollama-chat.js";
|
|
11
|
-
import { takeFlag } from "./argv.js";
|
|
11
|
+
import { failUsage, isHelpFlag, printHelp, takeFlag } from "./argv.js";
|
|
12
12
|
import { resolveTarget } from "./target.js";
|
|
13
13
|
/** Pull HTTP timeout (ms). 0 = none. Large models can take hours. */
|
|
14
14
|
function pullTimeoutMs() {
|
|
15
15
|
return envInt("OLLAMA_PULL_TIMEOUT_MS", 0);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
17
|
+
export function helpText() {
|
|
18
|
+
return `Usage:
|
|
19
19
|
ollanet pull <machine> <model>
|
|
20
20
|
ollanet pull --machine <name> --model <name>
|
|
21
21
|
|
|
@@ -33,8 +33,10 @@ Options:
|
|
|
33
33
|
--model <name> Model to pull (e.g. gemma3:12b)
|
|
34
34
|
--insecure Allow HTTP / self-signed model registries
|
|
35
35
|
--no-stream Wait for a single final response (no progress chunks)
|
|
36
|
-
--json Emit result JSON on stdout
|
|
37
|
-
|
|
36
|
+
--json Emit result JSON on stdout`;
|
|
37
|
+
}
|
|
38
|
+
function usage() {
|
|
39
|
+
failUsage(helpText());
|
|
38
40
|
}
|
|
39
41
|
function parseArgs(argv) {
|
|
40
42
|
const args = [...argv];
|
|
@@ -48,8 +50,8 @@ function parseArgs(argv) {
|
|
|
48
50
|
const arg = args.shift();
|
|
49
51
|
if (arg === "--")
|
|
50
52
|
continue;
|
|
51
|
-
if (arg
|
|
52
|
-
|
|
53
|
+
if (isHelpFlag(arg))
|
|
54
|
+
printHelp(helpText());
|
|
53
55
|
if (arg === "--insecure") {
|
|
54
56
|
insecure = true;
|
|
55
57
|
continue;
|
package/dist/rm.d.ts
CHANGED
package/dist/rm.js
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
import { createInterface } from "node:readline";
|
|
7
7
|
import { envInt, ollamaBaseUrl, shortName } from "./hosts.js";
|
|
8
8
|
import { ollamaDelete } from "./ollama-chat.js";
|
|
9
|
-
import { takeFlag } from "./argv.js";
|
|
9
|
+
import { failUsage, isHelpFlag, printHelp, takeFlag } from "./argv.js";
|
|
10
10
|
import { resolveTarget } from "./target.js";
|
|
11
11
|
function rmTimeoutMs() {
|
|
12
12
|
return envInt("OLLAMA_RM_TIMEOUT_MS", 30_000);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
14
|
+
export function helpText() {
|
|
15
|
+
return `Usage:
|
|
16
16
|
ollanet rm <machine> <model> --yes
|
|
17
17
|
ollanet rm --machine <name> --model <name> --yes
|
|
18
18
|
|
|
@@ -27,8 +27,10 @@ Options:
|
|
|
27
27
|
--machine <name> Host (discovered name, MagicDNS, hostname, or IP[:port])
|
|
28
28
|
--model <name> Model to delete
|
|
29
29
|
--yes Required unless stdin is a TTY and you confirm
|
|
30
|
-
--json Emit result JSON on stdout
|
|
31
|
-
|
|
30
|
+
--json Emit result JSON on stdout`;
|
|
31
|
+
}
|
|
32
|
+
function usage() {
|
|
33
|
+
failUsage(helpText());
|
|
32
34
|
}
|
|
33
35
|
function parseArgs(argv) {
|
|
34
36
|
const args = [...argv];
|
|
@@ -41,8 +43,8 @@ function parseArgs(argv) {
|
|
|
41
43
|
const arg = args.shift();
|
|
42
44
|
if (arg === "--")
|
|
43
45
|
continue;
|
|
44
|
-
if (arg
|
|
45
|
-
|
|
46
|
+
if (isHelpFlag(arg))
|
|
47
|
+
printHelp(helpText());
|
|
46
48
|
if (arg === "--yes" || arg === "-y") {
|
|
47
49
|
yes = true;
|
|
48
50
|
continue;
|
package/dist/scan.d.ts
CHANGED
|
@@ -54,4 +54,5 @@ export interface ScanPayload {
|
|
|
54
54
|
}
|
|
55
55
|
/** Programmatic scan used by CLI `--json`, MCP, and `import { scanNetwork } from "ollanet"`. */
|
|
56
56
|
export declare function scanNetwork(options?: ScanOptions): Promise<ScanPayload>;
|
|
57
|
+
export declare function helpText(): string;
|
|
57
58
|
export declare function main(): Promise<void>;
|
package/dist/scan.js
CHANGED
|
@@ -7,6 +7,7 @@ import { configFromPartial, loadConfig } from "./config.js";
|
|
|
7
7
|
import { discoverHosts, envInt, ollamaPort, shortName, } from "./hosts.js";
|
|
8
8
|
import { lastScanPath, loadLastScan, saveLastScan } from "./scan-store.js";
|
|
9
9
|
import { looksTuned } from "./tuned.js";
|
|
10
|
+
import { isHelpFlag, printHelp } from "./argv.js";
|
|
10
11
|
function scanTimeoutMs() {
|
|
11
12
|
return envInt("OLLAMA_TIMEOUT_MS", 2500);
|
|
12
13
|
}
|
|
@@ -184,7 +185,30 @@ export async function scanNetwork(options = {}) {
|
|
|
184
185
|
}
|
|
185
186
|
return payload;
|
|
186
187
|
}
|
|
188
|
+
export function helpText() {
|
|
189
|
+
return `Usage:
|
|
190
|
+
ollanet scan [--json] [--all] [--lan] [--last]
|
|
191
|
+
|
|
192
|
+
Examples:
|
|
193
|
+
ollanet scan
|
|
194
|
+
ollanet scan --lan
|
|
195
|
+
ollanet scan --last
|
|
196
|
+
ollanet scan --json
|
|
197
|
+
|
|
198
|
+
Discovers Ollama hosts (localhost, config, OLLANET_HOSTS, Tailscale) and lists
|
|
199
|
+
models. --lan is an opt-in TCP sweep of local /24s on port 11434.
|
|
200
|
+
|
|
201
|
+
Options:
|
|
202
|
+
--json Machine-readable output
|
|
203
|
+
--all Also probe offline Tailscale peers
|
|
204
|
+
--lan TCP-scan local LAN CIDRs for open Ollama ports
|
|
205
|
+
--last Reprint the last saved scan (no network)
|
|
206
|
+
--cached Same as --last`;
|
|
207
|
+
}
|
|
187
208
|
export async function main() {
|
|
209
|
+
if (process.argv.slice(2).some((arg) => isHelpFlag(arg))) {
|
|
210
|
+
printHelp(helpText());
|
|
211
|
+
}
|
|
188
212
|
const includeOffline = process.argv.includes("--all");
|
|
189
213
|
const jsonOut = process.argv.includes("--json");
|
|
190
214
|
const lanScan = process.argv.includes("--lan");
|
package/dist/show.d.ts
CHANGED
package/dist/show.js
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { envInt, ollamaBaseUrl, shortName } from "./hosts.js";
|
|
7
7
|
import { ollamaShow } from "./ollama-chat.js";
|
|
8
|
-
import { takeFlag } from "./argv.js";
|
|
8
|
+
import { failUsage, isHelpFlag, printHelp, takeFlag } from "./argv.js";
|
|
9
9
|
import { resolveTarget } from "./target.js";
|
|
10
10
|
import { looksTuned } from "./tuned.js";
|
|
11
11
|
function showTimeoutMs() {
|
|
12
12
|
return envInt("OLLAMA_SHOW_TIMEOUT_MS", 30_000);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
14
|
+
export function helpText() {
|
|
15
|
+
return `Usage:
|
|
16
16
|
ollanet show <machine> <model>
|
|
17
17
|
ollanet show --machine <name> --model <name>
|
|
18
18
|
|
|
@@ -26,8 +26,10 @@ Tuned Finetuna-style names are marked [tuned].
|
|
|
26
26
|
Options:
|
|
27
27
|
--machine <name> Host (discovered name, MagicDNS, hostname, or IP[:port])
|
|
28
28
|
--model <name> Model to inspect
|
|
29
|
-
--json Emit result JSON on stdout
|
|
30
|
-
|
|
29
|
+
--json Emit result JSON on stdout`;
|
|
30
|
+
}
|
|
31
|
+
function usage() {
|
|
32
|
+
failUsage(helpText());
|
|
31
33
|
}
|
|
32
34
|
function parseArgs(argv) {
|
|
33
35
|
const args = [...argv];
|
|
@@ -39,8 +41,8 @@ function parseArgs(argv) {
|
|
|
39
41
|
const arg = args.shift();
|
|
40
42
|
if (arg === "--")
|
|
41
43
|
continue;
|
|
42
|
-
if (arg
|
|
43
|
-
|
|
44
|
+
if (isHelpFlag(arg))
|
|
45
|
+
printHelp(helpText());
|
|
44
46
|
if (arg === "--json") {
|
|
45
47
|
json = true;
|
|
46
48
|
continue;
|