@oss-autopilot/core 3.19.1 → 3.19.3
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.
|
@@ -17,9 +17,24 @@ export interface IssueListLocation {
|
|
|
17
17
|
path: string;
|
|
18
18
|
source: 'configured' | 'auto-detected';
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Persist an absolute list/skip path back to state config, but only when it
|
|
22
|
+
* differs from what's stored (avoid an autoSave on every run). Upgrading a
|
|
23
|
+
* relative/auto-detected value to absolute makes the location stick across
|
|
24
|
+
* working directories, so `/oss` invoked from anywhere keeps finding the list
|
|
25
|
+
* and skip file instead of silently no-opping the vet/skip/list-maintenance
|
|
26
|
+
* flow (#1577). Shared by the list detection here and the skip-path resolution
|
|
27
|
+
* in startup.ts.
|
|
28
|
+
*/
|
|
29
|
+
export declare function persistConfigPath(key: 'issueListPath' | 'skippedIssuesPath', absolutePath: string): void;
|
|
20
30
|
/**
|
|
21
31
|
* Locate the curated issue-list file: state config first, then the legacy
|
|
22
32
|
* config.md frontmatter, then known default paths. Returns undefined when
|
|
23
33
|
* no list exists — callers treat that as "user has no curated list".
|
|
34
|
+
*
|
|
35
|
+
* All returned paths are ABSOLUTE (#1577): a relative configured value or a
|
|
36
|
+
* known-path probe is resolved against CWD once, then persisted, so the vet →
|
|
37
|
+
* skip → list-maintenance flow no longer depends on `/oss` running from the
|
|
38
|
+
* list's parent directory.
|
|
24
39
|
*/
|
|
25
40
|
export declare function detectIssueListPath(): IssueListLocation | undefined;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* counts / skipped-issues detection on top of `detectIssueListPath`.
|
|
9
9
|
*/
|
|
10
10
|
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
11
12
|
import { getStateManager } from '../core/index.js';
|
|
12
13
|
import { errorMessage } from '../core/errors.js';
|
|
13
14
|
import { warn } from '../core/logger.js';
|
|
@@ -24,18 +25,62 @@ export function parseIssueListPathFromConfig(configContent) {
|
|
|
24
25
|
const pathMatch = frontmatter.match(/issueListPath:\s*["']?([^"'\n]+)["']?/);
|
|
25
26
|
return pathMatch ? pathMatch[1].trim() : undefined;
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Persist an absolute list/skip path back to state config, but only when it
|
|
30
|
+
* differs from what's stored (avoid an autoSave on every run). Upgrading a
|
|
31
|
+
* relative/auto-detected value to absolute makes the location stick across
|
|
32
|
+
* working directories, so `/oss` invoked from anywhere keeps finding the list
|
|
33
|
+
* and skip file instead of silently no-opping the vet/skip/list-maintenance
|
|
34
|
+
* flow (#1577). Shared by the list detection here and the skip-path resolution
|
|
35
|
+
* in startup.ts.
|
|
36
|
+
*/
|
|
37
|
+
export function persistConfigPath(key, absolutePath) {
|
|
38
|
+
try {
|
|
39
|
+
const stateManager = getStateManager();
|
|
40
|
+
if (stateManager.getState().config[key] !== absolutePath) {
|
|
41
|
+
stateManager.updateConfig({ [key]: absolutePath });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
// Best-effort — the current run still uses the resolved path; the next run
|
|
46
|
+
// just re-detects. Log so the failure is debuggable.
|
|
47
|
+
warn('startup', `Could not persist absolute ${key}: ${errorMessage(error)}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
27
50
|
/**
|
|
28
51
|
* Locate the curated issue-list file: state config first, then the legacy
|
|
29
52
|
* config.md frontmatter, then known default paths. Returns undefined when
|
|
30
53
|
* no list exists — callers treat that as "user has no curated list".
|
|
54
|
+
*
|
|
55
|
+
* All returned paths are ABSOLUTE (#1577): a relative configured value or a
|
|
56
|
+
* known-path probe is resolved against CWD once, then persisted, so the vet →
|
|
57
|
+
* skip → list-maintenance flow no longer depends on `/oss` running from the
|
|
58
|
+
* list's parent directory.
|
|
31
59
|
*/
|
|
32
60
|
export function detectIssueListPath() {
|
|
61
|
+
// When a configured path exists but its file is missing at resolve-time, a
|
|
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;
|
|
33
65
|
// 1. Check state.json config (primary)
|
|
34
66
|
try {
|
|
35
67
|
const stateManager = getStateManager();
|
|
36
68
|
const configuredPath = stateManager.getState().config.issueListPath;
|
|
37
|
-
if (configuredPath
|
|
38
|
-
|
|
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.`);
|
|
39
84
|
}
|
|
40
85
|
}
|
|
41
86
|
catch (error) {
|
|
@@ -48,19 +93,33 @@ export function detectIssueListPath() {
|
|
|
48
93
|
try {
|
|
49
94
|
const configContent = fs.readFileSync(configPath, 'utf8');
|
|
50
95
|
const configuredPath = parseIssueListPathFromConfig(configContent);
|
|
51
|
-
if (configuredPath
|
|
52
|
-
|
|
96
|
+
if (configuredPath) {
|
|
97
|
+
const resolved = path.resolve(configuredPath);
|
|
98
|
+
if (fs.existsSync(resolved)) {
|
|
99
|
+
return { path: resolved, source: 'configured' };
|
|
100
|
+
}
|
|
53
101
|
}
|
|
54
102
|
}
|
|
55
103
|
catch (error) {
|
|
56
104
|
console.error('[STARTUP] Failed to read config:', errorMessage(error));
|
|
57
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).
|
|
58
109
|
}
|
|
59
|
-
// 3. Probe known paths
|
|
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.
|
|
60
116
|
const probes = ['open-source/potential-issue-list.md', 'oss/issue-list.md', 'issues.md'];
|
|
61
117
|
for (const probe of probes) {
|
|
62
118
|
if (fs.existsSync(probe)) {
|
|
63
|
-
|
|
119
|
+
const resolved = path.resolve(probe);
|
|
120
|
+
if (!configuredButMissing)
|
|
121
|
+
persistConfigPath('issueListPath', resolved);
|
|
122
|
+
return { path: resolved, source: 'auto-detected' };
|
|
64
123
|
}
|
|
65
124
|
}
|
|
66
125
|
return undefined;
|
package/dist/commands/startup.js
CHANGED
|
@@ -16,7 +16,7 @@ import { executeDailyCheck } from './daily.js';
|
|
|
16
16
|
import { launchDashboardServer } from './dashboard-lifecycle.js';
|
|
17
17
|
import { recordBrowserOpened } from './dashboard-process.js';
|
|
18
18
|
import { parseIssueList } from './parse-list.js';
|
|
19
|
-
import { detectIssueListPath } from './locate-issue-list.js';
|
|
19
|
+
import { detectIssueListPath, persistConfigPath } from './locate-issue-list.js';
|
|
20
20
|
// Path detection moved to locate-issue-list.ts (#1463) so the daily
|
|
21
21
|
// merge-loop can use it without an import cycle through this module.
|
|
22
22
|
// Re-exported here for back-compat with existing consumers/tests.
|
|
@@ -61,12 +61,25 @@ export function detectIssueList() {
|
|
|
61
61
|
}
|
|
62
62
|
// 5. Detect skipped issues file
|
|
63
63
|
let skippedIssuesPath;
|
|
64
|
-
// Check config first
|
|
64
|
+
// Check config first. A relative skippedIssuesPath is anchored to the issue
|
|
65
|
+
// list's (now absolute) directory — a stable base — not CWD, and upgraded to
|
|
66
|
+
// absolute in config so the skip list isn't silently dropped when /oss runs
|
|
67
|
+
// from a different directory (#1577). Anchoring to the list dir (rather than
|
|
68
|
+
// CWD) avoids baking in a coincidentally-named skipped-issues.md from an
|
|
69
|
+
// unrelated working directory. A multi-segment relative that doesn't resolve
|
|
70
|
+
// here safely falls through to the list-dir default probe below.
|
|
65
71
|
try {
|
|
66
72
|
const stateManager = getStateManager();
|
|
67
73
|
const configuredSkipPath = stateManager.getState().config.skippedIssuesPath;
|
|
68
|
-
if (configuredSkipPath
|
|
69
|
-
|
|
74
|
+
if (configuredSkipPath) {
|
|
75
|
+
const resolvedSkip = path.isAbsolute(configuredSkipPath)
|
|
76
|
+
? configuredSkipPath
|
|
77
|
+
: path.resolve(path.dirname(issueListPath), configuredSkipPath);
|
|
78
|
+
if (fs.existsSync(resolvedSkip)) {
|
|
79
|
+
skippedIssuesPath = resolvedSkip;
|
|
80
|
+
if (resolvedSkip !== configuredSkipPath)
|
|
81
|
+
persistConfigPath('skippedIssuesPath', resolvedSkip);
|
|
82
|
+
}
|
|
70
83
|
}
|
|
71
84
|
}
|
|
72
85
|
catch (err) {
|