Skip to content

Commit d2d7924

Browse files
authored
feat: terramate ui (#2294)
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://github.com/terramate-io/terramate/blob/main/CONTRIBUTING.md 2. If the PR is unfinished, mark it as draft: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request 3. Please update the PR title using the Conventional Commits convention: https://www.conventionalcommits.org/en/v1.0.0/ Example: feat: add support for XYZ. --> ## What this PR does / why we need it: This PR adds a new command `terramate ui`. It improves `scaffold` and adds workflows for reconfigure and promote. See changelog for details. ## Does this PR introduce a user-facing change? <!-- If no, just write "no" in the block below. If yes, please explain the change and update documentation and the CHANGELOG.md file accordingly. --> ``` yes, see changelog ``` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Large new TUI command plus refactors to scaffold/packaging input evaluation and manifest types may change behavior of bundle discovery, defaults/options evaluation, and remote bundle loading. While mostly CLI-facing, it touches core config evaluation paths used by existing `scaffold` flows. > > **Overview** > **Adds a new interactive command, `terramate ui`,** implemented as a BubbleTea TUI that guides users through *Create*, *Reconfigure*, and *Promote* workflows and persists changes as bundle instance YAML files. > > Updates existing scaffolding/packaging code to align with the newer type system and prompt model: local bundle/component discovery now evaluates metadata during listing, prompt handling moves to `PromptConfig` (text/multiline/options/multiselect), and input evaluation paths are refactored to pass `typeschema.EvalContext` (schemas + eval context) consistently. The manifest model is also updated to use `manifest.Collection` (instead of `Package`) throughout. > > Bumps version to `0.17.0-rc1` and documents the new `terramate ui` command and `input.prompt { ... }` syntax in `CHANGELOG.md`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f39ea6f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
2 parents 5a91f80 + f39ea6f commit d2d7924

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+9906
-325
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,25 @@ Given a version number `MAJOR.MINOR.PATCH`, we increment the:
3636
default = null
3737
}
3838
```
39+
- Add new command `terramate ui`. This is the successor to `terramate scaffold` with many improvements and new features:
40+
- Workflows for Reconfigure and environment Promote with diff viewer.
41+
- Staging area to apply multiple changes during the same session.
42+
- Custom input forms for all types of the new type system.
43+
- Nested forms for objects, including input forms for attributes.
44+
- Nested bundle creation.
45+
- New `input.prompt{...}` block to deprecate `input.prompt = ...` etc. Example:
46+
```
47+
input "multiline_input" {
48+
type = string
49+
description = "Description"
50+
51+
prompt {
52+
text = "Required Multiline input"
53+
multiline = true
54+
}
55+
}
56+
```
57+
This is supported for inputs and attributes.
3958
4059
## 0.16.0
4160

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.16.1-dev
1+
0.17.0-rc1

commands/package/create/create.go

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ func (s *Spec) Exec(_ context.Context, cli commands.CLI) error {
6363
}
6464

6565
// TODO: Could both be done in a single pass.
66-
localBundles, err := config.ListLocalBundleDefinitions(root, project.NewPath("/bundles"))
66+
localBundles, err := config.ListLocalBundleDefinitions(root, evalctx, project.NewPath("/bundles"))
6767
if err != nil {
6868
return err
6969
}
7070

71-
localComponents, err := config.ListLocalComponentDefinitions(root, project.NewPath("/components"))
71+
localComponents, err := config.ListLocalComponentDefinitions(root, evalctx, project.NewPath("/components"))
7272
if err != nil {
7373
return err
7474
}
@@ -77,47 +77,37 @@ func (s *Spec) Exec(_ context.Context, cli commands.CLI) error {
7777
s.PackageName = s.tryDetectPackageName()
7878
}
7979

80-
pkg := manifest.Package{
80+
pkg := manifest.Collection{
8181
Name: s.PackageName,
8282
Location: s.PackageLocation,
8383
Description: s.PackageDescription,
8484
}
8585

8686
for _, defEntry := range localBundles {
87-
md, err := config.EvalMetadata(root, evalctx, defEntry.Tree, &defEntry.Define.Metadata)
88-
if err != nil {
89-
return err
90-
}
91-
9287
pkg.Bundles = append(pkg.Bundles, manifest.Bundle{
9388
Path: defEntry.Tree.Dir().String(),
94-
Name: md.Name,
95-
Class: md.Class,
96-
Version: md.Version,
97-
Description: md.Description,
89+
Name: defEntry.Metadata.Name,
90+
Class: defEntry.Metadata.Class,
91+
Version: defEntry.Metadata.Version,
92+
Description: defEntry.Metadata.Description,
9893
})
9994
}
10095

10196
for _, defEntry := range localComponents {
102-
md, err := config.EvalMetadata(root, evalctx, defEntry.Tree, &defEntry.Define.Metadata)
103-
if err != nil {
104-
return err
105-
}
106-
10797
pkg.Components = append(pkg.Components, manifest.Component{
10898
Path: defEntry.Tree.Dir().String(),
109-
Name: md.Name,
110-
Class: md.Class,
111-
Version: md.Version,
112-
Description: md.Description,
99+
Name: defEntry.Metadata.Name,
100+
Class: defEntry.Metadata.Class,
101+
Version: defEntry.Metadata.Version,
102+
Description: defEntry.Metadata.Description,
113103
})
114104
}
115105

116106
if len(pkg.Bundles)+len(pkg.Components) == 0 {
117107
return errors.E("no bundles or components found for packaging")
118108
}
119109

120-
pkgs := []*manifest.Package{&pkg}
110+
pkgs := []*manifest.Collection{&pkg}
121111

122112
manifestData, err := json.MarshalIndent(&pkgs, "", " ")
123113
if err != nil {

0 commit comments

Comments
 (0)