vidjutsu 0.2.0 → 1.0.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.
- package/README.md +1 -1
- package/dist/cli/index.mjs +3348 -0
- package/install.sh +197 -0
- package/package.json +18 -4
package/install.sh
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# VidJutsu CLI Installer
|
|
5
|
+
# Usage: curl -fsSL https://vidjutsu.ai/install.sh | bash
|
|
6
|
+
|
|
7
|
+
REPO="tfcbot/vidjutsu-sdk"
|
|
8
|
+
BINARY_NAME="vidjutsu"
|
|
9
|
+
INSTALL_DIR="$HOME/.local/bin"
|
|
10
|
+
|
|
11
|
+
# Colors
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
GREEN='\033[0;32m'
|
|
14
|
+
YELLOW='\033[1;33m'
|
|
15
|
+
CYAN='\033[0;36m'
|
|
16
|
+
BOLD='\033[1m'
|
|
17
|
+
RESET='\033[0m'
|
|
18
|
+
|
|
19
|
+
info() { printf "${CYAN}>${RESET} %s\n" "$1"; }
|
|
20
|
+
success() { printf "${GREEN}✓${RESET} %s\n" "$1"; }
|
|
21
|
+
warn() { printf "${YELLOW}!${RESET} %s\n" "$1"; }
|
|
22
|
+
error() { printf "${RED}✗${RESET} %s\n" "$1" >&2; exit 1; }
|
|
23
|
+
|
|
24
|
+
# --- Detect OS and Architecture ---
|
|
25
|
+
|
|
26
|
+
detect_platform() {
|
|
27
|
+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
28
|
+
ARCH=$(uname -m)
|
|
29
|
+
|
|
30
|
+
case "$OS" in
|
|
31
|
+
darwin) OS="darwin" ;;
|
|
32
|
+
linux) OS="linux" ;;
|
|
33
|
+
*) error "Unsupported operating system: $OS" ;;
|
|
34
|
+
esac
|
|
35
|
+
|
|
36
|
+
case "$ARCH" in
|
|
37
|
+
x86_64|amd64) ARCH="x64" ;;
|
|
38
|
+
aarch64|arm64) ARCH="arm64" ;;
|
|
39
|
+
*) error "Unsupported architecture: $ARCH" ;;
|
|
40
|
+
esac
|
|
41
|
+
|
|
42
|
+
PLATFORM="${OS}-${ARCH}"
|
|
43
|
+
info "Detected platform: ${BOLD}${PLATFORM}${RESET}"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# --- Prerequisites ---
|
|
47
|
+
|
|
48
|
+
ensure_node() {
|
|
49
|
+
if command -v node >/dev/null 2>&1; then
|
|
50
|
+
success "Node.js $(node --version) found"
|
|
51
|
+
return
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
error "Node.js is required. Install it from https://nodejs.org"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ensure_bun() {
|
|
58
|
+
if command -v bun >/dev/null 2>&1; then
|
|
59
|
+
success "Bun $(bun --version) found"
|
|
60
|
+
return
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
info "Installing Bun..."
|
|
64
|
+
curl -fsSL https://bun.sh/install | bash
|
|
65
|
+
export BUN_INSTALL="$HOME/.bun"
|
|
66
|
+
export PATH="$BUN_INSTALL/bin:$PATH"
|
|
67
|
+
success "Bun installed: $(bun --version)"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
ensure_typescript() {
|
|
71
|
+
if command -v tsc >/dev/null 2>&1; then
|
|
72
|
+
success "TypeScript $(tsc --version) found"
|
|
73
|
+
return
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
info "Installing TypeScript globally..."
|
|
77
|
+
if command -v bun >/dev/null 2>&1; then
|
|
78
|
+
bun add -g typescript
|
|
79
|
+
elif command -v npm >/dev/null 2>&1; then
|
|
80
|
+
npm install -g typescript
|
|
81
|
+
fi
|
|
82
|
+
success "TypeScript installed"
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# --- Version Detection ---
|
|
86
|
+
|
|
87
|
+
get_version() {
|
|
88
|
+
if [ -n "$VERSION" ]; then
|
|
89
|
+
info "Using specified version: v${VERSION}"
|
|
90
|
+
return
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
info "Fetching latest release..."
|
|
94
|
+
|
|
95
|
+
RELEASE_RESPONSE=$(curl -sL -w "\n%{http_code}" \
|
|
96
|
+
"https://api.github.com/repos/${REPO}/releases/latest")
|
|
97
|
+
|
|
98
|
+
HTTP_CODE=$(echo "$RELEASE_RESPONSE" | tail -1)
|
|
99
|
+
RELEASE_BODY=$(echo "$RELEASE_RESPONSE" | sed '$d')
|
|
100
|
+
|
|
101
|
+
if [ "$HTTP_CODE" != "200" ]; then
|
|
102
|
+
error "Could not fetch latest release (HTTP ${HTTP_CODE}). Check that a release exists at https://github.com/${REPO}/releases or set VERSION env var manually."
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
VERSION=$(echo "$RELEASE_BODY" | grep '"tag_name"' | sed -E 's/.*"v?([^"]+)".*/\1/')
|
|
106
|
+
|
|
107
|
+
if [ -z "$VERSION" ]; then
|
|
108
|
+
error "Could not parse version from release response. Set VERSION env var manually."
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
info "Latest version: ${BOLD}v${VERSION}${RESET}"
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# --- Download and Install ---
|
|
115
|
+
|
|
116
|
+
install_binary() {
|
|
117
|
+
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/v${VERSION}/${BINARY_NAME}-${PLATFORM}"
|
|
118
|
+
TMPFILE=$(mktemp)
|
|
119
|
+
|
|
120
|
+
info "Downloading ${BINARY_NAME} v${VERSION} for ${PLATFORM}..."
|
|
121
|
+
curl -fsSL "$DOWNLOAD_URL" -o "$TMPFILE" || error "Download failed. Check that v${VERSION} exists at ${DOWNLOAD_URL}"
|
|
122
|
+
|
|
123
|
+
# Verify checksum if available
|
|
124
|
+
CHECKSUM_URL="https://github.com/${REPO}/releases/download/v${VERSION}/checksums.txt"
|
|
125
|
+
if curl -fsSL "$CHECKSUM_URL" -o /tmp/vidjutsu-checksums.txt 2>/dev/null; then
|
|
126
|
+
EXPECTED=$(grep "${BINARY_NAME}-${PLATFORM}" /tmp/vidjutsu-checksums.txt | awk '{print $1}')
|
|
127
|
+
if [ -n "$EXPECTED" ]; then
|
|
128
|
+
if command -v sha256sum >/dev/null 2>&1; then
|
|
129
|
+
ACTUAL=$(sha256sum "$TMPFILE" | awk '{print $1}')
|
|
130
|
+
else
|
|
131
|
+
ACTUAL=$(shasum -a 256 "$TMPFILE" | awk '{print $1}')
|
|
132
|
+
fi
|
|
133
|
+
if [ "$ACTUAL" != "$EXPECTED" ]; then
|
|
134
|
+
rm -f "$TMPFILE" /tmp/vidjutsu-checksums.txt
|
|
135
|
+
error "Checksum verification failed. The binary may have been tampered with."
|
|
136
|
+
fi
|
|
137
|
+
success "Checksum verified"
|
|
138
|
+
fi
|
|
139
|
+
rm -f /tmp/vidjutsu-checksums.txt
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
chmod +x "$TMPFILE"
|
|
143
|
+
|
|
144
|
+
mkdir -p "$INSTALL_DIR"
|
|
145
|
+
mv "$TMPFILE" "${INSTALL_DIR}/${BINARY_NAME}"
|
|
146
|
+
success "Installed to ${INSTALL_DIR}/${BINARY_NAME}"
|
|
147
|
+
|
|
148
|
+
# Auto-add to PATH if needed
|
|
149
|
+
case ":$PATH:" in
|
|
150
|
+
*":${INSTALL_DIR}:"*) ;;
|
|
151
|
+
*)
|
|
152
|
+
export PATH="${INSTALL_DIR}:$PATH"
|
|
153
|
+
SHELL_RC=""
|
|
154
|
+
if [ -n "$ZSH_VERSION" ] || [ "$(basename "$SHELL")" = "zsh" ]; then
|
|
155
|
+
SHELL_RC="$HOME/.zshrc"
|
|
156
|
+
else
|
|
157
|
+
SHELL_RC="$HOME/.bashrc"
|
|
158
|
+
fi
|
|
159
|
+
if [ -n "$SHELL_RC" ] && ! grep -q '.local/bin' "$SHELL_RC" 2>/dev/null; then
|
|
160
|
+
printf '\nexport PATH="$HOME/.local/bin:$PATH"\n' >> "$SHELL_RC"
|
|
161
|
+
success "Added $INSTALL_DIR to PATH in $SHELL_RC"
|
|
162
|
+
fi
|
|
163
|
+
;;
|
|
164
|
+
esac
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
# --- Verify ---
|
|
168
|
+
|
|
169
|
+
verify() {
|
|
170
|
+
if command -v "$BINARY_NAME" >/dev/null 2>&1; then
|
|
171
|
+
success "Verification passed"
|
|
172
|
+
else
|
|
173
|
+
warn "Binary installed but not found in PATH. You may need to restart your shell."
|
|
174
|
+
fi
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
# --- Main ---
|
|
178
|
+
|
|
179
|
+
main() {
|
|
180
|
+
printf "\n${BOLD} VidJutsu CLI Installer${RESET}\n\n"
|
|
181
|
+
|
|
182
|
+
detect_platform
|
|
183
|
+
ensure_node
|
|
184
|
+
ensure_bun
|
|
185
|
+
ensure_typescript
|
|
186
|
+
get_version
|
|
187
|
+
install_binary
|
|
188
|
+
verify
|
|
189
|
+
|
|
190
|
+
printf "\n${GREEN}${BOLD} ✓ VidJutsu CLI v${VERSION} installed successfully${RESET}\n"
|
|
191
|
+
printf "\n Get started:\n"
|
|
192
|
+
printf " ${CYAN}vidjutsu auth${RESET} — authenticate your account\n"
|
|
193
|
+
printf " ${CYAN}vidjutsu generate${RESET} — generate AI video\n"
|
|
194
|
+
printf " ${CYAN}vidjutsu --help${RESET} — see all commands\n\n"
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
main
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vidjutsu",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "VidJutsu — video intelligence API. SDK + CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -11,15 +11,28 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"vidjutsu": "./dist/cli/index.mjs"
|
|
16
|
+
},
|
|
14
17
|
"files": [
|
|
15
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"install.sh"
|
|
16
20
|
],
|
|
17
21
|
"scripts": {
|
|
18
22
|
"generate": "bun scripts/generate-schema.ts && bun scripts/generate-methods.ts",
|
|
19
|
-
"build": "
|
|
23
|
+
"build": "bun run build:sdk && bun run build:cli",
|
|
24
|
+
"build:sdk": "tsc",
|
|
25
|
+
"build:cli": "bun build src/cli/index.ts --outfile dist/cli/index.mjs --target node",
|
|
26
|
+
"build:binary": "bun run build:binary:darwin-arm64 && bun run build:binary:darwin-x64 && bun run build:binary:linux-x64 && bun run build:binary:linux-arm64",
|
|
27
|
+
"build:binary:darwin-arm64": "bun build src/cli/index.ts --compile --target=bun-darwin-arm64 --outfile dist/vidjutsu-darwin-arm64",
|
|
28
|
+
"build:binary:darwin-x64": "bun build src/cli/index.ts --compile --target=bun-darwin-x64 --outfile dist/vidjutsu-darwin-x64",
|
|
29
|
+
"build:binary:linux-x64": "bun build src/cli/index.ts --compile --target=bun-linux-x64 --outfile dist/vidjutsu-linux-x64",
|
|
30
|
+
"build:binary:linux-arm64": "bun build src/cli/index.ts --compile --target=bun-linux-arm64 --outfile dist/vidjutsu-linux-arm64",
|
|
31
|
+
"dev": "bun run src/cli/index.ts",
|
|
20
32
|
"prepublishOnly": "bun run generate && bun run build"
|
|
21
33
|
},
|
|
22
34
|
"dependencies": {
|
|
35
|
+
"citty": "^0.1",
|
|
23
36
|
"openapi-fetch": "^0.13.5"
|
|
24
37
|
},
|
|
25
38
|
"devDependencies": {
|
|
@@ -33,6 +46,7 @@
|
|
|
33
46
|
"ai",
|
|
34
47
|
"api",
|
|
35
48
|
"sdk",
|
|
49
|
+
"cli",
|
|
36
50
|
"watch",
|
|
37
51
|
"extract",
|
|
38
52
|
"transcribe"
|