-
Notifications
You must be signed in to change notification settings - Fork 0
feat: real-time output streaming, npm publish pipeline, v0.9.0 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,7 @@ interface RunOptions { | |||||||||||||||||||||||||
| audit?: boolean; | ||||||||||||||||||||||||||
| runtime?: string; | ||||||||||||||||||||||||||
| auditOutput?: string; | ||||||||||||||||||||||||||
| stream?: boolean; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export async function runCommand(servicePath: string, options: RunOptions): Promise<void> { | ||||||||||||||||||||||||||
|
|
@@ -52,7 +53,14 @@ export async function runCommand(servicePath: string, options: RunOptions): Prom | |||||||||||||||||||||||||
| ? (await loadPolicyFile(service.servicePath)) ?? DEFAULT_POLICY | ||||||||||||||||||||||||||
| : undefined; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const metrics = await executeService(service, { input, skipBuild: true, audit: options.audit, policy }); | ||||||||||||||||||||||||||
| const metrics = await executeService(service, { | ||||||||||||||||||||||||||
| input, | ||||||||||||||||||||||||||
| skipBuild: true, | ||||||||||||||||||||||||||
| audit: options.audit, | ||||||||||||||||||||||||||
| policy, | ||||||||||||||||||||||||||
| onStdout: options.stream ? (chunk) => process.stdout.write(chunk) : undefined, | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| onStdout: options.stream ? (chunk) => process.stdout.write(chunk) : undefined, | |
| onStdout: options.stream | |
| ? (chunk) => { | |
| if (options.json) { | |
| // When JSON output is requested, send streamed stdout to stderr | |
| // so that stdout remains valid JSON. | |
| process.stderr.write(chunk); | |
| } else { | |
| process.stdout.write(chunk); | |
| } | |
| } | |
| : undefined, |
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With --stream enabled, stdout/stderr is printed in real time via the callbacks, but the subsequent human-readable report output (via formatReportAsText) includes a STDOUT: section that prints the captured stdout again. This will duplicate potentially large outputs and make the CLI output hard to read. Consider omitting stdout from the text report when streaming is enabled (e.g., add an option to the formatter, or clear/replace the displayed stdout while still keeping the raw stdout for audit parsing/JSON output).
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,7 +92,7 @@ export async function dockerRun(options: DockerRunOptions): Promise<DockerRunRes | |
| logger.debug(`Running: docker ${args.join(' ')}`); | ||
|
|
||
| const startTime = Date.now(); | ||
| const result = await execDockerWithTimeout(args, options.timeoutMs); | ||
| const result = await execDockerWithTimeout(args, options.timeoutMs, options.onStdout, options.onStderr); | ||
| const durationMs = Date.now() - startTime; | ||
|
|
||
| const inspectResult = await inspectExitedContainer(options.containerName).catch(() => null); | ||
|
|
@@ -188,7 +188,7 @@ function execDocker(args: string[]): Promise<ExecResult> { | |
| }); | ||
| } | ||
|
|
||
| function execDockerWithTimeout(args: string[], timeoutMs: number): Promise<ExecResult> { | ||
| function execDockerWithTimeout(args: string[], timeoutMs: number, onStdout?: (chunk: string) => void, onStderr?: (chunk: string) => void): Promise<ExecResult> { | ||
| return new Promise((resolve) => { | ||
| const proc = spawn('docker', args, { stdio: ['ignore', 'pipe', 'pipe'] }); | ||
|
|
||
|
|
@@ -202,11 +202,15 @@ function execDockerWithTimeout(args: string[], timeoutMs: number): Promise<ExecR | |
| }, timeoutMs); | ||
|
|
||
| proc.stdout.on('data', (data: Buffer) => { | ||
| stdout += data.toString(); | ||
| const chunk = data.toString(); | ||
| stdout += chunk; | ||
| onStdout?.(chunk); | ||
| }); | ||
|
|
||
| proc.stderr.on('data', (data: Buffer) => { | ||
| stderr += data.toString(); | ||
| const chunk = data.toString(); | ||
| stderr += chunk; | ||
| onStderr?.(chunk); | ||
| }); | ||
|
Comment on lines
204
to
214
|
||
|
|
||
| proc.on('close', (code) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@ignite/runtime-bun", | ||
| "version": "0.8.0", | ||
| "version": "0.9.0", | ||
| "private": true, | ||
| "description": "Bun runtime adapter for Ignite" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
publish-npmjob grantsid-token: write, but the workflow usesNODE_AUTH_TOKENand does not appear to use OIDC/provenance publishing. Consider removingid-token: writeto follow least-privilege, or switch to provenance/OIDC publishing so the permission is justified.