cc-dev-template 0.1.65 → 0.1.66
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/bin/install.js
CHANGED
|
@@ -254,8 +254,6 @@ if (fs.existsSync(mergeSettingsPath)) {
|
|
|
254
254
|
const configs = [
|
|
255
255
|
{ file: 'read-guard-hook.json', name: 'Context guard for large reads' },
|
|
256
256
|
{ file: 'statusline-config.json', name: 'Custom status line' },
|
|
257
|
-
{ file: 'bash-overflow-hook.json', name: 'Bash overflow guard hook' },
|
|
258
|
-
{ file: 'env-config.json', name: 'Environment variables' },
|
|
259
257
|
// Spinner verbs - choose one (Helldivers or Factorio)
|
|
260
258
|
{ file: 'spinner-verbs-helldivers.json', name: 'Helldivers spinner verbs' }
|
|
261
259
|
// { file: 'spinner-verbs-factorio.json', name: 'Factorio spinner verbs' }
|
|
@@ -310,7 +308,10 @@ deprecatedMcpServers.forEach(server => {
|
|
|
310
308
|
const deprecatedFiles = [
|
|
311
309
|
path.join(CLAUDE_DIR, 'hooks', 'bash-precheck.sh'),
|
|
312
310
|
path.join(CLAUDE_DIR, 'hooks', 'bash-wrapper-helper.sh'),
|
|
313
|
-
path.join(CLAUDE_DIR, 'scripts', 'bash-precheck-hook.json')
|
|
311
|
+
path.join(CLAUDE_DIR, 'scripts', 'bash-precheck-hook.json'),
|
|
312
|
+
path.join(CLAUDE_DIR, 'hooks', 'bash-overflow-guard.sh'),
|
|
313
|
+
path.join(CLAUDE_DIR, 'scripts', 'bash-overflow-hook.json'),
|
|
314
|
+
path.join(CLAUDE_DIR, 'scripts', 'env-config.json')
|
|
314
315
|
];
|
|
315
316
|
|
|
316
317
|
deprecatedFiles.forEach(file => {
|
|
@@ -354,6 +355,43 @@ if (fs.existsSync(settingsFile)) {
|
|
|
354
355
|
});
|
|
355
356
|
}
|
|
356
357
|
|
|
358
|
+
// Remove bash-overflow-guard hooks from settings
|
|
359
|
+
if (settings.hooks) {
|
|
360
|
+
['PostToolUse'].forEach(hookType => {
|
|
361
|
+
if (settings.hooks[hookType] && Array.isArray(settings.hooks[hookType])) {
|
|
362
|
+
const originalLength = settings.hooks[hookType].length;
|
|
363
|
+
settings.hooks[hookType] = settings.hooks[hookType].filter(hook => {
|
|
364
|
+
const command = hook.hooks?.[0]?.command || '';
|
|
365
|
+
return !command.includes('bash-overflow-guard');
|
|
366
|
+
});
|
|
367
|
+
if (settings.hooks[hookType].length < originalLength) {
|
|
368
|
+
console.log(`✓ Removed deprecated bash-overflow-guard hook from ${hookType}`);
|
|
369
|
+
settingsModified = true;
|
|
370
|
+
cleanupPerformed = true;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Remove BASH_MAX_OUTPUT_LENGTH from env
|
|
377
|
+
if (settings.env && settings.env.BASH_MAX_OUTPUT_LENGTH !== undefined) {
|
|
378
|
+
delete settings.env.BASH_MAX_OUTPUT_LENGTH;
|
|
379
|
+
console.log('✓ Removed deprecated BASH_MAX_OUTPUT_LENGTH env var');
|
|
380
|
+
settingsModified = true;
|
|
381
|
+
cleanupPerformed = true;
|
|
382
|
+
// Remove env object if empty
|
|
383
|
+
if (Object.keys(settings.env).length === 0) {
|
|
384
|
+
delete settings.env;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Set subagent model to Opus
|
|
389
|
+
if (!settings.env) settings.env = {};
|
|
390
|
+
if (settings.env.CLAUDE_CODE_SUBAGENT_MODEL !== 'opus') {
|
|
391
|
+
settings.env.CLAUDE_CODE_SUBAGENT_MODEL = 'opus';
|
|
392
|
+
console.log('✓ Set CLAUDE_CODE_SUBAGENT_MODEL=opus');
|
|
393
|
+
settingsModified = true;
|
|
394
|
+
}
|
|
357
395
|
|
|
358
396
|
if (settingsModified) {
|
|
359
397
|
fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2));
|
package/package.json
CHANGED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# bash-overflow-guard.sh - Intercept large Bash outputs to preserve context
|
|
3
|
-
#
|
|
4
|
-
# PostToolUse hook that catches large Bash outputs, saves them to a file,
|
|
5
|
-
# and tells Claude to use Grep to search the file instead of consuming context.
|
|
6
|
-
|
|
7
|
-
set -e
|
|
8
|
-
|
|
9
|
-
# Configuration
|
|
10
|
-
MAX_CHARS=${BASH_OVERFLOW_MAX_CHARS:-20000} # ~5k tokens
|
|
11
|
-
OVERFLOW_DIR="${HOME}/.claude/bash-overflow"
|
|
12
|
-
|
|
13
|
-
# Read hook input from stdin
|
|
14
|
-
input=$(cat)
|
|
15
|
-
|
|
16
|
-
# Parse the tool response
|
|
17
|
-
tool_name=$(echo "$input" | jq -r '.tool_name // empty')
|
|
18
|
-
|
|
19
|
-
# Only process Bash tool
|
|
20
|
-
if [[ "$tool_name" != "Bash" ]]; then
|
|
21
|
-
exit 0
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
# Extract stdout from the response
|
|
25
|
-
# tool_response can be a string or object depending on output
|
|
26
|
-
stdout=$(echo "$input" | jq -r '.tool_response // empty')
|
|
27
|
-
|
|
28
|
-
# If tool_response is an object, try to get stdout field
|
|
29
|
-
if echo "$stdout" | jq -e 'type == "object"' > /dev/null 2>&1; then
|
|
30
|
-
stdout=$(echo "$stdout" | jq -r '.stdout // .output // empty')
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# Measure size
|
|
34
|
-
char_count=${#stdout}
|
|
35
|
-
line_count=$(echo "$stdout" | wc -l | tr -d ' ')
|
|
36
|
-
|
|
37
|
-
# Check if output exceeds threshold
|
|
38
|
-
if [[ $char_count -gt $MAX_CHARS ]]; then
|
|
39
|
-
# Create overflow directory
|
|
40
|
-
mkdir -p "$OVERFLOW_DIR"
|
|
41
|
-
|
|
42
|
-
# Generate filename with timestamp
|
|
43
|
-
timestamp=$(date +%Y%m%d_%H%M%S)
|
|
44
|
-
overflow_file="$OVERFLOW_DIR/bash_output_${timestamp}.txt"
|
|
45
|
-
|
|
46
|
-
# Save output to file
|
|
47
|
-
echo "$stdout" > "$overflow_file"
|
|
48
|
-
|
|
49
|
-
# Calculate approximate token count (rough heuristic: 4 chars per token)
|
|
50
|
-
approx_tokens=$((char_count / 4))
|
|
51
|
-
|
|
52
|
-
# Return block decision with guidance
|
|
53
|
-
cat << EOF
|
|
54
|
-
{
|
|
55
|
-
"decision": "block",
|
|
56
|
-
"reason": "Bash output too large for context (${line_count} lines, ~${approx_tokens} tokens). Output saved to: ${overflow_file}\n\nUse the Grep tool to search this file:\n Grep(pattern: \"your-pattern\", path: \"${overflow_file}\")\n\nOr read specific sections:\n Read(file_path: \"${overflow_file}\", offset: 1, limit: 100)"
|
|
57
|
-
}
|
|
58
|
-
EOF
|
|
59
|
-
exit 0
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
# Output is small enough, allow it through
|
|
63
|
-
exit 0
|