@ivannikov-pro/ai-context-surgeon 1.0.3 → 1.0.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ivannikov-pro/ai-context-surgeon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "AI-native Knowledge API for surgical monorepo restructuring — roles, strategies, prompts, and analysis tools accessible on-demand",
|
|
5
5
|
"files": [
|
|
6
6
|
"bin",
|
|
@@ -75,4 +75,4 @@
|
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=18"
|
|
77
77
|
}
|
|
78
|
-
}
|
|
78
|
+
}
|
|
@@ -33,7 +33,7 @@ for file in $(git diff --name-only "$BASE_REF" -- '*.ts' '*.js' '*.tsx' '*.jsx'
|
|
|
33
33
|
total_changes=$(git diff "$BASE_REF" -- "$file" | grep -cE '^[+-]' || true)
|
|
34
34
|
|
|
35
35
|
if [ "$total_changes" -gt 5 ] && [ "$fnh_diff" -eq 0 ]; then
|
|
36
|
-
echo " ⚠️
|
|
36
|
+
echo " ⚠️ \`$file\`"
|
|
37
37
|
echo " $total_changes lines changed, FNH header unchanged"
|
|
38
38
|
WARN_COUNT=$((WARN_COUNT + 1))
|
|
39
39
|
fi
|
|
@@ -47,7 +47,7 @@ for file in $(git diff --name-only "$BASE_REF" -- '*.md' 2>/dev/null || true); d
|
|
|
47
47
|
# Check if file has a > context line in first 5 lines
|
|
48
48
|
has_fnh=$(head -5 "$file" | grep -c '^>' || true)
|
|
49
49
|
if [ "$has_fnh" -eq 0 ]; then
|
|
50
|
-
echo " ❌
|
|
50
|
+
echo " ❌ \`$file\` — missing FNH (no > blockquote after H1)"
|
|
51
51
|
WARN_COUNT=$((WARN_COUNT + 1))
|
|
52
52
|
fi
|
|
53
53
|
done
|
|
@@ -59,7 +59,7 @@ for file in $(git diff --name-only "$BASE_REF" -- '*.sh' 2>/dev/null || true); d
|
|
|
59
59
|
|
|
60
60
|
has_fnh=$(head -3 "$file" | grep -c '^# Tool:\|^# Script:\|^# Config:' || true)
|
|
61
61
|
if [ "$has_fnh" -eq 0 ]; then
|
|
62
|
-
echo " ❌
|
|
62
|
+
echo " ❌ \`$file\` — missing FNH (no # Tool/Script/Config header)"
|
|
63
63
|
WARN_COUNT=$((WARN_COUNT + 1))
|
|
64
64
|
fi
|
|
65
65
|
done
|
|
@@ -61,7 +61,7 @@ echo "$GOD_FILES" | while read -r line; do
|
|
|
61
61
|
severity="🟡"
|
|
62
62
|
[[ $lines -gt 1000 ]] && severity="🔴"
|
|
63
63
|
[[ $lines -gt 2000 ]] && severity="💀"
|
|
64
|
-
echo "${severity} ${lines} lines —
|
|
64
|
+
echo "${severity} ${lines} lines — \`${file}\`"
|
|
65
65
|
done
|
|
66
66
|
|
|
67
67
|
echo ""
|
package/tools/scan-fnh.sh
CHANGED
|
@@ -73,7 +73,7 @@ if [[ "$SHOW_LEGEND" == true ]]; then
|
|
|
73
73
|
if [[ -n "$INTERNAL_SCOPES" ]]; then
|
|
74
74
|
echo "🔍 Treating scopes as local: $INTERNAL_SCOPES"
|
|
75
75
|
fi
|
|
76
|
-
echo "FORMAT: [LOC L] path/to/file | Semantic Description OR 🔴 [NO FNH] ContextWeight W (L_loc: local_deps, I_glb: global_deps)"
|
|
76
|
+
echo "FORMAT: [LOC L] \`path/to/file\` | Semantic Description OR 🔴 [NO FNH] ContextWeight W (L_loc: local_deps, I_glb: global_deps)"
|
|
77
77
|
echo "───────────────────────────────────────────────────────────────────────────────"
|
|
78
78
|
fi
|
|
79
79
|
|
|
@@ -143,14 +143,14 @@ echo "$FILES" | sort | while read -r FILE; do
|
|
|
143
143
|
# Report Output Formatting
|
|
144
144
|
# Minimal formatting to preserve AI context tokens (no excessive space padding)
|
|
145
145
|
if [[ -n "$DESC" ]]; then
|
|
146
|
-
echo "[$LOC L]
|
|
146
|
+
echo "[$LOC L] \`$FILE\` | $DESC"
|
|
147
147
|
else
|
|
148
148
|
# If standard markdown, just say NO FNH without calculating code context weight
|
|
149
149
|
if [[ "$FILE" == *.md || "$FILE" == *.json || "$FILE" == *.yml || "$FILE" == *.yaml ]]; then
|
|
150
150
|
if [[ $(basename "$FILE") == "README.md" ]]; then
|
|
151
|
-
echo "[$LOC L]
|
|
151
|
+
echo "[$LOC L] \`$FILE\` | ⚠️ [Standard README]"
|
|
152
152
|
else
|
|
153
|
-
echo "[$LOC L]
|
|
153
|
+
echo "[$LOC L] \`$FILE\` | 🔴 [NO FNH]"
|
|
154
154
|
fi
|
|
155
155
|
else
|
|
156
156
|
# If code file, calculate Context Weight as a penalty/diagnostic string!
|
|
@@ -161,7 +161,7 @@ echo "$FILES" | sort | while read -r FILE; do
|
|
|
161
161
|
WEIGHT=$((LOC + (IMPORTS_LOCAL * 20) + (IMPORTS_GLOBAL * 5)))
|
|
162
162
|
|
|
163
163
|
# Print with rich context penalty warning
|
|
164
|
-
echo "[$LOC L]
|
|
164
|
+
echo "[$LOC L] \`$FILE\` | 🔴 [NO FNH] $WEIGHT W (L_loc: $IMPORTS_LOCAL, I_glb: $IMPORTS_GLOBAL)"
|
|
165
165
|
fi
|
|
166
166
|
fi
|
|
167
167
|
|
|
@@ -86,7 +86,7 @@ if [[ -s "$TMP_RESULTS" ]]; then
|
|
|
86
86
|
icon="⚠️ ";
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
printf " %s%s %d W\033[0m (L:%d, I_loc:%d, I_glb:%d)
|
|
89
|
+
printf " %s%s %d W\033[0m (L:%d, I_loc:%d, I_glb:%d) \`%s\`\n", color, icon, weight, loc, i_loc, i_glob, file
|
|
90
90
|
}'
|
|
91
91
|
|
|
92
92
|
echo ""
|