permit: allow all edits per session, drop per-file always, add /yolo
This commit is contained in:
1 parent
6f951ad7f8
commit
5eee541e62
6 files changed
+65
-11
No files matched your search
@@ -1027,6 +1027,16 @@ async fn submit(app: &mut App, mut line: String, c: &Ctx<'_>) {
|
||||
let l = skills_list(&app.specs, &dirs);
|
||||
show(app, "skills", l);
|
||||
}
|
||||
"yolo" => {
|
||||
let on = app
|
||||
.state
|
||||
.allow
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.toggle_yolo();
|
||||
let m = if on { "yolo on: nothing asks" } else { "yolo off" };
|
||||
app.t.push(Item::Info(m.into()));
|
||||
}
|
||||
"lsp" => {
|
||||
let st = lsp_status().await;
|
||||
let l = if st.is_empty() {
|
||||
|
||||
@@ -33,6 +33,9 @@ impl Prompt {
|
||||
.unwrap_or(&self.req.rule);
|
||||
v.push((Decision::Always, format!("[a] allow always: {r}")));
|
||||
}
|
||||
if matches!(self.req.tool.as_str(), "write" | "edit") {
|
||||
v.push((Decision::Edits, "[e] allow all edits this session".into()));
|
||||
}
|
||||
v.push((Decision::Deny, "[n] deny".into()));
|
||||
v
|
||||
}
|
||||
@@ -41,6 +44,9 @@ impl Prompt {
|
||||
match k.code {
|
||||
KeyCode::Char('y' | 'Y') => Some(Decision::Once),
|
||||
KeyCode::Char('a' | 'A') if self.can_always() => Some(Decision::Always),
|
||||
KeyCode::Char('e' | 'E') if matches!(self.req.tool.as_str(), "write" | "edit") => {
|
||||
Some(Decision::Edits)
|
||||
}
|
||||
KeyCode::Char('n' | 'N') | KeyCode::Esc => Some(Decision::Deny),
|
||||
KeyCode::Up | KeyCode::Left => {
|
||||
let n = self.opts().len();
|
||||
@@ -60,6 +66,7 @@ impl Prompt {
|
||||
match d {
|
||||
Decision::Once => "allowed",
|
||||
Decision::Always => "allowed always",
|
||||
Decision::Edits => "allowed all edits this session:",
|
||||
Decision::Deny => "denied",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user