MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / normalizeFailureSignature

Function normalizeFailureSignature

src/skills/learning/failures.ts:40–52  ·  view source on GitHub ↗
(tool: string, error: string)

Source from the content-addressed store, hash-verified

38 * and hex; lowercase; collapse whitespace; cap length. Keyed by the tool name.
39 */
40export function normalizeFailureSignature(tool: string, error: string): string {
41 let s = (error || '').toLowerCase();
42 s = s.replace(/[\w./-]*\/[\w./-]+/g, '<path>'); // unix-ish paths (with a slash)
43 s = s.replace(/[a-z]:\\[\w\\./-]+/g, '<path>'); // windows paths
44 s = s.replace(/\b[\w-]+\.[a-z][a-z0-9]{0,5}\b/g, '<path>'); // bare filenames (x.ts, y.py)
45 s = s.replace(/:\d+(:\d+)?/g, ''); // :line:col
46 s = s.replace(/'[^']*'|"[^"]*"|`[^`]*`/g, "'<id>'"); // quoted identifiers
47 s = s.replace(/\b0x[0-9a-f]+\b/g, '<hex>');
48 s = s.replace(/\b\d+\b/g, '<n>');
49 s = s.replace(/\s+/g, ' ').trim();
50 s = s.slice(0, 100);
51 return `${tool}|${s}`;
52}
53
54/** A short, stable key for a task (so we count distinct tasks). */
55export function taskKey(prompt: string): string {

Callers 3

evFunction · 0.85
recordToolFailureMethod · 0.85

Calls

no outgoing calls

Tested by 1

evFunction · 0.68