diff --git a/.surface-skill-drift b/.surface-skill-drift index ee769b637..e3c6c42f1 100644 --- a/.surface-skill-drift +++ b/.surface-skill-drift @@ -25,6 +25,7 @@ CMD basecamp connect setup FLAG basecamp --operator-profile FLAG basecamp --serve FLAG basecamp --shadow +FLAG basecamp --reset CMD basecamp connect discard CMD basecamp connect ask CMD basecamp connect doctor diff --git a/internal/commands/connect.go b/internal/commands/connect.go index 07f8206a7..65704b5b5 100644 --- a/internal/commands/connect.go +++ b/internal/commands/connect.go @@ -18,6 +18,7 @@ import ( surfguard "github.com/basecamp/surfguard/go" "github.com/spf13/cobra" + "github.com/spf13/pflag" "github.com/basecamp/basecamp-sdk/go/pkg/basecamp" @@ -231,13 +232,13 @@ func runConnectShow(app *appctx.App) error { "The connector's setup is not supported on Windows: this CLI cannot verify who can change connect.json there.") case err != nil: return output.ErrUsageHint("connect.json cannot be used: "+setup.ErrorText(err), - "Nothing of it was shown. Fix or remove "+richtext.SanitizeSingleLine(path)+", then run setup again.") + "Nothing of it was shown. "+connectResetHint(name)+", or fix "+richtext.SanitizeSingleLine(path)+" by hand.") } if f.Profile != name { // A policy copied from another profile's directory is not this // profile's, however valid it is on its own: setup refuses it too. return output.ErrUsageHint(fmt.Sprintf("%s names profile %q, not %q", richtext.SanitizeSingleLine(path), f.Profile, name), - "Nothing of it was shown. Remove "+richtext.SanitizeSingleLine(path)+" and run setup again for this profile.") + "Nothing of it was shown. "+connectResetHint(name)+".") } // The generic object renderer drops nested maps, which is where the @@ -405,6 +406,11 @@ type connectSetupFlags struct { ackBoost optionalString noAckBoost bool + // reset sets the profile up afresh from this run's flags alone, over a + // connect.json that cannot be used or is for another agent: the old + // file is moved aside only when the new one is written. + reset bool + serve []string classes []string watch []string @@ -596,6 +602,7 @@ Examples: fl.StringArrayVar(&f.unlistenCampfires, "no-listen-campfire", nil, "Require mentions again: : (repeatable)") fl.Var(&f.ackBoost, "ack-boost", fmt.Sprintf("Boost the connector acknowledges each request with, as the agent, before handing it off (default %s; at most %d characters)", setup.DefaultAckContent, setup.AckContentMax)) fl.BoolVar(&f.noAckBoost, "no-ack-boost", false, "Don't acknowledge requests in the connector; the session reading them boosts instead") + fl.BoolVar(&f.reset, "reset", false, "Set the profile up afresh from this run's flags, ignoring connect.json; the old file is kept beside the new one as connect.json.broken-