Skip to content

CLI Reference

The LenserFight CLI lives at apps/cli/src/main.ts and ships as lenserfight. It uses citty for command parsing and consumes the same Postgres RPCs and @lenserfight/types DTOs as the web frontend — there is no CLI-only business logic.

bash
lenserfight <command> [subcommand] [flags]

This page lists every ConnectedLenses-relevant command. Commands that already exist link to source. Commands marked Proposed are in Future work.

Existing top-level commands

The full list of subcommands registered in main.ts:

CommandSourceConnectedLenses-relevant?
initinit.tsProject bootstrap
doctordoctor.tsDiagnostics
devdev.tsLocal-dev orchestration
seedseed.tsDB seed
resetreset.tsDB reset
statusstatus.tsDeployment status
authauth.tsSession login/logout
configconfig.tsCLI config
setupsetup.tsBootstrap helpers
lenserlenser.tsYes — agent lenser integration
agentmain.ts:29Deprecated alias of lenser
inspectinspect.tsYes — execution inspection
runrun.tsYes — execute lens / workflow
publishpublish.tsYes — publish lens version
lenslens.tsYes — lens authoring
lenseslenses.tsYes — lens listing/search
lenserlenser.tsYes — identity ops
providersproviders.tsYes — list AI providers
modelsmodels.tsYes — list AI models
gatewaygateway.tsYes — execution gateway
aiai.tsYes — AI catalog ops
tagtag.tsTag CRUD
feedfeed.tsFeed
leaderboardleaderboard.tsLeaderboard
templatetemplate.tsWorkflow template scaffolding
connectorsconnectors.tsConnector metadata
connectconnect.tsRegister connector
inviteinvite.tsInvitations
reportreport.tsReporting
rubricrubric.tsRubric editing
communitiescommunities.tsCommunity ops
battlebattle.tsBattle ops
tooltool.tsYes — tool authoring, registry, assignments, invocations, approvals
memorymemory.tsYes — memory profile + entry management

Lens commands

lens is grouped subcommands. Source: apps/cli/src/commands/lens.ts.

bash
lenserfight lens <subcommand>
SubcommandPurpose
version listList versions of a lens
version createCreate a new draft version
version publishPublish a draft version
resource attachAttach a resource (parameter binding via lenses.tools)
importImport lens from external source

Lens listing/search is the separate lenses command:

bash
lenserfight lenses search <query>
lenserfight lenses filter --tag <slug> --sort newest|trending|popular

Run commands

bash
lenserfight run <subcommand>

Source: apps/cli/src/commands/run.ts. Subcommand surface roughly mirrors workflowsService.startRun and the run-state projection.

The lenser integration uses citty and is documented at docs/reference/cli/run.md.

Inspect commands

bash
lenserfight inspect <subcommand>

Source: apps/cli/src/commands/inspect.ts. Wraps fn_workflow_get_run_state and fn_get_run_provenance to render the n8n-style inspector in the terminal.

Lenser / Agent commands

bash
lenserfight lenser <subcommand>

Source: apps/cli/src/commands/lenser.ts. Documented at docs/reference/cli/agent.md. Subcommands: connect, list, view, enable, remove, test, types.

These are agent lenser commands — registering an external lenser (e.g. local Ollama, a remote MCP server) for an Agent Lenser. They are not team management commands.

AI catalog commands

bash
lenserfight providers list
lenserfight models list [--provider <key>] [--capability <tag>] [--modality <tag>]
lenserfight ai <subcommand>

Sources:

Lenser commands

bash
lenserfight lenser <subcommand>

Source: apps/cli/src/commands/lenser.ts. Identity operations for human and agent lensers.

Publish commands

bash
lenserfight publish <subcommand>

Source: apps/cli/src/commands/publish.ts. Publishes lens versions via fn_publish_lens_version.

Memory commands

Full spec: memory-per-agent.md.

bash
lenserfight memory list-profiles --agent <ai-lenser-id>
lenserfight memory list-entries  --profile <profile-id> [--scope project|conversation|global] [--limit 50]
lenserfight memory write-entry   --profile <profile-id> --scope project --source manual --content "..." [--confidence 0.8]
lenserfight memory redact <memory-entry-id> --reason "..."
lenserfight memory summarize     --profile <profile-id>

All list commands support --json for script-friendly output.

Source: apps/cli/src/commands/memory.ts

Tool commands (expanded)

Full spec: tools.md.

bash
# Contract authoring
lenserfight tool test     <path/to/TOOL.md> [--json]
lenserfight tool register --file <path/to/TOOL.md> [--apply]

# Registry + assignments
lenserfight tool list [--registry|--assignments|--profiles] [--agent <id>]
lenserfight tool assign  --tool <tool-id> --agent <ai-lenser-id> [--profile <profile-id>]
lenserfight tool revoke  --tool <tool-id> --agent <ai-lenser-id>

# Runtime invocations
lenserfight tool invocations [--status pending|running|completed|failed] [--agent <id>] [--team-run <id>] [--limit 50]
lenserfight tool approve <invocation-id>
lenserfight tool reject  <invocation-id> --reason "<text>"

Source: apps/cli/src/commands/tool.ts

Future work

Three additional top-level commands are needed for full ConnectedLenses CLI parity. None exists today.

team command (Proposed)

bash
lenserfight team <subcommand>
SubcommandMaps to
listagentWorkspaceService.getWorkspaceBootstrap(handle).teams
create --ai-lenser <id> --name <name> [--description <text>]agentWorkspaceService.createTeam
members --team <id>agentWorkspaceService.listTeamMembers
add-member --team <id> --agent <id> --role <role> [--lane <n>]INSERT agents.team_members
remove-member --member <id>DELETE agents.team_members
edges --team <id>agentWorkspaceService.listTeamEdges
add-edge --team <id> --source <member> --target <member> --type <edge_type> [--blocking]INSERT agents.team_edges
assign --team <id> --workflow <id> [--approval-policy <json>]INSERT agents.workflow_assignments
dispatch --assignment <id> [--inputs <json>]Manual team-run dispatch
runs --ai-lenser <id> [--limit <n>]agents.team_runs recent

schedule command (Proposed)

bash
lenserfight schedule <subcommand>
SubcommandMaps to
list [--workflow <id>]fn_workflow_get_schedules
inspect --schedule <id>Single-row read of lenses.workflow_schedules
create --workflow <id> --cron <expr> --timezone <tz> --assignee-type agent|team --assignee-id <id> [--inputs-template <json>] [--approval-policy <json>] [--retry-policy <json>] [--failure-policy <json>] [--queue-policy <json>] [--inactive]fn_upsert_workflow_schedule
update --schedule <id> [...same flags as create]Same RPC with p_schedule_id
pause --schedule <id>UPDATE is_active=false (or proposed fn_pause_workflow_schedule)
resume --schedule <id>UPDATE is_active=true (or proposed fn_resume_workflow_schedule)
delete --schedule <id>DELETE row
history --schedule <id> [--limit <n>]Read of last_run_at / last_completed_at history

approval command (Proposed)

bash
lenserfight approval <subcommand>
SubcommandMaps to
list [--ai-lenser <id>]agents.team_runs WHERE approval_status='pending' (eventually agents.approval_requests_v)
inspect --request <id>Single-row read with assignment join
approve --request <id> [--reason <text>] [--modifications <json>]fn_decide_approval (proposed)
reject --request <id> [--reason <text>]fn_decide_approval (proposed)
audit --request <id>agents.agent_run_events for this team_run

execution command (Proposed)

A unified inspector across workflow_runs and team_runs:

bash
lenserfight execution list [--ai-lenser <id>] [--status <status>]
lenserfight execution inspect --run <id>
lenserfight execution provenance --run <id>
lenserfight execution events --run <id> [--after <event-id>] [--follow]
lenserfight execution cancel --run <id>
lenserfight execution retry --run <id>

Maps to workflowsService.getRunState, getRunProvenance, listRunEvents, updateRunStatus.

Authoring guidance

When adding a ConnectedLenses-related CLI command:

  1. Use citty's defineCommand (matches existing pattern in lens.ts).
  2. Import service-layer methods from @lenserfight/data-repositories. Do not call Supabase directly.
  3. Use @lenserfight/types for DTOs. Do not declare CLI-local request/response shapes.
  4. Render output with consola so the format matches the rest of the CLI.
  5. Support --json flag on list commands so output is parseable in scripts.
  6. Surface RPC errors with their SQLSTATE code (see api-reference.md).