@muthuishere/aos 0.0.0-stage → 0.6.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 +16 -2
- package/bin/aos.js +17 -0
- package/install.cmd +144 -0
- package/install.sh +164 -0
- package/lib/copy-installers.js +10 -0
- package/lib/install.js +64 -0
- package/lib/postinstall.js +7 -0
- package/package.json +46 -4
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @muthuishere/aos
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Hands for your AI agent: one CLI to drive macOS, Windows and Linux.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm i -g @muthuishere/aos
|
|
7
|
+
aos doctor
|
|
8
|
+
# or, without installing
|
|
9
|
+
npx @muthuishere/aos doctor
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The package downloads the matching `aos` release binary (sha256-verified) into
|
|
13
|
+
its own folder via the project's `install.sh` / `install.cmd`, so `npm uninstall -g @muthuishere/aos`
|
|
14
|
+
removes it. With `--ignore-scripts`, pnpm or bun, the binary is fetched on first run instead.
|
|
15
|
+
The first run also installs the bundled agent skill; opt out with `AOS_NO_SKILL_AUTOINSTALL=1`.
|
|
16
|
+
|
|
17
|
+
Docs: https://muthuishere.github.io/aos/
|
package/bin/aos.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Shim: run the aos binary that lives in this package, passing args, stdio and
|
|
3
|
+
// the exit code straight through. Installs it first if postinstall never ran.
|
|
4
|
+
'use strict';
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const { spawnSync } = require('child_process');
|
|
7
|
+
const { install, binaryPath } = require('../lib/install');
|
|
8
|
+
|
|
9
|
+
if (!fs.existsSync(binaryPath) && !install()) process.exit(1);
|
|
10
|
+
|
|
11
|
+
const r = spawnSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
12
|
+
if (r.error) {
|
|
13
|
+
process.stderr.write(`aos: ${r.error.message}\n`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
if (r.signal) process.kill(process.pid, r.signal);
|
|
17
|
+
process.exit(r.status === null ? 1 : r.status);
|
package/install.cmd
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
rem Install aos on Windows from a GitHub release, a local folder, a mirror URL,
|
|
3
|
+
rem or a single aos.exe. No Go toolchain, no administrator.
|
|
4
|
+
rem
|
|
5
|
+
rem curl -fsSL -o install.cmd https://raw.githubusercontent.com/muthuishere/aos/main/install.cmd && install.cmd
|
|
6
|
+
rem install.cmd /version v0.6.0
|
|
7
|
+
rem install.cmd /from C:\path\to\release-folder (goreleaser archives + checksums.txt)
|
|
8
|
+
rem install.cmd /from https://mirror.example/aos/v0.6.0/
|
|
9
|
+
rem install.cmd /from .\aos_0.5.0_windows_arm64.zip (one release archive: unpacked)
|
|
10
|
+
rem install.cmd /from .\aos.exe (copied in as-is)
|
|
11
|
+
rem install.cmd /dir %USERPROFILE%\bin
|
|
12
|
+
rem
|
|
13
|
+
rem --from / --version / --dir work too. Environment equivalents: AOS_FROM,
|
|
14
|
+
rem AOS_VERSION, AOS_INSTALL_DIR. Default dir: %LOCALAPPDATA%\Programs\aos,
|
|
15
|
+
rem added to your user PATH (/no-path or AOS_NO_PATH=1 leaves PATH alone).
|
|
16
|
+
rem
|
|
17
|
+
rem A .cmd rather than a .ps1 on purpose: PowerShell's execution policy blocks
|
|
18
|
+
rem unsigned script FILES by default, but not -Command, so the PowerShell below
|
|
19
|
+
rem is read out of this file and run that way.
|
|
20
|
+
setlocal
|
|
21
|
+
set "AOS_INSTALL_ARGS=%*"
|
|
22
|
+
set "AOS_INSTALL_SELF=%~f0"
|
|
23
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "$s = Get-Content -Raw -LiteralPath $env:AOS_INSTALL_SELF; $m = '#' + '#AOS-POWERSHELL##'; Invoke-Expression ($s.Substring($s.IndexOf($m) + $m.Length))"
|
|
24
|
+
exit /b %ERRORLEVEL%
|
|
25
|
+
|
|
26
|
+
##AOS-POWERSHELL##
|
|
27
|
+
$ErrorActionPreference = 'Stop'
|
|
28
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
29
|
+
$repo = 'muthuishere/aos'
|
|
30
|
+
$from = if ($env:AOS_FROM) { $env:AOS_FROM } else { $env:AOS_DOWNLOAD_BASE }
|
|
31
|
+
$version = $env:AOS_VERSION
|
|
32
|
+
$dir = if ($env:AOS_INSTALL_DIR) { $env:AOS_INSTALL_DIR } else { Join-Path $env:LOCALAPPDATA 'Programs\aos' }
|
|
33
|
+
$noPath = [bool]$env:AOS_NO_PATH
|
|
34
|
+
|
|
35
|
+
function Fail($msg) { [Console]::Error.WriteLine("install: $msg"); exit 1 }
|
|
36
|
+
|
|
37
|
+
# Split the argument string the way cmd passed it, honouring quotes.
|
|
38
|
+
$argv = @([regex]::Matches("$env:AOS_INSTALL_ARGS", '"([^"]*)"|(\S+)') | ForEach-Object {
|
|
39
|
+
if ($_.Groups[1].Success) { $_.Groups[1].Value } else { $_.Groups[2].Value } })
|
|
40
|
+
for ($i = 0; $i -lt $argv.Count; $i++) {
|
|
41
|
+
$a = $argv[$i]
|
|
42
|
+
$name = $a -replace '^(--|/)', ''
|
|
43
|
+
$val = $null
|
|
44
|
+
if ($name -match '^(\w+)[=:](.*)$') { $name = $Matches[1]; $val = $Matches[2] }
|
|
45
|
+
if ($name -in @('from', 'version', 'dir')) {
|
|
46
|
+
if ($null -eq $val) { $i++; if ($i -ge $argv.Count) { Fail "$a needs a value" }; $val = $argv[$i] }
|
|
47
|
+
Set-Variable -Name $name -Value $val
|
|
48
|
+
} elseif ($name -eq 'no-path') {
|
|
49
|
+
$noPath = $true
|
|
50
|
+
} elseif ($name -in @('h', 'help', '?')) {
|
|
51
|
+
Write-Host 'install.cmd [/from <folder|url|aos.exe>] [/version vX.Y.Z] [/dir <path>] [/no-path]'; exit 0
|
|
52
|
+
} else { Fail "unknown argument: $a" }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
$arch = if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64' -or $env:PROCESSOR_ARCHITEW6432 -eq 'ARM64') { 'arm64' } else { 'amd64' }
|
|
56
|
+
$tmp = Join-Path ([IO.Path]::GetTempPath()) ('aos-install-' + [guid]::NewGuid())
|
|
57
|
+
New-Item -ItemType Directory -Force -Path $tmp | Out-Null
|
|
58
|
+
New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
|
59
|
+
$target = Join-Path $dir 'aos.exe'
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
if ($from -and (Test-Path -LiteralPath $from -PathType Leaf) -and $from -like '*.zip') {
|
|
63
|
+
Write-Host "==> Installing from the archive $from"
|
|
64
|
+
$tmpa = Join-Path ([IO.Path]::GetTempPath()) ("aos-" + [guid]::NewGuid())
|
|
65
|
+
Expand-Archive -LiteralPath $from -DestinationPath $tmpa -Force
|
|
66
|
+
$exe = Join-Path $tmpa 'aos.exe'
|
|
67
|
+
if (-not (Test-Path -LiteralPath $exe)) { Fail "$from does not contain aos.exe" }
|
|
68
|
+
Copy-Item -LiteralPath $exe -Destination $target -Force
|
|
69
|
+
Remove-Item -Recurse -Force $tmpa
|
|
70
|
+
} elseif ($from -and (Test-Path -LiteralPath $from -PathType Leaf)) {
|
|
71
|
+
Write-Host "==> Installing the executable $from"
|
|
72
|
+
Copy-Item -LiteralPath $from -Destination $target -Force
|
|
73
|
+
} else {
|
|
74
|
+
$isUrl = $false
|
|
75
|
+
if (-not $from) {
|
|
76
|
+
if (-not $version) {
|
|
77
|
+
$version = (Invoke-RestMethod -UseBasicParsing "https://api.github.com/repos/$repo/releases/latest").tag_name
|
|
78
|
+
if (-not $version) { Fail "could not resolve the latest release of $repo" }
|
|
79
|
+
}
|
|
80
|
+
if ($version -notmatch '^v') { $version = "v$version" }
|
|
81
|
+
$base = "https://github.com/$repo/releases/download/$version"; $isUrl = $true
|
|
82
|
+
} else {
|
|
83
|
+
$base = $from.TrimEnd('/', '\')
|
|
84
|
+
$isUrl = $base -match '^https?://'
|
|
85
|
+
if (-not $isUrl -and -not (Test-Path -LiteralPath $base -PathType Container)) {
|
|
86
|
+
Fail "/from $from is not a folder, an executable, or an http(s) URL"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
Write-Host "==> Installing aos for windows/$arch from $base"
|
|
90
|
+
|
|
91
|
+
function Fetch($name, $dest) {
|
|
92
|
+
try {
|
|
93
|
+
if ($isUrl) { Invoke-WebRequest -UseBasicParsing -Uri "$base/$name" -OutFile $dest }
|
|
94
|
+
else { Copy-Item -LiteralPath (Join-Path $base $name) -Destination $dest -ErrorAction Stop }
|
|
95
|
+
return $true
|
|
96
|
+
} catch { return $false }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
$sumsFile = Join-Path $tmp 'checksums.txt'
|
|
100
|
+
$sums = @{}
|
|
101
|
+
if (Fetch 'checksums.txt' $sumsFile) {
|
|
102
|
+
Get-Content $sumsFile | ForEach-Object { $p = $_ -split '\s+', 2; if ($p.Count -eq 2) { $sums[$p[1].Trim()] = $p[0] } }
|
|
103
|
+
}
|
|
104
|
+
$pattern = "^aos_.*_windows_$arch\.zip$"
|
|
105
|
+
$archive = $null
|
|
106
|
+
if ($sums.Count -gt 0) {
|
|
107
|
+
$names = @($sums.Keys | Where-Object { $_ -match $pattern })
|
|
108
|
+
if ($version) { $names = @($names | Where-Object { $_ -like "*_$($version.TrimStart('v'))_*" }) }
|
|
109
|
+
$archive = $names | Select-Object -First 1
|
|
110
|
+
} elseif ($version) {
|
|
111
|
+
$archive = "aos_$($version.TrimStart('v'))_windows_$arch.zip"
|
|
112
|
+
} elseif (-not $isUrl) {
|
|
113
|
+
$archive = Get-ChildItem -LiteralPath $base -File | Where-Object { $_.Name -match $pattern } | Select-Object -First 1 -ExpandProperty Name
|
|
114
|
+
} else { Fail "$base has no checksums.txt to find the archive by; pass /version" }
|
|
115
|
+
if (-not $archive) { Fail "no aos archive for windows/$arch at $base" }
|
|
116
|
+
|
|
117
|
+
$zip = Join-Path $tmp $archive
|
|
118
|
+
if (-not (Fetch $archive $zip)) { Fail "download failed: $base/$archive" }
|
|
119
|
+
if ($sums.Count -gt 0) {
|
|
120
|
+
$got = (Get-FileHash -Algorithm SHA256 -LiteralPath $zip).Hash.ToLower()
|
|
121
|
+
if ($sums[$archive] -ne $got) { Fail "checksum mismatch for $archive -- refusing to install" }
|
|
122
|
+
Write-Host ' sha256 verified'
|
|
123
|
+
} else {
|
|
124
|
+
Write-Warning "$base has no checksums.txt -- installing $archive WITHOUT verifying it"
|
|
125
|
+
}
|
|
126
|
+
Expand-Archive -LiteralPath $zip -DestinationPath (Join-Path $tmp 'x') -Force
|
|
127
|
+
$exe = Join-Path $tmp 'x\aos.exe'
|
|
128
|
+
if (-not (Test-Path -LiteralPath $exe)) { Fail "$archive does not contain aos.exe" }
|
|
129
|
+
Copy-Item -LiteralPath $exe -Destination $target -Force
|
|
130
|
+
}
|
|
131
|
+
} finally {
|
|
132
|
+
if ($tmp -and (Test-Path -LiteralPath $tmp)) { Remove-Item -LiteralPath $tmp -Recurse -Force }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
Write-Host " $target"
|
|
136
|
+
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
|
|
137
|
+
if (-not $noPath -and -not (($userPath -split ';') -contains $dir)) {
|
|
138
|
+
[Environment]::SetEnvironmentVariable('Path', ($(if ($userPath) { "$userPath;$dir" } else { $dir })), 'User')
|
|
139
|
+
Write-Host " added $dir to your user PATH (open a new terminal to pick it up)"
|
|
140
|
+
}
|
|
141
|
+
$env:Path = "$dir;$env:Path"
|
|
142
|
+
# Running it once also installs the bundled agent skill.
|
|
143
|
+
& $target --version
|
|
144
|
+
exit $LASTEXITCODE
|
package/install.sh
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Install aos from a GitHub release, a local folder, a mirror URL, or a single
|
|
3
|
+
# executable. No Go toolchain, no root.
|
|
4
|
+
#
|
|
5
|
+
# curl -fsSL https://raw.githubusercontent.com/muthuishere/aos/main/install.sh | sh
|
|
6
|
+
# curl -fsSL https://raw.githubusercontent.com/muthuishere/aos/main/install.sh | sh -s -- --version v0.6.0
|
|
7
|
+
# sh install.sh --from /path/to/release-folder # goreleaser archives + checksums.txt (e.g. a copied dist/)
|
|
8
|
+
# sh install.sh --from https://mirror.example/aos/v0.6.0/
|
|
9
|
+
# sh install.sh --from ./aos_0.5.0_darwin_arm64.tar.gz # one release archive: unpacked
|
|
10
|
+
# sh install.sh --from ./aos # an already-extracted executable: copied in as-is
|
|
11
|
+
# sh install.sh --dir ~/bin
|
|
12
|
+
#
|
|
13
|
+
# Environment equivalents: AOS_FROM, AOS_VERSION, AOS_INSTALL_DIR
|
|
14
|
+
# (AOS_NO_PATH=1 skips the PATH hint)
|
|
15
|
+
# (AOS_DOWNLOAD_BASE is accepted as an alias of AOS_FROM).
|
|
16
|
+
#
|
|
17
|
+
# Read it first if you like -- the right instinct for anything piped to a shell:
|
|
18
|
+
# curl -fsSL https://raw.githubusercontent.com/muthuishere/aos/main/install.sh -o install.sh && less install.sh
|
|
19
|
+
|
|
20
|
+
set -eu
|
|
21
|
+
|
|
22
|
+
REPO="muthuishere/aos"
|
|
23
|
+
FROM="${AOS_FROM:-${AOS_DOWNLOAD_BASE:-}}"
|
|
24
|
+
VERSION="${AOS_VERSION:-}"
|
|
25
|
+
DIR="${AOS_INSTALL_DIR:-$HOME/.local/bin}"
|
|
26
|
+
|
|
27
|
+
say() { printf '%s\n' "$*"; }
|
|
28
|
+
step() { printf '==> %s\n' "$*"; }
|
|
29
|
+
warn() { printf 'install: WARNING: %s\n' "$*" >&2; }
|
|
30
|
+
die() { printf 'install: %s\n' "$*" >&2; exit 1; }
|
|
31
|
+
|
|
32
|
+
usage() {
|
|
33
|
+
sed -n '2,16p' "$0" 2>/dev/null | sed 's/^# \{0,1\}//' || true
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
while [ $# -gt 0 ]; do
|
|
37
|
+
case "$1" in
|
|
38
|
+
--from) [ $# -ge 2 ] || die "--from needs a value"; FROM=$2; shift 2 ;;
|
|
39
|
+
--from=*) FROM=${1#*=}; shift ;;
|
|
40
|
+
--version) [ $# -ge 2 ] || die "--version needs a value"; VERSION=$2; shift 2 ;;
|
|
41
|
+
--version=*) VERSION=${1#*=}; shift ;;
|
|
42
|
+
--dir) [ $# -ge 2 ] || die "--dir needs a value"; DIR=$2; shift 2 ;;
|
|
43
|
+
--dir=*) DIR=${1#*=}; shift ;;
|
|
44
|
+
-h|--help) usage; exit 0 ;;
|
|
45
|
+
*) die "unknown argument: $1 (try --help)" ;;
|
|
46
|
+
esac
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
case "$(uname -s)" in
|
|
50
|
+
Darwin) os=darwin ;;
|
|
51
|
+
Linux) os=linux ;;
|
|
52
|
+
*) die "unsupported OS $(uname -s); on Windows use install.cmd" ;;
|
|
53
|
+
esac
|
|
54
|
+
case "$(uname -m)" in
|
|
55
|
+
x86_64|amd64) arch=amd64 ;;
|
|
56
|
+
arm64|aarch64) arch=arm64 ;;
|
|
57
|
+
*) die "unsupported architecture $(uname -m)" ;;
|
|
58
|
+
esac
|
|
59
|
+
|
|
60
|
+
sha256() {
|
|
61
|
+
if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | cut -d' ' -f1
|
|
62
|
+
elif command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | cut -d' ' -f1
|
|
63
|
+
else echo ""; fi
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
tmp=$(mktemp -d 2>/dev/null || mktemp -d -t aos)
|
|
67
|
+
trap 'rm -rf "${tmp:?}"' EXIT INT TERM
|
|
68
|
+
|
|
69
|
+
# fetch NAME DEST: copy NAME from the source (folder or URL). Returns non-zero
|
|
70
|
+
# when it is not there.
|
|
71
|
+
fetch() {
|
|
72
|
+
case "$base" in
|
|
73
|
+
http://*|https://*) curl -fsSL "$base/$1" -o "$2" 2>/dev/null ;;
|
|
74
|
+
*) [ -f "$base/$1" ] && cp "$base/$1" "$2" ;;
|
|
75
|
+
esac
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
install_binary() { # $1 = path of an aos executable
|
|
79
|
+
mkdir -p "$DIR"
|
|
80
|
+
cp "$1" "$tmp/aos.new"
|
|
81
|
+
chmod +x "$tmp/aos.new"
|
|
82
|
+
mv -f "$tmp/aos.new" "${DIR:?}/aos"
|
|
83
|
+
if [ "$os" = darwin ]; then
|
|
84
|
+
xattr -d com.apple.quarantine "${DIR:?}/aos" 2>/dev/null || true
|
|
85
|
+
fi
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# --- a single release archive: unpack it and install the aos inside.
|
|
89
|
+
if [ -n "$FROM" ] && [ -f "$FROM" ] && case "$FROM" in *.tar.gz|*.tgz) true ;; *) false ;; esac; then
|
|
90
|
+
step "Installing from the archive $FROM"
|
|
91
|
+
tmpa=$(mktemp -d)
|
|
92
|
+
tar -xzf "$FROM" -C "$tmpa" || die "could not unpack $FROM"
|
|
93
|
+
[ -f "$tmpa/aos" ] || die "$FROM does not contain an aos executable"
|
|
94
|
+
install_binary "$tmpa/aos"
|
|
95
|
+
rm -rf "$tmpa"
|
|
96
|
+
# --- a single executable: copy it in, nothing to verify against.
|
|
97
|
+
elif [ -n "$FROM" ] && [ -f "$FROM" ]; then
|
|
98
|
+
step "Installing the executable $FROM"
|
|
99
|
+
install_binary "$FROM"
|
|
100
|
+
else
|
|
101
|
+
# --- resolve the source base and the version.
|
|
102
|
+
if [ -z "$FROM" ]; then
|
|
103
|
+
if [ -z "$VERSION" ]; then
|
|
104
|
+
# /releases/latest redirects to /releases/tag/<tag>; no API token needed.
|
|
105
|
+
VERSION=$(curl -fsSLI -o /dev/null -w '%{url_effective}' "https://github.com/$REPO/releases/latest" | sed 's#.*/tag/##')
|
|
106
|
+
case "$VERSION" in v*|[0-9]*) ;; *) die "could not resolve the latest release of $REPO" ;; esac
|
|
107
|
+
fi
|
|
108
|
+
case "$VERSION" in v*) ;; *) VERSION="v$VERSION" ;; esac
|
|
109
|
+
base="https://github.com/$REPO/releases/download/$VERSION"
|
|
110
|
+
else
|
|
111
|
+
base=${FROM%/}
|
|
112
|
+
case "$base" in
|
|
113
|
+
http://*|https://*) ;;
|
|
114
|
+
*) [ -d "$base" ] || die "--from $FROM is not a folder, an executable, or an http(s) URL" ;;
|
|
115
|
+
esac
|
|
116
|
+
fi
|
|
117
|
+
step "Installing aos for $os/$arch from $base"
|
|
118
|
+
|
|
119
|
+
# --- pick the archive: from checksums.txt when present, else by version / glob.
|
|
120
|
+
have_sums=0
|
|
121
|
+
if fetch checksums.txt "$tmp/checksums.txt"; then have_sums=1; fi
|
|
122
|
+
archive=""
|
|
123
|
+
if [ "$have_sums" = 1 ]; then
|
|
124
|
+
archive=$(awk '{print $2}' "$tmp/checksums.txt" | grep "^aos_.*_${os}_${arch}\.tar\.gz\$" | { [ -n "$VERSION" ] && grep "_${VERSION#v}_" || cat; } | head -n1 || true)
|
|
125
|
+
elif [ -n "$VERSION" ]; then
|
|
126
|
+
archive="aos_${VERSION#v}_${os}_${arch}.tar.gz"
|
|
127
|
+
else
|
|
128
|
+
case "$base" in
|
|
129
|
+
http://*|https://*) die "$base has no checksums.txt to find the archive by; pass --version" ;;
|
|
130
|
+
*) for f in "$base"/aos_*_"${os}"_"${arch}".tar.gz; do
|
|
131
|
+
[ -f "$f" ] && archive=${f##*/} && break
|
|
132
|
+
done ;;
|
|
133
|
+
esac
|
|
134
|
+
fi
|
|
135
|
+
[ -n "$archive" ] || die "no aos archive for $os/$arch at $base"
|
|
136
|
+
|
|
137
|
+
fetch "$archive" "$tmp/$archive" || die "download failed: $base/$archive"
|
|
138
|
+
|
|
139
|
+
if [ "$have_sums" = 1 ]; then
|
|
140
|
+
want=$(awk -v f="$archive" '$2 == f {print $1}' "$tmp/checksums.txt")
|
|
141
|
+
got=$(sha256 "$tmp/$archive")
|
|
142
|
+
[ -n "$got" ] || die "no sha256sum or shasum to verify the download with"
|
|
143
|
+
[ -n "$want" ] && [ "$want" = "$got" ] || die "checksum mismatch for $archive -- refusing to install"
|
|
144
|
+
say " sha256 verified"
|
|
145
|
+
else
|
|
146
|
+
warn "$base has no checksums.txt -- installing $archive WITHOUT verifying it"
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
mkdir -p "$tmp/x"
|
|
150
|
+
tar -xzf "$tmp/$archive" -C "$tmp/x"
|
|
151
|
+
[ -f "$tmp/x/aos" ] || die "$archive does not contain an aos executable"
|
|
152
|
+
install_binary "$tmp/x/aos"
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
say " ${DIR}/aos"
|
|
156
|
+
case "${AOS_NO_PATH:+skip}:$PATH:" in
|
|
157
|
+
skip*|*":$DIR:"*) ;;
|
|
158
|
+
*) say ""
|
|
159
|
+
say "$DIR is not on your PATH. Add this to your shell profile:"
|
|
160
|
+
say " export PATH=\"$DIR:\$PATH\"" ;;
|
|
161
|
+
esac
|
|
162
|
+
|
|
163
|
+
# Running it once also installs the bundled agent skill.
|
|
164
|
+
"${DIR}/aos" --version
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// prepack: ship the repo's own install.sh / install.cmd inside the package, so
|
|
2
|
+
// npm installs exactly what the curl one-liners install.
|
|
3
|
+
'use strict';
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const root = path.join(__dirname, '..');
|
|
8
|
+
for (const name of ['install.sh', 'install.cmd']) {
|
|
9
|
+
fs.copyFileSync(path.join(root, '..', name), path.join(root, name));
|
|
10
|
+
}
|
package/lib/install.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Installs the aos binary INTO this package (vendor/), using the same
|
|
2
|
+
// install.sh / install.cmd the curl one-liners use, so `npm uninstall`
|
|
3
|
+
// removes it and nothing is put on the global PATH.
|
|
4
|
+
'use strict';
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { spawnSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
const root = path.join(__dirname, '..');
|
|
10
|
+
const win = process.platform === 'win32';
|
|
11
|
+
const vendorDir = path.join(root, 'vendor');
|
|
12
|
+
const binaryPath = path.join(vendorDir, win ? 'aos.exe' : 'aos');
|
|
13
|
+
const version = require('../package.json').version;
|
|
14
|
+
|
|
15
|
+
const MANUAL = win
|
|
16
|
+
? 'curl -fsSL -o install.cmd https://raw.githubusercontent.com/muthuishere/aos/main/install.cmd && install.cmd'
|
|
17
|
+
: 'curl -fsSL https://raw.githubusercontent.com/muthuishere/aos/main/install.sh | sh';
|
|
18
|
+
|
|
19
|
+
function supported() {
|
|
20
|
+
return ['darwin', 'linux', 'win32'].includes(process.platform) &&
|
|
21
|
+
['x64', 'arm64'].includes(process.arch);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// install() -> true when the binary is in place. Output goes to stderr so a
|
|
25
|
+
// first-run install never pollutes the command's stdout.
|
|
26
|
+
function install() {
|
|
27
|
+
if (!supported()) {
|
|
28
|
+
fail(`aos has no build for ${process.platform}/${process.arch}.`);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
const env = Object.assign({}, process.env, {
|
|
32
|
+
AOS_INSTALL_DIR: vendorDir,
|
|
33
|
+
AOS_NO_PATH: '1',
|
|
34
|
+
});
|
|
35
|
+
// 0.0.0 is the unpublished in-repo version: take the latest release.
|
|
36
|
+
if (version && version !== '0.0.0' && !env.AOS_VERSION) env.AOS_VERSION = 'v' + version;
|
|
37
|
+
// npm's proxy config reaches scripts as npm_config_*; curl and PowerShell read
|
|
38
|
+
// the conventional variables.
|
|
39
|
+
const proxy = env.npm_config_https_proxy || env.npm_config_proxy;
|
|
40
|
+
if (proxy) {
|
|
41
|
+
if (!env.HTTPS_PROXY && !env.https_proxy) env.HTTPS_PROXY = proxy;
|
|
42
|
+
if (!env.HTTP_PROXY && !env.http_proxy) env.HTTP_PROXY = env.npm_config_proxy || proxy;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const r = win
|
|
46
|
+
? spawnSync(env.ComSpec || 'cmd.exe', ['/d', '/c', path.join(root, 'install.cmd')], { env, stdio: ['ignore', 2, 2] })
|
|
47
|
+
: spawnSync('sh', [path.join(root, 'install.sh')], { env, stdio: ['ignore', 2, 2] });
|
|
48
|
+
|
|
49
|
+
if (r.error || r.status !== 0 || !fs.existsSync(binaryPath)) {
|
|
50
|
+
fail(r.error ? r.error.message : `the installer exited with ${r.status}.`, env.AOS_VERSION);
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function fail(why, wanted) {
|
|
57
|
+
const v = wanted ? ` (version ${wanted})` : '';
|
|
58
|
+
process.stderr.write(
|
|
59
|
+
`\n@muthuishere/aos: could not install the aos binary${v}: ${why}\n` +
|
|
60
|
+
'Behind a proxy? Set HTTPS_PROXY (or npm config set https-proxy). Or install it manually:\n' +
|
|
61
|
+
` ${MANUAL}\n\n`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = { install, binaryPath };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// postinstall: fetch the binary now. Never fails the npm install -- if this is
|
|
2
|
+
// skipped (--ignore-scripts, pnpm, bun) or fails, bin/aos.js retries on first run.
|
|
3
|
+
'use strict';
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const { install, binaryPath } = require('./install');
|
|
6
|
+
|
|
7
|
+
if (!fs.existsSync(binaryPath)) install();
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muthuishere/aos",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Hands for your AI agent: one CLI to drive macOS, Windows and Linux (windows, mouse, keyboard, screenshots, files, processes, services).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://muthuishere.github.io/aos/",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/muthuishere/aos.git",
|
|
10
|
+
"directory": "npm"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/muthuishere/aos/issues",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"cli",
|
|
15
|
+
"automation",
|
|
16
|
+
"ai-agent",
|
|
17
|
+
"mcp",
|
|
18
|
+
"desktop",
|
|
19
|
+
"windows",
|
|
20
|
+
"macos",
|
|
21
|
+
"linux"
|
|
22
|
+
],
|
|
23
|
+
"bin": {
|
|
24
|
+
"aos": "bin/aos.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin/",
|
|
28
|
+
"lib/",
|
|
29
|
+
"install.sh",
|
|
30
|
+
"install.cmd"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"prepack": "node lib/copy-installers.js",
|
|
34
|
+
"postinstall": "node lib/postinstall.js"
|
|
35
|
+
},
|
|
36
|
+
"os": [
|
|
37
|
+
"darwin",
|
|
38
|
+
"linux",
|
|
39
|
+
"win32"
|
|
40
|
+
],
|
|
41
|
+
"cpu": [
|
|
42
|
+
"x64",
|
|
43
|
+
"arm64"
|
|
44
|
+
],
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=16"
|
|
47
|
+
}
|
|
48
|
+
}
|