[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JZ548282CBBAQBAJ8HNPG2":3,"skill-same:01M6JZ548282CBBAQBAJ8HNPG2":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":13,"repositoryHtmlUrl":45,"repositoryHomepageUrl":46,"ownerHtmlUrl":47,"ownerBlogUrl":46,"ownerDescription":6,"updatedAt":48,"install":49,"resources":62},"01M6JZ548282CBBAQBAJ8HNPG2","oauth-provider",null,"Add a new OAuth\u002FOIDC identity provider to MUDdown. Covers the shared type, auth switch statements, server config, login page button, env vars, tests, and local verification.","MUDdown\u002FMUDdown","MUDdown","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F271809841?v=4","01M6JZ2ZZ19Z0NRQS2YHZ57AHZ","01M6JZ303FSH41JFNGAAJSQGDN",2,"MIT","https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Foauth-provider\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],"provider","oauth provider","OAuth","verification","server","env vars","identity","oidc","page","auth","switch","local","shared","tests","type","env","add","login","config","2026-11-10 10:12:30",false,"---\nname: oauth-provider\ndescription: Add a new OAuth\u002FOIDC identity provider to MUDdown. Covers the shared type, auth switch statements, server config, login page button, env vars, tests, and local verification.\n---\n\n# OAuth Provider Skill\n\nYou are adding a new OAuth or OIDC identity provider to MUDdown. This is a multi-file change that touches shared types, server auth logic, server startup config, the login page, env files, and tests.\n\n## Files to Modify (in order)\n\n### 1. `packages\u002Fshared\u002Fsrc\u002Findex.ts` — Register the provider\n\nAdd the new provider string to the `OAUTH_PROVIDERS` tuple so it is included in the shared provider type and validation guard. This tuple does **not** control the login-button display order; update `apps\u002Fwebsite\u002Fsrc\u002Fpages\u002Flogin.astro` separately if you need to change the UI order.\n\n```typescript\nexport const OAUTH_PROVIDERS = [\"discord\", \"github\", \"microsoft\", \"google\"] as const;\n```\n\nThe `OAuthProvider` type and `isOAuthProvider()` guard derive from this array automatically — no other changes needed in shared.\n\n### 2. `packages\u002Fserver\u002Fsrc\u002Fauth.ts` — Implement the three protocol functions\n\nAdd a `case` for the new provider in **all three** switch statements. Each uses `assertNever(provider)` as the default, so the build will fail if any switch is missed.\n\n| Function | Purpose | Key details |\n|----------|---------|-------------|\n| `buildAuthorizeUrl()` | Construct the OAuth authorize redirect URL | Set `scope`, `response_type`, `client_id`, `redirect_uri`, `state` |\n| `exchangeCodeForToken()` | Exchange the authorization code for an access token | Know whether the provider expects JSON or `application\u002Fx-www-form-urlencoded` |\n| `fetchProviderUser()` | Fetch the authenticated user's profile | Map provider fields to `{ providerId, username, displayName }` |\n\n**Common pitfalls:**\n- Discord's token endpoint requires `Content-Type: application\u002Fx-www-form-urlencoded` with a `URLSearchParams` body (not JSON).\n- Some providers return the user ID as a number (GitHub), others as a string (Discord snowflake). Always convert to `String()`.\n- The `displayName` field should use the provider's \"friendly name\" field (e.g., Discord `global_name`, GitHub `name`, Microsoft `displayName`).\n\n### 3. `packages\u002Fserver\u002Fsrc\u002Findex.ts` — Wire up provider config\n\nAdd a `buildProviderConfig()` call for the new provider's env vars, following the existing pattern:\n\n```typescript\nconst exampleCfg = buildProviderConfig(\"EXAMPLE_CLIENT_ID\", \"EXAMPLE_CLIENT_SECRET\", \"EXAMPLE_CALLBACK_URL\");\nif (exampleCfg) oauthConfig.example = exampleCfg;\n```\n\nAlso add a callback-URL warning in the `if (exampleCfg && !process.env.EXAMPLE_CALLBACK_URL)` block.\n\n### 4. `apps\u002Fwebsite\u002Fsrc\u002Fpages\u002Flogin.astro` — Add the login button\n\nAdd a new `\u003Cbutton>` in the provider list with the provider's brand SVG icon. Register it in the `providerButtons` record in the `\u003Cscript>` block. The `\u002Fauth\u002Fproviders` endpoint controls provider availability; providers not returned are rendered disabled and dimmed unless you also update `login.astro` to remove them from the rendered list.\n\n### 5. `packages\u002Fserver\u002F.env.example` — Document env vars\n\nAdd the three new env vars (this is the canonical env example file):\n\n```\nEXAMPLE_CLIENT_ID=\nEXAMPLE_CLIENT_SECRET=\nEXAMPLE_CALLBACK_URL=https:\u002F\u002Fyour-domain.com\u002Fauth\u002Fcallback\n```\n\n### 6. Tests to update\n\n| File | What to change |\n|------|---------------|\n| `packages\u002Fserver\u002Ftests\u002Fauth-handlers.test.ts` | Add provider to `allProviders` config object; add a redirect URL assertion test |\n| `packages\u002Fserver\u002Ftests\u002Fshared-guards.test.ts` | Remove new provider from \"rejects unknown provider strings\" if it was listed there |\n\n## OAuth Provider Registration\n\nEach provider has a developer portal where you register the application:\n\n- **Redirect URI**: Register both `http:\u002F\u002Flocalhost:3300\u002Fauth\u002Fcallback` (dev) and `https:\u002F\u002Fyour-domain.com\u002Fauth\u002Fcallback` (prod). The server sends `redirect_uri` in the authorize request and it must exactly match a registered URI.\n- **Scopes**: Request the minimum scope needed for login (e.g., Discord `identify`, GitHub `read:user`, Google `openid profile email`).\n- **Bot permissions**: Not needed — the app only uses OAuth for user identity, not API access.\n\n## Local Verification Checklist\n\nAfter implementation:\n\n1. `npx turbo run build` — confirms `assertNever` exhaustiveness (build fails if a switch is missed)\n2. `npx turbo run test` — confirms shared guards and auth handler tests pass\n3. **Restart the dev server** — a running `node dist\u002Findex.js` serves the old build; kill and restart it\n4. `curl -s http:\u002F\u002Flocalhost:3300\u002Fauth\u002Fproviders` — confirm the new provider appears in the JSON array\n5. Load `http:\u002F\u002Flocalhost:4321\u002Flogin` — confirm the button renders and is clickable\n6. Click the button — confirm it redirects to the provider's authorize page with the correct `redirect_uri`\n\n> **Important**: The dev server (`node dist\u002Findex.js`) does not hot-reload. After `npx turbo run build`, you must kill and restart the server process for changes to take effect. The Astro dev server (`npm run dev`) *does* hot-reload.\n","# OAuth Provider Skill\n\nYou are adding a new OAuth or OIDC identity provider to MUDdown. This is a multi-file change that touches shared types, server auth logic, server startup config, the login page, env files, and tests.\n\n## Files to Modify (in order)\n\n### 1. `packages\u002Fshared\u002Fsrc\u002Findex.ts` — Register the provider\n\nAdd the new provider string to the `OAUTH_PROVIDERS` tuple so it is included in the shared provider type and validation guard. This tuple does **not** control the login-button display order; update `apps\u002Fwebsite\u002Fsrc\u002Fpages\u002Flogin.astro` separately if you need to change the UI order.\n\n```typescript\nexport const OAUTH_PROVIDERS = [\"discord\", \"github\", \"microsoft\", \"google\"] as const;\n```\n\nThe `OAuthProvider` type and `isOAuthProvider()` guard derive from this array automatically — no other changes needed in shared.\n\n### 2. `packages\u002Fserver\u002Fsrc\u002Fauth.ts` — Implement the three protocol functions\n\nAdd a `case` for the new provider in **all three** switch statements. Each uses `assertNever(provider)` as the default, so the build will fail if any switch is missed.\n\n| Function | Purpose | Key details |\n|----------|---------|-------------|\n| `buildAuthorizeUrl()` | Construct the OAuth authorize redirect URL | Set `scope`, `response_type`, `client_id`, `redirect_uri`, `state` |\n| `exchangeCodeForToken()` | Exchange the authorization code for an access token | Know whether the provider expects JSON or `application\u002Fx-www-form-urlencoded` |\n| `fetchProviderUser()` | Fetch the authenticated user's profile | Map provider fields to `{ providerId, username, displayName }` |\n\n**Common pitfalls:**\n- Discord's token endpoint requires `Content-Type: application\u002Fx-www-form-urlencoded` with a `URLSearchParams` body (not JSON).\n- Some providers return the user ID as a number (GitHub), others as a string (Discord snowflake). Always convert to `String()`.\n- The `displayName` field should use the provider's \"friendly name\" field (e.g., Discord `global_name`, GitHub `name`, Microsoft `displayName`).\n\n### 3. `packages\u002Fserver\u002Fsrc\u002Findex.ts` — Wire up provider config\n\nAdd a `buildProviderConfig()` call for the new provider's env vars, following the existing pattern:\n\n```typescript\nconst exampleCfg = buildProviderConfig(\"EXAMPLE_CLIENT_ID\", \"EXAMPLE_CLIENT_SECRET\", \"EXAMPLE_CALLBACK_URL\");\nif (exampleCfg) oauthConfig.example = exampleCfg;\n```\n\nAlso add a callback-URL warning in the `if (exampleCfg && !process.env.EXAMPLE_CALLBACK_URL)` block.\n\n### 4. `apps\u002Fwebsite\u002Fsrc\u002Fpages\u002Flogin.astro` — Add the login button\n\nAdd a new `\u003Cbutton>` in the provider list with the provider's brand SVG icon. Register it in the `providerButtons` record in the `\u003Cscript>` block. The `\u002Fauth\u002Fproviders` endpoint controls provider availability; providers not returned are rendered disabled and dimmed unless you also update `login.astro` to remove them from the rendered list.\n\n### 5. `packages\u002Fserver\u002F.env.example` — Document env vars\n\nAdd the three new env vars (this is the canonical env example file):\n\n```\nEXAMPLE_CLIENT_ID=\nEXAMPLE_CLIENT_SECRET=\nEXAMPLE_CALLBACK_URL=https:\u002F\u002Fyour-domain.com\u002Fauth\u002Fcallback\n```\n\n### 6. Tests to update\n\n| File | What to change |\n|------|---------------|\n| `packages\u002Fserver\u002Ftests\u002Fauth-handlers.test.ts` | Add provider to `allProviders` config object; add a redirect URL assertion test |\n| `packages\u002Fserver\u002Ftests\u002Fshared-guards.test.ts` | Remove new provider from \"rejects unknown provider strings\" if it was listed there |\n\n## OAuth Provider Registration\n\nEach provider has a developer portal where you register the application:\n\n- **Redirect URI**: Register both `http:\u002F\u002Flocalhost:3300\u002Fauth\u002Fcallback` (dev) and `https:\u002F\u002Fyour-domain.com\u002Fauth\u002Fcallback` (prod). The server sends `redirect_uri` in the authorize request and it must exactly match a registered URI.\n- **Scopes**: Request the minimum scope needed for login (e.g., Discord `identify`, GitHub `read:user`, Google `openid profile email`).\n- **Bot permissions**: Not needed — the app only uses OAuth for user identity, not API access.\n\n## Local Verification Checklist\n\nAfter implementation:\n\n1. `npx turbo run build` — confirms `assertNever` exhaustiveness (build fails if a switch is missed)\n2. `npx turbo run test` — confirms shared guards and auth handler tests pass\n3. **Restart the dev server** — a running `node dist\u002Findex.js` serves the old build; kill and restart it\n4. `curl -s http:\u002F\u002Flocalhost:3300\u002Fauth\u002Fproviders` — confirm the new provider appears in the JSON array\n5. Load `http:\u002F\u002Flocalhost:4321\u002Flogin` — confirm the button renders and is clickable\n6. Click the button — confirm it redirects to the provider's authorize page with the correct `redirect_uri`\n\n> **Important**: The dev server (`node dist\u002Findex.js`) does not hot-reload. After `npx turbo run build`, you must kill and restart the server process for changes to take effect. The Astro dev server (`npm run dev`) *does* hot-reload.\n",{"name":5,"description":7},"main","003024ca8f1bd677ce1cf158084703aa98867375",".github\u002Fskills\u002Foauth-provider","https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown","https:\u002F\u002Fwww.muddown.com","https:\u002F\u002Fgithub.com\u002FMUDdown","2026-08-06 08:37:36",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add MUDdown\u002FMUDdown --skill oauth-provider",{"tool":55,"command":56},"bunx","bunx skills add MUDdown\u002FMUDdown --skill oauth-provider",{"tool":58,"command":59},"pnpm","pnpm dlx skills add MUDdown\u002FMUDdown --skill oauth-provider","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Foauth-provider\u002FSKILL.md",true,[],[64,82,102,118,139,161],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":37},"01M6JZ5NT4RRHMMEDQTJE0BQFK","testing","Write and maintain tests for MUDdown packages. Covers vitest for the server and parser, fixture helpers, world integrity tests, and testing conventions.","https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftesting\u002FSKILL.md",[],[66,71,72,31,73,74,75,76,77,78,79,80,22,81],"integrity","for","testing conventions","fixture","conventions","world","maintain","write","parser","vitest","packages",{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":37},"01M6JZ5JM4ZZHTZ2S93S00GCKY","room-creation","Create and modify MUDdown room files. Covers the Markdown+YAML structure, frontmatter fields, container blocks, bidirectional exits, item\u002FNPC references, lighting, and region organization.","https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Froom-creation\u002FSKILL.md",[],[89,90,91,92,93,94,95,96,97,98,99,100,101],"creation","room creation","markdown","yaml","create","organization","container","frontmatter","blocks","lighting","structure","references","files",{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":37},"01M6JZ5FHRMJ7DFRWS3H3TQY6Y","privacy","Audit and maintain privacy compliance for MUDdown. Covers the privacy policy, data collection practices, cookie\u002Fstorage usage, and compliance testing.","https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fprivacy\u002FSKILL.md",[],[104,77,72,109,110,111,112,113,114,115,116,117,66],"privacy policy","usage","data collection","collection","data","compliance","audit","storage","policy",{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":37},"01M6JZ5C6GZ0H6AD33FJY399M3","persistence","Work with the database abstraction layer and account\u002Fcharacter\u002Fworld persistence. Covers the GameDatabase interface, SQLite adapter, save\u002Fload lifecycle, auth sessions, and testing patterns.","https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fpersistence\u002FSKILL.md",[],[120,125,126,76,127,128,129,130,131,132,133,134,135,136,137,27,138,66],"layer","load","database","with","adapter","patterns","character","work","save","sqlite","lifecycle","testing patterns","interface","sessions",{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":143,"categories":144,"keywords":145,"publishedAt":37},"01M6JZ5836SXKR67RCMC83VRDJ","osc8-bridge","Add or modify OSC 8 hyperlink capabilities in the telnet bridge — NEW-ENVIRON (RFC 1572) negotiation, Mudlet\u002FFado\u002FMudForge `send:` URIs, and per-scheme tooltip\u002Fmenu metadata. Covers the capability pipeline from telnet negotiation through renderer output, the sanitization contract, and the word-wrap invariant.","https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fosc8-bridge\u002FSKILL.md",[],[146,147,148,149,150,151,152,153,154,155,156,157,158,159,34,160],"bridge","osc8 bridge","wrap","Word","RFC","pipeline","negotiation","metadata","capabilities","contract","renderer","sanitization","scheme","output","osc",{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":167,"publishedAt":37},"01M6JZ511D20VEPBNB2NMMNB8M","npc-creation","Create and modify NPCs with branching dialogue trees for MUDdown. Covers the JSON format, dialogue node structure, location binding, mood\u002Fnarrative fields, and the talk command flow.","https:\u002F\u002Fgithub.com\u002FMUDdown\u002FMUDdown\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fnpc-creation\u002FSKILL.md",[],[89,168,169,72,128,170,171,172,99,173,174,175,176,177,178,179,93],"npc creation","trees","branching","narrative","binding","dialogue","location","command","node","format","json","flow"]