Skip to content

Commit 77f9c76

Browse files
committed
Polish docs and contract coverage
1 parent a282b47 commit 77f9c76

3 files changed

Lines changed: 123 additions & 10 deletions

File tree

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,29 @@ sudo rpm -i fizzy-cli_VERSION_linux_amd64.rpm
8282

8383
</details>
8484

85-
## Usage
85+
## Next Steps
86+
87+
Start with a few common commands:
88+
89+
```bash
90+
fizzy board list
91+
fizzy card list
92+
fizzy card show 42
93+
fizzy search "authentication"
94+
fizzy comment create --card 42 --body "Looks good!"
95+
```
96+
97+
Then branch out as needed:
8698

8799
```bash
88-
fizzy board list # List boards
89100
fizzy board accesses --board ID # Show board access settings and users
90101
fizzy activity list --board ID # List recent board activity
91-
fizzy card list # List cards on default board
92-
fizzy card show 42 # Show card details
93-
fizzy card create --board ID --title "Fix login bug" # Create card
94-
fizzy card close 42 # Close card
95-
fizzy search "authentication" # Search across cards
96-
fizzy comment create --card 42 --body "Looks good!" # Add comment
97-
fizzy webhook deliveries --board ID WEBHOOK_ID # List webhook deliveries
98-
fizzy user export-create USER_ID # Create a user data export
102+
fizzy webhook deliveries --board ID WEBHOOK_ID
103+
fizzy user export-create USER_ID
99104
```
100105

106+
For the full command surface, run `fizzy commands --json` or read [`skills/fizzy/SKILL.md`](skills/fizzy/SKILL.md).
107+
101108
### Attachments
102109

103110
Simple mode uses repeatable `--attach` and appends inline attachments to the end of card descriptions or comment bodies:

e2e/cli_tests/output_contract_test.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"strconv"
66
"strings"
77
"testing"
8+
"time"
89

910
"github.com/basecamp/fizzy-cli/e2e/harness"
1011
)
@@ -241,3 +242,74 @@ func TestOutputContractShowCommands(t *testing.T) {
241242
})
242243
}
243244
}
245+
246+
func TestOutputContractWebhookDeliveries(t *testing.T) {
247+
h := newHarness(t)
248+
boardID := createBoard(t, h)
249+
cardNum := createCard(t, h, boardID)
250+
create := h.Run("webhook", "create", "--board", boardID, "--name", "Output Contract Hook", "--url", "https://example.com/fizzy-cli-output-contract", "--actions", "card_closed")
251+
assertOK(t, create)
252+
webhookID := create.GetIDFromLocation()
253+
if webhookID == "" {
254+
webhookID = create.GetDataString("id")
255+
}
256+
if webhookID == "" {
257+
t.Fatal("expected webhook ID in create response")
258+
}
259+
t.Cleanup(func() { newHarness(t).Run("webhook", "delete", "--board", boardID, webhookID) })
260+
261+
assertOK(t, h.Run("card", "close", strconv.Itoa(cardNum)))
262+
263+
var ready bool
264+
for attempt := 0; attempt < 15; attempt++ {
265+
result := h.Run("webhook", "deliveries", "--board", boardID, webhookID)
266+
if result.ExitCode == harness.ExitSuccess && len(result.GetDataArray()) > 0 {
267+
ready = true
268+
break
269+
}
270+
time.Sleep(200 * time.Millisecond)
271+
}
272+
if !ready {
273+
t.Fatal("expected webhook deliveries to contain at least one item")
274+
}
275+
276+
baseArgs := []string{"webhook", "deliveries", "--board", boardID, webhookID}
277+
for _, f := range listFlagSuite() {
278+
f := f
279+
t.Run(f.name, func(t *testing.T) {
280+
args := append(append([]string(nil), baseArgs...), f.extra...)
281+
result := h.Run(args...)
282+
if result.ExitCode != harness.ExitSuccess {
283+
t.Fatalf("expected exit code 0, got %d\nstdout: %s\nstderr: %s", result.ExitCode, result.Stdout, result.Stderr)
284+
}
285+
f.check(t, result)
286+
})
287+
}
288+
}
289+
290+
func TestOutputContractUserExportShow(t *testing.T) {
291+
h := newHarness(t)
292+
userID := currentUserID(t, h)
293+
create := h.Run("user", "export-create", userID)
294+
assertOK(t, create)
295+
exportID := create.GetDataString("id")
296+
if exportID == "" {
297+
exportID = mapValueString(create.GetDataMap(), "id")
298+
}
299+
if exportID == "" {
300+
t.Fatal("expected user export ID in create response")
301+
}
302+
303+
baseArgs := []string{"user", "export-show", userID, exportID}
304+
for _, f := range showFlagSuite() {
305+
f := f
306+
t.Run(f.name, func(t *testing.T) {
307+
args := append(append([]string(nil), baseArgs...), f.extra...)
308+
result := h.Run(args...)
309+
if result.ExitCode != harness.ExitSuccess {
310+
t.Fatalf("expected exit code 0, got %d\nstdout: %s\nstderr: %s", result.ExitCode, result.Stdout, result.Stderr)
311+
}
312+
f.check(t, result)
313+
})
314+
}
315+
}

e2e/cli_tests/syntax_contract_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,37 @@ func TestAccountEntropyRejectsInvalidZeroValue(t *testing.T) {
6868
result := h.Run("account", "entropy", "--auto_postpone_period_in_days", "0")
6969
assertResult(t, result, harness.ExitUsage)
7070
}
71+
72+
func TestUserExportCommandsUsePositionalIDs(t *testing.T) {
73+
h := newHarness(t)
74+
userID := currentUserID(t, h)
75+
76+
create := h.Run("user", "export-create", userID)
77+
assertOK(t, create)
78+
exportID := create.GetDataString("id")
79+
if exportID == "" {
80+
exportID = mapValueString(create.GetDataMap(), "id")
81+
}
82+
if exportID == "" {
83+
t.Fatal("expected export ID from user export-create")
84+
}
85+
86+
assertOK(t, h.Run("user", "export-show", userID, exportID))
87+
}
88+
89+
func TestWebhookDeliveriesUsesBoardFlagAndWebhookID(t *testing.T) {
90+
h := newHarness(t)
91+
boardID := createBoard(t, h)
92+
cardNum := createCard(t, h, boardID)
93+
create := h.Run("webhook", "create", "--board", boardID, "--name", "Syntax Contract Hook", "--url", "https://example.com/fizzy-cli-syntax", "--actions", "card_closed")
94+
assertOK(t, create)
95+
webhookID := create.GetIDFromLocation()
96+
if webhookID == "" {
97+
webhookID = create.GetDataString("id")
98+
}
99+
if webhookID == "" {
100+
t.Fatal("expected webhook ID from webhook create")
101+
}
102+
assertOK(t, h.Run("card", "close", strconv.Itoa(cardNum)))
103+
assertOK(t, h.Run("webhook", "deliveries", "--board", boardID, webhookID))
104+
}

0 commit comments

Comments
 (0)