feat(FN-2406): persist dashboard auth token and harden TUI layout
- Persist dashboard auth token in global settings and add daemon-token utilities for reuse - Update dashboard CLI command auth precedence and token handling behavior - Harden dashboard TUI log viewport budgeting to avoid footer overlap under constrained heights - Expand CLI and TUI test coverage for token persistence, auth precedence, and environment mocking - Refresh README/CLI/getting-started docs and add changesets for token persistence and TUI fix
This commit is contained in:
@@ -64,6 +64,30 @@ export class DaemonTokenManager {
|
||||
return settings.daemonToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the existing daemon token or create/persist one if missing.
|
||||
*
|
||||
* Safe for concurrent callers: if another process writes the token between
|
||||
* the initial read and generateToken(), this method re-reads and returns the
|
||||
* persisted token instead of failing.
|
||||
*/
|
||||
async getOrCreateToken(): Promise<string> {
|
||||
const existing = await this.getToken();
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.generateToken();
|
||||
} catch (error) {
|
||||
const afterRace = await this.getToken();
|
||||
if (afterRace) {
|
||||
return afterRace;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that a provided token matches the stored token.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user