artifacts

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package artifacts is the CLI's client for memcode.ai's artifact hosting: the agent publishes a self-contained HTML page and gets a stable, unguessable URL (memcode.ai/code/artifact/<id>) back. Publish/Update/List/Delete map onto the www /api/cli/artifacts endpoints, authenticated with the same bearer token the login flow mints (MEMCODE_API_TOKEN). This talks to the WEB APP, not the inference gateway — a deliberate, separate client.

Index

Constants

View Source
const (

	// MaxHTMLBytes mirrors the server's 1.5MB cap so an oversize artifact fails
	// fast locally instead of uploading 1.5MB to get a 413.
	MaxHTMLBytes = 1536 * 1024
)

Variables

This section is empty.

Functions

func RenderList added in v0.27.0

func RenderList(list []Artifact) string

RenderList formats artifacts as an aligned table — shared by the cobra command and the TUI /artifacts slash handler.

Types

type Artifact

type Artifact struct {
	ID        string `json:"id"`
	Title     string `json:"title,omitempty"`
	URL       string `json:"url"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

Artifact is one published page, as the www API reports it.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an authenticated memcode.ai artifacts client.

func New

func New() (*Client, error)

New builds a client from the environment. Errors when the user has no token — the caller surfaces "run `memcode login`".

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, id string) error

Delete takes a published artifact down.

func (*Client) List

func (c *Client) List(ctx context.Context) ([]Artifact, error)

List returns the org's artifacts, newest first.

func (*Client) Publish

func (c *Client) Publish(ctx context.Context, title, html string) (Artifact, error)

Publish creates a new artifact and returns it (URL included).

func (*Client) Update

func (c *Client) Update(ctx context.Context, id, title, html string) (Artifact, error)

Update replaces an artifact's content in place — the URL stays stable.

Jump to

Keyboard shortcuts

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