Add data privacy layer with binary exclusion and context preview#2
Merged
leandigital merged 4 commits intomainfrom Feb 24, 2026
Merged
Conversation
…and context preview - Add ContentRedactor utility for secret/PII pattern redaction before LLM calls - Add LeanIgnore with .leanignore support, sensitive file defaults, binary file exclusion (images, fonts, media, archives, documents, compiled), and centralized default directory ignores (node_modules, dist, build, .git, etc.) - Add context preview with pre-send confirmation prompt (--dry-run, --yes) - Integrate privacy flags (--yes, --no-redact, --include-sensitive) into all commands: docs, analyze, full, update, summary, ai-helper - Wire redaction and ignore patterns through contextGatherer and llmOrchestrator - Document Data Privacy & Scrubbing section in README with all exclusion categories - Bump version to 1.2.0
1. Rename --no-redact to --skip-redact across all 6 commands Commander.js interprets --no-<name> as negation of a boolean <name>, so --no-redact was creating options.redact instead of options.noRedact, making the flag silently non-functional. 2. Route getPackageJsonContent/getRequirementsTxtContent through readFileContent These methods were reading files with raw fs.readFile, bypassing the redactor. Private registry tokens or credentials would be sent unredacted. 3. Add missing await on showContextWarningAndConfirm in dry-run paths Four commands called the async function without await, causing non-deterministic output ordering in dry-run mode.
- GENERIC_SECRET: add upper bound {8,128} to prevent greedy over-matching
of code like schema validators and interface definitions
- PHONE: require separators between digit groups (not just optional) and
add \b word boundaries to avoid matching numeric IDs and timestamps
- IP_ADDRESS: broaden private range exclusions to cover full 10.0.0.0/8,
172.16.0.0/12, 127.0.0.0/8, and all 255.255.255.x subnet masks
- Remove duplicate directory patterns from contextGatherer glob calls
now that DEFAULT_IGNORE_PATTERNS is centralized in leanignore.ts
The test was missing mocks for gatherContextPreview and showContextWarningAndConfirm, causing process.exit(1) in CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[REDACTED:TYPE]markers before sending to LLM providers.leanignorefile support (.gitignoresyntax) plus centralized default exclusion lists — sensitive files, binary files (images, fonts, media, archives, documents, compiled), and common non-source directories (node_modules,dist,.git, etc.)--dry-runfor preview-only and--yesfor auto-confirm--yes,--no-redact,--include-sensitive) added to all 6 commands (docs, analyze, full, update, summary, ai-helper)Test plan
npm run buildpasseslean-intel docs --dry-run -p <project> --yesshows no binary files (.webp,.jpg,.woff) in file type breakdownlean-intel docs --dry-run -p <project>shows context preview with confirmation promptlean-intel docs --dry-run -p <project> --yesauto-confirms.leanignorefile entries are respected when present--no-redactflag disables redaction--include-sensitiveflag includes.envfiles