Skip to content

Conversation

@regenrek
Copy link
Owner

Summary

  • Fix --include-dir and --include-files to work additively - Previously mutually exclusive, now they combine so you can include specific directories PLUS specific files
  • Support external prompt file paths - Prompts like -p docs/arch/prompt.md now work correctly instead of requiring files in codefetch/prompts/
  • Add XML-structured output format - Output now uses semantic XML tags (<task>, <filetree>, <source_code>) for better AI model parsing

Changes

Core Fixes

  • packages/sdk/src/files.ts - Restructured pattern building to combine includeDirs and includeFiles additively
  • packages/cli/src/commands/default.ts & open.ts - Fixed getPromptFile to handle external file paths
  • packages/sdk/src/template-parser.ts - Added hasCodebasePlaceholder helper
  • packages/sdk/src/markdown.ts - Added XML tags and prepend logic for prompts without placeholder

Tests

  • Added E2E tests for combined --include-dir + --include-files
  • Added sample project in playground/sample-rust-project/ for manual testing
  • Updated token limit tests to account for XML tag overhead

Documentation

  • Updated README with XML output format section
  • Updated README with combined include example
  • Updated all changelogs for v2.2.0

Test Plan

  • SDK tests pass (269 passed)
  • CLI tests pass (119 passed)
  • Manual testing with sample project verified:
    • --include-dir alone works
    • --include-files alone works
    • Both combined work additively
    • External prompt files work
    • Inline prompts work
    • XML tags present in output
    • .gitignore respected
    • .codefetchignore respected

Previously, when both --include-dir and --include-files were specified,
includeFiles would clear the includeDirs patterns, making them mutually
exclusive. Now they combine additively - files from both filters are
included in the output.
- Add integration tests verifying additive behavior of includeDirs + includeFiles
- Add sample-rust-project in playground/ for manual testing
- Tests verify: tree output, prompt, file inclusion, ignores working correctly
…laceholder

- External paths (containing / or \) are now used directly instead of
  being nested under codefetch/prompts/
- Prompts without {{CURRENT_CODEBASE}} placeholder are prepended to
  the codebase content instead of replacing it
- Wrap prompts in <task>...</task> tags
- Wrap file tree in <filetree>...</filetree> tags
- Wrap source code in <source_code>...</source_code> tags

This provides better structure for AI models to understand the different
sections of the codebase output.
- Document XML-structured output format with <task>, <filetree>, <source_code> tags
- Document additive --include-dir and --include-files behavior
- Document external prompt file path support
- Update all changelogs (root, cli, sdk) for v2.2.0
@github-actions
Copy link

github-actions bot commented Nov 27, 2025

🧪 SDK Test Results

All checks passed!

Check Status
Linting ✅ success
Type Check ✅ success
Tests ✅ success
Build ✅ success

View full logs

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 27, 2025

Open in StackBlitz

npm i https://pkg.pr.new/regenrek/codefetch@20
npm i https://pkg.pr.new/regenrek/codefetch/codefetch-sdk@20

commit: c3c1ead

@regenrek regenrek merged commit 92de98e into main Nov 27, 2025
11 checks passed
@regenrek regenrek deleted the fix/include-dirs-and-files-additive branch November 27, 2025 16:51
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.

2 participants