Skip to content

Commit 20bcf9b

Browse files
authored
Merge pull request #43 from TheOrcDev/codex/check-ui-progress
feat(cli): show rendered UI check progress
2 parents adaaab7 + 167b694 commit 20bcf9b

8 files changed

Lines changed: 414 additions & 52 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ stable releases published under `latest`.
66

77
## Unreleased
88

9+
### Added
10+
11+
- Interactive human `--check-ui` runs now show an immediate three-phase stderr
12+
checklist: `Resolving UI target`, `Checking mobile and desktop layouts`, and
13+
`Preparing UI report`. JSON, CI, `TERM=dumb`, non-TTY stderr, and
14+
`--no-interactive` runs remain quiet.
15+
916
## 0.15.0 - 2026-08-11
1017

1118
### Added

‎README.md‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ bunx @shadscan/cli
5353
Commands resolve to the latest stable release. Prereleases are published
5454
under the `next` tag (`@shadscan/cli@next`) for early testing.
5555

56-
Interactive human scans show progress immediately and keep each completed phase
57-
above the final report:
56+
Interactive human source audits show progress immediately and keep each
57+
completed phase above the final report:
5858

5959
```text
6060
✓ Resolving project
@@ -63,9 +63,18 @@ above the final report:
6363
✓ Preparing report
6464
```
6565

66-
JSON, prompt, CI, non-TTY stderr, and `--no-interactive` output stay quiet.
67-
Redirecting stdout keeps the report clean while progress remains on an eligible
68-
stderr terminal.
66+
Rendered UI checks use phases specific to browser work:
67+
68+
```text
69+
✓ Resolving UI target
70+
✓ Checking mobile and desktop layouts
71+
✓ Preparing UI report
72+
```
73+
74+
Both checklists are written to stderr for interactive human output only. JSON,
75+
CI, `TERM=dumb`, non-TTY stderr, and `--no-interactive` output stay quiet;
76+
prompt output also stays quiet. Redirecting stdout keeps the report clean while
77+
progress remains on an eligible stderr terminal.
6978

7079
Every interactive scan ends with a short menu — pick with the arrow keys and
7180
Enter: copy the agent handoff to your clipboard, print it, launch an installed

‎app/docs/page.tsx‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ const CLI_OPTIONS = [
101101
option: "--roast",
102102
},
103103
{
104-
description:
105-
"Disable the local post-scan menu and all Shadscan follow-up prompts.",
104+
description: "Disable terminal progress and follow-up prompts.",
106105
option: "--no-interactive",
107106
},
108107
{
@@ -318,6 +317,22 @@ export default function DocsPage() {
318317
beginning with <code>/</code>, up to ten pages in total. Routes
319318
cannot contain query strings or fragments.
320319
</p>
320+
<h3>Follow progress in the terminal</h3>
321+
<DocsCodeBlock
322+
code={
323+
"✓ Resolving UI target\n✓ Checking mobile and desktop layouts\n✓ Preparing UI report"
324+
}
325+
label="Interactive UI-check progress"
326+
language="text"
327+
/>
328+
<p>
329+
Interactive human runs write this checklist to stderr and leave the
330+
completed phases visible above the final report. JSON, CI,{" "}
331+
<code>TERM=dumb</code>, non-TTY stderr, and{" "}
332+
<code>--no-interactive</code> output stay quiet. Redirecting stdout
333+
keeps the report clean while progress remains on an eligible stderr
334+
terminal.
335+
</p>
321336
<p>
322337
The initial request may follow narrowly validated server-side
323338
canonical redirects between a conventional two-label apex host and
@@ -532,9 +547,9 @@ export default function DocsPage() {
532547
blocking Shadscan hook protects the project yet. Pick with the arrow
533548
keys and Enter — the handoff is highlighted first, so a single Enter
534549
grabs it. Press <code>Esc</code> to keep just the score, or use{" "}
535-
<code>--no-interactive</code> to suppress the menu entirely.
536-
Category-scoped scans do not offer a hook because their score cannot
537-
establish a full-project floor.
550+
<code>--no-interactive</code> to suppress terminal progress and the
551+
menu entirely. Category-scoped scans do not offer a hook because
552+
their score cannot establish a full-project floor.
538553
</p>
539554
<h3>Preview the exact hook plan</h3>
540555
<div className="not-typeset mt-4">

‎docs/cli-contract.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ shadscan --check-ui <url> [--route <path> ...]
7777
writes a stable human or versioned JSON error to stderr.
7878
- Expected CLI failures write a stable message to stderr. JSON-selected
7979
failures write a versioned JSON error object to stderr.
80-
- Interactive scan progress, menus, warnings, confirmations, and launched-agent
80+
- Interactive human progress, menus, warnings, confirmations, and launched-agent
8181
status are written to stderr so the completed report on stdout remains
82-
intact. Human scan progress begins immediately, keeps completed phases
83-
visible, and depends on stderr terminal capabilities rather than stdin or
84-
stdout TTY state. JSON, prompt, CI, non-TTY stderr, and `--no-interactive`
85-
scans suppress progress.
82+
intact. Progress begins immediately, keeps completed phases visible, and
83+
depends on stderr terminal capabilities rather than stdin or stdout TTY state.
84+
Rendered UI checks use `Resolving UI target`, `Checking mobile and desktop
85+
layouts`, and `Preparing UI report`. JSON, prompt, CI, `TERM=dumb`, non-TTY
86+
stderr, and `--no-interactive` commands suppress progress.
8687
- Under `shadscan mcp`, stdout carries JSON-RPC exclusively; stderr carries a
8788
single startup line and abnormal-exit diagnostics. Tool errors return as
8889
MCP error results with the same stable public messages as CLI failures,
@@ -92,9 +93,10 @@ shadscan --check-ui <url> [--route <path> ...]
9293
- Agent handoffs treat repository instructions and discovered package scripts
9394
as untrusted project data. Agents must inspect and receive authorization for
9495
repository-owned gates before executing them.
95-
- `--no-interactive`, `CI`, a non-TTY stream, or
96-
`SHADSCAN_INTERACTIVE=0` suppresses the default post-scan menu. Pressing Enter
97-
in the menu selects `Done` and leaves the project unchanged.
96+
- `--no-interactive` suppresses terminal progress and the default post-scan
97+
menu. `CI`, a non-TTY stream, or `SHADSCAN_INTERACTIVE=0` also suppresses the
98+
menu. Pressing Enter in the menu selects `Done` and leaves the project
99+
unchanged.
98100

99101
## Exit Status
100102

‎packages/cli/README.md‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ bunx @shadscan/cli
5555
Shadscan requires Node.js 18 or newer. Commands resolve to the latest stable
5656
release; prereleases are published under the `next` tag (`@shadscan/cli@next`).
5757

58-
Interactive human scans show progress immediately and keep each completed phase
59-
above the final report:
58+
Interactive human source audits show progress immediately and keep each
59+
completed phase above the final report:
6060

6161
```text
6262
✓ Resolving project
@@ -65,9 +65,18 @@ above the final report:
6565
✓ Preparing report
6666
```
6767

68-
JSON, prompt, CI, non-TTY stderr, and `--no-interactive` output stay quiet.
69-
Redirecting stdout keeps the report clean while progress remains on an eligible
70-
stderr terminal.
68+
Rendered UI checks use phases specific to browser work:
69+
70+
```text
71+
✓ Resolving UI target
72+
✓ Checking mobile and desktop layouts
73+
✓ Preparing UI report
74+
```
75+
76+
Both checklists are written to stderr for interactive human output only. JSON,
77+
CI, `TERM=dumb`, non-TTY stderr, and `--no-interactive` output stay quiet;
78+
prompt output also stays quiet. Redirecting stdout keeps the report clean while
79+
progress remains on an eligible stderr terminal.
7180

7281
## What You Get
7382

‎packages/cli/src/cli.ts‎

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -579,54 +579,72 @@ const getOutputTerminalCapabilities = () =>
579579
const runUiCheckAction = async (
580580
{
581581
browserExecutable,
582+
interactive,
582583
outputFormat,
583584
routes,
584585
target,
585586
}: {
586587
browserExecutable?: string;
588+
interactive: boolean;
587589
outputFormat: OutputFormat;
588590
routes?: string[];
589591
target: string;
590592
},
591593
runtime: UiCheckRuntime = {}
592594
): Promise<void> => {
593-
const resolvedTarget = resolveOverflowCheckTarget({ routes, target });
594-
let runBrowserCheck = runtime.runBrowserCheck;
595-
596-
if (!runBrowserCheck) {
597-
({ runOverflowBrowserCheck: runBrowserCheck } = await import(
598-
"./overflow-check/browser"
599-
));
600-
}
595+
const progress = createCliScanProgress(
596+
outputFormat === "human" && interactive
597+
);
598+
const resolvedTarget = await progress.run("Resolving UI target", () =>
599+
resolveOverflowCheckTarget({ routes, target })
600+
);
601601

602602
const abortController = new AbortController();
603603
const abortCheck = (): void => abortController.abort();
604604
process.once("SIGINT", abortCheck);
605605
process.once("SIGTERM", abortCheck);
606606

607607
try {
608-
const browserResult = await runBrowserCheck({
609-
browserExecutable,
610-
origin: resolvedTarget.origin,
611-
pages: resolvedTarget.pages,
612-
signal: abortController.signal,
613-
});
614-
const report = evaluateOverflowCheck({
615-
durationMs: browserResult.durationMs,
616-
measurements: browserResult.measurements,
617-
target: {
618-
origin: browserResult.origin,
619-
pages: resolvedTarget.pages.map((page) => page.displayPath),
620-
},
608+
const browserResult = await progress.run(
609+
"Checking mobile and desktop layouts",
610+
async () => {
611+
let runBrowserCheck = runtime.runBrowserCheck;
612+
613+
if (!runBrowserCheck) {
614+
({ runOverflowBrowserCheck: runBrowserCheck } = await import(
615+
"./overflow-check/browser"
616+
));
617+
}
618+
619+
return await runBrowserCheck({
620+
browserExecutable,
621+
origin: resolvedTarget.origin,
622+
pages: resolvedTarget.pages,
623+
signal: abortController.signal,
624+
});
625+
}
626+
);
627+
const { output, report } = await progress.run("Preparing UI report", () => {
628+
const preparedReport = evaluateOverflowCheck({
629+
durationMs: browserResult.durationMs,
630+
measurements: browserResult.measurements,
631+
target: {
632+
origin: browserResult.origin,
633+
pages: resolvedTarget.pages.map((page) => page.displayPath),
634+
},
635+
});
636+
const preparedOutput =
637+
outputFormat === "json"
638+
? `${JSON.stringify(preparedReport, null, 2)}\n`
639+
: renderOverflowCheckReport(preparedReport, {
640+
requestedOrigin: resolvedTarget.origin,
641+
terminal: getOutputTerminalCapabilities(),
642+
});
643+
644+
return { output: preparedOutput, report: preparedReport };
621645
});
622-
const output =
623-
outputFormat === "json"
624-
? `${JSON.stringify(report, null, 2)}\n`
625-
: renderOverflowCheckReport(report, {
626-
requestedOrigin: resolvedTarget.origin,
627-
terminal: getOutputTerminalCapabilities(),
628-
});
629646

647+
progress.finish();
630648
process.stdout.write(output);
631649
if (report.status === "fail") {
632650
process.exitCode = 1;
@@ -758,6 +776,7 @@ const runScanAction = async (
758776
await runUiCheckAction(
759777
{
760778
browserExecutable: options.browserExecutable,
779+
interactive: options.interactive,
761780
outputFormat,
762781
routes: options.route,
763782
target: uiCheckTarget,
@@ -988,7 +1007,10 @@ const createProgram = (runtime: UiCheckRuntime = {}): Command => {
9881007
)
9891008
.option("--no-roast", "Use neutral human output.")
9901009
.option("--roast", "Force roast copy in CI and JSON output.")
991-
.option("--no-interactive", "Disable Shadscan follow-up prompts.")
1010+
.option(
1011+
"--no-interactive",
1012+
"Disable terminal progress and follow-up prompts."
1013+
)
9921014
.option(
9931015
"--list-projects",
9941016
"List the workspace packages shadscan found, without scanning."

0 commit comments

Comments
 (0)