9ccca7a97f
* feat(hooks): add tasks-todowrite-disabler hook to block TodoRead/TodoWrite Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * feat(task-tools): add parallel execution guidance to descriptions Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * refactor(index): migrate task system to experimental.task_system flag Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * docs: update AGENTS.md for experimental task system Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * fix(task-tests): align test field names with Claude Code spec (subject, blockedBy, addBlockedBy) * fix: address Cubic review feedback Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * fix: add optional chaining for tasksTodowriteDisabler null check --------- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
30 lines
776 B
TypeScript
30 lines
776 B
TypeScript
import { BLOCKED_TOOLS, REPLACEMENT_MESSAGE } from "./constants";
|
|
|
|
export interface TasksTodowriteDisablerConfig {
|
|
experimental?: {
|
|
task_system?: boolean;
|
|
};
|
|
}
|
|
|
|
export function createTasksTodowriteDisablerHook(
|
|
config: TasksTodowriteDisablerConfig,
|
|
) {
|
|
const isTaskSystemEnabled = config.experimental?.task_system ?? false;
|
|
|
|
return {
|
|
"tool.execute.before": async (
|
|
input: { tool: string; sessionID: string; callID: string },
|
|
output: { args: Record<string, unknown> },
|
|
) => {
|
|
if (!isTaskSystemEnabled) {
|
|
return;
|
|
}
|
|
|
|
const toolName = input.tool as string;
|
|
if (BLOCKED_TOOLS.some((blocked) => blocked.toLowerCase() === toolName.toLowerCase())) {
|
|
throw new Error(REPLACEMENT_MESSAGE);
|
|
}
|
|
},
|
|
};
|
|
}
|