erfanium / erfanium/h8-cli

FEATURE: h8 kubectl exec --script for multi-line commands

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
ai-agent enhancement P0-critical
Dominant language
TypeScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## Problem

Multi-line shell commands through `exec` are nearly impossible due to quote escaping hell. During the Grist migration, every attempt to run more than one command failed silently:

```bash
# Broken — quotes inside quotes, \$ escaping, shebangs
h8 kubectl exec pod -- sh -c '
mv /persist/home.sqlite3 /persist/home.sqlite3.bak
tar xzf /persist/backup.tar.gz -C /persist
chown grist:grist /persist/*
'
```

Ended up having to copy a script file via `kubectl cp` first, then exec it, then rm it — 3 commands where 1 should work.

## Proposal

```bash
h8 app exec grist --script '
mv /persist/home.sqlite3 /persist/home.sqlite3.bak
tar xzf /persist/backup.tar.gz -C /persist
chown grist:grist /persist/*
'
```

Implementation: write the script to a temp file, `kubectl cp` it to the pod, `kubectl exec pod -- sh /tmp/h8-script`, then `kubectl exec pod -- rm /tmp/h8-script`. All transparent to the user.

Stderr from the script should be forwarded, and exit code from the script should be the exit code of the h8 command.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.