Skip to content
Open
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
21 changes: 13 additions & 8 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ work-please/ # Monorepo root (Bun + Turborepo)
│ ├── cli.ts # CLI parsing and startup (Commander)
│ ├── orchestrator.ts # Core loop: poll → reconcile → dispatch → retry
│ ├── config.ts # YAML front matter → typed ServiceConfig with env-var resolution
│ ├── workflow.ts # WORKFLOW.md parser (YAML front matter + Liquid body)
│ ├── workflow.ts # WORKFLOW.md parser + repo override merge (YAML front matter + Liquid body)
│ ├── prompt-builder.ts # Liquid template rendering (issue → prompt string)
│ ├── agent-runner.ts # Claude Code agent session via @anthropic-ai/claude-agent-sdk
│ ├── workspace.ts # Per-issue directory management, git worktrees, lifecycle hooks
Expand Down Expand Up @@ -195,13 +195,18 @@ simple for daemon operation.

### Configuration

Single-file configuration via `WORKFLOW.md` in the target repository:

- **YAML front matter** — Tracker connection, polling interval, workspace root, hooks, agent
limits, Claude CLI settings
- **Liquid template body** — Prompt template rendered with issue context variables
- **Live reload** — File watcher triggers re-parse; invalid configs are rejected with the last
known-good config retained
Two-layer configuration via `WORKFLOW.md`:

- **Global WORKFLOW.md** (operator) — Defines service-level settings (tracker, polling, workspace)
and default agent config. Read at startup and watched for live reload.
- **Repo WORKFLOW.md** (target repository, optional) — Overrides selected agent-level settings and
the prompt template for issues from that repo. Only read when `repo_overrides: true` is set in
the global workflow. Service-level sections are never overridable (security boundary).
- **Merge semantics** — Allowed config sections are deep-merged (repo values win); prompt template
is replaced if repo provides a non-empty one. Merge happens per-issue at dispatch time via
`resolveEffectiveWorkflow()` in the orchestrator.
- **Live reload** — File watcher triggers re-parse of the global workflow; invalid configs are
rejected with the last known-good config retained.

### Authentication

Expand Down
101 changes: 101 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Work Pleaseはイシュートラッカーのタスクを隔離された自律的
- [WORKFLOW.md設定](#workflowmd設定)
- [完全なFront Matterスキーマ](#完全なfront-matterスキーマ)
- [テンプレート変数](#テンプレート変数)
- [リポジトリごとのワークフローオーバーライド](#リポジトリごとのワークフローオーバーライド)
- [仕組み](#仕組み)
- [オーバーライドルール](#オーバーライドルール)
- [例](#例)
- [CLI使用方法](#cli使用方法)
- [GitHub App認証](#github-app認証)
- [GitHub App資格情報の設定](#github-app資格情報の設定)
Expand Down Expand Up @@ -75,6 +79,10 @@ GitHub Projects v2 / AsanaおよびClaude Codeに適応されています(Line
- **動的設定リロード** — `WORKFLOW.md`を編集すると、サービス再起動なしで変更が適用されます。
- **ワークスペースフック** — `after_create`、`before_run`、`after_run`、`before_remove`ライフサイクル
イベントでシェルスクリプトを実行します。
- **リポジトリごとのワークフローオーバーライド** — ターゲットリポジトリが独自の`WORKFLOW.md`を
提供して、エージェント設定とプロンプトテンプレートをカスタマイズできます。グローバルワークフローで
`repo_overrides: true`で有効化します。サービスレベルの設定(tracker、polling、workspace)は
オーバーライドされません。
- **構造化ロギング** — 安定した`key=value`形式のオペレーター可視ログを提供します。
- **オプションHTTPダッシュボード** — `--port`で有効化して、ランタイム状態とJSON APIを確認できます。

Expand Down Expand Up @@ -455,6 +463,12 @@ claude:
commit: "🙏 Generated with [Work Please](https://github.com/pleaseai/work-please)" # 任意: gitコミットメッセージに追加。デフォルトはWork Pleaseリンク。
pr: "🙏 Generated with [Work Please](https://github.com/pleaseai/work-please)" # 任意: PR説明に追加。デフォルトはWork Pleaseリンク。

repo_overrides: true # 任意: ターゲットリポジトリが独自のWORKFLOW.mdでワークフローをオーバーライドできるようにする。
# デフォルト: false(リポジトリのWORKFLOW.mdファイルは無視される)。
# きめ細かい制御のためにオブジェクトも使用可能:
# repo_overrides:
# allow: [agent, claude, env, prompt_template] # リポジトリがオーバーライドできるセクションを制限

server:
port: 3000 # 任意: このポートでHTTPダッシュボードを有効化
---
Expand Down Expand Up @@ -510,6 +524,93 @@ server:
{% endif %}
```

## リポジトリごとのワークフローオーバーライド

複数のリポジトリにまたがるGitHub Projects v2プロジェクトを管理する場合、各ターゲットリポジトリが
独自の`WORKFLOW.md`を提供して、グローバル設定を変更せずにエージェントの動作をカスタマイズできます。

### 仕組み

1. オペレーターのグローバル`WORKFLOW.md`がサービスを起動し、サービスレベルの設定(tracker、polling、
Comment thread
amondnet marked this conversation as resolved.
workspace)を定義します。この機能を有効にするには`repo_overrides: true`を含める必要があります。
2. イシューがディスパッチされると、Work Pleaseはグローバル設定を使用してワークスペース
(クローン/ワークツリー)を作成します。
3. ワークスペースの準備が完了すると、Work Pleaseはリポジトリルートの`WORKFLOW.md`を確認します。
4. 見つかった場合、リポジトリの設定セクションがグローバル設定にディープマージされ(許可されたセクション
のみ)、リポジトリのプロンプトテンプレートがグローバルのものを置き換えます(空でない場合)。
5. 有効な(マージされた)ワークフローがエージェントセッションに使用されます。

### オーバーライドルール

| セクション | オーバーライド可能 | 理由 |
|-----------|-------------------|------|
| `tracker` | 不可 | サービス資格情報 — セキュリティ境界 |
| `polling` | 不可 | サービスレベルの関心事 |
| `workspace` | 不可 | セキュリティ境界(パストラバーサル) |
| `server` | 不可 | サービスレベルの関心事 |
| `agent` | **可能** | `max_turns`、リトライ、同時実行数 |
| `claude` | **可能** | `model`、`effort`、`allowed_tools`、`system_prompt`、`permission_mode` |
| `hooks` | 明示的opt-inのみ | デフォルトには含まれません。`allow`に`hooks`を追加すると`before_run`/`after_run`のオーバーライドが可能 |
| `env` | **可能** | エージェント用の追加環境変数 |
| プロンプトテンプレート | **可能** | リポジトリごとのプロンプトカスタマイズ |

きめ細かい形式でリポジトリがオーバーライドできる設定セクションを制限できます。リポジトリのプロンプトテンプレートは、`prompt_template`がallowリストから除外されない限り適用されます:

```yaml
repo_overrides:
allow: [agent, claude, env, prompt_template]
```

### 例

**グローバルWORKFLOW.md(オペレーター):**

```yaml
---
tracker:
kind: github_projects
api_key: $GITHUB_TOKEN
owner: myorg
project_number: 5
repo_overrides: true
agent:
max_turns: 20
claude:
effort: high
---
全リポジトリのデフォルトプロンプト...
{{ issue.title }}
```

**ターゲットリポジトリのWORKFLOW.md(リポジトリチーム):**

```yaml
---
agent:
max_turns: 40
claude:
model: claude-sonnet-4-20250514
effort: max
env:
DATABASE_URL: $DATABASE_URL
---
{{ issue.identifier }}に取り組むバックエンドスペシャリストです。

注力事項:
- データベースマイグレーション
- APIエンドポイントの実装
{{ issue.description }}
```

**そのリポジトリのイシューに対する有効な結果:**

- `tracker` — グローバルから(オーバーライド不可)
- `agent.max_turns` — 40(リポジトリから)
- `claude.model` — `claude-sonnet-4-20250514`(リポジトリから)
- `claude.effort` — `max`(リポジトリから)
- `env.DATABASE_URL` — `$DATABASE_URL`から解決(リポジトリから)
- プロンプトテンプレート — リポジトリのカスタムテンプレート

## CLI使用方法

```bash
Expand Down
100 changes: 100 additions & 0 deletions README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Work Please는 이슈 트래커의 작업을 격리된 자율 구현 실행으
- [WORKFLOW.md 설정](#workflowmd-설정)
- [전체 Front Matter 스키마](#전체-front-matter-스키마)
- [템플릿 변수](#템플릿-변수)
- [저장소별 워크플로우 오버라이드](#저장소별-워크플로우-오버라이드)
- [동작 방식](#동작-방식)
- [오버라이드 규칙](#오버라이드-규칙)
- [예시](#예시)
- [CLI 사용법](#cli-사용법)
- [GitHub App 인증](#github-app-인증)
- [GitHub App 자격 증명 설정](#github-app-자격-증명-설정)
Expand Down Expand Up @@ -75,6 +79,9 @@ GitHub Projects v2 / Asana 및 Claude Code에 맞게 적용되었습니다 (Line
- **동적 설정 리로드** — `WORKFLOW.md`를 편집하면 서비스 재시작 없이 변경사항이 적용됩니다.
- **워크스페이스 훅** — `after_create`, `before_run`, `after_run`, `before_remove` 라이프사이클
이벤트에서 셸 스크립트를 실행합니다.
- **저장소별 워크플로우 오버라이드** — 대상 저장소가 자체 `WORKFLOW.md`를 제공하여 에이전트 설정과
프롬프트 템플릿을 커스터마이즈할 수 있습니다. 글로벌 워크플로우에서 `repo_overrides: true`로
활성화합니다. 서비스 수준 설정(tracker, polling, workspace)은 절대 오버라이드되지 않습니다.
- **구조화된 로깅** — 안정적인 `key=value` 형식의 운영자 가시 로그를 제공합니다.
- **선택적 HTTP 대시보드** — `--port`로 활성화하여 런타임 상태와 JSON API를 확인할 수 있습니다.

Expand Down Expand Up @@ -455,6 +462,12 @@ claude:
commit: "🙏 Generated with [Work Please](https://github.com/pleaseai/work-please)" # 선택: git 커밋 메시지에 추가. 기본값은 Work Please 링크.
pr: "🙏 Generated with [Work Please](https://github.com/pleaseai/work-please)" # 선택: PR 설명에 추가. 기본값은 Work Please 링크.

repo_overrides: true # 선택: 대상 저장소가 자체 WORKFLOW.md로 워크플로우를 오버라이드할 수 있도록 허용.
# 기본값: false (저장소 WORKFLOW.md 파일은 무시됨).
# 세분화된 제어를 위해 객체로도 설정 가능:
# repo_overrides:
# allow: [agent, claude, env, prompt_template] # 저장소가 오버라이드할 수 있는 섹션 제한

server:
port: 3000 # 선택: 이 포트에서 HTTP 대시보드 활성화
---
Expand Down Expand Up @@ -510,6 +523,93 @@ server:
{% endif %}
```

## 저장소별 워크플로우 오버라이드

여러 저장소에 걸쳐 있는 GitHub Projects v2 프로젝트를 관리할 때, 각 대상 저장소가 자체
`WORKFLOW.md`를 제공하여 에이전트 동작을 커스터마이즈할 수 있습니다 — 글로벌 설정을 변경하지 않고도
가능합니다.

### 동작 방식

1. 운영자의 글로벌 `WORKFLOW.md`가 서비스를 시작하고 서비스 수준 설정(tracker, polling, workspace)을
정의합니다. 이 기능을 활성화하려면 `repo_overrides: true`를 포함해야 합니다.
2. 이슈가 디스패치되면, Work Please는 글로벌 설정을 사용하여 워크스페이스(클론/워크트리)를 생성합니다.
3. 워크스페이스가 준비되면, Work Please는 저장소 루트에서 `WORKFLOW.md`를 확인합니다.
4. 발견되면, 저장소의 설정 섹션이 글로벌 설정에 deep-merge되고(허용된 섹션만), 저장소의 프롬프트
템플릿이 글로벌 템플릿을 대체합니다(비어있지 않은 경우).
5. 유효한(병합된) 워크플로우가 에이전트 세션에 사용됩니다.

### 오버라이드 규칙

| 섹션 | 오버라이드 가능 | 이유 |
|------|----------------|------|
| `tracker` | 불가 | 서비스 자격 증명 — 보안 경계 |
| `polling` | 불가 | 서비스 수준 관심사 |
| `workspace` | 불가 | 보안 경계 (경로 탐색) |
| `server` | 불가 | 서비스 수준 관심사 |
| `agent` | **가능** | `max_turns`, 재시도, 동시성 |
| `claude` | **가능** | `model`, `effort`, `allowed_tools`, `system_prompt`, `permission_mode` |
| `hooks` | 명시적 opt-in만 | 기본값에 미포함; `allow`에 `hooks` 추가 시 `before_run`/`after_run` 오버라이드 허용 |
| `env` | **가능** | 에이전트용 추가 환경 변수 |
| 프롬프트 템플릿 | **가능** | 저장소별 프롬프트 커스터마이즈 |

세분화된 형태로 저장소가 오버라이드할 수 있는 config 섹션을 제한할 수 있습니다. 저장소 프롬프트 템플릿은 `prompt_template`이 allow 목록에서 제외되지 않는 한 적용됩니다:

```yaml
repo_overrides:
allow: [agent, claude, env, prompt_template]
```

### 예시

**글로벌 WORKFLOW.md (운영자):**

```yaml
---
tracker:
kind: github_projects
api_key: $GITHUB_TOKEN
owner: myorg
project_number: 5
repo_overrides: true
agent:
max_turns: 20
claude:
effort: high
---
모든 저장소의 기본 프롬프트...
{{ issue.title }}
```

**대상 저장소의 WORKFLOW.md (저장소 팀):**

```yaml
---
agent:
max_turns: 40
claude:
model: claude-sonnet-4-20250514
effort: max
env:
DATABASE_URL: $DATABASE_URL
---
{{ issue.identifier }}에 대해 작업하는 백엔드 전문가입니다.

집중 사항:
- 데이터베이스 마이그레이션
- API 엔드포인트 구현
{{ issue.description }}
```

**해당 저장소의 이슈에 대한 유효 결과:**

- `tracker` — 글로벌에서 (오버라이드 불가)
- `agent.max_turns` — 40 (저장소에서)
- `claude.model` — `claude-sonnet-4-20250514` (저장소에서)
- `claude.effort` — `max` (저장소에서)
- `env.DATABASE_URL` — `$DATABASE_URL`에서 해석됨 (저장소에서)
- 프롬프트 템플릿 — 저장소의 커스텀 템플릿

## CLI 사용법

```bash
Expand Down
Loading