manmankan 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. manmankan-0.0.1/.githooks/pre-commit +51 -0
  2. manmankan-0.0.1/.github/ISSUE_TEMPLATE/bug_report.md +39 -0
  3. manmankan-0.0.1/.github/ISSUE_TEMPLATE/feature_request.md +30 -0
  4. manmankan-0.0.1/.github/PULL_REQUEST_TEMPLATE.md +34 -0
  5. manmankan-0.0.1/.github/dependabot.yml +27 -0
  6. manmankan-0.0.1/.github/workflows/release.yml +24 -0
  7. manmankan-0.0.1/.github/workflows/test.yml +34 -0
  8. manmankan-0.0.1/.gitignore +50 -0
  9. manmankan-0.0.1/AUTHORS.md +12 -0
  10. manmankan-0.0.1/CHANGELOG.md +56 -0
  11. manmankan-0.0.1/CLAUDE.md +203 -0
  12. manmankan-0.0.1/CONTRIBUTING.md +97 -0
  13. manmankan-0.0.1/LICENSE +21 -0
  14. manmankan-0.0.1/PKG-INFO +297 -0
  15. manmankan-0.0.1/README.md +263 -0
  16. manmankan-0.0.1/SECURITY.md +45 -0
  17. manmankan-0.0.1/docs/compliance.md +46 -0
  18. manmankan-0.0.1/docs/design-kan-doctor.md +154 -0
  19. manmankan-0.0.1/docs/reviews/v0.0.1.md +276 -0
  20. manmankan-0.0.1/docs/roadmap.md +125 -0
  21. manmankan-0.0.1/kan/__init__.py +3 -0
  22. manmankan-0.0.1/kan/cli.py +1302 -0
  23. manmankan-0.0.1/kan/fetcher.py +357 -0
  24. manmankan-0.0.1/kan/models.py +35 -0
  25. manmankan-0.0.1/kan/paths.py +64 -0
  26. manmankan-0.0.1/kan/render.py +58 -0
  27. manmankan-0.0.1/kan/scanner.py +419 -0
  28. manmankan-0.0.1/kan/watchlist.py +299 -0
  29. manmankan-0.0.1/pyproject.toml +85 -0
  30. manmankan-0.0.1/scripts/check-privacy-leaks.sh +128 -0
  31. manmankan-0.0.1/tests/__init__.py +0 -0
  32. manmankan-0.0.1/tests/test_completion_cli.py +119 -0
  33. manmankan-0.0.1/tests/test_fetcher.py +248 -0
  34. manmankan-0.0.1/tests/test_help_cli.py +68 -0
  35. manmankan-0.0.1/tests/test_limit.py +97 -0
  36. manmankan-0.0.1/tests/test_normalize_alignment.py +222 -0
  37. manmankan-0.0.1/tests/test_scan_cli.py +213 -0
  38. manmankan-0.0.1/tests/test_scanner.py +169 -0
  39. manmankan-0.0.1/tests/test_sort_logic.py +211 -0
  40. manmankan-0.0.1/tests/test_trend_cli.py +177 -0
  41. manmankan-0.0.1/tests/test_uninstall_cli.py +138 -0
  42. manmankan-0.0.1/tests/test_watchlist.py +273 -0
  43. manmankan-0.0.1/uv.lock +1277 -0
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # manmankan pre-commit hook
4
+ #
5
+ # 启用方式 (一次性):
6
+ # git config core.hooksPath .githooks
7
+ #
8
+ # 跳过 (不推荐 · 仅紧急情况):
9
+ # git commit --no-verify
10
+ #
11
+ # 详见 CLAUDE.md「公开输出语言规范」+ CONTRIBUTING.md
12
+
13
+ set -uo pipefail
14
+
15
+ REPO_ROOT="$(git rev-parse --show-toplevel)"
16
+ cd "$REPO_ROOT"
17
+
18
+ echo ""
19
+ echo "═══ pre-commit 自检 ═══"
20
+ echo ""
21
+
22
+ # 1. 隐私泄漏自检
23
+ echo "[1/2] 公开档案隐私自检 ..."
24
+ if ! bash scripts/check-privacy-leaks.sh; then
25
+ echo ""
26
+ echo "❌ pre-commit 拦截 · 修复后再 commit"
27
+ echo "💡 临时跳过 (不推荐): git commit --no-verify"
28
+ exit 1
29
+ fi
30
+
31
+ echo ""
32
+ echo "[2/2] ruff lint ..."
33
+ if command -v uv >/dev/null 2>&1; then
34
+ if ! uv run ruff check kan/ tests/ 2>&1; then
35
+ echo ""
36
+ echo "❌ ruff lint 失败 · 修复后再 commit"
37
+ exit 1
38
+ fi
39
+ elif command -v ruff >/dev/null 2>&1; then
40
+ if ! ruff check kan/ tests/ 2>&1; then
41
+ echo ""
42
+ echo "❌ ruff lint 失败 · 修复后再 commit"
43
+ exit 1
44
+ fi
45
+ else
46
+ echo "⚠️ uv / ruff 未安装 · 跳过 lint (建议装上)"
47
+ fi
48
+
49
+ echo ""
50
+ echo "✅ pre-commit 全部通过"
51
+ echo ""
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: 🐛 Bug 上报
3
+ about: 报告慢慢看的 bug · 中文优先
4
+ title: "[Bug] "
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ ## 现象
10
+
11
+ <!-- 你看到了什么?最好贴 terminal 完整输出(敏感信息脱敏)-->
12
+
13
+ ## 复现步骤
14
+
15
+ 1.
16
+ 2.
17
+ 3.
18
+
19
+ ## 期望行为
20
+
21
+ <!-- 你认为应该是什么样? -->
22
+
23
+ ## 环境
24
+
25
+ - 操作系统(macOS / Linux / Windows):
26
+ - Python 版本(`python --version`):
27
+ - manmankan 版本(`kan --version`):
28
+ - 终端宽度(列数 · 影响表格渲染):
29
+ - 终端类型(iTerm / Terminal.app / Windows Terminal / VS Code 等):
30
+
31
+ ## 数据相关
32
+
33
+ - 你跑的命令:
34
+ - 自选股池大小(`kan list | wc -l`):约 N 只
35
+ - 数据是今天的吗(看 `kan scan` 标题"X 更新")?
36
+
37
+ ## 其他线索
38
+
39
+ <!-- 截图 / 异常 traceback / 你的推测 -->
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: ✨ 功能建议
3
+ about: 建议新功能或改进
4
+ title: "[Feature] "
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ ## 你想解决什么问题?
10
+
11
+ <!-- 不要直接说"加 X 功能" · 先描述使用场景和痛点 -->
12
+
13
+ ## 你的建议
14
+
15
+ <!-- 想要什么样的解决方案?怎么个调用方式? -->
16
+
17
+ ## 替代方案
18
+
19
+ <!-- 有其他可能的实现方式吗?为什么这个更好? -->
20
+
21
+ ## 合规自检(金融工具必须)
22
+
23
+ 慢慢看的设计哲学:**位置感入口 ≠ 决策出口**。新功能必须满足:
24
+
25
+ - [ ] 不涉及「建议买卖」「推荐持仓」「目标价」等决策性输出
26
+ - [ ] 不涉及预测涨跌 / 选股推荐 / AI 选股
27
+ - [ ] 仅展示客观数据 + 让用户自行判断
28
+ - [ ] 措辞严守「位置 / 区间 / 触及 / 共振」等中性词
29
+
30
+ 如果建议本身违反上述任一条 · 请理解我们不会接受(参见 README §法律免责)。
@@ -0,0 +1,34 @@
1
+ ## 概述
2
+
3
+ <!-- 1-2 句话说清楚改了什么 / 为什么 -->
4
+
5
+ ## 类型
6
+
7
+ - [ ] 🐛 bug 修复
8
+ - [ ] ✨ 新功能
9
+ - [ ] ♻️ 重构(不改行为)
10
+ - [ ] 📝 文档
11
+ - [ ] ✅ 测试
12
+ - [ ] ⚠️ Breaking change(必填 Migration guide)
13
+
14
+ ## 验证
15
+
16
+ - [ ] `uv run pytest` 全绿
17
+ - [ ] `uv run ruff check kan/ tests/` 无新增 F/E/B/N 类真技术债
18
+ - [ ] **实际跑过 CLI** 验证(不仅看代码 · 见 CONTRIBUTING.md)
19
+
20
+ ## 合规自检(金融工具必须)
21
+
22
+ - [ ] 不涉及买卖建议 / 选股推荐
23
+ - [ ] 输出严守「位置 / 区间 / 触及 / 共振」中性措辞
24
+ - [ ] 风险提示完整保留(不可关闭)
25
+
26
+ ## 相关 issue
27
+
28
+ Closes #
29
+
30
+ ## Migration(如 Breaking change)
31
+
32
+ | v0.x 写法 | v0.y 写法 |
33
+ |---|---|
34
+ | | |
@@ -0,0 +1,27 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ day: "monday"
8
+ open-pull-requests-limit: 5
9
+ labels:
10
+ - "dependencies"
11
+ - "python"
12
+ commit-message:
13
+ prefix: "chore(deps)"
14
+ include: "scope"
15
+
16
+ - package-ecosystem: "github-actions"
17
+ directory: "/"
18
+ schedule:
19
+ interval: "weekly"
20
+ day: "monday"
21
+ open-pull-requests-limit: 3
22
+ labels:
23
+ - "dependencies"
24
+ - "ci"
25
+ commit-message:
26
+ prefix: "chore(ci)"
27
+ include: "scope"
@@ -0,0 +1,24 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ['v*']
6
+
7
+ jobs:
8
+ build-and-publish:
9
+ name: Build and publish to PyPI
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write # trusted publisher OIDC
13
+ contents: read
14
+ steps:
15
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 (pinned 2025-11-13)
16
+ - uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4 (pinned 2024-11-30)
17
+ with:
18
+ python-version: '3.12'
19
+ - name: Build
20
+ run: uv build
21
+ - name: Publish to PyPI
22
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 (pinned 2026-02-18)
23
+ with:
24
+ packages-dir: dist/
@@ -0,0 +1,34 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - 'feat/**'
8
+ - 'fix/**'
9
+ paths-ignore:
10
+ - '**.md'
11
+ - 'docs/**'
12
+ pull_request:
13
+ branches: [main]
14
+
15
+ jobs:
16
+ test:
17
+ runs-on: ${{ matrix.os }}
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ os: [ubuntu-latest, macos-latest]
22
+ python-version: ['3.11', '3.12']
23
+ steps:
24
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 (pinned 2025-11-13)
25
+ - uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4 (pinned 2024-11-30)
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+ enable-cache: true
29
+ - name: Install dependencies
30
+ run: uv sync --all-extras
31
+ - name: Run tests
32
+ run: uv run pytest -q
33
+ - name: Lint
34
+ run: uv run ruff check kan/
@@ -0,0 +1,50 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ .eggs/
10
+
11
+ # Virtual env
12
+ .venv/
13
+ venv/
14
+ .uv/
15
+
16
+ # Environment variables
17
+ .env
18
+ .env.local
19
+
20
+ # Database / Data
21
+ *.db
22
+ *.sqlite
23
+ data/
24
+ *.parquet
25
+
26
+ # Testing
27
+ .pytest_cache/
28
+ .mypy_cache/
29
+ .ruff_cache/
30
+ htmlcov/
31
+ .coverage
32
+ .coverage.*
33
+ .tox/
34
+
35
+ # IDE
36
+ .idea/
37
+ .vscode/
38
+ *.swp
39
+ *.swo
40
+ *~
41
+
42
+ # OS
43
+ .DS_Store
44
+ Thumbs.db
45
+
46
+ # Local / private (any user-private files we don't want to track)
47
+ *.local
48
+ *.private
49
+ *.secret
50
+ *.bak
@@ -0,0 +1,12 @@
1
+ # Authors · 作者
2
+
3
+ ## Maintainer · 维护者
4
+
5
+ - **piklen** — <https://github.com/piklen>
6
+
7
+ ## Contributors · 贡献者
8
+
9
+ Contributions are welcome. See `git log` for a complete list of contributors,
10
+ and [`CONTRIBUTING.md`](CONTRIBUTING.md) for how to get involved.
11
+
12
+ 欢迎贡献。完整贡献者列表请见 `git log`,参与方式请见 [`CONTRIBUTING.md`](CONTRIBUTING.md)。
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.0.1] - 2026-05-10
11
+
12
+ ### Added · 首次公开发布
13
+
14
+ **位置扫描** `kan scan`
15
+ - 多周期位置扫描(3/5/7/10/15/30/60/90/120/180 日)
16
+ - `--high` 高点模式 / `-S --signal` 仅显示有共振信号 / `--diff` 增量模式
17
+ - `--exclude-st` 排除 ST/*ST
18
+ - 多周期共振信号自动高亮(×N 标记)
19
+ - 终端宽度自适应(130+ 列 10 周期 · 100 列 6 周期 · 80 列 4 周期 · 共振列始终可见)
20
+
21
+ **筛选模式**
22
+ - `kan low N [N2 ...]` / `kan high N [N2 ...]` 触及阈值筛选(≤5% 低点 / ≥95% 高点 · 支持多周期)
23
+
24
+ **连续涨跌看板** `kan trend`
25
+ - `--latest N` 近 N 天走势
26
+ - `--down N` / `--up N` 筛选连续涨/跌(N 范围 2-30)
27
+ - `--candle` 阳线阴线口径
28
+ - 涨跌停自动标记
29
+ - 跨板块差异化涨跌停限制(按 2026-07-06 政策日期切换)
30
+
31
+ **单只详情**
32
+ - `kan info <代码>` 全周期位置 + 涨跌 + 共振统计
33
+
34
+ **自选股管理**
35
+ - `kan add` 支持代码 + 名称搜索 + 批量
36
+ - `kan remove` 支持名称 + 批量
37
+ - `kan list` / `kan import` / `kan clear`
38
+ - `kan uninstall` 一次清数据 + 输出包卸载命令(自动检测 uv tool / pipx / pip)
39
+
40
+ **数据层**
41
+ - 多源 K 线 fallback:`baostock → 新浪 → 东财 → 腾讯`
42
+ - 本地 Parquet 缓存(`~/.local/share/kan/data/` · XDG 规范)
43
+ - 7 天 A 股代码-名称缓存 + 自动过期更新
44
+ - `kan fetch [--force]` 手动刷新
45
+
46
+ **Shell 集成**
47
+ - `kan completion install [shell]` 一键启用 zsh / bash / fish / powershell 命令前缀补全
48
+ - 任意命令首次启动自动启用补全(`KAN_NO_COMPLETION_AUTOINSTALL=1` 可关闭 · 非 TTY 跳过)
49
+
50
+ **合规与隐私**
51
+ - 强制风险提示 + 关键词黑名单(无买卖建议 / 无目标价 / 无评级)
52
+ - 所有数据本地存储 · 不上传任何用户数据
53
+ - `CONTRIBUTING.md` + `SECURITY.md` + 公开输出语言纪律
54
+
55
+ [Unreleased]: https://github.com/piklen/manmankan/compare/v0.0.1...HEAD
56
+ [0.0.1]: https://github.com/piklen/manmankan/releases/tag/v0.0.1
@@ -0,0 +1,203 @@
1
+ # CLAUDE.md · manmankan AI 协作纪律
2
+
3
+ > 本文件是给 AI 编程助手(Claude Code / GitHub Copilot / Codex / Cursor 等)的硬约束。
4
+ > 人类 contributor 也适用。
5
+ > manmankan 是公开的 MIT 开源项目,已发布到 PyPI 与 GitHub。
6
+ > AI 协作产出直接进入永久公开档案,因此对 AI 输出有比私有项目**严苛得多**的语言纪律。
7
+
8
+ ---
9
+
10
+ ## 1. 核心原则
11
+
12
+ **写之前先想 — 这条信息在 5 年后被 GitHub 上一个素未谋面的 contributor 看到,会不会显得奇怪 / 暴露内部语境 / 让维护者难堪?**
13
+
14
+ manmankan 所有 commit / changelog / docs / 代码注释都是**永久公开档案**:
15
+
16
+ - 一旦 push 到 `origin/main`,即使删除也会留底(GitHub forks / archive 镜像 / search index)
17
+ - 一旦发布到 PyPI,包内 metadata(含 README / CHANGELOG)**完全无法修改**,只能 yank
18
+
19
+ ---
20
+
21
+ ## 2. 禁用词表(绝对红线 · 任何公开输出禁止出现)
22
+
23
+ ### 2.1 维护者私人称谓 / 昵称
24
+ - 任何在 GitHub 公开身份页之外的称呼
25
+ - 不在公开介绍出现的称谓 / 项目内部口语化称呼
26
+
27
+ **必用替代**:用户 / 维护者 / 开发者
28
+
29
+ ### 2.2 维护者其他工作区 / 项目代号
30
+ - 任何**本仓库 README 未公开介绍**的兄弟项目名
31
+ - 内部工作区代号 / 私有 git 仓库代号
32
+
33
+ **必用替代**:完全不引用(manmankan 是独立项目)
34
+
35
+ ### 2.3 AI 工具自身署名
36
+ - `Claude` / `Codex` / `GitHub Copilot` / `Cursor` / `Plan agent` / `Plan subagent` / `Explore agent`
37
+ - `claude.com/claude-code` 等 AI 工具 promo 链接
38
+ - `🤖 Generated with [Claude Code](...)` 等 AI 生成标记
39
+ - `Co-authored-by: Claude` / `Co-authored-by: <任何 AI 工具>` 等 trailer
40
+
41
+ **必用替代**:完全删除 attribution,由 maintainer 统一署名
42
+
43
+ ### 2.4 AI 协作过程语境
44
+ - `audit-must-user-test` / `audit 漏判` / `user-test 漏判` 等内部协作过程词
45
+ - `LOCKED 准则` / `LOCKED 工作流` / 内部 ADR 编号
46
+ - `合伙人 mode` / `主会话` / `subagent` 等 AI 协作架构语
47
+ - 私有 memory 文件名引用(`feedback_xxx.md` / `project_xxx.md` 等)
48
+ - `用户拍板` / `维护者拍板` / `和 X 讨论` / `X 建议` 类 attribution
49
+
50
+ **必用替代**:直接陈述结论 / 用通用工程语言("测试" / "实测" / "已确认")
51
+
52
+ ### 2.5 维护者个人 / 账户信息
53
+ - 持仓金额 / 账户底子 / 资产规模
54
+ - 维护者其他平台账号 / 私有 alias
55
+
56
+ **必用替代**:完全零提及
57
+
58
+ ### 2.6 跨项目语境(其他赛道 / 其他项目)
59
+ - 任何不属于 manmankan 项目本身的策略 / 监管 / 平台名称
60
+
61
+ **必用替代**:完全零提及(manmankan 边界 = A 股自选股 CLI 工具)
62
+
63
+ ---
64
+
65
+ ## 3. 公开输出规范
66
+
67
+ ### 3.1 Commit message
68
+ - Conventional Commits 格式(`feat:` / `fix:` / `docs:` / `refactor:` / `test:` / `chore:`)
69
+ - subject 简洁描述「做了什么」(用户视角)
70
+ - body 描述「why + how」· **不写**「谁建议 / 谁审 / 谁拍板」
71
+ - **绝对不带** `Co-authored-by: <AI>` trailer
72
+ - **绝对不带** `🤖 Generated with <AI>` 类签名行
73
+ - **绝对不带** AI 工具的 promo 链接
74
+
75
+ ❌ 反例:
76
+ ```
77
+ fix(scan): 大 watchlist 卡死
78
+
79
+ Co-authored-by: Claude Opus 4.7 (1M context)
80
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
81
+ ```
82
+
83
+ ✅ 正例:
84
+ ```
85
+ fix(scan): 大 watchlist 卡死体验 · 并发 + 进度条
86
+
87
+ v0.3.0 串行拉取 172 只可能阻塞 ≥ 9 分钟无反馈。
88
+ fetch_batch 改用 ThreadPoolExecutor (默认并发 5) · 总时间降到 ~30-90s。
89
+ 加 rich.Progress 进度条 · 实时显示进度 % + 已用时间。
90
+ ```
91
+
92
+ ### 3.2 CHANGELOG.md
93
+ - **用户视角**:用户能感知到什么变化、为什么需要
94
+ - "Why" 段写**用户痛点**或**技术原因**,不写**与谁讨论**
95
+ - 涉及隐私 / 用语修复的 entry,用中性表述("措辞规范化"),**不**暗示被修复内容的性质(避免 Streisand 效应引诱读者翻 PyPI 旧版)
96
+
97
+ ❌ 反例:「v0.X.Y 含项目内部私人称谓」「audit 漏判教训」「[audit-must-user-test] LOCKED 准则」
98
+ ✅ 正例:「CHANGELOG / docs 措辞规范化」「测试覆盖漏判」「「真实规模 + 错误路径」必须纳入发布前测试」
99
+
100
+ ### 3.3 设计文档 / Roadmap
101
+ - 不写"X agent 产出 + Y 整理 + Z 拍板" 等 AI 协作脚注
102
+ - 不引用内部 LOCKED memory 名 / 内部 feedback 文件名
103
+ - 角色名用通用工程角色:「维护者」/「代码审查者」/「实施评审」
104
+ - 不用:`Plan agent` / `Claude` / `subagent` / `PM 角色` / `架构师角色`
105
+
106
+ ### 3.4 代码注释
107
+ - 解释 why(非平凡决策 / 隐藏约束 / 已知坑)
108
+ - ❌ "Claude 建议" / "和维护者讨论后" / "audit step #N" / 私有 memory 引用 / LOCKED 准则名
109
+ - ✅ "akshare push2his 对部分 IP 段持续封禁 · retry 无效 · 改 fallback 顺序"
110
+
111
+ ### 3.5 PR 描述 / Issue 评论
112
+ - 同 commit message 规范
113
+ - 不暴露内部 sprint 视角
114
+
115
+ ---
116
+
117
+ ## 4. 发布前自检(强制)
118
+
119
+ ### 4.1 一次性配置 git pre-commit hook(推荐)
120
+
121
+ ```bash
122
+ git config core.hooksPath .githooks
123
+ ```
124
+
125
+ 启用后每次 `git commit` 自动跑禁用词扫描 + ruff lint。
126
+
127
+ ### 4.2 手动跑
128
+
129
+ ```bash
130
+ bash scripts/check-privacy-leaks.sh
131
+ ```
132
+
133
+ 非零退出 = 立即停止 + 修完再 commit。
134
+
135
+ ### 4.3 release 前 checklist
136
+
137
+ - [ ] `bash scripts/check-privacy-leaks.sh` 通过
138
+ - [ ] 检查 `git log --pretty=full <last-tag>..HEAD` 无 AI co-author trailer
139
+ - [ ] 检查 CHANGELOG 对应版本段无内部协作过程词
140
+ - [ ] PyPI metadata(pyproject.toml description / keywords)干净
141
+
142
+ ---
143
+
144
+ ## 5. 不可逆操作的特殊责任
145
+
146
+ ### 5.1 PyPI 发布
147
+ PyPI wheel/sdist **完全不可修改**,只能 yank(标记弃用,元数据永久存档)。release 前的隐私审查 = **一次性最高责任**动作。
148
+
149
+ ### 5.2 GitHub commit history rewrite
150
+ `git filter-repo` + `git push --force` 可清掉历史泄漏,但:
151
+ - 破坏所有 fork / clone(contributors 必须重新拉)
152
+ - 已被搜索引擎 / GitHub archive / 镜像收录的页面留底
153
+
154
+ ### 5.3 AI assistant 行为约束
155
+ 未由维护者明确指示前,**绝不**自主执行:
156
+ - `git push --force` / `git push --force-with-lease` 到 main
157
+ - `git filter-repo` / `git filter-branch` 重写历史
158
+ - `pypi yank` / `twine yank` 任何已发布版本
159
+ - 删除已发布 git tag
160
+
161
+ ---
162
+
163
+ ## 6. AI 工具署名问题(明确立场)
164
+
165
+ GitHub 业界惯例支持 `Co-authored-by: <AI tool>` trailer · **本仓库明确不采用**:
166
+
167
+ - AI 工具是维护者使用的**实现工具**,不是独立 contributor
168
+ - AI 工具 footprint 出现在公开 commit history = AI 协作上下文泄漏
169
+ - 维护者对所有 commit 内容**完全负责**,不需要 AI 共同署名分担
170
+
171
+ **结论**:所有 commit / PR / release notes 中**零提及任何 AI 工具名**。由 maintainer (`piklen`) 统一署名。
172
+
173
+ ---
174
+
175
+ ## 7. 发现泄漏的处理
176
+
177
+ ### 7.1 已发现但未 commit
178
+ 直接修复 + 不带 attribution 重新 commit。
179
+
180
+ ### 7.2 已 commit 但未 push
181
+ - `git commit --amend` 或 `git rebase -i HEAD~N` 重写本地历史
182
+ - 重写时不能引入新 AI co-author trailer
183
+
184
+ ### 7.3 已 push 到 GitHub 但未发版
185
+ - 优先:fix-forward 加新 commit 修复
186
+ - 严重时:`git filter-repo` rewrite history + force push(**必须** maintainer 明确批准)
187
+
188
+ ### 7.4 已发布到 PyPI
189
+ - PyPI 包**完全不可改**
190
+ - 修复版本:patch bump(如 v0.3.3.4 → v0.3.3.5)
191
+ - 严重泄漏:`pypi yank <package>==<version>` 标记弃用
192
+
193
+ ---
194
+
195
+ ## 8. 这份纪律的来源
196
+
197
+ 2026-05-10 maintainer 全面 audit 发现 v0.3.3.x 系列含 AI 协作上下文 + 内部代号 + 内部私人语境。修复后立纪律防再犯。
198
+
199
+ ---
200
+
201
+ **违反本文件任何一条 = 视为 P0 issue**
202
+
203
+ *Last updated: 2026-05-10*
@@ -0,0 +1,97 @@
1
+ # 贡献指南
2
+
3
+ 感谢你对慢慢看的兴趣!
4
+
5
+ ## 开发环境
6
+
7
+ 要求 Python 3.11+,推荐使用 [uv](https://docs.astral.sh/uv/):
8
+
9
+ ```bash
10
+ git clone https://github.com/piklen/manmankan.git
11
+ cd manmankan
12
+ uv sync
13
+ ```
14
+
15
+ ## 运行测试
16
+
17
+ ```bash
18
+ uv run pytest
19
+ uv run pytest --cov=kan # 带覆盖率
20
+ ```
21
+
22
+ ## 代码风格
23
+
24
+ - 使用 [ruff](https://docs.astral.sh/ruff/) 做 lint 和格式化:`uv run ruff check kan/`
25
+ - 类型注解:所有公开函数应有类型注解
26
+ - 命名:小写 + 下划线
27
+ - Pydantic v2 用于数据模型
28
+
29
+ ## 合规红线(重要)
30
+
31
+ 本项目严格定位为**行情数据展示工具**,PR 不应引入任何形式的:
32
+
33
+ - 买卖建议 / 评分评级 / 策略推荐
34
+ - 涨跌预测 / 目标价
35
+ - "建议关注 / 低估 / 见底 / 抄底"等暗示性词汇
36
+
37
+ 详见 [`docs/compliance.md`](docs/compliance.md)。
38
+
39
+ ## 提交流程
40
+
41
+ 1. Fork 本仓库
42
+ 2. 创建功能分支:`git checkout -b feat/your-feature`
43
+ 3. 提交改动:`git commit -m "feat: ..."`
44
+ 4. 推送到 fork:`git push origin feat/your-feature`
45
+ 5. 在 GitHub 上发起 Pull Request
46
+
47
+ ## Commit Message 规范
48
+
49
+ ```
50
+ feat: 新功能
51
+ fix: 修复 bug
52
+ docs: 文档变更
53
+ refactor: 重构(不改变功能)
54
+ test: 测试相关
55
+ chore: 构建/依赖等杂项
56
+ ```
57
+
58
+ **用户视角**:commit message 描述用户能感知到的变化,不暴露内部协作过程 / 私人语境 / sprint 视角。
59
+
60
+ ⚠️ **不带 AI co-author trailer / 不带 AI 工具签名行** —— 详见 [`CLAUDE.md`](CLAUDE.md) §3.1。
61
+
62
+ ## 公开输出语言规范
63
+
64
+ manmankan 是公开开源项目,所有 commit / changelog / docs / 代码注释都是**永久公开档案**。
65
+
66
+ 详细禁用词表 + 中性词替代见 [`CLAUDE.md`](CLAUDE.md)(AI 协作纪律 · 人类 contributor 也适用)。
67
+
68
+ 发布前必跑禁用词扫描:
69
+
70
+ ```bash
71
+ bash scripts/check-privacy-leaks.sh
72
+ ```
73
+
74
+ 或一次性启用 git pre-commit hook:
75
+
76
+ ```bash
77
+ git config core.hooksPath .githooks
78
+ ```
79
+
80
+ ## AI 协助开发
81
+
82
+ 如果你用 AI 编程助手协助开发:
83
+
84
+ - 必须先阅读 [`CLAUDE.md`](CLAUDE.md) 中的公开输出规范 + 禁用词表
85
+ - AI 生成的 commit message 不加 AI co-author trailer 和 AI 工具签名行
86
+ - AI 生成的代码注释 / 文档不暴露 AI 协作过程
87
+ - 提交前跑 `bash scripts/check-privacy-leaks.sh` 自检
88
+
89
+ ## 报告问题
90
+
91
+ 通过 [GitHub Issues](https://github.com/piklen/manmankan/issues) 报告 bug 或提出功能建议。
92
+
93
+ 请提供:
94
+ - 复现步骤
95
+ - 期望行为 vs 实际行为
96
+ - Python 版本、操作系统
97
+ - 相关日志或截图
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 piklen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.