diff --git a/skills/.curated/develop-web-game/LICENSE.txt b/skills/.curated/develop-web-game/LICENSE.txt deleted file mode 100644 index 13e25df..0000000 --- a/skills/.curated/develop-web-game/LICENSE.txt +++ /dev/null @@ -1,201 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf of - any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don\'t include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/skills/.curated/develop-web-game/SKILL.md b/skills/.curated/develop-web-game/SKILL.md deleted file mode 100644 index 9d99aba..0000000 --- a/skills/.curated/develop-web-game/SKILL.md +++ /dev/null @@ -1,149 +0,0 @@ ---- -name: "develop-web-game" -description: "Use when Codex is building or iterating on a web game (HTML/JS) and needs a reliable development + testing loop: implement small changes, run a Playwright-based test script with short input bursts and intentional pauses, inspect screenshots/text, and review console errors with render_game_to_text." ---- - - -# Develop Web Game - -Build games in small steps and validate every change. Treat each iteration as: implement → act → pause → observe → adjust. - -## Skill paths (set once) - -```bash -export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}" -export WEB_GAME_CLIENT="$CODEX_HOME/skills/develop-web-game/scripts/web_game_playwright_client.js" -export WEB_GAME_ACTIONS="$CODEX_HOME/skills/develop-web-game/references/action_payloads.json" -``` - -User-scoped skills install under `$CODEX_HOME/skills` (default: `~/.codex/skills`). - -## Workflow - -1. **Pick a goal.** Define a single feature or behavior to implement. -2. **Implement small.** Make the smallest change that moves the game forward. -3. **Ensure integration points.** Provide a single canvas and `window.render_game_to_text` so the test loop can read state. -4. **Add `window.advanceTime(ms)`.** Strongly prefer a deterministic step hook so the Playwright script can advance frames reliably; without it, automated tests can be flaky. -5. **Initialize progress.md.** If `progress.md` exists, read it first and confirm the original user prompt is recorded at the top (prefix with `Original prompt:`). Also note any TODOs and suggestions left by the previous agent. If missing, create it and write `Original prompt: ` at the top before appending updates. -6. **Verify Playwright availability.** Ensure `playwright` is available (local dependency or global install). If unsure, check `npx` first. -7. **Run the Playwright test script.** You must run `$WEB_GAME_CLIENT` after each meaningful change; do not invent a new client unless required. -8. **Use the payload reference.** Base actions on `$WEB_GAME_ACTIONS` to avoid guessing keys. -9. **Inspect state.** Capture screenshots and text state after each burst. -10. **Inspect screenshots.** Open the latest screenshot, verify expected visuals, fix any issues, and rerun the script. Repeat until correct. -11. **Verify controls and state (multi-step focus).** Exhaustively exercise all important interactions. For each, think through the full multi-step sequence it implies (cause → intermediate states → outcome) and verify the entire chain works end-to-end. Confirm `render_game_to_text` reflects the same state shown on screen. If anything is off, fix and rerun. - Examples of important interactions: move, jump, shoot/attack, interact/use, select/confirm/cancel in menus, pause/resume, restart, and any special abilities or puzzle actions defined by the request. Multi-step examples: shooting an enemy should reduce its health; when health reaches 0 it should disappear and update the score; collecting a key should unlock a door and allow level progression. -12. **Check errors.** Review console errors and fix the first new issue before continuing. -13. **Reset between scenarios.** Avoid cross-test state when validating distinct features. -14. **Iterate with small deltas.** Change one variable at a time (frames, inputs, timing, positions), then repeat steps 7–13 until stable. - -Example command (actions required): -``` -node "$WEB_GAME_CLIENT" --url http://localhost:5173 --actions-file "$WEB_GAME_ACTIONS" --click-selector "#start-btn" --iterations 3 --pause-ms 250 -``` - -Example actions (inline JSON): -```json -{ - "steps": [ - { "buttons": ["left_mouse_button"], "frames": 2, "mouse_x": 120, "mouse_y": 80 }, - { "buttons": [], "frames": 6 }, - { "buttons": ["right"], "frames": 8 }, - { "buttons": ["space"], "frames": 4 } - ] -} -``` - -## Test Checklist - -Test any new features added for the request and any areas your logic changes could affect. Identify issues, fix them, and re-run the tests to confirm they’re resolved. - -Examples of things to test: -- Primary movement/interaction inputs (e.g., move, jump, shoot, confirm/select). -- Win/lose or success/fail transitions. -- Score/health/resource changes. -- Boundary conditions (collisions, walls, screen edges). -- Menu/pause/start flow if present. -- Any special actions tied to the request (powerups, combos, abilities, puzzles, timers). - -## Test Artifacts to Review - -- Latest screenshots from the Playwright run. -- Latest `render_game_to_text` JSON output. -- Console error logs (fix the first new error before continuing). -You must actually open and visually inspect the latest screenshots after running the Playwright script, not just generate them. Ensure everything that should be visible on screen is actually visible. Go beyond the start screen and capture gameplay screenshots that cover all newly added features. Treat the screenshots as the source of truth; if something is missing, it is missing in the build. If you suspect a headless/WebGL capture issue, rerun the Playwright script in headed mode and re-check. Fix and rerun in a tight loop until the screenshots and text state look correct. Once fixes are verified, re-test all important interactions and controls, confirm they work, and ensure your changes did not introduce regressions. If they did, fix them and rerun everything in a loop until interactions, text state, and controls all work as expected. Be exhaustive in testing controls; broken games are not acceptable. - -## Core Game Guidelines - -### Canvas + Layout -- Prefer a single canvas centered in the window. - -### Visuals -- Keep on-screen text minimal; show controls on a start/menu screen rather than overlaying them during play. -- Avoid overly dark scenes unless the design calls for it. Make key elements easy to see. -- Draw the background on the canvas itself instead of relying on CSS backgrounds. - -### Text State Output (render_game_to_text) -Expose a `window.render_game_to_text` function that returns a concise JSON string representing the current game state. The text should include enough information to play the game without visuals. - -Minimal pattern: -```js -function renderGameToText() { - const payload = { - mode: state.mode, - player: { x: state.player.x, y: state.player.y, r: state.player.r }, - entities: state.entities.map((e) => ({ x: e.x, y: e.y, r: e.r })), - score: state.score, - }; - return JSON.stringify(payload); -} -window.render_game_to_text = renderGameToText; -``` - -Keep the payload succinct and biased toward on-screen/interactive elements. Prefer current, visible entities over full history. -Include a clear coordinate system note (origin and axis directions), and encode all player-relevant state: player position/velocity, active obstacles/enemies, collectibles, timers/cooldowns, score, and any mode/state flags needed to make correct decisions. Avoid large histories; only include what's currently relevant and visible. - -### Time Stepping Hook -Provide a deterministic time-stepping hook so the Playwright client can advance the game in controlled increments. Expose `window.advanceTime(ms)` (or a thin wrapper that forwards to your game update loop) and have the game loop use it when present. -The Playwright test script uses this hook to step frames deterministically during automated testing. - -Minimal pattern: -```js -window.advanceTime = (ms) => { - const steps = Math.max(1, Math.round(ms / (1000 / 60))); - for (let i = 0; i < steps; i++) update(1 / 60); - render(); -}; -``` - -### Fullscreen Toggle -- Use a single key (prefer `f`) to toggle fullscreen on/off. -- Allow `Esc` to exit fullscreen. -- When fullscreen toggles, resize the canvas/rendering so visuals and input mapping stay correct. - -## Progress Tracking - -Create a `progress.md` file if it doesn't exist, and append TODOs, notes, gotchas, and loose ends as you go so another agent can pick up seamlessly. -If a `progress.md` file already exists, read it first, including the original user prompt at the top (you may be continuing another agent's work). Do not overwrite the original prompt; preserve it. -Update `progress.md` after each meaningful chunk of work (feature added, bug found, test run, or decision made). -At the end of your work, leave TODOs and suggestions for the next agent in `progress.md`. - -## Playwright Prerequisites - -- Prefer a local `playwright` dependency if the project already has it. -- If unsure whether Playwright is available, check for `npx`: - ``` - command -v npx >/dev/null 2>&1 - ``` -- If `npx` is missing, install Node/npm and then install Playwright globally: - ``` - npm install -g @playwright/mcp@latest - ``` -- Do not switch to `@playwright/test` unless explicitly asked; stick to the client script. - -## Scripts - -- `$WEB_GAME_CLIENT` (installed default: `$CODEX_HOME/skills/develop-web-game/scripts/web_game_playwright_client.js`) — Playwright-based action loop with virtual-time stepping, screenshot capture, and console error buffering. You must pass an action burst via `--actions-file`, `--actions-json`, or `--click`. - -## References - -- `$WEB_GAME_ACTIONS` (installed default: `$CODEX_HOME/skills/develop-web-game/references/action_payloads.json`) — example action payloads (keyboard + mouse, per-frame capture). Use these to build your burst. diff --git a/skills/.curated/develop-web-game/agents/openai.yaml b/skills/.curated/develop-web-game/agents/openai.yaml deleted file mode 100644 index 8a9f2f5..0000000 --- a/skills/.curated/develop-web-game/agents/openai.yaml +++ /dev/null @@ -1,6 +0,0 @@ -interface: - display_name: "Develop Web Game" - short_description: "Web game dev + Playwright test loop" - icon_small: "./assets/game-small.svg" - icon_large: "./assets/game.png" - default_prompt: "Build and iterate a playable web game in this workspace, validating changes with a Playwright loop." diff --git a/skills/.curated/develop-web-game/assets/game-small.svg b/skills/.curated/develop-web-game/assets/game-small.svg deleted file mode 100644 index 43828b7..0000000 --- a/skills/.curated/develop-web-game/assets/game-small.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/skills/.curated/develop-web-game/assets/game.png b/skills/.curated/develop-web-game/assets/game.png deleted file mode 100644 index 53e0b9e..0000000 Binary files a/skills/.curated/develop-web-game/assets/game.png and /dev/null differ diff --git a/skills/.curated/develop-web-game/references/action_payloads.json b/skills/.curated/develop-web-game/references/action_payloads.json deleted file mode 100644 index c10007d..0000000 --- a/skills/.curated/develop-web-game/references/action_payloads.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "steps": [ - { "buttons": ["left"], "frames": 6 }, - { "buttons": [], "frames": 4 }, - { "buttons": ["space"], "frames": 3 } - ] -} diff --git a/skills/.curated/develop-web-game/scripts/web_game_playwright_client.js b/skills/.curated/develop-web-game/scripts/web_game_playwright_client.js deleted file mode 100644 index ffed8ec..0000000 --- a/skills/.curated/develop-web-game/scripts/web_game_playwright_client.js +++ /dev/null @@ -1,356 +0,0 @@ -import fs from "node:fs"; -import path from "node:path"; -import { chromium } from "playwright"; - -function parseArgs(argv) { - const args = { - url: null, - iterations: 3, - pauseMs: 250, - headless: true, - screenshotDir: "output/web-game", - actionsFile: null, - actionsJson: null, - click: null, - clickSelector: null, - }; - for (let i = 2; i < argv.length; i++) { - const arg = argv[i]; - const next = argv[i + 1]; - if (arg === "--url" && next) { - args.url = next; - i++; - } else if (arg === "--iterations" && next) { - args.iterations = parseInt(next, 10); - i++; - } else if (arg === "--pause-ms" && next) { - args.pauseMs = parseInt(next, 10); - i++; - } else if (arg === "--headless" && next) { - args.headless = next !== "0" && next !== "false"; - i++; - } else if (arg === "--screenshot-dir" && next) { - args.screenshotDir = next; - i++; - } else if (arg === "--actions-file" && next) { - args.actionsFile = next; - i++; - } else if (arg === "--actions-json" && next) { - args.actionsJson = next; - i++; - } else if (arg === "--click" && next) { - const parts = next.split(",").map((v) => parseFloat(v.trim())); - if (parts.length === 2 && parts.every((v) => Number.isFinite(v))) { - args.click = { x: parts[0], y: parts[1] }; - } - i++; - } else if (arg === "--click-selector" && next) { - args.clickSelector = next; - i++; - } - } - if (!args.url) { - throw new Error("--url is required"); - } - return args; -} - -const buttonNameToKey = { - up: "ArrowUp", - down: "ArrowDown", - left: "ArrowLeft", - right: "ArrowRight", - enter: "Enter", - space: "Space", - a: "KeyA", - b: "KeyB", -}; - -async function sleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} - -function ensureDir(p) { - fs.mkdirSync(p, { recursive: true }); -} - -function makeVirtualTimeShim() { - return `(() => { - const pending = new Set(); - const origSetTimeout = window.setTimeout.bind(window); - const origSetInterval = window.setInterval.bind(window); - const origRequestAnimationFrame = window.requestAnimationFrame.bind(window); - - window.__vt_pending = pending; - - window.setTimeout = (fn, t, ...rest) => { - const task = {}; - pending.add(task); - return origSetTimeout(() => { - pending.delete(task); - fn(...rest); - }, t); - }; - - window.setInterval = (fn, t, ...rest) => { - const task = {}; - pending.add(task); - return origSetInterval(() => { - fn(...rest); - }, t); - }; - - window.requestAnimationFrame = (fn) => { - const task = {}; - pending.add(task); - return origRequestAnimationFrame((ts) => { - pending.delete(task); - fn(ts); - }); - }; - - window.advanceTime = (ms) => { - return new Promise((resolve) => { - const start = performance.now(); - function step(now) { - if (now - start >= ms) return resolve(); - origRequestAnimationFrame(step); - } - origRequestAnimationFrame(step); - }); - }; - - window.__drainVirtualTimePending = () => pending.size; - })();`; -} - -async function getCanvasHandle(page) { - const handle = await page.evaluateHandle(() => { - let best = null; - let bestArea = 0; - for (const canvas of document.querySelectorAll("canvas")) { - const area = (canvas.width || canvas.clientWidth || 0) * (canvas.height || canvas.clientHeight || 0); - if (area > bestArea) { - bestArea = area; - best = canvas; - } - } - return best; - }); - return handle.asElement(); -} - -async function captureCanvasPngBase64(canvas) { - return canvas.evaluate((c) => { - if (!c || typeof c.toDataURL !== "function") return ""; - const data = c.toDataURL("image/png"); - const idx = data.indexOf(","); - return idx === -1 ? "" : data.slice(idx + 1); - }); -} - -async function isCanvasTransparent(canvas) { - if (!canvas) return true; - return canvas.evaluate((c) => { - try { - const w = c.width || c.clientWidth || 0; - const h = c.height || c.clientHeight || 0; - if (!w || !h) return true; - const size = Math.max(1, Math.min(16, w, h)); - const probe = document.createElement("canvas"); - probe.width = size; - probe.height = size; - const ctx = probe.getContext("2d"); - if (!ctx) return true; - ctx.drawImage(c, 0, 0, size, size); - const data = ctx.getImageData(0, 0, size, size).data; - for (let i = 3; i < data.length; i += 4) { - if (data[i] !== 0) return false; - } - return true; - } catch { - return false; - } - }); -} - -async function captureScreenshot(page, canvas, outPath) { - let buffer = null; - let base64 = canvas ? await captureCanvasPngBase64(canvas) : ""; - if (base64) { - buffer = Buffer.from(base64, "base64"); - const transparent = canvas ? await isCanvasTransparent(canvas) : false; - if (transparent) buffer = null; - } - if (!buffer && canvas) { - try { - buffer = await canvas.screenshot({ type: "png" }); - } catch { - buffer = null; - } - } - if (!buffer) { - const bbox = canvas ? await canvas.boundingBox() : null; - if (bbox) { - buffer = await page.screenshot({ - type: "png", - omitBackground: false, - clip: bbox, - }); - } else { - buffer = await page.screenshot({ type: "png", omitBackground: false }); - } - } - fs.writeFileSync(outPath, buffer); -} - -class ConsoleErrorTracker { - constructor() { - this._seen = new Set(); - this._errors = []; - } - - ingest(err) { - const key = JSON.stringify(err); - if (this._seen.has(key)) return; - this._seen.add(key); - this._errors.push(err); - } - - drain() { - const next = [...this._errors]; - this._errors = []; - return next; - } -} - -async function doChoreography(page, canvas, steps) { - for (const step of steps) { - const buttons = new Set(step.buttons || []); - for (const button of buttons) { - if (button === "left_mouse_button" || button === "right_mouse_button") { - const bbox = canvas ? await canvas.boundingBox() : null; - if (!bbox) continue; - const x = typeof step.mouse_x === "number" ? step.mouse_x : bbox.width / 2; - const y = typeof step.mouse_y === "number" ? step.mouse_y : bbox.height / 2; - await page.mouse.move(bbox.x + x, bbox.y + y); - await page.mouse.down({ button: button === "left_mouse_button" ? "left" : "right" }); - } else if (buttonNameToKey[button]) { - await page.keyboard.down(buttonNameToKey[button]); - } - } - - const frames = step.frames || 1; - for (let i = 0; i < frames; i++) { - await page.evaluate(async () => { - if (typeof window.advanceTime === "function") { - await window.advanceTime(1000 / 60); - } - }); - } - - for (const button of buttons) { - if (button === "left_mouse_button" || button === "right_mouse_button") { - await page.mouse.up({ button: button === "left_mouse_button" ? "left" : "right" }); - } else if (buttonNameToKey[button]) { - await page.keyboard.up(buttonNameToKey[button]); - } - } - } -} - -async function main() { - const args = parseArgs(process.argv); - ensureDir(args.screenshotDir); - - const browser = await chromium.launch({ - headless: args.headless, - args: ["--use-gl=angle", "--use-angle=swiftshader"], - }); - const page = await browser.newPage(); - const consoleErrors = new ConsoleErrorTracker(); - - page.on("console", (msg) => { - if (msg.type() !== "error") return; - consoleErrors.ingest({ type: "console.error", text: msg.text() }); - }); - page.on("pageerror", (err) => { - consoleErrors.ingest({ type: "pageerror", text: String(err) }); - }); - - await page.addInitScript({ content: makeVirtualTimeShim() }); - await page.goto(args.url, { waitUntil: "domcontentloaded" }); - await page.waitForTimeout(500); - await page.evaluate(() => { - window.dispatchEvent(new Event("resize")); - }); - - let canvas = await getCanvasHandle(page); - - if (args.clickSelector) { - try { - await page.click(args.clickSelector, { timeout: 5000 }); - await page.waitForTimeout(250); - } catch (err) { - console.warn("Failed to click selector", args.clickSelector, err); - } - } - let steps = null; - if (args.actionsFile) { - const raw = fs.readFileSync(args.actionsFile, "utf-8"); - const parsed = JSON.parse(raw); - if (Array.isArray(parsed)) steps = parsed; - if (parsed && Array.isArray(parsed.steps)) steps = parsed.steps; - } else if (args.actionsJson) { - const parsed = JSON.parse(args.actionsJson); - if (Array.isArray(parsed)) steps = parsed; - if (parsed && Array.isArray(parsed.steps)) steps = parsed.steps; - } else if (args.click) { - steps = [ - { - buttons: ["left_mouse_button"], - frames: 2, - mouse_x: args.click.x, - mouse_y: args.click.y, - }, - ]; - } - if (!steps) { - throw new Error("Actions are required. Use --actions-file, --actions-json, or --click."); - } - - for (let i = 0; i < args.iterations; i++) { - if (!canvas) canvas = await getCanvasHandle(page); - await doChoreography(page, canvas, steps); - await sleep(args.pauseMs); - - const shotPath = path.join(args.screenshotDir, `shot-${i}.png`); - await captureScreenshot(page, canvas, shotPath); - - const text = await page.evaluate(() => { - if (typeof window.render_game_to_text === "function") { - return window.render_game_to_text(); - } - return null; - }); - if (text) { - fs.writeFileSync(path.join(args.screenshotDir, `state-${i}.json`), text); - } - - const freshErrors = consoleErrors.drain(); - if (freshErrors.length) { - fs.writeFileSync( - path.join(args.screenshotDir, `errors-${i}.json`), - JSON.stringify(freshErrors, null, 2) - ); - break; - } - } - - await browser.close(); -} - -main().catch((err) => { - console.error(err); - process.exit(1); -}); diff --git a/skills/.curated/frontend-skill/LICENSE.txt b/skills/.curated/frontend-skill/LICENSE.txt deleted file mode 100644 index b20752a..0000000 --- a/skills/.curated/frontend-skill/LICENSE.txt +++ /dev/null @@ -1,201 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf of - any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/skills/.curated/frontend-skill/SKILL.md b/skills/.curated/frontend-skill/SKILL.md deleted file mode 100644 index 0ced5cf..0000000 --- a/skills/.curated/frontend-skill/SKILL.md +++ /dev/null @@ -1,184 +0,0 @@ ---- -name: frontend-skill -description: Use when the task asks for a visually strong landing page, website, app, prototype, demo, or game UI. This skill enforces restrained composition, image-led hierarchy, cohesive content structure, and tasteful motion while avoiding generic cards, weak branding, and UI clutter. ---- - -# Frontend Skill - -Use this skill when the quality of the work depends on art direction, hierarchy, restraint, imagery, and motion rather than component count. - -Goal: ship interfaces that feel deliberate, premium, and current. Default toward award-level composition: one big idea, strong imagery, sparse copy, rigorous spacing, and a small number of memorable motions. - -## Working Model - -Before building, write three things: - -- visual thesis: one sentence describing mood, material, and energy -- content plan: hero, support, detail, final CTA -- interaction thesis: 2-3 motion ideas that change the feel of the page - -Each section gets one job, one dominant visual idea, and one primary takeaway or action. - -## Beautiful Defaults - -- Start with composition, not components. -- Prefer a full-bleed hero or full-canvas visual anchor. -- Make the brand or product name the loudest text. -- Keep copy short enough to scan in seconds. -- Use whitespace, alignment, scale, cropping, and contrast before adding chrome. -- Limit the system: two typefaces max, one accent color by default. -- Default to cardless layouts. Use sections, columns, dividers, lists, and media blocks instead. -- Treat the first viewport as a poster, not a document. - -## Landing Pages - -Default sequence: - -1. Hero: brand or product, promise, CTA, and one dominant visual -2. Support: one concrete feature, offer, or proof point -3. Detail: atmosphere, workflow, product depth, or story -4. Final CTA: convert, start, visit, or contact - -Hero rules: - -- One composition only. -- Full-bleed image or dominant visual plane. -- Canonical full-bleed rule: on branded landing pages, the hero itself must run edge-to-edge with no inherited page gutters, framed container, or shared max-width; constrain only the inner text/action column. -- Brand first, headline second, body third, CTA fourth. -- No hero cards, stat strips, logo clouds, pill soup, or floating dashboards by default. -- Keep headlines to roughly 2-3 lines on desktop and readable in one glance on mobile. -- Keep the text column narrow and anchored to a calm area of the image. -- All text over imagery must maintain strong contrast and clear tap targets. - -If the first viewport still works after removing the image, the image is too weak. If the brand disappears after hiding the nav, the hierarchy is too weak. - -Viewport budget: - -- If the first screen includes a sticky/fixed header, that header counts against the hero. The combined header + hero content must fit within the initial viewport at common desktop and mobile sizes. -- When using `100vh`/`100svh` heroes, subtract persistent UI chrome (`calc(100svh - header-height)`) or overlay the header instead of stacking it in normal flow. - -## Apps - -Default to Linear-style restraint: - -- calm surface hierarchy -- strong typography and spacing -- few colors -- dense but readable information -- minimal chrome -- cards only when the card is the interaction - -For app UI, organize around: - -- primary workspace -- navigation -- secondary context or inspector -- one clear accent for action or state - -Avoid: - -- dashboard-card mosaics -- thick borders on every region -- decorative gradients behind routine product UI -- multiple competing accent colors -- ornamental icons that do not improve scanning - -If a panel can become plain layout without losing meaning, remove the card treatment. - -## Imagery - -Imagery must do narrative work. - -- Use at least one strong, real-looking image for brands, venues, editorial pages, and lifestyle products. -- Prefer in-situ photography over abstract gradients or fake 3D objects. -- Choose or crop images with a stable tonal area for text. -- Do not use images with embedded signage, logos, or typographic clutter fighting the UI. -- Do not generate images with built-in UI frames, splits, cards, or panels. -- If multiple moments are needed, use multiple images, not one collage. - -The first viewport needs a real visual anchor. Decorative texture is not enough. - -## Copy - -- Write in product language, not design commentary. -- Let the headline carry the meaning. -- Supporting copy should usually be one short sentence. -- Cut repetition between sections. -- Do not include prompt language or design commentary into the UI. -- Give every section one responsibility: explain, prove, deepen, or convert. - -If deleting 30 percent of the copy improves the page, keep deleting. - -## Utility Copy For Product UI - -When the work is a dashboard, app surface, admin tool, or operational workspace, default to utility copy over marketing copy. - -- Prioritize orientation, status, and action over promise, mood, or brand voice. -- Start with the working surface itself: KPIs, charts, filters, tables, status, or task context. Do not introduce a hero section unless the user explicitly asks for one. -- Section headings should say what the area is or what the user can do there. -- Good: "Selected KPIs", "Plan status", "Search metrics", "Top segments", "Last sync". -- Avoid aspirational hero lines, metaphors, campaign-style language, and executive-summary banners on product surfaces unless specifically requested. -- Supporting text should explain scope, behavior, freshness, or decision value in one sentence. -- If a sentence could appear in a homepage hero or ad, rewrite it until it sounds like product UI. -- If a section does not help someone operate, monitor, or decide, remove it. -- Litmus check: if an operator scans only headings, labels, and numbers, can they understand the page immediately? - -## Motion - -Use motion to create presence and hierarchy, not noise. - -Ship at least 2-3 intentional motions for visually led work: - -- one entrance sequence in the hero -- one scroll-linked, sticky, or depth effect -- one hover, reveal, or layout transition that sharpens affordance - -Prefer Framer Motion when available for: - -- section reveals -- shared layout transitions -- scroll-linked opacity, translate, or scale shifts -- sticky storytelling -- carousels that advance narrative, not just fill space -- menus, drawers, and modal presence effects - -Motion rules: - -- noticeable in a quick recording -- smooth on mobile -- fast and restrained -- consistent across the page -- removed if ornamental only - -## Hard Rules - -- No cards by default. -- No hero cards by default. -- No boxed or center-column hero when the brief calls for full bleed. -- No more than one dominant idea per section. -- No section should need many tiny UI devices to explain itself. -- No headline should overpower the brand on branded pages. -- No filler copy. -- No split-screen hero unless text sits on a calm, unified side. -- No more than two typefaces without a clear reason. -- No more than one accent color unless the product already has a strong system. - -## Reject These Failures - -- Generic SaaS card grid as the first impression -- Beautiful image with weak brand presence -- Strong headline with no clear action -- Busy imagery behind text -- Sections that repeat the same mood statement -- Carousel with no narrative purpose -- App UI made of stacked cards instead of layout - -## Litmus Checks - -- Is the brand or product unmistakable in the first screen? -- Is there one strong visual anchor? -- Can the page be understood by scanning headlines only? -- Does each section have one job? -- Are cards actually necessary? -- Does motion improve hierarchy or atmosphere? -- Would the design still feel premium if all decorative shadows were removed? diff --git a/skills/.curated/frontend-skill/agents/openai.yaml b/skills/.curated/frontend-skill/agents/openai.yaml deleted file mode 100644 index ddafd94..0000000 --- a/skills/.curated/frontend-skill/agents/openai.yaml +++ /dev/null @@ -1,4 +0,0 @@ -interface: - display_name: "Frontend Skill" - short_description: "Design visually strong landing pages, websites, apps, and UI" - default_prompt: "Use $frontend-skill to establish a visual thesis, content plan, and interaction thesis before building a visually strong landing page, website, app, prototype, demo, or game UI."