@cyanautomation/kaseki-agent 1.16.0 → 1.17.0
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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Output Filter
|
|
3
|
+
*
|
|
4
|
+
* Filters validation command output in real-time to reduce noise in Docker logs
|
|
5
|
+
* while preserving full output in stored log files.
|
|
6
|
+
*
|
|
7
|
+
* Filters OUT verbose lines while preserving:
|
|
8
|
+
* - Error and warning lines (never filtered)
|
|
9
|
+
* - Test result indicators (✓, ✗, PASS, FAIL, passed, failed, etc.)
|
|
10
|
+
* - Command boundaries (first and last lines)
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* some_command 2>&1 | node validation-output-filter.js | tee -a logfile.log
|
|
14
|
+
*
|
|
15
|
+
* Exit code: Always 0 (this filter does not affect command success/failure)
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=validation-output-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-output-filter.d.ts","sourceRoot":"","sources":["../src/validation-output-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Output Filter
|
|
3
|
+
*
|
|
4
|
+
* Filters validation command output in real-time to reduce noise in Docker logs
|
|
5
|
+
* while preserving full output in stored log files.
|
|
6
|
+
*
|
|
7
|
+
* Filters OUT verbose lines while preserving:
|
|
8
|
+
* - Error and warning lines (never filtered)
|
|
9
|
+
* - Test result indicators (✓, ✗, PASS, FAIL, passed, failed, etc.)
|
|
10
|
+
* - Command boundaries (first and last lines)
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* some_command 2>&1 | node validation-output-filter.js | tee -a logfile.log
|
|
14
|
+
*
|
|
15
|
+
* Exit code: Always 0 (this filter does not affect command success/failure)
|
|
16
|
+
*/
|
|
17
|
+
import { createInterface } from 'readline';
|
|
18
|
+
const state = {
|
|
19
|
+
inCommand: false,
|
|
20
|
+
commandNumber: 0,
|
|
21
|
+
firstLineOfCommand: null,
|
|
22
|
+
linesSinceCommandStart: 0,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Patterns that always pass through (never filtered)
|
|
26
|
+
*/
|
|
27
|
+
const ALWAYS_SHOW_PATTERNS = [
|
|
28
|
+
/ERROR/i,
|
|
29
|
+
/WARN/i, // Shows real warnings (compiler, linter, etc)
|
|
30
|
+
/FATAL/i,
|
|
31
|
+
/CRITICAL/i,
|
|
32
|
+
/Exception/,
|
|
33
|
+
/at\s+\(/, // Stack traces
|
|
34
|
+
/^\s+at\s+/,
|
|
35
|
+
/failed/i,
|
|
36
|
+
/failure/i,
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Patterns that should be filtered out (verbose/noisy output)
|
|
40
|
+
*/
|
|
41
|
+
const FILTER_OUT_PATTERNS = [
|
|
42
|
+
/^npm\s+(notice|warn)/i, // npm notice and warn messages (framework metadata)
|
|
43
|
+
/^npm\s+ERR!/i, // npm error prefixed lines (actual errors shown differently)
|
|
44
|
+
/welcome to npm/i,
|
|
45
|
+
/^\s*\[[\s█▓▒░]*\].*%?\s*(complete|done)/i, // Progress bars
|
|
46
|
+
/\d+%\s+complete/i, // Percentage progress indicators
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* Patterns that indicate test results or completion
|
|
50
|
+
*/
|
|
51
|
+
const KEY_MILESTONE_PATTERNS = [
|
|
52
|
+
/\bPASS/i,
|
|
53
|
+
/\bFAIL/i,
|
|
54
|
+
/\bOK\b/i,
|
|
55
|
+
/\bDONE\b/i,
|
|
56
|
+
/✓/,
|
|
57
|
+
/✗/,
|
|
58
|
+
/passed/i,
|
|
59
|
+
/failed/i,
|
|
60
|
+
/completed/i,
|
|
61
|
+
/finished/i,
|
|
62
|
+
/complete/i, // "Bundle complete", "Build complete", etc.
|
|
63
|
+
/\d+\s+tests?.*passed/i,
|
|
64
|
+
/\d+\s+tests?.*failed/i,
|
|
65
|
+
/\d+\s+error/i,
|
|
66
|
+
/\d+\s+warning/i,
|
|
67
|
+
/all\s+tests?\s+passed/i,
|
|
68
|
+
/test\s+suite.*passed/i,
|
|
69
|
+
/test\s+suite.*failed/i,
|
|
70
|
+
/\bsuccess\b/i,
|
|
71
|
+
/build.*success/i,
|
|
72
|
+
/build.*success/i,
|
|
73
|
+
/\d+.*tests?\s+(passed|failed)/i,
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* Patterns that indicate command boundaries (start/end)
|
|
77
|
+
*/
|
|
78
|
+
const COMMAND_BOUNDARY_PATTERNS = [
|
|
79
|
+
/^==> /, // Command start
|
|
80
|
+
/^exit_code=/, // Command end
|
|
81
|
+
];
|
|
82
|
+
/**
|
|
83
|
+
* Check if a line should always be shown (error/warning)
|
|
84
|
+
*/
|
|
85
|
+
function shouldAlwaysShow(line) {
|
|
86
|
+
return ALWAYS_SHOW_PATTERNS.some((pattern) => pattern.test(line));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Check if a line should be filtered out (verbose/noisy)
|
|
90
|
+
*/
|
|
91
|
+
function shouldFilterOut(line) {
|
|
92
|
+
return FILTER_OUT_PATTERNS.some((pattern) => pattern.test(line));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Check if a line is a key milestone (test result indicator)
|
|
96
|
+
*/
|
|
97
|
+
function isKeyMilestone(line) {
|
|
98
|
+
return KEY_MILESTONE_PATTERNS.some((pattern) => pattern.test(line));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check if a line is a command boundary
|
|
102
|
+
*/
|
|
103
|
+
function isCommandBoundary(line) {
|
|
104
|
+
return COMMAND_BOUNDARY_PATTERNS.some((pattern) => pattern.test(line));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Determine if a line should be shown in real-time output
|
|
108
|
+
*/
|
|
109
|
+
function shouldShow(line) {
|
|
110
|
+
// Filter out explicitly noisy patterns first
|
|
111
|
+
if (shouldFilterOut(line)) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
// Always show errors and warnings
|
|
115
|
+
if (shouldAlwaysShow(line)) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
// Always show command boundaries
|
|
119
|
+
if (isCommandBoundary(line)) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
// Always show key milestones (test results)
|
|
123
|
+
if (isKeyMilestone(line)) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
// Filter everything else
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Process a line of input
|
|
131
|
+
*/
|
|
132
|
+
function processLine(line) {
|
|
133
|
+
// Detect command start
|
|
134
|
+
if (line.match(/^==> /)) {
|
|
135
|
+
state.inCommand = true;
|
|
136
|
+
state.commandNumber++;
|
|
137
|
+
state.firstLineOfCommand = line;
|
|
138
|
+
state.linesSinceCommandStart = 0;
|
|
139
|
+
output(line); // Always show command start
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// Detect command end
|
|
143
|
+
if (line.match(/^exit_code=/)) {
|
|
144
|
+
output(line); // Always show exit code
|
|
145
|
+
state.inCommand = false;
|
|
146
|
+
state.firstLineOfCommand = null;
|
|
147
|
+
state.linesSinceCommandStart = 0;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// If not in a command, show the line anyway (e.g., preamble, separators)
|
|
151
|
+
if (!state.inCommand) {
|
|
152
|
+
output(line);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
// In a command: decide whether to show this line based on filter criteria
|
|
156
|
+
state.linesSinceCommandStart++;
|
|
157
|
+
// Show only lines that match filter criteria (errors, milestones, boundaries)
|
|
158
|
+
if (shouldShow(line)) {
|
|
159
|
+
output(line);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Output a line to stdout
|
|
164
|
+
*/
|
|
165
|
+
function output(line) {
|
|
166
|
+
console.log(line);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Main: read from stdin and process
|
|
170
|
+
*/
|
|
171
|
+
const rl = createInterface({
|
|
172
|
+
input: process.stdin,
|
|
173
|
+
output: process.stdout,
|
|
174
|
+
terminal: false,
|
|
175
|
+
});
|
|
176
|
+
rl.on('line', (line) => {
|
|
177
|
+
processLine(line);
|
|
178
|
+
});
|
|
179
|
+
rl.on('close', () => {
|
|
180
|
+
process.exit(0);
|
|
181
|
+
});
|
|
182
|
+
// Handle errors gracefully
|
|
183
|
+
process.on('error', (err) => {
|
|
184
|
+
console.error(`[validation-output-filter] Error: ${err.message}`);
|
|
185
|
+
process.exit(1);
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=validation-output-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-output-filter.js","sourceRoot":"","sources":["../src/validation-output-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAS3C,MAAM,KAAK,GAAgB;IACzB,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,CAAC;IAChB,kBAAkB,EAAE,IAAI;IACxB,sBAAsB,EAAE,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,oBAAoB,GAAG;IAC3B,QAAQ;IACR,OAAO,EAAG,8CAA8C;IACxD,QAAQ;IACR,WAAW;IACX,WAAW;IACX,SAAS,EAAG,eAAe;IAC3B,WAAW;IACX,SAAS;IACT,UAAU;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,mBAAmB,GAAG;IAC1B,uBAAuB,EAAG,oDAAoD;IAC9E,cAAc,EAAG,6DAA6D;IAC9E,iBAA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1E,KAAK,CAAC,sBAAsB,EAAE,CAAC;IAE/B,8EAA8E;IAC9E,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,EAAE,GAAG,eAAe,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC;AAEH,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;IAC7B,WAAW,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;IAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,2BAA2B;AAC3B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;IAC1B,OAAO,CAAC,KAAK,CAAC,qCAAqC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/kaseki-agent.sh
CHANGED
|
@@ -2042,7 +2042,7 @@ else
|
|
|
2042
2042
|
PI_EXTRACTION_DEPS_OK=1
|
|
2043
2043
|
missing_executables=()
|
|
2044
2044
|
missing_helpers=()
|
|
2045
|
-
for required_exec in kaseki-pi-event-filter kaseki-pi-progress-stream; do
|
|
2045
|
+
for required_exec in kaseki-pi-event-filter kaseki-pi-progress-stream validation-output-filter; do
|
|
2046
2046
|
if ! command -v "$required_exec" >/dev/null 2>&1; then
|
|
2047
2047
|
missing_executables+=("$required_exec")
|
|
2048
2048
|
fi
|
|
@@ -2263,7 +2263,7 @@ else
|
|
|
2263
2263
|
command_exit=$?
|
|
2264
2264
|
printf 'exit_code=%s\n' "$command_exit"
|
|
2265
2265
|
exit "$command_exit"
|
|
2266
|
-
} 2>&1 | tee -a /results/validation.log
|
|
2266
|
+
} 2>&1 | tee -a /results/validation.log | validation-output-filter
|
|
2267
2267
|
command_exit="${PIPESTATUS[0]}"
|
|
2268
2268
|
validation_end="$(date +%s)"
|
|
2269
2269
|
duration=$((validation_end - validation_start))
|
package/package.json
CHANGED