repoflow-mcp 0.2.0__tar.gz

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 (70) hide show
  1. repoflow_mcp-0.2.0/.github/CODEOWNERS +2 -0
  2. repoflow_mcp-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +121 -0
  3. repoflow_mcp-0.2.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  4. repoflow_mcp-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +60 -0
  5. repoflow_mcp-0.2.0/.github/PULL_REQUEST_TEMPLATE.md +45 -0
  6. repoflow_mcp-0.2.0/.github/dependabot.yml +18 -0
  7. repoflow_mcp-0.2.0/.github/workflows/ci.yml +79 -0
  8. repoflow_mcp-0.2.0/.github/workflows/codeql.yml +36 -0
  9. repoflow_mcp-0.2.0/.github/workflows/contributors.yml +47 -0
  10. repoflow_mcp-0.2.0/.github/workflows/pr-checks.yml +106 -0
  11. repoflow_mcp-0.2.0/.github/workflows/release.yml +59 -0
  12. repoflow_mcp-0.2.0/.gitignore +33 -0
  13. repoflow_mcp-0.2.0/.pre-commit-config.yaml +26 -0
  14. repoflow_mcp-0.2.0/CHANGELOG.md +47 -0
  15. repoflow_mcp-0.2.0/CODE_OF_CONDUCT.md +148 -0
  16. repoflow_mcp-0.2.0/CONTRIBUTING.md +247 -0
  17. repoflow_mcp-0.2.0/LICENSE +21 -0
  18. repoflow_mcp-0.2.0/PKG-INFO +237 -0
  19. repoflow_mcp-0.2.0/README.md +223 -0
  20. repoflow_mcp-0.2.0/SECURITY.md +75 -0
  21. repoflow_mcp-0.2.0/docs/assets/demo.gif +0 -0
  22. repoflow_mcp-0.2.0/pyproject.toml +46 -0
  23. repoflow_mcp-0.2.0/scripts/check_no_pro.py +311 -0
  24. repoflow_mcp-0.2.0/scripts/leak_allow.txt +13 -0
  25. repoflow_mcp-0.2.0/scripts/make_demo_gif.py +257 -0
  26. repoflow_mcp-0.2.0/scripts/update_contributors.py +108 -0
  27. repoflow_mcp-0.2.0/src/repoflow/__init__.py +1 -0
  28. repoflow_mcp-0.2.0/src/repoflow/core/__init__.py +0 -0
  29. repoflow_mcp-0.2.0/src/repoflow/core/config.py +25 -0
  30. repoflow_mcp-0.2.0/src/repoflow/core/github.py +79 -0
  31. repoflow_mcp-0.2.0/src/repoflow/core/hooks.py +84 -0
  32. repoflow_mcp-0.2.0/src/repoflow/core/models.py +126 -0
  33. repoflow_mcp-0.2.0/src/repoflow/core/proc.py +91 -0
  34. repoflow_mcp-0.2.0/src/repoflow/core/store.py +65 -0
  35. repoflow_mcp-0.2.0/src/repoflow/core/workspace.py +83 -0
  36. repoflow_mcp-0.2.0/src/repoflow/discover/__init__.py +0 -0
  37. repoflow_mcp-0.2.0/src/repoflow/discover/parsers.py +329 -0
  38. repoflow_mcp-0.2.0/src/repoflow/discover/tools.py +467 -0
  39. repoflow_mcp-0.2.0/src/repoflow/guards.py +246 -0
  40. repoflow_mcp-0.2.0/src/repoflow/policy/__init__.py +1 -0
  41. repoflow_mcp-0.2.0/src/repoflow/policy/playbook.py +1168 -0
  42. repoflow_mcp-0.2.0/src/repoflow/policy/tools.py +112 -0
  43. repoflow_mcp-0.2.0/src/repoflow/sandbox/__init__.py +0 -0
  44. repoflow_mcp-0.2.0/src/repoflow/sandbox/docker.py +247 -0
  45. repoflow_mcp-0.2.0/src/repoflow/sandbox/tools.py +42 -0
  46. repoflow_mcp-0.2.0/src/repoflow/server.py +55 -0
  47. repoflow_mcp-0.2.0/src/repoflow/teach/__init__.py +0 -0
  48. repoflow_mcp-0.2.0/src/repoflow/teach/cards.py +161 -0
  49. repoflow_mcp-0.2.0/src/repoflow/teach/ledger.py +241 -0
  50. repoflow_mcp-0.2.0/src/repoflow/teach/prompts.py +37 -0
  51. repoflow_mcp-0.2.0/src/repoflow/teach/tools.py +178 -0
  52. repoflow_mcp-0.2.0/src/repoflow/understand/__init__.py +0 -0
  53. repoflow_mcp-0.2.0/src/repoflow/understand/analysis.py +179 -0
  54. repoflow_mcp-0.2.0/src/repoflow/understand/graph.py +251 -0
  55. repoflow_mcp-0.2.0/src/repoflow/understand/metrics.py +153 -0
  56. repoflow_mcp-0.2.0/src/repoflow/understand/scan.py +223 -0
  57. repoflow_mcp-0.2.0/src/repoflow/understand/tools.py +88 -0
  58. repoflow_mcp-0.2.0/src/repoflow/understand/walk.py +119 -0
  59. repoflow_mcp-0.2.0/tests/conftest.py +71 -0
  60. repoflow_mcp-0.2.0/tests/test_check_no_pro.py +251 -0
  61. repoflow_mcp-0.2.0/tests/test_discover.py +410 -0
  62. repoflow_mcp-0.2.0/tests/test_guards.py +193 -0
  63. repoflow_mcp-0.2.0/tests/test_hooks.py +110 -0
  64. repoflow_mcp-0.2.0/tests/test_integration.py +59 -0
  65. repoflow_mcp-0.2.0/tests/test_no_pro_imports.py +109 -0
  66. repoflow_mcp-0.2.0/tests/test_policy.py +588 -0
  67. repoflow_mcp-0.2.0/tests/test_sandbox.py +88 -0
  68. repoflow_mcp-0.2.0/tests/test_teach.py +358 -0
  69. repoflow_mcp-0.2.0/tests/test_understand.py +197 -0
  70. repoflow_mcp-0.2.0/tests/test_update_contributors.py +53 -0
@@ -0,0 +1,2 @@
1
+ # Default owner for everything in this repo.
2
+ * @LolPanda2004
@@ -0,0 +1,121 @@
1
+ name: Bug report
2
+ description: Something in RepoFlow Lite doesn't work as expected.
3
+ title: "[Bug]: "
4
+ labels: ["bug", "needs triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for taking the time to report a bug.
10
+ Please search [existing issues](https://github.com/LolPanda2004/repoflow/issues) first.
11
+ Security problems go to [SECURITY.md](https://github.com/LolPanda2004/repoflow/security/policy), not here.
12
+
13
+ - type: textarea
14
+ id: what-happened
15
+ attributes:
16
+ label: What happened?
17
+ description: A short, clear description of the bug.
18
+ validations:
19
+ required: true
20
+
21
+ - type: textarea
22
+ id: expected
23
+ attributes:
24
+ label: What did you expect?
25
+ validations:
26
+ required: true
27
+
28
+ - type: textarea
29
+ id: steps
30
+ attributes:
31
+ label: Steps to reproduce
32
+ description: The smallest steps that show the bug. Include the target repo if it's public.
33
+ placeholder: |
34
+ 1. Register RepoFlow with `claude mcp add repoflow -- repoflow`
35
+ 2. Ask: "Use repoflow to run the tests of owner/small-repo"
36
+ 3. See error ...
37
+ validations:
38
+ required: true
39
+
40
+ - type: dropdown
41
+ id: area
42
+ attributes:
43
+ label: Area
44
+ options:
45
+ - Understand (analyze_repo, get_architecture, find_hotspots)
46
+ - Contribution policy (get_contribution_playbook, check_ai_policy, ...)
47
+ - Discover (setup_environment, run_tests, run_static_analysis, detect_flaky_tests)
48
+ - Sandbox (Docker, sandbox_status)
49
+ - Teach (record_finding, explain_finding, export_report, ...)
50
+ - Install / server start
51
+ - Docs
52
+ - Not sure
53
+ validations:
54
+ required: true
55
+
56
+ - type: input
57
+ id: tool
58
+ attributes:
59
+ label: Tool name
60
+ description: The RepoFlow tool that failed, if you know it.
61
+ placeholder: run_tests
62
+
63
+ - type: textarea
64
+ id: logs
65
+ attributes:
66
+ label: Error output or logs
67
+ description: Paste the error message or tool output. Remove tokens and other secrets.
68
+ render: text
69
+
70
+ - type: input
71
+ id: version
72
+ attributes:
73
+ label: RepoFlow version
74
+ description: "Run: pip show repoflow-mcp"
75
+ placeholder: 0.1.0
76
+ validations:
77
+ required: true
78
+
79
+ - type: dropdown
80
+ id: sandbox
81
+ attributes:
82
+ label: Sandbox mode (REPOFLOW_SANDBOX)
83
+ options:
84
+ - docker (default)
85
+ - local
86
+ - "off"
87
+ - Not sure
88
+ validations:
89
+ required: true
90
+
91
+ - type: input
92
+ id: python
93
+ attributes:
94
+ label: Python version
95
+ placeholder: "3.12.4"
96
+ validations:
97
+ required: true
98
+
99
+ - type: input
100
+ id: os
101
+ attributes:
102
+ label: Operating system
103
+ placeholder: Windows 11 / macOS 15 / Ubuntu 24.04
104
+ validations:
105
+ required: true
106
+
107
+ - type: input
108
+ id: client
109
+ attributes:
110
+ label: MCP client and version
111
+ placeholder: Claude Code 2.x
112
+
113
+ - type: checkboxes
114
+ id: checks
115
+ attributes:
116
+ label: Before you submit
117
+ options:
118
+ - label: I searched existing issues and this is not a duplicate.
119
+ required: true
120
+ - label: I removed tokens, passwords and other secrets from the logs.
121
+ required: true
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Question or idea
4
+ url: https://github.com/LolPanda2004/repoflow/discussions
5
+ about: Ask questions and share ideas in GitHub Discussions, not in issues.
6
+ - name: Security problem
7
+ url: https://github.com/LolPanda2004/repoflow/security/policy
8
+ about: Please don't report security problems in public issues. See SECURITY.md.
@@ -0,0 +1,60 @@
1
+ name: Feature request
2
+ description: Suggest a new tool or an improvement.
3
+ title: "[Feature]: "
4
+ labels: ["enhancement", "needs triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for the idea. Open-ended ideas can also start in [Discussions](https://github.com/LolPanda2004/repoflow/discussions).
10
+
11
+ RepoFlow Lite is **learn-only**: it helps people understand a repo, follow its rules,
12
+ run its tests safely and learn from findings. It does not open issues or pull requests
13
+ for anyone. Requests that change this are likely to be closed.
14
+
15
+ - type: textarea
16
+ id: problem
17
+ attributes:
18
+ label: What problem does this solve?
19
+ description: Describe the situation. "When I try to ..., I can't ..."
20
+ validations:
21
+ required: true
22
+
23
+ - type: textarea
24
+ id: solution
25
+ attributes:
26
+ label: Proposed solution
27
+ description: What would you like RepoFlow to do? A new tool, a new option, a better message?
28
+ validations:
29
+ required: true
30
+
31
+ - type: textarea
32
+ id: alternatives
33
+ attributes:
34
+ label: Alternatives you considered
35
+
36
+ - type: dropdown
37
+ id: area
38
+ attributes:
39
+ label: Area
40
+ options:
41
+ - Understand
42
+ - Contribution policy
43
+ - Discover
44
+ - Sandbox
45
+ - Teach
46
+ - Docs
47
+ - Other
48
+ validations:
49
+ required: true
50
+
51
+ - type: checkboxes
52
+ id: checks
53
+ attributes:
54
+ label: Before you submit
55
+ options:
56
+ - label: I searched existing issues and discussions.
57
+ required: true
58
+ - label: This fits the learn-first goal of RepoFlow Lite.
59
+ required: true
60
+ - label: I'd like to work on this myself.
@@ -0,0 +1,45 @@
1
+ <!--
2
+ Thanks for contributing to RepoFlow Lite! Please read CONTRIBUTING.md first.
3
+ - PR title must be a Conventional Commit: "fix: ...", "feat: ...", "docs: ...", "test: ...", "refactor: ...", "chore: ...".
4
+ - One change per PR. Small and focused.
5
+ - The "pr-checks" CI job checks the title, "What does this PR do?" and "AI use". Keep the headings.
6
+ -->
7
+
8
+ ## What does this PR do?
9
+
10
+ <!-- One or two sentences. Required. -->
11
+
12
+ Fixes #<!-- issue number -->
13
+
14
+ ## Why?
15
+
16
+ <!-- The problem this solves. Link the issue or discussion. -->
17
+
18
+ ## How was it tested?
19
+
20
+ <!-- Commands you ran and what you saw. New behavior needs a test. A bug fix needs a test that failed before the fix. -->
21
+
22
+ - [ ] `python -m pytest -q` passes locally
23
+ - [ ] `pre-commit run --all-files` passes locally (ruff + leak check)
24
+ - [ ] I added or updated tests for this change
25
+ - [ ] Sandbox: I ran the tests with Docker running (or say below why not)
26
+
27
+ ## Checklist
28
+
29
+ - [ ] I was assigned to the linked issue before starting
30
+ - [ ] This PR is small and does one thing
31
+ - [ ] I updated docs (README, docstrings) if behavior changed
32
+ - [ ] I added a line to `CHANGELOG.md` under "Unreleased" if users will notice the change
33
+ - [ ] Each new tool has a clear description (MCP clients show it to users)
34
+ - [ ] No secrets, tokens or personal data in code, tests or logs
35
+
36
+ ## AI use
37
+
38
+ <!-- AI tools are allowed. Being open about them is required. Tick exactly one of the first two boxes. -->
39
+
40
+ - [ ] I did **not** use AI tools for this PR
41
+ - [ ] I **used** AI tools (fill in the next line)
42
+
43
+ AI tools and what they did: <!-- for example: "Claude Code drafted the test; I wrote the fix" -->
44
+
45
+ - [ ] I read, understand and can explain every line in this PR, and I tested it myself
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ open-pull-requests-limit: 5
8
+ commit-message:
9
+ prefix: "chore"
10
+ include: scope
11
+ - package-ecosystem: github-actions
12
+ directory: "/"
13
+ schedule:
14
+ interval: weekly
15
+ open-pull-requests-limit: 5
16
+ commit-message:
17
+ prefix: "chore"
18
+ include: scope
@@ -0,0 +1,79 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ci-${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ lint:
18
+ name: lint (ruff)
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 10
21
+ steps:
22
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23
+ with:
24
+ persist-credentials: false
25
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
26
+ with:
27
+ python-version: "3.12"
28
+ - name: Install ruff
29
+ run: python -m pip install "ruff==0.17.6"
30
+ - name: Ruff check
31
+ run: ruff check --output-format=github .
32
+ - name: Ruff format
33
+ run: ruff format --check .
34
+
35
+ leak-scan:
36
+ name: leak-scan (no Pro code)
37
+ runs-on: ubuntu-latest
38
+ timeout-minutes: 10
39
+ steps:
40
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
41
+ with:
42
+ persist-credentials: false
43
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
44
+ with:
45
+ python-version: "3.12"
46
+ - name: Check for Pro code
47
+ run: python scripts/check_no_pro.py
48
+
49
+ tests:
50
+ name: tests (Python ${{ matrix.python-version }})
51
+ runs-on: ubuntu-latest
52
+ timeout-minutes: 30
53
+ strategy:
54
+ fail-fast: false
55
+ matrix:
56
+ # pyproject.toml: requires-python = ">=3.11"
57
+ python-version: ["3.11", "3.12", "3.13"]
58
+ env:
59
+ # No Docker in CI. Repo code in tests runs on the runner instead
60
+ # (REPOFLOW_SANDBOX=local). Tests about Docker itself mock it.
61
+ REPOFLOW_SANDBOX: local
62
+ PYTHONUTF8: "1"
63
+ steps:
64
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
65
+ with:
66
+ persist-credentials: false
67
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
68
+ with:
69
+ python-version: ${{ matrix.python-version }}
70
+ cache: pip
71
+ cache-dependency-path: pyproject.toml
72
+ - name: Install
73
+ run: |
74
+ python -m pip install --upgrade pip
75
+ python -m pip install -e ".[dev]"
76
+ - name: Import check
77
+ run: python -c "import sys; sys.path.insert(0, 'src'); import repoflow.server"
78
+ - name: Run tests
79
+ run: python -m pytest -q
@@ -0,0 +1,36 @@
1
+ name: CodeQL
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ schedule:
8
+ - cron: "17 3 * * 1" # weekly, Monday 03:17 UTC
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ concurrency:
15
+ group: codeql-${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ analyze:
20
+ name: analyze (python)
21
+ runs-on: ubuntu-latest
22
+ timeout-minutes: 30
23
+ permissions:
24
+ contents: read
25
+ security-events: write # upload results to code scanning
26
+ steps:
27
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28
+ with:
29
+ persist-credentials: false
30
+ - uses: github/codeql-action/init@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
31
+ with:
32
+ languages: python
33
+ build-mode: none
34
+ - uses: github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
35
+ with:
36
+ category: "/language:python"
@@ -0,0 +1,47 @@
1
+ name: Contributors card
2
+
3
+ # After each merge to main, redraw the README contributors card (avatar, name, merged PRs)
4
+ # and push it to the "contributors" branch. main is protected, so the card lives on its own branch.
5
+ on:
6
+ push:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: contributors-card
15
+ cancel-in-progress: false
16
+
17
+ jobs:
18
+ card:
19
+ name: update contributors card
20
+ runs-on: ubuntu-latest
21
+ timeout-minutes: 10
22
+ permissions:
23
+ contents: write
24
+ steps:
25
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
27
+ with:
28
+ python-version: "3.12"
29
+ - name: Draw the card
30
+ env:
31
+ GITHUB_TOKEN: ${{ github.token }}
32
+ run: python scripts/update_contributors.py "$GITHUB_REPOSITORY" "$RUNNER_TEMP/contributors.svg"
33
+ - name: Push it to the contributors branch
34
+ run: |
35
+ git config user.name "github-actions[bot]"
36
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
37
+ if git ls-remote --exit-code --heads origin contributors >/dev/null; then
38
+ git fetch --depth=1 origin contributors
39
+ git switch -C contributors FETCH_HEAD
40
+ else
41
+ git switch --orphan contributors
42
+ fi
43
+ cp "$RUNNER_TEMP/contributors.svg" contributors.svg
44
+ git add contributors.svg
45
+ if git diff --cached --quiet; then echo "No change."; exit 0; fi
46
+ git commit -m "chore: update contributors card"
47
+ git push origin contributors
@@ -0,0 +1,106 @@
1
+ name: PR checks
2
+
3
+ # Checks the PR title and description. It only reads the event payload:
4
+ # no checkout, no comments, read-only token. A failed check tells the author what to fix.
5
+ on:
6
+ pull_request:
7
+ types: [opened, edited, reopened, synchronize, ready_for_review]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: pr-checks-${{ github.event.pull_request.number }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ pr-checks:
18
+ name: pr-checks (title, description, AI use)
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 5
21
+ steps:
22
+ - name: Check PR title and description
23
+ # Title and body are read from the event file, never pasted into the script.
24
+ shell: python
25
+ run: |
26
+ import json, os, re, sys
27
+
28
+ pr = json.load(open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8"))["pull_request"]
29
+ title = pr.get("title") or ""
30
+ body = pr.get("body") or ""
31
+ author = (pr.get("user") or {}).get("login", "")
32
+ errors = []
33
+
34
+ # 1. Conventional Commit title, for example "fix: handle empty config" or "feat(teach)!: ...".
35
+ types = "fix|feat|docs|test|refactor|chore|ci|build|perf|revert"
36
+ if not re.match(rf"^({types})(\([a-z0-9._/-]+\))?!?: \S.*", title):
37
+ errors.append(
38
+ f"Title {title!r} is not a Conventional Commit title. "
39
+ "Use '<type>: <summary>' where type is one of: " + ", ".join(types.split("|"))
40
+ )
41
+
42
+ # Bots (Dependabot) don't fill in the template; only the title rule applies to them.
43
+ if not author.endswith("[bot]"):
44
+ text = re.sub(r"<!--.*?-->", "", body, flags=re.S) # drop template hints
45
+
46
+ # 2. Description is not empty: the "What does this PR do?" section has real text.
47
+ # Headings may be ##, ### or #### and any letter case.
48
+ def section(name):
49
+ m = re.search(
50
+ rf"^#{{2,4}}\s*{name}\s*:?\s*$(.*?)(?=^#{{1,4}}\s|\Z)", text, flags=re.M | re.S | re.I
51
+ )
52
+ return m.group(1) if m else ""
53
+
54
+ what = section(r"What does this PR do\?")
55
+ what_words = re.sub(r"Fixes\s*#\s*$", "", what.strip(), flags=re.M | re.I).strip()
56
+ if not text.strip():
57
+ errors.append("The PR description is empty. Fill in the PR template.")
58
+ elif not what_words:
59
+ errors.append("Fill in 'What does this PR do?' with one or two sentences.")
60
+
61
+ # 3. AI use section is filled in.
62
+ ai = section("AI use")
63
+ ticked = lambda label: re.search(rf"^\s*[-*]\s*\[[xX]\]\s*{label}", ai, flags=re.M | re.I) is not None
64
+ no_ai = ticked(r"I did (\*\*)?not(\*\*)? use AI tools")
65
+ used_ai = ticked(r"I (\*\*)?used(\*\*)? AI tools")
66
+ if not ai.strip():
67
+ errors.append("The 'AI use' section is missing. Copy it from the PR template (link below).")
68
+ else:
69
+ if no_ai == used_ai:
70
+ errors.append("AI use: tick exactly one box: 'did not use' or 'used' AI tools.")
71
+ if used_ai:
72
+ # The answer may be on the same line or on the lines below (up to the next checkbox).
73
+ m = re.search(
74
+ r"^\s*AI tools and what they did:(.*?)(?=^\s*[-*]\s*\[|\Z)", ai, flags=re.M | re.I | re.S
75
+ )
76
+ if not m or not m.group(1).strip():
77
+ errors.append("AI use: after 'AI tools and what they did:' say which tools and what they did.")
78
+ if not ticked(r"I read, understand and can explain every line"):
79
+ errors.append("AI use: tick 'I read, understand and can explain every line ...'.")
80
+
81
+ if errors:
82
+ branch = ((pr.get("base") or {}).get("repo") or {}).get("default_branch", "main")
83
+ repo_url = f"{os.environ.get('GITHUB_SERVER_URL', 'https://github.com')}/{os.environ.get('GITHUB_REPOSITORY', '')}"
84
+ template = f"{repo_url}/blob/{branch}/.github/PULL_REQUEST_TEMPLATE.md"
85
+ for e in errors:
86
+ print(f"::error::{e}")
87
+ print(f"\nHow to fix: edit your PR description (no new commit needed) and paste the template: {template}")
88
+ summary = os.environ.get("GITHUB_STEP_SUMMARY")
89
+ if summary:
90
+ with open(summary, "a", encoding="utf-8") as f:
91
+ f.write("## PR checks: please update your PR description\n\n")
92
+ f.write("".join(f"- {e}\n" for e in errors))
93
+ f.write(
94
+ "\n**How to fix:** edit the PR description on GitHub (no new commit needed); "
95
+ f"this check re-runs by itself. Template: {template}\n\n"
96
+ "Opened the PR with `gh` or an AI tool? Those skip the template. "
97
+ "Next time use `gh pr create --template PULL_REQUEST_TEMPLATE.md`.\n\n"
98
+ "The AI use part must look like this (tick one of the first two boxes):\n\n"
99
+ "```markdown\n## AI use\n\n"
100
+ "- [ ] I did **not** use AI tools for this PR\n"
101
+ "- [ ] I **used** AI tools (fill in the next line)\n\n"
102
+ "AI tools and what they did: ...\n\n"
103
+ "- [ ] I read, understand and can explain every line in this PR, and I tested it myself\n```\n"
104
+ )
105
+ sys.exit(1)
106
+ print("PR title and description look good.")
@@ -0,0 +1,59 @@
1
+ name: Release to PyPI
2
+
3
+ # Publishes repoflow-mcp to PyPI when a GitHub release is published.
4
+ # Uses PyPI trusted publishing (OIDC): no API token is stored anywhere.
5
+ # The "pypi" environment requires a maintainer to approve each upload.
6
+ on:
7
+ release:
8
+ types: [published]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ build:
15
+ name: build sdist and wheel
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 10
18
+ steps:
19
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20
+ with:
21
+ persist-credentials: false
22
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
23
+ with:
24
+ python-version: "3.12"
25
+ - name: Check the tag matches the package version
26
+ run: |
27
+ tag="${GITHUB_REF_NAME#v}"
28
+ version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
29
+ if [ "$tag" != "$version" ]; then
30
+ echo "::error::Tag v$tag does not match pyproject version $version"
31
+ exit 1
32
+ fi
33
+ - name: Leak check (no Pro code)
34
+ run: python scripts/check_no_pro.py
35
+ - name: Build
36
+ run: |
37
+ python -m pip install build
38
+ python -m build
39
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
40
+ with:
41
+ name: dist
42
+ path: dist/
43
+
44
+ publish:
45
+ name: publish to PyPI
46
+ needs: build
47
+ runs-on: ubuntu-latest
48
+ timeout-minutes: 10
49
+ environment:
50
+ name: pypi
51
+ url: https://pypi.org/project/repoflow-mcp/
52
+ permissions:
53
+ id-token: write
54
+ steps:
55
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
56
+ with:
57
+ name: dist
58
+ path: dist/
59
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
@@ -0,0 +1,33 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ build/
5
+ dist/
6
+ .venv/
7
+ venv/
8
+ .rfvenv/
9
+ .repoflow/
10
+ .repoflow-*
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .coverage
14
+ .coverage.*
15
+ eval/results*/
16
+ .env
17
+
18
+ # extra ignores
19
+ .mypy_cache/
20
+ .ruff_cache/
21
+ .hypothesis/
22
+ htmlcov/
23
+ .tox/
24
+ .rfvenv/
25
+ .repoflow*/
26
+ .repoflow-*
27
+ eval/results*/
28
+ *.egg-info/
29
+ .DS_Store
30
+ Thumbs.db
31
+ *.pem
32
+ *.key
33
+ .env.*
@@ -0,0 +1,26 @@
1
+ # Lint (ruff) and Lite leak protection. Install once: pip install pre-commit && pre-commit install -t pre-commit -t pre-push
2
+ repos:
3
+ - repo: https://github.com/astral-sh/ruff-pre-commit
4
+ rev: v0.17.6
5
+ hooks:
6
+ - id: ruff-check
7
+ args: [--fix]
8
+ - id: ruff-format
9
+ - repo: local
10
+ hooks:
11
+ # On commit: check only the staged files (read from the git index).
12
+ - id: check-no-pro-staged
13
+ name: no Pro code in Lite (staged files)
14
+ entry: python scripts/check_no_pro.py --staged
15
+ language: system
16
+ pass_filenames: false
17
+ always_run: true
18
+ stages: [pre-commit]
19
+ # On push: check every tracked file, since the user pushes.
20
+ - id: check-no-pro-all
21
+ name: no Pro code in Lite (whole repo)
22
+ entry: python scripts/check_no_pro.py
23
+ language: system
24
+ pass_filenames: false
25
+ always_run: true
26
+ stages: [pre-push]