readthrough 0.4.0__py3-none-any.whl

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 (73) hide show
  1. readthrough/__init__.py +8 -0
  2. readthrough/__main__.py +3 -0
  3. readthrough/agents.py +344 -0
  4. readthrough/analyze.py +537 -0
  5. readthrough/assets/SKILL.md +86 -0
  6. readthrough/assets/defaults.toml +143 -0
  7. readthrough/assets/profile-reference.md +133 -0
  8. readthrough/assets/vendor/README.md +22 -0
  9. readthrough/assets/vendor/cose-base.js +3214 -0
  10. readthrough/assets/vendor/cytoscape-fcose.js +1549 -0
  11. readthrough/assets/vendor/cytoscape.min.js +31 -0
  12. readthrough/assets/vendor/layout-base.js +5230 -0
  13. readthrough/assets/vendor/licenses/cose-base-LICENSE +21 -0
  14. readthrough/assets/vendor/licenses/cytoscape-LICENSE +19 -0
  15. readthrough/assets/vendor/licenses/cytoscape-fcose-LICENSE +19 -0
  16. readthrough/assets/vendor/licenses/dompurify-LICENSE +202 -0
  17. readthrough/assets/vendor/licenses/layout-base-LICENSE +21 -0
  18. readthrough/assets/vendor/licenses/lucide-LICENSE +15 -0
  19. readthrough/assets/vendor/licenses/marked-LICENSE +44 -0
  20. readthrough/assets/vendor/lucide-icons.js +36 -0
  21. readthrough/assets/vendor/marked.umd.js +82 -0
  22. readthrough/assets/vendor/purify.min.js +7 -0
  23. readthrough/assets/web/dashboard.css +202 -0
  24. readthrough/assets/web/dashboard.html +48 -0
  25. readthrough/assets/web/dashboard.js +937 -0
  26. readthrough/assets/web/setup.css +57 -0
  27. readthrough/assets/web/setup.html +28 -0
  28. readthrough/assets/web/setup.js +342 -0
  29. readthrough/assets/web/theme.css +36 -0
  30. readthrough/assistants.py +699 -0
  31. readthrough/brief.py +145 -0
  32. readthrough/build.py +616 -0
  33. readthrough/ci.py +107 -0
  34. readthrough/cli.py +958 -0
  35. readthrough/config.py +533 -0
  36. readthrough/contract.py +394 -0
  37. readthrough/engine.py +230 -0
  38. readthrough/faults.py +92 -0
  39. readthrough/files.py +110 -0
  40. readthrough/forges/__init__.py +614 -0
  41. readthrough/forges/azure_devops.py +658 -0
  42. readthrough/forges/forgejo.py +300 -0
  43. readthrough/forges/github.py +487 -0
  44. readthrough/forges/gitlab.py +335 -0
  45. readthrough/ledger.py +61 -0
  46. readthrough/limits.py +26 -0
  47. readthrough/logs.py +169 -0
  48. readthrough/membership.py +76 -0
  49. readthrough/model.py +177 -0
  50. readthrough/onboard.py +551 -0
  51. readthrough/onboard_model.py +319 -0
  52. readthrough/process.py +169 -0
  53. readthrough/profile.py +699 -0
  54. readthrough/py.typed +0 -0
  55. readthrough/registry.py +157 -0
  56. readthrough/review.py +394 -0
  57. readthrough/rules.py +111 -0
  58. readthrough/runtimes/__init__.py +297 -0
  59. readthrough/runtimes/anthropic.py +278 -0
  60. readthrough/runtimes/copilot.py +313 -0
  61. readthrough/runtimes/openai.py +307 -0
  62. readthrough/serve.py +817 -0
  63. readthrough/study.py +327 -0
  64. readthrough/system.py +205 -0
  65. readthrough/terminals.py +168 -0
  66. readthrough/tuning.py +266 -0
  67. readthrough/usage.py +169 -0
  68. readthrough/web_setup.py +635 -0
  69. readthrough-0.4.0.dist-info/METADATA +123 -0
  70. readthrough-0.4.0.dist-info/RECORD +73 -0
  71. readthrough-0.4.0.dist-info/WHEEL +4 -0
  72. readthrough-0.4.0.dist-info/entry_points.txt +2 -0
  73. readthrough-0.4.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,143 @@
1
+ # readthrough's tunable settings, with their defaults.
2
+ #
3
+ # To change one, put it under a [tuning.<section>] table in your config.toml, for example:
4
+ #
5
+ # [tuning.forge]
6
+ # timeout_seconds = 120
7
+ #
8
+ # Sections marked "per repo" can also be set for one repo, under that repo's [[repos]] entry:
9
+ #
10
+ # [[repos]]
11
+ # name = "microsoft/vscode"
12
+ # [repos.tuning.planning]
13
+ # estimate_max_minutes = 120
14
+ #
15
+ # `readthrough config --defaults` prints this file; `readthrough config --check` validates yours.
16
+ # Values outside the allowed range, wrong types, and unknown keys are rejected with a clear message.
17
+
18
+ [forge]
19
+ # Seconds before a single call to the forge (a `gh` command, or an API request) is abandoned. Without a limit,
20
+ # one hung call stalls a repo forever.
21
+ timeout_seconds = 60
22
+ # How many times a call that failed for a temporary reason (connection reset, timeout, a 5xx) is retried.
23
+ retries = 3
24
+ # Seconds to wait before the first retry. Each later retry waits twice as long, plus up to 25% random jitter.
25
+ retry_backoff_seconds = 2.0
26
+ # The longest wait between two retries.
27
+ retry_max_backoff_seconds = 30.0
28
+ # Seconds to wait when the forge says you're being rate limited (429, or 403 with a rate-limit message).
29
+ rate_limit_wait_seconds = 60.0
30
+ # The most forge calls running at once, across every repo the server refreshes.
31
+ # Lower it if you see connection resets; forges throttle bursts of parallel requests.
32
+ concurrency = 6
33
+ # Open PRs fetched per page. Smaller pages are slower but less likely to time out.
34
+ pr_page_size = 20
35
+ # A PR's files, CI checks, and review threads are fetched page by page up to these limits.
36
+ # 3,000 files is the most GitHub will list for one PR.
37
+ max_files_per_pr = 3000
38
+ max_checks_per_pr = 500
39
+ max_review_threads_per_pr = 300
40
+ # The most files onboarding lists from a repo's tree through an API that pages it (GitLab, Forgejo), which would
41
+ # otherwise take minutes on a big repo. GitHub sends the whole tree in one call, and a local clone has no limit.
42
+ max_tree_files = 20000
43
+ # A forge that serves no unified diff (Azure DevOps) gets one assembled from both versions of each changed file,
44
+ # two requests per file. PRs changing more files than this are treated as too large to diff, like a diff GitHub
45
+ # refuses to serve; their files are still placed on the map, only the line heuristics are skipped.
46
+ max_assembled_diff_files = 300
47
+ # Days to keep cached diffs of PRs that are no longer in the fetched list (closed, merged, or past `limit`).
48
+ diff_cache_days = 14
49
+
50
+ [git]
51
+ # Seconds before a git command (fetching a PR, adding a worktree) is abandoned.
52
+ timeout_seconds = 300
53
+
54
+ [server]
55
+ # Seconds between checks for changes made outside the server (CLI builds, ledger edits, agent sessions).
56
+ watch_seconds = 3.0
57
+ # Seconds between keep-alive messages on the dashboard's live connection.
58
+ keepalive_seconds = 15.0
59
+ # Seconds between the first refreshes of each repo, so they don't all hit GitHub at once.
60
+ start_stagger_seconds = 20
61
+ # Each refresh interval is varied by up to this fraction, so repos drift apart instead of refreshing together.
62
+ refresh_jitter = 0.1
63
+ # After a failed refresh, retry after these many minutes in turn (then every refresh interval).
64
+ retry_after_failure_minutes = [1, 2, 5]
65
+
66
+ [planning] # per repo
67
+ # Reading-time estimate: base + minutes per changed line by kind + minutes per extra layer, capped.
68
+ estimate_base_minutes = 5.0
69
+ estimate_minutes_per_source_line = 0.08
70
+ estimate_minutes_per_test_line = 0.03
71
+ estimate_minutes_per_other_line = 0.01
72
+ estimate_minutes_per_extra_layer = 4.0
73
+ estimate_max_minutes = 240
74
+ # Burn-down order. A ready PR scores priority_base, plus its age in days (up to priority_age_cap_days),
75
+ # plus the bonuses below. Approved PRs get priority_approved; other lanes 0.
76
+ priority_base = 50.0
77
+ priority_age_cap_days = 30.0
78
+ priority_review_requested = 40.0
79
+ priority_re_review = 15.0
80
+ priority_quick_minutes = 15
81
+ priority_quick_bonus = 20.0
82
+ priority_short_minutes = 30
83
+ priority_short_bonus = 10.0
84
+ priority_closes_issue = 5.0
85
+ priority_approved = 30.0
86
+ priority_ci_passing = 10.0
87
+ priority_ci_failing_on_main = 5.0
88
+ priority_ci_failing_optional = -10.0
89
+ priority_ci_not_run = -5.0
90
+
91
+ [onboarding] # per repo
92
+ # Share of recently changed lines that must land in a named component before a profile can be accepted.
93
+ min_coverage = 0.85
94
+ # Below this share of open-PR changes landing in a named component, the dashboard says the map is drifting.
95
+ drift_coverage = 0.75
96
+ # How many recently merged PRs onboarding learns from.
97
+ merged_sample = 100
98
+ # Minutes the browser setup page reuses what it read about a repo before reading it again.
99
+ facts_cache_minutes = 30
100
+
101
+ [freshness] # per repo
102
+ # Hours before the dashboard warns that its data is old: on the live server, and in a static snapshot.
103
+ stale_live_hours = 2.0
104
+ stale_snapshot_hours = 26.0
105
+ # Hours before `readthrough doctor` flags a repo's last build as too old.
106
+ doctor_build_hours = 36.0
107
+
108
+ [payload] # per repo
109
+ # How much of each PR's text is kept in the dashboard's data. Longer text is cut off.
110
+ description_chars = 4000
111
+ description_html_chars = 60000
112
+ thread_comment_chars = 400
113
+ thread_comment_html_chars = 8000
114
+ line_heuristic_code_chars = 160
115
+
116
+ [study] # per repo
117
+ # Seconds before a study-assistant turn is abandoned.
118
+ turn_timeout_seconds = 600
119
+ # The most text one of the study assistant's tools returns to the model.
120
+ max_tool_output_chars = 60000
121
+ # The same two limits for model-assisted onboarding, plus how much of each doc the model is shown up front.
122
+ onboarding_turn_timeout_seconds = 900
123
+ onboarding_tool_output_chars = 30000
124
+ onboarding_doc_excerpt_chars = 8000
125
+
126
+ [sessions]
127
+ # Seconds between scans for new agent sessions (Copilot CLI, Claude Code) to link to their PRs.
128
+ scan_seconds = 5.0
129
+ # How far into a session's event log to look for its first message.
130
+ first_message_bytes = 512000
131
+
132
+ [authors] # per repo
133
+ # Days a team or org membership check is remembered.
134
+ membership_cache_days = 7.0
135
+
136
+ [logging]
137
+ # debug, info, warning, or error. `--verbose` on the command line means debug.
138
+ level = "info"
139
+ # "text" for people, "json" for one JSON object per line (for log tools).
140
+ format = "text"
141
+ # readthrough.log is rotated at this size, keeping this many old files.
142
+ file_max_kb = 1024
143
+ file_backups = 3
@@ -0,0 +1,133 @@
1
+ # Profile reference (schema 1)
2
+
3
+ A profile is a TOML file describing a repo's architecture. Top-level keys must come before any `[table]` or `[[array]]` header.
4
+
5
+ ```toml
6
+ schema = 1 # required
7
+ repo = "owner/name" # required: the repo's path on its forge (group/subgroup/project on GitLab, organization/project/repository on Azure DevOps)
8
+ title = "Name" # shown in the dashboard header; defaults to the last segment of repo
9
+ drafted_by = "model" # optional: "readthrough" or "model", whoever wrote the first draft (shown on the map)
10
+ read_order = ["api", "core"] # optional: component ids in the order a reviewer should read them
11
+ ```
12
+
13
+ ## Layers (at least one)
14
+
15
+ Rows of the architecture map, top to bottom.
16
+
17
+ ```toml
18
+ [[layers]]
19
+ id = "entry"
20
+ label = "Entry points"
21
+ flow = false # true draws arrows between this layer's components, left to right
22
+ source = true # false for tests/docs/infra: excluded from "cross-cutting" and sizing
23
+ color = "#2f6f9f" # optional
24
+ ```
25
+
26
+ ## Components (at least one)
27
+
28
+ **First match wins**, so put narrow patterns (tests inside source trees, a sub-package) before broad ones. Anything unmatched falls into an implicit `other` component.
29
+
30
+ ```toml
31
+ [[components]]
32
+ id = "scorers" # unique, kebab-case
33
+ label = "Scorers"
34
+ layer = "core" # a layer id
35
+ paths = ["src/app/score/**", "src/app/scoring.py"] # globs: ** spans directories, * stays in one
36
+ contract = "Scorers" # optional: heading in the contracts doc (see [contracts])
37
+ responsibility = "Turns a response into a score." # optional, used when there's no contract doc
38
+ does_not_own = "Deciding what to do with a score (the caller branches)."
39
+ questions = ["Does the score type match what callers expect?"] # asked when a PR touches this component
40
+ ```
41
+
42
+ Write `responsibility` and `does_not_own` in plain sentences. `does_not_own` is what makes "responsibility bleed" reviewable: name the neighbouring component that owns each thing.
43
+
44
+ ## Contracts and rules (optional)
45
+
46
+ ```toml
47
+ [contracts]
48
+ source = "docs/architecture.md" # markdown file in the repo; each component's section is found by its `contract` heading
49
+ labels = { responsibility = "Responsibility", does_not_own = "Does not own" } # the bold labels inside each section
50
+
51
+ [rules]
52
+ instructions_dir = ".github/instructions" # *.instructions.md files with applyTo globs, matched to changed files
53
+ guidance_file = ".github/copilot-instructions.md"
54
+ ```
55
+
56
+ ## Review and study guidance (optional)
57
+
58
+ ```toml
59
+ [review]
60
+ guidance = '''What reviewers here comment on, and what they don't.'''
61
+ test_cmd = "{clone}/.venv/bin/python -m pytest {tests} -q" # {clone} and {tests} are filled in
62
+
63
+ [study]
64
+ guidance = '''Extra context for the study quiz.'''
65
+ ```
66
+
67
+ ## Signals, smells, paired files
68
+
69
+ Each has a `kind`: risk, blocker, convention, responsibility, correctness, info, author, or you.
70
+
71
+ ```toml
72
+ [[signals]] # raised when a PR changes matching paths
73
+ id = "migration"
74
+ kind = "risk"
75
+ message = "Database migration: check it's reversible"
76
+ paths = ["**/migrations/**"]
77
+ change_types = ["ADDED"] # optional: ADDED, MODIFIED, DELETED, RENAMED
78
+
79
+ [[smells]] # regex over added lines in the diff
80
+ id = "print"
81
+ kind = "convention"
82
+ message = "print() in library code"
83
+ path = '^src/' # regex on the file path
84
+ line = '^\s*print\(' # regex on the added line (use TOML literal strings for regexes)
85
+
86
+ [[paired_files]] # e.g. notebooks that must be regenerated with their .py source
87
+ id = "notebook-pair"
88
+ kind = "convention"
89
+ message = "Changed the .py but not the .ipynb"
90
+ under = "doc/"
91
+ extensions = [".py", ".ipynb"]
92
+ ```
93
+
94
+ ## Checks, weights, overlap
95
+
96
+ ```toml
97
+ [checks]
98
+ tests_component = "tests" # component id that holds tests (default "tests" if it exists)
99
+ test_paths = ["tests/**"]
100
+ no_tests_min_lines = 20 # flag source changes bigger than this with no test changes
101
+ cross_cutting_layers = 3 # flag PRs spanning this many source layers
102
+ large_lines = 800
103
+ stale_days = 21
104
+
105
+ [weights]
106
+ capped_paths = ["**/*.lock", "**/*.ipynb"] # generated files: count at most capped_lines toward size
107
+ capped_lines = 20
108
+
109
+ [overlap]
110
+ ignore = ["**/__init__.py"] # files every PR touches; don't count as overlap
111
+ non_source = ["tests/**", "docs/**"] # shown dimmer in the overlap graph
112
+ ```
113
+
114
+ ## Authors
115
+
116
+ Decides who's internal (a maintainer) and who's external. Rules apply in this order: bots, the `internal`/`external` login lists, team and org membership, then GitHub's author association.
117
+
118
+ ```toml
119
+ [authors]
120
+ internal = ["alice"] # always internal
121
+ external = ["vendor-bot-account"] # always external
122
+ bots = ["renovate"] # in addition to GitHub Bot accounts
123
+ internal_teams = ["owner/core-team"] # members are internal (needs read:org)
124
+ internal_orgs = ["owner"] # members are internal
125
+ association = { MEMBER = "internal", COLLABORATOR = "internal", CONTRIBUTOR = "external", NONE = "first-time" }
126
+ unknown = "external"
127
+
128
+ [authors.kinds.first-time] # optional: tune a kind's label, badge, signal, review questions
129
+ label = "first-time contributor"
130
+ questions = ["Did a maintainer ask for this change?"]
131
+ ```
132
+
133
+ An empty `[authors]` section is valid and means "use the defaults": OWNER, MEMBER, and COLLABORATOR are internal; CONTRIBUTOR is external; NONE (first PR) is first-time.
@@ -0,0 +1,22 @@
1
+ # Vendored libraries
2
+
3
+ Inlined into the dashboard so it works offline and when opened from disk. Load order matters.
4
+
5
+ | File | Package | Version | License | SHA-256 |
6
+ | --- | --- | --- | --- | --- |
7
+ | `cytoscape.min.js` | [cytoscape](https://github.com/cytoscape/cytoscape.js) | 3.34.3 | MIT | `5f3b5b529546d5af1fc5628590af033b74511a5b6f789f5f4682845863228b91` |
8
+ | `layout-base.js` | [layout-base](https://github.com/iVis-at-Bilkent/layout-base) | 2.0.1 | MIT | `f5c66be21c9cca16c4f25a576bffbd16ed1a48181c1c2dcbb8d905ec822e76b5` |
9
+ | `cose-base.js` | [cose-base](https://github.com/iVis-at-Bilkent/cose-base) | 2.2.0 | MIT | `7cae9509bd36235a63a85e71c8d9fa2cd0bc1d0c1ecc5b5a737976f39d040ddf` |
10
+ | `cytoscape-fcose.js` | [cytoscape-fcose](https://github.com/iVis-at-Bilkent/cytoscape.js-fcose) | 2.2.0 | MIT | `4b1cab218d74996aa59cd8473f9239cc6398b8c1774d84d7e59ad9a68959cb57` |
11
+ | `marked.umd.js` | [marked](https://github.com/markedjs/marked) | 18.0.14 | MIT | `21568877a938d2c4e7d74e27f18e60da96bb73a68809610ca39216e1efebae62` |
12
+ | `purify.min.js` | [DOMPurify](https://github.com/cure53/DOMPurify) | 3.4.16 | MPL-2.0 OR Apache-2.0 | `2c90a9b46d6463f26038a29b686e82bc91de01fdac9d5229e7cfe3b360134ea2` |
13
+ | `lucide-icons.js` | [lucide-static](https://github.com/lucide-icons/lucide) | 0.469.0 | ISC (portions MIT, from Feather) | `748fbc3ba70c87996157a8eaba8f2bdc5a7f7be20489a1fb3ce599fc39f71aeb` |
14
+
15
+ The first six files are byte-identical to the files of the same name in the packages' npm tarballs
16
+ (`dist/cytoscape.min.js`, `layout-base.js`, `cose-base.js`, `cytoscape-fcose.js`, `lib/marked.umd.js`,
17
+ `dist/purify.min.js`); `lucide-icons.js` is readthrough's own subset, holding only the icons the dashboard uses
18
+ (the inner markup of each `lucide-static/icons/<name>.svg`). `tests/test_vendor.py` checks every file against
19
+ its hash, so a changed file means a changed row, in the same commit, with the new version named.
20
+
21
+ License texts are in `licenses/`. To update, `npm install` the packages and copy the same files from
22
+ `node_modules`, then record the new version and hash here.