cli

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 36 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportPath

func ImportPath(ctx context.Context, client *Client, targetPath, targetFolder string) (*noteops.ImportResult, error)

ImportPath imports a local .md file, directory tree (Obsidian vault or Markdown folder), or .zip archive into the Mote server via POST /api/v1/import/markdown or POST /api/v1/import/zip.

func IsCLISubcommand

func IsCLISubcommand(cmd string) bool

IsCLISubcommand reports whether cmd is a user-facing note/MCP/skill/upgrade CLI subcommand.

Types

type Client

type Client struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
}

Client is a lightweight HTTP client for talking to the local Mote HTTP server.

func NewClient

func NewClient(baseURL, token string, httpClient *http.Client) *Client

NewClient constructs a Client targeting baseURL (default http://127.0.0.1:5230).

func (*Client) AppendNote

func (c *Client) AppendNote(ctx context.Context, idOrPrefix, content string) (*noteops.NoteDetail, error)

func (*Client) AttachNoteToWhiteboard

func (c *Client) AttachNoteToWhiteboard(ctx context.Context, boardIDOrPrefix string, in noteops.AttachNoteToWhiteboardInput) (*model.Whiteboard, error)

func (*Client) ChangeSyncPassphrase added in v0.0.4

func (c *Client) ChangeSyncPassphrase(ctx context.Context, newPassphrase string, rotateRecovery bool) (*SyncActionResult, error)

func (*Client) ClearWhiteboardElements

func (c *Client) ClearWhiteboardElements(ctx context.Context, boardRef string) (*model.Whiteboard, error)

func (*Client) ConvertNoteBlock

func (c *Client) ConvertNoteBlock(ctx context.Context, noteRef, blockRef, targetType string, attrs map[string]any) (*noteops.NoteBlockMutationResult, error)

func (*Client) CreateCollection

func (*Client) CreateCollectionProperty

func (c *Client) CreateCollectionProperty(ctx context.Context, colRef string, in noteops.CreateCollectionPropertyInput) (*noteops.CollectionPropertyInfo, error)

func (*Client) CreateCollectionRecord

func (c *Client) CreateCollectionRecord(ctx context.Context, colRef string, in noteops.CreateCollectionRecordInput) (*noteops.CollectionRecord, error)

func (*Client) CreateCollectionTemplate

func (c *Client) CreateCollectionTemplate(ctx context.Context, colRef string, in noteops.CreateCollectionTemplateInput) (*noteops.TemplateDetail, error)

func (*Client) CreateCollectionView

func (c *Client) CreateCollectionView(ctx context.Context, colRef string, in noteops.CreateCollectionViewInput) (*noteops.CollectionViewInfo, error)

func (*Client) CreateFolder

func (c *Client) CreateFolder(ctx context.Context, in noteops.CreateFolderInput) (*noteops.FolderInfo, error)

func (*Client) CreateNote

func (c *Client) CreateNote(ctx context.Context, in noteops.CreateNoteInput) (*noteops.NoteDetail, error)

func (*Client) CreateNoteComment

func (c *Client) CreateNoteComment(ctx context.Context, noteRef string, in noteops.CreateCommentInput) (*model.CommentThread, error)

func (*Client) CreateTemplate

func (*Client) CreateWhiteboard

func (c *Client) CreateWhiteboard(ctx context.Context, in noteops.CreateWhiteboardInput) (*model.Whiteboard, error)

func (*Client) DeleteCollection

func (c *Client) DeleteCollection(ctx context.Context, colRef string, permanent bool) (*noteops.CollectionDetail, error)

func (*Client) DeleteCollectionProperty

func (c *Client) DeleteCollectionProperty(ctx context.Context, colRef, propRef string, permanent bool) (map[string]any, error)

func (*Client) DeleteCollectionRecord

func (c *Client) DeleteCollectionRecord(ctx context.Context, colRef, recordRef string, permanent bool) (*noteops.CollectionRecord, error)

func (*Client) DeleteCollectionTemplate

func (c *Client) DeleteCollectionTemplate(ctx context.Context, colRef, tplRef string, permanent bool) (map[string]any, error)

func (*Client) DeleteCollectionView

func (c *Client) DeleteCollectionView(ctx context.Context, colRef, viewRef string, permanent bool) (map[string]any, error)

func (*Client) DeleteComment

func (c *Client) DeleteComment(ctx context.Context, ref string) (*noteops.DeleteCommentResult, error)

func (*Client) DeleteFolder

func (c *Client) DeleteFolder(ctx context.Context, ref string) (*noteops.FolderInfo, error)

func (*Client) DeleteNote

func (c *Client) DeleteNote(ctx context.Context, idOrPrefix string) (*noteops.NoteDetail, error)

func (*Client) DeleteNoteBlock

func (c *Client) DeleteNoteBlock(ctx context.Context, noteRef, blockRef string) (*noteops.DeleteNoteBlockResult, error)

func (*Client) DeleteTemplate

func (c *Client) DeleteTemplate(ctx context.Context, tplRef string, permanent bool) (string, error)

func (*Client) DeleteWhiteboard

func (c *Client) DeleteWhiteboard(ctx context.Context, idOrPrefix string, permanent bool) (*model.Whiteboard, error)

func (*Client) DeleteWhiteboardElement

func (c *Client) DeleteWhiteboardElement(ctx context.Context, boardRef, elemRef string) (*noteops.DeleteWhiteboardElementResult, error)

func (*Client) DetachNoteFromWhiteboard

func (c *Client) DetachNoteFromWhiteboard(ctx context.Context, boardIDOrPrefix, noteIDOrPrefix string) (*model.Whiteboard, error)

func (*Client) DownloadExportZip

func (c *Client) DownloadExportZip(ctx context.Context, includeTrash bool) ([]byte, error)

DownloadExportZip downloads the server-generated workspace .zip archive.

func (*Client) DuplicateCollectionTemplate

func (c *Client) DuplicateCollectionTemplate(ctx context.Context, colRef, tplRef string) (*noteops.TemplateDetail, error)

func (*Client) DuplicateCollectionView

func (c *Client) DuplicateCollectionView(ctx context.Context, colRef, viewRef, newName string) (*noteops.CollectionViewInfo, error)

func (*Client) EditCommentMessage

func (c *Client) EditCommentMessage(ctx context.Context, msgRef, body string) (*model.CommentThread, error)

func (*Client) ExportWhiteboardSVG

func (c *Client) ExportWhiteboardSVG(ctx context.Context, boardRef string) (string, error)
func (c *Client) GetBacklinks(ctx context.Context, idOrPrefix string) (*noteops.NoteBacklinksResult, error)

func (*Client) GetCollection

func (c *Client) GetCollection(ctx context.Context, colRef string) (*noteops.CollectionDetail, error)

func (*Client) GetCollectionRecord

func (c *Client) GetCollectionRecord(ctx context.Context, colRef, recordRef string) (*noteops.CollectionRecord, error)

func (*Client) GetCollectionTemplate

func (c *Client) GetCollectionTemplate(ctx context.Context, colRef, tplRef string) (*noteops.TemplateDetail, error)

func (*Client) GetCommentThread

func (c *Client) GetCommentThread(ctx context.Context, threadRef string) (*model.CommentThread, error)

func (*Client) GetNote

func (c *Client) GetNote(ctx context.Context, idOrPrefix string) (*noteops.NoteDetail, error)

func (*Client) GetNoteBlock

func (c *Client) GetNoteBlock(ctx context.Context, noteRef, blockRef string) (*noteops.DocumentBlockDTO, error)

func (*Client) GetNoteRevision

func (c *Client) GetNoteRevision(ctx context.Context, noteRef, revIDOrPrefix string) (*noteops.NoteRevisionDetail, error)

func (*Client) GetSyncStatus added in v0.0.4

func (c *Client) GetSyncStatus(ctx context.Context) (*syncfolder.SyncStatus, error)

func (*Client) GetTemplate

func (c *Client) GetTemplate(ctx context.Context, tplRef string) (*noteops.TemplateDetail, error)

func (*Client) GetWhiteboard

func (c *Client) GetWhiteboard(ctx context.Context, idOrPrefix string) (*model.Whiteboard, error)

func (*Client) ImportMarkdown

func (c *Client) ImportMarkdown(ctx context.Context, in noteops.ImportMarkdownInput) (*noteops.ImportResult, error)

ImportMarkdown uploads structured Markdown files to POST /api/v1/import/markdown.

func (*Client) ImportZip

func (c *Client) ImportZip(ctx context.Context, rawZip []byte, targetFolder string) (*noteops.ImportResult, error)

ImportZip uploads a raw .zip archive to POST /api/v1/import/zip.

func (*Client) InsertNoteBlocks

func (c *Client) InsertNoteBlocks(ctx context.Context, noteRef string, in noteops.InsertBlocksInput) (*noteops.NoteBlockMutationResult, error)

func (*Client) InstantiateCollectionTemplate

func (c *Client) InstantiateCollectionTemplate(ctx context.Context, colRef, tplRef string, in noteops.InstantiateCollectionTemplateInput) (*noteops.NoteDetail, error)

func (*Client) InstantiateTemplate

func (c *Client) InstantiateTemplate(ctx context.Context, idOrName string, in noteops.InstantiateTemplateInput) (*noteops.NoteDetail, error)

func (*Client) ListCollectionProperties

func (c *Client) ListCollectionProperties(ctx context.Context, colRef string) ([]noteops.CollectionPropertyInfo, error)

func (*Client) ListCollectionRecords

func (c *Client) ListCollectionRecords(ctx context.Context, colRef, viewRef string, limit, offset int) (*noteops.CollectionRecordListResult, error)

func (*Client) ListCollectionTemplates

func (c *Client) ListCollectionTemplates(ctx context.Context, colRef string) ([]model.Template, error)

func (*Client) ListCollectionViews

func (c *Client) ListCollectionViews(ctx context.Context, colRef string) ([]noteops.CollectionViewInfo, error)

func (*Client) ListCollections

func (c *Client) ListCollections(ctx context.Context, includeDeleted, includeEmbedded bool) ([]noteops.CollectionDetail, error)

func (*Client) ListFolders

func (c *Client) ListFolders(ctx context.Context) ([]noteops.FolderInfo, error)

func (*Client) ListNoteBlocks

func (c *Client) ListNoteBlocks(ctx context.Context, noteRef string) (*noteops.NoteBlocksResult, error)

func (*Client) ListNoteComments

func (c *Client) ListNoteComments(ctx context.Context, noteRef, status string) ([]model.CommentThread, error)

func (*Client) ListNoteRevisions

func (c *Client) ListNoteRevisions(ctx context.Context, noteRef string) ([]noteops.NoteRevisionSummary, error)

func (*Client) ListOrSearchNotes

func (c *Client) ListOrSearchNotes(ctx context.Context, q, scope, folder, tag string, limit, offset int) (*noteops.NoteListResult, error)

func (*Client) ListTags

func (c *Client) ListTags(ctx context.Context) ([]noteops.TagInfo, error)

func (*Client) ListTemplates

func (c *Client) ListTemplates(ctx context.Context, scope string) ([]model.Template, error)

func (*Client) ListWhiteboardElements

func (c *Client) ListWhiteboardElements(ctx context.Context, boardRef string) (*noteops.WhiteboardElementsResult, error)

func (*Client) ListWhiteboards

func (c *Client) ListWhiteboards(ctx context.Context, includeDeleted, includeEmbedded bool) ([]model.WhiteboardSummary, error)

func (*Client) LockSync added in v0.0.4

func (c *Client) LockSync(ctx context.Context) (*SyncActionResult, error)

func (*Client) MoveNoteBlock

func (c *Client) MoveNoteBlock(ctx context.Context, noteRef, blockRef, targetBlockRef, position string) (*noteops.NoteBlockMutationResult, error)

func (*Client) ReorderCollectionViews

func (c *Client) ReorderCollectionViews(ctx context.Context, colRef string, orderedRefs []string) ([]noteops.CollectionViewInfo, error)

func (*Client) ReplyCommentThread

func (c *Client) ReplyCommentThread(ctx context.Context, threadRef, author, body string) (*model.CommentThread, error)

func (*Client) ResolveCommentThread

func (c *Client) ResolveCommentThread(ctx context.Context, threadRef string, resolved bool, actor string) (*model.CommentThread, error)

func (*Client) RestoreCollection

func (c *Client) RestoreCollection(ctx context.Context, colRef string) (*noteops.CollectionDetail, error)

func (*Client) RestoreFolder

func (c *Client) RestoreFolder(ctx context.Context, ref string) (*noteops.FolderInfo, error)

func (*Client) RestoreNote

func (c *Client) RestoreNote(ctx context.Context, idOrPrefix string) (*noteops.NoteDetail, error)

func (*Client) RestoreNoteRevision

func (c *Client) RestoreNoteRevision(ctx context.Context, noteRef, revIDOrPrefix string) (*noteops.NoteDetail, error)

func (*Client) RestoreWhiteboard

func (c *Client) RestoreWhiteboard(ctx context.Context, idOrPrefix string) (*model.Whiteboard, error)

func (*Client) SeedDemoWorkspace

func (c *Client) SeedDemoWorkspace(ctx context.Context, in noteops.SeedDemoInput) (*noteops.SeedDemoResult, error)

SeedDemoWorkspace calls POST /api/v1/demo/seed to idempotently populate the Mote showcase dataset.

func (*Client) SetDefaultCollectionTemplate

func (c *Client) SetDefaultCollectionTemplate(ctx context.Context, colRef, tplRef string) (*noteops.TemplateDetail, error)

func (*Client) SetSyncConfig added in v0.0.4

func (c *Client) SetSyncConfig(ctx context.Context, syncDir string, enabled bool, cred syncfolder.UnlockCredential) (*SyncActionResult, error)

func (*Client) TriggerSyncNow added in v0.0.4

func (c *Client) TriggerSyncNow(ctx context.Context) (*SyncActionResult, error)

func (*Client) UnlockSync added in v0.0.4

func (*Client) UpdateCollection

func (c *Client) UpdateCollection(ctx context.Context, colRef string, in noteops.UpdateDatabaseInput) (*noteops.CollectionDetail, error)

func (*Client) UpdateCollectionProperty

func (c *Client) UpdateCollectionProperty(ctx context.Context, colRef, propRef string, in noteops.UpdateCollectionPropertyInput) (*noteops.CollectionPropertyInfo, error)

func (*Client) UpdateCollectionRecord

func (c *Client) UpdateCollectionRecord(ctx context.Context, colRef, recordRef string, in noteops.UpdateCollectionRecordInput) (*noteops.CollectionRecord, error)

func (*Client) UpdateCollectionTemplate

func (c *Client) UpdateCollectionTemplate(ctx context.Context, colRef, tplRef string, in noteops.UpdateCollectionTemplateInput) (*noteops.TemplateDetail, error)

func (*Client) UpdateCollectionView

func (c *Client) UpdateCollectionView(ctx context.Context, colRef, viewRef string, in noteops.UpdateCollectionViewInput) (*noteops.CollectionViewInfo, error)

func (*Client) UpdateFolder

func (c *Client) UpdateFolder(ctx context.Context, ref string, in noteops.UpdateFolderInput) (*noteops.FolderInfo, error)

func (*Client) UpdateNote

func (c *Client) UpdateNote(ctx context.Context, idOrPrefix string, in noteops.UpdateNoteInput) (*noteops.NoteDetail, error)

func (*Client) UpdateNoteBlock

func (c *Client) UpdateNoteBlock(ctx context.Context, noteRef, blockRef string, in noteops.UpdateBlockInput) (*noteops.NoteBlockMutationResult, error)

func (*Client) UpdateTemplate

func (c *Client) UpdateTemplate(ctx context.Context, tplRef string, in noteops.UpdateTemplateInput) (*noteops.TemplateDetail, error)

func (*Client) UpdateWhiteboard

func (c *Client) UpdateWhiteboard(ctx context.Context, boardRef string, in noteops.UpdateWhiteboardInput) (*model.Whiteboard, error)

func (*Client) UpdateWhiteboardElement

func (c *Client) UpdateWhiteboardElement(ctx context.Context, boardRef, elemRef string, in noteops.UpdateWhiteboardElementInput) (*noteops.WhiteboardElementMutationResult, error)

type ExportResult

type ExportResult struct {
	OutPath         string   `json:"out"`
	NoteCount       int      `json:"note_count"`
	BlobCount       int      `json:"blob_count"`
	WhiteboardCount int      `json:"whiteboard_count,omitempty"`
	Files           []string `json:"files"`
}

ExportResult summarizes a completed `mote export` archive.

func ExportZip

func ExportZip(ctx context.Context, client *Client, outPath string, includeTrash bool) (*ExportResult, error)

ExportZip downloads GET /api/v1/export/zip from the local Mote server, atomically writes it to outPath, and inspects the archive entries to produce ExportResult.

type GlobalOptions

type GlobalOptions struct {
	Server             string
	ServerFlagExplicit bool
	ServerEnvExplicit  bool
	Token              string
	DataDir            string
	DataFlagExplicit   bool
	DataEnvExplicit    bool
	Direct             bool
	JSONOut            bool
}

GlobalOptions holds CLI-wide transport & formatting settings.

type Runner

type Runner struct {
	In               io.Reader
	Out              io.Writer
	ErrOut           io.Writer
	StdinIsTTY       bool
	HTTPClient       *http.Client
	DefaultServerURL string
	BuildVersion     string
	CLIOnly          bool
	UpdaterClient    *updater.Client
}

Runner executes user-facing Mote CLI subcommands against a local/remote Mote HTTP server or directly against the local SQLite WAL database in-process when no server is running.

func DefaultRunner

func DefaultRunner() *Runner

DefaultRunner builds a Runner wired to os.Stdin / os.Stdout / os.Stderr.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, args []string) error

Run dispatches a CLI invocation (may contain global flags before or after the subcommand).

type SyncActionResult added in v0.0.4

type SyncActionResult struct {
	Status      syncfolder.SyncStatus  `json:"status"`
	Report      *syncfolder.SyncReport `json:"report,omitempty"`
	RecoveryKey string                 `json:"recovery_key,omitempty"`
}

SyncActionResult mirrors the JSON payload of sync config, sync now, unlock, lock, and passphrase endpoints.

Jump to

Keyboard shortcuts

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