chore: import upstream snapshot with attribution
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
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
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
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { cli, Strategy } from '@jackwener/opencli/registry';
|
||||
import { selectorError } from '@jackwener/opencli/errors';
|
||||
import { conversationSelectionArgs, openCodexConversation } from './sidebar.js';
|
||||
export const sendCommand = cli({
|
||||
site: 'codex',
|
||||
name: 'send',
|
||||
access: 'write',
|
||||
description: 'Send text/commands to the current or selected Codex AI composer',
|
||||
domain: 'localhost',
|
||||
strategy: Strategy.UI,
|
||||
browser: true,
|
||||
args: [
|
||||
{ name: 'text', required: true, positional: true, help: 'Text, command (e.g. /review), or skill (e.g. $imagegen)' },
|
||||
...conversationSelectionArgs,
|
||||
],
|
||||
columns: ['Status', 'Project', 'Conversation', 'InjectedText'],
|
||||
func: async (page, kwargs) => {
|
||||
const textToInsert = kwargs.text;
|
||||
const selected = await openCodexConversation(page, kwargs);
|
||||
const injected = await page.evaluate(`
|
||||
(function(text) {
|
||||
let composer = document.querySelector('textarea, [contenteditable="true"]');
|
||||
|
||||
const editables = Array.from(document.querySelectorAll('[contenteditable="true"]'));
|
||||
if (editables.length > 0) {
|
||||
composer = editables[editables.length - 1];
|
||||
}
|
||||
|
||||
if (!composer) return false;
|
||||
|
||||
composer.focus();
|
||||
document.execCommand('insertText', false, text);
|
||||
return true;
|
||||
})(${JSON.stringify(textToInsert)})
|
||||
`);
|
||||
if (!injected)
|
||||
throw selectorError('Codex Composer input element');
|
||||
// Wait for the UI to register the input
|
||||
await page.wait(0.5);
|
||||
// Simulate Enter key to submit
|
||||
await page.pressKey('Enter');
|
||||
return [
|
||||
{
|
||||
Status: 'Success',
|
||||
Project: selected?.project || '',
|
||||
Conversation: selected?.conversation || '',
|
||||
InjectedText: textToInsert,
|
||||
},
|
||||
];
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user