@hasna/todos 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +17 -9
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -9137,18 +9137,21 @@ hooks.command("install").description("Install Claude Code hooks for auto-sync").
|
|
|
9137
9137
|
const hookScript = `#!/usr/bin/env bash
|
|
9138
9138
|
# Auto-generated by: todos hooks install
|
|
9139
9139
|
# Syncs todos with Claude Code task list on tool use events.
|
|
9140
|
-
#
|
|
9140
|
+
# Reads session_id and tool_name from the hook JSON stdin.
|
|
9141
9141
|
|
|
9142
|
-
|
|
9142
|
+
INPUT=$(cat)
|
|
9143
9143
|
|
|
9144
|
-
#
|
|
9145
|
-
|
|
9144
|
+
# Extract session_id from stdin JSON (hooks always receive this)
|
|
9145
|
+
SESSION_ID=$(echo "$INPUT" | grep -o '"session_id":"[^"]*"' | head -1 | cut -d'"' -f4 2>/dev/null || true)
|
|
9146
|
+
|
|
9147
|
+
# Task list priority: env override > session ID from hook input
|
|
9148
|
+
TASK_LIST="\${TODOS_CLAUDE_TASK_LIST:-\${CLAUDE_CODE_TASK_LIST_ID:-$SESSION_ID}}"
|
|
9146
9149
|
|
|
9147
9150
|
if [ -z "$TASK_LIST" ]; then
|
|
9148
9151
|
exit 0
|
|
9149
9152
|
fi
|
|
9150
9153
|
|
|
9151
|
-
TOOL_NAME=$(
|
|
9154
|
+
TOOL_NAME=$(echo "$INPUT" | grep -o '"tool_name":"[^"]*"' | head -1 | cut -d'"' -f4 2>/dev/null || true)
|
|
9152
9155
|
|
|
9153
9156
|
case "$TOOL_NAME" in
|
|
9154
9157
|
TaskCreate|TaskUpdate)
|
|
@@ -9175,19 +9178,24 @@ exit 0
|
|
|
9175
9178
|
hooksConfig["PostToolUse"] = [];
|
|
9176
9179
|
}
|
|
9177
9180
|
const postToolUse = hooksConfig["PostToolUse"];
|
|
9178
|
-
const filtered = postToolUse.filter((
|
|
9181
|
+
const filtered = postToolUse.filter((group) => {
|
|
9182
|
+
const groupHooks = group["hooks"];
|
|
9183
|
+
if (!groupHooks)
|
|
9184
|
+
return true;
|
|
9185
|
+
return !groupHooks.some((h) => (h["command"] || "").includes("todos-sync.sh"));
|
|
9186
|
+
});
|
|
9179
9187
|
filtered.push({
|
|
9180
9188
|
matcher: "TaskCreate|TaskUpdate",
|
|
9181
|
-
command: hookPath
|
|
9189
|
+
hooks: [{ type: "command", command: hookPath }]
|
|
9182
9190
|
});
|
|
9183
9191
|
filtered.push({
|
|
9184
9192
|
matcher: "mcp__todos__create_task|mcp__todos__update_task|mcp__todos__complete_task|mcp__todos__start_task",
|
|
9185
|
-
command: hookPath
|
|
9193
|
+
hooks: [{ type: "command", command: hookPath }]
|
|
9186
9194
|
});
|
|
9187
9195
|
hooksConfig["PostToolUse"] = filtered;
|
|
9188
9196
|
writeJsonFile(settingsPath, settings);
|
|
9189
9197
|
console.log(chalk.green(`Claude Code hooks configured in: ${settingsPath}`));
|
|
9190
|
-
console.log(chalk.dim("Task list ID auto-detected from
|
|
9198
|
+
console.log(chalk.dim("Task list ID auto-detected from hook stdin session_id."));
|
|
9191
9199
|
});
|
|
9192
9200
|
program2.command("mcp").description("Start MCP server (stdio)").option("--register <agent>", "Register MCP server with an agent (claude, codex, gemini, all)").option("--unregister <agent>", "Unregister MCP server from an agent (claude, codex, gemini, all)").option("-g, --global", "Register/unregister globally (user-level) instead of project-level").action(async (opts) => {
|
|
9193
9201
|
if (opts.register) {
|