Spaces:
Build error
Build error
|
Download docs/dev_a_prd.md from Danisz/spymaster-dev-b: direct link, hf CLI and curl.
- Browser
- Download file 7.82 kB
-
https://huggingface.co/spaces/Danisz/spymaster-dev-b/resolve/main/docs/dev_a_prd.md
- Command line
-
hf download hf://spaces/Danisz/spymaster-dev-b/docs/dev_a_prd.md
-
curl -L -o dev_a_prd.md https://huggingface.co/spaces/Danisz/spymaster-dev-b/resolve/main/docs/dev_a_prd.md
7.82 kB
A newer version of the Streamlit SDK is available: 1.67.0
PRD β Dev A: Server Layer & Runner/Packaging
1 β’ Goal
As Dev A, your goal is to develop the Server Layer of the local Node.js application. This involves creating the MCP server, defining the resources and tools for interacting with the Codenames game, and handling communication with the Browser Layer via a defined interface (ICodenamesBrowser). You will also contribute to the top-level runner.ts script and the project's packaging configuration (package.json, tsconfig.json).
2 β’ Key Technologies (Focus)
- Node.js & npm
modelcontextprotocolSDK (TypeScript)- TypeScript
- Understanding of
npm link/npxfor integration and testing
3 β’ Responsibilities & Deliverables
| Module / Layer | Responsibilities | Deliverables |
|---|---|---|
| Server Layer | Node.js MCP server logic: β’ Initialize MCP SDK β’ Define MCP resources & tools (e.g., getBoardState, giveClue)β’ Handle MCP requests β’ Call Browser Layer API ( ICodenamesBrowser) |
server/server.ts, server/schemas.ts, server/tests/ |
| Runner & Packaging | Top-level script & setup contributions: β’ Implement relevant parts of runner.ts (initialize Server Layer, wire to Browser Layer)β’ Drive definition of ICodenamesBrowser interfaceβ’ Configure package.json (name, version, bin, files, scripts)β’ Configure tsconfig.json |
Contributions to: runner.ts, package.json, tsconfig.json, shared/types.ts |
4 β’ Suggested Folder Structure (Focus)
spymaster/
βββ server/ # <-- Your primary focus
β βββ server.ts # <-- MCP logic
β βββ schemas.ts # <-- MCP resource/tool schemas
β βββ tests/ # <-- Your unit tests
βββ browser/ # <-- Dev B's area (interact via ICodenamesBrowser)
β βββ ...
βββ runner.ts # <-- Collaborate on setup/wiring
βββ shared/ # <-- Define ICodenamesBrowser here
β βββ types.ts
βββ package.json # <-- Configure build, link, run
βββ tsconfig.json # <-- Configure TS compilation
βββ README.md
βββ docs/
βββ overall_prd.md
βββ dev_a_prd.md # <-- This document
5 β’ Architecture & Execution Flow (Your Role)
- Build: Ensure
npm run build(usingtsconfig.jsonyou configure) compilesserver/andrunner.tscorrectly intodist/. - Linking: Use
npm linkto make the package executable. - Execution:
npx your-package-namerunsdist/runner.js. - Runner (
dist/runner.js):- Initializes the Browser Layer (handled by Dev B, provides
ICodenamesBrowserinstance). - You ensure
runner.tsinitializes your Server Layer, passing theICodenamesBrowserinstance to it. - Your Server Layer starts the MCP server.
- Initializes the Browser Layer (handled by Dev B, provides
- Server Layer: Your code handles incoming MCP requests, translates them into calls to the
ICodenamesBrowserinterface methods provided by the Browser Layer.
6 β’ Development Steps (Your Flow)
| Phase | Your Actions (Dev A: Server Layer / Build / Runner) | Key Interaction / Synchronization Point |
|---|---|---|
| 1. Setup, Config & Contract | Setup server/. Configure package.json, tsconfig.json. Drive definition of ICodenamesBrowser interface in shared/types.ts. |
Critical Sync: Agree with Dev B on ICodenamesBrowser interface & package.json structure (bin, runner.ts). |
| 2. Independent Implementation | Implement Server Layer (server/) against a mock implementation of ICodenamesBrowser. Implement runner.ts wiring logic. Unit test server/ logic using the mock. |
None. Focus on your layer using the defined interface and mock. |
| 3. Build, Link & Smoke Test | Run npm run build. Run npm link. Run npx your-package-name smoke test. Verify your server starts up correctly (even if browser part fails initially). |
Sync Point: Verify successful build, link, basic npx execution. Inform Dev B. |
| 4. Integration Test & Debug | Lead E2E testing using MCP Inspector connected to the npx-run process. Debug MCP request/response flow and issues related to interaction with the Browser Layer API. |
Sync Point: Collaborative E2E testing & debugging using npx-launched app. You lead, Dev B supports. |
7 β’ Testing Approach (Your Responsibility)
- Unit Tests (
server/tests/):- Thoroughly test your
server.tsandschemas.tslogic. - Crucially, mock the
ICodenamesBrowserinterface. Your unit tests should not depend on the actual Playwright implementation. Verify that your server logic correctly calls the mock interface methods based on MCP requests.
- Thoroughly test your
- E2E & Primary Validation:
- After
npm run buildandnpm link, you will primarily drive E2E testing. - Run
npx your-package-name. - Connect MCP Inspector.
- Execute MCP commands (
getBoardState,giveClue,makeGuess, etc.). - Verify:
- Correct MCP responses are generated by your server.
- Expected actions occur in the browser (debugging with Dev B if browser actions fail).
- Your server correctly handles the data/responses received from the Browser Layer via the
ICodenamesBrowserinterface.
- After
8 β’ Key Risks (Focus)
- Interface Mismatch: Your server code expects one thing from
ICodenamesBrowser, but the Browser Layer implements it differently.- Mitigation: Clear TypeScript interface definition (
shared/types.ts), early integration testing vianpxrun, frequent communication with Dev B.
- Mitigation: Clear TypeScript interface definition (
- Build/Link Issues: Problems with
tsconfig.json,package.json(bin,files), ornpm link.- Mitigation: Verify build output (
dist/), check global links (npm ls -g --depth=0 --link=true), ensurerunner.tscompiles correctly andpackage.jsonpoints to it.
- Mitigation: Verify build output (
- MCP Logic Errors: Incorrectly handling MCP requests or formatting responses.
- Mitigation: Strong unit tests with mocked browser interface, thorough E2E testing with MCP Inspector.
9 β’ Acceptance Criteria (Your Contribution)
npm run buildsuccessfully compilesserver/,shared/, andrunner.tsintodist/.npm linksuccessfully links the package defined inpackage.json.npx your-package-namestarts therunner.tsscript, which successfully initializes and starts your MCP server.- MCP Inspector can connect to your server process.
- MCP Inspector can invoke all defined MCP tools (
getBoardState,getTeamTurn,getClueLog,giveClue,makeGuess,endTurn). - Your Server Layer correctly processes these requests, calls the appropriate methods on the (mocked or real)
ICodenamesBrowserinterface, and returns accurate responses based on the interface's return values.