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

Function newConfigPathCommand

internal/cli/config.go:524–603  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

522}
523
524func newConfigPathCommand(deps commandDeps) *cobra.Command {
525 var (
526 scopeRaw string
527 workspaceRoot string
528 )
529 cmd := &cobra.Command{
530 Use: configPathKey,
531 Short: "Show resolved AGH config paths",
532 Args: cobra.NoArgs,
533 RunE: func(cmd *cobra.Command, _ []string) error {
534 scope, err := parseWriteScope(scopeRaw)
535 if err != nil {
536 return err
537 }
538 homeWorkspace := ""
539 if scope == aghconfig.WriteScopeWorkspace || strings.TrimSpace(workspaceRoot) != "" {
540 homeWorkspace, err = resolveConfigWorkspaceRoot(deps, workspaceRoot)
541 if err != nil {
542 return err
543 }
544 } else {
545 homeWorkspace, err = currentWorkingDirectory(deps)
546 if err != nil {
547 return err
548 }
549 }
550 homePaths, err := deps.resolveHomeForWorkspace(homeWorkspace)
551 if err != nil {
552 return err
553 }
554 globalMCP, err := aghconfig.ResolveMCPSidecarWriteTarget(homePaths, "", aghconfig.WriteScopeGlobal)
555 if err != nil {
556 return err
557 }
558 selected, err := aghconfig.ResolveConfigWriteTarget(homePaths, "", aghconfig.WriteScopeGlobal)
559 if err != nil {
560 return err
561 }
562 record := configPathRecord{
563 HomeDir: homePaths.HomeDir,
564 GlobalConfig: homePaths.ConfigFile,
565 GlobalMCPJSON: globalMCP.Path(),
566 Scope: string(scope),
567 Managed: detectManagedState(deps).Managed,
568 Manager: detectManagedState(deps).Manager,
569 SelectedConfigTarget: selected.Path(),
570 }
571 if scope == aghconfig.WriteScopeWorkspace || strings.TrimSpace(workspaceRoot) != "" {
572 workspace := homeWorkspace
573 workspaceConfig, err := aghconfig.ResolveConfigWriteTarget(
574 homePaths,
575 workspace,
576 aghconfig.WriteScopeWorkspace,
577 )
578 if err != nil {
579 return err
580 }
581 workspaceMCP, err := aghconfig.ResolveMCPSidecarWriteTarget(

Callers 1

newConfigCommandFunction · 0.85

Calls 7

parseWriteScopeFunction · 0.85
currentWorkingDirectoryFunction · 0.85
detectManagedStateFunction · 0.85
writeCommandOutputFunction · 0.85
configPathBundleFunction · 0.85
PathMethod · 0.65

Tested by

no test coverage detected