Skip to content

feat(cli): add ork idp command for IDP inspection and validation - #242

Merged
iAlexeze merged 5 commits into
mainfrom
feat/ork-idp-cli
Aug 5, 2026
Merged

feat(cli): add ork idp command for IDP inspection and validation#242
iAlexeze merged 5 commits into
mainfrom
feat/ork-idp-cli

Conversation

@iAlexeze

@iAlexeze iAlexeze commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a new ork idp CLI command for inspecting and validating Internal Developer Platform (IDP) configurations, and consolidates global flag shadowing across all CLI commands with a reusable helper.

ork idp Command

Subcommands for inspecting and debugging IDP configurations without needing to run the gateway or access a cluster:

Command Description
ork idp validate Validate IDP configuration (--full for detailed breakdown)
ork idp schema Show the flat schema for an IDP target (--target, --kind, --name)
ork idp fields List IDP fields with their paths and types (--target, --kind, --name)
ork idp tokens Show token permissions for a CRD (--target, --kind, --name)
ork idp targets List all IDP targets in a Katalog
ork idp can-i Check if a token can perform an operation
ork idp response Show the IDP response configuration (--preview)

Flag Shadowing Consolidation

Introduces shadowGlobalCommandFlags(cmd, flags ...string) helper that recursively shadows global flags (debug, kubeconfig, verbose) on all subcommands, with optional support for command-specific flags like --file.

  • Removes repeated manual flag shadowing from individual init() functions
  • Prevents duplicate flag registration with Lookup() checks
  • Commands can opt into additional flags (e.g., shadowGlobalCommandFlags(cmd, "file"))

Implementation Details

  • All ork idp subcommands use buildKatalog() helper respecting --file
  • resolveCRD() handles lookups by --target, --kind, or --name
  • Colorized JSON output in response --preview
  • Sorted field output for consistent display
  • can-i validates namespace against CRD allowed namespaces

Example

# List all IDP targets
ork idp targets

# Show schema for a target
ork idp schema --target smartapp

# Check token permissions
ork idp can-i --token ci-pipeline --target smartapp --operation create --namespace staging

# Show response config with preview
ork idp response --target smartapp --preview

Test Plan

  • ork idp validate passes on valid Katalog
  • ork idp validate --full shows detailed breakdown
  • ork idp schema -t <target> shows fields
  • ork idp fields lists all fields
  • ork idp tokens -t <target> shows permissions
  • ork idp targets lists targets
  • ork idp can-i correctly evaluates permissions
  • ork idp response -t <target> --preview shows colorized JSON
  • go build ./... clean
  • go test ./... clean
  • No duplicate flag registration panics

Adds a new Inspect and validate Internal Developer Platform (IDP) configurations.

The IDP is the contract between platform teams and developers. It defines
what fields developers can submit, what the gateway builds, and what
callers see.

Subcommands:
  validate    Validate IDP configuration in a Katalog
  schema      Show the flat schema for an IDP target
  fields      List all IDP fields with their paths and types
  tokens      Show token permissions for a CRD
  targets     List all IDP targets in a Katalog
  can-i       Check if a token can perform an operation
  response    Show the IDP response configuration

Usage:
  ork idp [command]

Available Commands:
  can-i       Check if a token can perform an operation
  fields      List IDP fields with their paths and types
  response    Show the IDP response configuration
  schema      Show the flat schema for an IDP target
  targets     List all IDP targets in a Katalog
  tokens      Show token permissions for a CRD
  validate    Validate IDP configuration

Flags:
  -h, --help   help for idp

Global Flags:
      --debug               Enable debug logging
  -f, --file strings        Path(s) or URL(s) to katalog.yaml (repeatable)
      --kubeconfig string   Path to kubeconfig file
  -v, --verbose             Show full context

Use "ork idp [command] --help" for more information about a command. CLI command with subcommands for inspecting and
validating Internal Developer Platform (IDP) configurations.

Subcommands:
  validate   - Validate IDP configuration (--full for detailed breakdown)
  schema     - Show flat schema for a target (--target, --kind, --name)
  fields     - List IDP fields with paths and types (--target, --kind, --name)
  tokens     - Show token permissions for a CRD (--target, --kind, --name)
  targets    - List all IDP targets in a Katalog
  can-i      - Check if a token can perform an operation
  response   - Show IDP response configuration (--preview)

All subcommands support the same --file global flag as ork validate.
Introduce a helper function to shadow global flags (debug, kubeconfig, verbose and optional flags like file)
across all CLI commands, replacing repeated manual shadowing in each command's
init().
@iAlexeze
iAlexeze merged commit 13aed59 into main Aug 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant