Skip to content

Commit dbe71ad

Browse files
committed
Added cli option to obtain the llm prompt
1 parent 0527db5 commit dbe71ad

8 files changed

Lines changed: 30 additions & 15 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "chatfs"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
edition = "2024"
55

66
[dependencies]

src/cli/interface.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ use crate::connection::socket::set_gateway;
99
use crate::utils::logger;
1010

1111

12+
const TOOL_NOTICE: &str = "
13+
This tool is a url-based filesystem interface that allows an AI model to access your workspace.
14+
15+
- Run `chatfs prompt` to obtain the LLM prompt.
16+
- Then run `chatfs run` to start the chat interface.
17+
- Copy both prompt and gateway URL, then paste it in AI chat.
18+
";
19+
20+
const PROMPT: &str = include_str!("../../PROMPT.md");
21+
1222
pub fn cli_handler() -> Result<(), String>{
1323
// CLI instance
1424
let cli = Cli::parse();
@@ -58,6 +68,10 @@ pub fn cli_handler() -> Result<(), String>{
5868

5969
// Process commands
6070
match cli.command {
71+
Some(Commands::Prompt) => {
72+
println!("{}", PROMPT);
73+
exit(0);
74+
},
6175
Some(Commands::SetConfig { key, value }) => {
6276
match set_config(key, value) {
6377
Ok(_) => {
@@ -112,8 +126,19 @@ pub fn cli_handler() -> Result<(), String>{
112126
return Ok(());
113127
},
114128
None => {
115-
// TODO: Update tool notice
116-
println!("Tool notice: use 'run' command");
129+
// Tool notice
130+
println!(r#"
131+
__ __ __ ____ ______ _____ _____
132+
/ ]| | | / || || |/ ___/
133+
/ / | | || o || || __( \_
134+
/ / | _ || ||_| |_|| |_ \__ |
135+
/ \_ | | || _ | | | | _] / \ |
136+
\ || | || | | | | | | \ |
137+
\____||__|__||__|__| |__| |__| \___|
138+
139+
"#);
140+
141+
println!("{}", TOOL_NOTICE);
117142
exit(0);
118143
}
119144
}

src/cli/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub struct Cli {
1212

1313
#[derive(Subcommand)]
1414
pub enum Commands {
15+
Prompt,
1516
SetConfig {
1617
#[arg(value_name = "KEY")]
1718
key: ConfigKey,

src/core/executor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use super::operations;
66

77
pub fn execute_command(command: &Command, queries: &HashMap<String, String>) -> Result<Value, String> {
88
match command {
9-
Command::Prompt => operations::prompt::prompt(),
109
Command::List => operations::list::list(queries),
1110
Command::Content => operations::content::content(queries),
1211
Command::Create => operations::create::create(queries),

src/core/operations/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub mod prompt;
21
pub mod list;
32
pub mod content;
43
pub mod create;

src/core/operations/prompt.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/core/types.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use serde::Deserialize;
44
// Commands
55
#[derive(Debug, Deserialize)]
66
pub enum Command {
7-
#[serde(rename = "prompt")]
8-
Prompt,
97
#[serde(rename = "list")]
108
List,
119
#[serde(rename = "content")]

0 commit comments

Comments
 (0)