Skip to content

Commit be89c20

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 be89c20

9 files changed

Lines changed: 844 additions & 0 deletions

File tree

.github/workflows/build.yml

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