Skip to content

lang-bmb/gotgan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

곳간 (Gotgan)

BMB Package Manager with Rust Ecosystem Support

BMB 패키지 매니저. Rust 폴백 생태계를 지원하고 Rust→BMB 마이그레이션 도구를 제공합니다.

Features

Core Package Management

  • gotgan new <name> - 새 프로젝트 생성
  • gotgan build - 프로젝트 빌드
  • gotgan run - 빌드 및 실행
  • gotgan test - 테스트 실행
  • gotgan verify - 계약 검증 (BMB)
  • gotgan publish - 패키지 배포
  • gotgan add <name> - 의존성 추가

Local Registry

  • gotgan publish --local - 로컬 레지스트리에 패키지 게시
  • gotgan add <name> --local - 로컬 레지스트리에서 패키지 설치
  • Semver 기반 버전 관리 (^, ~, >=, <=, >, <, =, *)
  • 오프라인 패키지 캐싱

Rust Fallback Ecosystem

  • Cargo 호환: Rust crates를 의존성으로 사용 가능
  • FFI 자동 생성: Rust 라이브러리 바인딩 자동 생성
  • 혼합 프로젝트: BMB + Rust 코드 동시 사용

Rust to BMB Migration

  • gotgan migrate <crate> - Rust crate를 BMB로 변환
  • 점진적 마이그레이션: 함수 단위로 순차 변환
  • 계약 추론: Rust 코드에서 pre/post 조건 추론

Installation

# From source (requires Rust)
cargo install gotgan

# Pre-built binary (planned)
curl -sSf https://bmb-lang.org/gotgan/install.sh | sh

Quick Start

# Create new project
gotgan new hello
cd hello

# Build and run
gotgan run

Project Structure

hello/
├── gotgan.toml          # Project manifest
├── src/
│   └── main.bmb         # Entry point
└── tests/
    └── test_main.bmb    # Tests

gotgan.toml

[package]
name = "hello"
version = "0.1.0"
edition = "2025"

[dependencies]
# BMB packages
json = "0.1"

# Go-style git dependencies (v0.60.250+)
[dependencies.bmb-hash]
git = "github.com/lang-bmb/gotgan-packages"
tag = "v0.1.0"
# path in repo: packages/bmb-hash

# Branch or commit
[dependencies.mylib]
git = "github.com/user/repo"
branch = "main"  # or: tag = "v1.0.0", rev = "abc123"

# Rust fallback (crates.io) - planned
[dependencies.rust]
serde = "1.0"
tokio = { version = "1", features = ["full"] }

[dev-dependencies]
test-utils = "0.1"

Git Dependencies (Go-style)

No central registry needed. Dependencies are fetched directly from git repositories.

# gotgan.toml
[dependencies.bmb-json]
git = "github.com/lang-bmb/gotgan-packages"
tag = "v0.1.0"

Cache location: ~/.gotgan/cache/[email protected]/

Supported Options

Option Description Example
git Repository URL (Go-style) "github.com/user/repo"
tag Git tag (recommended for releases) "v1.0.0"
branch Git branch "main"
rev Git commit hash "abc1234"

Local Registry

# Publish package to local registry (~/.gotgan/registry/)
gotgan publish --local

# Add dependency from local registry
gotgan add bmb-json --local

# Add specific version
gotgan add bmb-json --local --version "^1.0"

Registry structure:

~/.gotgan/
├── registry/
│   ├── bmb-json/
│   │   ├── 1.0.0/
│   │   │   ├── gotgan.toml
│   │   │   └── src/
│   │   └── index.json
│   └── ...
└── cache/

Rust Interop

Using Rust Crates

# gotgan.toml
[dependencies.rust]
regex = "1.10"
-- main.bmb
use rust::regex::Regex;

fn match_email(s: &str) -> bool =
  Regex::new(r"^\S+@\S+\.\S+$").unwrap().is_match(s);

Migration Example

# Analyze Rust crate for migration
gotgan migrate --analyze my_crate

# Generate BMB skeleton with inferred contracts
gotgan migrate --generate my_crate

# Verify migrated code
gotgan verify src/

Roadmap

Version Features Status
v0.1 Project structure, build, run ✅ 완료
v0.2 Local dependencies, lock file ✅ 완료
v0.3 Local registry, publish, search ✅ 완료
v0.4 Rust fallback ecosystem 계획
v0.5 Migration tools 계획
v1.0 Full feature set, BMB rewrite 계획

Development

# Build
cargo build

# Test
cargo test

# Run locally
cargo run -- new test-project

License

MIT License

About

BMB Package Manager

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages