diff --git a/network-poc/static/index.html b/network-poc/static/index.html
index fe282e3..9e50e81 100644
--- a/network-poc/static/index.html
+++ b/network-poc/static/index.html
@@ -2264,11 +2264,26 @@ Files: ${Object.keys(generatedFiles).join(', ')}`;
}
}
// Levenshtein-etäisyys ensimmäiselle sanalle
- const firstWord = input.trim().split(/\s+/)[0].toLowerCase();
+ const words = input.trim().split(/\s+/);
+ const firstWord = words[0].toLowerCase();
if (firstWord !== 'kpn' && firstWord.length >= 2 && firstWord.length <= 5) {
const dist = levenshtein(firstWord, 'kpn');
if (dist <= 2) return 'kpn' + input.slice(firstWord.length);
}
+ // Fuzzy-korjaus alikomentotasolla: "kpn rnu" → "kpn run"
+ if (firstWord === 'kpn' && words.length >= 2) {
+ const sub = words[1].toLowerCase();
+ const subCommands = ['help', 'run', 'project', 'pipeline', 'load', 'status', 'models', 'hello', 'clear'];
+ let bestMatch = null, bestDist = 3;
+ for (const cmd of subCommands) {
+ const d = levenshtein(sub, cmd);
+ if (d > 0 && d < bestDist) { bestDist = d; bestMatch = cmd; }
+ }
+ if (bestMatch) {
+ words[1] = bestMatch;
+ return words.join(' ');
+ }
+ }
return null;
}
@@ -2426,6 +2441,13 @@ Files: ${Object.keys(generatedFiles).join(', ')}`;
};
function tabComplete(input) {
+ // Autokorjaus ensin: korjaa typo ja palauta true jos korjattiin
+ const corrected = autocorrect(input.value.trim());
+ if (corrected && corrected !== input.value.trim()) {
+ input.value = corrected;
+ return true;
+ }
+
const val = input.value;
const words = val.trimEnd().split(/\s+/);