Skip to content

Conversation

@qxprakash
Copy link
Contributor


Key Features and Implementations:

1. Extended EmbedArgs:

Enhanced EmbedArgs to support five scenarios:

  • Git + Path: Clones the default branch and fetches the latest commit.
  • Git + Path + Branch: Clones a specified branch and fetches the latest commit.
  • Git + Path + Commit: Clones and checks out to a specific commit hash.
  • Git + Path + Tag: Clones and checks out to a specified tag.
  • Internal Nested Files: Previous flow intact

2. Improved Snippet Handling:

New Flow:

  • Entire files are now stored as snippets, enabling efficient parsing and embedding.
  • Supports embedding entire files directly when identifiers are not provided by the user.

Caching and Optimization:

  • Before cloning a repo, a unique file name is generated based on arguments (git, branch/tag/commit, path).
  • Snippets are saved in the .snippets directory.
  • File content hashes are compared with snippet hashes to prevent unnecessary updates.
  • Introduced DOCIFY_DISABLE_UPDATES to disable updates when unnecessary.

Edge Case Handling:

  • Added validation for file paths:
    • Prohibited paths starting with ../.
    • For Git URLs, paths starting with .. or / are forbidden.
  • Addressed Git URL edge cases by stripping .git suffixes to avoid hash mismatches.
  • Added helpful error messages for all edge cases.

let me know if any other changes are required.

With Regards
Prakash

…in that case throw an error that please pass the correct source file path
…h , still need to handle the case where both branch and commit hash is provided
…t , either one of commit , branch , tag can only be passed with git , also added validation check that none of tag , commit , branch be passed without specifying git argument
…, so in that case created snippet path without commit
@sam0x17
Copy link
Owner

sam0x17 commented Dec 16, 2024

this looks great, I will add docs and merge this shortly!

@sam0x17 sam0x17 merged commit 4db4825 into sam0x17:main Feb 20, 2025
4 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.

2 participants