@kepoai/cli 0.0.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 +33 -0
  2. package/bin/kp +75 -0
  3. package/package.json +42 -0
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @kepo/cli
2
+
3
+ Kepo CLI - A tool for building TypeScript code into platform-specific plugins.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @kepo/cli
9
+ # or
10
+ yarn global add @kepo/cli
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ You can use the CLI in the following ways:
16
+
17
+ ```bash
18
+ # After global installation
19
+ kp [command] [options]
20
+
21
+ # Or using npx
22
+ npx @kepo/cli [command] [options]
23
+ ```
24
+
25
+ ## System Requirements
26
+
27
+ - Node.js >= 14.0.0
28
+ - Supported OS: macOS, Linux
29
+ - Supported architectures: x86_64, arm64 (Apple Silicon)
30
+
31
+ ## Auto-Download
32
+
33
+ The CLI binary will be automatically downloaded from our release server during installation or first use, matching your system's architecture.
package/bin/kp ADDED
@@ -0,0 +1,75 @@
1
+ #!/bin/bash
2
+
3
+ # Determine script path
4
+ source=${BASH_SOURCE:-$0}
5
+ while [ -L "$source" ]; do
6
+ dir=$( unset CDPATH && cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )
7
+ source=$(readlink "$source")
8
+ [[ $source != /* ]] && source=$dir/$source
9
+ done
10
+ bin_dir=$( unset CDPATH && cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )
11
+ dist_dir=$(dirname "$bin_dir")
12
+
13
+ if [ -z "$bin_dir" ]; then
14
+ echo "Error: Unable to determine CLI path: ${BASH_SOURCE:-$0}"
15
+ exit 1
16
+ fi
17
+
18
+ # Read version from package.json
19
+ kp_version=$(sed -n 's|.*"version": "\([^"]*\)".*|\1|p' < "$dist_dir/package.json")
20
+ if [ -z "$kp_version" ]; then
21
+ echo "Error: Failed to parse version"
22
+ exit 1
23
+ fi
24
+
25
+ # Determine system architecture
26
+ os="$(uname)"
27
+ architecture="$(uname -m)"
28
+ if [[ "${os}" = "Darwin" ]]; then
29
+ if [[ "${architecture}" = "arm64" ]]; then
30
+ architecture_dir="arm64"
31
+ download_arch="arm64"
32
+ else
33
+ architecture_dir="x86"
34
+ download_arch="amd64"
35
+ fi
36
+ elif [ "${os}" = "Linux" ]; then
37
+ architecture_dir="linux"
38
+ download_arch="amd64"
39
+ fi
40
+
41
+ # Define CLI paths
42
+ kp_path="$bin_dir/$architecture_dir/kp"
43
+ download_url="https://r2.kepo.ai/kepo-cli/${kp_version}/kepo-cli-${os,,}-${download_arch}"
44
+
45
+ # Function to download CLI binary
46
+ function download_cli {
47
+ echo "Downloading Kepo CLI v${kp_version} for ${os}/${architecture_dir}..."
48
+ mkdir -p "$(dirname "$kp_path")"
49
+ if ! curl -L -f -s "$download_url" -o "$kp_path"; then
50
+ echo "Error: Failed to download CLI from $download_url"
51
+ exit 1
52
+ fi
53
+ chmod +x "$kp_path"
54
+ }
55
+
56
+ # Handle npm post-install
57
+ if [ "$1" == "npm-post-install" ]; then
58
+ download_cli
59
+ exit 0
60
+ fi
61
+
62
+ # If CLI doesn't exist, download it
63
+ if [ ! -f "$kp_path" ]; then
64
+ download_cli
65
+ 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
69
+ echo "Updating Kepo CLI from v${current_version} to v${kp_version}..."
70
+ download_cli
71
+ fi
72
+ fi
73
+
74
+ # Execute CLI command
75
+ "$kp_path" "$@"
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@kepoai/cli",
3
+ "version": "0.0.1",
4
+ "description": "Kepo CLI - A tool for building TypeScript code into platform-specific plugins",
5
+ "bin": {
6
+ "kp": "./bin/kp"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "README.md"
11
+ ],
12
+ "engines": {
13
+ "node": ">=14.0.0"
14
+ },
15
+ "os": [
16
+ "darwin",
17
+ "linux"
18
+ ],
19
+ "author": "Kepo Team",
20
+ "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/kepo-io/cli"
24
+ },
25
+ "keywords": [
26
+ "kepo",
27
+ "cli",
28
+ "typescript",
29
+ "plugin",
30
+ "build"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/kepo-io/cli/issues"
37
+ },
38
+ "homepage": "https://kepo.ai",
39
+ "scripts": {
40
+ "postinstall": "./bin/kp npm-post-install"
41
+ }
42
+ }