# farizdotid/teundeun-cli architecture

> Architecture diagram of the GitHub repository farizdotid/teundeun-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/farizdotid/teundeun-cli
- Repository: https://github.com/farizdotid/teundeun-cli

## Overview

Teundeun is a local CLI for saving, listing, searching, resuming, and deleting named AI coding sessions. The main workflow enters through the CLI, dispatches to a command handler, and persists or retrieves session records in a local JSON file; resuming dispatches the stored command to a provider executable. The README documents all five commands and local-only storage. Some command modules are represented from the tree and README; their internal wiring is included only where supported by sampled source.

Main entry points: [`src/cli.js`](https://github.com/farizdotid/teundeun-cli/blob/main/src/cli.js) (CLI dispatcher), [`src/storage.js`](https://github.com/farizdotid/teundeun-cli/blob/main/src/storage.js) (Session storage), [`src/commands/list.js`](https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/list.js) (List sessions), [`src/commands/search.js`](https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/search.js) (Search sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_cli["CLI dispatcher<br/>[cli.js]"]
end

subgraph group_commands["Session commands"]
  node_save["Save session<br/>[save.js]"]
  node_list["List sessions<br/>[list.js]"]
  node_search["Search sessions<br/>[search.js]"]
  node_resume["Resume session<br/>[resume.js]"]
  node_delete["Delete session<br/>[delete.js]"]
  node_formatter["Table formatter<br/>[formatter.js]"]
end

subgraph group_storage["Local persistence"]
  node_storage_api["Session storage<br/>[storage.js]"]
  node_session_file[("Sessions JSON")]
end

node_user(("Terminal user"))
node_provider_cli["Provider executable"]

node_user -->|"runs command"| node_cli
node_cli -->|"dispatches save"| node_save
node_cli -->|"dispatches list"| node_list
node_cli -->|"dispatches search"| node_search
node_cli -->|"dispatches resume"| node_resume
node_cli -->|"dispatches delete"| node_delete
node_save -->|"checks and saves"| node_storage_api
node_list -->|"reads sessions"| node_storage_api
node_list -->|"formats table"| node_formatter
node_search -->|"searches sessions"| node_storage_api
node_search -->|"formats matches"| node_formatter
node_resume -->|"finds session"| node_storage_api
node_resume -->|"spawns command"| node_provider_cli
node_delete -->|"deletes session"| node_storage_api
node_storage_api -->|"reads and writes"| node_session_file

click node_cli "https://github.com/farizdotid/teundeun-cli/blob/main/src/cli.js"
click node_save "https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/save.js"
click node_list "https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/list.js"
click node_search "https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/search.js"
click node_resume "https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/resume.js"
click node_delete "https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/delete.js"
click node_formatter "https://github.com/farizdotid/teundeun-cli/blob/main/src/formatter.js"
click node_storage_api "https://github.com/farizdotid/teundeun-cli/blob/main/src/storage.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_user toneBlue
class node_save,node_list,node_search,node_resume,node_delete,node_formatter toneAmber
class node_storage_api,node_session_file toneMint
class node_provider_cli toneIndigo
```

## Components

### CLI entry

- [CLI dispatcher](https://github.com/farizdotid/teundeun-cli/blob/main/src/cli.js): `src/cli.js`

### Session commands

- [Save session](https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/save.js): `src/commands/save.js`
- [List sessions](https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/list.js): `src/commands/list.js`
- [Search sessions](https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/search.js): `src/commands/search.js`
- [Resume session](https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/resume.js): `src/commands/resume.js`
- [Delete session](https://github.com/farizdotid/teundeun-cli/blob/main/src/commands/delete.js): `src/commands/delete.js`
- [Table formatter](https://github.com/farizdotid/teundeun-cli/blob/main/src/formatter.js): `src/formatter.js`

### Local persistence

- [Session storage](https://github.com/farizdotid/teundeun-cli/blob/main/src/storage.js): `src/storage.js`
- **Sessions JSON**

### Other components

- **Terminal user**
- **Provider executable**

## Connections

- Terminal user → CLI dispatcher: runs command
- CLI dispatcher → Save session: dispatches save
- CLI dispatcher → List sessions: dispatches list
- CLI dispatcher → Search sessions: dispatches search
- CLI dispatcher → Resume session: dispatches resume
- CLI dispatcher → Delete session: dispatches delete
- Save session → Session storage: checks and saves
- List sessions → Session storage: reads sessions
- List sessions → Table formatter: formats table
- Search sessions → Session storage: searches sessions
- Search sessions → Table formatter: formats matches
- Resume session → Session storage: finds session
- Resume session → Provider executable: spawns command
- Delete session → Session storage: deletes session
- Session storage → Sessions JSON: reads and writes
