Skip to content

Commit 8c6038c

Browse files
committed
initial release: sf — terminal file manager written in ARO
Midnight Commander-style dual-panel file manager with keyboard navigation, file preview, and directory browsing. Includes CI/CD pipeline with signed macOS builds and Homebrew tap support.
0 parents  commit 8c6038c

9 files changed

Lines changed: 852 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 323 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,323 @@
1+
name: Build & Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['*']
7+
pull_request:
8+
branches: [main]
9+
10+
env:
11+
ARO_VERSION: latest
12+
13+
jobs:
14+
# ===========================================================================
15+
# Check — syntax-check on both platforms
16+
# ===========================================================================
17+
check:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- os: ubuntu-22.04
23+
asset: aro-linux-amd64.tar.gz
24+
- os: macos-latest
25+
asset: aro-macos-arm64.tar.gz
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Install dependencies (Linux)
32+
if: runner.os == 'Linux'
33+
run: |
34+
sudo apt-get update -qq
35+
sudo apt-get install -y -qq libgit2-dev
36+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
37+
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee /etc/apt/sources.list.d/llvm.list
38+
sudo apt-get update -qq
39+
sudo apt-get install -y -qq libllvm20
40+
41+
- name: Install ARO (Linux)
42+
if: runner.os == 'Linux'
43+
run: |
44+
if [ "$ARO_VERSION" = "latest" ]; then
45+
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/arolang/aro/releases/latest \
46+
| grep "browser_download_url.*${{ matrix.asset }}" \
47+
| cut -d '"' -f 4)
48+
else
49+
DOWNLOAD_URL="https://github.com/arolang/aro/releases/download/${ARO_VERSION}/${{ matrix.asset }}"
50+
fi
51+
curl -fsSL "$DOWNLOAD_URL" | tar xz
52+
sudo mv aro /usr/local/bin/
53+
sudo mv libARORuntime.a /usr/local/lib/
54+
aro --version
55+
56+
- name: Install ARO (macOS)
57+
if: runner.os == 'macOS'
58+
run: |
59+
brew tap arolang/aro
60+
brew install aro libgit2 llvm@20
61+
aro --version
62+
63+
- name: Check code
64+
run: aro check .
65+
66+
# ===========================================================================
67+
# Build — compile for macOS (signed) and Linux
68+
# ===========================================================================
69+
build-linux:
70+
needs: check
71+
runs-on: ubuntu-22.04
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
76+
- name: Install dependencies
77+
run: |
78+
sudo apt-get update -qq
79+
sudo apt-get install -y -qq libgit2-dev
80+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
81+
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee /etc/apt/sources.list.d/llvm.list
82+
sudo apt-get update -qq
83+
sudo apt-get install -y -qq libllvm20
84+
85+
- name: Install ARO
86+
run: |
87+
if [ "$ARO_VERSION" = "latest" ]; then
88+
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/arolang/aro/releases/latest \
89+
| grep "browser_download_url.*aro-linux-amd64.tar.gz" \
90+
| cut -d '"' -f 4)
91+
else
92+
DOWNLOAD_URL="https://github.com/arolang/aro/releases/download/${ARO_VERSION}/aro-linux-amd64.tar.gz"
93+
fi
94+
curl -fsSL "$DOWNLOAD_URL" | tar xz
95+
sudo mv aro /usr/local/bin/
96+
sudo mv libARORuntime.a /usr/local/lib/
97+
98+
- name: Build
99+
run: aro build . --optimize --strip --size -o sf
100+
101+
- name: Upload artifact
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: sf-linux-amd64
105+
path: sf
106+
107+
build-macos:
108+
needs: check
109+
runs-on: macos-latest
110+
steps:
111+
- name: Checkout repository
112+
uses: actions/checkout@v4
113+
114+
- name: Install ARO
115+
run: |
116+
brew tap arolang/aro
117+
brew install aro libgit2 llvm@20
118+
119+
- name: Import Code Signing Certificate
120+
if: github.ref_type == 'tag'
121+
env:
122+
APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
123+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
124+
run: |
125+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
126+
KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
127+
128+
echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > certificate.p12
129+
130+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
131+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
132+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
133+
134+
security import certificate.p12 \
135+
-P "$APPLE_CERTIFICATE_PASSWORD" \
136+
-A \
137+
-t cert \
138+
-f pkcs12 \
139+
-k $KEYCHAIN_PATH
140+
141+
security list-keychain -d user -s $KEYCHAIN_PATH
142+
security set-key-partition-list \
143+
-S apple-tool:,apple: \
144+
-s \
145+
-k "$KEYCHAIN_PASSWORD" \
146+
$KEYCHAIN_PATH
147+
148+
rm certificate.p12
149+
150+
- name: Build (signed)
151+
if: github.ref_type == 'tag'
152+
env:
153+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
154+
run: |
155+
aro build . --sign "$APPLE_TEAM_ID" --optimize --strip --size -o sf
156+
codesign --verify --verbose sf
157+
158+
- name: Build (unsigned)
159+
if: github.ref_type != 'tag'
160+
run: aro build . --optimize --strip --size -o sf
161+
162+
- name: Notarize Binary
163+
if: github.ref_type == 'tag'
164+
env:
165+
APPLE_ID: ${{ secrets.APPLE_ID }}
166+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
167+
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
168+
run: |
169+
zip -r sf.zip sf
170+
xcrun notarytool submit sf.zip \
171+
--apple-id "$APPLE_ID" \
172+
--team-id "$APPLE_TEAM_ID" \
173+
--password "$APPLE_APP_PASSWORD" \
174+
--wait
175+
# Staple may fail for CLI tools — that's OK
176+
xcrun stapler staple sf || true
177+
178+
- name: Upload artifact
179+
uses: actions/upload-artifact@v4
180+
with:
181+
name: sf-macos-arm64
182+
path: sf
183+
184+
# ===========================================================================
185+
# Release — create GitHub release on tag push
186+
# ===========================================================================
187+
release:
188+
name: Create Release
189+
needs: [build-linux, build-macos]
190+
runs-on: ubuntu-latest
191+
if: github.ref_type == 'tag'
192+
permissions:
193+
contents: write
194+
steps:
195+
- name: Checkout repository
196+
uses: actions/checkout@v4
197+
198+
- name: Download all artifacts
199+
uses: actions/download-artifact@v4
200+
with:
201+
path: artifacts
202+
203+
- name: Package release assets
204+
run: |
205+
cd artifacts/sf-linux-amd64
206+
chmod +x sf
207+
tar -czvf ../sf-linux-amd64.tar.gz sf
208+
cd ../..
209+
210+
cd artifacts/sf-macos-arm64
211+
chmod +x sf
212+
tar -czvf ../sf-macos-arm64.tar.gz sf
213+
cd ../..
214+
215+
- name: Extract version from tag
216+
id: version
217+
run: |
218+
VERSION="${{ github.ref_name }}"
219+
VERSION="${VERSION#v}"
220+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
221+
222+
- name: Create GitHub Release
223+
uses: softprops/action-gh-release@v2
224+
with:
225+
name: sf ${{ steps.version.outputs.version }}
226+
draft: false
227+
prerelease: ${{ contains(github.ref_name, '-') }}
228+
generate_release_notes: true
229+
files: |
230+
artifacts/sf-linux-amd64.tar.gz
231+
artifacts/sf-macos-arm64.tar.gz
232+
body: |
233+
## ShowFiles ${{ steps.version.outputs.version }}
234+
235+
A Midnight Commander-style terminal file manager written in ARO.
236+
237+
### Downloads
238+
239+
| Platform | Architecture | Download |
240+
|----------|--------------|----------|
241+
| macOS | Apple Silicon | [sf-macos-arm64.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/sf-macos-arm64.tar.gz) |
242+
| Linux | x86_64 | [sf-linux-amd64.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/sf-linux-amd64.tar.gz) |
243+
244+
### Installation
245+
246+
**macOS (Homebrew)**
247+
```bash
248+
brew tap arolang/applications
249+
brew install sf
250+
```
251+
252+
**macOS (Manual)**
253+
```bash
254+
curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/sf-macos-arm64.tar.gz | tar xz
255+
sudo mv sf /usr/local/bin/
256+
```
257+
258+
**Linux**
259+
```bash
260+
curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/sf-linux-amd64.tar.gz | tar xz
261+
sudo mv sf /usr/local/bin/
262+
```
263+
264+
# ======================================================================
265+
# Update Homebrew Formula
266+
# ======================================================================
267+
- name: Update Homebrew Formula
268+
continue-on-error: true
269+
env:
270+
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
271+
run: |
272+
SHA256_MACOS=$(shasum -a 256 artifacts/sf-macos-arm64.tar.gz | awk '{print $1}')
273+
SHA256_LINUX=$(shasum -a 256 artifacts/sf-linux-amd64.tar.gz | awk '{print $1}')
274+
VERSION="${{ steps.version.outputs.version }}"
275+
REPO="${{ github.repository }}"
276+
TAG="${{ github.ref_name }}"
277+
278+
echo "Version: $VERSION"
279+
echo "SHA256 macOS: $SHA256_MACOS"
280+
echo "SHA256 Linux: $SHA256_LINUX"
281+
282+
git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/arolang/homebrew-applications.git
283+
cd homebrew-applications
284+
mkdir -p Formula
285+
286+
{
287+
echo 'class Sf < Formula'
288+
echo ' desc "Midnight Commander-style terminal file manager written in ARO"'
289+
echo " homepage \"https://github.com/${REPO}\""
290+
echo " version \"${VERSION}\""
291+
echo ' license "MIT"'
292+
echo ''
293+
echo ' on_macos do'
294+
echo ' depends_on arch: :arm64'
295+
echo " url \"https://github.com/${REPO}/releases/download/${TAG}/sf-macos-arm64.tar.gz\""
296+
echo " sha256 \"${SHA256_MACOS}\""
297+
echo ' end'
298+
echo ''
299+
echo ' on_linux do'
300+
echo " url \"https://github.com/${REPO}/releases/download/${TAG}/sf-linux-amd64.tar.gz\""
301+
echo " sha256 \"${SHA256_LINUX}\""
302+
echo ' end'
303+
echo ''
304+
echo ' def install'
305+
echo ' bin.install "sf"'
306+
echo ' end'
307+
echo ''
308+
echo ' test do'
309+
echo ' assert_match version.to_s, shell_output("#{bin}/sf --version")'
310+
echo ' end'
311+
echo 'end'
312+
} > Formula/sf.rb
313+
314+
git config user.name "github-actions[bot]"
315+
git config user.email "github-actions[bot]@users.noreply.github.com"
316+
317+
git add Formula/sf.rb
318+
if git diff --staged --quiet; then
319+
echo "No changes to formula"
320+
else
321+
git commit -m "chore: update sf to version ${VERSION}"
322+
git push https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/arolang/homebrew-applications.git main
323+
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/sf
2+
/.idea
3+
/.DS_Store

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# ShowFiles (sf)
2+
3+
A Midnight Commander-style terminal file manager written in [ARO](https://arolang.github.io/aro/).
4+
5+
![ShowFiles screenshot](assets/screen.jpg)
6+
7+
## Features
8+
9+
- Dual-panel layout: file list on the left, file preview on the right
10+
- Navigate with arrow keys (up/down to select, Enter to open directories)
11+
- Scrollable file list and preview panel
12+
- Streams only the first bytes of files for fast previews
13+
14+
## Installation
15+
16+
**macOS (Homebrew)**
17+
```bash
18+
brew tap arolang/applications
19+
brew install sf
20+
```
21+
22+
**Linux / macOS (Manual)**
23+
24+
Download the latest release from the [Releases](https://github.com/arolang/ShowFiles/releases) page, extract, and move to your PATH:
25+
```bash
26+
sudo mv sf /usr/local/bin/
27+
```
28+
29+
## Building from Source
30+
31+
Requires the ARO toolchain (`aro` CLI). Install it via `brew tap arolang/aro && brew install aro` or from [GitHub releases](https://github.com/arolang/aro/releases).
32+
33+
```bash
34+
# Syntax check
35+
aro check .
36+
37+
# Run directly (interpreter mode)
38+
aro run .
39+
40+
# Compile to native binary
41+
aro build . --optimize
42+
```
43+
44+
The compiled binary is placed in `.build/`.
45+
46+
## Project Structure
47+
48+
```
49+
sf/
50+
├── main.aro # Application startup and initial state
51+
├── handlers.aro # Keyboard input handlers
52+
├── observer.aro # Repository observers (reactive UI rendering)
53+
├── openapi.yaml # Schema definitions for UIState and FileItem
54+
└── templates/
55+
└── display.screen # Terminal screen template
56+
```

assets/screen.jpg

547 KB
Loading

0 commit comments

Comments
 (0)