@oss-autopilot/core 3.26.0 → 3.27.0
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/dist/cli-registry.js +1 -1
- package/dist/cli.bundle.cjs +73 -72
- package/dist/commands/daily-render.js +4 -1
- package/dist/commands/overnight.d.ts +12 -1
- package/dist/commands/overnight.js +24 -3
- package/dist/commands/setup.js +1 -1
- package/dist/core/config-registry.js +2 -2
- package/dist/core/daily-logic.js +8 -4
- package/package.json +1 -1
|
@@ -124,7 +124,10 @@ export function formatSummary(digest, capacity, issueResponses = []) {
|
|
|
124
124
|
const capacityIcon = capacity.hasCapacity ? '✅' : '⚠️';
|
|
125
125
|
const capacityLabel = capacity.hasCapacity ? 'Ready for new work' : 'Focus on existing PRs';
|
|
126
126
|
const shelvedNote = capacity.shelvedPRCount > 0 ? ` + ${capacity.shelvedPRCount} shelved` : '';
|
|
127
|
-
|
|
127
|
+
const countLabel = capacity.maxActivePRs > 0
|
|
128
|
+
? `${capacity.activePRCount}/${capacity.maxActivePRs} PRs`
|
|
129
|
+
: `${capacity.activePRCount} PRs, no limit`;
|
|
130
|
+
lines.push(`**Capacity:** ${capacityIcon} ${capacityLabel} (${countLabel}${shelvedNote})`);
|
|
128
131
|
return lines.join('\n');
|
|
129
132
|
}
|
|
130
133
|
/**
|
|
@@ -204,11 +204,22 @@ export declare const LAUNCHD_LABEL = "com.oss-autopilot.overnight";
|
|
|
204
204
|
*/
|
|
205
205
|
export declare const OVERNIGHT_DISALLOWED_TOOLS: string;
|
|
206
206
|
export declare const OVERNIGHT_ALLOWED_TOOLS: string;
|
|
207
|
+
/**
|
|
208
|
+
* The settings layer the scheduled job runs with instead of the user's own
|
|
209
|
+
* (#1697). Permission allow rules union across settings layers, and a user
|
|
210
|
+
* whose day-to-day settings allow bare `Bash` would otherwise void the
|
|
211
|
+
* enumerated allowlist entirely: only the deny list would apply. So the job
|
|
212
|
+
* drops user, project and local settings (`--setting-sources ""`) and gets
|
|
213
|
+
* this file, which carries only what it needs from them: the plugin itself.
|
|
214
|
+
*/
|
|
215
|
+
export declare function renderOvernightSettings(): string;
|
|
207
216
|
/** Pure: the launchd plist that runs `/oss-overnight` headlessly. */
|
|
208
|
-
export declare function renderLaunchdPlist(options: Pick<ScheduleOptions, 'hour' | 'claudePath'>, logPath: string): string;
|
|
217
|
+
export declare function renderLaunchdPlist(options: Pick<ScheduleOptions, 'hour' | 'claudePath'>, logPath: string, settingsPath: string): string;
|
|
209
218
|
export interface ScheduleOutput {
|
|
210
219
|
plist: string;
|
|
211
220
|
plistPath: string;
|
|
221
|
+
/** The settings layer the job runs with (see renderOvernightSettings); written with --install. */
|
|
222
|
+
settingsPath: string;
|
|
212
223
|
installed: boolean;
|
|
213
224
|
/** The one command the user runs to (re)load the job. */
|
|
214
225
|
loadCommand: string;
|
|
@@ -475,17 +475,34 @@ export const OVERNIGHT_ALLOWED_TOOLS = [
|
|
|
475
475
|
function xmlEscape(s) {
|
|
476
476
|
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
477
477
|
}
|
|
478
|
+
/**
|
|
479
|
+
* The settings layer the scheduled job runs with instead of the user's own
|
|
480
|
+
* (#1697). Permission allow rules union across settings layers, and a user
|
|
481
|
+
* whose day-to-day settings allow bare `Bash` would otherwise void the
|
|
482
|
+
* enumerated allowlist entirely: only the deny list would apply. So the job
|
|
483
|
+
* drops user, project and local settings (`--setting-sources ""`) and gets
|
|
484
|
+
* this file, which carries only what it needs from them: the plugin itself.
|
|
485
|
+
*/
|
|
486
|
+
export function renderOvernightSettings() {
|
|
487
|
+
return `${JSON.stringify({ enabledPlugins: { 'oss-autopilot@oss-autopilot': true } }, null, 2)}\n`;
|
|
488
|
+
}
|
|
478
489
|
/** Pure: the launchd plist that runs `/oss-overnight` headlessly. */
|
|
479
|
-
export function renderLaunchdPlist(options, logPath) {
|
|
490
|
+
export function renderLaunchdPlist(options, logPath, settingsPath) {
|
|
480
491
|
// Headless `-p` starts in manual permission mode, where any unapproved tool
|
|
481
492
|
// call fails (nobody can answer). `dontAsk` + the enumerated allowlist above
|
|
482
|
-
// is the documented unattended shape and the enforcement half of the gate
|
|
493
|
+
// is the documented unattended shape and the enforcement half of the gate,
|
|
494
|
+
// and only holds with the user's own settings out of the picture (see
|
|
495
|
+
// renderOvernightSettings).
|
|
483
496
|
const args = [
|
|
484
497
|
options.claudePath,
|
|
485
498
|
'-p',
|
|
486
499
|
'/oss-overnight',
|
|
487
500
|
'--permission-mode',
|
|
488
501
|
'dontAsk',
|
|
502
|
+
'--setting-sources',
|
|
503
|
+
'',
|
|
504
|
+
'--settings',
|
|
505
|
+
settingsPath,
|
|
489
506
|
'--allowedTools',
|
|
490
507
|
OVERNIGHT_ALLOWED_TOOLS,
|
|
491
508
|
'--disallowedTools',
|
|
@@ -544,14 +561,18 @@ export function runOvernightSchedule(options) {
|
|
|
544
561
|
const claudePath = resolveClaudePath(options.claudePath);
|
|
545
562
|
const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${LAUNCHD_LABEL}.plist`);
|
|
546
563
|
const logPath = path.join(getReportsDir(), 'overnight-launchd.log');
|
|
547
|
-
const
|
|
564
|
+
const settingsPath = path.join(getReportsDir(), 'overnight-settings.json');
|
|
565
|
+
const plist = renderLaunchdPlist({ hour: options.hour, claudePath }, logPath, settingsPath);
|
|
548
566
|
if (options.install) {
|
|
549
567
|
fs.mkdirSync(path.dirname(plistPath), { recursive: true });
|
|
550
568
|
fs.writeFileSync(plistPath, plist, { mode: 0o644 });
|
|
569
|
+
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
570
|
+
fs.writeFileSync(settingsPath, renderOvernightSettings(), { mode: 0o600 });
|
|
551
571
|
}
|
|
552
572
|
return {
|
|
553
573
|
plist,
|
|
554
574
|
plistPath,
|
|
575
|
+
settingsPath,
|
|
555
576
|
installed: options.install,
|
|
556
577
|
loadCommand: `launchctl bootout gui/$(id -u) ${plistPath} 2>/dev/null; launchctl bootstrap gui/$(id -u) ${plistPath}`,
|
|
557
578
|
};
|
package/dist/commands/setup.js
CHANGED
|
@@ -66,7 +66,7 @@ export async function runSetup(options) {
|
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
case 'maxActivePRs': {
|
|
69
|
-
const maxPRs =
|
|
69
|
+
const maxPRs = parseNonNegativeInt(value, 'maxActivePRs');
|
|
70
70
|
stateManager.updateConfig({ maxActivePRs: maxPRs });
|
|
71
71
|
results[key] = String(maxPRs);
|
|
72
72
|
break;
|
|
@@ -27,9 +27,9 @@ export const CONFIG_KEY_REGISTRY = [
|
|
|
27
27
|
// ── Capacity / dormancy ──────────────────────────────────────────────
|
|
28
28
|
{
|
|
29
29
|
key: 'maxActivePRs',
|
|
30
|
-
description: 'Soft cap on how many active PRs you want to juggle at once.',
|
|
30
|
+
description: 'Soft cap on how many active PRs you want to juggle at once. 0 disables the cap.',
|
|
31
31
|
settableVia: 'setup',
|
|
32
|
-
valueHint: '
|
|
32
|
+
valueHint: 'non-negative integer (0 = no limit)',
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
key: 'dormantDays',
|
package/dist/core/daily-logic.js
CHANGED
|
@@ -232,15 +232,19 @@ export function computeRepoSignals(prs) {
|
|
|
232
232
|
export function assessCapacity(activePRs, maxActivePRs, shelvedPRCount) {
|
|
233
233
|
const activePRCount = activePRs.length;
|
|
234
234
|
const criticalIssueCount = activePRs.filter((pr) => pr.status === 'needs_addressing' && pr.actionReason && CRITICAL_ACTION_REASONS.has(pr.actionReason)).length;
|
|
235
|
-
// Has capacity if: under PR limit AND no critical issues
|
|
236
|
-
const
|
|
235
|
+
// Has capacity if: under PR limit AND no critical issues. A limit of 0 means no limit.
|
|
236
|
+
const unlimited = maxActivePRs <= 0;
|
|
237
|
+
const underPRLimit = unlimited || activePRCount < maxActivePRs;
|
|
237
238
|
const noCriticalIssues = criticalIssueCount === 0;
|
|
238
239
|
const hasCapacity = underPRLimit && noCriticalIssues;
|
|
239
240
|
// Generate reason
|
|
240
241
|
let reason;
|
|
241
242
|
const shelvedNote = shelvedPRCount > 0 ? ` + ${shelvedPRCount} shelved` : '';
|
|
243
|
+
const countLabel = unlimited
|
|
244
|
+
? `${activePRCount} active PRs (no limit)`
|
|
245
|
+
: `${activePRCount}/${maxActivePRs} active PRs`;
|
|
242
246
|
if (hasCapacity) {
|
|
243
|
-
reason = `You have capacity: ${
|
|
247
|
+
reason = `You have capacity: ${countLabel}${shelvedNote}, no critical issues`;
|
|
244
248
|
}
|
|
245
249
|
else {
|
|
246
250
|
const reasons = [];
|
|
@@ -437,7 +441,7 @@ export function computeActionMenu(actionableIssues, capacity, commentedIssues =
|
|
|
437
441
|
description: 'Look for new contribution opportunities',
|
|
438
442
|
};
|
|
439
443
|
if (!capacity.hasCapacity) {
|
|
440
|
-
const atLimit = capacity.activePRCount >= capacity.maxActivePRs;
|
|
444
|
+
const atLimit = capacity.maxActivePRs > 0 && capacity.activePRCount >= capacity.maxActivePRs;
|
|
441
445
|
const hasCritical = capacity.criticalIssueCount > 0;
|
|
442
446
|
if (atLimit && hasCritical) {
|
|
443
447
|
searchItem.capacityWarning = `You're at ${capacity.activePRCount}/${capacity.maxActivePRs} active PRs and have ${capacity.criticalIssueCount} critical issue(s). Resolve existing work before claiming new issues.`;
|