### Install and Run T1Code Source: https://context7.com/maria-rcks/t1code/llms.txt Commands to run T1Code instantly, install it globally, or set up a development environment. ```bash # Run instantly without installation bunx @maria_rcks/t1code # Install globally bun add -g @maria_rcks/t1code # Develop from source git clone https://github.com/maria-rcks/t1code.git cd t1code bun install bun dev:tui ``` -------------------------------- ### Install t1code globally Source: https://github.com/maria-rcks/t1code/blob/main/README.md Installs the package globally on the system using bun. ```bash bun add -g @maria_rcks/t1code ``` -------------------------------- ### Start T1Code Server via CLI Source: https://context7.com/maria-rcks/t1code/llms.txt Execute the T1Code server with various command-line flags to control ports, modes, and environment settings. ```bash # Start with default settings t3 # Start on specific port and host t3 --port 8080 --host 0.0.0.0 # Run in TUI mode (terminal UI) t3 --mode tui # Run in desktop mode t3 --mode desktop # Disable browser auto-open t3 --no-browser # Set custom home directory t3 --home-dir ~/.config/t1code # Development mode with Vite dev server t3 --dev-url http://localhost:5173 # Enable auth token t3 --auth-token my-secret-token # Auto-create project for current directory t3 --auto-bootstrap-project-from-cwd # Environment variables T3CODE_PORT=3000 T3CODE_HOME=~/.t3 t3 T3CODE_MODE=tui T3CODE_NO_BROWSER=true t3 ``` -------------------------------- ### Run t1code instantly Source: https://github.com/maria-rcks/t1code/blob/main/README.md Executes the package directly using bunx without requiring a global installation. ```bash bunx @maria_rcks/t1code ``` -------------------------------- ### Run T3 Code Server with Tailscale IP Source: https://github.com/maria-rcks/t1code/blob/main/REMOTE.md Starts the T3 Code server, binding to the Tailscale IP address for secure access within your Tailnet. This limits exposure compared to binding to all interfaces. ```bash TAILNET_IP="$(tailscale ip -4)" TOKEN="$(openssl rand -hex 24)" bun run --cwd apps/server start -- --host "$(tailscale ip -4)" --port 3773 --auth-token "$TOKEN" --no-browser ``` -------------------------------- ### Build and Run T3 Code Server for Remote Access Source: https://github.com/maria-rcks/t1code/blob/main/REMOTE.md Builds the T3 Code web app and starts the server for remote access. Ensure your OS firewall allows inbound TCP on the selected port. Use `--host 0.0.0.0` to listen on all IPv4 interfaces and `--no-browser` to prevent local auto-open. ```bash bun run build TOKEN="$(openssl rand -hex 24)" bun run --cwd apps/server start -- --host 0.0.0.0 --port 3773 --auth-token "$TOKEN" --no-browser ``` -------------------------------- ### Develop t1code from source Source: https://github.com/maria-rcks/t1code/blob/main/README.md Clones the repository and sets up the development environment for the terminal UI. ```bash git clone https://github.com/maria-rcks/t1code.git cd t1code bun install bun dev:tui ``` -------------------------------- ### Configure Keybindings via JSON Source: https://context7.com/maria-rcks/t1code/llms.txt Define custom keybindings in the ~/.t3/keybindings.json file to map commands to specific key combinations. ```json [ { "key": "mod+j", "command": "terminal.toggle" }, { "key": "mod+d", "command": "terminal.split", "when": "terminalFocus" }, { "key": "mod+n", "command": "terminal.new", "when": "terminalFocus" }, { "key": "mod+w", "command": "terminal.close", "when": "terminalFocus" }, { "key": "mod+n", "command": "chat.new", "when": "!terminalFocus" }, { "key": "mod+shift+n", "command": "chat.newLocal", "when": "!terminalFocus" }, { "key": "mod+o", "command": "editor.openFavorite" }, { "key": "mod+t", "command": "script.test.run" } ] ``` -------------------------------- ### Initialize and Use WsTransport Source: https://context7.com/maria-rcks/t1code/llms.txt Establishes WebSocket communication for RPC requests, event subscriptions, and state management. ```typescript import { WsTransport } from "@t3tools/client-core"; // Initialize transport with server URL const transport = new WsTransport({ url: "ws://localhost:3000/ws", onWarning: (message, details) => console.warn(message, details), }); // Make RPC requests to the server const projects = await transport.request("projects.list"); const gitStatus = await transport.request("git.status", { cwd: "/path/to/project" }); // Subscribe to real-time push events const unsubscribe = transport.subscribe("orchestration.domainEvent", (message) => { console.log("Event:", message.data.type, message.data.payload); }); // Get latest cached push message const welcome = transport.getLatestPush("server.welcome"); console.log("Working directory:", welcome?.data.cwd); // Check transport state const state = transport.getState(); // "connecting" | "open" | "reconnecting" | "closed" | "disposed" // Cleanup when done unsubscribe(); transport.dispose(); ``` -------------------------------- ### Dispatch Orchestration Commands Source: https://context7.com/maria-rcks/t1code/llms.txt Dispatches commands for project creation, thread management, and AI interaction turns using the orchestration system. ```typescript import { WS_METHODS, ORCHESTRATION_WS_METHODS } from "@t3tools/contracts"; // Create a new project const createProjectCommand = { type: "project.create", commandId: crypto.randomUUID(), projectId: crypto.randomUUID(), title: "My TypeScript Project", workspaceRoot: "/home/user/projects/my-app", createdAt: new Date().toISOString(), }; const result = await transport.request( ORCHESTRATION_WS_METHODS.dispatchCommand, { command: createProjectCommand } ); console.log("Event sequence:", result.sequence); // Create a new conversation thread const createThreadCommand = { type: "thread.create", commandId: crypto.randomUUID(), threadId: crypto.randomUUID(), projectId: createProjectCommand.projectId, title: "Implement auth feature", model: "gpt-4", runtimeMode: "full-access", // or "approval-required" interactionMode: "default", // or "plan" branch: null, worktreePath: null, createdAt: new Date().toISOString(), }; await transport.request( ORCHESTRATION_WS_METHODS.dispatchCommand, { command: createThreadCommand } ); // Start a conversation turn with AI const startTurnCommand = { type: "thread.turn.start", commandId: crypto.randomUUID(), threadId: createThreadCommand.threadId, message: { messageId: crypto.randomUUID(), role: "user", text: "Create a login form component with email and password validation", attachments: [], }, provider: "codex", // or "claudeAgent" runtimeMode: "full-access", interactionMode: "default", createdAt: new Date().toISOString(), }; await transport.request( ORCHESTRATION_WS_METHODS.dispatchCommand, { command: startTurnCommand } ); ``` -------------------------------- ### Custom Keybindings JSON Structure Source: https://github.com/maria-rcks/t1code/blob/main/KEYBINDINGS.md Define custom keybindings in `~/.t3/keybindings.json`. This file must be a JSON array of rules, each specifying a key, command, and an optional 'when' condition. ```json [ { "key": "mod+g", "command": "terminal.toggle" }, { "key": "mod+shift+g", "command": "terminal.new", "when": "terminalFocus" } ] ``` -------------------------------- ### Default Keybindings JSON Structure Source: https://github.com/maria-rcks/t1code/blob/main/KEYBINDINGS.md The default keybindings are provided as a JSON array of rules. These can be found in `apps/server/src/keybindings.ts` for the most up-to-date list. ```json [ { "key": "mod+j", "command": "terminal.toggle" }, { "key": "mod+d", "command": "terminal.split", "when": "terminalFocus" }, { "key": "mod+n", "command": "terminal.new", "when": "terminalFocus" }, { "key": "mod+w", "command": "terminal.close", "when": "terminalFocus" }, { "key": "mod+n", "command": "chat.new", "when": "!terminalFocus" }, { "key": "mod+shift+o", "command": "chat.new", "when": "!terminalFocus" }, { "key": "mod+shift+n", "command": "chat.newLocal", "when": "!terminalFocus" }, { "key": "mod+o", "command": "editor.openFavorite" } ] ``` -------------------------------- ### WebSocket RPC Methods Source: https://context7.com/maria-rcks/t1code/llms.txt Standard RPC methods available via the WsTransport interface for querying system state and project information. ```APIDOC ## RPC projects.list ### Description Retrieves a list of all managed projects. ### Method RPC Request ### Endpoint projects.list ### Response #### Success Response (200) - **projects** (array) - List of project objects ## RPC git.status ### Description Retrieves the current git status for a specific project directory. ### Method RPC Request ### Endpoint git.status ### Parameters #### Request Body - **cwd** (string) - Required - The absolute path to the project directory ### Response #### Success Response (200) - **status** (object) - Git status details ``` -------------------------------- ### Dispatch Thread Commands Source: https://context7.com/maria-rcks/t1code/llms.txt Execute commands for approvals, user inputs, turn interruptions, and checkpoint reverts using the dispatchCommand method. ```typescript // Respond to approval request (for file changes, command execution, etc.) const approvalCommand = { type: "thread.approval.respond", commandId: crypto.randomUUID(), threadId: "thread-123", requestId: "approval-request-456", decision: "accept", // "accept" | "acceptForSession" | "decline" | "cancel" createdAt: new Date().toISOString(), }; await transport.request( ORCHESTRATION_WS_METHODS.dispatchCommand, { command: approvalCommand } ); // Respond to user input questions const userInputCommand = { type: "thread.user-input.respond", commandId: crypto.randomUUID(), threadId: "thread-123", requestId: "input-request-789", answers: { "question-1": "option-a", "question-2": ["option-b", "option-c"], // for multiSelect }, createdAt: new Date().toISOString(), }; await transport.request( ORCHESTRATION_WS_METHODS.dispatchCommand, { command: userInputCommand } ); // Interrupt a running turn const interruptCommand = { type: "thread.turn.interrupt", commandId: crypto.randomUUID(), threadId: "thread-123", createdAt: new Date().toISOString(), }; await transport.request( ORCHESTRATION_WS_METHODS.dispatchCommand, { command: interruptCommand } ); // Revert to a checkpoint const revertCommand = { type: "thread.checkpoint.revert", commandId: crypto.randomUUID(), threadId: "thread-123", turnCount: 2, // revert to turn 2 createdAt: new Date().toISOString(), }; await transport.request( ORCHESTRATION_WS_METHODS.dispatchCommand, { command: revertCommand } ); ``` -------------------------------- ### Parse and Match Slash Commands Source: https://context7.com/maria-rcks/t1code/llms.txt Utilize slash command utilities to parse user input strings and retrieve autocomplete suggestions for chat composer actions. ```typescript import { parseSlashCommandInput, matchSlashCommands, SLASH_COMMAND_DEFINITIONS, } from "@t3tools/client-core"; // Parse user input for slash commands const input = "/thread new My Feature Thread"; const parsed = parseSlashCommandInput(input); if (parsed) { console.log("Command:", parsed.command); // "thread" console.log("Args:", parsed.args); // "new My Feature Thread" } // Get autocomplete suggestions const query = "th"; const matches = matchSlashCommands(query); // Returns: [{ command: "thread", usage: "/thread new [title]", ... }] ``` -------------------------------- ### Manage Keybindings via WebSocket API Source: https://context7.com/maria-rcks/t1code/llms.txt Use the transport interface to programmatically upsert keybinding rules or retrieve the current server configuration. ```typescript import { WS_METHODS } from "@t3tools/contracts"; // Upsert a keybinding rule const result = await transport.request(WS_METHODS.serverUpsertKeybinding, { key: "mod+shift+t", command: "script.test.run", when: "!terminalFocus", }); console.log("Updated keybindings:", result.keybindings); console.log("Config issues:", result.issues); // Get current server config including keybindings const config = await transport.request(WS_METHODS.serverGetConfig, {}); console.log("Keybindings:", config.keybindings); console.log("Available editors:", config.availableEditors); console.log("Provider status:", config.providers); ``` -------------------------------- ### Perform Git Operations via WebSocket Source: https://context7.com/maria-rcks/t1code/llms.txt Use these methods to interact with Git repositories, including status checks, branch management, and automated stacked actions. ```typescript import { WS_METHODS } from "@t3tools/contracts"; // Get git status const status = await transport.request(WS_METHODS.gitStatus, { cwd: "/path/to/repo", }); console.log("Branch:", status.branch); console.log("Has changes:", status.hasWorkingTreeChanges); console.log("Files changed:", status.workingTree.files.length); console.log("Ahead/Behind:", status.aheadCount, status.behindCount); // List all branches const branches = await transport.request(WS_METHODS.gitListBranches, { cwd: "/path/to/repo", }); branches.branches.forEach((b) => { console.log(`${b.current ? "*" : " "} ${b.name} ${b.isDefault ? "(default)" : ""}`); }); // Run stacked git action (commit, push, create PR) const actionResult = await transport.request(WS_METHODS.gitRunStackedAction, { actionId: crypto.randomUUID(), cwd: "/path/to/repo", action: "commit_push_pr", // "commit" | "commit_push" | "commit_push_pr" commitMessage: "feat: add user authentication", featureBranch: true, }); console.log("Commit SHA:", actionResult.commit.commitSha); console.log("PR URL:", actionResult.pr.url); // Create and checkout branch await transport.request(WS_METHODS.gitCreateBranch, { cwd: "/path/to/repo", branch: "feature/new-feature", }); await transport.request(WS_METHODS.gitCheckout, { cwd: "/path/to/repo", branch: "feature/new-feature", }); // Create git worktree for parallel development const worktree = await transport.request(WS_METHODS.gitCreateWorktree, { cwd: "/path/to/repo", branch: "main", newBranch: "feature/experiment", path: null, // auto-generate path }); console.log("Worktree path:", worktree.worktree.path); // Subscribe to git action progress events transport.subscribe("git.actionProgress", (message) => { const event = message.data; switch (event.kind) { case "phase_started": console.log(`Starting ${event.phase}: ${event.label}`); break; case "hook_output": console.log(`[${event.stream}] ${event.text}`); break; case "action_finished": console.log("Git action completed:", event.result); break; } }); ``` -------------------------------- ### Define Project Scripts Source: https://context7.com/maria-rcks/t1code/llms.txt Register custom project scripts via the orchestration API to enable quick execution of common development tasks. ```typescript // Update project with scripts const updateProjectCommand = { type: "project.meta.update", commandId: crypto.randomUUID(), projectId: "project-123", scripts: [ { id: "test", name: "Run Tests", command: "npm test", icon: "test", runOnWorktreeCreate: true, }, { id: "build", name: "Build Project", command: "npm run build", icon: "build", runOnWorktreeCreate: false, }, { id: "lint", name: "Lint Code", command: "npm run lint", icon: "lint", runOnWorktreeCreate: false, }, ], }; await transport.request( ORCHESTRATION_WS_METHODS.dispatchCommand, { command: updateProjectCommand } ); // Scripts can be triggered via keybindings: // { "key": "mod+t", "command": "script.test.run" } // { "key": "mod+b", "command": "script.build.run" } ``` -------------------------------- ### Subscribe to Orchestration Events Source: https://context7.com/maria-rcks/t1code/llms.txt Use the transport layer to fetch snapshots, subscribe to domain events, and handle specific thread-related updates. Replay events are available for state synchronization after reconnection. ```typescript import { ORCHESTRATION_WS_CHANNELS, ORCHESTRATION_WS_METHODS } from "@t3tools/contracts"; // Get current snapshot of all projects and threads const snapshot = await transport.request(ORCHESTRATION_WS_METHODS.getSnapshot, {}); console.log("Projects:", snapshot.projects.length); console.log("Threads:", snapshot.threads.length); // Subscribe to domain events for real-time updates transport.subscribe(ORCHESTRATION_WS_CHANNELS.domainEvent, (message) => { const event = message.data; switch (event.type) { case "thread.message-sent": console.log(`[${event.payload.role}]: ${event.payload.text.substring(0, 100)}...`); break; case "thread.session-set": const session = event.payload.session; console.log(`Session ${session.status}: ${session.providerName}`); break; case "thread.turn-diff-completed": console.log("Turn completed with checkpoint:", event.payload.checkpointRef); console.log("Files changed:", event.payload.files.map(f => f.path)); break; case "thread.activity-appended": const activity = event.payload.activity; console.log(`[${activity.tone}] ${activity.kind}: ${activity.summary}`); break; } }); // Get diff for a specific turn range const diff = await transport.request(ORCHESTRATION_WS_METHODS.getTurnDiff, { threadId: "thread-123", fromTurnCount: 0, toTurnCount: 3, }); console.log("Unified diff:\n", diff.diff); // Replay events from a sequence number for reconnection const events = await transport.request(ORCHESTRATION_WS_METHODS.replayEvents, { fromSequenceExclusive: 42, }); events.forEach((e) => console.log("Replayed:", e.type)); ``` -------------------------------- ### Terminal Session Management Source: https://context7.com/maria-rcks/t1code/llms.txt Endpoints for managing integrated terminal sessions, including opening, writing, resizing, and closing terminals. ```APIDOC ## WS_METHODS.terminalOpen ### Description Initializes a new terminal session. ### Request Body - **threadId** (string) - Required - Associated thread ID. - **terminalId** (string) - Required - Unique terminal identifier. - **cwd** (string) - Required - Working directory. - **cols** (number) - Required - Terminal columns. - **rows** (number) - Required - Terminal rows. - **env** (object) - Optional - Environment variables. ## WS_METHODS.terminalWrite ### Description Sends input data to an active terminal session. ### Request Body - **threadId** (string) - Required - Associated thread ID. - **terminalId** (string) - Required - Unique terminal identifier. - **data** (string) - Required - Input string to send to the terminal. ``` -------------------------------- ### Orchestration Commands Source: https://context7.com/maria-rcks/t1code/llms.txt Commands dispatched via the orchestration system to manage project lifecycle, threads, and AI interactions. ```APIDOC ## POST orchestration.dispatchCommand ### Description Dispatches a command to the orchestration engine to trigger domain events. ### Method POST (via WebSocket RPC) ### Endpoint orchestration.dispatchCommand ### Parameters #### Request Body - **command** (object) - Required - The command object containing type, commandId, and specific payload fields. ### Request Example { "command": { "type": "project.create", "commandId": "uuid", "projectId": "uuid", "title": "My Project", "workspaceRoot": "/path/to/project", "createdAt": "ISO-8601-string" } } ### Response #### Success Response (200) - **sequence** (array) - The resulting sequence of domain events generated by the command ``` -------------------------------- ### Git Operations API Source: https://context7.com/maria-rcks/t1code/llms.txt Endpoints for managing Git repositories, including status checks, branching, worktrees, and stacked actions. ```APIDOC ## WS_METHODS.gitStatus ### Description Retrieves the current status of a Git repository. ### Request Body - **cwd** (string) - Required - The absolute path to the repository. ### Response - **branch** (string) - Current branch name. - **hasWorkingTreeChanges** (boolean) - Indicates if there are uncommitted changes. - **workingTree** (object) - Contains list of files changed. - **aheadCount** (number) - Commits ahead of remote. - **behindCount** (number) - Commits behind remote. ## WS_METHODS.gitRunStackedAction ### Description Executes a sequence of Git actions such as commit, push, and PR creation. ### Request Body - **actionId** (string) - Required - Unique identifier for the action. - **cwd** (string) - Required - Repository path. - **action** (string) - Required - Type of action: "commit", "commit_push", or "commit_push_pr". - **commitMessage** (string) - Required - Message for the commit. - **featureBranch** (boolean) - Required - Whether to use a feature branch. ### Response - **commit** (object) - Contains commitSha. - **pr** (object) - Contains PR url. ``` -------------------------------- ### Manage Terminal Sessions via WebSocket Source: https://context7.com/maria-rcks/t1code/llms.txt Control integrated terminal sessions by opening, sending input, resizing, and subscribing to output events. ```typescript import { WS_METHODS, DEFAULT_TERMINAL_ID } from "@t3tools/contracts"; // Open a new terminal session await transport.request(WS_METHODS.terminalOpen, { threadId: "thread-123", terminalId: DEFAULT_TERMINAL_ID, cwd: "/home/user/projects/my-app", cols: 120, rows: 30, env: { NODE_ENV: "development", DEBUG: "app:*", }, }); // Send input to terminal await transport.request(WS_METHODS.terminalWrite, { threadId: "thread-123", terminalId: DEFAULT_TERMINAL_ID, data: "npm run dev\n", }); // Resize terminal await transport.request(WS_METHODS.terminalResize, { threadId: "thread-123", terminalId: DEFAULT_TERMINAL_ID, cols: 160, rows: 40, }); // Subscribe to terminal events transport.subscribe("terminal.event", (message) => { const event = message.data; switch (event.type) { case "started": console.log("Terminal started, PID:", event.snapshot.pid); break; case "output": process.stdout.write(event.data); break; case "exited": console.log("Terminal exited with code:", event.exitCode); break; } }); // Clear terminal await transport.request(WS_METHODS.terminalClear, { threadId: "thread-123", terminalId: DEFAULT_TERMINAL_ID, }); // Close terminal await transport.request(WS_METHODS.terminalClose, { threadId: "thread-123", terminalId: DEFAULT_TERMINAL_ID, deleteHistory: false, }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.