🌐 生态系统
TLL 生态系统包括包管理器、CLI 工具、编辑器插件、社区资源。本章介绍如何使用和融入 TLL 生态。
1. 包管理器
tll.toml 包清单
[package]
name = "myapp"
version = "0.1.0"
license = "MIT"
authors = ["Your Name "]
description = "My TLL application"
repository = "https://github.com/user/myapp"
[dependencies]
http = "1.0.0"
json = "2.1.0"
ai-agent = { git = "https://github.com/aliquanhou/ai-agent", tag = "v0.3.0" }
my-utils = { path = "../my-utils" }
[dev-dependencies]
testing = "1.0.0"
benchmark = "0.2.0"
[profile.release]
opt_level = 3
lto = true
debug = false
包管理命令
| 命令 | 说明 |
|---|---|
tll new <name> | 创建新项目 |
tll init | 在当前目录初始化项目 |
tll install | 安装所有依赖 |
tll add <pkg> | 添加依赖 |
tll remove <pkg> | 移除依赖 |
tll update | 更新依赖到最新版本 |
tll publish | 发布到包仓库 |
tll search <query> | 搜索包 |
tll list | 列出已安装的包 |
tll outdated | 检查过时的依赖 |
版本约束
[dependencies]
# 精确版本
http = "1.2.3"
# 兼容版本(>=1.2.3, <2.0.0)
http = "^1.2.3"
# 近似版本(>=1.2.3, <1.3.0)
http = "~1.2.3"
# 范围
http = ">=1.0.0, <2.0.0"
# 最新
http = "latest"
# Git 依赖
ai-agent = { git = "https://github.com/aliquanhou/ai-agent" }
ai-agent = { git = "https://github.com/aliquanhou/ai-agent", branch = "dev" }
ai-agent = { git = "https://github.com/aliquanhou/ai-agent", tag = "v0.3.0" }
ai-agent = { git = "https://github.com/aliquanhou/ai-agent", rev = "abc123" }
# 本地路径
my-utils = { path = "../my-utils" }
2. CLI 工具
开发命令
# 创建项目
tll new myapp
cd myapp
# 开发模式(自动重载)
tll dev
# 构建
tll build
tll build --release
# 运行
tll run
tll run src/main.tll
# 测试
tll test
tll test --filter "test_add"
tll test --watch
# 代码检查
tll check
tll check --strict
# 格式化
tll fmt
tll fmt --check
# 文档生成
tll doc
tll doc --open
# 依赖管理
tll add http
tll remove http
tll install
tll update
tll outdated
全局选项
tll --version # 显示版本
tll --help # 显示帮助
tll --help # 显示命令帮助
tll -v # 详细输出
tll -q # 静默模式
tll --color=never # 禁用颜色输出
3. 项目模板
# 基础库项目
tll new mylib --lib
# 可执行程序
tll new myapp --bin
# Web 应用
tll new myweb --web
# AI Agent 项目
tll new myagent --agent
# 全栈应用
tll new myfullstack --fullstack
4. 编辑器插件
| 编辑器 | 状态 | 功能 |
|---|---|---|
| VS Code | 开发中 | 语法高亮、自动补全、跳转定义、错误诊断、格式化 |
| Vim / Neovim | 计划中 | 语法高亮、LSP 支持 |
| Emacs | 计划中 | 语法高亮、LSP 支持 |
| Sublime Text | 计划中 | 语法高亮 |
| JetBrains IDE | 计划中 | 完整 IDE 支持 |
Language Server Protocol (LSP)
TLL 提供标准的 LSP 服务器,支持任何兼容 LSP 的编辑器:
# 启动 LSP 服务器
tll lsp
# VS Code 配置示例(settings.json)
{
"tll.lsp.enabled": true,
"tll.format.enable": true,
"tll.check.onSave": true
}
5. 社区资源
官方渠道
- GitHub — https://github.com/aliquanhou/tll
- 官网 — http://tll.knitoem.com
- 文档 — http://tll.knitoem.com/docs/
- Playground — http://tll.knitoem.com/playground/
贡献方式
- 代码贡献 — 提交 PR 修复 bug、实现新功能
- 文档贡献 — 改进文档、翻译、添加示例
- Bug 报告 — 在 GitHub Issues 提交 bug
- 功能建议 — 提出新功能或改进建议
- 社区支持 — 回答问题、帮助新用户
- 生态建设 — 开发库、工具、编辑器插件
6. 版本策略
TLL 遵循 语义化版本(SemVer):
- 0.x — 不稳定阶段,小版本之间可能有破坏性变更
- 1.0 — 第一个稳定版本,API 冻结
- 1.x — 向后兼容的功能新增
- 2.0 — 破坏性变更
7. 常见问题(FAQ)
Q: TLL 和其他语言有什么区别?
A: TLL 的核心是 AI-Native。Agent、Intent、Tool 是语言级一等公民,而非库。TLL 不依赖任何其他语言的语义,目标是完全自举。
Q: 为什么用 TypeScript 实现 Bootstrap 编译器?
A: TypeScript 生态成熟、开发效率高、跨平台。Bootstrap 编译器是临时的,最终 TLL 编译器将由 TLL 自己编写(Self-hosting)。
Q: TLL 有垃圾回收吗?
A: TLL 0.1 没有 GC。内存通过所有权 + 借用 + 可选引用计数管理。未来版本可能提供可选 GC。