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 df0b9c7c..edef3075 100644 --- a/src/web/public/index.html +++ b/src/web/public/index.html @@ -1442,6 +1442,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 9b757349..8575cac6 100644 --- a/src/web/public/session-ui.js +++ b/src/web/public/session-ui.js @@ -2486,6 +2486,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; @@ -2566,6 +2574,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)'); + }); });