chore: 清理仓库旧内容 - #1
Closed
CodFrm wants to merge 6 commits into
Closed
Conversation
- 模块 github.com/scriptscat/sctl(仓库 scriptscat/sctl,二进制 sctl) - cmd/sctl:cobra 根 + serve/mcp/pair/status/version 子命令 - internal/cli:serve 引导 cago 应用(component.Core + 桥接 Component) - internal/bridge:WS server 作为 cago ComponentCancel(骨架空跑,阻塞至 ctx 取消) - internal/protocol:go:embed protocol.json 解析 + 测试(6 scope/6 action/14 envelope/12 错误码) - configs/config.yaml:cago 配置(bridge.address=127.0.0.1:8643) - PROTOCOL.md/protocol.json 为 Phase 0 草案镜像,权威副本随扩展仓库
- internal/logging:logger.New + NewFileCore 构建全局 logger(不用 component.Core, 它强制 stdout)。出口=stderr console + 文件(sctl.log 收 level+ / sctl.err.log 收 error+); stdout 全程留给 MCP 协议帧与 --json 输出。cobra 根 PersistentPreRunE 统一初始化 + --log-level - internal/config:数据目录解析(平台约定 + SCTL_DATA_DIR),派生 LogsDir/KeyFile - 各子命令入口 + 协议加载失败 + bridge 生命周期(启动/配置/取消/停止)补日志 - bridge 组件改用 gogo.Go 起 goroutine 后立即返回(修复 StartCancel 阻塞导致 SIGINT 死锁) - serve 去掉 component.Core(),复用全局 stderr logger,SIGINT 优雅关闭
- internal/auth:双向 HMAC-SHA256 挑战应答(会话/配对双模)、HKDF 派生配对密钥、 AES-256-GCM 下发长期密钥 K、Crockford base32 配对码;恒定时间比较,常量取自 protocol.json - internal/auth 存储:K 与客户端 token 均落盘(token 只存 SHA-256),原子写 0600 - internal/bridge:coder/websocket 接入,仅回环 127.0.0.1:8643(非回环 fail-fast), 单实例连接管理,阻塞式 Call(写操作挂起至审批),断开/超时/取消 → bridge.cancel, pair.decision→铸客户端→client.sync,client.revoke→中断在途→重同步 - internal/ratelimit:按 key 滑窗限流(配对/读/写) - component 用 cago ComponentCancel:回环校验→net.Listen→gogo.Go serve→优雅退出 - go test / -race 全过;serve 绑定回环、stdout 洁净、SIGINT 无死锁 Task #8。MCP stdio server 与 CLI 动词留待 Task #9。
- internal/bridge/control.go:daemon listener 上挂 /control/* HTTP 控制面(与扩展 WS 同端口、 独立路径),控制令牌恒定时间校验;handleControlCall 驱动 Server.Call,断开→bridge.cancel - internal/control:前端→daemon 客户端 + DTO + 256bit 控制令牌(0600,绑定后写)+ detached 自动拉起 (绑定竞态「连胜出者」) - internal/mcpserver:go-sdk v1.6.1 stdio server,6 action 为工具、按 scope 过滤 tools/list、 等待期 10s progress 续期;业务错误→IsError,传输/取消→协议错误 - internal/mcpidentity:sctl mcp 身份缓存(pair 与 serve 拆分:mcp pair 交互配对铸令牌落 0600, mcp 加载身份 + whoami 复核实时 scope 后服务;--name 支持多配置) - internal/cli:scripts list/info/source、install、enable/disable、rm;阻塞 + Ctrl-C 取消, 退出码 0/1/2(+3 其他);--json;source 转发 clientId=sctl-cli 走扩展侧披露豁免 - 两处 serve 使能修复:认 SCTL_BRIDGE_ADDR、缺 config.yaml 退回内置默认(自动拉起所需) - 文档:THREAT-MODEL.md(新,§4 威胁模型落地)、README(刷新到实际状态 + 冒烟/版本门槛) - gofmt 修 server_test.go;go build/vet/test -race 全绿;stdout 实测仅 jsonrpc 帧洁净 Task#9。真实浏览器联调与推送留待 Task#4(须用户确认 + ldflags 注版本 0.1.0)。
扩展侧审计只覆盖已配对客户端的行为;握手失败、配对限流、请求限流这些在扩展 会话建立之前就被挡掉的事件不会产生任何扩展侧记录,缺了它们无法对「网页直连 8643」这类探测取证。新增 internal/audit 补这一段: - 固定容量环形缓冲(对齐扩展侧 500 条),只驻内存不落盘,避免审计本身成为 新的敏感文件;事件字段集封闭(时间/类型/客户端/原因分类),没有承载任意 载荷的出口,以此保证 token、源码、凭据 URL 永不进审计; - 握手失败经 authError 携带审计分类,由 handleWS 统一记录一次,避免在各失败 点散落调用而漏记;本地故障(密钥读写等)不混入安全审计; - sctl status 给摘要行,--json 输出完整事件。 另修 §3.1 规格偏差:写动词(install/enable/disable/rm)阻塞期缺「等待浏览器 确认…」提示。提示走 stderr 以免污染 --json 的 stdout,且在连上 daemon 之后 才打印,否则 daemon 不可用时会先报一句误导的等待。 配套:CI(build/vet/test -race + protocol.json 与扩展仓库逐字节比对防漂移)、 goreleaser(6 目标交叉编译已本地快照验证)、补 GPLv3 LICENSE(与主仓一致)。
CodFrm
force-pushed
the
chore/cleanup-repository
branch
from
July 21, 2026 01:02
7b5552e to
d0d1e21
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
说明
清理当前仓库中的旧实现,仅保留一个简单 README,避免与正在推进的新方案混淆。
相关开发与讨论:
变更