diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7b7f1c54..b476488f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.73" + ".": "0.1.0-alpha.74" } diff --git a/.stats.yml b/.stats.yml index fc492edb..81e34d03 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-c05bce23f6a3478a1803494b2c627e0bbf73917a849756eddc42f4607e167c6b.yml -openapi_spec_hash: b9eb999620220d15b176f815f21a67ba -config_hash: 977c436868252591d86546b2127ab8ce +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-60fccc45e9e7fac02642f763acadcafbd890990992facb1242864364f7c3fa80.yml +openapi_spec_hash: f4a06d91e54ada059445cd7ab63678b3 +config_hash: 4b44da9496c775d2294758cd233f4ecd diff --git a/CHANGELOG.md b/CHANGELOG.md index ae0b65fb..95fb6a81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 0.1.0-alpha.74 (2026-02-25) + +Full Changelog: [v0.1.0-alpha.73...v0.1.0-alpha.74](https://github.com/stainless-api/stainless-api-cli/compare/v0.1.0-alpha.73...v0.1.0-alpha.74) + +### Features + +* add CommitOnly option to build model ([93e3e0c](https://github.com/stainless-api/stainless-api-cli/commit/93e3e0cfb46c70982b70b9768200d8ce992326dd)) +* **api:** manual updates ([5d1a904](https://github.com/stainless-api/stainless-api-cli/commit/5d1a9048221995d8103d5abc945c9a03f1df520a)) +* remove unused dev.TickMsg ([5e5b7cf](https://github.com/stainless-api/stainless-api-cli/commit/5e5b7cfdfc7cb5f1baa72cb2d74b016d7f78558c)) + + +### Bug Fixes + +* fix project creation ([27237e2](https://github.com/stainless-api/stainless-api-cli/commit/27237e28927e936ca9efe213baef180933a050ea)) +* improve error handling in build errors ([c4d1866](https://github.com/stainless-api/stainless-api-cli/commit/c4d186657c0f944a9dc736df4280d8c4fb77fc38)) + + +### Chores + +* **internal:** remove mock server code ([c4dd9e7](https://github.com/stainless-api/stainless-api-cli/commit/c4dd9e705c0e9d7de3df03f42034e7cd9b4322ec)) + ## 0.1.0-alpha.73 (2026-02-20) Full Changelog: [v0.1.0-alpha.72...v0.1.0-alpha.73](https://github.com/stainless-api/stainless-api-cli/compare/v0.1.0-alpha.72...v0.1.0-alpha.73) diff --git a/pkg/cmd/build.go b/pkg/cmd/build.go index d6f61267..09be974d 100644 --- a/pkg/cmd/build.go +++ b/pkg/cmd/build.go @@ -430,8 +430,10 @@ func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error { if waitMode > WaitNone { console.Spacer() + buildModel := cbuild.NewModel(client, ctx, *build, cmd.String("branch"), downloadPaths) + buildModel.CommitOnly = waitMode == WaitCommit model := tea.Model(buildCompletionModel{ - Build: cbuild.NewModel(client, ctx, *build, cmd.String("branch"), downloadPaths), + Build: buildModel, WaitMode: waitMode, }) model, err = tea.NewProgram(model).Run() @@ -541,6 +543,7 @@ func (c buildCompletionModel) IsCompleted() bool { } func (c buildCompletionModel) View() string { + c.Build.CommitOnly = c.WaitMode == WaitCommit return c.Build.View() } diff --git a/pkg/cmd/init.go b/pkg/cmd/init.go index 09f35370..6b244605 100644 --- a/pkg/cmd/init.go +++ b/pkg/cmd/init.go @@ -220,7 +220,7 @@ func fetchUserProjects(ctx context.Context, client stainless.Client, org string) // askSelectProject prompts the user to select from existing projects or create a new one func askSelectProject(projects []stainless.Project) (string, *stainless.Project, error) { options := make([]huh.Option[*stainless.Project], 0, len(projects)+1) - options = append(options, huh.NewOption("", &stainless.Project{})) + options = append(options, huh.NewOption("", (*stainless.Project)(nil))) projects = slices.SortedFunc(slices.Values(projects), func(p1, p2 stainless.Project) int { if p1.Slug < p2.Slug { return -1 @@ -240,6 +240,9 @@ func askSelectProject(projects []stainless.Project) (string, *stainless.Project, if err != nil { return "", nil, err } + if picked == nil { + return "", nil, nil + } return picked.Slug, picked, nil } @@ -422,8 +425,11 @@ func initializeWorkspace(ctx context.Context, cmd *cli.Command, client stainless downloadPaths[stainless.Target(targetName)] = targetConfig.OutputPath } + buildModel := cbuild.NewModel(client, ctx, *build, "main", downloadPaths) + buildModel.CommitOnly = true model := buildCompletionModel{ - Build: cbuild.NewModel(client, ctx, *build, "main", downloadPaths), + Build: buildModel, + WaitMode: WaitCommit, } _, err = tea.NewProgram(model).Run() diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 2b395e0c..b1c4ba3a 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "0.1.0-alpha.73" // x-release-please-version +const Version = "0.1.0-alpha.74" // x-release-please-version diff --git a/pkg/components/build/model.go b/pkg/components/build/model.go index cbb10885..c9aaec2e 100644 --- a/pkg/components/build/model.go +++ b/pkg/components/build/model.go @@ -28,7 +28,8 @@ type Model struct { Ctx context.Context Branch string // Optional branch name for git checkout Downloads map[stainless.Target]DownloadStatus // When a BuildTarget has a commit available, this target will download it, if it has been specified in the initialization. - Err error // This will be populated if the model concludes with an error + Err error // This will be populated if the model concludes with an error + CommitOnly bool // When true, only show the commit step in the pipeline view } type DownloadStatus struct { @@ -121,6 +122,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { case ErrorMsg: m.Err = msg + cmds = append(cmds, tea.Quit) } return m, tea.Batch(cmds...) diff --git a/pkg/components/build/view.go b/pkg/components/build/view.go index 258b7d25..1a524e6c 100644 --- a/pkg/components/build/view.go +++ b/pkg/components/build/view.go @@ -11,16 +11,19 @@ import ( ) func (m Model) View() string { - return View(m.Build, m.Downloads) + if m.Err != nil { + return m.Err.Error() + } + return View(m.Build, m.Downloads, m.CommitOnly) } -func View(build stainless.Build, downloads map[stainless.Target]DownloadStatus) string { +func View(build stainless.Build, downloads map[stainless.Target]DownloadStatus, commitOnly bool) string { s := strings.Builder{} buildObj := stainlessutils.NewBuild(build) languages := buildObj.Languages() // Target rows with colors for _, target := range languages { - pipeline := ViewBuildPipeline(build, target, downloads) + pipeline := ViewBuildPipeline(build, target, downloads, commitOnly) langStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("15")).Bold(true) s.WriteString(fmt.Sprintf("%s %s\n", langStyle.Render(fmt.Sprintf("%-13s", string(target))), pipeline)) @@ -50,7 +53,7 @@ func View(build stainless.Build, downloads map[stainless.Target]DownloadStatus) } // View renders the build pipeline for a target -func ViewBuildPipeline(build stainless.Build, target stainless.Target, downloads map[stainless.Target]DownloadStatus) string { +func ViewBuildPipeline(build stainless.Build, target stainless.Target, downloads map[stainless.Target]DownloadStatus, commitOnly bool) string { buildObj := stainlessutils.NewBuild(build) buildTarget := buildObj.BuildTarget(target) if buildTarget == nil { @@ -61,6 +64,9 @@ func ViewBuildPipeline(build stainless.Build, target stainless.Target, downloads var pipeline strings.Builder for _, step := range stepOrder { + if commitOnly && step != "commit" { + continue + } status, url, conclusion := buildTarget.StepInfo(step) if status == "" { continue // Skip steps that don't exist for this target diff --git a/pkg/components/dev/model.go b/pkg/components/dev/model.go index 073b2be3..61aac63a 100644 --- a/pkg/components/dev/model.go +++ b/pkg/components/dev/model.go @@ -3,7 +3,6 @@ package dev import ( "context" "errors" - "time" "github.com/charmbracelet/bubbles/help" "github.com/charmbracelet/bubbles/key" @@ -34,7 +33,6 @@ type Model struct { Diagnostics diagnostics.Model } -type TickMsg time.Time type ErrorMsg error type FileChangeMsg struct{} @@ -52,9 +50,8 @@ func NewModel(client stainless.Client, ctx context.Context, branch string, fn fu func (m Model) Init() tea.Cmd { return tea.Batch( - tea.Tick(time.Second, func(t time.Time) tea.Msg { - return TickMsg(t) - }), + m.Build.Init(), + m.Diagnostics.Init(), func() tea.Msg { res, err := m.start() if err != nil { @@ -62,8 +59,6 @@ func (m Model) Init() tea.Cmd { } return build.FetchBuildMsg(*res) }, - m.Build.Init(), - m.Diagnostics.Init(), ) } diff --git a/pkg/components/dev/view.go b/pkg/components/dev/view.go index 853f4372..c9dd85a8 100644 --- a/pkg/components/dev/view.go +++ b/pkg/components/dev/view.go @@ -11,6 +11,10 @@ import ( ) func (m Model) View() string { + if m.Err != nil { + return m.Err.Error() + } + s := strings.Builder{} idx := slices.IndexFunc(parts, func(part ViewPart) bool {