mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 15:09:42 +02:00
fix(tui): resolve screen attach ambiguity with multiple sessions
- Add getFullScreenId() to get PID.screenName format for unambiguous attach - Update DirectAttach.ts and index.tsx to use full screen IDs - Remove TUI documentation from README (still in development) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+18
-2
@@ -892,11 +892,23 @@ class ClaudemanApp {
|
||||
|
||||
async loadQuickStartCases(selectCaseName = null) {
|
||||
try {
|
||||
// Load settings to get lastUsedCase
|
||||
let lastUsedCase = null;
|
||||
try {
|
||||
const settingsRes = await fetch('/api/settings');
|
||||
if (settingsRes.ok) {
|
||||
const settings = await settingsRes.json();
|
||||
lastUsedCase = settings.lastUsedCase || null;
|
||||
}
|
||||
} catch {
|
||||
// Ignore settings load errors
|
||||
}
|
||||
|
||||
// Add cache-busting to ensure fresh data
|
||||
const res = await fetch('/api/cases?_t=' + Date.now());
|
||||
const cases = await res.json();
|
||||
this.cases = cases;
|
||||
console.log('[loadQuickStartCases] Loaded cases:', cases.map(c => c.name));
|
||||
console.log('[loadQuickStartCases] Loaded cases:', cases.map(c => c.name), 'lastUsedCase:', lastUsedCase);
|
||||
|
||||
const select = document.getElementById('quickStartCase');
|
||||
|
||||
@@ -920,8 +932,12 @@ class ClaudemanApp {
|
||||
if (selectCaseName) {
|
||||
select.value = selectCaseName;
|
||||
this.updateDirDisplayForCase(selectCaseName);
|
||||
} else if (lastUsedCase && cases.some(c => c.name === lastUsedCase)) {
|
||||
// Use lastUsedCase if available and exists
|
||||
select.value = lastUsedCase;
|
||||
this.updateDirDisplayForCase(lastUsedCase);
|
||||
} else if (cases.length > 0) {
|
||||
// Auto-select first case
|
||||
// Fallback to testcase or first case
|
||||
const firstCase = cases.find(c => c.name === 'testcase') || cases[0];
|
||||
select.value = firstCase.name;
|
||||
this.updateDirDisplayForCase(firstCase.name);
|
||||
|
||||
@@ -854,6 +854,23 @@ export class WebServer extends EventEmitter {
|
||||
}
|
||||
this.broadcast('session:updated', { session: session.toDetailedState() });
|
||||
|
||||
// Save lastUsedCase to settings for TUI/web sync
|
||||
try {
|
||||
const settingsFilePath = join(homedir(), '.claudeman', 'settings.json');
|
||||
let settings: Record<string, unknown> = {};
|
||||
if (existsSync(settingsFilePath)) {
|
||||
settings = JSON.parse(readFileSync(settingsFilePath, 'utf-8'));
|
||||
}
|
||||
settings.lastUsedCase = caseName;
|
||||
const dir = dirname(settingsFilePath);
|
||||
if (!existsSync(dir)) {
|
||||
mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
writeFileSync(settingsFilePath, JSON.stringify(settings, null, 2));
|
||||
} catch {
|
||||
// Non-critical, ignore settings save errors
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
sessionId: session.id,
|
||||
|
||||
Reference in New Issue
Block a user