Files
cmbuyer/init.sh
T

68 lines
2.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# cmbuyer 标准启动与验证入口(Unix shell 版),与 init.ps1 等价,二选一。
#
# 注意:本项目的构建与验证工具链只在 Windows 侧(Go SDK、Python 环境、Android SDK)。
# 在 WSL 中运行本脚本通常会因缺少工具链而失败——这是预期行为,不是 bug。
# 正式验证请在 Windows PowerShell 运行 ./init.ps1。
#
# T-001 / T-002 / T-003 落地后补全命令,并同步:
# docs/03-tech-stack.md、docs/00-ai-start-here.md、docs/current-state.md
set -euo pipefail
cd "$(dirname "$0")"
export GOTOOLCHAIN=local
pending=()
echo "==> 当前目录: $(pwd)"
# ---------------------------------------------------------------- web 端(Go)
if [ -d web ]; then
echo "==> web 端:同步依赖"
( cd web && go mod download )
echo "==> web 端:静态检查"
( cd web && go vet ./... )
echo "==> web 端:测试"
( cd web && go test ./... )
else
echo "==> web 端:目录 web/ 不存在,跳过。先做 T-001(初始化 web 端 Go 骨架)。"
pending+=("T-001 初始化 web 端 Go 骨架")
fi
# ------------------------------------------------------------ desk 端(Python)
if [ -d desk ]; then
echo "==> desk 端:同步依赖"
( cd desk \
&& { [ -d .venv ] || python3 -m venv .venv; } \
&& .venv/bin/python -m pip install -q -r requirements.txt )
echo "==> desk 端:语法检查"
( cd desk && .venv/bin/python -m compileall -q src tests )
echo "==> desk 端:测试"
( cd desk && .venv/bin/python -m unittest discover -s tests -t . )
else
echo "==> desk 端:目录 desk/ 不存在,跳过。先做 T-002(初始化 desk 端 Python 骨架)。"
pending+=("T-002 初始化 desk 端 Python 骨架")
fi
# ------------------------------------------------------------------ 文档自检
echo "==> 校验 agent 上下文清单"
python3 scripts/validate_agent_context.py
# -------------------------------------------------------------------- 汇总
echo
if [ ${#pending[@]} -gt 0 ]; then
echo "==> 尚未初始化的部分:"
for item in "${pending[@]}"; do echo " - $item"; done
echo
echo "当前仓库只有文档。按 docs/06-tasks.md 领取上述任务后再运行本脚本。"
exit 3
fi
echo "==> 启动命令"
echo " web 端: cd web && go run ./cmd/server"
echo " desk 端: cd desk && .venv/bin/python src/main.py"
echo
echo "基础验证失败时先修基线,不要在坏的起点上继续叠新功能。"
echo "真机连接与设备验收只能由人工完成,agent 不得据此把任务标为 DONE。"