codexで
- 翻訳ファイル編集
- astroでサイト生成まで一括?
を試したいと思います。
Macにインストール、intel macでも使えるそうです
% node --version v24.3.0 % npm install -g @openai/codex
added 7 packages in 13s
インストールできたようです。起動してみます
$ codex
__+=~~=+=,__
,;=";,_,===||_^*\+,
,,"_+*"~*" `"^"\+*|+_
_|"_*|* _,+|\/*\
_| ,|* _/!_||^*\||\
/`,|' +*';|"/ '\~|\
;|;+| ,* .+*^ ,\|/
|_^/` "";:|", |~"|
|/||;,=;======_,';^^\* / |\
'|^|_" /``____|\ *\"|=\ ,/ ||
\,^\'"""""""*" \,=||,| /\
* ^*/, _/*.|/
\_^*,~_ ,;*`;*'
^,-."~+^;;,:"~"`,/*'
`*+~_!=____|*""
Welcome to Codex, OpenAI's command-line coding agent
Sign in with ChatGPT to use Codex as part of your paid plan
or connect an API key for usage-based billing
> 1. Sign in with ChatGPT
Usage included with Plus, Pro, Business, and Enterprise plans
2. Sign in with Device Code
Sign in from another device with a one-time code
3. Provide your own API key
Pay for what you use
Press enter to continueChatGPTにログインします。enterでブラウザリンクが開き連携できます
Welcome to Codex, OpenAI's command-line coding agent ✓ Signed in with your ChatGPT account Before you start: Decide how much autonomy you want to grant Codex For more details see the Codex docs Codex can make mistakes Review the code it writes and commands it runs Powered by your ChatGPT account Uses your plan's rate limits and training data preferences
Astroで管理しているサイトを編集してみる
リリースノートのファイルjsonに翻訳を追記してもらおうと思います。
プロジェクトルートで codexを起動
You are in ./git/umi-astro Do you trust the contents of this directory? Working with untrusted contents comes with higher risk of prompt injection. Trusting the directory allows project-local config, hooks, and exec policies to load. › 1. Yes, continue 2. No, quit
configを読んでいいか聞かれました。 Yesにしてみます。
>_ OpenAI Codex (v0.137.0) │
│ │
│ model: gpt-5.5 /model to change │
│ directory: ~/git/umi-astro │
╰───────────────────────────────────────╯
Tip: GPT-5.5 is now available in Codex. It's our strongest agentic coding model yet, built to reason through large codebases, check assumptions with tools, and keep going until the work is done.
Learn more: https://openai.com/index/introducing-gpt-5-5/
› Implement {feature}
gpt-5.5 default · ~/git/umi-astro依頼メッセージを送信
› 一旦ui-releases.tsを戻します。section[1]については、入れ替えではなく、1.12.xと1.11の行だけ先頭に追記してください。ほかは同じ編集をお願いします
• 了解です。section[0] の変更はそのまま維持し、section[1].p は元の長い履歴本文に戻した上で、先頭に v1.12.x と v1.11.1 の2行だけを追加する形に直します。まず差分を確認して、戻す範囲を限定します。
• Ran git diff -- src/i18n/ui-releases.ts
└ (no output)
• Ran git status --short
└ ?? cd.html
?? public/images/
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• git status 上は ui-releases.ts に未コミット差分がありません。つまり現在の内容は Git の追跡状態と一致しています。念のため現ファイルの該当構造を見てから、希望どおりの追記方式に編集します。
• Explored
└ Read ui-releases.ts
Search NEEW|NEW: v1.12|v1\.12\.x|v1\.11\.1 in ui-releases.ts
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• 現在は元の長い履歴に戻っている状態です。これから、各ロケールごとに section[0] は NEEW: v1.12.x... と先頭行追加、section[1].p は既存本文を残したまま2行だけ先頭追加します。
• Working (1m 05s • esc to interrupt)依頼を実行するスクリプトを生成して、実行するか確認
Would you like to make the following edits? › 1. Yes, proceed (y) 2. Yes, and don't ask again for these files (a) 3. No, and tell Codex what to do differently (esc)
Yesで実行
• 差分は、各言語で section[0] のタイトル・先頭行と、section[1] 先頭2行の追加に収まっています。構文確認としてビルドを実行します。
• Ran npm run build
└
> umi-astro@0.0.1 prebuild
… +609 lines (ctrl + t to view transcript)
00:02:46 [build] Complete!
✅ Successfully generated .htaccess in ./dist/api/v1
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• 完了しました。
src/i18n/ui-releases.ts を修正し、全ロケールで以下の形にしました。
- section[0].title: NEEW: v1.12.x... に変更
- section[0].p: v1.12.x... の1行を先頭に追加
- section[1].p: 既存の履歴本文は残したまま、先頭に v1.12.x... と v1.11.1... の2行だけ追加
npm run build も成功しています。未追跡の cd.html と public/images/ は既存のまま触っていません。buidまで通して確認してくれました。
ただのテキスト変換なので、簡単に終わりました。
画像処理のpythonなどスクリプト系はなんの問題もなく使えると思います◎
無料枠は厳しい。。。/status
/status ╭────────────────────────────────────────────────────────────────────────────────╮ │ >_ OpenAI Codex (v0.137.0) │ │ │ │ Visit https://chatgpt.com/codex/settings/usage for up-to-date │ │ information on rate limits and credits │ │ │ │ Model: gpt-5.5 (reasoning medium, summaries auto) │ │ Directory: ~/git/umi-astro │ │ Permissions: Workspace (Ask for approval) │ │ Agents.md: <none> │ │ Account: abc (Free) │ │ Collaboration mode: Default │ │ Session: 019ea287- │ │ │ │ Context window: 46% left (144K used / 258K) │ │ Monthly limit: [█████░░░░░░░░░░░░░░░] 25% left (resets 23:45 on 7 Jul) │ ╰────────────────────────────────────────────────────────────────────────────────╯
ちょっと使っただけで 1か月分の75%使ったようです。。。
全部やってくれるので便利ですが消費量を抑えるには、AGENT.mdに
# AGENTS.md Rules: - Do not run build unless explicitly requested. - Do not run tests unless explicitly requested. - For translation updates, edit only translation files. - Show changed files before making unrelated changes.
といれておくと npm run buildしてエラーチェックなどしなくなるので良いようです。
buildするとメッセージをすべてチェックするのでそれなりに消費してしまうようです。
Codexの終了と再開
/exitで終了
To continue this session, run codex resume 019ea287—–
と表示されるので codex resume 019ea287—– で再開すると続きが使えるようです。
codex resume --last ( ただし最後のセッションなので、IDを指定したほうが良い


コメント