lean_ctx/tools/registered/
mod.rs1pub mod ctx_agent;
2pub mod ctx_analyze;
3pub mod ctx_architecture;
4pub mod ctx_artifacts;
5pub mod ctx_benchmark;
6pub mod ctx_cache;
7pub mod ctx_call;
8pub mod ctx_callgraph;
9pub mod ctx_compile;
10pub mod ctx_compose;
11pub mod ctx_compress;
12pub mod ctx_compress_memory;
13pub mod ctx_context;
14pub mod ctx_control;
15pub mod ctx_cost;
16pub mod ctx_dedup;
17pub mod ctx_delta;
18pub mod ctx_discover;
19pub mod ctx_discover_tools;
20pub mod ctx_edit;
21pub mod ctx_execute;
22pub mod ctx_expand;
23pub mod ctx_feedback;
24pub mod ctx_fill;
25pub mod ctx_gain;
26pub mod ctx_graph;
27pub mod ctx_handoff;
28pub mod ctx_heatmap;
29pub mod ctx_impact;
30pub mod ctx_index;
31pub mod ctx_intent;
32pub mod ctx_knowledge;
33pub mod ctx_ledger;
34pub mod ctx_load_tools;
35pub mod ctx_metrics;
36pub mod ctx_multi_read;
37pub mod ctx_multi_repo;
38pub mod ctx_outline;
39pub mod ctx_overview;
40pub mod ctx_pack;
41pub mod ctx_plan;
42pub mod ctx_plugins;
43pub mod ctx_prefetch;
44pub mod ctx_preload;
45pub mod ctx_proof;
46pub mod ctx_provider;
47pub mod ctx_radar;
48pub mod ctx_read;
49pub mod ctx_refactor;
50pub mod ctx_repomap;
51pub mod ctx_response;
52pub mod ctx_retrieve;
53pub mod ctx_review;
54pub mod ctx_routes;
55pub mod ctx_rules;
56pub mod ctx_search;
57pub mod ctx_semantic_search;
58pub mod ctx_session;
59pub mod ctx_share;
60pub mod ctx_shell;
61pub mod ctx_smart_read;
62pub mod ctx_smells;
63pub mod ctx_symbol;
64pub mod ctx_task;
65pub mod ctx_tree;
66pub mod ctx_verify;
67pub mod ctx_workflow;
68pub mod shell_alias;
69
70pub(crate) fn resolve_path_sync(
75 session: &crate::core::session::SessionState,
76 raw: &str,
77) -> Result<String, String> {
78 let normalized = crate::core::pathutil::normalize_tool_path(raw);
79 if normalized.is_empty() || normalized == "." {
80 return Ok(normalized);
81 }
82 let p = std::path::Path::new(&normalized);
83
84 let jail_root = session
85 .project_root
86 .as_deref()
87 .or(session.shell_cwd.as_deref())
88 .unwrap_or(".")
89 .to_string();
90
91 let resolved = if p.is_absolute() || p.exists() {
92 std::path::PathBuf::from(&normalized)
93 } else if let Some(ref root) = session.project_root {
94 let joined = std::path::Path::new(root).join(&normalized);
95 if joined.exists() {
96 joined
97 } else if let Some(ref cwd) = session.shell_cwd {
98 std::path::Path::new(cwd).join(&normalized)
99 } else {
100 std::path::Path::new(&jail_root).join(&normalized)
101 }
102 } else if let Some(ref cwd) = session.shell_cwd {
103 std::path::Path::new(cwd).join(&normalized)
104 } else {
105 std::path::Path::new(&jail_root).join(&normalized)
106 };
107
108 let jail_root_path = std::path::Path::new(&jail_root);
109 let jailed = crate::core::pathjail::jail_path(&resolved, jail_root_path)?;
110 crate::core::io_boundary::check_secret_path_for_tool("resolve_path", &jailed)?;
111
112 Ok(crate::core::pathutil::normalize_tool_path(
113 &jailed.to_string_lossy().replace('\\', "/"),
114 ))
115}