INNER CODE UNIT · TypeScript

runAgentMode

AmrDab/clawdcursor · src/surface/cli.ts:261

async function runAgentMode(opts: AgentModeOpts): Promise<void> {
  // commander stores negated flags as `{ llm: false }` / `{ vision: false }`.
  // Keep the internal explicit names so callers/tests can also pass noLlm /
  // noVision directly.
  const forceNoLlm = Boolean(opts.noLlm || (opts as any).llm === false);
  const forceNoVision = Boolean(opts.noVision || (opts as any).vision === false);

  // Single-instance guard — uses the legacy `start` lockfile name so
  // existing `clawdcursor stop` sweeps still find it.
  const existingPid = claimPidFile('start');
  if (existingPid !== null) {
    console.error(`${e('❌', '[ERR]')} clawdcursor agent is already running (pid ${existingPid}). Run \`clawdcursor stop\` first.`);
    process.exit(1);
  }

  // ── Consent ──
  const { hasConsent, writeConsentFile, runOnboarding } = await import('./onboarding');
  const canSkipDev = opts.skipConsent && process.env.NODE_ENV === 'development';

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…