Skip to content

feat: control Git commit creation in anchor init (fixes #23)#33

Merged
Tanishq1030 merged 1 commit into
mainfrom
feature/issue-23-git-commit-control
Jul 10, 2026
Merged

feat: control Git commit creation in anchor init (fixes #23)#33
Tanishq1030 merged 1 commit into
mainfrom
feature/issue-23-git-commit-control

Conversation

@Tanishq1030

Copy link
Copy Markdown
Member

Description

This PR separates Anchor project initialization from automatic Git operations during anchor init, giving the developer explicit control over version control modifications.

Acceptance Criteria

  • Remove automatic commit creation during anchor init.
  • Require explicit confirmation before performing Git operations.
  • Continue generating all Anchor project files regardless of Git choice.
  • Preserve existing initialization behavior for non-Git projects.
  • Documentation updated to describe the new workflow.

Changes

  • CLI (anchor/cli.py):
    • Replaced automatic Git commit generation with an interactive prompt at the end of the initialization step:
      Anchor has finished initialization.
      Would you like to create an initial governance commit? [Y/n]
      
    • If the user approves, stages the configuration and manifest files (.gitignore, .pre-commit-config.yaml, .anchor/ directory) and runs the initial commit.
    • If the user declines, no version control operations are performed.
    • Dynamically updates the console initialization summary based on whether the initial commit was selected.
  • Unit Tests (tests/unit/test_init_git.py): Added a test suite using mocked click callbacks and system properties:
    • Validates Git commit creation and file staging when the prompt is accepted.
    • Validates that version control remains untouched when the prompt is declined.

Related Issues

Fixes #23

Copilot AI review requested due to automatic review settings July 10, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Tanishq1030
Tanishq1030 merged commit 29f1014 into main Jul 10, 2026
1 check 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.

Require Explicit User Confirmation Before Modifying Git State

2 participants