@@ -41,15 +41,24 @@ export async function createAction(options: CreateOptions): Promise<void> {
4141 process . exit ( 1 ) ;
4242 }
4343
44- // ── Read stdin ───────────────────────── ───────────────────────────────────
45- p . intro ( pc . bold ( "github-issue-ops" ) + pc . dim ( " · issue create" ) ) ;
46-
44+ // ── Read stdin (before any clack call) ───────────────────────────────────
45+ // Consume the pipe first, then reopen /dev/tty, then call p.intro() so that
46+ // clack captures the live terminal stream — not the already-EOF pipe.
4747 const raw = await readStdin ( ) ;
4848 if ( ! raw ) {
49- p . cancel ( "No input detected. Pipe github-code-search output or JSON results into stdin." ) ;
49+ process . stderr . write (
50+ `${ pc . red ( "✘" ) } No input detected. Pipe github-code-search output or JSON results into stdin.\n` ,
51+ ) ;
5052 process . exit ( 1 ) ;
5153 }
5254
55+ // ── Restore TTY before initialising clack ────────────────────────────────
56+ // After readStdin() the pipe is at EOF. Re-open /dev/tty so that every
57+ // clack prompt (text, confirm, select…) reads from the physical terminal.
58+ reopenStdinAsTty ( ) ;
59+
60+ p . intro ( pc . bold ( "github-issue-ops" ) + pc . dim ( " · issue create" ) ) ;
61+
5362 const s = p . spinner ( ) ;
5463 s . start ( "Parsing results…" ) ;
5564 const results = parseResults ( raw ) ;
@@ -62,11 +71,6 @@ export async function createAction(options: CreateOptions): Promise<void> {
6271 process . exit ( 1 ) ;
6372 }
6473
65- // ── Restore TTY for interactive prompts ───────────────────────────────────
66- // stdin was consumed by readStdin() above; re-open /dev/tty so that clack
67- // prompts (text, confirm, select…) can still read from the terminal.
68- reopenStdinAsTty ( ) ;
69-
7074 // ── Resolve title ─────────────────────────────────────────────────────────
7175 let title = options . title ;
7276 if ( ! title && ! options . nonInteractive ) {
0 commit comments