fizzy-cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.github/workflows/release.yml +29 -0
  2. package/.github/workflows/tests.yml +24 -0
  3. package/AGENTS.md +33 -0
  4. package/CHANGELOG.md +63 -0
  5. package/Makefile +20 -9
  6. package/README.md +88 -1
  7. package/bin/fizzy +0 -0
  8. package/bin/fizzy-darwin-amd64 +0 -0
  9. package/bin/fizzy-darwin-arm64 +0 -0
  10. package/bin/fizzy-linux-amd64 +0 -0
  11. package/bin/fizzy-linux-arm64 +0 -0
  12. package/bin/fizzy-windows-amd64.exe +0 -0
  13. package/cmd/account.go +14 -0
  14. package/cmd/account_list.go +44 -0
  15. package/cmd/account_list_test.go +118 -0
  16. package/cmd/board.go +38 -12
  17. package/cmd/board_create.go +60 -0
  18. package/cmd/board_create_test.go +158 -0
  19. package/cmd/board_list.go +18 -32
  20. package/cmd/board_list_test.go +115 -0
  21. package/cmd/board_test.go +92 -0
  22. package/cmd/card.go +24 -0
  23. package/cmd/card_close.go +46 -0
  24. package/cmd/card_close_test.go +92 -0
  25. package/cmd/card_create.go +73 -0
  26. package/cmd/card_create_test.go +206 -0
  27. package/cmd/card_delete.go +46 -0
  28. package/cmd/card_delete_test.go +92 -0
  29. package/cmd/card_list.go +53 -0
  30. package/cmd/card_list_test.go +148 -0
  31. package/cmd/card_reopen.go +46 -0
  32. package/cmd/card_reopen_test.go +92 -0
  33. package/cmd/card_show.go +46 -0
  34. package/cmd/card_show_test.go +92 -0
  35. package/cmd/card_update.go +74 -0
  36. package/cmd/card_update_test.go +147 -0
  37. package/cmd/column.go +14 -0
  38. package/cmd/column_create.go +80 -0
  39. package/cmd/column_create_test.go +196 -0
  40. package/cmd/column_list.go +44 -0
  41. package/cmd/column_list_test.go +138 -0
  42. package/cmd/login.go +61 -4
  43. package/cmd/login_test.go +98 -0
  44. package/cmd/root.go +15 -4
  45. package/cmd/use.go +85 -0
  46. package/cmd/use_test.go +186 -0
  47. package/docs/API.md +1168 -0
  48. package/go.mod +23 -2
  49. package/go.sum +43 -0
  50. package/internal/api/client.go +463 -0
  51. package/internal/app/app.go +49 -0
  52. package/internal/colors/colors.go +32 -0
  53. package/internal/config/config.go +69 -0
  54. package/internal/testutil/client.go +26 -0
  55. package/internal/ui/account_list.go +14 -0
  56. package/internal/ui/account_selector.go +63 -0
  57. package/internal/ui/board_list.go +14 -0
  58. package/internal/ui/card_list.go +14 -0
  59. package/internal/ui/card_show.go +23 -0
  60. package/internal/ui/column_list.go +28 -0
  61. package/internal/ui/format.go +14 -0
  62. package/main.go +1 -1
  63. package/package.json +1 -1
@@ -0,0 +1,26 @@
1
+ // Package testutil
2
+ package testutil
3
+
4
+ import (
5
+ "net/http"
6
+ "time"
7
+
8
+ "github.com/rogeriopvl/fizzy/internal/api"
9
+ )
10
+
11
+ func NewTestClient(baseURL, accountSlug, boardID, accessToken string) *api.Client {
12
+ accountBaseURL := baseURL + accountSlug
13
+
14
+ var boardURL string
15
+ if boardID != "" {
16
+ boardURL = accountBaseURL + "/boards" + "/" + boardID
17
+ }
18
+
19
+ return &api.Client{
20
+ BaseURL: baseURL,
21
+ AccountBaseURL: accountBaseURL,
22
+ BoardBaseURL: boardURL,
23
+ AccessToken: accessToken,
24
+ HTTPClient: &http.Client{Timeout: 30 * time.Second},
25
+ }
26
+ }
@@ -0,0 +1,14 @@
1
+ package ui
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/rogeriopvl/fizzy/internal/api"
7
+ )
8
+
9
+ func DisplayAccounts(accounts []api.Account) error {
10
+ for _, account := range accounts {
11
+ fmt.Printf("%s (%s)\n", account.Name, DisplayMeta("slug", account.Slug))
12
+ }
13
+ return nil
14
+ }
@@ -0,0 +1,63 @@
1
+ // Package ui
2
+ package ui
3
+
4
+ import (
5
+ "fmt"
6
+
7
+ tea "github.com/charmbracelet/bubbletea"
8
+ "github.com/rogeriopvl/fizzy/internal/api"
9
+ )
10
+
11
+ type accountModel struct {
12
+ accounts []api.Account
13
+ cursor int
14
+ }
15
+
16
+ func (m accountModel) Init() tea.Cmd {
17
+ return nil
18
+ }
19
+
20
+ func (m accountModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
21
+ switch msg := msg.(type) {
22
+ case tea.KeyMsg:
23
+ switch msg.String() {
24
+ case "ctrl+c", "q":
25
+ return m, tea.Quit
26
+ case "up", "k":
27
+ if m.cursor > 0 {
28
+ m.cursor--
29
+ }
30
+ case "down", "j":
31
+ if m.cursor < len(m.accounts)-1 {
32
+ m.cursor++
33
+ }
34
+ case "enter":
35
+ return m, tea.Quit
36
+ }
37
+ }
38
+ return m, nil
39
+ }
40
+
41
+ func (m accountModel) View() string {
42
+ s := "Select an account:\n\n"
43
+ for i, account := range m.accounts {
44
+ cursor := " "
45
+ if i == m.cursor {
46
+ cursor = "> "
47
+ }
48
+ s += fmt.Sprintf("%s%s (%s)\n", cursor, account.Name, account.Slug)
49
+ }
50
+ s += "\nUse ↑/↓ or k/j to navigate, Enter to select, q to quit"
51
+ return s
52
+ }
53
+
54
+ func SelectAccount(accounts []api.Account) (api.Account, error) {
55
+ m := accountModel{accounts: accounts, cursor: 0}
56
+ p, err := tea.NewProgram(m).Run()
57
+ if err != nil {
58
+ return api.Account{}, err
59
+ }
60
+
61
+ finalModel := p.(accountModel)
62
+ return finalModel.accounts[finalModel.cursor], nil
63
+ }
@@ -0,0 +1,14 @@
1
+ package ui
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/rogeriopvl/fizzy/internal/api"
7
+ )
8
+
9
+ func DisplayBoards(boards []api.Board) error {
10
+ for _, board := range boards {
11
+ fmt.Printf("%s (%s)\n", board.Name, DisplayID(board.ID))
12
+ }
13
+ return nil
14
+ }
@@ -0,0 +1,14 @@
1
+ package ui
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/rogeriopvl/fizzy/internal/api"
7
+ )
8
+
9
+ func DisplayCards(cards []api.Card) error {
10
+ for _, card := range cards {
11
+ fmt.Printf("%d - %s\n", card.Number, card.Title)
12
+ }
13
+ return nil
14
+ }
@@ -0,0 +1,23 @@
1
+ package ui
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/charmbracelet/lipgloss"
7
+ "github.com/rogeriopvl/fizzy/internal/api"
8
+ )
9
+
10
+ func DisplayCard(card *api.Card) error {
11
+ boldStyle := lipgloss.NewStyle().Bold(true)
12
+ dimStyle := lipgloss.NewStyle().Bold(true).Faint(true)
13
+ fmt.Printf("%s\n", boldStyle.Render(fmt.Sprintf("%s (#%d)", card.Title, card.Number)))
14
+ fmt.Println("─────────────────────────────────────")
15
+ fmt.Printf("%s %s\n", dimStyle.Render("Description:"), card.Description)
16
+ fmt.Printf("%s %v\n", dimStyle.Render("Tags:"), card.Tags)
17
+ fmt.Printf("%s %v\n", dimStyle.Render("Golden:"), card.Golden)
18
+ fmt.Printf("%s %s\n", dimStyle.Render("Status:"), card.Status)
19
+ fmt.Printf("%s %s\n", dimStyle.Render("Created:"), card.CreatedAt)
20
+ fmt.Printf("%s %s\n", dimStyle.Render("Last Active:"), card.LastActiveAt)
21
+ fmt.Printf("%s %s\n", dimStyle.Render("URL:"), card.URL)
22
+ return nil
23
+ }
@@ -0,0 +1,28 @@
1
+ package ui
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/charmbracelet/lipgloss"
7
+ "github.com/rogeriopvl/fizzy/internal/api"
8
+ "github.com/rogeriopvl/fizzy/internal/colors"
9
+ )
10
+
11
+ func DisplayColumns(columns []api.Column) error {
12
+ for _, column := range columns {
13
+ colorName := column.Color.Name
14
+ colorDef := colors.ByName(colorName)
15
+
16
+ termColor := lipgloss.Color("7") // default to white
17
+ if colorDef != nil {
18
+ termColor = colorDef.TermColor
19
+ }
20
+
21
+ styledName := lipgloss.NewStyle().
22
+ Foreground(termColor).
23
+ Render(column.Name)
24
+
25
+ fmt.Printf("%s (%s)\n", styledName, DisplayID(column.ID))
26
+ }
27
+ return nil
28
+ }
@@ -0,0 +1,14 @@
1
+ package ui
2
+
3
+ import "github.com/charmbracelet/lipgloss"
4
+
5
+ // DisplayMeta returns a formatted metadata string with greyed out styling
6
+ func DisplayMeta(label string, value string) string {
7
+ return lipgloss.NewStyle().
8
+ Foreground(lipgloss.Color("8")). // Grey color
9
+ Render(label + ": " + value)
10
+ }
11
+
12
+ func DisplayID(id string) string {
13
+ return DisplayMeta("id", id)
14
+ }
package/main.go CHANGED
@@ -1,6 +1,6 @@
1
1
  package main
2
2
 
3
- import "github.com/rogeriopvl/fizzy-cli/cmd"
3
+ import "github.com/rogeriopvl/fizzy/cmd"
4
4
 
5
5
  func main() {
6
6
  cmd.Execute()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fizzy-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CLI for https://fizzy.do",
5
5
  "main": "bin/fizzy",
6
6
  "type": "module",