mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
`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).
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import type {
|
|
LinearIssueRelationship,
|
|
LinearIssueRelationWriteRequest,
|
|
LinearIssueRelationWriteResult
|
|
} from '../../shared/linear/agent-access'
|
|
import type { CommandHandler } from '../dispatch'
|
|
import { getRequiredStringFlag } from '../flags'
|
|
import { printResult } from '../format'
|
|
import { formatLinearRelationWrite } from '../linear-format'
|
|
import { buildWriteTargetRequest } from '../linear-request-builders'
|
|
import { RuntimeClientError } from '../runtime-client'
|
|
|
|
const LINEAR_WRITE_TIMEOUT_MS = 75_000
|
|
|
|
export function linearRelationWriteHandler(operation: 'add' | 'remove'): CommandHandler {
|
|
return async ({ flags, client, cwd, json }) => {
|
|
const request: LinearIssueRelationWriteRequest = {
|
|
...buildWriteTargetRequest(flags, cwd, client.isRemote),
|
|
relatedInput: getRequiredStringFlag(flags, 'related'),
|
|
relationship: parseRelationship(getRequiredStringFlag(flags, 'type')),
|
|
operation
|
|
}
|
|
const response = await client.call<LinearIssueRelationWriteResult>(
|
|
'linear.issueRelationWrite',
|
|
request,
|
|
{ timeoutMs: LINEAR_WRITE_TIMEOUT_MS }
|
|
)
|
|
printResult(response, json, formatLinearRelationWrite)
|
|
}
|
|
}
|
|
|
|
function parseRelationship(value: string): LinearIssueRelationship {
|
|
const relationship = {
|
|
blocks: 'blocks',
|
|
'blocked-by': 'blockedBy',
|
|
related: 'relatedTo',
|
|
'duplicate-of': 'duplicateOf'
|
|
}[value]
|
|
if (!relationship) {
|
|
throw new RuntimeClientError(
|
|
'invalid_argument',
|
|
'--type must be blocks, blocked-by, related, or duplicate-of'
|
|
)
|
|
}
|
|
return relationship as LinearIssueRelationship
|
|
}
|