@onkernel/cli 0.5.0 → 0.6.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.
Files changed (3) hide show
  1. package/README.md +12 -3
  2. package/lib.js +49 -9
  3. package/package.json +19 -19
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  </p>
4
4
 
5
5
  <p align="center">
6
- <img alt="GitHub License" src="https://img.shields.io/github/license/onkernel/kernel">
6
+ <img alt="GitHub License" src="https://img.shields.io/github/license/onkernel/cli">
7
7
  <a href="https://discord.gg/FBrveQRcud"><img src="https://img.shields.io/discord/1342243238748225556?logo=discord&logoColor=white&color=7289DA" alt="Discord"></a>
8
8
  <a href="https://x.com/juecd__"><img src="https://img.shields.io/twitter/follow/juecd__" alt="Follow @juecd__"></a>
9
9
  <a href="https://x.com/rfgarcia"><img src="https://img.shields.io/twitter/follow/rfgarcia" alt="Follow @rfgarcia"></a>
@@ -103,15 +103,24 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
103
103
  - `kernel logout` - Clear stored credentials
104
104
  - `kernel auth` - Check authentication status
105
105
 
106
- ### App Management
106
+ ### App Deployment
107
107
 
108
108
  - `kernel deploy <file>` - Deploy an app to Kernel
109
-
110
109
  - `--version <version>` - Specify app version (default: latest)
111
110
  - `--force` - Allow overwriting existing version
112
111
  - `--env <KEY=VALUE>`, `-e` - Set environment variables (can be used multiple times)
113
112
  - `--env-file <file>` - Load environment variables from file (can be used multiple times)
114
113
 
114
+ - `kernel deploy logs <deployment_id>` - Stream logs for a deployment
115
+ - `--follow`, `-f` - Follow logs in real-time (stream continuously)
116
+ - `--since`, `-s` - How far back to retrieve logs. Duration formats: ns, us, ms, s, m, h (e.g., 5m, 2h, 1h30m). Timestamps also supported: 2006-01-02, 2006-01-02T15:04, 2006-01-02T15:04:05, 2006-01-02T15:04:05.000
117
+ - `--with-timestamps`, `-t` - Include timestamps in each log line
118
+
119
+ - `kernel deploy history [app_name]` - Show deployment history
120
+ - `--all` - Show deployment history for all applications
121
+
122
+ ### App Management
123
+
115
124
  - `kernel invoke <app> <action>` - Run an app action
116
125
 
117
126
  - `--version <version>`, `-v` - Specify app version (default: latest)
package/lib.js CHANGED
@@ -19,31 +19,61 @@ const getArchive = () => {
19
19
 
20
20
  const binDir = path.join(__dirname, "bin");
21
21
 
22
- async function extractTar(tarPath, binaries, dir) {
22
+ async function extractTar(tarPath, binaries, dir, wrappedIn) {
23
23
  try {
24
+ const filesToExtract = wrappedIn
25
+ ? binaries.map((bin) =>
26
+ path.join(wrappedIn, bin).replace(/\\/g, "/"),
27
+ )
28
+ : binaries;
29
+
24
30
  await tar.x({
25
31
  file: tarPath,
26
32
  cwd: dir,
27
- filter: (path) => binaries.includes(path),
33
+ filter: (path) => filesToExtract.includes(path),
28
34
  });
29
- console.log(`Successfully extracted binaries to "${dir}"`);
35
+
36
+ // If wrapped, move files from wrapped directory to bin directory
37
+ if (wrappedIn) {
38
+ const wrappedDir = path.join(dir, wrappedIn);
39
+ for (const binary of binaries) {
40
+ const srcPath = path.join(wrappedDir, binary);
41
+ const destPath = path.join(dir, binary);
42
+ if (fs.existsSync(srcPath)) {
43
+ fs.renameSync(srcPath, destPath);
44
+ }
45
+ }
46
+ // Clean up empty wrapped directory
47
+ try {
48
+ fs.rmSync(wrappedDir, { recursive: true, force: true });
49
+ } catch (err) {
50
+ // Ignore cleanup errors
51
+ }
52
+ }
53
+
54
+ console.log(`Successfully extracted ${binaries} to "${dir}"`);
30
55
  } catch (err) {
31
56
  throw new Error(`Extraction failed: ${err.message}`);
32
57
  }
33
58
  }
34
59
 
35
- async function extractZip(zipPath, binaries, dir) {
60
+ async function extractZip(zipPath, binaries, dir, wrappedIn) {
36
61
  try {
37
62
  const zipData = fs.readFileSync(zipPath);
38
63
  const zip = await JSZip.loadAsync(zipData);
64
+
39
65
  for (const binary of binaries) {
40
- if (!zip.files[binary]) {
66
+ const binaryPath = wrappedIn
67
+ ? path.join(wrappedIn, binary).replace(/\\/g, "/")
68
+ : binary;
69
+
70
+ if (!zip.files[binaryPath]) {
41
71
  throw new Error(
42
- `Error: ${binary} does not exist in ${zipPath}`,
72
+ `Error: ${binaryPath} does not exist in ${zipPath}`,
43
73
  );
44
74
  }
45
75
 
46
- const content = await zip.files[binary].async("nodebuffer");
76
+ const content = await zip.files[binaryPath].async("nodebuffer");
47
77
  if (!fs.existsSync(dir)) {
48
78
  fs.mkdirSync(dir, { recursive: true });
49
79
  }
@@ -94,11 +124,21 @@ const install = async () => {
94
124
  fs.chmodSync(bin, 0o755);
95
125
  return;
96
126
  case "zip":
97
- return extractZip(archivePath, archive.bins, binDir);
127
+ return extractZip(
128
+ archivePath,
129
+ archive.bins,
130
+ binDir,
131
+ archive.wrappedIn,
132
+ );
98
133
  case "tar":
99
134
  case "tar.gz":
100
135
  case "tgz":
101
- return extractTar(archivePath, archive.bins, binDir);
136
+ return extractTar(
137
+ archivePath,
138
+ archive.bins,
139
+ binDir,
140
+ archive.wrappedIn,
141
+ );
102
142
  case "tar.zst":
103
143
  case "tzst":
104
144
  case "tar.xz":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onkernel/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Kernel CLI",
5
5
  "scripts": {
6
6
  "postinstall": "node install.js",
@@ -33,75 +33,75 @@
33
33
  },
34
34
  "archives": {
35
35
  "darwin-arm64": {
36
- "name": "kernel_0.5.0_darwin_arm64.tar.gz",
37
- "url": "https://github.com/onkernel/cli/releases/download/v0.5.0/kernel_0.5.0_darwin_arm64.tar.gz",
36
+ "name": "kernel_0.6.1_darwin_arm64.tar.gz",
37
+ "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_darwin_arm64.tar.gz",
38
38
  "bins": [
39
39
  "kernel"
40
40
  ],
41
41
  "format": "tar.gz",
42
42
  "checksum": {
43
43
  "algorithm": "sha256",
44
- "digest": "aeb716f6c351823b1ac3a679dafc7bde12874fcae324b26a383065aac56a9113"
44
+ "digest": "63b0cc5c284f8a1579506851a50e24b09f72dcacac8bbbcb92715b7e717322f3"
45
45
  }
46
46
  },
47
47
  "darwin-x64": {
48
- "name": "kernel_0.5.0_darwin_amd64.tar.gz",
49
- "url": "https://github.com/onkernel/cli/releases/download/v0.5.0/kernel_0.5.0_darwin_amd64.tar.gz",
48
+ "name": "kernel_0.6.1_darwin_amd64.tar.gz",
49
+ "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_darwin_amd64.tar.gz",
50
50
  "bins": [
51
51
  "kernel"
52
52
  ],
53
53
  "format": "tar.gz",
54
54
  "checksum": {
55
55
  "algorithm": "sha256",
56
- "digest": "9020bf76cd279e056f679e0cc416dd8c345cffa4154a43e157302a236c986cd6"
56
+ "digest": "c72560234c0117034f9f3539cee93c61313c16e6ad14fbec8016dea91d197d2d"
57
57
  }
58
58
  },
59
59
  "linux-arm64": {
60
- "name": "kernel_0.5.0_linux_arm64.tar.gz",
61
- "url": "https://github.com/onkernel/cli/releases/download/v0.5.0/kernel_0.5.0_linux_arm64.tar.gz",
60
+ "name": "kernel_0.6.1_linux_arm64.tar.gz",
61
+ "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_linux_arm64.tar.gz",
62
62
  "bins": [
63
63
  "kernel"
64
64
  ],
65
65
  "format": "tar.gz",
66
66
  "checksum": {
67
67
  "algorithm": "sha256",
68
- "digest": "8f3485acacec01098eb46c6b7655ba2ad4993b37616978eebe7dbbfe2b581eb2"
68
+ "digest": "b56a71aacadae54970718e66f43ae07d3897b673a60d19b596cca632ffcb8d5d"
69
69
  }
70
70
  },
71
71
  "linux-x64": {
72
- "name": "kernel_0.5.0_linux_amd64.tar.gz",
73
- "url": "https://github.com/onkernel/cli/releases/download/v0.5.0/kernel_0.5.0_linux_amd64.tar.gz",
72
+ "name": "kernel_0.6.1_linux_amd64.tar.gz",
73
+ "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_linux_amd64.tar.gz",
74
74
  "bins": [
75
75
  "kernel"
76
76
  ],
77
77
  "format": "tar.gz",
78
78
  "checksum": {
79
79
  "algorithm": "sha256",
80
- "digest": "a1043af30a86f868403fbfe54ba3bd4c0549e0ff9b3c82caae6395de006ed2a8"
80
+ "digest": "228b4af7e637963daf1c73a7e45874ad9b3e3ddb7436f3f1167efc2e31d07eff"
81
81
  }
82
82
  },
83
83
  "win32-arm64": {
84
- "name": "kernel_0.5.0_windows_arm64.tar.gz",
85
- "url": "https://github.com/onkernel/cli/releases/download/v0.5.0/kernel_0.5.0_windows_arm64.tar.gz",
84
+ "name": "kernel_0.6.1_windows_arm64.tar.gz",
85
+ "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_windows_arm64.tar.gz",
86
86
  "bins": [
87
87
  "kernel.exe"
88
88
  ],
89
89
  "format": "tar.gz",
90
90
  "checksum": {
91
91
  "algorithm": "sha256",
92
- "digest": "34a1e1adb3104bbbae3fd8e813e120ceb0ca513c279fa52c3a7ebb06c394908f"
92
+ "digest": "0640b83de4a54790ffc8b61bc1b0fef69aeb24ca81d77cc0b55377ec3f4b39b8"
93
93
  }
94
94
  },
95
95
  "win32-x64": {
96
- "name": "kernel_0.5.0_windows_amd64.tar.gz",
97
- "url": "https://github.com/onkernel/cli/releases/download/v0.5.0/kernel_0.5.0_windows_amd64.tar.gz",
96
+ "name": "kernel_0.6.1_windows_amd64.tar.gz",
97
+ "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_windows_amd64.tar.gz",
98
98
  "bins": [
99
99
  "kernel.exe"
100
100
  ],
101
101
  "format": "tar.gz",
102
102
  "checksum": {
103
103
  "algorithm": "sha256",
104
- "digest": "48f3a239067b4d0d2b37d151483dcc9875bea38f68a5ff16ef656e198b8f9bb1"
104
+ "digest": "b769e93f74defdbefb4bb1ae8f6d303e80418b1c7bb82a1b741141d9f767e6be"
105
105
  }
106
106
  }
107
107
  }