brevi 0.0.0-stage → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +31 -2
  2. package/bin/brevi.js +33 -0
  3. package/package.json +33 -4
package/README.md CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # Brevi: fast, safe native builds of AI-written Python
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Brevi is a compiler built for AI coding agents. The agent writes the plain Python it already writes best; Brevi builds it through Rust into a native binary that prints exactly what CPython prints and runs 1.7x to 40x faster with the default build. Anything it cannot build comes back as one short JSON line the agent can act on.
4
+
5
+ ```
6
+ npm install -g brevi # or run it without installing: npx brevi mcp
7
+ ```
8
+
9
+ The first run downloads the prebuilt `brevi` for your platform from the matching [GitHub release](https://github.com/ets-public/brevi/releases) into `~/.cache/brevi/VERSION`.
10
+
11
+ ```
12
+ $ printf 'print(sum(i * i for i in range(10)))\n' > main.py
13
+ $ brevi run main.py # build natively (cached), then run
14
+ 285
15
+ $ brevi check main.py # build without running: errors only
16
+ $ brevi build main.py -o app --release # an optimised binary to keep or ship
17
+ $ brevi mcp # MCP server for agents: check, run, test, patch, edit, show, guide
18
+ ```
19
+
20
+ A sure mistake is reported before anything runs, as one line with a fix:
21
+
22
+ ```
23
+ {"line":8,"msg":"name 'totl' is not defined","fix":"did you mean total?"}
24
+ ```
25
+
26
+ Brevi compiles through `rustc`, so a Rust toolchain must be on the PATH ([rustup.rs](https://rustup.rs)).
27
+
28
+ - **For agents:** add the MCP server as the command `brevi` with the argument `mcp` (Claude Code: `claude mcp add brevi -- brevi mcp`). Its tools sandbox by default. [For AI agents](https://brevi-lang.org/docs/agents)
29
+ - **Same answers as CPython:** every saved agent program and large test program matches CPython's output and exit status. Imports of installed packages (numpy, pandas, requests, ...) work; most numpy code builds natively.
30
+ - **Public preview:** Brevi works today and is tested against CPython on every change, but expect the CLI to change between releases.
31
+
32
+ [Docs](https://brevi-lang.org/docs/) · [Source](https://github.com/ets-public/brevi) · [Changelog](https://github.com/ets-public/brevi/blob/main/CHANGELOG.md) · [Issues](https://github.com/ets-public/brevi/issues) · Apache-2.0
package/bin/brevi.js ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ // Runs the prebuilt brevi binary for this platform, fetching it from the GitHub release on first use.
3
+ // The binary is kept in ~/.cache/brevi/VERSION/, so later runs start at once.
4
+ const { spawnSync, execFileSync } = require("child_process");
5
+ const fs = require("fs"), os = require("os"), path = require("path");
6
+ const version = require("../package.json").version;
7
+ const targets = {
8
+ "linux-x64": "x86_64-unknown-linux-gnu", "linux-arm64": "aarch64-unknown-linux-gnu",
9
+ "darwin-arm64": "aarch64-apple-darwin", "darwin-x64": "x86_64-apple-darwin", "win32-x64": "x86_64-pc-windows-msvc",
10
+ };
11
+ const target = targets[`${process.platform}-${process.arch}`];
12
+ if (!target) {
13
+ console.log(JSON.stringify({ e: "install", msg: `no prebuilt brevi for ${process.platform}-${process.arch}`, fix: "cargo install --git https://github.com/ets-public/brevi" }));
14
+ process.exit(1);
15
+ }
16
+ const exe = process.platform === "win32" ? "brevi.exe" : "brevi";
17
+ const dir = path.join(os.homedir(), ".cache", "brevi", version);
18
+ const bin = path.join(dir, `brevi-${target}`, exe);
19
+ if (!fs.existsSync(bin)) {
20
+ fs.mkdirSync(dir, { recursive: true });
21
+ const ext = process.platform === "win32" ? "zip" : "tar.gz";
22
+ const url = `https://github.com/ets-public/brevi/releases/download/v${version}/brevi-${target}.${ext}`;
23
+ const archive = path.join(dir, `brevi.${ext}`);
24
+ try {
25
+ execFileSync("curl", ["-fsSL", "-o", archive, url], { stdio: "inherit" });
26
+ execFileSync("tar", ["-xf", archive, "-C", dir], { stdio: "inherit" });
27
+ } catch (e) {
28
+ console.log(JSON.stringify({ e: "install", msg: `could not fetch ${url}`, fix: "check the network, or cargo install --git https://github.com/ets-public/brevi" }));
29
+ process.exit(1);
30
+ }
31
+ }
32
+ const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
33
+ process.exit(r.status === null ? 1 : r.status);
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "brevi",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.25.0",
4
+ "description": "Compiles the plain Python AI agents write into fast native binaries via Rust, with one-line JSON errors and an MCP server.",
5
+ "keywords": [
6
+ "python",
7
+ "compiler",
8
+ "rust",
9
+ "mcp",
10
+ "ai-agents",
11
+ "llm",
12
+ "native",
13
+ "brevi"
14
+ ],
15
+ "homepage": "https://brevi-lang.org",
16
+ "bugs": {
17
+ "url": "https://github.com/ets-public/brevi/issues"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/ets-public/brevi.git"
22
+ },
23
+ "license": "Apache-2.0",
24
+ "bin": {
25
+ "brevi": "bin/brevi.js"
26
+ },
27
+ "files": [
28
+ "bin",
29
+ "README.md"
30
+ ],
31
+ "engines": {
32
+ "node": ">=18"
33
+ },
34
+ "mcpName": "io.github.ets-public/brevi"
35
+ }