shiva-code 0.7.0 → 0.7.1
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 +248 -71
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -219,27 +219,27 @@ function generateBackupCodes(count = 10) {
|
|
|
219
219
|
return codes;
|
|
220
220
|
}
|
|
221
221
|
function generateDeviceFingerprint() {
|
|
222
|
-
const
|
|
222
|
+
const os8 = __require("os");
|
|
223
223
|
const components = [
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
224
|
+
os8.hostname(),
|
|
225
|
+
os8.platform(),
|
|
226
|
+
os8.arch(),
|
|
227
|
+
os8.cpus()[0]?.model || "unknown",
|
|
228
|
+
os8.userInfo().username
|
|
229
229
|
];
|
|
230
230
|
const fingerprint = crypto.createHash("sha256").update(components.join("|")).digest("hex").slice(0, 32);
|
|
231
231
|
return fingerprint;
|
|
232
232
|
}
|
|
233
233
|
function getDeviceName() {
|
|
234
|
-
const
|
|
235
|
-
const hostname =
|
|
236
|
-
const
|
|
234
|
+
const os8 = __require("os");
|
|
235
|
+
const hostname = os8.hostname();
|
|
236
|
+
const platform2 = os8.platform();
|
|
237
237
|
const platformNames = {
|
|
238
238
|
darwin: "macOS",
|
|
239
239
|
linux: "Linux",
|
|
240
240
|
win32: "Windows"
|
|
241
241
|
};
|
|
242
|
-
return `${hostname} (${platformNames[
|
|
242
|
+
return `${hostname} (${platformNames[platform2] || platform2})`;
|
|
243
243
|
}
|
|
244
244
|
var TwoFactorService = class {
|
|
245
245
|
/**
|
|
@@ -7214,7 +7214,7 @@ sessionsCommand.command("resume <sessionId>").description("Cloud-Session fortset
|
|
|
7214
7214
|
sessionsCommand.command("export <sessionId>").description("Cloud-Session exportieren").option("-o, --output <file>", "Ausgabedatei").action(async (sessionId, options) => {
|
|
7215
7215
|
const { api: api2 } = await import("./client-GIGZFXT5.js");
|
|
7216
7216
|
const { isAuthenticated: isAuthenticated2 } = await import("./config-FGMZONWV.js");
|
|
7217
|
-
const { writeFileSync:
|
|
7217
|
+
const { writeFileSync: writeFileSync12 } = await import("fs");
|
|
7218
7218
|
if (!isAuthenticated2()) {
|
|
7219
7219
|
log.error("Nicht angemeldet");
|
|
7220
7220
|
log.info("Anmelden mit: shiva login");
|
|
@@ -7225,7 +7225,7 @@ sessionsCommand.command("export <sessionId>").description("Cloud-Session exporti
|
|
|
7225
7225
|
const exportData = await api2.exportSession(sessionId);
|
|
7226
7226
|
spinner.stop();
|
|
7227
7227
|
if (options.output) {
|
|
7228
|
-
|
|
7228
|
+
writeFileSync12(options.output, JSON.stringify(exportData, null, 2));
|
|
7229
7229
|
log.success(`Session exportiert: ${options.output}`);
|
|
7230
7230
|
} else {
|
|
7231
7231
|
console.log(JSON.stringify(exportData, null, 2));
|
|
@@ -12979,10 +12979,39 @@ import { Command as Command29 } from "commander";
|
|
|
12979
12979
|
import { execSync as execSync4, spawn as spawn6 } from "child_process";
|
|
12980
12980
|
import * as fs12 from "fs";
|
|
12981
12981
|
import * as path13 from "path";
|
|
12982
|
+
import * as os6 from "os";
|
|
12983
|
+
import * as crypto3 from "crypto";
|
|
12982
12984
|
import { fileURLToPath } from "url";
|
|
12983
12985
|
var __filename = fileURLToPath(import.meta.url);
|
|
12984
12986
|
var __dirname = path13.dirname(__filename);
|
|
12985
12987
|
var PACKAGE_NAME = "shiva-code";
|
|
12988
|
+
var GITHUB_REPO = "Aimtaim/shiva-code";
|
|
12989
|
+
function detectInstallationType() {
|
|
12990
|
+
const execPath = process.execPath;
|
|
12991
|
+
const execName = path13.basename(execPath).toLowerCase();
|
|
12992
|
+
if (execName === "shiva" || execName === "shiva.exe") {
|
|
12993
|
+
const possibleNodeModules = path13.resolve(path13.dirname(execPath), "../node_modules");
|
|
12994
|
+
if (!fs12.existsSync(possibleNodeModules)) {
|
|
12995
|
+
return "native";
|
|
12996
|
+
}
|
|
12997
|
+
}
|
|
12998
|
+
try {
|
|
12999
|
+
const npmGlobal = execSync4("npm list -g --depth=0 2>/dev/null", { encoding: "utf-8" });
|
|
13000
|
+
if (npmGlobal.includes(PACKAGE_NAME)) return "npm";
|
|
13001
|
+
} catch {
|
|
13002
|
+
}
|
|
13003
|
+
try {
|
|
13004
|
+
const yarnGlobal = execSync4("yarn global list 2>/dev/null", { encoding: "utf-8" });
|
|
13005
|
+
if (yarnGlobal.includes(PACKAGE_NAME)) return "yarn";
|
|
13006
|
+
} catch {
|
|
13007
|
+
}
|
|
13008
|
+
try {
|
|
13009
|
+
const pnpmGlobal = execSync4("pnpm list -g 2>/dev/null", { encoding: "utf-8" });
|
|
13010
|
+
if (pnpmGlobal.includes(PACKAGE_NAME)) return "pnpm";
|
|
13011
|
+
} catch {
|
|
13012
|
+
}
|
|
13013
|
+
return "npm";
|
|
13014
|
+
}
|
|
12986
13015
|
function getCurrentVersion() {
|
|
12987
13016
|
try {
|
|
12988
13017
|
const packageJsonPath = path13.resolve(__dirname, "../../package.json");
|
|
@@ -12992,23 +13021,32 @@ function getCurrentVersion() {
|
|
|
12992
13021
|
}
|
|
12993
13022
|
} catch {
|
|
12994
13023
|
}
|
|
12995
|
-
|
|
13024
|
+
try {
|
|
13025
|
+
const output = execSync4(`"${process.execPath}" --version 2>/dev/null`, { encoding: "utf-8" }).trim();
|
|
13026
|
+
return output || "0.0.0";
|
|
13027
|
+
} catch {
|
|
13028
|
+
return "0.7.0";
|
|
13029
|
+
}
|
|
12996
13030
|
}
|
|
12997
|
-
async function
|
|
13031
|
+
async function getLatestNpmVersion() {
|
|
12998
13032
|
try {
|
|
12999
13033
|
const response = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}`);
|
|
13000
13034
|
if (!response.ok) return null;
|
|
13001
13035
|
const data = await response.json();
|
|
13002
13036
|
return data["dist-tags"]?.latest || null;
|
|
13003
13037
|
} catch {
|
|
13004
|
-
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13038
|
+
return null;
|
|
13039
|
+
}
|
|
13040
|
+
}
|
|
13041
|
+
async function getLatestGitHubVersion() {
|
|
13042
|
+
try {
|
|
13043
|
+
const response = await fetch(`https://api.github.com/repos/${GITHUB_REPO}/releases/latest`);
|
|
13044
|
+
if (!response.ok) return null;
|
|
13045
|
+
const release2 = await response.json();
|
|
13046
|
+
const version = release2.tag_name.replace(/^v/, "");
|
|
13047
|
+
return { version, release: release2 };
|
|
13048
|
+
} catch {
|
|
13049
|
+
return null;
|
|
13012
13050
|
}
|
|
13013
13051
|
}
|
|
13014
13052
|
function compareVersions(current, latest) {
|
|
@@ -13022,32 +13060,155 @@ function compareVersions(current, latest) {
|
|
|
13022
13060
|
}
|
|
13023
13061
|
return 0;
|
|
13024
13062
|
}
|
|
13025
|
-
async function checkForUpdates() {
|
|
13063
|
+
async function checkForUpdates(installType) {
|
|
13026
13064
|
const current = getCurrentVersion();
|
|
13027
|
-
|
|
13028
|
-
|
|
13029
|
-
|
|
13030
|
-
|
|
13031
|
-
|
|
13032
|
-
|
|
13065
|
+
if (installType === "native") {
|
|
13066
|
+
const github = await getLatestGitHubVersion();
|
|
13067
|
+
return {
|
|
13068
|
+
current,
|
|
13069
|
+
latest: github?.version || current,
|
|
13070
|
+
isOutdated: github ? compareVersions(current, github.version) < 0 : false,
|
|
13071
|
+
source: "github"
|
|
13072
|
+
};
|
|
13073
|
+
} else {
|
|
13074
|
+
const latest = await getLatestNpmVersion();
|
|
13075
|
+
return {
|
|
13076
|
+
current,
|
|
13077
|
+
latest: latest || current,
|
|
13078
|
+
isOutdated: latest ? compareVersions(current, latest) < 0 : false,
|
|
13079
|
+
source: "npm"
|
|
13080
|
+
};
|
|
13081
|
+
}
|
|
13033
13082
|
}
|
|
13034
|
-
function
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13038
|
-
|
|
13083
|
+
function getPlatformIdentifier() {
|
|
13084
|
+
const platform2 = os6.platform();
|
|
13085
|
+
const arch3 = os6.arch();
|
|
13086
|
+
let platformStr;
|
|
13087
|
+
let archStr;
|
|
13088
|
+
switch (platform2) {
|
|
13089
|
+
case "linux":
|
|
13090
|
+
platformStr = "linux";
|
|
13091
|
+
break;
|
|
13092
|
+
case "darwin":
|
|
13093
|
+
platformStr = "darwin";
|
|
13094
|
+
break;
|
|
13095
|
+
case "win32":
|
|
13096
|
+
platformStr = "windows";
|
|
13097
|
+
break;
|
|
13098
|
+
default:
|
|
13099
|
+
return null;
|
|
13100
|
+
}
|
|
13101
|
+
switch (arch3) {
|
|
13102
|
+
case "x64":
|
|
13103
|
+
case "amd64":
|
|
13104
|
+
archStr = "x64";
|
|
13105
|
+
break;
|
|
13106
|
+
case "arm64":
|
|
13107
|
+
case "aarch64":
|
|
13108
|
+
archStr = "arm64";
|
|
13109
|
+
break;
|
|
13110
|
+
default:
|
|
13111
|
+
return null;
|
|
13039
13112
|
}
|
|
13113
|
+
const ext = platform2 === "win32" ? ".exe" : "";
|
|
13114
|
+
const binaryName = `shiva-${platformStr}-${archStr}${ext}`;
|
|
13115
|
+
return { platform: platformStr, arch: archStr, binaryName };
|
|
13116
|
+
}
|
|
13117
|
+
async function downloadFile(url, dest) {
|
|
13118
|
+
const response = await fetch(url);
|
|
13119
|
+
if (!response.ok) {
|
|
13120
|
+
throw new Error(`Download failed: ${response.status} ${response.statusText}`);
|
|
13121
|
+
}
|
|
13122
|
+
const buffer = await response.arrayBuffer();
|
|
13123
|
+
fs12.writeFileSync(dest, Buffer.from(buffer));
|
|
13124
|
+
}
|
|
13125
|
+
async function verifyChecksum(filePath, checksumUrl) {
|
|
13040
13126
|
try {
|
|
13041
|
-
const
|
|
13042
|
-
if (
|
|
13127
|
+
const response = await fetch(checksumUrl);
|
|
13128
|
+
if (!response.ok) {
|
|
13129
|
+
log.warn("Checksum-Datei nicht gefunden, \xFCberspringe Verifikation");
|
|
13130
|
+
return true;
|
|
13131
|
+
}
|
|
13132
|
+
const expectedHash = (await response.text()).trim().split(" ")[0].toLowerCase();
|
|
13133
|
+
const fileBuffer = fs12.readFileSync(filePath);
|
|
13134
|
+
const actualHash = crypto3.createHash("sha256").update(fileBuffer).digest("hex").toLowerCase();
|
|
13135
|
+
return expectedHash === actualHash;
|
|
13043
13136
|
} catch {
|
|
13137
|
+
log.warn("Checksum-Verifikation fehlgeschlagen, \xFCberspringe");
|
|
13138
|
+
return true;
|
|
13139
|
+
}
|
|
13140
|
+
}
|
|
13141
|
+
async function updateNativeBinary(targetVersion) {
|
|
13142
|
+
const platformInfo = getPlatformIdentifier();
|
|
13143
|
+
if (!platformInfo) {
|
|
13144
|
+
log.error("Plattform nicht unterst\xFCtzt f\xFCr Native Update");
|
|
13145
|
+
return false;
|
|
13044
13146
|
}
|
|
13147
|
+
const { binaryName } = platformInfo;
|
|
13148
|
+
const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/v${targetVersion}/${binaryName}`;
|
|
13149
|
+
const checksumUrl = `${downloadUrl}.sha256`;
|
|
13150
|
+
const currentBinary = process.execPath;
|
|
13151
|
+
const tempDir = os6.tmpdir();
|
|
13152
|
+
const tempBinary = path13.join(tempDir, `shiva-update-${Date.now()}${platformInfo.platform === "windows" ? ".exe" : ""}`);
|
|
13153
|
+
const backupBinary = `${currentBinary}.backup`;
|
|
13045
13154
|
try {
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13155
|
+
log.info(`Lade ${binaryName} herunter...`);
|
|
13156
|
+
log.dim(` URL: ${downloadUrl}`);
|
|
13157
|
+
await downloadFile(downloadUrl, tempBinary);
|
|
13158
|
+
log.info("Verifiziere Checksum...");
|
|
13159
|
+
const checksumValid = await verifyChecksum(tempBinary, checksumUrl);
|
|
13160
|
+
if (!checksumValid) {
|
|
13161
|
+
log.error("Checksum stimmt nicht \xFCberein! Update abgebrochen.");
|
|
13162
|
+
fs12.unlinkSync(tempBinary);
|
|
13163
|
+
return false;
|
|
13164
|
+
}
|
|
13165
|
+
log.success(" Checksum OK");
|
|
13166
|
+
if (platformInfo.platform !== "windows") {
|
|
13167
|
+
fs12.chmodSync(tempBinary, 493);
|
|
13168
|
+
}
|
|
13169
|
+
log.info("Erstelle Backup...");
|
|
13170
|
+
if (fs12.existsSync(currentBinary)) {
|
|
13171
|
+
fs12.copyFileSync(currentBinary, backupBinary);
|
|
13172
|
+
}
|
|
13173
|
+
log.info("Installiere neue Version...");
|
|
13174
|
+
if (platformInfo.platform === "windows") {
|
|
13175
|
+
const updateScript = path13.join(tempDir, "shiva-update.bat");
|
|
13176
|
+
const scriptContent = `
|
|
13177
|
+
@echo off
|
|
13178
|
+
timeout /t 1 /nobreak >nul
|
|
13179
|
+
move /y "${tempBinary}" "${currentBinary}"
|
|
13180
|
+
del "${backupBinary}" 2>nul
|
|
13181
|
+
del "%~f0"
|
|
13182
|
+
`;
|
|
13183
|
+
fs12.writeFileSync(updateScript, scriptContent);
|
|
13184
|
+
spawn6("cmd", ["/c", updateScript], { detached: true, stdio: "ignore" }).unref();
|
|
13185
|
+
log.success("Update wird nach Beenden angewendet");
|
|
13186
|
+
log.info("Bitte starte SHIVA neu.");
|
|
13187
|
+
} else {
|
|
13188
|
+
fs12.renameSync(tempBinary, currentBinary);
|
|
13189
|
+
if (fs12.existsSync(backupBinary)) {
|
|
13190
|
+
fs12.unlinkSync(backupBinary);
|
|
13191
|
+
}
|
|
13192
|
+
}
|
|
13193
|
+
return true;
|
|
13194
|
+
} catch (error) {
|
|
13195
|
+
log.error(`Update fehlgeschlagen: ${error instanceof Error ? error.message : String(error)}`);
|
|
13196
|
+
if (fs12.existsSync(backupBinary) && fs12.existsSync(currentBinary)) {
|
|
13197
|
+
try {
|
|
13198
|
+
fs12.copyFileSync(backupBinary, currentBinary);
|
|
13199
|
+
log.info("Backup wiederhergestellt");
|
|
13200
|
+
} catch {
|
|
13201
|
+
log.warn("Backup konnte nicht wiederhergestellt werden");
|
|
13202
|
+
}
|
|
13203
|
+
}
|
|
13204
|
+
if (fs12.existsSync(tempBinary)) {
|
|
13205
|
+
try {
|
|
13206
|
+
fs12.unlinkSync(tempBinary);
|
|
13207
|
+
} catch {
|
|
13208
|
+
}
|
|
13209
|
+
}
|
|
13210
|
+
return false;
|
|
13049
13211
|
}
|
|
13050
|
-
return "npm";
|
|
13051
13212
|
}
|
|
13052
13213
|
function getUpgradeCommand(pm) {
|
|
13053
13214
|
switch (pm) {
|
|
@@ -13061,7 +13222,7 @@ function getUpgradeCommand(pm) {
|
|
|
13061
13222
|
return `npm install -g ${PACKAGE_NAME}@latest`;
|
|
13062
13223
|
}
|
|
13063
13224
|
}
|
|
13064
|
-
async function
|
|
13225
|
+
async function runPackageManagerUpgrade(pm) {
|
|
13065
13226
|
const command = getUpgradeCommand(pm);
|
|
13066
13227
|
const [cmd, ...args] = command.split(" ");
|
|
13067
13228
|
return new Promise((resolve14) => {
|
|
@@ -13079,14 +13240,22 @@ async function runUpgrade(pm) {
|
|
|
13079
13240
|
});
|
|
13080
13241
|
});
|
|
13081
13242
|
}
|
|
13082
|
-
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) => {
|
|
13243
|
+
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 (f\xFCr npm-Installationen)").option("--yarn", "yarn verwenden").option("--pnpm", "pnpm verwenden").option("--native", "Native Binary Update erzwingen").action(async (options) => {
|
|
13083
13244
|
log.newline();
|
|
13084
13245
|
console.log(colors.orange.bold("\u{1F680} SHIVA Upgrade"));
|
|
13085
13246
|
log.newline();
|
|
13247
|
+
let installType = detectInstallationType();
|
|
13248
|
+
if (options.native) installType = "native";
|
|
13249
|
+
else if (options.npm) installType = "npm";
|
|
13250
|
+
else if (options.yarn) installType = "yarn";
|
|
13251
|
+
else if (options.pnpm) installType = "pnpm";
|
|
13252
|
+
log.dim(`Installation: ${installType}`);
|
|
13253
|
+
log.newline();
|
|
13086
13254
|
log.info("Pr\xFCfe auf Updates...");
|
|
13087
|
-
const versionInfo = await checkForUpdates();
|
|
13255
|
+
const versionInfo = await checkForUpdates(installType);
|
|
13088
13256
|
console.log(` Installiert: ${colors.bold(versionInfo.current)}`);
|
|
13089
13257
|
console.log(` Verf\xFCgbar: ${colors.bold(versionInfo.latest)}`);
|
|
13258
|
+
console.log(` Quelle: ${colors.dim(versionInfo.source)}`);
|
|
13090
13259
|
log.newline();
|
|
13091
13260
|
if (!versionInfo.isOutdated && !options.force) {
|
|
13092
13261
|
log.success("SHIVA ist bereits auf dem neuesten Stand!");
|
|
@@ -13102,26 +13271,34 @@ var upgradeCommand = new Command29("upgrade").description("SHIVA CLI aktualisier
|
|
|
13102
13271
|
}
|
|
13103
13272
|
return;
|
|
13104
13273
|
}
|
|
13105
|
-
let pm = "npm";
|
|
13106
|
-
if (options.npm) pm = "npm";
|
|
13107
|
-
else if (options.yarn) pm = "yarn";
|
|
13108
|
-
else if (options.pnpm) pm = "pnpm";
|
|
13109
|
-
else pm = detectPackageManager2();
|
|
13110
13274
|
log.newline();
|
|
13111
|
-
|
|
13112
|
-
|
|
13275
|
+
let success;
|
|
13276
|
+
if (installType === "native") {
|
|
13277
|
+
success = await updateNativeBinary(versionInfo.latest);
|
|
13278
|
+
} else {
|
|
13279
|
+
log.info(`Verwende: ${installType}`);
|
|
13280
|
+
success = await runPackageManagerUpgrade(installType);
|
|
13281
|
+
}
|
|
13113
13282
|
log.newline();
|
|
13114
13283
|
if (success) {
|
|
13115
13284
|
log.success("SHIVA wurde erfolgreich aktualisiert!");
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13285
|
+
if (installType !== "native" || os6.platform() !== "win32") {
|
|
13286
|
+
const newVersion = getCurrentVersion();
|
|
13287
|
+
if (newVersion !== versionInfo.current) {
|
|
13288
|
+
log.info(`Neue Version: ${newVersion}`);
|
|
13289
|
+
}
|
|
13119
13290
|
}
|
|
13120
13291
|
} else {
|
|
13121
13292
|
log.error("Upgrade fehlgeschlagen");
|
|
13122
13293
|
log.newline();
|
|
13123
|
-
|
|
13124
|
-
|
|
13294
|
+
if (installType === "native") {
|
|
13295
|
+
log.info("Alternativen:");
|
|
13296
|
+
log.plain(" curl -fsSL https://shiva.li/install | bash");
|
|
13297
|
+
log.plain(" npm install -g shiva-code");
|
|
13298
|
+
} else {
|
|
13299
|
+
log.info("Versuche manuell:");
|
|
13300
|
+
log.plain(` ${getUpgradeCommand(installType)}`);
|
|
13301
|
+
}
|
|
13125
13302
|
}
|
|
13126
13303
|
});
|
|
13127
13304
|
var selfUpdateCommand = new Command29("self-update").description('Alias f\xFCr "shiva upgrade"').action(async () => {
|
|
@@ -13385,9 +13562,9 @@ complete -F _shiva_completions shiva
|
|
|
13385
13562
|
}
|
|
13386
13563
|
async function installBashCompletion() {
|
|
13387
13564
|
const fs15 = await import("fs");
|
|
13388
|
-
const
|
|
13565
|
+
const os8 = await import("os");
|
|
13389
13566
|
const path15 = await import("path");
|
|
13390
|
-
const bashrcPath = path15.join(
|
|
13567
|
+
const bashrcPath = path15.join(os8.homedir(), ".bashrc");
|
|
13391
13568
|
const completionScript = generateBashCompletion();
|
|
13392
13569
|
const marker = "# SHIVA Code Bash Completion";
|
|
13393
13570
|
try {
|
|
@@ -13528,9 +13705,9 @@ compdef _shiva shiva
|
|
|
13528
13705
|
}
|
|
13529
13706
|
async function installZshCompletion() {
|
|
13530
13707
|
const fs15 = await import("fs");
|
|
13531
|
-
const
|
|
13708
|
+
const os8 = await import("os");
|
|
13532
13709
|
const path15 = await import("path");
|
|
13533
|
-
const zshrcPath = path15.join(
|
|
13710
|
+
const zshrcPath = path15.join(os8.homedir(), ".zshrc");
|
|
13534
13711
|
const completionScript = generateZshCompletion();
|
|
13535
13712
|
const marker = "# SHIVA Code Zsh Completion";
|
|
13536
13713
|
try {
|
|
@@ -13633,9 +13810,9 @@ complete -c shiva -n "__fish_seen_subcommand_from stats" -l json -d "JSON Output
|
|
|
13633
13810
|
}
|
|
13634
13811
|
async function installFishCompletion() {
|
|
13635
13812
|
const fs15 = await import("fs");
|
|
13636
|
-
const
|
|
13813
|
+
const os8 = await import("os");
|
|
13637
13814
|
const path15 = await import("path");
|
|
13638
|
-
const fishCompletionsDir = path15.join(
|
|
13815
|
+
const fishCompletionsDir = path15.join(os8.homedir(), ".config", "fish", "completions");
|
|
13639
13816
|
const fishCompletionPath = path15.join(fishCompletionsDir, "shiva.fish");
|
|
13640
13817
|
const completionScript = generateFishCompletion();
|
|
13641
13818
|
try {
|
|
@@ -13955,7 +14132,7 @@ statsCommand.command("tools").description("Tool Usage Analytics (Pro Feature)").
|
|
|
13955
14132
|
statsCommand.command("export").description("Analytics-Daten exportieren (Pro Feature)").option("--start <date>", "Start-Datum (YYYY-MM-DD)").option("--end <date>", "End-Datum (YYYY-MM-DD)").option("--format <format>", "Format: json, csv", "json").option("-o, --output <file>", "Ausgabedatei").action(async (options) => {
|
|
13956
14133
|
const { api: api2 } = await import("./client-GIGZFXT5.js");
|
|
13957
14134
|
const { isAuthenticated: isAuthenticated2 } = await import("./config-FGMZONWV.js");
|
|
13958
|
-
const { writeFileSync:
|
|
14135
|
+
const { writeFileSync: writeFileSync12 } = await import("fs");
|
|
13959
14136
|
if (!isAuthenticated2()) {
|
|
13960
14137
|
log.error("Nicht angemeldet");
|
|
13961
14138
|
log.info("Anmelden mit: shiva login");
|
|
@@ -13971,7 +14148,7 @@ statsCommand.command("export").description("Analytics-Daten exportieren (Pro Fea
|
|
|
13971
14148
|
spinner.stop();
|
|
13972
14149
|
if (options.output) {
|
|
13973
14150
|
const content = options.format === "json" ? JSON.stringify(result.data, null, 2) : String(result.data);
|
|
13974
|
-
|
|
14151
|
+
writeFileSync12(options.output, content);
|
|
13975
14152
|
log.success(`Analytics exportiert: ${options.output}`);
|
|
13976
14153
|
} else {
|
|
13977
14154
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -14524,7 +14701,7 @@ dockerCommand.action(() => {
|
|
|
14524
14701
|
import { Command as Command35 } from "commander";
|
|
14525
14702
|
import * as fs13 from "fs";
|
|
14526
14703
|
import * as path14 from "path";
|
|
14527
|
-
import * as
|
|
14704
|
+
import * as os7 from "os";
|
|
14528
14705
|
import ora22 from "ora";
|
|
14529
14706
|
import inquirer12 from "inquirer";
|
|
14530
14707
|
var builtInWorkflows = {
|
|
@@ -14683,7 +14860,7 @@ workflowCommand.command("delete").alias("rm").description("Workflow l\xF6schen")
|
|
|
14683
14860
|
log.success(`Workflow "${name}" gel\xF6scht`);
|
|
14684
14861
|
});
|
|
14685
14862
|
function getWorkflowsPath() {
|
|
14686
|
-
return path14.join(
|
|
14863
|
+
return path14.join(os7.homedir(), ".shiva", "workflows.json");
|
|
14687
14864
|
}
|
|
14688
14865
|
function loadCustomWorkflows() {
|
|
14689
14866
|
const filepath = getWorkflowsPath();
|
|
@@ -14801,10 +14978,10 @@ async function executeStep(step) {
|
|
|
14801
14978
|
|
|
14802
14979
|
// src/commands/advanced/hook.ts
|
|
14803
14980
|
import { Command as Command36 } from "commander";
|
|
14804
|
-
import { existsSync as existsSync22, readFileSync as readFileSync12, writeFileSync as
|
|
14981
|
+
import { existsSync as existsSync22, readFileSync as readFileSync12, writeFileSync as writeFileSync11, mkdirSync as mkdirSync6 } from "fs";
|
|
14805
14982
|
import { homedir as homedir7 } from "os";
|
|
14806
|
-
import { join as
|
|
14807
|
-
var CLAUDE_SETTINGS_PATH =
|
|
14983
|
+
import { join as join13 } from "path";
|
|
14984
|
+
var CLAUDE_SETTINGS_PATH = join13(homedir7(), ".claude", "settings.json");
|
|
14808
14985
|
function getClaudeSettings() {
|
|
14809
14986
|
if (!existsSync22(CLAUDE_SETTINGS_PATH)) {
|
|
14810
14987
|
return {};
|
|
@@ -14817,11 +14994,11 @@ function getClaudeSettings() {
|
|
|
14817
14994
|
}
|
|
14818
14995
|
}
|
|
14819
14996
|
function saveClaudeSettings(settings) {
|
|
14820
|
-
const dir =
|
|
14997
|
+
const dir = join13(homedir7(), ".claude");
|
|
14821
14998
|
if (!existsSync22(dir)) {
|
|
14822
14999
|
mkdirSync6(dir, { recursive: true });
|
|
14823
15000
|
}
|
|
14824
|
-
|
|
15001
|
+
writeFileSync11(CLAUDE_SETTINGS_PATH, JSON.stringify(settings, null, 2));
|
|
14825
15002
|
}
|
|
14826
15003
|
function hasShivaHook(hooks, event) {
|
|
14827
15004
|
if (!hooks || !hooks[event]) return false;
|
|
@@ -14838,7 +15015,7 @@ function removeShivaHooks(eventHooks) {
|
|
|
14838
15015
|
var hookCommand = new Command36("hook").description("Claude Code Hook Integration verwalten");
|
|
14839
15016
|
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) => {
|
|
14840
15017
|
log.brand();
|
|
14841
|
-
const claudePath =
|
|
15018
|
+
const claudePath = join13(homedir7(), ".claude");
|
|
14842
15019
|
if (!existsSync22(claudePath)) {
|
|
14843
15020
|
log.error("Claude Code nicht gefunden");
|
|
14844
15021
|
log.newline();
|