shiva-code 0.8.10 → 0.8.12

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 CHANGED
@@ -3361,7 +3361,7 @@ var repairCommand = new Command9("repair").description("Repariert SHIVA-Konfigur
3361
3361
 
3362
3362
  // src/commands/session/start.ts
3363
3363
  import { Command as Command10 } from "commander";
3364
- import * as fs from "fs";
3364
+ import * as fs2 from "fs";
3365
3365
  import * as path3 from "path";
3366
3366
  import ora8 from "ora";
3367
3367
  import { spawnSync as spawnSync4 } from "child_process";
@@ -3370,6 +3370,7 @@ import { spawnSync as spawnSync4 } from "child_process";
3370
3370
  import { spawn as spawn2, spawnSync as spawnSync2 } from "child_process";
3371
3371
  import * as path2 from "path";
3372
3372
  import * as os2 from "os";
3373
+ import * as fs from "fs";
3373
3374
 
3374
3375
  // src/services/infrastructure/docker.ts
3375
3376
  import { spawn, spawnSync } from "child_process";
@@ -3446,8 +3447,8 @@ var DockerService = class {
3446
3447
  ];
3447
3448
  for (const socketPath of possiblePaths) {
3448
3449
  try {
3449
- const fs15 = __require("fs");
3450
- if (fs15.existsSync(socketPath)) {
3450
+ const fs16 = __require("fs");
3451
+ if (fs16.existsSync(socketPath)) {
3451
3452
  return socketPath;
3452
3453
  }
3453
3454
  } catch {
@@ -4117,6 +4118,29 @@ var DockerService = class {
4117
4118
  var dockerService = new DockerService();
4118
4119
 
4119
4120
  // src/services/infrastructure/terminal.ts
4121
+ function cleanupTmuxSockets() {
4122
+ try {
4123
+ const tmpDir = "/tmp";
4124
+ const files = fs.readdirSync(tmpDir);
4125
+ const uid = process.getuid?.() ?? 0;
4126
+ for (const file of files) {
4127
+ if (file.startsWith("tmux-") && file.includes(String(uid))) {
4128
+ const socketPath = path2.join(tmpDir, file);
4129
+ try {
4130
+ const stats = fs.statSync(socketPath);
4131
+ if (stats.isDirectory()) {
4132
+ const result = spawnSync2("tmux", ["list-sessions"], { stdio: "pipe" });
4133
+ if (result.status !== 0) {
4134
+ fs.rmSync(socketPath, { recursive: true, force: true });
4135
+ }
4136
+ }
4137
+ } catch {
4138
+ }
4139
+ }
4140
+ }
4141
+ } catch {
4142
+ }
4143
+ }
4120
4144
  function commandExists(command) {
4121
4145
  try {
4122
4146
  if (!/^[a-zA-Z0-9_-]+$/.test(command)) {
@@ -4189,6 +4213,7 @@ function sanitizeProjectName(name) {
4189
4213
  return name.replace(/[^a-zA-Z0-9_-]/g, "-").substring(0, 50);
4190
4214
  }
4191
4215
  async function spawnInTmux(projects, sessionName) {
4216
+ cleanupTmuxSockets();
4192
4217
  const tmuxSession = sessionName || `shiva-${Date.now()}`;
4193
4218
  const insideTmux = isInsideTmux();
4194
4219
  for (let i = 0; i < projects.length; i++) {
@@ -4201,16 +4226,12 @@ async function spawnInTmux(projects, sessionName) {
4201
4226
  const claudeArgs = buildClaudeArgs(project);
4202
4227
  const safeName = sanitizeProjectName(project.projectName);
4203
4228
  if (insideTmux) {
4204
- spawnSync2("tmux", [
4205
- "new-window",
4206
- "-n",
4207
- safeName,
4208
- "-c",
4209
- project.projectPath,
4210
- "claude",
4211
- ...claudeArgs
4212
- ], { stdio: "ignore" });
4213
- spawnSync2("tmux", ["select-window", "-t", safeName], { stdio: "ignore" });
4229
+ spawnSync2("tmux", ["rename-window", safeName], { stdio: "ignore" });
4230
+ spawnSync2("claude", claudeArgs, {
4231
+ stdio: "inherit",
4232
+ cwd: project.projectPath
4233
+ });
4234
+ return;
4214
4235
  } else {
4215
4236
  if (i === 0) {
4216
4237
  spawnSync2("tmux", [
@@ -4539,7 +4560,7 @@ function getTerminalName(terminal) {
4539
4560
  }
4540
4561
 
4541
4562
  // src/services/sandbox/sandbox.ts
4542
- import { existsSync as existsSync8, mkdirSync, rmSync, readdirSync as readdirSync2, copyFileSync, readFileSync as readFileSync4 } from "fs";
4563
+ import { existsSync as existsSync8, mkdirSync, rmSync as rmSync2, readdirSync as readdirSync3, copyFileSync, readFileSync as readFileSync4 } from "fs";
4543
4564
  import { join as join4, dirname } from "path";
4544
4565
  import { randomUUID } from "crypto";
4545
4566
  import Conf2 from "conf";
@@ -4834,7 +4855,7 @@ var SandboxService = class {
4834
4855
  * Recursively copy a directory
4835
4856
  */
4836
4857
  copyDirectory(src, dest, excludePaths) {
4837
- const entries = readdirSync2(src, { withFileTypes: true });
4858
+ const entries = readdirSync3(src, { withFileTypes: true });
4838
4859
  for (const entry of entries) {
4839
4860
  const srcPath = join4(src, entry.name);
4840
4861
  const destPath = join4(dest, entry.name);
@@ -4928,13 +4949,13 @@ var SandboxService = class {
4928
4949
  const removeResult = gitExec(["worktree", "remove", session.sandboxPath, "--force"], session.projectPath);
4929
4950
  if (!removeResult.success) {
4930
4951
  if (existsSync8(session.sandboxPath)) {
4931
- rmSync(session.sandboxPath, { recursive: true, force: true });
4952
+ rmSync2(session.sandboxPath, { recursive: true, force: true });
4932
4953
  }
4933
4954
  gitExec(["worktree", "prune"], session.projectPath);
4934
4955
  }
4935
4956
  } else {
4936
4957
  if (existsSync8(session.sandboxPath)) {
4937
- rmSync(session.sandboxPath, { recursive: true, force: true });
4958
+ rmSync2(session.sandboxPath, { recursive: true, force: true });
4938
4959
  }
4939
4960
  }
4940
4961
  const sessions = store.get("sessions");
@@ -5010,7 +5031,7 @@ var SandboxService = class {
5010
5031
  const sandboxEntries = /* @__PURE__ */ new Set();
5011
5032
  const sandboxFullPath = join4(sandboxPath, relativePath);
5012
5033
  if (existsSync8(sandboxFullPath)) {
5013
- const entries = readdirSync2(sandboxFullPath, { withFileTypes: true });
5034
+ const entries = readdirSync3(sandboxFullPath, { withFileTypes: true });
5014
5035
  for (const entry of entries) {
5015
5036
  if (config.excludePaths.includes(entry.name) || entry.name === ".shiva") {
5016
5037
  continue;
@@ -5054,7 +5075,7 @@ var SandboxService = class {
5054
5075
  }
5055
5076
  const originalFullPath = join4(originalPath, relativePath);
5056
5077
  if (existsSync8(originalFullPath)) {
5057
- const entries = readdirSync2(originalFullPath, { withFileTypes: true });
5078
+ const entries = readdirSync3(originalFullPath, { withFileTypes: true });
5058
5079
  for (const entry of entries) {
5059
5080
  if (config.excludePaths.includes(entry.name) || entry.name === ".shiva") {
5060
5081
  continue;
@@ -5100,7 +5121,7 @@ var SandboxService = class {
5100
5121
  * Count changes for a new directory
5101
5122
  */
5102
5123
  async countNewDirectoryChanges(dirPath, relativePath, changes) {
5103
- const entries = readdirSync2(dirPath, { withFileTypes: true });
5124
+ const entries = readdirSync3(dirPath, { withFileTypes: true });
5104
5125
  const config = this.getConfig();
5105
5126
  for (const entry of entries) {
5106
5127
  if (config.excludePaths.includes(entry.name)) continue;
@@ -5124,7 +5145,7 @@ var SandboxService = class {
5124
5145
  * Count changes for a deleted directory
5125
5146
  */
5126
5147
  async countDeletedDirectoryChanges(dirPath, relativePath, changes) {
5127
- const entries = readdirSync2(dirPath, { withFileTypes: true });
5148
+ const entries = readdirSync3(dirPath, { withFileTypes: true });
5128
5149
  const config = this.getConfig();
5129
5150
  for (const entry of entries) {
5130
5151
  if (config.excludePaths.includes(entry.name)) continue;
@@ -5228,7 +5249,7 @@ ${content.split("\n").map((l) => `- ${l}`).join("\n")}`;
5228
5249
  const destPath = join4(session.projectPath, filePath);
5229
5250
  if (change.type === "deleted") {
5230
5251
  if (existsSync8(destPath)) {
5231
- rmSync(destPath, { force: true });
5252
+ rmSync2(destPath, { force: true });
5232
5253
  }
5233
5254
  } else {
5234
5255
  if (existsSync8(srcPath)) {
@@ -5268,7 +5289,7 @@ ${content.split("\n").map((l) => `- ${l}`).join("\n")}`;
5268
5289
  copyFileSync(originalPath, sandboxFilePath);
5269
5290
  } else {
5270
5291
  if (existsSync8(sandboxFilePath)) {
5271
- rmSync(sandboxFilePath, { force: true });
5292
+ rmSync2(sandboxFilePath, { force: true });
5272
5293
  }
5273
5294
  }
5274
5295
  }
@@ -5361,7 +5382,7 @@ var startCommand = new Command10("start").description("Projekte starten (mit Git
5361
5382
  const launches = [];
5362
5383
  for (const projektArg of projekte) {
5363
5384
  const absolutePath = path3.resolve(projektArg);
5364
- if (fs.existsSync(absolutePath) && fs.statSync(absolutePath).isDirectory()) {
5385
+ if (fs2.existsSync(absolutePath) && fs2.statSync(absolutePath).isDirectory()) {
5365
5386
  const project = findProjectFromArray(allProjects, absolutePath);
5366
5387
  const latestSession = project?.latestSession;
5367
5388
  launches.push({
@@ -5373,7 +5394,7 @@ var startCommand = new Command10("start").description("Projekte starten (mit Git
5373
5394
  } else {
5374
5395
  const project = findProjectFromArray(allProjects, projektArg);
5375
5396
  if (project) {
5376
- if (!fs.existsSync(project.absolutePath)) {
5397
+ if (!fs2.existsSync(project.absolutePath)) {
5377
5398
  spinner.warn(`Projektpfad existiert nicht: ${project.absolutePath}`);
5378
5399
  continue;
5379
5400
  }
@@ -5522,7 +5543,7 @@ async function startIssueSession(issueNumber, options) {
5522
5543
  let foundIssue = null;
5523
5544
  let repoFullName = null;
5524
5545
  for (const project of allProjects) {
5525
- if (!fs.existsSync(project.absolutePath)) continue;
5546
+ if (!fs2.existsSync(project.absolutePath)) continue;
5526
5547
  const repo = getRepoInfo(project.absolutePath);
5527
5548
  if (!repo) continue;
5528
5549
  const issue = getIssue(repo.fullName, issueNumber);
@@ -5631,7 +5652,7 @@ async function startPRSession(prNumber, options) {
5631
5652
  let foundPR = null;
5632
5653
  let repoFullName = null;
5633
5654
  for (const project of allProjects) {
5634
- if (!fs.existsSync(project.absolutePath)) continue;
5655
+ if (!fs2.existsSync(project.absolutePath)) continue;
5635
5656
  const repo = getRepoInfo(project.absolutePath);
5636
5657
  if (!repo) continue;
5637
5658
  const pr = getPR(repo.fullName, prNumber);
@@ -5732,7 +5753,7 @@ import { Command as Command11 } from "commander";
5732
5753
  import { spawn as spawn4 } from "child_process";
5733
5754
  import inquirer4 from "inquirer";
5734
5755
  import ora9 from "ora";
5735
- import * as fs2 from "fs";
5756
+ import * as fs3 from "fs";
5736
5757
  var resumeCommand = new Command11("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) => {
5737
5758
  try {
5738
5759
  let project = null;
@@ -5824,7 +5845,7 @@ var resumeCommand = new Command11("resume").description("Neueste Claude Code Ses
5824
5845
  log.error("Kein Projekt gefunden");
5825
5846
  return;
5826
5847
  }
5827
- if (!fs2.existsSync(project.absolutePath)) {
5848
+ if (!fs3.existsSync(project.absolutePath)) {
5828
5849
  log.error(`Projektpfad existiert nicht mehr: ${project.absolutePath}`);
5829
5850
  return;
5830
5851
  }
@@ -5955,7 +5976,7 @@ import { Command as Command12 } from "commander";
5955
5976
  import { spawn as spawn5 } from "child_process";
5956
5977
  import inquirer5 from "inquirer";
5957
5978
  import ora10 from "ora";
5958
- import * as fs3 from "fs";
5979
+ import * as fs4 from "fs";
5959
5980
  var restoreCommand = new Command12("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) => {
5960
5981
  try {
5961
5982
  let project = null;
@@ -6032,7 +6053,7 @@ var restoreCommand = new Command12("restore").description("Context aus crashed S
6032
6053
  const statusText = corrupted ? colors.red("Corrupted") : colors.green("OK");
6033
6054
  let fileSize = "unbekannt";
6034
6055
  try {
6035
- const stats = fs3.statSync(session.fullPath);
6056
+ const stats = fs4.statSync(session.fullPath);
6036
6057
  const sizeMB = (stats.size / (1024 * 1024)).toFixed(1);
6037
6058
  fileSize = `${sizeMB}MB`;
6038
6059
  } catch {
@@ -6064,7 +6085,7 @@ var restoreCommand = new Command12("restore").description("Context aus crashed S
6064
6085
  log.newline();
6065
6086
  }
6066
6087
  if (options.prompt !== false) {
6067
- const projectExists = fs3.existsSync(project.absolutePath);
6088
+ const projectExists = fs4.existsSync(project.absolutePath);
6068
6089
  if (!projectExists) {
6069
6090
  log.warn(`Projektpfad existiert nicht: ${project.absolutePath}`);
6070
6091
  log.info("Neue Session kann nicht gestartet werden.");
@@ -6109,7 +6130,7 @@ import { Command as Command13 } from "commander";
6109
6130
  import ora11 from "ora";
6110
6131
 
6111
6132
  // src/services/data/tags.ts
6112
- import * as fs4 from "fs";
6133
+ import * as fs5 from "fs";
6113
6134
  import * as path4 from "path";
6114
6135
  import * as os3 from "os";
6115
6136
  function getTagsPath() {
@@ -6117,11 +6138,11 @@ function getTagsPath() {
6117
6138
  }
6118
6139
  function loadTagsData() {
6119
6140
  const filepath = getTagsPath();
6120
- if (!fs4.existsSync(filepath)) {
6141
+ if (!fs5.existsSync(filepath)) {
6121
6142
  return { sessions: {}, tagMeta: {} };
6122
6143
  }
6123
6144
  try {
6124
- const content = fs4.readFileSync(filepath, "utf-8");
6145
+ const content = fs5.readFileSync(filepath, "utf-8");
6125
6146
  return JSON.parse(content);
6126
6147
  } catch {
6127
6148
  return { sessions: {}, tagMeta: {} };
@@ -6130,10 +6151,10 @@ function loadTagsData() {
6130
6151
  function saveTagsData(data) {
6131
6152
  const filepath = getTagsPath();
6132
6153
  const dir = path4.dirname(filepath);
6133
- if (!fs4.existsSync(dir)) {
6134
- fs4.mkdirSync(dir, { recursive: true });
6154
+ if (!fs5.existsSync(dir)) {
6155
+ fs5.mkdirSync(dir, { recursive: true });
6135
6156
  }
6136
- fs4.writeFileSync(filepath, JSON.stringify(data, null, 2));
6157
+ fs5.writeFileSync(filepath, JSON.stringify(data, null, 2));
6137
6158
  }
6138
6159
  function addTagToSession(sessionId, tag) {
6139
6160
  const data = loadTagsData();
@@ -6389,8 +6410,8 @@ ${colors.dim("Beispiele:")}
6389
6410
  }));
6390
6411
  async function checkProjectExists(path15) {
6391
6412
  try {
6392
- const fs15 = await import("fs");
6393
- return fs15.existsSync(path15);
6413
+ const fs16 = await import("fs");
6414
+ return fs16.existsSync(path15);
6394
6415
  } catch {
6395
6416
  return false;
6396
6417
  }
@@ -6398,7 +6419,8 @@ async function checkProjectExists(path15) {
6398
6419
  sessionsCommand.command("push").description("Sessions in Cloud sichern").option("-p, --project <pfad>", "Nur Sessions eines Projekts").action(async (options) => {
6399
6420
  const { api: api2 } = await import("./client-H3JXPT5B.js");
6400
6421
  const { isAuthenticated: isAuthenticated2 } = await import("./config-FGMZONWV.js");
6401
- const { getProjectConfig: getProjectConfig2 } = await import("./config-D6M6LI6U.js");
6422
+ const { getProjectConfig: getProjectConfig2, getAnalyticsConfig: getAnalyticsConfig2 } = await import("./config-D6M6LI6U.js");
6423
+ const { createAnalyticsService } = await import("./analytics-6WNUPA56.js");
6402
6424
  if (!isAuthenticated2()) {
6403
6425
  log.errorWithSuggestion(Errors.NOT_AUTHENTICATED());
6404
6426
  return;
@@ -6426,15 +6448,24 @@ sessionsCommand.command("push").description("Sessions in Cloud sichern").option(
6426
6448
  if (!config.projectId) {
6427
6449
  continue;
6428
6450
  }
6451
+ const analyticsConfig = getAnalyticsConfig2(project.absolutePath);
6452
+ const analyticsService = createAnalyticsService(project.absolutePath, analyticsConfig);
6429
6453
  for (const session of project.sessions) {
6430
6454
  try {
6455
+ const sessionAnalytics = analyticsService.getSessionAnalytics(session.sessionId);
6431
6456
  await api2.syncSession({
6432
6457
  sessionId: session.sessionId,
6433
6458
  projectId: config.projectId,
6434
6459
  summary: session.firstPrompt,
6435
6460
  messageCount: session.messageCount,
6436
6461
  firstPrompt: session.firstPrompt,
6437
- gitBranch: session.gitBranch
6462
+ gitBranch: session.gitBranch,
6463
+ // Include analytics data if available
6464
+ tokenCount: sessionAnalytics ? sessionAnalytics.inputTokens + sessionAnalytics.outputTokens : void 0,
6465
+ inputTokens: sessionAnalytics?.inputTokens,
6466
+ outputTokens: sessionAnalytics?.outputTokens,
6467
+ durationMinutes: sessionAnalytics?.duration,
6468
+ toolsUsed: sessionAnalytics?.toolsUsed
6438
6469
  });
6439
6470
  syncedCount++;
6440
6471
  } catch {
@@ -6504,7 +6535,8 @@ sessionsCommand.command("pull").description("Sessions aus Cloud laden").option("
6504
6535
  sessionsCommand.command("sync").description("Sessions mit Cloud synchronisieren").option("-p, --project <pfad>", "Nur Sessions eines Projekts").action(async (options) => {
6505
6536
  const { api: api2 } = await import("./client-H3JXPT5B.js");
6506
6537
  const { isAuthenticated: isAuthenticated2 } = await import("./config-FGMZONWV.js");
6507
- const { getProjectConfig: getProjectConfig2 } = await import("./config-D6M6LI6U.js");
6538
+ const { getProjectConfig: getProjectConfig2, getAnalyticsConfig: getAnalyticsConfig2 } = await import("./config-D6M6LI6U.js");
6539
+ const { createAnalyticsService } = await import("./analytics-6WNUPA56.js");
6508
6540
  if (!isAuthenticated2()) {
6509
6541
  log.errorWithSuggestion(Errors.NOT_AUTHENTICATED());
6510
6542
  return;
@@ -6524,15 +6556,24 @@ sessionsCommand.command("sync").description("Sessions mit Cloud synchronisieren"
6524
6556
  for (const project of projects.filter((p) => p.sessions.length > 0)) {
6525
6557
  const config = getProjectConfig2(project.absolutePath);
6526
6558
  if (!config.projectId) continue;
6559
+ const analyticsConfig = getAnalyticsConfig2(project.absolutePath);
6560
+ const analyticsService = createAnalyticsService(project.absolutePath, analyticsConfig);
6527
6561
  for (const session of project.sessions) {
6528
6562
  try {
6563
+ const sessionAnalytics = analyticsService.getSessionAnalytics(session.sessionId);
6529
6564
  await api2.syncSession({
6530
6565
  sessionId: session.sessionId,
6531
6566
  projectId: config.projectId,
6532
6567
  summary: session.firstPrompt,
6533
6568
  messageCount: session.messageCount,
6534
6569
  firstPrompt: session.firstPrompt,
6535
- gitBranch: session.gitBranch
6570
+ gitBranch: session.gitBranch,
6571
+ // Include analytics data if available
6572
+ tokenCount: sessionAnalytics ? sessionAnalytics.inputTokens + sessionAnalytics.outputTokens : void 0,
6573
+ inputTokens: sessionAnalytics?.inputTokens,
6574
+ outputTokens: sessionAnalytics?.outputTokens,
6575
+ durationMinutes: sessionAnalytics?.duration,
6576
+ toolsUsed: sessionAnalytics?.toolsUsed
6536
6577
  });
6537
6578
  pushedCount++;
6538
6579
  } catch {
@@ -7169,7 +7210,7 @@ sessionCommand.command("config").description("Sandbox-Konfiguration verwalten").
7169
7210
  // src/commands/github/github-cmd.ts
7170
7211
  import { Command as Command15 } from "commander";
7171
7212
  import { spawn as spawn6, spawnSync as spawnSync5 } from "child_process";
7172
- import * as fs5 from "fs";
7213
+ import * as fs6 from "fs";
7173
7214
  import * as path5 from "path";
7174
7215
  import inquirer6 from "inquirer";
7175
7216
  var githubCommand = new Command15("github").description("GitHub Integration verwalten").action(() => {
@@ -7596,18 +7637,18 @@ githubCommand.command("git-hook").description("Git Hooks f\xFCr Branch-Session I
7596
7637
  const hooksDir = path5.join(gitDir, "hooks");
7597
7638
  const hookFile = path5.join(hooksDir, "post-checkout");
7598
7639
  if (options.uninstall) {
7599
- if (fs5.existsSync(hookFile)) {
7600
- const content = fs5.readFileSync(hookFile, "utf-8");
7640
+ if (fs6.existsSync(hookFile)) {
7641
+ const content = fs6.readFileSync(hookFile, "utf-8");
7601
7642
  if (content.includes("shiva hook branch-switch")) {
7602
7643
  const lines = content.split("\n");
7603
7644
  const filtered = lines.filter(
7604
7645
  (line) => !line.includes("shiva hook branch-switch") && !line.includes("# SHIVA Code")
7605
7646
  );
7606
7647
  if (filtered.filter((l) => l.trim() && !l.startsWith("#!")).length === 0) {
7607
- fs5.unlinkSync(hookFile);
7648
+ fs6.unlinkSync(hookFile);
7608
7649
  log.success("Git Hook entfernt");
7609
7650
  } else {
7610
- fs5.writeFileSync(hookFile, filtered.join("\n"), "utf-8");
7651
+ fs6.writeFileSync(hookFile, filtered.join("\n"), "utf-8");
7611
7652
  log.success("SHIVA aus Git Hook entfernt");
7612
7653
  }
7613
7654
  } else {
@@ -7622,12 +7663,12 @@ githubCommand.command("git-hook").description("Git Hooks f\xFCr Branch-Session I
7622
7663
  console.log(colors.orange.bold("SHIVA Code - Git Hook installieren"));
7623
7664
  console.log(colors.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
7624
7665
  log.newline();
7625
- if (!fs5.existsSync(hooksDir)) {
7626
- fs5.mkdirSync(hooksDir, { recursive: true });
7666
+ if (!fs6.existsSync(hooksDir)) {
7667
+ fs6.mkdirSync(hooksDir, { recursive: true });
7627
7668
  }
7628
7669
  let existingContent = "";
7629
- if (fs5.existsSync(hookFile)) {
7630
- existingContent = fs5.readFileSync(hookFile, "utf-8");
7670
+ if (fs6.existsSync(hookFile)) {
7671
+ existingContent = fs6.readFileSync(hookFile, "utf-8");
7631
7672
  if (existingContent.includes("shiva hook branch-switch")) {
7632
7673
  log.warn("SHIVA Hook ist bereits installiert");
7633
7674
  log.info("Zum Entfernen: shiva github git-hook --uninstall");
@@ -7639,15 +7680,15 @@ githubCommand.command("git-hook").description("Git Hooks f\xFCr Branch-Session I
7639
7680
  shiva hook branch-switch "$1" "$2" --quiet 2>/dev/null || true
7640
7681
  `;
7641
7682
  if (existingContent) {
7642
- fs5.writeFileSync(hookFile, existingContent + shivaHookCode, "utf-8");
7683
+ fs6.writeFileSync(hookFile, existingContent + shivaHookCode, "utf-8");
7643
7684
  log.success("SHIVA zu bestehendem Hook hinzugef\xFCgt");
7644
7685
  } else {
7645
7686
  const newHook = `#!/bin/bash
7646
7687
  ${shivaHookCode}`;
7647
- fs5.writeFileSync(hookFile, newHook, "utf-8");
7688
+ fs6.writeFileSync(hookFile, newHook, "utf-8");
7648
7689
  log.success("Git Hook erstellt");
7649
7690
  }
7650
- fs5.chmodSync(hookFile, "755");
7691
+ fs6.chmodSync(hookFile, "755");
7651
7692
  log.newline();
7652
7693
  log.info("Der Hook zeigt beim Branch-Wechsel an, ob eine Session existiert.");
7653
7694
  log.newline();
@@ -10159,7 +10200,7 @@ securityCommand.addCommand(devicesCommand);
10159
10200
  import { Command as Command20 } from "commander";
10160
10201
  import inquirer8 from "inquirer";
10161
10202
  import ora15 from "ora";
10162
- import * as fs6 from "fs";
10203
+ import * as fs7 from "fs";
10163
10204
  import * as path6 from "path";
10164
10205
  var SECURE_FILE_MODE = 384;
10165
10206
  var secretsCommand = new Command20("secrets").description(t("commands.secrets.description")).addHelpText("after", `
@@ -10409,7 +10450,7 @@ secretsCommand.command("env").description("Secrets als .env Format ausgeben").op
10409
10450
  spinner.stop();
10410
10451
  const envContent = Object.entries(secrets).map(([key, value]) => `${key}="${value}"`).join("\n");
10411
10452
  if (options.output) {
10412
- fs6.writeFileSync(options.output, envContent + "\n", { mode: SECURE_FILE_MODE });
10453
+ fs7.writeFileSync(options.output, envContent + "\n", { mode: SECURE_FILE_MODE });
10413
10454
  log.success(`Secrets in ${options.output} geschrieben`);
10414
10455
  log.warn("Diese Datei enth\xE4lt sensible Daten!");
10415
10456
  log.dim(`Datei-Berechtigungen auf ${SECURE_FILE_MODE.toString(8)} gesetzt`);
@@ -10430,11 +10471,11 @@ secretsCommand.command("import").description(".env Datei in Vault importieren").
10430
10471
  return;
10431
10472
  }
10432
10473
  const filePath = path6.resolve(file);
10433
- if (!fs6.existsSync(filePath)) {
10474
+ if (!fs7.existsSync(filePath)) {
10434
10475
  log.errorWithSuggestion(Errors.FILE_NOT_FOUND(file));
10435
10476
  return;
10436
10477
  }
10437
- const content = fs6.readFileSync(filePath, "utf-8");
10478
+ const content = fs7.readFileSync(filePath, "utf-8");
10438
10479
  const lines = content.split("\n");
10439
10480
  const secrets = [];
10440
10481
  for (const line of lines) {
@@ -10539,7 +10580,7 @@ secretsCommand.command("export").description("Secrets exportieren").option("-p,
10539
10580
  }).join("\n");
10540
10581
  }
10541
10582
  if (options.output) {
10542
- fs6.writeFileSync(options.output, output + "\n", { mode: SECURE_FILE_MODE });
10583
+ fs7.writeFileSync(options.output, output + "\n", { mode: SECURE_FILE_MODE });
10543
10584
  log.success(`Secrets in ${options.output} geschrieben`);
10544
10585
  log.warn("Diese Datei enth\xE4lt sensible Daten!");
10545
10586
  log.dim(`Datei-Berechtigungen auf ${SECURE_FILE_MODE.toString(8)} gesetzt`);
@@ -10734,19 +10775,19 @@ import { Command as Command22 } from "commander";
10734
10775
  import ora16 from "ora";
10735
10776
 
10736
10777
  // src/services/data/memory.ts
10737
- import * as fs7 from "fs";
10778
+ import * as fs8 from "fs";
10738
10779
  import * as path7 from "path";
10739
10780
  import * as os4 from "os";
10740
10781
  function findAllClaudeMdFiles() {
10741
10782
  const results = [];
10742
10783
  const sessionsPath = path7.join(os4.homedir(), ".claude", "projects");
10743
- if (fs7.existsSync(sessionsPath)) {
10744
- const dirs = fs7.readdirSync(sessionsPath);
10784
+ if (fs8.existsSync(sessionsPath)) {
10785
+ const dirs = fs8.readdirSync(sessionsPath);
10745
10786
  for (const dir of dirs) {
10746
10787
  const projectPath = decodeProjectPath(dir);
10747
- if (projectPath && fs7.existsSync(projectPath)) {
10788
+ if (projectPath && fs8.existsSync(projectPath)) {
10748
10789
  const claudeMdPath = path7.join(projectPath, "CLAUDE.md");
10749
- if (fs7.existsSync(claudeMdPath)) {
10790
+ if (fs8.existsSync(claudeMdPath)) {
10750
10791
  results.push({
10751
10792
  path: claudeMdPath,
10752
10793
  projectPath,
@@ -10768,7 +10809,7 @@ function decodeProjectPath(encoded) {
10768
10809
  while (i < parts.length) {
10769
10810
  const part = parts[i];
10770
10811
  const testPath = currentPath + "/" + part;
10771
- if (fs7.existsSync(testPath)) {
10812
+ if (fs8.existsSync(testPath)) {
10772
10813
  currentPath = testPath;
10773
10814
  i++;
10774
10815
  } else {
@@ -10776,21 +10817,21 @@ function decodeProjectPath(encoded) {
10776
10817
  for (let j = i + 1; j < parts.length && j <= i + 5 && !found; j++) {
10777
10818
  const partsToJoin = parts.slice(i, j + 1);
10778
10819
  const hyphenPath = currentPath + "/" + partsToJoin.join("-");
10779
- if (fs7.existsSync(hyphenPath)) {
10820
+ if (fs8.existsSync(hyphenPath)) {
10780
10821
  currentPath = hyphenPath;
10781
10822
  i = j + 1;
10782
10823
  found = true;
10783
10824
  break;
10784
10825
  }
10785
10826
  const dotPath = currentPath + "/" + partsToJoin.join(".");
10786
- if (fs7.existsSync(dotPath)) {
10827
+ if (fs8.existsSync(dotPath)) {
10787
10828
  currentPath = dotPath;
10788
10829
  i = j + 1;
10789
10830
  found = true;
10790
10831
  break;
10791
10832
  }
10792
10833
  const underscorePath = currentPath + "/" + partsToJoin.join("_");
10793
- if (fs7.existsSync(underscorePath)) {
10834
+ if (fs8.existsSync(underscorePath)) {
10794
10835
  currentPath = underscorePath;
10795
10836
  i = j + 1;
10796
10837
  found = true;
@@ -10810,7 +10851,7 @@ function getLocalMemories() {
10810
10851
  const claudeFiles = findAllClaudeMdFiles();
10811
10852
  for (const file of claudeFiles) {
10812
10853
  try {
10813
- const content = fs7.readFileSync(file.path, "utf-8");
10854
+ const content = fs8.readFileSync(file.path, "utf-8");
10814
10855
  const parsed = parseClaudeMd(content);
10815
10856
  for (const memory of parsed.memories) {
10816
10857
  memories.push({
@@ -10937,15 +10978,15 @@ async function searchMemories(query, options = {}) {
10937
10978
  }
10938
10979
  function deleteLocalMemory(projectPath, key) {
10939
10980
  const claudeMdPath = path7.join(projectPath, "CLAUDE.md");
10940
- if (!fs7.existsSync(claudeMdPath)) {
10981
+ if (!fs8.existsSync(claudeMdPath)) {
10941
10982
  return false;
10942
10983
  }
10943
10984
  try {
10944
- let content = fs7.readFileSync(claudeMdPath, "utf-8");
10985
+ let content = fs8.readFileSync(claudeMdPath, "utf-8");
10945
10986
  const regex = new RegExp(`^- \\*\\*${escapeRegex(key)}\\*\\* \\([^)]+\\): .+$`, "gm");
10946
10987
  const newContent = content.replace(regex, "").replace(/\n\n\n+/g, "\n\n");
10947
10988
  if (newContent !== content) {
10948
- fs7.writeFileSync(claudeMdPath, newContent);
10989
+ fs8.writeFileSync(claudeMdPath, newContent);
10949
10990
  return true;
10950
10991
  }
10951
10992
  return false;
@@ -10987,14 +11028,14 @@ async function deleteMemory(projectPath, key, options = {}) {
10987
11028
  async function deleteAllProjectMemories(projectPath) {
10988
11029
  const result = { local: 0, cloud: 0 };
10989
11030
  const claudeMdPath = path7.join(projectPath, "CLAUDE.md");
10990
- if (fs7.existsSync(claudeMdPath)) {
11031
+ if (fs8.existsSync(claudeMdPath)) {
10991
11032
  try {
10992
- let content = fs7.readFileSync(claudeMdPath, "utf-8");
11033
+ let content = fs8.readFileSync(claudeMdPath, "utf-8");
10993
11034
  const parsed = parseClaudeMd(content);
10994
11035
  result.local = parsed.memories.length;
10995
11036
  const regex = /^- \*\*.+\*\* \([^)]+\): .+$/gm;
10996
11037
  const newContent = content.replace(regex, "").replace(/\n\n\n+/g, "\n\n");
10997
- fs7.writeFileSync(claudeMdPath, newContent);
11038
+ fs8.writeFileSync(claudeMdPath, newContent);
10998
11039
  } catch {
10999
11040
  }
11000
11041
  }
@@ -11026,8 +11067,8 @@ async function getContextPreview(projectPath) {
11026
11067
  secrets: [],
11027
11068
  totalSize: 0
11028
11069
  };
11029
- if (fs7.existsSync(claudeMdPath)) {
11030
- const content = fs7.readFileSync(claudeMdPath, "utf-8");
11070
+ if (fs8.existsSync(claudeMdPath)) {
11071
+ const content = fs8.readFileSync(claudeMdPath, "utf-8");
11031
11072
  preview.claudeMdContent = content;
11032
11073
  preview.totalSize += content.length;
11033
11074
  const parsed = parseClaudeMd(content);
@@ -11040,8 +11081,8 @@ async function getContextPreview(projectPath) {
11040
11081
  }
11041
11082
  const shivaDir = path7.join(projectPath, ".shiva");
11042
11083
  const contextPath = path7.join(shivaDir, "github-context.md");
11043
- if (fs7.existsSync(contextPath)) {
11044
- const content = fs7.readFileSync(contextPath, "utf-8");
11084
+ if (fs8.existsSync(contextPath)) {
11085
+ const content = fs8.readFileSync(contextPath, "utf-8");
11045
11086
  preview.githubContext = content;
11046
11087
  preview.totalSize += content.length;
11047
11088
  }
@@ -11387,12 +11428,12 @@ function truncate(str, maxLen) {
11387
11428
  // src/commands/memory/context.ts
11388
11429
  import { Command as Command24 } from "commander";
11389
11430
  import * as path9 from "path";
11390
- import * as fs8 from "fs";
11431
+ import * as fs9 from "fs";
11391
11432
  import ora18 from "ora";
11392
11433
  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) => {
11393
11434
  const projectPath = options.dir ? path9.resolve(options.dir) : process.cwd();
11394
11435
  const projectName = path9.basename(projectPath);
11395
- if (!fs8.existsSync(projectPath)) {
11436
+ if (!fs9.existsSync(projectPath)) {
11396
11437
  log.error(`Verzeichnis nicht gefunden: ${projectPath}`);
11397
11438
  return;
11398
11439
  }
@@ -11811,12 +11852,12 @@ tagsCommand.command("cloud").description("Memory-Tags aus Cloud laden").option("
11811
11852
  // src/commands/memory/export.ts
11812
11853
  import { Command as Command26 } from "commander";
11813
11854
  import * as path11 from "path";
11814
- import * as fs10 from "fs";
11855
+ import * as fs11 from "fs";
11815
11856
  import ora19 from "ora";
11816
11857
  import inquirer12 from "inquirer";
11817
11858
 
11818
11859
  // src/services/session/export.ts
11819
- import * as fs9 from "fs";
11860
+ import * as fs10 from "fs";
11820
11861
  import * as path10 from "path";
11821
11862
  async function exportSession(sessionId, options = {}) {
11822
11863
  const projects = await getAllClaudeProjects();
@@ -11837,8 +11878,8 @@ async function exportSession(sessionId, options = {}) {
11837
11878
  encodeProjectPath(project.absolutePath),
11838
11879
  session.sessionId + ".jsonl"
11839
11880
  );
11840
- if (fs9.existsSync(transcriptPath)) {
11841
- exported.transcript = fs9.readFileSync(transcriptPath, "utf-8");
11881
+ if (fs10.existsSync(transcriptPath)) {
11882
+ exported.transcript = fs10.readFileSync(transcriptPath, "utf-8");
11842
11883
  }
11843
11884
  }
11844
11885
  if (options.includeConversation && options.includeTranscript) {
@@ -11847,8 +11888,8 @@ async function exportSession(sessionId, options = {}) {
11847
11888
  encodeProjectPath(project.absolutePath),
11848
11889
  session.sessionId + ".jsonl"
11849
11890
  );
11850
- if (fs9.existsSync(transcriptPath)) {
11851
- const content = fs9.readFileSync(transcriptPath, "utf-8");
11891
+ if (fs10.existsSync(transcriptPath)) {
11892
+ const content = fs10.readFileSync(transcriptPath, "utf-8");
11852
11893
  const lines = content.split("\n").filter((l) => l.trim());
11853
11894
  exported.conversation = lines.map((line) => {
11854
11895
  try {
@@ -11870,12 +11911,12 @@ async function exportSessionToFile(sessionId, outputPath, options = {}) {
11870
11911
  return false;
11871
11912
  }
11872
11913
  const content = JSON.stringify(exported, null, 2);
11873
- fs9.writeFileSync(outputPath, content, "utf-8");
11914
+ fs10.writeFileSync(outputPath, content, "utf-8");
11874
11915
  return true;
11875
11916
  }
11876
11917
  async function exportSessions(sessionIds, outputDir, options = {}) {
11877
- if (!fs9.existsSync(outputDir)) {
11878
- fs9.mkdirSync(outputDir, { recursive: true });
11918
+ if (!fs10.existsSync(outputDir)) {
11919
+ fs10.mkdirSync(outputDir, { recursive: true });
11879
11920
  }
11880
11921
  let success = 0;
11881
11922
  let failed = 0;
@@ -11884,7 +11925,7 @@ async function exportSessions(sessionIds, outputDir, options = {}) {
11884
11925
  if (exported) {
11885
11926
  const filename = `${exported.projectName}-${sessionId.slice(0, 8)}.json`;
11886
11927
  const filepath = path10.join(outputDir, filename);
11887
- fs9.writeFileSync(filepath, JSON.stringify(exported, null, 2));
11928
+ fs10.writeFileSync(filepath, JSON.stringify(exported, null, 2));
11888
11929
  success++;
11889
11930
  } else {
11890
11931
  failed++;
@@ -11905,7 +11946,7 @@ async function exportProjectSessions(projectPath, outputDir, options = {}) {
11905
11946
  }
11906
11947
  function createBackupArchive(outputPath, projectPaths) {
11907
11948
  const claudeDir = getClaudeProjectsPath();
11908
- if (!fs9.existsSync(claudeDir)) {
11949
+ if (!fs10.existsSync(claudeDir)) {
11909
11950
  return false;
11910
11951
  }
11911
11952
  try {
@@ -11914,14 +11955,14 @@ function createBackupArchive(outputPath, projectPaths) {
11914
11955
  for (const p of projectPaths) {
11915
11956
  const encoded = encodeProjectPath(p);
11916
11957
  const fullPath = path10.join(claudeDir, encoded);
11917
- if (fs9.existsSync(fullPath)) {
11958
+ if (fs10.existsSync(fullPath)) {
11918
11959
  includePaths.push(encoded);
11919
11960
  }
11920
11961
  }
11921
11962
  } else {
11922
- const entries = fs9.readdirSync(claudeDir);
11963
+ const entries = fs10.readdirSync(claudeDir);
11923
11964
  includePaths = entries.filter((e) => {
11924
- const stat = fs9.statSync(path10.join(claudeDir, e));
11965
+ const stat = fs10.statSync(path10.join(claudeDir, e));
11925
11966
  return stat.isDirectory();
11926
11967
  });
11927
11968
  }
@@ -11940,28 +11981,28 @@ async function importSession(data, targetProjectPath) {
11940
11981
  const projectPath = targetProjectPath || data.projectPath;
11941
11982
  const encodedPath = encodeProjectPath(projectPath);
11942
11983
  const sessionDir = path10.join(getClaudeProjectsPath(), encodedPath);
11943
- if (!fs9.existsSync(sessionDir)) {
11944
- fs9.mkdirSync(sessionDir, { recursive: true });
11984
+ if (!fs10.existsSync(sessionDir)) {
11985
+ fs10.mkdirSync(sessionDir, { recursive: true });
11945
11986
  }
11946
11987
  const sessionFile = path10.join(sessionDir, data.session.sessionId + ".jsonl");
11947
- if (fs9.existsSync(sessionFile)) {
11988
+ if (fs10.existsSync(sessionFile)) {
11948
11989
  return {
11949
11990
  success: false,
11950
11991
  message: "Session already exists"
11951
11992
  };
11952
11993
  }
11953
11994
  if (data.transcript) {
11954
- fs9.writeFileSync(sessionFile, data.transcript, "utf-8");
11995
+ fs10.writeFileSync(sessionFile, data.transcript, "utf-8");
11955
11996
  } else if (data.conversation) {
11956
11997
  const transcript = data.conversation.map((entry) => JSON.stringify(entry)).join("\n");
11957
- fs9.writeFileSync(sessionFile, transcript, "utf-8");
11998
+ fs10.writeFileSync(sessionFile, transcript, "utf-8");
11958
11999
  } else {
11959
12000
  const minimalEntry = {
11960
12001
  type: "imported",
11961
12002
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11962
12003
  originalSession: data.session
11963
12004
  };
11964
- fs9.writeFileSync(sessionFile, JSON.stringify(minimalEntry) + "\n");
12005
+ fs10.writeFileSync(sessionFile, JSON.stringify(minimalEntry) + "\n");
11965
12006
  }
11966
12007
  if (data.tags && data.tags.length > 0) {
11967
12008
  const { addTagToSession: addTagToSession2 } = await import("./tags.js");
@@ -11984,13 +12025,13 @@ async function importSession(data, targetProjectPath) {
11984
12025
  }
11985
12026
  async function importSessionFromFile(filepath, targetProjectPath) {
11986
12027
  try {
11987
- if (!fs9.existsSync(filepath)) {
12028
+ if (!fs10.existsSync(filepath)) {
11988
12029
  return {
11989
12030
  success: false,
11990
12031
  message: `File not found: ${filepath}`
11991
12032
  };
11992
12033
  }
11993
- const content = fs9.readFileSync(filepath, "utf-8");
12034
+ const content = fs10.readFileSync(filepath, "utf-8");
11994
12035
  const data = JSON.parse(content);
11995
12036
  if (!data.version || !data.session || !data.session.sessionId) {
11996
12037
  return {
@@ -12007,10 +12048,10 @@ async function importSessionFromFile(filepath, targetProjectPath) {
12007
12048
  }
12008
12049
  }
12009
12050
  async function importSessionsFromDirectory(dirPath, targetProjectPath) {
12010
- if (!fs9.existsSync(dirPath)) {
12051
+ if (!fs10.existsSync(dirPath)) {
12011
12052
  return { success: 0, failed: 0, results: [] };
12012
12053
  }
12013
- const files = fs9.readdirSync(dirPath).filter((f) => f.endsWith(".json"));
12054
+ const files = fs10.readdirSync(dirPath).filter((f) => f.endsWith(".json"));
12014
12055
  const results = [];
12015
12056
  let success = 0;
12016
12057
  let failed = 0;
@@ -12027,13 +12068,13 @@ async function importSessionsFromDirectory(dirPath, targetProjectPath) {
12027
12068
  return { success, failed, results };
12028
12069
  }
12029
12070
  function restoreFromArchive(archivePath, targetDir) {
12030
- if (!fs9.existsSync(archivePath)) {
12071
+ if (!fs10.existsSync(archivePath)) {
12031
12072
  return false;
12032
12073
  }
12033
12074
  try {
12034
12075
  const extractTo = targetDir || getClaudeProjectsPath();
12035
- if (!fs9.existsSync(extractTo)) {
12036
- fs9.mkdirSync(extractTo, { recursive: true });
12076
+ if (!fs10.existsSync(extractTo)) {
12077
+ fs10.mkdirSync(extractTo, { recursive: true });
12037
12078
  }
12038
12079
  const extractResult = tarExec(["-xzf", archivePath, "-C", extractTo]);
12039
12080
  if (!extractResult.success) {
@@ -12046,10 +12087,10 @@ function restoreFromArchive(archivePath, targetDir) {
12046
12087
  }
12047
12088
  function previewExportFile(filepath) {
12048
12089
  try {
12049
- if (!fs9.existsSync(filepath)) {
12090
+ if (!fs10.existsSync(filepath)) {
12050
12091
  return null;
12051
12092
  }
12052
- const content = fs9.readFileSync(filepath, "utf-8");
12093
+ const content = fs10.readFileSync(filepath, "utf-8");
12053
12094
  const data = JSON.parse(content);
12054
12095
  return {
12055
12096
  ...data,
@@ -12095,7 +12136,7 @@ var importCommand = new Command26("import").description("Sessions importieren").
12095
12136
  console.log(colors.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
12096
12137
  log.newline();
12097
12138
  const absolutePath = path11.resolve(inputPath);
12098
- if (!fs10.existsSync(absolutePath)) {
12139
+ if (!fs11.existsSync(absolutePath)) {
12099
12140
  log.error(`Datei nicht gefunden: ${absolutePath}`);
12100
12141
  return;
12101
12142
  }
@@ -12107,7 +12148,7 @@ var importCommand = new Command26("import").description("Sessions importieren").
12107
12148
  await handlePreview(absolutePath);
12108
12149
  return;
12109
12150
  }
12110
- const stat = fs10.statSync(absolutePath);
12151
+ const stat = fs11.statSync(absolutePath);
12111
12152
  if (stat.isDirectory()) {
12112
12153
  await handleImportDirectory(absolutePath, options.project);
12113
12154
  } else {
@@ -12121,7 +12162,7 @@ async function handleBackup(outputPath) {
12121
12162
  const success = createBackupArchive(output);
12122
12163
  if (success) {
12123
12164
  spinner.succeed(`Backup erstellt: ${output}`);
12124
- const stat = fs10.statSync(output);
12165
+ const stat = fs11.statSync(output);
12125
12166
  log.dim(`Gr\xF6\xDFe: ${(stat.size / 1024 / 1024).toFixed(2)} MB`);
12126
12167
  } else {
12127
12168
  spinner.fail("Backup fehlgeschlagen");
@@ -12352,7 +12393,7 @@ ${colors.dim("Beispiele:")}
12352
12393
  // src/commands/system/doctor.ts
12353
12394
  import { Command as Command28 } from "commander";
12354
12395
  import { execSync as execSync2 } from "child_process";
12355
- import * as fs11 from "fs";
12396
+ import * as fs12 from "fs";
12356
12397
  import * as path12 from "path";
12357
12398
  import * as os5 from "os";
12358
12399
  function tryExec(command) {
@@ -12517,7 +12558,7 @@ function checkNpm() {
12517
12558
  function checkShivaConfig() {
12518
12559
  const configDir = path12.join(os5.homedir(), ".config", "shiva-code");
12519
12560
  const configFile = path12.join(configDir, "config.json");
12520
- if (!fs11.existsSync(configDir)) {
12561
+ if (!fs12.existsSync(configDir)) {
12521
12562
  return {
12522
12563
  name: "SHIVA Config",
12523
12564
  status: "warn",
@@ -12525,7 +12566,7 @@ function checkShivaConfig() {
12525
12566
  hint: "Wird bei erster Nutzung erstellt"
12526
12567
  };
12527
12568
  }
12528
- if (!fs11.existsSync(configFile)) {
12569
+ if (!fs12.existsSync(configFile)) {
12529
12570
  return {
12530
12571
  name: "SHIVA Config",
12531
12572
  status: "warn",
@@ -12541,7 +12582,7 @@ function checkShivaConfig() {
12541
12582
  }
12542
12583
  function checkClaudeProjects() {
12543
12584
  const claudeDir = path12.join(os5.homedir(), ".claude", "projects");
12544
- if (!fs11.existsSync(claudeDir)) {
12585
+ if (!fs12.existsSync(claudeDir)) {
12545
12586
  return {
12546
12587
  name: "Claude Projects",
12547
12588
  status: "warn",
@@ -12550,8 +12591,8 @@ function checkClaudeProjects() {
12550
12591
  };
12551
12592
  }
12552
12593
  try {
12553
- const projects = fs11.readdirSync(claudeDir).filter(
12554
- (f) => fs11.statSync(path12.join(claudeDir, f)).isDirectory()
12594
+ const projects = fs12.readdirSync(claudeDir).filter(
12595
+ (f) => fs12.statSync(path12.join(claudeDir, f)).isDirectory()
12555
12596
  );
12556
12597
  return {
12557
12598
  name: "Claude Projects",
@@ -12679,7 +12720,7 @@ var doctorCommand = new Command28("doctor").description("System-Check f\xFCr SHI
12679
12720
  // src/commands/system/upgrade.ts
12680
12721
  import { Command as Command29 } from "commander";
12681
12722
  import { execSync as execSync3, spawn as spawn7 } from "child_process";
12682
- import * as fs12 from "fs";
12723
+ import * as fs13 from "fs";
12683
12724
  import * as path13 from "path";
12684
12725
  import * as os6 from "os";
12685
12726
  import * as crypto from "crypto";
@@ -12693,7 +12734,7 @@ function detectInstallationType() {
12693
12734
  const execName = path13.basename(execPath).toLowerCase();
12694
12735
  if (execName === "shiva" || execName === "shiva.exe") {
12695
12736
  const possibleNodeModules = path13.resolve(path13.dirname(execPath), "../node_modules");
12696
- if (!fs12.existsSync(possibleNodeModules)) {
12737
+ if (!fs13.existsSync(possibleNodeModules)) {
12697
12738
  return "native";
12698
12739
  }
12699
12740
  }
@@ -12733,8 +12774,8 @@ function getCurrentVersion() {
12733
12774
  ];
12734
12775
  for (const pkgPath of possiblePaths) {
12735
12776
  try {
12736
- if (fs12.existsSync(pkgPath)) {
12737
- const packageJson = JSON.parse(fs12.readFileSync(pkgPath, "utf-8"));
12777
+ if (fs13.existsSync(pkgPath)) {
12778
+ const packageJson = JSON.parse(fs13.readFileSync(pkgPath, "utf-8"));
12738
12779
  if (packageJson.name === PACKAGE_NAME && packageJson.version) {
12739
12780
  return packageJson.version;
12740
12781
  }
@@ -12850,7 +12891,7 @@ async function downloadFile(url, dest) {
12850
12891
  throw new Error(`Download failed: ${response.status} ${response.statusText}`);
12851
12892
  }
12852
12893
  const buffer = await response.arrayBuffer();
12853
- fs12.writeFileSync(dest, Buffer.from(buffer));
12894
+ fs13.writeFileSync(dest, Buffer.from(buffer));
12854
12895
  }
12855
12896
  async function verifyChecksum(filePath, checksumUrl) {
12856
12897
  try {
@@ -12860,7 +12901,7 @@ async function verifyChecksum(filePath, checksumUrl) {
12860
12901
  return true;
12861
12902
  }
12862
12903
  const expectedHash = (await response.text()).trim().split(" ")[0].toLowerCase();
12863
- const fileBuffer = fs12.readFileSync(filePath);
12904
+ const fileBuffer = fs13.readFileSync(filePath);
12864
12905
  const actualHash = crypto.createHash("sha256").update(fileBuffer).digest("hex").toLowerCase();
12865
12906
  return expectedHash === actualHash;
12866
12907
  } catch {
@@ -12889,16 +12930,16 @@ async function updateNativeBinary(targetVersion) {
12889
12930
  const checksumValid = await verifyChecksum(tempBinary, checksumUrl);
12890
12931
  if (!checksumValid) {
12891
12932
  log.error("Checksum stimmt nicht \xFCberein! Update abgebrochen.");
12892
- fs12.unlinkSync(tempBinary);
12933
+ fs13.unlinkSync(tempBinary);
12893
12934
  return false;
12894
12935
  }
12895
12936
  log.success(" Checksum OK");
12896
12937
  if (platformInfo.platform !== "windows") {
12897
- fs12.chmodSync(tempBinary, 493);
12938
+ fs13.chmodSync(tempBinary, 493);
12898
12939
  }
12899
12940
  log.info("Erstelle Backup...");
12900
- if (fs12.existsSync(currentBinary)) {
12901
- fs12.copyFileSync(currentBinary, backupBinary);
12941
+ if (fs13.existsSync(currentBinary)) {
12942
+ fs13.copyFileSync(currentBinary, backupBinary);
12902
12943
  }
12903
12944
  log.info("Installiere neue Version...");
12904
12945
  if (platformInfo.platform === "windows") {
@@ -12910,30 +12951,30 @@ move /y "${tempBinary}" "${currentBinary}"
12910
12951
  del "${backupBinary}" 2>nul
12911
12952
  del "%~f0"
12912
12953
  `;
12913
- fs12.writeFileSync(updateScript, scriptContent);
12954
+ fs13.writeFileSync(updateScript, scriptContent);
12914
12955
  spawn7("cmd", ["/c", updateScript], { detached: true, stdio: "ignore" }).unref();
12915
12956
  log.success("Update wird nach Beenden angewendet");
12916
12957
  log.info("Bitte starte SHIVA neu.");
12917
12958
  } else {
12918
- fs12.renameSync(tempBinary, currentBinary);
12919
- if (fs12.existsSync(backupBinary)) {
12920
- fs12.unlinkSync(backupBinary);
12959
+ fs13.renameSync(tempBinary, currentBinary);
12960
+ if (fs13.existsSync(backupBinary)) {
12961
+ fs13.unlinkSync(backupBinary);
12921
12962
  }
12922
12963
  }
12923
12964
  return true;
12924
12965
  } catch (error) {
12925
12966
  log.error(`Update fehlgeschlagen: ${error instanceof Error ? error.message : String(error)}`);
12926
- if (fs12.existsSync(backupBinary) && fs12.existsSync(currentBinary)) {
12967
+ if (fs13.existsSync(backupBinary) && fs13.existsSync(currentBinary)) {
12927
12968
  try {
12928
- fs12.copyFileSync(backupBinary, currentBinary);
12969
+ fs13.copyFileSync(backupBinary, currentBinary);
12929
12970
  log.info("Backup wiederhergestellt");
12930
12971
  } catch {
12931
12972
  log.warn("Backup konnte nicht wiederhergestellt werden");
12932
12973
  }
12933
12974
  }
12934
- if (fs12.existsSync(tempBinary)) {
12975
+ if (fs13.existsSync(tempBinary)) {
12935
12976
  try {
12936
- fs12.unlinkSync(tempBinary);
12977
+ fs13.unlinkSync(tempBinary);
12937
12978
  } catch {
12938
12979
  }
12939
12980
  }
@@ -13355,7 +13396,7 @@ complete -F _shiva_completions shiva
13355
13396
  `;
13356
13397
  }
13357
13398
  async function installBashCompletion() {
13358
- const fs15 = await import("fs");
13399
+ const fs16 = await import("fs");
13359
13400
  const os9 = await import("os");
13360
13401
  const path15 = await import("path");
13361
13402
  const bashrcPath = path15.join(os9.homedir(), ".bashrc");
@@ -13363,15 +13404,15 @@ async function installBashCompletion() {
13363
13404
  const marker = "# SHIVA Code Bash Completion";
13364
13405
  try {
13365
13406
  let bashrc = "";
13366
- if (fs15.existsSync(bashrcPath)) {
13367
- bashrc = fs15.readFileSync(bashrcPath, "utf-8");
13407
+ if (fs16.existsSync(bashrcPath)) {
13408
+ bashrc = fs16.readFileSync(bashrcPath, "utf-8");
13368
13409
  }
13369
13410
  if (bashrc.includes(marker)) {
13370
13411
  log.warn("Bash completion bereits installiert");
13371
13412
  log.info("Manuell entfernen und neu installieren falls n\xF6tig");
13372
13413
  return;
13373
13414
  }
13374
- fs15.appendFileSync(bashrcPath, "\n" + completionScript);
13415
+ fs16.appendFileSync(bashrcPath, "\n" + completionScript);
13375
13416
  log.success("Bash completion installiert");
13376
13417
  log.info("Ausf\xFChren: source ~/.bashrc");
13377
13418
  } catch (error) {
@@ -13498,7 +13539,7 @@ compdef _shiva shiva
13498
13539
  `;
13499
13540
  }
13500
13541
  async function installZshCompletion() {
13501
- const fs15 = await import("fs");
13542
+ const fs16 = await import("fs");
13502
13543
  const os9 = await import("os");
13503
13544
  const path15 = await import("path");
13504
13545
  const zshrcPath = path15.join(os9.homedir(), ".zshrc");
@@ -13506,15 +13547,15 @@ async function installZshCompletion() {
13506
13547
  const marker = "# SHIVA Code Zsh Completion";
13507
13548
  try {
13508
13549
  let zshrc = "";
13509
- if (fs15.existsSync(zshrcPath)) {
13510
- zshrc = fs15.readFileSync(zshrcPath, "utf-8");
13550
+ if (fs16.existsSync(zshrcPath)) {
13551
+ zshrc = fs16.readFileSync(zshrcPath, "utf-8");
13511
13552
  }
13512
13553
  if (zshrc.includes(marker)) {
13513
13554
  log.warn("Zsh completion bereits installiert");
13514
13555
  log.info("Manuell entfernen und neu installieren falls n\xF6tig");
13515
13556
  return;
13516
13557
  }
13517
- fs15.appendFileSync(zshrcPath, "\n" + completionScript);
13558
+ fs16.appendFileSync(zshrcPath, "\n" + completionScript);
13518
13559
  log.success("Zsh completion installiert");
13519
13560
  log.info("Ausf\xFChren: source ~/.zshrc");
13520
13561
  } catch (error) {
@@ -13603,17 +13644,17 @@ complete -c shiva -n "__fish_seen_subcommand_from stats" -l json -d "JSON Output
13603
13644
  `;
13604
13645
  }
13605
13646
  async function installFishCompletion() {
13606
- const fs15 = await import("fs");
13647
+ const fs16 = await import("fs");
13607
13648
  const os9 = await import("os");
13608
13649
  const path15 = await import("path");
13609
13650
  const fishCompletionsDir = path15.join(os9.homedir(), ".config", "fish", "completions");
13610
13651
  const fishCompletionPath = path15.join(fishCompletionsDir, "shiva.fish");
13611
13652
  const completionScript = generateFishCompletion();
13612
13653
  try {
13613
- if (!fs15.existsSync(fishCompletionsDir)) {
13614
- fs15.mkdirSync(fishCompletionsDir, { recursive: true });
13654
+ if (!fs16.existsSync(fishCompletionsDir)) {
13655
+ fs16.mkdirSync(fishCompletionsDir, { recursive: true });
13615
13656
  }
13616
- fs15.writeFileSync(fishCompletionPath, completionScript);
13657
+ fs16.writeFileSync(fishCompletionPath, completionScript);
13617
13658
  log.success("Fish completion installiert");
13618
13659
  log.info("Wird automatisch beim n\xE4chsten Start geladen");
13619
13660
  } catch (error) {
@@ -14836,7 +14877,7 @@ accountCommand.command("delete").description(t("account.deleteDesc")).option("-f
14836
14877
 
14837
14878
  // src/commands/system/uninstall.ts
14838
14879
  import { Command as Command38 } from "commander";
14839
- import { existsSync as existsSync23, rmSync as rmSync2, readFileSync as readFileSync12, writeFileSync as writeFileSync10 } from "fs";
14880
+ import { existsSync as existsSync23, rmSync as rmSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync10 } from "fs";
14840
14881
  import { homedir as homedir8 } from "os";
14841
14882
  import { join as join14 } from "path";
14842
14883
  import inquirer15 from "inquirer";
@@ -14927,7 +14968,7 @@ var uninstallCommand = new Command38("uninstall").description(t("uninstall.descr
14927
14968
  const spinner = ora23(t("uninstall.removingConfig")).start();
14928
14969
  try {
14929
14970
  if (existsSync23(CONFIG_DIR)) {
14930
- rmSync2(CONFIG_DIR, { recursive: true, force: true });
14971
+ rmSync3(CONFIG_DIR, { recursive: true, force: true });
14931
14972
  }
14932
14973
  spinner.succeed(t("uninstall.configRemoved"));
14933
14974
  } catch (error) {
@@ -15251,7 +15292,7 @@ dockerCommand.action(() => {
15251
15292
 
15252
15293
  // src/commands/advanced/workflow.ts
15253
15294
  import { Command as Command40 } from "commander";
15254
- import * as fs13 from "fs";
15295
+ import * as fs14 from "fs";
15255
15296
  import * as path14 from "path";
15256
15297
  import * as os7 from "os";
15257
15298
  import ora25 from "ora";
@@ -15416,11 +15457,11 @@ function getWorkflowsPath() {
15416
15457
  }
15417
15458
  function loadCustomWorkflows() {
15418
15459
  const filepath = getWorkflowsPath();
15419
- if (!fs13.existsSync(filepath)) {
15460
+ if (!fs14.existsSync(filepath)) {
15420
15461
  return {};
15421
15462
  }
15422
15463
  try {
15423
- const content = fs13.readFileSync(filepath, "utf-8");
15464
+ const content = fs14.readFileSync(filepath, "utf-8");
15424
15465
  return JSON.parse(content);
15425
15466
  } catch {
15426
15467
  return {};
@@ -15429,18 +15470,18 @@ function loadCustomWorkflows() {
15429
15470
  function saveCustomWorkflow(name, workflow) {
15430
15471
  const filepath = getWorkflowsPath();
15431
15472
  const dir = path14.dirname(filepath);
15432
- if (!fs13.existsSync(dir)) {
15433
- fs13.mkdirSync(dir, { recursive: true });
15473
+ if (!fs14.existsSync(dir)) {
15474
+ fs14.mkdirSync(dir, { recursive: true });
15434
15475
  }
15435
15476
  const workflows = loadCustomWorkflows();
15436
15477
  workflows[name] = workflow;
15437
- fs13.writeFileSync(filepath, JSON.stringify(workflows, null, 2));
15478
+ fs14.writeFileSync(filepath, JSON.stringify(workflows, null, 2));
15438
15479
  }
15439
15480
  function deleteCustomWorkflow(name) {
15440
15481
  const filepath = getWorkflowsPath();
15441
15482
  const workflows = loadCustomWorkflows();
15442
15483
  delete workflows[name];
15443
- fs13.writeFileSync(filepath, JSON.stringify(workflows, null, 2));
15484
+ fs14.writeFileSync(filepath, JSON.stringify(workflows, null, 2));
15444
15485
  }
15445
15486
  async function executeStep(step) {
15446
15487
  const spinner = ora25("Ausf\xFChren...").start();
@@ -16195,7 +16236,7 @@ hookCommand.command("scan-session").description("Session nach sensiblen Tokens s
16195
16236
  const { detectTokens: detectTokens2, redactTokens, maskToken: maskToken2 } = await import("./token-detection-K6KCIWAU.js");
16196
16237
  const { api: api2 } = await import("./client-H3JXPT5B.js");
16197
16238
  const { isAuthenticated: isAuthenticated2 } = await import("./config-FGMZONWV.js");
16198
- const { existsSync: existsSync27, readFileSync: readFileSync15, writeFileSync: writeFileSync13, readdirSync: readdirSync6, statSync: statSync7 } = await import("fs");
16239
+ const { existsSync: existsSync27, readFileSync: readFileSync15, writeFileSync: writeFileSync13, readdirSync: readdirSync7, statSync: statSync8 } = await import("fs");
16199
16240
  const { join: join17 } = await import("path");
16200
16241
  const { homedir: homedir12 } = await import("os");
16201
16242
  const quiet = options.quiet;
@@ -16219,16 +16260,16 @@ hookCommand.command("scan-session").description("Session nach sensiblen Tokens s
16219
16260
  } else if (existsSync27(claudeProjectsPath)) {
16220
16261
  const oneHourAgo = Date.now() - 60 * 60 * 1e3;
16221
16262
  try {
16222
- const projects = readdirSync6(claudeProjectsPath);
16263
+ const projects = readdirSync7(claudeProjectsPath);
16223
16264
  for (const project of projects) {
16224
16265
  const projectPath = join17(claudeProjectsPath, project);
16225
- const stat = statSync7(projectPath);
16266
+ const stat = statSync8(projectPath);
16226
16267
  if (!stat.isDirectory()) continue;
16227
- const files = readdirSync6(projectPath);
16268
+ const files = readdirSync7(projectPath);
16228
16269
  for (const file of files) {
16229
16270
  if (!file.endsWith(".jsonl")) continue;
16230
16271
  const filePath = join17(projectPath, file);
16231
- const fileStat = statSync7(filePath);
16272
+ const fileStat = statSync8(filePath);
16232
16273
  if (fileStat.mtime.getTime() > oneHourAgo) {
16233
16274
  sessionFiles.push(filePath);
16234
16275
  }
@@ -16310,7 +16351,7 @@ hookCommand.command("scan-session").description("Session nach sensiblen Tokens s
16310
16351
 
16311
16352
  // src/commands/advanced/package.ts
16312
16353
  import { Command as Command42 } from "commander";
16313
- import * as fs14 from "fs";
16354
+ import * as fs15 from "fs";
16314
16355
  import inquirer17 from "inquirer";
16315
16356
  import ora26 from "ora";
16316
16357
  var packageCommand = new Command42("package").description("Projekt-Gruppen (Packages) verwalten").action(() => {
@@ -16407,7 +16448,7 @@ packageCommand.command("show <name>").description("Package-Details anzeigen").ac
16407
16448
  if (pkg.projects.length > 0) {
16408
16449
  console.log("Projekte:");
16409
16450
  for (const projectPath of pkg.projects) {
16410
- const exists = fs14.existsSync(projectPath);
16451
+ const exists = fs15.existsSync(projectPath);
16411
16452
  const icon = exists ? colors.green("\u2713") : colors.yellow("\u26A0");
16412
16453
  const name2 = getProjectName(projectPath);
16413
16454
  console.log(` ${icon} ${name2}`);
@@ -16662,7 +16703,7 @@ function listPackages() {
16662
16703
  }
16663
16704
  const displayProjects = pkg.projects.slice(0, 3);
16664
16705
  for (const projectPath of displayProjects) {
16665
- const exists = fs14.existsSync(projectPath);
16706
+ const exists = fs15.existsSync(projectPath);
16666
16707
  const icon = exists ? colors.dim("\u2514\u2500") : colors.yellow("\u2514\u2500");
16667
16708
  console.log(` ${icon} ${getProjectName(projectPath)}`);
16668
16709
  }
@@ -17299,8 +17340,7 @@ async function showDashboard() {
17299
17340
  newSession: false
17300
17341
  }], detectTerminal());
17301
17342
  if (isInsideTmux()) {
17302
- await new Promise((resolve14) => setTimeout(resolve14, 100));
17303
- return;
17343
+ await showDashboard();
17304
17344
  }
17305
17345
  }
17306
17346
  break;
@@ -17314,8 +17354,7 @@ async function showDashboard() {
17314
17354
  if (launches.length > 0) {
17315
17355
  await spawnProjects(launches, detectTerminal());
17316
17356
  if (isInsideTmux()) {
17317
- await new Promise((resolve14) => setTimeout(resolve14, 100));
17318
- return;
17357
+ await showDashboard();
17319
17358
  }
17320
17359
  }
17321
17360
  break;