shiva-code 0.5.3 → 0.6.0

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.
@@ -299,6 +299,38 @@ var ApiClient = class {
299
299
  });
300
300
  }
301
301
  // ============================================
302
+ // Packages Endpoints (Cloud-synced packages)
303
+ // ============================================
304
+ /**
305
+ * Get all packages from cloud
306
+ */
307
+ async getPackages() {
308
+ return this.request("/packages");
309
+ }
310
+ /**
311
+ * Sync a package to cloud
312
+ */
313
+ async syncPackage(data) {
314
+ return this.request("/packages", {
315
+ method: "POST",
316
+ body: JSON.stringify(data)
317
+ });
318
+ }
319
+ /**
320
+ * Get a specific package from cloud
321
+ */
322
+ async getPackage(name) {
323
+ return this.request(`/packages/${encodeURIComponent(name)}`);
324
+ }
325
+ /**
326
+ * Delete a package from cloud
327
+ */
328
+ async deleteCloudPackage(name) {
329
+ return this.request(`/packages/${encodeURIComponent(name)}`, {
330
+ method: "DELETE"
331
+ });
332
+ }
333
+ // ============================================
302
334
  // Two-Factor Authentication Endpoints (Phase 15)
303
335
  // ============================================
304
336
  /**
@@ -464,6 +496,294 @@ var ApiClient = class {
464
496
  body: JSON.stringify({ email: newOwnerEmail })
465
497
  });
466
498
  }
499
+ // ============================================
500
+ // Sandbox Endpoints (Phase 1)
501
+ // ============================================
502
+ /**
503
+ * Get all sandboxes
504
+ */
505
+ async getSandboxes(params) {
506
+ const queryParams = new URLSearchParams();
507
+ if (params?.status) queryParams.set("status", params.status);
508
+ if (params?.projectId) queryParams.set("projectId", String(params.projectId));
509
+ if (params?.limit) queryParams.set("limit", String(params.limit));
510
+ if (params?.offset) queryParams.set("offset", String(params.offset));
511
+ const queryString = queryParams.toString() ? `?${queryParams.toString()}` : "";
512
+ return this.request(`/sandbox${queryString}`);
513
+ }
514
+ /**
515
+ * Get pending-review sandboxes
516
+ */
517
+ async getPendingSandboxes() {
518
+ return this.request("/sandbox/pending");
519
+ }
520
+ /**
521
+ * Get active sandboxes
522
+ */
523
+ async getActiveSandboxes() {
524
+ return this.request("/sandbox/active");
525
+ }
526
+ /**
527
+ * Get sandbox configuration
528
+ */
529
+ async getSandboxConfig() {
530
+ return this.request("/sandbox/config");
531
+ }
532
+ /**
533
+ * Update sandbox configuration
534
+ */
535
+ async updateSandboxConfig(config) {
536
+ return this.request("/sandbox/config", {
537
+ method: "PUT",
538
+ body: JSON.stringify(config)
539
+ });
540
+ }
541
+ /**
542
+ * Get sandbox statistics
543
+ */
544
+ async getSandboxStats() {
545
+ return this.request("/sandbox/stats");
546
+ }
547
+ /**
548
+ * Cleanup old sandboxes
549
+ */
550
+ async cleanupSandboxes(params) {
551
+ return this.request("/sandbox/cleanup", {
552
+ method: "POST",
553
+ body: JSON.stringify(params || {})
554
+ });
555
+ }
556
+ /**
557
+ * Create a sandbox
558
+ */
559
+ async createSandbox(data) {
560
+ return this.request("/sandbox", {
561
+ method: "POST",
562
+ body: JSON.stringify(data)
563
+ });
564
+ }
565
+ /**
566
+ * Get sandbox details
567
+ */
568
+ async getSandbox(sessionId) {
569
+ return this.request(`/sandbox/${sessionId}`);
570
+ }
571
+ /**
572
+ * Sync sandbox data
573
+ */
574
+ async syncSandbox(sessionId, data) {
575
+ return this.request(`/sandbox/${sessionId}/sync`, {
576
+ method: "POST",
577
+ body: JSON.stringify(data)
578
+ });
579
+ }
580
+ /**
581
+ * Delete sandbox
582
+ */
583
+ async deleteSandbox(sessionId) {
584
+ return this.request(`/sandbox/${sessionId}`, {
585
+ method: "DELETE"
586
+ });
587
+ }
588
+ // ============================================
589
+ // User Management Endpoints (Phase 2)
590
+ // ============================================
591
+ /**
592
+ * Get user profile
593
+ */
594
+ async getUserProfile() {
595
+ return this.request("/users/me");
596
+ }
597
+ /**
598
+ * Update user profile
599
+ */
600
+ async updateUserProfile(data) {
601
+ return this.request("/users/me", {
602
+ method: "PUT",
603
+ body: JSON.stringify(data)
604
+ });
605
+ }
606
+ /**
607
+ * Get resource usage and limits
608
+ */
609
+ async getUserUsage() {
610
+ return this.request("/users/me/usage");
611
+ }
612
+ /**
613
+ * Generate new CLI token
614
+ */
615
+ async generateCliToken() {
616
+ return this.request("/users/me/token", {
617
+ method: "POST"
618
+ });
619
+ }
620
+ /**
621
+ * Get subscription info
622
+ */
623
+ async getSubscription() {
624
+ return this.request("/users/me/subscription");
625
+ }
626
+ /**
627
+ * Delete account (requires confirmation)
628
+ */
629
+ async deleteAccount(confirmation) {
630
+ return this.request("/users/me", {
631
+ method: "DELETE",
632
+ body: JSON.stringify({ confirmation })
633
+ });
634
+ }
635
+ // ============================================
636
+ // Extended Memories Endpoints (Phase 3)
637
+ // ============================================
638
+ /**
639
+ * Get all memory tags
640
+ */
641
+ async getMemoryTags() {
642
+ return this.request("/memories/tags");
643
+ }
644
+ /**
645
+ * Get a single memory by ID
646
+ */
647
+ async getMemory(memoryId) {
648
+ return this.request(`/memories/${memoryId}`);
649
+ }
650
+ /**
651
+ * Update a memory
652
+ */
653
+ async updateMemory(memoryId, data) {
654
+ return this.request(`/memories/${memoryId}`, {
655
+ method: "PUT",
656
+ body: JSON.stringify(data)
657
+ });
658
+ }
659
+ // ============================================
660
+ // Extended Hooks Endpoints (Phase 4)
661
+ // ============================================
662
+ /**
663
+ * Get a single hook by ID
664
+ */
665
+ async getHook(hookId) {
666
+ return this.request(`/hooks/${hookId}`);
667
+ }
668
+ /**
669
+ * Create a new hook
670
+ */
671
+ async createHook(data) {
672
+ return this.request("/hooks", {
673
+ method: "POST",
674
+ body: JSON.stringify(data)
675
+ });
676
+ }
677
+ /**
678
+ * Update a hook
679
+ */
680
+ async updateHook(hookId, data) {
681
+ return this.request(`/hooks/${hookId}`, {
682
+ method: "PUT",
683
+ body: JSON.stringify(data)
684
+ });
685
+ }
686
+ /**
687
+ * Delete a hook
688
+ */
689
+ async deleteHook(hookId) {
690
+ return this.request(`/hooks/${hookId}`, {
691
+ method: "DELETE"
692
+ });
693
+ }
694
+ /**
695
+ * Test a hook
696
+ */
697
+ async testHook(hookId) {
698
+ return this.request(`/hooks/${hookId}/test`, {
699
+ method: "POST"
700
+ });
701
+ }
702
+ /**
703
+ * Get hooks for a specific event type
704
+ */
705
+ async getHooksForEvent(eventType) {
706
+ return this.request(`/hooks/for-event/${encodeURIComponent(eventType)}`);
707
+ }
708
+ // ============================================
709
+ // Extended Sessions Endpoints (Phase 5)
710
+ // ============================================
711
+ /**
712
+ * Get active sessions
713
+ */
714
+ async getActiveSessions() {
715
+ return this.request("/sessions/active");
716
+ }
717
+ /**
718
+ * Get session statistics
719
+ */
720
+ async getSessionStats() {
721
+ return this.request("/sessions/stats");
722
+ }
723
+ /**
724
+ * Update a session
725
+ */
726
+ async updateSession(sessionId, data) {
727
+ return this.request(`/sessions/${sessionId}`, {
728
+ method: "PUT",
729
+ body: JSON.stringify(data)
730
+ });
731
+ }
732
+ /**
733
+ * Resume a session
734
+ */
735
+ async resumeSession(sessionId) {
736
+ return this.request(`/sessions/${sessionId}/resume`, {
737
+ method: "POST"
738
+ });
739
+ }
740
+ /**
741
+ * Export session data
742
+ */
743
+ async exportSession(sessionId) {
744
+ return this.request(`/sessions/${sessionId}/export`);
745
+ }
746
+ // ============================================
747
+ // Extended Analytics Endpoints (Phase 6)
748
+ // ============================================
749
+ /**
750
+ * Get session analytics (Pro Feature)
751
+ */
752
+ async getSessionAnalytics() {
753
+ return this.request("/analytics/sessions");
754
+ }
755
+ /**
756
+ * Get token usage analytics (Pro Feature)
757
+ */
758
+ async getTokenAnalytics() {
759
+ return this.request("/analytics/tokens");
760
+ }
761
+ /**
762
+ * Get tool usage analytics (Pro Feature)
763
+ */
764
+ async getToolAnalytics() {
765
+ return this.request("/analytics/tools");
766
+ }
767
+ /**
768
+ * Track an analytics event
769
+ */
770
+ async trackAnalyticsEvent(event) {
771
+ return this.request("/analytics/events", {
772
+ method: "POST",
773
+ body: JSON.stringify(event)
774
+ });
775
+ }
776
+ /**
777
+ * Export analytics data
778
+ */
779
+ async exportAnalytics(params) {
780
+ const queryParams = new URLSearchParams();
781
+ if (params?.startDate) queryParams.set("startDate", params.startDate);
782
+ if (params?.endDate) queryParams.set("endDate", params.endDate);
783
+ if (params?.format) queryParams.set("format", params.format);
784
+ const queryString = queryParams.toString() ? `?${queryParams.toString()}` : "";
785
+ return this.request(`/analytics/export${queryString}`);
786
+ }
467
787
  };
468
788
  var api = new ApiClient();
469
789
 
@@ -0,0 +1,69 @@
1
+ // src/utils/clipboard.ts
2
+ import { execSync, spawnSync } from "child_process";
3
+ var CLIPBOARD_COMMANDS = [
4
+ // Wayland (modern Linux)
5
+ { command: "wl-copy", args: [], check: "wl-copy" },
6
+ // X11 - xclip
7
+ { command: "xclip", args: ["-selection", "clipboard"], check: "xclip" },
8
+ // X11 - xsel
9
+ { command: "xsel", args: ["--clipboard", "--input"], check: "xsel" },
10
+ // macOS
11
+ { command: "pbcopy", args: [], check: "pbcopy" }
12
+ ];
13
+ function commandExists(command) {
14
+ try {
15
+ execSync(`which ${command}`, { stdio: "ignore" });
16
+ return true;
17
+ } catch {
18
+ return false;
19
+ }
20
+ }
21
+ function findClipboardCommand() {
22
+ for (const cmd of CLIPBOARD_COMMANDS) {
23
+ if (commandExists(cmd.check)) {
24
+ return cmd;
25
+ }
26
+ }
27
+ return null;
28
+ }
29
+ function copyToClipboard(text) {
30
+ const clipboardCmd = findClipboardCommand();
31
+ if (!clipboardCmd) {
32
+ return false;
33
+ }
34
+ try {
35
+ const result = spawnSync(clipboardCmd.command, clipboardCmd.args, {
36
+ input: text,
37
+ stdio: ["pipe", "ignore", "ignore"]
38
+ });
39
+ return result.status === 0;
40
+ } catch {
41
+ return false;
42
+ }
43
+ }
44
+ function getClipboardToolName() {
45
+ const cmd = findClipboardCommand();
46
+ return cmd?.command || null;
47
+ }
48
+ function isClipboardAvailable() {
49
+ return findClipboardCommand() !== null;
50
+ }
51
+ function getClipboardInstallInstructions() {
52
+ const isWayland = process.env.WAYLAND_DISPLAY || process.env.XDG_SESSION_TYPE === "wayland";
53
+ const isX11 = process.env.DISPLAY && !isWayland;
54
+ if (isWayland) {
55
+ return "F\xFCr Wayland: sudo apt install wl-clipboard";
56
+ } else if (isX11) {
57
+ return "F\xFCr X11: sudo apt install xclip";
58
+ } else if (process.platform === "darwin") {
59
+ return "pbcopy sollte bereits verf\xFCgbar sein";
60
+ }
61
+ return "sudo apt install wl-clipboard (Wayland) oder xclip (X11)";
62
+ }
63
+
64
+ export {
65
+ copyToClipboard,
66
+ getClipboardToolName,
67
+ isClipboardAvailable,
68
+ getClipboardInstallInstructions
69
+ };
@@ -0,0 +1,118 @@
1
+ // src/utils/logger.ts
2
+ import chalk from "chalk";
3
+ var log = {
4
+ // Success messages
5
+ success: (message) => console.log(chalk.green("\u2713"), message),
6
+ // Error messages
7
+ error: (message) => console.log(chalk.red("\u2717"), message),
8
+ // Warning messages
9
+ warn: (message) => console.log(chalk.yellow("\u26A0"), message),
10
+ // Info messages
11
+ info: (message) => console.log(chalk.blue("\u2139"), message),
12
+ // Plain message
13
+ plain: (message) => console.log(message),
14
+ // Dimmed text
15
+ dim: (message) => console.log(chalk.dim(message)),
16
+ // Bold text
17
+ bold: (message) => console.log(chalk.bold(message)),
18
+ // Newline
19
+ newline: () => console.log(),
20
+ // Header
21
+ header: (title) => {
22
+ console.log();
23
+ console.log(chalk.bold(title));
24
+ console.log(chalk.dim("\u2500".repeat(title.length)));
25
+ },
26
+ // Key-value pair
27
+ keyValue: (key, value, indent = 0) => {
28
+ const spaces = " ".repeat(indent);
29
+ console.log(`${spaces}${chalk.dim(key + ":")} ${value}`);
30
+ },
31
+ // List item
32
+ listItem: (text, status) => {
33
+ let icon = "\u2022";
34
+ if (status === "synced") icon = chalk.green("\u2713");
35
+ if (status === "pending") icon = chalk.yellow("\u25CB");
36
+ if (status === "error") icon = chalk.red("\u2717");
37
+ console.log(` ${icon} ${text}`);
38
+ },
39
+ // Tree structure
40
+ tree: {
41
+ item: (text, isLast = false) => {
42
+ const prefix = isLast ? "\u2514\u2500" : "\u251C\u2500";
43
+ console.log(chalk.dim(prefix), text);
44
+ }
45
+ },
46
+ // Branded header
47
+ brand: () => {
48
+ console.log();
49
+ console.log(chalk.hex("#FF6B2C").bold("SHIVA Code"));
50
+ console.log(chalk.dim("Makes Claude Code Persistent"));
51
+ console.log();
52
+ },
53
+ // Error with suggestion (for ShivaError)
54
+ errorWithSuggestion: (error) => {
55
+ console.log(chalk.red("\u2717"), error.message);
56
+ if (error.suggestion) {
57
+ console.log(chalk.dim(` \u2192 ${error.suggestion}`));
58
+ }
59
+ },
60
+ // Progress bar
61
+ progress: (current, total, label) => {
62
+ const percentage = Math.round(current / total * 100);
63
+ const barWidth = 20;
64
+ const filled = Math.round(current / total * barWidth);
65
+ const empty = barWidth - filled;
66
+ const bar = chalk.green("\u2588".repeat(filled)) + chalk.dim("\u2591".repeat(empty));
67
+ const counts = chalk.dim(`${current}/${total}`);
68
+ const labelStr = label ? ` ${label}` : "";
69
+ process.stdout.write(`\r[${bar}] ${counts}${labelStr}`);
70
+ if (current >= total) {
71
+ console.log();
72
+ }
73
+ },
74
+ // Status line (inline update)
75
+ status: (message) => {
76
+ process.stdout.write(`\r${chalk.dim("\u2192")} ${message}`.padEnd(60));
77
+ },
78
+ // Clear the current line
79
+ clearLine: () => {
80
+ process.stdout.write("\r" + " ".repeat(80) + "\r");
81
+ },
82
+ // Box with title
83
+ box: (title, content) => {
84
+ const maxLen = Math.max(title.length, ...content.map((l) => l.length));
85
+ const border = "\u2500".repeat(maxLen + 2);
86
+ console.log(chalk.dim(`\u250C${border}\u2510`));
87
+ console.log(chalk.dim("\u2502 ") + chalk.bold(title.padEnd(maxLen)) + chalk.dim(" \u2502"));
88
+ console.log(chalk.dim(`\u251C${border}\u2524`));
89
+ for (const line of content) {
90
+ console.log(chalk.dim("\u2502 ") + line.padEnd(maxLen) + chalk.dim(" \u2502"));
91
+ }
92
+ console.log(chalk.dim(`\u2514${border}\u2518`));
93
+ },
94
+ // Table row
95
+ tableRow: (columns, widths) => {
96
+ const padded = columns.map((col, i) => col.padEnd(widths[i] || col.length));
97
+ console.log(" " + padded.join(" "));
98
+ },
99
+ // Separator line
100
+ separator: (char = "\u2500", length = 40) => {
101
+ console.log(chalk.dim(char.repeat(length)));
102
+ }
103
+ };
104
+ var colors = {
105
+ orange: chalk.hex("#FF6B2C"),
106
+ cyan: chalk.hex("#00D4FF"),
107
+ green: chalk.green,
108
+ red: chalk.red,
109
+ yellow: chalk.yellow,
110
+ blue: chalk.blue,
111
+ dim: chalk.dim,
112
+ bold: chalk.bold
113
+ };
114
+
115
+ export {
116
+ log,
117
+ colors
118
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  api
3
- } from "./chunk-EGRMFBG6.js";
3
+ } from "./chunk-2DKDGG4A.js";
4
4
  import "./chunk-OP4HYQZZ.js";
5
5
  import "./chunk-3RG5ZIWI.js";
6
6
  export {
@@ -0,0 +1,13 @@
1
+ import {
2
+ copyToClipboard,
3
+ getClipboardInstallInstructions,
4
+ getClipboardToolName,
5
+ isClipboardAvailable
6
+ } from "./chunk-WWGAGUNY.js";
7
+ import "./chunk-3RG5ZIWI.js";
8
+ export {
9
+ copyToClipboard,
10
+ getClipboardInstallInstructions,
11
+ getClipboardToolName,
12
+ isClipboardAvailable
13
+ };