Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xsline OpenChatCut CLI Profile

From Leeroopedia
Knowledge Sources
Domains CLI, Configuration
Last Updated 2026-10-22 14:00 GMT

Overview

Profile bootstrap for the CLI that applies `--data-dir` before any store module loads, ensuring the runtime profile picks up the correct directory.

Description

The CLI Profile module sets `OPENCHATCUT_DATA_DIR` env var from the `--data-dir` flag. Must run before any store import because `server/runtime-profile.ts` freezes the active profile at module load time. `profileReport` reads the active profile after options are applied.

Usage

  • CLI startup: Called at the very beginning of CLI execution before any store imports.

Code Reference

Source Location

  • Repository: OpenChatCut
  • File: cli/profile.ts
  • Lines: 1-43

Signature

export function applyGlobalOptions(flags: Map<string, string | true>): void;
export function profileReport(): { dataDir: string; profileName: string };

Import

import { applyGlobalOptions, profileReport } from './profile.ts';

I/O Contract

Inputs

Name Type Required Description
flags Map Yes Parsed CLI flags containing --data-dir

Outputs

Name Type Description
applyGlobalOptions() returns void Sets OPENCHATCUT_DATA_DIR env var
profileReport() returns { dataDir, profileName } Active profile info

Usage Examples

Applying Profile Options

import { applyGlobalOptions, profileReport } from './profile.ts';

// Must run BEFORE any store imports
applyGlobalOptions(flags);
const { dataDir } = profileReport();

Related Pages

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment