1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser, Debug)]
#[command(
name = "oxo-call",
version,
about = "Model-intelligent orchestration for CLI bioinformatics",
long_about = r#"oxo-call uses LLM intelligence + expert Skills to help you call bioinformatics
tools without memorizing every flag and parameter.
Quick start:
1. Obtain a license file (academic: free; commercial: license@traitome.com)
and place it at the platform config path
(macOS: ~/Library/Application Support/io.traitome.oxo-call/license.oxo.json;
legacy Unix path ~/.config/oxo-call/license.oxo.json is also accepted)
2. Set up your API token:
oxo-call config set llm.api_token <your-github-token>
3. Run a tool with a natural-language task (documentation is auto-indexed):
oxo-call run samtools "sort input.bam by coordinate and output to sorted.bam"
oxo-call dry-run bwa "align reads.fastq to reference.fa with 8 threads"
4. Optionally pre-build the documentation index or add extra sources:
oxo-call docs add samtools
oxo-call docs add samtools --url https://www.htslib.org/doc/samtools.html
oxo-call docs add myapp --file /path/to/manual.md
oxo-call docs add myapp --dir /path/to/docs/
Skills — expert knowledge for reliable LLM output even with small models:
oxo-call skill list # see all built-in skills (samtools, bwa, gatk, ...)
oxo-call skill show samtools # inspect the samtools skill
oxo-call skill install <tool> # install a community skill from the registry
oxo-call skill create <tool> # generate a skill template for a new tool
Supported LLM providers: github-copilot (default), openai, anthropic, ollama
Task descriptions may be written in any language (English, Chinese, etc.).
License: Dual (Academic free / Commercial per-org) — run 'oxo-call license' for details."#
)]
pub struct Cli {
/// Path to the license file (overrides OXO_CALL_LICENSE env var and default path)
#[arg(long, global = true, value_name = "PATH")]
pub license: Option<PathBuf>,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
/// Execute a bioinformatics tool with LLM-generated parameters
#[command(visible_alias = "r")]
Run {
/// The tool to run (must be in PATH)
tool: String,
/// Natural-language description of the task (any language supported)
task: String,
/// Ask for confirmation before executing the generated command
#[arg(short, long)]
ask: bool,
},
/// Preview the command that would be executed (no actual execution)
#[command(name = "dry-run", visible_alias = "d")]
DryRun {
/// The tool to preview
tool: String,
/// Natural-language description of the task (any language supported)
task: String,
},
/// Manage tool documentation (add, remove, update, list, show)
#[command(visible_alias = "doc")]
Docs {
#[command(subcommand)]
command: DocsCommands,
},
/// [Deprecated] Manage the local documentation index — use 'docs' instead
#[command(visible_alias = "i", hide = true)]
Index {
#[command(subcommand)]
command: IndexCommands,
},
/// Manage oxo-call configuration
#[command(visible_alias = "cfg")]
Config {
#[command(subcommand)]
command: ConfigCommands,
},
/// Show command execution history
#[command(visible_alias = "hist")]
History {
#[command(subcommand)]
command: HistoryCommands,
},
/// Manage bioinformatics tool skills (expert knowledge for LLM prompts)
#[command(visible_alias = "sk")]
Skill {
#[command(subcommand)]
command: SkillCommands,
},
/// Show license information or verify the current license file
#[command(visible_alias = "lic")]
License {
#[command(subcommand)]
command: Option<LicenseCommands>,
},
/// Generate bioinformatics workflow files (Snakemake / Nextflow)
#[command(visible_alias = "wf")]
Workflow {
#[command(subcommand)]
command: WorkflowCommands,
},
}
#[derive(Subcommand, Debug)]
pub enum DocsCommands {
/// Add (or re-index) a tool's documentation from any combination of sources
Add {
/// Tool name (must be in PATH unless --url/--file/--dir is provided)
tool: String,
/// Remote documentation URL to include (http:// or https://)
#[arg(long)]
url: Option<String>,
/// Local documentation file to include (.md, .txt, .rst, .html)
#[arg(long, value_name = "PATH")]
file: Option<PathBuf>,
/// Local directory containing documentation files to include
#[arg(long, value_name = "DIR")]
dir: Option<PathBuf>,
},
/// Remove a tool's cached documentation
Remove {
/// Tool name to remove
tool: String,
},
/// Update (re-index) documentation for a tool or all indexed tools
Update {
/// Tool name to update, or omit to update all indexed tools
tool: Option<String>,
/// Optional remote documentation URL
#[arg(long)]
url: Option<String>,
},
/// List all indexed tools
List,
/// Show the cached documentation for a tool
Show {
/// Tool name
tool: String,
},
/// Fetch and cache documentation for a tool from a URL (alias for 'add --url')
Fetch {
/// Tool name
tool: String,
/// Remote documentation URL
url: String,
},
/// Show the path where documentation is cached
Path {
/// Tool name
tool: String,
},
}
/// Deprecated index subcommands — these now mirror the 'docs' equivalents.
#[derive(Subcommand, Debug)]
pub enum IndexCommands {
/// Add a tool to the documentation index (use 'docs add' instead)
Add {
/// Tool name (must be in PATH, or --url must be provided)
tool: String,
/// Optional remote documentation URL to include
#[arg(long)]
url: Option<String>,
/// Local documentation file to include (.md, .txt, .rst, .html)
#[arg(long, value_name = "PATH")]
file: Option<PathBuf>,
/// Local directory containing documentation files
#[arg(long, value_name = "DIR")]
dir: Option<PathBuf>,
},
/// Remove a tool from the documentation index (use 'docs remove' instead)
Remove {
/// Tool name to remove
tool: String,
},
/// Update (re-index) documentation for a tool (use 'docs update' instead)
Update {
/// Tool name to update, or omit to update all
tool: Option<String>,
/// Optional remote documentation URL
#[arg(long)]
url: Option<String>,
},
/// List all indexed tools (use 'docs list' instead)
List,
}
#[derive(Subcommand, Debug)]
pub enum ConfigCommands {
/// Set a configuration key to a value
Set {
/// Configuration key (e.g. llm.provider, llm.api_token, llm.model)
key: String,
/// Value to set
value: String,
},
/// Get the current value of a configuration key
Get {
/// Configuration key
key: String,
},
/// Show all current configuration
Show,
/// Verify the effective LLM configuration with a real API call
Verify,
/// Show the path to the configuration file
Path,
}
#[derive(Subcommand, Debug)]
pub enum HistoryCommands {
/// List recent command history
List {
/// Number of entries to show (default: 20)
#[arg(short = 'n', long, default_value = "20")]
limit: usize,
/// Filter by tool name
#[arg(long)]
tool: Option<String>,
},
/// Clear all history
Clear {
/// Skip confirmation
#[arg(short, long)]
yes: bool,
},
}
#[derive(Subcommand, Debug)]
pub enum SkillCommands {
/// List all available skills (built-in, community, and user-defined)
List,
/// Show the content of a skill
Show {
/// Tool name
tool: String,
},
/// Install a skill from the community registry or a custom URL
Install {
/// Tool name
tool: String,
/// Custom URL to a skill TOML file (optional; defaults to community registry)
#[arg(long)]
url: Option<String>,
},
/// Remove a community or user-installed skill
Remove {
/// Tool name
tool: String,
},
/// Generate a skill template for a new tool
Create {
/// Tool name
tool: String,
/// Write template to this file (defaults to stdout)
#[arg(short, long)]
output: Option<std::path::PathBuf>,
},
/// Show the path to the user skills directory
Path,
}
#[derive(Subcommand, Debug)]
pub enum LicenseCommands {
/// Verify the license file and display its details
Verify,
}
#[derive(Subcommand, Debug)]
pub enum WorkflowCommands {
/// Run a workflow file with the oxo-call native engine
#[command(name = "run", visible_alias = "r")]
RunWorkflow {
/// Path to an .oxo.toml workflow file (or a built-in template name)
file: String,
},
/// Preview a workflow without executing any steps (dry-run)
#[command(name = "dry-run", visible_alias = "d")]
DryRunWorkflow {
/// Path to an .oxo.toml workflow file (or a built-in template name)
file: String,
},
/// Export a native .oxo.toml workflow to Snakemake or Nextflow format
Export {
/// Path to an .oxo.toml workflow file (or a built-in template name)
file: String,
/// Target format: snakemake or nextflow
#[arg(long, default_value = "snakemake", value_parser = ["snakemake", "nextflow"])]
to: String,
/// Write output to this file (defaults to stdout)
#[arg(short, long)]
output: Option<std::path::PathBuf>,
},
/// Generate a workflow with LLM from a natural-language description
Generate {
/// Plain-English description of the bioinformatics workflow
task: String,
/// Output format: native (default), snakemake, or nextflow
#[arg(short, long, default_value = "native", value_parser = ["native", "snakemake", "nextflow"])]
engine: String,
/// Write the generated workflow to this file (defaults to stdout)
#[arg(short, long)]
output: Option<std::path::PathBuf>,
},
/// Infer and generate a workflow from a task description and input data directory
///
/// Scans the data directory to discover sample names and file patterns, then
/// uses the LLM to generate a workflow with real paths and sample names already filled in.
Infer {
/// Plain-English description of the analysis task
task: String,
/// Path to the directory containing input data files (FASTQ, BAM, etc.)
#[arg(short, long, value_name = "DIR")]
data: std::path::PathBuf,
/// Output format: native (default), snakemake, or nextflow
#[arg(short, long, default_value = "native", value_parser = ["native", "snakemake", "nextflow"])]
engine: String,
/// Write the generated workflow to this file (defaults to stdout)
#[arg(short, long)]
output: Option<std::path::PathBuf>,
/// After generating, immediately run the workflow (only with --output)
#[arg(long)]
run: bool,
},
/// List built-in workflow templates
List,
/// Show a built-in workflow template
Show {
/// Template name (see 'workflow list')
name: String,
/// Format to show: native (default), snakemake, or nextflow
#[arg(short, long, default_value = "native", value_parser = ["native", "snakemake", "nextflow"])]
engine: String,
},
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_run_defaults_to_non_interactive_execution() {
let cli = Cli::parse_from(["oxo-call", "run", "date", "current time"]);
match cli.command {
Commands::Run { ask, .. } => assert!(!ask),
_ => panic!("expected run command"),
}
}
#[test]
fn test_run_supports_explicit_ask_flag() {
let cli = Cli::parse_from(["oxo-call", "run", "--ask", "date", "current time"]);
match cli.command {
Commands::Run { ask, .. } => assert!(ask),
_ => panic!("expected run command"),
}
}
}