@ranger1/dx 0.1.91 → 0.1.92

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 (52) hide show
  1. package/README.md +2 -2
  2. package/lib/cli/help.js +1 -1
  3. package/lib/codex-initial.js +19 -215
  4. package/package.json +2 -2
  5. package/skills/backend-layering-audit-fixer/SKILL.md +180 -0
  6. package/{codex/skills → skills}/doctor/SKILL.md +2 -9
  7. package/{codex/skills → skills}/doctor/scripts/doctor.sh +2 -253
  8. package/skills/git-pr-ship/SKILL.md +481 -0
  9. package/skills/naming-audit-fixer/SKILL.md +149 -0
  10. package/skills/naming-audit-fixer/references/fix-guide.md +93 -0
  11. package/skills/naming-audit-fixer/scripts/audit_naming.py +534 -0
  12. package/codex/agents/fixer.toml +0 -37
  13. package/codex/agents/orchestrator.toml +0 -11
  14. package/codex/agents/reviewer.toml +0 -52
  15. package/codex/agents/spark.toml +0 -18
  16. package/codex/skills/pr-review-loop/SKILL.md +0 -209
  17. package/codex/skills/pr-review-loop/agents/openai.yaml +0 -4
  18. package/codex/skills/pr-review-loop/references/agents/pr-context.md +0 -73
  19. package/codex/skills/pr-review-loop/references/agents/pr-precheck.md +0 -161
  20. package/codex/skills/pr-review-loop/references/agents/pr-review-aggregate.md +0 -188
  21. package/codex/skills/pr-review-loop/references/skill-layout.md +0 -25
  22. package/codex/skills/pr-review-loop/scripts/gh_review_harvest.py +0 -292
  23. package/codex/skills/pr-review-loop/scripts/pr_context.py +0 -351
  24. package/codex/skills/pr-review-loop/scripts/pr_review_aggregate.py +0 -951
  25. package/codex/skills/pr-review-loop/scripts/test_pr_review_aggregate.py +0 -876
  26. package/codex/skills/pr-review-loop/scripts/test_validate_reviewer_prompts.py +0 -92
  27. package/codex/skills/pr-review-loop/scripts/validate_reviewer_prompts.py +0 -87
  28. /package/{codex/skills → skills}/doctor/agents/openai.yaml +0 -0
  29. /package/{codex/skills → skills}/e2e-audit-fixer/SKILL.md +0 -0
  30. /package/{codex/skills → skills}/e2e-audit-fixer/agents/openai.yaml +0 -0
  31. /package/{codex/skills → skills}/e2e-audit-fixer/scripts/e2e_e2e_audit.py +0 -0
  32. /package/{codex/skills → skills}/env-accessor-audit-fixer/SKILL.md +0 -0
  33. /package/{codex/skills → skills}/env-accessor-audit-fixer/agents/openai.yaml +0 -0
  34. /package/{codex/skills → skills}/env-accessor-audit-fixer/references/bootstrap-env-foundation.md +0 -0
  35. /package/{codex/skills → skills}/env-accessor-audit-fixer/scripts/env_accessor_audit.py +0 -0
  36. /package/{codex/skills → skills}/error-handling-audit-fixer/SKILL.md +0 -0
  37. /package/{codex/skills → skills}/error-handling-audit-fixer/agents/openai.yaml +0 -0
  38. /package/{codex/skills → skills}/error-handling-audit-fixer/references/error-handling-standard.md +0 -0
  39. /package/{codex/skills → skills}/error-handling-audit-fixer/references/foundation-bootstrap.md +0 -0
  40. /package/{codex/skills → skills}/error-handling-audit-fixer/scripts/error_handling_audit.py +0 -0
  41. /package/{codex/skills → skills}/gh-dependabot-cleanup/SKILL.md +0 -0
  42. /package/{codex/skills → skills}/gh-dependabot-cleanup/agents/openai.yaml +0 -0
  43. /package/{codex/skills → skills}/git-commit-and-pr/SKILL.md +0 -0
  44. /package/{codex/skills → skills}/git-commit-and-pr/agents/openai.yaml +0 -0
  45. /package/{codex/skills → skills}/git-release/SKILL.md +0 -0
  46. /package/{codex/skills → skills}/git-release/agents/openai.yaml +0 -0
  47. /package/{codex/skills → skills}/online-debug-guard/SKILL.md +0 -0
  48. /package/{codex/skills → skills}/online-debug-guard/agents/openai.yaml +0 -0
  49. /package/{codex/skills → skills}/pagination-dto-audit-fixer/SKILL.md +0 -0
  50. /package/{codex/skills → skills}/pagination-dto-audit-fixer/agents/openai.yaml +0 -0
  51. /package/{codex/skills → skills}/pagination-dto-audit-fixer/references/pagination-standard.md +0 -0
  52. /package/{codex/skills → skills}/pagination-dto-audit-fixer/scripts/pagination_dto_audit.py +0 -0
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Unit tests for validate_reviewer_prompts.py.
4
- """
5
-
6
- import importlib.util
7
- from pathlib import Path
8
- from typing import Callable, cast
9
-
10
-
11
- def _load_module():
12
- module_path = Path(__file__).with_name("validate_reviewer_prompts.py")
13
- spec = importlib.util.spec_from_file_location("validate_reviewer_prompts", module_path)
14
- if spec is None or spec.loader is None:
15
- raise RuntimeError(f"Failed to load module spec: {module_path}")
16
- module = importlib.util.module_from_spec(spec)
17
- spec.loader.exec_module(module)
18
- return module
19
-
20
-
21
- _module = _load_module()
22
- _validate_prompt_text = cast(Callable[[str], list[str]], getattr(_module, "_validate_prompt_text"))
23
-
24
-
25
- def test_validate_prompt_text_accepts_complete_contract() -> None:
26
- text = """
27
- # PR Reviewer (Security)
28
-
29
- ## 角色码(强制)
30
-
31
- - `ROLE_CODE = SEC`
32
- - `reviewFile`: `./.cache/review-SEC-pr<PR_NUMBER>-r<ROUND>-<RUN_ID>.md`
33
- - findings id 前缀:`SEC-`
34
-
35
- ## 输出格式(强制)
36
-
37
- - 必须写入 `reviewFile`,禁止只在 stdout 输出审查结果。
38
- - 若无问题,文件内容必须严格为以下模板:
39
-
40
- ```md
41
- # Review (SEC)
42
- PR: 123
43
- Round: 1
44
- RunId: 123-1-abcdef0
45
-
46
- ## Findings
47
- None
48
- ```
49
-
50
- - 若有问题,每个 finding 必须使用如下块格式,字段名必须逐字一致:
51
-
52
- ```md
53
- # Review (SEC)
54
- PR: 123
55
- Round: 1
56
- RunId: 123-1-abcdef0
57
-
58
- ## Findings
59
- id: SEC-001
60
- priority: P1
61
- category: bug
62
- file: apps/api/src/service.ts
63
- line: 10
64
- title: 标题
65
- description: 描述
66
- suggestion: 建议
67
- ```
68
-
69
- - `priority` 只能是 `P0`、`P1`、`P2`、`P3`。
70
- - `category` 只允许使用英文小写单词或短语。
71
- - `line` 必须是单个行号数字;未知时写 `null`。
72
- - 多个 finding 之间必须空一行;禁止额外嵌套列表、表格、代码块或总结性 prose。
73
- - 输出前必须自检:字段齐全、非空、前缀与 `ROLE_CODE` 一致。
74
- """
75
-
76
- assert _validate_prompt_text(text) == []
77
-
78
-
79
- def test_validate_prompt_text_reports_missing_contract_sections() -> None:
80
- text = """
81
- # PR Reviewer (Style)
82
-
83
- ## 角色码(强制)
84
-
85
- - `ROLE_CODE = STY`
86
- - `reviewFile`: `./.cache/review-STY-pr<PR_NUMBER>-r<ROUND>-<RUN_ID>.md`
87
- """
88
-
89
- errors = _validate_prompt_text(text)
90
- assert any("输出格式(强制)" in err for err in errors)
91
- assert any("None" in err for err in errors)
92
- assert any("priority" in err for err in errors)
@@ -1,87 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Validate reviewer prompt files contain the required output contract.
4
- """
5
-
6
- import argparse
7
- import json
8
- import re
9
- import sys
10
- from pathlib import Path
11
-
12
-
13
- REQUIRED_SNIPPETS = [
14
- "## 输出格式(强制)",
15
- "## Findings",
16
- "None",
17
- "id:",
18
- "priority:",
19
- "category:",
20
- "file:",
21
- "line:",
22
- "title:",
23
- "description:",
24
- "suggestion:",
25
- ]
26
-
27
-
28
- def _validate_prompt_text(text: str) -> list[str]:
29
- errors: list[str] = []
30
- for snippet in REQUIRED_SNIPPETS:
31
- if snippet not in text:
32
- errors.append(f"缺少必需片段: {snippet}")
33
-
34
- role_match = re.search(r"ROLE_CODE\s*=\s*([A-Z0-9]+)", text)
35
- if not role_match:
36
- errors.append("缺少 ROLE_CODE = <CODE>")
37
- return errors
38
-
39
- role_code = role_match.group(1)
40
- if f"id: {role_code}-001" not in text:
41
- errors.append(f"缺少与 ROLE_CODE 匹配的 finding id 示例: id: {role_code}-001")
42
-
43
- review_file_pattern = rf"review-{role_code}-pr<PR_NUMBER>-r<ROUND>-<RUN_ID>\.md"
44
- if not re.search(review_file_pattern, text):
45
- errors.append(f"reviewFile 模板未与 ROLE_CODE 对齐: {role_code}")
46
-
47
- return errors
48
-
49
-
50
- def _validate_file(path: Path) -> list[str]:
51
- try:
52
- text = path.read_text(encoding="utf-8")
53
- except Exception as exc:
54
- return [f"文件不可读: {exc}"]
55
- return _validate_prompt_text(text)
56
-
57
-
58
- def main(argv: list[str]) -> int:
59
- parser = argparse.ArgumentParser(add_help=False)
60
- parser.add_argument("paths", nargs="+")
61
- args = parser.parse_args(argv)
62
-
63
- invalid: dict[str, list[str]] = {}
64
- checked: list[str] = []
65
- for raw in args.paths:
66
- path = Path(raw)
67
- checked.append(str(path))
68
- errors = _validate_file(path)
69
- if errors:
70
- invalid[str(path)] = errors
71
-
72
- if invalid:
73
- sys.stdout.write(
74
- json.dumps(
75
- {"ok": False, "checked": checked, "invalid": invalid},
76
- ensure_ascii=False,
77
- )
78
- + "\n"
79
- )
80
- return 1
81
-
82
- sys.stdout.write(json.dumps({"ok": True, "checked": checked}, ensure_ascii=False) + "\n")
83
- return 0
84
-
85
-
86
- if __name__ == "__main__":
87
- raise SystemExit(main(sys.argv[1:]))
File without changes