Skip to content

bug: bootstrap overwrites existing files despite "never overwrites" guarantee #449

@jwm4

Description

@jwm4

Bug Description

The user guide (docs/user-guide.md, line 101) states that bootstrap is "Safe by Design" and "Never overwrites existing files." However, only CONTRIBUTING.md and CODE_OF_CONDUCT.md have existence guards. All other generated files are silently overwritten if they already exist:

  • .github/workflows/agentready-assessment.yml
  • .github/workflows/tests.yml
  • .github/workflows/security.yml
  • .github/workflows/repomix-update.yml
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/feature_request.md
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/CODEOWNERS
  • .pre-commit-config.yaml
  • .github/dependabot.yml

Steps to Reproduce

  1. Create a repo with a customized .pre-commit-config.yaml or CODEOWNERS
  2. Run agentready bootstrap .
  3. Observe that the existing file is replaced with the template version

Expected Behavior

Bootstrap should skip any file that already exists, matching the documented guarantee. Ideally it should log a message like "Skipping .pre-commit-config.yaml (already exists)" so the user knows.

Relevant Code

src/agentready/services/bootstrap.py lines 180-189: _write_file() unconditionally opens the file with "w" mode. Only _generate_docs() (lines 166, 173) checks for existing files before writing.

Acceptance Criteria

  • _write_file() or each caller checks for file existence before writing
  • Existing files are never overwritten
  • Skipped files are reported in the output (e.g., "Skipping .pre-commit-config.yaml (already exists)")
  • --dry-run output distinguishes between "would create" and "would skip (exists)"
  • Unit tests verify that existing files are preserved

Submitted by Bill Murdock with assistance from Claude Code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions