-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.sh
More file actions
executable file
·225 lines (197 loc) · 6.82 KB
/
Copy pathsync.sh
File metadata and controls
executable file
·225 lines (197 loc) · 6.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#!/usr/bin/env bash
# Regenerate the ferrosa Homebrew formulae from the latest STABLE GitHub
# releases. Single source of truth: the committed Formula/*.rb files are always
# the output of this script, so they cannot drift from the real release assets.
#
# Brew tracks the *stable* channel only (the maintainer-promoted "latest"
# release), matching the curl installers at ferrosadb.com.
#
# Idempotent: only rewrites a formula when its resolved version/sha changes.
# Fails loud: a missing release, missing asset, or missing checksum aborts with
# a non-zero exit rather than emitting a half-built formula.
set -euo pipefail
cd "$(dirname "$0")/.."
die() { printf 'error: %s\n' "$*" >&2; exit 1; }
latest_stable() { # repo -> tag (e.g. v0.16.0)
local tag
tag=$(curl -fsSL "https://api.github.com/repos/$1/releases/latest" \
| sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p' | head -1)
[ -n "$tag" ] || die "no stable release for $1"
printf '%s' "$tag"
}
sha_for() { # repo tag asset -> sha256
local sums sha
sums=$(curl -fsSL "https://github.com/$1/releases/download/$2/SHA256SUMS") \
|| die "cannot fetch SHA256SUMS for $1 $2"
# Some release workflows (forge) emit "./name" in SHA256SUMS; normalize.
sha=$(printf '%s\n' "$sums" | awk -v a="$3" '{sub(/^\.\//, "", $2)} $2==a{print $1}')
[ -n "$sha" ] || die "no checksum for asset $3 in $1 $2"
printf '%s' "$sha"
}
write_ferrosa() {
local repo="ferrosadb/ferrosa" tag base
tag=$(latest_stable "$repo")
base="https://github.com/${repo}/releases/download/${tag}"
local mac_arm lin_arm lin_x86
mac_arm=$(sha_for "$repo" "$tag" "ferrosa-${tag}-aarch64-apple-darwin.tar.gz")
lin_arm=$(sha_for "$repo" "$tag" "ferrosa-${tag}-aarch64-unknown-linux-musl.tar.gz")
lin_x86=$(sha_for "$repo" "$tag" "ferrosa-${tag}-x86_64-unknown-linux-musl.tar.gz")
cat > Formula/ferrosa.rb <<RB
# typed: false
# frozen_string_literal: true
# Generated by scripts/sync.sh — do not edit by hand.
class Ferrosa < Formula
desc "Cassandra-compatible database engine with S3-backed storage"
homepage "https://ferrosadb.com"
license "Apache-2.0"
on_macos do
on_arm do
url "${base}/ferrosa-${tag}-aarch64-apple-darwin.tar.gz"
sha256 "${mac_arm}"
end
end
on_linux do
on_arm do
url "${base}/ferrosa-${tag}-aarch64-unknown-linux-musl.tar.gz"
sha256 "${lin_arm}"
end
on_intel do
url "${base}/ferrosa-${tag}-x86_64-unknown-linux-musl.tar.gz"
sha256 "${lin_x86}"
end
end
def install
bin.install "ferrosa"
bin.install "ferrosa-ctl"
(etc/"ferrosa").install "config/ferrosa.example.toml" if File.exist?("config/ferrosa.example.toml")
end
def caveats
<<~EOS
Ferrosa installed. A default config example is at:
#{etc}/ferrosa/ferrosa.example.toml
Start it manually:
FERROSA_CONFIG="#{etc}/ferrosa/ferrosa.example.toml" ferrosa
Brew tracks the stable channel. For nightlies use the curl installer:
curl -fsSL https://ferrosadb.com/install.sh | bash -s -- --channel nightly
EOS
end
test do
# The main \`ferrosa\` binary boots the server on any args; \`ferrosa-ctl\`
# is the CLI with a clean --version.
assert_match version.to_s, shell_output("#{bin}/ferrosa-ctl --version")
end
end
RB
echo "wrote Formula/ferrosa.rb (${tag})"
}
write_ferrosa_memory() {
local repo="ferrosadb/ferrosa-memory" tag base
tag=$(latest_stable "$repo")
base="https://github.com/${repo}/releases/download/${tag}"
local mac_arm lin_arm lin_x86
mac_arm=$(sha_for "$repo" "$tag" "ferrosa-memory-${tag}-aarch64-apple-darwin.tar.gz")
lin_arm=$(sha_for "$repo" "$tag" "ferrosa-memory-${tag}-aarch64-unknown-linux-musl.tar.gz")
lin_x86=$(sha_for "$repo" "$tag" "ferrosa-memory-${tag}-x86_64-unknown-linux-musl.tar.gz")
cat > Formula/ferrosa-memory.rb <<RB
# typed: false
# frozen_string_literal: true
# Generated by scripts/sync.sh — do not edit by hand.
class FerrosaMemory < Formula
desc "Memory/knowledge-graph MCP server backed by Ferrosa"
homepage "https://ferrosadb.com"
license "Apache-2.0"
on_macos do
on_arm do
url "${base}/ferrosa-memory-${tag}-aarch64-apple-darwin.tar.gz"
sha256 "${mac_arm}"
end
end
on_linux do
on_arm do
url "${base}/ferrosa-memory-${tag}-aarch64-unknown-linux-musl.tar.gz"
sha256 "${lin_arm}"
end
on_intel do
url "${base}/ferrosa-memory-${tag}-x86_64-unknown-linux-musl.tar.gz"
sha256 "${lin_x86}"
end
end
def install
bin.install "ferrosa-memory-mcp"
# Native setup CLI (\`ferrosa-memory\`) — ships in releases after v0.16.x.
bin.install "ferrosa-memory" if File.exist?("ferrosa-memory")
(etc/"ferrosa").install "config/ferrosa-memory.example.toml" if File.exist?("config/ferrosa-memory.example.toml")
end
def caveats
<<~EOS
ferrosa-memory-mcp installed. It connects to a running Ferrosa instance
at localhost:9042 — install Ferrosa first:
brew install ferrosadb/tap/ferrosa
Register with Claude Code by adding to your MCP config:
{
"mcpServers": {
"ferrosa-memory": {
"command": "#{bin}/ferrosa-memory-mcp",
"env": { "FERROSA_MEMORY_CONFIG": "#{etc}/ferrosa/ferrosa-memory.example.toml" }
}
}
}
EOS
end
test do
# ferrosa-memory-mcp is a stdio MCP server with no --version flag; just
# assert it landed. The native setup CLI has a clean --help when present.
assert_predicate bin/"ferrosa-memory-mcp", :executable?
assert_match "setup", shell_output("#{bin}/ferrosa-memory --help 2>&1") if (bin/"ferrosa-memory").exist?
end
end
RB
echo "wrote Formula/ferrosa-memory.rb (${tag})"
}
write_forge() {
local repo="ferrosadb/forge" tag base
tag=$(latest_stable "$repo")
base="https://github.com/${repo}/releases/download/${tag}"
local mac_arm lin_x86
mac_arm=$(sha_for "$repo" "$tag" "frg-macos-aarch64.tar.gz")
lin_x86=$(sha_for "$repo" "$tag" "frg-linux-x86_64.tar.gz")
cat > Formula/forge.rb <<RB
# typed: false
# frozen_string_literal: true
# Generated by scripts/sync.sh — do not edit by hand.
class Forge < Formula
desc "Developer tooling CLI (frg) and MCP server for the Ferrosa suite"
homepage "https://github.com/ferrosadb/forge"
version "${tag#v}"
license "Apache-2.0"
on_macos do
on_arm do
url "${base}/frg-macos-aarch64.tar.gz"
sha256 "${mac_arm}"
end
end
on_linux do
on_intel do
url "${base}/frg-linux-x86_64.tar.gz"
sha256 "${lin_x86}"
end
end
def install
bin.install "frg"
end
def caveats
<<~EOS
The forge CLI is installed as \`frg\`. Run \`frg --help\` for commands.
EOS
end
test do
assert_match version.to_s, shell_output("#{bin}/frg --version")
end
end
RB
echo "wrote Formula/forge.rb (${tag})"
}
write_ferrosa
write_ferrosa_memory
write_forge
echo "done."