@bradygaster/squad-cli 0.9.1 → 0.9.2-insider.6
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 +329 -329
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +10 -10
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/config.d.ts +12 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +157 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/consult.d.ts.map +1 -1
- package/dist/cli/commands/consult.js +9 -4
- package/dist/cli/commands/consult.js.map +1 -1
- package/dist/cli/commands/copilot.d.ts.map +1 -1
- package/dist/cli/commands/copilot.js +8 -7
- package/dist/cli/commands/copilot.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +50 -17
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/economy.d.ts.map +1 -1
- package/dist/cli/commands/economy.js +3 -2
- package/dist/cli/commands/economy.js.map +1 -1
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +22 -16
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/extract.d.ts.map +1 -1
- package/dist/cli/commands/extract.js +14 -10
- package/dist/cli/commands/extract.js.map +1 -1
- package/dist/cli/commands/import.d.ts.map +1 -1
- package/dist/cli/commands/import.js +21 -18
- package/dist/cli/commands/import.js.map +1 -1
- package/dist/cli/commands/init-remote.d.ts.map +1 -1
- package/dist/cli/commands/init-remote.js +7 -6
- package/dist/cli/commands/init-remote.js.map +1 -1
- package/dist/cli/commands/link.d.ts.map +1 -1
- package/dist/cli/commands/link.js +11 -10
- package/dist/cli/commands/link.js.map +1 -1
- package/dist/cli/commands/migrate.d.ts.map +1 -1
- package/dist/cli/commands/migrate.js +19 -18
- package/dist/cli/commands/migrate.js.map +1 -1
- package/dist/cli/commands/personal.d.ts.map +1 -1
- package/dist/cli/commands/personal.js +57 -65
- package/dist/cli/commands/personal.js.map +1 -1
- package/dist/cli/commands/plugin.d.ts.map +1 -1
- package/dist/cli/commands/plugin.js +8 -7
- package/dist/cli/commands/plugin.js.map +1 -1
- package/dist/cli/commands/rc.d.ts.map +1 -1
- package/dist/cli/commands/rc.js +19 -12
- package/dist/cli/commands/rc.js.map +1 -1
- package/dist/cli/commands/schedule.d.ts.map +1 -1
- package/dist/cli/commands/schedule.js +6 -5
- package/dist/cli/commands/schedule.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +18 -11
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/streams.d.ts.map +1 -1
- package/dist/cli/commands/streams.js +3 -2
- package/dist/cli/commands/streams.js.map +1 -1
- package/dist/cli/commands/upstream.d.ts.map +1 -1
- package/dist/cli/commands/upstream.js +23 -19
- package/dist/cli/commands/upstream.js.map +1 -1
- package/dist/cli/commands/watch/capabilities/board.d.ts +22 -0
- package/dist/cli/commands/watch/capabilities/board.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/board.js +121 -0
- package/dist/cli/commands/watch/capabilities/board.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/budget-check.d.ts +29 -0
- package/dist/cli/commands/watch/capabilities/budget-check.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/budget-check.js +38 -0
- package/dist/cli/commands/watch/capabilities/budget-check.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/circuit-breaker.d.ts +52 -0
- package/dist/cli/commands/watch/capabilities/circuit-breaker.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/circuit-breaker.js +152 -0
- package/dist/cli/commands/watch/capabilities/circuit-breaker.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/decision-hygiene.d.ts +14 -0
- package/dist/cli/commands/watch/capabilities/decision-hygiene.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/decision-hygiene.js +72 -0
- package/dist/cli/commands/watch/capabilities/decision-hygiene.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/execute.d.ts +33 -0
- package/dist/cli/commands/watch/capabilities/execute.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/execute.js +156 -0
- package/dist/cli/commands/watch/capabilities/execute.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/health-check.d.ts +29 -0
- package/dist/cli/commands/watch/capabilities/health-check.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/health-check.js +139 -0
- package/dist/cli/commands/watch/capabilities/health-check.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/heartbeat.d.ts +48 -0
- package/dist/cli/commands/watch/capabilities/heartbeat.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/heartbeat.js +115 -0
- package/dist/cli/commands/watch/capabilities/heartbeat.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/index.d.ts +9 -0
- package/dist/cli/commands/watch/capabilities/index.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/index.js +40 -0
- package/dist/cli/commands/watch/capabilities/index.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/lockfile.d.ts +30 -0
- package/dist/cli/commands/watch/capabilities/lockfile.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/lockfile.js +100 -0
- package/dist/cli/commands/watch/capabilities/lockfile.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/machine-capabilities.d.ts +30 -0
- package/dist/cli/commands/watch/capabilities/machine-capabilities.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/machine-capabilities.js +103 -0
- package/dist/cli/commands/watch/capabilities/machine-capabilities.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/monitor-email.d.ts +14 -0
- package/dist/cli/commands/watch/capabilities/monitor-email.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/monitor-email.js +54 -0
- package/dist/cli/commands/watch/capabilities/monitor-email.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts +14 -0
- package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/monitor-teams.js +55 -0
- package/dist/cli/commands/watch/capabilities/monitor-teams.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/post-failure.d.ts +19 -0
- package/dist/cli/commands/watch/capabilities/post-failure.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/post-failure.js +58 -0
- package/dist/cli/commands/watch/capabilities/post-failure.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/priority.d.ts +59 -0
- package/dist/cli/commands/watch/capabilities/priority.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/priority.js +101 -0
- package/dist/cli/commands/watch/capabilities/priority.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/rate-pool.d.ts +67 -0
- package/dist/cli/commands/watch/capabilities/rate-pool.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/rate-pool.js +187 -0
- package/dist/cli/commands/watch/capabilities/rate-pool.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/retro.d.ts +14 -0
- package/dist/cli/commands/watch/capabilities/retro.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/retro.js +81 -0
- package/dist/cli/commands/watch/capabilities/retro.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/self-pull.d.ts +14 -0
- package/dist/cli/commands/watch/capabilities/self-pull.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/self-pull.js +33 -0
- package/dist/cli/commands/watch/capabilities/self-pull.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/stale-reclaim.d.ts +23 -0
- package/dist/cli/commands/watch/capabilities/stale-reclaim.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/stale-reclaim.js +87 -0
- package/dist/cli/commands/watch/capabilities/stale-reclaim.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/two-pass.d.ts +14 -0
- package/dist/cli/commands/watch/capabilities/two-pass.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/two-pass.js +66 -0
- package/dist/cli/commands/watch/capabilities/two-pass.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/wave-dispatch.d.ts +14 -0
- package/dist/cli/commands/watch/capabilities/wave-dispatch.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/wave-dispatch.js +117 -0
- package/dist/cli/commands/watch/capabilities/wave-dispatch.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/webhook-alerts.d.ts +29 -0
- package/dist/cli/commands/watch/capabilities/webhook-alerts.d.ts.map +1 -0
- package/dist/cli/commands/watch/capabilities/webhook-alerts.js +114 -0
- package/dist/cli/commands/watch/capabilities/webhook-alerts.js.map +1 -0
- package/dist/cli/commands/watch/config.d.ts +40 -0
- package/dist/cli/commands/watch/config.d.ts.map +1 -0
- package/dist/cli/commands/watch/config.js +129 -0
- package/dist/cli/commands/watch/config.js.map +1 -0
- package/dist/cli/commands/watch/index.d.ts +109 -0
- package/dist/cli/commands/watch/index.d.ts.map +1 -0
- package/dist/cli/commands/watch/index.js +757 -0
- package/dist/cli/commands/watch/index.js.map +1 -0
- package/dist/cli/commands/watch/registry.d.ts +19 -0
- package/dist/cli/commands/watch/registry.d.ts.map +1 -0
- package/dist/cli/commands/watch/registry.js +28 -0
- package/dist/cli/commands/watch/registry.js.map +1 -0
- package/dist/cli/commands/watch/types.d.ts +57 -0
- package/dist/cli/commands/watch/types.d.ts.map +1 -0
- package/dist/cli/commands/watch/types.js +8 -0
- package/dist/cli/commands/watch/types.js.map +1 -0
- package/dist/cli/core/cast.d.ts.map +1 -1
- package/dist/cli/core/cast.js +15 -19
- package/dist/cli/core/cast.js.map +1 -1
- package/dist/cli/core/detect-squad-dir.d.ts.map +1 -1
- package/dist/cli/core/detect-squad-dir.js +12 -10
- package/dist/cli/core/detect-squad-dir.js.map +1 -1
- package/dist/cli/core/email-scrub.d.ts.map +1 -1
- package/dist/cli/core/email-scrub.js +12 -11
- package/dist/cli/core/email-scrub.js.map +1 -1
- package/dist/cli/core/gh-cli.d.ts +13 -0
- package/dist/cli/core/gh-cli.d.ts.map +1 -1
- package/dist/cli/core/gh-cli.js +24 -0
- package/dist/cli/core/gh-cli.js.map +1 -1
- package/dist/cli/core/init.d.ts +2 -0
- package/dist/cli/core/init.d.ts.map +1 -1
- package/dist/cli/core/init.js +22 -5
- package/dist/cli/core/init.js.map +1 -1
- package/dist/cli/core/migrate-directory.d.ts.map +1 -1
- package/dist/cli/core/migrate-directory.js +14 -13
- package/dist/cli/core/migrate-directory.js.map +1 -1
- package/dist/cli/core/migrations.d.ts.map +1 -1
- package/dist/cli/core/migrations.js +22 -8
- package/dist/cli/core/migrations.js.map +1 -1
- package/dist/cli/core/nap.d.ts.map +1 -1
- package/dist/cli/core/nap.js +116 -49
- package/dist/cli/core/nap.js.map +1 -1
- package/dist/cli/core/project-type.d.ts.map +1 -1
- package/dist/cli/core/project-type.js +11 -10
- package/dist/cli/core/project-type.js.map +1 -1
- package/dist/cli/core/team-md.d.ts.map +1 -1
- package/dist/cli/core/team-md.js +43 -38
- package/dist/cli/core/team-md.js.map +1 -1
- package/dist/cli/core/templates.d.ts.map +1 -1
- package/dist/cli/core/templates.js +4 -3
- package/dist/cli/core/templates.js.map +1 -1
- package/dist/cli/core/upgrade.d.ts.map +1 -1
- package/dist/cli/core/upgrade.js +68 -55
- package/dist/cli/core/upgrade.js.map +1 -1
- package/dist/cli/core/version.d.ts.map +1 -1
- package/dist/cli/core/version.js +8 -7
- package/dist/cli/core/version.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/self-update.d.ts.map +1 -1
- package/dist/cli/self-update.js +7 -4
- package/dist/cli/self-update.js.map +1 -1
- package/dist/cli/shell/agent-name-parser.d.ts +16 -0
- package/dist/cli/shell/agent-name-parser.d.ts.map +1 -0
- package/dist/cli/shell/agent-name-parser.js +54 -0
- package/dist/cli/shell/agent-name-parser.js.map +1 -0
- package/dist/cli/shell/commands.d.ts.map +1 -1
- package/dist/cli/shell/commands.js +4 -3
- package/dist/cli/shell/commands.js.map +1 -1
- package/dist/cli/shell/coordinator.d.ts +4 -1
- package/dist/cli/shell/coordinator.d.ts.map +1 -1
- package/dist/cli/shell/coordinator.js +29 -26
- package/dist/cli/shell/coordinator.js.map +1 -1
- package/dist/cli/shell/index.d.ts.map +1 -1
- package/dist/cli/shell/index.js +33 -35
- package/dist/cli/shell/index.js.map +1 -1
- package/dist/cli/shell/lifecycle.d.ts +13 -2
- package/dist/cli/shell/lifecycle.d.ts.map +1 -1
- package/dist/cli/shell/lifecycle.js +26 -13
- package/dist/cli/shell/lifecycle.js.map +1 -1
- package/dist/cli/shell/session-store.d.ts.map +1 -1
- package/dist/cli/shell/session-store.js +16 -12
- package/dist/cli/shell/session-store.js.map +1 -1
- package/dist/cli/shell/spawn.d.ts +4 -1
- package/dist/cli/shell/spawn.d.ts.map +1 -1
- package/dist/cli/shell/spawn.js +28 -10
- package/dist/cli/shell/spawn.js.map +1 -1
- package/dist/cli-entry.js +136 -12
- package/dist/cli-entry.js.map +1 -1
- package/package.json +8 -4
- package/scripts/patch-esm-imports.mjs +105 -105
- package/scripts/patch-ink-rendering.mjs +115 -115
- package/templates/casting/Futurama.json +9 -9
- package/templates/casting-history.json +4 -4
- package/templates/casting-policy.json +37 -37
- package/templates/casting-reference.md +104 -104
- package/templates/casting-registry.json +3 -3
- package/templates/ceremonies.md +41 -41
- package/templates/charter.md +53 -53
- package/templates/constraint-tracking.md +38 -38
- package/templates/cooperative-rate-limiting.md +229 -229
- package/templates/copilot-instructions.md +46 -46
- package/templates/history.md +10 -10
- package/templates/identity/now.md +9 -9
- package/templates/identity/wisdom.md +15 -15
- package/templates/issue-lifecycle.md +412 -412
- package/templates/keda-scaler.md +164 -164
- package/templates/machine-capabilities.md +74 -74
- package/templates/mcp-config.md +90 -90
- package/templates/multi-agent-format.md +28 -28
- package/templates/orchestration-log.md +27 -27
- package/templates/plugin-marketplace.md +49 -49
- package/templates/ralph-circuit-breaker.md +313 -313
- package/templates/raw-agent-output.md +37 -37
- package/templates/roster.md +60 -60
- package/templates/routing.md +39 -39
- package/templates/run-output.md +50 -50
- package/templates/scribe-charter.md +123 -119
- package/templates/skill.md +24 -24
- package/templates/skills/agent-collaboration/SKILL.md +42 -42
- package/templates/skills/agent-conduct/SKILL.md +24 -24
- package/templates/skills/architectural-proposals/SKILL.md +151 -151
- package/templates/skills/ci-validation-gates/SKILL.md +84 -84
- package/templates/skills/cli-wiring/SKILL.md +47 -47
- package/templates/skills/client-compatibility/SKILL.md +89 -89
- package/templates/skills/cross-machine-coordination/SKILL.md +434 -0
- package/templates/skills/cross-squad/SKILL.md +114 -114
- package/templates/skills/distributed-mesh/SKILL.md +287 -287
- package/templates/skills/distributed-mesh/mesh.json.example +30 -30
- package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -111
- package/templates/skills/distributed-mesh/sync-mesh.sh +104 -104
- package/templates/skills/docs-standards/SKILL.md +71 -71
- package/templates/skills/economy-mode/SKILL.md +114 -114
- package/templates/skills/error-recovery/SKILL.md +99 -0
- package/templates/skills/external-comms/SKILL.md +329 -329
- package/templates/skills/gh-auth-isolation/SKILL.md +183 -183
- package/templates/skills/git-workflow/SKILL.md +204 -204
- package/templates/skills/github-multi-account/SKILL.md +95 -95
- package/templates/skills/history-hygiene/SKILL.md +36 -36
- package/templates/skills/humanizer/SKILL.md +105 -105
- package/templates/skills/init-mode/SKILL.md +102 -102
- package/templates/skills/iterative-retrieval/SKILL.md +165 -0
- package/templates/skills/model-selection/SKILL.md +117 -117
- package/templates/skills/nap/SKILL.md +24 -24
- package/templates/skills/notification-routing/SKILL.md +105 -0
- package/templates/skills/personal-squad/SKILL.md +57 -57
- package/templates/skills/pr-screenshots/SKILL.md +149 -0
- package/templates/skills/ralph-two-pass-scan/SKILL.md +35 -0
- package/templates/skills/reflect/SKILL.md +229 -0
- package/templates/skills/release-process/SKILL.md +131 -423
- package/templates/skills/reskill/SKILL.md +92 -92
- package/templates/skills/retro-enforcement/SKILL.md +148 -0
- package/templates/skills/reviewer-protocol/SKILL.md +79 -79
- package/templates/skills/secret-handling/SKILL.md +200 -200
- package/templates/skills/session-recovery/SKILL.md +155 -155
- package/templates/skills/squad-conventions/SKILL.md +69 -69
- package/templates/skills/test-discipline/SKILL.md +37 -37
- package/templates/skills/tiered-memory/SKILL.md +234 -0
- package/templates/skills/windows-compatibility/SKILL.md +98 -74
- package/templates/{squad.agent.md → squad.agent.md.template} +1316 -1287
- package/templates/workflows/squad-ci.yml +24 -24
- package/templates/workflows/squad-docs.yml +54 -54
- package/templates/workflows/squad-heartbeat.yml +0 -4
- package/templates/workflows/squad-insider-release.yml +61 -61
- package/templates/workflows/squad-issue-assign.yml +161 -161
- package/templates/workflows/squad-label-enforce.yml +181 -181
- package/templates/workflows/squad-preview.yml +55 -55
- package/templates/workflows/squad-promote.yml +120 -120
- package/templates/workflows/squad-release.yml +77 -77
- package/templates/workflows/squad-triage.yml +260 -260
- package/templates/workflows/sync-squad-labels.yml +169 -169
- package/dist/cli/commands/watch.d.ts +0 -18
- package/dist/cli/commands/watch.d.ts.map +0 -1
- package/dist/cli/commands/watch.js +0 -306
- package/dist/cli/commands/watch.js.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lockfile utility — per-repo lock with PID, timestamp, and stale detection.
|
|
3
|
+
*
|
|
4
|
+
* Ported from ralph-watch.ps1 lockfile logic.
|
|
5
|
+
* Written BEFORE a round (status=running) and AFTER (status=idle/error).
|
|
6
|
+
* External tools (e.g., squad-monitor) can read this file to know if
|
|
7
|
+
* a watch process is active.
|
|
8
|
+
*
|
|
9
|
+
* This is a utility module — not a WatchCapability.
|
|
10
|
+
*/
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import fs from 'node:fs';
|
|
13
|
+
const STALE_THRESHOLD_MS = 30 * 60 * 1000; // 30 minutes
|
|
14
|
+
/**
|
|
15
|
+
* Acquire a lockfile for this watch process.
|
|
16
|
+
* Returns false if another non-stale process holds the lock.
|
|
17
|
+
*/
|
|
18
|
+
export function acquireLock(teamRoot) {
|
|
19
|
+
const lockPath = getLockPath(teamRoot);
|
|
20
|
+
if (fs.existsSync(lockPath)) {
|
|
21
|
+
try {
|
|
22
|
+
const existing = JSON.parse(fs.readFileSync(lockPath, 'utf-8'));
|
|
23
|
+
// Check if the PID is still alive
|
|
24
|
+
if (isProcessAlive(existing.pid)) {
|
|
25
|
+
// Check if it's stale
|
|
26
|
+
const age = Date.now() - new Date(existing.lastRun).getTime();
|
|
27
|
+
if (age < STALE_THRESHOLD_MS) {
|
|
28
|
+
return false; // Another active process holds the lock
|
|
29
|
+
}
|
|
30
|
+
// Stale — we can take over
|
|
31
|
+
}
|
|
32
|
+
// Dead or stale PID — safe to overwrite
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Corrupt lockfile — overwrite
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
writeLock(teamRoot, {
|
|
39
|
+
pid: process.pid,
|
|
40
|
+
status: 'running',
|
|
41
|
+
round: 0,
|
|
42
|
+
lastRun: new Date().toISOString(),
|
|
43
|
+
exitCode: 0,
|
|
44
|
+
consecutiveFailures: 0,
|
|
45
|
+
started: new Date().toISOString(),
|
|
46
|
+
directory: teamRoot,
|
|
47
|
+
});
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
/** Update the lockfile with current round state. */
|
|
51
|
+
export function updateLock(teamRoot, status, round, exitCode = 0, consecutiveFailures = 0) {
|
|
52
|
+
const lockPath = getLockPath(teamRoot);
|
|
53
|
+
let existing = {};
|
|
54
|
+
try {
|
|
55
|
+
existing = JSON.parse(fs.readFileSync(lockPath, 'utf-8'));
|
|
56
|
+
}
|
|
57
|
+
catch { /* use defaults */ }
|
|
58
|
+
writeLock(teamRoot, {
|
|
59
|
+
pid: process.pid,
|
|
60
|
+
status,
|
|
61
|
+
round,
|
|
62
|
+
lastRun: new Date().toISOString(),
|
|
63
|
+
exitCode,
|
|
64
|
+
consecutiveFailures,
|
|
65
|
+
started: existing.started ?? new Date().toISOString(),
|
|
66
|
+
directory: teamRoot,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** Release the lockfile on shutdown. */
|
|
70
|
+
export function releaseLock(teamRoot) {
|
|
71
|
+
const lockPath = getLockPath(teamRoot);
|
|
72
|
+
try {
|
|
73
|
+
if (fs.existsSync(lockPath)) {
|
|
74
|
+
const data = JSON.parse(fs.readFileSync(lockPath, 'utf-8'));
|
|
75
|
+
if (data.pid === process.pid) {
|
|
76
|
+
fs.unlinkSync(lockPath);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch { /* best-effort */ }
|
|
81
|
+
}
|
|
82
|
+
function getLockPath(teamRoot) {
|
|
83
|
+
return path.join(teamRoot, '.ralph-watch.lock');
|
|
84
|
+
}
|
|
85
|
+
function writeLock(teamRoot, data) {
|
|
86
|
+
try {
|
|
87
|
+
fs.writeFileSync(getLockPath(teamRoot), JSON.stringify(data, null, 2), 'utf-8');
|
|
88
|
+
}
|
|
89
|
+
catch { /* best-effort */ }
|
|
90
|
+
}
|
|
91
|
+
function isProcessAlive(pid) {
|
|
92
|
+
try {
|
|
93
|
+
process.kill(pid, 0);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=lockfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lockfile.js","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/lockfile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AAazB,MAAM,kBAAk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CAAC,QAAgB,EAAE,IAAkB;IACrD,IAAI,CAAC;QACH,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Machine capability checking — match issue needs:* labels to local machine.
|
|
3
|
+
*
|
|
4
|
+
* Ported from ralph-watch.ps1 `Test-MachineCapability`.
|
|
5
|
+
* Reads `needs:*` labels from issues and compares against a local
|
|
6
|
+
* capabilities list provided via:
|
|
7
|
+
* 1. CLI flag: --capabilities gpu,browser,docker
|
|
8
|
+
* 2. Config: watch.capabilities["machine-capabilities"].list
|
|
9
|
+
* 3. Auto-detect: probe for common tools (nvidia-smi, playwright, docker)
|
|
10
|
+
*
|
|
11
|
+
* This is a utility module — not a WatchCapability.
|
|
12
|
+
*/
|
|
13
|
+
export interface MachineCapabilityResult {
|
|
14
|
+
canHandle: boolean;
|
|
15
|
+
reason: string;
|
|
16
|
+
missing?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface MachineCapabilityConfig {
|
|
19
|
+
/** Explicit list of capabilities this machine has. */
|
|
20
|
+
list?: string[];
|
|
21
|
+
/** Whether to auto-detect capabilities (default: true). */
|
|
22
|
+
autoDetect?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Detect capabilities available on this machine. */
|
|
25
|
+
export declare function detectCapabilities(config?: MachineCapabilityConfig): Promise<string[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Check if this machine can handle an issue based on its needs:* labels.
|
|
28
|
+
*/
|
|
29
|
+
export declare function checkMachineCapability(issueLabels: string[], machineCaps: string[]): MachineCapabilityResult;
|
|
30
|
+
//# sourceMappingURL=machine-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machine-capabilities.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/machine-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAyCD,qDAAqD;AACrD,wBAAsB,kBAAkB,CAAC,MAAM,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAW5F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,EAAE,MAAM,EAAE,GACpB,uBAAuB,CAqBzB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Machine capability checking — match issue needs:* labels to local machine.
|
|
3
|
+
*
|
|
4
|
+
* Ported from ralph-watch.ps1 `Test-MachineCapability`.
|
|
5
|
+
* Reads `needs:*` labels from issues and compares against a local
|
|
6
|
+
* capabilities list provided via:
|
|
7
|
+
* 1. CLI flag: --capabilities gpu,browser,docker
|
|
8
|
+
* 2. Config: watch.capabilities["machine-capabilities"].list
|
|
9
|
+
* 3. Auto-detect: probe for common tools (nvidia-smi, playwright, docker)
|
|
10
|
+
*
|
|
11
|
+
* This is a utility module — not a WatchCapability.
|
|
12
|
+
*/
|
|
13
|
+
import { execFile } from 'node:child_process';
|
|
14
|
+
import { promisify } from 'node:util';
|
|
15
|
+
const execFileAsync = promisify(execFile);
|
|
16
|
+
/** Probes for common capabilities on the local machine. */
|
|
17
|
+
const CAPABILITY_PROBES = {
|
|
18
|
+
gpu: async () => {
|
|
19
|
+
try {
|
|
20
|
+
await execFileAsync('nvidia-smi', ['--query-gpu=name', '--format=csv,noheader'], { timeout: 5_000 });
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
browser: async () => {
|
|
28
|
+
try {
|
|
29
|
+
await execFileAsync('npx', ['playwright', '--version'], { timeout: 10_000 });
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
docker: async () => {
|
|
37
|
+
try {
|
|
38
|
+
await execFileAsync('docker', ['info'], { timeout: 5_000 });
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
node: async () => {
|
|
46
|
+
try {
|
|
47
|
+
await execFileAsync('node', ['--version'], { timeout: 5_000 });
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
python: async () => {
|
|
55
|
+
try {
|
|
56
|
+
await execFileAsync('python3', ['--version'], { timeout: 5_000 });
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
try {
|
|
61
|
+
await execFileAsync('python', ['--version'], { timeout: 5_000 });
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
/** Detect capabilities available on this machine. */
|
|
71
|
+
export async function detectCapabilities(config) {
|
|
72
|
+
const caps = new Set(config?.list ?? []);
|
|
73
|
+
if (config?.autoDetect !== false) {
|
|
74
|
+
const probes = Object.entries(CAPABILITY_PROBES).map(async ([name, probe]) => {
|
|
75
|
+
if (await probe())
|
|
76
|
+
caps.add(name);
|
|
77
|
+
});
|
|
78
|
+
await Promise.all(probes);
|
|
79
|
+
}
|
|
80
|
+
return [...caps];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if this machine can handle an issue based on its needs:* labels.
|
|
84
|
+
*/
|
|
85
|
+
export function checkMachineCapability(issueLabels, machineCaps) {
|
|
86
|
+
const needsLabels = issueLabels
|
|
87
|
+
.filter(l => l.startsWith('needs:'))
|
|
88
|
+
.map(l => l.replace(/^needs:/, ''));
|
|
89
|
+
if (needsLabels.length === 0) {
|
|
90
|
+
return { canHandle: true, reason: 'No needs:* labels on issue' };
|
|
91
|
+
}
|
|
92
|
+
const capSet = new Set(machineCaps.map(c => c.toLowerCase()));
|
|
93
|
+
const missing = needsLabels.filter(need => !capSet.has(need.toLowerCase()));
|
|
94
|
+
if (missing.length === 0) {
|
|
95
|
+
return { canHandle: true, reason: 'All required capabilities present' };
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
canHandle: false,
|
|
99
|
+
reason: `Missing capabilities: ${missing.join(', ')}`,
|
|
100
|
+
missing,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=machine-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machine-capabilities.js","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/machine-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC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tC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC;IACnE,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAE5E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,mCAAmC,EAAE,CAAC;IAC1E,CAAC;IAED,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,yBAAyB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACrD,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MonitorEmail capability — scan email for actionable items + GitHub alerts.
|
|
3
|
+
*/
|
|
4
|
+
import type { WatchCapability, WatchContext, PreflightResult, CapabilityResult } from '../types.js';
|
|
5
|
+
export declare class MonitorEmailCapability implements WatchCapability {
|
|
6
|
+
readonly name = "monitor-email";
|
|
7
|
+
readonly description = "Scan email for actionable items each round (requires WorkIQ MCP)";
|
|
8
|
+
readonly configShape: "boolean";
|
|
9
|
+
readonly requires: string[];
|
|
10
|
+
readonly phase: "housekeeping";
|
|
11
|
+
preflight(_context: WatchContext): Promise<PreflightResult>;
|
|
12
|
+
execute(context: WatchContext): Promise<CapabilityResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=monitor-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor-email.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/monitor-email.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAyBpG,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,QAAQ,CAAC,IAAI,mBAAmB;IAChC,QAAQ,CAAC,WAAW,sEAAsE;IAC1F,QAAQ,CAAC,WAAW,EAAG,SAAS,CAAU;IAC1C,QAAQ,CAAC,QAAQ,WAAwB;IACzC,QAAQ,CAAC,KAAK,EAAG,cAAc,CAAU;IAEnC,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAI3D,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAiBhE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MonitorEmail capability — scan email for actionable items + GitHub alerts.
|
|
3
|
+
*/
|
|
4
|
+
import { execFile } from 'node:child_process';
|
|
5
|
+
function buildAgentCommand(prompt, context) {
|
|
6
|
+
if (context.agentCmd) {
|
|
7
|
+
const parts = context.agentCmd.trim().split(/\s+/);
|
|
8
|
+
return { cmd: parts[0], args: [...parts.slice(1), '--message', prompt] };
|
|
9
|
+
}
|
|
10
|
+
const args = ['copilot', '--message', prompt];
|
|
11
|
+
if (context.copilotFlags)
|
|
12
|
+
args.push(...context.copilotFlags.trim().split(/\s+/));
|
|
13
|
+
return { cmd: 'gh', args };
|
|
14
|
+
}
|
|
15
|
+
function spawnWithTimeout(cmd, args, cwd, timeoutMs) {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
execFile(cmd, args, { cwd, timeout: timeoutMs, maxBuffer: 50 * 1024 * 1024 }, (err) => {
|
|
18
|
+
if (err) {
|
|
19
|
+
const execErr = err;
|
|
20
|
+
reject(new Error(execErr.killed ? `Timed out after ${Math.round(timeoutMs / 1000)}s` : execErr.message));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
resolve();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export class MonitorEmailCapability {
|
|
29
|
+
name = 'monitor-email';
|
|
30
|
+
description = 'Scan email for actionable items each round (requires WorkIQ MCP)';
|
|
31
|
+
configShape = 'boolean';
|
|
32
|
+
requires = ['gh', 'WorkIQ MCP'];
|
|
33
|
+
phase = 'housekeeping';
|
|
34
|
+
async preflight(_context) {
|
|
35
|
+
return { ok: true };
|
|
36
|
+
}
|
|
37
|
+
async execute(context) {
|
|
38
|
+
try {
|
|
39
|
+
const prompt = 'Check email for actionable items. Use workiq-ask_work_iq to query: ' +
|
|
40
|
+
'"Recent emails about CI failures, Dependabot alerts, security vulnerabilities, or review requests". ' +
|
|
41
|
+
'For CI failures: check if a GitHub issue with label "ci-alert" already exists for the same workflow in the last 24 hours — if so, skip. ' +
|
|
42
|
+
'For new alerts: create a GitHub issue with label "email-bridge". ' +
|
|
43
|
+
'If a failed workflow can be re-run, attempt: gh run rerun <run-id> --failed. ' +
|
|
44
|
+
'If WorkIQ is not available, just report that and exit.';
|
|
45
|
+
const { cmd, args } = buildAgentCommand(prompt, context);
|
|
46
|
+
await spawnWithTimeout(cmd, args, context.teamRoot, 60_000);
|
|
47
|
+
return { success: true, summary: 'Email scan complete' };
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
return { success: false, summary: `Email monitor: ${e.message}` };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=monitor-email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor-email.js","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/monitor-email.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EA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AAC,CAAC,CAAC;YAC3G,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,OAAO,sBAAsB;IACxB,IAAI,GAAG,eAAe,CAAC;IACvB,WAAW,GAAG,kEAAkE,CAAC;IACjF,WAAW,GAAG,SAAkB,CAAC;IACjC,QAAQ,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAChC,KAAK,GAAG,cAAuB,CAAC;IAEzC,KAAK,CAAC,SAAS,CAAC,QAAsB;QACpC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAqB;QACjC,IAAI,CAAC;YACH,MAAM,MAAM,GACV,qEAAqE;gBACrE,sGAAsG;gBACtG,0IAA0I;gBAC1I,mEAAmE;gBACnE,+EAA+E;gBAC/E,wDAAwD,CAAC;YAE3D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACzD,MAAM,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QAC3D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAmB,CAAW,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/E,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MonitorTeams capability — scan Teams for actionable messages via WorkIQ.
|
|
3
|
+
*/
|
|
4
|
+
import type { WatchCapability, WatchContext, PreflightResult, CapabilityResult } from '../types.js';
|
|
5
|
+
export declare class MonitorTeamsCapability implements WatchCapability {
|
|
6
|
+
readonly name = "monitor-teams";
|
|
7
|
+
readonly description = "Scan Teams for actionable messages each round (requires WorkIQ MCP)";
|
|
8
|
+
readonly configShape: "boolean";
|
|
9
|
+
readonly requires: string[];
|
|
10
|
+
readonly phase: "housekeeping";
|
|
11
|
+
preflight(_context: WatchContext): Promise<PreflightResult>;
|
|
12
|
+
execute(context: WatchContext): Promise<CapabilityResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=monitor-teams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor-teams.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/monitor-teams.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA0BpG,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,QAAQ,CAAC,IAAI,mBAAmB;IAChC,QAAQ,CAAC,WAAW,yEAAyE;IAC7F,QAAQ,CAAC,WAAW,EAAG,SAAS,CAAU;IAC1C,QAAQ,CAAC,QAAQ,WAAwB;IACzC,QAAQ,CAAC,KAAK,EAAG,cAAc,CAAU;IAEnC,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAK3D,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAgBhE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MonitorTeams capability — scan Teams for actionable messages via WorkIQ.
|
|
3
|
+
*/
|
|
4
|
+
import { execFile } from 'node:child_process';
|
|
5
|
+
/** Build agent command from prompt, respecting --agent-cmd. */
|
|
6
|
+
function buildAgentCommand(prompt, context) {
|
|
7
|
+
if (context.agentCmd) {
|
|
8
|
+
const parts = context.agentCmd.trim().split(/\s+/);
|
|
9
|
+
return { cmd: parts[0], args: [...parts.slice(1), '--message', prompt] };
|
|
10
|
+
}
|
|
11
|
+
const args = ['copilot', '--message', prompt];
|
|
12
|
+
if (context.copilotFlags)
|
|
13
|
+
args.push(...context.copilotFlags.trim().split(/\s+/));
|
|
14
|
+
return { cmd: 'gh', args };
|
|
15
|
+
}
|
|
16
|
+
function spawnWithTimeout(cmd, args, cwd, timeoutMs) {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
execFile(cmd, args, { cwd, timeout: timeoutMs, maxBuffer: 50 * 1024 * 1024 }, (err) => {
|
|
19
|
+
if (err) {
|
|
20
|
+
const execErr = err;
|
|
21
|
+
reject(new Error(execErr.killed ? `Timed out after ${Math.round(timeoutMs / 1000)}s` : execErr.message));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
resolve();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export class MonitorTeamsCapability {
|
|
30
|
+
name = 'monitor-teams';
|
|
31
|
+
description = 'Scan Teams for actionable messages each round (requires WorkIQ MCP)';
|
|
32
|
+
configShape = 'boolean';
|
|
33
|
+
requires = ['gh', 'WorkIQ MCP'];
|
|
34
|
+
phase = 'housekeeping';
|
|
35
|
+
async preflight(_context) {
|
|
36
|
+
// WorkIQ availability can only be checked at runtime; preflight is optimistic
|
|
37
|
+
return { ok: true };
|
|
38
|
+
}
|
|
39
|
+
async execute(context) {
|
|
40
|
+
try {
|
|
41
|
+
const prompt = 'Check Teams for actionable messages from the last 30 minutes. ' +
|
|
42
|
+
'Use workiq-ask_work_iq to query: "Teams messages in last 30 min mentioning action items, reviews, urgent requests". ' +
|
|
43
|
+
'For each actionable item found, create a GitHub issue with the label "teams-bridge". ' +
|
|
44
|
+
'First check existing open issues with label "teams-bridge" to avoid duplicates. ' +
|
|
45
|
+
'If WorkIQ is not available, just report that and exit.';
|
|
46
|
+
const { cmd, args } = buildAgentCommand(prompt, context);
|
|
47
|
+
await spawnWithTimeout(cmd, args, context.teamRoot, 60_000);
|
|
48
|
+
return { success: true, summary: 'Teams scan complete' };
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
return { success: false, summary: `Teams monitor: ${e.message}` };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=monitor-teams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor-teams.js","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/monitor-teams.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,+DAA+D;AAC/D,SAAS,iBAAiB,CAAC,MAAc,EAAE,OAAqB;IAC9D,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACnD,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC;IAC5E,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC9C,IAAI,OAAO,CAAC,YAAY;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACjF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW,EAAE,IAAc,EAAE,GAAW,EAAE,SAAiB;IACnF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE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E,IAAI,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QAC3D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAmB,CAAW,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/E,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-failure remediation — tiered self-healing response.
|
|
3
|
+
*
|
|
4
|
+
* Ported from ralph-watch.ps1 `Invoke-PostFailureRemediation`.
|
|
5
|
+
* Tiered response based on consecutive failure count:
|
|
6
|
+
* Tier 1 (≥3): Reset circuit breaker state
|
|
7
|
+
* Tier 2 (≥6): Re-verify auth
|
|
8
|
+
* Tier 3 (≥9): Git pull to get latest fixes
|
|
9
|
+
* Tier 4 (≥15): Extended pause + webhook alert
|
|
10
|
+
*
|
|
11
|
+
* This is a utility module — called from the main watch loop on errors.
|
|
12
|
+
*/
|
|
13
|
+
import type { ModelCircuitBreaker } from './circuit-breaker.js';
|
|
14
|
+
export interface RemediationResult {
|
|
15
|
+
actions: string[];
|
|
16
|
+
pauseSeconds: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function runPostFailureRemediation(consecutiveFailures: number, round: number, teamRoot: string, circuitBreaker?: ModelCircuitBreaker): Promise<RemediationResult>;
|
|
19
|
+
//# sourceMappingURL=post-failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-failure.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/post-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAIhE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,yBAAyB,CAC7C,mBAAmB,EAAE,MAAM,EAC3B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,mBAAmB,GACnC,OAAO,CAAC,iBAAiB,CAAC,CA4C5B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-failure remediation — tiered self-healing response.
|
|
3
|
+
*
|
|
4
|
+
* Ported from ralph-watch.ps1 `Invoke-PostFailureRemediation`.
|
|
5
|
+
* Tiered response based on consecutive failure count:
|
|
6
|
+
* Tier 1 (≥3): Reset circuit breaker state
|
|
7
|
+
* Tier 2 (≥6): Re-verify auth
|
|
8
|
+
* Tier 3 (≥9): Git pull to get latest fixes
|
|
9
|
+
* Tier 4 (≥15): Extended pause + webhook alert
|
|
10
|
+
*
|
|
11
|
+
* This is a utility module — called from the main watch loop on errors.
|
|
12
|
+
*/
|
|
13
|
+
import { execFile } from 'node:child_process';
|
|
14
|
+
import { promisify } from 'node:util';
|
|
15
|
+
const execFileAsync = promisify(execFile);
|
|
16
|
+
export async function runPostFailureRemediation(consecutiveFailures, round, teamRoot, circuitBreaker) {
|
|
17
|
+
const actions = [];
|
|
18
|
+
let pauseSeconds = 0;
|
|
19
|
+
if (consecutiveFailures >= 3 && consecutiveFailures < 6) {
|
|
20
|
+
// Tier 1: Reset circuit breaker
|
|
21
|
+
if (circuitBreaker) {
|
|
22
|
+
circuitBreaker.reset();
|
|
23
|
+
actions.push('Tier1: Reset circuit breaker to defaults');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (consecutiveFailures >= 6 && consecutiveFailures < 9) {
|
|
27
|
+
// Tier 2: Re-verify gh auth
|
|
28
|
+
try {
|
|
29
|
+
const { stdout } = await execFileAsync('gh', ['api', 'user', '--jq', '.login'], {
|
|
30
|
+
timeout: 10_000,
|
|
31
|
+
});
|
|
32
|
+
actions.push(`Tier2: GH auth verified (${stdout.trim()})`);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
actions.push('Tier2: GH auth still failing');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (consecutiveFailures >= 9 && consecutiveFailures < 15) {
|
|
39
|
+
// Tier 3: Git pull latest
|
|
40
|
+
try {
|
|
41
|
+
await execFileAsync('git', ['pull', '--rebase', '--quiet'], {
|
|
42
|
+
cwd: teamRoot,
|
|
43
|
+
timeout: 30_000,
|
|
44
|
+
});
|
|
45
|
+
actions.push('Tier3: Git pull --rebase succeeded');
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
actions.push('Tier3: Git pull failed');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (consecutiveFailures >= 15) {
|
|
52
|
+
// Tier 4: Extended pause
|
|
53
|
+
pauseSeconds = 30 * 60; // 30 minutes
|
|
54
|
+
actions.push(`Tier4: ${consecutiveFailures} failures — pausing ${pauseSeconds / 60} minutes`);
|
|
55
|
+
}
|
|
56
|
+
return { actions, pauseSeconds };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=post-failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-failure.js","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/post-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAO1C,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,mBAA2B,EAC3B,KAAa,EACb,QAAgB,EAChB,cAAoC;IAEpC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,IAAI,mBAAmB,IAAI,CAAC,IAAI,mBAAmB,GAAG,CAAC,EAAE,CAAC;QACxD,gCAAgC;QAChC,IAAI,cAAc,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YAAY,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue priority scoring — weigh issues for execution order.
|
|
3
|
+
*
|
|
4
|
+
* Ported from ralph-watch.ps1 issue scoring logic.
|
|
5
|
+
* Factors:
|
|
6
|
+
* - Priority labels: P0 (100), P1 (60), P2 (30), P3 (10)
|
|
7
|
+
* - Age bonus: +1 per day open (max +30)
|
|
8
|
+
* - Staleness: +20 if no activity in 7+ days
|
|
9
|
+
* - Bug label: +15
|
|
10
|
+
* - Size labels: size:S +10, size:M 0, size:L -5
|
|
11
|
+
*
|
|
12
|
+
* This is a utility module — not a WatchCapability.
|
|
13
|
+
* Used by the execute capability to sort issues before picking work.
|
|
14
|
+
*/
|
|
15
|
+
export interface ScoredIssue {
|
|
16
|
+
number: number;
|
|
17
|
+
title: string;
|
|
18
|
+
labels: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
}>;
|
|
21
|
+
score: number;
|
|
22
|
+
breakdown: Record<string, number>;
|
|
23
|
+
}
|
|
24
|
+
export interface PriorityConfig {
|
|
25
|
+
/** Weight multipliers — override defaults. */
|
|
26
|
+
weights?: Partial<PriorityWeights>;
|
|
27
|
+
}
|
|
28
|
+
export interface PriorityWeights {
|
|
29
|
+
p0: number;
|
|
30
|
+
p1: number;
|
|
31
|
+
p2: number;
|
|
32
|
+
p3: number;
|
|
33
|
+
agePerDay: number;
|
|
34
|
+
ageMax: number;
|
|
35
|
+
staleThresholdDays: number;
|
|
36
|
+
staleBonus: number;
|
|
37
|
+
bugBonus: number;
|
|
38
|
+
sizeSBonus: number;
|
|
39
|
+
sizeLPenalty: number;
|
|
40
|
+
}
|
|
41
|
+
export interface IssueLike {
|
|
42
|
+
number: number;
|
|
43
|
+
title: string;
|
|
44
|
+
labels: Array<{
|
|
45
|
+
name: string;
|
|
46
|
+
}>;
|
|
47
|
+
createdAt?: string | Date;
|
|
48
|
+
updatedAt?: string | Date;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Score a single issue for execution priority.
|
|
52
|
+
* Higher score = should be picked first.
|
|
53
|
+
*/
|
|
54
|
+
export declare function scoreIssue(issue: IssueLike, config?: PriorityConfig): ScoredIssue;
|
|
55
|
+
/**
|
|
56
|
+
* Score and sort a batch of issues, highest score first.
|
|
57
|
+
*/
|
|
58
|
+
export declare function rankIssues(issues: IssueLike[], config?: PriorityConfig): ScoredIssue[];
|
|
59
|
+
//# sourceMappingURL=priority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"priority.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/watch/capabilities/priority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAgBD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,C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