Skip to content
Merged
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to the CLI are documented here. Releases are `v<version>` tags on `main`.

## 0.3.0 - 2026-10-18

### Added

- `fopost queue slots list · create · update · delete`, `queue next` and `queue preview` manage the posting queue, and `posts create --schedule queue` drops a post into the next free slot.
- `fopost posts unpublish` takes a live post down on every network; it confirms unless `--yes` is passed.
- `fopost connect-sessions create · get` mints a hosted connect link for one of your users and reads its status.
- `fopost webhooks deliveries list · get · redeliver` reads and replays a subscription's delivery log.
- `fopost automations versions list · get · restore` walks an automation's saved graphs and restores one as a new version.
- `fopost analytics inbox` prints the inbox roll-up.
- Requires `fopost-go` 0.4.0 (`Queue`, `ConnectSessions`, `Posts.Unpublish`, webhook deliveries, automation versions, `Analytics.Inbox`); the pin in `go.mod` must be re-pointed at the tag once it is released.

## 0.2.0 - 2026-10-18

### Removed
Expand Down
14 changes: 7 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Guidance for Claude Code (claude.ai/code) when working in this repository.
## What This Is

`github.com/fopost/fopost-cli` — the official FoPost command-line interface. It
builds a single static binary named `fopost` (version 0.2.0) that wraps the
builds a single static binary named `fopost` (version 0.3.0) that wraps the
official Go SDK, `github.com/fopost/fopost-go`. It is distributed through a
Homebrew tap, GitHub Releases, and `go install`; it is not a library and exports
no public API.
Expand Down Expand Up @@ -101,11 +101,11 @@ resolves it normally with no shim. It is currently pinned to a pseudo-version
because the SDK has no `v*` tag yet; once it is tagged, bump `go.mod` to the
released version.

The pin currently points at a commit on the SDK's `feature/broadcasts-sequences`
branch, which is stacked on `feature/contacts` and is what `fopost contacts`,
`fopost broadcasts` and `fopost sequences` need. Re-point it at `main` — or at
the tag — once those branches merge, or a `go get -u` will silently walk it
backwards.
The pin currently points at the head of the SDK's `feature/sdk-gaps` branch
(fopost/fopost-go#38), which is what `fopost queue`, `posts unpublish`,
`connect-sessions`, `webhooks deliveries`, `automations versions` and
`analytics inbox` need. Re-point it at the `v0.4.0` tag once that PR merges and
is tagged, or a `go get -u` will silently walk it backwards.

`go.mod` declares `go 1.22`, which is why `golang.org/x/term` is pinned to
`v0.27.0` — from `v0.34.0` it requires a newer toolchain. CI builds on 1.22 and
Expand All @@ -121,7 +121,7 @@ go vet ./...
gofmt -l . # must print nothing
go run . --help # try the CLI without installing it

go build -ldflags "-X github.com/fopost/fopost-cli/internal/buildinfo.Version=0.2.0" -o fopost .
go build -ldflags "-X github.com/fopost/fopost-cli/internal/buildinfo.Version=0.3.0" -o fopost .
```

Tests never reach the network. They run the real cobra tree in-process through
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Grab the archive for your platform from the
`checksums.txt`, and put `fopost` on your `PATH`:

```bash
tar -xzf fopost_0.2.0_darwin_arm64.tar.gz
tar -xzf fopost_0.3.0_darwin_arm64.tar.gz
sudo mv fopost /usr/local/bin/
fopost version
```
Expand Down Expand Up @@ -137,6 +137,10 @@ git log -1 --pretty=%s | \
Nothing reaches a platform without `--publish`, an explicit `posts publish`, or
a schedule you set.

`--schedule queue` drops the post into the next free slot of the posting queue
instead of a fixed time. `fopost queue slots` manages the weekly slots, and
`fopost queue next` and `fopost queue preview` show when a queued post would go out.

## Scripting with `--json`

Every command takes `--json` and prints the resource instead of a table, so it
Expand Down Expand Up @@ -239,8 +243,9 @@ fopost accounts list · get · rename · move · health · metrics · valid
linkedin mentions
reddit subreddits · rules · flairs · set-default
fopost account-groups list · get · create · rename · set-members · delete
fopost posts list · get · create · publish · cancel · delete
fopost posts list · get · create · publish · cancel · unpublish · delete
duplicate · preflight · deliveries
fopost queue slots (list · create · update · delete) · next · preview
fopost media list · limits · upload · delete
fopost labels list · create · delete
fopost contacts list · get · conversations · import · delete
Expand All @@ -254,9 +259,12 @@ fopost blog settings get · set · rotate-secret · test-website
fopost blogs list · articles (list · get · create · update · delete)
products (list · update)
fopost analytics overview · top-posts · time-series · decay · frequency · timeline ·
changes · collect-post · native-posts
changes · collect-post · native-posts · inbox
fopost automations list · get · toggle · trigger · runs
versions list · get · restore
fopost webhooks list · create · test · delete
deliveries list · get · redeliver
fopost connect-sessions create · get
fopost activity list · audit
fopost ads networks · tree · pause · resume · insights · leads · catalogs · library
fopost completion bash · zsh · fish · powershell
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/fopost/fopost-cli
go 1.22

require (
github.com/fopost/fopost-go v0.3.0
github.com/fopost/fopost-go v0.3.1-0.20261018185422-4bdeedf09a93
github.com/spf13/cobra v1.10.2
golang.org/x/term v0.27.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/fopost/fopost-go v0.3.0 h1:HF8RGB+uO9SRXk+FWXLkrlzznN4Gl+SCxgQWV/TD3lY=
github.com/fopost/fopost-go v0.3.0/go.mod h1:Qz+7UCYTBnDEeZqB3VMrePxmYLVR9rFvx3+QWcKND8Q=
github.com/fopost/fopost-go v0.3.1-0.20261018185422-4bdeedf09a93 h1:CcVlEqyEa4w5GuUrtKekgcOjkc1sFWmQEpmRAoi47F4=
github.com/fopost/fopost-go v0.3.1-0.20261018185422-4bdeedf09a93/go.mod h1:Qz+7UCYTBnDEeZqB3VMrePxmYLVR9rFvx3+QWcKND8Q=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down
2 changes: 1 addition & 1 deletion internal/buildinfo/buildinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "runtime/debug"

// Overridden at build time with -ldflags "-X ...buildinfo.Version=1.2.3".
var (
Version = "0.2.0"
Version = "0.3.0"
Commit = ""
Date = ""
)
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func newAnalyticsCmd(state *State) *cobra.Command {
newAnalyticsChangesCmd(state),
newAnalyticsCollectPostCmd(state),
newAnalyticsNativePostsCmd(state),
newAnalyticsInboxCmd(state),
)
return cmd
}
Expand Down
64 changes: 64 additions & 0 deletions internal/cmd/analytics_inbox.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package cmd

import (
"fmt"

fopost "github.com/fopost/fopost-go"
"github.com/spf13/cobra"

"github.com/fopost/fopost-cli/internal/output"
)

func newAnalyticsInboxCmd(state *State) *cobra.Command {
params := &fopost.InboxAnalyticsParams{}
cmd := &cobra.Command{
Use: "inbox",
Short: "Inbox volume, response time, and where it comes from",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
client, err := state.Client()
if err != nil {
return err
}
resolved, err := state.Resolved()
if err != nil {
return err
}
params.WorkspaceID = resolved.Workspace
inbox, err := client.Analytics.Inbox(cmd.Context(), params)
if err != nil {
return err
}
printer := state.Printer()
return printer.Value(inbox, func() {
median := ""
if inbox.Totals.MedianResponseMinutes != nil {
median = fmt.Sprintf("%.0f min", *inbox.Totals.MedianResponseMinutes)
}
printer.Fields([][2]string{
{"Received", itoa(inbox.Totals.Received)},
{"Sent", itoa(inbox.Totals.Sent)},
{"Answered", itoa(inbox.Totals.Answered)},
{"Open", itoa(inbox.Totals.Open)},
{"Conversations", itoa(inbox.Totals.Conversations)},
{"Median response", output.Dash(median)},
{"Time zone", output.Dash(inbox.TimeZone)},
})
if len(inbox.ByPlatform) == 0 {
return
}
printer.Line("")
rows := make([][]string, 0, len(inbox.ByPlatform))
for _, row := range inbox.ByPlatform {
rows = append(rows, []string{row.Platform, itoa(row.Received), itoa(row.Sent)})
}
printer.Table([]string{"platform", "received", "sent"}, rows)
})
},
}
flags := cmd.Flags()
flags.StringVar(&params.AccountID, "account", "", "narrow to one account id")
flags.IntVar(&params.Days, "days", 0, "window length in days, 1 to 365 (the API defaults to 7)")
flags.StringVar(&params.TZ, "tz", "", "IANA zone the series and heatmap are bucketed in (default UTC)")
return cmd
}
34 changes: 34 additions & 0 deletions internal/cmd/analytics_inbox_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cmd

import (
"encoding/json"
"net/http"
"strings"
"testing"
)

func TestAnalyticsInboxPrintsTheTotals(t *testing.T) {
isolate(t)
api := newFakeAPI(t, func(w http.ResponseWriter, _ *http.Request) {
json.NewEncoder(w).Encode(map[string]any{"data": map[string]any{
"totals": map[string]any{"received": 40, "sent": 12, "answered": 10, "open": 5, "conversations": 8, "median_response_minutes": 95.4},
"deltas": map[string]any{}, "series": []any{},
"by_platform": []map[string]any{{"platform": "linkedin", "received": 40, "sent": 12}},
"by_type": []any{}, "by_account": []any{}, "response_time": []any{}, "heatmap": []any{},
"time_zone": "UTC",
}})
})
configured(t, api.URL)

stdout, stderr, code := run(t, "", "analytics", "inbox", "--days", "30", "--tz", "Europe/Zagreb")
if code != ExitOK {
t.Fatalf("exit = %d\n%s%s", code, stdout, stderr)
}
sent := api.find(t, "GET", "/analytics/inbox")
if sent.Query.Get("workspace_id") != "ws_1" || sent.Query.Get("days") != "30" || sent.Query.Get("tz") != "Europe/Zagreb" {
t.Fatalf("inbox sent query %v", sent.Query)
}
if !strings.Contains(stdout, "95 min") || !strings.Contains(stdout, "linkedin") {
t.Fatalf("inbox did not print the totals:\n%s", stdout)
}
}
Loading
Loading