feat: lifetime elision, tooling CI, registry, and LSP locals
Ship the QUALITY_PLAN stretch from ownership through ecosystem: C.1 lifetime elision (bootstrap + selfhost), bux fmt/test/doc CI hooks, stdlib goldens, package registry (bux search/add), and LSP 0.4 position-sensitive locals with inferred let types. Full-tree format pass plus Map/Set remove double-free fix.
This commit is contained in:
+76
-28
@@ -1,6 +1,8 @@
|
||||
# Bux Package Manager
|
||||
|
||||
> **Status:** Implemented (Phase 9.1)
|
||||
> **Status:** Path + git + **local/file registry** (E.1). HTTP registry index URL optional later.
|
||||
|
||||
See also: [SEMVER.md](SEMVER.md) for version policy.
|
||||
|
||||
---
|
||||
|
||||
@@ -20,52 +22,97 @@ License = "MIT"
|
||||
Output = "Bin"
|
||||
|
||||
[Dependencies]
|
||||
Std = "1.0"
|
||||
Json = { Version = "2.1", Source = "https://github.com/bux-lang/json" }
|
||||
greet = { Path = "/abs/path/to/greet" }
|
||||
Json = { Version = "2.1", Source = "https://github.com/bux-lang/json" }
|
||||
Utils = { Path = "../Utils" }
|
||||
# Registry name-only (resolved by `bux add` / `bux install`):
|
||||
# greet = "0.1.1"
|
||||
```
|
||||
|
||||
### Dependency Forms
|
||||
|
||||
| Form | Example | Description |
|
||||
|------|---------|-------------|
|
||||
| Version string | `Std = "1.0"` | Registry dependency |
|
||||
| Wildcard | `Std = "*"` | Latest version |
|
||||
| Version string | `greet = "0.1.1"` | Registry dependency |
|
||||
| Wildcard | `greet = "*"` | Latest registry version |
|
||||
| Inline table (git) | `{ Version = "1.4", Source = "https://..." }` | Git URL + version |
|
||||
| Inline table (path) | `{ Path = "../Lib" }` | Local path dependency |
|
||||
|
||||
---
|
||||
|
||||
## Package registry (E.1)
|
||||
|
||||
### Index file
|
||||
|
||||
Default locations (first hit wins):
|
||||
|
||||
1. `$BUX_REGISTRY` — path to a `registry.toml`
|
||||
2. `~/.bux/registry.toml`
|
||||
3. `config/registry.toml` next to the Bux repo / compiler
|
||||
|
||||
Format:
|
||||
|
||||
```toml
|
||||
[[package]]
|
||||
name = "greet"
|
||||
version = "0.1.1"
|
||||
source = "file:../registry/packages/greet" # relative to the index file
|
||||
description = "Hello helpers"
|
||||
|
||||
[[package]]
|
||||
name = "net"
|
||||
version = "1.0.0"
|
||||
source = "https://github.com/example/bux-net.git"
|
||||
description = "TCP helpers"
|
||||
```
|
||||
|
||||
`file:` / `path:` sources are resolved relative to the registry file.
|
||||
Git URLs are cloned into `~/.bux/packages/<name>/` on install.
|
||||
|
||||
### CLI
|
||||
|
||||
```bash
|
||||
# Search the index
|
||||
bux search
|
||||
bux search greet
|
||||
|
||||
# Add by registry name (writes Path or git Source into bux.toml)
|
||||
bux add greet
|
||||
bux add greet 0.1.1
|
||||
|
||||
# Explicit sources still work
|
||||
bux add utils --path "../utils"
|
||||
bux add network --git "https://github.com/bux-lang/network"
|
||||
|
||||
# Resolve + write bux.lock
|
||||
bux install
|
||||
```
|
||||
|
||||
Demo package in this monorepo: `registry/packages/greet` (registered in
|
||||
`config/registry.toml`). Smoke test: `tools/smoke_registry.sh`.
|
||||
|
||||
---
|
||||
|
||||
## CLI Commands
|
||||
|
||||
### `bux add <name> [version]`
|
||||
|
||||
Add a dependency to `bux.toml`.
|
||||
Add a dependency to `bux.toml` (registry / `--path` / `--git`).
|
||||
|
||||
```bash
|
||||
# Add registry dependency
|
||||
bux add json "2.1"
|
||||
### `bux search [query]`
|
||||
|
||||
# Add path-based dependency
|
||||
bux add utils --path "../utils"
|
||||
|
||||
# Add git dependency
|
||||
bux add network --git "https://github.com/bux-lang/network"
|
||||
```
|
||||
List packages in the active registry (filter by name/description).
|
||||
|
||||
### `bux install`
|
||||
|
||||
Resolve dependencies and generate `bux.lock`.
|
||||
|
||||
```bash
|
||||
bux install
|
||||
```
|
||||
|
||||
What it does:
|
||||
1. Reads `[Dependencies]` from `bux.toml`
|
||||
2. Resolves path-based deps (verifies directory exists)
|
||||
3. Clones/pulls git-based deps to `~/.bux/packages/<name>/`
|
||||
4. Generates `bux.lock` with exact versions and sources
|
||||
3. Clones git-based deps to `~/.bux/packages/<name>/`
|
||||
4. Resolves bare version names via the registry index
|
||||
5. Generates `bux.lock` with exact versions and sources
|
||||
|
||||
### `bux build` / `bux run`
|
||||
|
||||
@@ -84,10 +131,9 @@ Auto-generated. **Do not edit manually.**
|
||||
|
||||
```toml
|
||||
[[Package]]
|
||||
Name = "json"
|
||||
Version = "2.1.3"
|
||||
Source = "https://github.com/bux-lang/json"
|
||||
Checksum = "8dcb2a7f..."
|
||||
Name = "greet"
|
||||
Version = "0.1.1"
|
||||
Source = "/home/user/z-git/bux/bux/registry/packages/greet"
|
||||
|
||||
[[Package]]
|
||||
Name = "utils"
|
||||
@@ -103,7 +149,7 @@ The lockfile ensures **reproducible builds** — every developer gets the exact
|
||||
|
||||
1. **Path-based** deps are resolved relative to the manifest directory
|
||||
2. **Git-based** deps are cloned to `~/.bux/packages/<name>/`
|
||||
3. **Version-based** deps (without Source) require a registry (future feature)
|
||||
3. **Version-based** deps look up `config/registry.toml` (or `$BUX_REGISTRY`)
|
||||
4. Dependencies are loaded from `<dep>/src/*.bux` at build time
|
||||
5. Later declarations shadow earlier ones (project > deps > stdlib)
|
||||
|
||||
@@ -114,8 +160,10 @@ The lockfile ensures **reproducible builds** — every developer gets the exact
|
||||
```bash
|
||||
bux new mylib
|
||||
cd mylib
|
||||
# Edit src/Main.bux → module MyLib { pub func Add(...) }
|
||||
bux build # Builds as library (Type = "lib")
|
||||
# Edit src/*.bux → module MyLib { func Add(...) }
|
||||
# Set Type = "lib" in bux.toml
|
||||
# Register in your registry.toml with source = "file:..."
|
||||
bux build
|
||||
```
|
||||
|
||||
## Example: Using a Library
|
||||
|
||||
Reference in New Issue
Block a user