Skip to content

Commit 2389584

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 2389584

9 files changed

Lines changed: 843 additions & 0 deletions

File tree

.github/workflows/build.yml

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