build: declare workspace dependencies and check them in CI (P0.2)

Packages relied on npm hoisting for imports they never declared, so a
package installed on its own fails (UF-024).

- server: + @waggle/marketplace, @waggle/sdk, @waggle/weaver, zod (MIT),
  @anthropic-ai/sdk (MIT), @ax-llm/ax (Apache-2.0);
  - @waggle/hive-mind-shim-core and stripe (unused)
- agent: + pdf-parse (Apache-2.0); playwright-core (Apache-2.0) as an
  optional peer, since it is loaded only when available
- worker: + @waggle/waggle-dance; web: + @waggle/shared
- launcher: + @waggle/server as a dev dependency (bundled by tsup);
  - stripe; cli: - @waggle/weaver (unused); root: - stripe

scripts/check-workspace-deps.mjs (npm run check:deps) compares the
imports in each community-edition package's src/ with its manifest and
runs in CI. Two imports wait for P1.4 (optimizer, evolution wiring).
This commit is contained in:
shumeiko.it
2026-10-15 19:31:50 +02:00
parent fe2eb0f648
commit d2b6506f8b
12 changed files with 179 additions and 11 deletions

View File

@@ -52,6 +52,7 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`.
| UF-021 | Settings visual-regression baseline is ignored by git | Fixed | Tests, git |
| UF-022 | Unit tests write into the developer's real `~/.waggle` | Fixed | Tests |
| UF-023 | Four unit-test files fail on macOS | Open | Tests, macOS |
| UF-024 | Workspace packages import packages they do not declare | Fixed | Build, packaging |
## Entries
@@ -234,3 +235,12 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14.
- Cause: the runtime fixtures appear to assume the Windows archive layout, and the path checks do not account for `/var` being a symlink to `/private/var` on macOS. The OpenClaw timeout is not investigated yet.
- What we did: nothing yet. The failures are recorded as known in `docs/oss/baseline.md`.
- Recommendation: make the runtime fixtures platform-aware, compare resolved paths (`fs.realpathSync`) in path assertions, and run the unit suite on macOS and Linux in CI.
### UF-024. Workspace packages import packages they do not declare
- Status: Fixed
- Found: 2026-10-15
- Where: `package.json` of `packages/server`, `packages/agent`, `packages/launcher`, `packages/worker`, `packages/cli` and `apps/web`
- Symptom: inside the monorepo everything works because npm hoists all dependencies to the root `node_modules`, but a package installed on its own fails to resolve imports. `server` imports `@waggle/marketplace`, `@waggle/sdk`, `@waggle/weaver`, `zod`, `@anthropic-ai/sdk` and `@ax-llm/ax` without declaring them; `agent` imports `pdf-parse` and `playwright-core`; `worker` imports `@waggle/waggle-dance`; `launcher` imports `@waggle/server`; `apps/web` imports `@waggle/shared`. `server` declares `@waggle/hive-mind-shim-core` and `cli` declares `@waggle/weaver` without using them.
- Cause: no check compares imports with declared dependencies.
- What we did: declared the missing dependencies (`playwright-core` as an optional peer, because `agent` loads it only when available; `@waggle/server` as a dev dependency of `launcher`, because its build bundles `@waggle/*`), removed the unused ones, and added `scripts/check-workspace-deps.mjs` (`npm run check:deps`) to CI.
- Recommendation: apply the same declarations in the main project and run the check in CI.