Skip to content

cli types#96

Merged
Kitenite merged 2 commits intomainfrom
cli-types
Nov 18, 2025
Merged

cli types#96
Kitenite merged 2 commits intomainfrom
cli-types

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Nov 18, 2025

  • add ink (add ink #95)
  • upgrade ink
  • refactor source
  • cli types

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • New Features
    • Support for configurable deployment environments (local and cloud).
    • Workspace management: create, list, retrieve, update, and delete workspaces.
    • Process management: create, list, retrieve, update, stop/stop-all, and delete processes.
    • Added terminal-based processes and agent-based processes with multiple agent implementations.
    • Agent status tracking with lifecycle states (idle, running, stopped, error).

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 18, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds comprehensive TypeScript public interfaces and enums in apps/cli/src/types/index.ts modeling Environments, Workspaces (and LocalWorkspace), Processes (Agent/Terminal), Agent metadata/status, and orchestrator contracts for workspace and process lifecycle operations.

Changes

Cohort / File(s) Summary
CLI types
apps/cli/src/types/index.ts
Added typed models and enums: Environment; WorkspaceType & Workspace + LocalWorkspace; ProcessType & Process + Terminal; AgentType & Agent (with status); and orchestrator interfaces WorkspaceOrchestrator and ProcessOrchestrator with CRUD and lifecycle methods (get, list, create, update, stop, stopAll, delete).

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI
  participant Orch as ProcessOrchestrator
  participant Store as DataStore

  rect rgb(235,248,255)
    CLI->>Orch: createProcess(createPayload)
    Orch->>Store: persist(process)
    Store-->>Orch: createdProcess
    Orch-->>CLI: createdProcess
  end

  rect rgb(245,255,235)
    CLI->>Orch: stop(processId)
    Orch->>Store: markEnded(processId)
    Store-->>Orch: updatedProcess
    Orch-->>CLI: stoppedConfirmation
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify consistency of enum values and string literals (workspace/process/agent types).
  • Ensure optional timestamps (endedAt) and createdAt/updatedAt use correct Date semantics.
  • Check orchestrator method signatures for expected parameter/return types.

Possibly related PRs

  • cli types #96 — Replaces/supersedes simpler CLI type declarations in the same file; directly related to these expanded type definitions.

Poem

🐰 I hopped through types with glee,
Environments, workspaces, and processes for me.
Agents chatter, terminals rest,
Orchestrators keep them at best.
Hop—types snug in TypeScript nest!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete; while it lists commit messages, the required template sections (Description, Related Issues, Type of Change, Testing, Additional Notes) are all empty or unchecked. Fill in the Description section with details about the new interfaces, check the appropriate Type of Change box (likely 'New feature'), and add any relevant issue links or testing information.
Title check ❓ Inconclusive The title 'cli types' is vague and generic; it does not clearly convey the specific changes being made (adding new TypeScript interfaces for Env, Process, Agent, and Terminal types). Use a more descriptive title that explains the purpose, such as 'Add TypeScript type definitions for CLI environments and processes' or 'Define CLI interfaces (Env, Process, Agent, Terminal)'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 836a070 and 4b92ad4.

📒 Files selected for processing (1)
  • apps/cli/src/types/index.ts (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 289179b and 836a070.

📒 Files selected for processing (1)
  • apps/cli/src/types/index.ts (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: CI
apps/cli/src/types/index.ts

[error] 1-1: formatter would have printed formatting changes in this file.

🔇 Additional comments (2)
apps/cli/src/types/index.ts (2)

1-3: LGTM!

The Env interface is clean and straightforward for distinguishing between local and cloud environments.


15-17: Clarify the Terminal interface placeholder.

The placeholder comment suggests this interface may be incomplete. Please confirm whether:

  • Additional fields will be added in a future PR
  • The interface is intentionally empty (in which case the comment can be removed)

Comment thread apps/cli/src/types/index.ts Outdated
Comment on lines +1 to +17
export interface Env {
type: "local" | "cloud";
}

export interface Process {
id: string;
title: string;
type: "agent" | "terminal";
}

export interface Agent extends Process {
agentType: "codex" | "claude";
}

export interface Terminal extends Process {
// placeholder
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix formatting to pass CI.

The pipeline reports formatting issues in this file. Please run the project's formatter to fix these issues before merging.

#!/bin/bash
# Run the formatter on this file
npm run format apps/cli/src/types/index.ts
🧰 Tools
🪛 GitHub Actions: CI

[error] 1-1: formatter would have printed formatting changes in this file.

🤖 Prompt for AI Agents
In apps/cli/src/types/index.ts lines 1-17 the file fails CI formatting; run the
project formatter on this file (npm run format apps/cli/src/types/index.ts) or
run the repo-wide formatter, review the changed whitespace/quoting/style, stage
and commit the updated file, and push the commit so CI sees the formatted
version.

Comment on lines +5 to +17
export interface Process {
id: string;
title: string;
type: "agent" | "terminal";
}

export interface Agent extends Process {
agentType: "codex" | "claude";
}

export interface Terminal extends Process {
// placeholder
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Narrow the type field in Agent and Terminal interfaces for type safety.

Currently, Agent and Terminal extend Process without narrowing the type field. This means an Agent could have type: "terminal" and vice versa, which breaks the discriminated union pattern.

Apply this diff to properly narrow the types:

 export interface Process {
     id: string;
     title: string;
     type: "agent" | "terminal";
 }
 
-export interface Agent extends Process {
+export interface Agent extends Omit<Process, "type"> {
+    type: "agent";
     agentType: "codex" | "claude";
 }
 
-export interface Terminal extends Process {
+export interface Terminal extends Omit<Process, "type"> {
+    type: "terminal";
     // placeholder
 }

Alternatively, you could use a discriminated union approach:

export interface BaseProcess {
    id: string;
    title: string;
}

export interface Agent extends BaseProcess {
    type: "agent";
    agentType: "codex" | "claude";
}

export interface Terminal extends BaseProcess {
    type: "terminal";
}

export type Process = Agent | Terminal;
🤖 Prompt for AI Agents
In apps/cli/src/types/index.ts around lines 5 to 17, the Agent and Terminal
interfaces currently inherit the broad Process.type and can end up with the
wrong discriminant; narrow the types by either 1) removing the shared type
literal from Process and explicitly set type: "agent" on Agent and type:
"terminal" on Terminal (keeping Process as a union of Agent | Terminal), or 2)
refactor to a BaseProcess without type and then define Agent and Terminal with
their respective type literals and export Process as the discriminated union
Agent | Terminal; update any imports/usages accordingly to use the new
discriminated union.

@Kitenite Kitenite merged commit ed65cee into main Nov 18, 2025
0 of 5 checks passed
@Kitenite Kitenite deleted the cli-types branch November 18, 2025 01:57
@Kitenite Kitenite mentioned this pull request Nov 18, 2025
This was referenced Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant