Skip to content

fix(cli): keep egc subcommands interactive and make the prompt-library gate honest - #1228

Merged
Fmarzochi merged 2 commits into
mainfrom
fix/egc-cli-interactive-stdio
Aug 7, 2026
Merged

fix(cli): keep egc subcommands interactive and make the prompt-library gate honest#1228
Fmarzochi merged 2 commits into
mainfrom
fix/egc-cli-interactive-stdio

Conversation

@Fmarzochi

@Fmarzochi Fmarzochi commented Aug 7, 2026

Copy link
Copy Markdown
Owner

What

Three defects around one symptom from the v1.1.18 Windows testing report (#1217): after npm install -g @egchq/egc + egc install, the ecosystem/prompt-library step silently never ran, leaving egc doctor with a stale install-state (previous repo version recorded, 61 drifted managed files, 5 missing source files).

  1. egc.js ran every subcommand over a captured pipe. runCommand spawned children with the default piped stdio, printed their output only after exit, and left stdin a dead pipe. Any interactive step downstream was unreachable: install.ps1's Read-Host returned $null instantly, and the user saw the prompt text only in the final buffered dump, which is exactly what the report describes ("it was not possible to respond to this prompt, as the installation continued automatically"). Subcommands now run on the inherited stdio: prompts reach the terminal, progress streams live, exit codes unchanged.

  2. install.ps1's interactivity gate could not see a redirected stdin. [Environment]::UserInteractive stays true for a child with piped stdio, and $null -eq '' is false in PowerShell, so the whole ecosystem block vanished with no message. The gate now also checks [Console]::IsInputRedirected, the default-Y branch accepts a $null answer via [string]::IsNullOrEmpty, and both installers announce the skip instead of vanishing (install.sh already gated correctly with [ -t 0 ]; it announces now too).

  3. Both installers advertised fossilized catalog counts (62 agents, 228 skills, 74 commands) while the CI-tested README ships 61/230/77. Corrected, and locked by a new parity test that reads the counts out of install.ps1, install.sh and README.md so the three can never drift apart silently again.

Why the doctor report looked the way it did

The skipped step is the one that reapplies managed files and rewrites install-state. Skipping it on an upgrade leaves the previous version's files behind: recorded repo version 1.1.17, 61 drifted managed files (1.1.17 content vs the 1.1.18 package), and 5 missing source files (files the 1.1.18 package no longer ships).

Out of scope, by design

The two crashes from the same report (the PowerShell 5.1 quoting SyntaxError at install.ps1:221 and the crusher-shim pathResult TypeError) are being fixed by their reporter in a follow-up PR.

Tests

  • tests/scripts/egc.test.js: new guard that runCommand hands the terminal to the child; the 19 existing delegation tests all pass over the inherited stdio (output reaches the caller's descriptors directly).
  • tests/scripts/install-ps1.test.js: new three-way parity test for the prompt-library counts, and a gate test covering IsInputRedirected, the null-safe default-Y branch, and the announced skip in both installers.
  • Full local suite: 4144 passed, 0 failed.

Summary by cubic

Makes egc subcommands interactive by inheriting stdio and fixes the installer gate so the prompt-library step runs or clearly skips instead of disappearing. Updates catalog counts to 61/230/77, adds tests to keep installers and README in sync, and records the changes in the ROADMAP.

  • Bug Fixes
    • CLI spawns subcommands with stdio: 'inherit' so prompts and progress stream live; exit codes unchanged.
    • PowerShell gate also checks [Console]::IsInputRedirected; default-Y accepts null; both installers announce skip in non-interactive sessions.
    • Prompt text updated to 61 agents, 230 skills, 77 commands; tests enforce stdio behavior and count parity across install.ps1, install.sh, and README.
    • ROADMAP updated under Unreleased to document the interactive-stdio and prompt-gate fixes.

Written for commit 8eafe90. Summary will update on new commits.

Review in cubic

…y gate honest

Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
… Unreleased

Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@Fmarzochi

Copy link
Copy Markdown
Owner Author

Note for the record: the analysis-failed comment above is a stale-report race, not a quality failure. Two pushes landed minutes apart, and the older report (1eae27e) reached SonarCloud after the newer one (8eafe90) had already been processed; the compute engine rejects older reports by design. The PR quality gate reports OK via the API, and the post-merge main-branch analysis is the binding one.

@Fmarzochi
Fmarzochi merged commit 9446d30 into main Aug 7, 2026
42 checks passed
@Fmarzochi
Fmarzochi deleted the fix/egc-cli-interactive-stdio branch August 7, 2026 18:00
@github-project-automation github-project-automation Bot moved this from Todo to Done in EGC Roadmap Aug 7, 2026
@Fmarzochi Fmarzochi added this to the v1.1.19 milestone Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant