Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,43 @@

## Project Structure & Module Organization

This `pnpm` monorepo contains a desktop-first workflow app, relay backend, connector, and Flutter client.

- `apps/desktop/electron/`: Electron main process and preload.
- `apps/desktop/renderer/src/`: React UI: `pages/`, `components/`, `stores/`, and `lib/`.
- `apps/desktop/local-server-controllers/`: Express/WebSocket controllers.
- `apps/desktop/connector/`: bridge for local state sync and remote commands.
- `apps/backend/`: cloud relay backend, default port `8787`.
- `apps/mobile/`: Flutter app, including `lib/` and `test/`.
- `packages/core-models/`, `packages/core-lib/`: shared models and runtime helpers.
This `pnpm` monorepo contains a web workflow app, local daemon, and stateless relay server.

- `apps/web/src/`: React UI: `pages/`, `components/`, `stores/`, and `lib/`.
- `apps/daemon/`: local daemon for workflow/task data and outbound relay connection.
- `apps/server/`: stateless relay server, default port `8787`.
- `packages/protocol/`: shared daemon/server/web protocol contracts.
- `docs/`, `references/`, `examples/`, and demo folders hold notes and experiments.

## Build, Test, and Development Commands

Use Node `25` from `.nvmrc`; run `pnpm` at the repo root.

- `pnpm install`: install workspace dependencies.
- `pnpm dev:renderer`: start Vite on `127.0.0.1:5173`.
- `pnpm dev:desktop`: run renderer, local server, connector, and Electron.
- `pnpm dev:desktop-stack`: run server, backend, and connector.
- `pnpm dev:backend`: start the relay backend.
- `pnpm dev:server`: start the local workflow server on port `3000`.
- `pnpm dev:connector`: start the desktop connector.
- `pnpm build:desktop`: build `apps/desktop/renderer/dist`.
- `pnpm start:desktop`: open Electron with the existing renderer build.
- `cd apps/mobile && flutter pub get && flutter analyze`: install and check Flutter code.
- `pnpm dev:web`: start Vite on `127.0.0.1:5173`.
- `pnpm dev:all`: run web app, relay server, and daemon.
- `pnpm dev:stack`: run relay server and daemon.
- `pnpm dev:relay-server`: start the relay server.
- `pnpm dev:server`: alias for the stateless relay server.
- `pnpm dev:daemon`: start the local daemon; it connects outbound to the relay server.
- `pnpm build:web`: build `apps/web/dist`.
- `pnpm build:daemon`: check the daemon package.
- `pnpm build:server`: check the relay server package.

`pnpm test` fails intentionally because no Node test suite is configured.

## Coding Style & Naming Conventions

Keep changes surgical and match nearby code. Use ES modules for Node and React. JavaScript and JSX use 2-space indentation, double quotes, and semicolons. Name React components with `PascalCase`, such as `HomePage.jsx`; use `camelCase` for variables and functions; keep Node filenames lowercase, such as `workflowController.mjs`. For Flutter, follow standard Dart formatting.
Keep changes surgical and match nearby code. Use ES modules for Node and React. JavaScript and JSX use 2-space indentation, double quotes, and semicolons. Name React components with `PascalCase`, such as `HomePage.jsx`; use `camelCase` for variables and functions; keep Node filenames lowercase, such as `workflowController.mjs`.

## Testing Guidelines

For desktop UI changes, run `pnpm build:desktop`; smoke-test with `pnpm dev:desktop` or `pnpm start:desktop` when behavior changes. For backend, connector, or server changes, manually verify the affected API or WebSocket path with the relevant `pnpm dev:*` command. For mobile changes, run `flutter analyze` under `apps/mobile`. If tests are added, place them near the feature or under `tests/` as `*.test.*`.
For web UI changes, run `pnpm build:web`; smoke-test with `pnpm dev:all` when behavior changes. For daemon or server changes, manually verify the affected API or WebSocket path with the relevant `pnpm dev:*` command. If tests are added, place them near the feature or under `tests/` as `*.test.*`.

## Commit & Pull Request Guidelines

Use short, imperative commit subjects. History includes plain subjects like `update title and link text` and Conventional Commit style such as `feat: enhance task deletion process`. Keep commits focused. PRs should describe changes, verification, and screenshots for renderer UI updates. Link related issues or workflow tasks.

## Configuration Notes

Treat `apps/desktop/renderer/dist` as build output; edit source under `apps/desktop/renderer/src`. Keep mobile access and relay behavior desktop-first unless the task expands backend or mobile ownership.
Treat `apps/web/dist` as build output; edit source under `apps/web/src`.
57 changes: 57 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Development Commands

- Install dependencies: `pnpm install`
- Start full local stack: `pnpm dev:all`
- Start web app only: `pnpm dev:web`
- Start relay server and daemon: `pnpm dev:stack`
- Start relay server only: `pnpm dev:relay-server`
- Start daemon only: `pnpm dev:daemon`
- Build web app: `pnpm build:web`
- Build daemon: `pnpm build:daemon`
- Build relay server: `pnpm build:server`

## Testing Commands

- Run web test suite: `pnpm test`
- Run web tests directly: `pnpm --dir apps/web test`
- Run a single test file: `pnpm --dir apps/web vitest run src/path/to/file.test.ts`
- Run tests matching a name: `pnpm --dir apps/web vitest run -t "test name"`
- Run protocol tests: `pnpm test:protocol`

## Current Command Gaps

- No root `lint` script is currently defined in `package.json`.

## Architecture Overview

This is a `pnpm` monorepo for a local AI workflow runner.

Primary runtime path:

1. The React web app in `apps/web` talks to the relay server over HTTP/WebSocket.
2. The relay server in `apps/server` stays stateless and forwards UI requests to a connected daemon.
3. The daemon in `apps/daemon` owns workflow/task data, JSON storage, local APIs, and workflow runtime execution.
4. Shared protocol contracts live in `packages/protocol`.

## Key Module Responsibilities

- `apps/web`: React UI for workflows, tasks, settings, and skills.
- `apps/daemon`: local source of truth for config, workflows, skills, workfolders, tasks, artifacts, runtime, and worktrees.
- `apps/server`: in-memory relay for daemon presence, task snapshots/events, and UI commands.
- `packages/protocol`: shared REST/WebSocket message contracts.

## Data and Storage Notes

- Daemon data is stored under `~/.dev-workflow` by default.
- The relay server stores only short-lived coordination state in memory.
- Workflow execution depends on the daemon staying online.

## Practical Development Notes

- For web behavior changes, run `pnpm build:web` and smoke-test with `pnpm dev:all`.
- For daemon/server behavior changes, verify the affected API or WebSocket path with the relevant `pnpm dev:*` command.
- Treat `apps/web/dist` as build output; edit web source under `apps/web/src`.
165 changes: 48 additions & 117 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,186 +1,117 @@
# Dev Workflow

Dev Workflow is an Electron desktop app for running AI-assisted development workflows on your own machine.
Dev Workflow is a local web app for running AI-assisted development workflows on your own machine.

The desktop app is the source of truth. It manages workflow definitions, selected project folders, task runs, AI agent execution, uploaded context, generated outputs, skills, and optional Git worktrees locally. The mobile app is still early and currently only exists as an optional remote companion through the relay backend.
The daemon is the source of truth. It stores workflow definitions, selected project folders, task runs, AI agent execution state, uploaded context, generated outputs, skills, and optional Git worktrees under `~/.dev-workflow` by default. The web app talks to the stateless relay server, and the relay server forwards requests to the local daemon.

## What The Desktop App Does
## What The App Does

The app is meant to turn repeatable development work into guided, inspectable workflow runs. Instead of manually prompting an AI agent step by step, you define a workflow made of agent steps, condition steps, and checkpoint steps. Then you start a task from the desktop UI, provide the task context, and let the app run each phase while keeping the state, logs, outputs, and decisions organized.
The app turns repeatable development work into guided, inspectable workflow runs. You define a workflow made of agent steps, condition steps, and checkpoint steps, then start a task from the web UI against a local project folder. The daemon runs each phase and keeps state, logs, outputs, and decisions organized.

Typical use cases:

- Create a workflow for a recurring engineering process, such as planning, implementation, review, or documentation.
- Create workflows for planning, implementation, review, or documentation.
- Start a task against a real local project folder.
- Provide structured context fields and pasted or uploaded screenshots/images.
- Provide structured context fields and uploaded screenshots/images.
- Let Claude or Codex execute workflow phases from the local runtime.
- Review each phase in a graph-based run page that shows status, routes, checkpoints, outputs, logs, and debug details.
- Approve, reject, or send follow-up messages when a checkpoint needs human input.
- Review each phase in a graph-based run page.
- Approve, reject, or send follow-up messages at checkpoints.
- Save generated outputs and phase artifacts under the task run.
- Use managed skills to control how agents perform specific workflow steps.
- Optionally create a Git worktree for a workflow run so code changes stay isolated.

In short, the Electron app is a local control center for AI-assisted project work: it stores the workflow, starts the agents, tracks every phase, and keeps the run tied to your actual workspace.

## Download

Download the macOS installer from the latest GitHub release:

https://github.com/hileix/dev-workflow/releases/latest/download/dev-workflow.dmg

Open the DMG, drag Dev Workflow into Applications, then launch it from Applications.
- Use managed skills to guide specific workflow steps.
- Optionally create a Git worktree so code changes stay isolated.

## Architecture

```txt
Electron Desktop App
|
| local IPC
v
Desktop Runtime + Local Workflow Server
|
| local HTTP / WebSocket
v
Desktop Connector
|
| WebSocket
v
Relay Backend
|
| HTTP / WebSocket
v
Flutter Mobile App
Web App
|
| HTTP / WebSocket
v
Relay Server
|
| WebSocket
v
Daemon
```

Mobile access is disabled by default and is not the main product surface yet.

## Repository Layout

- `apps/desktop/electron`: Electron main process, preload bridge, API handlers, and workflow runtime.
- `apps/desktop/renderer`: React renderer for the desktop app.
- `apps/desktop/local-server-controllers`: local Express and WebSocket controllers.
- `apps/desktop/connector`: bridge between local desktop state and the relay backend.
- `apps/backend`: in-memory relay backend for mobile access.
- `apps/mobile`: Flutter mobile client.
- `packages/core-models`: workflow, config, state, skills, and workfolder storage.
- `packages/core-lib`: shared workflow runtime helpers, worktree helpers, and SDK adapters.
- `apps/web`: React web app.
- `apps/daemon`: local backend daemon that owns workflow/task data, JSON storage, workflow runtime, and outbound relay connection.
- `apps/server`: stateless in-memory relay server.
- `packages/protocol`: shared REST/WebSocket message contracts.
- `docs`: design notes and implementation plans.
- `references`: external source snapshots used for architecture research.

## Requirements

- Node.js from `.nvmrc`
- `pnpm`
- Flutter, only for mobile development

Install dependencies:

```bash
pnpm install
cd apps/mobile && flutter pub get
```

## Desktop Development
## Development

Start the desktop app, local workflow server, and connector:
Start the full local stack:

```bash
pnpm dev:desktop
pnpm dev:all
```

Build the renderer:
Start only the relay server and daemon:

```bash
pnpm build:desktop
pnpm dev:stack
```

Run Electron with the existing renderer build:

```bash
pnpm start:desktop
```

Useful focused commands:

```bash
pnpm dev:renderer
pnpm dev:server
pnpm dev:connector
```

## Mobile Relay Development

Start the local workflow server, backend, and connector:
Start individual processes:

```bash
pnpm dev:mobile-stack
pnpm dev:web
pnpm dev:daemon
pnpm dev:relay-server
```

Start the Flutter app in another terminal:

```bash
pnpm dev:mobile
```

Set the backend URL in the mobile app:

- iOS simulator: `http://127.0.0.1:8787`
- Android emulator: `http://10.0.2.2:8787`
- Real device on the same LAN: `http://<your-host-ip>:8787`

Useful checks:

```txt
http://127.0.0.1:3000
http://127.0.0.1:5173
http://127.0.0.1:8787/health
http://127.0.0.1:8787/api/devices
```

If the connector is online and mobile access is enabled, the device list should include `desktop-local`.

## Runtime Data

Desktop data is stored under the platform app-data directory:

- macOS: `~/Library/Application Support/dev-Workflow`
- Windows: `%APPDATA%/dev-Workflow`
- Linux: `$XDG_CONFIG_HOME/dev-Workflow` or `~/.config/dev-Workflow`
Daemon data is stored under `~/.dev-workflow` by default.

Important subpaths:

- `config.json`: active workflow, mobile access, and AI backend settings.
- `config.json`: active workflow and AI backend settings.
- `workflows/`: app-managed workflow DSL JSON files.
- `skills/`: app-managed skills.
- `tasks/`: task run state, uploads, phase logs, and output artifacts.

Legacy workflow JSON files from repo-root `workflows/` are migrated into the app-data workflow directory when possible.

## Commands

```bash
pnpm dev:desktop # desktop UI + local server + connector
pnpm dev:desktop-stack # local server + backend + connector
pnpm dev:mobile-stack # local server + backend + connector
pnpm dev:all # desktop stack plus backend
pnpm dev:backend # relay backend only
pnpm build:desktop # build React renderer
pnpm start:desktop # start Electron from existing build
```

`pnpm test` is not configured and currently exits with an intentional error.

For mobile checks:

```bash
cd apps/mobile
flutter analyze
flutter run -d ios
flutter run -d android
pnpm dev:web # web app only
pnpm dev:stack # relay server + daemon
pnpm dev:all # web app + relay server + daemon
pnpm dev:daemon # daemon only; connects outbound to relay server
pnpm dev:relay-server # relay server only
pnpm build:web # build React web app
pnpm build:daemon # check daemon package
pnpm build:server # check relay server package
pnpm test # web tests
pnpm test:protocol # protocol tests
```

## Current Limitations

- The backend stores relay state in memory.
- Mobile access has no production pairing or authentication layer yet.
- Workflow execution depends on the desktop machine staying online.
- Mobile supports remote task visibility and commands, not full workflow editing.
- The relay server stores coordination state in memory.
- There is no production authentication layer yet.
- Workflow execution depends on the daemon staying online.
Loading
Loading