Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
target/
.git/
tmp/
.env
projects/
.claude/
.idea/
**/.DS_Store
crates/web/dist/
crates/ios/host/build/
crates/ios/host/lib/
crates/ios/host/*.xcodeproj/
crates/android/host/.gradle/
crates/android/host/build/
crates/android/host/app/build/
crates/android/host/app/src/main/jniLibs/
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/crates/headless/container/entrypoint.sh text eol=lf
/crates/headless/container/profile.sh text eol=lf
/crates/web/build.sh text eol=lf
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches: [main]
pull_request:
# Pull requests opened with GITHUB_TOKEN start no pull_request run; the
# agent-version workflow dispatches one instead.
workflow_dispatch:

permissions:
contents: read
Expand Down Expand Up @@ -77,6 +80,47 @@ jobs:
- name: Run Clippy
run: cargo clippy --workspace --all-targets --locked -- -D warnings

# The container image runs tcode-headless with the browser bundle built
# in. Release publishing builds both with fat LTO and smoke-tests the
# images; here the bundle only has to build and the binary pass Clippy.
- name: Read the locked wasm-bindgen version
id: wasm-bindgen
if: runner.os == 'Linux'
run: echo "version=$(sed -n '/^name = "wasm-bindgen"$/{n;s/^version = "\(.*\)"$/\1/p;q;}' Cargo.lock)" >> "$GITHUB_OUTPUT"

- name: Install wasm-bindgen
if: runner.os == 'Linux'
uses: taiki-e/install-action@v2
with:
tool: wasm-bindgen@${{ steps.wasm-bindgen.outputs.version }}

- name: Build the browser bundle
if: runner.os == 'Linux'
env:
CARGO_PROFILE_RELEASE_LTO: 'off'
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '256'
CARGO_PROFILE_RELEASE_OPT_LEVEL: '0'
run: |
rustup target add wasm32-unknown-unknown
crates/web/build.sh

- name: Run Clippy on the container's headless host
if: runner.os == 'Linux'
run: cargo clippy -p tcode-headless --features web --all-targets --locked -- -D warnings

- uses: actions/setup-node@v7
if: runner.os == 'Linux'
with:
node-version: '24'

- name: Check the container scripts and Compose files
if: runner.os == 'Linux'
run: |
shellcheck crates/headless/container/*.sh
for script in crates/headless/container/*.mjs; do node --check "$script"; done
TCODE_PASSWORD=ci docker compose config --quiet
docker compose -f crates/traverse-server/docker-compose.yml config --quiet

linux-tests:
name: Linux x64 / tests
runs-on: ubuntu-24.04
Expand Down
214 changes: 198 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ concurrency:
group: release-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
cancel-in-progress: false

# Tag-scoped Cargo caches cannot warm the next release and evict the main CI
# caches from the shared Actions quota.
# Tag-scoped caches, Cargo's or Docker's, cannot warm the next release and
# evict the main CI caches from the shared Actions quota.
jobs:
setup:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -354,6 +354,19 @@ jobs:
produced. `SHA256SUMS.txt` is added after every platform package has finished.
NOTES

# macOS runners run bash 3.2, which has no ${var,,}.
image_repo="$(printf '%s' "$REPOSITORY" | tr '[:upper:]' '[:lower:]')"
{
printf '\n## Docker (Linux amd64 / arm64)\n\n'
printf 'Images: `ghcr.io/%s-headless:%s` and `ghcr.io/%s-traverse:%s`. The agent CLIs named in `TCODE_AGENTS` (all six by default) install into the data volume on first start.\n\n' \
"$image_repo" "$VERSION" "$image_repo" "$VERSION"
printf 'Save this as `docker-compose.yml`, set `TCODE_PASSWORD` in `.env`, then run `docker compose up -d`. Set `TCODE_VERSION=%s` in `.env` to pin this release.\n\n' "$VERSION"
printf 'Container login methods and NAS setup: https://github.com/%s/blob/%s/docs/docker.md\n\n' "$REPOSITORY" "$RELEASE_TAG"
printf '```yaml\n'
cat docker-compose.yml
printf '```\n'
} >> "$notes_file"

release_args=(
"$RELEASE_TAG"
--repo "$REPOSITORY"
Expand Down Expand Up @@ -411,24 +424,12 @@ jobs:

- name: Install wasm tools
run: |
cargo install wasm-bindgen-cli --version 0.2.127 --locked
cargo install wasm-bindgen-cli --locked --version "$(sed -n '/^name = "wasm-bindgen"$/{n;s/^version = "\(.*\)"$/\1/p;q;}' Cargo.lock)"
sudo apt-get update
sudo apt-get install -y --no-install-recommends binaryen

- name: Build browser bundle
run: |
set -euo pipefail
cargo build -p tcode-web --target wasm32-unknown-unknown --release --locked
mkdir -p crates/web/dist
wasm-bindgen --target web --out-dir crates/web/dist --out-name tcode_web \
target/wasm32-unknown-unknown/release/tcode_web.wasm
wasm-opt -Oz --enable-bulk-memory --enable-nontrapping-float-to-int \
--enable-sign-ext --enable-mutable-globals --enable-reference-types --enable-multivalue \
crates/web/dist/tcode_web_bg.wasm \
-o crates/web/dist/tcode_web_bg.optimized.wasm
mv crates/web/dist/tcode_web_bg.optimized.wasm crates/web/dist/tcode_web_bg.wasm
cp crates/web/static/index.html crates/web/static/auth.mjs crates/web/dist/
ls -lh crates/web/dist
run: crates/web/build.sh

- name: Upload browser bundle
uses: actions/upload-artifact@v7
Expand Down Expand Up @@ -642,6 +643,180 @@ jobs:
if-no-files-found: error
retention-days: 14

container-images:
name: Container images ${{ matrix.arch }}
needs: [setup, package-headless, package-traverse]
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
id-token: write
attestations: write
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
archive_arch: x64
os: ubuntu-24.04
- arch: arm64
archive_arch: arm64
os: ubuntu-24.04-arm
env:
VERSION: ${{ needs.setup.outputs.version }}
ARCH: ${{ matrix.arch }}
CARGO_PROFILE_DEV_DEBUG: 0
steps:
- uses: actions/checkout@v7
with:
ref: ${{ needs.setup.outputs.tag }}

- uses: actions/download-artifact@v8
with:
pattern: package-*-linux-${{ matrix.archive_arch }}
path: archives
merge-multiple: true

- name: Stage release binaries and image names
env:
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
mkdir -p "dist/$ARCH"
for binary in tcode-headless tcode-traverse; do
tar -xzf "archives/$binary-$VERSION-linux-${{ matrix.archive_arch }}.tar.gz" -C "dist/$ARCH"
done
echo "HEADLESS_IMAGE=ghcr.io/${REPOSITORY,,}-headless" >> "$GITHUB_ENV"
echo "TRAVERSE_IMAGE=ghcr.io/${REPOSITORY,,}-traverse" >> "$GITHUB_ENV"
echo "REVISION=$(git rev-parse HEAD)" >> "$GITHUB_ENV"

- uses: dtolnay/rust-toolchain@stable

- name: Install pairing probe build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang cmake pkg-config libssl-dev libzstd-dev

- name: Build native container pairing probe
run: cargo build -p tcode-traverse --example pair_and_query --locked

- uses: actions/setup-node@v7
with:
node-version: '24'

- uses: docker/setup-buildx-action@v4

- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build headless image
uses: docker/build-push-action@v7
with:
context: .
file: crates/headless/Dockerfile
build-args: BINARY_SOURCE=release
load: true
tags: ${{ env.HEADLESS_IMAGE }}:${{ env.VERSION }}-${{ env.ARCH }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.version=${{ env.VERSION }}
org.opencontainers.image.revision=${{ env.REVISION }}

- name: Build Traverse image
uses: docker/build-push-action@v7
with:
context: .
file: crates/traverse-server/Dockerfile
build-args: BINARY_SOURCE=release
load: true
tags: ${{ env.TRAVERSE_IMAGE }}:${{ env.VERSION }}-${{ env.ARCH }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.version=${{ env.VERSION }}
org.opencontainers.image.revision=${{ env.REVISION }}

- name: Verify containers before publishing
run: |
node crates/headless/container/smoke.mjs \
"$HEADLESS_IMAGE:$VERSION-$ARCH" \
"$PWD/target/debug/examples/pair_and_query" "$TRAVERSE_IMAGE:$VERSION-$ARCH"

- uses: anchore/sbom-action/download-syft@v0.24.3
id: syft

- name: Push verified architecture images
id: push
env:
SYFT: ${{ steps.syft.outputs.cmd }}
run: |
set -euo pipefail
for entry in "headless=$HEADLESS_IMAGE:$VERSION-$ARCH" \
"traverse=$TRAVERSE_IMAGE:$VERSION-$ARCH"; do
name="${entry%%=*}"
image="${entry#*=}"
"$SYFT" scan "docker:$image" --output "spdx-json=$RUNNER_TEMP/$name.spdx.json"
docker push "$image"
echo "$name=$(docker inspect --format '{{index .RepoDigests 0}}' "$image" | cut -d@ -f2)" >> "$GITHUB_OUTPUT"
done

- uses: actions/attest@v4
with:
subject-name: ${{ env.HEADLESS_IMAGE }}
subject-digest: ${{ steps.push.outputs.headless }}
sbom-path: ${{ runner.temp }}/headless.spdx.json
push-to-registry: true

- uses: actions/attest@v4
with:
subject-name: ${{ env.TRAVERSE_IMAGE }}
subject-digest: ${{ steps.push.outputs.traverse }}
sbom-path: ${{ runner.temp }}/traverse.spdx.json
push-to-registry: true

publish-containers:
name: Publish ${{ matrix.image }}
needs: [setup, container-images]
runs-on: ubuntu-24.04
permissions:
packages: write
id-token: write
attestations: write
strategy:
matrix:
image: [headless, traverse]
steps:
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish the version tag and stable alias
id: manifest
env:
REPOSITORY: ${{ github.repository }}
VERSION: ${{ needs.setup.outputs.version }}
PRERELEASE: ${{ needs.setup.outputs.prerelease }}
run: |
set -euo pipefail
image="ghcr.io/${REPOSITORY,,}-${{ matrix.image }}"
tags=(--tag "$image:$VERSION")
if [[ "$PRERELEASE" == false ]]; then
tags+=(--tag "$image:latest")
fi
docker buildx imagetools create "${tags[@]}" \
"$image:$VERSION-amd64" "$image:$VERSION-arm64"
echo "image=$image" >> "$GITHUB_OUTPUT"
echo "digest=$(docker buildx imagetools inspect "$image:$VERSION" --format '{{json .Manifest}}' | jq -r .digest)" >> "$GITHUB_OUTPUT"
- uses: actions/attest-build-provenance@v4
with:
subject-name: ${{ steps.manifest.outputs.image }}
subject-digest: ${{ steps.manifest.outputs.digest }}
push-to-registry: true

package-android:
name: Android arm64
needs: setup
Expand Down Expand Up @@ -744,13 +919,20 @@ jobs:
needs: [setup, package, package-headless, package-traverse, package-android]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
ref: ${{ needs.setup.outputs.tag }}

- name: Download all packages
uses: actions/download-artifact@v8
with:
pattern: package-*
path: dist
merge-multiple: true

- name: Include Compose deployment template
run: cp docker-compose.yml dist/docker-compose.yml

- name: Show release files
run: ls -lh dist

Expand Down
27 changes: 16 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ is derived from it. **Process** is how to build, check and submit work.
5. **Remote access.** iroh, end to end encrypted, is the only transport for
native clients; the browser client is a direct-access HTTP entry on the
machine and does not use iroh. There is no automatic discovery: a device's
first contact with a machine is always its invitation, scanned or pasted.
An official service, **Traverse**, provides lookup and relay fallback: no
accounts, on by default, self-hostable, sees only ciphertext, and never
required — on a LAN, direct connections give the full product without it.
Abuse is limited without accounts: the relay forwards by destination id and
the machine rejects every peer it has not paired; lookup and relay
bandwidth are rate-limited per node and per IP; an invitation secret dies
after five failures on the machine, which is the only place it is ever
checked — the service never sees it; and no SLA is promised. Current status
first contact with a machine, or with a group of machines, is always an
invitation, scanned or pasted; a machine admits only devices it paired or
that a machine in its group admitted. An official service, **Traverse**,
provides lookup and relay fallback: no accounts, on by default,
self-hostable, sees only ciphertext, and never required — on a LAN, direct
connections give the full product without it. Abuse is limited without
accounts: the relay forwards by destination id and the machine rejects
every peer it has not admitted; lookup and relay bandwidth are rate-limited
per node and per IP; an invitation secret dies after five failures on the
machine, which is the only place it is ever checked — the service never
sees it; and no SLA is promised. Current status
and plan: [#376](https://github.com/Tryanks/tcode/issues/376).

6. **gpui-base is the infrastructure; no house UI principles.** Tcode follows
Expand Down Expand Up @@ -157,8 +159,11 @@ and blocking work goes through `Host::unblock`. A new approved site carries an
`allow(clippy::disallowed_methods)` with its reason.

CI also runs `cargo machete` to catch unused dependencies, and checks iOS, Android
and Web with `RUSTFLAGS='-D warnings'`. Use the commands and tool version in
[the workflow](.github/workflows/ci.yml) to reproduce those checks. Fix warnings
and Web with `RUSTFLAGS='-D warnings'`. On Linux it also builds the browser
bundle, runs Clippy on `tcode-headless --features web` (the container image's
binary) and checks the container scripts and Compose files. Use the commands and
tool version in [the workflow](.github/workflows/ci.yml) to reproduce those
checks. Fix warnings
at their source; a platform-specific lint exception needs a concrete reason at
the declaration. For a dependency imported under a different crate name, use
Cargo's `package` alias or machete's `renamed` metadata so unused imports remain
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading