Skip to content

feat: derive project name from git remote instead of directory name#19

Merged
Naoray merged 1 commit into
mainfrom
feat/derive-name-from-remote
Apr 1, 2026
Merged

feat: derive project name from git remote instead of directory name#19
Naoray merged 1 commit into
mainfrom
feat/derive-name-from-remote

Conversation

@Naoray

@Naoray Naoray commented Mar 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • anvil link now derives the project name from the origin remote URL (e.g. git@github.com:Naoray/scribe.gitscribe) instead of using the directory name
  • Falls back to directory name when no remote is configured
  • Shows an info message when the remote-derived name differs from the directory name
  • Updates integration tests to use {{ .DatabaseName }} instead of raw {{ .SiteName }}_{{ .DbSuffix }}, ensuring tests exercise the truncation-safe template variable

Closes #18

Test plan

  • deriveProjectName returns --name flag value when provided
  • deriveProjectName extracts repo name from SSH remote URL
  • deriveProjectName extracts repo name from HTTPS remote URL
  • deriveProjectName falls back to directory name when no remote exists
  • --name flag overrides remote-derived name
  • Integration tests pass with {{ .DatabaseName }} template
  • Full lint passes (golangci-lint run ./...)

🤖 Generated with Claude Code

When no --name flag is provided, anvil link now checks the origin remote
URL before falling back to the directory name. This prevents mismatches
when a repo is cloned into a differently-named folder.

Also updates integration tests to use {{ .DatabaseName }} instead of
the raw {{ .SiteName }}_{{ .DbSuffix }} pattern, ensuring tests exercise
the truncation-safe template variable.

Closes #18

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Naoray Naoray merged commit 51e82a2 into main Apr 1, 2026
8 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.

link: derive project name from git remote instead of directory name

1 participant