Skip to content

v1.1.0: routing single source of truth + regression benchmark + supply-chain pins + opencode integration - #43

Merged
zhaoxuya520 merged 5 commits into
zhaoxuya520:mainfrom
withlovehub:improve-v1.1.0
Aug 8, 2026
Merged

v1.1.0: routing single source of truth + regression benchmark + supply-chain pins + opencode integration#43
zhaoxuya520 merged 5 commits into
zhaoxuya520:mainfrom
withlovehub:improve-v1.1.0

Conversation

@withlovehub

Copy link
Copy Markdown

v1.1.0: 路由单一事实源 + 回归基准 + 供应链 pin + opencode 生态适配

向 reverse-skill 推荐一套实质性改进(2 commits,基于当前 main,零冲突)。核心思路:保持现有架构不变,把路由规则的维护方式升级为"单一数据源 + 回归测试"

改进内容

1. 路由引擎:硬编码 → 单一事实源

  • 新增 skills/config/routing.json:R0–R39 全部关键词规则结构化(must / mustAll / exclude 语义 + 边界注释)
  • master-route.ps1 改为读取 JSON(CLI 完全兼容:参数、输出、退出码不变),内置 priority 自检防漏
  • 两轮 benchmark 驱动的关键词覆盖增强:burp 家族、pcap/wireshark、root 检测/证书校验、buffer overflow、.so/native/JNI、go 二进制(中文)、js 加密、webshell、提权、S3、应急响应、蓝牙 BLE、USB、Unity 等 20+ 盲区

2. 回归测试体系(防止改路由改坏东西)

  • skills/tests/routing-benchmark.json:162 条中英双语用例(含 jailbreak iphone→R2 vs LLM 越狱→R14 等边界)
  • skills/scripts/test-routing.ps1:回归 runner
  • .github/workflows/ci.yml:Windows + Ubuntu 双矩阵,push/PR 自动跑 5 项检查

3. 供应链 pin gate(与现有安全理念闭环)

  • verify-routing-coherence.ps1 新增强制检查:自动安装能力必须有 pinnedVersion / pinnedCommit / pinPolicy / 资产哈希,否则 FAIL
  • 已 pin:frida-tools 14.10.4、pwntools 4.15.0、agent-browser 0.31.1、ida-pro-mcp @commit、SecLists/ProxyCat @commit、nuclei v3.9.0

4. 全局注入改为显式 opt-in(安全边界)

  • 新增 install-global.ps1(交互确认,写独立文件,不再向用户既有 CLAUDE.md/AGENTS.md 静默追加)+ uninstall-global.ps1/.sh(零残留)
  • RULES.md/RULES_zh.md 同步更新:AI 未经确认禁止修改用户全局配置

5. opencode 生态适配

  • opencode.jsonc:42 个 SKILL.md 通过 skills.paths 直接注册为 opencode skills + 5 个 MCP(默认关闭按需启用)
  • AGENTS.md 项目入口、.opencode/agent/reverse-router.md 路由分诊子代理、install-opencode.ps1 一键检查
  • 补全 dsl-vm-reverse/SKILL.md 缺失的 frontmatter(唯一没有 name/description 的模块)

6. 其他

  • skills/INDEX.md 自动导航索引(extract-summaries.ps1 生成,-Check 防 drift,行尾免疫)
  • examples/ctf-demo/ 完整流程示例
  • 修复 3 个上游混合 CRLF 文件(.gitattributes 声明 LF 但提交为 CRLF,fresh clone 永远 dirty)

测试证据

本地 + fresh clone 全流程验证(PowerShell 5.1):

检查 结果
test-routing.ps1(162 用例) ✅ ALL PASS
verify-routing-coherence.ps1(含 pin gate) ✅ ALL PASSED
smoke.ps1 ✅ ALL PASS
extract-summaries -Check ✅ up to date
install-opencode.ps1 ✅ ALL CHECKS PASSED
bash -n / JSON 校验

兼容性

  • master-route.ps1 / case-init.ps1 / append-evidence.ps1 等既有 CLI 契约全部不变
  • 路由行为经 23 个既有 verify 用例 + 162 个 benchmark 用例验证与旧版一致
  • 新增文件均为增量,不删除/不重写任何既有模块内容

可以怎么审

  1. git diff main...improve-v1.1.0 --stat 看变更面(34+5 个文件)
  2. powershell -File skills/scripts/test-routing.ps1 验证 162 用例
  3. 有不同意见欢迎直接指出,我会配合调整

test added 2 commits August 2, 2026 21:31
…tion + supply-chain pins

- routing: skills/config/routing.json becomes the single source of truth;
  master-route.ps1 reads it (must/mustAll/exclude semantics); hardcoded
  routing tables removed; 20+ benchmark-driven keyword coverage fixes
- tests: skills/tests/routing-benchmark.json (162 bilingual cases) +
  test-routing.ps1 runner; CI (windows+ubuntu matrix) runs regression,
  coherence, smoke, INDEX drift and JSON validation
- supply chain: verify pin gate fails unpinned auto-install; pinned
  frida-tools 14.10.4, pwntools 4.15.0, agent-browser 0.31.1,
  ida-pro-mcp/proxycat/seclists @commit, nuclei v3.9.0
- global injection: opt-in install-global.ps1 (standalone files) +
  uninstall-global.ps1/.sh (zero residue); RULES/RULES_zh updated
- opencode: opencode.jsonc (42 skills + MCP registry), AGENTS.md,
  .opencode/agent/reverse-router.md, install-opencode.ps1
- nav: skills/INDEX.md generated by extract-summaries.ps1
- docs: README/CHANGELOG/VERSION 1.1.0, examples/ctf-demo walkthrough
- fix: normalize 3 upstream mixed-CRLF markdown files
…llback, BOM for star-history

- ci.yml: trigger CI on all branches (fork improve branch was never tested)
- extract-summaries.ps1: write LF output + normalize EOL in -Check so it
  passes under core.autocrlf=true worktrees (GitHub Windows runner)
- master-route.ps1: fall back safely if priority contains a ghost route id
- install-global.ps1: complete the Claude Code @include hint with full path
- update-star-history.ps1: add UTF-8 BOM for PowerShell 5.1 CJK

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR delivers the v1.1.0 upgrade to the repo’s routing system by moving routing rules into a single structured source of truth, adding a regression benchmark/CI enforcement layer, tightening supply-chain pinning guarantees, and adding opt-in global routing + opencode integration.

Changes:

  • Centralize PRIMARY routing rules into skills/config/routing.json, and update master-route.ps1 + verification tooling to consume it.
  • Add routing regression benchmark + runner (routing-benchmark.json, test-routing.ps1) and wire them into CI (Windows + Ubuntu).
  • Add opt-in global routing install/uninstall scripts and opencode configuration/agent entrypoints.

Reviewed changes

Copilot reviewed 32 out of 35 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
VERSION Bump version to 1.1.0.
skills/tests/routing-benchmark.json Adds 162-case bilingual routing regression benchmark.
skills/scripts/verify-routing-coherence.ps1 Verifies routing/config artifacts and enforces supply-chain pinning.
skills/scripts/update-star-history.ps1 Encoding/header adjustment (BOM).
skills/scripts/uninstall-global.sh Adds *nix uninstaller for global routing injection artifacts.
skills/scripts/uninstall-global.ps1 Adds PowerShell uninstaller for global routing injection artifacts.
skills/scripts/test-routing.ps1 Adds routing regression runner script.
skills/scripts/smoke.ps1 Extends smoke script coverage to include new scripts.
skills/scripts/master-route.ps1 Switches routing to JSON single source of truth; removes hardcoded maps.
skills/scripts/install-opencode.ps1 Adds opencode install/check helper (CLI/config/frontmatter checks).
skills/scripts/install-global.ps1 Adds explicit opt-in global routing injection installer.
skills/scripts/extract-summaries.ps1 Generates skills/INDEX.md from SKILL frontmatter; supports -Check.
skills/scripts/bootstrap-manifest.json Pins tool versions/commits and adds pin policy metadata.
skills/reverse-engineering/dsl-vm-reverse/SKILL.md Adds missing frontmatter (name/description).
skills/pentest-tools/src-hunter/references/playbooks/http-smuggling.md EOL/format normalization in reference content.
skills/pentest-tools/src-hunter/references/payloader/by-category/web/请求走私.md EOL/format normalization in reference content.
skills/INDEX.md Adds generated skills navigation index.
skills/config/routing.json Introduces routing.json single source of truth (R0–R39).
skills/config/global-routing-template.md Template used by global routing injection installer.
RULES.md Updates rules to require explicit opt-in for global injection.
RULES_zh.md Chinese rules update mirroring explicit opt-in global injection.
README.md Documents new routing artifacts, tests, and opencode integration.
opencode.jsonc Adds opencode project config (skills.paths + MCP registry disabled-by-default).
kali/scripts/bootstrap-manifest.json Adds/preserves pins in Kali manifest and reformats JSON.
examples/ctf-demo/workitems.md Adds example workitems for the demo case.
examples/ctf-demo/timeline.md Adds example timeline for the demo case.
examples/ctf-demo/scope.md Adds example scope gate document for the demo case.
examples/ctf-demo/report/report.md Adds example final report output.
examples/ctf-demo/README.md Adds walkthrough README for the demo case.
examples/ctf-demo/evidence/E-001-E-003.md Adds example evidence chain artifacts.
CHANGELOG.md Adds 1.1.0 changelog entry.
AGENTS.md Adds opencode project entry guidance for this repo.
.opencode/agent/reverse-router.md Adds opencode subagent for routing-only triage.
.github/workflows/ci.yml Adds CI: routing regression, coherence/pin gate, smoke, INDEX drift, JSON validation, sh syntax.
Suppressed comments (5)

skills/scripts/master-route.ps1:119

  • OutDir construction embeds backslashes in path segments (e.g., work\master-route-...). On non-Windows, this can create directories containing a literal backslash instead of nesting folders. Build paths with Join-Path per segment for cross-platform behavior.
    if ($packageRoot -and (Test-Path -LiteralPath $packageRoot)) {
        $OutDir = Join-Path $packageRoot ("work\master-route-{0}" -f $stamp)
    } else {
        $tmpBase = if ($env:TEMP) { $env:TEMP } else { [System.IO.Path]::GetTempPath() }
        $OutDir = Join-Path $tmpBase ("reverse-skill-route\master-route-{0}" -f $stamp)

skills/scripts/verify-routing-coherence.ps1:40

  • This uses a Windows-style segment (tests\routing-benchmark.json) in Join-Path. On Linux/macOS PowerShell this becomes a literal backslash in the filename, so the benchmark won’t be found.
    skills/scripts/test-routing.ps1:33
  • $env:TEMP can be unset on non-Windows runners. With $ErrorActionPreference='Stop', Join-Path will throw and the Ubuntu CI run can fail. Use the same GetTempPath fallback pattern as master-route.ps1.
if ([string]::IsNullOrWhiteSpace($LogDir)) {
    $LogDir = Join-Path $env:TEMP ("rs-routing-test-{0}" -f (Get-Date -Format 'yyyyMMdd-HHmmss'))
}
New-Item -ItemType Directory -Force -Path $LogDir | Out-Null

skills/scripts/test-routing.ps1:48

  • Per-case temp dir creation also assumes $env:TEMP is set. On Linux/macOS this may throw; use [System.IO.Path]::GetTempPath() fallback to keep regression runs portable.
foreach ($c in $cases) {
    $tmp = Join-Path $env:TEMP ("rs-rt-{0}" -f [guid]::NewGuid().ToString('n'))
    $got = 'ERR'

skills/scripts/extract-summaries.ps1:28

  • Directory extraction uses $rel.Split('\\'), which won’t split Linux/macOS paths (they contain /). This can make the generated module name/path incorrect.
foreach ($sf in $skillFiles) {
    $rel = $sf.FullName.Substring($skillsRoot.Length + 1)
    $dir = $rel.Split('\')[0]
    $head = Get-Content -LiteralPath $sf.FullName -TotalCount 15 -Encoding UTF8

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +127 to 128
### Supported scenarios| Scenario | Entry |
|----------|-------|
if (-not $scriptDir) { $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path }
$skillsRoot = Split-Path -Parent $scriptDir
$packageRoot = Split-Path -Parent $skillsRoot
$configPath = Join-Path $skillsRoot 'config\routing.json'
function Bad($m) { Write-Host "[FAIL] $m" -ForegroundColor Red; [void]$fail.Add($m) }

# --- 新事实源/产物检查(routing.json / benchmark / INDEX) ---
$routingJson = Join-Path $skillsRoot 'config\routing.json'
# --- supply-chain pin gate: auto-install download sources MUST be pinned ---
# 统一判定:pinnedVersion / pinnedCommit / pinPolicy 三选一;
# github-release-* 额外接受 assetSha256 / preferApiDigest(GitHub 官方发布资产哈希)。
$pinKinds = @('pip-package', 'npm-mcp', 'npm-global', 'go-install', 'git-clone')
if (-not $PackageRoot) { $PackageRoot = Split-Path -Parent $skillsRoot }

if ([string]::IsNullOrWhiteSpace($Benchmark)) {
$Benchmark = Join-Path $skillsRoot 'tests\routing-benchmark.json'
Comment on lines +19 to +22
$skillFiles = Get-ChildItem -Path $skillsRoot -Recurse -Filter 'SKILL.md' | Where-Object {
$rel = $_.FullName.Substring($skillsRoot.Length + 1)
$rel -ne 'SKILL.md' -and -not ($skipDirs | Where-Object { $rel.StartsWith($_ + '\') })
} | Sort-Object FullName
test added 3 commits August 3, 2026 00:54
Address GitHub Copilot review comments on PR zhaoxuya520#43:
- master-route.ps1: Join-Path per segment for OutDir (no literal backslashes)
- verify-routing-coherence.ps1: forward-slash segments in Join-Path (16 paths)
- test-routing.ps1: GetTempPath fallback for LogDir and per-case temp dirs
- smoke.ps1 / case-init.ps1: GetTempPath fallback for TEMP usage
- extract-summaries.ps1: split on both path separators; skip-dir match on both
- install-opencode.ps1: opencode CLI absence is WARN not FAIL (CI-friendly)
…ning

- verify-routing-coherence.ps1: GetTempPath fallback for ScratchDir (was the
  actual Ubuntu CI failure: Join-Path \C:\Users\asus\AppData\Local\Temp with null Path)
- bootstrap-reverse.ps1: define tmpBase once, use for download/extract dirs
- test-p0-friction.ps1: GetTempPath fallback for ScratchDir
# Conflicts:
#	kali/scripts/bootstrap-manifest.json
@withlovehub

Copy link
Copy Markdown
Author

Hi @zhaoxuya520 👋

Just a heads-up on the current state of this PR and the fork:

Update: fork main is now fully synced with the latest iteration

I noticed you merged fix/open-issues (#26 #30 #38 #39 #40 #41) into main — thanks! I've merged those changes into this branch too, so improve-v1.1.0 and my fork's main are both up to date with your latest code plus the v1.1.0 improvements:

  • Routing single source of truth (skills/config/routing.json) + master-route.ps1 reading from it
  • 162-case routing regression benchmark + test-routing.ps1, wired into CI (Windows + Ubuntu)
  • Supply-chain pin gate in verify-routing-coherence.ps1 (unpinned auto-install fails); all download sources pinned (frida-tools 14.10.4, pwntools 4.15.0, agent-browser 0.31.1, ida-pro-mcp/seclists/proxycat @commit, nuclei v3.9.0, etc.)
  • Opt-in global routing injection (install-global.ps1 / uninstall-global.ps1) — standalone files, no silent writes to user config
  • opencode integration: opencode.jsonc (42 skills + MCP registry), AGENTS.md, routing-triage subagent, install-opencode.ps1
  • Auto-generated skills/INDEX.md navigation + examples/ctf-demo walkthrough
  • Cross-platform hardening after Copilot review + Ubuntu CI fixes (path separators, TEMP fallbacks)
  • Your new kali/scripts/bootstrap-manifest.json structure is preserved; pins re-applied on top of it

Status

  • CI: all green (windows + ubuntu: routing regression, coherence+pin gate, smoke, INDEX drift, JSON validation, shell syntax)
  • PR is mergeable (no conflicts, ahead of main)
  • Local tests: 162/162 routing cases pass, fresh-clone verified

Take your time reviewing — happy to adjust anything. If you'd prefer smaller granular PRs (e.g. routing.json alone, or CI alone), I can split this one.

Thanks for the great project! 🙏

@zhaoxuya520
zhaoxuya520 merged commit 7098a55 into zhaoxuya520:main Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants