MCPcopy Index your code
hub / github.com/simstudioai/sim / buildWorkflowAliasLinks

Function buildWorkflowAliasLinks

apps/sim/lib/copilot/vfs/workflow-aliases.ts:323–360  ·  view source on GitHub ↗
(args: {
  workflowPath: string
  workflowId: string
  changelog?: WorkspaceFileRecord | null
  planFiles?: WorkspaceFileRecord[]
})

Source from the content-addressed store, hash-verified

321}
322
323export function buildWorkflowAliasLinks(args: {
324 workflowPath: string
325 workflowId: string
326 changelog?: WorkspaceFileRecord | null
327 planFiles?: WorkspaceFileRecord[]
328}): WorkflowAliasLink[] {
329 const links: WorkflowAliasLink[] = [
330 {
331 kind: 'changelog',
332 aliasPath: `${args.workflowPath}/${WORKFLOW_CHANGELOG_ALIAS_NAME}`,
333 backingPath: workflowChangelogBackingPath(args.workflowId),
334 backingFileId: args.changelog?.id,
335 },
336 {
337 kind: 'plans_dir',
338 aliasPath: `${args.workflowPath}/${WORKFLOW_PLANS_ALIAS_DIR}`,
339 backingPath: workflowPlansBackingFolderPath(args.workflowId),
340 },
341 ]
342
343 for (const file of args.planFiles ?? []) {
344 const relativePath = file.folderPath
345 ?.replace(`${WORKFLOW_PLANS_BACKING_FOLDER}/${args.workflowId}`, '')
346 .replace(/^\/+/, '')
347 const aliasRelativePath = encodeVfsPathSegments(
348 [relativePath, file.name].filter(Boolean).join('/').split('/')
349 )
350 const aliasPath = [args.workflowPath, WORKFLOW_PLANS_ALIAS_DIR, aliasRelativePath].join('/')
351 links.push({
352 kind: 'plan_file',
353 aliasPath,
354 backingPath: canonicalWorkspaceFilePath({ folderPath: file.folderPath, name: file.name }),
355 backingFileId: file.id,
356 })
357 }
358
359 return links
360}

Callers 1

materializeWorkflowsMethod · 0.90

Calls 7

encodeVfsPathSegmentsFunction · 0.90
joinMethod · 0.80
replaceMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected