Skip to content

Commit 4576323

Browse files
author
farfarfun
committed
build: add nlt-build tool with aicommits and funbuild alignment
1 parent 361c7b1 commit 4576323

7 files changed

Lines changed: 54 additions & 48 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- **celery**:Celery 安装与 worker/beat/flower 启停、状态;默认 `~/opt/celery`
1111
- **utils**:安装 **gum**`~/opt/gum`)与可选 shell 别名(`ll` / `la` / `lla`)。
1212
- **github-net**:诊断并修复「网页能开但 `git clone` 失败」的常见 HTTPS/SSH 问题。
13+
- **build**`nlt-build`):默认用 **aicommits** 快速提交;子命令对齐开源 **[funbuild / nltbuild](https://github.com/farfarfun/funbuild)**`pull` / `push` / `upgrade` / `install` / `build` / `release` / `tags` 等,见 `scripts/tools/build/setup.sh` 头注释)。
1314
- **paperclip**:从 **GitHub 克隆** [paperclipai/paperclip](https://github.com/paperclipai/paperclip) 源码、`pnpm install`,并以 **`pnpm paperclipai run`** 启停;默认安装根 `~/opt/paperclip`,数据目录见上游 `~/.paperclip/…`
1415
- **code-server**:从 **GitHub Releases** 下载官方 **standalone** 压缩包并解压到 `~/opt/code-server``nohup` 后台运行,默认绑定 `127.0.0.1:8080`;无需本机 Node.js。
1516
- **new-api**:从 **GitHub Releases** 下载 [QuantumNous/new-api](https://github.com/QuantumNous/new-api) 的预编译二进制到 `~/opt/new-api/bin`;数据目录默认 `~/opt/new-api/data`(SQLite 等),默认 **HTTP 端口 3000**;解析版本时会跳过无附件的 nightly,fallback `v0.12.6`
@@ -84,20 +85,15 @@ bash tests/install_smoke.sh
8485
|-------------|---------------------|
8586
| `nlt-pip-sources` | `scripts/tools/pip-sources/setup.sh`(无参时 gum 选 install/update/reinstall/uninstall) |
8687
| `nlt-python-env` | `scripts/tools/python-env/setup.sh`(无参时 gum 选子命令;见脚本头) |
87-
| `nlt-airflow-install` | `scripts/services/airflow/setup.sh` install |
88-
| `nlt-airflow` | 同上 `setup.sh` 全量子命令(如 `start` / `stop` / `status` / `update`);无参为 gum 菜单 |
89-
| `nlt-celery-install` | `scripts/services/celery/setup.sh` install |
90-
| `nlt-celery-update` | 同上 `setup.sh` update |
91-
| `nlt-celery` | 同上 `setup.sh` 全量子命令(如 `start-worker` / `stop` / `status`);无参为菜单 |
88+
| `nlt-airflow` | `scripts/services/airflow/setup.sh` 全量子命令;`install` 首次/升级安装;`start` / `stop` / `status` / `update` 等;无参为 gum 菜单 |
89+
| `nlt-celery` | `scripts/services/celery/setup.sh` 全量子命令;`install` / `update``start-worker` / `stop` / `status` 等;无参为菜单 |
9290
| `nlt-utils`(可接子参数,如 `gum``all`| `scripts/tools/utils/setup.sh`|
9391
| `nlt-github-net` | `scripts/tools/github-net/setup.sh`(无参 gum;可 `install` / `update` / `reinstall` / `uninstall`|
92+
| `nlt-build` | `scripts/tools/build/setup.sh` + `nltbuild_core.py`:默认 `aicommits -a``commit` / `staged` 同前。子命令 **pull / push / upgrade / install / build / release / tags** 等与 [farfarfun/funbuild](https://github.com/farfarfun/funbuild)(PyPI **nltbuild**)行为对齐;Python 部分需 **python3****`pip install toml`****push** 使用 `aicommits --yes`(与上游 `core.py` 一致)。**clean** / **clean-history** 须设置确认环境变量(见脚本 `help`|
9493
| `nlt-services` | `scripts/services/nlt-services.sh`(无参 gum;`status``install` 先选安装或卸载;非交互:`install add <模块>` / `install remove <模块>``status --no-http`|
95-
| `nlt-paperclip-install` | `scripts/services/paperclip/setup.sh` install(git clone + pnpm install) |
96-
| `nlt-paperclip` | 同上 `setup.sh` 全量子命令;无参为 gum 菜单 |
97-
| `nlt-code-server-install` | `scripts/services/code-server/setup.sh` install(下载解压官方包) |
98-
| `nlt-code-server` | 同上 `setup.sh` 全量子命令;无参为 gum 菜单 |
99-
| `nlt-new-api-install` | `scripts/services/new-api/setup.sh` install(下载 Release 二进制) |
100-
| `nlt-new-api` | 同上 `setup.sh` 全量子命令;无参为 gum 菜单 |
94+
| `nlt-paperclip` | `scripts/services/paperclip/setup.sh` 全量子命令;`install`(git clone + pnpm install)等;无参为 gum 菜单 |
95+
| `nlt-code-server` | `scripts/services/code-server/setup.sh` 全量子命令;`install`(下载解压官方包)等;无参为 gum 菜单 |
96+
| `nlt-new-api` | `scripts/services/new-api/setup.sh` 全量子命令;`install` / `update` 下载 Release 二进制;无参为 gum 菜单 |
10197

10298
## 目录结构
10399

@@ -123,8 +119,11 @@ nltdeploy/
123119
│ │ │ └── README.md
124120
│ │ ├── utils/
125121
│ │ │ └── setup.sh # gum / 别名 / all
126-
│ │ └── github-net/
127-
│ │ └── setup.sh # Git 连通性诊断与修复
122+
│ │ ├── github-net/
123+
│ │ │ └── setup.sh # Git 连通性诊断与修复
124+
│ │ └── build/
125+
│ │ ├── setup.sh # nlt-build:aicommits + nltbuild 移植核心
126+
│ │ └── nltbuild_core.py # 构建/版本/发布逻辑(Python)
128127
│ └── services/ # 常驻服务与聚合入口
129128
│ ├── nlt-services.sh # nlt-services:status + install 聚合入口
130129
│ ├── airflow/
@@ -253,6 +252,7 @@ curl -LsSf https://gitee.com/farfarfun/nltdeploy/raw/master/scripts/tools/github
253252
| `tools/python-env` | `setup.sh` | uv、多版本 Python venv、基础包 |
254253
| `tools/utils` | `setup.sh` | gum 与 shell 便利项 |
255254
| `tools/github-net` | `setup.sh` | GitHub 克隆通道诊断与修复 |
255+
| `tools/build` | `setup.sh``nltbuild_core.py` | `nlt-build`:aicommits 与 funbuild/nltbuild 能力 |
256256
| `services/airflow` | `setup.sh` | Airflow 3 安装与日常运维封装 |
257257
| `services/celery` | `setup.sh` | Celery 安装与进程管理 |
258258
| `services/paperclip` | `setup.sh` | 克隆 [paperclipai/paperclip](https://github.com/paperclipai/paperclip)、pnpm 安装与启停 |

docs/superpowers/plans/2026-04-11-nltdeploy-local-install.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,7 @@ _emit_wrapper nlt-python-env python-env/setup.sh
141141
_emit_wrapper nlt-utils utils/setup.sh
142142
_emit_wrapper nlt-github-net github-net/setup.sh
143143

144-
_emit_wrapper nlt-airflow-install airflow/setup.sh install
145144
_emit_wrapper nlt-airflow airflow/setup.sh
146-
147-
_emit_wrapper nlt-celery-install celery/setup.sh install
148-
_emit_wrapper nlt-celery-update celery/setup.sh update
149145
_emit_wrapper nlt-celery celery/setup.sh
150146
```
151147

@@ -237,8 +233,7 @@ export NLTDEPLOY_ROOT="${TMP}/nd"
237233
bash "${ROOT}/install.sh"
238234
for f in \
239235
nlt-pip-sources nlt-python-env nlt-utils nlt-github-net \
240-
nlt-airflow-install nlt-airflow \
241-
nlt-celery-install nlt-celery-update nlt-celery
236+
nlt-airflow nlt-celery
242237
do
243238
[[ -x "${NLTDEPLOY_ROOT}/bin/${f}" ]] || { echo "missing: bin/${f}" >&2; exit 1; }
244239
bash -n "${NLTDEPLOY_ROOT}/bin/${f}" || exit 1
@@ -302,7 +297,7 @@ git commit -m "docs: document local install, nlt-* mapping, and NLTDEPLOY_RAW_BA
302297
| 一键安装 + `bin``nlt-*` | Task 1–2 |
303298
| `libexec` 实现分离 | Task 1 |
304299
| `nlt-<域>` 单入口透传子命令 | Task 2(Airflow/Celery 等) |
305-
| `nlt-airflow-install` 非 service | Task 2 |
300+
| 服务域仅 `nlt-<域>` 单入口(含 `install` 子命令) | Task 2 |
306301
| `NLTDEPLOY_ROOT` 可覆盖 | Task 1–2 薄包装 |
307302
| `NONINTERACTIVE` 保留 | 无需改脚本(沿用现有) |
308303
| `NLTDEPLOY_RAW_BASE` | Task 3 |

docs/superpowers/specs/2026-04-11-nltdeploy-local-install-design.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
| 主形态 | **A:Bash 小命令为主** | 与当前仓库以 shell 为主力一致;Python 包不作为终端主入口(可后续作为可选依赖,本规格不强制)。 |
2727
| 命令前缀 | **`nlt-`** | 所有 `bin` 内可执行文件名均以此开头。 |
2828
| 服务生命周期 | **`nlt-<域>`** |**`nlt-airflow`****`nlt-celery`****`nlt-paperclip`** 等总控入口透传 `start` / `stop` / `status` / `update` 等子命令;****再生成 `nlt-service-<域>` 重复包装。 |
29-
| Airflow「首次安装」 | **`nlt-airflow-install`** | 首次/干净环境安装;日常运维用 **`nlt-airflow`** 接子命令。 |
30-
| Celery | **`nlt-celery-install`** / **`nlt-celery-update`** / **`nlt-celery`** | 安装、依赖升级与全量子命令(含 worker/beat/flower)分口,与 Airflow 的 install + 总控对称。 |
29+
| Airflow / Celery 等安装与运维 | **`nlt-airflow`** / **`nlt-celery`**| 每个域 **单一** `bin` 入口,**透传** `install``update``start``stop` 等子命令;****再为 `install`/`update` 单独生成 `nlt-<域>-install` 等并行包装。 |
3130
| 数据与运行时目录 | **默认保持现有 `~/opt/...` 约定** | 与 README 及现有脚本一致,降低迁移成本;若设置 `AIRFLOW_HOME` / `CELERY_HOME` 等,仍以用户环境为准。后续可在实现阶段增加可选「统一到 `~/.local/nltdeploy/var`」的迁移助手,**不作为本规格 v1 默认行为**|
3231

3332
---
@@ -65,7 +64,7 @@
6564
| `scripts/tools/python-env/setup.sh` | `nlt-python-env` |
6665
| `scripts/tools/utils/setup.sh` | `nlt-utils` 或拆分为 `nlt-utils-gum`|
6766
| `scripts/tools/github-net/setup.sh` | `nlt-github-net` |
68-
| Airflow 首次安装/升级(原 `scripts/services/airflow/setup.sh` 中非启停部分) | `nlt-airflow-install` |
67+
| Airflow 首次安装/升级(原 `airflow/setup.sh` 中非启停部分) | `nlt-airflow install`(及域内 `update` 等) |
6968

7069
### 4.3 服务(进程生命周期)
7170

@@ -112,7 +111,7 @@
112111
## 8. 测试与验收(规格层)
113112

114113
- 安装脚本在 **macOS 与 Linux**(含无 TTY 的 `NONINTERACTIVE`)下可完成安装。
115-
- 抽样验收:`nlt-pip-sources``nlt-python-env``nlt-airflow-install``nlt-airflow status`(在未安装服务时可有明确退出码与提示)等按迁移表可调用。
114+
- 抽样验收:`nlt-pip-sources``nlt-python-env``nlt-airflow install``nlt-airflow status`(在未安装服务时可有明确退出码与提示)等按迁移表可调用。
116115

117116
---
118117

@@ -126,5 +125,5 @@
126125
## 规格自检记录
127126

128127
- **占位符**:无 TBD;数据目录默认策略已写死为保留 `~/opt` 与既有 env。
129-
- **一致性**服务生命周期统一经 `nlt-<域>`;Airflow / Celery 的首次安装仍用 `nlt-airflow-install``nlt-celery-install`,与上文表格一致
128+
- **一致性**服务生命周期与首次安装统一经 **`nlt-<域>`** 及子命令(如 `install`),与上文表格一致;`install.sh` 在更新时会删除历史上曾生成的 `nlt-<域>-install` 等废弃包装
130129
- **范围**:本文件仅定义布局与命名;不展开具体 systemd/launchd 或进程管理实现细节(归入实现计划)。

docs/superpowers/specs/2026-04-11-nltdeploy-tool-service-conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
- **推荐**:每个域一个 **总控入口**(如 `nlt-airflow``airflow/setup.sh "$@"`),所有子命令通过参数触发直执行或 gum 菜单。
6262
- **服务域**:长期运行域只用 **`nlt-<域>`** 透传子命令(如 `nlt-airflow start`),****再提供并行的 `nlt-service-<域>` 包装。
63-
- **新增服务/工具**:总控 `nlt-<域>`;需要单独语义时仍可用 `nlt-<域>-install` / `nlt-<域>-update`(如 Celery)等,**不为**每个动词单独生成 `nlt-<域>-<动词>` 文件。
63+
- **新增服务/工具**:总控 **`nlt-<域>`** 透传子命令(如 `install``update`),****再为同一域生成并行的 `nlt-<域>-install` / `nlt-<域>-update` 等独立 `bin` 文件。
6464

6565
---
6666

install.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ do_install_or_update() {
264264
LIBEXEC="${NLTDEPLOY_ROOT}/libexec/nltdeploy"
265265
mkdir -p "${NLTDEPLOY_ROOT}/bin" "${LIBEXEC}" \
266266
"${NLTDEPLOY_ROOT}/share/nltdeploy" "${NLTDEPLOY_ROOT}/etc/nltdeploy"
267-
mkdir -p "${LIBEXEC}/pip-sources" "${LIBEXEC}/python-env" \
267+
mkdir -p "${LIBEXEC}/pip-sources" "${LIBEXEC}/python-env" "${LIBEXEC}/build" \
268268
"${LIBEXEC}/airflow" "${LIBEXEC}/celery" "${LIBEXEC}/utils" "${LIBEXEC}/github-net" \
269269
"${LIBEXEC}/paperclip" "${LIBEXEC}/code-server" "${LIBEXEC}/new-api" \
270270
"${LIBEXEC}/services" \
@@ -300,6 +300,16 @@ do_install_or_update() {
300300
"${SCRIPTS}/tools/github-net/setup.sh" \
301301
"${SCRIPTS}/github-net/setup.sh"
302302

303+
_nlt_cp_first "${LIBEXEC}/build/setup.sh" \
304+
"${SCRIPTS}/tools/build/setup.sh" \
305+
"${SCRIPTS}/build/setup.sh"
306+
307+
if [[ -f "${SCRIPTS}/tools/build/nltbuild_core.py" ]]; then
308+
cp -f "${SCRIPTS}/tools/build/nltbuild_core.py" "${LIBEXEC}/build/nltbuild_core.py"
309+
else
310+
die "找不到 ${SCRIPTS}/tools/build/nltbuild_core.py"
311+
fi
312+
303313
_nlt_cp_first "${LIBEXEC}/paperclip/setup.sh" \
304314
"${SCRIPTS}/services/paperclip/setup.sh" \
305315
"${SCRIPTS}/paperclip/setup.sh" \
@@ -324,23 +334,21 @@ do_install_or_update() {
324334
_emit_wrapper nlt-python-env python-env/setup.sh
325335
_emit_wrapper nlt-utils utils/setup.sh
326336
_emit_wrapper nlt-github-net github-net/setup.sh
337+
_emit_wrapper nlt-build build/setup.sh
327338
_emit_wrapper nlt-services services/nlt-services.sh
328339

329-
_emit_wrapper nlt-airflow-install airflow/setup.sh install
330340
_emit_wrapper nlt-airflow airflow/setup.sh
331-
332-
_emit_wrapper nlt-celery-install celery/setup.sh install
333-
_emit_wrapper nlt-celery-update celery/setup.sh update
334341
_emit_wrapper nlt-celery celery/setup.sh
335-
336-
_emit_wrapper nlt-paperclip-install paperclip/setup.sh install
337342
_emit_wrapper nlt-paperclip paperclip/setup.sh
338-
339-
_emit_wrapper nlt-code-server-install code-server/setup.sh install
340343
_emit_wrapper nlt-code-server code-server/setup.sh
341-
342-
_emit_wrapper nlt-new-api-install new-api/setup.sh install
343344
_emit_wrapper nlt-new-api new-api/setup.sh
345+
rm -f \
346+
"${NLTDEPLOY_ROOT}/bin/nlt-airflow-install" \
347+
"${NLTDEPLOY_ROOT}/bin/nlt-celery-install" \
348+
"${NLTDEPLOY_ROOT}/bin/nlt-celery-update" \
349+
"${NLTDEPLOY_ROOT}/bin/nlt-paperclip-install" \
350+
"${NLTDEPLOY_ROOT}/bin/nlt-code-server-install" \
351+
"${NLTDEPLOY_ROOT}/bin/nlt-new-api-install"
344352

345353
if [[ "${NLTDEPLOY_SKIP_PROFILE_HINT:-}" != "1" ]]; then
346354
echo ""

scripts/services/nlt-services.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,11 @@ _dispatch_install_or_remove() {
231231
fi
232232

233233
case "$name" in
234-
airflow) exec "${NLT_BIN}/nlt-airflow-install" ;;
235-
celery) exec "${NLT_BIN}/nlt-celery-install" ;;
236-
paperclip) exec "${NLT_BIN}/nlt-paperclip-install" ;;
237-
code-server) exec "${NLT_BIN}/nlt-code-server-install" ;;
238-
new-api) exec "${NLT_BIN}/nlt-new-api-install" ;;
234+
airflow) exec "${NLT_BIN}/nlt-airflow" install ;;
235+
celery) exec "${NLT_BIN}/nlt-celery" install ;;
236+
paperclip) exec "${NLT_BIN}/nlt-paperclip" install ;;
237+
code-server) exec "${NLT_BIN}/nlt-code-server" install ;;
238+
new-api) exec "${NLT_BIN}/nlt-new-api" install ;;
239239
pip-sources) exec "${NLT_BIN}/nlt-pip-sources" ;;
240240
python-env) exec "${NLT_BIN}/nlt-python-env" ;;
241241
utils) exec "${NLT_BIN}/nlt-utils" ;;

tests/install_smoke.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@ export NLTDEPLOY_SKIP_GIT_PULL=1
99
bash "${ROOT}/install.sh" install
1010
bash "${ROOT}/install.sh" update
1111
for f in \
12-
nlt-pip-sources nlt-python-env nlt-utils nlt-github-net nlt-services \
13-
nlt-airflow-install nlt-airflow \
14-
nlt-celery-install nlt-celery-update nlt-celery \
15-
nlt-paperclip-install nlt-paperclip \
16-
nlt-code-server-install nlt-code-server \
17-
nlt-new-api-install nlt-new-api
12+
nlt-pip-sources nlt-python-env nlt-utils nlt-github-net nlt-build nlt-services \
13+
nlt-airflow nlt-celery nlt-paperclip nlt-code-server nlt-new-api
1814
do
1915
[[ -x "${NLTDEPLOY_ROOT}/bin/${f}" ]] || { echo "missing: bin/${f}" >&2; exit 1; }
2016
bash -n "${NLTDEPLOY_ROOT}/bin/${f}" || exit 1
2117
done
18+
for bad in \
19+
nlt-airflow-install \
20+
nlt-celery-install nlt-celery-update \
21+
nlt-paperclip-install nlt-code-server-install nlt-new-api-install
22+
do
23+
[[ -e "${NLTDEPLOY_ROOT}/bin/${bad}" ]] && { echo "unexpected deprecated bin/${bad}" >&2; exit 1; }
24+
done
2225
bash -n "${NLTDEPLOY_ROOT}/libexec/nltdeploy/airflow/setup.sh" || exit 1
2326
bash -n "${NLTDEPLOY_ROOT}/libexec/nltdeploy/code-server/setup.sh" || exit 1
2427
bash -n "${NLTDEPLOY_ROOT}/libexec/nltdeploy/new-api/setup.sh" || exit 1
2528
bash -n "${NLTDEPLOY_ROOT}/libexec/nltdeploy/services/nlt-services.sh" || exit 1
29+
python3 -m py_compile "${NLTDEPLOY_ROOT}/libexec/nltdeploy/build/nltbuild_core.py" || exit 1
2630
"${NLTDEPLOY_ROOT}/bin/nlt-services" status --no-http >/dev/null || exit 1
2731
echo "install_smoke OK"

0 commit comments

Comments
 (0)