@thebassclef/lite 1.0.1 → 1.0.2

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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const version = "1.0.1";
3
+ const version = "1.0.2";
4
4
  exports.version = version;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version: "1.0.1";
1
+ export declare const version: "1.0.2";
2
2
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = "1.0.1";
1
+ const version = "1.0.2";
2
2
  export {
3
3
  version
4
4
  };
@@ -64,6 +64,91 @@ bassclef_detect_self_mode() {
64
64
  return 0
65
65
  }
66
66
 
67
+ # === _sync_install_hooks (goal 14c Step 5) ===
68
+ # Install a hard-coded list of substrate hooks to the operator's
69
+ # ~/.claude/hooks/. For each name: if the source hook declares a
70
+ # # install-class: header, route via lib/hook-installer.sh's
71
+ # install_by_class (which honors operator|project|dual). If no header,
72
+ # fall back to legacy operator-scope copy per ADR-058 c2 grace window
73
+ # (through 2026-10-31).
74
+ #
75
+ # Args:
76
+ # $1 — BASSCLEF_DIR (source of hooks + lib)
77
+ # $2 — user-scope target dir (default $HOME/.claude/hooks)
78
+ #
79
+ # Discipline (per ADR-058 constraints 1-4):
80
+ # c1 — install_by_class wrapped in subshell; lib's strict mode
81
+ # stays contained; caller's strict-mode state preserved
82
+ # c2 — unheadered hooks install where they install today +
83
+ # one trace line `skipped-no-header <hook>` fires
84
+ # c3 — CLAUDE_PROJECT_DIR resolved (git rev-parse fallback) and
85
+ # exported before the loop so project/dual class routing works
86
+ # c4 — settings.json command strings unchanged; wiring self-heal
87
+ # continues at Section 4 (unrelated to this function)
88
+ _sync_install_hooks() {
89
+ local bassclef_dir="$1"
90
+ local user_target_dir="${2:-$HOME/.claude/hooks}"
91
+
92
+ local hook_names=(
93
+ bug-diagnosis.sh
94
+ tool-failure-diagnosis.sh
95
+ trace-helper.sh
96
+ deploy-guard.sh
97
+ memory-write-audit.sh
98
+ turn-prose-kiss-check.sh
99
+ session-end.sh
100
+ bet-doc-gate.sh
101
+ substrate-clarity-gate.sh
102
+ )
103
+
104
+ mkdir -p "$user_target_dir" 2>/dev/null || true
105
+
106
+ local installer_lib="$bassclef_dir/lib/hook-installer.sh"
107
+ local dispatch_available=0
108
+ [ -f "$installer_lib" ] && dispatch_available=1
109
+
110
+ # ADR-058 c3 — resolve CLAUDE_PROJECT_DIR before loop
111
+ if [ -z "${CLAUDE_PROJECT_DIR:-}" ]; then
112
+ if command -v git >/dev/null 2>&1; then
113
+ CLAUDE_PROJECT_DIR="$(git rev-parse --show-toplevel 2>/dev/null || true)"
114
+ fi
115
+ if [ -n "${CLAUDE_PROJECT_DIR:-}" ]; then
116
+ export CLAUDE_PROJECT_DIR
117
+ fi
118
+ fi
119
+
120
+ for hook_name in "${hook_names[@]}"; do
121
+ local hook_src="$bassclef_dir/.claude/hooks/$hook_name"
122
+ if [ ! -f "$hook_src" ]; then
123
+ continue
124
+ fi
125
+
126
+ local has_header=0
127
+ if head -10 "$hook_src" 2>/dev/null | grep -qE '^# install-class:[[:space:]]*(operator|project|dual)[[:space:]]*$'; then
128
+ has_header=1
129
+ fi
130
+
131
+ if [ "$has_header" = "1" ] && [ "$dispatch_available" = "1" ]; then
132
+ # ADR-058 c1 — subshell wraps install_by_class so lib strict
133
+ # mode never leaks into this script. On subshell failure, fall
134
+ # back to legacy operator-scope copy to preserve adopter
135
+ # contract per c4 (settings.json command strings byte-identical).
136
+ # shellcheck disable=SC1090 # dynamic source path
137
+ if ! ( source "$installer_lib" 2>/dev/null && install_by_class "$hook_src" ) >/dev/null 2>&1; then
138
+ cp "$hook_src" "$user_target_dir/" 2>/dev/null || true
139
+ chmod +x "$user_target_dir/$hook_name" 2>/dev/null || true
140
+ fi
141
+ else
142
+ # ADR-058 c2 fallback — grace window through 2026-10-31.
143
+ cp "$hook_src" "$user_target_dir/" 2>/dev/null || true
144
+ chmod +x "$user_target_dir/$hook_name" 2>/dev/null || true
145
+ if [ "$has_header" = "0" ] && command -v trace_log >/dev/null 2>&1; then
146
+ trace_log "ok" "sync-install-hooks-skipped-no-header" "$hook_name"
147
+ fi
148
+ fi
149
+ done
150
+ }
151
+
67
152
  # === Test-mode guard (#915) ===
68
153
  # Tests source this hook to access helpers without triggering main sync.
69
154
  # Early return under BASSCLEF_SYNC_TEST_MODE=1. Helpers defined ABOVE.
@@ -106,13 +191,14 @@ SYNC_NEW=""
106
191
 
107
192
  # === 1. Clone or pull bassclef ===
108
193
  if [ ! -d "$BASSCLEF_DIR/.claude" ]; then
109
- if git clone "$BASSCLEF_REPO" "$BASSCLEF_DIR" 2>/dev/null; then
194
+ if git clone "$BASSCLEF_REPO" "$BASSCLEF_DIR"; then
110
195
  SYNC_STATUS="freshly cloned"
111
196
  else
112
- echo "### BASSCLEF SYNC FAILED"
197
+ echo "### Bassclef sync — full-tier not synced"
113
198
  echo ""
114
- echo "Could not clone bassclef. Skills, rules, and agents unavailable."
115
- echo "Check GitHub auth: is your account connected at claude.ai?"
199
+ echo "Optional: set up GitHub auth to sync the full bassclef substrate."
200
+ echo "Lite tier works without it — your session is fine."
201
+ echo "Skills / rules / agents beyond lite become available once sync succeeds."
116
202
  echo ""
117
203
  exit 0
118
204
  fi
@@ -206,18 +292,14 @@ ${PER_SURFACE}"
206
292
  fi
207
293
 
208
294
  # === 3. Install general hooks to ~/.claude/ ===
209
- # This list MUST be in lock-step with §4's settings.json template +
210
- # any older settings.json that may still wire $HOME paths (per #294).
211
- # Adding session-end.sh because older bassclef versions wired it in
212
- # settings.json; current parking widen would otherwise leave the wiring
213
- # broken on operator machines whose settings.json predates #294.
214
- mkdir -p ~/.claude/hooks 2>/dev/null || true
215
- for HOOK in bug-diagnosis.sh tool-failure-diagnosis.sh trace-helper.sh deploy-guard.sh memory-write-audit.sh turn-prose-kiss-check.sh session-end.sh bet-doc-gate.sh substrate-clarity-gate.sh; do
216
- if [ -f "$BASSCLEF_DIR/.claude/hooks/$HOOK" ]; then
217
- cp "$BASSCLEF_DIR/.claude/hooks/$HOOK" ~/.claude/hooks/ 2>/dev/null || true
218
- chmod +x ~/.claude/hooks/"$HOOK" 2>/dev/null || true
219
- fi
220
- done
295
+ # Delegates to _sync_install_hooks (goal 14c Step 5 per ADR-058).
296
+ # The hard-coded 9-name list that lived here through v0.41.1 moved
297
+ # into the function above. Each hook now routes by its own
298
+ # # install-class: header when declared; unheadered hooks fall back
299
+ # to legacy operator-scope copy per ADR-058 c2 grace window
300
+ # (through 2026-10-31). Section 4 self-heal continues to preserve
301
+ # adopter contract per c4 (settings.json command strings unchanged).
302
+ _sync_install_hooks "$BASSCLEF_DIR" "$HOME/.claude/hooks"
221
303
 
222
304
  # === Install agents to ~/.claude/ ===
223
305
  mkdir -p ~/.claude/agents 2>/dev/null || true
@@ -124,7 +124,7 @@ check_axis_any "Turns" "Turn count" "Turn range" "Turn estimate" \
124
124
  || SIX_MISSING+=("Turns")
125
125
  check_axis_any "Risk" "| *Risk" "🟢" "🟡" "🔴" \
126
126
  || SIX_MISSING+=("Risk")
127
- check_axis_any "Shipping priority" "Priority:" "\bQ1\b" "\bQ2\b" "\bQ3\b" "\bQ4\b" \
127
+ check_axis_any "Shipping priority" "Priority:" "\bP[1-4]\b" "\bQ[1-4]\b" \
128
128
  || SIX_MISSING+=("Shipping priority")
129
129
 
130
130
  # Pick the shape with fewer missing axes; if neither set is complete, that
@@ -267,7 +267,7 @@ if [ "${#MISSING[@]}" -eq 0 ]; then
267
267
  # "same end-state as Option b" do not trigger a false section
268
268
  # boundary. Cure per bassclef-upstream#1421 Option (a). H2+ range
269
269
  # per bassclef-upstream#1532 — options nested under a container H3
270
- # anchor (e.g., `### Compounding value per option`) resolve cleanly
270
+ # anchor (e.g., `### Compounding value recommended only` or the
271
271
  # regardless of nesting depth. H1 excluded by design.
272
272
  SECTION=$(echo "$MESSAGE_TEXT" | awk -v want="$shape" '
273
273
  BEGIN { in_section=0 }
@@ -335,7 +335,7 @@ if [ "${#MISSING[@]}" -eq 0 ]; then
335
335
  || SIX_SECTION_MISSING+=("Turns")
336
336
  echo "$SECTION" | grep -qiE "Risk|🟢|🟡|🔴" \
337
337
  || SIX_SECTION_MISSING+=("Risk")
338
- echo "$SECTION" | grep -qiE "Shipping priority|Priority:|\bQ1\b|\bQ2\b|\bQ3\b|\bQ4\b" \
338
+ echo "$SECTION" | grep -qiE "Shipping priority|Priority:|\bP[1-4]\b|\bQ[1-4]\b" \
339
339
  || SIX_SECTION_MISSING+=("Shipping priority")
340
340
 
341
341
  # Pick the shape with fewer missing per this section. If either set is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thebassclef/lite",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Bassclef CLI — install and upgrade bassclef in your project with two commands.",
5
5
  "keywords": ["bassclef", "claude-code", "cli", "scaffolding"],
6
6
  "homepage": "https://github.com/sunj-labs/bassclef-cli",