9b395f5cc3
Build Chrome Extension / build (push) Waiting to run
Trigger Website Rebuild (Docs Updated) / dispatch (push) Waiting to run
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
import { conversationSelectionArgs, openCodexConversation } from './sidebar.js';
|
|
export const readCommand = cli({
|
|
site: 'codex',
|
|
name: 'read',
|
|
access: 'read',
|
|
description: 'Read the contents of the current or selected Codex conversation thread',
|
|
domain: 'localhost',
|
|
strategy: Strategy.UI,
|
|
browser: true,
|
|
args: [
|
|
...conversationSelectionArgs,
|
|
],
|
|
columns: ['Project', 'Conversation', 'Content'],
|
|
func: async (page, kwargs) => {
|
|
const selected = await openCodexConversation(page, kwargs);
|
|
const historyText = await page.evaluate(`
|
|
(function() {
|
|
const turns = Array.from(document.querySelectorAll('[data-content-search-turn-key]'));
|
|
if (turns.length > 0) {
|
|
return turns.map(t => t.innerText || t.textContent).join('\\n\\n---\\n\\n');
|
|
}
|
|
|
|
const threadContainer = document.querySelector('[role="log"], [data-testid="conversation"], .thread-container, .messages-list, main');
|
|
|
|
if (threadContainer) {
|
|
return threadContainer.innerText || threadContainer.textContent;
|
|
}
|
|
|
|
return document.body.innerText;
|
|
})()
|
|
`);
|
|
return [
|
|
{
|
|
Project: selected?.project || '',
|
|
Conversation: selected?.conversation || '',
|
|
Content: historyText,
|
|
},
|
|
];
|
|
},
|
|
});
|