@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.
- package/cli/audit/ast-visitors.js +7 -1
- package/cli/audit/csharp-analyzer.js +360 -7
- package/cli/audit/csharp-analyzer.spec.js +216 -0
- package/cli/audit/extended-text-patterns.js +6 -3
- package/cli/audit/metrics.js +5 -3
- package/cli/audit/reporter-markdown.js +1 -1
- package/cli/audit/reporter-sections.js +1 -1
- package/cli/audit/rules-helpers.js +7 -1
- package/cli/audit/rules-registry.js +10 -0
- package/cli/audit/rules.js +2 -2
- package/cli/audit.js +16 -8
- package/cli/commands/cmd-audit.js +6 -4
- package/cli/config/loader.js +1 -0
- package/cli/config/profiles.js +3 -0
- package/cli/friction-fixes.spec.js +96 -0
- package/cli/installer-templates.js +37 -6
- package/cli/mcp/manifests.js +7 -2
- package/cli/mcp/tools-patch.js +4 -3
- package/cli/mcp/tools-read.js +3 -1
- package/cli/mcp/tools-team-locks.js +10 -3
- package/cli/mcp/tools-team-tasks.js +5 -2
- package/cli/mcp/tools-write.js +2 -1
- package/cli/mcp/tools.js +44 -1
- package/cli/patcher.js +3 -2
- package/cli/path-scope.js +113 -0
- package/cli/path-traversal.spec.js +242 -0
- package/cli/reader.js +3 -1
- package/cli/search.d.ts +2 -1
- package/cli/search.js +1 -21
- package/cli/search.spec.js +12 -0
- package/cli/team/team-commands-lock.js +17 -5
- package/cli/team/team-commands.js +2 -2
- package/cli/team/team-db-locks.js +50 -15
- package/package.json +1 -1
- package/scripts/pre-commit.sh +28 -6
package/scripts/pre-commit.sh
CHANGED
|
@@ -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
|
|
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 "%
|
|
105
|
-
printf "
|
|
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
|
|
131
|
-
printf "
|
|
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
|