Skip to content

refactor(shared): group worktree, github, and linear modules into folders - #14408

Closed
nwparker wants to merge 1 commit into
nwparker/split-shared-types-barrelfrom
nwparker/shared-domain-folders
Closed

nwparker wants to merge 1 commit into
nwparker/split-shared-types-barrelfrom
nwparker/shared-domain-folders

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Stacked on #14397 — review that first; this PR's diff is against it.

What

src/shared is a flat directory of ~1,150 entries. The worktree, github, and linear domains alone accounted for 71 of them, so finding a module meant scanning a wall of same-prefixed filenames.

Each domain moves into its own folder with the now-redundant prefix dropped, following the existing network/ and new-workspace/ convention in the same directory:

src/shared/github-pr-types.ts   ->  src/shared/github/pull-request-types.ts
src/shared/worktree-id.ts       ->  src/shared/worktree/id.ts
src/shared/linear-links.ts      ->  src/shared/linear/links.ts
folder files
src/shared/worktree/ 25
src/shared/github/ 27
src/shared/linear/ 19

Whole clusters move, including tests. Foldering only part of a domain would be worse than leaving it flat — a reader would have to check both github/ and the flat directory, and github-auth-types.ts / github-project-types.ts are themselves type modules that belong with the rest. Zero files with these prefixes remain flat.

Import specifiers were rewritten by resolving each to an absolute path and recomputing it, not by string substitution — which is why the @/../../shared/github-auth-types alias forms came out right. 502 specifiers across 299 files.

Two things tsc cannot catch

  1. Stale ratchet entry. github-project-types.ts carries its own max-lines bypass. Its baseline entry is repointed, not pruned — --prune would drop the bypass and then flag the new path as a fresh violation. Ratchet stays at 345.
  2. mobile/ is outside pnpm typecheck and can't be typechecked here (mobile/node_modules is empty; expo/tsconfig.base.json missing — pre-existing). It was modified, so instead every relative specifier in the repo was resolved against the filesystem: 174 unresolved before, 174 after — identical, so mobile is fine too.

The pinned tests/e2e/.cross-version-checkouts fixtures are deliberately not rewritten — they're a snapshot of an older release and correctly still reference the old paths.

Verification

Known leftover

A dated design-handoff doc (docs/reference/terminal-session-correctness-handoff-2026-08-07/) cites src/shared/worktree-id.ts:15-28. Left as-is: it's a point-in-time archive whose line numbers are already stale, and rewriting it would misrepresent what was true at that date.

…ders

`src/shared` is a flat directory of ~1,150 entries. The worktree, github, and
linear domains accounted for 71 of them, so finding the module you wanted meant
scanning a wall of same-prefixed filenames.

Move each domain into its own folder and drop the now-redundant prefix:

    src/shared/github-pr-types.ts    -> src/shared/github/pull-request-types.ts
    src/shared/worktree-id.ts        -> src/shared/worktree/id.ts
    src/shared/linear-links.ts       -> src/shared/linear/links.ts

This follows the existing `network/` and `new-workspace/` convention in the
same directory, which also drop the prefix inside the folder.

Whole clusters move, including tests. Foldering only part of a domain would be
worse than flat: a reader would have to check both `github/` and the flat
directory, and `github-auth-types.ts` / `github-project-types.ts` are type
modules that belong with the rest.

Import specifiers were rewritten by resolving each one to an absolute path and
recomputing it, not by string substitution, so the `@/../../shared/...` alias
forms are handled correctly. 502 specifiers across 299 files.

Two things `tsc` cannot catch, handled explicitly:

- `github-project-types.ts` carries its own `max-lines` bypass, so its baseline
  entry is REPOINTED to the new path rather than pruned. Pruning would drop the
  bypass and then flag the new path as a fresh violation. Ratchet stays at 345.
- `mobile/` is outside `pnpm typecheck` and cannot be typechecked here
  (`mobile/node_modules` is empty). Instead every relative specifier in the repo
  was resolved against the filesystem: 174 unresolved before this change and 174
  after — identical, so nothing broke in mobile either.

The pinned `tests/e2e/.cross-version-checkouts` fixtures are deliberately NOT
rewritten; they are a snapshot of an older release and still reference the old
paths.

Verified: cold `tsc --noEmit` green on node, cli, and web (buildinfo deleted
first — these projects are `composite: true` and reuse stale caches).
@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown

Too many files changed for review (319 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@nwparker
nwparker deleted the branch nwparker/split-shared-types-barrel August 14, 2026 03:34
@nwparker nwparker closed this Aug 14, 2026
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