desktop AI fix: a claude CLI without a sign-in ("Not logged in · Please run /login", seen in a real headless run) shows 'not signed in' with the copy-for-AI fallback instead of a bare failure; the flags were checked against a real claude run (it edited the file)
This commit is contained in:
parent
c95f2af8ff
commit
5ed787a8ca
4 changed files with 19 additions and 1 deletions
|
|
@ -90,7 +90,9 @@ export function AiFix({ projectId, f, claude, busy, setBusy, rescan, stillThere,
|
|||
);
|
||||
else if (p.kind === 'done') {
|
||||
const o = p.run.outcome;
|
||||
const head = o.cancelled ? t('ai.cancelled') : o.timed_out ? t('ai.timedOut') : !p.run.changes.length ? t('ai.noChanges') : t('ai.changed', { count: p.run.changes.length });
|
||||
// a claude CLI that is not signed in answers at once ("Not logged in · Please run /login"): say so, offer the copy
|
||||
const signedOut = !p.run.changes.length && signedOutText(o.summary);
|
||||
const head = o.cancelled ? t('ai.cancelled') : o.timed_out ? t('ai.timedOut') : signedOut ? t('ai.signedOut') : !p.run.changes.length ? t('ai.noChanges') : t('ai.changed', { count: p.run.changes.length });
|
||||
panel = (
|
||||
<div className="ai-panel" role="status">
|
||||
<span className="li-sub">{head}{p.run.changes.length > 0 && !p.undone ? ` · ${stillThere ? t('ai.stillThere') : t('ai.gone')}` : ''}</span>
|
||||
|
|
@ -100,6 +102,7 @@ export function AiFix({ projectId, f, claude, busy, setBusy, rescan, stillThere,
|
|||
<div className="row">
|
||||
{p.run.changes.length > 0 && <button className="btn btn-sm btn-primary" onClick={() => setP({ kind: 'idle' })}><Icon name="check" />{t('ai.keep')}</button>}
|
||||
{p.run.changes.length > 0 && <button className="btn btn-sm" onClick={() => undo(p.run)}><Icon name="rotate" />{t('ai.undo')}</button>}
|
||||
{signedOut && <button className="btn btn-sm" onClick={copy}><Icon name="copy" />{t('ai.copy')}</button>}
|
||||
{!p.run.changes.length && <button className="btn btn-sm" onClick={() => setP({ kind: 'idle' })}>{t('common.close')}</button>}
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -113,3 +116,6 @@ export function AiFix({ projectId, f, claude, busy, setBusy, rescan, stillThere,
|
|||
);
|
||||
return <>{p.kind === 'idle' || p.kind === 'running' ? <div className="ai-actions">{button}</div> : null}{panel}</>;
|
||||
}
|
||||
|
||||
/** The claude CLI's answer when it has no sign-in (it exits at once, nothing changed). */
|
||||
export const signedOutText = (s: string): boolean => /not logged in|please run \/login|invalid api key|authentication/i.test(s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue