Skip to content

Commit 793488b

Browse files
authored
Merge pull request #3 from Blankeos/configuration
feat: add configurable runtime, remote client, and release packaging
2 parents 81aa430 + 8af180f commit 793488b

303 files changed

Lines changed: 87803 additions & 9632 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.devrefs/devrefs.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# DevRefs makes cloning/updating references for agents seamless and fast.
2+
# Edit this file directly, or use `devrefs add <id> <description>` to add entries.
3+
references:
4+
- id: ogulcancelik/herdr
5+
description: "Ratatui app with good scroll"
6+
remote: https://github.com/ogulcancelik/herdr.git
7+
branch: master
8+
- id: anomalyco/opencode
9+
description: "Main reference and preferred agent harness by the author, we wanted to rewrite it in rust w/ crabcode"
10+
remote: https://github.com/anomalyco/opencode.git
11+
branch: dev
12+
- id: openai/codex
13+
description: "a ratatui agent harness that we can use as reference, especially since it's by openai"
14+
remote: https://github.com/openai/codex.git
15+
branch: main

‎.github/dist-build-setup.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- name: Install Bun
2+
uses: oven-sh/setup-bun@v2
3+
- name: Build remote client
4+
shell: bash
5+
run: |
6+
cd remote-client
7+
bun install --frozen-lockfile
8+
bun run build
9+
- name: Verify remote client assets
10+
shell: bash
11+
run: test -s remote-client/dist/client/index.html

‎.github/workflows/release.yml‎

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
# This file was autogenerated by dist: https://axodotdev.github.io/cargo-dist
2+
#
3+
# Copyright 2022-2024, axodotdev
4+
# SPDX-License-Identifier: MIT or Apache-2.0
5+
#
6+
# CI that:
7+
#
8+
# * checks for a Git Tag that looks like a release
9+
# * builds artifacts with dist (archives, installers, hashes)
10+
# * uploads those artifacts to temporary workflow zip
11+
# * on success, uploads the artifacts to a GitHub Release
12+
#
13+
# Note that the GitHub Release will be created with a generated
14+
# title/body based on your changelogs.
15+
16+
name: Release
17+
permissions:
18+
"contents": "write"
19+
20+
# This task will run whenever you push a git tag that looks like a version
21+
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
22+
# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where
23+
# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION
24+
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
25+
#
26+
# If PACKAGE_NAME is specified, then the announcement will be for that
27+
# package (erroring out if it doesn't have the given version or isn't dist-able).
28+
#
29+
# If PACKAGE_NAME isn't specified, then the announcement will be for all
30+
# (dist-able) packages in the workspace with that version (this mode is
31+
# intended for workspaces with only one dist-able package, or with all dist-able
32+
# packages versioned/released in lockstep).
33+
#
34+
# If you push multiple tags at once, separate instances of this workflow will
35+
# spin up, creating an independent announcement for each one. However, GitHub
36+
# will hard limit this to 3 tags per commit, as it will assume more tags is a
37+
# mistake.
38+
#
39+
# If there's a prerelease-style suffix to the version, then the release(s)
40+
# will be marked as a prerelease.
41+
on:
42+
pull_request:
43+
push:
44+
tags:
45+
- '**[0-9]+.[0-9]+.[0-9]+*'
46+
47+
jobs:
48+
# Run 'dist plan' (or host) to determine what tasks we need to do
49+
plan:
50+
runs-on: "ubuntu-22.04"
51+
outputs:
52+
val: ${{ steps.plan.outputs.manifest }}
53+
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
54+
tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
55+
publishing: ${{ !github.event.pull_request }}
56+
env:
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
steps:
59+
- uses: actions/checkout@v4
60+
with:
61+
persist-credentials: false
62+
submodules: recursive
63+
- name: Install dist
64+
# we specify bash to get pipefail; it guards against the `curl` command
65+
# failing. otherwise `sh` won't catch that `curl` returned non-0
66+
shell: bash
67+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.3/cargo-dist-installer.sh | sh"
68+
- name: Cache dist
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: cargo-dist-cache
72+
path: ~/.cargo/bin/dist
73+
# sure would be cool if github gave us proper conditionals...
74+
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
75+
# functionality based on whether this is a pull_request, and whether it's from a fork.
76+
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
77+
# but also really annoying to build CI around when it needs secrets to work right.)
78+
- id: plan
79+
run: |
80+
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
81+
echo "dist ran successfully"
82+
cat plan-dist-manifest.json
83+
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
84+
- name: "Upload dist-manifest.json"
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: artifacts-plan-dist-manifest
88+
path: plan-dist-manifest.json
89+
90+
# Build and packages all the platform-specific things
91+
build-local-artifacts:
92+
name: build-local-artifacts (${{ join(matrix.targets, ', ') }})
93+
# Let the initial task tell us to not run (currently very blunt)
94+
needs:
95+
- plan
96+
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
97+
strategy:
98+
fail-fast: false
99+
# Target platforms/runners are computed by dist in create-release.
100+
# Each member of the matrix has the following arguments:
101+
#
102+
# - runner: the github runner
103+
# - dist-args: cli flags to pass to dist
104+
# - install-dist: expression to run to install dist on the runner
105+
#
106+
# Typically there will be:
107+
# - 1 "global" task that builds universal installers
108+
# - N "local" tasks that build each platform's binaries and platform-specific installers
109+
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
110+
runs-on: ${{ matrix.runner }}
111+
container: ${{ matrix.container && matrix.container.image || null }}
112+
env:
113+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
115+
steps:
116+
- name: enable windows longpaths
117+
run: |
118+
git config --global core.longpaths true
119+
- uses: actions/checkout@v4
120+
with:
121+
persist-credentials: false
122+
submodules: recursive
123+
- name: Install Rust non-interactively if not already installed
124+
if: ${{ matrix.container }}
125+
run: |
126+
if ! command -v cargo > /dev/null 2>&1; then
127+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
128+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
129+
fi
130+
- name: "Install Bun"
131+
uses: "oven-sh/setup-bun@v2"
132+
- name: "Build remote client"
133+
run: |
134+
cd remote-client
135+
bun install --frozen-lockfile
136+
bun run build
137+
shell: "bash"
138+
- name: "Verify remote client assets"
139+
run: "test -s remote-client/dist/client/index.html"
140+
shell: "bash"
141+
- name: Install dist
142+
run: ${{ matrix.install_dist.run }}
143+
# Get the dist-manifest
144+
- name: Fetch local artifacts
145+
uses: actions/download-artifact@v4
146+
with:
147+
pattern: artifacts-*
148+
path: target/distrib/
149+
merge-multiple: true
150+
- name: Install dependencies
151+
run: |
152+
${{ matrix.packages_install }}
153+
- name: Build artifacts
154+
run: |
155+
# Actually do builds and make zips and whatnot
156+
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
157+
echo "dist ran successfully"
158+
- id: cargo-dist
159+
name: Post-build
160+
# We force bash here just because github makes it really hard to get values up
161+
# to "real" actions without writing to env-vars, and writing to env-vars has
162+
# inconsistent syntax between shell and powershell.
163+
shell: bash
164+
run: |
165+
# Parse out what we just built and upload it to scratch storage
166+
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
167+
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
168+
echo "EOF" >> "$GITHUB_OUTPUT"
169+
170+
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
171+
- name: "Upload artifacts"
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
175+
path: |
176+
${{ steps.cargo-dist.outputs.paths }}
177+
${{ env.BUILD_MANIFEST_NAME }}
178+
179+
# Build and package all the platform-agnostic(ish) things
180+
build-global-artifacts:
181+
needs:
182+
- plan
183+
- build-local-artifacts
184+
runs-on: "ubuntu-22.04"
185+
env:
186+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
187+
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
188+
steps:
189+
- uses: actions/checkout@v4
190+
with:
191+
persist-credentials: false
192+
submodules: recursive
193+
- name: Install cached dist
194+
uses: actions/download-artifact@v4
195+
with:
196+
name: cargo-dist-cache
197+
path: ~/.cargo/bin/
198+
- run: chmod +x ~/.cargo/bin/dist
199+
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
200+
- name: Fetch local artifacts
201+
uses: actions/download-artifact@v4
202+
with:
203+
pattern: artifacts-*
204+
path: target/distrib/
205+
merge-multiple: true
206+
- id: cargo-dist
207+
shell: bash
208+
run: |
209+
dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
210+
echo "dist ran successfully"
211+
212+
# Parse out what we just built and upload it to scratch storage
213+
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
214+
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
215+
echo "EOF" >> "$GITHUB_OUTPUT"
216+
217+
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
218+
- name: "Upload artifacts"
219+
uses: actions/upload-artifact@v4
220+
with:
221+
name: artifacts-build-global
222+
path: |
223+
${{ steps.cargo-dist.outputs.paths }}
224+
${{ env.BUILD_MANIFEST_NAME }}
225+
# Determines if we should publish/announce
226+
host:
227+
needs:
228+
- plan
229+
- build-local-artifacts
230+
- build-global-artifacts
231+
# Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine)
232+
if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
233+
env:
234+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
235+
runs-on: "ubuntu-22.04"
236+
outputs:
237+
val: ${{ steps.host.outputs.manifest }}
238+
steps:
239+
- uses: actions/checkout@v4
240+
with:
241+
persist-credentials: false
242+
submodules: recursive
243+
- name: Install cached dist
244+
uses: actions/download-artifact@v4
245+
with:
246+
name: cargo-dist-cache
247+
path: ~/.cargo/bin/
248+
- run: chmod +x ~/.cargo/bin/dist
249+
# Fetch artifacts from scratch-storage
250+
- name: Fetch artifacts
251+
uses: actions/download-artifact@v4
252+
with:
253+
pattern: artifacts-*
254+
path: target/distrib/
255+
merge-multiple: true
256+
- id: host
257+
shell: bash
258+
run: |
259+
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
260+
echo "artifacts uploaded and released successfully"
261+
cat dist-manifest.json
262+
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
263+
- name: "Upload dist-manifest.json"
264+
uses: actions/upload-artifact@v4
265+
with:
266+
# Overwrite the previous copy
267+
name: artifacts-dist-manifest
268+
path: dist-manifest.json
269+
# Create a GitHub Release while uploading all files to it
270+
- name: "Download GitHub Artifacts"
271+
uses: actions/download-artifact@v4
272+
with:
273+
pattern: artifacts-*
274+
path: artifacts
275+
merge-multiple: true
276+
- name: Cleanup
277+
run: |
278+
# Remove the granular manifests
279+
rm -f artifacts/*-dist-manifest.json
280+
- name: Create GitHub Release
281+
env:
282+
PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
283+
ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
284+
ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
285+
RELEASE_COMMIT: "${{ github.sha }}"
286+
run: |
287+
# Write and read notes from a file to avoid quoting breaking things
288+
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
289+
290+
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
291+
292+
announce:
293+
needs:
294+
- plan
295+
- host
296+
# use "always() && ..." to allow us to wait for all publish jobs while
297+
# still allowing individual publish jobs to skip themselves (for prereleases).
298+
# "host" however must run to completion, no skipping allowed!
299+
if: ${{ always() && needs.host.result == 'success' }}
300+
runs-on: "ubuntu-22.04"
301+
env:
302+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
303+
steps:
304+
- uses: actions/checkout@v4
305+
with:
306+
persist-credentials: false
307+
submodules: recursive

‎.gitignore‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,16 @@ src/themes/
33
!src/theme.json
44
!src/theme.json
55
app.log
6+
aisdk_debug.log
7+
sounds/complete.wav
8+
9+
_dev_reference1
10+
_dev_reference2
11+
.env
12+
node_modules
13+
remote-client/dist/assets.json
14+
remote-client/dist/client/.vite/
15+
remote-client/dist/server/
16+
.devrefs/references
17+
.benchmarks/
18+
benchmark-reports/

‎.ignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!_dev_reference1
2+
!_dev_reference2

0 commit comments

Comments
 (0)