shiva-code 0.6.1 → 0.6.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 +538 -293
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,29 +35,6 @@ import {
|
|
|
35
35
|
colors,
|
|
36
36
|
log
|
|
37
37
|
} from "./chunk-Z6NXFC4Q.js";
|
|
38
|
-
import {
|
|
39
|
-
encodeProjectPath,
|
|
40
|
-
findProject,
|
|
41
|
-
findProjectForCurrentDir,
|
|
42
|
-
findProjectFromArray,
|
|
43
|
-
findSessionByBranch,
|
|
44
|
-
formatDate,
|
|
45
|
-
formatRelativeTime,
|
|
46
|
-
getAllClaudeProjects,
|
|
47
|
-
getClaudeProjectsPath,
|
|
48
|
-
getProjectName,
|
|
49
|
-
getRecoveredContext,
|
|
50
|
-
getSessionStats,
|
|
51
|
-
invalidateSessionsCache,
|
|
52
|
-
isSessionActive,
|
|
53
|
-
isSessionCorrupted,
|
|
54
|
-
isSessionCorruptedQuick,
|
|
55
|
-
isValidProjectPath,
|
|
56
|
-
isValidSessionId,
|
|
57
|
-
maskSecret,
|
|
58
|
-
sanitizeForLog,
|
|
59
|
-
saveRecoveredContext
|
|
60
|
-
} from "./chunk-H5OFO4VS.js";
|
|
61
38
|
import {
|
|
62
39
|
SECURITY_PRESETS,
|
|
63
40
|
addDockerMount,
|
|
@@ -85,6 +62,29 @@ import {
|
|
|
85
62
|
updateSessionLimits,
|
|
86
63
|
updateTimeControl
|
|
87
64
|
} from "./chunk-PMA6MGQW.js";
|
|
65
|
+
import {
|
|
66
|
+
encodeProjectPath,
|
|
67
|
+
findProject,
|
|
68
|
+
findProjectForCurrentDir,
|
|
69
|
+
findProjectFromArray,
|
|
70
|
+
findSessionByBranch,
|
|
71
|
+
formatDate,
|
|
72
|
+
formatRelativeTime,
|
|
73
|
+
getAllClaudeProjects,
|
|
74
|
+
getClaudeProjectsPath,
|
|
75
|
+
getProjectName,
|
|
76
|
+
getRecoveredContext,
|
|
77
|
+
getSessionStats,
|
|
78
|
+
invalidateSessionsCache,
|
|
79
|
+
isSessionActive,
|
|
80
|
+
isSessionCorrupted,
|
|
81
|
+
isSessionCorruptedQuick,
|
|
82
|
+
isValidProjectPath,
|
|
83
|
+
isValidSessionId,
|
|
84
|
+
maskSecret,
|
|
85
|
+
sanitizeForLog,
|
|
86
|
+
saveRecoveredContext
|
|
87
|
+
} from "./chunk-H5OFO4VS.js";
|
|
88
88
|
import {
|
|
89
89
|
formatContextAsMarkdown,
|
|
90
90
|
generateGitHubContext,
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
} from "./chunk-3RG5ZIWI.js";
|
|
113
113
|
|
|
114
114
|
// src/index.ts
|
|
115
|
-
import { Command as
|
|
115
|
+
import { Command as Command39 } from "commander";
|
|
116
116
|
import * as readline from "readline";
|
|
117
117
|
|
|
118
118
|
// src/commands/auth/login.ts
|
|
@@ -571,12 +571,12 @@ async function findAvailablePort() {
|
|
|
571
571
|
throw new Error("Kein freier Port f\xFCr Callback-Server gefunden");
|
|
572
572
|
}
|
|
573
573
|
function checkPort(port) {
|
|
574
|
-
return new Promise((
|
|
574
|
+
return new Promise((resolve14) => {
|
|
575
575
|
const server = http.createServer();
|
|
576
|
-
server.once("error", () =>
|
|
576
|
+
server.once("error", () => resolve14(false));
|
|
577
577
|
server.once("listening", () => {
|
|
578
578
|
server.close();
|
|
579
|
-
|
|
579
|
+
resolve14(true);
|
|
580
580
|
});
|
|
581
581
|
server.listen(port, "127.0.0.1");
|
|
582
582
|
});
|
|
@@ -729,7 +729,7 @@ function getCallbackHtml(type2, data) {
|
|
|
729
729
|
</html>`;
|
|
730
730
|
}
|
|
731
731
|
function startCallbackServer(port) {
|
|
732
|
-
return new Promise((
|
|
732
|
+
return new Promise((resolve14, reject) => {
|
|
733
733
|
const server = http.createServer((req, res) => {
|
|
734
734
|
const url = new URL2(req.url || "/", `http://127.0.0.1:${port}`);
|
|
735
735
|
if (url.pathname === "/callback") {
|
|
@@ -755,7 +755,7 @@ function startCallbackServer(port) {
|
|
|
755
755
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
756
756
|
res.end(getCallbackHtml("success", { email }));
|
|
757
757
|
server.close();
|
|
758
|
-
|
|
758
|
+
resolve14({
|
|
759
759
|
token,
|
|
760
760
|
user: {
|
|
761
761
|
id: parseInt(userId, 10),
|
|
@@ -992,7 +992,7 @@ var logoutCommand = new Command2("logout").description("Abmelden").action(() =>
|
|
|
992
992
|
|
|
993
993
|
// src/commands/project/init.ts
|
|
994
994
|
import { Command as Command3 } from "commander";
|
|
995
|
-
import { writeFileSync, existsSync as existsSync2 } from "fs";
|
|
995
|
+
import { writeFileSync, existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
996
996
|
import { resolve as resolve2 } from "path";
|
|
997
997
|
import ora from "ora";
|
|
998
998
|
import inquirer3 from "inquirer";
|
|
@@ -1202,6 +1202,65 @@ function parseClaudeMd(content) {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
return { memories };
|
|
1204
1204
|
}
|
|
1205
|
+
function hasShivaInstructions(content) {
|
|
1206
|
+
return content.includes("### SHIVA Instructions") || content.includes("## SHIVA Code");
|
|
1207
|
+
}
|
|
1208
|
+
function generateShivaSection(project) {
|
|
1209
|
+
const lines = [];
|
|
1210
|
+
lines.push("");
|
|
1211
|
+
lines.push("## SHIVA Code");
|
|
1212
|
+
lines.push("");
|
|
1213
|
+
lines.push("This project is managed by [SHIVA Code](https://shiva.li).");
|
|
1214
|
+
lines.push("");
|
|
1215
|
+
if (project) {
|
|
1216
|
+
lines.push(`- **Status**: ${project.synced ? "Synced" : "Pending"}`);
|
|
1217
|
+
if (project.last_synced_at) {
|
|
1218
|
+
lines.push(`- **Last Sync**: ${new Date(project.last_synced_at).toLocaleString()}`);
|
|
1219
|
+
}
|
|
1220
|
+
lines.push(`- **Project ID**: ${project.id}`);
|
|
1221
|
+
} else {
|
|
1222
|
+
lines.push("- **Status**: Not synced");
|
|
1223
|
+
lines.push("- **Last Sync**: Never");
|
|
1224
|
+
}
|
|
1225
|
+
lines.push("");
|
|
1226
|
+
lines.push("### SHIVA Instructions");
|
|
1227
|
+
lines.push("");
|
|
1228
|
+
lines.push("IMPORTANT: Du MUSST diese Befehle nutzen um Informationen \xFCber Sessions hinweg zu speichern!");
|
|
1229
|
+
lines.push("");
|
|
1230
|
+
lines.push("**Memory speichern** - Wenn der User dich bittet etwas zu merken oder wichtige Infos auftauchen:");
|
|
1231
|
+
lines.push("```bash");
|
|
1232
|
+
lines.push('shiva remember "Die wichtige Information die gemerkt werden soll"');
|
|
1233
|
+
lines.push("```");
|
|
1234
|
+
lines.push("");
|
|
1235
|
+
lines.push("**Memories durchsuchen** - Um gespeicherte Informationen zu finden:");
|
|
1236
|
+
lines.push("```bash");
|
|
1237
|
+
lines.push('shiva search "suchbegriff"');
|
|
1238
|
+
lines.push("```");
|
|
1239
|
+
lines.push("");
|
|
1240
|
+
lines.push("**Wann Memories speichern:**");
|
|
1241
|
+
lines.push('- User sagt "merk dir...", "speicher...", "erinner dich..."');
|
|
1242
|
+
lines.push("- Wichtige Projektentscheidungen");
|
|
1243
|
+
lines.push("- API Keys, Secrets, Konfigurationen (nutze `shiva secrets add`)");
|
|
1244
|
+
lines.push("- Wichtige Code-Patterns oder Konventionen");
|
|
1245
|
+
lines.push("- Alles was in zuk\xFCnftigen Sessions relevant sein k\xF6nnte");
|
|
1246
|
+
lines.push("");
|
|
1247
|
+
lines.push("## Memories");
|
|
1248
|
+
lines.push("");
|
|
1249
|
+
if (project?.memories && project.memories.length > 0) {
|
|
1250
|
+
lines.push("The following context is remembered across sessions:");
|
|
1251
|
+
lines.push("");
|
|
1252
|
+
for (const memory of project.memories) {
|
|
1253
|
+
lines.push(`- **${memory.key}** (${memory.category}): ${memory.value}`);
|
|
1254
|
+
}
|
|
1255
|
+
} else {
|
|
1256
|
+
lines.push("No memories stored yet. Use `shiva sync` to sync your project.");
|
|
1257
|
+
}
|
|
1258
|
+
lines.push("");
|
|
1259
|
+
lines.push("---");
|
|
1260
|
+
lines.push("");
|
|
1261
|
+
lines.push("*Generated by SHIVA Code CLI*");
|
|
1262
|
+
return lines.join("\n");
|
|
1263
|
+
}
|
|
1205
1264
|
|
|
1206
1265
|
// src/services/data/templates.ts
|
|
1207
1266
|
var templates = {
|
|
@@ -1452,7 +1511,7 @@ function getTemplateDescriptions() {
|
|
|
1452
1511
|
}
|
|
1453
1512
|
|
|
1454
1513
|
// src/commands/project/init.ts
|
|
1455
|
-
var initCommand = new Command3("init").description("Projekt f\xFCr SHIVA Code initialisieren").option("-d, --dir <directory>", "Projektverzeichnis", ".").option("-t, --template <name>", "Template verwenden (api, frontend, cli, fullstack, library)").option("-f, --force", "CLAUDE.md \xFCberschreiben wenn vorhanden").option("--no-sync", "Nicht mit Cloud synchronisieren").option("--list-templates", "Verf\xFCgbare Templates anzeigen").action(async (options) => {
|
|
1514
|
+
var initCommand = new Command3("init").description("Projekt f\xFCr SHIVA Code initialisieren").option("-d, --dir <directory>", "Projektverzeichnis", ".").option("-t, --template <name>", "Template verwenden (api, frontend, cli, fullstack, library)").option("-f, --force", "CLAUDE.md \xFCberschreiben wenn vorhanden").option("--no-sync", "Nicht mit Cloud synchronisieren").option("--list-templates", "Verf\xFCgbare Templates anzeigen").option("--repair", "Repariert fehlende projectId in Config").action(async (options) => {
|
|
1456
1515
|
log.brand();
|
|
1457
1516
|
if (options.listTemplates) {
|
|
1458
1517
|
console.log(colors.bold("Verf\xFCgbare Templates:"));
|
|
@@ -1486,21 +1545,61 @@ var initCommand = new Command3("init").description("Projekt f\xFCr SHIVA Code in
|
|
|
1486
1545
|
if (scanned.framework) log.keyValue("Framework", scanned.framework, 2);
|
|
1487
1546
|
if (scanned.packageManager) log.keyValue("Package Manager", scanned.packageManager, 2);
|
|
1488
1547
|
log.newline();
|
|
1548
|
+
const existingConfig = getProjectConfig(projectDir);
|
|
1489
1549
|
const claudeMdPath = resolve2(projectDir, "CLAUDE.md");
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1550
|
+
const claudeMdExists = existsSync2(claudeMdPath);
|
|
1551
|
+
let existingClaudeMd = "";
|
|
1552
|
+
let shivaInstructionsExist = false;
|
|
1553
|
+
if (claudeMdExists) {
|
|
1554
|
+
existingClaudeMd = readFileSync2(claudeMdPath, "utf-8");
|
|
1555
|
+
shivaInstructionsExist = hasShivaInstructions(existingClaudeMd);
|
|
1556
|
+
}
|
|
1557
|
+
let claudeMdAction = "replace";
|
|
1558
|
+
if (claudeMdExists && !options.force) {
|
|
1559
|
+
if (shivaInstructionsExist) {
|
|
1560
|
+
if (existingConfig.projectId) {
|
|
1561
|
+
log.success("SHIVA bereits konfiguriert");
|
|
1562
|
+
if (options.repair) {
|
|
1563
|
+
claudeMdAction = "repair-only";
|
|
1564
|
+
} else {
|
|
1565
|
+
const { action } = await inquirer3.prompt([
|
|
1566
|
+
{
|
|
1567
|
+
type: "list",
|
|
1568
|
+
name: "action",
|
|
1569
|
+
message: "CLAUDE.md hat bereits SHIVA-Anweisungen. Was m\xF6chtest du tun?",
|
|
1570
|
+
choices: [
|
|
1571
|
+
{ name: "Config reparieren (projectId pr\xFCfen)", value: "repair-only" },
|
|
1572
|
+
{ name: "CLAUDE.md komplett ersetzen", value: "replace" },
|
|
1573
|
+
{ name: "Abbrechen", value: "skip" }
|
|
1574
|
+
]
|
|
1575
|
+
}
|
|
1576
|
+
]);
|
|
1577
|
+
claudeMdAction = action;
|
|
1578
|
+
}
|
|
1579
|
+
} else {
|
|
1580
|
+
log.warn("SHIVA-Anweisungen vorhanden, aber projectId fehlt");
|
|
1581
|
+
claudeMdAction = "repair-only";
|
|
1497
1582
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1583
|
+
} else {
|
|
1584
|
+
const { action } = await inquirer3.prompt([
|
|
1585
|
+
{
|
|
1586
|
+
type: "list",
|
|
1587
|
+
name: "action",
|
|
1588
|
+
message: "CLAUDE.md existiert, aber SHIVA-Anweisungen fehlen. Was m\xF6chtest du tun?",
|
|
1589
|
+
choices: [
|
|
1590
|
+
{ name: "SHIVA-Sektion anf\xFCgen (empfohlen)", value: "append" },
|
|
1591
|
+
{ name: "CLAUDE.md komplett ersetzen", value: "replace" },
|
|
1592
|
+
{ name: "Abbrechen", value: "skip" }
|
|
1593
|
+
]
|
|
1594
|
+
}
|
|
1595
|
+
]);
|
|
1596
|
+
claudeMdAction = action;
|
|
1502
1597
|
}
|
|
1503
1598
|
}
|
|
1599
|
+
if (claudeMdAction === "skip") {
|
|
1600
|
+
log.info("CLAUDE.md wurde nicht ver\xE4ndert");
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1504
1603
|
let project = null;
|
|
1505
1604
|
if (options.sync && isAuthenticated()) {
|
|
1506
1605
|
const syncSpinner = ora("Synchronisiere mit Cloud...").start();
|
|
@@ -1516,6 +1615,7 @@ var initCommand = new Command3("init").description("Projekt f\xFCr SHIVA Code in
|
|
|
1516
1615
|
}
|
|
1517
1616
|
});
|
|
1518
1617
|
project = await api.getProject(result.projectId);
|
|
1618
|
+
updateProjectConfig(projectDir, { projectId: result.projectId });
|
|
1519
1619
|
syncSpinner.succeed(`Projekt ${result.action === "created" ? "erstellt" : "aktualisiert"}`);
|
|
1520
1620
|
} catch (error) {
|
|
1521
1621
|
syncSpinner.warn("Cloud-Sync fehlgeschlagen (offline?)");
|
|
@@ -1523,44 +1623,58 @@ var initCommand = new Command3("init").description("Projekt f\xFCr SHIVA Code in
|
|
|
1523
1623
|
} else if (!isAuthenticated()) {
|
|
1524
1624
|
log.dim('Tipp: Mit "shiva login" anmelden f\xFCr Cloud-Sync');
|
|
1525
1625
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1626
|
+
if (claudeMdAction === "repair-only") {
|
|
1627
|
+
log.success("Config repariert");
|
|
1628
|
+
log.newline();
|
|
1629
|
+
log.success("Projekt ist bereit!");
|
|
1630
|
+
} else {
|
|
1631
|
+
let claudeMdContent;
|
|
1632
|
+
if (options.template) {
|
|
1633
|
+
const template = getTemplate(options.template);
|
|
1634
|
+
if (!template) {
|
|
1635
|
+
log.error(`Template nicht gefunden: ${options.template}`);
|
|
1636
|
+
log.info("Verf\xFCgbare Templates: " + getTemplateNames().join(", "));
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
claudeMdContent = `# ${scanned.name}
|
|
1535
1640
|
|
|
1536
1641
|
`;
|
|
1537
|
-
|
|
1642
|
+
claudeMdContent += `**Template:** ${template.name}
|
|
1538
1643
|
|
|
1539
1644
|
`;
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1645
|
+
claudeMdContent += template.claudeMd;
|
|
1646
|
+
if (template.secrets.length > 0) {
|
|
1647
|
+
claudeMdContent += `
|
|
1543
1648
|
## Required Secrets
|
|
1544
1649
|
|
|
1545
1650
|
`;
|
|
1546
|
-
|
|
1651
|
+
claudeMdContent += `This project needs the following secrets:
|
|
1547
1652
|
`;
|
|
1548
|
-
|
|
1549
|
-
|
|
1653
|
+
for (const secret of template.secrets) {
|
|
1654
|
+
claudeMdContent += `- \`${secret}\`
|
|
1550
1655
|
`;
|
|
1551
|
-
|
|
1552
|
-
|
|
1656
|
+
}
|
|
1657
|
+
claudeMdContent += `
|
|
1553
1658
|
Add with: \`shiva secrets add <KEY> <VALUE>\`
|
|
1554
1659
|
`;
|
|
1660
|
+
}
|
|
1661
|
+
claudeMdContent += generateShivaSection(project || void 0);
|
|
1662
|
+
log.info(`Template "${options.template}" verwendet`);
|
|
1663
|
+
} else if (claudeMdAction === "append") {
|
|
1664
|
+
claudeMdContent = existingClaudeMd + generateShivaSection(project || void 0);
|
|
1665
|
+
log.info("SHIVA-Sektion angef\xFCgt");
|
|
1666
|
+
} else {
|
|
1667
|
+
claudeMdContent = generateClaudeMd(scanned, project || void 0);
|
|
1555
1668
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1669
|
+
writeFileSync(claudeMdPath, claudeMdContent);
|
|
1670
|
+
if (claudeMdAction === "append") {
|
|
1671
|
+
log.success("CLAUDE.md aktualisiert");
|
|
1672
|
+
} else {
|
|
1673
|
+
log.success("CLAUDE.md erstellt");
|
|
1674
|
+
}
|
|
1675
|
+
log.newline();
|
|
1676
|
+
log.success("Projekt initialisiert!");
|
|
1559
1677
|
}
|
|
1560
|
-
writeFileSync(claudeMdPath, claudeMdContent);
|
|
1561
|
-
log.success("CLAUDE.md erstellt");
|
|
1562
|
-
log.newline();
|
|
1563
|
-
log.success("Projekt initialisiert!");
|
|
1564
1678
|
if (!isAuthenticated()) {
|
|
1565
1679
|
log.newline();
|
|
1566
1680
|
log.info("N\xE4chste Schritte:");
|
|
@@ -1878,6 +1992,7 @@ var syncCommand = new Command5("sync").description("Projekt mit Cloud synchronis
|
|
|
1878
1992
|
return;
|
|
1879
1993
|
}
|
|
1880
1994
|
}
|
|
1995
|
+
updateProjectConfig(projectDir, { projectId: project.id });
|
|
1881
1996
|
let memories = [];
|
|
1882
1997
|
if (scanned.claudeMdContent) {
|
|
1883
1998
|
const parsed = parseClaudeMd(scanned.claudeMdContent);
|
|
@@ -1970,6 +2085,7 @@ async function syncAllProjects(options) {
|
|
|
1970
2085
|
});
|
|
1971
2086
|
cloudProject = await api.getProject(result.projectId);
|
|
1972
2087
|
}
|
|
2088
|
+
updateProjectConfig(projectDir, { projectId: cloudProject.id });
|
|
1973
2089
|
let memories = [];
|
|
1974
2090
|
if (scanned.claudeMdContent) {
|
|
1975
2091
|
const parsed = parseClaudeMd(scanned.claudeMdContent);
|
|
@@ -3749,11 +3865,139 @@ projectCommand.command("status").description("Projekt-Status anzeigen").action(a
|
|
|
3749
3865
|
log.newline();
|
|
3750
3866
|
});
|
|
3751
3867
|
|
|
3752
|
-
// src/commands/
|
|
3868
|
+
// src/commands/project/repair.ts
|
|
3753
3869
|
import { Command as Command10 } from "commander";
|
|
3870
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
|
|
3871
|
+
import { resolve as resolve6 } from "path";
|
|
3872
|
+
import ora6 from "ora";
|
|
3873
|
+
var repairCommand = new Command10("repair").description("Repariert SHIVA-Konfiguration (fehlende projectId, etc.)").option("-d, --dir <directory>", "Projektverzeichnis", ".").option("-v, --verbose", "Detaillierte Ausgabe").action(async (options) => {
|
|
3874
|
+
log.brand();
|
|
3875
|
+
const projectDir = resolve6(options.dir);
|
|
3876
|
+
const results = [];
|
|
3877
|
+
if (!existsSync6(projectDir)) {
|
|
3878
|
+
log.error(`Verzeichnis nicht gefunden: ${projectDir}`);
|
|
3879
|
+
return;
|
|
3880
|
+
}
|
|
3881
|
+
log.header("SHIVA Repair");
|
|
3882
|
+
log.newline();
|
|
3883
|
+
const spinner = ora6("Pr\xFCfe Konfiguration...").start();
|
|
3884
|
+
if (!hasShivaDir(projectDir)) {
|
|
3885
|
+
spinner.warn(".shiva Verzeichnis fehlt");
|
|
3886
|
+
results.push({
|
|
3887
|
+
issue: ".shiva Verzeichnis",
|
|
3888
|
+
status: "failed",
|
|
3889
|
+
message: 'F\xFChre "shiva init" aus um das Projekt zu initialisieren'
|
|
3890
|
+
});
|
|
3891
|
+
} else {
|
|
3892
|
+
results.push({
|
|
3893
|
+
issue: ".shiva Verzeichnis",
|
|
3894
|
+
status: "ok",
|
|
3895
|
+
message: "Vorhanden"
|
|
3896
|
+
});
|
|
3897
|
+
}
|
|
3898
|
+
const claudeMdPath = resolve6(projectDir, "CLAUDE.md");
|
|
3899
|
+
if (!existsSync6(claudeMdPath)) {
|
|
3900
|
+
results.push({
|
|
3901
|
+
issue: "CLAUDE.md",
|
|
3902
|
+
status: "failed",
|
|
3903
|
+
message: 'F\xFChre "shiva init" aus um CLAUDE.md zu erstellen'
|
|
3904
|
+
});
|
|
3905
|
+
} else {
|
|
3906
|
+
const claudeMdContent = readFileSync3(claudeMdPath, "utf-8");
|
|
3907
|
+
if (hasShivaInstructions(claudeMdContent)) {
|
|
3908
|
+
results.push({
|
|
3909
|
+
issue: "CLAUDE.md SHIVA-Anweisungen",
|
|
3910
|
+
status: "ok",
|
|
3911
|
+
message: "Vorhanden"
|
|
3912
|
+
});
|
|
3913
|
+
} else {
|
|
3914
|
+
results.push({
|
|
3915
|
+
issue: "CLAUDE.md SHIVA-Anweisungen",
|
|
3916
|
+
status: "failed",
|
|
3917
|
+
message: 'F\xFChre "shiva init" aus um SHIVA-Anweisungen hinzuzuf\xFCgen'
|
|
3918
|
+
});
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
const config = getProjectConfig(projectDir);
|
|
3922
|
+
if (!config.projectId) {
|
|
3923
|
+
spinner.text = "Versuche projectId von Cloud zu holen...";
|
|
3924
|
+
if (!isAuthenticated()) {
|
|
3925
|
+
results.push({
|
|
3926
|
+
issue: "projectId in Config",
|
|
3927
|
+
status: "failed",
|
|
3928
|
+
message: 'Nicht angemeldet - f\xFChre "shiva login" aus'
|
|
3929
|
+
});
|
|
3930
|
+
} else {
|
|
3931
|
+
try {
|
|
3932
|
+
const project = await api.findProjectByPath(projectDir);
|
|
3933
|
+
if (project) {
|
|
3934
|
+
updateProjectConfig(projectDir, { projectId: project.id });
|
|
3935
|
+
results.push({
|
|
3936
|
+
issue: "projectId in Config",
|
|
3937
|
+
status: "fixed",
|
|
3938
|
+
message: `Repariert (ID: ${project.id})`
|
|
3939
|
+
});
|
|
3940
|
+
} else {
|
|
3941
|
+
spinner.text = "Erstelle Projekt in Cloud...";
|
|
3942
|
+
const result = await api.createOrUpdateProject({
|
|
3943
|
+
name: __require("path").basename(projectDir),
|
|
3944
|
+
path: projectDir
|
|
3945
|
+
});
|
|
3946
|
+
updateProjectConfig(projectDir, { projectId: result.projectId });
|
|
3947
|
+
results.push({
|
|
3948
|
+
issue: "projectId in Config",
|
|
3949
|
+
status: "fixed",
|
|
3950
|
+
message: `Projekt erstellt (ID: ${result.projectId})`
|
|
3951
|
+
});
|
|
3952
|
+
}
|
|
3953
|
+
} catch (error) {
|
|
3954
|
+
results.push({
|
|
3955
|
+
issue: "projectId in Config",
|
|
3956
|
+
status: "failed",
|
|
3957
|
+
message: error instanceof Error ? error.message : "Cloud-Fehler"
|
|
3958
|
+
});
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
} else {
|
|
3962
|
+
results.push({
|
|
3963
|
+
issue: "projectId in Config",
|
|
3964
|
+
status: "ok",
|
|
3965
|
+
message: `ID: ${config.projectId}`
|
|
3966
|
+
});
|
|
3967
|
+
}
|
|
3968
|
+
spinner.stop();
|
|
3969
|
+
log.newline();
|
|
3970
|
+
const fixed = results.filter((r) => r.status === "fixed").length;
|
|
3971
|
+
const failed = results.filter((r) => r.status === "failed").length;
|
|
3972
|
+
const ok = results.filter((r) => r.status === "ok").length;
|
|
3973
|
+
for (const result of results) {
|
|
3974
|
+
const icon = result.status === "ok" ? colors.green("\u2713") : result.status === "fixed" ? colors.yellow("\u26A1") : colors.red("\u2717");
|
|
3975
|
+
const statusText = result.status === "fixed" ? colors.yellow("REPARIERT") : result.status === "ok" ? colors.green("OK") : colors.red("FEHLT");
|
|
3976
|
+
console.log(` ${icon} ${result.issue}`);
|
|
3977
|
+
if (options.verbose || result.status !== "ok") {
|
|
3978
|
+
console.log(` ${colors.dim(result.message)}`);
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
log.newline();
|
|
3982
|
+
log.separator("\u2500", 40);
|
|
3983
|
+
if (failed === 0) {
|
|
3984
|
+
if (fixed > 0) {
|
|
3985
|
+
log.success(`${fixed} Problem${fixed > 1 ? "e" : ""} repariert!`);
|
|
3986
|
+
} else {
|
|
3987
|
+
log.success("Alles in Ordnung!");
|
|
3988
|
+
}
|
|
3989
|
+
} else {
|
|
3990
|
+
log.warn(`${failed} Problem${failed > 1 ? "e" : ""} gefunden`);
|
|
3991
|
+
log.info("F\xFChre die vorgeschlagenen Befehle aus um zu reparieren");
|
|
3992
|
+
}
|
|
3993
|
+
log.newline();
|
|
3994
|
+
});
|
|
3995
|
+
|
|
3996
|
+
// src/commands/session/start.ts
|
|
3997
|
+
import { Command as Command11 } from "commander";
|
|
3754
3998
|
import * as fs from "fs";
|
|
3755
3999
|
import * as path3 from "path";
|
|
3756
|
-
import
|
|
4000
|
+
import ora7 from "ora";
|
|
3757
4001
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
3758
4002
|
|
|
3759
4003
|
// src/services/infrastructure/terminal.ts
|
|
@@ -3865,11 +4109,11 @@ var DockerService = class {
|
|
|
3865
4109
|
throw new Error(`Invalid image name: ${sanitizeForLog(image)}`);
|
|
3866
4110
|
}
|
|
3867
4111
|
const cmd = this.getCommand();
|
|
3868
|
-
return new Promise((
|
|
4112
|
+
return new Promise((resolve14, reject) => {
|
|
3869
4113
|
const pull = spawn(cmd, ["pull", image], { stdio: "inherit" });
|
|
3870
4114
|
pull.on("close", (code) => {
|
|
3871
4115
|
if (code === 0) {
|
|
3872
|
-
|
|
4116
|
+
resolve14();
|
|
3873
4117
|
} else {
|
|
3874
4118
|
reject(new Error(`Failed to pull image: ${sanitizeForLog(image)}`));
|
|
3875
4119
|
}
|
|
@@ -4918,7 +5162,7 @@ function getTerminalName(terminal) {
|
|
|
4918
5162
|
|
|
4919
5163
|
// src/services/sandbox/sandbox.ts
|
|
4920
5164
|
import { execSync } from "child_process";
|
|
4921
|
-
import { existsSync as
|
|
5165
|
+
import { existsSync as existsSync7, mkdirSync, rmSync, readdirSync as readdirSync2, copyFileSync, readFileSync as readFileSync4 } from "fs";
|
|
4922
5166
|
import { join as join3, dirname } from "path";
|
|
4923
5167
|
import { randomUUID } from "crypto";
|
|
4924
5168
|
import Conf2 from "conf";
|
|
@@ -5089,13 +5333,13 @@ var SandboxService = class {
|
|
|
5089
5333
|
for (const file of untrackedFiles) {
|
|
5090
5334
|
const srcPath = join3(projectPath, file);
|
|
5091
5335
|
const destPath = join3(sandboxPath, file);
|
|
5092
|
-
if (!
|
|
5336
|
+
if (!existsSync7(srcPath)) continue;
|
|
5093
5337
|
const config = this.getConfig();
|
|
5094
5338
|
if (config.excludePaths.some((excluded) => file.startsWith(excluded))) {
|
|
5095
5339
|
continue;
|
|
5096
5340
|
}
|
|
5097
5341
|
const destDir = dirname(destPath);
|
|
5098
|
-
if (!
|
|
5342
|
+
if (!existsSync7(destDir)) {
|
|
5099
5343
|
mkdirSync(destDir, { recursive: true });
|
|
5100
5344
|
}
|
|
5101
5345
|
copyFileSync(srcPath, destPath);
|
|
@@ -5214,7 +5458,7 @@ var SandboxService = class {
|
|
|
5214
5458
|
stdio: "pipe"
|
|
5215
5459
|
});
|
|
5216
5460
|
} catch {
|
|
5217
|
-
if (
|
|
5461
|
+
if (existsSync7(session.sandboxPath)) {
|
|
5218
5462
|
rmSync(session.sandboxPath, { recursive: true, force: true });
|
|
5219
5463
|
}
|
|
5220
5464
|
try {
|
|
@@ -5226,7 +5470,7 @@ var SandboxService = class {
|
|
|
5226
5470
|
}
|
|
5227
5471
|
}
|
|
5228
5472
|
} else {
|
|
5229
|
-
if (
|
|
5473
|
+
if (existsSync7(session.sandboxPath)) {
|
|
5230
5474
|
rmSync(session.sandboxPath, { recursive: true, force: true });
|
|
5231
5475
|
}
|
|
5232
5476
|
}
|
|
@@ -5271,8 +5515,8 @@ var SandboxService = class {
|
|
|
5271
5515
|
const untrackedFiles = untrackedOutput.split("\n").filter((f) => f.trim().length > 0);
|
|
5272
5516
|
for (const file of untrackedFiles) {
|
|
5273
5517
|
const filePath = join3(session.sandboxPath, file);
|
|
5274
|
-
if (
|
|
5275
|
-
const content =
|
|
5518
|
+
if (existsSync7(filePath)) {
|
|
5519
|
+
const content = readFileSync4(filePath, "utf-8");
|
|
5276
5520
|
const lineCount = content.split("\n").length;
|
|
5277
5521
|
changes.push({
|
|
5278
5522
|
type: "added",
|
|
@@ -5306,7 +5550,7 @@ var SandboxService = class {
|
|
|
5306
5550
|
const config = this.getConfig();
|
|
5307
5551
|
const sandboxEntries = /* @__PURE__ */ new Set();
|
|
5308
5552
|
const sandboxFullPath = join3(sandboxPath, relativePath);
|
|
5309
|
-
if (
|
|
5553
|
+
if (existsSync7(sandboxFullPath)) {
|
|
5310
5554
|
const entries = readdirSync2(sandboxFullPath, { withFileTypes: true });
|
|
5311
5555
|
for (const entry of entries) {
|
|
5312
5556
|
if (config.excludePaths.includes(entry.name) || entry.name === ".shiva") {
|
|
@@ -5317,14 +5561,14 @@ var SandboxService = class {
|
|
|
5317
5561
|
const originalEntryPath = join3(originalPath, entryRelPath);
|
|
5318
5562
|
const sandboxEntryPath = join3(sandboxPath, entryRelPath);
|
|
5319
5563
|
if (entry.isDirectory()) {
|
|
5320
|
-
if (!
|
|
5564
|
+
if (!existsSync7(originalEntryPath)) {
|
|
5321
5565
|
await this.countNewDirectoryChanges(sandboxEntryPath, entryRelPath, changes);
|
|
5322
5566
|
} else {
|
|
5323
5567
|
await this.compareDirectories(originalPath, sandboxPath, entryRelPath, changes);
|
|
5324
5568
|
}
|
|
5325
5569
|
} else {
|
|
5326
|
-
if (!
|
|
5327
|
-
const content =
|
|
5570
|
+
if (!existsSync7(originalEntryPath)) {
|
|
5571
|
+
const content = readFileSync4(sandboxEntryPath, "utf-8");
|
|
5328
5572
|
changes.push({
|
|
5329
5573
|
type: "added",
|
|
5330
5574
|
path: entryRelPath,
|
|
@@ -5333,8 +5577,8 @@ var SandboxService = class {
|
|
|
5333
5577
|
selected: true
|
|
5334
5578
|
});
|
|
5335
5579
|
} else {
|
|
5336
|
-
const originalContent =
|
|
5337
|
-
const sandboxContent =
|
|
5580
|
+
const originalContent = readFileSync4(originalEntryPath, "utf-8");
|
|
5581
|
+
const sandboxContent = readFileSync4(sandboxEntryPath, "utf-8");
|
|
5338
5582
|
if (originalContent !== sandboxContent) {
|
|
5339
5583
|
const { additions, deletions } = this.countLineDiff(originalContent, sandboxContent);
|
|
5340
5584
|
changes.push({
|
|
@@ -5350,7 +5594,7 @@ var SandboxService = class {
|
|
|
5350
5594
|
}
|
|
5351
5595
|
}
|
|
5352
5596
|
const originalFullPath = join3(originalPath, relativePath);
|
|
5353
|
-
if (
|
|
5597
|
+
if (existsSync7(originalFullPath)) {
|
|
5354
5598
|
const entries = readdirSync2(originalFullPath, { withFileTypes: true });
|
|
5355
5599
|
for (const entry of entries) {
|
|
5356
5600
|
if (config.excludePaths.includes(entry.name) || entry.name === ".shiva") {
|
|
@@ -5362,7 +5606,7 @@ var SandboxService = class {
|
|
|
5362
5606
|
if (entry.isDirectory()) {
|
|
5363
5607
|
await this.countDeletedDirectoryChanges(originalEntryPath, entryRelPath, changes);
|
|
5364
5608
|
} else {
|
|
5365
|
-
const content =
|
|
5609
|
+
const content = readFileSync4(originalEntryPath, "utf-8");
|
|
5366
5610
|
changes.push({
|
|
5367
5611
|
type: "deleted",
|
|
5368
5612
|
path: entryRelPath,
|
|
@@ -5406,7 +5650,7 @@ var SandboxService = class {
|
|
|
5406
5650
|
if (entry.isDirectory()) {
|
|
5407
5651
|
await this.countNewDirectoryChanges(entryPath, entryRelPath, changes);
|
|
5408
5652
|
} else {
|
|
5409
|
-
const content =
|
|
5653
|
+
const content = readFileSync4(entryPath, "utf-8");
|
|
5410
5654
|
changes.push({
|
|
5411
5655
|
type: "added",
|
|
5412
5656
|
path: entryRelPath,
|
|
@@ -5430,7 +5674,7 @@ var SandboxService = class {
|
|
|
5430
5674
|
if (entry.isDirectory()) {
|
|
5431
5675
|
await this.countDeletedDirectoryChanges(entryPath, entryRelPath, changes);
|
|
5432
5676
|
} else {
|
|
5433
|
-
const content =
|
|
5677
|
+
const content = readFileSync4(entryPath, "utf-8");
|
|
5434
5678
|
changes.push({
|
|
5435
5679
|
type: "deleted",
|
|
5436
5680
|
path: entryRelPath,
|
|
@@ -5458,8 +5702,8 @@ var SandboxService = class {
|
|
|
5458
5702
|
return diff || "(no changes)";
|
|
5459
5703
|
} catch {
|
|
5460
5704
|
const sandboxFilePath2 = join3(session.sandboxPath, filePath);
|
|
5461
|
-
if (
|
|
5462
|
-
const content =
|
|
5705
|
+
if (existsSync7(sandboxFilePath2)) {
|
|
5706
|
+
const content = readFileSync4(sandboxFilePath2, "utf-8");
|
|
5463
5707
|
return `+++ ${filePath} (new file)
|
|
5464
5708
|
${content.split("\n").map((l) => `+ ${l}`).join("\n")}`;
|
|
5465
5709
|
}
|
|
@@ -5468,21 +5712,21 @@ ${content.split("\n").map((l) => `+ ${l}`).join("\n")}`;
|
|
|
5468
5712
|
}
|
|
5469
5713
|
const originalPath = join3(session.projectPath, filePath);
|
|
5470
5714
|
const sandboxFilePath = join3(session.sandboxPath, filePath);
|
|
5471
|
-
const originalExists =
|
|
5472
|
-
const sandboxExists =
|
|
5715
|
+
const originalExists = existsSync7(originalPath);
|
|
5716
|
+
const sandboxExists = existsSync7(sandboxFilePath);
|
|
5473
5717
|
if (!originalExists && sandboxExists) {
|
|
5474
|
-
const content =
|
|
5718
|
+
const content = readFileSync4(sandboxFilePath, "utf-8");
|
|
5475
5719
|
return `+++ ${filePath} (new file)
|
|
5476
5720
|
${content.split("\n").map((l) => `+ ${l}`).join("\n")}`;
|
|
5477
5721
|
}
|
|
5478
5722
|
if (originalExists && !sandboxExists) {
|
|
5479
|
-
const content =
|
|
5723
|
+
const content = readFileSync4(originalPath, "utf-8");
|
|
5480
5724
|
return `--- ${filePath} (deleted)
|
|
5481
5725
|
${content.split("\n").map((l) => `- ${l}`).join("\n")}`;
|
|
5482
5726
|
}
|
|
5483
5727
|
if (originalExists && sandboxExists) {
|
|
5484
|
-
const originalContent =
|
|
5485
|
-
const sandboxContent =
|
|
5728
|
+
const originalContent = readFileSync4(originalPath, "utf-8");
|
|
5729
|
+
const sandboxContent = readFileSync4(sandboxFilePath, "utf-8");
|
|
5486
5730
|
if (originalContent === sandboxContent) {
|
|
5487
5731
|
return "(no changes)";
|
|
5488
5732
|
}
|
|
@@ -5528,13 +5772,13 @@ ${content.split("\n").map((l) => `- ${l}`).join("\n")}`;
|
|
|
5528
5772
|
const srcPath = join3(session.sandboxPath, filePath);
|
|
5529
5773
|
const destPath = join3(session.projectPath, filePath);
|
|
5530
5774
|
if (change.type === "deleted") {
|
|
5531
|
-
if (
|
|
5775
|
+
if (existsSync7(destPath)) {
|
|
5532
5776
|
rmSync(destPath, { force: true });
|
|
5533
5777
|
}
|
|
5534
5778
|
} else {
|
|
5535
|
-
if (
|
|
5779
|
+
if (existsSync7(srcPath)) {
|
|
5536
5780
|
const destDir = dirname(destPath);
|
|
5537
|
-
if (!
|
|
5781
|
+
if (!existsSync7(destDir)) {
|
|
5538
5782
|
mkdirSync(destDir, { recursive: true });
|
|
5539
5783
|
}
|
|
5540
5784
|
copyFileSync(srcPath, destPath);
|
|
@@ -5565,10 +5809,10 @@ ${content.split("\n").map((l) => `- ${l}`).join("\n")}`;
|
|
|
5565
5809
|
for (const filePath of filePaths) {
|
|
5566
5810
|
const sandboxFilePath = join3(session.sandboxPath, filePath);
|
|
5567
5811
|
const originalPath = join3(session.projectPath, filePath);
|
|
5568
|
-
if (
|
|
5812
|
+
if (existsSync7(originalPath)) {
|
|
5569
5813
|
copyFileSync(originalPath, sandboxFilePath);
|
|
5570
5814
|
} else {
|
|
5571
|
-
if (
|
|
5815
|
+
if (existsSync7(sandboxFilePath)) {
|
|
5572
5816
|
rmSync(sandboxFilePath, { force: true });
|
|
5573
5817
|
}
|
|
5574
5818
|
}
|
|
@@ -5640,7 +5884,7 @@ ${content.split("\n").map((l) => `- ${l}`).join("\n")}`;
|
|
|
5640
5884
|
var sandboxService = new SandboxService();
|
|
5641
5885
|
|
|
5642
5886
|
// src/commands/session/start.ts
|
|
5643
|
-
var startCommand = new
|
|
5887
|
+
var startCommand = new Command11("start").description("Projekte starten (mit GitHub Integration)").argument("[projekte...]", "Projektnamen oder Pfade").option("-n, --new", "Neue Sessions statt Resume").option("-t, --terminal <type>", "Terminal-Typ: tmux, gnome-terminal, kitty, alacritty, docker, auto", "auto").option("-d, --docker", "In Docker-Container starten").option("-i, --issue <number>", "Session f\xFCr GitHub Issue starten").option("-p, --pr <number>", "Session f\xFCr PR Review starten").option("--no-context", "Ohne GitHub Context starten").option("-s, --sandbox [mode]", "In Sandbox starten (worktree, copy, docker-overlay)").action(async (projekte, options) => {
|
|
5644
5888
|
try {
|
|
5645
5889
|
if (options.issue) {
|
|
5646
5890
|
await startIssueSession(parseInt(options.issue, 10), options);
|
|
@@ -5657,7 +5901,7 @@ var startCommand = new Command10("start").description("Projekte starten (mit Git
|
|
|
5657
5901
|
log.info("Oder: shiva start --pr <nummer>");
|
|
5658
5902
|
return;
|
|
5659
5903
|
}
|
|
5660
|
-
const spinner =
|
|
5904
|
+
const spinner = ora7("Bereite Projekte vor...").start();
|
|
5661
5905
|
const allProjects = await getAllClaudeProjects();
|
|
5662
5906
|
const launches = [];
|
|
5663
5907
|
for (const projektArg of projekte) {
|
|
@@ -5812,7 +6056,7 @@ var startCommand = new Command10("start").description("Projekte starten (mit Git
|
|
|
5812
6056
|
}
|
|
5813
6057
|
});
|
|
5814
6058
|
async function startIssueSession(issueNumber, options) {
|
|
5815
|
-
const spinner =
|
|
6059
|
+
const spinner = ora7(`Suche Issue #${issueNumber}...`).start();
|
|
5816
6060
|
if (!isGhInstalled() || !isGhAuthenticated()) {
|
|
5817
6061
|
spinner.fail("GitHub nicht verf\xFCgbar");
|
|
5818
6062
|
log.info("Anmelden mit: shiva github login");
|
|
@@ -5921,7 +6165,7 @@ function generateIssueContext(issue, repo) {
|
|
|
5921
6165
|
return lines.join("\n");
|
|
5922
6166
|
}
|
|
5923
6167
|
async function startPRSession(prNumber, options) {
|
|
5924
|
-
const spinner =
|
|
6168
|
+
const spinner = ora7(`Suche PR #${prNumber}...`).start();
|
|
5925
6169
|
if (!isGhInstalled() || !isGhAuthenticated()) {
|
|
5926
6170
|
spinner.fail("GitHub nicht verf\xFCgbar");
|
|
5927
6171
|
log.info("Anmelden mit: shiva github login");
|
|
@@ -6029,12 +6273,12 @@ function generatePRReviewContext(pr, repo) {
|
|
|
6029
6273
|
}
|
|
6030
6274
|
|
|
6031
6275
|
// src/commands/session/resume.ts
|
|
6032
|
-
import { Command as
|
|
6276
|
+
import { Command as Command12 } from "commander";
|
|
6033
6277
|
import { spawn as spawn3 } from "child_process";
|
|
6034
6278
|
import inquirer4 from "inquirer";
|
|
6035
|
-
import
|
|
6279
|
+
import ora8 from "ora";
|
|
6036
6280
|
import * as fs2 from "fs";
|
|
6037
|
-
var resumeCommand = new
|
|
6281
|
+
var resumeCommand = new Command12("resume").description("Neueste Claude Code Session fortsetzen").argument("[projekt]", "Projektname oder Pfad").option("-s, --session <id>", "Bestimmte Session-ID fortsetzen").option("-b, --branch", "Session f\xFCr aktuellen Branch verwenden").option("-l, --list", "Sessions zur Auswahl anzeigen").option("--save-mapping", "Branch-Session Mapping speichern").action(async (projekt, options) => {
|
|
6038
6282
|
try {
|
|
6039
6283
|
let project = null;
|
|
6040
6284
|
let session = null;
|
|
@@ -6159,7 +6403,7 @@ var resumeCommand = new Command11("resume").description("Neueste Claude Code Ses
|
|
|
6159
6403
|
}
|
|
6160
6404
|
});
|
|
6161
6405
|
async function selectProjectInteractive() {
|
|
6162
|
-
const spinner =
|
|
6406
|
+
const spinner = ora8("Lade Projekte...").start();
|
|
6163
6407
|
const projects = await getAllClaudeProjects();
|
|
6164
6408
|
spinner.stop();
|
|
6165
6409
|
const projectsWithSessions = projects.filter((p) => p.sessions.length > 0);
|
|
@@ -6252,12 +6496,12 @@ function launchClaudeResume(projectPath, sessionId) {
|
|
|
6252
6496
|
}
|
|
6253
6497
|
|
|
6254
6498
|
// src/commands/session/restore.ts
|
|
6255
|
-
import { Command as
|
|
6499
|
+
import { Command as Command13 } from "commander";
|
|
6256
6500
|
import { spawn as spawn4 } from "child_process";
|
|
6257
6501
|
import inquirer5 from "inquirer";
|
|
6258
|
-
import
|
|
6502
|
+
import ora9 from "ora";
|
|
6259
6503
|
import * as fs3 from "fs";
|
|
6260
|
-
var restoreCommand = new
|
|
6504
|
+
var restoreCommand = new Command13("restore").description("Context aus crashed Session wiederherstellen").argument("[projekt]", "Projektname oder Pfad").option("--level <level>", "Recovery-Level: minimal, standard, full", "standard").option("-o, --output <pfad>", "Ausgabeverzeichnis f\xFCr Recovery-Datei").option("--no-prompt", "Keine neue Session starten").action(async (projekt, options) => {
|
|
6261
6505
|
try {
|
|
6262
6506
|
let project = null;
|
|
6263
6507
|
let session = null;
|
|
@@ -6268,7 +6512,7 @@ var restoreCommand = new Command12("restore").description("Context aus crashed S
|
|
|
6268
6512
|
return;
|
|
6269
6513
|
}
|
|
6270
6514
|
if (!projekt) {
|
|
6271
|
-
const spinner2 =
|
|
6515
|
+
const spinner2 = ora9("Lade Projekte...").start();
|
|
6272
6516
|
const projects = await getAllClaudeProjects();
|
|
6273
6517
|
spinner2.stop();
|
|
6274
6518
|
const projectsWithSessions = projects.filter((p) => p.sessions.length > 0);
|
|
@@ -6341,7 +6585,7 @@ var restoreCommand = new Command12("restore").description("Context aus crashed S
|
|
|
6341
6585
|
log.keyValue("Status", `${statusText} (${fileSize})`);
|
|
6342
6586
|
log.keyValue("Level", level);
|
|
6343
6587
|
log.newline();
|
|
6344
|
-
const spinner =
|
|
6588
|
+
const spinner = ora9("Extrahiere Context...").start();
|
|
6345
6589
|
try {
|
|
6346
6590
|
const context = await getRecoveredContext(session, level);
|
|
6347
6591
|
spinner.succeed("Context extrahiert");
|
|
@@ -6406,8 +6650,8 @@ var restoreCommand = new Command12("restore").description("Context aus crashed S
|
|
|
6406
6650
|
});
|
|
6407
6651
|
|
|
6408
6652
|
// src/commands/session/sessions.ts
|
|
6409
|
-
import { Command as
|
|
6410
|
-
import
|
|
6653
|
+
import { Command as Command14 } from "commander";
|
|
6654
|
+
import ora10 from "ora";
|
|
6411
6655
|
|
|
6412
6656
|
// src/services/data/tags.ts
|
|
6413
6657
|
import * as fs4 from "fs";
|
|
@@ -6588,11 +6832,11 @@ function logErrorWithSuggestion(error, commandName) {
|
|
|
6588
6832
|
}
|
|
6589
6833
|
|
|
6590
6834
|
// src/commands/session/sessions.ts
|
|
6591
|
-
var sessionsCommand = new
|
|
6835
|
+
var sessionsCommand = new Command14("sessions").description("Alle Claude Code Sessions auflisten").option("-a, --all", "Auch leere Projekte zeigen").option("-p, --project <pfad>", "Nur ein bestimmtes Projekt").option("-t, --tag <tag>", "Nach Tag filtern (Komma-getrennt f\xFCr mehrere)").option("-r, --refresh", "Cache invalidieren und neu laden").option("--json", "JSON Output").action(withCommandErrorHandling("sessions", async (options) => {
|
|
6592
6836
|
if (options.refresh) {
|
|
6593
6837
|
invalidateSessionsCache();
|
|
6594
6838
|
}
|
|
6595
|
-
const spinner =
|
|
6839
|
+
const spinner = ora10("Lade Sessions...").start();
|
|
6596
6840
|
let projects = await getAllClaudeProjects(options.refresh);
|
|
6597
6841
|
if (options.project) {
|
|
6598
6842
|
const found = await findProject(options.project);
|
|
@@ -6714,7 +6958,7 @@ sessionsCommand.command("push").description("Sessions in Cloud sichern").option(
|
|
|
6714
6958
|
log.warn("Keine Sessions zum Synchronisieren gefunden");
|
|
6715
6959
|
return;
|
|
6716
6960
|
}
|
|
6717
|
-
const spinner =
|
|
6961
|
+
const spinner = ora10("Synchronisiere Sessions...").start();
|
|
6718
6962
|
let syncedCount = 0;
|
|
6719
6963
|
let errorCount = 0;
|
|
6720
6964
|
for (const project of projects) {
|
|
@@ -6758,7 +7002,7 @@ sessionsCommand.command("pull").description("Sessions aus Cloud laden").option("
|
|
|
6758
7002
|
log.info("Anmelden mit: shiva login");
|
|
6759
7003
|
return;
|
|
6760
7004
|
}
|
|
6761
|
-
const spinner =
|
|
7005
|
+
const spinner = ora10("Lade Sessions aus Cloud...").start();
|
|
6762
7006
|
try {
|
|
6763
7007
|
const cloudSessions = await api2.getSessions();
|
|
6764
7008
|
spinner.stop();
|
|
@@ -6816,7 +7060,7 @@ sessionsCommand.command("sync").description("Sessions mit Cloud synchronisieren"
|
|
|
6816
7060
|
return;
|
|
6817
7061
|
}
|
|
6818
7062
|
}
|
|
6819
|
-
const spinner =
|
|
7063
|
+
const spinner = ora10("Synchronisiere Sessions...").start();
|
|
6820
7064
|
let pushedCount = 0;
|
|
6821
7065
|
for (const project of projects.filter((p) => p.sessions.length > 0)) {
|
|
6822
7066
|
const config = getProjectConfig2(project.absolutePath);
|
|
@@ -6877,7 +7121,7 @@ sessionsCommand.command("active").description("Aktive Cloud-Sessions anzeigen").
|
|
|
6877
7121
|
log.info("Anmelden mit: shiva login");
|
|
6878
7122
|
return;
|
|
6879
7123
|
}
|
|
6880
|
-
const spinner =
|
|
7124
|
+
const spinner = ora10("Lade aktive Sessions...").start();
|
|
6881
7125
|
try {
|
|
6882
7126
|
const sessions = await api2.getActiveSessions();
|
|
6883
7127
|
spinner.stop();
|
|
@@ -6914,7 +7158,7 @@ sessionsCommand.command("stats").description("Cloud-Session-Statistiken anzeigen
|
|
|
6914
7158
|
log.info("Anmelden mit: shiva login");
|
|
6915
7159
|
return;
|
|
6916
7160
|
}
|
|
6917
|
-
const spinner =
|
|
7161
|
+
const spinner = ora10("Lade Session-Statistiken...").start();
|
|
6918
7162
|
try {
|
|
6919
7163
|
const stats = await api2.getSessionStats();
|
|
6920
7164
|
spinner.stop();
|
|
@@ -6946,7 +7190,7 @@ sessionsCommand.command("resume <sessionId>").description("Cloud-Session fortset
|
|
|
6946
7190
|
log.info("Anmelden mit: shiva login");
|
|
6947
7191
|
return;
|
|
6948
7192
|
}
|
|
6949
|
-
const spinner =
|
|
7193
|
+
const spinner = ora10("Lade Session...").start();
|
|
6950
7194
|
try {
|
|
6951
7195
|
const result = await api2.resumeSession(sessionId);
|
|
6952
7196
|
if (result.success) {
|
|
@@ -6971,7 +7215,7 @@ sessionsCommand.command("export <sessionId>").description("Cloud-Session exporti
|
|
|
6971
7215
|
log.info("Anmelden mit: shiva login");
|
|
6972
7216
|
return;
|
|
6973
7217
|
}
|
|
6974
|
-
const spinner =
|
|
7218
|
+
const spinner = ora10("Exportiere Session...").start();
|
|
6975
7219
|
try {
|
|
6976
7220
|
const exportData = await api2.exportSession(sessionId);
|
|
6977
7221
|
spinner.stop();
|
|
@@ -6999,7 +7243,7 @@ sessionsCommand.command("update <sessionId>").description("Cloud-Session aktuali
|
|
|
6999
7243
|
log.info("Verf\xFCgbare Optionen: --summary, --branch");
|
|
7000
7244
|
return;
|
|
7001
7245
|
}
|
|
7002
|
-
const spinner =
|
|
7246
|
+
const spinner = ora10("Aktualisiere Session...").start();
|
|
7003
7247
|
try {
|
|
7004
7248
|
const result = await api2.updateSession(sessionId, {
|
|
7005
7249
|
summary: options.summary,
|
|
@@ -7017,8 +7261,8 @@ sessionsCommand.command("update <sessionId>").description("Cloud-Session aktuali
|
|
|
7017
7261
|
});
|
|
7018
7262
|
|
|
7019
7263
|
// src/commands/session/session.ts
|
|
7020
|
-
import { Command as
|
|
7021
|
-
import
|
|
7264
|
+
import { Command as Command15 } from "commander";
|
|
7265
|
+
import ora11 from "ora";
|
|
7022
7266
|
function formatChangeType(type2) {
|
|
7023
7267
|
switch (type2) {
|
|
7024
7268
|
case "added":
|
|
@@ -7084,9 +7328,9 @@ async function selectSandbox(sessions) {
|
|
|
7084
7328
|
]);
|
|
7085
7329
|
return selected;
|
|
7086
7330
|
}
|
|
7087
|
-
var sessionCommand = new
|
|
7331
|
+
var sessionCommand = new Command15("session").description("Sandbox-Sessions verwalten");
|
|
7088
7332
|
sessionCommand.command("end").description("Aktive Sandbox-Session beenden").argument("[session-id]", "Session ID (optional, nutzt aktive Session)").action(async (sessionId) => {
|
|
7089
|
-
const spinner =
|
|
7333
|
+
const spinner = ora11("Beende Session...").start();
|
|
7090
7334
|
try {
|
|
7091
7335
|
let session = null;
|
|
7092
7336
|
if (sessionId) {
|
|
@@ -7122,7 +7366,7 @@ sessionCommand.command("end").description("Aktive Sandbox-Session beenden").argu
|
|
|
7122
7366
|
}
|
|
7123
7367
|
});
|
|
7124
7368
|
sessionCommand.command("review").description("Sandbox-\xC4nderungen reviewen").argument("[session-id]", "Session ID (optional)").option("--json", "JSON Output").action(async (sessionId, options) => {
|
|
7125
|
-
const spinner =
|
|
7369
|
+
const spinner = ora11("Lade \xC4nderungen...").start();
|
|
7126
7370
|
try {
|
|
7127
7371
|
let session = null;
|
|
7128
7372
|
if (sessionId) {
|
|
@@ -7170,7 +7414,7 @@ sessionCommand.command("review").description("Sandbox-\xC4nderungen reviewen").a
|
|
|
7170
7414
|
}
|
|
7171
7415
|
});
|
|
7172
7416
|
sessionCommand.command("diff").description("Diff f\xFCr Datei anzeigen").argument("[session-id]", "Session ID").argument("[file]", "Datei (optional, zeigt alle wenn nicht angegeben)").option("--stat", "Nur Statistiken zeigen").action(async (sessionId, file, options) => {
|
|
7173
|
-
const spinner =
|
|
7417
|
+
const spinner = ora11("Lade Diff...").start();
|
|
7174
7418
|
try {
|
|
7175
7419
|
let session = null;
|
|
7176
7420
|
if (sessionId) {
|
|
@@ -7219,7 +7463,7 @@ sessionCommand.command("diff").description("Diff f\xFCr Datei anzeigen").argumen
|
|
|
7219
7463
|
}
|
|
7220
7464
|
});
|
|
7221
7465
|
sessionCommand.command("apply").description("Sandbox-\xC4nderungen \xFCbernehmen").argument("[session-id]", "Session ID").argument("[files...]", "Nur bestimmte Dateien \xFCbernehmen").option("--select", "Dateien interaktiv ausw\xE4hlen").option("-y, --yes", "Ohne Best\xE4tigung").action(async (sessionId, files, options) => {
|
|
7222
|
-
const spinner =
|
|
7466
|
+
const spinner = ora11("Bereite Apply vor...").start();
|
|
7223
7467
|
try {
|
|
7224
7468
|
let session = null;
|
|
7225
7469
|
if (sessionId) {
|
|
@@ -7293,7 +7537,7 @@ sessionCommand.command("apply").description("Sandbox-\xC4nderungen \xFCbernehmen
|
|
|
7293
7537
|
return;
|
|
7294
7538
|
}
|
|
7295
7539
|
}
|
|
7296
|
-
const applySpinner =
|
|
7540
|
+
const applySpinner = ora11("\xDCbernehme \xC4nderungen...").start();
|
|
7297
7541
|
await sandboxService.applyChanges(session.id, selectedPaths);
|
|
7298
7542
|
applySpinner.succeed("\xC4nderungen \xFCbernommen");
|
|
7299
7543
|
log.newline();
|
|
@@ -7303,7 +7547,7 @@ sessionCommand.command("apply").description("Sandbox-\xC4nderungen \xFCbernehmen
|
|
|
7303
7547
|
}
|
|
7304
7548
|
});
|
|
7305
7549
|
sessionCommand.command("discard").description("Sandbox-\xC4nderungen verwerfen").argument("[session-id]", "Session ID").argument("[files...]", "Nur bestimmte Dateien verwerfen").option("-y, --yes", "Ohne Best\xE4tigung").action(async (sessionId, files, options) => {
|
|
7306
|
-
const spinner =
|
|
7550
|
+
const spinner = ora11("Bereite Discard vor...").start();
|
|
7307
7551
|
try {
|
|
7308
7552
|
let session = null;
|
|
7309
7553
|
if (sessionId) {
|
|
@@ -7356,7 +7600,7 @@ sessionCommand.command("discard").description("Sandbox-\xC4nderungen verwerfen")
|
|
|
7356
7600
|
return;
|
|
7357
7601
|
}
|
|
7358
7602
|
}
|
|
7359
|
-
const discardSpinner =
|
|
7603
|
+
const discardSpinner = ora11("Verwerfe \xC4nderungen...").start();
|
|
7360
7604
|
if (files && files.length > 0) {
|
|
7361
7605
|
await sandboxService.discardFiles(session.id, files);
|
|
7362
7606
|
discardSpinner.succeed(`${files.length} Dateien verworfen`);
|
|
@@ -7416,7 +7660,7 @@ sessionCommand.command("cleanup").description("Alte Sandboxes aufr\xE4umen").opt
|
|
|
7416
7660
|
return;
|
|
7417
7661
|
}
|
|
7418
7662
|
}
|
|
7419
|
-
const spinner =
|
|
7663
|
+
const spinner = ora11("R\xE4ume auf...").start();
|
|
7420
7664
|
let cleaned;
|
|
7421
7665
|
if (options.all) {
|
|
7422
7666
|
cleaned = await sandboxService.cleanupAllSandboxes();
|
|
@@ -7466,12 +7710,12 @@ sessionCommand.command("config").description("Sandbox-Konfiguration verwalten").
|
|
|
7466
7710
|
});
|
|
7467
7711
|
|
|
7468
7712
|
// src/commands/github/github-cmd.ts
|
|
7469
|
-
import { Command as
|
|
7713
|
+
import { Command as Command16 } from "commander";
|
|
7470
7714
|
import { spawn as spawn5, spawnSync as spawnSync5 } from "child_process";
|
|
7471
7715
|
import * as fs5 from "fs";
|
|
7472
7716
|
import * as path5 from "path";
|
|
7473
7717
|
import inquirer6 from "inquirer";
|
|
7474
|
-
var githubCommand = new
|
|
7718
|
+
var githubCommand = new Command16("github").description("GitHub Integration verwalten").action(() => {
|
|
7475
7719
|
showStatus();
|
|
7476
7720
|
});
|
|
7477
7721
|
githubCommand.command("status").description("GitHub Verbindungsstatus anzeigen").action(() => {
|
|
@@ -8061,9 +8305,9 @@ githubCommand.command("mappings").description("Alle Branch-Session Mappings anze
|
|
|
8061
8305
|
});
|
|
8062
8306
|
|
|
8063
8307
|
// src/commands/github/issues.ts
|
|
8064
|
-
import { Command as
|
|
8065
|
-
import
|
|
8066
|
-
var issuesCommand = new
|
|
8308
|
+
import { Command as Command17 } from "commander";
|
|
8309
|
+
import ora12 from "ora";
|
|
8310
|
+
var issuesCommand = new Command17("issues").description("GitHub Issues \xFCber alle Projekte anzeigen").option("-m, --mine", "Nur mir zugewiesene Issues").option("-p, --project <name>", "Nur Issues eines Projekts").option("-a, --all", "Auch geschlossene Issues").option("-l, --limit <n>", "Maximale Anzahl pro Projekt", "10").option("--json", "JSON Output").action(withCommandErrorHandling("issues", async (options) => {
|
|
8067
8311
|
if (!isGhInstalled()) {
|
|
8068
8312
|
throw Errors.GITHUB_NOT_INSTALLED();
|
|
8069
8313
|
}
|
|
@@ -8071,7 +8315,7 @@ var issuesCommand = new Command16("issues").description("GitHub Issues \xFCber a
|
|
|
8071
8315
|
throw Errors.GITHUB_NOT_AUTHENTICATED();
|
|
8072
8316
|
}
|
|
8073
8317
|
const currentUser = getGhUser();
|
|
8074
|
-
const spinner =
|
|
8318
|
+
const spinner = ora12("Lade Issues...").start();
|
|
8075
8319
|
const allProjects = await getAllClaudeProjects();
|
|
8076
8320
|
let projects = allProjects;
|
|
8077
8321
|
if (options.project) {
|
|
@@ -8158,9 +8402,9 @@ var issuesCommand = new Command16("issues").description("GitHub Issues \xFCber a
|
|
|
8158
8402
|
}));
|
|
8159
8403
|
|
|
8160
8404
|
// src/commands/github/prs.ts
|
|
8161
|
-
import { Command as
|
|
8162
|
-
import
|
|
8163
|
-
var prsCommand = new
|
|
8405
|
+
import { Command as Command18 } from "commander";
|
|
8406
|
+
import ora13 from "ora";
|
|
8407
|
+
var prsCommand = new Command18("prs").description("GitHub Pull Requests \xFCber alle Projekte anzeigen").option("-m, --mine", "Nur meine PRs").option("-r, --review", "PRs wo ich Reviewer bin").option("-p, --project <name>", "Nur PRs eines Projekts").option("-l, --limit <n>", "Maximale Anzahl pro Projekt", "10").option("--json", "JSON Output").action(withCommandErrorHandling("prs", async (options) => {
|
|
8164
8408
|
if (!isGhInstalled()) {
|
|
8165
8409
|
throw Errors.GITHUB_NOT_INSTALLED();
|
|
8166
8410
|
}
|
|
@@ -8168,7 +8412,7 @@ var prsCommand = new Command17("prs").description("GitHub Pull Requests \xFCber
|
|
|
8168
8412
|
throw Errors.GITHUB_NOT_AUTHENTICATED();
|
|
8169
8413
|
}
|
|
8170
8414
|
const currentUser = getGhUser();
|
|
8171
|
-
const spinner =
|
|
8415
|
+
const spinner = ora13("Lade Pull Requests...").start();
|
|
8172
8416
|
const allProjects = await getAllClaudeProjects();
|
|
8173
8417
|
let projects = allProjects;
|
|
8174
8418
|
if (options.project) {
|
|
@@ -8279,10 +8523,10 @@ var prsCommand = new Command17("prs").description("GitHub Pull Requests \xFCber
|
|
|
8279
8523
|
}));
|
|
8280
8524
|
|
|
8281
8525
|
// src/commands/security/scan.ts
|
|
8282
|
-
import { Command as
|
|
8526
|
+
import { Command as Command19 } from "commander";
|
|
8283
8527
|
import { readFile } from "fs/promises";
|
|
8284
|
-
import { existsSync as
|
|
8285
|
-
import { join as join6, resolve as
|
|
8528
|
+
import { existsSync as existsSync13 } from "fs";
|
|
8529
|
+
import { join as join6, resolve as resolve8 } from "path";
|
|
8286
8530
|
|
|
8287
8531
|
// src/services/security/package-scanner.ts
|
|
8288
8532
|
import Conf3 from "conf";
|
|
@@ -9633,11 +9877,11 @@ async function parsePackageJson(filePath) {
|
|
|
9633
9877
|
if (pkg.devDependencies) {
|
|
9634
9878
|
packages.push(...Object.keys(pkg.devDependencies));
|
|
9635
9879
|
}
|
|
9636
|
-
const dir =
|
|
9880
|
+
const dir = resolve8(filePath, "..");
|
|
9637
9881
|
let manager = "npm";
|
|
9638
|
-
if (
|
|
9882
|
+
if (existsSync13(join6(dir, "pnpm-lock.yaml"))) {
|
|
9639
9883
|
manager = "pnpm";
|
|
9640
|
-
} else if (
|
|
9884
|
+
} else if (existsSync13(join6(dir, "yarn.lock"))) {
|
|
9641
9885
|
manager = "yarn";
|
|
9642
9886
|
}
|
|
9643
9887
|
return { packages, manager };
|
|
@@ -9691,7 +9935,7 @@ function displayConfig(config) {
|
|
|
9691
9935
|
log.keyValue("Blocklist entries", `${config.blocklist.length}`);
|
|
9692
9936
|
log.keyValue("Allowlist entries", `${config.allowlist.length}`);
|
|
9693
9937
|
}
|
|
9694
|
-
var scanCommand = new
|
|
9938
|
+
var scanCommand = new Command19("scan").description("Scanne Packages auf Sicherheitsrisiken").argument("[packages...]", "Package names to scan").option("-m, --manager <manager>", "Package manager (npm, pip, cargo)", "npm").option("-f, --file <file>", "Scan dependencies from file (package.json, requirements.txt, Cargo.toml)").option("-c, --command <command>", "Scan packages from install command").option("--project", "Scan all dependencies in current project").option("--hook-mode", "Output in hook format (JSON)").option("-j, --json", "Output as JSON").option("-v, --verbose", "Show detailed output").action(async (packages, options) => {
|
|
9695
9939
|
const config = packageScanner.getConfig();
|
|
9696
9940
|
if (!config.enabled && !options.hookMode) {
|
|
9697
9941
|
log.warn("Package scanning is disabled. Enable it with: shiva scan config --enable");
|
|
@@ -9700,8 +9944,8 @@ var scanCommand = new Command18("scan").description("Scanne Packages auf Sicherh
|
|
|
9700
9944
|
let packagesToScan = packages || [];
|
|
9701
9945
|
let manager = options.manager;
|
|
9702
9946
|
if (options.file) {
|
|
9703
|
-
const filePath =
|
|
9704
|
-
if (!
|
|
9947
|
+
const filePath = resolve8(options.file);
|
|
9948
|
+
if (!existsSync13(filePath)) {
|
|
9705
9949
|
log.error(`File not found: ${filePath}`);
|
|
9706
9950
|
process.exit(1);
|
|
9707
9951
|
}
|
|
@@ -9738,14 +9982,14 @@ var scanCommand = new Command18("scan").description("Scanne Packages auf Sicherh
|
|
|
9738
9982
|
}
|
|
9739
9983
|
if (options.project) {
|
|
9740
9984
|
const cwd = process.cwd();
|
|
9741
|
-
if (
|
|
9985
|
+
if (existsSync13(join6(cwd, "package.json"))) {
|
|
9742
9986
|
const parsed = await parsePackageJson(join6(cwd, "package.json"));
|
|
9743
9987
|
packagesToScan = parsed.packages;
|
|
9744
9988
|
manager = parsed.manager;
|
|
9745
|
-
} else if (
|
|
9989
|
+
} else if (existsSync13(join6(cwd, "requirements.txt"))) {
|
|
9746
9990
|
packagesToScan = await parseRequirementsTxt(join6(cwd, "requirements.txt"));
|
|
9747
9991
|
manager = "pip";
|
|
9748
|
-
} else if (
|
|
9992
|
+
} else if (existsSync13(join6(cwd, "Cargo.toml"))) {
|
|
9749
9993
|
packagesToScan = await parseCargoToml(join6(cwd, "Cargo.toml"));
|
|
9750
9994
|
manager = "cargo";
|
|
9751
9995
|
} else {
|
|
@@ -9788,7 +10032,7 @@ var scanCommand = new Command18("scan").description("Scanne Packages auf Sicherh
|
|
|
9788
10032
|
process.exit(1);
|
|
9789
10033
|
}
|
|
9790
10034
|
});
|
|
9791
|
-
var blocklistCommand = new
|
|
10035
|
+
var blocklistCommand = new Command19("blocklist").description("Verwalte Package-Blocklist").option("--add <package>", "Add package to blocklist").option("--remove <package>", "Remove package from blocklist").option("--reason <reason>", "Reason for blocking (used with --add)").option("-m, --manager <manager>", "Package manager", "npm").option("--list", "List all blocked packages").action(async (options) => {
|
|
9792
10036
|
const manager = options.manager;
|
|
9793
10037
|
if (options.add) {
|
|
9794
10038
|
const reason = options.reason || "Manually blocked";
|
|
@@ -9823,7 +10067,7 @@ var blocklistCommand = new Command18("blocklist").description("Verwalte Package-
|
|
|
9823
10067
|
log.plain(colors.dim(` Added: ${entry.addedAt} (${entry.source})`));
|
|
9824
10068
|
}
|
|
9825
10069
|
});
|
|
9826
|
-
var allowlistCommand = new
|
|
10070
|
+
var allowlistCommand = new Command19("allowlist").description("Verwalte Package-Allowlist").option("--add <package>", "Add package to allowlist").option("--remove <package>", "Remove package from allowlist").option("--list", "List all allowed packages").action(async (options) => {
|
|
9827
10071
|
if (options.add) {
|
|
9828
10072
|
packageScanner.addToAllowlist(options.add);
|
|
9829
10073
|
log.success(`Added "${options.add}" to allowlist`);
|
|
@@ -9849,7 +10093,7 @@ var allowlistCommand = new Command18("allowlist").description("Verwalte Package-
|
|
|
9849
10093
|
log.plain(`${colors.green("\u2713")} ${pkg}`);
|
|
9850
10094
|
}
|
|
9851
10095
|
});
|
|
9852
|
-
var configCommand2 = new
|
|
10096
|
+
var configCommand2 = new Command19("config").description("Konfiguriere Package-Scanning").option("--enable", "Enable package scanning").option("--disable", "Disable package scanning").option("--auto-block", "Enable auto-blocking of suspicious packages").option("--no-auto-block", "Disable auto-blocking").option("--min-downloads <n>", "Set minimum weekly downloads threshold", parseInt).option("--max-age <days>", "Set maximum age threshold in days", parseInt).option("--typosquat", "Enable typosquatting detection").option("--no-typosquat", "Disable typosquatting detection").option("--scripts", "Enable script analysis").option("--no-scripts", "Disable script analysis").option("--show", "Show current configuration").option("--reset", "Reset to defaults").action(async (options) => {
|
|
9853
10097
|
if (options.show) {
|
|
9854
10098
|
displayConfig(packageScanner.getConfig());
|
|
9855
10099
|
return;
|
|
@@ -9894,10 +10138,10 @@ scanCommand.addCommand(allowlistCommand);
|
|
|
9894
10138
|
scanCommand.addCommand(configCommand2);
|
|
9895
10139
|
|
|
9896
10140
|
// src/commands/security/security.ts
|
|
9897
|
-
import { Command as
|
|
10141
|
+
import { Command as Command20 } from "commander";
|
|
9898
10142
|
import inquirer7 from "inquirer";
|
|
9899
|
-
var securityCommand = new
|
|
9900
|
-
var permissionsCommand = new
|
|
10143
|
+
var securityCommand = new Command20("security").description("Sicherheitseinstellungen verwalten");
|
|
10144
|
+
var permissionsCommand = new Command20("permissions").description("Permission-Bypass konfigurieren").option("--skip", "Permissions \xFCberspringen (--dangerously-skip-permissions)").option("--no-skip", "Permissions nicht \xFCberspringen").option("--inherit", "Von globaler Einstellung erben").option("--block-tool <tool>", "Tool blockieren").option("--unblock-tool <tool>", "Tool-Block aufheben").option("--allow-path <path>", "Pfad erlauben").option("--block-path <path>", "Pfad blockieren").option("--status", "Aktuellen Status anzeigen").action(async (options) => {
|
|
9901
10145
|
const projectPath = process.cwd();
|
|
9902
10146
|
if (!hasShivaDir(projectPath)) {
|
|
9903
10147
|
initShivaDir(projectPath);
|
|
@@ -9969,7 +10213,7 @@ function displayPermissionsStatus(config) {
|
|
|
9969
10213
|
log.newline();
|
|
9970
10214
|
}
|
|
9971
10215
|
securityCommand.addCommand(permissionsCommand);
|
|
9972
|
-
var approvalCommand = new
|
|
10216
|
+
var approvalCommand = new Command20("approval").description("Plan-Approval-Strategie konfigurieren").argument("[strategy]", "Strategie: auto, manual, hybrid").option("--max-files <n>", "Max. Dateien f\xFCr Auto-Approval").option("--max-lines <n>", "Max. Zeilen f\xFCr Auto-Approval").option("--require <pattern>", "Pattern, das Approval erfordert").option("--skip <pattern>", "Pattern, das Approval \xFCberspringt").option("--remove-require <pattern>", "Require-Pattern entfernen").option("--remove-skip <pattern>", "Skip-Pattern entfernen").option("--status", "Aktuellen Status anzeigen").action(async (strategy, options) => {
|
|
9973
10217
|
const projectPath = process.cwd();
|
|
9974
10218
|
if (!hasShivaDir(projectPath)) {
|
|
9975
10219
|
initShivaDir(projectPath);
|
|
@@ -10306,7 +10550,7 @@ securityCommand.command("status").description("Sicherheitsstatus anzeigen").acti
|
|
|
10306
10550
|
displayPermissionsStatus(config.security.permissions);
|
|
10307
10551
|
displayApprovalStatus(config.security.approval);
|
|
10308
10552
|
});
|
|
10309
|
-
var tfaCommand = new
|
|
10553
|
+
var tfaCommand = new Command20("2fa").description("Zwei-Faktor-Authentifizierung").option("--enable", "2FA aktivieren").option("--disable", "2FA deaktivieren").option("--status", "Status anzeigen").option("--backup", "Neue Backup-Codes generieren").action(async (options) => {
|
|
10310
10554
|
if (!isAuthenticated()) {
|
|
10311
10555
|
log.error("Nicht angemeldet. Verwende: shiva login");
|
|
10312
10556
|
return;
|
|
@@ -10396,7 +10640,7 @@ var tfaCommand = new Command19("2fa").description("Zwei-Faktor-Authentifizierung
|
|
|
10396
10640
|
}
|
|
10397
10641
|
});
|
|
10398
10642
|
securityCommand.addCommand(tfaCommand);
|
|
10399
|
-
var devicesCommand = new
|
|
10643
|
+
var devicesCommand = new Command20("devices").description("Vertrauensw\xFCrdige Ger\xE4te verwalten").option("--list", "Ger\xE4te auflisten").option("--revoke <id>", "Ger\xE4t widerrufen").option("--revoke-all", "Alle Ger\xE4te widerrufen").action(async (options) => {
|
|
10400
10644
|
if (!isAuthenticated()) {
|
|
10401
10645
|
log.error("Nicht angemeldet. Verwende: shiva login");
|
|
10402
10646
|
return;
|
|
@@ -10446,13 +10690,13 @@ var devicesCommand = new Command19("devices").description("Vertrauensw\xFCrdige
|
|
|
10446
10690
|
securityCommand.addCommand(devicesCommand);
|
|
10447
10691
|
|
|
10448
10692
|
// src/commands/security/secrets.ts
|
|
10449
|
-
import { Command as
|
|
10693
|
+
import { Command as Command21 } from "commander";
|
|
10450
10694
|
import inquirer8 from "inquirer";
|
|
10451
|
-
import
|
|
10695
|
+
import ora14 from "ora";
|
|
10452
10696
|
import * as fs6 from "fs";
|
|
10453
10697
|
import * as path6 from "path";
|
|
10454
10698
|
var SECURE_FILE_MODE = 384;
|
|
10455
|
-
var secretsCommand = new
|
|
10699
|
+
var secretsCommand = new Command21("secrets").description("API Keys und Secrets verwalten (Cloud Vault)").action(async () => {
|
|
10456
10700
|
await listSecrets();
|
|
10457
10701
|
});
|
|
10458
10702
|
secretsCommand.command("list").alias("ls").description("Alle Secrets anzeigen").option("-p, --project <id>", "Nur Secrets f\xFCr Projekt").action(async (options) => {
|
|
@@ -10463,7 +10707,7 @@ async function listSecrets(projectId) {
|
|
|
10463
10707
|
log.errorWithSuggestion(Errors.NOT_AUTHENTICATED());
|
|
10464
10708
|
return;
|
|
10465
10709
|
}
|
|
10466
|
-
const spinner =
|
|
10710
|
+
const spinner = ora14("Lade Secrets...").start();
|
|
10467
10711
|
try {
|
|
10468
10712
|
const result = await api.listSecrets(projectId);
|
|
10469
10713
|
spinner.stop();
|
|
@@ -10561,7 +10805,7 @@ secretsCommand.command("add").description("Secret hinzuf\xFCgen").argument("<key
|
|
|
10561
10805
|
log.dim("Abgebrochen");
|
|
10562
10806
|
return;
|
|
10563
10807
|
}
|
|
10564
|
-
const spinner =
|
|
10808
|
+
const spinner = ora14("Speichere Secret...").start();
|
|
10565
10809
|
try {
|
|
10566
10810
|
await api.addSecret({
|
|
10567
10811
|
key,
|
|
@@ -10596,7 +10840,7 @@ secretsCommand.command("remove").alias("rm").alias("delete").description("Secret
|
|
|
10596
10840
|
return;
|
|
10597
10841
|
}
|
|
10598
10842
|
}
|
|
10599
|
-
const spinner =
|
|
10843
|
+
const spinner = ora14("L\xF6sche Secret...").start();
|
|
10600
10844
|
try {
|
|
10601
10845
|
await api.deleteSecret(key, options.project);
|
|
10602
10846
|
spinner.stop();
|
|
@@ -10635,7 +10879,7 @@ secretsCommand.command("get").description("Secret-Wert anzeigen (maskiert)").arg
|
|
|
10635
10879
|
return;
|
|
10636
10880
|
}
|
|
10637
10881
|
}
|
|
10638
|
-
const spinner =
|
|
10882
|
+
const spinner = ora14("Lade Secret...").start();
|
|
10639
10883
|
try {
|
|
10640
10884
|
const result = await api.getSecret(key, options.project);
|
|
10641
10885
|
spinner.stop();
|
|
@@ -10689,7 +10933,7 @@ secretsCommand.command("env").description("Secrets als .env Format ausgeben").op
|
|
|
10689
10933
|
log.dim("Abgebrochen");
|
|
10690
10934
|
return;
|
|
10691
10935
|
}
|
|
10692
|
-
const spinner =
|
|
10936
|
+
const spinner = ora14("Lade Secrets...").start();
|
|
10693
10937
|
try {
|
|
10694
10938
|
const secrets = await api.getSecretsForInjection(options.project);
|
|
10695
10939
|
spinner.stop();
|
|
@@ -10765,7 +11009,7 @@ secretsCommand.command("import").description(".env Datei in Vault importieren").
|
|
|
10765
11009
|
return;
|
|
10766
11010
|
}
|
|
10767
11011
|
}
|
|
10768
|
-
const spinner =
|
|
11012
|
+
const spinner = ora14("Importiere Secrets...").start();
|
|
10769
11013
|
let imported = 0;
|
|
10770
11014
|
let failed = 0;
|
|
10771
11015
|
for (const secret of secrets) {
|
|
@@ -10807,7 +11051,7 @@ secretsCommand.command("export").description("Secrets exportieren").option("-p,
|
|
|
10807
11051
|
log.dim("Abgebrochen");
|
|
10808
11052
|
return;
|
|
10809
11053
|
}
|
|
10810
|
-
const spinner =
|
|
11054
|
+
const spinner = ora14("Exportiere Secrets...").start();
|
|
10811
11055
|
try {
|
|
10812
11056
|
const secrets = await api.getSecretsForInjection(options.project);
|
|
10813
11057
|
spinner.stop();
|
|
@@ -10839,8 +11083,8 @@ secretsCommand.command("export").description("Secrets exportieren").option("-p,
|
|
|
10839
11083
|
});
|
|
10840
11084
|
|
|
10841
11085
|
// src/commands/memory/search.ts
|
|
10842
|
-
import { Command as
|
|
10843
|
-
import
|
|
11086
|
+
import { Command as Command22 } from "commander";
|
|
11087
|
+
import ora15 from "ora";
|
|
10844
11088
|
|
|
10845
11089
|
// src/services/data/memory.ts
|
|
10846
11090
|
import * as fs7 from "fs";
|
|
@@ -11126,8 +11370,8 @@ function escapeRegex(str) {
|
|
|
11126
11370
|
}
|
|
11127
11371
|
|
|
11128
11372
|
// src/commands/memory/search.ts
|
|
11129
|
-
var searchCommand = new
|
|
11130
|
-
const spinner =
|
|
11373
|
+
var searchCommand = new Command22("search").description("Memories \xFCber alle Projekte durchsuchen").argument("<query>", "Suchbegriff").option("-c, --category <category>", "Nach Kategorie filtern (general, preference, decision, context)").option("-p, --project <name>", "In bestimmtem Projekt suchen").option("-s, --source <source>", "Quelle: local, cloud, all (default: all)").option("-l, --limit <n>", "Max. Ergebnisse (default: 50)", "50").option("--case-sensitive", "Gro\xDF-/Kleinschreibung beachten").option("--json", "JSON Ausgabe").action(async (query, options) => {
|
|
11374
|
+
const spinner = ora15("Durchsuche Memories...").start();
|
|
11131
11375
|
try {
|
|
11132
11376
|
const result = await searchMemories(query, {
|
|
11133
11377
|
caseSensitive: options.caseSensitive,
|
|
@@ -11199,11 +11443,11 @@ function escapeRegex2(str) {
|
|
|
11199
11443
|
}
|
|
11200
11444
|
|
|
11201
11445
|
// src/commands/memory/forget.ts
|
|
11202
|
-
import { Command as
|
|
11446
|
+
import { Command as Command23 } from "commander";
|
|
11203
11447
|
import * as path8 from "path";
|
|
11204
11448
|
import inquirer9 from "inquirer";
|
|
11205
|
-
import
|
|
11206
|
-
var forgetCommand = new
|
|
11449
|
+
import ora16 from "ora";
|
|
11450
|
+
var forgetCommand = new Command23("forget").description("Memories l\xF6schen (GDPR)").argument("[key]", "Memory-Key zum L\xF6schen").option("-p, --project <path>", "Projekt-Pfad").option("--all", "Alle Memories eines Projekts l\xF6schen").option("--search <query>", "Memories nach Suchbegriff l\xF6schen").option("--local-only", "Nur lokal l\xF6schen").option("--cloud-only", "Nur aus Cloud l\xF6schen").option("-f, --force", "Ohne Best\xE4tigung l\xF6schen").option("--dry-run", "Nur anzeigen, was gel\xF6scht w\xFCrde").action(async (key, options) => {
|
|
11207
11451
|
log.newline();
|
|
11208
11452
|
console.log(colors.orange.bold("SHIVA Code - Forget"));
|
|
11209
11453
|
console.log(colors.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
@@ -11256,7 +11500,7 @@ async function handleDeleteAll(projectPath, options) {
|
|
|
11256
11500
|
return;
|
|
11257
11501
|
}
|
|
11258
11502
|
}
|
|
11259
|
-
const spinner =
|
|
11503
|
+
const spinner = ora16("L\xF6sche Memories...").start();
|
|
11260
11504
|
try {
|
|
11261
11505
|
const result = await deleteAllProjectMemories(projectPath);
|
|
11262
11506
|
spinner.succeed("Memories gel\xF6scht");
|
|
@@ -11270,7 +11514,7 @@ async function handleDeleteAll(projectPath, options) {
|
|
|
11270
11514
|
}
|
|
11271
11515
|
}
|
|
11272
11516
|
async function handleDeleteBySearch(query, projectPath, options) {
|
|
11273
|
-
const spinner =
|
|
11517
|
+
const spinner = ora16("Suche Memories...").start();
|
|
11274
11518
|
const result = await searchMemories(query, {
|
|
11275
11519
|
project: options.project ? projectPath : void 0
|
|
11276
11520
|
});
|
|
@@ -11305,7 +11549,7 @@ async function handleDeleteBySearch(query, projectPath, options) {
|
|
|
11305
11549
|
return;
|
|
11306
11550
|
}
|
|
11307
11551
|
}
|
|
11308
|
-
const deleteSpinner =
|
|
11552
|
+
const deleteSpinner = ora16("L\xF6sche Memories...").start();
|
|
11309
11553
|
let deleted = 0;
|
|
11310
11554
|
let failed = 0;
|
|
11311
11555
|
for (const memory of result.memories) {
|
|
@@ -11348,7 +11592,7 @@ async function handleDeleteKey(key, projectPath, options) {
|
|
|
11348
11592
|
return;
|
|
11349
11593
|
}
|
|
11350
11594
|
}
|
|
11351
|
-
const spinner =
|
|
11595
|
+
const spinner = ora16("L\xF6sche Memory...").start();
|
|
11352
11596
|
try {
|
|
11353
11597
|
const result = await deleteMemory(projectPath, key, {
|
|
11354
11598
|
localOnly: options.localOnly,
|
|
@@ -11371,7 +11615,7 @@ async function handleDeleteKey(key, projectPath, options) {
|
|
|
11371
11615
|
}
|
|
11372
11616
|
}
|
|
11373
11617
|
async function handleInteractiveDelete(projectPath, options) {
|
|
11374
|
-
const spinner =
|
|
11618
|
+
const spinner = ora16("Lade Memories...").start();
|
|
11375
11619
|
const memories = await getAllMemories();
|
|
11376
11620
|
spinner.stop();
|
|
11377
11621
|
if (memories.length === 0) {
|
|
@@ -11415,7 +11659,7 @@ async function handleInteractiveDelete(projectPath, options) {
|
|
|
11415
11659
|
return;
|
|
11416
11660
|
}
|
|
11417
11661
|
}
|
|
11418
|
-
const deleteSpinner =
|
|
11662
|
+
const deleteSpinner = ora16("L\xF6sche Memories...").start();
|
|
11419
11663
|
let deleted = 0;
|
|
11420
11664
|
let failed = 0;
|
|
11421
11665
|
for (const memory of selected) {
|
|
@@ -11444,18 +11688,18 @@ function truncate(str, maxLen) {
|
|
|
11444
11688
|
}
|
|
11445
11689
|
|
|
11446
11690
|
// src/commands/memory/context.ts
|
|
11447
|
-
import { Command as
|
|
11691
|
+
import { Command as Command24 } from "commander";
|
|
11448
11692
|
import * as path9 from "path";
|
|
11449
11693
|
import * as fs8 from "fs";
|
|
11450
|
-
import
|
|
11451
|
-
var contextCommand = new
|
|
11694
|
+
import ora17 from "ora";
|
|
11695
|
+
var contextCommand = new Command24("context").description("Zeigt was in Claude injected w\xFCrde").option("-d, --dir <path>", "Projektverzeichnis").option("--github", "GitHub Context einschlie\xDFen").option("--secrets", "Secret-Keys anzeigen").option("--raw", "Rohe CLAUDE.md Ausgabe").option("--json", "JSON Ausgabe").option("-s, --size", "Nur Gr\xF6\xDFe anzeigen").action(async (options) => {
|
|
11452
11696
|
const projectPath = options.dir ? path9.resolve(options.dir) : process.cwd();
|
|
11453
11697
|
const projectName = path9.basename(projectPath);
|
|
11454
11698
|
if (!fs8.existsSync(projectPath)) {
|
|
11455
11699
|
log.error(`Verzeichnis nicht gefunden: ${projectPath}`);
|
|
11456
11700
|
return;
|
|
11457
11701
|
}
|
|
11458
|
-
const spinner =
|
|
11702
|
+
const spinner = ora17("Sammle Context...").start();
|
|
11459
11703
|
try {
|
|
11460
11704
|
const preview = await getContextPreview(projectPath);
|
|
11461
11705
|
if (options.github) {
|
|
@@ -11639,9 +11883,9 @@ function formatGitHubContext(context) {
|
|
|
11639
11883
|
}
|
|
11640
11884
|
|
|
11641
11885
|
// src/commands/memory/tags.ts
|
|
11642
|
-
import { Command as
|
|
11886
|
+
import { Command as Command25 } from "commander";
|
|
11643
11887
|
import inquirer10 from "inquirer";
|
|
11644
|
-
var tagsCommand = new
|
|
11888
|
+
var tagsCommand = new Command25("tags").description("Session-Tags verwalten").action(async () => {
|
|
11645
11889
|
await listTags();
|
|
11646
11890
|
});
|
|
11647
11891
|
tagsCommand.command("list").alias("ls").description("Alle Tags anzeigen").action(async () => {
|
|
@@ -11840,8 +12084,8 @@ tagsCommand.command("cloud").description("Memory-Tags aus Cloud laden").option("
|
|
|
11840
12084
|
log.info("Anmelden mit: shiva login");
|
|
11841
12085
|
return;
|
|
11842
12086
|
}
|
|
11843
|
-
const
|
|
11844
|
-
const spinner =
|
|
12087
|
+
const ora25 = (await import("ora")).default;
|
|
12088
|
+
const spinner = ora25("Lade Memory-Tags aus Cloud...").start();
|
|
11845
12089
|
try {
|
|
11846
12090
|
const cloudTags = await api2.getMemoryTags();
|
|
11847
12091
|
spinner.stop();
|
|
@@ -11868,10 +12112,10 @@ tagsCommand.command("cloud").description("Memory-Tags aus Cloud laden").option("
|
|
|
11868
12112
|
});
|
|
11869
12113
|
|
|
11870
12114
|
// src/commands/memory/export.ts
|
|
11871
|
-
import { Command as
|
|
12115
|
+
import { Command as Command26 } from "commander";
|
|
11872
12116
|
import * as path11 from "path";
|
|
11873
12117
|
import * as fs10 from "fs";
|
|
11874
|
-
import
|
|
12118
|
+
import ora18 from "ora";
|
|
11875
12119
|
import inquirer11 from "inquirer";
|
|
11876
12120
|
|
|
11877
12121
|
// src/services/session/export.ts
|
|
@@ -12123,7 +12367,7 @@ function previewExportFile(filepath) {
|
|
|
12123
12367
|
}
|
|
12124
12368
|
|
|
12125
12369
|
// src/commands/memory/export.ts
|
|
12126
|
-
var exportCommand = new
|
|
12370
|
+
var exportCommand = new Command26("export").description("Sessions exportieren").argument("[session-id]", "Session ID (optional)").option("-o, --output <path>", "Ausgabedatei/-verzeichnis").option("-p, --project <name>", "Alle Sessions eines Projekts exportieren").option("-t, --transcript", "Transkript einschlie\xDFen").option("-c, --conversation", "Parsed Conversation einschlie\xDFen").option("--backup", "Vollst\xE4ndiges Backup erstellen (tar.gz)").option("--all", "Alle Sessions exportieren").action(async (sessionId, options) => {
|
|
12127
12371
|
log.newline();
|
|
12128
12372
|
console.log(colors.orange.bold("SHIVA Code - Export"));
|
|
12129
12373
|
console.log(colors.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
@@ -12150,7 +12394,7 @@ var exportCommand = new Command25("export").description("Sessions exportieren").
|
|
|
12150
12394
|
}
|
|
12151
12395
|
await handleInteractiveExport(exportOptions);
|
|
12152
12396
|
});
|
|
12153
|
-
var importCommand = new
|
|
12397
|
+
var importCommand = new Command26("import").description("Sessions importieren").argument("<path>", "Import-Datei oder Verzeichnis").option("-p, --project <path>", "Ziel-Projektpfad").option("--preview", "Nur Vorschau, nicht importieren").option("--restore", "Backup-Archiv wiederherstellen").action(async (inputPath, options) => {
|
|
12154
12398
|
log.newline();
|
|
12155
12399
|
console.log(colors.orange.bold("SHIVA Code - Import"));
|
|
12156
12400
|
console.log(colors.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
@@ -12176,7 +12420,7 @@ var importCommand = new Command25("import").description("Sessions importieren").
|
|
|
12176
12420
|
}
|
|
12177
12421
|
});
|
|
12178
12422
|
async function handleBackup(outputPath) {
|
|
12179
|
-
const spinner =
|
|
12423
|
+
const spinner = ora18("Erstelle Backup...").start();
|
|
12180
12424
|
const filename = `shiva-backup-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.tar.gz`;
|
|
12181
12425
|
const output = outputPath || path11.join(process.cwd(), filename);
|
|
12182
12426
|
const success = createBackupArchive(output);
|
|
@@ -12189,7 +12433,7 @@ async function handleBackup(outputPath) {
|
|
|
12189
12433
|
}
|
|
12190
12434
|
}
|
|
12191
12435
|
async function handleExportAll(outputDir, options = {}) {
|
|
12192
|
-
const spinner =
|
|
12436
|
+
const spinner = ora18("Lade Sessions...").start();
|
|
12193
12437
|
const projects = await getAllClaudeProjects();
|
|
12194
12438
|
const allSessionIds = projects.flatMap((p) => p.sessions.map((s) => s.sessionId));
|
|
12195
12439
|
if (allSessionIds.length === 0) {
|
|
@@ -12207,7 +12451,7 @@ async function handleExportAll(outputDir, options = {}) {
|
|
|
12207
12451
|
log.dim(`Verzeichnis: ${output}`);
|
|
12208
12452
|
}
|
|
12209
12453
|
async function handleExportProject(projectName, outputDir, options = {}) {
|
|
12210
|
-
const spinner =
|
|
12454
|
+
const spinner = ora18("Suche Projekt...").start();
|
|
12211
12455
|
const projects = await getAllClaudeProjects();
|
|
12212
12456
|
const project = projects.find(
|
|
12213
12457
|
(p) => p.projectName.toLowerCase() === projectName.toLowerCase() || p.absolutePath.includes(projectName)
|
|
@@ -12228,7 +12472,7 @@ async function handleExportProject(projectName, outputDir, options = {}) {
|
|
|
12228
12472
|
log.dim(`Verzeichnis: ${output}`);
|
|
12229
12473
|
}
|
|
12230
12474
|
async function handleExportSession(sessionId, outputPath, options = {}) {
|
|
12231
|
-
const spinner =
|
|
12475
|
+
const spinner = ora18("Exportiere Session...").start();
|
|
12232
12476
|
const output = outputPath || `session-${sessionId.slice(0, 8)}.json`;
|
|
12233
12477
|
const success = await exportSessionToFile(sessionId, output, options);
|
|
12234
12478
|
if (success) {
|
|
@@ -12268,7 +12512,7 @@ async function handleInteractiveExport(options = {}) {
|
|
|
12268
12512
|
await handleExportSession(selectedSession, void 0, options);
|
|
12269
12513
|
}
|
|
12270
12514
|
async function handleImportFile(filepath, targetProject) {
|
|
12271
|
-
const spinner =
|
|
12515
|
+
const spinner = ora18("Importiere Session...").start();
|
|
12272
12516
|
const result = await importSessionFromFile(filepath, targetProject);
|
|
12273
12517
|
if (result.success) {
|
|
12274
12518
|
spinner.succeed(result.message);
|
|
@@ -12283,7 +12527,7 @@ async function handleImportFile(filepath, targetProject) {
|
|
|
12283
12527
|
}
|
|
12284
12528
|
}
|
|
12285
12529
|
async function handleImportDirectory(dirPath, targetProject) {
|
|
12286
|
-
const spinner =
|
|
12530
|
+
const spinner = ora18("Importiere Sessions...").start();
|
|
12287
12531
|
const result = await importSessionsFromDirectory(dirPath, targetProject);
|
|
12288
12532
|
spinner.succeed(`Import abgeschlossen`);
|
|
12289
12533
|
log.info(`${result.success} Sessions importiert`);
|
|
@@ -12302,7 +12546,7 @@ async function handleRestore(archivePath, targetDir) {
|
|
|
12302
12546
|
log.dim("Abgebrochen");
|
|
12303
12547
|
return;
|
|
12304
12548
|
}
|
|
12305
|
-
const spinner =
|
|
12549
|
+
const spinner = ora18("Stelle Backup wieder her...").start();
|
|
12306
12550
|
const success = restoreFromArchive(archivePath, targetDir);
|
|
12307
12551
|
if (success) {
|
|
12308
12552
|
spinner.succeed("Backup wiederhergestellt");
|
|
@@ -12342,8 +12586,8 @@ async function handlePreview(filepath) {
|
|
|
12342
12586
|
}
|
|
12343
12587
|
|
|
12344
12588
|
// src/commands/memory/remember.ts
|
|
12345
|
-
import { Command as
|
|
12346
|
-
var rememberCommand = new
|
|
12589
|
+
import { Command as Command27 } from "commander";
|
|
12590
|
+
var rememberCommand = new Command27("remember").description("Memory in der Cloud speichern").argument("<text>", "Der Text der gespeichert werden soll").option("-k, --key <key>", "Schl\xFCssel/Titel f\xFCr die Memory").option("-c, --category <category>", "Kategorie (context, learning, preference, fact)", "fact").action(async (text, options) => {
|
|
12347
12591
|
if (!isAuthenticated()) {
|
|
12348
12592
|
log.error("Nicht angemeldet");
|
|
12349
12593
|
log.info("Anmelden mit: shiva login");
|
|
@@ -12375,7 +12619,7 @@ var rememberCommand = new Command26("remember").description("Memory in der Cloud
|
|
|
12375
12619
|
});
|
|
12376
12620
|
|
|
12377
12621
|
// src/commands/system/doctor.ts
|
|
12378
|
-
import { Command as
|
|
12622
|
+
import { Command as Command28 } from "commander";
|
|
12379
12623
|
import { execSync as execSync3 } from "child_process";
|
|
12380
12624
|
import * as fs11 from "fs";
|
|
12381
12625
|
import * as path12 from "path";
|
|
@@ -12633,7 +12877,7 @@ function printResult(result) {
|
|
|
12633
12877
|
console.log(` ${colors.dim("\u2192")} ${colors.dim(result.hint)}`);
|
|
12634
12878
|
}
|
|
12635
12879
|
}
|
|
12636
|
-
var doctorCommand = new
|
|
12880
|
+
var doctorCommand = new Command28("doctor").description("System-Check f\xFCr SHIVA und Claude Code").option("-v, --verbose", "Zeige zus\xE4tzliche Details").option("-j, --json", "Ausgabe als JSON").action(async (options) => {
|
|
12637
12881
|
if (!options.json) {
|
|
12638
12882
|
log.newline();
|
|
12639
12883
|
console.log(colors.orange.bold("\u{1F3E5} SHIVA Doctor - System Health Check"));
|
|
@@ -12702,7 +12946,7 @@ var doctorCommand = new Command27("doctor").description("System-Check f\xFCr SHI
|
|
|
12702
12946
|
});
|
|
12703
12947
|
|
|
12704
12948
|
// src/commands/system/upgrade.ts
|
|
12705
|
-
import { Command as
|
|
12949
|
+
import { Command as Command29 } from "commander";
|
|
12706
12950
|
import { execSync as execSync4, spawn as spawn6 } from "child_process";
|
|
12707
12951
|
import * as fs12 from "fs";
|
|
12708
12952
|
import * as path13 from "path";
|
|
@@ -12791,7 +13035,7 @@ function getUpgradeCommand(pm) {
|
|
|
12791
13035
|
async function runUpgrade(pm) {
|
|
12792
13036
|
const command = getUpgradeCommand(pm);
|
|
12793
13037
|
const [cmd, ...args] = command.split(" ");
|
|
12794
|
-
return new Promise((
|
|
13038
|
+
return new Promise((resolve14) => {
|
|
12795
13039
|
log.info(`F\xFChre aus: ${command}`);
|
|
12796
13040
|
log.newline();
|
|
12797
13041
|
const proc = spawn6(cmd, args, {
|
|
@@ -12799,14 +13043,14 @@ async function runUpgrade(pm) {
|
|
|
12799
13043
|
shell: true
|
|
12800
13044
|
});
|
|
12801
13045
|
proc.on("close", (code) => {
|
|
12802
|
-
|
|
13046
|
+
resolve14(code === 0);
|
|
12803
13047
|
});
|
|
12804
13048
|
proc.on("error", () => {
|
|
12805
|
-
|
|
13049
|
+
resolve14(false);
|
|
12806
13050
|
});
|
|
12807
13051
|
});
|
|
12808
13052
|
}
|
|
12809
|
-
var upgradeCommand = new
|
|
13053
|
+
var upgradeCommand = new Command29("upgrade").description("SHIVA CLI aktualisieren").option("-c, --check", "Nur auf Updates pr\xFCfen, nicht installieren").option("-f, --force", "Update erzwingen, auch wenn aktuell").option("--npm", "npm verwenden").option("--yarn", "yarn verwenden").option("--pnpm", "pnpm verwenden").action(async (options) => {
|
|
12810
13054
|
log.newline();
|
|
12811
13055
|
console.log(colors.orange.bold("\u{1F680} SHIVA Upgrade"));
|
|
12812
13056
|
log.newline();
|
|
@@ -12851,12 +13095,12 @@ var upgradeCommand = new Command28("upgrade").description("SHIVA CLI aktualisier
|
|
|
12851
13095
|
log.plain(` ${getUpgradeCommand(pm)}`);
|
|
12852
13096
|
}
|
|
12853
13097
|
});
|
|
12854
|
-
var selfUpdateCommand = new
|
|
13098
|
+
var selfUpdateCommand = new Command29("self-update").description('Alias f\xFCr "shiva upgrade"').action(async () => {
|
|
12855
13099
|
await upgradeCommand.parseAsync(["upgrade"], { from: "user" });
|
|
12856
13100
|
});
|
|
12857
13101
|
|
|
12858
13102
|
// src/commands/system/telemetry.ts
|
|
12859
|
-
import { Command as
|
|
13103
|
+
import { Command as Command30 } from "commander";
|
|
12860
13104
|
import Conf4 from "conf";
|
|
12861
13105
|
var telemetryConfig = new Conf4({
|
|
12862
13106
|
projectName: "shiva-code",
|
|
@@ -12892,7 +13136,7 @@ var DATA_NOT_COLLECTED = [
|
|
|
12892
13136
|
"Pers\xF6nliche Daten oder IP-Adressen",
|
|
12893
13137
|
"Code oder Datei-Inhalte"
|
|
12894
13138
|
];
|
|
12895
|
-
var telemetryCommand = new
|
|
13139
|
+
var telemetryCommand = new Command30("telemetry").description("Telemetrie/Analytics verwalten").option("--enable", "Telemetrie aktivieren (opt-in)").option("--disable", "Telemetrie deaktivieren (opt-out)").option("--status", "Aktuellen Status anzeigen").option("-j, --json", "Ausgabe als JSON").action((options) => {
|
|
12896
13140
|
const isEnabled = telemetryConfig.get("enabled");
|
|
12897
13141
|
const optInAt = telemetryConfig.get("optInAt");
|
|
12898
13142
|
const optOutAt = telemetryConfig.get("optOutAt");
|
|
@@ -12983,8 +13227,8 @@ var telemetryCommand = new Command29("telemetry").description("Telemetrie/Analyt
|
|
|
12983
13227
|
});
|
|
12984
13228
|
|
|
12985
13229
|
// src/commands/system/completions.ts
|
|
12986
|
-
import { Command as
|
|
12987
|
-
var completionsCommand = new
|
|
13230
|
+
import { Command as Command31 } from "commander";
|
|
13231
|
+
var completionsCommand = new Command31("completions").description("Shell-Completion-Skripte generieren").argument("[shell]", "Shell-Typ: bash, zsh, fish").option("--install", "Direkt installieren (nur bash/zsh)").action(async (shell, options) => {
|
|
12988
13232
|
if (!shell) {
|
|
12989
13233
|
log.newline();
|
|
12990
13234
|
console.log(colors.orange.bold("SHIVA Code - Shell Completions"));
|
|
@@ -13379,10 +13623,10 @@ async function installFishCompletion() {
|
|
|
13379
13623
|
}
|
|
13380
13624
|
|
|
13381
13625
|
// src/commands/system/stats.ts
|
|
13382
|
-
import { Command as
|
|
13383
|
-
import
|
|
13384
|
-
var statsCommand = new
|
|
13385
|
-
const spinner =
|
|
13626
|
+
import { Command as Command32 } from "commander";
|
|
13627
|
+
import ora19 from "ora";
|
|
13628
|
+
var statsCommand = new Command32("stats").description("Session-Statistiken und Analytics anzeigen").option("-d, --days <n>", "Zeitraum in Tagen", "30").option("--json", "JSON Output").action(async (options) => {
|
|
13629
|
+
const spinner = ora19("Sammle Statistiken...").start();
|
|
13386
13630
|
try {
|
|
13387
13631
|
const projects = await getAllClaudeProjects();
|
|
13388
13632
|
const days = parseInt(options.days, 10) || 30;
|
|
@@ -13543,7 +13787,7 @@ statsCommand.command("sessions").description("Session Analytics (Pro Feature)").
|
|
|
13543
13787
|
log.info("Anmelden mit: shiva login");
|
|
13544
13788
|
return;
|
|
13545
13789
|
}
|
|
13546
|
-
const spinner =
|
|
13790
|
+
const spinner = ora19("Lade Session Analytics...").start();
|
|
13547
13791
|
try {
|
|
13548
13792
|
const analytics = await api2.getSessionAnalytics();
|
|
13549
13793
|
spinner.stop();
|
|
@@ -13595,7 +13839,7 @@ statsCommand.command("tokens").description("Token Usage Analytics (Pro Feature)"
|
|
|
13595
13839
|
log.info("Anmelden mit: shiva login");
|
|
13596
13840
|
return;
|
|
13597
13841
|
}
|
|
13598
|
-
const spinner =
|
|
13842
|
+
const spinner = ora19("Lade Token Analytics...").start();
|
|
13599
13843
|
try {
|
|
13600
13844
|
const analytics = await api2.getTokenAnalytics();
|
|
13601
13845
|
spinner.stop();
|
|
@@ -13643,7 +13887,7 @@ statsCommand.command("tools").description("Tool Usage Analytics (Pro Feature)").
|
|
|
13643
13887
|
log.info("Anmelden mit: shiva login");
|
|
13644
13888
|
return;
|
|
13645
13889
|
}
|
|
13646
|
-
const spinner =
|
|
13890
|
+
const spinner = ora19("Lade Tool Analytics...").start();
|
|
13647
13891
|
try {
|
|
13648
13892
|
const analytics = await api2.getToolAnalytics();
|
|
13649
13893
|
spinner.stop();
|
|
@@ -13688,7 +13932,7 @@ statsCommand.command("export").description("Analytics-Daten exportieren (Pro Fea
|
|
|
13688
13932
|
log.info("Anmelden mit: shiva login");
|
|
13689
13933
|
return;
|
|
13690
13934
|
}
|
|
13691
|
-
const spinner =
|
|
13935
|
+
const spinner = ora19("Exportiere Analytics...").start();
|
|
13692
13936
|
try {
|
|
13693
13937
|
const result = await api2.exportAnalytics({
|
|
13694
13938
|
startDate: options.start,
|
|
@@ -13739,16 +13983,16 @@ statsCommand.command("track").description("Analytics Event tracken").argument("<
|
|
|
13739
13983
|
});
|
|
13740
13984
|
|
|
13741
13985
|
// src/commands/system/user.ts
|
|
13742
|
-
import { Command as
|
|
13743
|
-
import
|
|
13744
|
-
var userCommand = new
|
|
13986
|
+
import { Command as Command33 } from "commander";
|
|
13987
|
+
import ora20 from "ora";
|
|
13988
|
+
var userCommand = new Command33("user").description("User Account Verwaltung");
|
|
13745
13989
|
userCommand.command("profile").description("User-Profil anzeigen").option("--json", "JSON Output").action(async (options) => {
|
|
13746
13990
|
if (!isAuthenticated()) {
|
|
13747
13991
|
log.error("Nicht angemeldet");
|
|
13748
13992
|
log.info("Anmelden mit: shiva login");
|
|
13749
13993
|
return;
|
|
13750
13994
|
}
|
|
13751
|
-
const spinner =
|
|
13995
|
+
const spinner = ora20("Lade Profil...").start();
|
|
13752
13996
|
try {
|
|
13753
13997
|
const profile = await api.getUserProfile();
|
|
13754
13998
|
spinner.stop();
|
|
@@ -13785,7 +14029,7 @@ userCommand.command("update").description("User-Profil aktualisieren").option("-
|
|
|
13785
14029
|
log.plain(" --name <name> Name setzen");
|
|
13786
14030
|
return;
|
|
13787
14031
|
}
|
|
13788
|
-
const spinner =
|
|
14032
|
+
const spinner = ora20("Aktualisiere Profil...").start();
|
|
13789
14033
|
try {
|
|
13790
14034
|
const result = await api.updateUserProfile({
|
|
13791
14035
|
name: options.name
|
|
@@ -13806,7 +14050,7 @@ userCommand.command("usage").description("Resource-Nutzung und Limits anzeigen")
|
|
|
13806
14050
|
log.info("Anmelden mit: shiva login");
|
|
13807
14051
|
return;
|
|
13808
14052
|
}
|
|
13809
|
-
const spinner =
|
|
14053
|
+
const spinner = ora20("Lade Usage...").start();
|
|
13810
14054
|
try {
|
|
13811
14055
|
const usage = await api.getUserUsage();
|
|
13812
14056
|
spinner.stop();
|
|
@@ -13849,7 +14093,7 @@ userCommand.command("subscription").description("Subscription-Status anzeigen").
|
|
|
13849
14093
|
log.info("Anmelden mit: shiva login");
|
|
13850
14094
|
return;
|
|
13851
14095
|
}
|
|
13852
|
-
const spinner =
|
|
14096
|
+
const spinner = ora20("Lade Subscription...").start();
|
|
13853
14097
|
try {
|
|
13854
14098
|
const sub = await api.getSubscription();
|
|
13855
14099
|
spinner.stop();
|
|
@@ -13909,7 +14153,7 @@ userCommand.command("token").description("Neuen CLI-Token generieren").option("-
|
|
|
13909
14153
|
log.dim("Abgebrochen");
|
|
13910
14154
|
return;
|
|
13911
14155
|
}
|
|
13912
|
-
const spinner =
|
|
14156
|
+
const spinner = ora20("Generiere Token...").start();
|
|
13913
14157
|
try {
|
|
13914
14158
|
const result = await api.generateCliToken();
|
|
13915
14159
|
spinner.stop();
|
|
@@ -13974,7 +14218,7 @@ userCommand.command("delete").description("Account unwiderruflich l\xF6schen").a
|
|
|
13974
14218
|
log.dim("Abgebrochen (falscher Best\xE4tigungstext)");
|
|
13975
14219
|
return;
|
|
13976
14220
|
}
|
|
13977
|
-
const spinner =
|
|
14221
|
+
const spinner = ora20("L\xF6sche Account...").start();
|
|
13978
14222
|
try {
|
|
13979
14223
|
const result = await api.deleteAccount("DELETE");
|
|
13980
14224
|
if (result.success) {
|
|
@@ -14016,9 +14260,9 @@ userCommand.command("whoami").description("Aktuelle Anmeldung anzeigen").action(
|
|
|
14016
14260
|
});
|
|
14017
14261
|
|
|
14018
14262
|
// src/commands/advanced/docker.ts
|
|
14019
|
-
import { Command as
|
|
14020
|
-
import
|
|
14021
|
-
var dockerCommand = new
|
|
14263
|
+
import { Command as Command34 } from "commander";
|
|
14264
|
+
import ora21 from "ora";
|
|
14265
|
+
var dockerCommand = new Command34("docker").description("Docker-Integration verwalten");
|
|
14022
14266
|
dockerCommand.command("status").description("Docker-Verf\xFCgbarkeit pr\xFCfen").action(() => {
|
|
14023
14267
|
log.brand();
|
|
14024
14268
|
log.header("Docker Status");
|
|
@@ -14083,7 +14327,7 @@ dockerCommand.command("enable").description("Docker-Modus aktivieren").action(as
|
|
|
14083
14327
|
return;
|
|
14084
14328
|
}
|
|
14085
14329
|
const image = dockerService.getDefaultImage();
|
|
14086
|
-
const spinner =
|
|
14330
|
+
const spinner = ora21(`Pr\xFCfe Image: ${image}...`).start();
|
|
14087
14331
|
if (!dockerService.imageExists(image)) {
|
|
14088
14332
|
spinner.text = `Lade Image herunter: ${image}...`;
|
|
14089
14333
|
try {
|
|
@@ -14142,7 +14386,7 @@ dockerCommand.command("logs").description("Container-Logs anzeigen").argument("<
|
|
|
14142
14386
|
console.log(logs);
|
|
14143
14387
|
});
|
|
14144
14388
|
dockerCommand.command("stop").description("Container stoppen").argument("<name>", "Container-Name oder ID").action(async (name) => {
|
|
14145
|
-
const spinner =
|
|
14389
|
+
const spinner = ora21(`Stoppe Container ${name}...`).start();
|
|
14146
14390
|
try {
|
|
14147
14391
|
await dockerService.stopContainer(name);
|
|
14148
14392
|
spinner.succeed(`Container gestoppt: ${name}`);
|
|
@@ -14152,7 +14396,7 @@ dockerCommand.command("stop").description("Container stoppen").argument("<name>"
|
|
|
14152
14396
|
}
|
|
14153
14397
|
});
|
|
14154
14398
|
dockerCommand.command("clean").description("Gestoppte Container aufr\xE4umen").action(async () => {
|
|
14155
|
-
const spinner =
|
|
14399
|
+
const spinner = ora21("R\xE4ume Container auf...").start();
|
|
14156
14400
|
try {
|
|
14157
14401
|
const count = await dockerService.cleanContainers();
|
|
14158
14402
|
spinner.succeed(`${count} Container entfernt`);
|
|
@@ -14163,7 +14407,7 @@ dockerCommand.command("clean").description("Gestoppte Container aufr\xE4umen").a
|
|
|
14163
14407
|
});
|
|
14164
14408
|
dockerCommand.command("pull").description("Docker-Image herunterladen").argument("[image]", "Image-Name (default: shiva/claude-runner:latest)").action(async (image) => {
|
|
14165
14409
|
const targetImage = image || dockerService.getDefaultImage();
|
|
14166
|
-
const spinner =
|
|
14410
|
+
const spinner = ora21(`Lade Image herunter: ${targetImage}...`).start();
|
|
14167
14411
|
try {
|
|
14168
14412
|
await dockerService.pullImage(targetImage);
|
|
14169
14413
|
spinner.succeed(`Image heruntergeladen: ${targetImage}`);
|
|
@@ -14248,11 +14492,11 @@ dockerCommand.action(() => {
|
|
|
14248
14492
|
});
|
|
14249
14493
|
|
|
14250
14494
|
// src/commands/advanced/workflow.ts
|
|
14251
|
-
import { Command as
|
|
14495
|
+
import { Command as Command35 } from "commander";
|
|
14252
14496
|
import * as fs13 from "fs";
|
|
14253
14497
|
import * as path14 from "path";
|
|
14254
14498
|
import * as os6 from "os";
|
|
14255
|
-
import
|
|
14499
|
+
import ora22 from "ora";
|
|
14256
14500
|
import inquirer12 from "inquirer";
|
|
14257
14501
|
var builtInWorkflows = {
|
|
14258
14502
|
morning: {
|
|
@@ -14272,7 +14516,7 @@ var builtInWorkflows = {
|
|
|
14272
14516
|
]
|
|
14273
14517
|
}
|
|
14274
14518
|
};
|
|
14275
|
-
var workflowCommand = new
|
|
14519
|
+
var workflowCommand = new Command35("workflow").description("Automatisierte Workflows ausf\xFChren").action(async () => {
|
|
14276
14520
|
await listWorkflows();
|
|
14277
14521
|
});
|
|
14278
14522
|
workflowCommand.command("list").alias("ls").description("Verf\xFCgbare Workflows anzeigen").action(async () => {
|
|
@@ -14441,7 +14685,7 @@ function deleteCustomWorkflow(name) {
|
|
|
14441
14685
|
fs13.writeFileSync(filepath, JSON.stringify(workflows, null, 2));
|
|
14442
14686
|
}
|
|
14443
14687
|
async function executeStep(step) {
|
|
14444
|
-
const spinner =
|
|
14688
|
+
const spinner = ora22("Ausf\xFChren...").start();
|
|
14445
14689
|
try {
|
|
14446
14690
|
switch (step.type) {
|
|
14447
14691
|
case "issues": {
|
|
@@ -14527,17 +14771,17 @@ async function executeStep(step) {
|
|
|
14527
14771
|
}
|
|
14528
14772
|
|
|
14529
14773
|
// src/commands/advanced/hook.ts
|
|
14530
|
-
import { Command as
|
|
14531
|
-
import { existsSync as
|
|
14774
|
+
import { Command as Command36 } from "commander";
|
|
14775
|
+
import { existsSync as existsSync22, readFileSync as readFileSync12, writeFileSync as writeFileSync10, mkdirSync as mkdirSync6 } from "fs";
|
|
14532
14776
|
import { homedir as homedir7 } from "os";
|
|
14533
14777
|
import { join as join12 } from "path";
|
|
14534
14778
|
var CLAUDE_SETTINGS_PATH = join12(homedir7(), ".claude", "settings.json");
|
|
14535
14779
|
function getClaudeSettings() {
|
|
14536
|
-
if (!
|
|
14780
|
+
if (!existsSync22(CLAUDE_SETTINGS_PATH)) {
|
|
14537
14781
|
return {};
|
|
14538
14782
|
}
|
|
14539
14783
|
try {
|
|
14540
|
-
const content =
|
|
14784
|
+
const content = readFileSync12(CLAUDE_SETTINGS_PATH, "utf-8");
|
|
14541
14785
|
return JSON.parse(content);
|
|
14542
14786
|
} catch {
|
|
14543
14787
|
return {};
|
|
@@ -14545,7 +14789,7 @@ function getClaudeSettings() {
|
|
|
14545
14789
|
}
|
|
14546
14790
|
function saveClaudeSettings(settings) {
|
|
14547
14791
|
const dir = join12(homedir7(), ".claude");
|
|
14548
|
-
if (!
|
|
14792
|
+
if (!existsSync22(dir)) {
|
|
14549
14793
|
mkdirSync6(dir, { recursive: true });
|
|
14550
14794
|
}
|
|
14551
14795
|
writeFileSync10(CLAUDE_SETTINGS_PATH, JSON.stringify(settings, null, 2));
|
|
@@ -14562,11 +14806,11 @@ function removeShivaHooks(eventHooks) {
|
|
|
14562
14806
|
(entry) => !entry.hooks?.some((h) => h.command?.includes("shiva"))
|
|
14563
14807
|
);
|
|
14564
14808
|
}
|
|
14565
|
-
var hookCommand = new
|
|
14809
|
+
var hookCommand = new Command36("hook").description("Claude Code Hook Integration verwalten");
|
|
14566
14810
|
hookCommand.command("install").description("SHIVA Hooks in Claude Code installieren").option("--github", "GitHub Context Injection aktivieren").option("--sync", "Cloud Sync Hooks aktivieren (Standard)").option("--scan", "Package Security Scanning aktivieren").option("--all", "Alle Hooks aktivieren").action((options) => {
|
|
14567
14811
|
log.brand();
|
|
14568
14812
|
const claudePath = join12(homedir7(), ".claude");
|
|
14569
|
-
if (!
|
|
14813
|
+
if (!existsSync22(claudePath)) {
|
|
14570
14814
|
log.error("Claude Code nicht gefunden");
|
|
14571
14815
|
log.newline();
|
|
14572
14816
|
log.info("Installiere Claude Code:");
|
|
@@ -14984,8 +15228,8 @@ hookCommand.command("cloud-list").description("Cloud-Hooks auflisten").option("-
|
|
|
14984
15228
|
log.info("Anmelden mit: shiva login");
|
|
14985
15229
|
return;
|
|
14986
15230
|
}
|
|
14987
|
-
const
|
|
14988
|
-
const spinner =
|
|
15231
|
+
const ora25 = (await import("ora")).default;
|
|
15232
|
+
const spinner = ora25("Lade Cloud-Hooks...").start();
|
|
14989
15233
|
try {
|
|
14990
15234
|
let hooks;
|
|
14991
15235
|
if (options.event) {
|
|
@@ -15032,8 +15276,8 @@ hookCommand.command("cloud-create").description("Neuen Cloud-Hook erstellen").re
|
|
|
15032
15276
|
log.info("Anmelden mit: shiva login");
|
|
15033
15277
|
return;
|
|
15034
15278
|
}
|
|
15035
|
-
const
|
|
15036
|
-
const spinner =
|
|
15279
|
+
const ora25 = (await import("ora")).default;
|
|
15280
|
+
const spinner = ora25("Erstelle Cloud-Hook...").start();
|
|
15037
15281
|
try {
|
|
15038
15282
|
const result = await api2.createHook({
|
|
15039
15283
|
event: options.event,
|
|
@@ -15061,8 +15305,8 @@ hookCommand.command("cloud-test").description("Cloud-Hook testen").argument("<ho
|
|
|
15061
15305
|
log.info("Anmelden mit: shiva login");
|
|
15062
15306
|
return;
|
|
15063
15307
|
}
|
|
15064
|
-
const
|
|
15065
|
-
const spinner =
|
|
15308
|
+
const ora25 = (await import("ora")).default;
|
|
15309
|
+
const spinner = ora25("Teste Hook...").start();
|
|
15066
15310
|
try {
|
|
15067
15311
|
const result = await api2.testHook(hookId);
|
|
15068
15312
|
spinner.stop();
|
|
@@ -15108,8 +15352,8 @@ hookCommand.command("cloud-delete").description("Cloud-Hook l\xF6schen").argumen
|
|
|
15108
15352
|
return;
|
|
15109
15353
|
}
|
|
15110
15354
|
}
|
|
15111
|
-
const
|
|
15112
|
-
const spinner =
|
|
15355
|
+
const ora25 = (await import("ora")).default;
|
|
15356
|
+
const spinner = ora25("L\xF6sche Hook...").start();
|
|
15113
15357
|
try {
|
|
15114
15358
|
const result = await api2.deleteHook(hookId);
|
|
15115
15359
|
if (result.success) {
|
|
@@ -15135,8 +15379,8 @@ hookCommand.command("cloud-toggle").description("Cloud-Hook aktivieren/deaktivie
|
|
|
15135
15379
|
log.error("Bitte --enable oder --disable angeben");
|
|
15136
15380
|
return;
|
|
15137
15381
|
}
|
|
15138
|
-
const
|
|
15139
|
-
const spinner =
|
|
15382
|
+
const ora25 = (await import("ora")).default;
|
|
15383
|
+
const spinner = ora25("Aktualisiere Hook...").start();
|
|
15140
15384
|
try {
|
|
15141
15385
|
const result = await api2.updateHook(hookId, { enabled });
|
|
15142
15386
|
if (result.success) {
|
|
@@ -15151,11 +15395,11 @@ hookCommand.command("cloud-toggle").description("Cloud-Hook aktivieren/deaktivie
|
|
|
15151
15395
|
});
|
|
15152
15396
|
|
|
15153
15397
|
// src/commands/advanced/package.ts
|
|
15154
|
-
import { Command as
|
|
15398
|
+
import { Command as Command37 } from "commander";
|
|
15155
15399
|
import * as fs14 from "fs";
|
|
15156
15400
|
import inquirer13 from "inquirer";
|
|
15157
|
-
import
|
|
15158
|
-
var packageCommand = new
|
|
15401
|
+
import ora23 from "ora";
|
|
15402
|
+
var packageCommand = new Command37("package").description("Projekt-Gruppen (Packages) verwalten").action(() => {
|
|
15159
15403
|
listPackages();
|
|
15160
15404
|
});
|
|
15161
15405
|
packageCommand.command("list").description("Alle Packages auflisten").option("--json", "JSON Output").action((options) => {
|
|
@@ -15271,7 +15515,7 @@ packageCommand.command("start <name>").description("Alle Projekte eines Packages
|
|
|
15271
15515
|
log.error(`Package "${pkg.name}" hat keine Projekte.`);
|
|
15272
15516
|
return;
|
|
15273
15517
|
}
|
|
15274
|
-
const spinner =
|
|
15518
|
+
const spinner = ora23("Bereite Projekte vor...").start();
|
|
15275
15519
|
try {
|
|
15276
15520
|
const launches = await getPackageLaunchConfig(name, options.new);
|
|
15277
15521
|
spinner.stop();
|
|
@@ -15321,7 +15565,7 @@ packageCommand.command("push").description("Packages in Cloud sichern").option("
|
|
|
15321
15565
|
log.warn("Keine Packages zum Synchronisieren gefunden");
|
|
15322
15566
|
return;
|
|
15323
15567
|
}
|
|
15324
|
-
const spinner =
|
|
15568
|
+
const spinner = ora23("Synchronisiere Packages...").start();
|
|
15325
15569
|
let syncedCount = 0;
|
|
15326
15570
|
let errorCount = 0;
|
|
15327
15571
|
for (const pkg of packages) {
|
|
@@ -15353,7 +15597,7 @@ packageCommand.command("pull").description("Packages aus Cloud laden").option("-
|
|
|
15353
15597
|
log.info("Anmelden mit: shiva login");
|
|
15354
15598
|
return;
|
|
15355
15599
|
}
|
|
15356
|
-
const spinner =
|
|
15600
|
+
const spinner = ora23("Lade Packages aus Cloud...").start();
|
|
15357
15601
|
try {
|
|
15358
15602
|
const cloudPackages = await api2.getPackages();
|
|
15359
15603
|
spinner.stop();
|
|
@@ -15415,7 +15659,7 @@ packageCommand.command("sync").description("Packages mit Cloud synchronisieren")
|
|
|
15415
15659
|
log.info("Anmelden mit: shiva login");
|
|
15416
15660
|
return;
|
|
15417
15661
|
}
|
|
15418
|
-
const spinner =
|
|
15662
|
+
const spinner = ora23("Synchronisiere Packages...").start();
|
|
15419
15663
|
const localPackages = getAllPackages();
|
|
15420
15664
|
let pushedCount = 0;
|
|
15421
15665
|
for (const pkg of localPackages) {
|
|
@@ -15518,11 +15762,11 @@ function listPackages() {
|
|
|
15518
15762
|
}
|
|
15519
15763
|
|
|
15520
15764
|
// src/commands/advanced/sandbox.ts
|
|
15521
|
-
import { Command as
|
|
15522
|
-
import
|
|
15523
|
-
var sandboxCommand = new
|
|
15765
|
+
import { Command as Command38 } from "commander";
|
|
15766
|
+
import ora24 from "ora";
|
|
15767
|
+
var sandboxCommand = new Command38("sandbox").description("Sandbox-Management mit Cloud-Sync");
|
|
15524
15768
|
sandboxCommand.command("list").description("Alle Sandboxes auflisten").option("--local", "Nur lokale Sandboxes").option("--cloud", "Nur Cloud Sandboxes").option("--status <status>", "Nach Status filtern: active, pending-review, applied, discarded").option("--json", "JSON Output").action(async (options) => {
|
|
15525
|
-
const spinner =
|
|
15769
|
+
const spinner = ora24("Lade Sandboxes...").start();
|
|
15526
15770
|
try {
|
|
15527
15771
|
const results = [];
|
|
15528
15772
|
if (!options.cloud) {
|
|
@@ -15592,7 +15836,7 @@ sandboxCommand.command("list").description("Alle Sandboxes auflisten").option("-
|
|
|
15592
15836
|
}
|
|
15593
15837
|
});
|
|
15594
15838
|
sandboxCommand.command("pending").description("Sandboxes mit Pending Review Status").option("--json", "JSON Output").action(async (options) => {
|
|
15595
|
-
const spinner =
|
|
15839
|
+
const spinner = ora24("Lade Pending Sandboxes...").start();
|
|
15596
15840
|
try {
|
|
15597
15841
|
const localPending = sandboxService.listPendingReview();
|
|
15598
15842
|
let cloudPending = [];
|
|
@@ -15636,7 +15880,7 @@ sandboxCommand.command("pending").description("Sandboxes mit Pending Review Stat
|
|
|
15636
15880
|
}
|
|
15637
15881
|
});
|
|
15638
15882
|
sandboxCommand.command("stats").description("Sandbox-Statistiken anzeigen").option("--json", "JSON Output").action(async (options) => {
|
|
15639
|
-
const spinner =
|
|
15883
|
+
const spinner = ora24("Lade Statistiken...").start();
|
|
15640
15884
|
try {
|
|
15641
15885
|
const localSandboxes = sandboxService.listSandboxes();
|
|
15642
15886
|
const localStats = {
|
|
@@ -15690,7 +15934,7 @@ sandboxCommand.command("sync").description("Sandbox mit Cloud synchronisieren").
|
|
|
15690
15934
|
log.info("Anmelden mit: shiva login");
|
|
15691
15935
|
return;
|
|
15692
15936
|
}
|
|
15693
|
-
const spinner =
|
|
15937
|
+
const spinner = ora24("Synchronisiere Sandbox...").start();
|
|
15694
15938
|
try {
|
|
15695
15939
|
if (id) {
|
|
15696
15940
|
await api.syncSandbox(id, {
|
|
@@ -15731,7 +15975,7 @@ sandboxCommand.command("cleanup").description("Alte Sandboxes aufr\xE4umen").opt
|
|
|
15731
15975
|
return;
|
|
15732
15976
|
}
|
|
15733
15977
|
}
|
|
15734
|
-
const spinner =
|
|
15978
|
+
const spinner = ora24("R\xE4ume Sandboxes auf...").start();
|
|
15735
15979
|
try {
|
|
15736
15980
|
let localDeleted = 0;
|
|
15737
15981
|
let cloudDeleted = 0;
|
|
@@ -15759,7 +16003,7 @@ sandboxCommand.command("cleanup").description("Alte Sandboxes aufr\xE4umen").opt
|
|
|
15759
16003
|
});
|
|
15760
16004
|
sandboxCommand.command("config").description("Sandbox-Konfiguration verwalten").option("--show", "Konfiguration anzeigen").option("--mode <mode>", "Standard-Modus: worktree, copy, docker-overlay").option("--cleanup-days <days>", "Auto-Cleanup nach X Tagen").option("--max <n>", "Maximale aktive Sandboxes").option("--require-review", "Review vor Apply erforderlich").option("--no-require-review", "Review nicht erforderlich").option("--pull", "Konfiguration aus Cloud laden").option("--push", "Konfiguration in Cloud speichern").action(async (options) => {
|
|
15761
16005
|
if (options.pull && isAuthenticated()) {
|
|
15762
|
-
const spinner =
|
|
16006
|
+
const spinner = ora24("Lade Konfiguration aus Cloud...").start();
|
|
15763
16007
|
try {
|
|
15764
16008
|
const cloudConfig = await api.getSandboxConfig();
|
|
15765
16009
|
sandboxService.updateConfig({
|
|
@@ -15776,7 +16020,7 @@ sandboxCommand.command("config").description("Sandbox-Konfiguration verwalten").
|
|
|
15776
16020
|
}
|
|
15777
16021
|
}
|
|
15778
16022
|
if (options.push && isAuthenticated()) {
|
|
15779
|
-
const spinner =
|
|
16023
|
+
const spinner = ora24("Speichere Konfiguration in Cloud...").start();
|
|
15780
16024
|
try {
|
|
15781
16025
|
const localConfig = sandboxService.getConfig();
|
|
15782
16026
|
const cloudMode = localConfig.defaultMode === "none" ? "worktree" : localConfig.defaultMode;
|
|
@@ -15847,7 +16091,7 @@ sandboxCommand.command("delete <id>").description("Sandbox l\xF6schen").option("
|
|
|
15847
16091
|
return;
|
|
15848
16092
|
}
|
|
15849
16093
|
}
|
|
15850
|
-
const spinner =
|
|
16094
|
+
const spinner = ora24("L\xF6sche Sandbox...").start();
|
|
15851
16095
|
try {
|
|
15852
16096
|
try {
|
|
15853
16097
|
await sandboxService.deleteSandbox(id);
|
|
@@ -15871,8 +16115,8 @@ sandboxCommand.command("delete <id>").description("Sandbox l\xF6schen").option("
|
|
|
15871
16115
|
});
|
|
15872
16116
|
|
|
15873
16117
|
// src/index.ts
|
|
15874
|
-
var program = new
|
|
15875
|
-
program.name("shiva").description("SHIVA Code - Control Station for Claude Code").version("0.
|
|
16118
|
+
var program = new Command39();
|
|
16119
|
+
program.name("shiva").description("SHIVA Code - Control Station for Claude Code").version("0.6.3");
|
|
15876
16120
|
program.addCommand(loginCommand);
|
|
15877
16121
|
program.addCommand(logoutCommand);
|
|
15878
16122
|
program.addCommand(sessionsCommand);
|
|
@@ -15888,6 +16132,7 @@ program.addCommand(connectCommand);
|
|
|
15888
16132
|
program.addCommand(disconnectCommand);
|
|
15889
16133
|
program.addCommand(configCommand);
|
|
15890
16134
|
program.addCommand(projectCommand);
|
|
16135
|
+
program.addCommand(repairCommand);
|
|
15891
16136
|
program.addCommand(githubCommand);
|
|
15892
16137
|
program.addCommand(issuesCommand);
|
|
15893
16138
|
program.addCommand(prsCommand);
|
|
@@ -15919,7 +16164,7 @@ program.action(async () => {
|
|
|
15919
16164
|
async function interactiveMenu(choices, shortcuts) {
|
|
15920
16165
|
const write = (str) => process.stdout.write(str);
|
|
15921
16166
|
const totalLines = 1 + choices.length + 1;
|
|
15922
|
-
return new Promise((
|
|
16167
|
+
return new Promise((resolve14) => {
|
|
15923
16168
|
let selectedIndex = 0;
|
|
15924
16169
|
let resolved = false;
|
|
15925
16170
|
let firstRender = true;
|
|
@@ -15974,7 +16219,7 @@ async function interactiveMenu(choices, shortcuts) {
|
|
|
15974
16219
|
resolved = true;
|
|
15975
16220
|
cleanup();
|
|
15976
16221
|
showSelection(shortcutType);
|
|
15977
|
-
|
|
16222
|
+
resolve14({ type: shortcutType });
|
|
15978
16223
|
return;
|
|
15979
16224
|
}
|
|
15980
16225
|
if (keyName === "up") {
|
|
@@ -15987,12 +16232,12 @@ async function interactiveMenu(choices, shortcuts) {
|
|
|
15987
16232
|
resolved = true;
|
|
15988
16233
|
cleanup();
|
|
15989
16234
|
showSelection(choices[selectedIndex].name);
|
|
15990
|
-
|
|
16235
|
+
resolve14(choices[selectedIndex].value);
|
|
15991
16236
|
} else if (keyName === "escape") {
|
|
15992
16237
|
resolved = true;
|
|
15993
16238
|
cleanup();
|
|
15994
16239
|
showSelection("Beenden");
|
|
15995
|
-
|
|
16240
|
+
resolve14({ type: "quit" });
|
|
15996
16241
|
}
|
|
15997
16242
|
};
|
|
15998
16243
|
process.stdin.on("keypress", handler);
|