Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
feat(skills): add termux_operations and termux_repositories skills
Gotcha Contributorf17f4ef3a5f9
diff --git a/app/src/main/assets/skills/termux_operations.json b/app/src/main/assets/skills/termux_operations.jsonnew file mode 100644index 0000000..8a75fea--- /dev/null+++ b/app/src/main/assets/skills/termux_operations.json@@ -0,0 +1,9 @@+{+ "id": "termux_operations",+ "targetPackageNames": ["com.termux"],+ "name": "Termux Operations",+ "description": "How to drive Termux through Gotcha: state isolation, prompts, output caps, and timeouts.",+ "requiresTools": ["run_termux_command"],+ "keywords": ["termux", "shell", "command", "pkg", "apt", "linux", "run_termux_command"],+ "instructions": "1. run_termux_command runs under Termux's UID, not Gotcha's. Gotcha's working directory is invisible to Termux, and Termux's home is invisible to Gotcha. The only cross-uid bridge is /sdcard/Download (after `termux-setup-storage` has been run in Termux once).\n2. Each call is a fresh /bin/sh -c. `cd`, `export`, activated virtualenvs, and `source` do NOT carry over. Chain dependent steps with `&&` in one command, never split across calls.\n3. There is no interactive terminal. Anything that waits for typed input (pkg install without -y, ssh password prompt, read, mysql>) blocks until the 600s timeout. Always pass -y / --yes / -q where the tool supports them.\n4. Output is capped at 32KB by Gotcha and ~100KB by Termux. For larger output, redirect to a file inside Termux (`grep ... > /sdcard/Download/out.txt`) and read it back via Gotcha's read_file.\n5. You cannot kill a command after submission. A timed-out command keeps running under Termux's UID. Before launching anything long, warn the user and check existing processes with `ps -ef` before starting a new one.\n6. Hard ceiling: timeout_seconds <= 600. `pkg install` of ffmpeg, chromium, rust, golang, or texlive can hit this. If it does, split into smaller packages or warn the user.\n7. Concurrency cap: 4 commands in flight, process-wide. Sub-agents share the same semaphore. A 5th call returns an error.\n8. Android 12+ background restriction: if Gotcha is in the background and the assistive ball is off, run_termux_command fails with \"Not allowed to start service\" — Termux exposes a foreground service. Tell the user to bring Gotcha to the foreground (or switch the assistive ball on).\n9. The Play-Store build of Termux has no RUN_COMMAND API and can never work. Only F-Droid or GitHub builds are usable.\n10. The four setup steps are: install Termux from F-Droid, confirm the build exposes Run Commands API, grant com.termux.permission.RUN_COMMAND, and set `allow-external-apps=true` in ~/.termux/termux.properties. Walk the user through Settings -> Termux (Linux shell) if any check fails."+}diff --git a/app/src/main/assets/skills/termux_repositories.json b/app/src/main/assets/skills/termux_repositories.jsonnew file mode 100644index 0000000..a86ae42--- /dev/null+++ b/app/src/main/assets/skills/termux_repositories.json@@ -0,0 +1,9 @@+{+ "id": "termux_repositories",+ "targetPackageNames": ["com.termux"],+ "name": "Termux Repositories",+ "description": "Mirror selection and large-package handling for Termux's pkg/apt repositories.",+ "requiresTools": ["run_termux_command"],+ "keywords": ["pkg", "apt", "mirror", "ffmpeg", "install", "repository", "termux-change-repo"],+ "instructions": "1. The default Termux mirror (https://packages.termux.dev) is often slow or blocked on networks in China, parts of India, behind corporate firewalls, and on some ISPs. Symptom: `pkg install` hangs at \"0% [Connecting to packages.termux.dev]\" or fails with \"Could not resolve host\" / \"NO_PUBKEY\" / repeated 404s.\n2. To switch mirrors interactively, the user must run `termux-change-repo` INSIDE Termux (it opens a TUI picker). Gotcha cannot drive that TUI from run_termux_command. Tell the user to open Termux, run the command, pick a mirror, and not return to chat until done.\n3. To switch non-interactively from a script, overwrite TWO files:\n - `$PREFIX/etc/apt/sources.list` with: `deb <mirror> termux-main`\n - `$PREFIX/etc/apt/sources.list.d/root.list` with: `deb <mirror> termux-root`\n Then run `apt-get update -y`. `<PREFIX>` is `/data/data/com.termux/files/usr`.\n4. Known mirrors (substitute the user's geography):\n - Official primary: https://packages.termux.dev/apt/termux-main\n - Official secondary: https://termux.mentality.org/apt/termux-main\n - Tsinghua (China): https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main\n - USTC (China): https://mirrors.ustc.edu.cn/termux/apt/termux-main\n - ISCAS (China): https://mirror.iscas.ac.cn/termux/apt/termux-main\n - CERN (China): https://mirrors.cernet.edu.cn/termux/apt/termux-main\n - NJU (China): https://mirror.nju.edu.cn/termux/apt/termux-main\n - Netherlands: https://ftp.snt.utwente.nl/termux/apt/termux-main\n5. After a mirror change, ALWAYS run `pkg update -y` to verify the new server. A `NO_PUBKEY` error means the mirror is missing the signing key — fall back to the official primary.\n6. Large packages — ffmpeg, python, rust, chromium, golang, nodejs-lts, texlive, qt — typically take 5-15 minutes to install even on a fast mirror. Always raise timeout_seconds to 600 and warn the user before kicking one off.\n7. If `pkg install` keeps failing midway, split the network step from the install step: `pkg download <pkg>` puts the .deb in $PREFIX/var/cache/apt/archives/; then `cd $PREFIX/var/cache/apt/archives && dpkg -i *.deb` installs from local cache. This is also useful for retrying a single bad package.\n8. For reproducible installs across mirrors, prefer `pkg install -y` over `apt install`; `pkg` is the wrapper that handles Termux-specific package names and dependencies and is the supported interface."+}