@the-bearded-bear/claude-craft 3.3.1 → 3.3.2-next.b3cf7c7

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.
@@ -378,6 +378,7 @@ copy_directory() {
378
378
  local src_dir="$1"
379
379
  local dest_dir="$2"
380
380
  local pattern="${3:-*}"
381
+ local exclude="${4:-}" # Optional: filename to exclude
381
382
 
382
383
  if [[ ! -d "$src_dir" ]]; then
383
384
  log_error "${MSG_ERR_DIR_NOT_FOUND} $src_dir"
@@ -387,6 +388,12 @@ copy_directory() {
387
388
 
388
389
  # Process files
389
390
  while IFS= read -r -d '' file; do
391
+ local filename
392
+ filename=$(basename "$file")
393
+ # Skip excluded files
394
+ if [[ -n "$exclude" && "$filename" == "$exclude" ]]; then
395
+ continue
396
+ fi
390
397
  local relative_path="${file#$src_dir/}"
391
398
  local dest_file="$dest_dir/$relative_path"
392
399
  copy_file "$file" "$dest_file"
@@ -447,7 +454,8 @@ install_commands() {
447
454
  local dest_commands="$target_dir/.claude/commands/common"
448
455
 
449
456
  if [[ -d "$src_commands" ]]; then
450
- copy_directory "$src_commands" "$dest_commands" "*.md"
457
+ # Exclude add-technology.md (claude-craft internal command)
458
+ copy_directory "$src_commands" "$dest_commands" "*.md" "add-technology.md"
451
459
  else
452
460
  log_warning "${MSG_COMMANDS_NOT_FOUND} $src_commands"
453
461
  fi
@@ -544,6 +552,10 @@ install_claude_md() {
544
552
  while IFS= read -r cmd_file; do
545
553
  local cmd_name
546
554
  cmd_name=$(basename "$cmd_file" .md)
555
+ # Exclude add-technology (claude-craft internal command)
556
+ if [[ "$cmd_name" == "add-technology" ]]; then
557
+ continue
558
+ fi
547
559
  local cmd_desc
548
560
  cmd_desc=$(grep -m1 "^description:" "$cmd_file" 2>/dev/null | sed 's/^description:[[:space:]]*//' | tr -d '"' | head -c 60)
549
561
  if [[ -n "$cmd_desc" ]]; then
@@ -9,16 +9,17 @@
9
9
 
10
10
  # Configuration defaults
11
11
  CONTEXT_AUTO_COMPACT="${CONTEXT_AUTO_COMPACT:-true}"
12
- CONTEXT_MAX_COMPACTS="${CONTEXT_MAX_COMPACTS:-3}"
12
+ CONTEXT_MAX_COMPACTS="${CONTEXT_MAX_COMPACTS:-5}"
13
13
 
14
14
  # Advanced context management (new features)
15
15
  CONTEXT_OVERFLOW_STRATEGY="${CONTEXT_OVERFLOW_STRATEGY:-new_session}" # new_session, extend, fail
16
- CONTEXT_PREVENTIVE_THRESHOLD="${CONTEXT_PREVENTIVE_THRESHOLD:-90}" # Fallback: Compact at 90% capacity
16
+ CONTEXT_PREVENTIVE_THRESHOLD="${CONTEXT_PREVENTIVE_THRESHOLD:-95}" # Fallback: Compact at 95% capacity
17
+ CONTEXT_MIN_THRESHOLD="${CONTEXT_MIN_THRESHOLD:-50}" # Don't compact if below this %
17
18
  CONTEXT_SMART_RECONSTRUCTION="${CONTEXT_SMART_RECONSTRUCTION:-true}" # Use intelligent reconstruction
18
19
  CONTEXT_MAX_CONTINUATION_SESSIONS="${CONTEXT_MAX_CONTINUATION_SESSIONS:-5}" # Max chained sessions
19
20
 
20
21
  # Note: Strategic compacts (sprint start, task complete) are preferred over % threshold
21
- # The 90% threshold acts as a safety net if strategic compacts miss the window
22
+ # The 95% threshold acts as a safety net if strategic compacts miss the window
22
23
 
23
24
  # External command (default to 'claude' if not set)
24
25
  CLAUDE_COMMAND="${CLAUDE_COMMAND:-claude}"
@@ -82,6 +83,9 @@ init_context_manager() {
82
83
 
83
84
  local max_continuations=$(yq e '.context.max_continuation_sessions // ""' "$CONFIG_FILE" 2>/dev/null)
84
85
  [[ -n "$max_continuations" ]] && CONTEXT_MAX_CONTINUATION_SESSIONS=$max_continuations
86
+
87
+ local min_threshold=$(yq e '.context.min_threshold // ""' "$CONFIG_FILE" 2>/dev/null)
88
+ [[ -n "$min_threshold" ]] && CONTEXT_MIN_THRESHOLD=$min_threshold
85
89
  fi
86
90
 
87
91
  # Initialize sprint progress module if available
@@ -94,6 +98,7 @@ init_context_manager() {
94
98
  print_verbose " - Max compacts: $CONTEXT_MAX_COMPACTS"
95
99
  print_verbose " - Overflow strategy: $CONTEXT_OVERFLOW_STRATEGY"
96
100
  print_verbose " - Preventive threshold: $CONTEXT_PREVENTIVE_THRESHOLD%"
101
+ print_verbose " - Min threshold: $CONTEXT_MIN_THRESHOLD%"
97
102
  print_verbose " - Smart reconstruction: $CONTEXT_SMART_RECONSTRUCTION"
98
103
  }
99
104
 
@@ -111,6 +116,24 @@ run_auto_compact() {
111
116
  return 1
112
117
  fi
113
118
 
119
+ # Check if context is above minimum threshold before compacting
120
+ if [[ "$CONTEXT_MIN_THRESHOLD" -gt 0 ]]; then
121
+ local context_info
122
+ if command -v timeout &> /dev/null; then
123
+ context_info=$(timeout 10s $CLAUDE_COMMAND -p "/context" 2>/dev/null | head -5)
124
+ else
125
+ context_info=$($CLAUDE_COMMAND -p "/context" 2>/dev/null | head -5)
126
+ fi
127
+ local current_usage
128
+ current_usage=$(echo "$context_info" | grep -oP '\d+(?=%)' | head -1)
129
+
130
+ if [[ -n "$current_usage" && "$current_usage" -lt "$CONTEXT_MIN_THRESHOLD" ]]; then
131
+ log_session "$session_id" "INFO" "Context at ${current_usage}% - below minimum threshold (${CONTEXT_MIN_THRESHOLD}%), skipping compact"
132
+ print_verbose "Context at ${current_usage}% - below min threshold (${CONTEXT_MIN_THRESHOLD}%), skipping compact"
133
+ return 1
134
+ fi
135
+ fi
136
+
114
137
  # Check if we've exceeded max compacts
115
138
  if [[ $CONTEXT_COMPACT_COUNT -ge $CONTEXT_MAX_COMPACTS ]]; then
116
139
  log_session "$session_id" "WARN" "Maximum compacts reached ($CONTEXT_MAX_COMPACTS)"
@@ -59,7 +59,8 @@ context:
59
59
  auto_compact: true
60
60
 
61
61
  # Maximum number of compacts per session (safety limit)
62
- max_compacts: 3
62
+ # Increased to 5 to allow longer sprints without interruption
63
+ max_compacts: 5
63
64
 
64
65
  # Strategy when max_compacts is reached:
65
66
  # - "new_session": Create continuation session (recommended for long sprints)
@@ -69,8 +70,14 @@ context:
69
70
 
70
71
  # Preventive compaction threshold (percentage 0-100)
71
72
  # Acts as FALLBACK safety net - strategic compacts (see sprint section) are preferred
72
- # Set to 90% so it only triggers if strategic compacts miss the window
73
- preventive_threshold: 90
73
+ # Set to 95% so it only triggers close to the limit
74
+ preventive_threshold: 95
75
+
76
+ # Minimum context usage threshold (percentage 0-100)
77
+ # Don't trigger reactive compact if context is below this threshold
78
+ # This prevents unnecessary compacts when context is still low
79
+ # Set to 0 to disable this check
80
+ min_threshold: 50
74
81
 
75
82
  # Enable smart context reconstruction after compact
76
83
  # Rebuilds focused context from sprint-progress.md + git + tests
@@ -80,6 +80,7 @@ MSG_CONTEXT_NEW_SESSION="Fortsetzungssitzung wird erstellt"
80
80
  MSG_CONTEXT_EXTEND="Compact-Limit erweitert"
81
81
  MSG_CONTEXT_OVERFLOW_FAIL="Kontextlimit uberschritten, wird gestoppt"
82
82
  MSG_CONTEXT_PREVENTIVE="Kontext bei {0}% - praventives Compact"
83
+ MSG_CONTEXT_BELOW_MIN="Kontext bei {0}% - unter Mindestschwelle ({1}%), Compact ubersprungen"
83
84
  MSG_CONTEXT_CONTINUATION_CREATED="Fortsetzungssitzung erstellt"
84
85
  MSG_CONTEXT_MAX_CONTINUATIONS="Maximale Fortsetzungssitzungen erreicht"
85
86
  MSG_CONTEXT_RECONSTRUCTING="Kontext wird aus Fortschrittsdatei rekonstruiert"
@@ -80,6 +80,7 @@ MSG_CONTEXT_NEW_SESSION="Creating continuation session"
80
80
  MSG_CONTEXT_EXTEND="Extended max compacts"
81
81
  MSG_CONTEXT_OVERFLOW_FAIL="Context limit exceeded, stopping"
82
82
  MSG_CONTEXT_PREVENTIVE="Context at {0}% - running preventive compact"
83
+ MSG_CONTEXT_BELOW_MIN="Context at {0}% - below minimum threshold ({1}%), skipping compact"
83
84
  MSG_CONTEXT_CONTINUATION_CREATED="Continuation session created"
84
85
  MSG_CONTEXT_MAX_CONTINUATIONS="Maximum continuation sessions reached"
85
86
  MSG_CONTEXT_RECONSTRUCTING="Reconstructing context from progress file"
@@ -80,6 +80,7 @@ MSG_CONTEXT_NEW_SESSION="Creando sesion de continuacion"
80
80
  MSG_CONTEXT_EXTEND="Extension del limite de compacts"
81
81
  MSG_CONTEXT_OVERFLOW_FAIL="Limite de contexto excedido, deteniendo"
82
82
  MSG_CONTEXT_PREVENTIVE="Contexto al {0}% - compact preventivo"
83
+ MSG_CONTEXT_BELOW_MIN="Contexto al {0}% - bajo umbral minimo ({1}%), compact omitido"
83
84
  MSG_CONTEXT_CONTINUATION_CREATED="Sesion de continuacion creada"
84
85
  MSG_CONTEXT_MAX_CONTINUATIONS="Maximo de sesiones de continuacion alcanzado"
85
86
  MSG_CONTEXT_RECONSTRUCTING="Reconstruyendo contexto desde archivo de progreso"
@@ -80,6 +80,7 @@ MSG_CONTEXT_NEW_SESSION="Creation de session de continuation"
80
80
  MSG_CONTEXT_EXTEND="Extension de la limite de compacts"
81
81
  MSG_CONTEXT_OVERFLOW_FAIL="Limite de contexte depassee, arret"
82
82
  MSG_CONTEXT_PREVENTIVE="Contexte a {0}% - compact preventif"
83
+ MSG_CONTEXT_BELOW_MIN="Contexte a {0}% - en dessous du seuil minimum ({1}%), compact ignore"
83
84
  MSG_CONTEXT_CONTINUATION_CREATED="Session de continuation creee"
84
85
  MSG_CONTEXT_MAX_CONTINUATIONS="Nombre maximum de sessions de continuation atteint"
85
86
  MSG_CONTEXT_RECONSTRUCTING="Reconstruction du contexte depuis le fichier de progres"
@@ -80,6 +80,7 @@ MSG_CONTEXT_NEW_SESSION="Criando sessao de continuacao"
80
80
  MSG_CONTEXT_EXTEND="Limite de compacts estendido"
81
81
  MSG_CONTEXT_OVERFLOW_FAIL="Limite de contexto excedido, parando"
82
82
  MSG_CONTEXT_PREVENTIVE="Contexto em {0}% - compact preventivo"
83
+ MSG_CONTEXT_BELOW_MIN="Contexto em {0}% - abaixo do limite minimo ({1}%), compact ignorado"
83
84
  MSG_CONTEXT_CONTINUATION_CREATED="Sessao de continuacao criada"
84
85
  MSG_CONTEXT_MAX_CONTINUATIONS="Maximo de sessoes de continuacao atingido"
85
86
  MSG_CONTEXT_RECONSTRUCTING="Reconstruindo contexto do arquivo de progresso"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-bearded-bear/claude-craft",
3
- "version": "3.3.1",
3
+ "version": "3.3.2-next.b3cf7c7",
4
4
  "description": "A comprehensive framework for AI-assisted development with Claude Code. Install standardized rules, agents, and commands for your projects.",
5
5
  "main": "cli/index.js",
6
6
  "bin": {