finish phase 3: type-only codemod and zero non-bridge @atproto/api imports

Task 8: codemod repointed 150 namespace-type files to #/lexicons
(AppBskyFeedDefs.PostView -> app.bsky.feed.defs.PostView, .Record -> .Main)
plus ~105 hand-fixed consumers (composer/video state, DebugMod, Profile,
onboarding, dialogs). DM_SERVICE_HEADERS deleted; last chat call sites on
the chat client. RichText.tsx flipped to SDK-only. Remaining @atproto/api
importers: the three session bridge files, the deliberate dual-world
matcher in lib/xrpc-error.ts, and test fixtures. toLex boundary casts are
TODO(phase4)-tagged for bridge removal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-07-17 02:08:48 +03:00
parent 300a50b69a
commit e7d349bc30
283 changed files with 2029 additions and 1806 deletions
@@ -1,13 +1,12 @@
import {View} from 'react-native'
import {
type $Typed,
type AppBskyGraphDefs,
type AppBskyGraphListitem,
type AppBskyGraphStarterpack,
type ComAtprotoRepoApplyWrites,
} from '@atproto/api'
import {TID} from '@atproto/common-web'
import {AtUri} from '@atproto/syntax'
import {type $Typed} from '@atproto/lex'
import {
type AtIdentifierString,
AtUri,
type AtUriString,
toDatetimeString,
} from '@atproto/syntax'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
@@ -20,7 +19,7 @@ import {wait} from '#/lib/async/wait'
import {type NavigationProp} from '#/lib/routes/types'
import {logger} from '#/logger'
import {getAllListMembers} from '#/state/queries/list-members'
import {useAgent, useSession} from '#/state/session'
import {useAppviewClient, usePdsClient, useSession} from '#/state/session'
import {atoms as a, platform, useTheme, web} from '#/alf'
import {Admonition} from '#/components/Admonition'
import {Button, ButtonText} from '#/components/Button'
@@ -29,6 +28,7 @@ import {Loader} from '#/components/Loader'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {useAnalytics} from '#/analytics'
import {app, com} from '#/lexicons'
import {CreateOrEditListDialog} from './CreateOrEditListDialog'
export function CreateListFromStarterPackDialog({
@@ -36,11 +36,12 @@ export function CreateListFromStarterPackDialog({
starterPack,
}: {
control: Dialog.DialogControlProps
starterPack: AppBskyGraphDefs.StarterPackView
starterPack: app.bsky.graph.defs.StarterPackView
}) {
const {_} = useLingui()
const t = useTheme()
const agent = useAgent()
const pdsClient = usePdsClient()
const appviewClient = useAppviewClient()
const ax = useAnalytics()
const {currentAccount} = useSession()
const navigation = useNavigation<NavigationProp>()
@@ -48,7 +49,7 @@ export function CreateListFromStarterPackDialog({
const createDialogControl = Dialog.useDialogControl()
const loadingDialogControl = Dialog.useDialogControl()
const record = starterPack.record as AppBskyGraphStarterpack.Record
const record = starterPack.record as app.bsky.graph.starterpack.Main
const onPressCreate = () => {
control.close(() => createDialogControl.open())
@@ -73,16 +74,19 @@ export function CreateListFromStarterPackDialog({
const listItems = await wait(
3000,
(async () => {
const items = await getAllListMembers(agent, starterPack.list!.uri)
const items = await getAllListMembers(
appviewClient,
starterPack.list!.uri,
)
if (items.length > 0) {
const listitemWrites: $Typed<ComAtprotoRepoApplyWrites.Create>[] =
const listitemWrites: $Typed<com.atproto.repo.applyWrites.Create>[] =
items.map(item => {
const listitemRecord: $Typed<AppBskyGraphListitem.Record> = {
const listitemRecord: $Typed<app.bsky.graph.listitem.Main> = {
$type: 'app.bsky.graph.listitem',
subject: item.subject.did,
list: listUri,
createdAt: new Date().toISOString(),
list: listUri as AtUriString,
createdAt: toDatetimeString(new Date()),
}
return {
$type: 'com.atproto.repo.applyWrites#create',
@@ -94,8 +98,8 @@ export function CreateListFromStarterPackDialog({
const chunks = chunk(listitemWrites, 50)
for (const c of chunks) {
await agent.com.atproto.repo.applyWrites({
repo: currentAccount.did,
await pdsClient.call(com.atproto.repo.applyWrites, {
repo: currentAccount.did as AtIdentifierString,
writes: c,
})
}
@@ -103,10 +107,10 @@ export function CreateListFromStarterPackDialog({
await until(
5,
1e3,
(res: {data: {items: unknown[]}}) => res.data.items.length > 0,
(res: {items: unknown[]}) => res.items.length > 0,
() =>
agent.app.bsky.graph.getList({
list: listUri,
appviewClient.call(app.bsky.graph.getList, {
list: listUri as AtUriString,
limit: 1,
}),
)
@@ -1,6 +1,5 @@
import {useCallback, useEffect, useMemo, useState} from 'react'
import {View} from 'react-native'
import {type AppBskyGraphDefs} from '@atproto/api'
import {RichText as RichTextAPI} from '@bsky.app/sdk/richtext'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -28,6 +27,7 @@ import * as Prompt from '#/components/Prompt'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {IS_WEB} from '#/env'
import {type app} from '#/lexicons'
import {toLex} from '#/types/bsky'
const DISPLAY_NAME_MAX_GRAPHEMES = 64
@@ -47,8 +47,8 @@ export function CreateOrEditListDialog({
initialValues,
}: {
control: Dialog.DialogControlProps
list?: AppBskyGraphDefs.ListView
purpose?: AppBskyGraphDefs.ListPurpose
list?: app.bsky.graph.defs.ListView
purpose?: app.bsky.graph.defs.ListPurpose
onSave?: (uri: string) => void
initialValues?: InitialListValues
}) {
@@ -115,8 +115,8 @@ function DialogInner({
onPressCancel,
initialValues,
}: {
list?: AppBskyGraphDefs.ListView
purpose?: AppBskyGraphDefs.ListPurpose
list?: app.bsky.graph.defs.ListView
purpose?: app.bsky.graph.defs.ListPurpose
onSave?: (uri: string) => void
setDirty: (dirty: boolean) => void
onPressCancel: () => void
@@ -1,6 +1,5 @@
import {useCallback, useMemo} from 'react'
import {View} from 'react-native'
import {type AppBskyGraphDefs} from '@atproto/api'
import {type ModerationOpts} from '@bsky.app/sdk/moderation'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
@@ -23,6 +22,7 @@ import {
import {Loader} from '#/components/Loader'
import * as ProfileCard from '#/components/ProfileCard'
import * as Toast from '#/components/Toast'
import {type app} from '#/lexicons'
import type * as bsky from '#/types/bsky'
export function ListAddRemoveUsersDialog({
@@ -31,7 +31,7 @@ export function ListAddRemoveUsersDialog({
onChange,
}: {
control: Dialog.DialogControlProps
list: AppBskyGraphDefs.ListView
list: app.bsky.graph.defs.ListView
onChange?: (
type: 'add' | 'remove',
profile: bsky.profile.AnyProfileView,
@@ -52,7 +52,7 @@ function DialogInner({
list,
onChange,
}: {
list: AppBskyGraphDefs.ListView
list: app.bsky.graph.defs.ListView
onChange?: (
type: 'add' | 'remove',
profile: bsky.profile.AnyProfileView,
@@ -89,7 +89,7 @@ function DialogInner({
* Returns undefined for pending, false for not a member, and string for a member (the URI of the membership record)
*/
function getMembership(
listMembers: AppBskyGraphDefs.ListItemView[] | undefined,
listMembers: app.bsky.graph.defs.ListItemView[] | undefined,
actorDid: string,
): string | false | undefined {
if (!listMembers) {
@@ -107,8 +107,8 @@ function UserResult({
moderationOpts,
}: {
profile: bsky.profile.AnyProfileView
list: AppBskyGraphDefs.ListView
listMembers: AppBskyGraphDefs.ListItemView[] | undefined
list: app.bsky.graph.defs.ListView
listMembers: app.bsky.graph.defs.ListItemView[] | undefined
onChange?: (
type: 'add' | 'remove',
profile: bsky.profile.AnyProfileView,