@google/jules-fleet 0.0.1-experimental.2 → 0.0.1-experimental.4

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.
package/README.md CHANGED
@@ -53,10 +53,18 @@ If a merge conflict is detected, the fleet closes the conflicting PR, re-dispatc
53
53
  ## Set up a repository
54
54
 
55
55
  ```bash
56
- npx @google/jules-fleet init --repo your-org/your-repo
56
+ npx @google/jules-fleet init
57
57
  ```
58
58
 
59
- This creates a pull request containing three GitHub Actions workflows and an example goal file. It also creates the `fleet` and `fleet-merge-ready` labels. Merge the PR, then add `JULES_API_KEY` to your repository secrets.
59
+ The interactive wizard will:
60
+ 1. **Detect the repo** from your git remote (or pass `--repo owner/repo`)
61
+ 2. **Configure auth** — choose GitHub App (recommended) or personal access token
62
+ - For GitHub App: enter your app slug and path to the `.pem` private key file. Fleet auto-detects the App ID and Installation ID.
63
+ 3. **Upload secrets** — `JULES_API_KEY` and app credentials are uploaded to GitHub Actions secrets
64
+ 4. **Create a PR** with three workflow files and an example goal
65
+ 5. **Create labels** — `fleet` and `fleet-merge-ready`
66
+
67
+ If workflow files already exist (re-initialization), the wizard prompts to overwrite them with the latest templates.
60
68
 
61
69
  ## CLI Reference
62
70
 
@@ -65,16 +73,20 @@ This creates a pull request containing three GitHub Actions workflows and an exa
65
73
  Scaffold a repository for fleet workflows by creating a PR with the necessary files.
66
74
 
67
75
  ```
68
- jules-fleet init --repo <owner/repo> [options]
76
+ jules-fleet init [options]
69
77
 
70
78
  Options:
71
- --base <branch> Base branch for the PR (default: main)
79
+ --repo <owner/repo> Repository (auto-detected from git remote)
80
+ --base <branch> Base branch for the PR (default: main)
81
+ --non-interactive Disable wizard prompts — all inputs via flags/env vars
82
+ --dry-run Show what would be created without making changes
83
+ --upload-secrets Upload secrets to GitHub Actions (default: true)
72
84
  ```
73
85
 
74
86
  Files added by the PR:
75
- - `.github/workflows/fleet-merge.yml`
76
- - `.github/workflows/fleet-dispatch.yml`
77
87
  - `.github/workflows/fleet-analyze.yml`
88
+ - `.github/workflows/fleet-dispatch.yml`
89
+ - `.github/workflows/fleet-merge.yml`
78
90
  - `.fleet/goals/example.md`
79
91
 
80
92
  Labels created: `fleet`, `fleet-merge-ready`
@@ -166,15 +178,19 @@ Options:
166
178
 
167
179
  ### Environment Variables
168
180
 
181
+ Fleet auto-detects auth from environment variables. App auth takes priority over `GITHUB_TOKEN`.
182
+
169
183
  ```
170
- GITHUB_TOKEN Required. GitHub token with repo access.
171
- JULES_API_KEY Required for analyze, dispatch, and re-dispatch.
172
- GITHUB_APP_ID GitHub App authentication (alternative to token).
173
- GITHUB_APP_PRIVATE_KEY GitHub App private key (PEM or base64).
174
- GITHUB_APP_INSTALLATION_ID GitHub App installation ID.
175
- FLEET_BASE_BRANCH Override default base branch (default: main).
184
+ GITHUB_TOKEN Auto-provided in GitHub Actions. For local use, set a PAT.
185
+ JULES_API_KEY Required for analyze, dispatch, and re-dispatch.
186
+ FLEET_APP_ID GitHub App ID.
187
+ FLEET_APP_PRIVATE_KEY GitHub App private key (base64-encoded).
188
+ FLEET_APP_INSTALLATION_ID GitHub App installation ID.
189
+ FLEET_BASE_BRANCH Override default base branch (default: main).
176
190
  ```
177
191
 
192
+ `GITHUB_APP_ID`, `GITHUB_APP_PRIVATE_KEY_BASE64`, and `GITHUB_APP_INSTALLATION_ID` are also accepted as aliases. The `FLEET_APP_*` names are recommended because they work both as GitHub Actions secret names and as local env vars.
193
+
178
194
  ## Programmatic API
179
195
 
180
196
  The handlers are exported for use in scripts and custom workflows.
@@ -1,4 +1,15 @@
1
1
  import { createRequire } from "node:module";
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true,
8
+ configurable: true,
9
+ set: (newValue) => all[name] = () => newValue
10
+ });
11
+ };
12
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
2
13
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
14
 
4
15
  // src/cli/analyze.command.ts
@@ -180,7 +191,9 @@ function formatPRContext(pr) {
180
191
  }
181
192
 
182
193
  // src/analyze/prompt.ts
183
- var SYSTEM_PREAMBLE = `You are a senior software architect performing a rigorous code analysis against a set of goal directives. Your job is to identify gaps and create GitHub issues for each actionable task.`;
194
+ var SYSTEM_PREAMBLE = `You are a senior software architect performing a rigorous code analysis. Your ONLY deliverable is GitHub issues created via the \`npx @google/jules-fleet signal create\` CLI command.
195
+
196
+ Focus exclusively on analysis and signal creation. Leave all application code, project scaffolding, and feature implementation to the downstream worker agents who will receive your signals. Your value is in the precision of your diagnosis and the clarity of your issue descriptions — the code comes later, from others.`;
184
197
  var DEDUP_RULES = `**Deduplication Rules (MANDATORY):**
185
198
  1. **Closed Issue = Work Already Done.** Do NOT recreate issues that have been closed.
186
199
  2. **Open Issue = Work In Progress.** Someone is already handling it. Do NOT create a duplicate.
@@ -207,16 +220,16 @@ var PHASE_2_ARCHITECT = `### Phase 2: Architect
207
220
  Design a concrete, production-ready solution for each root cause.
208
221
 
209
222
  For each solution, you must provide:
210
- 1. **Proposed Implementation:** Write the actual TypeScript/code demonstrating the solution. Include function signatures, interfaces, and logic.
223
+ 1. **Proposed Implementation:** Write code demonstrating the solution in the project's primary language. Include function signatures, types, and logic.
211
224
  2. **Integration Points:** Detail exactly where in the existing code this gets wired in, using before/after diffs to show the structural changes.
212
225
  3. **Edge Cases:** Identify assumptions and define fallback behaviors.
213
226
  4. **Test Scenarios:** Define specific test cases, inputs, and expected outputs that validate the fix.`;
214
227
  var PHASE_3_PLAN = `### Phase 3: Plan (Coupling & Boundary Analysis)
215
228
  Evaluate the exact file requirements for each architectural solution to define strict boundaries for the downstream worker agents.
216
229
 
217
- 1. **Coupling Analysis:** Map all implicitly coupled files. Identify test files that exercise the modified code, barrel exports (\`index.ts\`), and shared utilities.
218
- 2. **File Ownership & Locking:** The downstream Orchestrator prevents merge conflicts by locking files at runtime. You must exhaustively list every single file (source, test, and utility) the worker agent needs to touch.
219
- 3. **Task Sizing:** Keep tasks strictly isolated by functional domain. You may assign the same core file (e.g., \`types.ts\`) to multiple tasks; the Orchestrator will sequence them automatically based on your exhaustive file list.`;
230
+ 1. **Coupling Analysis:** Map all implicitly coupled files. Identify test files that exercise the modified code, barrel exports, and shared utilities.
231
+ 2. **File Ownership &#x26; Locking:** The downstream Orchestrator prevents merge conflicts by locking files at runtime. You must exhaustively list every single file (source, test, and utility) the worker agent needs to touch.
232
+ 3. **Task Sizing:** Keep tasks strictly isolated by functional domain. You may assign the same core file (e.g., shared type definitions) to multiple tasks; the Orchestrator will sequence them automatically based on your exhaustive file list.`;
220
233
  var PHASE_4_DISPATCH_HEALTHY = `**Path A: System Healthy Protocol**
221
234
  If your Phase 0 verification confirms that the codebase already satisfies the goal directives and no actionable work remains, formulate a comprehensive "Fleet Status: Goal Currently Satisfied" report. Detail exactly which domains, files, and logic paths you verified to reach this conclusion. Output this markdown report and exit gracefully, bypassing the issue creation step entirely. Preserve the repository's current state by creating issues only when substantial, goal-aligned engineering work is required.`;
222
235
  var PHASE_4_DISPATCH_ISSUES = `**Path B: Task Dispatch Protocol**
@@ -226,37 +239,36 @@ For EACH validated task that requires execution, perform a **Deduplication Check
226
239
  2. If an existing open issue's **Objective** already covers the same gap (even partially or under a different name), **do NOT create a new issue**. Instead, note the overlap in your report and skip creation.
227
240
  3. Only create an issue for gaps that are genuinely novel — not covered by any existing open issue.
228
241
 
229
- For each non-duplicate task, create a signal using the \`jules-fleet signal create\` command.`;
242
+ For each non-duplicate task, create a signal using the \`npx @google/jules-fleet signal create\` command.`;
230
243
  var ISSUE_BODY_TEMPLATE = `\`\`\`markdown
231
244
  ### Objective
232
245
  [2-3 sentences explaining the functional goal of this isolated task]
233
246
 
234
247
  ### Code-Level Diagnosis
235
- **Code path:** [e.g., \`src/session.ts fetch()\`]
248
+ **Code path:** [e.g., src/module.py -> function_name()]
236
249
  **Mechanism:** [Explanation of the current state]
237
250
  **Root cause:** [Summary of the architectural gap]
238
251
 
239
252
  #### Current Implementation
240
- \\\`\\\`\\\`typescript
253
+ \`\`\`
241
254
  // [Insert exact snippet from current codebase showing the logic to be changed]
242
- \\\`\\\`\\\`
255
+ \`\`\`
243
256
 
244
257
  ### Proposed Implementation
245
258
  **Files to modify:** [Brief summary of structural changes]
246
259
 
247
- #### Integration (Before After)
248
- \\\`\\\`\\\`diff
260
+ #### Integration (Before -> After)
261
+ \`\`\`diff
249
262
  // [Insert precise diffs showing how the new logic integrates]
250
- \\\`\\\`\\\`
263
+ \`\`\`
251
264
 
252
265
  ### Test Scenarios
253
266
  1. [Scenario 1: Input -> Expected Output]
254
267
  2. [Scenario 2: Input -> Expected Output]
255
268
 
256
269
  ### Target Files
257
- - [exact/path/to/source1.ts]
258
- - [exact/path/to/source2.ts]
259
- - [exact/path/to/test1.test.ts]
270
+ - [exact/path/to/source_file]
271
+ - [exact/path/to/test_file]
260
272
 
261
273
  ### Boundary Rules
262
274
  Restrict your modifications exclusively to the files listed in the Target Files section. Ensure your source changes are entirely backward-compatible if unowned tests outside your boundary fail. Retain all existing file names and locations outside your explicitly declared target list.
@@ -279,20 +291,12 @@ ${prContext}
279
291
 
280
292
  **Assessment** (actionable — requires code changes):
281
293
  \`\`\`bash
282
- jules-fleet signal create \\
283
- --kind assessment \\
284
- --title "[Fleet Execution] <Highly Specific Domain Task Title>" \\
285
- --tag fleet \\
286
- --body-file <path_to_markdown_file>${milestoneFlag}
294
+ npx @google/jules-fleet signal create \\ --kind assessment \\ --title "[Fleet Execution] [Highly Specific Domain Task Title]" \\ --tag fleet \\ --body-file [path_to_markdown_file]${milestoneFlag}
287
295
  \`\`\`
288
296
 
289
297
  **Insight** (informational — no action required):
290
298
  \`\`\`bash
291
- jules-fleet signal create \\
292
- --kind insight \\
293
- --title "<Descriptive Finding>" \\
294
- --tag fleet \\
295
- --body-file <path_to_markdown_file>${milestoneFlag}
299
+ npx @google/jules-fleet signal create \\ --kind insight \\ --title "[Descriptive Finding]" \\ --tag fleet \\ --body-file [path_to_markdown_file]${milestoneFlag}
296
300
  \`\`\``;
297
301
  return [
298
302
  SYSTEM_PREAMBLE,
@@ -329,7 +333,7 @@ jules-fleet signal create \\
329
333
  PHASE_3_PLAN,
330
334
  "",
331
335
  `### Phase 4: Dispatch (Issue Creation or Goal Validation)`,
332
- `Translate your analysis into independent signals using \`jules-fleet signal create\`, or provide a clean bill of health.`,
336
+ `Translate your analysis into independent signals using \`npx @google/jules-fleet signal create\`, or provide a clean bill of health.`,
333
337
  "",
334
338
  PHASE_4_DISPATCH_HEALTHY,
335
339
  "",
@@ -548,10 +552,10 @@ function resolvePrivateKey(base64Value, rawValue) {
548
552
  // src/shared/auth/octokit.ts
549
553
  var CachedOctokit = Octokit.plugin(cachePlugin);
550
554
  function getAuthOptions() {
551
- const appId = process.env.GITHUB_APP_ID;
552
- const privateKeyBase64 = process.env.GITHUB_APP_PRIVATE_KEY_BASE64;
555
+ const appId = process.env.FLEET_APP_ID || process.env.GITHUB_APP_ID;
556
+ const privateKeyBase64 = process.env.FLEET_APP_PRIVATE_KEY || process.env.GITHUB_APP_PRIVATE_KEY_BASE64;
553
557
  const privateKeyRaw = process.env.GITHUB_APP_PRIVATE_KEY;
554
- const installationId = process.env.GITHUB_APP_INSTALLATION_ID;
558
+ const installationId = process.env.FLEET_APP_INSTALLATION_ID || process.env.GITHUB_APP_INSTALLATION_ID;
555
559
  if (appId && (privateKeyBase64 || privateKeyRaw) && installationId) {
556
560
  return {
557
561
  authStrategy: createAppAuth,
@@ -566,7 +570,7 @@ function getAuthOptions() {
566
570
  if (token) {
567
571
  return { auth: token };
568
572
  }
569
- throw new Error("GitHub auth not configured. Set GITHUB_APP_ID + GITHUB_APP_PRIVATE_KEY + GITHUB_APP_INSTALLATION_ID for App auth, or GITHUB_TOKEN for PAT auth.");
573
+ throw new Error("GitHub auth not configured. Set FLEET_APP_ID + FLEET_APP_PRIVATE_KEY + FLEET_APP_INSTALLATION_ID for App auth, or GITHUB_TOKEN for PAT auth.");
570
574
  }
571
575
  function createFleetOctokit() {
572
576
  return new CachedOctokit(getAuthOptions());
@@ -1,4 +1,15 @@
1
1
  import { createRequire } from "node:module";
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true,
8
+ configurable: true,
9
+ set: (newValue) => all[name] = () => newValue
10
+ });
11
+ };
12
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
2
13
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
14
 
4
15
  // src/cli/configure.command.ts
@@ -171,10 +182,10 @@ function resolvePrivateKey(base64Value, rawValue) {
171
182
  // src/shared/auth/octokit.ts
172
183
  var CachedOctokit = Octokit.plugin(cachePlugin);
173
184
  function getAuthOptions() {
174
- const appId = process.env.GITHUB_APP_ID;
175
- const privateKeyBase64 = process.env.GITHUB_APP_PRIVATE_KEY_BASE64;
185
+ const appId = process.env.FLEET_APP_ID || process.env.GITHUB_APP_ID;
186
+ const privateKeyBase64 = process.env.FLEET_APP_PRIVATE_KEY || process.env.GITHUB_APP_PRIVATE_KEY_BASE64;
176
187
  const privateKeyRaw = process.env.GITHUB_APP_PRIVATE_KEY;
177
- const installationId = process.env.GITHUB_APP_INSTALLATION_ID;
188
+ const installationId = process.env.FLEET_APP_INSTALLATION_ID || process.env.GITHUB_APP_INSTALLATION_ID;
178
189
  if (appId && (privateKeyBase64 || privateKeyRaw) && installationId) {
179
190
  return {
180
191
  authStrategy: createAppAuth,
@@ -189,7 +200,7 @@ function getAuthOptions() {
189
200
  if (token) {
190
201
  return { auth: token };
191
202
  }
192
- throw new Error("GitHub auth not configured. Set GITHUB_APP_ID + GITHUB_APP_PRIVATE_KEY + GITHUB_APP_INSTALLATION_ID for App auth, or GITHUB_TOKEN for PAT auth.");
203
+ throw new Error("GitHub auth not configured. Set FLEET_APP_ID + FLEET_APP_PRIVATE_KEY + FLEET_APP_INSTALLATION_ID for App auth, or GITHUB_TOKEN for PAT auth.");
193
204
  }
194
205
  function createFleetOctokit() {
195
206
  return new CachedOctokit(getAuthOptions());
@@ -1,4 +1,15 @@
1
1
  import { createRequire } from "node:module";
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true,
8
+ configurable: true,
9
+ set: (newValue) => all[name] = () => newValue
10
+ });
11
+ };
12
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
2
13
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
14
 
4
15
  // src/cli/dispatch.command.ts
@@ -319,10 +330,10 @@ function resolvePrivateKey(base64Value, rawValue) {
319
330
  // src/shared/auth/octokit.ts
320
331
  var CachedOctokit = Octokit.plugin(cachePlugin);
321
332
  function getAuthOptions() {
322
- const appId = process.env.GITHUB_APP_ID;
323
- const privateKeyBase64 = process.env.GITHUB_APP_PRIVATE_KEY_BASE64;
333
+ const appId = process.env.FLEET_APP_ID || process.env.GITHUB_APP_ID;
334
+ const privateKeyBase64 = process.env.FLEET_APP_PRIVATE_KEY || process.env.GITHUB_APP_PRIVATE_KEY_BASE64;
324
335
  const privateKeyRaw = process.env.GITHUB_APP_PRIVATE_KEY;
325
- const installationId = process.env.GITHUB_APP_INSTALLATION_ID;
336
+ const installationId = process.env.FLEET_APP_INSTALLATION_ID || process.env.GITHUB_APP_INSTALLATION_ID;
326
337
  if (appId && (privateKeyBase64 || privateKeyRaw) && installationId) {
327
338
  return {
328
339
  authStrategy: createAppAuth,
@@ -337,7 +348,7 @@ function getAuthOptions() {
337
348
  if (token) {
338
349
  return { auth: token };
339
350
  }
340
- throw new Error("GitHub auth not configured. Set GITHUB_APP_ID + GITHUB_APP_PRIVATE_KEY + GITHUB_APP_INSTALLATION_ID for App auth, or GITHUB_TOKEN for PAT auth.");
351
+ throw new Error("GitHub auth not configured. Set FLEET_APP_ID + FLEET_APP_PRIVATE_KEY + FLEET_APP_INSTALLATION_ID for App auth, or GITHUB_TOKEN for PAT auth.");
341
352
  }
342
353
  function createFleetOctokit() {
343
354
  return new CachedOctokit(getAuthOptions());