@spardutti/claude-skills 2.59.0 → 2.59.1

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.
@@ -62,13 +62,17 @@ function prOf(branch) {
62
62
  }
63
63
 
64
64
  // Agents skip the `pr` call, so a log whose branch has a PR by now is closed at that PR.
65
+ // A PR older than the log was only updated by it, so that log ends at its own last event.
65
66
  function closeOpened(dir, app) {
66
67
  const open = join(dir, "open");
67
68
  for (const f of existsSync(open) ? readdirSync(open).filter((n) => n.startsWith(`${app}__`)) : []) {
68
69
  const path = join(open, f), record = JSON.parse(readFileSync(path, "utf8"));
69
70
  if (!record.gate.length && !record.findings.length) continue;
70
71
  const pr = prOf(record.branch);
71
- if (pr) finalize(dir, path, Object.assign(record, { pr: pr.number }), `pr${pr.number}`, "pr-opened", null, pr.createdAt);
72
+ if (!pr) continue;
73
+ const opened = pr.createdAt >= record.started;
74
+ finalize(dir, path, Object.assign(record, { pr: pr.number }), `pr${pr.number}`,
75
+ opened ? "pr-opened" : "pr-updated", null, opened ? pr.createdAt : lastEvent(record));
72
76
  }
73
77
  }
74
78
 
@@ -2,20 +2,31 @@
2
2
 
3
3
  INPUT=$(cat | tr -d '\n')
4
4
 
5
- case "$INPUT" in
6
- *'"agent_type":"gauntlet-skills"'*) LOG=skill-flags.jsonl ;;
7
- *'\"failure_scenario\"'*) LOG=review-findings.jsonl ;;
8
- *) exit 0 ;;
9
- esac
10
-
11
5
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
12
6
  PROJECT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
7
+ TRANSCRIPT=$(printf '%s' "$INPUT" | grep -o '"agent_transcript_path":"[^"]*"' | head -1 | sed 's/.*:"//; s/"$//')
8
+
9
+ # The SubagentHandback tool carries the report and leaves last_assistant_message empty.
10
+ handback() {
11
+ node -e 'for (const s of require("fs").readFileSync(process.argv[1], "utf8").trim().split("\n").reverse()) {
12
+ let c; try { c = JSON.parse(s).message; } catch { continue; }
13
+ if (c?.role !== "assistant" || !Array.isArray(c.content)) continue;
14
+ const h = c.content.find((x) => x.type === "tool_use" && x.name === "SubagentHandback");
15
+ const t = h ? h.input?.message : c.content.filter((x) => x.type === "text").map((x) => x.text).join("");
16
+ if (t) { process.stdout.write(JSON.stringify(t).slice(1, -1)); break; }
17
+ }' "$1" 2>/dev/null
18
+ }
13
19
 
14
20
  # Kept JSON-escaped as it arrived, so the line stays valid JSON without a parser.
15
21
  REPLY=$(printf '%s' "$INPUT" | sed -nE 's/.*"last_assistant_message":"(([^"\\]|\\.)*)".*/\1/p')
22
+ [ -z "$REPLY" ] && [ -f "$TRANSCRIPT" ] && REPLY=$(handback "$TRANSCRIPT")
16
23
  [ -z "$REPLY" ] && exit 0
17
24
 
18
- TRANSCRIPT=$(printf '%s' "$INPUT" | grep -o '"agent_transcript_path":"[^"]*"' | head -1 | sed 's/.*:"//; s/"$//')
25
+ case "$INPUT" in
26
+ *'"agent_type":"gauntlet-skills"'*) LOG=skill-flags.jsonl ;;
27
+ *) case "$REPLY" in *'\"failure_scenario\"'*) LOG=review-findings.jsonl ;; *) exit 0 ;; esac ;;
28
+ esac
29
+
19
30
  MODEL=""
20
31
  [ -f "$TRANSCRIPT" ] && MODEL=$(grep -o '"model":"[^"]*"' "$TRANSCRIPT" | tail -1 | sed 's/.*:"//; s/"$//')
21
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spardutti/claude-skills",
3
- "version": "2.59.0",
3
+ "version": "2.59.1",
4
4
  "description": "Guardrails for Claude Code — best-practice skills, planning commands, and delivery gates.",
5
5
  "type": "module",
6
6
  "repository": {