Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ bin/
*.test
*.out
.DS_Store
docs/superpowers/
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,32 @@ flashduty field list [flags] # List custom field definitions

Supports `--name`.

### `statuspage` - Status Page Management (4 commands)
### `statuspage` - Status Page Management (5 command groups)

```bash
flashduty statuspage list [--id <ids>] # List status pages
flashduty statuspage changes --page-id <id> --type <incident|maintenance> # List active changes
flashduty statuspage create-incident --page-id <id> --title <title> # Create status incident
flashduty statuspage create-timeline --page-id <id> --change <id> --message <msg> # Add timeline update
flashduty statuspage migrate structure --from atlassian --source-page-id <id> --api-key <key> # Start structure/history migration
flashduty statuspage migrate email-subscribers --from atlassian --source-page-id <id> --target-page-id <id> --api-key <key> # Start email subscriber migration
flashduty statuspage migrate status --job-id <id> # Check migration job status
flashduty statuspage migrate cancel --job-id <id> # Cancel a running migration job
```

Migration jobs are asynchronous. After starting `structure` or `email-subscribers`, use:

```bash
flashduty statuspage migrate status --job-id <job_id>
```

Typical flow:

```bash
flashduty statuspage migrate structure --from atlassian --source-page-id page_123 --api-key $ATLASSIAN_STATUSPAGE_API_KEY
flashduty statuspage migrate status --job-id <structure_job_id>
flashduty statuspage migrate email-subscribers --from atlassian --source-page-id page_123 --target-page-id <target_page_id> --api-key $ATLASSIAN_STATUSPAGE_API_KEY
flashduty statuspage migrate status --job-id <subscriber_job_id>
```

### `template` - Notification Template Management (4 commands)
Expand Down
33 changes: 21 additions & 12 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"io"
"os"

flashduty "github.com/flashcatcloud/flashduty-sdk"
"github.com/flashcatcloud/flashduty-cli/internal/config"
"github.com/flashcatcloud/flashduty-cli/internal/output"
flashduty "github.com/flashcatcloud/flashduty-sdk"
"github.com/spf13/cobra"
)

Expand All @@ -20,9 +20,9 @@ var (
)

var rootCmd = &cobra.Command{
Use: "flashduty",
Short: "Flashduty CLI - incident management from your terminal",
Long: "Flashduty CLI - incident management from your terminal.\n\nGet started by running 'flashduty login' to authenticate.",
Use: "flashduty",
Short: "Flashduty CLI - incident management from your terminal",
Long: "Flashduty CLI - incident management from your terminal.\n\nGet started by running 'flashduty login' to authenticate.",
SilenceUsage: true,
SilenceErrors: true,
}
Expand Down Expand Up @@ -55,18 +55,11 @@ func Execute() error {

// newClient creates a Flashduty SDK client from resolved config + flag overrides.
func newClient() (*flashduty.Client, error) {
cfg, err := config.Load()
cfg, err := loadResolvedConfig()
if err != nil {
return nil, err
}

if flagAppKey != "" {
cfg.AppKey = flagAppKey
}
if flagBaseURL != "" {
cfg.BaseURL = flagBaseURL
}

if cfg.AppKey == "" {
return nil, fmt.Errorf("no app key configured. Run 'flashduty login' or set FLASHDUTY_APP_KEY")
}
Expand All @@ -82,6 +75,22 @@ func newClient() (*flashduty.Client, error) {
return flashduty.NewClient(cfg.AppKey, opts...)
}

func loadResolvedConfig() (*config.Config, error) {
cfg, err := config.Load()
if err != nil {
return nil, err
}

if flagAppKey != "" {
cfg.AppKey = flagAppKey
}
if flagBaseURL != "" {
cfg.BaseURL = flagBaseURL
}

return cfg, nil
}

// newPrinter creates a Printer based on global flags.
func newPrinter(w io.Writer) output.Printer {
if w == nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/cli/status_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strconv"
"strings"

flashduty "github.com/flashcatcloud/flashduty-sdk"
"github.com/flashcatcloud/flashduty-cli/internal/output"
flashduty "github.com/flashcatcloud/flashduty-sdk"
"github.com/spf13/cobra"
)

Expand All @@ -19,6 +19,7 @@ func newStatusPageCmd() *cobra.Command {
cmd.AddCommand(newStatusPageChangesCmd())
cmd.AddCommand(newStatusPageCreateIncidentCmd())
cmd.AddCommand(newStatusPageCreateTimelineCmd())
cmd.AddCommand(newStatusPageMigrateCmd())
return cmd
}

Expand Down
Loading
Loading