Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test

on:
pull_request:
push:
branches: [main]

jobs:
installers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sh tests/install-use-family.test.sh
- name: install-use-family.ps1 parses
shell: pwsh
run: |
$errors = $null
[System.Management.Automation.Language.Parser]::ParseFile("$PWD/install-use-family.ps1", [ref]$null, [ref]$errors) | Out-Null
if ($errors) { $errors; exit 1 }
8 changes: 6 additions & 2 deletions install-use-family.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,9 @@ foreach ($name in $Uses.Keys) {

''
"Skills are in $Skills. Start a new Codex session to pick them up."
$missing = @('chrome-use', 'mail-use', 'discord-use', 'chatgpt-use', 'ocs', 'paste-use') | Where-Object { -not (Get-Command $_ -ErrorAction SilentlyContinue) }
if ($missing) { "CLIs not installed yet: $($missing -join ', '). See each repo's README for the Windows install." }
$missing = @('chrome-use', 'mail-use', 'discord-use', 'chatgpt-use', 'ocs', 'paste-use', 'image-use') | Where-Object { -not (Get-Command $_ -ErrorAction SilentlyContinue) }
if ($missing) {
"CLIs not installed yet: $($missing -join ', '). See each repo's README for the Windows install."
# image-use has no installer: the CLI is a single Python file at the root of its checkout.
if ($missing -contains 'image-use') { " image-use: run it as py `"$(Join-Path $Base 'image-use\image-use')`"" }
}
8 changes: 6 additions & 2 deletions install-use-family.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mail-use:skills/mail-use wechat-use:. discord-use:. profile-use:. bitwarden-use:
chatgpt-use:. image-use:. memory-use:. ocs=open-cross-session:skills/ocs message-use:. motion-use:.
paste-use:."
# Uses that ship a CLI on PATH (iphone-use runs as a daemon, profile-use as a script in its skill).
CLIS="chrome-use cookie-use mail-use discord-use bitwarden-use chatgpt-use memory-use ocs motion-use"
CLIS="chrome-use cookie-use mail-use discord-use bitwarden-use chatgpt-use memory-use ocs motion-use image-use"

repo_of() { # repo_of <name>: the GitHub repo a use lives in
case "$1" in ocs) echo open-cross-session ;; *) echo "$1" ;; esac
Expand Down Expand Up @@ -65,6 +65,10 @@ echo "Skills are in $SKILLS. Start a new Codex session to pick them up."
if [ -n "$missing" ]; then
echo "CLIs not installed yet:$missing"
for name in $missing; do
echo " curl -fsSL https://raw.githubusercontent.com/leeguooooo/$(repo_of "$name")/main/install.sh | sh"
case "$name" in
# image-use has no install.sh: the CLI is the single file at the root of the checkout above.
image-use) echo " sudo install \"$BASE/image-use/image-use\" /usr/local/bin/image-use" ;;
*) echo " curl -fsSL https://raw.githubusercontent.com/leeguooooo/$(repo_of "$name")/main/install.sh | sh" ;;
esac
done
fi
41 changes: 41 additions & 0 deletions tests/install-use-family.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh
# Runs install-use-family.sh end to end against a fake git and an isolated HOME/PATH,
# then checks the missing-CLI hints. Nothing outside a temp dir is touched.
# sh tests/install-use-family.test.sh
set -eu
ROOT=$(cd "$(dirname "$0")/.." && pwd)
TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT
mkdir -p "$TMP/bin" "$TMP/home"

# Fake git: `clone` makes a checkout holding SKILL.md at every place the installer looks.
cat > "$TMP/bin/git" <<'GIT'
#!/bin/sh
for dest; do :; done
case "$*" in
*clone*) mkdir -p "$dest/.git"; touch "$dest/SKILL.md"
for sub in chrome-use cookie-use iphone-use mail-use ocs; do mkdir -p "$dest/skills/$sub"; touch "$dest/skills/$sub/SKILL.md"; done
mkdir -p "$dest/plugins/use-family/skills/use-family" ;;
esac
GIT
chmod +x "$TMP/bin/git"
for tool in sh mkdir ln readlink uname touch chmod rm cat dirname basename; do
ln -s "$(command -v "$tool")" "$TMP/bin/$tool"
done

run() { # run: the installer's stdout, with only $TMP/bin on PATH
HOME="$TMP/home" PATH="$TMP/bin" sh "$ROOT/install-use-family.sh"
}
fail() { echo "FAIL: $1"; echo "$out"; exit 1; }

out=$(run)
echo "$out" | grep -q '^CLIs not installed yet:.* image-use' || fail "image-use missing from the not-installed list"
echo "$out" | grep -qF "sudo install \"$TMP/home/.agents/use-family/image-use/image-use\" /usr/local/bin/image-use" \
|| fail "no single-file install hint for image-use"
echo "$out" | grep -q 'leeguooooo/image-use/main/install.sh' && fail "points at an install.sh image-use does not have"
echo "$out" | grep -qF 'leeguooooo/mail-use/main/install.sh | sh' || fail "generic install.sh hint lost"

printf '#!/bin/sh\n' > "$TMP/bin/image-use"; chmod +x "$TMP/bin/image-use"
out=$(run)
echo "$out" | grep -q 'image-use/image-use\|not installed yet:.* image-use' && fail "image-use reported although it is on PATH"

echo "ok install-use-family.sh"
Loading