@kepoai/cli 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/kp +16 -11
  2. package/package.json +2 -3
package/bin/kp CHANGED
@@ -24,7 +24,9 @@ fi
24
24
 
25
25
  # Determine system architecture
26
26
  os="$(uname)"
27
+ os_lower="darwin" # Currently only support macOS
27
28
  architecture="$(uname -m)"
29
+
28
30
  if [[ "${os}" = "Darwin" ]]; then
29
31
  if [[ "${architecture}" = "arm64" ]]; then
30
32
  architecture_dir="arm64"
@@ -33,24 +35,27 @@ if [[ "${os}" = "Darwin" ]]; then
33
35
  architecture_dir="x86"
34
36
  download_arch="amd64"
35
37
  fi
36
- elif [ "${os}" = "Linux" ]; then
37
- architecture_dir="linux"
38
- download_arch="amd64"
38
+ else
39
+ echo "Error: Currently only macOS is supported"
40
+ exit 1
39
41
  fi
40
42
 
41
43
  # Define CLI paths
42
44
  kp_path="$bin_dir/$architecture_dir/kp"
43
- download_url="https://r2.kepo.ai/kepo-cli/${kp_version}/kepo-cli-${os,,}-${download_arch}"
45
+ kp_version_file="$bin_dir/$architecture_dir/version"
46
+ download_url="https://r2.kepo.ai/kepo-cli/$kp_version/kepo-cli-$os_lower-$download_arch"
44
47
 
45
48
  # Function to download CLI binary
46
49
  function download_cli {
47
- echo "Downloading Kepo CLI v${kp_version} for ${os}/${architecture_dir}..."
50
+ echo "Downloading Kepo CLI v${kp_version} for ${os}/${download_arch}..."
48
51
  mkdir -p "$(dirname "$kp_path")"
49
- if ! curl -L -f -s "$download_url" -o "$kp_path"; then
52
+ if ! curl -fsSL "$download_url" -o "$kp_path"; then
50
53
  echo "Error: Failed to download CLI from $download_url"
51
54
  exit 1
52
55
  fi
53
56
  chmod +x "$kp_path"
57
+ echo "$kp_version" > "$kp_version_file"
58
+ echo "Successfully downloaded CLI to $kp_path"
54
59
  }
55
60
 
56
61
  # Handle npm post-install
@@ -59,13 +64,13 @@ if [ "$1" == "npm-post-install" ]; then
59
64
  exit 0
60
65
  fi
61
66
 
62
- # If CLI doesn't exist, download it
63
- if [ ! -f "$kp_path" ]; then
67
+ # If CLI doesn't exist or version file is missing, download it
68
+ if [ ! -f "$kp_path" ] || [ ! -f "$kp_version_file" ]; then
64
69
  download_cli
65
70
  else
66
- # Check if version is outdated
67
- current_version=$("$kp_path" version 2>/dev/null || echo "unknown")
68
- if [ "$current_version" == "unknown" ] || [ "$current_version" != "$kp_version" ]; then
71
+ # Check if version is outdated using version file
72
+ current_version=$(cat "$kp_version_file" 2>/dev/null || echo "unknown")
73
+ if [ "$current_version" != "$kp_version" ]; then
69
74
  echo "Updating Kepo CLI from v${current_version} to v${kp_version}..."
70
75
  download_cli
71
76
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kepoai/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Kepo CLI - A tool for building TypeScript code into platform-specific plugins",
5
5
  "bin": {
6
6
  "kp": "./bin/kp"
@@ -13,8 +13,7 @@
13
13
  "node": ">=14.0.0"
14
14
  },
15
15
  "os": [
16
- "darwin",
17
- "linux"
16
+ "darwin"
18
17
  ],
19
18
  "author": "Kepo Team",
20
19
  "license": "MIT",