Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,19 @@ A **plugin** is a folder in `~/.incode/plugins/<name>/` or
`hooks.json` (`{"pre_tool_use": [...], "post_tool_use": [...]}`, added to
`admin.json`'s hooks) and `.mcp.json` (`{"mcpServers": {"db": {"command",
"args", "env"}}}`, or `{"type": "http", "url", "headers"}`, started with the
session). `${INCODE_PLUGIN_ROOT}` in a hook or server is the plugin's folder.
session), and `agents/*.md` (sub-agents, as `<plugin>:<agent>`).
`${INCODE_PLUGIN_ROOT}` in a hook or server is the plugin's folder. A hook may
be `{"command": "...", "matcher": "Edit|Write"}` to run only for the tools the
regular expression names (the whole name, as in `admin.json`).

**Claude Code plugins install as they are.** A folder with
`.claude-plugin/plugin.json` and no `plugin.toml` is read in that layout:
the same `commands/`, `skills/` and `agents/`, its `hooks/hooks.json`
(events, `matcher`s and `command` hooks; the commands run in Git Bash on
Windows), its `.mcp.json` servers, and `${CLAUDE_PLUGIN_ROOT}`. Once installed
it is an incode plugin, used by every agent incode drives. `incode plugin
list` notes what it brings that incode does not run: `prompt` hooks, events
incode has no point for, and `plugin.json` keys it does not read.

```sh
incode plugin list
Expand Down
18 changes: 9 additions & 9 deletions src/admin/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,15 @@ fn a_tool() -> crate::ext_tools::ToolEntry {
/// fails to compile here until it is given a hook.
fn a_hook_on_every_desktop_event() -> crate::hooks::HookConfig {
crate::hooks::HookConfig {
pre_tool_use: vec!["a-guard-command".to_string()],
post_tool_use: vec!["a-logging-command".to_string()],
user_prompt_submit: vec!["a-prompt-check".to_string()],
pre_compact: vec!["a-compact-note".to_string()],
stop: vec!["a-stop-note".to_string()],
notification: vec!["a-notify-hook".to_string()],
session_start: vec!["a-start-note".to_string()],
session_end: vec!["a-end-note".to_string()],
subagent_stop: vec!["a-subagent-note".to_string()],
pre_tool_use: vec!["a-guard-command".into()],
post_tool_use: vec!["a-logging-command".into()],
user_prompt_submit: vec!["a-prompt-check".into()],
pre_compact: vec!["a-compact-note".into()],
stop: vec!["a-stop-note".into()],
notification: vec!["a-notify-hook".into()],
session_start: vec!["a-start-note".into()],
session_end: vec!["a-end-note".into()],
subagent_stop: vec!["a-subagent-note".into()],
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/agent/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,7 @@ mod tests {
let echo_stdin = if cfg!(windows) { "more" } else { "cat" };
let mut agent = backend(dir.path()).with_operator_hooks(Some(
crate::hooks::HookRunner::new(crate::hooks::HookConfig {
pre_compact: vec![echo_stdin.to_string()],
pre_compact: vec![echo_stdin.into()],
..crate::hooks::HookConfig::default()
}),
));
Expand Down
10 changes: 5 additions & 5 deletions src/cli/agent_turn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ mod tests {
let mut s = with_memory(ws.path(), engine.path(), &[], &seen, Box::new(|_| {}));
s.set_operator_hooks(Some(crate::hooks::HookRunner::new(
crate::hooks::HookConfig {
user_prompt_submit: vec![operator_hook("checked", "no secrets", code)],
user_prompt_submit: vec![operator_hook("checked", "no secrets", code).into()],
..crate::hooks::HookConfig::default()
},
)));
Expand Down Expand Up @@ -1736,7 +1736,7 @@ mod tests {
let mut s = with_memory(ws.path(), engine.path(), &[], &seen, Box::new(|_| {}));
s.set_operator_hooks(Some(crate::hooks::HookRunner::new(
crate::hooks::HookConfig {
user_prompt_submit: vec![operator_hook("checked", "no secrets", code)],
user_prompt_submit: vec![operator_hook("checked", "no secrets", code).into()],
..crate::hooks::HookConfig::default()
},
)));
Expand Down Expand Up @@ -1768,7 +1768,7 @@ mod tests {
let mut s = with_memory(ws.path(), engine.path(), &[], &seen, Box::new(|_| {}));
s.set_operator_hooks(Some(crate::hooks::HookRunner::new(
crate::hooks::HookConfig {
stop: vec![operator_hook("turn noted", "", 0)],
stop: vec![operator_hook("turn noted", "", 0).into()],
..crate::hooks::HookConfig::default()
},
)));
Expand Down Expand Up @@ -1800,8 +1800,8 @@ mod tests {
let here = if cfg!(windows) { "cd" } else { "pwd" };
s.set_operator_hooks(Some(crate::hooks::HookRunner::new(
crate::hooks::HookConfig {
session_start: vec![here.to_string()],
session_end: vec![operator_hook("bye", "", 2)],
session_start: vec![here.into()],
session_end: vec![operator_hook("bye", "", 2).into()],
..crate::hooks::HookConfig::default()
},
)));
Expand Down
2 changes: 1 addition & 1 deletion src/cli/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ mod tests {
let settings = Settings {
mode: Mode::Off,
hooks: Some(crate::hooks::HookRunner::new(crate::hooks::HookConfig {
notification: vec![command],
notification: vec![command.into()],
..crate::hooks::HookConfig::default()
})),
..Settings::default()
Expand Down
2 changes: 1 addition & 1 deletion src/cli/run_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ mod tests {
format!("echo '{out}'; exit {code}")
};
crate::hooks::HookRunner::new(crate::hooks::HookConfig {
user_prompt_submit: vec![command],
user_prompt_submit: vec![command.into()],
..crate::hooks::HookConfig::default()
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/mcp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ mod live {

let mut s = Server::new(InputThread::start().expect("input thread")).with_hooks(
crate::hooks::HookConfig {
pre_tool_use: vec![deny.to_string()],
pre_tool_use: vec![deny.into()],
post_tool_use: Vec::new(),
user_prompt_submit: Vec::new(),
pre_compact: Vec::new(),
Expand Down Expand Up @@ -359,7 +359,7 @@ mod live {
};
let mut s = Server::new(InputThread::start().expect("input thread")).with_hooks(
crate::hooks::HookConfig {
pre_tool_use: vec![allow.to_string()],
pre_tool_use: vec![allow.into()],
post_tool_use: Vec::new(),
user_prompt_submit: Vec::new(),
pre_compact: Vec::new(),
Expand Down
Loading
Loading