mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
refactor(shared): group worktree, github, and linear modules into folders (#14437)
`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. No files with these prefixes remain flat.
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. 501 specifiers across 298 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).
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* uses stable field labels ("Token scopes:", "(GITHUB_TOKEN)", etc.).
|
||||
*/
|
||||
import { ghExecFileAsync } from '../git/runner'
|
||||
import type { GhAuthDiagnostic, GhAuthAccount } from '../../shared/github-auth-types'
|
||||
import type { GhAuthDiagnostic, GhAuthAccount } from '../../shared/github/auth-types'
|
||||
|
||||
// Required scopes for ProjectV2 GraphQL access in Orca. `project` is the
|
||||
// scope that gates ProjectV2 reads/writes; the others are needed for the
|
||||
|
||||
@@ -118,7 +118,7 @@ import {
|
||||
_resetMergeQueueCacheForTests,
|
||||
_resetOwnerRepoCache
|
||||
} from './client'
|
||||
import { GITHUB_WORK_ITEMS_QUERY_MAX_BYTES } from '../../shared/github-work-items-query-bounds'
|
||||
import { GITHUB_WORK_ITEMS_QUERY_MAX_BYTES } from '../../shared/github/work-items-query-bounds'
|
||||
|
||||
import { _resetOriginGitHubApiRepositoryCache } from './github-api-repository'
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ import {
|
||||
_resetMergeQueueCacheForTests,
|
||||
_resetOwnerRepoCache
|
||||
} from './client'
|
||||
import { GITHUB_WORK_ITEMS_QUERY_MAX_BYTES } from '../../shared/github-work-items-query-bounds'
|
||||
import { GITHUB_WORK_ITEMS_QUERY_MAX_BYTES } from '../../shared/github/work-items-query-bounds'
|
||||
|
||||
import { _resetOriginGitHubApiRepositoryCache } from './github-api-repository'
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@ import {
|
||||
normalizeHostedReviewBaseRef,
|
||||
normalizeHostedReviewHeadRef
|
||||
} from '../../shared/hosted-review-refs'
|
||||
import { normalizeGitHubPRMergeMethodSettings } from '../../shared/github-pr-merge-methods'
|
||||
import { normalizeGitHubPRMergeMethodSettings } from '../../shared/github/pull-request-merge-methods'
|
||||
import { summarizeProviderChecks } from '../../shared/provider-check-summary'
|
||||
import { isGitHubWorkItemsQueryTooLarge } from '../../shared/github-work-items-query-bounds'
|
||||
import { classifyGitHubUnavailable } from '../../shared/github-api-availability'
|
||||
import { isGitHubWorkItemsQueryTooLarge } from '../../shared/github/work-items-query-bounds'
|
||||
import { classifyGitHubUnavailable } from '../../shared/github/api-availability'
|
||||
import { parseTaskQuery, type ParsedTaskQuery } from '../../shared/task-query'
|
||||
import {
|
||||
GITHUB_WORK_ITEMS_SSH_REMOTE_REQUIRED_MESSAGE,
|
||||
@@ -91,7 +91,7 @@ import {
|
||||
type GitHubRepoExecOptions,
|
||||
type GitHubApiRepository
|
||||
} from './github-api-repository'
|
||||
import { githubRepoIdentityKey } from '../../shared/github-repository-identity-key'
|
||||
import { githubRepoIdentityKey } from '../../shared/github/repository-identity-key'
|
||||
export { _resetOwnerRepoCache } from './gh-utils'
|
||||
export {
|
||||
getIssue,
|
||||
@@ -127,7 +127,7 @@ import {
|
||||
import {
|
||||
GITHUB_CHECK_DETAILS_HOST_TIMEOUT_MS,
|
||||
GITHUB_CHECK_DETAILS_TIMEOUT_MESSAGE
|
||||
} from '../../shared/github-check-details-deadline'
|
||||
} from '../../shared/github/check-details-deadline'
|
||||
import { hydrateGitHubPRStack, mergeGitHubPRStack } from './github-pr-stack'
|
||||
|
||||
type GhExecOptions = GitHubRepoExecOptions & { signal?: AbortSignal }
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
__resetLocalGitConfigSignatureCacheForTests,
|
||||
readLocalGitConfigSignature
|
||||
} from './local-git-config-signature'
|
||||
import { GITHUB_SEARCH_RESULT_WINDOW_ERROR_PATTERN } from '../../shared/github-work-items-query-bounds'
|
||||
import { GITHUB_SEARCH_RESULT_WINDOW_ERROR_PATTERN } from '../../shared/github/work-items-query-bounds'
|
||||
|
||||
describe('github owner/repo resolution', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { GitHubOwnerRepo, IssueSourcePreference } from '../../shared/types'
|
||||
import {
|
||||
githubRepoIdentityKey,
|
||||
isDefaultGitHubHost
|
||||
} from '../../shared/github-repository-identity-key'
|
||||
} from '../../shared/github/repository-identity-key'
|
||||
import {
|
||||
getOwnerRepoForRemote,
|
||||
ghRepoExecOptions,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { IssueSourcePreference } from '../../shared/types'
|
||||
import { githubRepoIdentityKey } from '../../shared/github-repository-identity-key'
|
||||
import { githubRepoIdentityKey } from '../../shared/github/repository-identity-key'
|
||||
import {
|
||||
getOwnerRepoForRemote,
|
||||
type LocalGitExecOptions,
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
PRReviewDecision,
|
||||
PRState
|
||||
} from '../../shared/types'
|
||||
import { githubRepoIdentityKey } from '../../shared/github-repository-identity-key'
|
||||
import { githubRepoIdentityKey } from '../../shared/github/repository-identity-key'
|
||||
import { ghExecFileAsync } from '../git/runner'
|
||||
import {
|
||||
githubHostExecOptions,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ghExecFileAsync } from './gh-utils'
|
||||
import { noteRepositoryRateLimitSpend, repositoryRateLimitGuard } from './rate-limit'
|
||||
import { githubHostExecOptions } from './github-api-repository'
|
||||
import { githubRepoIdentityKey } from '../../shared/github-repository-identity-key'
|
||||
import { githubRepoIdentityKey } from '../../shared/github/repository-identity-key'
|
||||
import type { OwnerRepo } from './github-repository-identity'
|
||||
|
||||
type GhExecOptions = Parameters<typeof ghExecFileAsync>[1]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PRRefreshErrorType } from '../../shared/types'
|
||||
import { classifyGitHubUnavailable } from '../../shared/github-api-availability'
|
||||
import { classifyGitHubUnavailable } from '../../shared/github/api-availability'
|
||||
import { extractExecError } from '../git/exec-error'
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import {
|
||||
GITHUB_PROJECT_REF_INPUT_MAX_BYTES,
|
||||
GITHUB_PROJECT_REF_INPUT_TOO_LARGE_ERROR
|
||||
} from '../../shared/github-project-ref-input'
|
||||
} from '../../shared/github/project-ref-input'
|
||||
import {
|
||||
PROJECT_VIEW_OWNER_CACHE_MAX_ENTRIES,
|
||||
_getProjectViewCacheSizesForTests,
|
||||
|
||||
@@ -46,12 +46,12 @@ import type {
|
||||
ListProjectViewsResult,
|
||||
ResolveProjectRefArgs,
|
||||
ResolveProjectRefResult
|
||||
} from '../../shared/github-project-types'
|
||||
} from '../../shared/github/project-types'
|
||||
import {
|
||||
GITHUB_PROJECT_REF_INPUT_TOO_LARGE_ERROR,
|
||||
isGitHubProjectRefInputTooLarge
|
||||
} from '../../shared/github-project-ref-input'
|
||||
import { githubProjectHost } from '../../shared/github-project-identity'
|
||||
} from '../../shared/github/project-ref-input'
|
||||
import { githubProjectHost } from '../../shared/github/project-identity'
|
||||
|
||||
// Re-export the public API so existing `./project-view` call sites keep working; the split is internal-only.
|
||||
export { isValidOwnerSlug, isValidRepoSlug } from './project-view/internals'
|
||||
|
||||
@@ -9,9 +9,9 @@ import {
|
||||
noteRepositoryRateLimitSpend,
|
||||
type RateLimitBucketKind
|
||||
} from '../rate-limit'
|
||||
import type { GitHubProjectViewError } from '../../../shared/github-project-types'
|
||||
import { githubProjectHost } from '../../../shared/github-project-identity'
|
||||
import { isDefaultGitHubHost } from '../../../shared/github-repository-identity-key'
|
||||
import type { GitHubProjectViewError } from '../../../shared/github/project-types'
|
||||
import { githubProjectHost } from '../../../shared/github/project-identity'
|
||||
import { isDefaultGitHubHost } from '../../../shared/github/repository-identity-key'
|
||||
import { isGitHubHostAuthenticatedForGlobalCli } from '../github-enterprise-repository'
|
||||
import {
|
||||
classifyProjectError,
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
type GraphqlVars
|
||||
} from './internals'
|
||||
import { classifyProjectError, rateLimitedError } from './project-error-classification'
|
||||
import { githubProjectHost } from '../../../shared/github-project-identity'
|
||||
import { githubProjectHost } from '../../../shared/github/project-identity'
|
||||
import type { GitHubAssignableUser, GitHubWorkItemDetails, PRComment } from '../../../shared/types'
|
||||
import type {
|
||||
AddIssueCommentBySlugArgs,
|
||||
@@ -39,7 +39,7 @@ import type {
|
||||
UpdateIssueTypeBySlugArgs,
|
||||
UpdatePullRequestBySlugArgs,
|
||||
UpdateProjectItemFieldArgs
|
||||
} from '../../../shared/github-project-types'
|
||||
} from '../../../shared/github/project-types'
|
||||
|
||||
function githubHostExecOptions(args: { host?: string }): { host: string } {
|
||||
return { host: githubProjectHost(args.host) }
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Why: turns raw gh stderr/stdout into the typed GitHubProjectViewError the
|
||||
// renderer can act on (auth vs scope vs rate limit vs drift), shared by the
|
||||
// project-view read and mutation paths.
|
||||
import type { GitHubProjectViewError } from '../../../shared/github-project-types'
|
||||
import { githubProjectHost } from '../../../shared/github-project-identity'
|
||||
import type { GitHubProjectViewError } from '../../../shared/github/project-types'
|
||||
import { githubProjectHost } from '../../../shared/github/project-identity'
|
||||
|
||||
export type GhGraphqlErrorShape = {
|
||||
type?: string
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
GitHubRateLimitBucket,
|
||||
GitHubRateLimitSnapshot
|
||||
} from '../../shared/types'
|
||||
import { isDefaultGitHubHost } from '../../shared/github-repository-identity-key'
|
||||
import { isDefaultGitHubHost } from '../../shared/github/repository-identity-key'
|
||||
import { isWslUncPath } from '../../shared/wsl-paths'
|
||||
import { acquire, release } from './gh-utils'
|
||||
import { ghExecFileAsync } from '../git/runner'
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
CreateStackedHostedReviewInput,
|
||||
CreateStackedHostedReviewResult
|
||||
} from '../../shared/hosted-review'
|
||||
import { isDefaultGitHubHost } from '../../shared/github-repository-identity-key'
|
||||
import { isDefaultGitHubHost } from '../../shared/github/repository-identity-key'
|
||||
import {
|
||||
normalizeHostedReviewBaseRef,
|
||||
normalizeHostedReviewHeadRef
|
||||
|
||||
Reference in New Issue
Block a user