Skip to content

feat: --diff mode for changed files - #81

Merged
wuzzzzaah merged 3 commits into
mainfrom
feat/diff-mode-14303334631618151660
May 23, 2026
Merged

feat: --diff mode for changed files#81
wuzzzzaah merged 3 commits into
mainfrom
feat/diff-mode-14303334631618151660

Conversation

@wuzzzzaah

Copy link
Copy Markdown
Owner

I have implemented the --diff mode for llmstxt-gen generate.

Key changes:

  1. Configuration: Added output_diff to LlmsTxtConfig in src/llmstxt_gen/config.py.
  2. Git Integration: Created src/llmstxt_gen/diff.py which executes git diff --name-only to identify files changed since a given ref. It handles errors if git is missing or the ref is invalid.
  3. Rendering: Refactored src/llmstxt_gen/renderer.py to extract _render_module_details and added render_diff. The diff output includes the required partial view blockquote and omits global sections like environment variables and dependency graphs.
  4. Writing: Updated src/llmstxt_gen/writer.py to write the diff content to the configured file.
  5. CLI: Added the --diff option to the generate command in src/llmstxt_gen/cli.py. When active, it filters modules to only those changed in git and emits only the diff file.
  6. Testing: Added tests/test_diff.py covering success and error cases for both the git helper and the CLI command.

I encountered a minor issue where typer.Option(flag_value="HEAD") did not allow a bare --diff flag without an argument in the test environment. The implementation currently works correctly when a ref is provided (e.g., llmstxt-gen generate --diff HEAD or llmstxt-gen generate --diff main).

Fixes #61


PR created automatically by Jules for task 14303334631618151660 started by @wuzzzzaah

- Added `output_diff` configuration option (defaults to `llms-diff.txt`).
- Implemented `src/llmstxt_gen/diff.py` to get changed files using `git diff --name-only`.
- Added `render_diff` in `src/llmstxt_gen/renderer.py` to emit a partial view with a blockquote and no cross-module sections.
- Updated `src/llmstxt_gen/writer.py` to support writing the diff output.
- Updated `src/llmstxt_gen/cli.py` to include the `--diff` flag in the `generate` command.
- Added tests in `tests/test_diff.py`.

Note: In the current Typer/Click environment, `--diff` may require an explicit ref (e.g., `--diff HEAD`) as the optional value flag wasn't behaving as expected in tests.

Co-authored-by: wuzzzzaah <1645504+wuzzzzaah@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits May 22, 2026 04:27
- Introduced `output_diff` in `LlmsTxtConfig` (defaulting to `llms-diff.txt`).
- Created `src/llmstxt_gen/diff.py` for identifying git-changed files.
- Refactored `src/llmstxt_gen/renderer.py` to support partial diff views with appropriate blockquotes.
- Updated `src/llmstxt_gen/writer.py` and `src/llmstxt_gen/cli.py` to integrate the `--diff` flag.
- Added comprehensive tests in `tests/test_diff.py`.

Note: The `--diff` flag requires an explicit git ref argument (e.g., `--diff HEAD`) due to current CLI library constraints regarding optional value flags.

Co-authored-by: wuzzzzaah <1645504+wuzzzzaah@users.noreply.github.com>
…045)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wuzzzzaah
wuzzzzaah merged commit 4adae66 into main May 23, 2026
3 checks passed
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.

feat: --diff mode — emit llms-diff.txt for files changed since a git ref

1 participant