agent-harness-kit 0.10.2 → 0.11.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.
Files changed (28) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +13 -5
  4. package/package.json +3 -2
  5. package/src/core/render-templates.mjs +31 -3
  6. package/src/templates/.claude/keybindings.json.example +20 -0
  7. package/src/templates/.claude/skills/deliver-html/SKILL.md.hbs +5 -1
  8. package/src/templates/.claude/skills/deliver-html/SKILL.md.vi.hbs +5 -1
  9. package/src/templates/.claude/skills/deliver-html/scripts/wrap-html.mjs +0 -0
  10. package/src/templates/.claude/skills/setup-nightly-eval/SKILL.md +118 -0
  11. package/src/templates/docs/env-vars.md +54 -0
  12. package/src/templates/docs/memory-cheatsheet.md +82 -0
  13. package/src/templates/scripts/_lib/jp.sh +53 -0
  14. package/src/templates/scripts/_lib/statusline-cache.mjs +57 -0
  15. package/src/templates/scripts/_lib/telemetry.sh +45 -0
  16. package/src/templates/scripts/notify-on-block.sh.hbs +6 -23
  17. package/src/templates/scripts/pre-compact.sh.hbs +2 -20
  18. package/src/templates/scripts/pre-push.sh +2 -20
  19. package/src/templates/scripts/precompletion-checklist.sh.hbs +5 -31
  20. package/src/templates/scripts/pretooluse-bash-guard.sh.hbs +2 -20
  21. package/src/templates/scripts/pretooluse-edit-guard.sh.hbs +2 -14
  22. package/src/templates/scripts/session-end.sh.hbs +2 -14
  23. package/src/templates/scripts/session-start.sh.hbs +2 -20
  24. package/src/templates/scripts/statusline.mjs +327 -36
  25. package/src/templates/scripts/structural-test-on-edit.sh.hbs +2 -14
  26. package/src/templates/scripts/subagent-stop.sh.hbs +7 -18
  27. package/src/templates/scripts/telemetry-on-skill.sh +14 -20
  28. package/src/templates/scripts/userprompt-guard.sh.hbs +2 -20
@@ -14,20 +14,9 @@ set -eo pipefail
14
14
 
15
15
  INPUT=$(cat)
16
16
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
17
- have_jq() {
18
- [ "${AHK_DISABLE_JQ:-}" = "1" ] && return 1
19
- command -v jq >/dev/null 2>&1
20
- }
21
- have_jp() {
22
- have_jq && return 0
23
- command -v node >/dev/null 2>&1 && [ -f "$SCRIPT_DIR/_lib/json-pick.mjs" ] && return 0
24
- return 1
25
- }
26
- jp() {
27
- if have_jq; then jq -r "$1"
28
- else node "$SCRIPT_DIR/_lib/json-pick.mjs" "$1"
29
- fi
30
- }
17
+ _LIB_DIR="$SCRIPT_DIR/_lib"
18
+ . "$_LIB_DIR/jp.sh"
19
+ . "$_LIB_DIR/telemetry.sh"
31
20
 
32
21
  SUBAGENT="(unknown)"
33
22
  if have_jp; then
@@ -35,12 +24,12 @@ if have_jp; then
35
24
  fi
36
25
 
37
26
  # Telemetry first so we record every subagent boundary, even if the
38
- # structural-test bails below.
39
- mkdir -p .harness
27
+ # structural-test bails below. telemetry_append handles rotation.
40
28
  TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
41
29
  SHA=$(git rev-parse --short HEAD 2>/dev/null || echo 'no-git')
42
- printf '{"ts":"%s","event":"subagent_stop","subagent":"%s","sha":"%s"}\n' \
43
- "$TS" "$SUBAGENT" "$SHA" >> .harness/telemetry.jsonl
30
+ LINE=$(printf '{"ts":"%s","event":"subagent_stop","subagent":"%s","sha":"%s"}' \
31
+ "$TS" "$SUBAGENT" "$SHA")
32
+ telemetry_append "$LINE"
44
33
 
45
34
  # Skip if structural test disabled.
46
35
  if [ -f harness.config.json ] \
@@ -8,25 +8,20 @@
8
8
  # v0.7: migrated from `command -v jq` fail-open gate to the kit's jp() helper
9
9
  # so the telemetry record still gets written on jq-less CI / Windows. Without
10
10
  # the migration, telemetry quietly went dark anywhere jq wasn't installed.
11
+ # v0.10.3: jp/have_jq/have_jp extracted to _lib/jp.sh; AHK_DISABLE_TELEMETRY
12
+ # opt-out + AHK_TELEMETRY_MAX_LINES rotation added.
11
13
  set -e
12
14
 
15
+ # Opt-out: respect AHK_DISABLE_TELEMETRY=1 before reading stdin so the user
16
+ # can fully disable observability without removing the hook from settings.
17
+ [ "${AHK_DISABLE_TELEMETRY:-}" = "1" ] && exit 0
18
+
13
19
  INPUT=$(cat)
14
20
 
15
21
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
16
- have_jq() {
17
- [ "${AHK_DISABLE_JQ:-}" = "1" ] && return 1
18
- command -v jq >/dev/null 2>&1
19
- }
20
- have_jp() {
21
- have_jq && return 0
22
- command -v node >/dev/null 2>&1 && [ -f "$SCRIPT_DIR/_lib/json-pick.mjs" ] && return 0
23
- return 1
24
- }
25
- jp() {
26
- if have_jq; then jq -r "$1"
27
- else node "$SCRIPT_DIR/_lib/json-pick.mjs" "$1"
28
- fi
29
- }
22
+ _LIB_DIR="$SCRIPT_DIR/_lib"
23
+ . "$_LIB_DIR/jp.sh"
24
+ . "$_LIB_DIR/telemetry.sh"
30
25
  if ! have_jp; then exit 0; fi
31
26
 
32
27
  TOOL=$(echo "$INPUT" | jp '.tool_name // empty')
@@ -35,14 +30,13 @@ TOOL=$(echo "$INPUT" | jp '.tool_name // empty')
35
30
  SKILL=$(echo "$INPUT" | jp '.tool_input.skill // empty')
36
31
  [ -z "$SKILL" ] && exit 0
37
32
 
38
- mkdir -p .harness
39
33
  TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
40
34
  SHA=$(git rev-parse --short HEAD 2>/dev/null || echo 'no-git')
41
35
 
42
36
  # Compose JSONL line by hand — same shape as the previous jq-built record.
43
- # Quoting via printf '%s' so embedded spaces in skill names don't break the
44
- # line. Skill names are constrained to `[a-z0-9-]+` upstream so we don't
45
- # need full JSON escaping here.
46
- printf '{"ts":"%s","event":"skill_invoked","skill":"%s","sha":"%s"}\n' \
47
- "$TS" "$SKILL" "$SHA" >> .harness/telemetry.jsonl
37
+ # Skill names are constrained to `[a-z0-9-]+` upstream so we don't need full
38
+ # JSON escaping here. telemetry_append handles mkdir, append, and rotation.
39
+ LINE=$(printf '{"ts":"%s","event":"skill_invoked","skill":"%s","sha":"%s"}' \
40
+ "$TS" "$SKILL" "$SHA")
41
+ telemetry_append "$LINE"
48
42
  exit 0
@@ -14,26 +14,8 @@ set -eo pipefail
14
14
 
15
15
  INPUT=$(cat)
16
16
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
17
- have_jq() {
18
- [ "${AHK_DISABLE_JQ:-}" = "1" ] && return 1
19
- command -v jq >/dev/null 2>&1
20
- }
21
- have_jp() {
22
- have_jq && return 0
23
- command -v node >/dev/null 2>&1 && [ -f "$SCRIPT_DIR/_lib/json-pick.mjs" ] && return 0
24
- return 1
25
- }
26
- jp() {
27
- if have_jq; then
28
- if [ -n "$2" ]; then jq -r "$1" "$2"; else jq -r "$1"; fi
29
- else
30
- if [ -n "$2" ]; then
31
- node "$SCRIPT_DIR/_lib/json-pick.mjs" "$1" "$2"
32
- else
33
- node "$SCRIPT_DIR/_lib/json-pick.mjs" "$1"
34
- fi
35
- fi
36
- }
17
+ _LIB_DIR="$SCRIPT_DIR/_lib"
18
+ . "$_LIB_DIR/jp.sh"
37
19
 
38
20
  if ! have_jp; then
39
21
  exit 0