3.8 KiB

Frontend Shared Boundary Cleanup Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Narrow the frontend shared/public API surface and remove remaining architecture ambiguity without changing business logic or UI behavior.

Architecture: This feature is a boundary cleanup pass. First identify the exact shared/public exports and the remaining cross-entity or cross-widget dependencies, then move or remove the problematic edges, then update docs so the layer boundaries are explicit for future work.

Tech Stack: TypeScript, FSD conventions, existing frontend barrels, shared/api, docs in apps/docs.


Task 1: Audit shared/public boundaries

Files:

  • Read: apps/frontend/src/shared/api/index.ts

  • Read: apps/frontend/src/shared/api/kyClient.ts

  • Read: apps/frontend/src/entities/*/index.ts

  • Read: apps/frontend/src/widgets/*/index.ts

  • Read: apps/docs/docs/frontend/overview.md

  • Read: docs/features/frontend-fsd-final/spec.md

  • Step 1: Identify the current shared API surface

List which exports are truly shared infrastructure and which exports are actually domain-specific convenience aliases.

  • Step 2: Identify remaining boundary ambiguities

Check for cross-entity or cross-widget imports that are technically working but should use public barrels or be moved.

Task 2: Narrow the shared surface

Files:

  • Modify: apps/frontend/src/shared/api/index.ts

  • Modify: apps/frontend/src/shared/api/kyClient.ts only if needed for public surface consistency

  • Modify: apps/frontend/src/entities/*/api/*.ts where the boundary cleanup requires public API reshaping

  • Step 1: Keep only truly shared infrastructure in shared/api

Remove or relocate aliases that are better expressed through entity public APIs rather than the shared root.

  • Step 2: Route domain-specific access through entity barrels

Ensure entities expose their own public entrypoints instead of relying on shared convenience exports for domain shapes.

Task 3: Fix ambiguous cross-boundary imports

Files:

  • Modify: any remaining apps/frontend/src/entities/*/model/*.ts

  • Modify: any remaining apps/frontend/src/widgets/*/ui/*.tsx

  • Modify: any impacted index.ts barrel files

  • Step 1: Replace ambiguous cross-entity imports with public barrels

If one entity consumes another, use the other entity's public API rather than deep imports.

  • Step 2: Replace ambiguous widget dependencies with shared or public widget APIs

If one widget reuses another widget's reusable piece, either move the reusable piece to shared or expose a proper public entrypoint.

Task 4: Update boundary docs

Files:

  • Modify: apps/docs/docs/frontend/overview.md

  • Modify: apps/docs/docs/frontend/api-client.md

  • Modify: docs/features/frontend-shared-boundary-cleanup/spec.md if scope clarification is needed during implementation

  • Step 1: Document the current public API rules

Spell out what shared, entities, and widgets are expected to export publicly after cleanup.

  • Step 2: Reflect the narrowed shared surface

Remove wording that implies shared owns domain-specific convenience exports.

Task 5: Verification

Files:

  • Read: changed frontend files and docs

  • Step 1: Run the targeted frontend checks

Run:

npm run lint -w apps/frontend
npm run test -w apps/frontend
npm run build -w apps/frontend

Expected: all three commands pass after the boundary cleanup changes land.

  • Step 2: Verify no behavior drift

Confirm that the UI and API contracts still behave the same after import and export boundary changes.