cli

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cli is `ce`, the command line client of Checkend. It reads stats and changes the setup of a remote Checkend server (cloud or self-hosted) with an API token, through the MCP tools (/mcp) and /api/v1/export: the same surface an agent uses, so no endpoint exists only for the CLI.

Index

Constants

View Source
const DefaultURL = "https://app.checkend.com"

DefaultURL is the server of a new login without --url: the cloud edition.

Variables

View Source
var ErrLocked = errors.New("the organization is locked: open Checkend in the browser to see why")

ErrLocked means the org of the token is locked (cloud billing).

View Source
var ErrUnauthorized = errors.New("the server refused the token (check it in Settings › Agent, then run: ce login)")

ErrUnauthorized means the server refused the token.

Functions

func Main

func Main(version string) int

Main runs ce with the process arguments and returns the exit code.

Types

type App

type App struct {
	Version string
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	Env     func(string) string
	HTTP    *http.Client // nil: a default client
	Now     func() time.Time
	// contains filtered or unexported fields
}

App holds what one run of ce needs. Main builds it from the process; tests build their own.

func (*App) Run

func (a *App) Run(ctx context.Context, args []string) int

Run runs one command and returns the exit code.

type Client

type Client struct {
	URL     string // base URL, no trailing slash
	Token   string
	Version string
	HTTP    *http.Client
	// contains filtered or unexported fields
}

Client talks to one Checkend server with an API token: the MCP tools at /mcp for stats and setup, and plain HTTP for the file export. It uses the same surface as an agent, so a token works in both.

func (*Client) Call

func (c *Client) Call(ctx context.Context, tool string, args any, out any) (raw json.RawMessage, err error)

Call runs one MCP tool and decodes its structured result into out (when out is not nil). raw is the result as JSON, for --json.

func (*Client) Close

func (c *Client) Close()

Close ends the MCP session.

func (*Client) Export

func (c *Client) Export(ctx context.Context, q url.Values, w func(name string) (io.WriteCloser, error)) (string, int64, error)

Export downloads one export file (GET /api/v1/export) into w and returns the file name the server proposes.

type Config

type Config struct {
	URL   string `json:"url"`
	Token string `json:"token"`
	Site  string `json:"site,omitempty"`
}

Config is what `ce login` stores: the server, the token and the default site.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL