pr-proof 0.0.0-stage → 0.1.0-beta.0
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.
- package/LICENSE +21 -0
- package/Procfile +2 -0
- package/README.md +300 -2
- package/app/__init__.py +1 -0
- package/app/api/__init__.py +1 -0
- package/app/api/cli.py +35 -0
- package/app/api/github.py +168 -0
- package/app/api/history.py +123 -0
- package/app/api/main.py +95 -0
- package/app/api/queue.py +45 -0
- package/app/api/responses.py +28 -0
- package/app/api/signature.py +19 -0
- package/app/api/sync.py +189 -0
- package/app/api/sync_rules_pure.py +71 -0
- package/app/api/webhook.py +166 -0
- package/app/setup/__init__.py +4 -0
- package/app/setup/cli.py +90 -0
- package/app/setup/configure.py +720 -0
- package/app/setup/files.py +93 -0
- package/app/setup/github_setup.py +149 -0
- package/app/setup/install_hints.json +32 -0
- package/app/setup/setup_pure.py +312 -0
- package/app/setup/start.py +113 -0
- package/app/shared/__init__.py +1 -0
- package/app/shared/comment_pure.py +29 -0
- package/app/shared/config.py +106 -0
- package/app/shared/db_pure.py +339 -0
- package/app/shared/embed_models_pure.py +55 -0
- package/app/shared/feedback_pure.py +84 -0
- package/app/shared/github_auth.py +74 -0
- package/app/shared/job_pure.py +43 -0
- package/app/shared/notify.py +97 -0
- package/app/shared/ops_alert_pure.py +38 -0
- package/app/shared/state_keys_pure.py +24 -0
- package/app/shared/version.py +27 -0
- package/app/worker/__init__.py +1 -0
- package/app/worker/access_pure.py +180 -0
- package/app/worker/ai/__init__.py +1 -0
- package/app/worker/ai/claude_cli.py +684 -0
- package/app/worker/ai/mcp_relay.py +42 -0
- package/app/worker/ai/path_hook.py +103 -0
- package/app/worker/ai/tool_server.py +139 -0
- package/app/worker/ai/workdir.py +333 -0
- package/app/worker/base_config.py +173 -0
- package/app/worker/budget.py +100 -0
- package/app/worker/cache_key_pure.py +34 -0
- package/app/worker/call_budget_pure.py +132 -0
- package/app/worker/checker_authoring_pure.py +599 -0
- package/app/worker/checker_pure.py +196 -0
- package/app/worker/cli.py +97 -0
- package/app/worker/command.py +191 -0
- package/app/worker/command_pure.py +38 -0
- package/app/worker/coverage.py +123 -0
- package/app/worker/coverage_pure.py +202 -0
- package/app/worker/deps.py +22 -0
- package/app/worker/diff_pure.py +419 -0
- package/app/worker/doc_rules_pure.py +201 -0
- package/app/worker/doc_rules_report.py +979 -0
- package/app/worker/eval_run_pure.py +241 -0
- package/app/worker/evaluation.py +151 -0
- package/app/worker/feedback.py +448 -0
- package/app/worker/feedback_pure.py +131 -0
- package/app/worker/feedback_report_pure.py +90 -0
- package/app/worker/feedback_triage.py +85 -0
- package/app/worker/feedback_triage_pure.py +363 -0
- package/app/worker/fix/__init__.py +1 -0
- package/app/worker/fix/decide.py +197 -0
- package/app/worker/fix/feedback_fix_pure.py +125 -0
- package/app/worker/fix/fix_decision_pure.py +386 -0
- package/app/worker/fix/fix_pure.py +70 -0
- package/app/worker/fix/mechanical_fix.py +214 -0
- package/app/worker/fix/model_fix.py +575 -0
- package/app/worker/fix/model_fix_pure.py +593 -0
- package/app/worker/fix/proposal.py +584 -0
- package/app/worker/fix/proposal_pure.py +103 -0
- package/app/worker/fix/scope.py +40 -0
- package/app/worker/fix/scope_pure.py +222 -0
- package/app/worker/generated_tests_pure.py +442 -0
- package/app/worker/github.py +471 -0
- package/app/worker/graph.py +963 -0
- package/app/worker/guard.py +91 -0
- package/app/worker/lang/__init__.py +0 -0
- package/app/worker/lang/install_pure.py +25 -0
- package/app/worker/lang/python.py +862 -0
- package/app/worker/loop.py +200 -0
- package/app/worker/main.py +76 -0
- package/app/worker/markdown_pure.py +29 -0
- package/app/worker/mcp_pure.py +150 -0
- package/app/worker/memory.py +503 -0
- package/app/worker/merged_fix_pure.py +236 -0
- package/app/worker/pr_check_report_pure.py +201 -0
- package/app/worker/pr_description_report_pure.py +112 -0
- package/app/worker/preflight.py +125 -0
- package/app/worker/rag_pure.py +285 -0
- package/app/worker/rag_switch_pure.py +203 -0
- package/app/worker/records.py +207 -0
- package/app/worker/records_pure.py +239 -0
- package/app/worker/repo.py +588 -0
- package/app/worker/repo_config_pure.py +269 -0
- package/app/worker/report.py +300 -0
- package/app/worker/retry.py +65 -0
- package/app/worker/rule_pure.py +223 -0
- package/app/worker/rule_reading_pure.py +503 -0
- package/app/worker/rules/__init__.py +1 -0
- package/app/worker/rules/checkers.py +615 -0
- package/app/worker/rules/detect.py +154 -0
- package/app/worker/rules/doc_rules.py +301 -0
- package/app/worker/rules/doc_sections_pure.py +168 -0
- package/app/worker/rules/judge.py +410 -0
- package/app/worker/rules/judge_pure.py +627 -0
- package/app/worker/rules/pr_check.py +404 -0
- package/app/worker/rules/pr_check_pure.py +922 -0
- package/app/worker/rules/pr_description.py +218 -0
- package/app/worker/rules/pr_description_pure.py +743 -0
- package/app/worker/rules/rules.py +314 -0
- package/app/worker/rules/run_check.py +95 -0
- package/app/worker/rules/run_check_pure.py +219 -0
- package/app/worker/rules/tool_choice_pure.py +135 -0
- package/app/worker/sandbox/__init__.py +1 -0
- package/app/worker/sandbox/checker_runner.py +412 -0
- package/app/worker/sandbox/container.py +130 -0
- package/app/worker/sandbox/docker_cli.py +170 -0
- package/app/worker/sandbox/safe_read.py +32 -0
- package/app/worker/sandbox/toolcache.py +425 -0
- package/app/worker/state.py +602 -0
- package/app/worker/test_lines.py +77 -0
- package/app/worker/test_run_pure.py +133 -0
- package/app/worker/text_edit_pure.py +66 -0
- package/app/worker/tools_pure.py +152 -0
- package/app/worker/update.py +305 -0
- package/app/worker/violation_pure.py +33 -0
- package/bin/pr-proof.js +173 -0
- package/docker/sandbox/Dockerfile +12 -0
- package/docker/sandbox/coveragerc +19 -0
- package/docker-compose.yml +5 -0
- package/package.json +31 -4
- package/pyproject.toml +60 -0
package/app/setup/cli.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""`python -m app.setup.cli <명령>`. 보통은 입구(`npx pr-proof <명령>`, bin/pr-proof.js)가 부른다.
|
|
2
|
+
|
|
3
|
+
- `configure`: 처음 설정 (`app/setup/configure.py`)
|
|
4
|
+
- `add <repo>...`, `rm <repo>...`, `list`: 처리할 repo 목록과 그 웹훅
|
|
5
|
+
- `start`: api, worker, (smee 주소가 있으면) smee-client를 띄운다 (`app/setup/start.py`)
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
import os
|
|
10
|
+
import sys
|
|
11
|
+
from typing import Final
|
|
12
|
+
|
|
13
|
+
from app.setup import configure as flow
|
|
14
|
+
from app.setup import github_setup, setup_pure, start
|
|
15
|
+
|
|
16
|
+
_REPO_HELP: Final = f"repo (예: {setup_pure.REPO_EXAMPLE})"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _parser() -> argparse.ArgumentParser:
|
|
20
|
+
parser = argparse.ArgumentParser(prog="npx pr-proof")
|
|
21
|
+
commands = parser.add_subparsers(dest="command", required=True)
|
|
22
|
+
|
|
23
|
+
conf = commands.add_parser(
|
|
24
|
+
"configure", help="처음 설정",
|
|
25
|
+
description="처음 설정. 터미널이면 묻고, 아니면 인자로만 받는다. 여러 번 돌려도 같다. "
|
|
26
|
+
f"토큰은 화면에 보이지 않게 입력하거나 환경 변수 {github_setup.TOKEN_INPUT_ENV}로 준다 "
|
|
27
|
+
"(명령줄 인자로는 받지 않는다).",
|
|
28
|
+
) # fmt: skip
|
|
29
|
+
conf.add_argument("--repo", action="append", default=[], metavar="REPO",
|
|
30
|
+
help=f"처리할 {_REPO_HELP}. 여러 번 줄 수 있다") # fmt: skip
|
|
31
|
+
conf.add_argument("--auth", choices=["gh", "token"], help="GitHub 인증 방식")
|
|
32
|
+
conf.add_argument("--webhook-url", help="웹훅 받는 주소. 주지 않으면 smee.io 주소를 만든다")
|
|
33
|
+
conf.add_argument("--port", type=int, help="API 포트 (기본 8765)")
|
|
34
|
+
conf.add_argument("--manual-webhook", action="store_true",
|
|
35
|
+
help="웹훅을 API로 등록하지 않고 손으로 등록할 값만 보인다") # fmt: skip
|
|
36
|
+
conf.add_argument("--dry-run", action="store_true",
|
|
37
|
+
help="파일과 GitHub에 쓰지 않고 할 일만 보인다") # fmt: skip
|
|
38
|
+
|
|
39
|
+
add = commands.add_parser(
|
|
40
|
+
"add", help="처리할 repo를 더한다",
|
|
41
|
+
description="허용 목록에 더하고, 권한을 확인하고, 웹훅을 등록한다.",
|
|
42
|
+
) # fmt: skip
|
|
43
|
+
add.add_argument("repos", nargs="+", metavar="REPO", help=_REPO_HELP)
|
|
44
|
+
add.add_argument("--webhook-url", help="웹훅 받는 주소 (주지 않으면 configure가 저장한 것)")
|
|
45
|
+
add.add_argument("--manual-webhook", action="store_true",
|
|
46
|
+
help="웹훅을 API로 등록하지 않고 손으로 등록할 값만 보인다") # fmt: skip
|
|
47
|
+
add.add_argument("--dry-run", action="store_true", help="쓰지 않고 할 일만 보인다")
|
|
48
|
+
|
|
49
|
+
rm = commands.add_parser(
|
|
50
|
+
"rm", help="처리할 repo를 뺀다",
|
|
51
|
+
description=f"허용 목록에서 빼고, 저장한 웹훅 받는 주소의 웹훅만 지운다. {flow.LEFT_ALONE}",
|
|
52
|
+
) # fmt: skip
|
|
53
|
+
rm.add_argument("repos", nargs="+", metavar="REPO", help=_REPO_HELP)
|
|
54
|
+
rm.add_argument("--yes", action="store_true", help="확인을 묻지 않는다")
|
|
55
|
+
rm.add_argument("--dry-run", action="store_true", help="쓰지 않고 할 일만 보인다")
|
|
56
|
+
|
|
57
|
+
ls = commands.add_parser("list", help="처리하는 repo 목록 (설정 파일만 읽는다)")
|
|
58
|
+
ls.add_argument(
|
|
59
|
+
"--check", action="store_true", help="repo마다 웹훅이 맞게 등록됐는지 GitHub에서 본다"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
run = commands.add_parser("start", help="서버 실행 (api, worker, smee에서 받아 오기)")
|
|
63
|
+
run.add_argument("--node", help="입구가 넘기는 node 실행 파일")
|
|
64
|
+
run.add_argument("--smee", help="입구가 넘기는 smee-client 실행 파일")
|
|
65
|
+
return parser
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def main(argv: list[str] | None = None) -> int:
|
|
69
|
+
args = _parser().parse_args(argv)
|
|
70
|
+
if args.command == "start":
|
|
71
|
+
return start.start(args.node, args.smee)
|
|
72
|
+
io = flow.Io(interactive=sys.stdin.isatty() and sys.stdout.isatty())
|
|
73
|
+
deps = flow.real_deps(os.environ)
|
|
74
|
+
if args.command == "configure":
|
|
75
|
+
opts = flow.Options(repos=args.repo, auth=args.auth, webhook_url=args.webhook_url,
|
|
76
|
+
port=args.port, dry_run=args.dry_run,
|
|
77
|
+
manual_webhook=args.manual_webhook) # fmt: skip
|
|
78
|
+
return flow.configure(opts, io, deps)
|
|
79
|
+
if args.command == "add":
|
|
80
|
+
opts = flow.Options(repos=args.repos, webhook_url=args.webhook_url, dry_run=args.dry_run,
|
|
81
|
+
manual_webhook=args.manual_webhook) # fmt: skip
|
|
82
|
+
return flow.add(opts, io, deps)
|
|
83
|
+
if args.command == "rm":
|
|
84
|
+
return flow.remove(flow.Options(repos=args.repos, yes=args.yes, dry_run=args.dry_run),
|
|
85
|
+
io, deps) # fmt: skip
|
|
86
|
+
return flow.list_repos(flow.Options(check=args.check), io, deps)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
sys.exit(main())
|