@aibyzero/byz 0.1.1 → 0.1.3

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 (114) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +34 -24
  3. package/dist/cli.js +22 -14
  4. package/dist/core/export-html/template.css +1066 -0
  5. package/dist/core/export-html/template.html +55 -0
  6. package/dist/core/export-html/template.js +1864 -0
  7. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  8. package/dist/core/export-html/vendor/marked.min.js +78 -0
  9. package/dist/fast.js +64 -0
  10. package/dist/modes/interactive/assets/clankolas.png +0 -0
  11. package/dist/modes/interactive/theme/dark.json +90 -0
  12. package/dist/modes/interactive/theme/light.json +89 -0
  13. package/dist/modes/interactive/theme/theme-schema.json +352 -0
  14. package/dist/runtime/bundle/chunks/{chunk-CCRJHU72.js → chunk-QY7DJQRI.js} +2 -2
  15. package/dist/runtime/bundle/chunks/github-copilot.js +1 -1
  16. package/dist/runtime/bundle/cli.js +1 -1
  17. package/dist/runtime/bundle/index.js +1 -1
  18. package/dist/runtime/bundle/rpc-entry.js +1 -1
  19. package/dist/runtime/core/resource-loader.d.ts +1 -0
  20. package/dist/runtime/core/resource-loader.d.ts.map +1 -1
  21. package/dist/runtime/core/resource-loader.js +8 -3
  22. package/dist/runtime/core/resource-loader.js.map +1 -1
  23. package/dist/workflows.js +4 -131
  24. package/package.json +2 -1
  25. package/workflows/cm-plugin/LICENSE +21 -0
  26. package/workflows/cm-plugin/README.md +195 -0
  27. package/workflows/cm-plugin/VERSION +1 -0
  28. package/workflows/cm-plugin/agents/cm-plugin-backend-agent.md +34 -0
  29. package/workflows/cm-plugin/agents/cm-plugin-extension-agent.md +35 -0
  30. package/workflows/cm-plugin/agents/cm-plugin-ui-agent.md +34 -0
  31. package/workflows/cm-plugin/commands/cm-plugin-ai-nodes/N1-init.md +60 -0
  32. package/workflows/cm-plugin/commands/cm-plugin-ai-nodes/N2-enter-feature.md +51 -0
  33. package/workflows/cm-plugin/commands/cm-plugin-ai-nodes/N3-execute-task.md +32 -0
  34. package/workflows/cm-plugin/commands/cm-plugin-ai-nodes/N4-review.md +58 -0
  35. package/workflows/cm-plugin/commands/cm-plugin-ai-nodes/N5-mark-done.md +80 -0
  36. package/workflows/cm-plugin/commands/cm-plugin-ai-nodes/N6-qa-eval.md +69 -0
  37. package/workflows/cm-plugin/commands/cm-plugin-ai-nodes/N7-context.md +23 -0
  38. package/workflows/cm-plugin/commands/cm-plugin-ai-nodes/N8-finish.md +61 -0
  39. package/workflows/cm-plugin/commands/cm-plugin-prd-modes/brownfield.md +13 -0
  40. package/workflows/cm-plugin/commands/cm-plugin-prd-modes/change-mode.md +130 -0
  41. package/workflows/cm-plugin/commands/cm-plugin-prd-modes/greenfield.md +82 -0
  42. package/workflows/cm-plugin/commands/cm-plugin:ai.md +75 -0
  43. package/workflows/cm-plugin/commands/cm-plugin:check.md +66 -0
  44. package/workflows/cm-plugin/commands/cm-plugin:fix.md +100 -0
  45. package/workflows/cm-plugin/commands/cm-plugin:idea.md +29 -0
  46. package/workflows/cm-plugin/commands/cm-plugin:init.md +145 -0
  47. package/workflows/cm-plugin/commands/cm-plugin:prd.md +403 -0
  48. package/workflows/cm-plugin/commands/cm-plugin:refactor.md +147 -0
  49. package/workflows/cm-plugin/commands/cm-plugin:rewrite.md +90 -0
  50. package/workflows/cm-plugin/commands/cm-plugin:scout.md +202 -0
  51. package/workflows/cm-plugin/docs//346/265/213/350/257/225/346/214/207/345/274/225-/345/277/253/351/200/237/344/270/212/346/211/213.md +189 -0
  52. package/workflows/cm-plugin/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/README.md +17 -0
  53. package/workflows/cm-plugin/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.excalidraw +3650 -0
  54. package/workflows/cm-plugin/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.mp4 +0 -0
  55. package/workflows/cm-plugin/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.png +0 -0
  56. package/workflows/cm-plugin/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.spec.json +223 -0
  57. package/workflows/cm-plugin/package.json +33 -0
  58. package/workflows/cm-plugin/skills/cm-plugin-backend-engineer/SKILL.md +100 -0
  59. package/workflows/cm-plugin/skills/cm-plugin-devops-engineer/NOTICE.md +14 -0
  60. package/workflows/cm-plugin/skills/cm-plugin-devops-engineer/SKILL.md +120 -0
  61. package/workflows/cm-plugin/skills/cm-plugin-devops-engineer/references/cws-ci-cd.md +139 -0
  62. package/workflows/cm-plugin/skills/cm-plugin-devops-engineer/references/cws-submission-checklist.md +87 -0
  63. package/workflows/cm-plugin/skills/cm-plugin-doc-syncer/SKILL.md +149 -0
  64. package/workflows/cm-plugin/skills/cm-plugin-extension-engineer/SKILL.md +105 -0
  65. package/workflows/cm-plugin/skills/cm-plugin-product-manager/SKILL.md +83 -0
  66. package/workflows/cm-plugin/skills/cm-plugin-qa-engineer/NOTICE.md +14 -0
  67. package/workflows/cm-plugin/skills/cm-plugin-qa-engineer/SKILL.md +134 -0
  68. package/workflows/cm-plugin/skills/cm-plugin-qa-engineer/references/cws-scan-checklist.md +136 -0
  69. package/workflows/cm-plugin/skills/cm-plugin-qa-engineer/references/cws-violation-codes.md +68 -0
  70. package/workflows/cm-plugin/skills/cm-plugin-ui-engineer/SKILL.md +94 -0
  71. package/workflows/cm-plugin/skills/codebase-context/SKILL.md +489 -0
  72. package/workflows/cm-plugin/skills/darwin-skill/NOTICE.md +24 -0
  73. package/workflows/cm-plugin/skills/darwin-skill/README.md +272 -0
  74. package/workflows/cm-plugin/skills/darwin-skill/SKILL.md +492 -0
  75. package/workflows/cm-plugin/skills/darwin-skill/references/runtime-neutrality.md +68 -0
  76. package/workflows/cm-plugin/skills/darwin-skill/references/skilllens-evidence.md +142 -0
  77. package/workflows/cm-plugin/skills/darwin-skill/scripts/screenshot.mjs +71 -0
  78. package/workflows/cm-plugin/skills/darwin-skill/templates/result-card-dark.html +698 -0
  79. package/workflows/cm-plugin/skills/darwin-skill/templates/result-card-white.html +444 -0
  80. package/workflows/cm-plugin/skills/darwin-skill/templates/result-card.html +616 -0
  81. package/workflows/cm-plugin/skills/idea-to-prd/SKILL.md +289 -0
  82. package/workflows/cm-plugin/skills/idea-to-prd/references/domains/trading.md +97 -0
  83. package/workflows/cm-plugin/skills/idea-to-prd/references/example-prd.md +92 -0
  84. package/workflows/cm-plugin/templates/arch-reference.md +55 -0
  85. package/workflows/cm-plugin/templates/auto-update/cm-announce.sh +19 -0
  86. package/workflows/cm-plugin/templates/auto-update/cm-update.sh +251 -0
  87. package/workflows/cm-plugin/templates/dashboard/dashboard.html +153 -0
  88. package/workflows/cm-plugin/templates/dashboard/serve.sh +10 -0
  89. package/workflows/cm-plugin/templates/e2e/extension-harness.ts +110 -0
  90. package/workflows/cm-plugin/templates/e2e/smoke.spec.example.ts +51 -0
  91. package/workflows/cm-plugin/templates/hooks/pre-commit-cm-task-check +33 -0
  92. package/workflows/cm-plugin/templates/pixel/cm-pixel.html +388 -0
  93. package/workflows/cm-plugin/templates/pixel/cm-pixel.sh +212 -0
  94. package/workflows/cm-plugin/templates/pixel/dev/README.md +20 -0
  95. package/workflows/cm-plugin/templates/pixel/dev/atlas-preview.png +0 -0
  96. package/workflows/cm-plugin/templates/pixel/dev/build.py +55 -0
  97. package/workflows/cm-plugin/templates/pixel/dev/sheets/roguelikeChar_transparent.png +0 -0
  98. package/workflows/cm-plugin/templates/pixel/dev/sheets/roguelikeCity_tilemap.png +0 -0
  99. package/workflows/cm-plugin/templates/pixel/dev/sheets/roguelikeIndoor_transparent.png +0 -0
  100. package/workflows/cm-plugin/templates/pixel/dev/template.html +388 -0
  101. package/workflows/cm-plugin/templates/pixel/serve.sh +12 -0
  102. package/workflows/cm-plugin/templates/refactor/cm-refactor-denies.json +14 -0
  103. package/workflows/cm-plugin/templates/rules/backend-api.md +36 -0
  104. package/workflows/cm-plugin/templates/rules/chrome-extension.md +53 -0
  105. package/workflows/cm-plugin/templates/rules/coding-style.md +44 -0
  106. package/workflows/cm-plugin/templates/rules/frontend.md +32 -0
  107. package/workflows/cm-plugin/templates/rules/git-workflow.md +25 -0
  108. package/workflows/cm-plugin/templates/rules/security.md +31 -0
  109. package/workflows/cm-plugin/templates/rules/testing.md +36 -0
  110. package/workflows/cm-plugin/templates/scripts/cm-plugin-codex.sh +52 -0
  111. package/workflows/cm-plugin/templates/scripts/cm-plugin-log.sh +41 -0
  112. package/workflows/cm-plugin/templates/scripts/cm-plugin-preflight.sh +60 -0
  113. package/workflows/cm-plugin/templates/statusline/cm-plugin-statusline.sh +73 -0
  114. package/workflows.lock.json +4 -3
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: {一句话:本项目的分支与提交约定}
3
+ ---
4
+
5
+ <!-- 模板骨架 · 生成时从 git 历史推断实际风格,{占位符} 结合项目填充。
6
+ 按 CLAUDE.md 版本控制字段裁剪:none → 不生成本文件;local → 删除 PR/合入 与 保护分支 相关内容,只留 commit 规范 -->
7
+
8
+ # Git 工作流
9
+
10
+ ## 分支
11
+
12
+ - 命名:{feature/xxx、fix/xxx——从现有分支推断}
13
+ - 保护分支:{main/master},禁止直接 push
14
+ - 合并方式:{squash / merge commit / rebase——从历史推断}
15
+
16
+ ## Commit
17
+
18
+ - 风格:{conventional commits(feat/fix/chore…)或项目实际风格,附 3 个历史真实示例}
19
+ - 一次 commit 一个逻辑变更;禁止 "wip"、"fix" 这类无信息量消息
20
+ - {是否要求关联 issue/任务编号,如 "feat: xxx (T-003)"}
21
+
22
+ ## PR / 合入
23
+
24
+ - PR 描述:{模板位置或最低要求}
25
+ - 合入前置:{CI 通过 / review 通过 / 覆盖率不降}
@@ -0,0 +1,31 @@
1
+ ---
2
+ description: {一句话:本项目的安全红线}
3
+ ---
4
+
5
+ <!-- 模板骨架 · 生成时遵守四原则,检查维度对照 OWASP Top 10,{占位符} 结合项目填充 -->
6
+
7
+ # 安全规范
8
+
9
+ ## 密钥与配置
10
+
11
+ - 密钥/连接串一律环境变量或密钥管理服务,**禁止硬编码**;`.env` 必须在 .gitignore
12
+ - `.env.example` 只放 key 不放值,与实际环境变量保持同步
13
+ - {项目使用的密钥管理方式:Vault / 云 KMS / CI secrets}
14
+
15
+ ## OWASP 对照清单(按项目暴露面裁剪)
16
+
17
+ - 注入:一律参数化查询/ORM,模板输出转义;{项目具体的入口清单}
18
+ - 失效的访问控制:权限检查靠近资源,新路由必须显式声明鉴权要求
19
+ - 认证失效:{会话/token 方案的具体约束:过期时间、刷新策略、存储位置}
20
+ - 敏感数据泄露:日志禁止输出密码/token/证件号;传输一律 TLS
21
+ - 安全配置错误:{CORS 白名单、安全响应头清单}
22
+ - 不安全依赖:{依赖审计命令,如 npm audit / cargo audit},高危漏洞阻断合入
23
+
24
+ ## 输入验证
25
+
26
+ - 边界层统一校验({项目使用的校验库}),内层信任已校验数据
27
+ - 文件上传:{类型白名单、大小上限、存储位置}
28
+
29
+ ## 敏感操作
30
+
31
+ - {支付/删除/导出等操作的审计日志与二次确认要求}
@@ -0,0 +1,36 @@
1
+ ---
2
+ description: {一句话:本项目的测试约定与覆盖率要求}
3
+ ---
4
+
5
+ <!-- 模板骨架 · 生成时遵守四原则(可执行/Bad-Good/量化/现代实践),{占位符} 结合项目填充 -->
6
+
7
+ # 测试规范
8
+
9
+ ## 框架与命令
10
+
11
+ - 单元/组件测试:{Vitest/Jest/pytest…,附运行命令}
12
+ - E2E:{Playwright/Cypress…,附运行命令}
13
+ - 覆盖率:`{coverage 命令}`
14
+
15
+ ## 覆盖率要求(QA 与 skill 默认值以本节为准)
16
+
17
+ - 整体行覆盖 ≥ {N}%
18
+ - 核心模块({列出目录})≥ {N}%
19
+ - 纯类型/配置文件排除:{coverage 配置的 exclude 清单}
20
+
21
+ ## 文件与命名约定
22
+
23
+ - 测试文件位置:{同目录 __tests__ / 独立 tests/ 目录}
24
+ - 命名:{*.test.ts / test_*.py}
25
+
26
+ ## 分类要求
27
+
28
+ - 工具函数:输入输出全覆盖含边界值
29
+ - API/服务层:正常流 + 异常流 + 边界
30
+ - 组件:渲染 + 交互 + props 边界
31
+ - 禁止:测试内固定延时(用 waitFor)、测试间共享可变状态
32
+
33
+ ## 可视化回归(如有 UI)
34
+
35
+ - browser_driver: {playwright | chrome-mcp | ask}(cm-plugin-qa-engineer 读取本字段)
36
+ - 基准截图位置:{路径}
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env bash
2
+ # cm-plugin Codex 审查封装——一处收齐 codex exec 的正确调用姿势 + 输出清洗 + 凭证落盘。
3
+ # 存在理由(实测教训):全程调 codex 十几次,每次都要记得 --skip-git-repo-check --sandbox read-only、
4
+ # 手动加超时、再 tail 清洗它探索源码的 stdout 转储才拿到结论。本脚本一把封装。
5
+ # 用法:
6
+ # cm-plugin-codex.sh "<提示词>" [凭证落盘路径]
7
+ # echo "<提示词>" | cm-plugin-codex.sh - [凭证落盘路径]
8
+ # 输出: 清洗后的 Codex 结论到 stdout;给了凭证路径则同时 tee 落盘(N4/prd/scout 凭证纪律)。
9
+ # 退出码: 0=拿到结论, 2=codex 未装(调用方按降级链处理)。
10
+ set -uo pipefail
11
+
12
+ PROMPT="${1:?用法: cm-plugin-codex.sh \"<提示词>\" [凭证路径]}"
13
+ CRED="${2:-}"
14
+ TIMEOUT="${CM_CODEX_TIMEOUT:-480}"
15
+
16
+ if [ "$PROMPT" = "-" ]; then PROMPT=$(cat); fi
17
+
18
+ if ! command -v codex >/dev/null 2>&1; then
19
+ echo "codex 未安装——按 N4 三级降级链处理(对抗式子代理/核验类自审)" >&2
20
+ exit 2
21
+ fi
22
+
23
+ # 正确调用姿势封装:read-only 沙箱 + 跳过 git 检查 + 从 stdin 关闭交互 + 超时。
24
+ # 超时用「输出落临时文件 + 轮询 PID」实现——把 codex 后台化再 $() 捕获会丢输出(实测踩过),
25
+ # 落文件最稳,且 macOS 无 GNU timeout 也能跑。
26
+ TMP=$(mktemp)
27
+ codex exec --skip-git-repo-check --sandbox read-only "$PROMPT" </dev/null >"$TMP" 2>&1 &
28
+ CODEX_PID=$!
29
+ i=0
30
+ while kill -0 "$CODEX_PID" 2>/dev/null; do
31
+ i=$((i+1))
32
+ [ "$i" -ge "$TIMEOUT" ] && { kill "$CODEX_PID" 2>/dev/null; echo "(codex 超时 ${TIMEOUT}s,已终止)" >>"$TMP"; break; }
33
+ sleep 1
34
+ done
35
+ wait "$CODEX_PID" 2>/dev/null || true
36
+ RAW=$(cat "$TMP"); rm -f "$TMP"
37
+
38
+ # 输出清洗:codex 常把探索源码的过程转储进 stdout,真正结论在末尾 "tokens used" 之前。
39
+ # ① 去掉 tokens 计数行 ② 去掉已知噪音(stdin 提示/codex 标记/提示词回显) ③ 取末段。
40
+ CLEAN=$(printf '%s\n' "$RAW" | grep -vxF "$PROMPT" | grep -vE '^(codex|user|Reading additional input.*|tokens used|[0-9,]+|\(codex 超时.*|OpenAI Codex .*|-{3,}|workdir:.*|model:.*|provider:.*|approval:.*|sandbox:.*|reasoning .*|session id:.*)$' | awk '
41
+ { buf = buf $0 "\n" }
42
+ END {
43
+ n = split(buf, lines, "\n")
44
+ start = n - 20; if (start < 1) start = 1
45
+ for (i = start; i <= n; i++) if (lines[i] != "") print lines[i]
46
+ }')
47
+ [ -z "$CLEAN" ] && CLEAN=$(printf '%s\n' "$RAW" | tail -15)
48
+
49
+ if [ -n "$CRED" ]; then
50
+ { echo "# Codex 审查凭证 · $(date +%Y-%m-%dT%H:%M:%S%z)"; echo; printf '%s\n' "$CLEAN"; } > "$CRED"
51
+ fi
52
+ printf '%s\n' "$CLEAN"
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+ # cm-plugin JSONL 日志助手——让运行日志由工具写,而非手打 bash echo。
3
+ # 存在理由(实测教训):手写 `echo '{...}' >> log` 犯过两类错——先记账后落盘(report_saved 早于文件存在)、
4
+ # 攒批导致多条挤同一秒时间线失真。本脚本自动 ISO8601 时间戳、原子追加、事件名非空校验。
5
+ # 用法:
6
+ # cm-plugin-log.sh <日志文件> <event> <detail> [k=v ...]
7
+ # 例:
8
+ # cm-plugin-log.sh run.jsonl fetch "reviews 页成功" channel=webfetch dim=D1 n=10
9
+ # 纪律: 每个事件在其步骤**完成后**立即单独调一次,禁止攒批(每次调用即一次原子追加)。
10
+ set -euo pipefail
11
+
12
+ LOG="${1:?用法: cm-plugin-log.sh <日志文件> <event> <detail> [k=v ...]}"
13
+ EVENT="${2:?缺 event}"
14
+ DETAIL="${3:?缺 detail}"
15
+ shift 3
16
+
17
+ TS=$(date +%Y-%m-%dT%H:%M:%S%z)
18
+
19
+ # 用 python 组装 JSON,保证特殊字符(引号/换行/中文)被正确转义——手写 echo 最容易在此翻车
20
+ python3 - "$LOG" "$TS" "$EVENT" "$DETAIL" "$@" <<'PY'
21
+ import json, sys, os
22
+ logfile, ts, event, detail = sys.argv[1:5]
23
+ row = {"at": ts, "event": event, "detail": detail}
24
+ for kv in sys.argv[5:]:
25
+ if "=" not in kv:
26
+ continue
27
+ k, v = kv.split("=", 1)
28
+ # 数字字段转 int/float,其余留字符串
29
+ if v.lstrip("-").isdigit():
30
+ row[k] = int(v)
31
+ else:
32
+ try:
33
+ row[k] = float(v)
34
+ except ValueError:
35
+ row[k] = v
36
+ line = json.dumps(row, ensure_ascii=False)
37
+ # 原子追加(单次 write,追加模式)
38
+ with open(logfile, "a", encoding="utf-8") as f:
39
+ f.write(line + "\n")
40
+ print(line)
41
+ PY
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+ # cm-plugin 环境预检——开跑前一次性探明本机能不能跑 Chrome 扩展开发的全链路。
3
+ # 存在理由(实测教训):/cm-plugin:rewrite 全程最吃时间的不是设计不是逻辑,是环境地雷——
4
+ # 系统 Chrome 静默屏蔽 --load-extension、codex 要 --skip-git-repo-check、playwright 浏览器下载被墙。
5
+ # 这些报错什么都不给。开跑前跑一遍本脚本,把地雷提前引爆。
6
+ # 用法: cm-plugin-preflight.sh (退出码 0=全通过或仅提示, 1=有阻塞项)
7
+ set -uo pipefail
8
+
9
+ pass(){ printf ' \033[32m✓\033[0m %s\n' "$1"; }
10
+ warn(){ printf ' \033[33m⚠\033[0m %s\n' "$1"; WARN=$((WARN+1)); }
11
+ fail(){ printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL+1)); }
12
+ WARN=0; FAIL=0
13
+
14
+ echo "🔎 cm-plugin 环境预检"
15
+
16
+ # 1. Node / npm(脚手架与构建)
17
+ if command -v node >/dev/null 2>&1; then
18
+ major=$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0)
19
+ if [ "${major:-0}" -ge 18 ]; then pass "Node $(node -v)"; else fail "Node 版本过低($(node -v)),需 ≥18"; fi
20
+ else fail "Node 未安装(WXT 脚手架/构建依赖)"; fi
21
+ command -v npm >/dev/null 2>&1 && pass "npm $(npm -v)" || fail "npm 未安装"
22
+
23
+ # 2. git(每任务提交/审计链)
24
+ command -v git >/dev/null 2>&1 && pass "git $(git --version | awk '{print $3}')" || warn "git 未安装(审计链降级为 NO_GIT)"
25
+
26
+ # 3. Codex(N4 双模型复审主通道)—— 实测:调用必须带 --skip-git-repo-check
27
+ if command -v codex >/dev/null 2>&1; then
28
+ pass "Codex $(codex --version 2>/dev/null | head -1) —— 调用记得带 --skip-git-repo-check --sandbox read-only"
29
+ else
30
+ warn "Codex 未装 —— N4 将降级为对抗式子代理(次优)。装: npm i -g @openai/codex"
31
+ fi
32
+
33
+ # 4. 扩展加载能力(最大地雷)—— 系统 Chrome 屏蔽 --load-extension,只有 Chrome for Testing 能加载
34
+ CACHE="$HOME/Library/Caches/ms-playwright"
35
+ CFT=""
36
+ if [ -d "$CACHE" ]; then
37
+ CFT=$(find "$CACHE" -maxdepth 6 -name 'Google Chrome for Testing' -type f 2>/dev/null | head -1)
38
+ fi
39
+ if [ -n "$CFT" ]; then
40
+ pass "Chrome for Testing 就绪(E2E 用它加载扩展;系统 Chrome 2026 版屏蔽 --load-extension)"
41
+ else
42
+ warn "未找到 Chrome for Testing。E2E 无法真实加载扩展。装: npx playwright install chromium"
43
+ echo " (下载被墙时:改用其他项目已装的 CfT,或本机 Chrome 仅供手动 chrome://extensions 加载)"
44
+ fi
45
+
46
+ # 5. 系统 Chrome(手动形态确认兜底)
47
+ if [ -f "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
48
+ pass "系统 Chrome 存在(手动 chrome://extensions 加载可用;自动化用 CfT)"
49
+ else
50
+ warn "无系统 Chrome(手动形态确认需要它)"
51
+ fi
52
+
53
+ echo
54
+ if [ "$FAIL" -gt 0 ]; then
55
+ echo "结论: $FAIL 项阻塞 / $WARN 项提示 —— 阻塞项先解决再开跑"
56
+ exit 1
57
+ else
58
+ echo "结论: 通过($WARN 项提示,不阻塞)"
59
+ exit 0
60
+ fi
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env bash
2
+ # cm 工作流状态条 · Claude Code 底部实时显示(官方 statusLine 机制)
3
+ # 输出原则: 大白话,路过的人扫一眼能懂;工程细节收在行尾暗色角标
4
+ input=$(cat)
5
+
6
+ PTR="$HOME/.claude/cm-plugin-current-specs"
7
+ if [ -f "$PTR" ]; then
8
+ SPECS=$(cat "$PTR" 2>/dev/null)
9
+ ST="$SPECS/.cm-status.json"
10
+ if [ -f "$ST" ]; then
11
+ python3 - "$ST" "$SPECS" <<'EOF' && exit 0
12
+ import json, sys, os, re, time
13
+ try:
14
+ s = json.load(open(sys.argv[1]))
15
+ except Exception:
16
+ sys.exit(1)
17
+ SPECS = sys.argv[2]
18
+ G, Y, B, R, D = "\033[32m", "\033[33m", "\033[1m", "\033[0m", "\033[2m"
19
+
20
+ PHASE = { # 节点 → 人话阶段
21
+ "N1": ("🚀", "启动准备"), "N2": ("📋", "规划任务"), "N3": ("🔨", "开发中"),
22
+ "N4": ("🔍", "检查代码"), "N5": ("💾", "保存进度"), "N6": ("🧪", "质量检测"),
23
+ "N7": ("🧹", "整理现场"), "N8": ("📦", "收尾总结"),
24
+ }
25
+ age = time.time() - os.path.getmtime(sys.argv[1]) # 状态新鲜度
26
+ node = s.get("node", ""); st = s.get("state", "")
27
+ if st == "done" and age > 3600:
28
+ sys.exit(1) # 完成态过期 1 小时 → 回落默认显示,不再霸屏
29
+ det = s.get("detail", "")[:44]; feat = s.get("feature", ""); task = s.get("task", "")
30
+ feat_name = re.sub(r"^\d+\.", "", feat) # 去掉编号前缀
31
+
32
+ def progress(feature):
33
+ """当前 feature 的任务进度: (完成数, 总数, 当前序号)"""
34
+ try:
35
+ md = open(os.path.join(SPECS, feature, "tasks.md"), encoding="utf-8").read()
36
+ items = re.findall(r"^- \[( |x)\] (T-\d+)", md, re.M)
37
+ active = [(c, t) for c, t in items]
38
+ done = sum(1 for c, _ in active if c == "x")
39
+ cur = next((i + 1 for i, (c, _) in enumerate(active) if c == " "), len(active))
40
+ return done, len(active), cur
41
+ except Exception:
42
+ return None
43
+
44
+ icon, phase = PHASE.get(node, ("⚙", "运行中"))
45
+ tag = f"{D} ·{node}{' '+task if task else ''}{R}" # 工程角标,暗色收尾
46
+
47
+ if st not in ("paused_for_human", "done") and age > 600:
48
+ # 崩溃残留检测: 运行态超 10 分钟无更新,大概率已中断——错误的仪表比没有仪表危险
49
+ print(f"{Y}⚠ 可能已中断{R}(最后更新 {int(age//60)} 分钟前,去会话确认){D}原状态: {phase}·{det[:20]}{R}{tag}")
50
+ elif st == "paused_for_human":
51
+ print(f"{Y}🖐 等你确认:{det} —— 流程已暂停,回 Claude Code 回复即可{R}{tag}")
52
+ elif st == "done":
53
+ print(f"{G}✅ 全部完成!{R} 所有任务已交付,收尾报告见会话{tag}")
54
+ else:
55
+ p = progress(feat) if feat else None
56
+ prog = f"(进度 {p[0]}/{p[1]})" if p else ""
57
+ body = f"{det}" if det else phase
58
+ fpart = f"{B}{feat_name}{R} · " if feat_name else ""
59
+ print(f"{G}{icon} {phase}{R} {fpart}{body}{D}{prog}{R}{tag}")
60
+ EOF
61
+ fi
62
+ fi
63
+
64
+ # 兜底:无 cm 执行时显示模型与目录
65
+ echo "$input" | python3 -c '
66
+ import json, sys
67
+ try:
68
+ d = json.load(sys.stdin)
69
+ m = d.get("model", {}).get("display_name", "")
70
+ w = d.get("workspace", {}).get("current_dir", "").rstrip("/").split("/")[-1]
71
+ print(f"{m} · {w}")
72
+ except Exception:
73
+ print("cm")' 2>/dev/null || echo "cm"
@@ -27,9 +27,10 @@
27
27
  "name": "CM Plugin Workflow",
28
28
  "packageName": "@aibyzero/cm-plugin-workflow",
29
29
  "version": "0.5.0",
30
- "bundled": false,
31
- "private": true,
32
- "sourceEnv": "BYZ_CM_PLUGIN_WORKFLOW_SOURCE",
30
+ "source": "github:kingxiaozhe/cm-plugin-workflow#d9158aa5c6e143b6a39bfba415cb1d8a2a4051b1",
31
+ "license": "MIT",
32
+ "bundled": true,
33
+ "bundledPath": "workflows/cm-plugin",
33
34
  "envRoot": "BYZ_CM_PLUGIN_WORKFLOW_ROOT",
34
35
  "skillsPaths": ["skills"],
35
36
  "promptsPath": "commands",