feat(plugin): enhanced diagnostic — git/PATH/vault path on install failure

This commit is contained in:
Research Assistant 2026-05-11 17:51:14 +08:00
parent c81f892625
commit 0376fdb512

View file

@ -3109,12 +3109,23 @@ class PaperForgeSetupModal extends Modal {
const pyInfo = this.plugin?.settings?.python_path || 'auto';
const pluginVer = this.plugin?.manifest?.version || '?';
const osInfo = process.platform + ' ' + process.arch;
let gitDir, resolvedPy;
try { gitDir = resolveGitDir() || '(not found)'; } catch (_) { gitDir = '(error)'; }
try { resolvedPy = resolvePythonExecutable(s.vault_path.trim(), this.plugin.settings); } catch (_) { resolvedPy = null; }
const pathLen = (process.env.PATH || '').length;
const pathHasGit = (process.env.PATH || '').toLowerCase().includes('git');
const diagnostic = [
'[PaperForge Diagnostic]',
'Category: ' + errorMsg,
'Plugin version: ' + pluginVer,
'Python: ' + pyInfo,
'Resolved Python: ' + (resolvedPy?.path || '?'),
'OS: ' + osInfo,
'Vault path: ' + (s.vault_path || '?'),
'--- Git ---',
'Git dir (resolved): ' + gitDir,
'PATH length: ' + pathLen + ' chars',
'PATH contains git: ' + pathHasGit,
'--- Raw error ---',
rawError.slice(0, 2000),
].join('\n');