Skip to content

Feat/env - #5

Merged
s3bc40 merged 10 commits into
mainfrom
feat/env
Mar 26, 2026
Merged

Feat/env#5
s3bc40 merged 10 commits into
mainfrom
feat/env

Conversation

@s3bc40

@s3bc40 s3bc40 commented Mar 26, 2026

Copy link
Copy Markdown
Owner

Extract pure-Rust logic into pub(crate) functions so cargo test can
reach them. PyO3 module becomes thin wrappers via #[pymodule_export].
Add regex and ignore crate deps for pattern matching and gitignore-
aware directory walking. Add rlib to crate-type and tempfile dev-dep
to enable cargo test.


Three checks: .gitignore presence and advisory entry audit (Python),
.env vs .env.example key drift (Rust via diff_env_files), secret
pattern detection in committed files (Rust via scan_secrets).

CLI: PATH arg, --strict (warnings as errors), --quiet (plain text).
Graceful degradation when Rust extension is unavailable.
Type stubs (_devbrief_core.pyi) and py.typed PEP 561 marker added
so IDEs resolve EnvDiff / SecretMatch return types.


Python tests cover all three checks via mocked Rust functions:
gitignore present/missing/missing-entries, env drift missing-key/
undocumented/clean/missing-files, scan_secrets match/no-match/
binary/gitignored, summary line, --strict and --quiet flags.

Manual QA (tests/MANUAL_QA.md): 12 terminal scenarios for the full
integration path, including secret-in-gitignored-file and --strict.


ci.yml: install dtolnay/rust-toolchain@stable and uv run maturin
develop before pytest; activate rust-check job (clippy + cargo test)
with PYO3_BUILD_EXTENSION_MODULE=1 to avoid libpython linking on
hosts where it is not a shared lib.

release-wheels.yml: new workflow triggered on v* tags; builds
maturin wheels for linux/macos/windows x py3.12/py3.13, plus sdist,
then publishes via OIDC trusted publishing (no API token).


Remove pyo3/extension-module from [tool.maturin] features — deprecated
in PyO3 0.27; maturin >=1.9.4 sets PYO3_BUILD_EXTENSION_MODULE
automatically during extension builds. Removing it also unblocks
cargo test which previously could not link without libpython.


Reads the installed package version via importlib.metadata so the
output stays in sync with pyproject.toml without any hardcoding.
is_eager=True ensures the flag is processed before subcommand
routing, making devbrief --version work standalone.

s3bc40 and others added 7 commits March 26, 2026 10:31
Extract pure-Rust logic into pub(crate) functions so cargo test can
reach them. PyO3 module becomes thin wrappers via #[pymodule_export].
Add regex and ignore crate deps for pattern matching and gitignore-
aware directory walking. Add rlib to crate-type and tempfile dev-dep
to enable cargo test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, secret scan

Three checks: .gitignore presence and advisory entry audit (Python),
.env vs .env.example key drift (Rust via diff_env_files), secret
pattern detection in committed files (Rust via scan_secrets).

CLI: PATH arg, --strict (warnings as errors), --quiet (plain text).
Graceful degradation when Rust extension is unavailable.
Type stubs (_devbrief_core.pyi) and py.typed PEP 561 marker added
so IDEs resolve EnvDiff / SecretMatch return types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Python tests cover all three checks via mocked Rust functions:
gitignore present/missing/missing-entries, env drift missing-key/
undocumented/clean/missing-files, scan_secrets match/no-match/
binary/gitignored, summary line, --strict and --quiet flags.

Manual QA (tests/MANUAL_QA.md): 12 terminal scenarios for the full
integration path, including secret-in-gitignored-file and --strict.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ci.yml: install dtolnay/rust-toolchain@stable and uv run maturin
develop before pytest; activate rust-check job (clippy + cargo test)
with PYO3_BUILD_EXTENSION_MODULE=1 to avoid libpython linking on
hosts where it is not a shared lib.

release-wheels.yml: new workflow triggered on v* tags; builds
maturin wheels for linux/macos/windows x py3.12/py3.13, plus sdist,
then publishes via OIDC trusted publishing (no API token).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ule feature

Remove pyo3/extension-module from [tool.maturin] features — deprecated
in PyO3 0.27; maturin >=1.9.4 sets PYO3_BUILD_EXTENSION_MODULE
automatically during extension builds. Removing it also unblocks
cargo test which previously could not link without libpython.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
README: add devbrief env to intro, Usage section, and project
structure; document --strict/--quiet flags, exit codes, and the
Rust-backed secret scanner; add Rust to dev prerequisites and
document cargo test command with PYO3_BUILD_EXTENSION_MODULE=1.

CLAUDE.md: mark devbrief env IN PROGRESS v0.4.0; document Rust
testing setup (rlib + PYO3_BUILD_EXTENSION_MODULE); tick task #8.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reads the installed package version via importlib.metadata so the
output stays in sync with pyproject.toml without any hardcoding.
is_eager=True ensures the flag is processed before subcommand
routing, making `devbrief --version` work standalone.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@s3bc40 s3bc40 self-assigned this Mar 26, 2026
@s3bc40 s3bc40 added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 26, 2026
s3bc40 and others added 3 commits March 26, 2026 11:13
- Replace splitn(2, '=') with split('=') (needless_splitn)
- Replace iter().any(|&b| b == 0) with contains(&0) (manual_contains)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ensures local dev automatically has the same toolchain and components
as CI without manual rustup component add invocations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two missing semicolons on early-return EnvDiff structs and one
long assert! reformatted to multi-line by rustfmt.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@s3bc40
s3bc40 merged commit 775bf81 into main Mar 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant