@oss-autopilot/core 3.42.5 → 3.43.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 +272 -25
- package/dist/cli.bundle.cjs +183 -154
- package/dist/commands/check-integration.js +1 -0
- package/dist/commands/cleanup.d.ts +76 -0
- package/dist/commands/cleanup.js +269 -0
- package/dist/commands/comments.d.ts +6 -0
- package/dist/commands/comments.js +6 -2
- package/dist/commands/config.js +37 -5
- 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 +122 -0
- package/dist/commands/daily-ledger.js +225 -0
- package/dist/commands/daily-recent-prs.d.ts +26 -0
- package/dist/commands/daily-recent-prs.js +55 -0
- package/dist/commands/daily.d.ts +2 -1
- package/dist/commands/daily.js +59 -89
- package/dist/commands/dashboard-cache.d.ts +2 -0
- package/dist/commands/dashboard-cache.js +33 -8
- package/dist/commands/dashboard-data.js +71 -36
- package/dist/commands/dashboard-gist-sync.js +3 -1
- package/dist/commands/dashboard-lifecycle.js +1 -1
- package/dist/commands/dashboard-process.d.ts +14 -1
- package/dist/commands/dashboard-process.js +46 -7
- package/dist/commands/dashboard-server.js +89 -23
- package/dist/commands/detect-formatters.js +1 -0
- package/dist/commands/dismiss.js +5 -2
- package/dist/commands/doctor.d.ts +15 -1
- package/dist/commands/doctor.js +73 -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/guidelines.d.ts +23 -1
- package/dist/commands/guidelines.js +49 -4
- package/dist/commands/index.d.ts +24 -4
- package/dist/commands/index.js +15 -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 +13 -8
- package/dist/commands/overnight-push-prep.js +106 -34
- 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 +86 -0
- package/dist/commands/policy.js +263 -0
- package/dist/commands/pr-preflight.d.ts +43 -0
- package/dist/commands/pr-preflight.js +294 -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 +46 -18
- package/dist/commands/skip-add.js +10 -1
- package/dist/commands/startup.d.ts +5 -3
- package/dist/commands/startup.js +65 -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 +1 -0
- package/dist/commands/strategy.js +1 -0
- package/dist/commands/vet-list.d.ts +6 -0
- package/dist/commands/vet-list.js +25 -0
- package/dist/commands/vet.d.ts +12 -0
- package/dist/commands/vet.js +118 -1
- 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 +19 -0
- package/dist/core/commit-date.js +17 -0
- package/dist/core/config-registry.js +11 -5
- package/dist/core/contributing.d.ts +2 -3
- package/dist/core/contributing.js +2 -3
- package/dist/core/daily-logic.d.ts +27 -5
- package/dist/core/daily-logic.js +57 -19
- package/dist/core/errors.d.ts +37 -3
- package/dist/core/errors.js +54 -5
- 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 +97 -46
- package/dist/core/github-stats.d.ts +104 -16
- package/dist/core/github-stats.js +282 -97
- package/dist/core/http-cache.d.ts +0 -10
- package/dist/core/http-cache.js +0 -19
- package/dist/core/index.d.ts +12 -5
- package/dist/core/index.js +15 -5
- 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 +271 -0
- package/dist/core/merged-pr-notes.d.ts +2 -2
- 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.js +6 -2
- package/dist/core/pr-graphql.d.ts +37 -3
- package/dist/core/pr-graphql.js +73 -12
- package/dist/core/pr-monitor.d.ts +29 -12
- package/dist/core/pr-monitor.js +71 -23
- package/dist/core/pr-preflight.d.ts +113 -0
- package/dist/core/pr-preflight.js +364 -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/repo-policy.d.ts +105 -0
- package/dist/core/repo-policy.js +400 -0
- package/dist/core/repo-score-manager.d.ts +48 -0
- package/dist/core/repo-score-manager.js +111 -1
- package/dist/core/review-analysis.d.ts +34 -19
- package/dist/core/review-analysis.js +67 -10
- package/dist/core/reviewed-prs-fetch.js +11 -29
- package/dist/core/reviewed-prs.js +8 -15
- package/dist/core/stale-data.d.ts +41 -0
- package/dist/core/stale-data.js +115 -0
- package/dist/core/state-persistence.d.ts +62 -27
- package/dist/core/state-persistence.js +338 -117
- package/dist/core/state-schema.d.ts +113 -210
- package/dist/core/state-schema.js +165 -80
- package/dist/core/state.d.ts +60 -8
- package/dist/core/state.js +192 -46
- package/dist/core/status-determination.js +26 -8
- 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 +77 -42
- package/dist/core/urls.d.ts +9 -0
- package/dist/core/urls.js +18 -0
- package/dist/dashboard/assets/{chart-panel-DPKNBUts.js → chart-panel-C_C1lFTI.js} +1 -1
- package/dist/dashboard/assets/{index-B25bZOYX.js → index-B--H66Jk.js} +1 -1
- package/dist/dashboard/index.html +1 -1
- package/dist/formatters/json.d.ts +262 -6
- package/dist/formatters/json.js +77 -1
- package/package.json +1 -1
- 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
|
@@ -3,31 +3,36 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extracted from `startup.ts` so the daily merge-loop reconciliation can
|
|
5
5
|
* locate the list without importing `startup.ts` — that would close an
|
|
6
|
-
* import cycle (startup → daily → merge-loop → startup). `startup.ts`
|
|
7
|
-
*
|
|
8
|
-
* counts / skipped-issues detection on top of `detectIssueListPath`.
|
|
6
|
+
* import cycle (startup → daily → merge-loop → startup). `startup.ts` layers
|
|
7
|
+
* item counts / skipped-issues detection on top of `detectIssueListPath`.
|
|
9
8
|
*/
|
|
9
|
+
import { execFileSync } from 'node:child_process';
|
|
10
10
|
import * as fs from 'node:fs';
|
|
11
11
|
import * as path from 'node:path';
|
|
12
12
|
import { getStateManager } from '../core/index.js';
|
|
13
|
-
import { errorMessage } from '../core/errors.js';
|
|
13
|
+
import { UNATTENDED_ENV, ValidationError, errorMessage } from '../core/errors.js';
|
|
14
|
+
import { isOwnRepo } from '../core/urls.js';
|
|
15
|
+
import { getMachinePath, getMachinePathSource, setMachinePath } from '../core/local-config.js';
|
|
14
16
|
import { warn } from '../core/logger.js';
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
18
|
+
* The issue list this machine is configured to use, for commands whose
|
|
19
|
+
* `--list-path` is optional. Workflows call those commands without the flag
|
|
20
|
+
* so a stored path is never pasted into shell text. Resolved by
|
|
21
|
+
* {@link detectIssueListPath}: configured lists only, with its checks; never
|
|
22
|
+
* a file found in the current directory.
|
|
19
23
|
*/
|
|
20
|
-
export function
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
24
|
+
export function configuredIssueListPath() {
|
|
25
|
+
const location = detectIssueListPath();
|
|
26
|
+
if (!location) {
|
|
27
|
+
throw new ValidationError('No usable issue list is configured: none is set, or the configured path is relative, missing, or in a ' +
|
|
28
|
+
'checkout that is not yours. Set one via `oss-autopilot setup --set issueListPath=<absolute path>` or pass --list-path.');
|
|
29
|
+
}
|
|
30
|
+
return location.path;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
|
-
* Persist an absolute list/skip path
|
|
30
|
-
*
|
|
33
|
+
* Persist an absolute list/skip path for this machine (the local settings
|
|
34
|
+
* file, never the synced config: #1950), but only when it differs from the
|
|
35
|
+
* value in effect (avoid a write on every run). Upgrading a
|
|
31
36
|
* relative/auto-detected value to absolute makes the location stick across
|
|
32
37
|
* working directories, so `/oss` invoked from anywhere keeps finding the list
|
|
33
38
|
* and skip file instead of silently no-opping the vet/skip/list-maintenance
|
|
@@ -36,10 +41,13 @@ export function parseIssueListPathFromConfig(configContent) {
|
|
|
36
41
|
*/
|
|
37
42
|
export function persistConfigPath(key, absolutePath) {
|
|
38
43
|
try {
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
const { config } = getStateManager().getState();
|
|
45
|
+
if (getMachinePath(key, config) === absolutePath)
|
|
46
|
+
return;
|
|
47
|
+
// A configured value made absolute keeps the source it had; one that
|
|
48
|
+
// came from the synced config counts as adopted.
|
|
49
|
+
const current = getMachinePathSource(key, config);
|
|
50
|
+
setMachinePath(key, absolutePath, current === undefined || current === 'synced' ? 'adopted' : current);
|
|
43
51
|
}
|
|
44
52
|
catch (error) {
|
|
45
53
|
// Best-effort — the current run still uses the resolved path; the next run
|
|
@@ -47,80 +55,132 @@ export function persistConfigPath(key, absolutePath) {
|
|
|
47
55
|
warn('startup', `Could not persist absolute ${key}: ${errorMessage(error)}`);
|
|
48
56
|
}
|
|
49
57
|
}
|
|
58
|
+
const SET_HINT = 'run `setup --set issueListPath=<absolute path>` to use it';
|
|
59
|
+
/** The issue-list setting in effect, before any check on the file. */
|
|
60
|
+
function configuredIssueList(isQuiet = false) {
|
|
61
|
+
const { config } = getStateManager().getState();
|
|
62
|
+
const value = getMachinePath('issueListPath', config);
|
|
63
|
+
const source = getMachinePathSource('issueListPath', config);
|
|
64
|
+
// A `probe` record was saved without the user confirming it (a build
|
|
65
|
+
// between #1950 and #1933 did that). The synced value, if any, applies.
|
|
66
|
+
if (source === 'probe') {
|
|
67
|
+
if (!isQuiet)
|
|
68
|
+
warn('startup', `issueListPath ${value} was auto-detected and never confirmed; ${SET_HINT}`);
|
|
69
|
+
return config.issueListPath ? { value: config.issueListPath, source: 'synced' } : undefined;
|
|
70
|
+
}
|
|
71
|
+
return value && source ? { value, source } : undefined;
|
|
72
|
+
}
|
|
50
73
|
/**
|
|
51
|
-
* Locate the curated issue-list file
|
|
52
|
-
*
|
|
53
|
-
*
|
|
74
|
+
* Locate the curated issue-list file this machine is configured to use.
|
|
75
|
+
* Returns undefined when none is configured, or the configured value is
|
|
76
|
+
* relative, missing, or (unless the user set it on this machine) inside
|
|
77
|
+
* someone else's checkout. Callers treat that as "no curated list". A file
|
|
78
|
+
* found in the current directory is never returned here: see
|
|
79
|
+
* {@link suggestIssueListPath} (#1933).
|
|
54
80
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* skip → list-maintenance flow no longer depends on `/oss` running from the
|
|
58
|
-
* list's parent directory.
|
|
81
|
+
* @param isForeign - The foreign-checkout check; the long-running dashboard
|
|
82
|
+
* passes a memoized one so polling does not run Git per request (#2012).
|
|
59
83
|
*/
|
|
60
|
-
export function detectIssueListPath() {
|
|
61
|
-
|
|
62
|
-
// coincidental probe hit below must NOT overwrite the user's configured value
|
|
63
|
-
// in state — it's likely just absent from the current CWD, not wrong.
|
|
64
|
-
let configuredButMissing = false;
|
|
65
|
-
// 1. Check state.json config (primary)
|
|
84
|
+
export function detectIssueListPath(isForeign = isForeignCheckout) {
|
|
85
|
+
let configured;
|
|
66
86
|
try {
|
|
67
|
-
|
|
68
|
-
const configuredPath = stateManager.getState().config.issueListPath;
|
|
69
|
-
if (configuredPath) {
|
|
70
|
-
// Resolve a relative configured value against CWD to an absolute path so
|
|
71
|
-
// the location is stable no matter where `/oss` runs (#1577).
|
|
72
|
-
const resolved = path.resolve(configuredPath);
|
|
73
|
-
if (fs.existsSync(resolved)) {
|
|
74
|
-
if (resolved !== configuredPath)
|
|
75
|
-
persistConfigPath('issueListPath', resolved);
|
|
76
|
-
return { path: resolved, source: 'configured' };
|
|
77
|
-
}
|
|
78
|
-
// A path WAS configured but nothing is there. Surface it prominently
|
|
79
|
-
// instead of silently degrading to probes/undefined (#1577): a large
|
|
80
|
-
// configured list being ignored is otherwise easy to miss.
|
|
81
|
-
configuredButMissing = true;
|
|
82
|
-
warn('startup', `Configured issueListPath not found at ${resolved} (cwd ${process.cwd()}); ` +
|
|
83
|
-
`falling back to auto-detection. Set an absolute issueListPath, or run from its directory.`);
|
|
84
|
-
}
|
|
87
|
+
configured = configuredIssueList();
|
|
85
88
|
}
|
|
86
89
|
catch (error) {
|
|
87
|
-
// State manager may not be initialized yet — fall through to legacy config.md
|
|
88
90
|
warn('startup', `Could not read issueListPath from state: ${errorMessage(error)}`);
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
if (!configured)
|
|
94
|
+
return undefined;
|
|
95
|
+
const { value, source } = configured;
|
|
96
|
+
// Resolving a relative value against the current directory would pick up
|
|
97
|
+
// whatever file is there (#1933); setup and config store absolute paths.
|
|
98
|
+
if (!path.isAbsolute(value)) {
|
|
99
|
+
warn('startup', `Ignoring relative issueListPath ${value}; ${SET_HINT}`);
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
if (!fs.existsSync(value)) {
|
|
103
|
+
warn('startup', `Configured issueListPath not found at ${value}.`);
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
// A value the user did not set here (synced, adopted) is checked like a
|
|
107
|
+
// probe hit: it may point into a checkout that is not theirs.
|
|
108
|
+
if (source !== 'set' && isForeign(path.dirname(value))) {
|
|
109
|
+
warn('startup', `Ignoring issueListPath ${value}: its checkout has a remote not owned by you; ${SET_HINT}`);
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
return { path: value, source: 'configured' };
|
|
113
|
+
}
|
|
114
|
+
/** The owner segment of a remote URL on any host (`https://h/o/r`, `ssh://u@h:22/o/r`, `u@h:o/r`). */
|
|
115
|
+
function remoteOwner(url) {
|
|
116
|
+
return (/^[a-z][\w+.-]*:\/\/[^/]+\/([^/]+)\//i.exec(url) ?? /^(?:[^@/]+@)?[^/:]+:([^/]+)\//.exec(url))?.[1];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* True when `dir` is inside a Git checkout that has a remote not owned by
|
|
120
|
+
* the configured user (owner path segment, any host, case-insensitive). A
|
|
121
|
+
* fork clone with an `upstream` remote is foreign, and so is a checkout with
|
|
122
|
+
* no remotes or one Git refuses to read. Only Git reporting "not a git
|
|
123
|
+
* repository" means not a checkout (false); a timeout, a spawn failure (no
|
|
124
|
+
* Git) or any other error fails closed as foreign. Reads local Git config
|
|
125
|
+
* only; no network.
|
|
126
|
+
*/
|
|
127
|
+
export function isForeignCheckout(dir) {
|
|
128
|
+
const git = (...args) => execFileSync('git', ['-C', dir, ...args], { encoding: 'utf8', timeout: 5000, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
129
|
+
try {
|
|
130
|
+
if (git('rev-parse', '--is-inside-work-tree').trim() !== 'true')
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
// Fail closed: a timeout or spawn failure (code/signal set), "dubious
|
|
135
|
+
// ownership" (a checkout Git will not read) or any other Git error is
|
|
136
|
+
// foreign. Only a plain "not a git repository" exit is not a checkout.
|
|
137
|
+
const { code, signal, stderr } = error;
|
|
138
|
+
return Boolean(code || signal) || !/not a git repository/.test(String(stderr));
|
|
139
|
+
}
|
|
140
|
+
let username = '';
|
|
141
|
+
let urls;
|
|
142
|
+
try {
|
|
143
|
+
username = getStateManager().getState().config.githubUsername;
|
|
144
|
+
urls = git('config', '--get-regexp', String.raw `^remote\..*\.url$`)
|
|
145
|
+
.trim()
|
|
146
|
+
.split('\n')
|
|
147
|
+
.map((line) => line.slice(line.indexOf(' ') + 1));
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return true; // no remotes, or git failed inside a checkout
|
|
151
|
+
}
|
|
152
|
+
return !username || urls.some((url) => !isOwnRepo(remoteOwner(url) ?? '', username));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* A curated list found at a known path under the current directory, offered
|
|
156
|
+
* for the user to confirm (#1933). Nothing is saved: the prompt layer asks,
|
|
157
|
+
* and a yes is stored with `setup --set issueListPath=<path>`. Until then the
|
|
158
|
+
* file is not used as the list. Offered only when no list is configured, the
|
|
159
|
+
* run is attended, the path has no shell metacharacters, and the current
|
|
160
|
+
* directory is not someone else's checkout (a repository can ship an
|
|
161
|
+
* `issues.md`).
|
|
162
|
+
*/
|
|
163
|
+
export function suggestIssueListPath() {
|
|
164
|
+
if (process.env[UNATTENDED_ENV] !== undefined)
|
|
165
|
+
return undefined;
|
|
166
|
+
try {
|
|
167
|
+
if (configuredIssueList(true))
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
warn('startup', `Could not read issueListPath from state: ${errorMessage(error)}`);
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
const probe = ['open-source/potential-issue-list.md', 'oss/issue-list.md', 'issues.md'].find((p) => fs.existsSync(p));
|
|
175
|
+
if (!probe)
|
|
176
|
+
return undefined;
|
|
177
|
+
const found = path.resolve(probe);
|
|
178
|
+
// The path goes into a quoted shell command in the prompt layer.
|
|
179
|
+
if (/["$\\`\p{Cc}]/u.test(found))
|
|
180
|
+
return undefined;
|
|
181
|
+
if (isForeignCheckout(process.cwd())) {
|
|
182
|
+
warn('startup', `Found ${found}, not offered because this checkout has a remote not owned by you; ${SET_HINT}`);
|
|
183
|
+
return undefined;
|
|
89
184
|
}
|
|
90
|
-
|
|
91
|
-
const configPath = '.claude/oss-autopilot/config.md';
|
|
92
|
-
if (fs.existsSync(configPath)) {
|
|
93
|
-
try {
|
|
94
|
-
const configContent = fs.readFileSync(configPath, 'utf8');
|
|
95
|
-
const configuredPath = parseIssueListPathFromConfig(configContent);
|
|
96
|
-
if (configuredPath) {
|
|
97
|
-
const resolved = path.resolve(configuredPath);
|
|
98
|
-
if (fs.existsSync(resolved)) {
|
|
99
|
-
return { path: resolved, source: 'configured' };
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
console.error('[STARTUP] Failed to read config:', errorMessage(error));
|
|
105
|
-
}
|
|
106
|
-
// Legacy config.md missing-file case is intentionally not warned/persisted:
|
|
107
|
-
// this branch is slated for removal, and step 1 already covers the primary
|
|
108
|
-
// (state.json) configured path (#1577).
|
|
109
|
-
}
|
|
110
|
-
// 3. Probe known paths. Return the ABSOLUTE path and persist it so the first
|
|
111
|
-
// successful detection sticks from any working directory afterwards (#1577).
|
|
112
|
-
// But NOT when a path was configured-but-missing: the probe hit is likely
|
|
113
|
-
// just absent from the current CWD, so overwriting the user's deliberate
|
|
114
|
-
// config with a coincidental probe file would be the silent-wrong-target bug
|
|
115
|
-
// #1577 set out to kill.
|
|
116
|
-
const probes = ['open-source/potential-issue-list.md', 'oss/issue-list.md', 'issues.md'];
|
|
117
|
-
for (const probe of probes) {
|
|
118
|
-
if (fs.existsSync(probe)) {
|
|
119
|
-
const resolved = path.resolve(probe);
|
|
120
|
-
if (!configuredButMissing)
|
|
121
|
-
persistConfigPath('issueListPath', resolved);
|
|
122
|
-
return { path: resolved, source: 'auto-detected' };
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return undefined;
|
|
185
|
+
return { path: found, source: 'auto-detected' };
|
|
126
186
|
}
|
package/dist/commands/move.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* attention, waiting, shelved, or auto (reset to computed status).
|
|
4
4
|
*/
|
|
5
5
|
import { getStateManager, maybeCheckpoint } from '../core/index.js';
|
|
6
|
+
import { shelveReasonsOf } from '../core/daily-logic.js';
|
|
7
|
+
import { issueRefKey } from '../core/urls.js';
|
|
6
8
|
import { ValidationError } from '../core/errors.js';
|
|
7
9
|
import { PR_URL_PATTERN, validateGitHubUrl, validateUrl } from './validation.js';
|
|
8
10
|
const MODULE = 'move';
|
|
@@ -46,7 +48,11 @@ export async function runMove(options) {
|
|
|
46
48
|
}
|
|
47
49
|
case 'shelved': {
|
|
48
50
|
const apply = () => stateManager.batch(() => {
|
|
49
|
-
|
|
51
|
+
// Record why the PR needs addressing right now, when the last
|
|
52
|
+
// digest knows it, so only a reason it lacks now unshelves it (#1922).
|
|
53
|
+
const key = issueRefKey(options.prUrl);
|
|
54
|
+
const openPR = stateManager.getState().lastDigest?.openPRs.find((pr) => issueRefKey(pr.url) === key);
|
|
55
|
+
stateManager.shelvePR(options.prUrl, openPR && shelveReasonsOf(openPR));
|
|
50
56
|
stateManager.clearStatusOverride(options.prUrl);
|
|
51
57
|
});
|
|
52
58
|
apply();
|
|
@@ -47,13 +47,23 @@ export declare function loadHandoff(dir: string): {
|
|
|
47
47
|
record: OvernightRecord;
|
|
48
48
|
report: string | null;
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
* Fetch `branch` from its bundle into a fresh bare repo under a private temp
|
|
52
|
-
* dir. The bundle is copied through a checked descriptor first, so the tick
|
|
53
|
-
* cannot swap the file between the check and git reading it. The caller
|
|
54
|
-
* pushes from `repo` and must call `cleanup`.
|
|
55
|
-
*/
|
|
56
|
-
export declare function importHandoffBundle(dir: string, branch: string): {
|
|
50
|
+
type PrivateRepo = {
|
|
57
51
|
repo: string;
|
|
58
52
|
cleanup: () => void;
|
|
59
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* The handoff's bundle as a private repo. The bundle is copied through a
|
|
56
|
+
* checked descriptor first, so the tick cannot swap the file between the
|
|
57
|
+
* check and git reading it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function importHandoffBundle(dir: string, branch: string): PrivateRepo;
|
|
60
|
+
/**
|
|
61
|
+
* A worktree's branch as a private repo, for a box without the handoff
|
|
62
|
+
* (#1937). The push then never runs in the worktree, whose config the tick
|
|
63
|
+
* could have written (a credential helper, a pre-push hook, an SSH command).
|
|
64
|
+
* Where the push goes is the caller's business: a URL rewrite in the worktree
|
|
65
|
+
* can still change what its remote list shows. `worktree` must be an
|
|
66
|
+
* absolute path.
|
|
67
|
+
*/
|
|
68
|
+
export declare function importWorktreeBranch(worktree: string, branch: string): PrivateRepo;
|
|
69
|
+
export {};
|
|
@@ -176,23 +176,16 @@ export function loadHandoff(dir) {
|
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
* Fetch `branch`
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
179
|
+
* Fetch `branch` into a fresh bare repo under a private temp dir, from the
|
|
180
|
+
* source `prepare` returns (it may put files in that dir first). The caller
|
|
181
|
+
* pushes from `repo` and must call `cleanup`. Nothing the tick wrote is the
|
|
182
|
+
* repository Git runs in: no config, hook or alias of its making is read.
|
|
183
183
|
*/
|
|
184
|
-
|
|
184
|
+
function importBranch(branch, prepare) {
|
|
185
185
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'oss-push-prep-'));
|
|
186
186
|
const cleanup = () => fs.rmSync(tmp, { recursive: true, force: true });
|
|
187
187
|
try {
|
|
188
|
-
const
|
|
189
|
-
const out = fs.openSync(copy, 'wx', 0o600);
|
|
190
|
-
try {
|
|
191
|
-
streamUntrusted(path.join(dir, bundleFileFor(branch)), MAX_BUNDLE_BYTES, (c) => fs.writeSync(out, c));
|
|
192
|
-
}
|
|
193
|
-
finally {
|
|
194
|
-
fs.closeSync(out);
|
|
195
|
-
}
|
|
188
|
+
const source = prepare(tmp);
|
|
196
189
|
const repo = path.join(tmp, 'repo.git');
|
|
197
190
|
gitRun(['init', '-q', '--bare', repo]);
|
|
198
191
|
gitRun([
|
|
@@ -203,7 +196,7 @@ export function importHandoffBundle(dir, branch) {
|
|
|
203
196
|
'fetch',
|
|
204
197
|
'-q',
|
|
205
198
|
'--no-tags',
|
|
206
|
-
|
|
199
|
+
source,
|
|
207
200
|
`+refs/heads/${branch}:refs/heads/${branch}`,
|
|
208
201
|
]);
|
|
209
202
|
return { repo, cleanup };
|
|
@@ -213,3 +206,32 @@ export function importHandoffBundle(dir, branch) {
|
|
|
213
206
|
throw err;
|
|
214
207
|
}
|
|
215
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* The handoff's bundle as a private repo. The bundle is copied through a
|
|
211
|
+
* checked descriptor first, so the tick cannot swap the file between the
|
|
212
|
+
* check and git reading it.
|
|
213
|
+
*/
|
|
214
|
+
export function importHandoffBundle(dir, branch) {
|
|
215
|
+
return importBranch(branch, (tmp) => {
|
|
216
|
+
const copy = path.join(tmp, 'in.bundle');
|
|
217
|
+
const out = fs.openSync(copy, 'wx', 0o600);
|
|
218
|
+
try {
|
|
219
|
+
streamUntrusted(path.join(dir, bundleFileFor(branch)), MAX_BUNDLE_BYTES, (c) => fs.writeSync(out, c));
|
|
220
|
+
}
|
|
221
|
+
finally {
|
|
222
|
+
fs.closeSync(out);
|
|
223
|
+
}
|
|
224
|
+
return copy;
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* A worktree's branch as a private repo, for a box without the handoff
|
|
229
|
+
* (#1937). The push then never runs in the worktree, whose config the tick
|
|
230
|
+
* could have written (a credential helper, a pre-push hook, an SSH command).
|
|
231
|
+
* Where the push goes is the caller's business: a URL rewrite in the worktree
|
|
232
|
+
* can still change what its remote list shows. `worktree` must be an
|
|
233
|
+
* absolute path.
|
|
234
|
+
*/
|
|
235
|
+
export function importWorktreeBranch(worktree, branch) {
|
|
236
|
+
return importBranch(branch, () => worktree);
|
|
237
|
+
}
|
|
@@ -8,19 +8,22 @@
|
|
|
8
8
|
* thing in the overnight pipeline that pushes. Three gates, all enforced in
|
|
9
9
|
* code rather than by convention:
|
|
10
10
|
*
|
|
11
|
-
* 1. The push target is
|
|
12
|
-
*
|
|
13
|
-
* never trusted
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* 1. The push target is the repository GitHub names: the PR's head repo, or
|
|
12
|
+
* `<login>/<repo>` for an issue. The worktree must hold a remote whose
|
|
13
|
+
* parsed URL names that same repo; remote names are never trusted, and
|
|
14
|
+
* neither is the remote's URL, which the worktree's config can rewrite
|
|
15
|
+
* (#1937). The push goes to a URL built from GitHub's answer, keeping only
|
|
16
|
+
* that remote's transport (pickRemote).
|
|
17
|
+
* 2. That repo must be a fork (`GET /repos/{owner}/{repo}` says `fork: true`)
|
|
18
|
+
* of the PR's repo, so the user's own source repos never grow `prep/*`
|
|
19
|
+
* branches.
|
|
16
20
|
* 3. The ref is always `refs/heads/prep/<branch>` and never `--force`; a
|
|
17
21
|
* non-fast-forward is a skip with a reason.
|
|
18
22
|
*
|
|
19
23
|
* With `OSS_AUTOPILOT_HANDOFF_DIR` set the tick ran as another user, and the
|
|
20
24
|
* branches arrive as bundles (overnight-handoff.ts). Then there is no
|
|
21
|
-
* worktree
|
|
22
|
-
*
|
|
23
|
-
* and the push goes out of a private repo filled from the bundle.
|
|
25
|
+
* worktree, so no remote to compare. Either way the push goes out of a
|
|
26
|
+
* private repo, filled from the bundle or from the worktree's branch.
|
|
24
27
|
*/
|
|
25
28
|
/** The only ref namespace this command ever pushes to. */
|
|
26
29
|
export declare const PREP_REF_PREFIX = "refs/heads/prep/";
|
|
@@ -94,5 +97,7 @@ export declare function buildPrepRef(branch: string): string;
|
|
|
94
97
|
export declare function prepBranchName(ref: string): string;
|
|
95
98
|
/** Pure: `<fork>/compare/<pr-head>...prep/<branch>`. */
|
|
96
99
|
export declare function compareUrlFor(target: RemoteOwnerRepo, prHead: string, prepBranch: string): string;
|
|
100
|
+
/** Run `git -C <worktree> <args>` and return its stdout. Also the runner `cleanup` uses. */
|
|
101
|
+
export declare function git(worktree: string, args: string[], timeoutMs?: number): string;
|
|
97
102
|
/** Push every prepared branch of the latest overnight run to `prep/*` on the user's fork. */
|
|
98
103
|
export declare function runOvernightPushPrep(options: OvernightPushPrepOptions): Promise<OvernightPushPrepOutput>;
|