feat: add codex-iterm skill

This commit is contained in:
Adolfo Reyna
2026-02-19 10:44:21 -05:00
parent 7865dd48e8
commit faae96c9ed
3 changed files with 118 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
on run argv
if (count of argv) is 0 then
error "Expected shell command argument"
end if
set shellCommand to item 1 of argv
tell application "iTerm"
activate
if (count of windows) = 0 then
create window with default profile
end if
tell current session of current window
write text shellCommand
end tell
end tell
end run

View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""Helper to run Codex commands inside iTerm so the user can watch output."""
import argparse
import shlex
import subprocess
from pathlib import Path
DEFAULT_CODEX = "/Applications/Codex.app/Contents/Resources/codex"
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("prompt", help="Codex prompt/instruction string")
parser.add_argument("--workdir", default=str(Path.home() / "Project/basic1"),
help="Working directory for the Codex session")
parser.add_argument("--flags", default="--full-auto",
help="Additional flags to pass to Codex (e.g. '--yolo')")
parser.add_argument("--codex-path", default=DEFAULT_CODEX,
help="Path to the Codex CLI binary")
parser.add_argument("--applescript", default=str(Path(__file__).with_name("run_codex_iterm.applescript")),
help="Path to the AppleScript wrapper")
args = parser.parse_args()
workdir = Path(args.workdir).expanduser()
codex_bin = Path(args.codex_path).expanduser()
applescript = Path(args.applescript).expanduser()
if not codex_bin.exists():
raise SystemExit(f"Codex binary not found at {codex_bin}")
if not applescript.exists():
raise SystemExit(f"AppleScript helper not found at {applescript}")
cmd = f"cd {shlex.quote(str(workdir))} && {shlex.quote(str(codex_bin))} {args.flags} {shlex.quote(args.prompt)}"
subprocess.run([
"osascript",
str(applescript),
cmd,
], check=True)
if __name__ == "__main__":
main()