Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions cmd/orbit/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,20 +327,27 @@ func formatDuration(d time.Duration) string {
func readSpecContext(specDir string) string {
var parts []string

// Key spec files to include
// Key spec files to include (with fallback alternatives)
specFiles := []struct {
name string
names []string
label string
}{
{"requirements.md", "Requirements"},
{"design.md", "Design"},
{"tasks.md", "Tasks"},
{[]string{"requirements.md"}, "Requirements"},
{[]string{"design.md"}, "Design"},
{[]string{"tasks.md", "TASKS.md"}, "Tasks"},
}

for _, sf := range specFiles {
path := filepath.Join(specDir, sf.name)
content, err := os.ReadFile(path)
if err != nil {
var content []byte
for _, name := range sf.names {
path := filepath.Join(specDir, name)
var err error
content, err = os.ReadFile(path)
if err == nil {
break
}
}
if content == nil {
continue // Skip files that don't exist
}

Expand Down
16 changes: 16 additions & 0 deletions cmd/orbit/compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,19 @@ func runCmd(t *testing.T, dir string, name string, args ...string) {
t.Fatalf("%s %v failed: %v\n%s", name, args, err, out)
}
}

// TestReadSpecContext_UppercaseTasksFile verifies that readSpecContext picks up
// TASKS.md when tasks.md does not exist (T-1008).
func TestReadSpecContext_UppercaseTasksFile(t *testing.T) {
specDir := t.TempDir()

// Create only TASKS.md (uppercase)
if err := os.WriteFile(filepath.Join(specDir, "TASKS.md"), []byte("# Tasks\n- task 1"), 0o644); err != nil {
t.Fatal(err)
}

result := readSpecContext(specDir)
if !strings.Contains(result, "# Tasks") {
t.Fatalf("expected TASKS.md content in spec context, got: %q", result)
}
}
23 changes: 15 additions & 8 deletions internal/orbit/comparison.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,20 +312,27 @@ func (o *Orbit) generateReport(ctx context.Context, allFailed bool) error {
func (o *Orbit) readSpecContext() string {
var parts []string

// Key spec files to include
// Key spec files to include (with fallback alternatives)
specFiles := []struct {
name string
names []string
label string
}{
{"requirements.md", "Requirements"},
{"design.md", "Design"},
{"tasks.md", "Tasks"},
{[]string{"requirements.md"}, "Requirements"},
{[]string{"design.md"}, "Design"},
{[]string{"tasks.md", "TASKS.md"}, "Tasks"},
}

for _, sf := range specFiles {
path := filepath.Join(o.config.SpecDir, sf.name)
content, err := os.ReadFile(path)
if err != nil {
var content []byte
for _, name := range sf.names {
path := filepath.Join(o.config.SpecDir, name)
var err error
content, err = os.ReadFile(path)
if err == nil {
break
}
}
if content == nil {
continue // Skip files that don't exist
}

Expand Down
Loading