feat(create): cleanup app creation outputs when slack create -app passed#598
feat(create): cleanup app creation outputs when slack create -app passed#598srtaalej wants to merge 1 commit into
slack create -app passed#598Conversation
slack create -app passed
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #598 +/- ##
==========================================
- Coverage 71.64% 71.59% -0.06%
==========================================
Files 226 226
Lines 19176 19195 +19
==========================================
+ Hits 13739 13742 +3
- Misses 4222 4240 +18
+ Partials 1215 1213 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| // LinkExistingAppQuiet links an existing app without verbose output. It resolves | ||
| // the team and environment, validates the app, saves it, and prints only the app | ||
| // summary. Used by `create --app` where the surrounding create output is enough. | ||
| func LinkExistingAppQuiet(ctx context.Context, clients *shared.ClientFactory, app *types.App) error { | ||
| linkedApp, auth, err := promptExistingApp(ctx, clients) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| *app = linkedApp | ||
|
|
||
| appIDs := []string{app.AppID} | ||
| _, err = clients.API().GetAppStatus(ctx, auth.Token, appIDs, app.TeamID) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| err = saveAppToJSON(ctx, clients, *app) | ||
| if err != nil { | ||
| clients.IO.PrintDebug(ctx, "Error saving app to file when linking existing app: %s", err) | ||
| return err | ||
| } | ||
|
|
||
| clients.IO.PrintInfo(ctx, false, "\n%s", style.Sectionf(style.TextSection{ | ||
| Emoji: "house", | ||
| Text: "App", | ||
| Secondary: formatListSuccess([]types.App{*app}), | ||
| })) | ||
|
|
||
| return nil | ||
| } |
There was a problem hiding this comment.
🔭 thought: This is near identical to the lines above and I'm wondering if we can somehow keep a single source of truth for this logic?
Lines 170 to 190 in a0f86d7
There was a problem hiding this comment.
sure good call! @zimeg to clarify though, do you mean the entire link command should return the way LinkExistingAppQuiet is returning? or should we have something like
func LinkExistingApp(ctx context.Context, clients *shared.ClientFactory, app *types.App, shouldConfirm bool, quiet bool) (err error) {
if !quiet {
// Header section
LinkAppHeaderSection(ctx, clients, shouldConfirm)
}
There was a problem hiding this comment.
@srtaalej I missed the edited mention! question But separating output from logic might make this possible? I think outputs and even the "should confirm" logic should be moved to adjacent functions:
- app.LinkExistingApp: What I permalink above
- app.LinkCommandRunE: Perhaps most the "link" outputs not meant to share
Changelog
Reduced verbose output when using
create --appto link an existing app during project creation.Summary
When
--appis provided toslack create, the linking step previously printed multiple noisy sections (App Link header, App Manifest details, App footer, and "Added existing app" message). Now it only prints the single🏠 Appsummary section showing team, App ID, Team ID, User ID, and Status.Preview
Testing
make test./bin/slack create my-test -t slack-samples/bolt-js-starter-template --app A123 --team T123 --environment localNotes
Adresses comments on PR #565 - Improve the output experience for create when --app is provided.
Requirements