将角色与 Skill 从 .claude 迁入 .agent,移除 Claude CLI 运行时并接入固定 Opus 角色 profile、完整 schema、预算 deadline、raw 与回执证据链。 同步拆分 Skill 职责、复利 lesson、Gate 回放、Dashboard 人审入口、数据库登记和机械门禁;候选设计正文不包含在本提交中。
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
||
"""raw 凭据过滤的离线回归测试。"""
|
||
import pathlib
|
||
import sys
|
||
|
||
PROJECT_ROOT = pathlib.Path(__file__).resolve().parents[3]
|
||
SCRIPT_DIR = PROJECT_ROOT / ".agent" / "skills" / "record-run-evidence" / "scripts"
|
||
sys.path.insert(0, str(SCRIPT_DIR))
|
||
from persist_raw import _check_no_secrets # noqa: E402
|
||
|
||
|
||
def test_normal_prompt_words_are_allowed():
|
||
_check_no_secrets("输出不超过 4000 字;token budget 只用于篇幅估算。")
|
||
|
||
|
||
def test_secret_assignments_are_rejected():
|
||
for text in (
|
||
"api_key=sk-example-secret-value",
|
||
"token: abcdefghijklmnop",
|
||
"Authorization: Bearer abcdefghijklmnop",
|
||
"-----BEGIN PRIVATE KEY-----",
|
||
):
|
||
try:
|
||
_check_no_secrets(text)
|
||
except ValueError:
|
||
continue
|
||
raise AssertionError(f"凭据未被拒绝: {text}")
|
||
|
||
|
||
def main():
|
||
test_normal_prompt_words_are_allowed()
|
||
test_secret_assignments_are_rejected()
|
||
print("全部通过")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|