karnel-termux 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.
- package/LICENSE +21 -0
- package/README.md +454 -0
- package/install.sh +272 -0
- package/karnel/bin/karnel +77 -0
- package/karnel/cli/commands/brain.sh +1553 -0
- package/karnel/cli/commands/cleanup.sh +66 -0
- package/karnel/cli/commands/doctor.sh +1528 -0
- package/karnel/cli/commands/env.sh +233 -0
- package/karnel/cli/commands/help.sh +8 -0
- package/karnel/cli/commands/ia.sh +502 -0
- package/karnel/cli/commands/init.sh +1274 -0
- package/karnel/cli/commands/install.sh +718 -0
- package/karnel/cli/commands/list.sh +399 -0
- package/karnel/cli/commands/open.sh +106 -0
- package/karnel/cli/commands/pg.sh +719 -0
- package/karnel/cli/commands/reinstall.sh +663 -0
- package/karnel/cli/commands/show.sh +90 -0
- package/karnel/cli/commands/start.sh +54 -0
- package/karnel/cli/commands/status.sh +96 -0
- package/karnel/cli/commands/uninstall.sh +668 -0
- package/karnel/cli/commands/update.sh +723 -0
- package/karnel/cli/commands/upgrade.sh +40 -0
- package/karnel/cli/commands/version.sh +3 -0
- package/karnel/cli/commands/voice.sh +230 -0
- package/karnel/cli/karnel.sh +706 -0
- package/karnel/modules/ai.sh +135 -0
- package/karnel/modules/auto.sh +114 -0
- package/karnel/modules/db.sh +132 -0
- package/karnel/modules/deploy.sh +74 -0
- package/karnel/modules/dev.sh +148 -0
- package/karnel/modules/editor.sh +115 -0
- package/karnel/modules/lang.sh +124 -0
- package/karnel/modules/npm.sh +146 -0
- package/karnel/modules/shell.sh +338 -0
- package/karnel/modules/ui.sh +139 -0
- package/karnel/modules/voice.sh +118 -0
- package/karnel/tools/ai/all.sh +209 -0
- package/karnel/tools/ai/antigravity-cli/README.md +45 -0
- package/karnel/tools/ai/antigravity-cli/bin/agy +28 -0
- package/karnel/tools/ai/antigravity-cli/helper/agy_helper.c +39 -0
- package/karnel/tools/ai/antigravity-cli/install.sh +469 -0
- package/karnel/tools/ai/claude-code/README.md +45 -0
- package/karnel/tools/ai/claude-code/bin/claude +29 -0
- package/karnel/tools/ai/claude-code/helper/claude_helper.c +42 -0
- package/karnel/tools/ai/claude-code/install.sh +278 -0
- package/karnel/tools/ai/cline/install.sh +160 -0
- package/karnel/tools/ai/codegraph/README.md +43 -0
- package/karnel/tools/ai/codegraph/bin/codegraph +5 -0
- package/karnel/tools/ai/codegraph/install.sh +160 -0
- package/karnel/tools/ai/codex/README.md +44 -0
- package/karnel/tools/ai/codex/install.sh +104 -0
- package/karnel/tools/ai/command-code/README.md +62 -0
- package/karnel/tools/ai/command-code/install.sh +136 -0
- package/karnel/tools/ai/crush/README.md +17 -0
- package/karnel/tools/ai/crush/install.sh +89 -0
- package/karnel/tools/ai/ctx7/README.md +26 -0
- package/karnel/tools/ai/ctx7/install.sh +61 -0
- package/karnel/tools/ai/engram/README.md +44 -0
- package/karnel/tools/ai/engram/install.sh +127 -0
- package/karnel/tools/ai/freebuff/README.md +52 -0
- package/karnel/tools/ai/freebuff/bin/freebuff +28 -0
- package/karnel/tools/ai/freebuff/helper/freebuff_helper.c +47 -0
- package/karnel/tools/ai/freebuff/install.sh +303 -0
- package/karnel/tools/ai/gemini-cli/README.md +46 -0
- package/karnel/tools/ai/gemini-cli/install.sh +111 -0
- package/karnel/tools/ai/gentle-ai/README.md +42 -0
- package/karnel/tools/ai/gentle-ai/install.sh +253 -0
- package/karnel/tools/ai/gentle-ai/termux-patches.go +256 -0
- package/karnel/tools/ai/gga/README.md +49 -0
- package/karnel/tools/ai/gga/install.sh +134 -0
- package/karnel/tools/ai/hermes-agent/README.md +50 -0
- package/karnel/tools/ai/hermes-agent/install.sh +120 -0
- package/karnel/tools/ai/kilocode-cli/README.md +45 -0
- package/karnel/tools/ai/kilocode-cli/bin/kilocode +21 -0
- package/karnel/tools/ai/kilocode-cli/helper/kilocode_helper.c +47 -0
- package/karnel/tools/ai/kilocode-cli/install.sh +179 -0
- package/karnel/tools/ai/kimchi-code/README.md +53 -0
- package/karnel/tools/ai/kimchi-code/install.sh +221 -0
- package/karnel/tools/ai/kimi-code/README.md +45 -0
- package/karnel/tools/ai/kimi-code/install.sh +111 -0
- package/karnel/tools/ai/kiro/README.md +17 -0
- package/karnel/tools/ai/kiro/install.sh +134 -0
- package/karnel/tools/ai/mimocode/README.md +43 -0
- package/karnel/tools/ai/mimocode/bin/mimo +28 -0
- package/karnel/tools/ai/mimocode/helper/mimocode_helper.c +47 -0
- package/karnel/tools/ai/mimocode/install.sh +287 -0
- package/karnel/tools/ai/minimax-cli/README.md +45 -0
- package/karnel/tools/ai/minimax-cli/install.sh +111 -0
- package/karnel/tools/ai/mistral-vibe/README.md +46 -0
- package/karnel/tools/ai/mistral-vibe/install.sh +119 -0
- package/karnel/tools/ai/odysseus/README.md +35 -0
- package/karnel/tools/ai/odysseus/install.sh +198 -0
- package/karnel/tools/ai/ollama/README.md +44 -0
- package/karnel/tools/ai/ollama/install.sh +78 -0
- package/karnel/tools/ai/omni-route/README.md +111 -0
- package/karnel/tools/ai/omni-route/install.sh +165 -0
- package/karnel/tools/ai/openclaude/README.md +46 -0
- package/karnel/tools/ai/openclaude/install.sh +110 -0
- package/karnel/tools/ai/openclaw/README.md +47 -0
- package/karnel/tools/ai/openclaw/install.sh +112 -0
- package/karnel/tools/ai/opencode/README.md +51 -0
- package/karnel/tools/ai/opencode/bin/opencode +28 -0
- package/karnel/tools/ai/opencode/helper/opencode_helper.c +57 -0
- package/karnel/tools/ai/opencode/install.sh +290 -0
- package/karnel/tools/ai/openspec/README.md +34 -0
- package/karnel/tools/ai/openspec/install.sh +61 -0
- package/karnel/tools/ai/pi/README.md +46 -0
- package/karnel/tools/ai/pi/install.sh +104 -0
- package/karnel/tools/ai/qwen-code/README.md +45 -0
- package/karnel/tools/ai/qwen-code/install.sh +111 -0
- package/karnel/tools/auto/all.sh +57 -0
- package/karnel/tools/auto/n8n/README.md +47 -0
- package/karnel/tools/auto/n8n/install.sh +102 -0
- package/karnel/tools/db/all.sh +61 -0
- package/karnel/tools/db/mariadb/README.md +43 -0
- package/karnel/tools/db/mariadb/install.sh +65 -0
- package/karnel/tools/db/mongodb/README.md +42 -0
- package/karnel/tools/db/mongodb/install.sh +73 -0
- package/karnel/tools/db/postgresql/README.md +45 -0
- package/karnel/tools/db/postgresql/install.sh +65 -0
- package/karnel/tools/db/redis/README.md +46 -0
- package/karnel/tools/db/redis/install.sh +64 -0
- package/karnel/tools/db/sqlite/README.md +44 -0
- package/karnel/tools/db/sqlite/install.sh +65 -0
- package/karnel/tools/deploy/all.sh +43 -0
- package/karnel/tools/deploy/netlify/install.sh +41 -0
- package/karnel/tools/deploy/railway/install.sh +109 -0
- package/karnel/tools/deploy/vercel/install.sh +43 -0
- package/karnel/tools/dev/all.sh +77 -0
- package/karnel/tools/dev/bat/README.md +44 -0
- package/karnel/tools/dev/bat/install.sh +82 -0
- package/karnel/tools/dev/bc/README.md +44 -0
- package/karnel/tools/dev/bc/install.sh +82 -0
- package/karnel/tools/dev/cloudflared/README.md +43 -0
- package/karnel/tools/dev/cloudflared/install.sh +82 -0
- package/karnel/tools/dev/curl/README.md +43 -0
- package/karnel/tools/dev/curl/install.sh +82 -0
- package/karnel/tools/dev/fzf/README.md +44 -0
- package/karnel/tools/dev/fzf/install.sh +82 -0
- package/karnel/tools/dev/gh/README.md +43 -0
- package/karnel/tools/dev/gh/install.sh +82 -0
- package/karnel/tools/dev/html2text/README.md +44 -0
- package/karnel/tools/dev/html2text/install.sh +82 -0
- package/karnel/tools/dev/imagemagick/README.md +44 -0
- package/karnel/tools/dev/imagemagick/install.sh +82 -0
- package/karnel/tools/dev/jq/README.md +44 -0
- package/karnel/tools/dev/jq/install.sh +82 -0
- package/karnel/tools/dev/lsd/README.md +44 -0
- package/karnel/tools/dev/lsd/install.sh +82 -0
- package/karnel/tools/dev/make/README.md +44 -0
- package/karnel/tools/dev/make/install.sh +82 -0
- package/karnel/tools/dev/ncurses/README.md +42 -0
- package/karnel/tools/dev/ncurses/install.sh +82 -0
- package/karnel/tools/dev/openssh/README.md +43 -0
- package/karnel/tools/dev/openssh/install.sh +75 -0
- package/karnel/tools/dev/proot/README.md +43 -0
- package/karnel/tools/dev/proot/install.sh +82 -0
- package/karnel/tools/dev/shfmt/README.md +44 -0
- package/karnel/tools/dev/shfmt/install.sh +82 -0
- package/karnel/tools/dev/tmate/README.md +44 -0
- package/karnel/tools/dev/tmate/install.sh +82 -0
- package/karnel/tools/dev/tmux/README.md +43 -0
- package/karnel/tools/dev/tmux/install.sh +75 -0
- package/karnel/tools/dev/translate/README.md +44 -0
- package/karnel/tools/dev/translate/install.sh +82 -0
- package/karnel/tools/dev/tree/README.md +44 -0
- package/karnel/tools/dev/tree/install.sh +82 -0
- package/karnel/tools/dev/udocker/README.md +44 -0
- package/karnel/tools/dev/udocker/install.sh +82 -0
- package/karnel/tools/dev/wget/README.md +44 -0
- package/karnel/tools/dev/wget/install.sh +82 -0
- package/karnel/tools/editor/all.sh +59 -0
- package/karnel/tools/editor/code-server/README.md +42 -0
- package/karnel/tools/editor/code-server/install.sh +74 -0
- package/karnel/tools/editor/neovim/README.md +43 -0
- package/karnel/tools/editor/neovim/install.sh +64 -0
- package/karnel/tools/editor/nvchad/README.md +45 -0
- package/karnel/tools/editor/nvchad/install.sh +105 -0
- package/karnel/tools/lang/all.sh +63 -0
- package/karnel/tools/lang/clang/README.md +43 -0
- package/karnel/tools/lang/clang/install.sh +79 -0
- package/karnel/tools/lang/golang/README.md +43 -0
- package/karnel/tools/lang/golang/install.sh +79 -0
- package/karnel/tools/lang/nodejs/README.md +43 -0
- package/karnel/tools/lang/nodejs/install.sh +79 -0
- package/karnel/tools/lang/perl/README.md +43 -0
- package/karnel/tools/lang/perl/install.sh +79 -0
- package/karnel/tools/lang/php/README.md +43 -0
- package/karnel/tools/lang/php/install.sh +79 -0
- package/karnel/tools/lang/python/README.md +43 -0
- package/karnel/tools/lang/python/install.sh +79 -0
- package/karnel/tools/lang/rust/README.md +43 -0
- package/karnel/tools/lang/rust/install.sh +79 -0
- package/karnel/tools/npm/all.sh +90 -0
- package/karnel/tools/npm/live-server/README.md +43 -0
- package/karnel/tools/npm/live-server/install.sh +96 -0
- package/karnel/tools/npm/localtunnel/README.md +43 -0
- package/karnel/tools/npm/localtunnel/install.sh +112 -0
- package/karnel/tools/npm/markserv/README.md +43 -0
- package/karnel/tools/npm/markserv/install.sh +95 -0
- package/karnel/tools/npm/ncu/README.md +43 -0
- package/karnel/tools/npm/ncu/install.sh +95 -0
- package/karnel/tools/npm/nestjs/README.md +43 -0
- package/karnel/tools/npm/nestjs/install.sh +95 -0
- package/karnel/tools/npm/ngrok/README.md +44 -0
- package/karnel/tools/npm/ngrok/install.sh +95 -0
- package/karnel/tools/npm/prettier/README.md +43 -0
- package/karnel/tools/npm/prettier/install.sh +95 -0
- package/karnel/tools/npm/psqlformat/README.md +43 -0
- package/karnel/tools/npm/psqlformat/install.sh +95 -0
- package/karnel/tools/npm/turbopack/README.md +8 -0
- package/karnel/tools/npm/turbopack/install.sh +42 -0
- package/karnel/tools/npm/typescript/README.md +43 -0
- package/karnel/tools/npm/typescript/install.sh +95 -0
- package/karnel/tools/npm/vercel/README.md +43 -0
- package/karnel/tools/npm/vercel/install.sh +95 -0
- package/karnel/tools/shell/all.sh +67 -0
- package/karnel/tools/shell/better-npm/README.md +43 -0
- package/karnel/tools/shell/better-npm/install.sh +85 -0
- package/karnel/tools/shell/fzf-tab/README.md +44 -0
- package/karnel/tools/shell/fzf-tab/install.sh +85 -0
- package/karnel/tools/shell/history-substring/README.md +43 -0
- package/karnel/tools/shell/history-substring/install.sh +85 -0
- package/karnel/tools/shell/powerlevel10k/README.md +43 -0
- package/karnel/tools/shell/powerlevel10k/install.sh +85 -0
- package/karnel/tools/shell/you-should-use/README.md +43 -0
- package/karnel/tools/shell/you-should-use/install.sh +85 -0
- package/karnel/tools/shell/zsh-autopair/README.md +44 -0
- package/karnel/tools/shell/zsh-autopair/install.sh +85 -0
- package/karnel/tools/shell/zsh-autosuggestions/README.md +43 -0
- package/karnel/tools/shell/zsh-autosuggestions/install.sh +85 -0
- package/karnel/tools/shell/zsh-completions/README.md +43 -0
- package/karnel/tools/shell/zsh-completions/install.sh +85 -0
- package/karnel/tools/shell/zsh-defer/README.md +43 -0
- package/karnel/tools/shell/zsh-defer/install.sh +85 -0
- package/karnel/tools/shell/zsh-syntax-highlighting/README.md +43 -0
- package/karnel/tools/shell/zsh-syntax-highlighting/install.sh +72 -0
- package/karnel/tools/ui/all.sh +61 -0
- package/karnel/tools/ui/banner/README.md +42 -0
- package/karnel/tools/ui/banner/install.sh +160 -0
- package/karnel/tools/ui/cursor/README.md +42 -0
- package/karnel/tools/ui/cursor/install.sh +58 -0
- package/karnel/tools/ui/extra-keys/README.md +43 -0
- package/karnel/tools/ui/extra-keys/install.sh +62 -0
- package/karnel/tools/ui/font/README.md +43 -0
- package/karnel/tools/ui/font/install.sh +63 -0
- package/karnel/tools/voice/all.sh +27 -0
- package/karnel/tools/voice/install.sh +10 -0
- package/karnel/tools/voice/uninstall.sh +8 -0
- package/karnel/utils/banner.sh +492 -0
- package/karnel/utils/bootstrap.sh +25 -0
- package/karnel/utils/colors.sh +33 -0
- package/karnel/utils/dialogrc +30 -0
- package/karnel/utils/env.sh +53 -0
- package/karnel/utils/log.sh +567 -0
- package/karnel/utils/version.sh +205 -0
- package/package.json +42 -0
- package/scripts/npm-install.js +60 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
import "@/utils/log"
|
|
4
|
+
import "@/utils/colors"
|
|
5
|
+
|
|
6
|
+
upgrade_main() {
|
|
7
|
+
echo
|
|
8
|
+
box "Karnel Upgrade"
|
|
9
|
+
echo
|
|
10
|
+
|
|
11
|
+
log_info "Upgrading Karnel framework to latest version..."
|
|
12
|
+
|
|
13
|
+
# Pull latest from git
|
|
14
|
+
if ! git -C "$KARNEL_PATH" pull origin main 2>/dev/null; then
|
|
15
|
+
log_warn "Git pull failed — check your internet connection"
|
|
16
|
+
return 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
log_success "Repository updated"
|
|
20
|
+
|
|
21
|
+
# Re-source env for new version
|
|
22
|
+
source "$KARNEL_PATH/utils/env.sh" 2>/dev/null
|
|
23
|
+
log_success "Karnel v$KARNEL_VERSION"
|
|
24
|
+
|
|
25
|
+
# Verify symlink
|
|
26
|
+
if [[ ! -L "$PREFIX/bin/karnel" ]] || [[ "$(readlink "$PREFIX/bin/karnel")" != "$KARNEL_PATH/bin/karnel" ]]; then
|
|
27
|
+
ln -sf "$KARNEL_PATH/bin/karnel" "$PREFIX/bin/karnel"
|
|
28
|
+
log_success "Symlink updated"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Run cleanup
|
|
32
|
+
echo
|
|
33
|
+
log_info "Running cleanup..."
|
|
34
|
+
import "@/cli/commands/cleanup"
|
|
35
|
+
cleanup_main
|
|
36
|
+
|
|
37
|
+
echo
|
|
38
|
+
log_success "Karnel is up to date (v$KARNEL_VERSION)"
|
|
39
|
+
echo
|
|
40
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
import "@/utils/log"
|
|
4
|
+
import "@/utils/colors"
|
|
5
|
+
|
|
6
|
+
voice_help() {
|
|
7
|
+
echo
|
|
8
|
+
box "KARNEL VOICE — Speech-to-Agent"
|
|
9
|
+
echo
|
|
10
|
+
log_info "Capture voice, review in ${EDITOR:-nano}, copy to clipboard, launch any AI agent."
|
|
11
|
+
echo
|
|
12
|
+
log_info "Usage: karnel voice [agent] [options]"
|
|
13
|
+
echo
|
|
14
|
+
separator_section "Agents"
|
|
15
|
+
echo
|
|
16
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "kilo" "kilo --prompt \"prompt\""
|
|
17
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "opencode" "opencode run \"prompt\""
|
|
18
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "claude-code" "claude -p \"prompt\""
|
|
19
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "codex" "codex \"prompt\""
|
|
20
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "gemini-cli" "gemini -p \"prompt\""
|
|
21
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "hermes-agent" "hermes chat -q \"prompt\""
|
|
22
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "kimi-code" "kimi -p \"prompt\""
|
|
23
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "mimocode" "mimo run \"prompt\""
|
|
24
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "mistral-vibe" "vibe --prompt \"prompt\""
|
|
25
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "openclaude" "openclaude --bg \"prompt\""
|
|
26
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "pi" "pi -p \"prompt\""
|
|
27
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "qwen-code" "qwen -p \"prompt\""
|
|
28
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "crush" "crush \"prompt\""
|
|
29
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "kiro" "kiro-cli \"prompt\""
|
|
30
|
+
printf " ${D_CYAN}%-16s${NC} %s\n" "text" "Print prompt to stdout (no agent)"
|
|
31
|
+
echo
|
|
32
|
+
separator_section "Options"
|
|
33
|
+
echo
|
|
34
|
+
printf " ${D_CYAN}%-20s${NC} %s\n" "--lang <code>" "Speech language (e.g. pt-BR, en-US, es)"
|
|
35
|
+
printf " ${D_CYAN}%-20s${NC} %s\n" "--raw" "Skip ${EDITOR:-nano} editing, use raw capture"
|
|
36
|
+
printf " ${D_CYAN}%-20s${NC} %s\n" "--no-clip" "Skip clipboard copy"
|
|
37
|
+
echo
|
|
38
|
+
separator_section "Examples"
|
|
39
|
+
echo
|
|
40
|
+
printf " ${D_CYAN}karnel voice${NC} # Show this help\n"
|
|
41
|
+
printf " ${D_CYAN}karnel voice opencode${NC} # Capture -> ${EDITOR:-nano} -> opencode\n"
|
|
42
|
+
printf " ${D_CYAN}karnel voice claude-code --lang pt-BR${NC} # Portuguese speech -> claude\n"
|
|
43
|
+
printf " ${D_CYAN}karnel voice text --raw${NC} # Capture -> print (no edit)\n"
|
|
44
|
+
printf " ${D_CYAN}karnel voice text --no-clip${NC} # Capture -> edit -> print\n"
|
|
45
|
+
echo
|
|
46
|
+
separator_section "Requirements"
|
|
47
|
+
echo
|
|
48
|
+
list_item "Termux:API package: ${D_CYAN}pkg install termux-api${NC}"
|
|
49
|
+
list_item "${EDITOR:-nano} editor: ${D_CYAN}karnel install editor${NC}"
|
|
50
|
+
list_item "Termux:API app: ${D_CYAN}https://kerneltermux.vercel.app/termux/api${NC}"
|
|
51
|
+
echo
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
voice_main() {
|
|
55
|
+
local agent="${1:-}"
|
|
56
|
+
local lang=""
|
|
57
|
+
local skip_edit=false
|
|
58
|
+
local no_clip=false
|
|
59
|
+
local extra_args=()
|
|
60
|
+
local parsed=false
|
|
61
|
+
|
|
62
|
+
# Parse options before agent
|
|
63
|
+
while [[ $# -gt 0 ]]; do
|
|
64
|
+
case "$1" in
|
|
65
|
+
--lang) lang="$2"; shift 2 ;;
|
|
66
|
+
--raw) skip_edit=true; shift ;;
|
|
67
|
+
--no-clip) no_clip=true; shift ;;
|
|
68
|
+
--help|-h) voice_help; return ;;
|
|
69
|
+
--) shift; break ;;
|
|
70
|
+
*) break ;;
|
|
71
|
+
esac
|
|
72
|
+
done
|
|
73
|
+
|
|
74
|
+
agent="${1:-}"
|
|
75
|
+
|
|
76
|
+
if [[ -z "$agent" ]] || [[ "$agent" == "--help" ]] || [[ "$agent" == "-h" ]]; then
|
|
77
|
+
voice_help
|
|
78
|
+
return
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Normalize ! alias
|
|
82
|
+
[[ "$agent" == "!" ]] && agent="text"
|
|
83
|
+
|
|
84
|
+
# -- dependency checks --
|
|
85
|
+
if ! command -v termux-speech-to-text &>/dev/null; then
|
|
86
|
+
if command -v termux-dialog &>/dev/null; then
|
|
87
|
+
log_warn "Using legacy termux-dialog (upgrade Termux:API for better STT)"
|
|
88
|
+
else
|
|
89
|
+
log_error "Termux:API is not installed"
|
|
90
|
+
list_item "Install the package: ${D_CYAN}pkg install termux-api${NC}"
|
|
91
|
+
list_item "Install the app: https://kerneltermux.vercel.app/termux/api"
|
|
92
|
+
separator
|
|
93
|
+
return 1
|
|
94
|
+
fi
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
if ! command -v "${EDITOR:-nano}" &>/dev/null && [[ "$skip_edit" == "false" ]]; then
|
|
98
|
+
log_warn "${EDITOR:-nano} not installed — falling back to --raw mode"
|
|
99
|
+
skip_edit=true
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
# -- start Termux API activity --
|
|
103
|
+
local api_ok=0
|
|
104
|
+
if command -v termux-api-start &>/dev/null; then
|
|
105
|
+
termux-api-start &>/dev/null || api_ok=$?
|
|
106
|
+
else
|
|
107
|
+
api_ok=1
|
|
108
|
+
fi
|
|
109
|
+
if [[ $api_ok -ne 0 ]]; then
|
|
110
|
+
log_warn "Failed to start Termux API activity — speech may not work"
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
local is_text=false
|
|
114
|
+
[[ "$agent" == "text" ]] && is_text=true
|
|
115
|
+
|
|
116
|
+
# -- capture voice --
|
|
117
|
+
$is_text || log_info "Listening through the microphone..."
|
|
118
|
+
local raw=""
|
|
119
|
+
|
|
120
|
+
if command -v termux-speech-to-text &>/dev/null; then
|
|
121
|
+
if [[ -n "$lang" ]]; then
|
|
122
|
+
raw="$(termux-speech-to-text -l "$lang" 2>/dev/null)"
|
|
123
|
+
else
|
|
124
|
+
raw="$(termux-speech-to-text 2>/dev/null)"
|
|
125
|
+
fi
|
|
126
|
+
elif command -v termux-dialog &>/dev/null; then
|
|
127
|
+
raw="$(termux-dialog speech 2>/dev/null | grep -i "text" | cut -d '"' -f 4)"
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
if [[ -z "$raw" ]]; then
|
|
131
|
+
log_error "No speech detected or dialog cancelled"
|
|
132
|
+
separator
|
|
133
|
+
return 1
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
# -- skip editor if --raw --
|
|
137
|
+
local prompt="$raw"
|
|
138
|
+
if [[ "$skip_edit" == "false" ]] && [[ -t 0 ]] && [[ -t 1 ]]; then
|
|
139
|
+
local tmpfile
|
|
140
|
+
tmpfile="$(mktemp)"
|
|
141
|
+
echo "$raw" >"$tmpfile"
|
|
142
|
+
$is_text || log_info "Review the prompt in ${EDITOR:-nano}, fix mistakes, then save and quit"
|
|
143
|
+
${EDITOR:-nano} "$tmpfile" </dev/tty >/dev/tty || true
|
|
144
|
+
prompt="$(< "$tmpfile")"
|
|
145
|
+
rm -f "$tmpfile"
|
|
146
|
+
elif [[ "$skip_edit" == "false" ]] && ! { [[ -t 0 ]] && [[ -t 1 ]]; }; then
|
|
147
|
+
$is_text || log_warn "No TTY available, skipping editor — using raw capture"
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
prompt="${prompt## }"
|
|
151
|
+
prompt="${prompt%% }"
|
|
152
|
+
|
|
153
|
+
if [[ -z "$prompt" ]]; then
|
|
154
|
+
log_error "Prompt is empty after editing"
|
|
155
|
+
separator
|
|
156
|
+
return 1
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
# -- copy to clipboard --
|
|
160
|
+
if [[ "$no_clip" == "false" ]] && command -v termux-clipboard-set &>/dev/null; then
|
|
161
|
+
echo "$prompt" | termux-clipboard-set
|
|
162
|
+
$is_text || log_info "Prompt copied to clipboard"
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
# -- "text" -> just print --
|
|
166
|
+
if [[ "$is_text" == "true" ]]; then
|
|
167
|
+
echo "$prompt"
|
|
168
|
+
return
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
# -- dispatch to agent --
|
|
172
|
+
log_info "Launching ${D_CYAN}$agent${NC} with prompt..."
|
|
173
|
+
echo
|
|
174
|
+
|
|
175
|
+
case "$agent" in
|
|
176
|
+
kilo)
|
|
177
|
+
kilo --prompt "$prompt"
|
|
178
|
+
;;
|
|
179
|
+
opencode)
|
|
180
|
+
opencode run "$prompt"
|
|
181
|
+
;;
|
|
182
|
+
claude-code)
|
|
183
|
+
claude -p "$prompt"
|
|
184
|
+
;;
|
|
185
|
+
codex)
|
|
186
|
+
codex "$prompt"
|
|
187
|
+
;;
|
|
188
|
+
gemini-cli)
|
|
189
|
+
gemini -p "$prompt"
|
|
190
|
+
;;
|
|
191
|
+
hermes-agent)
|
|
192
|
+
hermes chat -q "$prompt"
|
|
193
|
+
;;
|
|
194
|
+
kimi-code)
|
|
195
|
+
kimi -p "$prompt"
|
|
196
|
+
;;
|
|
197
|
+
mimocode)
|
|
198
|
+
mimo run "$prompt"
|
|
199
|
+
;;
|
|
200
|
+
mistral-vibe)
|
|
201
|
+
vibe --prompt "$prompt"
|
|
202
|
+
;;
|
|
203
|
+
openclaude)
|
|
204
|
+
openclaude --bg "$prompt"
|
|
205
|
+
;;
|
|
206
|
+
pi)
|
|
207
|
+
pi -p "$prompt"
|
|
208
|
+
;;
|
|
209
|
+
qwen-code)
|
|
210
|
+
qwen -p "$prompt"
|
|
211
|
+
;;
|
|
212
|
+
crush)
|
|
213
|
+
crush "$prompt"
|
|
214
|
+
;;
|
|
215
|
+
kiro)
|
|
216
|
+
kiro-cli "$prompt"
|
|
217
|
+
;;
|
|
218
|
+
*)
|
|
219
|
+
log_error "Unknown agent: $agent"
|
|
220
|
+
echo
|
|
221
|
+
log_info "Supported agents:"
|
|
222
|
+
echo " kilo, opencode, claude-code, codex, gemini-cli, hermes-agent,"
|
|
223
|
+
echo " kimi-code, mimocode, mistral-vibe, openclaude, pi, qwen-code, crush, kiro"
|
|
224
|
+
echo
|
|
225
|
+
log_info "Special: text (print only), ! (alias for text)"
|
|
226
|
+
separator
|
|
227
|
+
return 1
|
|
228
|
+
;;
|
|
229
|
+
esac
|
|
230
|
+
}
|