Skip to content

Phase 1A — @repowise/ui extraction (types + scaffold)#118

Closed
RaghavChamadiya wants to merge 4 commits intomainfrom
phase-1a-ui-types
Closed

Phase 1A — @repowise/ui extraction (types + scaffold)#118
RaghavChamadiya wants to merge 4 commits intomainfrom
phase-1a-ui-types

Conversation

@RaghavChamadiya
Copy link
Copy Markdown
Collaborator

Summary

Phase 1A of the hosted upgrade programme (per + "docs/HOSTED_PRODUCT_UPGRADE_PLAN.md" + §5 + + "docs/HOSTED_IMPLEMENTATION_GUIDE.md" + ). Option α confirmed: + "packages/types" + + + "packages/ui" + live inside the OSS monorepo. Scaffolding only — no component moves; that's 1B.

What ships

+ "packages/types" + (new) — canonical TS contracts shared between OSS web ( + "packages/web" + ) and the hosted web app (currently + "frontend/" + , becoming + "packages/hosted-web/" + in 1B).

  • Modules: + "graph" + , + "git" + , + "docs" + , + "decisions" + , + "dead-code" + , + "symbols" + , + "chat" + — exposed via subpath exports
  • + "ChatArtifact" + discriminated union (net-new): + "KnownChatArtifact" + + + "GenericArtifact" + + + "isKnownChatArtifact" + narrowing helper. Lets 2B's + "chat/artifact-panel.tsx" + switch on + ".type" + instead of casting + "Record<string, unknown>" + .
  • 12 type-level tests ( + "vitest --typecheck" + ) covering narrowing per variant, optional-field invariants, literal unions, + "Hotspot.file_path" + invariant.

+ "packages/ui" + (new, scaffold only) — empty subpath exports for + "graph" + / + "git" + / + "dead-code" + / + "decisions" + / + "docs" + / + "symbols" + / + "coverage" + / + "wiki" + / + "chat" + / + "dashboard" + / + "workspace" + / + "jobs" + / + "shared" + / + "hooks" + / + "ui" + . React 19 peer dep. + "@repowise/types" + workspace dep.

Root — added + "packages/types" + + + "packages/ui" + to npm workspaces; root scripts use + "--workspaces --if-present" + so each package opts in.

+ "docs/HOSTED_PROGRESS.md" + now tracked — dropped from + ".gitignore" + so phase sessions can update it in-repo.

Decisions taken

  • Canonical type style: OSS engine shapes win for engine-derived data; hosted-only enrichment fields ( + "status" + , + "note" + , + "staleness_score" + , + "edge_type" + , + "confidence" + ) layer in as optional so OSS-shaped artifacts still satisfy the contract.
  • npm workspaces, no Turborepo — caching value kicks in at >5 build targets; revisit at 1B exit.
  • No tsup in 1A — both consumers are Next.js with + "transpilePackages" + ; raw TS resolves directly. Add when 1B starts shipping components, OR if a non-Next consumer appears.
  • + "Symbol" + + "CodeSymbol" + to avoid shadowing the JS global.

Full close-out (decisions, drift, next-session entry point) is in + "docs/HOSTED_PROGRESS.md" + .

Out of scope (Phase 1B)

  • Component moves out of + "packages/web/src/components/" + and + "frontend/src/components/demo/" + .
  • + "frontend/" + + "packages/hosted-web/" + rename.
  • Copying the canonical Tailwind v4 + "@theme" + token set into + "packages/ui/styles/globals.css" + .
  • Wiring + "transpilePackages: ["@repowise/ui"]" + in either + "next.config.ts" + .

Test plan

  • + "npm install" + clean across workspaces
  • + "tsc --noEmit" + in + "packages/types" + and + "packages/ui" + (strict, + "exactOptionalPropertyTypes" + , + "noUncheckedIndexedAccess" + )
  • + "vitest run --typecheck" + in + "packages/types" + (12/12 pass)
  • CI green
  • OSS + "packages/web" + + "type-check" + + + "build" + still pass (no consumer changes in 1A but workspace install touched lockfile)

Adds packages/types as a workspace package, holding the canonical
TypeScript shapes shared between packages/web (OSS) and the hosted
frontend (currently frontend/, to become packages/hosted-web in 1B).

Modules: graph, git, docs, decisions, dead-code, symbols, chat.
ChatArtifact is a discriminated union (KnownChatArtifact + GenericArtifact
+ isKnownChatArtifact narrowing helper) so 2B's artifact-panel can switch
on .type instead of casting Record<string, unknown>.

Per-domain canonical decisions:
- OSS engine shapes (PipelineResult / SymbolResponse / GitMetadata /
  DecisionRecordResponse) are canonical for engine-derived data; hosted's
  looser fields (path vs file_path, bare strings vs literal unions) get
  reshaped via adapters in 1B.
- Hosted-only enrichment fields (DeadCodeFinding.status/note,
  DecisionRecord.staleness_score, GraphLink.confidence/edge_type) are
  optional so OSS-shaped artifacts still satisfy the contract.

Tests: vitest --typecheck against contracts.test.ts (12 assertions covering
narrowing, optional-field invariants, literal unions). Passes clean.
Skeleton only — Phase 1A scope is types extraction + scaffolding;
component moves are 1B (per plan §5.3 day 5–7).

Sets up:
- package.json with subpath exports (graph, git, dead-code, decisions,
  docs, symbols, coverage, wiki, chat, dashboard, workspace, jobs,
  shared, hooks, ui) so 1B can drop components into per-domain
  directories without re-touching the exports map.
- React 19 peer dep; @repowise/types as workspace dep.
- tsconfig with paths shim so the package resolves @repowise/types
  from source (no build step needed in dev).
- Empty styles/globals.css placeholder; 1B copies the canonical
  Tailwind v4 @theme tokens out of packages/web.
- README documenting layout + consuming pattern.
@RaghavChamadiya RaghavChamadiya requested a review from swati510 as a code owner May 1, 2026 08:50
@RaghavChamadiya
Copy link
Copy Markdown
Collaborator Author

Superseded by a re-opened PR with a corrected base branch and cleaner commit messages.

@RaghavChamadiya RaghavChamadiya deleted the phase-1a-ui-types branch May 1, 2026 09:42
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.

1 participant