install: treat xiaohe-agent/packages/mytoolkit as the working tree.
Refuse only GHA _work installs; drop the standalone myBin checkout as the install target.
This commit is contained in:
@@ -72,16 +72,18 @@ mytoolkit completion zsh # 打印 zsh 补全脚本
|
|||||||
| LaTeX 编译 | `mytoolkit latex compile paper.tex` |
|
| LaTeX 编译 | `mytoolkit latex compile paper.tex` |
|
||||||
| BibTeX 转 Markdown | `mytoolkit convert refs.bib -o refs.md` |
|
| BibTeX 转 Markdown | `mytoolkit convert refs.bib -o refs.md` |
|
||||||
| AVI 视频转 MP4 | `mytoolkit convert video.avi -o video.mp4` |
|
| AVI 视频转 MP4 | `mytoolkit convert video.avi -o video.mp4` |
|
||||||
| 更新工具本身 | `cd mytoolkit && make install` |
|
| 更新工具本身 | `cd <xiaohe-agent>/packages/mytoolkit && make install` |
|
||||||
|
|
||||||
## 安装与更新
|
## 安装与更新
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/workspace/packages/mytoolkit && make install
|
cd <xiaohe-agent>/packages/mytoolkit && make install
|
||||||
|
# 或:cd <xiaohe-agent> && make update / ./setup.sh
|
||||||
mytoolkit --version
|
mytoolkit --version
|
||||||
mytoolkit templates list
|
python3 -m pip show mytoolkit | grep Editable
|
||||||
|
# 期望:.../xiaohe-agent/packages/mytoolkit
|
||||||
```
|
```
|
||||||
|
|
||||||
> **重要**:修改 `packages/mytoolkit` 中的源码、或用 `git pull` / `git submodule update` 拉取更新后,**都必须重新执行 `make install`**(或 `mytoolkit update`)。Python 的 editable 安装不会自动跟踪源码改动,不重装则 CLI 调用的仍是旧版本。验证方式:`mytoolkit --version` 或 `which mytoolkit`。
|
> **重要**:修改 `packages/mytoolkit` 源码或 `git submodule update` 后须重新 `make install`(或走 monorepo `make update`)。勿从 `~/.xiaohe/actions-runner/_work/...` 安装。旁路备份克隆(如 `~/Documents/myBin/mytoolkit`)不要用来 install。
|
||||||
|
|
||||||
> **唯一真源**:mytoolkit 的具体用法、命令参数、模板说明以 **已安装的 mytoolkit 包** 为准(`mytoolkit info paths` 查路径、`mytoolkit info docs <name>` 打印参考文档)。**设计决策与仓库约定**(脚手架取舍、文档生成工作流、命名等)见仓库 `AGENTS.md`。若 `mytoolkit` 命令不可用,可按默认开发路径 `~/workspace/packages/mytoolkit/` 查找。本 skill 的 `references/` 仅作为 `info docs` 未覆盖命令的速查补充。
|
> **唯一真源**:用法以已安装包为准(`mytoolkit info paths` / `info docs`);仓库约定见 `AGENTS.md`。本 skill `references/` 仅作速查补充。
|
||||||
|
|||||||
@@ -146,17 +146,18 @@ mytoolkit init journal springer mydir
|
|||||||
|
|
||||||
### 本机安装(防串源)
|
### 本机安装(防串源)
|
||||||
|
|
||||||
真源检出:`~/Documents/myBin/mytoolkit`(远程 `apaam/mytoolkit`)。
|
真源检出:`xiaohe-agent/packages/mytoolkit`(submodule → `apaam/mytoolkit`)。
|
||||||
|
本机旁路克隆(如 `~/Documents/myBin/mytoolkit`)仅作备份,不要用来 `make install`。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/Documents/myBin/mytoolkit && make install
|
cd <xiaohe-agent>/packages/mytoolkit && make install
|
||||||
|
# 或随 monorepo:cd <xiaohe-agent> && make update / ./setup.sh
|
||||||
python3 -m pip show mytoolkit | grep Editable
|
python3 -m pip show mytoolkit | grep Editable
|
||||||
# 必须是 .../Documents/myBin/mytoolkit
|
# 必须是 .../xiaohe-agent/packages/mytoolkit
|
||||||
```
|
```
|
||||||
|
|
||||||
- **禁止**在 `~/.xiaohe/actions-runner/_work/...` 或任意 GHA worktree 里 `pip install -e`
|
- **禁止**在 `~/.xiaohe/actions-runner/_work/...` 里 `pip install -e`(会把 CLI 指到 ephemeral 树)
|
||||||
- **禁止**把 `xiaohe-agent/packages/mytoolkit` submodule 当开发树安装(那只是 pin)
|
- `make install` 会拒绝上述 runner worktree
|
||||||
- `make install` 会拒绝上述路径,并装进 PATH 上 `mytoolkit` 所用的 Python
|
|
||||||
|
|
||||||
### 测试
|
### 测试
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
ROOT_DIR := $(shell pwd)
|
ROOT_DIR := $(shell pwd)
|
||||||
# Prefer an explicit PYTHON=; else the interpreter behind `mytoolkit` on PATH;
|
|
||||||
# else python3. Never silently install into a different Python than the CLI.
|
# Prefer PYTHON= override. Else shebang of `mytoolkit` on PATH. Else python3.
|
||||||
|
ifndef PYTHON
|
||||||
CLI_BIN := $(shell command -v mytoolkit 2>/dev/null)
|
CLI_BIN := $(shell command -v mytoolkit 2>/dev/null)
|
||||||
CLI_PY := $(if $(CLI_BIN),$(shell head -1 "$(CLI_BIN)" 2>/dev/null | sed 's|^#!||'),)
|
ifneq ($(CLI_BIN),)
|
||||||
PYTHON ?= $(if $(CLI_PY),$(CLI_PY),python3)
|
PYTHON := $(shell head -1 "$(CLI_BIN)" 2>/dev/null | sed 's|^#!||')
|
||||||
|
endif
|
||||||
|
ifeq ($(strip $(PYTHON)),)
|
||||||
|
PYTHON := python3
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: help install uninstall sync-skill test
|
.PHONY: help install uninstall sync-skill test
|
||||||
|
|
||||||
@@ -11,18 +17,19 @@ help:
|
|||||||
@echo "Usage: make [target]"
|
@echo "Usage: make [target]"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " install Editable install into CLI Python + sync skill"
|
@echo " install Editable install into CLI Python + sync skill"
|
||||||
@echo " (refuse runner/_work trees; PYTHON=$(PYTHON))"
|
@echo " (refuse GHA runner/_work trees; PYTHON=$(PYTHON))"
|
||||||
@echo " sync-skill Copy the bundled agent skill to ~/.agents/skills/mytoolkit/"
|
@echo " sync-skill Copy the bundled agent skill to ~/.agents/skills/mytoolkit/"
|
||||||
@echo " test Run the pytest suite"
|
@echo " test Run the pytest suite"
|
||||||
@echo " uninstall Uninstall mytoolkit and remove shell completions"
|
@echo " uninstall Uninstall mytoolkit and remove shell completions"
|
||||||
|
|
||||||
# Canonical checkout: ~/Documents/myBin/mytoolkit (apaam/mytoolkit).
|
# Truth source for day-to-day work: xiaohe-agent/packages/mytoolkit (submodule).
|
||||||
# Do NOT `pip install -e` from GHA _work or xiaohe packages/ submodule.
|
# Refuse ephemeral GHA runner checkouts so PATH CLI cannot silently point at _work.
|
||||||
install:
|
install:
|
||||||
@case "$(ROOT_DIR)" in \
|
@case "$(ROOT_DIR)" in \
|
||||||
*/_work/*|*/actions-runner/*|*/.xiaohe/actions-runner/*) \
|
*/_work/*|*/.xiaohe/actions-runner/*) \
|
||||||
echo "ERROR: refuse install from runner/worktree: $(ROOT_DIR)" >&2; \
|
echo "ERROR: refuse install from GHA runner worktree: $(ROOT_DIR)" >&2; \
|
||||||
echo "Use: cd ~/Documents/myBin/mytoolkit && make install" >&2; \
|
echo "Use: cd <xiaohe-agent>/packages/mytoolkit && make install" >&2; \
|
||||||
|
echo " or: cd <xiaohe-agent> && make update / ./setup.sh" >&2; \
|
||||||
exit 1 ;; \
|
exit 1 ;; \
|
||||||
esac
|
esac
|
||||||
@echo "Installing editable mytoolkit"
|
@echo "Installing editable mytoolkit"
|
||||||
@@ -36,7 +43,7 @@ install:
|
|||||||
@$(PYTHON) -m pip show mytoolkit | awk '/^(Name|Version|Location|Editable project location):/'
|
@$(PYTHON) -m pip show mytoolkit | awk '/^(Name|Version|Location|Editable project location):/'
|
||||||
@ed="$$($(PYTHON) -m pip show mytoolkit | awk -F': ' '/Editable project location:/ {print $$2}')"; \
|
@ed="$$($(PYTHON) -m pip show mytoolkit | awk -F': ' '/Editable project location:/ {print $$2}')"; \
|
||||||
case "$$ed" in \
|
case "$$ed" in \
|
||||||
*/_work/*|*/actions-runner/*) \
|
*/_work/*|*/.xiaohe/actions-runner/*) \
|
||||||
echo "ERROR: Editable still points at runner tree: $$ed" >&2; exit 1 ;; \
|
echo "ERROR: Editable still points at runner tree: $$ed" >&2; exit 1 ;; \
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user