Skip to content

An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.

Rust

Merge remote-tracking branch 'origin/omx-issue-9103-clawcode-ux-enhance'

Yeachan-Heo769435665a6d
diff --cc rust/crates/rusty-claude-cli/src/main.rs
index 5120571e,194456fd..027455d0
--- a/rust/crates/rusty-claude-cli/src/main.rs
+++ b/rust/crates/rusty-claude-cli/src/main.rs
@@@ -323,13 -362,14 +362,15 @@@ fn parse_direct_slash_cli_action(rest:
Some(SlashCommand::Help) => Ok(CliAction::Help),
Some(SlashCommand::Agents { args }) => Ok(CliAction::Agents { args }),
Some(SlashCommand::Skills { args }) => Ok(CliAction::Skills { args }),
- Some(command) => Err(match command {
- SlashCommand::Unknown(name) => format_unknown_slash_command_message(&name),
- _ => format!(
- "slash command {command_name} is interactive-only. Start `claw` and run it there, or use `claw --resume SESSION.jsonl {command_name}` when the command is marked [resume] in /help.",
- command_name = rest[0]
- ),
+ Some(SlashCommand::Unknown(name)) => Err(format_unknown_direct_slash_command(&name)),
- Some(command) => Err(format!(
- "unsupported direct slash command outside the REPL: {command_name}",
- command_name = {
- let _ = command;
- rest[0].clone()
- }
- )),
++ Some(command) => Err({
++ let _ = command;
++ format!(
++ "slash command {command_name} is interactive-only. Start `claw` and run it there, or use `claw --resume SESSION.jsonl {command_name}` / `claw --resume {latest} {command_name}` when the command is marked [resume] in /help.",
++ command_name = rest[0],
++ latest = LATEST_SESSION_REFERENCE,
++ )
+ }),
None => Err(format!("unknown subcommand: {}", rest[0])),
}
}
@@@ -683,59 -833,6 +835,59 @@@ struct StatusUsage
estimated_tokens: usize,
}
+#[allow(clippy::struct_field_names)]
+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
+struct GitWorkspaceSummary {
+ changed_files: usize,
+ staged_files: usize,
+ unstaged_files: usize,
+ untracked_files: usize,
+ conflicted_files: usize,
+}
+
+impl GitWorkspaceSummary {
+ fn is_clean(self) -> bool {
+ self.changed_files == 0
+ }
+
+ fn headline(self) -> String {
+ if self.is_clean() {
+ "clean".to_string()
+ } else {
+ let mut details = Vec::new();
+ if self.staged_files > 0 {
+ details.push(format!("{} staged", self.staged_files));
+ }
+ if self.unstaged_files > 0 {
+ details.push(format!("{} unstaged", self.unstaged_files));
+ }
+ if self.untracked_files > 0 {
+ details.push(format!("{} untracked", self.untracked_files));
+ }
+ if self.conflicted_files > 0 {
+ details.push(format!("{} conflicted", self.conflicted_files));
+ }
+ format!(
+ "dirty · {} files · {}",
+ self.changed_files,
+ details.join(", ")
+ )
+ }
+ }
+}
+
+fn format_unknown_slash_command_message(name: &str) -> String {
- let suggestions = suggest_slash_commands(name, 3);
++ let suggestions = suggest_slash_commands(name);
+ if suggestions.is_empty() {
+ format!("unknown slash command: /{name}. Use /help to list available commands.")
+ } else {
+ format!(
+ "unknown slash command: /{name}. Did you mean {}? Use /help to list available commands.",
+ suggestions.join(", ")
+ )
+ }
+}
+
fn format_model_report(model: &str, message_count: usize, turns: u32) -> String {
format!(
"Model
@@@ -1282,15 -1348,10 +1443,19 @@@ impl LiveCli
|_| "<unknown>".to_string(),
|path| path.display().to_string(),
);
+ let status = status_context(None).ok();
+ let git_branch = status
+ .as_ref()
+ .and_then(|context| context.git_branch.as_deref())
+ .unwrap_or("unknown");
+ let workspace = status.as_ref().map_or_else(
+ || "unknown".to_string(),
+ |context| context.git_summary.headline(),
+ );
+ let session_path = self.session.path.strip_prefix(Path::new(&cwd)).map_or_else(
+ |_| self.session.path.display().to_string(),
+ |path| path.display().to_string(),
+ );
format!(
"\x1b[38;5;196m\
██████╗██╗ █████╗ ██╗ ██╗\n\
@@@ -1301,17 -1362,15 +1466,19 @@@
╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝\x1b[0m \x1b[38;5;208mCode\x1b[0m 🦞\n\n\
\x1b[2mModel\x1b[0m {}\n\
\x1b[2mPermissions\x1b[0m {}\n\
+ \x1b[2mBranch\x1b[0m {}\n\
+ \x1b[2mWorkspace\x1b[0m {}\n\
\x1b[2mDirectory\x1b[0m {}\n\
- \x1b[2mSession\x1b[0m {}\n\n\
- Type \x1b[1m/help\x1b[0m for commands · \x1b[1m/status\x1b[0m for live context · \x1b[1m/diff\x1b[0m then \x1b[1m/commit\x1b[0m to ship · \x1b[2mTab\x1b[0m for workflow completions · \x1b[2mShift+Enter\x1b[0m for newline",
+ \x1b[2mSession\x1b[0m {}\n\
+ \x1b[2mAuto-save\x1b[0m {}\n\n\
- Type \x1b[1m/help\x1b[0m for commands · \x1b[2m/resume latest\x1b[0m jumps back to the newest session",
++ Type \x1b[1m/help\x1b[0m for commands · \x1b[1m/status\x1b[0m for live context · \x1b[2m/resume latest\x1b[0m jumps back to the newest session · \x1b[1m/diff\x1b[0m then \x1b[1m/commit\x1b[0m to ship · \x1b[2mTab\x1b[0m for workflow completions · \x1b[2mShift+Enter\x1b[0m for newline",
self.model,
self.permission_mode.as_str(),
+ git_branch,
+ workspace,
cwd,
self.session.id,
+ session_path,
)
}
@@@ -2179,11 -2232,22 +2357,11 @@@ fn list_managed_sessions() -> Result<Ve
.modified()
.ok()
.and_then(|time| time.duration_since(UNIX_EPOCH).ok())
- .map(|duration| duration.as_secs())
+ .map(|duration| duration.as_millis())
.unwrap_or_default();
- let (id, message_count, parent_session_id, branch_name) = Session::load_from_path(&path)
- .map_or_else(
- |_| {
- (
- path.file_stem()
- .and_then(|value| value.to_str())
- .unwrap_or("unknown")
- .to_string(),
- 0,
- None,
- None,
- )
- },
- |session| {
+ let (id, message_count, parent_session_id, branch_name) =
+ match Session::load_from_path(&path) {
+ Ok(session) => {
let parent_session_id = session
.fork
.as_ref()
@@@ -2267,9 -2364,12 +2487,12 @@@ fn render_repl_help() -> String
" /exit Quit the REPL".to_string(),
" /quit Quit the REPL".to_string(),
" Up/Down Navigate prompt history".to_string(),
- " Tab Complete slash commands".to_string(),
+ " Tab Complete commands, modes, and recent sessions".to_string(),
" Ctrl-C Clear input (or exit on empty prompt)".to_string(),
" Shift+Enter/Ctrl+J Insert a newline".to_string(),
+ " Auto-save .claw/sessions/<session-id>.jsonl".to_string(),
+ " Resume latest /resume latest".to_string(),
+ " Browse sessions /session list".to_string(),
String::new(),
render_slash_command_help(),
]
@@@ -4515,15 -4491,14 +4754,17 @@@ mod tests
format_compact_report, format_cost_report, format_internal_prompt_progress_line,
format_model_report, format_model_switch_report, format_permissions_report,
format_permissions_switch_report, format_resume_report, format_status_report,
- format_tool_call_start, format_tool_result, format_unknown_slash_command_message,
+ format_tool_call_start, format_tool_result, format_unknown_slash_command,
++ format_unknown_slash_command_message,
normalize_permission_mode, parse_args, parse_git_status_branch,
- parse_git_status_metadata_for, permission_policy, print_help_to, push_output_block,
- render_config_report, render_diff_report, render_memory_report, render_repl_help,
- render_resume_usage, resolve_model_alias, resolve_session_reference, response_to_events,
- resume_supported_slash_commands, run_resume_command, status_context, CliAction,
- CliOutputFormat, InternalPromptProgressEvent, InternalPromptProgressState, SlashCommand,
- StatusUsage, DEFAULT_MODEL,
+ parse_git_status_metadata_for, parse_git_workspace_summary, permission_policy,
+ print_help_to, push_output_block, render_config_report, render_diff_report,
+ render_memory_report, render_repl_help, resolve_model_alias, resolve_session_reference,
- response_to_events, resume_supported_slash_commands, run_resume_command,
++ render_resume_usage, response_to_events, resume_supported_slash_commands,
++ run_resume_command,
+ slash_command_completion_candidates_with_sessions, status_context, CliAction,
+ CliOutputFormat, GitWorkspaceSummary, InternalPromptProgressEvent,
+ InternalPromptProgressState, LiveCli, SlashCommand, StatusUsage, DEFAULT_MODEL,
};
use api::{MessageResponse, OutputContentBlock, Usage};
use plugins::{PluginTool, PluginToolDefinition, PluginToolPermission};
@@@ -4920,47 -4912,10 +5188,49 @@@
assert!(help.contains("/agents"));
assert!(help.contains("/skills"));
assert!(help.contains("/exit"));
+ assert!(help.contains("Auto-save .claw/sessions/<session-id>.jsonl"));
+ assert!(help.contains("Resume latest /resume latest"));
}
+ #[test]
+ fn completion_candidates_include_workflow_shortcuts_and_dynamic_sessions() {
+ let completions = slash_command_completion_candidates_with_sessions(
+ "sonnet",
+ Some("session-current"),
+ vec!["session-old".to_string()],
+ );
+
+ assert!(completions.contains(&"/model claude-sonnet-4-6".to_string()));
+ assert!(completions.contains(&"/permissions workspace-write".to_string()));
+ assert!(completions.contains(&"/session list".to_string()));
+ assert!(completions.contains(&"/session switch session-current".to_string()));
+ assert!(completions.contains(&"/resume session-old".to_string()));
+ assert!(completions.contains(&"/ultraplan ".to_string()));
+ }
+
+ #[test]
+ fn startup_banner_mentions_workflow_completions() {
+ let _guard = env_lock();
+ let root = temp_dir();
+ fs::create_dir_all(&root).expect("root dir");
+
+ let banner = with_current_dir(&root, || {
+ LiveCli::new(
+ "claude-sonnet-4-6".to_string(),
+ true,
+ None,
+ PermissionMode::DangerFullAccess,
+ )
+ .expect("cli should initialize")
+ .startup_banner()
+ });
+
+ assert!(banner.contains("Tab"));
+ assert!(banner.contains("workflow completions"));
+
+ fs::remove_dir_all(root).expect("cleanup temp dir");
+ }
+
#[test]
fn resume_supported_command_list_matches_expected_surface() {
let names = resume_supported_slash_commands()