Skip to content

Commit 3bd79ed

Browse files
523034406523034406
authored andcommitted
Release v0.2.0: full CLI, distiller, collectors, generators, evals
- Seven-layer Persona pipeline with resume, interactive distill, dry-run - mentor doctor, config --preset, list/export/import/compare/update - Markdown/PDF/WeChat/Feishu/DingTalk collectors; multi-format Skill output - Tests, GitHub Actions CI, documentation refresh Made-with: Cursor
0 parents  commit 3bd79ed

70 files changed

Lines changed: 11213 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*" # 触发条件:推送 vX.Y.Z 格式的 tag
7+
8+
jobs:
9+
build-and-publish:
10+
name: Build & Publish
11+
runs-on: ubuntu-latest
12+
environment: pypi
13+
permissions:
14+
id-token: write # 使用 OIDC 免密发布(推荐)
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python 3.12
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
24+
- name: Install build tools
25+
run: |
26+
pip install build hatchling
27+
28+
- name: Run tests before publishing
29+
run: |
30+
pip install -e ".[dev]"
31+
pytest tests/ -v --tb=short
32+
33+
- name: Extract version from tag
34+
id: version
35+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
36+
37+
- name: Verify version matches tag
38+
run: |
39+
PKG_VERSION=$(python -c "from mentor_skill import __version__; print(__version__)")
40+
TAG_VERSION="${{ steps.version.outputs.VERSION }}"
41+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
42+
echo "❌ Version mismatch: package=$PKG_VERSION, tag=$TAG_VERSION"
43+
exit 1
44+
fi
45+
echo "✅ Version matched: $PKG_VERSION"
46+
47+
- name: Build package
48+
run: python -m build
49+
50+
- name: Publish to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
# OIDC 模式不需要 password,需在 PyPI 项目设置中配置 Trusted Publisher
53+
54+
create-release:
55+
name: Create GitHub Release
56+
needs: build-and-publish
57+
runs-on: ubuntu-latest
58+
permissions:
59+
contents: write
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
with:
64+
fetch-depth: 0
65+
66+
- name: Extract changelog for this version
67+
id: changelog
68+
run: |
69+
VERSION="${GITHUB_REF_NAME#v}"
70+
# 从 CHANGELOG.md 提取当前版本的更新内容
71+
NOTES=$(awk "/^## \[$VERSION\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md)
72+
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
73+
echo "$NOTES" >> $GITHUB_OUTPUT
74+
echo "EOF" >> $GITHUB_OUTPUT
75+
76+
- name: Create GitHub Release
77+
uses: softprops/action-gh-release@v2
78+
with:
79+
name: mentor-skill ${{ github.ref_name }}
80+
body: ${{ steps.changelog.outputs.NOTES }}
81+
files: dist/*
82+
draft: false
83+
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') }}

.github/workflows/test.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test Python ${{ matrix.python-version }}
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Cache pip
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.cache/pip
31+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
32+
restore-keys: |
33+
${{ runner.os }}-pip-${{ matrix.python-version }}-
34+
35+
- name: Install dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install -e ".[dev]"
39+
40+
- name: Run tests
41+
run: |
42+
pytest tests/ -v --tb=short --no-header
43+
44+
- name: Check CLI starts
45+
run: |
46+
mentor --version
47+
mentor --help
48+
49+
lint:
50+
name: Lint & Type Check
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Python 3.12
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: "3.12"
60+
61+
- name: Install lint tools
62+
run: |
63+
pip install ruff
64+
65+
- name: Ruff lint
66+
run: ruff check src/ --select E,F,W --ignore E501
67+
68+
- name: Ruff format check
69+
run: ruff format --check src/

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.egg-info/
6+
*.egg
7+
.eggs/
8+
dist/
9+
build/
10+
11+
# Virtual env
12+
.venv/
13+
venv/
14+
.env
15+
.env.*
16+
17+
# Tools / tests
18+
.pytest_cache/
19+
.ruff_cache/
20+
.mypy_cache/
21+
.coverage
22+
htmlcov/
23+
24+
# Local mentor data (user machine)
25+
.mentor/
26+
27+
# OS / editor
28+
.DS_Store
29+
.idea/
30+
.vscode/
31+
*.swp

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Changelog
2+
3+
All notable changes to mentor-skill are documented here.
4+
5+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
---
9+
10+
## [Unreleased]
11+
12+
### Planned (v0.3+)
13+
- 如流数据源、evals 基线跑通与持续蒸馏调优
14+
15+
---
16+
17+
## [0.2.0] — 2026-04-06
18+
19+
### Added
20+
- **`mentor doctor`**:检查配置、数据目录、`*_raw.json`、Persona 与 7 层完整性、`litellm` / `playwright`;可选 **`--check-llm`** 发短请求验证连通性
21+
- **`mentor config --preset`**:一键设置 `llm.model` + `llm.api_base``zhipu` / `deepseek` / `qwen` / `minimax` / `openai`);**`--set key.subkey=value`** 支持两层配置键
22+
- **`mentor list`**:列出 Persona,**`--verbose`** 详情
23+
- **`mentor demo`**:内置 Sample Persona;**`--full`** 展示完整 pipeline dry-run
24+
- **`mentor --version` / `-V`**
25+
- **`mentor test`**:多轮对话;**`--ask`** 单次模式
26+
- **`mentor distill --resume`**:断点恢复;**`--interactive`** 逐层确认;**`--dry-run`** 计划与 token/费用预估
27+
- **`mentor generate --format`**`generic` / `cursor` / `claude` / `openclaw` / `all`
28+
- **`mentor compare`**:逐层对比两个 Persona
29+
- **`mentor update`**:增量更新 Persona
30+
- **`mentor export` / `mentor import`**`.mentor.zip` 打包与导入(**`--overwrite`**
31+
- **`mentor analyze`** 增强:高价值比例、平均消息长度、Top-5 高价值预览
32+
- **L7 模型字段 `next_check_ins`**:与蒸馏层输出对齐;通用 / Claude SKILL 生成中展示
33+
- **蒸馏层 Prompt(L1–L7)**:证据约束、跨层上下文、对话对优先、L7 结构化记忆与追问要点
34+
- **`config.yaml.example`****`examples/sample-mentor-docs/`****`CONTRIBUTING.md`**
35+
- **evals**`metrics.py``run_eval.py``product_qa` / `tech_qa` / `academic_qa``evals/personas/sample_mentor/`
36+
- **tests/**`test_analyzers` / `test_collectors` / `test_distiller` / `test_generator` / **`test_cli`**(Typer 集成)
37+
- **CI**`.github/workflows/test.yml`(Python 3.10–3.13)、`publish.yml`(Tag → PyPI)
38+
39+
### Generators
40+
- **CursorRuleGenerator**`.mdc`)、**ClaudeSkillGenerator****OpenClawSkillGenerator**
41+
42+
### Collectors
43+
- **Feishu**:文档正文(docx/doc/wiki);用户搜索三层 fallback
44+
- **Dingtalk**:知识库正文;Playwright 消息采集
45+
- **Markdown**:glob 修复(`**/*.md`
46+
47+
### Distiller
48+
- Rich 进度条(ETA / 用时);蒸馏前 **token 用量与费用预估**(多厂商价表)
49+
50+
### Code quality
51+
- ruff 清理(F821/F841/E722/E741 等);版本 **0.2.0**`__init__.py` + `pyproject.toml`
52+
- 修复:`list` 命令名遮蔽内置 `list`,导致 `compare``isinstance(..., list)` 异常(模块级保留 `_list_type`
53+
- 修复:CLI 实现改名为 **`list_personas`** + `@app.command("list")`,避免 Typer 子命令解析错乱(曾出现执行 `doctor` 时误跑 `list -v`);**`mentor doctor`** 对数据目录 `Path.resolve()` 后再 glob `*_raw.json`(macOS `/var``/private/var`
54+
55+
### Docs
56+
- README 重写:徽章、快速体验、7 层示意、命令参考
57+
58+
---
59+
60+
## [0.1.0] — 2026-04-05
61+
62+
### Added
63+
- 项目初始化,7 层 Persona 模型设计
64+
- CLI 框架:`init` / `collect` / `analyze` / `distill` / `generate` / `config`
65+
- 数据采集:Markdown / PDF / WeChat / Feishu / DingTalk
66+
- 蒸馏引擎:L1-L7 七层顺序蒸馏,litellm 多模型支持
67+
- 生成器:通用 SKILL.md 格式
68+
- 数据模型:`Persona`(7 层)/ `RawMessage` / `DialogPair`
69+
- 配置系统:`config.yaml` 支持多 LLM 厂商配置

0 commit comments

Comments
 (0)