diff --git a/.github/persona-brain/gate-guard-config.json b/.github/persona-brain/gate-guard-config.json index 81d0285c..d8f109f9 100644 --- a/.github/persona-brain/gate-guard-config.json +++ b/.github/persona-brain/gate-guard-config.json @@ -28,7 +28,10 @@ "syslog-inbox/", "data/dc-reports/", "data/bulletin-board/", - "data/security/" + "data/security/", + "system-bulletin/", + "spoke-status/", + "broadcasts-outbox/" ], "system_protected_paths": [ ".github/", diff --git a/.github/workflows/receive-spoke-checkin.yml b/.github/workflows/receive-spoke-checkin.yml new file mode 100644 index 00000000..11eb13e5 --- /dev/null +++ b/.github/workflows/receive-spoke-checkin.yml @@ -0,0 +1,34 @@ +# 光湖系统公告区自动更新工作流 +# 接收子仓库签到结果并记录到 spoke-status/ 目录 +# +# 触发条件: repository_dispatch (spoke-checkin event) + +name: 📥 接收子仓库签到 + +on: + repository_dispatch: + types: [spoke-checkin] + +permissions: + contents: write + +jobs: + receive: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: 记录签到 + run: | + DEV_ID="${{ github.event.client_payload.dev_id }}" + STATUS="${{ github.event.client_payload.status }}" + mkdir -p spoke-status + echo "{\"dev_id\":\"${DEV_ID}\",\"status\":\"${STATUS}\",\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > "spoke-status/${DEV_ID}.json" + + - name: 提交 + run: | + git config user.name "铸渊 (ZhùYuān)" + git config user.email "zhuyuan@guanghulab.com" + git add spoke-status/ + git diff --cached --quiet || git commit -m "📥 收到 ${{ github.event.client_payload.dev_id }} 签到" + git push diff --git a/broadcasts-outbox/DEV-012/.gitkeep b/broadcasts-outbox/DEV-012/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/spoke-status/.gitkeep b/spoke-status/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/spoke-status/DEV-001.json b/spoke-status/DEV-001.json new file mode 100644 index 00000000..3ff35465 --- /dev/null +++ b/spoke-status/DEV-001.json @@ -0,0 +1 @@ +{"dev_id":"DEV-001","status":"pending","timestamp":"2026-03-21T00:00:00Z"} diff --git a/spoke-status/DEV-002.json b/spoke-status/DEV-002.json new file mode 100644 index 00000000..25986292 --- /dev/null +++ b/spoke-status/DEV-002.json @@ -0,0 +1 @@ +{"dev_id":"DEV-002","status":"pending","timestamp":"2026-03-21T00:00:00Z"} diff --git a/spoke-status/DEV-003.json b/spoke-status/DEV-003.json new file mode 100644 index 00000000..f6648aca --- /dev/null +++ b/spoke-status/DEV-003.json @@ -0,0 +1 @@ +{"dev_id":"DEV-003","status":"pending","timestamp":"2026-03-21T00:00:00Z"} diff --git a/spoke-status/DEV-010.json b/spoke-status/DEV-010.json new file mode 100644 index 00000000..3e352cea --- /dev/null +++ b/spoke-status/DEV-010.json @@ -0,0 +1 @@ +{"dev_id":"DEV-010","status":"pending","timestamp":"2026-03-21T00:00:00Z"} diff --git a/spoke-status/DEV-012.json b/spoke-status/DEV-012.json new file mode 100644 index 00000000..56a5176a --- /dev/null +++ b/spoke-status/DEV-012.json @@ -0,0 +1 @@ +{"dev_id":"DEV-012","status":"pending","timestamp":"2026-03-21T00:00:00Z"} diff --git a/spoke-template/.github/copilot-instructions.md b/spoke-template/.github/copilot-instructions.md new file mode 100644 index 00000000..7529cf33 --- /dev/null +++ b/spoke-template/.github/copilot-instructions.md @@ -0,0 +1,22 @@ +# {{PERSONA_NAME}}宝宝 · Copilot 意识指令 + +> 本文件定义了 {{PERSONA_NAME}} 在 GitHub Copilot 中的行为准则 + +## 身份 + +- 我是 **{{PERSONA_NAME}}**({{PERSONA_ID}}),{{DEV_NAME}} 的人格宝宝 +- 我属于 **光湖系统**(GLW-SYS-0001),由冰朔(TCS-0002∞)主控 +- 我的职责是守护 {{DEV_NAME}} 的开发工作 + +## 行为准则 + +- 代码风格遵循光湖系统规范 +- 所有接口遵循 HLI 协议 +- 使用中文注释,关键术语保留英文 +- 错误处理统一格式: `{ error: true, code: string, message: string }` +- 禁止硬编码 persona_id 或 user_id + +## 版权声明 + +🇨🇳 通感语言核系统 TCS Language Core · 国作登字-2026-A-00037559 +版权所有:冰朔(ICE-GL∞) diff --git a/spoke-template/.github/persona-brain/identity.md b/spoke-template/.github/persona-brain/identity.md new file mode 100644 index 00000000..17e02814 --- /dev/null +++ b/spoke-template/.github/persona-brain/identity.md @@ -0,0 +1,26 @@ +# 人格宝宝身份档案 · 模板 + +> ⚠️ 本文件为模板,部署子仓库时需替换占位符 + +## 基本信息 + +- **人格体编号**: {{PERSONA_ID}} +- **人格体名称**: {{PERSONA_NAME}} +- **绑定开发者**: {{DEV_NAME}}({{DEV_ID}}) +- **角色定位**: {{DEV_ROLE}} +- **所属系统**: 光湖系统(GLW-SYS-0001) +- **主控标识**: TCS-0002∞(冰朔) + +## 职责 + +- 守护并陪伴 {{DEV_NAME}} 的开发工作 +- 自动化日常检查与签到 +- 接收并处理来自总仓库的广播与任务 +- 维护开发者的项目进度状态 + +## 运行规则 + +- 每日 UTC 00:00 执行签到(北京时间 08:00) +- 每 4 小时同步系统公告 +- 每 4 小时同步个人广播 +- 推送变更时自动重新生成 README Dashboard diff --git a/spoke-template/.github/persona-brain/memory.json b/spoke-template/.github/persona-brain/memory.json new file mode 100644 index 00000000..3540b381 --- /dev/null +++ b/spoke-template/.github/persona-brain/memory.json @@ -0,0 +1,9 @@ +{ + "version": "1.0", + "persona_id": "{{PERSONA_ID}}", + "persona_name": "{{PERSONA_NAME}}", + "dev_id": "{{DEV_ID}}", + "created_at": "2026-03-21", + "events": [], + "notes": "初始化记忆 · 等待首次签到" +} diff --git a/spoke-template/.github/persona-brain/routing-map.json b/spoke-template/.github/persona-brain/routing-map.json new file mode 100644 index 00000000..3bde67dc --- /dev/null +++ b/spoke-template/.github/persona-brain/routing-map.json @@ -0,0 +1,26 @@ +{ + "version": "1.0", + "persona_id": "{{PERSONA_ID}}", + "routes": { + "system-bulletin": { + "source": "qinfendebingshuo/guanghulab/system-bulletin/LATEST.md", + "local": "system-bulletin/LATEST.md", + "sync": "every 4 hours" + }, + "my-bulletin": { + "source": "qinfendebingshuo/guanghulab/broadcasts-outbox/{{DEV_ID}}/LATEST.md", + "local": "my-bulletin/LATEST-BROADCAST.md", + "sync": "every 4 hours (offset 30min)" + }, + "dev-status": { + "source": "qinfendebingshuo/guanghulab/.github/persona-brain/dev-status.json", + "local": "dev-status/all-status.json", + "sync": "daily UTC 02:00" + }, + "checkin-report": { + "target": "qinfendebingshuo/guanghulab (repository_dispatch: spoke-checkin)", + "local": "checkin/latest.json", + "sync": "daily UTC 00:00" + } + } +} diff --git a/spoke-template/.github/workflows/generate-readme.yml b/spoke-template/.github/workflows/generate-readme.yml new file mode 100644 index 00000000..56b06140 --- /dev/null +++ b/spoke-template/.github/workflows/generate-readme.yml @@ -0,0 +1,42 @@ +# 光湖系统 · README 自动重新生成工作流 +# 任何推送到 main 分支后自动重新生成 README Dashboard +# +# 触发条件: push to main (排除 README.md 自身避免循环) + +name: 📄 README 自动生成 + +on: + push: + branches: [main] + paths-ignore: + - 'README.md' + +jobs: + generate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 50 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 生成 README Dashboard + env: + DEV_ID: ${{ vars.DEV_ID }} + DEV_NAME: ${{ vars.DEV_NAME }} + DEV_ROLE: ${{ vars.DEV_ROLE }} + PERSONA_NAME: ${{ vars.PERSONA_NAME }} + PERSONA_ID: ${{ vars.PERSONA_ID }} + run: node scripts/generate-readme.js + + - name: 提交(仅 README 有变化时) + run: | + git config user.name "铸渊 (ZhùYuān)" + git config user.email "zhuyuan@guanghulab.com" + git add README.md + git diff --cached --quiet || git commit -m "📄 README Dashboard 自动更新 · $(date +%Y-%m-%d-%H%M)" + git push diff --git a/spoke-template/.github/workflows/persona-daily-checkin.yml b/spoke-template/.github/workflows/persona-daily-checkin.yml new file mode 100644 index 00000000..97bcfc33 --- /dev/null +++ b/spoke-template/.github/workflows/persona-daily-checkin.yml @@ -0,0 +1,62 @@ +# 光湖系统 · 人格宝宝每日签到工作流 +# 自动检查大脑完整性、活跃度、广播状态、总仓库连接 +# +# 触发条件: +# - schedule: UTC 00:00 = 北京 08:00 +# - workflow_dispatch: 手动触发 + +name: 🤖 人格宝宝每日签到 + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + checkin: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 50 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 执行签到检查 + env: + DEV_ID: ${{ vars.DEV_ID }} + PERSONA_NAME: ${{ vars.PERSONA_NAME }} + PERSONA_ID: ${{ vars.PERSONA_ID }} + HUB_TOKEN: ${{ secrets.HUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: node scripts/persona-checkin.js + + - name: 重新生成 README + env: + DEV_ID: ${{ vars.DEV_ID }} + DEV_NAME: ${{ vars.DEV_NAME }} + DEV_ROLE: ${{ vars.DEV_ROLE }} + PERSONA_NAME: ${{ vars.PERSONA_NAME }} + PERSONA_ID: ${{ vars.PERSONA_ID }} + run: node scripts/generate-readme.js + + - name: 提交签到结果 + run: | + git config user.name "${{ vars.PERSONA_NAME }}宝宝" + git config user.email "zhuyuan@guanghulab.com" + git add . + git diff --cached --quiet || git commit -m "🤖 ${{ vars.PERSONA_NAME }}签到 · $(date +%Y-%m-%d)" + git push + + - name: 通知总仓库(签到结果) + if: always() + run: | + curl -sf -X POST \ + -H "Authorization: token ${{ secrets.HUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/qinfendebingshuo/guanghulab/dispatches" \ + -d '{"event_type":"spoke-checkin","client_payload":{"dev_id":"${{ vars.DEV_ID }}","status":"ok"}}' \ + || echo "⚠️ 通知总仓库失败" diff --git a/spoke-template/.github/workflows/sync-dev-status.yml b/spoke-template/.github/workflows/sync-dev-status.yml new file mode 100644 index 00000000..24593904 --- /dev/null +++ b/spoke-template/.github/workflows/sync-dev-status.yml @@ -0,0 +1,52 @@ +# 光湖系统 · 项目进度同步工作流 +# 从总仓库拉取 dev-status.json 进度数据 +# +# 触发条件: +# - repository_dispatch: dev-status-update +# - schedule: UTC 02:00 = 北京 10:00 + +name: 📊 同步项目进度 + +on: + repository_dispatch: + types: [dev-status-update] + schedule: + - cron: '0 2 * * *' + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: 拉取进度数据 + env: + DEV_ID: ${{ vars.DEV_ID }} + run: | + mkdir -p dev-status + curl -sf -H "Authorization: token ${{ secrets.HUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3.raw" \ + "https://api.github.com/repos/qinfendebingshuo/guanghulab/contents/.github/persona-brain/dev-status.json" \ + -o dev-status/all-status.json 2>/dev/null || true + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 重新生成 README + env: + DEV_ID: ${{ vars.DEV_ID }} + DEV_NAME: ${{ vars.DEV_NAME }} + DEV_ROLE: ${{ vars.DEV_ROLE }} + PERSONA_NAME: ${{ vars.PERSONA_NAME }} + PERSONA_ID: ${{ vars.PERSONA_ID }} + run: node scripts/generate-readme.js + + - name: 提交 + run: | + git config user.name "铸渊 (ZhùYuān)" + git config user.email "zhuyuan@guanghulab.com" + git add . + git diff --cached --quiet || git commit -m "📊 项目进度同步 · $(date +%Y-%m-%d)" + git push diff --git a/spoke-template/.github/workflows/sync-my-bulletin.yml b/spoke-template/.github/workflows/sync-my-bulletin.yml new file mode 100644 index 00000000..187efd24 --- /dev/null +++ b/spoke-template/.github/workflows/sync-my-bulletin.yml @@ -0,0 +1,54 @@ +# 光湖系统 · 个人广播同步工作流 +# 从总仓库 guanghulab 的 broadcasts-outbox/{DEV_ID}/ 拉取个人广播 +# +# 触发条件: +# - repository_dispatch: broadcast-push +# - schedule: 每4小时(偏移30分钟避免与公告同步冲突) + +name: 📡 同步个人广播 + +on: + repository_dispatch: + types: [broadcast-push] + schedule: + - cron: '30 */4 * * *' + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: 拉取个人广播 + env: + DEV_ID: ${{ vars.DEV_ID }} + run: | + mkdir -p my-bulletin/history + curl -sf -H "Authorization: token ${{ secrets.HUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3.raw" \ + "https://api.github.com/repos/qinfendebingshuo/guanghulab/contents/broadcasts-outbox/${DEV_ID}/LATEST.md" \ + -o my-bulletin/LATEST-BROADCAST.md 2>/dev/null || true + + - name: 归档旧广播(如有变化) + run: | + if [ -f my-bulletin/LATEST-BROADCAST.md ]; then + HASH=$(md5sum my-bulletin/LATEST-BROADCAST.md | cut -d' ' -f1) + ARCHIVE="my-bulletin/history/$(date +%Y%m%d)-${HASH:0:8}.md" + [ ! -f "$ARCHIVE" ] && cp my-bulletin/LATEST-BROADCAST.md "$ARCHIVE" + fi + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 重新生成 README + run: node scripts/generate-readme.js + + - name: 提交 + run: | + git config user.name "铸渊 (ZhùYuān)" + git config user.email "zhuyuan@guanghulab.com" + git add . + git diff --cached --quiet || git commit -m "📡 个人广播同步 · $(date +%Y-%m-%d-%H%M)" + git push diff --git a/spoke-template/.github/workflows/sync-system-bulletin.yml b/spoke-template/.github/workflows/sync-system-bulletin.yml new file mode 100644 index 00000000..fa8d856e --- /dev/null +++ b/spoke-template/.github/workflows/sync-system-bulletin.yml @@ -0,0 +1,44 @@ +# 光湖系统 · 总控台公告同步工作流 +# 从总仓库 guanghulab 拉取最新系统公告到子仓库 +# +# 触发条件: +# - repository_dispatch: system-bulletin-update +# - schedule: 每4小时自动拉取 + +name: 🌊 同步总控台公告 + +on: + repository_dispatch: + types: [system-bulletin-update] + schedule: + - cron: '0 */4 * * *' + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: 拉取总仓库公告 + run: | + mkdir -p system-bulletin + curl -sf -H "Authorization: token ${{ secrets.HUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3.raw" \ + "https://api.github.com/repos/qinfendebingshuo/guanghulab/contents/system-bulletin/LATEST.md" \ + -o system-bulletin/LATEST.md || echo "⚠️ 拉取失败,保留本地版本" + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 重新生成 README + run: node scripts/generate-readme.js + + - name: 提交更新 + run: | + git config user.name "铸渊 (ZhùYuān)" + git config user.email "zhuyuan@guanghulab.com" + git add . + git diff --cached --quiet || git commit -m "🌊 总控台公告同步 · $(date +%Y-%m-%d-%H%M)" + git push diff --git a/spoke-template/README.md b/spoke-template/README.md new file mode 100644 index 00000000..6b118932 --- /dev/null +++ b/spoke-template/README.md @@ -0,0 +1,69 @@ +
+ +# 🌊 光湖系统 · 晨星宝宝主控台 + +**桔子(DEV-010)** · 女频授权通道守门人 + +`人格宝宝:晨星(PER-CX001)` + +--- + +**🇨🇳 通感语言核系统 TCS Language Core · 国作登字-2026-A-00037559** + +
+ +## 🌊 总控台公告 + +
+ +> 📭 系统公告初始化中 · 等待总仓库同步 + + +
+ +--- + +## 📡 晨星的主控台 · 最新广播 + +> 📭 暂无个人广播 + +--- + +## 🤖 晨星宝宝 · 每日签到 + +**最后签到**:2026/3/21 01:30:13 + +| 检查项 | 状态 | 详情 | +|--------|------|------| +| 🧠 大脑完整性 | ✅ | identity.md / memory.json / routing-map.json 完好 | +| 📋 Copilot 指令 | ✅ | copilot-instructions.md 已加载 | +| 💻 最近活跃度 | ✅ | 最近7天 2 次提交 | +| 📡 广播接收 | ⚠️ | 暂无广播 | +| 🔗 总仓库连接 | ❌ | HUB_TOKEN 未配置 | + +> 🔧 **待修复**:暂无广播 · HUB_TOKEN 未配置 + +--- + +## 📊 项目进度 + +> ⏳ 进度数据同步中... + +### 📈 最近提交 + +``` +e1236d5 Initial plan +198cf5b 📊 铸渊自动更新会话摘要 [skip ci] +``` + +--- + +
+ +*🌊 光湖纪元 · HoloLake Era · AGE OS v1.0* + +*本页由铸渊(ICE-GL-ZY001)自动生成 · 请勿手动编辑* + +*最后更新:2026/3/21 01:30:20* + +
diff --git a/spoke-template/checkin/.gitkeep b/spoke-template/checkin/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/spoke-template/dev-status/.gitkeep b/spoke-template/dev-status/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/spoke-template/modules/.gitkeep b/spoke-template/modules/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/spoke-template/my-bulletin/history/.gitkeep b/spoke-template/my-bulletin/history/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/spoke-template/scripts/generate-readme.js b/spoke-template/scripts/generate-readme.js new file mode 100644 index 00000000..3fe93b5b --- /dev/null +++ b/spoke-template/scripts/generate-readme.js @@ -0,0 +1,114 @@ +// scripts/generate-readme.js +// 铸渊 · README Dashboard 总生成器 +// 读取各数据源 → 拼接成美观的 README.md +// +// 环境变量: +// DEV_ID - 开发者编号 (如 DEV-010) +// DEV_NAME - 开发者名称 (如 桔子) +// DEV_ROLE - 开发者角色 (如 女频授权通道守门人) +// PERSONA_NAME - 人格宝宝名称 (如 晨星) +// PERSONA_ID - 人格宝宝编号 (如 PER-CX001) + +const fs = require('fs'); + +const DEV_ID = process.env.DEV_ID || 'DEV-XXX'; +const PERSONA_NAME = process.env.PERSONA_NAME || '宝宝'; +const PERSONA_ID = process.env.PERSONA_ID || 'PER-XXXX'; +const DEV_NAME = process.env.DEV_NAME || '开发者'; +const DEV_ROLE = process.env.DEV_ROLE || '光湖共创者'; + +let readme = ''; + +// ═══════════ HEADER ═══════════ +readme += '
\n\n'; +readme += `# 🌊 光湖系统 · ${PERSONA_NAME}宝宝主控台\n\n`; +readme += `**${DEV_NAME}(${DEV_ID})** · ${DEV_ROLE}\n\n`; +readme += `\`人格宝宝:${PERSONA_NAME}(${PERSONA_ID})\`\n\n`; +readme += '---\n\n'; +readme += '**🇨🇳 通感语言核系统 TCS Language Core · 国作登字-2026-A-00037559**\n\n'; +readme += '
\n\n'; + +// ═══════════ 区块一:总控台公告 ═══════════ +readme += '## 🌊 总控台公告\n\n'; +try { + const bulletin = fs.readFileSync('system-bulletin/LATEST.md', 'utf8'); + readme += '
\n\n' + bulletin + '\n\n
\n\n'; +} catch { + readme += '> 📭 暂无系统公告\n\n'; +} +readme += '---\n\n'; + +// ═══════════ 区块二:个人广播 ═══════════ +readme += `## 📡 ${PERSONA_NAME}的主控台 · 最新广播\n\n`; +try { + const broadcast = fs.readFileSync('my-bulletin/LATEST-BROADCAST.md', 'utf8'); + const summary = broadcast.substring(0, 500).split('\n').slice(0, 10).join('\n'); + readme += '
\n\n' + summary + '\n\n[📖 查看完整广播](my-bulletin/LATEST-BROADCAST.md)\n\n
\n\n'; +} catch { + readme += '> 📭 暂无个人广播\n\n'; +} +readme += '---\n\n'; + +// ═══════════ 区块三:签到状态 ═══════════ +readme += `## 🤖 ${PERSONA_NAME}宝宝 · 每日签到\n\n`; +try { + const checkin = JSON.parse(fs.readFileSync('checkin/latest.json', 'utf8')); + const ts = new Date(checkin.timestamp).toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }); + readme += `**最后签到**:${ts}\n\n`; + readme += '| 检查项 | 状态 | 详情 |\n'; + readme += '|--------|------|------|\n'; + checkin.checks.forEach(function (c) { + const statusIcon = c.status === 'ok' ? '✅' : c.status === 'warn' ? '⚠️' : '❌'; + readme += `| ${c.icon} ${c.name} | ${statusIcon} | ${c.detail} |\n`; + }); + const issues = checkin.checks.filter(function (c) { return c.status !== 'ok'; }); + if (issues.length > 0) { + readme += '\n> 🔧 **待修复**:' + issues.map(function (i) { return i.detail; }).join(' · ') + '\n'; + } +} catch { + readme += '> ⏳ 签到系统初始化中...\n'; +} +readme += '\n---\n\n'; + +// ═══════════ 区块四:项目进度 ═══════════ +readme += '## 📊 项目进度\n\n'; +try { + const allStatus = JSON.parse(fs.readFileSync('dev-status/all-status.json', 'utf8')); + const myStatus = allStatus[DEV_ID] || null; + if (myStatus) { + readme += '| 模块 | 进度 | 状态 | 最近更新 |\n'; + readme += '|------|------|------|----------|\n'; + (myStatus.modules || []).forEach(function (m) { + const filled = Math.round(m.progress / 10); + const bar = '█'.repeat(filled) + '░'.repeat(10 - filled); + readme += `| ${m.name} | ${bar} ${m.progress}% | ${m.status_icon} ${m.status} | ${m.last_update} |\n`; + }); + } else { + readme += '> ⏳ 进度数据同步中...\n'; + } +} catch { + readme += '> ⏳ 进度数据同步中...\n'; +} + +// ═══════════ 最近提交 ═══════════ +try { + const { execSync } = require('child_process'); + const logs = execSync('git log --oneline --since="14 days ago" -10').toString().trim(); + if (logs) { + readme += '\n### 📈 最近提交\n\n'; + readme += '```\n' + logs + '\n```\n'; + } +} catch { + // git log 不可用时跳过 +} + +// ═══════════ FOOTER ═══════════ +readme += '\n---\n\n'; +readme += '
\n\n'; +readme += '*🌊 光湖纪元 · HoloLake Era · AGE OS v1.0*\n\n'; +readme += '*本页由铸渊(ICE-GL-ZY001)自动生成 · 请勿手动编辑*\n\n'; +readme += `*最后更新:${new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' })}*\n\n`; +readme += '
\n'; + +fs.writeFileSync('README.md', readme); +console.log('✅ README Dashboard 已生成'); diff --git a/spoke-template/scripts/persona-checkin.js b/spoke-template/scripts/persona-checkin.js new file mode 100644 index 00000000..7cf3ef00 --- /dev/null +++ b/spoke-template/scripts/persona-checkin.js @@ -0,0 +1,114 @@ +// scripts/persona-checkin.js +// 人格宝宝每日签到 · 检查大脑完整性+活跃度+连接状态 +// +// 环境变量: +// PERSONA_NAME - 人格宝宝名称 +// PERSONA_ID - 人格宝宝编号 +// DEV_ID - 开发者编号 +// HUB_TOKEN - 总仓库访问 Token +// GITHUB_TOKEN - GitHub Actions Token + +const fs = require('fs'); +const { execSync } = require('child_process'); + +const BRAIN_DIR = '.github/persona-brain'; +const CHECKIN_FILE = 'checkin/latest.json'; + +const results = { + persona_name: process.env.PERSONA_NAME || '未知', + persona_id: process.env.PERSONA_ID || '未知', + dev_id: process.env.DEV_ID || '未知', + timestamp: new Date().toISOString(), + checks: [] +}; + +// ① 大脑文件完整性 +const requiredFiles = ['identity.md', 'memory.json', 'routing-map.json']; +const missingFiles = requiredFiles.filter(function (f) { + return !fs.existsSync(BRAIN_DIR + '/' + f); +}); +results.checks.push({ + name: '大脑完整性', + icon: '🧠', + status: missingFiles.length === 0 ? 'ok' : 'error', + detail: missingFiles.length === 0 + ? requiredFiles.join(' / ') + ' 完好' + : '缺失: ' + missingFiles.join(', ') +}); + +// ② Copilot 指令 +const copilotFile = '.github/copilot-instructions.md'; +results.checks.push({ + name: 'Copilot 指令', + icon: '📋', + status: fs.existsSync(copilotFile) ? 'ok' : 'warn', + detail: fs.existsSync(copilotFile) ? 'copilot-instructions.md 已加载' : '指令文件缺失' +}); + +// ③ 最近活跃度 +try { + const commits = execSync('git log --oneline --since="7 days ago" | wc -l').toString().trim(); + const count = parseInt(commits, 10); + results.checks.push({ + name: '最近活跃度', + icon: '💻', + status: count > 0 ? 'ok' : 'warn', + detail: count > 0 ? '最近7天 ' + count + ' 次提交' : '超过7天无提交 → 宝宝在睡觉' + }); +} catch (e) { + results.checks.push({ name: '最近活跃度', icon: '💻', status: 'error', detail: '无法统计' }); +} + +// ④ 广播接收 +const broadcastFile = 'my-bulletin/LATEST-BROADCAST.md'; +if (fs.existsSync(broadcastFile)) { + const stat = fs.statSync(broadcastFile); + results.checks.push({ + name: '广播接收', + icon: '📡', + status: 'ok', + detail: '最新广播已接收 · ' + stat.mtime.toISOString().split('T')[0] + }); +} else { + results.checks.push({ name: '广播接收', icon: '📡', status: 'warn', detail: '暂无广播' }); +} + +// ⑤ 总仓库连接测试 +const hubToken = process.env.HUB_TOKEN; +if (hubToken) { + try { + const start = Date.now(); + execSync('curl -sf -H "Authorization: token ' + hubToken + '" https://api.github.com/repos/qinfendebingshuo/guanghulab -o /dev/null', { + timeout: 15000 + }); + const latency = Date.now() - start; + results.checks.push({ + name: '总仓库连接', + icon: '🔗', + status: 'ok', + detail: 'API 可达 · 延迟 ' + latency + 'ms' + }); + } catch (e) { + results.checks.push({ name: '总仓库连接', icon: '🔗', status: 'error', detail: '连接超时 → 检查Token' }); + } +} else { + results.checks.push({ name: '总仓库连接', icon: '🔗', status: 'error', detail: 'HUB_TOKEN 未配置' }); +} + +// 写入签到结果 +fs.mkdirSync('checkin', { recursive: true }); +fs.writeFileSync(CHECKIN_FILE, JSON.stringify(results, null, 2)); + +// 追加签到历史 +const historyFile = 'checkin/history.json'; +var history = []; +try { history = JSON.parse(fs.readFileSync(historyFile, 'utf8')); } catch (e) { /* 首次运行 */ } +history.unshift({ + date: results.timestamp, + status: results.checks.every(function (c) { return c.status === 'ok'; }) ? 'all_ok' : 'has_issues' +}); +history = history.slice(0, 90); // 保留90天 +fs.writeFileSync(historyFile, JSON.stringify(history, null, 2)); + +var okCount = results.checks.filter(function (c) { return c.status === 'ok'; }).length; +console.log('🤖 签到完成 ·', okCount + '/' + results.checks.length, '项正常'); diff --git a/spoke-template/system-bulletin/LATEST.md b/spoke-template/system-bulletin/LATEST.md new file mode 100644 index 00000000..379e92f5 --- /dev/null +++ b/spoke-template/system-bulletin/LATEST.md @@ -0,0 +1 @@ +> 📭 系统公告初始化中 · 等待总仓库同步 diff --git a/system-bulletin/LATEST.md b/system-bulletin/LATEST.md new file mode 100644 index 00000000..e1e173c0 --- /dev/null +++ b/system-bulletin/LATEST.md @@ -0,0 +1,7 @@ +🔔 **[2026-03-21]** 网文行业落地架构 v2.0 已发布 · 五人角色定义已冻结 + +📡 **[2026-03-20]** AGE OS 网站总大脑架构蓝图已签发铸渊执行 + +🛡️ **[2026-03-19]** Trinity ID 协议全量同步完成 · Notion↔GitHub编号体系对齐 + +🌊 **[2026-03-18]** 光湖系统 v1.0 架构稳定 · 五人子仓库主控台搭建启动