shiva-code 0.4.2 → 0.4.3
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/index.js +91 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
|
|
77
77
|
// src/index.ts
|
|
78
78
|
import { Command as Command35 } from "commander";
|
|
79
|
-
import
|
|
79
|
+
import * as readline from "readline";
|
|
80
80
|
|
|
81
81
|
// src/commands/auth/login.ts
|
|
82
82
|
import { Command } from "commander";
|
|
@@ -14632,7 +14632,7 @@ function listPackages() {
|
|
|
14632
14632
|
|
|
14633
14633
|
// src/index.ts
|
|
14634
14634
|
var program = new Command35();
|
|
14635
|
-
program.name("shiva").description("SHIVA Code - Control Station for Claude Code").version("0.4.
|
|
14635
|
+
program.name("shiva").description("SHIVA Code - Control Station for Claude Code").version("0.4.3");
|
|
14636
14636
|
program.addCommand(loginCommand);
|
|
14637
14637
|
program.addCommand(logoutCommand);
|
|
14638
14638
|
program.addCommand(initCommand);
|
|
@@ -14673,6 +14673,79 @@ program.addCommand(telemetryCommand);
|
|
|
14673
14673
|
program.action(async () => {
|
|
14674
14674
|
await showDashboard();
|
|
14675
14675
|
});
|
|
14676
|
+
async function interactiveMenu(choices, shortcuts) {
|
|
14677
|
+
return new Promise((resolve13) => {
|
|
14678
|
+
let selectedIndex = 0;
|
|
14679
|
+
let resolved = false;
|
|
14680
|
+
const renderMenu = () => {
|
|
14681
|
+
if (selectedIndex > 0 || choices.length > 0) {
|
|
14682
|
+
process.stdout.write(`\x1B[${choices.length + 1}A`);
|
|
14683
|
+
}
|
|
14684
|
+
console.log(colors.green("?") + " " + colors.bold("Auswahl:"));
|
|
14685
|
+
for (let i = 0; i < choices.length; i++) {
|
|
14686
|
+
const prefix = i === selectedIndex ? colors.cyan("\u276F ") : " ";
|
|
14687
|
+
const name = i === selectedIndex ? colors.cyan(choices[i].name) : choices[i].name;
|
|
14688
|
+
console.log(prefix + name);
|
|
14689
|
+
}
|
|
14690
|
+
console.log(colors.dim("\u2191\u2193 navigate \u2022 \u21B5 select"));
|
|
14691
|
+
};
|
|
14692
|
+
console.log(colors.green("?") + " " + colors.bold("Auswahl:"));
|
|
14693
|
+
for (let i = 0; i < choices.length; i++) {
|
|
14694
|
+
const prefix = i === selectedIndex ? colors.cyan("\u276F ") : " ";
|
|
14695
|
+
const name = i === selectedIndex ? colors.cyan(choices[i].name) : choices[i].name;
|
|
14696
|
+
console.log(prefix + name);
|
|
14697
|
+
}
|
|
14698
|
+
console.log(colors.dim("\u2191\u2193 navigate \u2022 \u21B5 select"));
|
|
14699
|
+
if (process.stdin.isTTY) {
|
|
14700
|
+
readline.emitKeypressEvents(process.stdin);
|
|
14701
|
+
process.stdin.setRawMode(true);
|
|
14702
|
+
}
|
|
14703
|
+
process.stdin.resume();
|
|
14704
|
+
const cleanup = () => {
|
|
14705
|
+
process.stdin.removeListener("keypress", handler);
|
|
14706
|
+
if (process.stdin.isTTY) {
|
|
14707
|
+
process.stdin.setRawMode(false);
|
|
14708
|
+
}
|
|
14709
|
+
};
|
|
14710
|
+
const handler = (_str, key) => {
|
|
14711
|
+
if (resolved) return;
|
|
14712
|
+
const keyName = key?.name?.toLowerCase() || "";
|
|
14713
|
+
const keyChar = key?.sequence?.toLowerCase() || "";
|
|
14714
|
+
if (key?.ctrl && keyName === "c") {
|
|
14715
|
+
cleanup();
|
|
14716
|
+
process.exit(0);
|
|
14717
|
+
}
|
|
14718
|
+
if (shortcuts[keyChar] || shortcuts[keyName]) {
|
|
14719
|
+
const shortcutType = shortcuts[keyChar] || shortcuts[keyName];
|
|
14720
|
+
resolved = true;
|
|
14721
|
+
cleanup();
|
|
14722
|
+
process.stdout.write(`\x1B[${choices.length + 2}A\x1B[J`);
|
|
14723
|
+
console.log(colors.green("?") + " " + colors.bold("Auswahl:") + " " + colors.cyan(shortcutType));
|
|
14724
|
+
resolve13({ type: shortcutType });
|
|
14725
|
+
return;
|
|
14726
|
+
}
|
|
14727
|
+
if (keyName === "up") {
|
|
14728
|
+
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : choices.length - 1;
|
|
14729
|
+
renderMenu();
|
|
14730
|
+
} else if (keyName === "down") {
|
|
14731
|
+
selectedIndex = selectedIndex < choices.length - 1 ? selectedIndex + 1 : 0;
|
|
14732
|
+
renderMenu();
|
|
14733
|
+
} else if (keyName === "return") {
|
|
14734
|
+
resolved = true;
|
|
14735
|
+
cleanup();
|
|
14736
|
+
process.stdout.write(`\x1B[${choices.length + 2}A\x1B[J`);
|
|
14737
|
+
console.log(colors.green("?") + " " + colors.bold("Auswahl:") + " " + colors.cyan(choices[selectedIndex].value.type));
|
|
14738
|
+
resolve13(choices[selectedIndex].value);
|
|
14739
|
+
} else if (keyName === "escape") {
|
|
14740
|
+
resolved = true;
|
|
14741
|
+
cleanup();
|
|
14742
|
+
process.stdout.write(`\x1B[${choices.length + 2}A\x1B[J`);
|
|
14743
|
+
resolve13({ type: "quit" });
|
|
14744
|
+
}
|
|
14745
|
+
};
|
|
14746
|
+
process.stdin.on("keypress", handler);
|
|
14747
|
+
});
|
|
14748
|
+
}
|
|
14676
14749
|
async function showDashboard() {
|
|
14677
14750
|
console.clear();
|
|
14678
14751
|
log.newline();
|
|
@@ -14727,20 +14800,23 @@ async function showDashboard() {
|
|
|
14727
14800
|
value: { type: "separator" }
|
|
14728
14801
|
});
|
|
14729
14802
|
choices.push(
|
|
14730
|
-
{ name: "
|
|
14731
|
-
{ name: "
|
|
14732
|
-
{ name: "
|
|
14733
|
-
{ name: "
|
|
14734
|
-
{ name: "
|
|
14735
|
-
{ name: "
|
|
14803
|
+
{ name: colors.green("[S]") + " Alle Sessions anzeigen", value: { type: "sessions" } },
|
|
14804
|
+
{ name: colors.green("[P]") + " Packages verwalten", value: { type: "packages" } },
|
|
14805
|
+
{ name: colors.green("[G]") + " GitHub Issues", value: { type: "issues" } },
|
|
14806
|
+
{ name: colors.green("[R]") + " Pull Requests", value: { type: "prs" } },
|
|
14807
|
+
{ name: colors.green("[C]") + " Config", value: { type: "config" } },
|
|
14808
|
+
{ name: colors.green("[Q]") + " Beenden", value: { type: "quit" } }
|
|
14736
14809
|
);
|
|
14737
|
-
const
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14810
|
+
const shortcuts = {
|
|
14811
|
+
"s": "sessions",
|
|
14812
|
+
"p": "packages",
|
|
14813
|
+
"g": "issues",
|
|
14814
|
+
"r": "prs",
|
|
14815
|
+
"c": "config",
|
|
14816
|
+
"q": "quit"
|
|
14817
|
+
};
|
|
14818
|
+
const menuChoices = choices.filter((c) => c.value.type !== "separator");
|
|
14819
|
+
const selected = await interactiveMenu(menuChoices, shortcuts);
|
|
14744
14820
|
switch (selected.type) {
|
|
14745
14821
|
case "resume": {
|
|
14746
14822
|
const project = selected.data;
|