Skip to content

Commit f7b47bc

Browse files
authored
chore(cleanup): apply codebase-design deep-module pass across the monorepo (#8549)
* chore(skills): vendor codebase-design deep-module vocabulary skill * chore(cleanup): remove dead client hooks, query exports, and orphaned scheduled-tasks utils * refactor(queries): concentrate workflow search MCP list fetches into two helpers * chore(cleanup): dedupe app copies of shared package helpers - import subflow helpers from @sim/workflow-persistence/subflow-helpers - drop env-capabilities and service-account-metadata re-export shims - use isWorkflowBlockProtected in block-enablement - move anonymous user identity into @sim/auth/principal - reuse isLightTileColor from @sim/workflow-renderer/tile-icon-color - use @sim/utils sleep/getErrorMessage in sim-cli (bundled) - remove dead normalizeSandboxProvider export * chore(cleanup): trim log-views to toOverview and use interruptibleSleep in data drains * chore(cleanup): use @sim/utils/object helpers in internal clients and drop dead vanta input-size * chore(cleanup): remove dead logs types, organization utils, and workspace permission queries * chore(cleanup): remove dead custom-tool use cases and unused folder, slack-search, skills, and selector helpers * chore(cleanup): remove unreachable application use cases and API helpers Delete test-only Copilot/executor use cases (bulk table rows by filter, credential delete-many, credential-group invite send/link, sandbox and connected-accounts adapters) with their operation entries, the unused public API route wrapper, parseToolRequest, the invitation management error policy, the execution invitation rate limit, and dead table/chat route helpers. * chore(cleanup): remove dead application use cases and utils, share workflow context resolver - Delete unreachable platform-context, workflow VFS, deployment-overview, chat undeploy, and Copilot block-output/upstream-reference use cases plus their workflowOperations entries - Delete dead fetch-deadline and scheduling utils and unused exported helpers - Add resolvePrincipalWorkflowContext and use it at the 16 identical resolvers - Share processCodeFailure between the Daytona and E2B adapters - Use escapeRegExp and generateId in place of inline equivalents * chore(cleanup): remove unreferenced Copilot table commands, workflow mutation handlers, and param types chore(cleanup): drop unused billing client usage-pill and plan-view exports * chore(cleanup): share webhook provider config, notification URL, and credential token helpers * chore(cleanup): remove dead billing, credential, MCP, and API key exports * chore(cleanup): remove dead executor helpers and redundant LoopConfigWithNodes type * refactor(executor): export subflow node-id codec functions directly and drop forwarders * refactor(providers): drop pass-through model wrappers and share the json_schema response format builder * chore(cleanup): remove dead executor, tools, and block registry exports * chore(cleanup): remove unreachable workspace-file and table use cases * chore(cleanup): reuse knowledge tag slot constants in the tags service * chore(cleanup): share escapeLikePattern from @sim/utils/string * chore(cleanup): reuse zip-guard EOCD parsing in the file sniffer * chore(cleanup): use isRecordLike for inline record guards * chore(cleanup): remove dead uploads, tokenization, table, knowledge, and search exports * chore(cleanup): use shared escapeLikePattern in list-query and logs filters * docs(skills): align codebase-design testing guidance with repo rules and add its license * chore(cleanup): cascade-remove use cases, helpers, and mocks orphaned by deleted Copilot commands * chore(cleanup): consolidate shared helpers and restore TSDoc on moved codec and subflow helpers * test(cleanup): port storage-cleanup ownership tests and drop stale mock keys * test(scripts): follow model-access import move in application-graph fixture * chore(skills): drop vendored codebase-design skill from the repo
1 parent d3f0d26 commit f7b47bc

478 files changed

Lines changed: 1298 additions & 17546 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/docs/components/ui/block-info-card.tsx‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

33
import type * as React from 'react'
4+
import { isLightTileColor } from '@sim/workflow-renderer/tile-icon-color'
45
import { blockTypeToIconMap } from '@/components/ui/icon-mapping'
56

67
interface BlockInfoCardProps {
@@ -9,33 +10,6 @@ interface BlockInfoCardProps {
910
icon?: React.ComponentType<{ className?: string }>
1011
}
1112

12-
/**
13-
* Brightness above which a tile background is "clearly light" and a white
14-
* foreground icon would wash out. Mirrors apps/sim's LIGHT_TILE_THRESHOLD
15-
* (blocks/icon-color.ts) so monochrome `currentColor` icons (e.g. Daytona,
16-
* Notion) stay legible on white/pale tiles instead of white-on-white.
17-
*/
18-
const LIGHT_TILE_THRESHOLD = 0.75
19-
20-
function isLightTileColor(color: string): boolean {
21-
const hex = color.trim().replace('#', '').toLowerCase()
22-
let r: number
23-
let g: number
24-
let b: number
25-
if (/^[0-9a-f]{3}$/.test(hex)) {
26-
r = Number.parseInt(hex[0] + hex[0], 16)
27-
g = Number.parseInt(hex[1] + hex[1], 16)
28-
b = Number.parseInt(hex[2] + hex[2], 16)
29-
} else if (/^[0-9a-f]{6}$/.test(hex)) {
30-
r = Number.parseInt(hex.slice(0, 2), 16)
31-
g = Number.parseInt(hex.slice(2, 4), 16)
32-
b = Number.parseInt(hex.slice(4, 6), 16)
33-
} else {
34-
return false
35-
}
36-
return (0.299 * r + 0.587 * g + 0.114 * b) / 255 > LIGHT_TILE_THRESHOLD
37-
}
38-
3913
export function BlockInfoCard({
4014
type,
4115
color,

‎apps/realtime/src/auth.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
import { createVerifyAuth } from '@sim/auth/verify'
22
import { env } from '@/env'
33

4-
export const ANONYMOUS_USER_ID = '00000000-0000-0000-0000-000000000000'
5-
6-
export const ANONYMOUS_USER = {
7-
id: ANONYMOUS_USER_ID,
8-
name: 'Anonymous',
9-
email: 'anonymous@localhost',
10-
emailVerified: true,
11-
image: null,
12-
} as const
13-
144
export const auth = createVerifyAuth({
155
secret: env.BETTER_AUTH_SECRET,
166
baseURL: env.BETTER_AUTH_URL,

‎apps/realtime/src/middleware/auth.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { ANONYMOUS_USER, ANONYMOUS_USER_ID } from '@sim/auth/principal'
12
import { createLogger } from '@sim/logger'
23
import { toError } from '@sim/utils/errors'
34
import type { Socket } from 'socket.io'
4-
import { ANONYMOUS_USER, ANONYMOUS_USER_ID, auth } from '@/auth'
5+
import { auth } from '@/auth'
56
import { isAuthDisabled } from '@/env'
67

78
const logger = createLogger('SocketAuth')

‎apps/sim/app/api/auth/oauth2/callback/instagram/route.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { db } from '@sim/db'
22
import { account } from '@sim/db/schema'
3+
import { EnvCapabilityConfigurationError } from '@sim/deployment-config/env-capabilities'
34
import { createLogger } from '@sim/logger'
45
import { generateId } from '@sim/utils/id'
56
import { and, eq } from 'drizzle-orm'
67
import { type NextRequest, NextResponse } from 'next/server'
78
import { instagramCallbackContract } from '@/lib/api/contracts/oauth-connections'
89
import { parseRequest } from '@/lib/api/server'
910
import { getSession } from '@/lib/auth'
10-
import { EnvCapabilityConfigurationError } from '@/lib/core/config/env-capabilities'
1111
import { requireConfiguredOAuthClient } from '@/lib/core/config/env-capabilities.server'
1212
import {
1313
DEFAULT_MAX_ERROR_BODY_BYTES,

‎apps/sim/app/api/auth/oauth2/callback/shopify/route.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { EnvCapabilityConfigurationError } from '@sim/deployment-config/env-capabilities'
12
import { createLogger } from '@sim/logger'
23
import { safeCompare } from '@sim/security/compare'
34
import { hmacSha256Hex } from '@sim/security/hmac'
@@ -7,7 +8,6 @@ import {
78
shopifyShopDomainSchema,
89
} from '@/lib/api/contracts/oauth-connections'
910
import { getSession } from '@/lib/auth'
10-
import { EnvCapabilityConfigurationError } from '@/lib/core/config/env-capabilities'
1111
import { requireConfiguredOAuthClient } from '@/lib/core/config/env-capabilities.server'
1212
import { getBaseUrl } from '@/lib/core/utils/urls'
1313
import { isSameOrigin } from '@/lib/core/utils/validation'

‎apps/sim/app/api/chat/utils.ts‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,6 @@ export async function setChatAuthCookie(
2626
})
2727
}
2828

29-
/**
30-
* Check if user has permission to create a chat for a specific workflow
31-
*/
32-
export async function checkWorkflowAccessForChatCreation(
33-
workflowId: string,
34-
userId: string
35-
): Promise<{ hasAccess: boolean; workflow?: any }> {
36-
const authorization = await authorizeWorkflowByWorkspacePermission({
37-
workflowId,
38-
userId,
39-
action: 'admin',
40-
})
41-
42-
if (!authorization.workflow) {
43-
return { hasAccess: false }
44-
}
45-
46-
if (authorization.allowed) {
47-
return { hasAccess: true, workflow: authorization.workflow }
48-
}
49-
50-
return { hasAccess: false }
51-
}
52-
5329
/**
5430
* Check if user has access to view/edit/delete a specific chat
5531
*/

‎apps/sim/app/api/files/delete/route.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ describe('File Delete API Route', () => {
5454
filesAuthorizationMockFns.mockVerifyFileAccess.mockResolvedValue(true)
5555
storageServiceMockFns.mockDeleteFile.mockResolvedValue(undefined)
5656
storageServiceMockFns.mockHasCloudStorage.mockReturnValue(true)
57-
uploadsMockFns.mockGetStorageProvider.mockReturnValue('s3')
5857
uploadsMockFns.mockIsUsingCloudStorage.mockReturnValue(true)
5958
})
6059

‎apps/sim/app/api/files/utils.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class InvalidRequestError extends Error {
4040
}
4141
}
4242

43-
export const contentTypeMap: Record<string, string> = {
43+
const contentTypeMap: Record<string, string> = {
4444
txt: 'text/plain',
4545
csv: 'text/csv',
4646
json: 'application/json',

‎apps/sim/app/api/public-api-route-handler.test.ts‎

Lines changed: 0 additions & 191 deletions
This file was deleted.

0 commit comments

Comments
 (0)