Skip to content

Commit f39d175

Browse files
authored
Merge branch 'main' into ale-accessibility-flag
2 parents 7a747ba + 5100c02 commit f39d175

38 files changed

+1487
-1177
lines changed

.claude/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"Bash(git log:*)",
1717
"Bash(git status:*)",
1818
"Bash(go build:*)",
19+
"Bash(go doc:*)",
1920
"Bash(go mod graph:*)",
2021
"Bash(go mod tidy:*)",
2122
"Bash(go mod tidy:*)",

.github/STYLE_GUIDE.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ A current suggestion for how Slack CLI inputs are handled and outputs are format
55
- **Input**
66
- [Prompts are Flags with Forms](#prompts-are-flags-with-forms)
77
- **Output**
8-
- [Format Sections with Command Details](#format-sections-with-command-details)
8+
- [Help Arguments use Opinionated Brackets](#help-arguments-use-opinionated-brackets)
9+
- [Help Descriptions find Complete Sentences](#help-descriptions-find-complete-sentences)
10+
- [Section Formats with Command Headings](#section-formats-with-command-headings)
911

1012
## Input
1113

@@ -23,7 +25,44 @@ A flag option should exist for each prompt with a form fallback. Either default
2325

2426
Results of a command go toward informing current happenings and suggesting next steps.
2527

26-
### Format Sections with Command Details
28+
### Help Arguments use Opinionated Brackets
29+
30+
The square brackets surrounding command arguments hint that these are optional:
31+
32+
```
33+
USAGE
34+
$ slack env add [name] [value] [flags]
35+
```
36+
37+
The angled brackets around arguments hint that these are required:
38+
39+
```
40+
USAGE
41+
$ slack <command>
42+
```
43+
44+
Optional and required arguments can be mixed-and-matched:
45+
46+
```
47+
USAGE
48+
$ slack <command> [args] [flags]
49+
```
50+
51+
These examples have meaningful argument placeholders and sometimes forms as fallback.
52+
53+
### Help Descriptions find Complete Sentences
54+
55+
The output of extended help descriptions should be complete sentences:
56+
57+
```txt
58+
$ slack docs search --help
59+
Search the Slack developer docs and return results in text, JSON, or browser
60+
format.
61+
```
62+
63+
This example uses punctuation and breaks lines at or before the 80 character count.
64+
65+
### Section Formats with Command Headings
2766

2867
A command often prints information and details about the process happenings. We format this as a section:
2968

cmd/app/app.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
func NewCommand(clients *shared.ClientFactory) *cobra.Command {
2626
cmd := &cobra.Command{
2727
Use: "app",
28-
Aliases: []string{"workspace", "app", "apps", "team", "teams", "workspaces"},
28+
Aliases: []string{"app", "apps"},
2929
Short: "Install, uninstall, and list teams with the app installed",
3030
Long: "Install, uninstall, and list teams with the app installed",
3131
Example: style.ExampleCommandsf([]style.ExampleCommand{
@@ -45,20 +45,6 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command {
4545
RunE: func(cmd *cobra.Command, args []string) error {
4646
return runListCommand(cmd, clients)
4747
},
48-
PostRunE: func(cmd *cobra.Command, args []string) error {
49-
ctx := cmd.Context()
50-
// DEPRECATED(semver:major): remove the "workspace" alias
51-
if cmd.CalledAs() == "workspace" {
52-
clients.IO.PrintInfo(ctx, false,
53-
"\n%s It looks like you used %s. This command will be deprecated in an upcoming release.\n You can now use %s instead of %s.\n ",
54-
style.Emoji("bulb"),
55-
style.Commandf("workspace", true),
56-
style.Commandf("app", true),
57-
style.Commandf("workspace", true),
58-
)
59-
}
60-
return nil
61-
},
6248
}
6349

6450
// Add child commands

cmd/app/app_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/stretchr/testify/assert"
2525
)
2626

27-
func TestWorkspaceCommand(t *testing.T) {
27+
func TestAppCommand(t *testing.T) {
2828
// Create mocks
2929
ctx := slackcontext.MockContext(t.Context())
3030
clientsMock := shared.NewClientsMock()

cmd/env/add.go

Lines changed: 0 additions & 153 deletions
This file was deleted.

cmd/env/env.go

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package env
1616

1717
import (
18+
"context"
1819
"strings"
1920

2021
"github.com/slackapi/slack-cli/internal/prompts"
@@ -34,28 +35,30 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command {
3435
cmd := &cobra.Command{
3536
Use: "env <subcommand>",
3637
Aliases: []string{"var", "vars", "variable", "variables"},
37-
Short: "Add, remove, or list environment variables",
38+
Short: "Set, unset, or list environment variables",
3839
Long: strings.Join([]string{
39-
"Add, remove, or list environment variables for apps deployed to Slack managed",
40-
"infrastructure.",
40+
"Set, unset, or list environment variables for the project.",
4141
"",
42-
"This command is supported for apps deployed to Slack managed infrastructure but",
43-
"other apps can attempt to run the command with the --force flag.",
42+
"Commands that run in the context of a project source environment variables from",
43+
"the \".env\" file. This includes the \"run\" command.",
44+
"",
45+
"The \"deploy\" command gathers environment variables from the \".env\" file as well",
46+
"unless the app is using ROSI features.",
4447
"",
4548
`Explore more: {{LinkText "https://docs.slack.dev/tools/slack-cli/guides/using-environment-variables-with-the-slack-cli"}}`,
4649
}, "\n"),
4750
Example: style.ExampleCommandsf([]style.ExampleCommand{
4851
{
49-
Meaning: "Add an environment variable",
50-
Command: "env add MAGIC_PASSWORD abracadbra",
52+
Meaning: "Set an environment variable",
53+
Command: "env set MAGIC_PASSWORD abracadbra",
5154
},
5255
{
5356
Meaning: "List all environment variables",
5457
Command: "env list",
5558
},
5659
{
57-
Meaning: "Remove an environment variable",
58-
Command: "env remove MAGIC_PASSWORD",
60+
Meaning: "Unset an environment variable",
61+
Command: "env unset MAGIC_PASSWORD",
5962
},
6063
}),
6164
RunE: func(cmd *cobra.Command, args []string) error {
@@ -64,9 +67,22 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command {
6467
}
6568

6669
// Add child commands
67-
cmd.AddCommand(NewEnvAddCommand(clients))
70+
cmd.AddCommand(NewEnvSetCommand(clients))
6871
cmd.AddCommand(NewEnvListCommand(clients))
69-
cmd.AddCommand(NewEnvRemoveCommand(clients))
72+
cmd.AddCommand(NewEnvUnsetCommand(clients))
7073

7174
return cmd
7275
}
76+
77+
// isHostedRuntime returns true if the local manifest is for an app that uses
78+
// the Deno Slack SDK function runtime.
79+
//
80+
// It defaults to false when the manifest cannot be fetched, which directs the
81+
// command to use the project ".env" file. Otherwise the API is used.
82+
func isHostedRuntime(ctx context.Context, clients *shared.ClientFactory) bool {
83+
manifest, err := clients.AppClient().Manifest.GetManifestLocal(ctx, clients.SDKConfig, clients.HookExecutor)
84+
if err != nil {
85+
return false
86+
}
87+
return manifest.IsFunctionRuntimeSlackHosted() || manifest.IsFunctionRuntimeLocal()
88+
}

0 commit comments

Comments
 (0)