Skip to content

fix: 🐛 Project structure creation with bare codeblocks is breaking markdown display and creation #6331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

chezsmithy
Copy link
Contributor

@chezsmithy chezsmithy commented Jun 27, 2025

Description

Claude 4 sonnet is very excited about creating project structure display in readme files. When this was attempted the markdown display was broken and the file output was truncated. This was due file structure being outputted with nested codeblocks without a type attached.

When I orginally implemented a fix to this code I noted that there might be some risky edge cases where the nested code blocks didn't have types. As such this PR should solve for that use case by implementing a look ahead feature to check upcoming code blocks to determine if nesting is starting or we are ending the outer code block nesting early.

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]

I've added a new function for the look ahead checking, and added new tests for that. Then I added a specfic test for the nested structure output that was failing.


Summary by cubic

Fixed an issue where project structure markdown with nested bare codeblocks would break display and truncate output.

  • Bug Fixes
    • Added logic to detect and handle nested bare codeblocks without a type.
    • Updated tests to cover these edge cases.

@chezsmithy chezsmithy requested a review from a team as a code owner June 27, 2025 23:04
@chezsmithy chezsmithy requested review from sestinj and removed request for a team June 27, 2025 23:04
Copy link

netlify bot commented Jun 27, 2025

👷 Deploy request for continuedev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a4e383a

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 27, 2025
@sestinj
Copy link
Contributor

sestinj commented Jun 30, 2025

@chezsmithy There is a failing test, but I do like the PR. Will merge once tests are fixed

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jul 1, 2025
@chezsmithy chezsmithy marked this pull request as draft July 1, 2025 00:45
@chezsmithy
Copy link
Contributor Author

chezsmithy commented Jul 1, 2025

TODO Items:

  • Passing tests
  • Review all ``` and STOP checking to make sure it is looking only for leading backticks or STOP keywords and not catching examples inside of code strings. Thus tests won't generate using these keywords or truncation can occur.
  • Optimize lookahead function for ``` / STOP checking to not scan the whole remainder of the file if we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants