MCPcopy Create free account
hub / github.com/compozy/agh / buildResolvedWorkspace

Method buildResolvedWorkspace

internal/workspace/resolver.go:280–315  ·  view source on GitHub ↗
(
	ctx context.Context,
	ws Workspace,
	scan workspaceScan,
)

Source from the content-addressed store, hash-verified

278}
279
280func (r *Resolver) buildResolvedWorkspace(
281 ctx context.Context,
282 ws Workspace,
283 scan workspaceScan,
284) (ResolvedWorkspace, error) {
285 if err := checkContext(ctx); err != nil {
286 return ResolvedWorkspace{}, err
287 }
288
289 cfg, err := r.loadConfig(ws.RootDir)
290 if err != nil {
291 return ResolvedWorkspace{}, fmt.Errorf("workspace: load config for %q: %w", ws.RootDir, err)
292 }
293 applyDefaultAgentOverride(&cfg, ws.DefaultAgent)
294 resolvedSandbox, err := resolveWorkspaceSandbox(ws, &cfg)
295 if err != nil {
296 return ResolvedWorkspace{}, fmt.Errorf("workspace: resolve sandbox for %q: %w", ws.ID, err)
297 }
298
299 agents, agentDiagnostics, err := loadAgents(ctx, scan.agents)
300 if err != nil {
301 return ResolvedWorkspace{}, err
302 }
303
304 skills := mergeSkillPaths(scan.skills)
305
306 return ResolvedWorkspace{
307 Workspace: cloneWorkspace(ws),
308 Config: cloneConfig(&cfg),
309 Agents: cloneAgentDefs(agents),
310 AgentDiagnostics: append([]AgentDiagnostic(nil), agentDiagnostics...),
311 Skills: cloneSkillPaths(skills),
312 Sandbox: cloneSandboxResolved(resolvedSandbox),
313 ResolvedAt: r.now(),
314 }, nil
315}
316
317func resolveWorkspaceSandbox(ws Workspace, cfg *aghconfig.Config) (sandbox.Resolved, error) {
318 ref := strings.TrimSpace(ws.SandboxRef)

Callers 1

ResolveMethod · 0.95

Calls 13

resolveWorkspaceSandboxFunction · 0.85
loadAgentsFunction · 0.85
mergeSkillPathsFunction · 0.85
cloneWorkspaceFunction · 0.85
cloneConfigFunction · 0.85
cloneAgentDefsFunction · 0.85
appendFunction · 0.85
cloneSkillPathsFunction · 0.85
cloneSandboxResolvedFunction · 0.85
loadConfigMethod · 0.80
checkContextFunction · 0.70

Tested by

no test coverage detected