Skip to content

Conversation

@supernovahs
Copy link
Contributor

@supernovahs supernovahs commented May 30, 2025

closes #117

Motivation:
Users were able to run commands out of sequence (e.g., avs call without starting devnet first), leading to confusing error messages and poor user experience. The CLI needed context-aware validation to ensure commands are executed in the correct order with helpful guidance when prerequisites aren't met.

Modifications:

Core guardrails system in pkg/hooks/command_guardrails.go:

  • Stage-based project lifecycle: uninitializedcreatedbuiltdevnet_readyrunning
  • Command dependency validation with helpful error messages
  • Automatic stage promotion after successful command execution
  • Stage persistence in context-specific YAML files (e.g., config/contexts/devnet.yaml)

Command dependency rules:

  • create: Requires uninitialized, promotes to created
  • build: Requires created, promotes to built
  • start: Requires created, promotes to devnet_ready (or running if AVS components start)
  • deploy-contracts: Requires created, promotes to devnet_ready
  • stop: Requires created, resets to created
  • run: Requires devnet_ready, promotes to running
  • call: Requires running
  • Stage field added to pkg/common/config.go ChainContextConfig struct

Result:

  • Context-aware error messages
  • Automatic stage tracking

Testing:

Unit tests

Open questions:
Should stage be stored in global project config vs context-specific YAML? (Currently context-specific)

@supernovahs supernovahs changed the title WIP:command guardwails initial feat :command guardrails Jun 2, 2025
@supernovahs supernovahs changed the title feat :command guardrails feat: command guardrails Jun 2, 2025
@supernovahs supernovahs marked this pull request as ready for review June 2, 2025 10:04
@supernovahs supernovahs requested a review from a team as a code owner June 2, 2025 10:04
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.

Command Guardrails for handling out of sequence cli commands and context aware error messages

2 participants