@ekkos/cli 0.2.6 → 0.2.7
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/dist/commands/run.js +30 -3
- package/package.json +1 -1
package/dist/commands/run.js
CHANGED
|
@@ -107,6 +107,25 @@ const SESSION_NAME_IN_STATUS_REGEX = /·\s*([a-z]+-[a-z]+-[a-z]+)\s*·/i;
|
|
|
107
107
|
// Weaker signal: any 3-word slug (word-word-word pattern)
|
|
108
108
|
const SESSION_NAME_REGEX = /\b([a-z]+-[a-z]+-[a-z]+)\b/i;
|
|
109
109
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
110
|
+
// SESSION NAME VALIDATION (MUST use words from session-words.json)
|
|
111
|
+
// This is the SOURCE OF TRUTH for valid session names
|
|
112
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
113
|
+
const session_words_json_1 = __importDefault(require("../utils/session-words.json"));
|
|
114
|
+
const VALID_ADJECTIVES = new Set(session_words_json_1.default.adjectives.map((w) => w.toLowerCase()));
|
|
115
|
+
const VALID_NOUNS = new Set(session_words_json_1.default.nouns.map((w) => w.toLowerCase()));
|
|
116
|
+
const VALID_VERBS = new Set(session_words_json_1.default.verbs.map((w) => w.toLowerCase()));
|
|
117
|
+
/**
|
|
118
|
+
* Validate that a detected session name actually uses words from our word lists.
|
|
119
|
+
* This prevents false positives like "x-github-event" from being detected.
|
|
120
|
+
*/
|
|
121
|
+
function isValidSessionName(name) {
|
|
122
|
+
const parts = name.toLowerCase().split('-');
|
|
123
|
+
if (parts.length !== 3)
|
|
124
|
+
return false;
|
|
125
|
+
const [adj, noun, verb] = parts;
|
|
126
|
+
return VALID_ADJECTIVES.has(adj) && VALID_NOUNS.has(noun) && VALID_VERBS.has(verb);
|
|
127
|
+
}
|
|
128
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
110
129
|
// LOGGING (FILE ONLY DURING TUI - NO TERMINAL CORRUPTION)
|
|
111
130
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
112
131
|
let _debugLogPath = path.join(os.homedir(), '.ekkos', 'auto-continue.debug.log');
|
|
@@ -800,8 +819,12 @@ async function run(options) {
|
|
|
800
819
|
const statusMatch = plain.match(SESSION_NAME_IN_STATUS_REGEX);
|
|
801
820
|
if (statusMatch) {
|
|
802
821
|
const detectedSession = statusMatch[1].toLowerCase();
|
|
803
|
-
//
|
|
804
|
-
if (detectedSession
|
|
822
|
+
// Validate against word lists (SOURCE OF TRUTH)
|
|
823
|
+
if (!isValidSessionName(detectedSession)) {
|
|
824
|
+
dlog(`Session rejected (invalid words): ${detectedSession}`);
|
|
825
|
+
}
|
|
826
|
+
else if (detectedSession !== lastSeenSessionName) {
|
|
827
|
+
// Only update if different (avoid log spam)
|
|
805
828
|
lastSeenSessionName = detectedSession;
|
|
806
829
|
lastSeenSessionAt = Date.now();
|
|
807
830
|
currentSession = lastSeenSessionName;
|
|
@@ -819,7 +842,11 @@ async function run(options) {
|
|
|
819
842
|
const anyMatch = plain.match(SESSION_NAME_REGEX);
|
|
820
843
|
if (anyMatch) {
|
|
821
844
|
const detectedSession = anyMatch[1].toLowerCase();
|
|
822
|
-
|
|
845
|
+
// Validate against word lists (SOURCE OF TRUTH)
|
|
846
|
+
if (!isValidSessionName(detectedSession)) {
|
|
847
|
+
dlog(`Session rejected (invalid words): ${detectedSession}`);
|
|
848
|
+
}
|
|
849
|
+
else if (detectedSession !== lastSeenSessionName) {
|
|
823
850
|
lastSeenSessionName = detectedSession;
|
|
824
851
|
lastSeenSessionAt = Date.now();
|
|
825
852
|
currentSession = lastSeenSessionName;
|