Skip to content

Commit 4eccb87

Browse files
authored
fix(init): change default version from 0.1.0 to 0.0.0 (#206)
* fix(semver): change default init version from 0.1.0 to 0.0.0 * fix(init): use path parameter and mark unused ctx in workspace.go
1 parent 69a7a36 commit 4eccb87

8 files changed

Lines changed: 25 additions & 25 deletions

File tree

cmd/sley/integration_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ func TestIntegration_Init(t *testing.T) {
8888
}
8989

9090
version := readVersionFile(t, dir)
91-
if version != "0.1.0" {
92-
t.Errorf("expected version 0.1.0, got %s", version)
91+
if version != "0.0.0" {
92+
t.Errorf("expected version 0.0.0, got %s", version)
9393
}
9494
})
9595

@@ -109,8 +109,8 @@ func TestIntegration_Init(t *testing.T) {
109109
if err != nil {
110110
t.Fatalf("failed to read custom version file: %v", err)
111111
}
112-
if strings.TrimSpace(string(data)) != "0.1.0" {
113-
t.Errorf("expected version 0.1.0, got %s", string(data))
112+
if strings.TrimSpace(string(data)) != "0.0.0" {
113+
t.Errorf("expected version 0.0.0, got %s", string(data))
114114
}
115115
})
116116
}
@@ -163,8 +163,8 @@ func TestIntegration_Show(t *testing.T) {
163163
}
164164

165165
// Should auto-initialize and show the version
166-
if !strings.Contains(output, "0.1.0") {
167-
t.Errorf("expected output to contain '0.1.0', got %q", output)
166+
if !strings.Contains(output, "0.0.0") {
167+
t.Errorf("expected output to contain '0.0.0', got %q", output)
168168
}
169169
})
170170
}
@@ -537,8 +537,8 @@ func TestIntegration_CustomPath(t *testing.T) {
537537
if err != nil {
538538
t.Fatalf("show failed: %v", err)
539539
}
540-
if output != "0.1.0" {
541-
t.Errorf("expected 0.1.0, got %s", output)
540+
if output != "0.0.0" {
541+
t.Errorf("expected 0.0.0, got %s", output)
542542
}
543543

544544
// Bump at custom path

internal/commands/initialize/initcmd_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ func TestCLI_InitCommand_CreatesFile(t *testing.T) {
4040
}
4141

4242
got := testutils.ReadTempVersionFile(t, tmp)
43-
if got != "0.1.0" {
44-
t.Errorf("expected version '0.1.0', got %q", got)
43+
if got != "0.0.0" {
44+
t.Errorf("expected version '0.0.0', got %q", got)
4545
}
4646

4747
// With --yes flag, output includes config creation message
48-
if !strings.Contains(output, fmt.Sprintf("Created %s with version 0.1.0", versionPath)) {
48+
if !strings.Contains(output, fmt.Sprintf("Created %s with version 0.0.0", versionPath)) {
4949
t.Errorf("expected output to contain version creation message, got: %q", output)
5050
}
5151
}
@@ -822,7 +822,7 @@ func TestInitializeVersionFileWithMigration(t *testing.T) {
822822
t.Error("expected file to be created")
823823
}
824824

825-
// Should have default version (0.1.0 or from git tag)
825+
// Should have default version (0.0.0 or from git tag)
826826
data, _ := os.ReadFile(versionPath)
827827
if string(data) == "" {
828828
t.Error("expected version to be written")

internal/commands/initialize/migration_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,9 @@ func TestCLI_InitCommand_MigrateNoSources(t *testing.T) {
422422
}
423423

424424
version := string(data)
425-
// Should fall back to default (0.1.0)
426-
if version != "0.1.0\n" {
427-
t.Errorf("expected version '0.1.0\\n', got %q", version)
425+
// Should fall back to default (0.0.0)
426+
if version != "0.0.0\n" {
427+
t.Errorf("expected version '0.0.0\\n', got %q", version)
428428
}
429429
}
430430

internal/commands/initialize/workspace.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type DiscoveredModule struct {
2222
// runWorkspaceInit initializes a monorepo/workspace configuration.
2323
func runWorkspaceInit(path string, yesFlag bool, templateFlag, enableFlag string, forceFlag bool) error {
2424
// Step 1: Discover existing .version files in subdirectories
25-
modules, err := discoverVersionFiles(".")
25+
modules, err := discoverVersionFiles(path)
2626
if err != nil {
2727
return fmt.Errorf("failed to discover modules: %w", err)
2828
}
@@ -227,7 +227,7 @@ func writePluginConfig(sb *strings.Builder, pluginName string) {
227227
}
228228

229229
// printWorkspaceSuccessSummary prints the success message for workspace init.
230-
func printWorkspaceSuccessSummary(configCreated bool, plugins []string, modules []DiscoveredModule, ctx *ProjectContext) {
230+
func printWorkspaceSuccessSummary(configCreated bool, plugins []string, modules []DiscoveredModule, _ *ProjectContext) {
231231
if configCreated {
232232
printer.PrintSuccess(fmt.Sprintf("Created .sley.yaml with %d plugin%s and workspace configuration",
233233
len(plugins), tui.Pluralize(len(plugins))))

internal/semver/error_recovery_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func TestVersionManager_InitializeNewFile_Recovery(t *testing.T) {
210210
t.Fatalf("failed to read initialized file: %v", err)
211211
}
212212

213-
// Initialize creates version based on implementation (may start at 0.0.0 or 0.1.0)
213+
// Initialize creates version based on implementation (starts at 0.0.0)
214214
if version.Major != 0 {
215215
t.Errorf("expected initial major version 0, got %d", version.Major)
216216
}

internal/semver/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ func (m *VersionManager) Save(ctx context.Context, path string, version SemVersi
6161
}
6262

6363
// Initialize creates a version file if it doesn't exist.
64-
// It tries to use the latest git tag, or falls back to 0.1.0.
64+
// It tries to use the latest git tag, or falls back to 0.0.0.
6565
func (m *VersionManager) Initialize(ctx context.Context, path string) error {
6666
if _, err := m.fs.Stat(ctx, path); err == nil {
6767
return nil // Already exists
6868
}
6969

70-
version := SemVersion{Major: 0, Minor: 1, Patch: 0} // Default
70+
version := SemVersion{Major: 0, Minor: 0, Patch: 0} // Default
7171

7272
if m.git != nil {
7373
tag, err := m.git.DescribeTags(ctx)

internal/semver/manager_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func TestVersionManager_Initialize_WithoutGitTag(t *testing.T) {
118118
t.Fatal("version file not created")
119119
}
120120

121-
expected := "0.1.0\n"
121+
expected := "0.0.0\n"
122122
if string(data) != expected {
123123
t.Errorf("expected default %q, got %q", expected, string(data))
124124
}

internal/semver/semver_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ func TestInitializeVersionFileWithFeedback(t *testing.T) {
392392
}
393393
})
394394

395-
t.Run("file does not exist, fallback to default 0.1.0", func(t *testing.T) {
395+
t.Run("file does not exist, fallback to default 0.0.0", func(t *testing.T) {
396396
tmp := t.TempDir()
397397
path := filepath.Join(tmp, ".version")
398398

@@ -413,8 +413,8 @@ func TestInitializeVersionFileWithFeedback(t *testing.T) {
413413
// Verify content
414414
data, _ := os.ReadFile(path)
415415
got := strings.TrimSpace(string(data))
416-
if got != "0.1.0" {
417-
t.Errorf("expected 0.1.0, got %q", got)
416+
if got != "0.0.0" {
417+
t.Errorf("expected 0.0.0, got %q", got)
418418
}
419419
})
420420
}
@@ -770,7 +770,7 @@ func TestInitialize_InvalidGitTagFormat(t *testing.T) {
770770

771771
data, _ := os.ReadFile(versionPath)
772772
got := strings.TrimSpace(string(data))
773-
want := "0.1.0"
773+
want := "0.0.0"
774774

775775
if got != want {
776776
t.Errorf("expected fallback version %q, got %q", want, got)

0 commit comments

Comments
 (0)