Skip to content

packages/codev build doesn't build its workspace deps — false TS failures after the sdk split; Directory Map doc points at the broken path #1352

Description

@amrmelsayed

Problem (found by the pir-1205 builder while rebasing over PR #1346 — credited, verified)

After the sdk restructuring, building from packages/codev (or pnpm --filter @cluesmith/codev build) produces convincing false failures when workspace deps have no fresh dist:

src/commands/porch/index.ts: TS2339 Property 'refreshOverview' does not exist on type 'TowerClient'
src/lib/github.ts: TS2307 Cannot find module '@cluesmith/codev-sdk/constants'

Both read as 'your code is wrong'; neither is — they mean 'a workspace dependency is not built'. The pir-1205 builder nearly reported the sdk restructuring itself as broken on this evidence. Building from the repo root is clean.

Root cause (verified)

  • packages/codev's build script is pnpm clean && tsc && pnpm build:dashboard && pnpm copy-skeleton — it never builds its workspace deps, whose exports maps point at ./dist/*.
  • The root script papers over it with a hand-maintained chain: types && sdk && core && artifact-canvas && codev.
  • The hand-list has already drifted from the graph: it builds artifact-canvas (not in codev's dependency closure) and omits apps/web (which IS in it — the builder empirically verified pnpm --filter "@cluesmith/codev^..." resolves to types, sdk, core, apps/web). Nuance for the implementer: codev's own build:dashboard step may partially cover web — reconcile rather than assume.
  • CLAUDE.md:320 + AGENTS.md:320 (Directory Map) still say: 'pnpm build / pnpm test → run from packages/codev/ or use pnpm --filter @cluesmith/codev build'both are now the broken path. Actively misleading, and the misdirection cost is high precisely because the failure mode masquerades as code errors. (PR Introduce @cluesmith/codev-sdk: client SDK for Tower (server/client dependency isolation) #1346's consult caught other stale build-order doc lines; this one slipped through.)

Fix (the builder's A+D, endorsed)

A. Prefix codev's build with the graph-derived closure: pnpm --filter "@cluesmith/codev^..." build — deps come from the dependency graph, not a hand-list. Apply the same to the root chain (removing the drift class entirely) or let root simply call codev's now-self-sufficient build.

D. Fix the Directory Map lines in CLAUDE.md + AGENTS.md (byte-identical twins) to the correct invocation.

Consider (deeper, optional follow-up): TypeScript project references (composite + tsc -b) — additionally fixes the STALE-dist case (deps built but outdated), which neither A nor a preflight guard catches. Worth weighing against the build-tooling churn.

Scope

BUGFIX/AIR-sized (package.json scripts + two doc lines), unless project references are taken on — then it grows. pir-1205 itself is unaffected (rebased clean, suite green).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreArea: shared core library / forge abstraction (packages/core, packages/codev/src/lib)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions