mdpeek 0.0.1__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.
@@ -0,0 +1,16 @@
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ pre-commit:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+
13
+ - uses: astral-sh/setup-uv@v5
14
+
15
+ - name: Run pre-commit
16
+ uses: j178/prek-action@v1
@@ -0,0 +1,69 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ with:
13
+ fetch-depth: 0 # hatch-vcs needs tags to derive the version
14
+
15
+ - uses: astral-sh/setup-uv@v5
16
+
17
+ - name: Build sdist and wheel
18
+ run: uv build
19
+
20
+ - uses: actions/upload-artifact@v4
21
+ with:
22
+ name: dist
23
+ path: dist/
24
+
25
+ publish-testpypi:
26
+ needs: build
27
+ runs-on: ubuntu-latest
28
+ environment: testpypi
29
+ permissions:
30
+ id-token: write
31
+ steps:
32
+ - uses: actions/download-artifact@v4
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+
37
+ - uses: pypa/gh-action-pypi-publish@release/v1
38
+ with:
39
+ repository-url: https://test.pypi.org/legacy/
40
+
41
+ publish-pypi:
42
+ needs: publish-testpypi
43
+ runs-on: ubuntu-latest
44
+ environment: pypi
45
+ permissions:
46
+ id-token: write
47
+ steps:
48
+ - uses: actions/download-artifact@v4
49
+ with:
50
+ name: dist
51
+ path: dist/
52
+
53
+ - uses: pypa/gh-action-pypi-publish@release/v1
54
+
55
+ github-release:
56
+ needs: publish-pypi
57
+ runs-on: ubuntu-latest
58
+ permissions:
59
+ contents: write
60
+ steps:
61
+ - uses: actions/download-artifact@v4
62
+ with:
63
+ name: dist
64
+ path: dist/
65
+
66
+ - name: Create GitHub release
67
+ env:
68
+ GH_TOKEN: ${{ github.token }}
69
+ run: gh release create "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --generate-notes
@@ -0,0 +1,51 @@
1
+ name: tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: write
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0 # hatch-vcs needs tags to derive the version
22
+
23
+ - uses: astral-sh/setup-uv@v5
24
+
25
+ - name: Install Python ${{ matrix.python-version }}
26
+ run: uv python install ${{ matrix.python-version }}
27
+
28
+ - name: Install dependencies
29
+ run: uv sync --python ${{ matrix.python-version }}
30
+
31
+ - name: Run tests
32
+ run: uv run --python ${{ matrix.python-version }} nox -s tests-${{ matrix.python-version }} -- --cov-report=json:coverage.json
33
+
34
+ - name: Generate coverage badge
35
+ if: github.ref == 'refs/heads/main' && matrix.python-version == '3.13'
36
+ run: |
37
+ COVERAGE=$(uv run python -c "import json; print(int(json.load(open('coverage.json'))['totals']['percent_covered_display']))")
38
+ uvx anybadge --value="$COVERAGE" --suffix="%" --file=coverage.svg --label=coverage \
39
+ --overwrite 50=red 60=orange 70=yellow 80=yellow_green 90=green
40
+
41
+ - name: Publish badge
42
+ if: github.ref == 'refs/heads/main' && matrix.python-version == '3.13'
43
+ run: |
44
+ cp coverage.svg /tmp/coverage.svg
45
+ git config user.name "github-actions[bot]"
46
+ git config user.email "github-actions[bot]@users.noreply.github.com"
47
+ git fetch origin badges:badges 2>/dev/null && git checkout badges || { git checkout --orphan badges && git rm -rf . ; }
48
+ cp /tmp/coverage.svg coverage.svg
49
+ git add coverage.svg
50
+ git commit -m "Update coverage badge" || true
51
+ git push origin badges --force
@@ -0,0 +1,22 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Coverage
13
+ coverage.xml
14
+ coverage.json
15
+ coverage.svg
16
+ .coverage
17
+ htmlcov/
18
+
19
+ # Tool caches
20
+ .pytest_cache/
21
+ .ruff_cache/
22
+ .nox/
@@ -0,0 +1,29 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: check-yaml
6
+ - id: check-toml
7
+ - id: trailing-whitespace
8
+ # Feature doc strings and fixtures may need exact whitespace.
9
+ exclude: ^tests/(features|fixtures)/
10
+ - id: end-of-file-fixer
11
+ exclude: ^tests/fixtures/
12
+ - id: no-commit-to-branch
13
+ args: [--branch, main]
14
+
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.15.0
17
+ hooks:
18
+ - id: ruff
19
+ args: [--fix]
20
+ - id: ruff-format
21
+
22
+ - repo: local
23
+ hooks:
24
+ - id: ty
25
+ name: ty
26
+ entry: uv run ty check src/
27
+ language: system
28
+ pass_filenames: false
29
+ types: [python]
@@ -0,0 +1 @@
1
+ 3.11
mdpeek-0.0.1/CLAUDE.md ADDED
@@ -0,0 +1,41 @@
1
+ # mdpeek
2
+
3
+ Progressive exposure for markdown. An agent navigates a large markdown file
4
+ (or URL) by section and queries its tables, instead of reading the whole
5
+ document into context.
6
+
7
+ ## Commands
8
+
9
+ ```sh
10
+ uv sync # Install dependencies
11
+ uv run mdpeek --version # Run locally
12
+ uv run pytest # Tests with coverage (unit, doctests; BDD later)
13
+ uv run nox # Tests across Python 3.11–3.14
14
+ prek run --all-files # ruff, ty and hygiene hooks
15
+ uv tool install --force --reinstall . # Install globally
16
+ ```
17
+
18
+ ## Conventions
19
+
20
+ - Test fixtures are synthetic.
21
+ - **Python ≥ 3.11.** The only runtime dependency is `markdown-it-py`. DuckDB is
22
+ an optional extra (`mdpeek[duckdb]`) and must be imported lazily.
23
+ - **API options are `StrEnum`s** (in `options.py`). Functions accept either the
24
+ enum or its string value; CLI `choices=` are derived from the enums.
25
+ - **Section IDs** (`S1`, `S1.3.2`, `S0` for preamble) and **table IDs**
26
+ (`T1..Tn`) are internal and derived only from document structure, never
27
+ from heading text.
28
+ - **CLI behaviour is specified in Gherkin** (`tests/features/*.feature`, run by
29
+ pytest-bdd). These files are the contract for a possible future Rust CLI, so
30
+ keep step wording language-neutral.
31
+ - **PRs are rebase merged**, so every commit on a branch lands on `main` as-is.
32
+ Keep a branch to a short list of meaningful commits, one per logical change.
33
+ Squash fixups, review tweaks and "fix typo" commits into the commit they belong
34
+ to before merging.
35
+ - **Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)**:
36
+ `<type>(<optional scope>): <imperative summary>`. Types: `feat`, `fix`,
37
+ `docs`, `test`, `refactor`, `perf`, `build`, `ci`, `chore`. Use `!` or a
38
+ `BREAKING CHANGE:` footer for breaking changes. Scopes are module names (e.g.
39
+ `feat(tables): …`, `fix(cli): …`).
40
+ - Versions come from git tags (`hatch-vcs`); never add a `version` field.
41
+ - Releases: see CONTRIBUTING.md.
@@ -0,0 +1,154 @@
1
+ # Contributing
2
+
3
+ ## Getting Started
4
+
5
+ ```sh
6
+ git clone https://github.com/jongracecox/mdpeek.git
7
+ cd mdpeek
8
+ uv sync
9
+ prek install # or: pre-commit install
10
+ ```
11
+
12
+ ## Running Locally
13
+
14
+ ```sh
15
+ uv run mdpeek --version
16
+ uv run mdpeek path/to/doc.md
17
+ ```
18
+
19
+ ## Installing Globally
20
+
21
+ After making changes, reinstall to test the global `mdpeek` command:
22
+
23
+ ```sh
24
+ uv tool install --force --reinstall .
25
+ ```
26
+
27
+ Both `--force` and `--reinstall` are required: `--force` alone reuses cached
28
+ wheel builds and won't pick up code changes.
29
+
30
+ ## Project Layout
31
+
32
+ ```
33
+ src/mdpeek/
34
+ ├── __init__.py # Public API and version
35
+ ├── __main__.py # python -m mdpeek
36
+ └── cli.py # argparse entry point
37
+ tests/ # pytest unit tests (BDD features arrive with the CLI)
38
+ ```
39
+
40
+ See [CLAUDE.md](CLAUDE.md) for architecture and conventions.
41
+
42
+ ## Testing
43
+
44
+ ```sh
45
+ uv run pytest # Quick run on the active Python version
46
+ uv run nox # Full matrix: Python 3.11, 3.12, 3.13, 3.14
47
+ uv run nox -s tests-3.14 # One Python version
48
+ ```
49
+
50
+ `noxfile.py` is the source of truth for the test matrix. To add a Python
51
+ version, append it to `PYTHON_VERSIONS`, add the classifier in
52
+ `pyproject.toml`, and extend the CI matrix in `.github/workflows/tests.yml`.
53
+
54
+ The coverage badge is generated by only one CI job (the 3.13 job) to avoid
55
+ concurrent pushes to the `badges` branch. If you drop or rename that version,
56
+ update the `matrix.python-version == '3.13'` conditions in
57
+ `.github/workflows/tests.yml`.
58
+
59
+ ## Code Style
60
+
61
+ Pre-commit hooks (run by prek) enforce:
62
+
63
+ - **ruff** for linting and auto-formatting
64
+ - **ty** for type checking
65
+ - YAML/TOML validity, trailing whitespace, end-of-file newlines
66
+ - no direct commits to `main`
67
+
68
+ Hooks run automatically on `git commit`. If a hook auto-fixes files, re-stage
69
+ and commit again. CI runs the same hooks on every pull request.
70
+
71
+ ## Commits and Pull Requests
72
+
73
+ Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/):
74
+
75
+ ```
76
+ <type>(<optional scope>): <imperative summary>
77
+
78
+ <optional body>
79
+
80
+ <optional footers>
81
+ ```
82
+
83
+ - **Types:** `feat`, `fix`, `docs`, `test`, `refactor`, `perf`, `build`,
84
+ `ci`, `chore`.
85
+ - **Scope:** the affected module, if useful, e.g. `feat(tables): add --tables
86
+ listing` or `fix(cli): reject unknown section IDs`.
87
+ - **Breaking changes:** add `!` after the type/scope (`feat(cli)!: …`) or a
88
+ `BREAKING CHANGE:` footer.
89
+
90
+ Pull requests are **rebase merged**, so every commit on a branch lands on
91
+ `main` unchanged. Keep a branch to a short list of meaningful commits, one per
92
+ logical change, and squash fixups into the commit they belong to before
93
+ merging.
94
+
95
+ ## Releasing
96
+
97
+ Releases are published by `.github/workflows/release.yml` when a tag matching
98
+ `v*` is pushed.
99
+
100
+ ### Versioning
101
+
102
+ The package version is derived from git tags by `hatch-vcs`; there is **no**
103
+ `version` field in `pyproject.toml`. Tag `v0.1.1` builds package version
104
+ `0.1.1`. Untagged commits get a dev version such as `0.1.1.dev3`.
105
+
106
+ ### Cutting a release
107
+
108
+ ```sh
109
+ git checkout main
110
+ git pull
111
+ git tag v0.1.1
112
+ git push origin v0.1.1
113
+ ```
114
+
115
+ The release workflow then runs:
116
+
117
+ 1. **Build**: sdist and wheel with `uv build`.
118
+ 2. **Publish to TestPyPI**: waits for manual approval in the `testpypi`
119
+ GitHub environment, then uploads via OIDC trusted publishing.
120
+ 3. **Publish to PyPI**: waits for a second approval in the `pypi`
121
+ environment, then uploads.
122
+ 4. **GitHub release**: created from the tag with the built artifacts and
123
+ generated notes.
124
+
125
+ Approve in **Actions → release run → Review deployments**. Between the two
126
+ approvals, sanity-check the upload at https://test.pypi.org/project/mdpeek/.
127
+
128
+ ### Recovering from a bad release
129
+
130
+ PyPI and TestPyPI versions are immutable: you cannot re-upload `v0.1.1` once
131
+ published.
132
+
133
+ - **Caught at the TestPyPI stage**: reject the PyPI deployment, fix the
134
+ problem, and push a new tag (e.g. `v0.1.2`).
135
+ - **Caught after the PyPI publish**: yank the version on pypi.org
136
+ (Manage → Yank), then push a fix tag.
137
+
138
+ Never delete and re-push a tag.
139
+
140
+ ### One-time setup
141
+
142
+ - **PyPI and TestPyPI**: a pending trusted publisher for project `mdpeek`,
143
+ owner `jongracecox`, repository `mdpeek`, workflow `release.yml`,
144
+ environment `pypi` / `testpypi` respectively.
145
+ - **GitHub environments** `testpypi` and `pypi`, each with a required
146
+ reviewer and deployment limited to `v*` tags.
147
+ - **Merge method**: rebase merge only (merge commits and squash merging are
148
+ disabled in the repository settings).
149
+ - **Branch ruleset on `main`**: require a pull request and the `pre-commit`
150
+ and `tests` status checks; block force pushes and deletion.
151
+ - **Actions workflow permissions**: read and write, so the tests workflow can
152
+ push the coverage badge to the `badges` branch.
153
+
154
+ See PyPA's Trusted Publishing docs: https://docs.pypi.org/trusted-publishers/
mdpeek-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jon Grace-Cox
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.
mdpeek-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.5
2
+ Name: mdpeek
3
+ Version: 0.0.1
4
+ Summary: Progressive exposure for markdown: navigate large documents by section and query their tables
5
+ Project-URL: Homepage, https://github.com/jongracecox/mdpeek
6
+ Project-URL: Issues, https://github.com/jongracecox/mdpeek/issues
7
+ Project-URL: Repository, https://github.com/jongracecox/mdpeek
8
+ Author-email: Jon Grace-Cox <30441316+jongracecox@users.noreply.github.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agents,claude-code,cli,context,llm,markdown
12
+ Classifier: Development Status :: 2 - Pre-Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
21
+ Classifier: Topic :: Utilities
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: markdown-it-py>=3.0
24
+ Provides-Extra: duckdb
25
+ Requires-Dist: duckdb>=1.1; extra == 'duckdb'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # mdpeek
29
+
30
+ Progressive exposure for markdown: navigate large markdown files (and URLs) by
31
+ section, without loading the whole document into context.
32
+
33
+ Work in progress.
mdpeek-0.0.1/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # mdpeek
2
+
3
+ Progressive exposure for markdown: navigate large markdown files (and URLs) by
4
+ section, without loading the whole document into context.
5
+
6
+ Work in progress.
@@ -0,0 +1,31 @@
1
+ """Nox sessions for matrix testing across Python versions.
2
+
3
+ Run all default sessions:
4
+ uv run nox
5
+
6
+ Run tests against a single Python version:
7
+ uv run nox -s tests-3.14
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import nox
13
+
14
+ nox.options.default_venv_backend = "uv"
15
+ nox.options.reuse_existing_virtualenvs = True
16
+ nox.options.sessions = ["tests"]
17
+
18
+ PYTHON_VERSIONS = ["3.11", "3.12", "3.13", "3.14"]
19
+
20
+
21
+ @nox.session(python=PYTHON_VERSIONS)
22
+ def tests(session: nox.Session) -> None:
23
+ """Run the test suite against a single Python version."""
24
+ session.run_install(
25
+ "uv",
26
+ "sync",
27
+ "--active",
28
+ "--group=dev",
29
+ env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
30
+ )
31
+ session.run("pytest", *session.posargs)
@@ -0,0 +1,83 @@
1
+ [project]
2
+ name = "mdpeek"
3
+ dynamic = ["version"]
4
+ description = "Progressive exposure for markdown: navigate large documents by section and query their tables"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ authors = [
10
+ { name = "Jon Grace-Cox", email = "30441316+jongracecox@users.noreply.github.com" },
11
+ ]
12
+ keywords = ["markdown", "cli", "llm", "agents", "context", "claude-code"]
13
+ classifiers = [
14
+ "Development Status :: 2 - Pre-Alpha",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Topic :: Text Processing :: Markup :: Markdown",
23
+ "Topic :: Utilities",
24
+ ]
25
+ dependencies = [
26
+ "markdown-it-py>=3.0",
27
+ ]
28
+
29
+ [project.optional-dependencies]
30
+ duckdb = ["duckdb>=1.1"]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/jongracecox/mdpeek"
34
+ Issues = "https://github.com/jongracecox/mdpeek/issues"
35
+ Repository = "https://github.com/jongracecox/mdpeek"
36
+
37
+ [project.scripts]
38
+ mdpeek = "mdpeek.cli:main"
39
+
40
+ [build-system]
41
+ requires = ["hatchling", "hatch-vcs"]
42
+ build-backend = "hatchling.build"
43
+
44
+ [tool.hatch.version]
45
+ source = "vcs"
46
+ fallback-version = "0.0.0"
47
+
48
+ [tool.hatch.version.raw-options]
49
+ local_scheme = "no-local-version"
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["src/mdpeek"]
53
+
54
+ [dependency-groups]
55
+ dev = [
56
+ "pytest>=9.0.2",
57
+ "pytest-cov>=7.0.0",
58
+ "pytest-bdd>=8.1.0",
59
+ "ty",
60
+ "nox>=2025.5.1",
61
+ ]
62
+
63
+ [tool.ruff]
64
+ line-length = 100
65
+ target-version = "py311"
66
+
67
+ [tool.ruff.lint]
68
+ select = ["E", "F", "W", "I", "UP", "B", "SIM", "RUF"]
69
+
70
+ [tool.pytest.ini_options]
71
+ testpaths = ["tests", "src"]
72
+ addopts = ["--doctest-modules", "--strict-markers", "-v", "--cov=mdpeek", "--cov-report=term-missing"]
73
+ pythonpath = ["src"]
74
+
75
+ [tool.coverage.run]
76
+ source = ["src/mdpeek"]
77
+
78
+ [tool.coverage.report]
79
+ show_missing = true
80
+ exclude_lines = [
81
+ "if __name__ == .__main__.",
82
+ "pragma: no cover",
83
+ ]
@@ -0,0 +1,10 @@
1
+ """mdpeek: progressive exposure for markdown documents."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("mdpeek")
7
+ except PackageNotFoundError: # pragma: no cover - only when running from an uninstalled tree
8
+ __version__ = "0.0.0"
9
+
10
+ __all__ = ["__version__"]
@@ -0,0 +1,3 @@
1
+ from mdpeek.cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,30 @@
1
+ """Command-line interface for mdpeek."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+ from collections.abc import Sequence
8
+
9
+ from mdpeek import __version__
10
+
11
+
12
+ def build_parser() -> argparse.ArgumentParser:
13
+ parser = argparse.ArgumentParser(
14
+ prog="mdpeek",
15
+ description="Progressively expose a markdown document by section.",
16
+ )
17
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
18
+ parser.add_argument("source", nargs="?", help="Markdown file path, URL, or '-' for stdin")
19
+ return parser
20
+
21
+
22
+ def main(argv: Sequence[str] | None = None) -> int:
23
+ """Run the CLI and return the process exit code."""
24
+ parser = build_parser()
25
+ args = parser.parse_args(argv)
26
+ if args.source is None:
27
+ parser.print_usage(sys.stderr)
28
+ return 2
29
+ print("mdpeek: document views are not implemented yet", file=sys.stderr)
30
+ return 2
@@ -0,0 +1,16 @@
1
+ import pytest
2
+
3
+ from mdpeek import __version__
4
+ from mdpeek.cli import main
5
+
6
+
7
+ def test_version_flag_prints_version(capsys: pytest.CaptureFixture[str]) -> None:
8
+ with pytest.raises(SystemExit) as exc:
9
+ main(["--version"])
10
+ assert exc.value.code == 0
11
+ assert capsys.readouterr().out.strip() == f"mdpeek {__version__}"
12
+
13
+
14
+ def test_missing_source_is_usage_error(capsys: pytest.CaptureFixture[str]) -> None:
15
+ assert main([]) == 2
16
+ assert "usage: mdpeek" in capsys.readouterr().err