docfriction 0.1.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 (44) hide show
  1. docfriction-0.1.0/.editorconfig +15 -0
  2. docfriction-0.1.0/.env.example +4 -0
  3. docfriction-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +33 -0
  4. docfriction-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  5. docfriction-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +27 -0
  6. docfriction-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +14 -0
  7. docfriction-0.1.0/.github/dependabot.yml +13 -0
  8. docfriction-0.1.0/.github/workflows/ci.yml +26 -0
  9. docfriction-0.1.0/.github/workflows/release.yml +40 -0
  10. docfriction-0.1.0/.gitignore +12 -0
  11. docfriction-0.1.0/.pre-commit-config.yaml +14 -0
  12. docfriction-0.1.0/.python-version +1 -0
  13. docfriction-0.1.0/CHANGELOG.md +33 -0
  14. docfriction-0.1.0/CODE_OF_CONDUCT.md +128 -0
  15. docfriction-0.1.0/CONTRIBUTING.md +84 -0
  16. docfriction-0.1.0/LICENSE +21 -0
  17. docfriction-0.1.0/PKG-INFO +186 -0
  18. docfriction-0.1.0/README.md +157 -0
  19. docfriction-0.1.0/SECURITY.md +38 -0
  20. docfriction-0.1.0/docs/research.md +209 -0
  21. docfriction-0.1.0/examples/github-action.yml +50 -0
  22. docfriction-0.1.0/examples/sample-friction-log.md +40 -0
  23. docfriction-0.1.0/pyproject.toml +79 -0
  24. docfriction-0.1.0/src/docfriction/__init__.py +29 -0
  25. docfriction-0.1.0/src/docfriction/_version.py +1 -0
  26. docfriction-0.1.0/src/docfriction/checks.py +152 -0
  27. docfriction-0.1.0/src/docfriction/cli.py +106 -0
  28. docfriction-0.1.0/src/docfriction/evaluate.py +177 -0
  29. docfriction-0.1.0/src/docfriction/fetch.py +124 -0
  30. docfriction-0.1.0/src/docfriction/jev.py +196 -0
  31. docfriction-0.1.0/src/docfriction/models.py +130 -0
  32. docfriction-0.1.0/src/docfriction/py.typed +0 -0
  33. docfriction-0.1.0/src/docfriction/report.py +123 -0
  34. docfriction-0.1.0/src/docfriction/rubric.py +154 -0
  35. docfriction-0.1.0/src/docfriction/segment.py +175 -0
  36. docfriction-0.1.0/tests/conftest.py +112 -0
  37. docfriction-0.1.0/tests/test_checks.py +139 -0
  38. docfriction-0.1.0/tests/test_cli.py +79 -0
  39. docfriction-0.1.0/tests/test_evaluate.py +163 -0
  40. docfriction-0.1.0/tests/test_fetch.py +115 -0
  41. docfriction-0.1.0/tests/test_jev.py +159 -0
  42. docfriction-0.1.0/tests/test_report.py +61 -0
  43. docfriction-0.1.0/tests/test_segment.py +131 -0
  44. docfriction-0.1.0/uv.lock +941 -0
@@ -0,0 +1,15 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+ indent_style = space
9
+ indent_size = 4
10
+
11
+ [*.{yml,yaml,toml,md}]
12
+ indent_size = 2
13
+
14
+ [*.md]
15
+ trim_trailing_whitespace = false
@@ -0,0 +1,4 @@
1
+ # Get a key at https://typesafe.ai (Jev is served from the System One API).
2
+ TYPESAFE_API_KEY=your-key-here
3
+ # Optional: override the API host, e.g. a compatible gateway.
4
+ # TYPESAFE_BASE_URL=https://api.typesafe.ai
@@ -0,0 +1,33 @@
1
+ name: Bug report
2
+ description: Something did not work as documented
3
+ labels: [bug]
4
+ body:
5
+ - type: input
6
+ id: version
7
+ attributes:
8
+ label: docfriction version
9
+ description: Output of `docfriction --version`
10
+ validations:
11
+ required: true
12
+ - type: input
13
+ id: page
14
+ attributes:
15
+ label: Documentation page
16
+ description: The URL or a description of the page you ran it on, if it can be shared
17
+ - type: textarea
18
+ id: what
19
+ attributes:
20
+ label: What happened
21
+ description: Include the command you ran and the full error or the unexpected part of the report
22
+ validations:
23
+ required: true
24
+ - type: textarea
25
+ id: expected
26
+ attributes:
27
+ label: What you expected
28
+ - type: textarea
29
+ id: dryrun
30
+ attributes:
31
+ label: Dry-run output
32
+ description: Output of `docfriction <page> --dry-run` (this never calls Jev)
33
+ render: text
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Security issue
4
+ url: https://github.com/Cyvid7-Darus10/docfriction/security/advisories/new
5
+ about: Report vulnerabilities privately, not as a public issue
@@ -0,0 +1,27 @@
1
+ name: Feature request
2
+ description: Suggest a check, a rubric change, or a new capability
3
+ labels: [enhancement]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: What friction are you trying to catch?
9
+ description: Describe the documentation problem, ideally with a real example
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: proposal
14
+ attributes:
15
+ label: Proposed change
16
+ description: A new Jev question, a deterministic check, a CLI flag, or something else
17
+ - type: dropdown
18
+ id: kind
19
+ attributes:
20
+ label: Kind
21
+ options:
22
+ - Rubric question (Jev)
23
+ - Deterministic check
24
+ - Fetching / segmentation
25
+ - Report format
26
+ - CLI / CI
27
+ - Other
@@ -0,0 +1,14 @@
1
+ ## Why
2
+
3
+ <!-- What problem does this solve? Link the issue if there is one. -->
4
+
5
+ ## What changed
6
+
7
+ <!-- Short summary. The diff shows the details. -->
8
+
9
+ ## Checklist
10
+
11
+ - [ ] Tests added or updated, `uv run pytest` passes
12
+ - [ ] `uv run ruff check src tests`, `uv run ruff format --check src tests`, `uv run mypy src` pass
13
+ - [ ] `CHANGELOG.md` updated under Unreleased
14
+ - [ ] If the rubric changed: wording follows `CONTRIBUTING.md` and `NOUL_FAILURE_DETAIL` is updated
@@ -0,0 +1,13 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: monthly
7
+ - package-ecosystem: uv
8
+ directory: /
9
+ schedule:
10
+ interval: monthly
11
+ groups:
12
+ dev-dependencies:
13
+ dependency-type: development
@@ -0,0 +1,26 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.10", "3.12", "3.13"]
17
+ steps:
18
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+ - run: uv sync --all-groups
23
+ - run: uv run ruff check src tests
24
+ - run: uv run ruff format --check src tests
25
+ - run: uv run mypy src
26
+ - run: uv run pytest -q --cov=docfriction --cov-fail-under=80
@@ -0,0 +1,40 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
15
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
16
+ - run: uv sync --all-groups
17
+ - run: uv run pytest -q
18
+ - run: uv build
19
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
20
+ with:
21
+ name: dist
22
+ path: dist/
23
+
24
+ publish:
25
+ needs: build
26
+ runs-on: ubuntu-latest
27
+ environment: pypi
28
+ permissions:
29
+ id-token: write # PyPI trusted publishing, no API token needed
30
+ contents: write # create the GitHub release
31
+ steps:
32
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
37
+ - name: GitHub release
38
+ env:
39
+ GH_TOKEN: ${{ github.token }}
40
+ run: gh release create "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --title "$GITHUB_REF_NAME" --generate-notes
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .coverage
10
+ htmlcov/
11
+ .env
12
+ friction-log.*
@@ -0,0 +1,14 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.16.8
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+ - repo: https://github.com/pre-commit/pre-commit-hooks
9
+ rev: v6.0.0
10
+ hooks:
11
+ - id: end-of-file-fixer
12
+ - id: trailing-whitespace
13
+ - id: check-yaml
14
+ - id: check-toml
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-09-20
10
+
11
+ ### Added
12
+
13
+ - `docfriction` CLI: fetch a docs page by URL or path, split it into
14
+ heading-level steps, evaluate each step with a batched Jev rubric, and render
15
+ a Markdown or JSON friction log.
16
+ - Rubric: friction type (choice), severity (score), and yes/no checks for
17
+ prerequisites, expected result, terms, code/prose match, and placeholders.
18
+ - Deterministic checks: dead links (`--check-links`), untagged code blocks,
19
+ stub sections, placeholder detection.
20
+ - `--fail-on-severity` CI gate, `--dry-run`, `--max-sections`, `--concurrency`,
21
+ `--model`.
22
+ - Thin Jev HTTP client with exponential backoff on 429/529; answers are
23
+ validated against the questions asked.
24
+ - Link checks refuse private, loopback and link-local addresses on every
25
+ redirect hop unless `--allow-private-links` is set; fetched pages are capped
26
+ at 5 MB.
27
+ - Segmenter handles setext headings, indented code blocks, nested fences of
28
+ different lengths, YAML front matter and HTML comments, and strips anchor
29
+ links and escapes from headings.
30
+ - Example GitHub Actions workflow and research notes on Jev.
31
+
32
+ [Unreleased]: https://github.com/Cyvid7-Darus10/docfriction/compare/v0.1.0...HEAD
33
+ [0.1.0]: https://github.com/Cyvid7-Darus10/docfriction/releases/tag/v0.1.0
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+
56
+ ## Enforcement
57
+
58
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
59
+ reported to the maintainer at cyrus@pastelero.ph. All complaints will be
60
+ reviewed and investigated promptly and fairly.
61
+
62
+ All community leaders are obligated to respect the privacy and security of the
63
+ reporter of any incident.
64
+
65
+ ## Enforcement Guidelines
66
+
67
+ Community leaders will follow these Community Impact Guidelines in determining
68
+ the consequences for any action they deem in violation of this Code of Conduct:
69
+
70
+ ### 1. Correction
71
+
72
+ **Community Impact**: Use of inappropriate language or other behavior deemed
73
+ unprofessional or unwelcome in the community.
74
+
75
+ **Consequence**: A private, written warning from community leaders, providing
76
+ clarity around the nature of the violation and an explanation of why the
77
+ behavior was inappropriate. A public apology may be requested.
78
+
79
+ ### 2. Warning
80
+
81
+ **Community Impact**: A violation through a single incident or series of
82
+ actions.
83
+
84
+ **Consequence**: A warning with consequences for continued behavior. No
85
+ interaction with the people involved, including unsolicited interaction with
86
+ those enforcing the Code of Conduct, for a specified period of time. This
87
+ includes avoiding interactions in community spaces as well as external channels
88
+ like social media. Violating these terms may lead to a temporary or permanent
89
+ ban.
90
+
91
+ ### 3. Temporary Ban
92
+
93
+ **Community Impact**: A serious violation of community standards, including
94
+ sustained inappropriate behavior.
95
+
96
+ **Consequence**: A temporary ban from any sort of interaction or public
97
+ communication with the community for a specified period of time. No public or
98
+ private interaction with the people involved, including unsolicited interaction
99
+ with those enforcing the Code of Conduct, is allowed during this period.
100
+ Violating these terms may lead to a permanent ban.
101
+
102
+ ### 4. Permanent Ban
103
+
104
+ **Community Impact**: Demonstrating a pattern of violation of community
105
+ standards, including sustained inappropriate behavior, harassment of an
106
+ individual, or aggression toward or disparagement of classes of individuals.
107
+
108
+ **Consequence**: A permanent ban from any sort of public interaction within the
109
+ community.
110
+
111
+ ## Attribution
112
+
113
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
114
+ version 2.1, available at
115
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
116
+
117
+ Community Impact Guidelines were inspired by
118
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
119
+
120
+ For answers to common questions about this code of conduct, see the FAQ at
121
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
122
+ [https://www.contributor-covenant.org/translations][translations].
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
126
+ [Mozilla CoC]: https://github.com/mozilla/diversity
127
+ [FAQ]: https://www.contributor-covenant.org/faq
128
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,84 @@
1
+ # Contributing to docfriction
2
+
3
+ docfriction does one thing: turn a docs page into a friction log using Jev
4
+ plus deterministic checks. Bug reports on real pages, new checks, and better
5
+ rubric wording are the most useful contributions.
6
+
7
+ ## Set up
8
+
9
+ ```bash
10
+ git clone https://github.com/Cyvid7-Darus10/docfriction
11
+ cd docfriction
12
+ uv sync --all-groups
13
+ uv run pre-commit install # optional but recommended
14
+ ```
15
+
16
+ You do not need a TypeSafe API key to develop. The whole test suite runs
17
+ against a mocked HTTP transport, and `docfriction <page> --dry-run` exercises
18
+ fetching and segmentation without calling Jev.
19
+
20
+ ## Run the checks
21
+
22
+ ```bash
23
+ uv run pytest --cov=docfriction # tests, coverage gate is 80%
24
+ uv run ruff check src tests # lint
25
+ uv run ruff format src tests # format
26
+ uv run mypy src # strict type check
27
+ ```
28
+
29
+ CI runs the same four commands on Python 3.10, 3.12 and 3.13.
30
+
31
+ ## Where things live
32
+
33
+ | Path | What |
34
+ |---|---|
35
+ | `src/docfriction/fetch.py` | URL / file loading, HTML to Markdown |
36
+ | `src/docfriction/segment.py` | Markdown to heading-level steps |
37
+ | `src/docfriction/rubric.py` | Every question we ask Jev, and the failure text per check |
38
+ | `src/docfriction/checks.py` | Deterministic checks (links, placeholders, stubs) |
39
+ | `src/docfriction/jev.py` | Thin HTTP client for `POST /v1/systemone` |
40
+ | `src/docfriction/evaluate.py` | Orchestration and thresholds |
41
+ | `src/docfriction/report.py` | Markdown and JSON rendering |
42
+ | `src/docfriction/cli.py` | argparse entry point |
43
+
44
+ ## Changing the rubric
45
+
46
+ Changes to `rubric.py` get the closest review, because a badly worded
47
+ question quietly changes every report. Follow TypeSafe's guidance for Jev,
48
+ which the existing questions do:
49
+
50
+ - Put the judgment in `instructions` and the possible answers in `criteria`.
51
+ - Score levels describe concrete situations, not degrees ("the reader has to
52
+ leave the page", not "moderately confusing").
53
+ - Choices include a no-match option.
54
+ - Reference state fields with backticks, e.g. `` `section_text` ``.
55
+ - Phrase yes/no checks positively; a low probability is the signal.
56
+ - Anything Jev is bad at (counting, comparing, following links) belongs in
57
+ `checks.py`, not in a question.
58
+
59
+ Add a test in `tests/test_evaluate.py` for any new check, and a line in
60
+ `NOUL_FAILURE_DETAIL` so the report can explain it.
61
+
62
+ ## Pull requests
63
+
64
+ - One logical change per PR. Keep refactors separate from behaviour changes.
65
+ - Use conventional commit messages: `feat:`, `fix:`, `docs:`, `test:`,
66
+ `refactor:`, `chore:`, `ci:`.
67
+ - Add or update tests. New code should not lower coverage.
68
+ - Update `CHANGELOG.md` under "Unreleased".
69
+ - Explain *why* in the PR description; the diff shows what.
70
+
71
+ ## Reporting bugs
72
+
73
+ Use the bug report issue template. If the bug is about a specific docs page,
74
+ include the URL and the output of `docfriction <url> --dry-run`, which never
75
+ sends anything to Jev.
76
+
77
+ ## Security
78
+
79
+ Please do not open public issues for security problems. See
80
+ [SECURITY.md](SECURITY.md).
81
+
82
+ ## Code of conduct
83
+
84
+ This project follows the [Contributor Covenant](CODE_OF_CONDUCT.md).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cyrus David Pastelero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.