Skip to content

[FEATURE] Shell integration for cx fix error capture #712

@mikejmorgan-ai

Description

@mikejmorgan-ai

Summary

The cx fix command expects errors to be in ~/.cx/last_error, but there is no shell integration to automatically capture command errors.

Current Behavior

$ some-command-that-fails
error: something went wrong

$ cx fix
# Error: No error captured. Run a command first or use: cx fix "error message"

Required Shell Integration

Bash (~/.cx/shell/bash_integration.sh)

  • Capture stderr from last command
  • Write to ~/.cx/last_error on non-zero exit
  • Hook into PROMPT_COMMAND

Zsh (~/.cx/shell/zsh_integration.sh)

  • Similar implementation using precmd hook
  • Compatible with oh-my-zsh and powerlevel10k

Installation

cx setup shell  # Adds source line to ~/.bashrc or ~/.zshrc

Acceptance Criteria

  • Bash integration captures stderr and exit code
  • Zsh integration captures stderr and exit code
  • cx setup shell installs integration
  • cx fix reads captured error automatically
  • Works with common error patterns (npm, cargo, python)
  • Does not slow down shell noticeably
  • BSL 1.1 header in shell scripts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions