chore: rebrand companion-os to clanker-agent

- Rename all package names from companion-* to clanker-*
- Update npm scopes from @mariozechner to @harivansh-afk
- Rename config directories .companion -> .clanker
- Rename environment variables COMPANION_* -> CLANKER_*
- Update all documentation, README files, and install scripts
- Rename package directories (companion-channels, companion-grind, companion-teams)
- Update GitHub URLs to harivansh-afk/clanker-agent
- Preserve full git history from companion-cloud monorepo
This commit is contained in:
Harivansh Rathi 2026-03-26 16:22:52 -04:00
parent f93fe7d1a0
commit 67168d8289
356 changed files with 2249 additions and 10223 deletions

View file

@ -1,4 +1,4 @@
# @mariozechner/companion-tui
# @mariozechner/clanker-tui
Minimal terminal UI framework with differential rendering and synchronized output for flicker-free interactive CLI applications.
@ -16,7 +16,7 @@ Minimal terminal UI framework with differential rendering and synchronized outpu
## Quick Start
```typescript
import { TUI, Text, Editor, ProcessTerminal } from "@mariozechner/companion-tui";
import { TUI, Text, Editor, ProcessTerminal } from "@mariozechner/clanker-tui";
// Create terminal
const terminal = new ProcessTerminal();
@ -146,7 +146,7 @@ import {
CURSOR_MARKER,
type Component,
type Focusable,
} from "@mariozechner/companion-tui";
} from "@mariozechner/clanker-tui";
class MyInput implements Component, Focusable {
focused: boolean = false; // Set by TUI when focus changes
@ -173,7 +173,7 @@ This enables IME candidate windows to appear at the correct position for CJK inp
**Container components with embedded inputs:** When a container component (dialog, selector, etc.) contains an `Input` or `Editor` child, the container must implement `Focusable` and propagate the focus state to the child:
```typescript
import { Container, type Focusable, Input } from "@mariozechner/companion-tui";
import { Container, type Focusable, Input } from "@mariozechner/clanker-tui";
class SearchDialog extends Container implements Focusable {
private searchInput: Input;
@ -542,7 +542,7 @@ Supported formats: PNG, JPEG, GIF, WebP. Dimensions are parsed from the image he
Supports both slash commands and file paths.
```typescript
import { CombinedAutocompleteProvider } from "@mariozechner/companion-tui";
import { CombinedAutocompleteProvider } from "@mariozechner/clanker-tui";
const provider = new CombinedAutocompleteProvider(
[
@ -568,7 +568,7 @@ editor.setAutocompleteProvider(provider);
Use `matchesKey()` with the `Key` helper for detecting keyboard input (supports Kitty keyboard protocol):
```typescript
import { matchesKey, Key } from "@mariozechner/companion-tui";
import { matchesKey, Key } from "@mariozechner/clanker-tui";
if (matchesKey(data, Key.ctrl("c"))) {
process.exit(0);
@ -632,7 +632,7 @@ import {
visibleWidth,
truncateToWidth,
wrapTextWithAnsi,
} from "@mariozechner/companion-tui";
} from "@mariozechner/clanker-tui";
// Get visible width of string (ignoring ANSI codes)
const width = visibleWidth("\x1b[31mHello\x1b[0m"); // 5
@ -657,8 +657,8 @@ When creating custom components, **each line returned by `render()` must not exc
Use `matchesKey()` with the `Key` helper for keyboard input:
```typescript
import { matchesKey, Key, truncateToWidth } from "@mariozechner/companion-tui";
import type { Component } from "@mariozechner/companion-tui";
import { matchesKey, Key, truncateToWidth } from "@mariozechner/clanker-tui";
import type { Component } from "@mariozechner/clanker-tui";
class MyInteractiveComponent implements Component {
private selectedIndex = 0;
@ -699,8 +699,8 @@ class MyInteractiveComponent implements Component {
Use the provided utilities to ensure lines fit:
```typescript
import { visibleWidth, truncateToWidth } from "@mariozechner/companion-tui";
import type { Component } from "@mariozechner/companion-tui";
import { visibleWidth, truncateToWidth } from "@mariozechner/clanker-tui";
import type { Component } from "@mariozechner/clanker-tui";
class MyComponent implements Component {
private text: string;
@ -799,8 +799,8 @@ npx tsx test/chat-simple.ts
### Debug logging
Set `COMPANION_TUI_WRITE_LOG` to capture the raw ANSI stream written to stdout.
Set `CLANKER_TUI_WRITE_LOG` to capture the raw ANSI stream written to stdout.
```bash
COMPANION_TUI_WRITE_LOG=/tmp/tui-ansi.log npx tsx test/chat-simple.ts
CLANKER_TUI_WRITE_LOG=/tmp/tui-ansi.log npx tsx test/chat-simple.ts
```

View file

@ -1,5 +1,5 @@
{
"name": "@mariozechner/companion-tui",
"name": "@harivansh-afk/clanker-tui",
"version": "0.56.2",
"description": "Terminal User Interface library with differential rendering for efficient text-based applications",
"type": "module",
@ -28,7 +28,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/getcompanion-ai/co-mono.git",
"url": "git+https://github.com/harivansh-afk/clanker-agent.git",
"directory": "packages/tui"
},
"engines": {

View file

@ -59,7 +59,7 @@ export class ProcessTerminal implements Terminal {
private _kittyProtocolActive = false;
private stdinBuffer?: StdinBuffer;
private stdinDataHandler?: (data: string) => void;
private writeLogPath = process.env.COMPANION_TUI_WRITE_LOG || "";
private writeLogPath = process.env.CLANKER_TUI_WRITE_LOG || "";
get kittyProtocolActive(): boolean {
return this._kittyProtocolActive;

View file

@ -227,8 +227,8 @@ export class TUI extends Container {
private hardwareCursorRow = 0; // Actual terminal cursor row (may differ due to IME positioning)
private inputBuffer = ""; // Buffer for parsing terminal responses
private cellSizeQueryPending = false;
private showHardwareCursor = process.env.COMPANION_HARDWARE_CURSOR === "1";
private clearOnShrink = process.env.COMPANION_CLEAR_ON_SHRINK === "1"; // Clear empty rows when content shrinks (default: off)
private showHardwareCursor = process.env.CLANKER_HARDWARE_CURSOR === "1";
private clearOnShrink = process.env.CLANKER_CLEAR_ON_SHRINK === "1"; // Clear empty rows when content shrinks (default: off)
private maxLinesRendered = 0; // Track terminal's working area (max lines ever rendered)
private previousViewportTop = 0; // Track previous viewport top for resize-aware cursor moves
private fullRedrawCount = 0;
@ -1009,10 +1009,10 @@ export class TUI extends Container {
this.previousHeight = height;
};
const debugRedraw = process.env.COMPANION_DEBUG_REDRAW === "1";
const debugRedraw = process.env.CLANKER_DEBUG_REDRAW === "1";
const logRedraw = (reason: string): void => {
if (!debugRedraw) return;
const logPath = path.join(os.homedir(), ".companion", "agent", "companion-debug.log");
const logPath = path.join(os.homedir(), ".clanker", "agent", "clanker-debug.log");
const msg = `[${new Date().toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
fs.appendFileSync(logPath, msg);
};
@ -1035,7 +1035,7 @@ export class TUI extends Container {
// Content shrunk below the working area and no overlays - re-render to clear empty rows
// (overlays need the padding, so only do this when no overlays are active)
// Configurable via setClearOnShrink() or COMPANION_CLEAR_ON_SHRINK=0 env var
// Configurable via setClearOnShrink() or CLANKER_CLEAR_ON_SHRINK=0 env var
if (
this.clearOnShrink &&
newLines.length < this.maxLinesRendered &&
@ -1180,9 +1180,9 @@ export class TUI extends Container {
// Log all lines to crash file for debugging
const crashLogPath = path.join(
os.homedir(),
".companion",
".clanker",
"agent",
"companion-crash.log",
"clanker-crash.log",
);
const crashData = [
`Crash at ${new Date().toISOString()}`,
@ -1233,7 +1233,7 @@ export class TUI extends Container {
buffer += "\x1b[?2026l"; // End synchronized output
if (process.env.COMPANION_TUI_DEBUG === "1") {
if (process.env.CLANKER_TUI_DEBUG === "1") {
const debugDir = "/tmp/tui";
fs.mkdirSync(debugDir, { recursive: true });
const debugPath = path.join(

View file

@ -139,7 +139,7 @@ describe("CombinedAutocompleteProvider", () => {
let outsideDir = "";
beforeEach(() => {
rootDir = mkdtempSync(join(tmpdir(), "companion-autocomplete-root-"));
rootDir = mkdtempSync(join(tmpdir(), "clanker-autocomplete-root-"));
baseDir = join(rootDir, "cwd");
outsideDir = join(rootDir, "outside");
mkdirSync(baseDir, { recursive: true });
@ -339,9 +339,9 @@ describe("CombinedAutocompleteProvider", () => {
test("includes hidden paths but excludes .git", () => {
setupFolder(baseDir, {
dirs: [".companion", ".github", ".git"],
dirs: [".clanker", ".github", ".git"],
files: {
".companion/config.json": "{}",
".clanker/config.json": "{}",
".github/workflows/ci.yml": "name: ci",
".git/config": "[core]",
},
@ -356,7 +356,7 @@ describe("CombinedAutocompleteProvider", () => {
const result = provider.getSuggestions([line], 0, line.length);
const values = result?.items.map((item) => item.value) ?? [];
assert.ok(values.includes("@.companion/"));
assert.ok(values.includes("@.clanker/"));
assert.ok(values.includes("@.github/"));
assert.ok(
!values.some(
@ -432,7 +432,7 @@ describe("CombinedAutocompleteProvider", () => {
let baseDir = "";
beforeEach(() => {
baseDir = mkdtempSync(join(tmpdir(), "companion-autocomplete-"));
baseDir = mkdtempSync(join(tmpdir(), "clanker-autocomplete-"));
});
afterEach(() => {