diff --git a/.github/workflows/bridge-changes-to-notion.yml b/.github/workflows/bridge-changes-to-notion.yml new file mode 100644 index 00000000..795ed26c --- /dev/null +++ b/.github/workflows/bridge-changes-to-notion.yml @@ -0,0 +1,72 @@ +name: 铸渊 · Bridge E · GitHub Changes → Notion + +# 管道 E:main 分支有 push 或 PR 创建/关闭 → 变更摘要同步到 Notion「📋 GitHub 变更日志」数据库 +# +# 依赖 Secrets(仓库 Settings → Secrets and variables → Actions): +# NOTION_TOKEN Notion 集成 token +# +# CHANGES_DB_ID 已内置默认值(e740b77aa6bd4ac0a2e8a75f678fba98) +# 如需覆盖,可在 Secrets 中添加 CHANGES_DB_ID + +on: + push: + branches: [main] + pull_request: + types: [opened, closed] + +jobs: + bridge-changes-to-notion: + name: 📡 Bridge E · GitHub Changes → Notion + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 # 获取前一次 commit 以便 diff + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + # ── commit push ────────────────────────────────────── + - name: 📡 同步 commit 变更到 Notion + if: github.event_name == 'push' + env: + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + CHANGES_DB_ID: ${{ secrets.CHANGES_DB_ID }} + EVENT_TYPE: commit + COMMIT_SHA: ${{ github.sha }} + COMMIT_MSG: ${{ github.event.head_commit.message }} + COMMITTER: ${{ github.event.head_commit.author.name || github.actor }} + COMMIT_TIMESTAMP: ${{ github.event.head_commit.timestamp }} + BRANCH: ${{ github.ref_name }} + run: | + # git diff 输出换行分隔的变更文件列表(包含新增、修改、删除) + # COMMIT_TIMESTAMP/COMMITTER fallback: GitHub 表达式 || 在空字符串时也会取右侧值 + CHANGED=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || true) + export CHANGED_FILES="$CHANGED" + node scripts/notion-bridge.js changes + + # ── PR 事件 ─────────────────────────────────────────── + - name: 📡 同步 PR 变更到 Notion + if: github.event_name == 'pull_request' + env: + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + CHANGES_DB_ID: ${{ secrets.CHANGES_DB_ID }} + EVENT_TYPE: pr + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_ACTION: ${{ github.event.action }} + PR_MERGED: ${{ github.event.pull_request.merged }} + COMMITTER: ${{ github.event.pull_request.user.login }} + COMMIT_TIMESTAMP: ${{ github.event.pull_request.updated_at }} + COMMIT_SHA: ${{ github.event.pull_request.head.sha }} + COMMIT_MSG: ${{ github.event.pull_request.title }} + BRANCH: ${{ github.event.pull_request.head.ref }} + run: node scripts/notion-bridge.js changes + diff --git a/.github/workflows/bridge-syslog-to-notion.yml b/.github/workflows/bridge-syslog-to-notion.yml new file mode 100644 index 00000000..42e188f0 --- /dev/null +++ b/.github/workflows/bridge-syslog-to-notion.yml @@ -0,0 +1,40 @@ +name: 铸渊 · Bridge A · SYSLOG → Notion + +# 管道 A:syslog-inbox/ 有新文件 push → 同步到 Notion「📥 GitHub SYSLOG 收件箱」数据库 +# +# 依赖 Secrets(仓库 Settings → Secrets and variables → Actions): +# NOTION_TOKEN Notion 集成 token +# +# SYSLOG_DB_ID 已内置默认值(330ab17507d542c9bbb96d0749b41197) +# 如需覆盖,可在 Secrets 中添加 SYSLOG_DB_ID + +on: + push: + branches: [main] + paths: + - 'syslog-inbox/**' + - 'syslog-processed/**' + workflow_dispatch: + +jobs: + bridge-syslog-to-notion: + name: 📥 Bridge A · SYSLOG → Notion + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 🔗 同步 syslog-inbox 到 Notion + env: + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + SYSLOG_DB_ID: ${{ secrets.SYSLOG_DB_ID }} + COMMIT_SHA: ${{ github.sha }} + run: node scripts/notion-bridge.js syslog diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index da4c4781..73c68002 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -2,7 +2,9 @@ name: 🌀 部署铸渊聊天室 (GitHub Pages) on: push: - branches: [main] + branches: + - main + - copilot/** # Copilot Agent 功能分支可直接部署预览,PR 合并后自动失效 paths: - 'docs/**' - '.github/brain/**' diff --git a/.github/workflows/syslog-pipeline.yml b/.github/workflows/syslog-pipeline.yml new file mode 100644 index 00000000..13f8b85e --- /dev/null +++ b/.github/workflows/syslog-pipeline.yml @@ -0,0 +1,130 @@ +name: 铸渊 · SYSLOG Pipeline (A/D/E) + +on: + push: + branches: [main] + paths: + - 'syslog-inbox/**' + workflow_dispatch: + +jobs: + # ── Pipeline A:SYSLOG 读取与处理 ────────────────────── + pipeline-a-syslog: + name: 📥 Pipeline A · SYSLOG 读取处理 + runs-on: ubuntu-latest + permissions: + contents: write + issues: read + outputs: + processed_count: ${{ steps.process.outputs.processed_count }} + + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ref: main + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: 📥 处理 syslog-inbox 条目 + id: process + run: | + node scripts/process-syslog.js + COUNT=$(ls syslog-processed/ -R 2>/dev/null | grep -c '\.json' || echo 0) + echo "processed_count=$COUNT" >> "$GITHUB_OUTPUT" + + - name: 提交处理结果 + run: | + git config user.name "铸渊[bot]" + git config user.email "zhu-yuan-bot@guanghulab.com" + git add syslog-inbox/ syslog-processed/ .github/brain/memory.json + git diff --staged --quiet || git commit -m "📥 syslog: 处理 inbox 条目,更新大脑记忆 [skip ci]" + git push + + # ── Pipeline D:Issues 巡检 ───────────────────────────── + pipeline-d-issues: + name: 🔍 Pipeline D · Issues 巡检 + runs-on: ubuntu-latest + needs: pipeline-a-syslog + permissions: + contents: write + issues: read + + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ref: main + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: 🔍 巡检 Issues + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + run: | + echo "🔍 Pipeline D · Issues 巡检开始" + node -e " + const https = require('https'); + const token = process.env.GITHUB_TOKEN; + const repo = process.env.REPO; + const opts = { + hostname: 'api.github.com', + path: '/repos/' + repo + '/issues?state=open&per_page=20', + headers: { 'Authorization': 'Bearer ' + token, 'User-Agent': 'zhuyuan-bot' } + }; + https.get(opts, res => { + let body = ''; + res.on('data', c => body += c); + res.on('end', () => { + const issues = JSON.parse(body); + console.log('📋 开放 Issues 数量:' + (Array.isArray(issues) ? issues.length : '读取失败')); + if (Array.isArray(issues) && issues.length > 0) { + issues.slice(0, 5).forEach(i => console.log(' #' + i.number + ' ' + i.title)); + } + console.log('✅ Pipeline D 巡检完成'); + }); + }).on('error', e => { console.error('❌ 巡检失败:', e.message); process.exit(1); }); + " + + # ── Pipeline E:变更感知 ──────────────────────────────── + pipeline-e-changes: + name: 📡 Pipeline E · 变更感知 + runs-on: ubuntu-latest + needs: pipeline-a-syslog + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ref: main + fetch-depth: 10 + + - name: 📡 感知近期变更 + run: | + echo "📡 Pipeline E · 变更感知开始" + echo "=== 近期 10 次提交 ===" + git --no-pager log --oneline -10 + echo "" + echo "=== syslog-inbox 文件状态 ===" + ls -la syslog-inbox/ || echo "(空)" + echo "" + echo "=== syslog-processed 文件状态 ===" + ls -laR syslog-processed/ || echo "(空)" + echo "✅ Pipeline E 变更感知完成" diff --git a/README.md b/README.md index 2e84f4ee..e79212de 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ **一句话:点下面这个链接就能打开,直接聊天。** -### 👉 [点这里打开铸渊聊天室](https://qinfendebingshuo.github.io/guanghulab/) +### 👉 [点这里打开铸渊聊天室](https://qinfendebingshuo.github.io/guanghulab/docs/index.html) ``` -https://qinfendebingshuo.github.io/guanghulab/ +https://qinfendebingshuo.github.io/guanghulab/docs/index.html ``` > 把这个链接发给任何人,他们打开就能用,不需要安装任何东西。 @@ -20,7 +20,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ### ❄️ 冰朔(你) -1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/ +1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/docs/index.html 2. **选身份** → 下拉菜单选「❄️ 冰朔(语言架构师·创始人)」 3. **填 API 密钥** → 输入你的云雾/OpenAI/DeepSeek API Key 4. **点「开始对话」** → 铸渊自动唤醒,汇报大脑状态 @@ -30,7 +30,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ### 🦁 肥猫(光湖团队总控 · DEV-002) -1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/ +1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/docs/index.html 2. **选身份** → 下拉菜单选「🦁 肥猫(光湖团队总控·DEV-002)」 3. **填 API 密钥** → 输入自己的 API Key(或点「演示模式」也能看进度面板) 4. **点「开始对话」** → 铸渊自动打开**总控指挥台**,显示全员进度 @@ -44,7 +44,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ### 🍊 桔子(光湖主控 · DEV-010) -1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/ +1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/docs/index.html 2. **选身份** → 下拉菜单选「🍊 桔子(光湖主控·DEV-010)」 3. **填 API 密钥** → 输入自己的 API Key 4. **点「开始对话」** → 铸渊显示你当前模块进度,并开放指挥台 @@ -53,7 +53,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ### 👩💻 其他开发者(页页 / 燕樊 / 小草莓 / 花尔 等) -1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/ +1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/docs/index.html 2. **选身份** → 下拉菜单选自己的名字 3. **填 API 密钥** → 填自己的 Key(没有的话点「演示模式」) 4. **点「开始对话」** → 铸渊显示你的当前任务状态,可以问问题 @@ -80,7 +80,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ``` 铸渊聊天室入口 👇 -https://qinfendebingshuo.github.io/guanghulab/ +https://qinfendebingshuo.github.io/guanghulab/docs/index.html 打开后选择你的身份,填入 API Key 就能和铸渊说话了。 ``` diff --git a/docs/index.html b/docs/index.html index c6768fae..4eb9924e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,8 +1,12 @@ +
+ + +