rea-agents 0.5.0 → 1.1.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 +40 -16
- package/dist/application/Doctor.js +4 -4
- package/dist/application/EnhancedTools.js +44 -36
- package/dist/application/EvidenceBundleFiles.js +4 -3
- package/dist/application/MacHopper.js +175 -0
- package/dist/application/Setup.js +83 -54
- package/dist/application/Upgrade.js +106 -0
- package/dist/cli.js +37 -3
- package/dist/contracts/toolContracts.js +3 -3
- package/dist/contracts/toolOutputSchemas.js +48 -10
- package/dist/domain/errors.js +26 -0
- package/dist/domain/hopperValues.js +2 -0
- package/dist/domain/runtimeVersion.js +8 -0
- package/dist/native/NativeMacOSProvider.js +2 -0
- package/install.sh +79 -164
- package/package.json +3 -4
package/install.sh
CHANGED
|
@@ -3,196 +3,111 @@ set -euo pipefail
|
|
|
3
3
|
|
|
4
4
|
PACKAGE="rea-agents"
|
|
5
5
|
REPOSITORY="morluto/rea"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
node_stage=""
|
|
11
|
-
node_backup=""
|
|
12
|
-
node_version=""
|
|
13
|
-
|
|
14
|
-
cleanup() {
|
|
15
|
-
if [[ -n "$temporary_directory" && -d "$temporary_directory" ]]; then
|
|
16
|
-
rm -rf -- "$temporary_directory"
|
|
17
|
-
fi
|
|
18
|
-
if [[ -n "$node_stage" && -e "$node_stage" ]]; then
|
|
19
|
-
rm -rf -- "$node_stage"
|
|
20
|
-
fi
|
|
21
|
-
if [[ -n "$node_backup" && -e "$node_backup" && ! -e "$node_destination" ]]; then
|
|
22
|
-
mv -- "$node_backup" "$node_destination"
|
|
23
|
-
fi
|
|
24
|
-
}
|
|
25
|
-
trap cleanup EXIT HUP INT TERM
|
|
6
|
+
version="${REA_VERSION:-}"
|
|
7
|
+
dry_run=false
|
|
8
|
+
start_setup=true
|
|
9
|
+
verbose=false
|
|
26
10
|
|
|
27
11
|
fail() {
|
|
28
12
|
printf 'REA installation failed: %s\n' "$1" >&2
|
|
29
13
|
exit 1
|
|
30
14
|
}
|
|
31
15
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
[[ "$major" =~ ^[0-9]+$ && "$minor" =~ ^[0-9]+$ ]] || return 1
|
|
39
|
-
((major > required_major || (major == required_major && minor >= required_minor)))
|
|
16
|
+
usage() {
|
|
17
|
+
cat <<'EOF'
|
|
18
|
+
Usage: install.sh [--version VERSION] [--dry-run] [--no-setup] [--no-prompt] [--verbose]
|
|
19
|
+
|
|
20
|
+
Installs only the REA CLI. Run `rea setup` separately to configure Hopper and coding agents.
|
|
21
|
+
EOF
|
|
40
22
|
}
|
|
41
23
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
24
|
+
while (($# > 0)); do
|
|
25
|
+
case "$1" in
|
|
26
|
+
--version)
|
|
27
|
+
(($# >= 2)) || fail "--version requires a value."
|
|
28
|
+
version="$2"
|
|
29
|
+
shift 2
|
|
30
|
+
;;
|
|
31
|
+
--dry-run)
|
|
32
|
+
dry_run=true
|
|
33
|
+
shift
|
|
34
|
+
;;
|
|
35
|
+
--no-setup|--no-prompt)
|
|
36
|
+
start_setup=false
|
|
37
|
+
shift
|
|
38
|
+
;;
|
|
39
|
+
--verbose)
|
|
40
|
+
verbose=true
|
|
41
|
+
shift
|
|
42
|
+
;;
|
|
43
|
+
--help|-h)
|
|
44
|
+
usage
|
|
45
|
+
exit 0
|
|
46
|
+
;;
|
|
47
|
+
*) fail "unknown option: $1" ;;
|
|
57
48
|
esac
|
|
58
|
-
|
|
59
|
-
fail "REA supports macOS and selected 64-bit Linux distributions."
|
|
60
|
-
fi
|
|
61
|
-
command -v curl >/dev/null 2>&1 || fail "curl is required."
|
|
62
|
-
command -v shasum >/dev/null 2>&1 || command -v sha256sum >/dev/null 2>&1 || fail "shasum or sha256sum is required."
|
|
49
|
+
done
|
|
63
50
|
|
|
64
|
-
if [[ "$
|
|
65
|
-
|
|
66
|
-
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || fail "Homebrew installation did not complete."
|
|
67
|
-
if [[ -x /opt/homebrew/bin/brew ]]; then
|
|
68
|
-
PATH="/opt/homebrew/bin:$PATH"
|
|
69
|
-
elif [[ -x /usr/local/bin/brew ]]; then
|
|
70
|
-
PATH="/usr/local/bin:$PATH"
|
|
71
|
-
fi
|
|
72
|
-
fi
|
|
73
|
-
if [[ "$platform" == "Darwin" ]]; then
|
|
74
|
-
command -v brew >/dev/null 2>&1 || fail "Homebrew is not available after installation."
|
|
51
|
+
if [[ "$verbose" == true ]]; then
|
|
52
|
+
set -x
|
|
75
53
|
fi
|
|
76
54
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
fi
|
|
84
|
-
if [[ "$node_compatible" != true ]]; then
|
|
85
|
-
if [[ "$platform" == "Darwin" ]]; then
|
|
86
|
-
brew install "$NODE_FORMULA" || fail "Node.js 24 installation failed."
|
|
87
|
-
node_prefix="$(brew --prefix "$NODE_FORMULA")" || fail "could not locate Node.js 24."
|
|
88
|
-
PATH="$node_prefix/bin:$PATH"
|
|
89
|
-
else
|
|
90
|
-
machine="$(uname -m)"
|
|
91
|
-
node_arch="$([[ "$machine" == "x86_64" ]] && printf 'x64' || printf 'arm64')"
|
|
92
|
-
node_archive="node-v${NODE_VERSION}-linux-${node_arch}.tar.xz"
|
|
93
|
-
node_base="https://nodejs.org/dist/v${NODE_VERSION}"
|
|
94
|
-
temporary_directory="$(mktemp -d "${TMPDIR:-/tmp}/rea-install.XXXXXX")" || fail "could not create a temporary directory."
|
|
95
|
-
curl -fsSL "$node_base/$node_archive" -o "$temporary_directory/$node_archive" || fail "Node.js download failed."
|
|
96
|
-
curl -fsSL "$node_base/SHASUMS256.txt" -o "$temporary_directory/SHASUMS256.txt" || fail "Node.js checksum download failed."
|
|
97
|
-
expected_checksum="$(awk -v archive="$node_archive" '$2 == archive { print $1 }' "$temporary_directory/SHASUMS256.txt")"
|
|
98
|
-
[[ "$expected_checksum" =~ ^[a-f0-9]{64}$ ]] || fail "Node.js checksum metadata was malformed."
|
|
99
|
-
if command -v shasum >/dev/null 2>&1; then
|
|
100
|
-
actual_checksum="$(shasum -a 256 "$temporary_directory/$node_archive" | awk '{ print $1 }')"
|
|
101
|
-
else
|
|
102
|
-
actual_checksum="$(sha256sum "$temporary_directory/$node_archive" | awk '{ print $1 }')"
|
|
103
|
-
fi
|
|
104
|
-
[[ "$actual_checksum" == "$expected_checksum" ]] || fail "Node.js checksum verification failed."
|
|
105
|
-
node_destination="$HOME/.local/share/rea/node"
|
|
106
|
-
node_stage="$HOME/.local/share/rea/node.new.$$"
|
|
107
|
-
node_backup="$HOME/.local/share/rea/node.backup.$$"
|
|
108
|
-
[[ ! -L "$node_destination" ]] || fail "refusing to replace a symlinked Node.js installation."
|
|
109
|
-
mkdir -p "$HOME/.local/share/rea"
|
|
110
|
-
rm -rf -- "$node_stage" "$node_backup"
|
|
111
|
-
mkdir "$node_stage"
|
|
112
|
-
tar -xJf "$temporary_directory/$node_archive" --strip-components=1 -C "$node_stage" || fail "Node.js extraction failed."
|
|
113
|
-
if [[ -e "$node_destination" ]]; then
|
|
114
|
-
mv -- "$node_destination" "$node_backup"
|
|
115
|
-
fi
|
|
116
|
-
if ! mv -- "$node_stage" "$node_destination"; then
|
|
117
|
-
[[ ! -e "$node_backup" ]] || mv -- "$node_backup" "$node_destination"
|
|
118
|
-
fail "Node.js installation replacement failed."
|
|
119
|
-
fi
|
|
120
|
-
node_stage=""
|
|
121
|
-
rm -rf -- "$node_backup"
|
|
122
|
-
node_backup=""
|
|
123
|
-
PATH="$node_destination/bin:$PATH"
|
|
124
|
-
fi
|
|
125
|
-
fi
|
|
55
|
+
platform="$(uname -s)"
|
|
56
|
+
[[ "$platform" == "Darwin" || "$platform" == "Linux" ]] || fail "REA supports macOS and selected 64-bit Linux distributions."
|
|
57
|
+
command -v curl >/dev/null 2>&1 || fail "curl is required."
|
|
58
|
+
command -v node >/dev/null 2>&1 || fail "Node.js 22.19+ or 24.11+ is required; install it from https://nodejs.org and retry."
|
|
59
|
+
command -v npm >/dev/null 2>&1 || fail "npm is required; install it with Node.js and retry."
|
|
60
|
+
|
|
126
61
|
node_version="$(node -p 'process.versions.node' 2>/dev/null || true)"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
npm_version="$(npm --version)"
|
|
132
|
-
if [[ ! "$npm_version" =~ ^11\. ]] || ! version_at_least "$npm_version" 11 16; then
|
|
133
|
-
if [[ "$platform" == "Linux" ]]; then
|
|
134
|
-
npm install --global --prefix "$HOME/.local" npm@11 || fail "npm 11 installation failed."
|
|
135
|
-
else
|
|
136
|
-
npm install --global npm@11 || fail "npm 11 installation failed."
|
|
137
|
-
fi
|
|
138
|
-
fi
|
|
139
|
-
npm_version="$(npm --version)"
|
|
140
|
-
if [[ ! "$npm_version" =~ ^11\. ]] || ! version_at_least "$npm_version" 11 16; then
|
|
141
|
-
fail "npm 11.16 or newer is not active on PATH."
|
|
62
|
+
IFS=. read -r node_major node_minor _node_patch <<<"$node_version"
|
|
63
|
+
[[ "$node_major" =~ ^[0-9]+$ && "$node_minor" =~ ^[0-9]+$ ]] || fail "could not determine the active Node.js version."
|
|
64
|
+
if ! ((node_major == 22 && node_minor >= 19 || node_major >= 24)); then
|
|
65
|
+
fail "Node.js $node_version is unsupported; use Node.js 22.19+ or 24.11+."
|
|
142
66
|
fi
|
|
143
|
-
if
|
|
144
|
-
|
|
145
|
-
temporary_directory=""
|
|
67
|
+
if ((node_major == 24 && node_minor < 11)); then
|
|
68
|
+
fail "Node.js $node_version is unsupported; use Node.js 24.11 or newer."
|
|
146
69
|
fi
|
|
147
70
|
|
|
148
|
-
if [[ -n "$
|
|
149
|
-
|
|
150
|
-
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] || fail "REA_VERSION must be an exact semantic version."
|
|
71
|
+
if [[ -n "$version" ]]; then
|
|
72
|
+
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] || fail "version must be an exact semantic version."
|
|
151
73
|
else
|
|
152
|
-
release_json="$(curl -fsSL -H 'Accept: application/vnd.github+json' "https://api.github.com/repos/$REPOSITORY/releases/latest")" || fail "could not resolve the latest GitHub release."
|
|
74
|
+
release_json="$(curl -fsSL --proto '=https' --tlsv1.2 --retry 3 -H 'Accept: application/vnd.github+json' "https://api.github.com/repos/$REPOSITORY/releases/latest")" || fail "could not resolve the latest GitHub release."
|
|
153
75
|
tag="$(printf '%s' "$release_json" | node -e 'let s="";process.stdin.on("data",c=>s+=c).on("end",()=>{const v=JSON.parse(s).tag_name;if(typeof v!=="string")process.exit(1);process.stdout.write(v)})')" || fail "GitHub returned malformed release metadata."
|
|
154
76
|
[[ "$tag" =~ ^rea-agents-([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?)$ ]] || fail "latest release tag is not a valid rea-agents release."
|
|
155
77
|
version="${BASH_REMATCH[1]}"
|
|
156
78
|
fi
|
|
157
79
|
|
|
158
|
-
|
|
80
|
+
prefix_args=()
|
|
159
81
|
if [[ "$platform" == "Linux" ]]; then
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
npm install --global --prefix "$HOME/.local" "$PACKAGE@$version" || fail "npm package installation failed."
|
|
82
|
+
prefix_args=(--prefix "$HOME/.local")
|
|
83
|
+
install_bin="$HOME/.local/bin/rea"
|
|
163
84
|
else
|
|
164
|
-
npm
|
|
85
|
+
npm_prefix="$(npm prefix --global)" || fail "could not determine the npm global prefix."
|
|
86
|
+
install_bin="$npm_prefix/bin/rea"
|
|
165
87
|
fi
|
|
166
|
-
command -v rea >/dev/null 2>&1 || fail "the rea command is not available after installation."
|
|
167
|
-
installed_version="$(rea --version 2>/dev/null | tr -d '[:space:]')" || fail "could not read the installed REA version."
|
|
168
|
-
[[ "$installed_version" == "$version" ]] || fail "installed version $installed_version does not match $version."
|
|
169
88
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const fs = require("node:fs");
|
|
177
|
-
const [setupPath, doctorPath] = process.argv.slice(2);
|
|
178
|
-
try {
|
|
179
|
-
const setup = JSON.parse(fs.readFileSync(setupPath, "utf8"));
|
|
180
|
-
const doctor = JSON.parse(fs.readFileSync(doctorPath, "utf8"));
|
|
181
|
-
if (!Array.isArray(doctor.checks) || typeof doctor.healthy !== "boolean") process.exit(2);
|
|
182
|
-
if (setup.status !== "ready" && setup.status !== "needs_human") process.exit(2);
|
|
183
|
-
const activation = setup.actions.includes("installed_hopper");
|
|
184
|
-
if (!doctor.healthy && !activation) process.exit(3);
|
|
185
|
-
process.stdout.write(activation ? "activation" : "ready");
|
|
186
|
-
} catch { process.exit(2); }
|
|
187
|
-
NODE
|
|
188
|
-
)" || fail "setup or doctor reported an unhealthy required component or malformed output."
|
|
89
|
+
printf 'REA install plan\n'
|
|
90
|
+
printf ' Version: %s\n' "$version"
|
|
91
|
+
printf ' Runtime: Node.js %s\n' "$node_version"
|
|
92
|
+
printf ' Command: npm install --global %s@%s\n' "$PACKAGE" "$version"
|
|
93
|
+
printf ' Binary: %s\n' "$install_bin"
|
|
94
|
+
printf ' Setup: %s\n' "$([[ "$start_setup" == true ]] && printf 'start when a terminal is available' || printf 'skipped')"
|
|
189
95
|
|
|
190
|
-
if [[ "$
|
|
191
|
-
printf '
|
|
192
|
-
|
|
193
|
-
else
|
|
194
|
-
printf 'REA %s is installed and ready. Run rea doctor --json at any time.\n' "$version"
|
|
96
|
+
if [[ "$dry_run" == true ]]; then
|
|
97
|
+
printf 'Dry run complete; no changes made.\n'
|
|
98
|
+
exit 0
|
|
195
99
|
fi
|
|
196
|
-
|
|
197
|
-
|
|
100
|
+
|
|
101
|
+
printf 'Installing %s@%s...\n' "$PACKAGE" "$version"
|
|
102
|
+
npm install --global "${prefix_args[@]}" "$PACKAGE@$version" || fail "npm package installation failed."
|
|
103
|
+
[[ -x "$install_bin" ]] || fail "the rea command was not installed at $install_bin."
|
|
104
|
+
installed_version="$("$install_bin" --version 2>/dev/null | tr -d '[:space:]')" || fail "could not read the installed REA version."
|
|
105
|
+
[[ "$installed_version" == "$version" ]] || fail "installed version $installed_version does not match $version."
|
|
106
|
+
|
|
107
|
+
printf 'REA %s is installed.\n' "$version"
|
|
108
|
+
if [[ "$start_setup" == true && -r /dev/tty && -w /dev/tty && -t 1 ]]; then
|
|
109
|
+
printf 'Starting REA setup...\n'
|
|
110
|
+
"$install_bin" setup </dev/tty >/dev/tty
|
|
111
|
+
else
|
|
112
|
+
printf 'Run %s setup to configure Hopper and coding agents.\n' "$install_bin"
|
|
198
113
|
fi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rea-agents",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Reverse engineer anything from your terminal or coding agent with one CLI and MCP server.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
"rea": "scripts/rea.mjs"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=24.
|
|
37
|
-
"npm": ">=11.16.0 <12"
|
|
36
|
+
"node": "^22.19.0 || >=24.11.0"
|
|
38
37
|
},
|
|
39
38
|
"packageManager": "npm@11.16.0",
|
|
40
39
|
"files": [
|
|
@@ -99,7 +98,7 @@
|
|
|
99
98
|
"pino": "9.14.0",
|
|
100
99
|
"plist": "5.0.0",
|
|
101
100
|
"smol-toml": "^1.7.0",
|
|
102
|
-
"write-file-atomic": "
|
|
101
|
+
"write-file-atomic": "7.0.0",
|
|
103
102
|
"ws": "8.21.0",
|
|
104
103
|
"zod": "4.4.3"
|
|
105
104
|
},
|