Skip to content

Add data privacy layer with binary exclusion and context preview#2

Merged
leandigital merged 4 commits intomainfrom
feat/privacy-layer-and-binary-exclusion
Feb 24, 2026
Merged

Add data privacy layer with binary exclusion and context preview#2
leandigital merged 4 commits intomainfrom
feat/privacy-layer-and-binary-exclusion

Conversation

@leandigital
Copy link
Owner

Summary

  • ContentRedactor: New utility that scans file content for secrets (AWS keys, tokens, JWTs, connection strings) and PII (emails, SSNs, phone numbers, IPs), replacing matches with [REDACTED:TYPE] markers before sending to LLM providers
  • LeanIgnore: .leanignore file support (.gitignore syntax) 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.)
  • Context preview: Pre-send confirmation showing file count, total size, file type breakdown, and estimated redactions. Supports --dry-run for preview-only and --yes for auto-confirm
  • CLI integration: Privacy flags (--yes, --no-redact, --include-sensitive) added to all 6 commands (docs, analyze, full, update, summary, ai-helper)
  • README: New "Data Privacy & Scrubbing" section documenting all exclusion categories and privacy flags
  • Version bump to 1.2.0

Test plan

  • npm run build passes
  • lean-intel docs --dry-run -p <project> --yes shows no binary files (.webp, .jpg, .woff) in file type breakdown
  • lean-intel docs --dry-run -p <project> shows context preview with confirmation prompt
  • lean-intel docs --dry-run -p <project> --yes auto-confirms
  • .leanignore file entries are respected when present
  • --no-redact flag disables redaction
  • --include-sensitive flag includes .env files

…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.
@leandigital leandigital merged commit 86da9a0 into main Feb 24, 2026
1 check passed
@leandigital leandigital deleted the feat/privacy-layer-and-binary-exclusion branch February 24, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant