fix: ENOENT on save (#4), drop unused deps, upgrade MCP SDK to 1.x - #9
Merged
Conversation
… MCP SDK to 1.x - Fix #4: saveTasks() now mkdir -p the parent directory, so environments without ~/Documents (Docker, CI, fresh OS profiles) no longer fail with ENOENT on first write - Remove unused dependencies (glob, chalk, zod-to-json-schema) that were never imported; this alone eliminates 3 known ReDoS advisories - Upgrade @modelcontextprotocol/sdk 0.5.0 -> ^1.20.0 (fixes GHSA-8r9q ReDoS), zod -> ^3.25; npm audit is now clean (7 -> 0 vulnerabilities) - Add vitest with 3 integration tests (ENOENT regression verified red->green, full plan->execute->approve flow, on-disk persistence across instances) - Add GitHub Actions CI (typecheck, build, test, audit gate) - Drop stale pnpm-lock.yaml; npm is the canonical package manager - Export TaskManagerServer and guard the stdio entrypoint so tests can import the module without starting the server A/B verified against v1.0.2: identical tools/list schemas (10 tools), identical responses for the full task flow, identical tasks.json format. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes task persistence failures when the default task file directory doesn’t exist (Issue #4), upgrades the MCP SDK to the 1.x line, removes unused dependencies to reduce audit surface, and adds a Vitest/CI safety net around the change.
Changes:
- Ensure
saveTasks()creates the parent directory (mkdir -p) before writingtasks.jsonto preventENOENT. - Upgrade
@modelcontextprotocol/sdkto^1.20.0, drop unused deps, and bump project version to1.1.0. - Add Vitest integration tests and a GitHub Actions CI workflow (typecheck/build/test/audit).
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
index.ts |
Creates parent directories before saving; exports TaskManagerServer; adds “only run when main” entrypoint guard. |
tests/taskmanager.test.ts |
Adds integration tests for ENOENT regression, workflow flow, and persistence. |
package.json |
Removes unused deps; upgrades MCP SDK and zod; adds vitest/typecheck scripts; bumps version. |
package-lock.json |
Updates lockfile to match new dependency graph (SDK 1.x + vitest). |
.github/workflows/ci.yml |
Adds CI pipeline: typecheck → build → test → audit. |
pnpm-lock.yaml |
Removes stale pnpm lockfile. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+866
to
+877
| // Only start the stdio server when executed directly as a binary, not when | ||
| // imported by tests. process.argv[1] is the entrypoint script path. | ||
| const isMain = | ||
| process.argv[1] && | ||
| fileURLToPath(import.meta.url) === path.resolve(process.argv[1]); | ||
|
|
||
| if (isMain) { | ||
| runServer().catch((error) => { | ||
| console.error("Fatal error running server:", error); | ||
| process.exit(1); | ||
| }); | ||
| } |
Comment on lines
+14
to
+17
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
saveTasks()fails withENOENTwhen the default~/Documentsdirectory does not exist (Docker/root, CI runners, fresh OS profiles)npm auditreported 7 vulnerabilities (1 critical / 2 high), most of them pulled in by dependencies that are never imported (glob,chalk,zod-to-json-schema), and by the 2-year-old@modelcontextprotocol/sdk 0.5.0(ReDoS, GHSA-8r9q-7v3j-jr4g)How
fs.mkdir(..., { recursive: true })before writing the task file^1.20.0(the low-levelServer/setRequestHandlerAPI is backward compatible)What
index.ts:mkdir -pinsaveTasks(); exportTaskManagerServer; stdio entrypoint guard for testspackage.json: deps cleanup, SDK0.5.0 → ^1.20.0, zod^3.25, vitest, v1.0.2 → v1.1.0tests/taskmanager.test.ts: 3 integration tests (ENOENT regression verified red→green, full plan→execute→approve flow, on-disk persistence).github/workflows/ci.yml: typecheck → build → test →npm audit --audit-level=highpnpm-lock.yamlVerification (all run locally, no mocks)
npm audit: 7 → 0 vulnerabilitiestasks.jsonformat — no behavioral regression🤖 Generated with Claude Code