@alaarab/cortex 1.15.3 → 1.15.4
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/mcp/dist/shell-input.js +5 -6
- package/mcp/dist/shell-view.js +22 -14
- package/package.json +1 -1
package/mcp/dist/shell-input.js
CHANGED
|
@@ -607,7 +607,7 @@ export function getListItems(cortexPath, profile, state, healthLineCount) {
|
|
|
607
607
|
return getProjectSkills(cortexPath, state.project).map((s) => ({ name: s.name, text: s.path }));
|
|
608
608
|
}
|
|
609
609
|
case "Hooks": {
|
|
610
|
-
return getHookEntries(cortexPath).map((e) => ({ name: e.
|
|
610
|
+
return getHookEntries(cortexPath).map((e) => ({ name: e.event, text: e.enabled ? "active" : "inactive" }));
|
|
611
611
|
}
|
|
612
612
|
case "Health":
|
|
613
613
|
return Array.from({ length: Math.max(1, healthLineCount) }, (_, i) => ({ id: String(i) }));
|
|
@@ -663,7 +663,7 @@ export async function activateSelected(host) {
|
|
|
663
663
|
break;
|
|
664
664
|
case "Hooks":
|
|
665
665
|
if (item.name) {
|
|
666
|
-
host.setMessage(` ${item.text === "
|
|
666
|
+
host.setMessage(` ${item.text === "active" ? style.boldGreen("active") : style.dim("inactive")} ${style.bold(item.name)}`);
|
|
667
667
|
}
|
|
668
668
|
break;
|
|
669
669
|
}
|
|
@@ -766,11 +766,10 @@ export async function doViewAction(host, key) {
|
|
|
766
766
|
}
|
|
767
767
|
break;
|
|
768
768
|
case "Hooks":
|
|
769
|
-
if (
|
|
769
|
+
if (key === "a" || key === "d") {
|
|
770
770
|
const enable = key === "a";
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
host.setMessage(` ${enable ? style.boldGreen("Enabled") : style.dim("Disabled")} hooks for ${item.name}`);
|
|
771
|
+
writeInstallPreferences(host.cortexPath, { hooksEnabled: enable });
|
|
772
|
+
host.setMessage(` Hooks ${enable ? style.boldGreen("enabled") : style.dim("disabled")} — takes effect next session`);
|
|
774
773
|
}
|
|
775
774
|
break;
|
|
776
775
|
}
|
package/mcp/dist/shell-view.js
CHANGED
|
@@ -434,20 +434,20 @@ export function renderSkillsView(ctx, cursor, height) {
|
|
|
434
434
|
}
|
|
435
435
|
return vp.lines;
|
|
436
436
|
}
|
|
437
|
-
|
|
438
|
-
|
|
437
|
+
const LIFECYCLE_HOOKS = [
|
|
438
|
+
{ event: "UserPromptSubmit", description: "inject context before each prompt" },
|
|
439
|
+
{ event: "Stop", description: "auto-save findings after each response" },
|
|
440
|
+
{ event: "SessionStart", description: "git pull at session start" },
|
|
441
|
+
];
|
|
439
442
|
export function getHookEntries(cortexPath) {
|
|
440
443
|
const prefs = readInstallPreferences(cortexPath);
|
|
441
444
|
const hooksEnabled = prefs.hooksEnabled !== false;
|
|
442
|
-
|
|
443
|
-
return HOOK_TOOLS.map((tool) => ({
|
|
444
|
-
tool,
|
|
445
|
-
enabled: hooksEnabled && toolPrefs[tool] !== false,
|
|
446
|
-
}));
|
|
445
|
+
return LIFECYCLE_HOOKS.map((h) => ({ ...h, enabled: hooksEnabled }));
|
|
447
446
|
}
|
|
448
447
|
export function renderHooksView(ctx, cursor, height) {
|
|
449
448
|
const cols = process.stdout.columns || 80;
|
|
450
449
|
const entries = getHookEntries(ctx.cortexPath);
|
|
450
|
+
const allEnabled = entries.every((e) => e.enabled);
|
|
451
451
|
const allLines = [];
|
|
452
452
|
let cursorFirstLine = 0;
|
|
453
453
|
let cursorLastLine = 0;
|
|
@@ -456,16 +456,24 @@ export function renderHooksView(ctx, cursor, height) {
|
|
|
456
456
|
const isSelected = i === cursor;
|
|
457
457
|
if (isSelected)
|
|
458
458
|
cursorFirstLine = allLines.length;
|
|
459
|
-
const statusBadge = e.enabled ? style.boldGreen("
|
|
460
|
-
let
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
459
|
+
const statusBadge = e.enabled ? style.boldGreen("active ") : style.dim("inactive");
|
|
460
|
+
let nameRow = ` ${style.dim((i + 1).toString().padEnd(3))} ${statusBadge} ${style.bold(e.event)}`;
|
|
461
|
+
let descRow = ` ${style.dim(e.description)}`;
|
|
462
|
+
if (isSelected) {
|
|
463
|
+
nameRow = `\x1b[7m${padToWidth(nameRow, cols)}${RESET}`;
|
|
464
|
+
descRow = `\x1b[7m${padToWidth(descRow, cols)}${RESET}`;
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
nameRow = truncateLine(nameRow, cols);
|
|
468
|
+
descRow = truncateLine(descRow, cols);
|
|
469
|
+
}
|
|
470
|
+
allLines.push(nameRow);
|
|
471
|
+
allLines.push(descRow);
|
|
466
472
|
if (isSelected)
|
|
467
473
|
cursorLastLine = allLines.length - 1;
|
|
468
474
|
}
|
|
475
|
+
allLines.push("");
|
|
476
|
+
allLines.push(style.dim(` hooks: ${allEnabled ? style.boldGreen("ON") : style.boldRed("OFF")} · ${style.dim("a = enable all · d = disable all")}`));
|
|
469
477
|
const usableHeight = Math.max(1, height - (allLines.length > height ? 1 : 0));
|
|
470
478
|
const vp = lineViewport(allLines, cursorFirstLine, cursorLastLine, usableHeight, ctx.currentScroll());
|
|
471
479
|
ctx.setScroll(vp.scrollStart);
|