Skip to content

Allow --force-create to overwrite existing doc version snapshots#247

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/add-version-snapshots
Draft

Allow --force-create to overwrite existing doc version snapshots#247
Copilot wants to merge 2 commits intomasterfrom
copilot/add-version-snapshots

Conversation

Copy link

Copilot AI commented Mar 9, 2026

Previously, generating documentation with --doc-version for an already-existing version always threw DuplicateDocVersionNameException — there was no way to update/overwrite a version snapshot.

Changes

  • DocVersionManager: Added forceCreate parameter. When true and the version already exists, removes it from versions.json and deletes its directory before regenerating.
  • RazorTemplateProcessor: Added forceCreate field; passes it to DocVersionManager. Reordered initialization so DocVersionManager is created before the version directory (enabling cleanup before recreation).
  • DefaultTemplateProcessor / Program.cs: Threads forceCreate through from config to the template processor stack.

Usage

# Initial snapshot
refdocgen MyLibrary.dll --doc-version v1.0

# Overwrite existing snapshot
refdocgen MyLibrary.dll --doc-version v1.0 --force-create

Tests

Added DocVersionManagerTests with unit tests covering: exception on duplicate without forceCreate, no exception with forceCreate, old directory deletion, and version list cleanup.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add version snapshots</issue_title>
<issue_description>## Description

Introduce a feature to create automatic version snapshots of documentation. This enhancement will help keep track of changes over time, allowing users to compare and revert if needed. </issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

… versions

Co-authored-by: VL-CZ <30175078+VL-CZ@users.noreply.github.com>
Copilot AI changed the title [WIP] Add feature for automatic version snapshots of documentation Allow --force-create to overwrite existing doc version snapshots Mar 9, 2026
Copilot finished work on behalf of VL-CZ March 9, 2026 13:46
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.

Add version snapshots

2 participants