pacework 1.1.0 → 1.4.1
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/bin/pacework-runner-ctl.mjs +91 -60
- package/bin/pacework-runner.mjs +628 -95
- package/lib/automation-limits.mjs +23 -0
- package/lib/git-lock.mjs +83 -0
- package/lib/home.mjs +63 -6
- package/lib/issues-cli.mjs +80 -0
- package/lib/mcp-cli.mjs +177 -0
- package/lib/mcp-connect.mjs +159 -0
- package/lib/pr-base-branch.mjs +84 -0
- package/lib/push-retry.mjs +108 -0
- package/lib/run-limits.mjs +302 -0
- package/lib/runner-control.mjs +55 -0
- package/lib/skills.mjs +130 -0
- package/lib/triage-worker.mjs +29 -4
- package/lib/ui.mjs +11 -1
- package/lib/usage-limit.mjs +23 -0
- package/lib/version.mjs +27 -0
- package/lib/workspace-api.mjs +47 -0
- package/package.json +1 -1
|
@@ -17,7 +17,9 @@ import { spawn, execFileSync, execSync } from "node:child_process"
|
|
|
17
17
|
import { fileURLToPath } from "node:url"
|
|
18
18
|
import { agentSecretsFrom, detectSetupCommand } from "../lib/environment.mjs"
|
|
19
19
|
import { runTriageLoop } from "../lib/triage-worker.mjs"
|
|
20
|
+
import { NPM_PACKAGE, isNewerVersion, latestPublishedVersion } from "../lib/version.mjs"
|
|
20
21
|
import { EXECUTORS, EXECUTOR_DEFAULT_NAMES, checkBinaryExists, executorLabel } from "../lib/executors.mjs"
|
|
22
|
+
import { BANNER_LINES } from "../lib/ui.mjs"
|
|
21
23
|
import {
|
|
22
24
|
PACEWORK_DIR,
|
|
23
25
|
STATE_DIR,
|
|
@@ -61,24 +63,17 @@ const LOCAL_VERSION = (() => {
|
|
|
61
63
|
async function checkForUpdate() {
|
|
62
64
|
if (!LOCAL_VERSION) return
|
|
63
65
|
try {
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
console.log(`\n⚠ Update available: pacework-runner ${LOCAL_VERSION} → ${latest}`)
|
|
69
|
-
console.log(` Run: npm install -g pacework\n`)
|
|
66
|
+
const latest = await latestPublishedVersion()
|
|
67
|
+
if (latest && isNewerVersion(latest, LOCAL_VERSION)) {
|
|
68
|
+
console.log(`\n⚠ Update available: ${NPM_PACKAGE} ${LOCAL_VERSION} → ${latest}`)
|
|
69
|
+
console.log(` Run: pacework update\n`)
|
|
70
70
|
}
|
|
71
71
|
} catch {}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// ── ascii banner ──────────────────────────────────────────────────────────────
|
|
75
75
|
|
|
76
|
-
const BANNER = `\x1b[38;5;39m
|
|
77
|
-
██╔══██╗██╔══██╗██╔════╝██╔════╝██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝
|
|
78
|
-
██████╔╝███████║██║ █████╗ ██║ █╗ ██║██║ ██║██████╔╝█████╔╝
|
|
79
|
-
██╔═══╝ ██╔══██║██║ ██╔══╝ ██║███╗██║██║ ██║██╔══██╗██╔═██╗
|
|
80
|
-
██║ ██║ ██║╚██████╗███████╗╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗
|
|
81
|
-
╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝\x1b[0m`
|
|
76
|
+
const BANNER = `\x1b[38;5;39m${BANNER_LINES.map((line) => ` ${line}`).join("\n")}\x1b[0m`
|
|
82
77
|
|
|
83
78
|
function printBanner(config) {
|
|
84
79
|
const cols = process.stdout.columns || 80
|
|
@@ -244,51 +239,87 @@ const parsedArgs = parseCliArgs(restArgs)
|
|
|
244
239
|
|
|
245
240
|
// ── help ──────────────────────────────────────────────────────────────────────
|
|
246
241
|
|
|
247
|
-
if (!command || command === "--help" || command === "-h") {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
pacework start \x1b[2m# run as background daemon\x1b[0m
|
|
242
|
+
if (!command || command === "--help" || command === "-h" || command === "help") {
|
|
243
|
+
const c = (text) => `\x1b[36m${text}\x1b[0m`
|
|
244
|
+
const d = (text) => `\x1b[2m${text}\x1b[0m`
|
|
245
|
+
const row = (command, description) => ` ${c(command.padEnd(30))} ${description}`
|
|
246
|
+
console.log(`\n${BANNER}\n`)
|
|
247
|
+
console.log(` Connect this machine to pacework: agents work on your issues here, and
|
|
248
|
+
your AI tools can read and update pacework.
|
|
249
|
+
|
|
250
|
+
\x1b[1mStart here\x1b[0m
|
|
251
|
+
${row("pacework", "Guided setup the first time, then the live home screen")}
|
|
252
|
+
|
|
253
|
+
\x1b[1mAccount\x1b[0m
|
|
254
|
+
${row("pacework login", "Sign in to a pacework (asks which one)")}
|
|
255
|
+
${row("pacework logout", "Sign out and revoke this machine's key")}
|
|
256
|
+
${row("pacework whoami", "Who and where you are signed in")}
|
|
257
|
+
|
|
258
|
+
\x1b[1mConnect your AI tools\x1b[0m ${d("Claude Code, Codex, Gemini CLI, Cursor, VS Code")}
|
|
259
|
+
${row("pacework mcp add [tool…|--all]", "Give them pacework's tools; they sign in on first use")}
|
|
260
|
+
${row("pacework mcp status", "Which tools are connected")}
|
|
261
|
+
${row("pacework mcp remove [tool…]", "Disconnect tools")}
|
|
262
|
+
|
|
263
|
+
\x1b[1mIssues\x1b[0m
|
|
264
|
+
${row("pacework issues [--mine]", "List open issues, or the ones assigned to you")}
|
|
265
|
+
${row("pacework issues --status S", `Filter: ${d("open, todo, in_progress, in_review, done, …")}`)}
|
|
266
|
+
${row("pacework issue ENG-42", "Show one issue with its latest comments")}
|
|
267
|
+
${row("pacework open [ENG-42]", "Open the workspace or an issue in the browser")}
|
|
268
|
+
|
|
269
|
+
\x1b[1mRunner\x1b[0m ${d("takes development and triage jobs")}
|
|
270
|
+
${row("pacework start | stop", "Start or stop it in the background")}
|
|
271
|
+
${row("pacework status [--json]", "Is it running, and what is it doing")}
|
|
272
|
+
${row("pacework logs [--lines N]", "Follow its log")}
|
|
273
|
+
${row("pacework connect", "Run it in this terminal instead")}
|
|
274
|
+
${row("pacework use <tool>", `Switch AI tool: ${d("claude_code, codex, gemini, cursor_agent, github_copilot")}`)}
|
|
275
|
+
${row("pacework doctor", "Check this machine's setup")}
|
|
276
|
+
${row("pacework triage [--once]", "Only triage, in the foreground")}
|
|
277
|
+
${row("pacework up --token CODE", "One-step setup from the command in pacework's Runners page")}
|
|
278
|
+
${row("pacework down", "Remove the background service")}
|
|
279
|
+
|
|
280
|
+
\x1b[1mRunner flags\x1b[0m ${d("for start, connect and up")}
|
|
281
|
+
--repo-root PATH --executor TOOL --name NAME --max-parallel-runs N --sandbox --no-triage
|
|
288
282
|
`)
|
|
289
283
|
process.exit(0)
|
|
290
284
|
}
|
|
291
285
|
|
|
286
|
+
// ── account, AI tools, issues ─────────────────────────────────────────────────
|
|
287
|
+
|
|
288
|
+
if (["whoami", "issues", "issue", "open", "mcp"].includes(command)) {
|
|
289
|
+
try {
|
|
290
|
+
const api = await import("../lib/workspace-api.mjs")
|
|
291
|
+
if (command === "whoami") {
|
|
292
|
+
const session = api.currentSession()
|
|
293
|
+
await api.workspaceGet("/cli/issues?limit=1")
|
|
294
|
+
console.log(`\n ${session.userName ?? session.userEmail ?? "Signed in"}${session.userName && session.userEmail ? ` \x1b[2m${session.userEmail}\x1b[0m` : ""}`)
|
|
295
|
+
console.log(` workspace \x1b[1m${session.workspaceSlug ?? session.workspaceId}\x1b[0m`)
|
|
296
|
+
console.log(` server ${session.appUrl}`)
|
|
297
|
+
console.log(` key \x1b[2m${session.apiKey.slice(0, 12)}…\x1b[0m \x1b[32mvalid\x1b[0m\n`)
|
|
298
|
+
} else if (command === "issues") {
|
|
299
|
+
const { printIssues } = await import("../lib/issues-cli.mjs")
|
|
300
|
+
const status = parsedArgs.status && parsedArgs.status !== "true" ? parsedArgs.status : (restArgs.find((arg) => !arg.startsWith("--")) ?? "open")
|
|
301
|
+
await printIssues({ mine: Boolean(parsedArgs.mine), status, limit: Number(parsedArgs.limit) || 30 })
|
|
302
|
+
} else if (command === "issue") {
|
|
303
|
+
const identifier = restArgs.find((arg) => !arg.startsWith("--"))
|
|
304
|
+
if (!identifier) throw new Error("Which issue? For example: pacework issue ENG-42")
|
|
305
|
+
const { printIssue } = await import("../lib/issues-cli.mjs")
|
|
306
|
+
await printIssue(identifier)
|
|
307
|
+
} else if (command === "open") {
|
|
308
|
+
const { openInBrowser } = await import("../lib/login.mjs")
|
|
309
|
+
const url = api.workspaceUrl(restArgs.find((arg) => !arg.startsWith("--")))
|
|
310
|
+
console.log(openInBrowser(url) ? `Opened ${url}` : `Open ${url}`)
|
|
311
|
+
} else if (command === "mcp") {
|
|
312
|
+
const { runMcpCommand } = await import("../lib/mcp-cli.mjs")
|
|
313
|
+
const sub = restArgs[0] && !restArgs[0].startsWith("--") ? restArgs[0] : (process.stdin.isTTY ? "add" : "status")
|
|
314
|
+
process.exit(await runMcpCommand(sub, restArgs.slice(1).filter((arg) => !arg.startsWith("--")), parsedArgs))
|
|
315
|
+
}
|
|
316
|
+
process.exit(0)
|
|
317
|
+
} catch (error) {
|
|
318
|
+
console.error(`\x1b[31m${error instanceof Error ? error.message : error}\x1b[0m`)
|
|
319
|
+
process.exit(1)
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
292
323
|
// ── login ─────────────────────────────────────────────────────────────────────
|
|
293
324
|
|
|
294
325
|
if (command === "login" && process.stdin.isTTY && !parsedArgs["app-url"] && !parsedArgs["workspace-id"]) {
|
|
@@ -1403,7 +1434,7 @@ else if (command === "shell" || command === "sh") {
|
|
|
1403
1434
|
console.log(cmd("use <executor>", "Switch executor"))
|
|
1404
1435
|
console.log(cmd("rename <name>", "Set runner display name"))
|
|
1405
1436
|
console.log(cmd("doctor", "Check all dependencies"))
|
|
1406
|
-
console.log(cmd("update", "Upgrade pacework
|
|
1437
|
+
console.log(cmd("update", "Upgrade pacework to the latest version"))
|
|
1407
1438
|
console.log(cmd("login", "Authenticate via browser"))
|
|
1408
1439
|
console.log(cmd("logout", "Revoke API key and clear credentials"))
|
|
1409
1440
|
console.log(sec("SHELL"))
|
|
@@ -2452,7 +2483,7 @@ else if (command === "shell" || command === "sh") {
|
|
|
2452
2483
|
const slug = config.workspaceSlug ?? config.workspaceId ?? ""
|
|
2453
2484
|
const issueId = args[0]
|
|
2454
2485
|
const url = issueId
|
|
2455
|
-
? (slug ? `${base}/${slug}/
|
|
2486
|
+
? (slug ? `${base}/${slug}/issue/${issueId.toUpperCase()}` : base)
|
|
2456
2487
|
: (slug ? `${base}/${slug}` : base)
|
|
2457
2488
|
console.log(`Opening \x1b[36m${url}\x1b[0m`)
|
|
2458
2489
|
const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open"
|
|
@@ -2463,13 +2494,13 @@ else if (command === "shell" || command === "sh") {
|
|
|
2463
2494
|
case "update": {
|
|
2464
2495
|
console.log("Checking for updates…")
|
|
2465
2496
|
try {
|
|
2466
|
-
const
|
|
2467
|
-
|
|
2468
|
-
if (latest
|
|
2497
|
+
const latest = await latestPublishedVersion()
|
|
2498
|
+
if (!latest) throw new Error("no version")
|
|
2499
|
+
if (!isNewerVersion(latest, LOCAL_VERSION)) {
|
|
2469
2500
|
console.log(`\x1b[32m✓\x1b[0m Already on latest (\x1b[1m${LOCAL_VERSION}\x1b[0m)`)
|
|
2470
2501
|
} else {
|
|
2471
2502
|
console.log(`Updating ${LOCAL_VERSION} → \x1b[1m${latest}\x1b[0m…`)
|
|
2472
|
-
const child = spawn("npm", ["install", "-g",
|
|
2503
|
+
const child = spawn("npm", ["install", "-g", `${NPM_PACKAGE}@${latest}`], { stdio: "inherit" })
|
|
2473
2504
|
await new Promise(r => child.on("exit", r))
|
|
2474
2505
|
}
|
|
2475
2506
|
} catch { console.log("\x1b[31mCould not reach npm registry.\x1b[0m") }
|
|
@@ -2636,7 +2667,7 @@ else if (command === "shell" || command === "sh") {
|
|
|
2636
2667
|
{ name: "open", desc: "Open workspace in browser" },
|
|
2637
2668
|
{ name: "config", desc: "View or set config values" },
|
|
2638
2669
|
{ name: "doctor", desc: "Check dependencies" },
|
|
2639
|
-
{ name: "update", desc: "Upgrade pacework
|
|
2670
|
+
{ name: "update", desc: "Upgrade pacework to the latest version" },
|
|
2640
2671
|
{ name: "login", desc: "Authenticate via browser" },
|
|
2641
2672
|
{ name: "logout", desc: "Revoke API key and clear credentials" },
|
|
2642
2673
|
{ name: "help", desc: "Show this help screen" },
|