mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
@claude-flow/shared 3.0.1-3.0.3 declare only sql.js, but the compiled code
imports zod (core/config) and express, cors, helmet and ws (mcp transports).
They sat in devDependencies, so a clean `npm i @claude-flow/shared` cannot load
`.` or `./core` (Cannot find package 'zod') or `./mcp` (Cannot find package
'express'). ruflo users never saw it because @claude-flow/cli declares the same
packages and npm hoists them.
- Move zod, express, cors, helmet and ws to dependencies, with ranges that
overlap what @claude-flow/cli declares so a CLI install can dedupe them.
express is bounded to `^4.22.2 || ^5.0.0` (the patched 4.x floor the repo
overrides to, and the 5.x the workspace runs) instead of an open `>=`.
- Move @types/ws to dependencies: dist/mcp/transport/websocket.d.ts imports
`ws`, so a consumer type-checking with skipLibCheck off hit TS7016.
- Exclude *.test.ts / *.spec.ts / __tests__ from the build, and negate them in
`files` so a stale local dist (composite builds do not clear old outputs)
cannot ship them either. 3.0.3 ships 6 compiled tests that import vitest.
- HttpTransport: read `req.body ?? {}`. Under Express 5 a POST /rpc with no JSON
body left req.body undefined and answered 500 instead of the JSON-RPC 400.
Malformed JSON (body-parser's entity.parse.failed) now answers 400 / -32700
Parse error instead of 500 / -32603 Internal error, under Express 4 and 5.
- Lockfile: only the shared importer block moves; ws 8.19.0 was referenced by
nothing else and is dropped. `pnpm@8.15.0 install --frozen-lockfile` passes.
- Tests: __tests__/package-manifest.test.ts scans src/ with the TypeScript
AST (type-only imports erased, comments/strings ignored) and fails on an
undeclared runtime import, a missing @types/ws, or removed test exclusions;
__tests__/mcp/http-transport-body.test.ts (transport bound to port 0) covers
the bodiless POST and malformed JSON. Every mutant (zod, express, @types/ws,
spec negation, tsconfig exclude, each HTTP fix reverted) is caught.
Verified: npm pack + clean `npm i <tgz>` imports all 9 exports subpaths
(origin/main and registry 3.0.3 fail on 3 of them) and ships no test files;
HTTP /health 200 and a WebSocket connect work under express 5.3.0 and 4.22.3;
a consumer tsc with skipLibCheck off reports 0 errors; shared tests pass; the
CI recursive build and the CLI type-check pass.
Not included: the version bump and the CLI's exact `@claude-flow/shared`
pin, which belong to the release.