Local Environments
Local environments ให้คุณกำหนดค่า setup steps สำหรับ worktrees รวมถึง actions ทั่วไปสำหรับโปรเจกต์
คุณกำหนดค่า local environments ผ่าน Codex App settings pane และสามารถ check ไฟล์ที่สร้างขึ้นเข้า Git repository ของโปรเจกต์เพื่อแชร์กับคนอื่นได้
Codex เก็บ configuration นี้ไว้ในโฟลเดอร์ .codex ที่ root ของโปรเจกต์ หากไฟล์ repository มีโปรเจกต์มากกว่าหนึ่ง ให้เปิดโฟลเดอร์โปรเจกต์ที่มีโฟลเดอร์ .codex ที่แชร์กัน
Setup scripts
เนื่องจาก worktrees รันในไดเรกทอรีที่แตกต่างจาก local tasks ของคุณ โปรเจกต์อาจไม่ได้ตั้งค่าครบถ้วนและอาจขาด dependencies หรือไฟล์ที่ไม่ได้ check เข้า repository
Setup scripts รันโดยอัตโนมัติเมื่อ Codex สร้าง worktree ใหม่ที่เริ่มต้น thread ใหม่
ใช้ script นี้เพื่อรันคำสั่งที่จำเป็นสำหรับการกำหนดค่า environment เช่น การติดตั้ง dependencies หรือรัน build process
ตัวอย่างสำหรับ TypeScript project:
npm install
npm run build
หาก setup เฉพาะแพลตฟอร์ม ให้กำหนด setup scripts สำหรับ macOS, Windows หรือ Linux แทน default
Actions
ใช้ actions เพื่อกำหนดงานทั่วไป เช่น การเริ่ม development server ของแอปหรือรัน test suite Actions เหล่านี้จะปรากฏใน Codex App top bar สำหรับการเข้าถึงที่รวดเร็ว
Actions รันภายใน integrated terminal ของแอป
Actions มีประโยชน์เพื่อหลีกเลี่ยงการพิมพ์คำสั่งซ้ำๆ เช่น trigger build สำหรับโปรเจกต์หรือเริ่ม development server สำหรับการ debug แบบ one-off สามารถใช้ integrated terminal โดยตรงได้
ตัวอย่างสำหรับ Node.js project ที่สร้าง "Run" action:
npm start
หากคำสั่งสำหรับ action เฉพาะแพลตฟอร์ม ให้กำหนด scripts เฉพาะสำหรับ macOS, Windows และ Linux
เพื่อระบุ actions ให้เลือกไอคอนที่เกี่ยวข้องกับแต่ละ action