Skip to content

fix: ENOENT on save (#4), drop unused deps, upgrade MCP SDK to 1.x - #9

Merged
kazuph merged 1 commit into
mainfrom
feature/deps-cleanup-and-bugfix
Jun 12, 2026
Merged

fix: ENOENT on save (#4), drop unused deps, upgrade MCP SDK to 1.x#9
kazuph merged 1 commit into
mainfrom
feature/deps-cleanup-and-bugfix

Conversation

@kazuph

@kazuph kazuph commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Why

  • Issue Error when creating tasks: ENOENT no such file or directory #4: saveTasks() fails with ENOENT when the default ~/Documents directory does not exist (Docker /root, CI runners, fresh OS profiles)
  • npm audit reported 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

  • Create the parent directory with fs.mkdir(..., { recursive: true }) before writing the task file
  • Physically remove the three unused dependencies instead of bumping them
  • Upgrade the MCP SDK to ^1.20.0 (the low-level Server/setRequestHandler API is backward compatible)
  • Introduce vitest + GitHub Actions CI as the safety net for the SDK major upgrade

What

  • index.ts: mkdir -p in saveTasks(); export TaskManagerServer; stdio entrypoint guard for tests
  • package.json: deps cleanup, SDK 0.5.0 → ^1.20.0, zod ^3.25, vitest, v1.0.2 → v1.1.0
  • tests/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=high
  • Removed stale pnpm-lock.yaml

Verification (all run locally, no mocks)

  • npm audit: 7 → 0 vulnerabilities
  • typecheck / build / 3 tests: all green
  • Real stdio MCP server smoke test: initialize + tools/list → all 10 tools respond
  • A/B against v1.0.2: identical tools/list schemas, identical responses across the full task flow, identical tasks.json format — no behavioral regression

🤖 Generated with Claude Code

… 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>
Copilot AI review requested due to automatic review settings June 12, 2026 06:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 writing tasks.json to prevent ENOENT.
  • Upgrade @modelcontextprotocol/sdk to ^1.20.0, drop unused deps, and bump project version to 1.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 thread index.ts
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 thread .github/workflows/ci.yml
Comment on lines +14 to +17
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
@kazuph
kazuph merged commit 516b809 into main Jun 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants