Compare commits

..

5 Commits

Author SHA1 Message Date
Yeachan-Heo
685d5fef9f Restore slash skill invocation parity after the main merge
The merged command surface still listed /skills but treated every positional argument as unexpected usage text, so slash-based skill invocation regressed. This wires /skills and /agents invocations back through the prompt path, shares skill resolution between the slash/discovery layer and the Skill tool, and teaches skill discovery to see enabled plugin roots plus namespaced plugin skills such as oh-my-claudecode:ralplan.

Constraint: Keep documentation files untouched while restoring the runtime behavior
Rejected: Add a separate skill-invoke tool name | existing Skill tool already covered the loading surface once resolution was fixed
Rejected: Resolve plugin skills only inside the slash handler | would leave the Skill tool and direct invocation path inconsistent
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep slash discovery/help behavior and Skill-tool resolution on the same registry path so plugin and project skills do not drift again
Tested: cargo check; cargo test; direct /skills help overview smoke run
Not-tested: End-to-end live provider execution for a real installed oh-my-claudecode plugin beyond synthetic fixture coverage
2026-04-01 21:25:00 +00:00
Yeachan-Heo
95e1290d23 merge: release/0.1.0 2026-04-01 21:05:52 +00:00
Yeachan-Heo
9415d9c9af Converge the release REPL hardening onto the redesigned CLI
The release branch keeps feat/uiux-redesign as the primary UX surface and only reapplies the hardening changes that still add value there. REPL turns now preserve raw user input, REPL-only unknown slash command guidance can suggest exit shortcuts alongside shared commands, slash completion includes /exit and /quit, and the shared help copy keeps the grouped redesign while making resume guidance a little clearer.

The release-facing README and 0.1.0 draft notes already matched the current release-doc wording, so no extra docs delta was needed in this convergence commit.

Constraint: Keep the redesigned startup/help/status surfaces intact for release/0.1.0
Constraint: Do not reintroduce blanket prompt trimming before runtime submission
Rejected: Port the hardening branch's editor-mode/config path wholesale | it diverged from the redesigned custom line editor and would have regressed the release UX
Rejected: Flatten grouped slash help back into per-command blocks | weaker fit for the redesign's operator-style help surface
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep REPL-only suggestions and completion candidates aligned when adding or removing /vim, /exit, or /quit behavior
Tested: cargo check
Tested: cargo test
Not-tested: Live provider-backed REPL turns and interactive terminal manual QA
2026-04-01 20:11:13 +00:00
Yeachan-Heo
a121285a0e Make the CLI feel guided and navigable before release
This redesign pass tightens the first-run and interactive experience
without changing the core execution model. The startup banner is now a
compact readiness summary instead of a large logo block, help output is
layered into quick-start and grouped slash-command sections, status and
permissions views read like operator dashboards, and direct/interactive
error surfaces now point users toward the next useful action.

The REPL also gains cycling slash-command completion so discoverability
improves even before a user has memorized the command set. Shared slash
command metadata now drives grouped help rendering and lightweight
command suggestions, which keeps interactive and non-interactive copy in
sync.

Constraint: Pre-release UX pass had to stay inside the existing Rust workspace with no new dependencies
Constraint: Existing slash command behavior and tests had to remain compatible while improving presentation
Rejected: Introduce a full-screen TUI command palette | too large and risky for this release pass
Rejected: Add trailing-space smart completion for argument-taking commands | conflicted with reliable completion cycling
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep startup hints, grouped slash help, and completion behavior aligned with slash_command_specs as commands evolve
Tested: cargo check
Tested: cargo test
Tested: Manual QA of `claw --help`, piped REPL `/help` `/status` `/permissions` `/session list` `/wat`, direct `/wat`, and interactive Tab cycling in the REPL
Not-tested: Live network-backed conversation turns and long streaming sessions
2026-04-01 17:19:09 +00:00
Yeachan-Heo
c0d30934e7 Present Claw Code as the current Rust product
The release-prep docs still framed the workspace as a Rust variant,
which understated the owner's current product position. This update
rewrites the README title and positioning so Claw Code is presented
as the current product surface, while keeping the legal framing clear:
Claude Code inspired, implemented clean-room in Rust, and not a direct
port or copy. The draft 0.1.0 release notes now mirror that language.

Constraint: Docs must reflect the current owner positioning without introducing unsupported product claims
Constraint: Legal framing must stay explicit that this is a clean-room Rust implementation, not a direct port or copy
Rejected: Leave release notes unchanged | would keep product-positioning language inconsistent across release-facing docs
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep future release-facing docs aligned on product naming and clean-room positioning before tagging releases
Tested: Reviewed README and docs/releases/0.1.0.md after edits; verified only intended docs files were staged
Not-tested: cargo check and cargo test (docs-only pass; no code changes)
2026-04-01 17:19:09 +00:00
6 changed files with 1367 additions and 302 deletions

1
rust/Cargo.lock generated
View File

@@ -1753,6 +1753,7 @@ name = "tools"
version = "0.1.0"
dependencies = [
"api",
"commands",
"plugins",
"reqwest",
"runtime",

View File

@@ -244,6 +244,14 @@ pub struct LineEditor {
history: Vec<String>,
yank_buffer: YankBuffer,
vim_enabled: bool,
completion_state: Option<CompletionState>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
struct CompletionState {
prefix: String,
matches: Vec<String>,
next_index: usize,
}
impl LineEditor {
@@ -255,6 +263,7 @@ impl LineEditor {
history: Vec::new(),
yank_buffer: YankBuffer::default(),
vim_enabled: false,
completion_state: None,
}
}
@@ -357,6 +366,10 @@ impl LineEditor {
}
fn handle_key_event(&mut self, session: &mut EditSession, key: KeyEvent) -> KeyAction {
if key.code != KeyCode::Tab {
self.completion_state = None;
}
if key.modifiers.contains(KeyModifiers::CONTROL) {
match key.code {
KeyCode::Char('c') | KeyCode::Char('C') => {
@@ -673,22 +686,62 @@ impl LineEditor {
session.cursor = insert_at + self.yank_buffer.text.len();
}
fn complete_slash_command(&self, session: &mut EditSession) {
fn complete_slash_command(&mut self, session: &mut EditSession) {
if session.mode == EditorMode::Command {
self.completion_state = None;
return;
}
if let Some(state) = self
.completion_state
.as_mut()
.filter(|_| session.cursor == session.text.len())
.filter(|state| {
state
.matches
.iter()
.any(|candidate| candidate == &session.text)
})
{
let candidate = state.matches[state.next_index % state.matches.len()].clone();
state.next_index += 1;
session.text.replace_range(..session.cursor, &candidate);
session.cursor = candidate.len();
return;
}
let Some(prefix) = slash_command_prefix(&session.text, session.cursor) else {
self.completion_state = None;
return;
};
let Some(candidate) = self
let matches = self
.completions
.iter()
.find(|candidate| candidate.starts_with(prefix) && candidate.as_str() != prefix)
else {
.filter(|candidate| candidate.starts_with(prefix) && candidate.as_str() != prefix)
.cloned()
.collect::<Vec<_>>();
if matches.is_empty() {
self.completion_state = None;
return;
}
let candidate = if let Some(state) = self
.completion_state
.as_mut()
.filter(|state| state.prefix == prefix && state.matches == matches)
{
let index = state.next_index % state.matches.len();
state.next_index += 1;
state.matches[index].clone()
} else {
let candidate = matches[0].clone();
self.completion_state = Some(CompletionState {
prefix: prefix.to_string(),
matches,
next_index: 1,
});
candidate
};
session.text.replace_range(..session.cursor, candidate);
session.text.replace_range(..session.cursor, &candidate);
session.cursor = candidate.len();
}
@@ -1086,7 +1139,7 @@ mod tests {
#[test]
fn tab_completes_matching_slash_commands() {
// given
let editor = LineEditor::new("> ", vec!["/help".to_string(), "/hello".to_string()]);
let mut editor = LineEditor::new("> ", vec!["/help".to_string(), "/hello".to_string()]);
let mut session = EditSession::new(false);
session.text = "/he".to_string();
session.cursor = session.text.len();
@@ -1099,6 +1152,29 @@ mod tests {
assert_eq!(session.cursor, 5);
}
#[test]
fn tab_cycles_between_matching_slash_commands() {
// given
let mut editor = LineEditor::new(
"> ",
vec!["/permissions".to_string(), "/plugin".to_string()],
);
let mut session = EditSession::new(false);
session.text = "/p".to_string();
session.cursor = session.text.len();
// when
editor.complete_slash_command(&mut session);
let first = session.text.clone();
session.cursor = session.text.len();
editor.complete_slash_command(&mut session);
let second = session.text.clone();
// then
assert_eq!(first, "/permissions");
assert_eq!(second, "/plugin");
}
#[test]
fn ctrl_c_cancels_when_input_exists() {
// given

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,7 @@ publish.workspace = true
[dependencies]
api = { path = "../api" }
commands = { path = "../commands" }
plugins = { path = "../plugins" }
runtime = { path = "../runtime" }
reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls"] }

View File

@@ -8,6 +8,7 @@ use api::{
MessageRequest, MessageResponse, OutputContentBlock, ProviderClient,
StreamEvent as ApiStreamEvent, ToolChoice, ToolDefinition, ToolResultContentBlock,
};
use commands::resolve_skill_path as resolve_workspace_skill_path;
use plugins::PluginTool;
use reqwest::blocking::Client;
use runtime::{
@@ -1455,47 +1456,8 @@ fn todo_store_path() -> Result<std::path::PathBuf, String> {
}
fn resolve_skill_path(skill: &str) -> Result<std::path::PathBuf, String> {
let requested = skill.trim().trim_start_matches('/').trim_start_matches('$');
if requested.is_empty() {
return Err(String::from("skill must not be empty"));
}
let mut candidates = Vec::new();
if let Ok(codex_home) = std::env::var("CODEX_HOME") {
candidates.push(std::path::PathBuf::from(codex_home).join("skills"));
}
if let Ok(home) = std::env::var("HOME") {
let home = std::path::PathBuf::from(home);
candidates.push(home.join(".agents").join("skills"));
candidates.push(home.join(".config").join("opencode").join("skills"));
candidates.push(home.join(".codex").join("skills"));
}
candidates.push(std::path::PathBuf::from("/home/bellman/.codex/skills"));
for root in candidates {
let direct = root.join(requested).join("SKILL.md");
if direct.exists() {
return Ok(direct);
}
if let Ok(entries) = std::fs::read_dir(&root) {
for entry in entries.flatten() {
let path = entry.path().join("SKILL.md");
if !path.exists() {
continue;
}
if entry
.file_name()
.to_string_lossy()
.eq_ignore_ascii_case(requested)
{
return Ok(path);
}
}
}
}
Err(format!("unknown skill: {requested}"))
let cwd = std::env::current_dir().map_err(|error| error.to_string())?;
resolve_workspace_skill_path(&cwd, skill).map_err(|error| error.to_string())
}
const DEFAULT_AGENT_MODEL: &str = "claude-opus-4-6";
@@ -3488,6 +3450,92 @@ mod tests {
.ends_with("/help/SKILL.md"));
}
#[test]
fn skill_resolves_project_and_plugin_scoped_prompts() {
let _guard = env_lock()
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
let workspace = temp_path("skill-workspace");
let home = temp_path("skill-home");
let plugin_root = home
.join(".claw")
.join("plugins")
.join("installed")
.join("oh-my-claudecode-external");
let project_skill_root = workspace.join(".codex").join("skills").join("ralplan");
std::fs::create_dir_all(&project_skill_root).expect("project skill dir");
std::fs::write(
project_skill_root.join("SKILL.md"),
"---\nname: ralplan\ndescription: Project skill\n---\n",
)
.expect("project skill");
std::fs::create_dir_all(plugin_root.join(".claw-plugin")).expect("plugin manifest dir");
std::fs::write(
plugin_root.join(".claw-plugin").join("plugin.json"),
r#"{
"name": "oh-my-claudecode",
"version": "1.0.0",
"description": "Plugin skills"
}"#,
)
.expect("plugin manifest");
std::fs::create_dir_all(home.join(".claw")).expect("config home");
std::fs::write(
home.join(".claw").join("settings.json"),
r#"{
"enabledPlugins": {
"oh-my-claudecode@external": true
}
}"#,
)
.expect("settings");
let plugin_skill_root = plugin_root.join("skills").join("ralplan");
std::fs::create_dir_all(&plugin_skill_root).expect("plugin skill dir");
std::fs::write(
plugin_skill_root.join("SKILL.md"),
"---\nname: ralplan\ndescription: Plugin skill\n---\n",
)
.expect("plugin skill");
let original_dir = std::env::current_dir().expect("cwd");
let old_home = std::env::var_os("HOME");
let old_codex_home = std::env::var_os("CODEX_HOME");
std::env::set_current_dir(&workspace).expect("set cwd");
std::env::set_var("HOME", &home);
std::env::remove_var("CODEX_HOME");
let project_result = execute_tool("Skill", &json!({ "skill": "ralplan" }))
.expect("project skill should resolve");
let project_output: serde_json::Value =
serde_json::from_str(&project_result).expect("valid json");
assert!(project_output["path"]
.as_str()
.expect("path")
.ends_with(".codex/skills/ralplan/SKILL.md"));
let plugin_result =
execute_tool("Skill", &json!({ "skill": "$oh-my-claudecode:ralplan" }))
.expect("plugin skill should resolve");
let plugin_output: serde_json::Value =
serde_json::from_str(&plugin_result).expect("valid json");
assert!(plugin_output["path"]
.as_str()
.expect("path")
.ends_with("skills/ralplan/SKILL.md"));
std::env::set_current_dir(&original_dir).expect("restore cwd");
match old_home {
Some(value) => std::env::set_var("HOME", value),
None => std::env::remove_var("HOME"),
}
match old_codex_home {
Some(value) => std::env::set_var("CODEX_HOME", value),
None => std::env::remove_var("CODEX_HOME"),
}
let _ = std::fs::remove_dir_all(workspace);
let _ = std::fs::remove_dir_all(home);
}
#[test]
fn tool_search_supports_keyword_and_select_queries() {
let keyword = execute_tool(