@softspark/ai-toolkit 1.3.4 → 1.3.6

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/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ Versioning follows [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ---
9
9
 
10
+ ## v1.3.6 — Patch (2026-04-07)
11
+
12
+ ### Fixed
13
+ - **Tests updated**: All hook tests now pass stdin JSON instead of env vars (matching hook changes from v1.3.5). 327/327 tests pass.
14
+
15
+ ---
16
+
17
+ ## v1.3.5 — Patch (2026-04-07)
18
+
19
+ ### Fixed
20
+ - **Stats not counting**: `track-usage.sh` and `user-prompt-submit.sh` now read prompt from stdin JSON (`.prompt` field) instead of non-existent `CLAUDE_USER_PROMPT` env var. Skill invocations are now properly tracked in `~/.ai-toolkit/stats.json`.
21
+
22
+ ---
23
+
10
24
  ## v1.3.4 — Patch (2026-04-07)
11
25
 
12
26
  ### Fixed
@@ -8,8 +8,10 @@
8
8
  # shellcheck source=_profile-check.sh
9
9
  source "$(dirname "$0")/_profile-check.sh"
10
10
 
11
- FILE_PATH="${CLAUDE_TOOL_INPUT_FILE_PATH:-}"
12
- TOOL_NAME="${CLAUDE_TOOL_NAME:-unknown}"
11
+ # Read from stdin (Claude Code passes JSON with .tool_name, .tool_input)
12
+ INPUT=$(cat)
13
+ TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // "unknown"' 2>/dev/null)
14
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
13
15
 
14
16
  if [ -z "$FILE_PATH" ]; then
15
17
  echo "PostToolUse: ${TOOL_NAME} completed. Consider validating lint, tests, and docs if behavior changed."
@@ -11,8 +11,11 @@ source "$(dirname "$0")/_profile-check.sh"
11
11
  SAVE_DIR="$HOME/.ai-toolkit/compactions"
12
12
  mkdir -p "$SAVE_DIR"
13
13
 
14
+ # Read from stdin (Claude Code passes JSON with .session_id)
15
+ INPUT=$(cat)
14
16
  TIMESTAMP=$(date -u +"%Y-%m-%d_%H-%M-%S")
15
- SESSION="${CLAUDE_SESSION_ID:-$$}"
17
+ SESSION=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
18
+ [ -z "$SESSION" ] && SESSION="$$"
16
19
  SAVE_FILE="$SAVE_DIR/${TIMESTAMP}_${SESSION}.txt"
17
20
 
18
21
  # Gather context
@@ -7,17 +7,22 @@
7
7
  # shellcheck source=_profile-check.sh
8
8
  source "$(dirname "$0")/_profile-check.sh"
9
9
 
10
+ # Read from stdin (Claude Code passes JSON with .session_id, .last_assistant_message)
11
+ INPUT=$(cat)
12
+ SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
13
+ LAST_MSG=$(echo "$INPUT" | jq -r '.last_assistant_message // "No summary available"' 2>/dev/null | head -5)
14
+
10
15
  SESSION_FILE=".claude/session-context.md"
11
16
 
12
- if [ -n "${CLAUDE_SESSION_ID:-}" ]; then
17
+ if [ -n "$SESSION_ID" ]; then
13
18
  mkdir -p .claude
14
19
  cat > "$SESSION_FILE" << EOF
15
20
  # Session Context
16
21
  Updated: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
17
- Session: ${CLAUDE_SESSION_ID:-unknown}
22
+ Session: ${SESSION_ID}
18
23
 
19
- ## Last Active Task
20
- ${CLAUDE_TASK_DESCRIPTION:-No task description available}
24
+ ## Last Assistant Message
25
+ ${LAST_MSG}
21
26
  EOF
22
27
  fi
23
28
 
@@ -8,7 +8,10 @@
8
8
  # shellcheck source=_profile-check.sh
9
9
  source "$(dirname "$0")/_profile-check.sh"
10
10
 
11
- SESSION="${CLAUDE_SESSION_ID:-$$}"
11
+ # Read from stdin (Claude Code passes JSON with .session_id)
12
+ INPUT=$(cat)
13
+ SESSION=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
14
+ [ -z "$SESSION" ] && SESSION="$$"
12
15
  SESSIONS_DIR="$HOME/.ai-toolkit/sessions"
13
16
  mkdir -p "$SESSIONS_DIR"
14
17
 
@@ -8,9 +8,11 @@
8
8
  # shellcheck source=_profile-check.sh
9
9
  source "$(dirname "$0")/_profile-check.sh"
10
10
 
11
- SUBAGENT="${CLAUDE_SUBAGENT_NAME:-${CLAUDE_TOOL_INPUT_SUBAGENT_TYPE:-subagent}}"
11
+ # Read from stdin (Claude Code passes JSON with .agent_id, .agent_type)
12
+ INPUT=$(cat)
13
+ AGENT_TYPE=$(echo "$INPUT" | jq -r '.agent_type // "subagent"' 2>/dev/null)
12
14
 
13
- echo "SubagentStart: ${SUBAGENT} owns a narrow scope. Read only the necessary files first, cite evidence, and return explicit validation notes with any edits."
15
+ echo "SubagentStart: ${AGENT_TYPE} owns a narrow scope. Read only the necessary files first, cite evidence, and return explicit validation notes with any edits."
14
16
 
15
17
  exit 0
16
18
 
@@ -8,9 +8,11 @@
8
8
  # shellcheck source=_profile-check.sh
9
9
  source "$(dirname "$0")/_profile-check.sh"
10
10
 
11
- SUBAGENT="${CLAUDE_SUBAGENT_NAME:-${CLAUDE_TOOL_INPUT_SUBAGENT_TYPE:-subagent}}"
11
+ # Read from stdin (Claude Code passes JSON with .agent_id, .agent_type)
12
+ INPUT=$(cat)
13
+ AGENT_TYPE=$(echo "$INPUT" | jq -r '.agent_type // "subagent"' 2>/dev/null)
12
14
 
13
- echo "SubagentStop: ${SUBAGENT} should report findings, exact files touched, tests run, remaining risks, and any docs that must be updated by the lead agent."
15
+ echo "SubagentStop: ${AGENT_TYPE} should report findings, exact files touched, tests run, remaining risks, and any docs that must be updated by the lead agent."
14
16
 
15
17
  exit 0
16
18
 
@@ -8,7 +8,11 @@
8
8
  # Uses atomic write via python3 os.replace() to prevent corruption.
9
9
 
10
10
  STATS_FILE="${HOME}/.ai-toolkit/stats.json"
11
- PROMPT_TEXT="${CLAUDE_USER_PROMPT:-${CLAUDE_PROMPT:-}}"
11
+
12
+ # Read prompt from stdin (Claude Code passes JSON with .prompt field)
13
+ INPUT=$(cat)
14
+ PROMPT_TEXT=$(echo "$INPUT" | jq -r '.prompt // empty' 2>/dev/null)
15
+ [ -z "$PROMPT_TEXT" ] && exit 0
12
16
 
13
17
  # Only track if prompt starts with a slash command
14
18
  SKILL_NAME=$(printf '%s' "$PROMPT_TEXT" | grep -oE '^/[a-z][a-z0-9-]*' | head -1 | sed 's|^/||')
@@ -8,7 +8,9 @@
8
8
  # shellcheck source=_profile-check.sh
9
9
  source "$(dirname "$0")/_profile-check.sh"
10
10
 
11
- PROMPT_TEXT="${CLAUDE_USER_PROMPT:-${CLAUDE_PROMPT:-}}"
11
+ # Read prompt from stdin (Claude Code passes JSON with .prompt field)
12
+ INPUT=$(cat)
13
+ PROMPT_TEXT=$(echo "$INPUT" | jq -r '.prompt // empty' 2>/dev/null)
12
14
  LOWERED="$(printf '%s' "$PROMPT_TEXT" | tr '[:upper:]' '[:lower:]')"
13
15
 
14
16
  echo "STOP. Execute Step 0 before responding: check your CLAUDE.md for search-first rules. If search-first rules exist, call the required search tool NOW — before any other tool or text output. If you skip this step, the user will interrupt you."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softspark/ai-toolkit",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Professional-grade AI coding toolkit: 90 skills, 44 agents, multi-platform support (Claude, Cursor, Windsurf, Copilot, Gemini, Cline, Roo Code, Aider, Augment), machine-enforced safety constitution, persona presets, skill security auditor, expanded lifecycle hooks, 11 plugin packs, and benchmark tooling.",
5
5
  "keywords": [
6
6
  "claude",