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

Function workflowAliasTargetForPath

apps/sim/lib/copilot/vfs/workflow-aliases.ts:164–212  ·  view source on GitHub ↗
(workflow: WorkflowAliasWorkflow, rawPath: string)

Source from the content-addressed store, hash-verified

162}
163
164function workflowAliasTargetForPath(workflow: WorkflowAliasWorkflow, rawPath: string) {
165 const workflowPath = workflowVfsPath(workflow)
166 const changelogPath = `${workflowPath}/${WORKFLOW_CHANGELOG_ALIAS_NAME}`
167 if (rawPath === changelogPath) {
168 return {
169 kind: 'changelog' as const,
170 scope: 'workflow' as const,
171 workflowId: workflow.id,
172 workflowName: workflow.name,
173 workflowPath,
174 aliasPath: changelogPath,
175 backingPath: workflowChangelogBackingPath(workflow.id),
176 backingFolderPath: `files/${normalizeVfsSegment(WORKFLOW_CHANGELOG_BACKING_FOLDER)}`,
177 }
178 }
179
180 const plansDirPath = `${workflowPath}/${WORKFLOW_PLANS_ALIAS_DIR}`
181 if (rawPath === plansDirPath || rawPath === `${plansDirPath}/.folder`) {
182 return {
183 kind: 'plans_dir' as const,
184 scope: 'workflow' as const,
185 workflowId: workflow.id,
186 workflowName: workflow.name,
187 workflowPath,
188 aliasPath: plansDirPath,
189 backingPath: workflowPlansBackingFolderPath(workflow.id),
190 backingFolderPath: workflowPlansBackingFolderPath(workflow.id),
191 }
192 }
193
194 const plansPrefix = `${plansDirPath}/`
195 if (rawPath.startsWith(plansPrefix)) {
196 const planRelativePath = rawPath.slice(plansPrefix.length)
197 if (!planRelativePath || planRelativePath === '.folder') return null
198 return {
199 kind: 'plan_file' as const,
200 scope: 'workflow' as const,
201 workflowId: workflow.id,
202 workflowName: workflow.name,
203 workflowPath,
204 aliasPath: rawPath,
205 backingPath: workflowPlanBackingPath(workflow.id, planRelativePath),
206 backingFolderPath: workflowPlansBackingFolderPath(workflow.id),
207 planRelativePath,
208 }
209 }
210
211 return null
212}
213
214export function resolveWorkspacePlanAliasPath(path: string): WorkflowAliasTarget | null {
215 const normalizedPath = path.trim().replace(/^\/+|\/+$/g, '')

Callers 1

resolveWorkflowAliasPathFunction · 0.85

Calls 5

normalizeVfsSegmentFunction · 0.90
workflowVfsPathFunction · 0.85
workflowPlanBackingPathFunction · 0.85

Tested by

no test coverage detected