Skip to content

Commit 95ff9c9

Browse files
CAP-9512 Use Git for workflows init copy (#347)
GitOrigin-RevId: fd82f61a9e5005d02739527f27d414df568326bb
1 parent 51e0396 commit 95ff9c9

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

cmd/workflowinit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func init() {
213213
workflowInitCmd.Flags().String("template", "", "Template to scaffold (defaults to the repo's default template)")
214214
workflowInitCmd.Flags().String("dir", "", "Output directory (default: workflows-demo)")
215215
workflowInitCmd.Flags().Bool("install-deps", false, "Install dependencies after scaffolding")
216-
workflowInitCmd.Flags().Bool("git", false, "Initialize a git repository")
216+
workflowInitCmd.Flags().Bool("git", false, "Initialize a Git repository")
217217
workflowInitCmd.Flags().Bool("install-agent-skill", false, "Install the Workflows agent skill for detected AI coding tools")
218218

219219
// --output doesn't apply to this command (output is always text/interactive)

cmd/workflowinit_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,7 @@ func TestFormatNextSteps_InterpolatesDirPlaceholder(t *testing.T) {
107107
assert.NotContains(t, out, "{{dir}}")
108108
assert.Contains(t, out, "./my-workflows")
109109
}
110+
111+
func TestWorkflowInitCmd_GitFlagUsesGitNaming(t *testing.T) {
112+
assert.Equal(t, "Initialize a Git repository", workflowInitCmd.Flag("git").Usage)
113+
}

cmd/workflowinitrunner.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func (r *WorkflowInitRunner) Run(ctx context.Context, input WorkflowInitInput) e
356356
form := huh.NewForm(
357357
huh.NewGroup(
358358
huh.NewSelect[string]().
359-
Title("Initialize a new git repository?").
359+
Title("Initialize a new Git repository?").
360360
Description("(optional)").
361361
Options(
362362
huh.NewOption("Yes", "yes"),
@@ -428,7 +428,7 @@ func (r *WorkflowInitRunner) Run(ctx context.Context, input WorkflowInitInput) e
428428
steps = append(steps, SetupStep{
429429
Label: "Git repository initialized",
430430
FailLabel: "Git initialization failed",
431-
ActiveLabel: "Initializing git repository...",
431+
ActiveLabel: "Initializing Git repository...",
432432
Run: func() error {
433433
gitDir := filepath.Join(absDir, ".git")
434434
if _, statErr := os.Stat(gitDir); !os.IsNotExist(statErr) {
@@ -462,7 +462,7 @@ func (r *WorkflowInitRunner) Run(ctx context.Context, input WorkflowInitInput) e
462462
command.Println(r.cmd, " %s Dependencies installed", ok.Render("✓"))
463463
}
464464
if gitInitialized {
465-
command.Println(r.cmd, " %s Initialized git repository", ok.Render("✓"))
465+
command.Println(r.cmd, " %s Initialized Git repository", ok.Render("✓"))
466466
}
467467
}
468468

cmd/workflowinitrunner_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,21 @@ func TestRunnerNonInteractive_GitInitErrorIsFatal(t *testing.T) {
243243
assert.Contains(t, err.Error(), "git not installed")
244244
}
245245

246+
func TestRunnerNonInteractive_GitSummaryUsesGitNaming(t *testing.T) {
247+
runner, output := newNonInteractiveRunner(&mockInitDeps{})
248+
249+
dir := t.TempDir() + "/output"
250+
err := runner.Run(context.Background(), WorkflowInitInput{
251+
Language: "python",
252+
Dir: dir,
253+
Git: true,
254+
})
255+
require.NoError(t, err)
256+
257+
assert.Contains(t, output.String(), "Initialized Git repository")
258+
assert.NotContains(t, output.String(), "Initialized git repository")
259+
}
260+
246261
func TestRunnerNonInteractive_LocalRepoOverrideSkipsClone(t *testing.T) {
247262
cloneCalled := false
248263
deps := &mockInitDeps{

0 commit comments

Comments
 (0)