OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security
TypeScript ai-securityapplication-securityclicode-scanningcodexcodex-securitycybersecuritydevsecopsnodejsnpmopenaisdksecuritytypescriptvulnerability-scanning
refactor(sdk): simplify CLI completion and display state (#1384)
mldangelo-oai5eca33d93df6
diff --git a/sdk/typescript/src/cli.ts b/sdk/typescript/src/cli.tsindex a9e64f2f6..b55c9267b 100644--- a/sdk/typescript/src/cli.ts+++ b/sdk/typescript/src/cli.ts@@ -685,7 +685,6 @@ class PublicationProgressPresenter {try {dashboard.stop();} catch {}- this.#dashboard = null;}}@@ -1675,14 +1674,10 @@ export async function runCodexSkillCommand(}),]);invocationStatus = new Promise<number>((resolve, reject) => {- let completed = false;const complete = (code: number | null,signal: NodeJS.Signals | null,): void => {- if (completed) return;- completed = true;- forceStatusCompletion = null;resolve(requestedSignal === "SIGINT" || signal === "SIGINT"? 130@@ -1692,12 +1687,7 @@ export async function runCodexSkillCommand();};forceStatusCompletion = () => complete(null, null);- invocation.once("error", (error) => {- if (completed) return;- completed = true;- forceStatusCompletion = null;- reject(error);- });+ invocation.once("error", reject);invocation.once(output === undefined ? "exit" : "close", complete);});let [status, events] = await Promise.all([invocationStatus, captured]);diff --git a/sdk/typescript/src/scan-dashboard.ts b/sdk/typescript/src/scan-dashboard.tsindex b14281cb4..3942c0104 100644--- a/sdk/typescript/src/scan-dashboard.ts+++ b/sdk/typescript/src/scan-dashboard.ts@@ -265,7 +265,7 @@ export class ScanDashboard {input.on("data", this.#onInput);this.#stream.write(ENABLE_ALTERNATE_SCROLL);}- this.#render();+ this.#stream.write(this.#frame());} catch (error) {try {this.stop();@@ -537,14 +537,10 @@ export class ScanDashboard {#refresh(): void {if (this.#timer === null) return;try {- this.#render();+ this.#stream.write(this.#frame());} catch {}}- #render(): void {- this.#stream.write(this.#frame());- }-#frame(): string {if (this.#options.presentation === "components") {return this.#showComponentdiff --git a/sdk/typescript/src/scan-history-renderer.ts b/sdk/typescript/src/scan-history-renderer.tsindex e7ffece3f..3e98c6b1e 100644--- a/sdk/typescript/src/scan-history-renderer.ts+++ b/sdk/typescript/src/scan-history-renderer.ts@@ -79,18 +79,17 @@ export function renderScanHistory(const wrap = (value: string, indent: number, prefix?: string): void => {const available = width - indent - 2;let line = "";- let first = true;for (const word of clean(value).split(/\s+/)) {if (line.length > 0 && line.length + word.length + 1 > available) {- lines.push(`${first && prefix ? prefix : " ".repeat(indent)}${line}`);- first = false;+ lines.push(`${prefix || " ".repeat(indent)}${line}`);+ prefix = undefined;line = word;} else {line = line.length > 0 ? `${line} ${word}` : word;}}if (line.length > 0) {- lines.push(`${first && prefix ? prefix : " ".repeat(indent)}${line}`);+ lines.push(`${prefix || " ".repeat(indent)}${line}`);}};