jules-orchestrator-kit 0.1.9 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ ---
2
+ type: jules_dispatch
3
+ title: "Test Swarm Task"
4
+ timestamp: "2026-07-27T09:38:12.728Z"
5
+ ---
6
+ # Jules Task Dispatch: Test Swarm Task
7
+
8
+ ## Prompt
9
+ Test Prompt Description
@@ -16,7 +16,14 @@ Implement sliding window rate limiting for public API routes.
16
16
  - Must pass `npm test` before submitting PR.
17
17
  ```
18
18
 
19
- Dispatch queued tasks using `scripts/jules-dispatch.mjs`:
19
+ Process all queued tasks in batch:
20
+
21
+ ```bash
22
+ npm run jules:queue
23
+ # or node scripts/jules-queue-runner.mjs
24
+ ```
25
+
26
+ Or dispatch a single queued task using `scripts/jules-dispatch.mjs`:
20
27
 
21
28
  ```bash
22
29
  node scripts/jules-dispatch.mjs "TASK-001 Rate Limiting" .agent/jules-queue/TASK-001-rate-limiting.md
package/.env.example ADDED
@@ -0,0 +1,17 @@
1
+ # Google Jules Orchestration Kit - Environment Configuration Example
2
+ # Copy this file to .env and populate with your credentials/settings.
3
+
4
+ # Google Jules API Key (Required for direct REST API dispatches)
5
+ JULES_API_KEY=your_google_jules_api_key_here
6
+
7
+ # Target GitHub Repository (Format: owner/repo)
8
+ JULES_REPO=FullThrottle83/jules-orchestrator-kit
9
+
10
+ # Base Branch for PR Audits & Merge-Base Calculations (Default: main)
11
+ BASE_BRANCH=main
12
+
13
+ # Swarm Concurrency Limit (Maximum parallel dispatches, default: 3)
14
+ JULES_SWARM_CONCURRENCY=3
15
+
16
+ # Swarm Dispatch Stagger Interval in Milliseconds (Default: 1500)
17
+ JULES_SWARM_STAGGER_MS=1500
@@ -0,0 +1,32 @@
1
+ name: Jules PR Audit & Test Gatekeeper
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ audit-and-test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0
17
+
18
+ - name: Setup Node.js
19
+ uses: actions/setup-node@v4
20
+ with:
21
+ node-version: "20"
22
+
23
+ - name: Run Unit Tests
24
+ run: npm test
25
+
26
+ - name: Run Jules PR Self-Audit Gatekeeper
27
+ if: github.event_name == 'pull_request' && (startsWith(github.actor, 'google-labs-jules') || contains(github.actor, 'jules'))
28
+ run: node scripts/jules-self-audit.mjs
29
+ env:
30
+ CI: "true"
31
+ BASE_BRANCH: "main"
32
+
@@ -0,0 +1,21 @@
1
+ name: Jules Nightly Self-Audit
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 3 * * *'
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ nightly-audit:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-node@v4
14
+ with:
15
+ node-version: 20
16
+ - name: Dispatch Nightly Maintenance to Jules
17
+ env:
18
+ JULES_API_KEY: ${{ secrets.JULES_API_KEY }}
19
+ JULES_REPO: ${{ github.repository }}
20
+ run: |
21
+ node scripts/jules-nightly.mjs
@@ -0,0 +1,27 @@
1
+ name: Auto Publish to npm
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ push:
7
+ tags:
8
+ - 'v*'
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+ id-token: write
14
+
15
+ jobs:
16
+ publish:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-node@v4
21
+ with:
22
+ node-version: "20"
23
+ registry-url: 'https://registry.npmjs.org'
24
+ - run: npm test
25
+ - run: npm publish --provenance --access public
26
+ env:
27
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -24,6 +24,8 @@ Dispatch tasks to Jules when ALL of the following apply:
24
24
  <rule>2. READ-BEFORE-WRITE (ZERO HALLUCINATION): You are FORBIDDEN from guessing internal API signatures. Before editing, you MUST use code search or MCP doc tools to inspect exact function signatures.</rule>
25
25
  <rule>3. VERIFICATION LOOP: After patching code, you MUST execute the project's verification commands (tests/build) and ensure 0 errors.</rule>
26
26
  <rule>4. ABORT CONDITION: On repeated unresolvable test failures (4+ attempts), output <status>ABORT_UNRESOLVABLE</status> and terminate immediately.</rule>
27
+ <rule>5. NO OUT-OF-BAND RUNNER SCRIPTS / CHEATING: You are FORBIDDEN from creating temporary shell scripts (e.g. patch.sh, test-fix.sh), disabling assertions, or bypassing verification tooling to force tests to pass.</rule>
28
+ <rule>6. ASSERTION QUALITY: Unit tests created or modified MUST contain explicit, non-trivial assertions (e.g. assert/expect) testing realistic input/output contracts. Empty test functions or tests asserting tautologies (e.g. true === true) are strictly forbidden.</rule>
27
29
  </strict_invariants>
28
30
  </MCP_DIRECTIVE>
29
31
  ```
@@ -32,20 +34,22 @@ Dispatch tasks to Jules when ALL of the following apply:
32
34
 
33
35
  ## 3. Dynamic Command Resolution
34
36
 
35
- Jules automatically infers test and build verification commands based on project manifest files:
36
- - `package.json` -> `npm test && npm run build`
37
- - `Cargo.toml` -> `cargo test --workspace && cargo build`
38
- - `go.mod` -> `go test ./... && go build ./...`
39
- - `pyproject.toml` -> `pytest`
40
- - `pom.xml` -> `mvn test`
41
- - `build.gradle` -> `./gradlew test`
42
- - `.agent/jules.yml` -> Custom user commands
37
+ Jules automatically infers test and build verification commands via `scripts/command-resolver.mjs`:
38
+ - `.agent/jules.yml` -> Custom user commands (`test_cmd`, `build_cmd`)
39
+ - `package.json` -> `testCmd: "npm test"` (or `"npm run lint && npm test"`), `buildCmd: "npm run build"`
40
+ - `Cargo.toml` -> `testCmd: "cargo test --workspace"`, `buildCmd: "cargo build"`
41
+ - `go.mod` -> `testCmd: "go test ./..."`, `buildCmd: "go build ./..."`
42
+ - `pyproject.toml` -> `testCmd: "pytest"`, `buildCmd: ""`
43
+ - `pom.xml` -> `testCmd: "mvn test"`, `buildCmd: "mvn compile"`
44
+ - `build.gradle` -> `testCmd: "./gradlew test"`, `buildCmd: "./gradlew assemble"`
45
+ - Workspace graphs (`turbo.json`, `pnpm-workspace.yaml`, `nx.json`) -> targeted affected package filters
43
46
 
44
47
  ---
45
48
 
46
49
  ## 4. Operational & Code Quality Directives
47
50
 
48
51
  - **Read Before Write**: Always inspect target files and surrounding symbol signatures (via grep or view tools) before applying changes.
52
+ - **Scope Locks**: Strictly adhere to designated file bounds. Do NOT modify files outside the explicit task scope or alter shared infrastructural components unless assigned.
49
53
  - **Rebase Before PR**: Fetch latest `main`, rebase onto `origin/main`, re-execute verification suite. If the resulting diff is empty, close/abort PR without pushing.
50
54
  - **Minimal Interference**: Preserve existing function signatures, comments, and style conventions.
51
55
  - **Falsifiable Claims**: Base all code changes on explicit error logs, file paths, line numbers, or test results.
package/README.md CHANGED
@@ -1,132 +1,262 @@
1
- # Google Jules Orchestration Kit
1
+ # Google Jules Orchestration Kit 🤖⚡
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/jules-orchestrator-kit.svg)](https://www.npmjs.com/package/jules-orchestrator-kit)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0.0-green.svg)](https://nodejs.org)
6
+ [![Zero Dependencies](https://img.shields.io/badge/Dependencies-0-blue.svg)](#)
5
7
 
6
- A lightweight, framework-agnostic toolkit for turning **Google Jules** into a deterministic, autonomous background code builder for any repository (Next.js, Vite, Node, Bun, Deno, Python, Go, Rust, Elixir, Ruby, Swift, Java, C/C++, Monorepos, etc.).
8
+ A lightweight, zero-dependency toolkit that upgrades **Google Jules** into a **fully autonomous, self-correcting background code builder** for any repository (Next.js, Vite, Node, Bun, Deno, Python, Go, Rust, Elixir, Ruby, Swift, Java, C/C++, Monorepos, etc.).
7
9
 
8
- > **TL;DR**: Don't use Google Jules like a chat assistant. Use it as an autonomous background worker. Run `npx jules-orchestrator-kit` inside any repository to automatically detect your tech stack, generate prompt guardrails, set up test/build verification gates, and install Jules orchestration scripts.
10
+ Whether you are a beginner looking to automate bug fixes without breaking your app, or a power user orchestrating parallel AI task swarms, this kit handles the heavy lifting of prompting, testing, security, and verification.
11
+
12
+ > **TL;DR**: Don't just chat with Google Jules—put it to work. Run `npx jules-orchestrator-kit` inside your project. Assign tasks, and the kit will automatically test the AI's code, tell it to fix any mistakes, and only present you with working, tested Pull Requests.
13
+
14
+ ---
15
+
16
+ ## 🎯 Who is this for?
17
+
18
+ **🌱 For Everyday Developers:**
19
+ AI agents can write broken code or skip tests. This kit acts as an automated safety net: it detects your tech stack, runs your tests against the AI's code, catches errors, and prompts the AI to self-correct *before* you review the Pull Request.
20
+
21
+ **🔥 For Power Users & Senior Engineers:**
22
+ Unlock deterministic, production-grade orchestration. Includes Git Worktree multi-task swarms, Shannon Entropy secret redaction, MCP (Model Context Protocol) directive envelopes, OODA self-healing feedback loops, and scope boundary locks.
9
23
 
10
24
  ---
11
25
 
12
- ## ⚡ 1-Step Quick Setup for Any Project
26
+ ## 🚀 Quick Start: Zero to Autonomous AI
13
27
 
14
- Run this command inside the root of **any target repository**:
28
+ ### 1. Initialize your project
29
+ Run this command inside the root of **any target repository**. It automatically detects your tech stack and sets up safety guardrails:
15
30
 
16
31
  ```bash
17
32
  npx jules-orchestrator-kit
18
- # or
19
- npx jules-init
33
+
34
+ # Or launch the interactive setup wizard:
35
+ npx jules-init --interactive
36
+ ```
37
+
38
+ ### 2. Dispatch your first task
39
+ Once initialized, you can immediately send tasks to Jules. The Orchestrator handles prompting, testing, security, and self-correction in the background:
40
+
41
+ ```bash
42
+ node scripts/jules-dispatch.mjs "Refactor rate limiter" "Implement sliding window rate limiting in src/utils/rate-limit.ts"
43
+ ```
44
+
45
+ *(**Pro-tip:** Add `JULES_DRY_RUN=1` before the command to test prompt generation locally without executing the remote API).*
46
+
47
+ ---
48
+
49
+ ## 🧠 How It Works: The Autonomous Loop
50
+
51
+ Instead of blindly trusting AI code mutations, the Orchestrator acts as a strict manager enforcing a **Tiered Verification Gate**:
52
+
53
+ 1. **Queue a Task:** Dispatch via CLI, REST API, or drop markdown files into `.agent/jules-queue/`.
54
+ 2. **Secret & Path Defense:** Hides passwords, API keys (`entropy > 3.6`), and blocks path traversal (`../`).
55
+ 3. **Jules Proposes Code:** Google Jules mutates code in an isolated environment.
56
+ 4. **Tiered Verification:** Enforces scope bounds (`git diff`), runs fast-fail linters/type-checks, then executes full test/build suites.
57
+ 5. **Self-Correction (OODA Loop):** If tests fail, stderr traces are fed back to Jules to self-correct (up to 4 attempts).
58
+ 6. **Clean Pull Request:** Once verified green, commits & pushes clean code to GitHub.
59
+
60
+ <details>
61
+ <summary><b>🔍 View System Architecture Diagram (For Power Users)</b></summary>
62
+
63
+ ```mermaid
64
+ sequenceDiagram
65
+ autonumber
66
+ participant CLI as CI Trigger / CLI
67
+ participant Orc as jules-orchestrator
68
+ participant Jules as Google Jules Agent
69
+ participant Git as Git Worktree Sandbox
70
+
71
+ CLI->>Orc: Dispatch Task ("Refactor Auth")
72
+
73
+ note over Orc,Git: Phase 1: Isolation & Setup
74
+ Orc->>Orc: Redact Secrets & Check Path Traversal
75
+ Orc->>Git: Provision Worktree (`git worktree add`)
76
+ Orc->>Jules: Dispatch Context, Invariants & Target Scope
77
+
78
+ loop Max Retries (Attempts < 4)
79
+ Jules->>Git: Propose Code Mutations
80
+
81
+ note over Orc,Git: Phase 2: Tiered Verification
82
+ Orc->>Git: Scope Audit (`git diff --name-only` vs forbidden_paths)
83
+ alt Scope Breach
84
+ Git-->>Orc: Scope Violation Error
85
+ else Scope OK
86
+ Orc->>Git: Run Fast-Fail Checks (Lint / Typecheck)
87
+ opt Pass Static Checks
88
+ Orc->>Git: Run Heavy Suite (`build_cmd` & `test_cmd`)
89
+ end
90
+ end
91
+
92
+ alt Verification Gates Pass
93
+ Orc->>Git: Commit, Push & Cleanup Worktree
94
+ Orc->>CLI: Return Success + Metrics (.agent/history/metrics.jsonl)
95
+ note over Jules,Git: Exit Loop
96
+ else Verification Gates Fail (Attempts < 4)
97
+ Git-->>Orc: Execution Trace (stdout/stderr / Diff)
98
+ Orc->>Jules: Inject OODA Feedback & Error Context
99
+ end
100
+ end
101
+
102
+ opt Verification Gates Fail (Attempts >= 4)
103
+ Orc->>Git: Abort & Rollback Worktree (`git worktree remove --force`)
104
+ Orc->>CLI: Return Terminal Failure (.agent/history/errors.jsonl)
105
+ end
20
106
  ```
21
107
 
22
- This single command will:
23
- 1. **Detect your tech stack & workspace structure** (Node, Bun, Deno, Rust, Go, Python, Elixir, Ruby, Swift, Java, C/C++, Turborepo, Nx, pnpm) via `command-resolver.mjs`.
24
- 2. **Generate `AGENTS.md`** pre-populated with pre-execution `<MCP_DIRECTIVE>` rules and verification invariants.
25
- 3. **Create `.agent/jules.yml` (v2 Schema)** pre-configured with detected test/build commands and glob-based `forbidden_paths`.
26
- 4. **Install `.agent/rules/dynamic-guardrails.json`** for RegEx-based dynamic prompt guardrail injection.
27
- 5. **Install orchestration scripts** into `./scripts/` (`jules-dispatch.mjs`, `jules-self-audit.mjs`, `jules-swarm.mjs`, `jules-queue-runner.mjs`, `jules-nightly.mjs`).
108
+ </details>
28
109
 
29
110
  ---
30
111
 
31
- ## 💡 What This Toolkit Provides
112
+ ## 💡 Core Capabilities (8 Component Suite)
32
113
 
33
- 1. **Init Scaffolding CLI (`bin/init.js`)**: Auto-scaffolds any repo in 1 second.
34
- 2. **Monorepo & Command Resolver (`scripts/command-resolver.mjs`)**: Auto-detects project manifests and monorepo workspace graphs (`turbo.json`, `pnpm-workspace.yaml`, `nx.json`, `Cargo.toml` workspaces) to run targeted affected package verifications instead of full-repo test suites.
35
- 3. **Dynamic Guardrail Composition (`.agent/rules/dynamic-guardrails.json`)**: RegEx-based rule matching that injects targeted stack guardrails into prompts on-the-fly.
36
- 4. **Pre-Flight Secret Redaction & REST/stdin Dispatcher (`scripts/jules-dispatch.mjs`)**: Auto-redacts API keys (`ghp_`, `AKIA`, `sk-`, `Bearer`, RSA keys), streams prompts over REST / stdin to bypass OS `ARG_MAX` shell limits, and handles HTTP 429 rate limits.
114
+ ### 🛠️ The Basics
37
115
 
38
- 5. **PR Self-Auditor & Glob Boundary Gatekeeper (`scripts/jules-self-audit.mjs`)**: Unshallows git history in CI runners (`git fetch --unshallow`), filters token bloat, enforces dynamic glob-based security boundaries (`forbidden_paths`), and runs scoped workspace test suites.
39
- 6. **Queue Runner (`scripts/jules-queue-runner.mjs`)**: Iterates through `.agent/jules-queue/`, dispatches queued markdown tasks, and moves finished tasks to `.agent/jules-queue/completed/`.
40
- 7. **Rate-Limited Swarm Orchestrator (`scripts/jules-swarm.mjs`)**: Manages multi-task batches with controlled concurrency (`JULES_SWARM_CONCURRENCY`, default 3), staggered dispatches (1.5s interval), and batch cooldowns to eliminate API rate-limit thrashing.
41
- 8. **Nightly Maintenance Suite (`scripts/jules-nightly.mjs`)**: Schedules automated background audits (security leak scans, WCAG accessibility checks, dead code pruning, unused env var cleanup).
116
+ * **Auto-Configuration (`bin/init.js`)**: Instantly scaffolds your repo using `node:util.parseArgs` with an interactive TTY wizard (`-i`) or silent CI fallback.
117
+ * **Queue Runner (`scripts/jules-queue-runner.mjs`)**: Drop markdown task specifications into `.agent/jules-queue/` and let the runner process them sequentially.
118
+ * **Nightly Maintenance (`scripts/jules-nightly.mjs`)**: Schedules automated background audits (security leak scans, WCAG accessibility checks, dead code pruning).
119
+
120
+ ### 🔒 Security & Guardrails
121
+
122
+ * **Secret & Traversal Redaction (`scripts/jules-dispatch.mjs`)**: Shannon Entropy detector strips API keys and secrets (`entropy > 3.6`, `length >= 20`) while preserving valid file paths. Supports dry-run testing (`JULES_DRY_RUN=1`).
123
+ * **Dynamic Guardrails (`.agent/rules/dynamic-guardrails.json`)**: RegEx-based rule matching that injects targeted stack guardrails into prompts on-the-fly.
124
+
125
+ ### 🐝 Advanced Orchestration
126
+
127
+ * **Monorepo Boundary Resolver (`scripts/command-resolver.mjs`)**: Auto-detects `turbo`, `nx`, `pnpm`, or `Cargo` workspaces to run targeted affected package verifications (`git diff`) instead of full-repo test suites.
128
+ * **Self-Healing Gatekeeper (`scripts/jules-self-audit.mjs`)**: Unshallows git history in CI runners (`git fetch --unshallow`), enforces `forbidden_paths`, extracts OODA feedback error traces, and logs telemetry to `.agent/history/metrics.jsonl`.
129
+ * **Git Worktree Swarms (`scripts/jules-swarm.mjs`)**: Manages multi-task batches in isolated Git worktrees (`JULES_USE_WORKTREES=true`) with scope boundary isolation.
42
130
 
43
131
  ---
44
132
 
45
- ## 🛠️ Usage Examples
133
+ ## ⚙️ Configuration & Zero-Trust Security
46
134
 
47
- ### Dispatch a single task to Jules
135
+ The orchestrator creates an `.agent/jules.yml` file to manage repo-level verification and security:
48
136
 
49
- ```bash
50
- node scripts/jules-dispatch.mjs "Refactor rate limiter" "Implement sliding window rate limiting using Redis. Must pass tests."
137
+ ```yaml
138
+ # Google Jules Repository Configuration (Version 2)
139
+ version: 2
140
+ test_cmd: "npm test"
141
+ build_cmd: "npm run build"
142
+ forbidden_paths:
143
+ - ".github/**"
144
+ - "**/secrets/**"
145
+ - "**/*.pem"
146
+ - "**/lock-manager/**"
147
+ - "scripts/jules-*"
148
+ - ".agent/jules.yml"
149
+ allow_paths: []
51
150
  ```
52
151
 
53
- ### Dispatch an entire queue of markdown task specifications
152
+ > 🛡️ **Zero-Trust Security Model**: `allow_paths` and `forbidden_paths` rules are read **strictly from the target base branch** (`origin/main`), never from untrusted PR branches. Even if an AI agent hallucinates and tries to modify its own security rules in a PR branch, the Orchestrator enforces the immutable rules defined on `main`.
153
+ > ℹ️ Setting `build_cmd: ""` explicitly skips the build verification step (useful for pure test suites or scripts). Note that `.agent/jules.yml` uses a zero-dependency parser that supports flow (`[...]`) and block (`- item`) list subsets.
154
+ > 📦 `.github/` is intentionally included in `package.json`'s `files` array so that `npx jules-init` can automatically scaffold `.github/workflows/jules-audit.yml` into target repositories.
155
+
156
+ ---
157
+
158
+ <details>
159
+ <summary><b>🛠️ Supported Language Manifests & Workspace Graphs (15+ Tech Stacks)</b></summary>
160
+
161
+ | Stack / Ecosystem | Manifest / Workspace File | Test Command (`testCmd`) | Build Command (`buildCmd`) |
162
+ |---|---|---|---|
163
+ | **Turborepo** | `turbo.json` | `npx turbo run test --filter=<pkg>...` | `npx turbo run build --filter=<pkg>...` |
164
+ | **pnpm Workspace** | `pnpm-workspace.yaml` | `pnpm --filter=...<pkg> test` | `pnpm --filter=...<pkg> build` |
165
+ | **Nx Workspace** | `nx.json` | `npx nx run-many -t test -p <pkg> --with-deps` | `npx nx run-many -t build -p <pkg> --with-deps` |
166
+ | **Bun** | `bunfig.toml` / `bun.lockb` | `bun test` | `bun run build` |
167
+ | **Deno** | `deno.json` / `deno.jsonc` | `deno test` | `deno task build` |
168
+ | **JavaScript / TypeScript** | `package.json` | `npm run lint && npm test` | `npm run build` |
169
+ | **Rust** | `Cargo.toml` | `cargo test --workspace` | `cargo build` |
170
+ | **Go** | `go.mod` | `go test ./...` | `go build ./...` |
171
+ | **Python** | `pyproject.toml` / `requirements.txt` | `pytest` | *(none)* |
172
+ | **Elixir** | `mix.exs` | `mix test` | `mix compile` |
173
+ | **Ruby** | `Gemfile` | `bundle exec rake test` | *(none)* |
174
+ | **Swift** | `Package.swift` | `swift test` | `swift build` |
175
+ | **Java (Maven/Gradle)** | `pom.xml` / `build.gradle` | `mvn test` / `./gradlew test` | `mvn compile` / `./gradlew assemble` |
176
+ | **C / C++** | `Makefile` | `make test` | `make build` |
177
+
178
+ </details>
179
+
180
+ ---
181
+
182
+ <details>
183
+ <summary><b>📖 Advanced Workflows (Queues, Swarms, Nightly Maintenance)</b></summary>
184
+
185
+ ### 1. Process an entire queue of background tasks
54
186
 
55
187
  ```bash
56
188
  npm run jules:queue
57
189
  ```
58
190
 
191
+ ### 2. Run Rate-Limited Swarms with Scope Isolation
192
+
193
+ Run massive parallel refactors safely. The orchestrator uses `tasks.json` file boundary `scope` segregation to prevent parallel task collisions:
194
+
59
195
  ```bash
60
- JULES_SWARM_CONCURRENCY=5 node scripts/jules-swarm.mjs tasks.json
196
+ JULES_SWARM_CONCURRENCY=5 JULES_USE_WORKTREES=true node scripts/jules-swarm.mjs tasks.json
61
197
  ```
62
198
 
63
- Where `tasks.json` is formatted as:
64
- ```json
65
- [
66
- { "id": "t1", "title": "Refactor Auth", "prompt": "Refactor auth middleware to ESM" },
67
- { "id": "t2", "title": "Fix Memory Leak", "prompt": "Fix listener memory leak in websocket event loop" }
68
- ]
69
- ```
199
+ *(Example `tasks.json` constraint: `[ { "id": "t1", "prompt": "Refactor auth", "scope": ["src/auth/**"] } ]`)*
70
200
 
71
- ### Run Nightly Maintenance Suite
201
+ ### 3. Run Nightly Maintenance Suite
72
202
 
73
203
  ```bash
74
204
  node scripts/jules-nightly.mjs --dry-run
75
205
  ```
76
206
 
77
- ### Audit Jules PRs before merging
207
+ ### 4. Audit Jules PRs before merging in CI
78
208
 
79
209
  ```bash
80
210
  node scripts/jules-self-audit.mjs
81
211
  ```
82
212
 
213
+ </details>
214
+
83
215
  ---
84
216
 
85
- ## 🛠️ Supported Language Manifests & Workspace Graphs
86
-
87
- The command resolver automatically sniffs your codebase and invokes the right verification chain:
88
-
89
- | Stack / Ecosystem | Manifest / Workspace File | Default Verification Command |
90
- |---|---|---|
91
- | **Turborepo** | `turbo.json` | `npx turbo run test --filter=<pkg>...` |
92
- | **pnpm Workspace** | `pnpm-workspace.yaml` | `pnpm --filter=...<pkg> test` |
93
- | **Nx Workspace** | `nx.json` | `npx nx run-many -t test -p <pkg> --with-deps` |
94
- | **Bun** | `bunfig.toml` / `bun.lockb` | `bun test && bun run build` |
95
- | **Deno** | `deno.json` / `deno.jsonc` | `deno test && deno task build` |
96
- | **JavaScript / TypeScript** | `package.json` | `npm run check:all` or `npm test` |
97
- | **Rust** | `Cargo.toml` | `cargo test -p <pkg>` / `cargo test --workspace` |
98
- | **Go** | `go.mod` | `go test ./... && go build ./...` |
99
- | **Python** | `pyproject.toml` / `requirements.txt` | `pytest` |
100
- | **Elixir** | `mix.exs` | `mix test && mix compile` |
101
- | **Ruby** | `Gemfile` | `bundle exec rake test` |
102
- | **Swift** | `Package.swift` | `swift test && swift build` |
103
- | **Java (Maven)** | `pom.xml` | `mvn test && mvn compile` |
104
- | **Java (Gradle)** | `build.gradle` | `./gradlew test && ./gradlew assemble` |
105
- | **C / C++** | `Makefile` | `make test && make build` |
106
- | **Custom Config (v2)** | `.agent/jules.yml` | Configurable `test_cmd`, `build_cmd`, `forbidden_paths` & `allow_paths` |
217
+ <details>
218
+ <summary><b>🌐 Integration Interfaces: CLI, REST API & MCP Directives</b></summary>
219
+
220
+ `jules-orchestrator-kit` supports three primary integration channels:
221
+
222
+ ### 1. Direct REST API Mode (`jules.googleapis.com`)
223
+ When `JULES_API_KEY` and `JULES_REPO` are present in your environment (`.env` or CI secrets), payloads are dispatched directly to the official Google Jules REST API endpoint.
224
+ - Handles HTTP 429 rate limits gracefully.
225
+ - Automatically maps `startingBranch` and `sourceContext`.
226
+
227
+ ### 2. Native Jules CLI Fallback (`jules new`)
228
+ If no API key is configured, the kit seamlessly falls back to invoking your local `jules` CLI binary. Prompts are piped directly via `stdin` to bypass OS `ARG_MAX` shell argument length limits.
229
+
230
+ ### 3. MCP (Model Context Protocol) Directives
231
+ All task dispatches dynamically inject `<MCP_DIRECTIVE>` envelopes into task prompts:
232
+ ```xml
233
+ <MCP_DIRECTIVE>
234
+ <system_state>HEADLESS_CI_MODE</system_state>
235
+ <strict_invariants>
236
+ <rule>1. READ-BEFORE-WRITE: Inspect symbol definitions before editing.</rule>
237
+ <rule>2. VERIFICATION LOOP: Execute test_cmd and pass with 0 errors.</rule>
238
+ <rule>3. ABORT CONDITION: Terminate on 4+ repeated test failures.</rule>
239
+ <rule>4. ASSERTION QUALITY: Unit tests created or modified MUST contain explicit assertions.</rule>
240
+ </strict_invariants>
241
+ </MCP_DIRECTIVE>
242
+ ```
243
+ This forces Jules to adhere to strict read-before-write invariants and deterministic execution when operating alongside MCP server tools.
244
+
245
+ </details>
107
246
 
108
247
  ---
109
248
 
110
- ## ⚙️ Configuration (`.agent/jules.yml`)
111
-
112
- ```yaml
113
- # Google Jules Repository Configuration (Version 2)
114
- version: 2
115
- test_cmd: "npm test"
116
- build_cmd: "npm run build"
117
- forbidden_paths:
118
- - ".github/**"
119
- - "**/secrets/**"
120
- - "**/*.pem"
121
- - "**/lock-manager/**"
122
- - "scripts/jules-*"
123
- - ".agent/jules.yml"
124
- allow_paths: []
125
- ```
249
+ <details>
250
+ <summary><b>🤝 Contributing & Code Guidelines</b></summary>
126
251
 
127
- > 🛡️ **Security Trust Model**: `allow_paths` is read **strictly from the target base branch** (`origin/main`), never from untrusted PR branches. Any path specified in `allow_paths` on `main` overrides the immutable default forbidden paths for automated background workers.
252
+ We welcome contributions! Please follow these core principles when submitting Pull Requests:
128
253
 
254
+ 1. **Zero External Dependencies**: Keep the orchestrator engine 100% dependency-free. Use ONLY native Node.js built-in modules (`node:fs`, `node:path`, `node:child_process`, `node:crypto`, `node:util`).
255
+ 2. **Verification Suite**: Ensure 100% of unit tests pass cleanly (`npm test`).
256
+ 3. **Conventional Commits**: Use standardized commit message prefixes (`feat:`, `fix:`, `docs:`, `test:`, `chore:`).
257
+ 4. **Cross-Platform Compatibility**: Always normalize Windows backslashes (`\`) to POSIX slashes (`/`) for glob patterns and paths.
129
258
 
259
+ </details>
130
260
 
131
261
  ---
132
262
 
@@ -135,5 +265,3 @@ allow_paths: []
135
265
  MIT License - feel free to use, modify, and share!
136
266
 
137
267
  *Disclaimer: This is an independent open-source orchestration tool and is not officially affiliated with or endorsed by Google.*
138
-
139
-