diff --git a/.gitignore b/.gitignore index 553259d..d77646f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ __pycache__/ # 上游子仓库元数据(raw/llm_wiki 的来源仓库备份,恢复上游更新时改名为 .git) raw/llm_wiki/.git.bak + +# Obsidian 运行时状态(窗口布局等,逐机不同,不应进入版本控制) +.obsidian/workspace.json +.obsidian/workspace-mobile.json diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json deleted file mode 100644 index 4d1d8d6..0000000 --- a/.obsidian/workspace.json +++ /dev/null @@ -1,244 +0,0 @@ -{ - "main": { - "id": "d1b946394494730d", - "type": "split", - "children": [ - { - "id": "bafcef641122da54", - "type": "tabs", - "children": [ - { - "id": "7e8c0fba09ad238c", - "type": "leaf", - "state": { - "type": "markdown", - "state": { - "file": "raw/期货/20-品种新闻/焦煤/日报/2026-08-06_焦煤日报.md", - "mode": "source", - "source": false - }, - "icon": "lucide-file", - "title": "2026-08-06_焦煤日报" - } - } - ] - } - ], - "direction": "vertical" - }, - "left": { - "id": "25233c1a01ae40dd", - "type": "split", - "children": [ - { - "id": "556d942fb29f95c8", - "type": "tabs", - "children": [ - { - "id": "6841af199caa58fd", - "type": "leaf", - "state": { - "type": "file-explorer", - "state": { - "sortOrder": "alphabetical", - "autoReveal": false, - "showSearch": false, - "searchQuery": "" - }, - "icon": "lucide-folder-closed", - "title": "文件列表" - } - }, - { - "id": "efb5da93abae8a42", - "type": "leaf", - "state": { - "type": "search", - "state": { - "query": "", - "matchingCase": false, - "explainSearch": false, - "collapseAll": false, - "extraContext": false, - "sortOrder": "alphabetical" - }, - "icon": "lucide-search", - "title": "搜索" - } - }, - { - "id": "d47b0191e9ea948e", - "type": "leaf", - "state": { - "type": "bookmarks", - "state": { - "showSearch": false, - "searchQuery": "" - }, - "icon": "lucide-bookmark", - "title": "书签" - } - } - ] - } - ], - "direction": "horizontal", - "width": 300 - }, - "right": { - "id": "2b042b53367f20f0", - "type": "split", - "children": [ - { - "id": "103e3ddcc6065b7a", - "type": "tabs", - "children": [ - { - "id": "709f6cac006d06bd", - "type": "leaf", - "state": { - "type": "backlink", - "state": { - "file": "raw/llm_wiki/mcp-server/README.md", - "collapseAll": false, - "extraContext": false, - "sortOrder": "alphabetical", - "showSearch": false, - "searchQuery": "", - "backlinkCollapsed": false, - "unlinkedCollapsed": true - }, - "icon": "links-coming-in", - "title": "反向链接" - } - }, - { - "id": "a885af2199869ca7", - "type": "leaf", - "state": { - "type": "outgoing-link", - "state": { - "file": "raw/llm_wiki/mcp-server/README.md", - "linksCollapsed": false, - "unlinkedCollapsed": true - }, - "icon": "links-going-out", - "title": "出链" - } - }, - { - "id": "bf9b9d9c7779db2e", - "type": "leaf", - "state": { - "type": "tag", - "state": { - "sortOrder": "frequency", - "useHierarchy": true, - "showSearch": false, - "searchQuery": "" - }, - "icon": "lucide-tags", - "title": "标签" - } - }, - { - "id": "0cc1103a1470f556", - "type": "leaf", - "state": { - "type": "all-properties", - "state": { - "sortOrder": "frequency", - "showSearch": false, - "searchQuery": "" - }, - "icon": "lucide-archive", - "title": "添加笔记属性" - } - }, - { - "id": "c828df96a07dc63e", - "type": "leaf", - "state": { - "type": "outline", - "state": { - "file": "raw/llm_wiki/mcp-server/README.md", - "followCursor": false, - "showSearch": false, - "searchQuery": "" - }, - "icon": "lucide-list", - "title": "大纲" - } - } - ] - } - ], - "direction": "horizontal", - "width": 300, - "collapsed": true - }, - "left-ribbon": { - "hiddenItems": { - "switcher:打开快速切换": false, - "graph:查看关系图谱": false, - "canvas:新建白板": false, - "daily-notes:打开/创建今天的日记": false, - "templates:插入模板": false, - "command-palette:打开命令面板": false, - "bases:新建数据库": false - } - }, - "active": "6841af199caa58fd", - "lastOpenFiles": [ - "wiki/concepts/焦煤2026年8月市场回顾.md", - "raw/期货/01-基本分析逻辑/焦煤日报/scripts/__pycache__/auto_daily_report.cpython-314.pyc", - "raw/期货/20-品种新闻/焦煤/日报/2026-07-24_焦煤日报.md", - "raw/期货/01-基本分析逻辑/焦煤日报/scripts/auto_daily_report.py", - "raw/期货/20-品种新闻/焦煤/事件/2026-08-06_山西焦煤西曲矿安全事故停产.md", - "raw/期货/20-品种新闻/焦煤/日报/2026-08-05_焦煤日报.md", - "raw/期货/20-品种新闻/焦煤/日报/2026-08-04_焦煤日报.md", - "raw/期货/20-品种新闻/焦煤/日报/2026-08-03_焦煤日报.md", - "raw/期货/20-品种新闻/焦煤/日报/2026-07-31_焦煤日报.pdf", - "verify_tushare_jm.py", - "资本小论.md", - "wiki/queries/What-is-Harness-Engineering-in-Simple-Terms.md", - "wiki/practices/玻璃期货研究框架.md", - "wiki/practices/LangChain-Harness-Engineering.md", - "wiki/sources.md", - "raw/期货/10-品种相关/烧碱/烧碱期货品种手册-郑商所-2025-12.md", - "raw/工程技术:在智能体优先的世界中利用 Codex.md", - "raw/期货/10-品种相关/烧碱/烧碱期货投教材料.docx", - "raw/股票/01-投资方法/股票投资要义-胡斐-2015.md", - "raw/期货/10-品种相关/玻璃/README.md", - "raw/期货/10-品种相关/玻璃/玻璃周期、产能出清与研究问题.md", - "raw/期货/10-品种相关/玻璃/玻璃行业基础与供应链.md", - "raw/期货/10-品种相关/玻璃/玻璃数据字典与数据库设计.md", - "raw/期货/10-品种相关/玻璃/玻璃生产工艺与成本模型.md", - "raw/期货/10-品种相关/玻璃/玻璃期货投教材料-郑商所-2021-06.md", - "raw/期货/10-品种相关/玻璃/玻璃期货合约与研究方法.md", - "raw/期货/_meta/目录迁移记录.md", - "raw/期货/README.md", - "raw/期货/90-待核验/期货价格走势分析框架-原始剪藏.md", - "wiki/concepts/奇异型期限结构与期现套利分析.md", - "wiki/concepts/中国房地产市场制度演进与周期阶段.md", - "raw/期货/01-基本分析逻辑/焦煤分析技能", - "raw/期货/01-基本分析逻辑/事件驱动", - "raw/期货/01-基本分析逻辑/焦煤日报/scripts/Generate-JmDailyReport.ps1", - "raw/期货/01-基本分析逻辑/焦煤日报/scripts/extract_pdf_sections.py", - "raw/期货/01-基本分析逻辑/焦煤日报/scripts/extract_pdf_preview.py", - "未命名.canvas", - "images/webui.jpeg", - "images/skill.png", - "images/obsidian-index.png", - "未命名 3.canvas", - "未命名 1.canvas", - "未命名 2.canvas", - "raw/期货/01-基本分析逻辑/技术分析图.jpg", - "raw/llm_wiki/src/assets/logo.jpg", - "raw/llm_wiki/src-tauri/icons/icon.png", - "raw/llm_wiki/src-tauri/icons/32x32.png", - "raw/llm_wiki/src-tauri/icons/128x128@2x.png", - "raw/llm_wiki/src-tauri/icons/128x128.png", - "raw/images/4f67b1c10566552aec514a716ea43544ab330e0b-668x243.webp" - ] -} \ No newline at end of file diff --git a/tools/wiki-push.ps1 b/tools/wiki-push.ps1 new file mode 100644 index 0000000..a806295 --- /dev/null +++ b/tools/wiki-push.ps1 @@ -0,0 +1,74 @@ +#requires -Version 7 +<# +.SYNOPSIS + 一键提交并推送到自建 Gitea 远程(jzy/my_wiki)。 + +.DESCRIPTION + 固化推送流程:可选先运行 wiki-audit.ps1 审计门禁,然后 + git add -A -> commit -> push gitea main,最后显示同步状态。 + 不修改任何知识正文,只负责版本控制操作。 + +.PARAMETER Message + 提交信息。缺省时自动生成 "maintain | YYYY-MM-DD Wiki 增量更新"。 + +.PARAMETER Audit + 推送前先运行 tools/wiki-audit.ps1;审计存在 ERROR 时中止推送。 + +.PARAMETER FailOnWarning + 与 -Audit 配合使用:将审计 WARNING 也视为失败(严格门禁)。 + +.EXAMPLE + pwsh -File .\tools\wiki-push.ps1 -Message "ingest | 8 月焦煤日报登记" + pwsh -File .\tools\wiki-push.ps1 -Audit -Message "维护后推送" +#> +param( + [string]$Message = '', + [switch]$Audit, + [switch]$FailOnWarning +) + +$ErrorActionPreference = 'Stop' +$root = Split-Path -Parent $PSScriptRoot +Set-Location $root + +# 1) 可选审计门禁:ERROR 阻断,WARNING 默认放行(-FailOnWarning 时也阻断) +if ($Audit) { + $auditArgs = @('-NoProfile', '-File', (Join-Path $root 'tools\wiki-audit.ps1')) + if ($FailOnWarning) { $auditArgs += '-FailOnWarning' } + & pwsh @auditArgs + if ($LASTEXITCODE -ne 0) { + Write-Error "审计未通过(exit $LASTEXITCODE),已中止推送。" + exit 1 + } + Write-Host '[1/4] 审计通过。' -ForegroundColor Green +} else { + Write-Host '[1/4] 跳过审计(使用 -Audit 可在推送前执行)。' -ForegroundColor DarkGray +} + +# 2) 检查变更 +$changes = git status --porcelain +if (-not $changes) { + Write-Host '[2/4] 没有待提交的变更,无需推送。' -ForegroundColor Yellow + exit 0 +} +Write-Host "[2/4] 待提交变更 $((($changes | Measure-Object).Count)) 项。" -ForegroundColor Cyan +$changes | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray } + +# 3) 提交 +if (-not $Message) { + $Message = "maintain | $(Get-Date -Format 'yyyy-MM-dd') Wiki 增量更新" +} +git add -A +git commit -m $Message +if ($LASTEXITCODE -ne 0) { Write-Error 'git commit 失败。'; exit 1 } +Write-Host '[3/4] 提交完成。' -ForegroundColor Green + +# 4) 推送(唯一远程 gitea,显式指定分支) +git push gitea main +if ($LASTEXITCODE -ne 0) { Write-Error 'git push 失败,请检查网络与凭据(.git/config 中的 token)。'; exit 1 } +Write-Host '[4/4] 推送完成。' -ForegroundColor Green + +# 5) 结果 +git status -sb | Select-Object -First 1 +Write-Host "推送内容:$Message" +exit 0 diff --git a/wiki/_meta/WIKI-SCHEMA.md b/wiki/_meta/WIKI-SCHEMA.md index fd4bad6..aba7e2e 100644 --- a/wiki/_meta/WIKI-SCHEMA.md +++ b/wiki/_meta/WIKI-SCHEMA.md @@ -1,6 +1,6 @@ --- title: "WikiLLM 知识库规范" -last_updated: 2026-08-03 +last_updated: 2026-08-07 type: schema --- @@ -198,3 +198,28 @@ pwsh -File .\tools\wiki-reflect.ps1 ``` 严格门禁可使用 `-FailOnWarning` 或 `-FailOnFindings`,但超长页面、历史规则和低置信度页面首先是人工审阅任务,不等于自动错误。 + +## 10. 远程同步与推送流程 + +本仓库的唯一远程是自建 Gitea:`gitea` → `http://10.4.167.10:63000/jzy/my_wiki.git`(账户 `jzy`,分支 `main`)。搭建时参考的 GitHub 上游 `origin` 已移除,不得再依赖外部仓库。 + +每次维护完成后的标准推送: + +```powershell +pwsh -File .\tools\wiki-push.ps1 -Audit -Message "描述本次变更" +``` + +`tools/wiki-push.ps1` 固化流程: + +1. `-Audit` 时先运行 `wiki-audit.ps1`,存在 ERROR 即中止(`-FailOnWarning` 可升级为严格门禁); +2. `git add -A` 并提交(`-Message` 缺省时自动生成 `maintain | 日期 Wiki 增量更新`); +3. `git push gitea main`,失败时提示检查网络与凭据。 + +凭据说明:access token 明文保存在 `.git/config` 的远程 URL 中,仅限内网使用;如 token 泄露或服务器可被他人访问,应在 Gitea「设置 → 应用」轮换 token,或改用 SSH 密钥方式。`git` 凭据不得写入仓库内任何文件(`.env`、脚本、日志均禁止)。 + +版本控制约定: + +- `.obsidian/workspace.json` 等 Obsidian 运行时状态已被 `.gitignore` 排除并停止跟踪,不进入提交; +- `raw/llm_wiki/.git.bak` 是上游子仓库元数据备份,被 `.gitignore` 排除;恢复上游更新时改名为 `.git` 使用; +- `__pycache__/` 与 `*.pyc` 等编译缓存不进入提交; +- 每次推送前应确认 `git status` 中无意外文件,推送后在 Gitea 页面核对提交记录。 diff --git a/wiki/compile.log b/wiki/compile.log index 93ac472..a9c13f5 100644 --- a/wiki/compile.log +++ b/wiki/compile.log @@ -217,3 +217,11 @@ - 编译:新增 `wiki/concepts/焦煤2026年8月市场回顾.md`(case-study,截至 8-06 的月度主线、行情、现货基差、供需、库存、事件链与 8 月跟踪问题);更新 `wiki/INDEX.md`、`wiki/sources.md`、`wiki/compile-results.tsv`(追加 6 行:日报 4 行 status=success,周报/事件 2 行 status=success_review_source)。 - 证据边界:盘面字段为方案二 REST fut_daily 正式日线;现货、库存、供需为多机构公开口径交叉标注;西曲矿事件为盘后公告(2026-026),8-06 盘面未包含该信息,需跟踪调查认定与复产时间。 - 哈希:6 个文件均为当前文件字节 SHA-256,已登记(日报 cb2794…/0e519d…/609a43…/63530f…;周报 529699…;事件 12aa20…)。 + +## [2026-08-07] maintain | 固化推送流程与远程配置 + +- 远程:新增自建 Gitea 远程 `gitea`(http://10.4.167.10:63000/jzy/my_wiki.git,账户 jzy,分支 main);移除搭建参考用的 GitHub `origin`(wang-junjian/wikillm)。首个推送提交 c6ec760 后本地 main 跟踪 gitea/main。 +- 工具:新增 `tools/wiki-push.ps1`,固化"可选审计门禁 -> git add/commit -> push gitea main"流程;`-Audit` 阻断 ERROR,`-FailOnWarning` 升级严格门禁。 +- 规范:`wiki/_meta/WIKI-SCHEMA.md` 增加第 10 节"远程同步与推送流程",记录唯一远程、标准推送命令、凭据边界与版本控制约定。 +- 版本控制:`.gitignore` 新增 `.obsidian/workspace.json`(Obsidian 运行时状态)并 `git rm --cached` 停止跟踪;此前已排除 `__pycache__/`、`*.pyc`、`raw/llm_wiki/.git.bak`。 +- 凭据:access token 明文存于 .git/config 远程 URL,仅限内网;后续如需可轮换或改 SSH。