### Execute Codex CLI Example with run.sh Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/README.md This snippet demonstrates the commands to navigate into an example directory and execute its `run.sh` helper script, which initiates a new Codex session based on the task specification. ```bash cd camerascii ./run.sh ``` -------------------------------- ### Codex CLI Example Directory Structure Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/README.md This snippet illustrates the standard file and directory layout for a Codex CLI example. It includes the `run.sh` helper script, `task.yaml` for prompts, an optional `template/` directory for starter files, and `runs/` for output. ```text example‑name/ ├── run.sh # helper script that launches a new Codex session for the task ├── task.yaml # task spec containing a prompt passed to Codex ├── template/ # (optional) starter files copied into each run └── runs/ # work directories created by run.sh ``` -------------------------------- ### Get Codex CLI Help Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompting_guide.md Demonstrates how to display the help message for the Codex command-line interface, providing an overview of available commands and options. ```Bash codex --help ``` -------------------------------- ### Example Content for Codex Task Description File Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompting_guide.md Provides a sample Markdown content for a `task_description.md` file, detailing a refactoring task for Codex, including a list of files to read for context and a requirement for a final output file. ```Markdown Refactor: simplify model names across static documentation Can you update docs_site to use a better model naming convention on the site. Read files like: - docs_site/content/models.md - docs_site/components/ModelCard.tsx - docs_site/utils/modelList.ts - docs_site/config/sidebar.ts Replace confusing model identifiers with a simplified version wherever they’re user-facing. Write what you changed or tried to do to final_output.md ``` -------------------------------- ### Ask Codex a Simple Question Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompting_guide.md Illustrates how to prompt Codex directly from the command line with a natural language question to get a quick response about its capabilities. ```Bash codex "write 2-3 sentences on what you can do" ``` -------------------------------- ### Create a Simple HTML Webpage with Codex CLI Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompting_guide.md Guides the user through a multi-step process to create a new directory, initialize a Git repository, and then use Codex to generate an HTML file with a poem, custom CSS, and a framed appearance. ```Bash mkdir first-task && cd first-task git init codex "Create a file poem.html that renders a poem about the nature of intelligence and programming by you, Codex. Add some nice CSS and make it look like it's framed on a wall" ``` -------------------------------- ### Execute Medium Tasks with Codex CLI from File Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompting_guide.md Demonstrates how to provide longer, more complex instructions to Codex by reading them from a Markdown file, suitable for multi-file refactoring or larger feature implementations. ```Bash codex "$(cat task_description.md)" ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/README.md Installs the required Python libraries for the prompt clustering utility, including pandas for data manipulation, numpy for numerical operations, scikit-learn for machine learning, matplotlib for plotting, and openai for interacting with the OpenAI API. It is recommended to install these within a virtual environment. ```bash pip install pandas numpy scikit-learn matplotlib openai ``` -------------------------------- ### Open-Codex Custom Instructions Markdown Example Source: https://github.com/ymichael/open-codex/blob/main/README.md This Markdown snippet illustrates how to define custom instructions for the `codex` tool in a file like `~/.codex/instructions.md`. These instructions guide the AI's behavior, such as always responding with emojis or restricting git command usage. ```md # ~/.codex/instructions.md - Always respond with emojis - Only use git commands if I explicitly mention you should ``` -------------------------------- ### Install Open-Codex CLI via npm or Yarn Source: https://github.com/ymichael/open-codex/blob/main/README.md This snippet demonstrates how to install the `open-codex` command-line interface globally using either npm or Yarn package managers, which is the recommended installation method. ```bash npm install -g open-codex # or yarn global add open-codex ``` -------------------------------- ### Build Open-Codex CLI from Source Source: https://github.com/ymichael/open-codex/blob/main/README.md This section provides instructions for building the `open-codex` CLI from its source code, including cloning the repository, installing dependencies, building the project, and linking the command globally for convenience. ```bash git clone https://github.com/ymichael/open-codex.git cd open-codex/codex-cli npm install npm run build node ./dist/cli.js --help node ./dist/cli.js npm link ``` -------------------------------- ### Open-Codex Default Configuration File Example Source: https://github.com/ymichael/open-codex/blob/main/README.md This JSON snippet shows an example of the `open-codex` configuration file, typically located at `~/.codex/config.json`. It defines default settings for the AI model, provider, approval mode, and error handling. ```json { "model": "o4-mini", "provider": "openai", "approvalMode": "suggest", "fullAutoErrorMode": "ask-user" } ``` -------------------------------- ### Codex CLI Command Usage Examples Source: https://github.com/ymichael/open-codex/blob/main/README.md This section provides various examples of how to use the `codex` command-line interface to perform tasks like refactoring code, generating migrations, writing tests, renaming files, explaining regex, proposing PRs, and finding vulnerabilities. ```bash codex "Refactor the Dashboard component to React Hooks" codex "Generate SQL migrations for adding a users table" codex "Write unit tests for utils/date.ts" codex "Bulk‑rename *.jpeg → *.jpg with git mv" codex "Explain what this regex does: ^(?=.*[A-Z]).{8,}$" codex "Carefully review this repo, and propose 3 high impact well-scoped PRs" codex "Look for vulnerabilities and create a security review report" ``` -------------------------------- ### Apply Small Code Changes with Codex CLI Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompting_guide.md Shows how to use Codex for minor, specific code modifications by directly naming the file and function to be edited and precisely describing the desired change, emphasizing specificity for faster feedback loops. ```Bash codex "Modify the discount function utils/priceUtils.js to apply a 10 percent discount" ``` -------------------------------- ### Run Prompt Clustering Utility with Custom Options Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/README.md Demonstrates how to execute the `cluster_prompts.py` script with various command-line arguments to override default settings. This example customizes the input CSV file, specifies an embedding cache path, selects DBSCAN as the clustering method, uses different OpenAI models for embeddings and chat, and defines custom output file and directory names. ```bash python cluster_prompts.py \ --csv my_prompts.csv \ --cache .cache/embeddings.json \ --cluster-method dbscan \ --embedding-model text-embedding-3-large \ --chat-model gpt-4o \ --output-md my_analysis.md \ --plots-dir my_plots ``` -------------------------------- ### Install Open Codex CLI Globally Source: https://github.com/ymichael/open-codex/blob/main/README.md Installs the Open Codex command-line interface globally using npm, making it accessible from any directory in your terminal. ```Shell npm install -g open-codex ``` -------------------------------- ### Codex CLI Command Reference Source: https://github.com/ymichael/open-codex/blob/main/README.md This section provides a comprehensive reference for the Codex command-line interface (CLI) commands. It lists various commands, their purposes, and example usages, along with key flags for model selection, approval mode, and quiet operation. ```APIDOC Command Line Interface (CLI) Reference: open-codex: Purpose: Interactive REPL Example: `codex` open-codex "…": Purpose: Initial prompt for interactive REPL Example: `codex "fix lint errors"` open-codex -q "…": Purpose: Non-interactive "quiet mode" Example: `codex -q --json "explain utils.ts"` open-codex completion : Purpose: Print shell completion script Example: `codex completion bash` Key Flags: --model/-m --approval-mode/-a --quiet/-q ``` -------------------------------- ### Configure Open-Codex for Alternative AI Provider Source: https://github.com/ymichael/open-codex/blob/main/README.md This JSON snippet demonstrates how to change the default AI provider for `open-codex` by setting the `provider` key in the configuration file, for example, to use 'gemini' instead of 'openai'. ```json { "provider": "gemini" } ``` -------------------------------- ### Integrate Codex into GitHub Actions for CI Source: https://github.com/ymichael/open-codex/blob/main/README.md This YAML snippet demonstrates how to integrate Codex into a GitHub Actions workflow for non-interactive operations. It shows steps to install `open-codex` globally, set the OpenAI API key from secrets, and run a Codex command in `auto-edit` and quiet mode to update a changelog. ```yaml - name: Update changelog via Codex run: | npm install -g open-codex export OPENAI_API_KEY="${{ secrets.OPENAI_KEY }}" open-codex -a auto-edit --quiet "update CHANGELOG for next release" ``` -------------------------------- ### Run Prompt Clustering Utility with Default Options Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/README.md Executes the `cluster_prompts.py` script using its default configuration. This command processes `prompts.csv`, uses `text-embedding-3-small` for embeddings, applies K-Means clustering with automatic 'k' selection, labels clusters with `gpt-4o-mini`, and saves results to `analysis.md` and diagnostic plots to the `plots/` directory. ```bash # Minimal command – runs on prompts.csv and writes analysis.md + plots/ python cluster_prompts.py ``` -------------------------------- ### Command-Line Interface Options for cluster_prompts.py Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/README.md Details the available command-line flags for customizing the prompt clustering utility's behavior. This includes options for specifying input/output paths, selecting clustering algorithms, choosing OpenAI models for embeddings and chat, and configuring various parameters for the clustering process. ```APIDOC Command-Line Options: --csv: Type: string Default: prompts.csv Description: Path to the input CSV (must contain a `prompt` column; an `act` column is used as context if present). --cache: Type: string Default: (none) Description: Embedding cache path (JSON). Speeds up repeated runs – new texts are appended automatically. --cluster-method: Type: string Default: kmeans Description: `kmeans` (with automatic *k*) or `dbscan`. --k-max: Type: integer Default: 10 Description: Upper bound for *k* when `kmeans` is selected. --dbscan-min-samples: Type: integer Default: 3 Description: Min samples parameter for DBSCAN. --embedding-model: Type: string Default: text-embedding-3-small Description: Any OpenAI embedding model. --chat-model: Type: string Default: gpt-4o-mini Description: Chat model used to generate cluster names / descriptions. --output-md: Type: string Default: analysis.md Description: Where to write the Markdown report. --plots-dir: Type: string Default: plots Description: Directory for generated PNGs. ``` -------------------------------- ### Name K-means Clusters Using OpenAI GPT-4 and Sample Reviews in Python Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/Clustering.ipynb This code iterates through each identified cluster, samples a few reviews, and uses the OpenAI GPT-4 model to generate a theme or name for the cluster based on the content of these reviews. It then prints the generated theme along with sample reviews and their scores, providing qualitative insights into each cluster's characteristics. ```python from openai import OpenAI import os client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY", "")) # Reading a review which belong to each group. rev_per_cluster = 5 for i in range(n_clusters): print(f"Cluster {i} Theme:", end=" ") reviews = "\n".join( df[df.Cluster == i] .combined.str.replace("Title: ", "") .str.replace("\n\nContent: ", ": ") .sample(rev_per_cluster, random_state=42) .values ) messages = [ {"role": "user", "content": f'What do the following customer reviews have in common?\n\nCustomer reviews:\n"""{reviews} """\n\nTheme:'} ] response = client.chat.completions.create( model="gpt-4", messages=messages, temperature=0, max_tokens=64, top_p=1, frequency_penalty=0, presence_penalty=0) print(response.choices[0].message.content.replace("\n", "")) sample_cluster_rows = df[df.Cluster == i].sample(rev_per_cluster, random_state=42) for j in range(rev_per_cluster): print(sample_cluster_rows.Score.values[j], end=", ") print(sample_cluster_rows.Summary.values[j], end=": ") print(sample_cluster_rows.Text.str[:70].values[j]) print("-" * 100) ``` -------------------------------- ### Load and Prepare Data for K-means Clustering in Python Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/Clustering.ipynb This snippet loads a CSV dataset containing text embeddings, converts the string representations of embeddings into NumPy arrays, and stacks them into a matrix suitable for clustering. It prepares the input data for the K-means algorithm. ```python # imports import numpy as np import pandas as pd from ast import literal_eval # load data datafile_path = "./data/fine_food_reviews_with_embeddings_1k.csv" df = pd.read_csv(datafile_path) df["embedding"] = df.embedding.apply(literal_eval).apply(np.array) # convert string to numpy array matrix = np.vstack(df.embedding.values) matrix.shape ``` -------------------------------- ### Run Pre-Push Development Checks Source: https://github.com/ymichael/open-codex/blob/main/README.md Execute the full suite of development checks including unit tests, linting, and TypeScript type-checking before pushing code changes to ensure quality and adherence to project standards. ```bash npm test && npm run lint && npm run typecheck ``` -------------------------------- ### Set OpenAI API Key Environment Variable Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/README.md Exports your OpenAI API key as an environment variable. This step is crucial as the `cluster_prompts.py` script requires this key to authenticate with the OpenAI API for embedding generation and chat model interactions. ```bash export OPENAI_API_KEY="sk‑..." ``` -------------------------------- ### Common Development Workflow Commands Source: https://github.com/ymichael/open-codex/blob/main/README.md Essential commands for the development workflow, including running tests in watch mode for continuous feedback, performing type-checks without file emission, and automatically fixing linting and formatting issues. ```bash # Watch mode (tests rerun on change) npm run test:watch # Type‑check without emitting files npm run typecheck # Automatically fix lint + prettier issues npm run lint:fix npm run format:fix ``` -------------------------------- ### Apply K-means Clustering to Data in Python Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/Clustering.ipynb This code applies the K-means algorithm from scikit-learn to the prepared data matrix. It initializes K-means with a specified number of clusters and fits the model to assign cluster labels to each data point. The cluster labels are then added to the DataFrame. ```python from sklearn.cluster import KMeans n_clusters = 4 kmeans = KMeans(n_clusters=n_clusters, init="k-means++", random_state=42) kmeans.fit(matrix) labels = kmeans.labels_ df["Cluster"] = labels df.groupby("Cluster").Score.mean().sort_values() ``` -------------------------------- ### Event Handlers and Main Game Loop Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/impossible-pong/template/index.html Sets up event listeners for start/pause, reset, mode selection, difficulty changes, and player paddle movement. It also defines the main game loop using `requestAnimationFrame` to continuously update and render the game state. ```JavaScript function loop() { update(); draw(); requestAnimationFrame(loop); } startPauseBtn.onclick = () => { isPaused = !isPaused; startPauseBtn.textContent = isPaused ? "Resume" : "Pause"; }; resetBtn.onclick = () => { scores = { player: 0, ai: 0 }; resetBall(); }; modeSelect.onchange = (e) => { mode = e.target.value; }; difficultySelect.onchange = (e) => { difficulty = e.target.value; resetBall(); }; document.addEventListener("mousemove", (e) => { if (mode === 'player') { const rect = canvas.getBoundingClientRect(); player.y = e.clientY - rect.top - paddleHeight / 2; } }); loop(); ``` -------------------------------- ### Set Environment Variable for AI Provider API Key Source: https://github.com/ymichael/open-codex/blob/main/README.md This bash command shows how to set an environment variable, such as `GOOGLE_GENERATIVE_AI_API_KEY`, which is required for authenticating with certain alternative AI providers like Gemini when using `open-codex`. ```bash export GOOGLE_GENERATIVE_AI_API_KEY="your-gemini-api-key-here" ``` -------------------------------- ### Run Open Codex CLI with a Specific Prompt Source: https://github.com/ymichael/open-codex/blob/main/README.md Executes the Open Codex CLI with a predefined prompt as input, enabling non-interactive code generation or explanation tasks. ```Shell open-codex "explain this codebase to me" ``` -------------------------------- ### Enable Verbose Logging for Codex Source: https://github.com/ymichael/open-codex/blob/main/README.md This shell command demonstrates how to enable verbose logging for Codex by setting the `DEBUG` environment variable to `true`. This will print full API request and response details, useful for debugging and tracing. ```shell DEBUG=true open-codex ``` -------------------------------- ### Initialize Pong Game Variables and Elements Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/impossible-pong/template/index.html Initializes DOM elements, game constants like paddle dimensions and ball radius, and game state variables such as player/AI paddle positions, ball state, pause status, game mode, difficulty, and scores. ```JavaScript const canvas = document.getElementById('pong'); const ctx = canvas.getContext('2d'); const startPauseBtn = document.getElementById('startPauseBtn'); const resetBtn = document.getElementById('resetBtn'); const modeSelect = document.getElementById('modeSelect'); const difficultySelect = document.getElementById('difficultySelect'); const scoreDisplay = document.getElementById('score'); const paddleWidth = 10, paddleHeight = 100; const ballRadius = 8; let player = { x: 0, y: canvas.height / 2 - paddleHeight / 2 }; let ai = { x: canvas.width - paddleWidth, y: canvas.height / 2 - paddleHeight / 2 }; let ball = { x: canvas.width / 2, y: canvas.height / 2, vx: 5, vy: 3 }; let isPaused = false; let mode = 'player'; let difficulty = 'basic'; const tennisSteps = ['0', '15', '30', '40', 'Adv', 'Win']; let scores = { player: 0, ai: 0 }; ``` -------------------------------- ### CSS Styling for Pong Game Layout Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/impossible-pong/template/index.html Defines the visual styles for the Pong game, including body, control panel, canvas, buttons, and score display. It sets up basic layout, colors, and font properties. ```CSS body { margin: 0; background: #000; color: white; font-family: sans-serif; overflow: hidden; } #controls { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px; background: #111; position: fixed; top: 0; width: 100%; z-index: 2; } canvas { display: block; margin: 60px auto 0 auto; background: #000; } button, select { background: #222; color: white; border: 1px solid #555; padding: 6px 12px; cursor: pointer; } button:hover { background: #333; } #score { font-weight: bold; } ``` -------------------------------- ### Set OpenAI API Key via .env File Source: https://github.com/ymichael/open-codex/blob/main/README.md Configures the OpenAI API key by placing it in a .env file at the root of your project. The Open Codex CLI automatically loads variables from this file. ```Shell OPENAI_API_KEY=your-api-key-here ``` -------------------------------- ### Run Open Codex CLI in Interactive Mode Source: https://github.com/ymichael/open-codex/blob/main/README.md Launches the Open Codex CLI in interactive mode, allowing for a conversational development experience directly in the terminal. ```Shell open-codex ``` -------------------------------- ### Run Open Codex CLI in Full Auto Approval Mode Source: https://github.com/ymichael/open-codex/blob/main/README.md Runs the Open Codex CLI with a prompt and enables 'full-auto' approval mode, allowing the agent to make and commit changes without manual intervention. ```Shell open-codex --approval-mode full-auto "create the fanciest todo-list app" ``` -------------------------------- ### Canvas Drawing Primitives for Pong Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/impossible-pong/template/index.html Provides utility functions `drawRect` and `drawCircle` to render rectangles and circles on the HTML canvas, used for drawing paddles, the ball, and court boundaries. ```JavaScript function drawRect(x, y, w, h, color = "#fff") { ctx.fillStyle = color; ctx.fillRect(x, y, w, h); } function drawCircle(x, y, r, color = "#fff") { ctx.fillStyle = color; ctx.beginPath(); ctx.arc(x, y, r, 0, Math.PI * 2); ctx.closePath(); ctx.fill(); } ``` -------------------------------- ### Visualize K-means Clusters with t-SNE in Python Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/prompt-analyzer/template/Clustering.ipynb This snippet uses t-SNE to reduce the dimensionality of the data to 2D for visualization purposes. It then plots the clustered data points using Matplotlib, coloring them by their assigned cluster and marking cluster centroids. This helps in visually inspecting the separation and distribution of the clusters. ```python from sklearn.manifold import TSNE import matplotlib import matplotlib.pyplot as plt tsne = TSNE(n_components=2, perplexity=15, random_state=42, init="random", learning_rate=200) vis_dims2 = tsne.fit_transform(matrix) x = [x for x, y in vis_dims2] y = [y for x, y in vis_dims2] for category, color in enumerate(["purple", "green", "red", "blue"]): xs = np.array(x)[df.Cluster == category] ys = np.array(y)[df.Cluster == category] plt.scatter(xs, ys, color=color, alpha=0.3) avg_x = xs.mean() avg_y = ys.mean() plt.scatter(avg_x, avg_y, marker="x", color=color, s=100) plt.title("Clusters identified visualized in language 2d using t-SNE") ``` -------------------------------- ### Main Game State Update Logic Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/impossible-pong/template/index.html Contains the core game logic, including ball movement, wall and paddle collision detection, scoring, AI paddle movement, and clamping paddle positions within the canvas boundaries. It also adjusts ball speed based on difficulty after collisions. ```JavaScript function update() { if (isPaused) return; ball.x += ball.vx; ball.y += ball.vy; // Wall bounce if (ball.y < 0 || ball.y > canvas.height) ball.vy *= -1; // Paddle collision let paddle = ball.x < canvas.width / 2 ? player : ai; if ( ball.x - ballRadius < paddle.x + paddleWidth && ball.x + ballRadius > paddle.x && ball.y > paddle.y && ball.y < paddle.y + paddleHeight ) { ball.vx *= -1; if (difficulty === 'fast') { ball.vx *= 1.05; ball.vy *= 1.05; } else if (difficulty === 'insane') { ball.vx *= 1.1; ball.vy *= 1.1; } } // Scoring if (ball.x < 0) { updateScore('ai'); resetBall(); } else if (ball.x > canvas.width) { updateScore('player'); resetBall(); } // Paddle AI if (mode === 'ai') { player.y += (ball.y - (player.y + paddleHeight / 2)) * 0.1; } ai.y += (ball.y - (ai.y + paddleHeight / 2)) * 0.1; // Clamp paddles player.y = Math.max(0, Math.min(canvas.height - paddleHeight, player.y)); ai.y = Math.max(0, Math.min(canvas.height - paddleHeight, ai.y)); } ``` -------------------------------- ### Set OpenAI API Key as Environment Variable (Temporary) Source: https://github.com/ymichael/open-codex/blob/main/README.md Sets the OpenAI API key as an environment variable for the current terminal session. This key is required for the CLI to authenticate with OpenAI or compatible providers. ```Shell export OPENAI_API_KEY="your-api-key-here" ``` -------------------------------- ### Pong Game Scoring and Utility Functions Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/impossible-pong/template/index.html Includes functions for displaying scores in a tennis-like format, updating game scores based on the winner, and determining the opponent of a given player. ```JavaScript function tennisDisplay() { if (scores.player >= 3 && scores.ai >= 3) { if (scores.player === scores.ai) return 'Deuce'; if (scores.player === scores.ai + 1) return 'Advantage Player'; if (scores.ai === scores.player + 1) return 'Advantage AI'; } return `Player: ${tennisSteps[Math.min(scores.player, 4)]} | AI: ${tennisSteps[Math.min(scores.ai, 4)]}`; } function updateScore(winner) { scores[winner]++; const diff = scores[winner] - scores[opponent(winner)]; if (scores[winner] >= 4 && diff >= 2) { alert(`${winner === 'player' ? 'Player' : 'AI'} wins the game!`); scores = { player: 0, ai: 0 }; } } function opponent(winner) { return winner === 'player' ? 'ai' : 'player'; } ``` -------------------------------- ### Release `codex` CLI: Commit Version Bump Source: https://github.com/ymichael/open-codex/blob/main/README.md This command commits the version bump changes for the `codex-cli` project, including the updated `session.ts` and `package.json` files. It uses a signed commit message that dynamically includes the new version number from `package.json`. ```bash git add codex-cli/src/utils/session.ts codex-cli/package.json git commit -s -m "chore(release): codex-cli v$(node -p \"require('./codex-cli/package.json').version\")" ``` -------------------------------- ### Game Rendering and Drawing Functions Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/impossible-pong/template/index.html Handles all drawing operations for the Pong game, including clearing the canvas, drawing court boundaries, paddles, the ball, and updating the score display. ```JavaScript function drawCourtBoundaries() { drawRect(0, 0, canvas.width, 4); // Top drawRect(0, canvas.height - 4, canvas.width, 4); // Bottom } function draw() { drawRect(0, 0, canvas.width, canvas.height, "#000"); drawCourtBoundaries(); drawRect(player.x, player.y, paddleWidth, paddleHeight); drawRect(ai.x, ai.y, paddleWidth, paddleHeight); drawCircle(ball.x, ball.y, ballRadius); scoreDisplay.textContent = tennisDisplay(); } ``` -------------------------------- ### Reset Ball Position and Velocity Source: https://github.com/ymichael/open-codex/blob/main/codex-cli/examples/impossible-pong/template/index.html Resets the ball's position to the center of the canvas and reinitializes its velocity based on the current difficulty setting, ensuring a random initial direction. ```JavaScript function resetBall() { ball.x = canvas.width / 2; ball.y = canvas.height / 2; let baseSpeed = difficulty === 'insane' ? 8 : 5; ball.vx = baseSpeed * (Math.random() > 0.5 ? 1 : -1); ball.vy = 3 * (Math.random() > 0.5 ? 1 : -1); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.