# hassamazam/oneshot architecture

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

- Interactive diagram: https://gitdiagram.com/hassamazam/oneshot
- Repository: https://github.com/hassamazam/oneshot

## Overview

Oneshot is an unattended GitLab issue-to-merge orchestrator: a `Loop` issue enters a deterministic conductor, which runs replayable work phases, verifies the change, opens an MR, and merges it. Its documented stages include recall, research, optional design approval, planning, implementation, test-case authoring, review, browser verification, screenshots, and merge. The repository also contains separate local-tests and Ready For Automation workflows. Edges reflect README statements and sampled imports/calls; some phase internals and optional integrations are documented but not fully sampled.

Main entry points: [`src/conductor/runner.ts`](https://github.com/hassamazam/oneshot/blob/main/src/conductor/runner.ts) (Run conductor), [`src/lib/gitlab.ts`](https://github.com/hassamazam/oneshot/blob/main/src/lib/gitlab.ts) (GitLab client), [`src/index.ts`](https://github.com/hassamazam/oneshot/blob/main/src/index.ts) (CLI entry), [`src/lib/artifacts.ts`](https://github.com/hassamazam/oneshot/blob/main/src/lib/artifacts.ts) (Run artifacts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dispatch["Dispatch and orchestration"]
  node_entry["CLI entry<br/>[index.ts]"]
  node_watcher["Issue watcher<br/>[watcher.ts]"]
  node_conductor["Run conductor<br/>[runner.ts]"]
end

subgraph group_pipeline["Ticket pipeline"]
  node_phases["Phase execution<br/>[phase.ts]"]
  node_code_phases["Work phases<br/>[codephases.ts]"]
  node_prompts["Phase prompts<br/>[prompts.ts]"]
  node_review_gate["Review gates<br/>[reviewgate.ts]"]
  node_verification["Browser verification<br/>[localtests.ts]"]
end

subgraph group_state["Run state and integrations"]
  node_artifacts[("Run artifacts<br/>[artifacts.ts]")]
  node_sqlite[("SQLite ledger<br/>[db.ts]")]
  node_gitlab_client["GitLab client<br/>[gitlab.ts]"]
  node_publisher["Artifact publisher<br/>[publish.ts]"]
  node_slack["Slack updates<br/>[slack.ts]"]
  node_worktrees["Ticket worktrees<br/>[worktrees.ts]"]
end

subgraph group_other_modes["Additional workflows"]
  node_localtests_mode["Local-tests mode<br/>[runner.ts]"]
  node_automation_mode["Automation mode<br/>[runner.ts]"]
  node_automation_context["Automation context<br/>[context.ts]"]
  node_automation_coverage["Coverage analysis<br/>[coverage.ts]"]
end

node_operator(("Operator"))
node_gitlab_issue(("Loop issue"))

node_operator -->|"starts run"| node_entry
node_gitlab_issue -.->|"queues work"| node_watcher
node_entry -->|"starts watcher"| node_watcher
node_entry -->|"dispatches run"| node_conductor
node_entry -->|"dispatches mode"| node_localtests_mode
node_entry -->|"dispatches mode"| node_automation_mode
node_watcher -.->|"starts ticket"| node_conductor
node_conductor -->|"reads issue"| node_gitlab_client
node_conductor -.->|"runs phases"| node_phases
node_conductor -->|"reads journal"| node_artifacts
node_conductor -->|"publishes pending"| node_publisher
node_conductor -.->|"manages worktree"| node_worktrees
node_conductor -.->|"sends updates"| node_slack
node_phases -->|"reads and writes"| node_artifacts
node_phases -->|"records state"| node_sqlite
node_code_phases -.->|"uses prompts"| node_prompts
node_review_gate -->|"reads journal"| node_artifacts
node_review_gate -->|"reads ticket notes"| node_gitlab_client
node_review_gate -->|"posts gate notes"| node_gitlab_client
node_verification -->|"publishes results"| node_gitlab_client
node_verification -->|"records state"| node_sqlite
node_verification -->|"uses artifacts"| node_artifacts
node_publisher -->|"reads artifacts"| node_artifacts
node_publisher -->|"uploads files"| node_gitlab_client
node_localtests_mode -->|"reads issues"| node_gitlab_client
node_localtests_mode -->|"alerts"| node_slack
node_automation_mode -->|"builds context"| node_automation_context
node_automation_mode -->|"analyzes coverage"| node_automation_coverage
node_automation_context -->|"reads issue data"| node_gitlab_client

click node_entry "https://github.com/hassamazam/oneshot/blob/main/src/index.ts"
click node_watcher "https://github.com/hassamazam/oneshot/blob/main/src/conductor/watcher.ts"
click node_conductor "https://github.com/hassamazam/oneshot/blob/main/src/conductor/runner.ts"
click node_phases "https://github.com/hassamazam/oneshot/blob/main/src/conductor/phase.ts"
click node_code_phases "https://github.com/hassamazam/oneshot/blob/main/src/conductor/codephases.ts"
click node_prompts "https://github.com/hassamazam/oneshot/blob/main/src/phases/prompts.ts"
click node_review_gate "https://github.com/hassamazam/oneshot/blob/main/src/conductor/reviewgate.ts"
click node_verification "https://github.com/hassamazam/oneshot/blob/main/src/conductor/localtests.ts"
click node_artifacts "https://github.com/hassamazam/oneshot/blob/main/src/lib/artifacts.ts"
click node_sqlite "https://github.com/hassamazam/oneshot/blob/main/src/lib/db.ts"
click node_gitlab_client "https://github.com/hassamazam/oneshot/blob/main/src/lib/gitlab.ts"
click node_publisher "https://github.com/hassamazam/oneshot/blob/main/src/lib/publish.ts"
click node_slack "https://github.com/hassamazam/oneshot/blob/main/src/lib/slack.ts"
click node_worktrees "https://github.com/hassamazam/oneshot/blob/main/src/lib/worktrees.ts"
click node_localtests_mode "https://github.com/hassamazam/oneshot/blob/main/src/localtests/runner.ts"
click node_automation_mode "https://github.com/hassamazam/oneshot/blob/main/src/automation/runner.ts"
click node_automation_context "https://github.com/hassamazam/oneshot/blob/main/src/automation/context.ts"
click node_automation_coverage "https://github.com/hassamazam/oneshot/blob/main/src/automation/coverage.ts"

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_entry,node_watcher,node_conductor toneBlue
class node_phases,node_code_phases,node_prompts,node_review_gate,node_verification toneAmber
class node_artifacts,node_sqlite,node_gitlab_client,node_publisher,node_slack,node_worktrees toneMint
class node_localtests_mode,node_automation_mode,node_automation_context,node_automation_coverage toneRose
class node_operator,node_gitlab_issue toneIndigo
```

## Components

### Dispatch and orchestration

- [CLI entry](https://github.com/hassamazam/oneshot/blob/main/src/index.ts): `src/index.ts`
- [Issue watcher](https://github.com/hassamazam/oneshot/blob/main/src/conductor/watcher.ts): `src/conductor/watcher.ts`
- [Run conductor](https://github.com/hassamazam/oneshot/blob/main/src/conductor/runner.ts): `src/conductor/runner.ts`

### Ticket pipeline

- [Phase execution](https://github.com/hassamazam/oneshot/blob/main/src/conductor/phase.ts): `src/conductor/phase.ts`
- [Work phases](https://github.com/hassamazam/oneshot/blob/main/src/conductor/codephases.ts): `src/conductor/codephases.ts`
- [Phase prompts](https://github.com/hassamazam/oneshot/blob/main/src/phases/prompts.ts): `src/phases/prompts.ts`
- [Review gates](https://github.com/hassamazam/oneshot/blob/main/src/conductor/reviewgate.ts): `src/conductor/reviewgate.ts`
- [Browser verification](https://github.com/hassamazam/oneshot/blob/main/src/conductor/localtests.ts): `src/conductor/localtests.ts`

### Run state and integrations

- [Run artifacts](https://github.com/hassamazam/oneshot/blob/main/src/lib/artifacts.ts): `src/lib/artifacts.ts`
- [SQLite ledger](https://github.com/hassamazam/oneshot/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [GitLab client](https://github.com/hassamazam/oneshot/blob/main/src/lib/gitlab.ts): `src/lib/gitlab.ts`
- [Artifact publisher](https://github.com/hassamazam/oneshot/blob/main/src/lib/publish.ts): `src/lib/publish.ts`
- [Slack updates](https://github.com/hassamazam/oneshot/blob/main/src/lib/slack.ts): `src/lib/slack.ts`
- [Ticket worktrees](https://github.com/hassamazam/oneshot/blob/main/src/lib/worktrees.ts): `src/lib/worktrees.ts`

### Additional workflows

- [Local-tests mode](https://github.com/hassamazam/oneshot/blob/main/src/localtests/runner.ts): `src/localtests/runner.ts`
- [Automation mode](https://github.com/hassamazam/oneshot/blob/main/src/automation/runner.ts): `src/automation/runner.ts`
- [Automation context](https://github.com/hassamazam/oneshot/blob/main/src/automation/context.ts): `src/automation/context.ts`
- [Coverage analysis](https://github.com/hassamazam/oneshot/blob/main/src/automation/coverage.ts): `src/automation/coverage.ts`

### Other components

- **Operator**
- **Loop issue**

## Connections

- Operator → CLI entry: starts run
- Loop issue → Issue watcher: queues work
- CLI entry → Issue watcher: starts watcher (evidence: `src/index.ts`)
- CLI entry → Run conductor: dispatches run (evidence: `src/index.ts`)
- CLI entry → Local-tests mode: dispatches mode (evidence: `src/index.ts`)
- CLI entry → Automation mode: dispatches mode (evidence: `src/index.ts`)
- Issue watcher → Run conductor: starts ticket (evidence: `src/conductor/runner.ts`)
- Run conductor → GitLab client: reads issue (evidence: `src/conductor/runner.ts`)
- Run conductor → Phase execution: runs phases (evidence: `src/conductor/runner.ts`)
- Run conductor → Run artifacts: reads journal (evidence: `src/conductor/runner.ts`)
- Run conductor → Artifact publisher: publishes pending (evidence: `src/conductor/runner.ts`)
- Run conductor → Ticket worktrees: manages worktree (evidence: `src/conductor/runner.ts`)
- Run conductor → Slack updates: sends updates (evidence: `src/conductor/runner.ts`)
- Phase execution → Run artifacts: reads and writes (evidence: `src/conductor/phase.ts`)
- Phase execution → SQLite ledger: records state (evidence: `src/conductor/phase.ts`)
- Work phases → Phase prompts: uses prompts
- Review gates → Run artifacts: reads journal (evidence: `src/conductor/reviewgate.ts`)
- Review gates → GitLab client: reads ticket notes (evidence: `src/conductor/reviewgate.ts`)
- Review gates → GitLab client: posts gate notes (evidence: `src/conductor/reviewgate.ts`)
- Browser verification → GitLab client: publishes results (evidence: `src/conductor/localtests.ts`)
- Browser verification → SQLite ledger: records state (evidence: `src/conductor/localtests.ts`)
- Browser verification → Run artifacts: uses artifacts (evidence: `src/conductor/localtests.ts`)
- Artifact publisher → Run artifacts: reads artifacts (evidence: `src/lib/publish.ts`)
- Artifact publisher → GitLab client: uploads files (evidence: `src/lib/publish.ts`)
- Local-tests mode → GitLab client: reads issues (evidence: `src/localtests/runner.ts`)
- Local-tests mode → Slack updates: alerts (evidence: `src/localtests/runner.ts`)
- Automation mode → Automation context: builds context (evidence: `src/automation/runner.ts`)
- Automation mode → Coverage analysis: analyzes coverage (evidence: `src/automation/runner.ts`)
- Automation context → GitLab client: reads issue data (evidence: `src/automation/context.ts`)
