From 0fced6ea9764fba96eaa21022eeb5413e029ea9d Mon Sep 17 00:00:00 2001 From: Devvyn <22340871+opticon454@users.noreply.github.com> Date: Sat, 10 Oct 2026 12:50:15 +0800 Subject: [PATCH] feat(session-options): show the session's working folder with a copy button --- .changeset/session-options-working-folder.md | 5 +++++ src/web/public/index.html | 10 ++++++++++ src/web/public/session-ui.js | 14 ++++++++++++++ test/session-options-structure.test.ts | 10 ++++++++++ 4 files changed, 39 insertions(+) create mode 100644 .changeset/session-options-working-folder.md diff --git a/.changeset/session-options-working-folder.md b/.changeset/session-options-working-folder.md new file mode 100644 index 00000000..38234593 --- /dev/null +++ b/.changeset/session-options-working-folder.md @@ -0,0 +1,5 @@ +--- +'aicodeman': patch +--- + +Session Options > Session now shows the working folder the session's CLI runs in on the Codeman host, with a Copy button. diff --git a/src/web/public/index.html b/src/web/public/index.html index cb6d38d0..6422e000 100644 --- a/src/web/public/index.html +++ b/src/web/public/index.html @@ -1407,6 +1407,16 @@ +
+
+ Working folder + Where this session's CLI runs, on the machine hosting Codeman. +
+
+ + +
+
Session color diff --git a/src/web/public/session-ui.js b/src/web/public/session-ui.js index 3ec17fe0..0e8704ff 100644 --- a/src/web/public/session-ui.js +++ b/src/web/public/session-ui.js @@ -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'); diff --git a/test/session-options-structure.test.ts b/test/session-options-structure.test.ts index 4df59cdf..9f4f2696 100644 --- a/test/session-options-structure.test.ts +++ b/test/session-options-structure.test.ts @@ -103,4 +103,14 @@ describe('Session Options modal structure', () => { ); expect(styles).not.toMatch(/@media \(min-width: 680px\)[\s\S]{0,1200}#sessionOptionsModal #context-tab/); }); + + it('shows the session working folder with a copy button', () => { + const modal = optionsModal(); + expect(modal).toContain('id="modalSessionPath"'); + expect(modal).toContain('app.copySessionPath()'); + const open = methodBody('openSessionOptions(sessionId)'); + expect(open).toContain("getElementById('modalSessionPath')"); + expect(open).toContain('session.workingDir'); + expect(methodBody('async copySessionPath()')).toContain('_copyText(session.workingDir)'); + }); });