Skip to content

Commit d6baec1

Browse files
committed
Merge branch 'claude/cli-repl'
# Conflicts: # src/runtime/cli/install_completions_command.rs
2 parents 7e66900 + ca05632 commit d6baec1

38 files changed

Lines changed: 3662 additions & 787 deletions

.buildkite/Dockerfile

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
ARG LLVM_VERSION="21"
2-
ARG REPORTED_LLVM_VERSION="21.1.8"
31
ARG OLD_BUN_VERSION="1.3.13"
42
ARG BUILDKITE_AGENT_TAGS="queue=linux,os=linux,arch=${TARGETARCH}"
53

64
FROM --platform=$BUILDPLATFORM ubuntu:20.04 as base-arm64
75
FROM --platform=$BUILDPLATFORM ubuntu:20.04 as base-amd64
86
FROM base-$TARGETARCH as base
97

10-
ARG LLVM_VERSION
118
ARG OLD_BUN_VERSION
129
ARG TARGETARCH
13-
ARG REPORTED_LLVM_VERSION
1410

1511
ENV DEBIAN_FRONTEND=noninteractive \
1612
CI=true \
@@ -35,7 +31,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3531
libgfortran5 libc6-dev \
3632
&& wget https://apt.llvm.org/llvm.sh \
3733
&& chmod +x llvm.sh \
38-
&& ./llvm.sh ${LLVM_VERSION} all \
34+
&& ./llvm.sh all \
35+
&& llvm_root="$(ls -d /usr/lib/llvm-* | sort -V | tail -n 1)" \
36+
&& ln -sfn "$llvm_root" /usr/lib/llvm \
3937
&& rm llvm.sh \
4038
&& rm -rf /var/lib/apt/lists/*
4139

@@ -75,22 +73,22 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
7573
&& echo "/usr/lib/${ARCH_PATH}" >> /etc/ld.so.conf.d/gcc-13.conf \
7674
&& ldconfig
7775

78-
RUN for f in /usr/lib/llvm-${LLVM_VERSION}/bin/*; do ln -sf "$f" /usr/bin; done \
79-
&& ln -sf /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang \
80-
&& ln -sf /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ \
81-
&& ln -sf /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld \
82-
&& ln -sf /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb \
83-
&& ln -sf /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd \
84-
&& ln -sf /usr/bin/llvm-ar-${LLVM_VERSION} /usr/bin/llvm-ar \
76+
RUN for f in /usr/lib/llvm/bin/*; do ln -sf "$f" /usr/bin; done \
77+
&& ln -sf /usr/lib/llvm/bin/clang /usr/bin/clang \
78+
&& ln -sf /usr/lib/llvm/bin/clang++ /usr/bin/clang++ \
79+
&& ln -sf /usr/lib/llvm/bin/lld /usr/bin/lld \
80+
&& ln -sf /usr/lib/llvm/bin/lldb /usr/bin/lldb \
81+
&& ln -sf /usr/lib/llvm/bin/clangd /usr/bin/clangd \
82+
&& ln -sf /usr/lib/llvm/bin/llvm-ar /usr/bin/llvm-ar \
8583
&& ln -sf /usr/bin/ld.lld /usr/bin/ld \
8684
&& ln -sf /usr/bin/clang /usr/bin/cc \
8785
&& ln -sf /usr/bin/clang++ /usr/bin/c++
8886

8987
ENV CC="clang" \
9088
CXX="clang++" \
91-
AR="llvm-ar-${LLVM_VERSION}" \
92-
RANLIB="llvm-ranlib-${LLVM_VERSION}" \
93-
LD="lld-${LLVM_VERSION}"
89+
AR="llvm-ar" \
90+
RANLIB="llvm-ranlib" \
91+
LD="ld.lld"
9492

9593
RUN --mount=type=tmpfs,target=/tmp \
9694
bash -c '\
@@ -112,8 +110,6 @@ RUN ARCH=$(if [ "$TARGETARCH" = "arm64" ]; then echo "arm64"; else echo "x64"; f
112110
| tar -xz -C /usr/local --strip-components=1 && \
113111
node --version
114112

115-
ENV LLVM_VERSION=${REPORTED_LLVM_VERSION}
116-
117113
WORKDIR /workspace
118114

119115

@@ -251,7 +247,6 @@ CMD ["bun", "/var/bun/scripts/agent.mjs", "start"]
251247

252248
FROM --platform=$BUILDPLATFORM base as bun-build-linux-local
253249

254-
ARG LLVM_VERSION
255250
WORKDIR /workspace/bun
256251

257252
COPY . /workspace/bun
@@ -268,9 +263,6 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
268263

269264
ENV PATH=/root/.cargo/bin:$PATH
270265

271-
ENV LLVM_VERSION=${REPORTED_LLVM_VERSION}
272-
273-
274266
RUN --mount=type=tmpfs,target=/workspace/bun/build \
275267
ls -la \
276268
&& bun run build:release \

.github/workflows/bun-integration.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ concurrency:
2525
env:
2626
BUN_VERSION: "1.3.2"
2727
CARGO_INCREMENTAL: "0"
28-
LLVM_VERSION_MAJOR: "21"
2928
RUSTUP_TOOLCHAIN: nightly-2026-07-20
3029

3130
jobs:
@@ -60,30 +59,27 @@ jobs:
6059
if: runner.os == 'Linux'
6160
shell: bash
6261
run: |
63-
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
64-
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc >/dev/null
65-
codename="$(lsb_release -cs)"
66-
echo \
67-
"deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${LLVM_VERSION_MAJOR} main" |
68-
sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null
6962
sudo apt-get update -qq
7063
sudo apt-get install -y -qq --no-install-recommends \
71-
clang-${LLVM_VERSION_MAJOR} \
7264
cmake \
7365
curl \
7466
golang \
67+
gnupg \
7568
libffi-dev \
7669
liblzma-dev \
7770
libtool \
78-
lld-${LLVM_VERSION_MAJOR} \
79-
llvm-${LLVM_VERSION_MAJOR} \
71+
lsb-release \
8072
ninja-build \
8173
pkg-config \
8274
ruby-full \
8375
software-properties-common \
8476
unzip \
8577
wget \
8678
xz-utils
79+
curl -fsSL https://apt.llvm.org/llvm.sh -o "$RUNNER_TEMP/llvm.sh"
80+
sudo bash "$RUNNER_TEMP/llvm.sh" all
81+
llvm_bin="$(ls -d /usr/lib/llvm-*/bin | sort -V | tail -n 1)"
82+
echo "$llvm_bin" >> "$GITHUB_PATH"
8783
8884
- name: Install Windows build dependencies
8985
if: runner.os == 'Windows'

CONTRIBUTING.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $ sudo pacman -S base-devel cmake git go libiconv libtool make ninja pkg-config
3535
```
3636

3737
```bash#Fedora
38-
$ sudo dnf install clang21 llvm21 lld21 cmake git golang libtool ninja-build pkg-config ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
38+
$ sudo dnf install clang llvm lld cmake git golang libtool ninja-build pkg-config ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
3939
```
4040

4141
```bash#openSUSE Tumbleweed
@@ -94,17 +94,17 @@ Our build scripts will automatically detect and use `ccache` if available. You c
9494

9595
## Install LLVM
9696

97-
Bun requires LLVM 21.1.8 (`clang` is part of LLVM). This version is enforced by the build system — mismatching versions will cause memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:
97+
Bun follows the current stable LLVM toolchain provided by your package source. The build only discovers the unversioned tools (`clang`, `clang++`, `ld.lld`, and the other `llvm-*` commands); it does not maintain fallbacks for older versioned release lines. In most cases, install LLVM through your system package manager:
9898

9999
{% codetabs group="os" %}
100100

101101
```bash#macOS (Homebrew)
102-
$ brew install llvm@21
102+
$ brew install llvm
103103
```
104104

105105
```bash#Ubuntu/Debian
106106
$ # LLVM has an automatic installation script that is compatible with all versions of Ubuntu
107-
$ wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 21 all
107+
$ wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- all
108108
```
109109

110110
```bash#Arch
@@ -116,17 +116,18 @@ $ sudo dnf install llvm clang lld-devel
116116
```
117117

118118
```bash#openSUSE Tumbleweed
119-
$ sudo zypper install clang21 lld21 llvm21
119+
$ sudo zypper install clang lld llvm
120120
```
121121

122122
{% /codetabs %}
123123

124-
If none of the above solutions apply, you will have to install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-21.1.8).
124+
If none of the above solutions apply, install the [latest stable LLVM release](https://github.com/llvm/llvm-project/releases/latest) manually.
125125

126-
Make sure Clang/LLVM 21 is in your path:
126+
Make sure the unversioned Clang command resolves to that toolchain:
127127

128128
```bash
129-
$ which clang-21
129+
$ command -v clang
130+
$ clang --version
130131
```
131132

132133
If not, run this to manually add it:
@@ -135,13 +136,13 @@ If not, run this to manually add it:
135136

136137
```bash#macOS (Homebrew)
137138
# use fish_add_path if you're using fish
138-
# use path+="$(brew --prefix llvm@21)/bin" if you are using zsh
139-
$ export PATH="$(brew --prefix llvm@21)/bin:$PATH"
139+
# use path+="$(brew --prefix llvm)/bin" if you are using zsh
140+
$ export PATH="$(brew --prefix llvm)/bin:$PATH"
140141
```
141142

142-
```bash#Arch
143-
# use fish_add_path if you're using fish
144-
$ export PATH="$PATH:/usr/lib/llvm21/bin"
143+
```bash#Ubuntu/Debian (apt.llvm.org)
144+
$ LLVM_BIN="$(ls -d /usr/lib/llvm-*/bin | sort -V | tail -n 1)"
145+
$ export PATH="$LLVM_BIN:$PATH"
145146
```
146147

147148
{% /codetabs %}
@@ -318,7 +319,7 @@ The issue may manifest when initially running `bun setup` as Clang being unable
318319
```
319320
The C++ compiler
320321
321-
"/usr/bin/clang++-21"
322+
"/usr/bin/clang++"
322323
323324
is not able to compile a simple test program.
324325
```

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,22 @@ The common project lifecycle should use one CLI:
5858
```text
5959
poly run app.ts # run a TypeScript entry point
6060
poly run tool.py # run a Python entry point
61+
poly repl python # start directly in Python REPL mode
6162
poly sync # resolve both ecosystems
6263
poly build app.ts # produce a standalone application
6364
```
6465

65-
`poly run` entry-point routing is part of the current prototype. Static
66-
cross-language imports, `poly sync`, and `poly build` are not implemented yet.
66+
`poly run` entry-point routing and the multi-language REPL are part of the
67+
current prototype. Static cross-language imports, `poly sync`, and `poly build`
68+
are not implemented yet.
69+
70+
REPL history is shared across languages. Recalling an entry from another mode
71+
shows it as an inline command such as `.py value = 42`, so it runs in the
72+
language where it was originally entered.
73+
74+
Interactive input uses language-specific syntax highlighting in JavaScript,
75+
Python, Shell, SQL, and C modes, including each language's strings, comments,
76+
numeric literals, keywords, and constructs such as expansions or preprocessors.
6777

6878
## One project, two ecosystems
6979

README.zh-CN.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,19 @@ import { python } from "poly";
5353
```text
5454
poly run app.ts # 运行 TypeScript 入口
5555
poly run tool.py # 运行 Python 入口
56+
poly repl python # 直接进入 Python REPL 模式
5657
poly sync # 解析两个生态的依赖
5758
poly build app.ts # 生成独立应用
5859
```
5960

60-
`poly run` 的入口分派属于当前原型。静态跨语言 import、`poly sync`
61-
`poly build` 尚未实现。
61+
`poly run` 的入口分派和多语言 REPL 属于当前原型。静态跨语言 import、
62+
`poly sync``poly build` 尚未实现。
63+
64+
REPL history 由所有语言共享。回看其他模式的记录时会显示为 `.py value = 42`
65+
这样的 inline 命令,从而仍在最初录入它的语言中执行。
66+
67+
JavaScript、Python、Shell、SQL 和 C 模式均提供各自的交互式语法高亮,包括该
68+
语言的字符串、注释、数值、关键字,以及变量展开或预处理指令等专有结构。
6269

6370
## 一个项目,两个生态
6471

docs/project/building-windows.mdx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ winget install "Visual Studio Community 2022" --override "--add Microsoft.Visual
3333

3434
After Visual Studio, you need the following:
3535

36-
- LLVM 21.1.8
36+
- The current stable LLVM release
3737
- Go
3838
- Rust (via rustup)
3939
- NASM
@@ -49,15 +49,13 @@ Use [Scoop](https://scoop.sh) to install these remaining tools.
4949
irm https://get.scoop.sh | iex
5050
scoop install nodejs-lts go rustup nasm ruby perl ccache
5151
# scoop seems to be buggy if you install llvm and the rest at the same time
52-
scoop install llvm@21.1.8
52+
scoop install llvm
5353
```
5454

55-
For Windows ARM64, download LLVM 21.1.8 directly from GitHub releases (first version with ARM64 Windows builds):
55+
For Windows ARM64, use Scoop's separate ARM64 LLVM manifest:
5656

5757
```ps1 ARM64
58-
# Download and install LLVM for ARM64
59-
Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/LLVM-21.1.8-woa64.exe" -OutFile "$env:TEMP\LLVM-21.1.8-woa64.exe"
60-
Start-Process -FilePath "$env:TEMP\LLVM-21.1.8-woa64.exe" -ArgumentList "/S" -Wait
58+
scoop install llvm-arm64
6159
```
6260

6361
<Note>
@@ -142,7 +140,7 @@ You can also build Windows binaries (both x64 and arm64) on a Linux host. The bu
142140

143141
### Prerequisites
144142

145-
1. The same LLVM version a native build uses (see `scripts/bootstrap.sh` `llvm_version_exact`), installed so that `clang-cl`, `lld-link`, `llvm-lib` and `llvm-rc` are available. On Debian/Ubuntu, `apt.llvm.org` packages provide all of them.
143+
1. The current stable LLVM toolchain, installed so the unversioned `clang-cl`, `lld-link`, `llvm-lib` and `llvm-rc` commands are available. On Debian/Ubuntu, `apt.llvm.org` packages provide all of them.
146144
2. `nasm` (only needed for Windows x64; BoringSSL's x64 assembly is NASM syntax).
147145
3. Rust std for the Windows targets (`rust-toolchain.toml` lists them; `rustup target add x86_64-pc-windows-msvc aarch64-pc-windows-msvc` if missing).
148146
4. A Windows sysroot: an [xwin](https://github.com/Jake-Shadle/xwin) splat of the MSVC CRT, Windows SDK, and ATL laid out like a Visual Studio install. Downloading these components means accepting Microsoft's license terms for them.

docs/project/contributing.mdx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ sudo pacman -S base-devel cmake git go libiconv libtool make ninja pkg-config py
3737
```
3838

3939
```bash Fedora
40-
sudo dnf install clang21 llvm21 lld21 cmake git golang libtool ninja-build pkg-config ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
40+
sudo dnf install clang llvm lld cmake git golang libtool ninja-build pkg-config ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
4141
```
4242

4343
```bash openSUSE Tumbleweed
@@ -96,17 +96,17 @@ The build scripts detect and use `ccache` automatically if it's available. Check
9696

9797
## Install LLVM
9898

99-
Bun requires LLVM 21.1.8 (`clang` is part of LLVM). The build system enforces this version: a mismatched version causes memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:
99+
Bun follows the current stable LLVM toolchain provided by your package source. The build only discovers the unversioned tools (`clang`, `clang++`, `ld.lld`, and the other `llvm-*` commands); it does not maintain fallbacks for older versioned release lines. In most cases, install LLVM through your system package manager:
100100

101101
<CodeGroup>
102102

103103
```bash macOS (Homebrew)
104-
brew install llvm@21
104+
brew install llvm
105105
```
106106

107107
```bash Ubuntu/Debian
108108
# LLVM has an automatic installation script that is compatible with all versions of Ubuntu
109-
wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 21 all
109+
wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- all
110110
```
111111

112112
```bash Arch
@@ -118,17 +118,18 @@ sudo dnf install llvm clang lld-devel
118118
```
119119

120120
```bash openSUSE Tumbleweed
121-
sudo zypper install clang21 lld21 llvm21
121+
sudo zypper install clang lld llvm
122122
```
123123

124124
</CodeGroup>
125125

126-
If none of these work, install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-21.1.8).
126+
If none of these work, install the [latest stable LLVM release](https://github.com/llvm/llvm-project/releases/latest) manually.
127127

128-
Make sure Clang/LLVM 21 is in your path:
128+
Make sure the unversioned Clang command resolves to that toolchain:
129129

130130
```bash
131-
which clang-21
131+
command -v clang
132+
clang --version
132133
```
133134

134135
If not, add it manually:
@@ -137,13 +138,13 @@ If not, add it manually:
137138

138139
```bash macOS (Homebrew)
139140
# use fish_add_path if you're using fish
140-
# use path+="$(brew --prefix llvm@21)/bin" if you are using zsh
141-
export PATH="$(brew --prefix llvm@21)/bin:$PATH"
141+
# use path+="$(brew --prefix llvm)/bin" if you are using zsh
142+
export PATH="$(brew --prefix llvm)/bin:$PATH"
142143
```
143144

144-
```bash Arch
145-
# use fish_add_path if you're using fish
146-
export PATH="$PATH:/usr/lib/llvm21/bin"
145+
```bash Ubuntu/Debian (apt.llvm.org)
146+
LLVM_BIN="$(ls -d /usr/lib/llvm-*/bin | sort -V | tail -n 1)"
147+
export PATH="$LLVM_BIN:$PATH"
147148
```
148149

149150
</CodeGroup>
@@ -322,7 +323,7 @@ The issue may also surface when first running `bun run build`, with Clang unable
322323
```txt
323324
The C++ compiler
324325
325-
"/usr/bin/clang++-21"
326+
"/usr/bin/clang++"
326327
327328
is not able to compile a simple test program.
328329
```

0 commit comments

Comments
 (0)