feat(session-options): show the session's working folder with a copy button

This commit is contained in:
Devvyn committed 2026-10-10 13:50:05 +08:00
1 parent 3d59e59e37
commit 0fced6ea97
4 files changed
+39

No files matched your search

+10
View File
@@ -1407,6 +1407,16 @@
<input type="text" id="modalSessionName" class="set-input" maxlength="128" placeholder="Auto (directory name)" onblur="app.saveSessionName()">
</div>
</div>
<div class="set-row">
<div class="set-row-text">
<span class="set-row-label">Working folder</span>
<span class="set-row-desc">Where this session's CLI runs, on the machine hosting Codeman.</span>
</div>
<div class="set-row-actions">
<code id="modalSessionPath" class="set-static mono" style="word-break: break-all; user-select: all;"></code>
<button type="button" class="btn-toolbar btn-sm" id="modalSessionPathCopy" onclick="app.copySessionPath()">Copy</button>
</div>
</div>
<div class="set-row set-row-block">
<div class="set-row-text">
<span class="set-row-label">Session color</span>
+14
View File
@@ -2473,6 +2473,14 @@ Object.assign(CodemanApp.prototype, {
if (tab) tab.classList.toggle('tab-show-detach', !!on);
},
/** Copy the open session's working folder (Session Options > Session > Working folder). */
async copySessionPath() {
const session = this.sessions.get(this.editingSessionId);
if (!session?.workingDir) return;
const ok = await this._copyText(session.workingDir);
this.showToast(ok ? 'Path copied' : 'Copy failed', ok ? 'success' : 'error');
},
openSessionOptions(sessionId) {
const session = this.sessions.get(sessionId);
if (!session) return;
@@ -2552,6 +2560,12 @@ Object.assign(CodemanApp.prototype, {
document.getElementById('modalSessionName').placeholder = 'Auto (directory name)';
}
// Working folder: the path the CLI was launched in on the Codeman host
const _pathEl = document.getElementById('modalSessionPath');
_pathEl.textContent = session.workingDir || '';
_pathEl.title = session.workingDir || '';
document.getElementById('modalSessionPathCopy').disabled = !session.workingDir;
// Initialize color picker with current session color
const currentColor = session.color || 'default';
const colorPicker = document.getElementById('sessionColorPicker');