| 1 | 1 | // End-to-end checks against a local `wrangler dev` (needs DEV_LOGIN=1 in .dev.vars and a migrated local database). |
| 2 | 2 | // Run: npm run dev then, in another shell: npm test |
| 3 | | - import { createHash, randomBytes } from 'node:crypto'; |
| 3 | + import { randomBytes } from 'node:crypto'; |
| 4 | 4 | import { createServer } from 'node:http'; |
| 5 | 5 | |
| 6 | 6 | const BASE = process.env.BASE_URL ?? 'http://127.0.0.1:8787'; |
| | ⋯ |
| 145 | 145 | return { res, page, steps, id: page.split('/').pop(), html: await (await client.req(page)).text() }; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | | - async function mcp(path, method, params, token, id = 1) { |
| 149 | | - const headers = { 'content-type': 'application/json', accept: 'application/json, text/event-stream' }; |
| 150 | | - if (token) headers.authorization = `Bearer ${token}`; |
| 151 | | - const res = await fetch(BASE + path, { method: 'POST', headers, body: JSON.stringify({ jsonrpc: '2.0', id, method, params }) }); |
| 152 | | - let body = null; |
| 153 | | - try { |
| 154 | | - body = await res.json(); |
| 155 | | - } catch { |
| 156 | | - /* empty */ |
| 157 | | - } |
| 158 | | - return { res, body }; |
| 159 | | - } |
| 160 | | - const toolData = (r) => r.body?.result?.structuredContent; |
| 161 | 148 | |
| 162 | 149 | async function main() { |
| 163 | 150 | const stub = await startStub(); |
| | ⋯ |
| 368 | 355 | const dl = await anon.req(`${skillPath}/download`); |
| 369 | 356 | check('download works', dl.status === 200 && (await dl.text()).includes('# Changelog writer')); |
| 370 | 357 | |
| 371 | | - // Tokens and MCP |
| 372 | | - const anonInit = await mcp('/mcp', 'initialize', { protocolVersion: '2025-06-18', capabilities: {}, clientInfo: { name: 'e2e', version: '1' } }); |
| 373 | | - check('MCP initialize without sign-in', anonInit.body?.result?.serverInfo?.name === 'skillfarm' && anonInit.body.result.protocolVersion === '2025-06-18'); |
| 374 | | - const tools = await mcp('/mcp', 'tools/list', {}); |
| 375 | | - check('MCP lists tools', tools.body?.result?.tools?.length >= 10); |
| 376 | | - const search = await mcp('/mcp', 'tools/call', { name: 'search_skills', arguments: { query: run } }); |
| 377 | | - check('MCP search finds the approved skill', toolData(search)?.skills?.some((s) => s.skill === `${owner}/${slug}`), JSON.stringify(search.body).slice(0, 200)); |
| 378 | | - const got = await mcp('/mcp', 'tools/call', { name: 'get_skill', arguments: { skill: `${owner}/${slug}` } }); |
| 379 | | - check('MCP reads a skill', toolData(got)?.skill_md?.includes('# Changelog writer')); |
| 380 | | - const dlm = await mcp('/mcp', 'tools/call', { name: 'download_skill', arguments: { skill: `${owner}/${slug}` } }); |
| 381 | | - check('MCP downloads a skill', toolData(dlm)?.files?.[0]?.path === 'SKILL.md'); |
| 382 | | - const anonShare = await mcp('/mcp', 'tools/call', { name: 'share_skill', arguments: { skill_md: SKILL_MD } }); |
| 383 | | - check('MCP write without sign-in answers 401 with a challenge', anonShare.res.status === 401 && (anonShare.res.headers.get('www-authenticate') ?? '').includes('resource_metadata=')); |
| 384 | | - check('MCP /account requires sign-in', (await mcp('/mcp/account', 'tools/list', {})).res.status === 401); |
| 385 | | - check('MCP rejects a made-up token', (await mcp('/mcp', 'tools/list', {}, 'sf_pat_notreal')).res.status === 401); |
| 386 | | - const cookieOnly = await a.req('/mcp', { method: 'POST', json: { jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'whoami', arguments: {} } }, origin: 'https://evil.example' }); |
| 387 | | - check('MCP ignores the browser session cookie', cookieOnly.status === 401, String(cookieOnly.status)); |
| 388 | | - check('MCP GET is not offered', (await fetch(`${BASE}/mcp`, { headers: { accept: 'text/event-stream' } })).status === 405); |
| 389 | | - |
| 390 | | - // Personal access tokens |
| 391 | | - const patRead = (await (await a.req('/settings/tokens', { method: 'POST', form: { name: 'read only', scopes: 'skills:read' } })).text()).match(/sf_pat_[A-Za-z0-9_-]+/)?.[0]; |
| 392 | | - check('create a read-only token', !!patRead); |
| 393 | | - const who = await mcp('/mcp/account', 'tools/call', { name: 'whoami', arguments: {} }, patRead); |
| 394 | | - check('token acts as its owner', toolData(who)?.handle === owner, JSON.stringify(who.body).slice(0, 200)); |
| 395 | | - const denied = await mcp('/mcp/account', 'tools/call', { name: 'share_skill', arguments: { skill_md: SHADY_MD } }, patRead); |
| 396 | | - check('read-only token cannot write', denied.res.status === 403 && (denied.res.headers.get('www-authenticate') ?? '').includes('insufficient_scope'), String(denied.res.status)); |
| 397 | | - |
| 398 | | - // OAuth for MCP clients |
| 399 | | - const meta = await (await fetch(`${BASE}/.well-known/oauth-authorization-server`)).json(); |
| 400 | | - check('OAuth metadata', meta.code_challenge_methods_supported?.includes('S256') && !!meta.registration_endpoint); |
| 401 | | - const prm = await (await fetch(`${BASE}/.well-known/oauth-protected-resource/mcp`)).json(); |
| 402 | | - check('protected-resource metadata', prm.resource?.endsWith('/mcp') && prm.authorization_servers?.length === 1); |
| 403 | | - const badReg = await fetch(`${BASE}/oauth/register`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ client_name: 'x', redirect_uris: ['http://evil.example/cb'] }) }); |
| 404 | | - check('registration refuses non-local http redirects', badReg.status === 400); |
| 405 | | - const badReg2 = await fetch(`${BASE}/oauth/register`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ client_name: 'x', redirect_uris: ['javascript:alert(1)'] }) }); |
| 406 | | - check('registration refuses script redirects', badReg2.status === 400); |
| 407 | | - const redirect = 'http://127.0.0.1:53999/callback'; |
| 408 | | - const reg = await (await fetch(`${BASE}/oauth/register`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ client_name: 'E2E <b>Client</b>', redirect_uris: [redirect] }) })).json(); |
| 409 | | - check('dynamic client registration', !!reg.client_id && !reg.client_secret); |
| 410 | | - const verifier = randomBytes(40).toString('base64url'); |
| 411 | | - const challenge = createHash('sha256').update(verifier).digest('base64url'); |
| 412 | | - const authz = (extra = {}) => new URLSearchParams({ response_type: 'code', client_id: reg.client_id, redirect_uri: redirect, code_challenge: challenge, code_challenge_method: 'S256', state: 'xyz', scope: 'skills:read skills:write', ...extra }); |
| 413 | | - check('authorize sends visitors to sign-in', (await anon.req(`/oauth/authorize?${authz()}`)).headers.get('location')?.startsWith('/signin?next=')); |
| 414 | | - check('authorize refuses an unregistered redirect', (await b.req(`/oauth/authorize?${authz({ redirect_uri: 'https://evil.example/cb' })}`)).status === 400); |
| 415 | | - const noPkce = await b.req(`/oauth/authorize?${new URLSearchParams({ response_type: 'code', client_id: reg.client_id, redirect_uri: redirect, state: 'xyz' })}`); |
| 416 | | - check('authorize requires PKCE', noPkce.status === 302 && noPkce.headers.get('location')?.includes('error=invalid_request')); |
| 417 | | - const consent = await b.req(`/oauth/authorize?${authz()}`); |
| 418 | | - const consentHtml = await consent.text(); |
| 419 | | - check('consent screen shows the app and escapes its name', consent.status === 200 && consentHtml.includes('E2E bClient/b') && !consentHtml.includes('<b>Client</b>'), consentHtml.match(/<h1>[^<]*/)?.[0]); |
| 420 | | - check('consent page allows the redirect back', !(consent.headers.get('content-security-policy') ?? '').includes('form-action')); |
| 421 | | - const crossConsent = await b.req('/oauth/authorize', { method: 'POST', form: Object.fromEntries([...authz(), ['decision', 'allow']]), origin: 'https://evil.example' }); |
| 422 | | - check('another site cannot approve for you', crossConsent.status === 403); |
| 423 | | - const allow = await b.req('/oauth/authorize', { method: 'POST', form: Object.fromEntries([...authz(), ['decision', 'allow']]) }); |
| 424 | | - const back = new URL(allow.headers.get('location') ?? 'http://x/'); |
| 425 | | - const code = back.searchParams.get('code'); |
| 426 | | - check('consent returns a code to the registered address', back.origin + back.pathname === redirect && !!code && back.searchParams.get('state') === 'xyz'); |
| 427 | | - const tokenReq = (form) => fetch(`${BASE}/oauth/token`, { method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(form) }); |
| 428 | | - const wrong = await tokenReq({ grant_type: 'authorization_code', code, client_id: reg.client_id, redirect_uri: redirect, code_verifier: randomBytes(40).toString('base64url') }); |
| 429 | | - check('wrong PKCE verifier is refused', wrong.status === 400); |
| 430 | | - const burned = await tokenReq({ grant_type: 'authorization_code', code, client_id: reg.client_id, redirect_uri: redirect, code_verifier: verifier }); |
| 431 | | - check('a code that failed once cannot be reused', burned.status === 400); |
| 432 | | - const allow2 = await b.req('/oauth/authorize', { method: 'POST', form: Object.fromEntries([...authz(), ['decision', 'allow']]) }); |
| 433 | | - const code2 = new URL(allow2.headers.get('location')).searchParams.get('code'); |
| 434 | | - const tok = await (await tokenReq({ grant_type: 'authorization_code', code: code2, client_id: reg.client_id, redirect_uri: redirect, code_verifier: verifier })).json(); |
| 435 | | - check('code exchange returns tokens', tok.access_token?.startsWith('sf_at_') && tok.refresh_token?.startsWith('sf_rt_') && tok.expires_in === 3600, JSON.stringify(tok).slice(0, 120)); |
| 436 | | - check('code is single use', (await tokenReq({ grant_type: 'authorization_code', code: code2, client_id: reg.client_id, redirect_uri: redirect, code_verifier: verifier })).status === 400); |
| 437 | | - check('refresh token is not a bearer token', (await mcp('/mcp/account', 'tools/list', {}, tok.refresh_token)).res.status === 401); |
| 438 | | - const who2 = await mcp('/mcp/account', 'tools/call', { name: 'whoami', arguments: {} }, tok.access_token); |
| 439 | | - check('OAuth token acts as the member who approved', toolData(who2)?.handle === fan); |
| 440 | | - |
| 441 | | - // Share through MCP: goes to the queue with the pattern scan attached |
| 442 | | - const mshare = await mcp('/mcp/account', 'tools/call', { name: 'share_skill', arguments: { skill_md: SHADY_MD } }, tok.access_token); |
| 443 | | - check('MCP share lands in review', toolData(mshare)?.status === 'waiting_for_review', JSON.stringify(mshare.body).slice(0, 300)); |
| 444 | | - const shadyRef = toolData(mshare)?.skill; |
| 445 | | - check('MCP submission is not public', (await anon.req(`/skills/${shadyRef}`)).status === 404); |
| 446 | | - const search2 = await mcp('/mcp', 'tools/call', { name: 'search_skills', arguments: { query: `Totally Fine Helper ${run}` } }); |
| 447 | | - check('MCP submission is not in search', toolData(search2)?.skills?.length === 0); |
| 448 | | - const mineList = await mcp('/mcp/account', 'tools/call', { name: 'my_skills', arguments: {} }, tok.access_token); |
| 449 | | - check('my_skills shows it as pending', toolData(mineList)?.skills?.some((s) => s.skill === shadyRef && s.state === 'pending')); |
| 450 | | - const queue2 = await (await admin.req('/admin')).text(); |
| 451 | | - check('queue shows the MCP submission flagged', queue2.includes(`Totally Fine Helper ${run}`) && /scan-high/.test(queue2)); |
| 452 | | - let shadyReview = null; |
| 453 | | - for (const p of [...new Set(queue2.match(/\/admin\/review\/[A-Za-z0-9_-]+/g) ?? [])]) { |
| 454 | | - const t = await (await admin.req(p)).text(); |
| 455 | | - if (t.includes(`Totally Fine Helper ${run}`)) shadyReview = p; |
| 358 | + for (const path of ['/mcp', '/mcp/account', '/oauth/register', '/.well-known/oauth-authorization-server']) { |
| 359 | + check('retired programmatic route '+path, (await fetch(BASE+path)).status === 410); |
| 456 | 360 | } |
| 457 | | - const deny = await admin.req(`${shadyReview}/decide`, { method: 'POST', form: { decision: 'reject', note: 'Pipes a remote script into a shell and reads SSH keys.' } }); |
| 458 | | - check('admin denies', deny.status === 302); |
| 459 | | - check('denied skill stays private', (await anon.req(`/skills/${shadyRef}`)).status === 404); |
| 460 | | - const mineList2 = await mcp('/mcp/account', 'tools/call', { name: 'my_skills', arguments: {} }, tok.access_token); |
| 461 | | - check('member sees the reviewer note', toolData(mineList2)?.skills?.some((s) => s.skill === shadyRef && /SSH keys/.test(s.latest_version?.reviewer_note ?? ''))); |
| 462 | 361 | |
| 463 | | - const mrepo = await mcp('/mcp/account', 'tools/call', { name: 'share_skill', arguments: { github_url: `https://github.com/e2e-org/turned-down-${run}` } }, tok.access_token); |
| 464 | | - check('MCP shares a whole repo', toolData(mrepo)?.skills_found === 2 && toolData(mrepo)?.url?.includes('/share/repo/'), JSON.stringify(mrepo.body).slice(0, 300)); |
| 465 | | - |
| 466 | | - const mlike = await mcp('/mcp/account', 'tools/call', { name: 'like_skill', arguments: { skill: `${owner}/${slug}` } }, tok.access_token); |
| 467 | | - check('MCP like', toolData(mlike)?.liked === true); |
| 468 | | - |
| 469 | | - // Refresh rotation and replay detection |
| 470 | | - const ref = await (await tokenReq({ grant_type: 'refresh_token', refresh_token: tok.refresh_token, client_id: reg.client_id })).json(); |
| 471 | | - check('refresh returns a new pair', ref.access_token?.startsWith('sf_at_') && ref.refresh_token !== tok.refresh_token); |
| 472 | | - check('old access token stops working after refresh', (await mcp('/mcp/account', 'tools/list', {}, tok.access_token)).res.status === 401); |
| 473 | | - check('new access token works', (await mcp('/mcp/account', 'tools/list', {}, ref.access_token)).res.status === 200); |
| 474 | | - check('replayed refresh token is refused', (await tokenReq({ grant_type: 'refresh_token', refresh_token: tok.refresh_token, client_id: reg.client_id })).status === 400); |
| 475 | | - check('replay revokes the whole connection', (await mcp('/mcp/account', 'tools/list', {}, ref.access_token)).res.status === 401); |
| 476 | | - |
| 477 | 362 | // Admin moderation after the fact |
| 478 | 363 | const adminSkills = await (await admin.req('/admin?tab=skills')).text(); |
| 479 | 364 | check('admin skills tab', adminSkills.includes(`Changelog Writer ${run}`)); |
| | ⋯ |
| 517 | 402 | check('members can like a pick', likePick.status === 200 && (await likePick.json()).liked === true); |
| 518 | 403 | const boards = (await (await anon.req('/leaderboard')).text()) + (await (await anon.req('/leaderboard?period=month')).text()) + (await (await anon.req('/growers')).text()); |
| 519 | 404 | check('Sprout earns nothing and is on no board', !boards.includes('/u/sprout')); |
| 520 | | - const mpick = await mcp('/mcp', 'tools/call', { name: 'search_skills', arguments: { query: pickTitle, from: 'sprout' } }); |
| 521 | | - const mp = toolData(mpick)?.skills?.[0]; |
| 522 | | - check('MCP search marks a pick and names its maker', mp?.kind === 'pick' && mp?.maker?.name === 'Example Maker' && mp?.source_url?.includes(`example-org/pick-${run}`) && mp?.by?.agent === true, JSON.stringify(mp ?? mpick.body).slice(0, 200)); |
| 523 | | - const mget = toolData(await mcp('/mcp', 'tools/call', { name: 'get_skill', arguments: { skill: `sprout/pick-${run}` } })); |
| 524 | | - check('MCP get_skill returns no hosted text for a pick', mget?.skill_md === null && /hosts no copy/.test(mget?.notice ?? '')); |
| 525 | | - const mdl = toolData(await mcp('/mcp', 'tools/call', { name: 'download_skill', arguments: { skill: `sprout/pick-${run}` } })); |
| 526 | | - check('MCP download points to the maker', mdl?.hosted === false && mdl?.files?.length === 0 && !!mdl?.source_url); |
| 527 | 405 | // The maker picks from migration 0004: new categories, and a Codex install line. |
| 528 | 406 | const legalHtml = await (await anon.req('/skills?category=legal')).text(); |
| 529 | 407 | check('the Legal category lists legal picks', legalHtml.includes('Legal skills') && legalHtml.includes('/skills/sprout/commercial-legal')); |
| 530 | 408 | const codexPick = await (await anon.req('/skills/sprout/security-best-practices')).text(); |
| 531 | 409 | check('a desktop agent pick says to type its install line inside that agent', codexPick.includes('Type this inside your desktop agent.') && codexPick.includes('$skill-installer security-best-practices')); |
| 532 | | - const mlegal = toolData(await mcp('/mcp', 'tools/call', { name: 'search_skills', arguments: { category: 'legal', limit: 30 } })); |
| 533 | | - check('MCP search filters by a new category', mlegal?.skills?.length >= 13 && mlegal.skills.every((k) => k.category === 'legal'), JSON.stringify(mlegal?.skills?.[0] ?? {}).slice(0, 200)); |
| 534 | | - const mtop = toolData(await mcp('/mcp', 'tools/call', { name: 'search_skills', arguments: { from: 'sprout', sort: 'trending', limit: 12 } })); |
| 535 | | - const topRepos = (mtop?.skills ?? []).map((k) => k.source_url?.split('/').slice(3, 5).join('/')); |
| 536 | | - check('one repo does not fill the first page of picks', new Set(topRepos).size === topRepos.length && topRepos.length === 12, topRepos.join(' ')); |
| 537 | | - // Search by maker, repo, licence, member and several words; categories; install steps. |
| 538 | | - const call = async (name, args) => toolData(await mcp('/mcp', 'tools/call', { name, arguments: args })); |
| 539 | | - const byMaker = await call('search_skills', { maker: 'an AI lab', limit: 30 }); |
| 540 | | - check('MCP search filters by maker', byMaker?.skills?.length >= 24 && byMaker.skills.every((k) => k.maker?.name === 'an AI lab'), `${byMaker?.skills?.length}`); |
| 541 | | - const byRepo = await call('search_skills', { repo: 'anthropics/claude-for-legal', limit: 30 }); |
| 542 | | - check('MCP search filters by repo', byRepo?.skills?.length === 12 && byRepo.skills.every((k) => k.github?.repo === 'anthropics/claude-for-legal'), `${byRepo?.skills?.length}`); |
| 543 | | - const byLicense = await call('search_skills', { license: 'mpl-2.0' }); |
| 544 | | - check('MCP search filters by licence', byLicense?.skills?.length === 1 && byLicense.skills[0].skill === 'sprout/hashicorp-agent-skills', JSON.stringify(byLicense?.skills?.map((k) => k.skill))); |
| 545 | | - const byWords = await call('search_skills', { query: 'legal anthropic contracts' }); |
| 546 | | - check('MCP search needs every word to match', byWords?.skills?.length >= 1 && byWords.skills.every((k) => k.category === 'legal'), JSON.stringify(byWords?.skills?.map((k) => k.skill))); |
| 547 | | - const byCatWord = await call('search_skills', { query: 'marketing', limit: 30 }); |
| 548 | | - check('a category word finds what is filed under it', byCatWord?.skills?.some((k) => k.skill === 'sprout/internal-comms')); |
| 549 | | - check('search by member finds only their skills', (await call('search_skills', { by: 'sprout', limit: 5 }))?.skills?.every((k) => k.by.handle === 'sprout')); |
| 550 | | - check('search by an unknown member finds nothing', (await call('search_skills', { by: 'nobody-here-xyz' }))?.skills?.length === 0); |
| 551 | | - const cats = await call('list_categories', {}); |
| 552 | | - check('MCP lists categories with counts', cats?.categories?.length === 14 && cats.categories.find((k) => k.key === 'legal')?.skills >= 13 && cats.agents?.length === 3 && cats.totals?.sprout_picks >= 136, JSON.stringify(cats?.totals)); |
| 553 | | - const pickPlan = await call('install_skill', { skill: 'sprout/security-best-practices' }); |
| 554 | | - check('install steps for a Codex pick point to the maker', pickPlan?.source === 'maker' && pickPlan.agents?.length === 1 && pickPlan.agents[0].quick === '$skill-installer security-best-practices' && pickPlan.agents[0].quick_where === 'codex', JSON.stringify(pickPlan?.agents?.[0] ?? pickPlan)); |
| 555 | | - const ccPlan = await call('install_skill', { skill: 'sprout/word-documents', agent: 'claude-code' }); |
| 556 | | - check('a line typed inside Claude Code is offered to Claude Code', ccPlan?.agents?.[0]?.quick_where === 'claude-code' && ccPlan.agents[0].quick.startsWith('/plugin marketplace add anthropics/skills')); |
| 557 | | - const allPlan = await call('install_skill', { skill: 'sprout/gemini-api-dev' }); |
| 558 | | - check('a terminal line is offered to every agent the pick supports', allPlan?.agents?.length === 3 && allPlan.agents.every((k) => k.quick_where === 'terminal')); |
| 559 | | - const hostedRef = (await call('search_skills', { from: 'growers', limit: 1 }))?.skills?.[0]; |
| 560 | | - const hostedPlan = hostedRef ? await call('install_skill', { skill: hostedRef.skill, agent: 'codex' }) : null; |
| 561 | | - check('install steps for a shared skill give a command and a folder', !!hostedPlan && ['github', 'skillfarm'].includes(hostedPlan.source) && hostedPlan.agents.length >= 1 && hostedPlan.agents.every((k) => k.folder.includes('/skills/') && !!k.reviewed_copy && k.manual.length >= 2), JSON.stringify(hostedPlan ?? {}).slice(0, 300)); |
| 562 | 410 | const siteSearch = await (await anon.req('/skills?q=legal+contracts')).text(); |
| 563 | 411 | check('site search matches several words', siteSearch.includes('/skills/sprout/commercial-legal') && !siteSearch.includes('/skills/sprout/word-documents')); |
| 564 | 412 | // Send to agent and the Help page. |
| | ⋯ |
| 567 | 415 | check('Help page lists the setup prompts', helpRes.status === 200 && helpHtml.includes('id="own-skills-repo"') && helpHtml.includes('id="review-before-install"') && helpHtml.includes('Keep your own skills repo')); |
| 568 | 416 | check('Help prompts carry a Claude Code link and a Codex link', helpHtml.includes('claude-cli://open?q=Set%20up%20one%20skills%20repository') && helpHtml.includes('codex://new?prompt=Set%20up%20one%20skills%20repository')); |
| 569 | 417 | check('the header links to Help', (await (await anon.req('/')).text()).includes('href="/help"')); |
| 570 | | - const hostedPage = hostedRef ? await (await anon.req(`/skills/${hostedRef.skill}`)).text() : ''; |
| 418 | + const hostedPage = await (await anon.req('/skills/'+owner+'/'+slug)).text(); |
| 571 | 419 | check('a shared skill page offers Send to agent and remembers the agent tab', hostedPage.includes('data-send-go') && hostedPage.includes('claude-cli://open?q=Install%20the%20') && hostedPage.includes('data-agent-tabs')); |
| 572 | 420 | const pickSend = await (await anon.req('/skills/sprout/security-best-practices')).text(); |
| 573 | 421 | check('a Codex pick sends its prompt to Codex only', pickSend.includes('codex://new?prompt=Help%20me%20install') && !pickSend.includes('claude-cli://')); |
| 574 | | - const geminiPlan = await call('install_skill', { skill: 'sprout/gemini-api-dev', agent: 'gemini-cli' }); |
| 575 | | - check('Gemini CLI installs into the shared agents folder', geminiPlan?.agents?.[0]?.folder === '~/.agents/skills'); |
| 576 | 422 | // Converted copies of picks. |
| 577 | 423 | const copyPage = await (await anon.req('/skills/sprout/powerpoint-decks')).text(); |
| 578 | 424 | check('a pick with a converted copy offers the multi-agent version', copyPage.includes('id="multi-agent"') && copyPage.includes('npx skills add https://branchwell.ai/skillfarm/skills.git --skill pptx --full-depth -a codex -g -y') && !copyPage.includes('NOTICE.md') && !copyPage.includes('keeps the credit') && !copyPage.includes('github.com/projectatomai') && copyPage.includes('Install the original')); |
| 579 | 425 | check('a pick without a converted copy shows no multi-agent card', !(await (await anon.req('/skills/sprout/security-best-practices')).text()).includes('id="multi-agent"')); |
| 580 | | - const copyPlan = await call('install_skill', { skill: 'sprout/powerpoint-decks' }); |
| 581 | | - check('install steps use the maker\'s way for Claude Code and the converted copy elsewhere', copyPlan?.agents?.length === 3 && copyPlan.agents.find((k) => k.agent === 'claude-code')?.quick_where === 'claude-code' && copyPlan.agents.find((k) => k.agent === 'codex')?.copy === true && copyPlan.multi_agent?.agents?.length === 3 && copyPlan.multi_agent.repo === 'skillfarm/skills', JSON.stringify(copyPlan?.agents?.map((k) => [k.agent, k.quick_where, k.copy]))); |
| 582 | | - const copyOne = await call('install_skill', { skill: 'sprout/powerpoint-decks', agent: 'gemini-cli' }); |
| 583 | | - check('asking for one agent narrows the converted copy too', copyOne?.agents?.length === 1 && copyOne.multi_agent?.agents?.length === 1 && copyOne.agents[0].quick.endsWith('-a gemini-cli -g -y')); |
| 584 | | - const copySearch = await call('search_skills', { query: 'powerpoint', agent: 'codex' }); |
| 585 | | - check('a converted pick is found under Codex and names its copy', copySearch?.skills?.some((k) => k.skill === 'sprout/powerpoint-decks' && k.multi_agent_version === 'https://branchwell.ai/skillfarm/skills/tree/main/converted/pptx'), JSON.stringify(copySearch?.skills?.map((k) => k.skill))); |
| 586 | 426 | // The prompt library. |
| 587 | 427 | const promptsRes = await anon.req('/prompts'); |
| 588 | 428 | const promptsHtml = await promptsRes.text(); |
| | ⋯ |
| 595 | 435 | check('the header links to Prompts', (await (await anon.req('/')).text()).includes('href="/prompts"')); |
| 596 | 436 | const sitemap = await (await anon.req('/sitemap.xml')).text(); |
| 597 | 437 | check('the sitemap lists Help, Prompts and each prompt', sitemap.includes('/help</loc>') && sitemap.includes('/prompts</loc>') && sitemap.includes('/prompts/own-skills-repo</loc>')); |
| 598 | | - const mcpPrompts = (await mcp('/mcp', 'prompts/list', {})).body?.result?.prompts; |
| 599 | | - check('MCP lists the prompts', mcpPrompts?.length === new Set(promptSlugs).size && mcpPrompts.some((k) => k.name === 'own-skills-repo' && k.description), `${mcpPrompts?.length}`); |
| 600 | | - const mcpPrompt = (await mcp('/mcp', 'prompts/get', { name: 'own-skills-repo' })).body?.result; |
| 601 | | - check('MCP returns one prompt as a user message', mcpPrompt?.messages?.[0]?.role === 'user' && mcpPrompt.messages[0].content?.text?.startsWith('Set up one skills repository')); |
| 602 | | - check('MCP refuses an unknown prompt', (await mcp('/mcp', 'prompts/get', { name: 'nope' })).body?.error?.code === -32602); |
| 603 | | - const promptList = await call('get_prompt', {}); |
| 604 | | - check('get_prompt lists the library in groups', promptList?.prompts?.length === mcpPrompts?.length && promptList.groups?.length === 4 && promptList.prompts.every((k) => k.url.includes('/prompts/'))); |
| 605 | | - const promptGroup = await call('get_prompt', { group: 'build' }); |
| 606 | | - check('get_prompt narrows to a group', promptGroup?.prompts?.length >= 3 && promptGroup.prompts.every((k) => k.group === 'build')); |
| 607 | | - const promptOne = await call('get_prompt', { prompt: 'fix-a-bug' }); |
| 608 | | - check('get_prompt returns the full text of one prompt', promptOne?.prompt === 'fix-a-bug' && typeof promptOne.text === 'string' && promptOne.text.length > 200); |
| 609 | 438 | const editPick = await admin.req('/admin/picks', { method: 'POST', form: { ...pickForm, id: pickId, summary: 'An edited summary for the made-up skill.' } }); |
| 610 | 439 | check('admin edits a pick', editPick.status === 302 && (await (await anon.req(pickPath)).text()).includes('An edited summary')); |
| 611 | 440 | const rmPick = await admin.req(`/admin/skills/${pickId}/remove`, { method: 'POST' }); |