start-vibing 2.0.28 → 2.0.30
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
|
@@ -1037,62 +1037,65 @@ async function readStdinWithTimeout(timeoutMs: number): Promise<string> {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
1039
|
/**
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1040
|
+
* Collect ALL validation errors in priority order.
|
|
1041
|
+
* Returns array of all errors found, empty if all passed.
|
|
1042
1042
|
*/
|
|
1043
|
-
function
|
|
1043
|
+
function collectAllErrors(
|
|
1044
1044
|
currentBranch: string,
|
|
1045
1045
|
modifiedFiles: string[],
|
|
1046
1046
|
sourceFiles: string[],
|
|
1047
1047
|
isMainBranch: boolean,
|
|
1048
|
-
|
|
1049
|
-
): ValidationError
|
|
1050
|
-
|
|
1051
|
-
// Each validation returns early on first error
|
|
1048
|
+
_isCleanTree: boolean
|
|
1049
|
+
): ValidationError[] {
|
|
1050
|
+
const errors: ValidationError[] = [];
|
|
1052
1051
|
|
|
1053
1052
|
// 1. Branch validation - can't complete on feature branch
|
|
1054
1053
|
const branchError = validateBranch(currentBranch, modifiedFiles);
|
|
1055
|
-
if (branchError)
|
|
1054
|
+
if (branchError) errors.push(branchError);
|
|
1056
1055
|
|
|
1057
1056
|
// 2. Git tree - must be clean (only check if on main)
|
|
1058
1057
|
if (isMainBranch) {
|
|
1059
1058
|
const treeError = validateGitTree(modifiedFiles);
|
|
1060
|
-
if (treeError)
|
|
1059
|
+
if (treeError) errors.push(treeError);
|
|
1061
1060
|
}
|
|
1062
1061
|
|
|
1063
1062
|
// 3. CLAUDE.md must exist
|
|
1064
1063
|
const claudeMdExistsError = validateClaudeMdExists();
|
|
1065
|
-
if (claudeMdExistsError)
|
|
1064
|
+
if (claudeMdExistsError) {
|
|
1065
|
+
errors.push(claudeMdExistsError);
|
|
1066
|
+
// If CLAUDE.md doesn't exist, skip other CLAUDE.md validations
|
|
1067
|
+
return errors;
|
|
1068
|
+
}
|
|
1066
1069
|
|
|
1067
1070
|
// 4. Check if template merge is needed
|
|
1068
1071
|
const templateMergeError = validateClaudeMdTemplateMerge();
|
|
1069
|
-
if (templateMergeError)
|
|
1072
|
+
if (templateMergeError) errors.push(templateMergeError);
|
|
1070
1073
|
|
|
1071
1074
|
// 5. CLAUDE.md size - must be under 40k
|
|
1072
1075
|
const sizeError = validateClaudeMdSize();
|
|
1073
|
-
if (sizeError)
|
|
1076
|
+
if (sizeError) errors.push(sizeError);
|
|
1074
1077
|
|
|
1075
1078
|
// 6. CLAUDE.md structure - must have required sections
|
|
1076
1079
|
const structureError = validateClaudeMdStructure();
|
|
1077
|
-
if (structureError)
|
|
1080
|
+
if (structureError) errors.push(structureError);
|
|
1078
1081
|
|
|
1079
1082
|
// 7. Last Change must not be stacked
|
|
1080
1083
|
const lastChangeError = validateClaudeMdLastChange();
|
|
1081
|
-
if (lastChangeError)
|
|
1084
|
+
if (lastChangeError) errors.push(lastChangeError);
|
|
1082
1085
|
|
|
1083
1086
|
// 8. CLAUDE.md must be updated if files changed
|
|
1084
1087
|
const updatedError = validateClaudeMdUpdated(modifiedFiles);
|
|
1085
|
-
if (updatedError)
|
|
1088
|
+
if (updatedError) errors.push(updatedError);
|
|
1086
1089
|
|
|
1087
1090
|
// 9. Source files must be documented
|
|
1088
1091
|
const docError = validateDocumentation(sourceFiles);
|
|
1089
|
-
if (docError)
|
|
1092
|
+
if (docError) errors.push(docError);
|
|
1090
1093
|
|
|
1091
1094
|
// 10. Domain documentation must be complete
|
|
1092
1095
|
const domainDocError = validateDomainDocumentation(modifiedFiles);
|
|
1093
|
-
if (domainDocError)
|
|
1096
|
+
if (domainDocError) errors.push(domainDocError);
|
|
1094
1097
|
|
|
1095
|
-
return
|
|
1098
|
+
return errors;
|
|
1096
1099
|
}
|
|
1097
1100
|
|
|
1098
1101
|
async function main(): Promise<void> {
|
|
@@ -1130,8 +1133,8 @@ async function main(): Promise<void> {
|
|
|
1130
1133
|
|
|
1131
1134
|
console.error(`[stop-validator] Branch: ${currentBranch}, Modified: ${modifiedFiles.length}`);
|
|
1132
1135
|
|
|
1133
|
-
//
|
|
1134
|
-
const
|
|
1136
|
+
// Collect ALL errors to show summary
|
|
1137
|
+
const allErrors = collectAllErrors(
|
|
1135
1138
|
currentBranch,
|
|
1136
1139
|
modifiedFiles,
|
|
1137
1140
|
sourceFiles,
|
|
@@ -1140,54 +1143,80 @@ async function main(): Promise<void> {
|
|
|
1140
1143
|
);
|
|
1141
1144
|
|
|
1142
1145
|
// ============================================================================
|
|
1143
|
-
// OUTPUT RESULTS -
|
|
1146
|
+
// OUTPUT RESULTS - SHOW ALL ERRORS, DETAIL FIRST ONE
|
|
1144
1147
|
// ============================================================================
|
|
1145
1148
|
|
|
1146
|
-
if (
|
|
1147
|
-
const
|
|
1149
|
+
if (allErrors.length > 0) {
|
|
1150
|
+
const firstError = allErrors[0];
|
|
1151
|
+
const subagentInfo = ERROR_TO_SUBAGENT[firstError.type] || {
|
|
1148
1152
|
agent: 'general-purpose',
|
|
1149
1153
|
prompt: 'Fix the validation error',
|
|
1150
1154
|
};
|
|
1151
1155
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
stop hook returns "ALL CHECKS PASSED". Keep fixing issues one by one until
|
|
1160
|
-
all validations pass.
|
|
1156
|
+
// Build summary of ALL errors
|
|
1157
|
+
let errorSummary = '';
|
|
1158
|
+
for (let i = 0; i < allErrors.length; i++) {
|
|
1159
|
+
const err = allErrors[i];
|
|
1160
|
+
const status = i === 0 ? '→ FIXING NOW' : ' (pending)';
|
|
1161
|
+
errorSummary += ` ${i + 1}. [${err.type}] ${status}\n`;
|
|
1162
|
+
}
|
|
1161
1163
|
|
|
1164
|
+
// Build pending errors note (if more than 1)
|
|
1165
|
+
let pendingNote = '';
|
|
1166
|
+
if (allErrors.length > 1) {
|
|
1167
|
+
pendingNote = `
|
|
1162
1168
|
--------------------------------------------------------------------------------
|
|
1169
|
+
REMAINING ISSUES (${allErrors.length - 1} more after this one)
|
|
1170
|
+
--------------------------------------------------------------------------------
|
|
1171
|
+
|
|
1172
|
+
After fixing the first issue, run the validator again to see details for the next:
|
|
1173
|
+
|
|
1174
|
+
Bash(command="npx tsx .claude/hooks/stop-validator.ts", description="Run validator to see next issue")
|
|
1175
|
+
|
|
1176
|
+
`;
|
|
1177
|
+
}
|
|
1163
1178
|
|
|
1164
|
-
|
|
1179
|
+
const blockReason = `
|
|
1180
|
+
================================================================================
|
|
1181
|
+
STOP VALIDATOR - BLOCKED (${allErrors.length} issue${allErrors.length > 1 ? 's' : ''} found)
|
|
1182
|
+
================================================================================
|
|
1165
1183
|
|
|
1166
|
-
${
|
|
1184
|
+
**FIRST**: Create a TODO LIST to track fixing all ${allErrors.length} issues:
|
|
1167
1185
|
|
|
1168
|
-
|
|
1186
|
+
TodoWrite(todos=[
|
|
1187
|
+
${allErrors.map((e, i) => ` { content: "Fix ${e.type}", status: "${i === 0 ? 'in_progress' : 'pending'}", activeForm: "Fixing ${e.type}" }`).join(',\n')}
|
|
1188
|
+
])
|
|
1169
1189
|
|
|
1170
1190
|
--------------------------------------------------------------------------------
|
|
1171
|
-
|
|
1191
|
+
ALL ISSUES FOUND (in priority order)
|
|
1172
1192
|
--------------------------------------------------------------------------------
|
|
1173
1193
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1194
|
+
${errorSummary}
|
|
1176
1195
|
--------------------------------------------------------------------------------
|
|
1177
|
-
|
|
1196
|
+
ISSUE #1 DETAILS (fix this first)
|
|
1178
1197
|
--------------------------------------------------------------------------------
|
|
1179
1198
|
|
|
1180
|
-
|
|
1199
|
+
ERROR: ${firstError.type}
|
|
1181
1200
|
|
|
1182
|
-
|
|
1183
|
-
DO NOT try to complete the task until the validator returns "ALL CHECKS PASSED".
|
|
1201
|
+
${firstError.message}
|
|
1184
1202
|
|
|
1203
|
+
${firstError.action}
|
|
1204
|
+
|
|
1205
|
+
--------------------------------------------------------------------------------
|
|
1206
|
+
FIX USING THIS SUBAGENT
|
|
1207
|
+
--------------------------------------------------------------------------------
|
|
1208
|
+
|
|
1209
|
+
Task(subagent_type="${subagentInfo.agent}", prompt="${subagentInfo.prompt}")
|
|
1210
|
+
${pendingNote}
|
|
1185
1211
|
--------------------------------------------------------------------------------
|
|
1186
|
-
|
|
1212
|
+
WORKFLOW
|
|
1187
1213
|
--------------------------------------------------------------------------------
|
|
1188
1214
|
|
|
1189
|
-
|
|
1190
|
-
|
|
1215
|
+
1. Create the TODO list above
|
|
1216
|
+
2. Fix issue #1 using the subagent
|
|
1217
|
+
3. Run: npx tsx .claude/hooks/stop-validator.ts
|
|
1218
|
+
4. If more issues, repeat for each one
|
|
1219
|
+
5. Only complete task when "ALL CHECKS PASSED"
|
|
1191
1220
|
================================================================================
|
|
1192
1221
|
`;
|
|
1193
1222
|
|
|
@@ -31,10 +31,23 @@ const STRICT_WORKFLOW = `
|
|
|
31
31
|
│ 6. DOCUMENT → Document ALL modified files (MANDATORY) │
|
|
32
32
|
│ 7. UPDATE → Update CLAUDE.md with session changes │
|
|
33
33
|
│ 8. QUALITY → typecheck + lint + test (Husky enforced) │
|
|
34
|
-
│ 9.
|
|
34
|
+
│ 9. VALIDATE → RUN: npx tsx .claude/hooks/stop-validator.ts │
|
|
35
|
+
│ 10. FINISH → Only after "ALL CHECKS PASSED" │
|
|
35
36
|
└─────────────────────────────────────────────────────────────────┘
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
╔═════════════════════════════════════════════════════════════════╗
|
|
39
|
+
║ ⚠️ MANDATORY: RUN STOP VALIDATOR BEFORE COMPLETING ANY TASK ║
|
|
40
|
+
╠═════════════════════════════════════════════════════════════════╣
|
|
41
|
+
║ ║
|
|
42
|
+
║ COMMAND: npx tsx .claude/hooks/stop-validator.ts ║
|
|
43
|
+
║ ║
|
|
44
|
+
║ YOU MUST run this command manually BEFORE saying "task done". ║
|
|
45
|
+
║ Fix ALL issues one by one. Run validator again after EACH fix.║
|
|
46
|
+
║ Only complete task when output shows "ALL CHECKS PASSED". ║
|
|
47
|
+
║ ║
|
|
48
|
+
╚═════════════════════════════════════════════════════════════════╝
|
|
49
|
+
|
|
50
|
+
⚠️ STOP HOOK BLOCKS task completion if:
|
|
38
51
|
- NOT on main branch (PR must be merged first)
|
|
39
52
|
- Git tree NOT clean (all changes must be committed)
|
|
40
53
|
- CLAUDE.md NOT updated (must reflect session changes)
|