kura_cli/commands/
read.rs1use clap::{Args, Subcommand};
2
3use crate::commands::agent;
4
5#[derive(Subcommand)]
6pub enum ReadCommands {
7 Startup(ReadStartupArgs),
9 Section(ReadSectionArgs),
11 #[command(hide = true)]
13 Bundle(ReadBundleArgs),
14}
15
16#[derive(Args)]
17pub struct ReadStartupArgs {
18 #[arg(long)]
20 exercise_limit: Option<u32>,
21 #[arg(long)]
23 strength_limit: Option<u32>,
24 #[arg(long)]
26 custom_limit: Option<u32>,
27 #[arg(long)]
29 task_intent: Option<String>,
30 #[arg(long)]
32 include_system: Option<bool>,
33 #[arg(long)]
35 budget_tokens: Option<u32>,
36}
37
38#[derive(Args)]
39pub struct ReadSectionArgs {
40 #[arg(long)]
42 section: String,
43 #[arg(long)]
45 limit: Option<u32>,
46 #[arg(long)]
48 cursor: Option<String>,
49 #[arg(long)]
51 fields: Option<String>,
52 #[arg(long)]
54 task_intent: Option<String>,
55}
56
57#[derive(Args)]
58pub struct ReadBundleArgs {
59 #[arg(long)]
61 exercise_limit: Option<u32>,
62 #[arg(long)]
64 strength_limit: Option<u32>,
65 #[arg(long)]
67 custom_limit: Option<u32>,
68 #[arg(long)]
70 task_intent: Option<String>,
71 #[arg(long)]
73 include_system: Option<bool>,
74 #[arg(long)]
76 budget_tokens: Option<u32>,
77}
78
79pub async fn run(api_url: &str, token: Option<&str>, command: ReadCommands) -> i32 {
80 match command {
81 ReadCommands::Startup(args) => {
82 agent::section_index(
83 api_url,
84 token,
85 args.exercise_limit,
86 args.strength_limit,
87 args.custom_limit,
88 args.task_intent,
89 args.include_system,
90 args.budget_tokens,
91 )
92 .await
93 }
94 ReadCommands::Section(args) => {
95 agent::section_fetch(
96 api_url,
97 token,
98 args.section,
99 args.limit,
100 args.cursor,
101 args.fields,
102 args.task_intent,
103 )
104 .await
105 }
106 ReadCommands::Bundle(args) => {
107 agent::context(
108 api_url,
109 token,
110 args.exercise_limit,
111 args.strength_limit,
112 args.custom_limit,
113 args.task_intent,
114 args.include_system,
115 args.budget_tokens,
116 )
117 .await
118 }
119 }
120}