Commit 0adcf77
committed
Port bbs2gh generate-script command
Port the bbs2gh generate-script command from C# to Go, generating
PowerShell migration scripts for Bitbucket Server to GitHub migrations.
Implementation:
- generateScriptBbsAPI interface with GetProjects/GetRepos methods
- bbsGenerateScriptArgs struct matching all C# command flags
- newGenerateScriptCmd (testable) and newGenerateScriptCmdLive (production)
- genScriptBbsClientAdapter bridging bbs.Client to consumer-defined interface
- runBbsGenerateScript with validation matching C# (no-ssl-verify, AWS+GH storage conflicts)
- generateBbsScript iterating projects/repos with optional --bbs-project filter
- bbsMigrateRepoScript building per-repo gh bbs2gh migrate-repo commands
- Extracted bbsWriteTargetOptions, bbsWriteSSHOptions, bbsWriteSMBOptions,
bbsWriteTrailingFlags to keep cyclomatic complexity under threshold
- BBS-specific validation constants (bbsValidateBBSUsername, bbsValidateBBSPassword,
bbsValidateSMBPassword) matching C# inline strings exactly
- bbsAppendLine/bbsAppendBlankLine helpers replicating C# AppendLine semantics
(skip null/whitespace content, always append blank lines)
- bbsReplaceInvalidCharactersWithDash for GitHub repo name sanitization
Tests: All 22 C# GenerateScriptCommandHandlerTests ported and passing.
Wired into cmd/bbs2gh/main.go via newGenerateScriptCmdLive().1 parent bf00f9f commit 0adcf77
3 files changed
Lines changed: 1132 additions & 1 deletion
0 commit comments