@chemx/starter-kit 26.9.26-253 → 26.9.28-1234

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.
@@ -66,8 +66,8 @@ MIN_SCORE="${CHEMX_MIN_SCORE:-${CONF_MIN_SCORE:-80}}"
66
66
  MAX_LINES="${CHEMX_MAX_LINES:-${CONF_MAX_LINES:-500}}"
67
67
  MAX_MOLECULE_LINES="${CHEMX_MAX_MOLECULE_LINES:-${CONF_MAX_MOL:-100}}"
68
68
 
69
- # Detect staged source files
70
- STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(jsx?|tsx?|vue|svelte)$' | grep -vE '(\.d\.ts|\.min\.|\.test\.|\.spec\.)')
69
+ # Detect staged source files (including polyglot C#, Python, Go)
70
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(jsx?|tsx?|vue|svelte|cs|py|go)$' | grep -vE '(\.(d\.ts|min\.|test\.|spec\.))')
71
71
 
72
72
  if [ -z "$STAGED_FILES" ]; then
73
73
  exit 0
@@ -75,6 +75,7 @@ fi
75
75
 
76
76
  LINE_BUDGET_FAILED=0
77
77
  LINE_BUDGET_ERRORS=""
78
+ EXCEEDED_FILES=""
78
79
 
79
80
  for FILE in $STAGED_FILES; do
80
81
  if [ -f "$FILE" ]; then
@@ -86,12 +87,14 @@ for FILE in $STAGED_FILES; do
86
87
  if [ "$LINES" -gt "$MAX_MOLECULE_LINES" ]; then
87
88
  LINE_BUDGET_FAILED=1
88
89
  LINE_BUDGET_ERRORS="${LINE_BUDGET_ERRORS}\n ${C_RED}✕${C_RESET} $FILE ($LINES LOC > $MAX_MOLECULE_LINES LOC molecule capsule limit)"
90
+ EXCEEDED_FILES="${EXCEEDED_FILES}\n- $FILE ($LINES LOC > $MAX_MOLECULE_LINES LOC molecule limit)"
89
91
  fi
90
92
  ;;
91
93
  *)
92
94
  if [ "$LINES" -gt "$MAX_LINES" ]; then
93
95
  LINE_BUDGET_FAILED=1
94
96
  LINE_BUDGET_ERRORS="${LINE_BUDGET_ERRORS}\n ${C_RED}✕${C_RESET} $FILE ($LINES LOC > $MAX_LINES LOC file budget)"
97
+ EXCEEDED_FILES="${EXCEEDED_FILES}\n- $FILE ($LINES LOC > $MAX_LINES LOC file budget)"
95
98
  fi
96
99
  ;;
97
100
  esac
@@ -101,8 +104,17 @@ done
101
104
  if [ "$LINE_BUDGET_FAILED" -eq 1 ]; then
102
105
  printf "\n%s%s[Chemical X] Commit Blocked: Staged files exceed architectural line budgets%s\n" "$C_BOLD" "$C_RED" "$C_RESET"
103
106
  printf "%b\n\n" "$LINE_BUDGET_ERRORS"
104
- printf "%sMonolithic files degrade AI context windows and cause hallucination loops.%s\n" "$C_YELLOW" "$C_RESET"
105
- printf "Decompose large files into single-purpose crystalline capsules before committing.\n\n"
107
+ printf "%s╭──────────────────────────────────────────────────────────────────────────╮%s\n" "$C_CYAN" "$C_RESET"
108
+ printf "%s│ 🤖 AI REFACTOR PROMPT (Copy & paste into your AI assistant): │%s\n" "$C_CYAN" "$C_RESET"
109
+ printf "%s╰──────────────────────────────────────────────────────────────────────────╯%s\n" "$C_CYAN" "$C_RESET"
110
+ printf "Please refactor the following files that exceed Chemical X line budgets:%b\n\n" "$EXCEEDED_FILES"
111
+ printf "Refactor Directives:\n"
112
+ printf "1. Decompose monolithic logic into single-purpose crystalline capsules or helper modules (< %s lines for files, < %s lines for molecules).\n" "$MAX_LINES" "$MAX_MOLECULE_LINES"
113
+ printf "2. Extract presentation into Table-of-Contents views and business state into composables/services.\n"
114
+ printf "3. Preserve all existing symbols, exports, and public API contracts.\n"
115
+ printf "4. Decompose complex inline booleans and flatten nested control flow.\n"
116
+ printf "%s────────────────────────────────────────────────────────────────────────────%s\n\n" "$C_CYAN" "$C_RESET"
117
+ printf "%s💡 Tip: To bypass line budgets temporarily: CHEMX_SKIP_PRECOMMIT=1 git commit%s\n\n" "$C_YELLOW" "$C_RESET"
106
118
  exit 1
107
119
  fi
108
120
 
@@ -127,8 +139,18 @@ if [ -n "$AUDIT_BIN" ]; then
127
139
  if ! AUDIT_OUT=$(eval "$AUDIT_CMD < /dev/null" 2>&1); then
128
140
  printf "\n%s%s[Chemical X] Commit Blocked: Architectural health verification failed%s\n" "$C_BOLD" "$C_RED" "$C_RESET"
129
141
  printf "%s\n\n" "$AUDIT_OUT"
130
- printf "%s💡 Tip: Want crystalline drop-in templates to refactor in minutes?%s\n" "$C_CYAN" "$C_RESET"
131
- printf " Run 'npm create chemx' or sponsor at https://github.com/sponsors/Chemical-X-Protocol\n\n"
142
+ printf "%s╭──────────────────────────────────────────────────────────────────────────╮%s\n" "$C_CYAN" "$C_RESET"
143
+ printf "%s│ 🤖 AI REFACTOR PROMPT (Copy & paste into your AI assistant): │%s\n" "$C_CYAN" "$C_RESET"
144
+ printf "%s╰──────────────────────────────────────────────────────────────────────────╯%s\n" "$C_CYAN" "$C_RESET"
145
+ printf "Please fix the Chemical X architectural hazards reported above in staged files.\n\n"
146
+ printf "Refactor Directives:\n"
147
+ printf "1. Surgically resolve each flagged Critical and High severity hazard.\n"
148
+ printf "2. Decompose monoliths into single-purpose crystalline capsules.\n"
149
+ printf "3. Preserve all existing symbols, exports, and test contracts.\n"
150
+ printf "4. Verify with 'chemx audit' after making changes.\n"
151
+ printf "%s────────────────────────────────────────────────────────────────────────────%s\n\n" "$C_CYAN" "$C_RESET"
152
+ printf "%s💡 Tip: Run 'chemx audit' locally to inspect details or run autofixes.%s\n" "$C_CYAN" "$C_RESET"
153
+ printf " To bypass this check temporarily: CHEMX_SKIP_PRECOMMIT=1 git commit\n\n"
132
154
  exit 1
133
155
  fi
134
156
  fi