36 Commits
Author SHA1 Message Date
mroberts 70188eb4ea fix(git): use jj as diff source in jujutsu repos
In a colocated jj repo, jj does not maintain git's index for git's own
consumption. git can therefore report an unmodified tracked file as a
whole-file add: for tests/integration/test_texttoentities_endpoint.py in
the IO repo, `git ls-tree HEAD` and `git ls-files -s` both showed the same
blob, yet `git status` reported `AM` and `git diff --cached --unified=0`
emitted a single `@@ -0,0 +1,330 @@` hunk.

shush treats every line in that hunk as agent-changed, so `--changes-only`
stripped all six comments from a file the agent had never touched (`jj diff`
confirmed 0 insertions). Diffing against HEAD instead of the index does not
help: it is poisoned the same way.

jj is authoritative when present, so DetectRepo now prefers `jj root` and
the three change queries route to `jj diff --git --context=0`. jj has no
staging area, so --staged, --unstaged and --changes-only all resolve to the
working-copy change; GetChangesOnly short-circuits so files are not
duplicated across the staged and unstaged passes.

Empty line ranges are overloaded to mean "process the whole file" (untracked
semantics). A deletion-only change parses to zero ranges, which would have
made shush strip an entire file whose only edit removed lines, so such files
are now skipped. New files still get correct full-file ranges from jj's
`@@ -0,0 +1,N @@` hunk, so they do not need the fallback.

Pagers are disabled explicitly on every git and jj invocation so output
stays machine-parseable regardless of the user's config.
2026-07-21 15:07:46 -05:00
mroberts bb963169dd feat(hooks): add --hook-output flag reporting removed comments
Emits Claude Code PostToolUse JSON so automated comment removal is
announced in-context instead of appearing as a silent mutation.
--install-hook now writes 'shush --changes-only --hook-output'.

Bump version to 0.6.0.
2026-07-17 12:42:41 -05:00
mroberts 59c48a36cb feat(config): preserve doc-style comments by default
Strip pass was eating JSDoc/Javadoc blocks. Add default preserve
patterns for /** blocks, /*! banners, /// and //! line docs.
Opt out by overriding preserve in .shush.toml.
2026-07-08 13:24:29 -05:00
mroberts 480aebfcd0 feat(config): preserve lint/tool directives by default across supported languages 2026-07-03 09:00:21 -05:00
mroberts 85f83a8aaf test(languages): tier-1 language comment-removal goldens 2026-07-02 09:20:06 -05:00
mroberts 2f37640302 feat(languages): register tier-1 languages and chroma routing 2026-07-02 09:20:06 -05:00
mroberts fda9a8a295 fix(processor): annotate every removed line in multi-line preview windows 2026-07-02 09:20:06 -05:00
mroberts b07ea41c60 test(processor): multi-line golden fixtures; route .sass through SCSS lexer 2026-07-02 09:20:06 -05:00
mroberts bbc49efbfe feat(processor): route preview paths through StripComments 2026-07-02 09:20:06 -05:00
mroberts 7ef198016e feat(processor): route mutation paths through StripComments 2026-07-02 09:20:06 -05:00
mroberts 811f1c13ff feat(processor): StripComments chroma engine with legacy fallback 2026-07-02 09:20:06 -05:00
mroberts 82b84c12d2 feat(processor): add chroma dep, lexer resolution and drop rules 2026-07-02 09:20:06 -05:00
mroberts 16fc10c59a test(processor): remove code comments from wholefile_test 2026-07-02 09:20:06 -05:00
mroberts 31619dc7ee test(processor): guard -update against CI misuse; drop agent report md 2026-07-02 09:20:06 -05:00
mroberts 3db4911e7a test(processor): git-mode whole-file and line-range cases 2026-07-02 09:20:06 -05:00
mroberts a117f75bba test(processor): preservation, preserve-lines, backup cases 2026-07-02 09:20:06 -05:00
mroberts 42c46aa2d5 test(processor): single-line block + inline/block flag cases 2026-07-02 09:20:06 -05:00
mroberts d3ab6a41be test(processor): line-comment, string-protection, structure cases 2026-07-02 09:20:06 -05:00
mroberts f51fb3f170 test(processor): whole-file golden driver + seed python cases 2026-07-02 09:20:06 -05:00
mroberts 9e9b292a6f refactor(processor): inject cfg into file-mutating methods 2026-07-02 09:20:06 -05:00
carraes 6e78bc9700 feat: add .shushignore support for flexible file exclusion
- Add .shushignore file support (project root + global ~/.config/.shushignore)
- Support gitignore-style patterns: wildcards (*), directories (dir/), negation (\!pattern)
- Universal integration: works with all processing modes (files, directories, git-aware)
- Smart messaging: explicit ignore messages for direct file access
- Silent skipping: directory traversal automatically skips ignored files
- Enhanced verbose output: distinguishes between ignored vs unsupported files
- Pattern examples: *.tmp, build/, test*.js, \!important.js
2025-07-07 15:39:20 -03:00
carraes d2dc3d8c36 feat: add context lines for preview mode with intelligent truncation
- Add --context-lines (-c) flag to control preview context display
- Add context_lines option to .shush.toml configuration
- Implement lazy-git style preview with context lines around changes
- Add intelligent truncation with "..." markers for distant changes
- Improve context line colors from dark gray to light for better visibility on dark terminals
- Support both regular and git-aware preview modes
- Default to 3 context lines, configurable via flag or config file
- Use -c 0 to show only changed lines (original behavior)
2025-07-07 14:36:58 -03:00
carraes 79b20776fc feat: update acronym to 'Hushing' and fix backup creation bug
- Update SHUSH acronym from 'Hiding' to 'Hushing' (better reflects removal)
- Fix critical error handling bug in file backup creation using io.Copy
- Remove golangci-lint references from Makefile and CLAUDE.md
- Update README, LLM guide, and CLI description with new acronym
- Create TASKS.md to track project improvements
2025-07-07 09:31:37 -03:00
carraes 8152e62cf5 feat: add support for 30+ languages and update README
- Add support for Rust, C#, PHP, Swift, Kotlin, SQL
- Add support for HTML, XML, CSS, SCSS markup languages
- Add support for JSX/TSX, Dart, Scala
- Add support for shell variants, config files, and more
- Add AlternateLineComment support for INI files
- Update README with comprehensive language tables
- Bump version to 0.2.1
2025-07-06 22:02:41 -03:00
carraes fae70c6b2b style: apply code formatting and linting fixes
- Remove unnecessary blank lines and improve spacing
- Fix linting warnings (remove redundant nil checks)
- Standardize indentation and formatting
- No functional changes, only style improvements
2025-07-06 12:01:32 -03:00
carraes ea1a50ba33 test(processor): fix and enhance string-aware parsing tests
- Fix broken string literals in test cases (caused by previous shush bug)
- Add comprehensive tests for all supported comment types
- Add edge case tests for string literals with comment markers
- Verify --inline, --block, and no-flag behaviors
- All tests now passing with improved coverage
2025-07-06 12:01:22 -03:00
carraes 64231c18fc fix(processor): implement universal string-aware comment parsing
- Fix block comment start detection to use string-aware parsing
- Fix block comment end detection to use string-aware parsing
- Fix lineHasComment to use string-aware parsing instead of strings.Contains
- Prevents removal of comment markers inside string literals
- Protects all supported languages: Go, JS, Python, Lua, etc.
2025-07-06 12:01:15 -03:00
carraes 70a2dd7612 fix(processor): preserve indentation and implement proper line deletion 2025-07-06 11:21:24 -03:00
carraes 28501c6823 refactor(processor): migrate from sed to unified in-memory processing 2025-07-06 11:21:24 -03:00
carraes 39e3c27f34 fix(processor): add string-aware comment detection to prevent URL corruption
- Implement findCommentIndex function that respects string boundaries
- Preserve URLs and strings containing '//' (e.g., https://example.com)
- Handle escaped quotes and multiple quote types (single, double, backtick)
- Prevent data corruption in config files and code containing URLs
2025-07-06 09:04:19 -03:00
carraes ca7821b015 fix(processor): resolve syntax errors in sed command generation
- Fix broken string literals in buildSedCommand function
- Ensure proper sed command formatting for both line and block comments
2025-07-05 23:44:21 -03:00
carraes 20135b3a7f feat(processor): integrate config-based comment preservation in git mode
- Load .shush.toml configuration for pattern-based comment preservation
- Add preserved comment tracking and display in dry-run output
- Enhance preview with cyan 'P' indicators for preserved comments
- Add preserved count to summary statistics and totals
- Support both line and block comment preservation based on patterns
2025-07-05 23:43:59 -03:00
carraes 801c55b07d style: fix formatting consistency in languages.go 2025-07-05 22:28:39 -03:00
carraes 79b6d28791 feat(processor): add git-aware comment removal with line-based processing
- Add processGitChanges() for git-aware operation routing
- Implement line-based comment removal with precise targeting
- Add GitTotals tracking for comprehensive dry-run reporting
- Create showGitPreviewWithTotals() with enhanced preview display
- Fix spacing preservation (only trim when comments are removed)
- Include comprehensive test suite for comment removal logic
2025-07-05 22:28:27 -03:00
carraes 8fdfbc7f06 fix: preserve blank lines while removing comments
- Remove comment-only lines completely
- Strip inline comments but preserve the line
- Keep original blank lines intact
- Maintain file structure and spacing
- Update version to 0.1.1
2025-07-03 14:30:30 -03:00
carraes 37bbe92319 feat: refactor to proper Go structure and add folder/recursive support
- Refactor to cmd/internal structure following Go best practices
- Add support for processing directories (files in folder)
- Add -r/--recursive flag for recursive directory traversal
- Split code into logical packages: types, processor, languages
- Fix --version flag to work properly with kong
- Update build path in GitHub Actions workflow
- Version bump to 0.1.0 for new major features
2025-07-03 14:25:18 -03:00