@openai/codex-security 0.1.20 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1101 -865
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/references/config-preflight.md +2 -30
- package/_bundled_plugin/references/core-scan.md +1 -1
- package/_bundled_plugin/references/final-report.md +1 -1
- package/_bundled_plugin/references/finding-detail-fields.md +5 -10
- package/_bundled_plugin/references/sarif-adapter.md +1 -1
- package/_bundled_plugin/schemas/patch-risk-assessment.schema.json +243 -0
- package/_bundled_plugin/scripts/config_preflight.py +2 -8
- package/_bundled_plugin/scripts/finalize_scan_contract.py +206 -35
- package/_bundled_plugin/scripts/finding_preview.py +22 -4
- package/_bundled_plugin/scripts/generate_in_scope_files.py +27 -1
- package/_bundled_plugin/scripts/launch_codex_security_mcp +0 -0
- package/_bundled_plugin/scripts/windows_scan_local_files.py +101 -7
- package/_bundled_plugin/scripts/workbench_cli.py +21 -1
- package/_bundled_plugin/scripts/workbench_dashboard.py +115 -0
- package/_bundled_plugin/scripts/workbench_db.py +29 -2
- package/_bundled_plugin/scripts/workbench_finding_index.py +42 -24
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +190 -0
- package/_bundled_plugin/scripts/workbench_findings.py +216 -0
- package/_bundled_plugin/scripts/workbench_saved_results.py +30 -5
- package/_bundled_plugin/scripts/workbench_schema.py +263 -58
- package/_bundled_plugin/scripts/workbench_target.py +22 -3
- package/_bundled_plugin/skills/assess-patch-risk/SKILL.md +88 -0
- package/_bundled_plugin/skills/assess-patch-risk/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/assess-patch-risk/references/risk-rubric.md +76 -0
- package/_bundled_plugin/skills/assess-patch-risk/scripts/validate_patch_risk_assessment.py +163 -0
- package/_bundled_plugin/skills/fix-finding/SKILL.md +16 -48
- package/_bundled_plugin/skills/track-findings/SKILL.md +2 -0
- package/dist/api.d.ts +3 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +129 -45
- package/dist/api.js.map +1 -1
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +6 -24
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/cli.d.ts +28 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +525 -96
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.d.ts +5 -1
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +312 -10
- package/dist/cloud-publish.js.map +1 -1
- package/dist/component-plan.d.ts.map +1 -1
- package/dist/component-plan.js +5 -1
- package/dist/component-plan.js.map +1 -1
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +9 -0
- package/dist/contract.js.map +1 -1
- package/dist/custom-publish.d.ts +22 -0
- package/dist/custom-publish.d.ts.map +1 -0
- package/dist/custom-publish.js +47 -0
- package/dist/custom-publish.js.map +1 -0
- package/dist/custom-validation-prompt.js +1 -1
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/deduplication/checkpointed-review.d.ts +16 -0
- package/dist/deduplication/checkpointed-review.d.ts.map +1 -0
- package/dist/deduplication/checkpointed-review.js +76 -0
- package/dist/deduplication/checkpointed-review.js.map +1 -0
- package/dist/deduplication/codex-review.d.ts +21 -0
- package/dist/deduplication/codex-review.d.ts.map +1 -0
- package/dist/deduplication/codex-review.js +252 -0
- package/dist/deduplication/codex-review.js.map +1 -0
- package/dist/deduplication/deduplication-prompts.d.ts +8 -0
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -0
- package/dist/deduplication/deduplication-prompts.js +35 -0
- package/dist/deduplication/deduplication-prompts.js.map +1 -0
- package/dist/deduplication/deduplication-reviewer.d.ts +46 -0
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -0
- package/dist/deduplication/deduplication-reviewer.js +105 -0
- package/dist/deduplication/deduplication-reviewer.js.map +1 -0
- package/dist/deduplication/deduplication.d.ts +6 -0
- package/dist/deduplication/deduplication.d.ts.map +1 -0
- package/dist/deduplication/deduplication.js +85 -0
- package/dist/deduplication/deduplication.js.map +1 -0
- package/dist/deduplication/scan.d.ts +16 -0
- package/dist/deduplication/scan.d.ts.map +1 -0
- package/dist/deduplication/scan.js +101 -0
- package/dist/deduplication/scan.js.map +1 -0
- package/dist/finding-dedupe-groups.d.ts +7 -0
- package/dist/finding-dedupe-groups.d.ts.map +1 -0
- package/dist/finding-dedupe-groups.js +2 -0
- package/dist/finding-dedupe-groups.js.map +1 -0
- package/dist/finding-retrieval.d.ts +13 -0
- package/dist/finding-retrieval.d.ts.map +1 -0
- package/dist/finding-retrieval.js +2 -0
- package/dist/finding-retrieval.js.map +1 -0
- package/dist/finding-workflow.d.ts +53 -0
- package/dist/finding-workflow.d.ts.map +1 -0
- package/dist/finding-workflow.js +117 -0
- package/dist/finding-workflow.js.map +1 -0
- package/dist/findings-client.d.ts +15 -0
- package/dist/findings-client.d.ts.map +1 -0
- package/dist/findings-client.js +60 -0
- package/dist/findings-client.js.map +1 -0
- package/dist/github.d.ts +161 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +158 -0
- package/dist/github.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/publication.js +28 -40
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts +10 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +29 -5
- package/dist/publish.js.map +1 -1
- package/dist/runtime.d.ts +5 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +371 -197
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan.d.ts +15 -0
- package/dist/saved-scan.d.ts.map +1 -0
- package/dist/saved-scan.js +68 -0
- package/dist/saved-scan.js.map +1 -0
- package/dist/scan-comparison.d.ts +6 -2
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +7 -2
- package/dist/scan-comparison.js.map +1 -1
- package/dist/server/dashboard/THIRD_PARTY_NOTICES.txt +276 -0
- package/dist/server/dashboard/app.css +2 -0
- package/dist/server/dashboard/app.js +66 -0
- package/dist/server/dashboard/index.html +18 -0
- package/dist/server/dashboard-types.d.ts +45 -0
- package/dist/server/dashboard-types.d.ts.map +1 -0
- package/dist/server/dashboard-types.js +2 -0
- package/dist/server/dashboard-types.js.map +1 -0
- package/dist/server/dashboard.d.ts +6 -0
- package/dist/server/dashboard.d.ts.map +1 -0
- package/dist/server/dashboard.js +45 -0
- package/dist/server/dashboard.js.map +1 -0
- package/dist/server/embeddings.d.ts +16 -0
- package/dist/server/embeddings.d.ts.map +1 -0
- package/dist/server/embeddings.js +114 -0
- package/dist/server/embeddings.js.map +1 -0
- package/dist/server/errors.d.ts +5 -0
- package/dist/server/errors.d.ts.map +1 -0
- package/dist/server/errors.js +8 -0
- package/dist/server/errors.js.map +1 -0
- package/dist/server/findings-service.d.ts +20 -0
- package/dist/server/findings-service.d.ts.map +1 -0
- package/dist/server/findings-service.js +31 -0
- package/dist/server/findings-service.js.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +32 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/routes.d.ts +6 -0
- package/dist/server/routes.d.ts.map +1 -0
- package/dist/server/routes.js +86 -0
- package/dist/server/routes.js.map +1 -0
- package/dist/server/server.d.ts +10 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +17 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/sqlite-store.d.ts +22 -0
- package/dist/server/sqlite-store.d.ts.map +1 -0
- package/dist/server/sqlite-store.js +82 -0
- package/dist/server/sqlite-store.js.map +1 -0
- package/dist/server/storage.d.ts +32 -0
- package/dist/server/storage.d.ts.map +1 -0
- package/dist/server/storage.js +2 -0
- package/dist/server/storage.js.map +1 -0
- package/dist/server/validation.d.ts +17 -0
- package/dist/server/validation.d.ts.map +1 -0
- package/dist/server/validation.js +53 -0
- package/dist/server/validation.js.map +1 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +1 -0
- package/dist/targets.js.map +1 -1
- package/dist/thread-source.d.ts +8 -0
- package/dist/thread-source.d.ts.map +1 -0
- package/dist/thread-source.js +7 -0
- package/dist/thread-source.js.map +1 -0
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +2 -1
- package/dist/trusted-executable.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +23 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-scan-discovery.d.ts","sourceRoot":"","sources":["../src/bulk-scan-discovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bulk-scan-discovery.d.ts","sourceRoot":"","sources":["../src/bulk-scan-discovery.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AA6CxC,MAAM,WAAW,cAAc;IAC7B,aAAa,IAAI,OAAO,CAAC;IACzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,CACL,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,OAAO,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,KAAK,CACH,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,MAAM,CAAC,KAAK,SAAS,MAAM,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS;QAAE,KAAK,EAAE,MAAM,CA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GAAG,IAAI,MAAM,CAAC;IACd,gBAAgB,IAAI,MAAM,CAAC;CAC5B,GAAG,6BAA6B,CAehC;AAED,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,6BAA6B,EAC3C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA8DtC"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { execFile as execFileCallback } from "node:child_process";
|
|
2
1
|
import { createHash } from "node:crypto";
|
|
3
2
|
import { lstat, mkdir, writeFile } from "node:fs/promises";
|
|
4
3
|
import { join, resolve } from "node:path";
|
|
5
4
|
import { stdin } from "node:process";
|
|
6
5
|
import { Writable } from "node:stream";
|
|
7
|
-
import { promisify } from "node:util";
|
|
8
6
|
import { checkbox, confirm, input, search, Separator } from "@inquirer/prompts";
|
|
9
|
-
import { Octokit } from "@octokit/core";
|
|
10
7
|
import Papa from "papaparse";
|
|
8
|
+
import { createAuthenticatedGitHub } from "./github.js";
|
|
11
9
|
import { expandHome } from "./runtime.js";
|
|
12
|
-
import { resolveTrustedExecutable } from "./trusted-executable.js";
|
|
13
|
-
const execFile = promisify(execFileCallback);
|
|
14
10
|
const GITHUB_REPOSITORIES_QUERY = `
|
|
15
11
|
query($owner: String!, $cursor: String) {
|
|
16
12
|
repositoryOwner(login: $owner) {
|
|
@@ -39,25 +35,11 @@ export function createBulkScanDiscoveryDependencies(options) {
|
|
|
39
35
|
...(process.env["GH_HOST"]?.trim()
|
|
40
36
|
? { githubHost: process.env["GH_HOST"].trim() }
|
|
41
37
|
: {}),
|
|
42
|
-
createGitHub:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let token;
|
|
48
|
-
try {
|
|
49
|
-
const { stdout } = await execFile(trusted.executable, ["auth", "token", "--hostname", host], { env: trusted.environment, signal });
|
|
50
|
-
token = stdout.trim();
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
signal?.throwIfAborted();
|
|
54
|
-
throw new Error("GitHub sign-in is required. Run 'gh auth login' first.");
|
|
55
|
-
}
|
|
56
|
-
return new Octokit({
|
|
57
|
-
auth: token,
|
|
58
|
-
...(host === "github.com" ? {} : { baseUrl: `https://${host}/api/v3` }),
|
|
59
|
-
});
|
|
60
|
-
},
|
|
38
|
+
createGitHub: (host, signal) => createAuthenticatedGitHub(host, {
|
|
39
|
+
environment: process.env,
|
|
40
|
+
currentDirectory: options.currentDirectory(),
|
|
41
|
+
signal,
|
|
42
|
+
}),
|
|
61
43
|
};
|
|
62
44
|
}
|
|
63
45
|
export async function runBulkScanWizard(dependencies, signal) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-scan-discovery.js","sourceRoot":"","sources":["../src/bulk-scan-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,QAAQ,GAAG,SAAS,CAA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execFile as execFileCallback } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { lstat, mkdir, writeFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { stdin } from \"node:process\";\nimport { Writable } from \"node:stream\";\nimport { promisify } from \"node:util\";\nimport { checkbox, confirm, input, search, Separator } from \"@inquirer/prompts\";\nimport { Octokit } from \"@octokit/core\";\nimport Papa from \"papaparse\";\nimport { expandHome } from \"./runtime.js\";\nimport { resolveTrustedExecutable } from \"./trusted-executable.js\";\n\nconst execFile = promisify(execFileCallback);\nconst GITHUB_REPOSITORIES_QUERY = `\n query($owner: String!, $cursor: String) {\n repositoryOwner(login: $owner) {\n repositories(\n first: 100\n after: $cursor\n isArchived: false\n isFork: false\n orderBy: { field: PUSHED_AT, direction: DESC }\n ) {\n nodes {\n nameWithOwner\n pushedAt\n defaultBranchRef { target { oid } }\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n }\n`;\n\ninterface GitHubRepository {\n fullName: string;\n url: string;\n revision: string;\n}\n\ninterface GitHubRepositoriesResponse {\n repositoryOwner: {\n repositories: {\n nodes: Array<{\n nameWithOwner: string;\n pushedAt: string;\n defaultBranchRef: { target: { oid: string } } | null;\n }>;\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n };\n } | null;\n}\n\nexport interface BulkScanPrompt {\n isInteractive(): boolean;\n write(value: string): void;\n confirm(\n question: string,\n defaultValue?: boolean,\n signal?: AbortSignal,\n ): Promise<boolean>;\n input(\n question: string,\n defaultValue?: string,\n signal?: AbortSignal,\n ): Promise<string>;\n select<Value extends string>(\n question: string,\n options: readonly { label: string; value: Value; short?: string }[],\n presentation?: { header?: string },\n signal?: AbortSignal,\n ): Promise<Value>;\n checkbox<Value extends string>(\n question: string,\n options: readonly { label: string; value: Value; short?: string }[],\n presentation?: { header?: string; required?: boolean },\n signal?: AbortSignal,\n ): Promise<Value[]>;\n}\n\nexport interface BulkScanDiscoveryDependencies {\n prompt: BulkScanPrompt;\n now(): number;\n currentDirectory(): string;\n githubHost?: string;\n createGitHub(host: string, signal?: AbortSignal): Promise<Octokit>;\n}\n\nexport interface BulkScanWizardResult {\n inputPath: string;\n outputDir: string;\n githubHost: string;\n}\n\ninterface PromptOutput {\n write(value: string): unknown;\n readonly isTTY?: boolean;\n readonly columns?: number;\n}\n\nexport function createBulkScanDiscoveryDependencies(options: {\n output: PromptOutput;\n now(): number;\n currentDirectory(): string;\n}): BulkScanDiscoveryDependencies {\n return {\n prompt: createTerminalPrompt(options.output),\n now: options.now,\n currentDirectory: options.currentDirectory,\n ...(process.env[\"GH_HOST\"]?.trim()\n ? { githubHost: process.env[\"GH_HOST\"].trim() }\n : {}),\n createGitHub: async (host, signal) => {\n const trusted = await resolveTrustedExecutable(\n \"gh\",\n process.env,\n options.currentDirectory(),\n );\n if (trusted === null) {\n throw new Error(\n \"GitHub CLI is required. Install gh and sign in first.\",\n );\n }\n\n let token: string;\n try {\n const { stdout } = await execFile(\n trusted.executable,\n [\"auth\", \"token\", \"--hostname\", host],\n { env: trusted.environment, signal },\n );\n token = stdout.trim();\n } catch {\n signal?.throwIfAborted();\n throw new Error(\n \"GitHub sign-in is required. Run 'gh auth login' first.\",\n );\n }\n return new Octokit({\n auth: token,\n ...(host === \"github.com\" ? {} : { baseUrl: `https://${host}/api/v3` }),\n });\n },\n };\n}\n\nexport async function runBulkScanWizard(\n dependencies: BulkScanDiscoveryDependencies,\n signal?: AbortSignal,\n): Promise<BulkScanWizardResult | null> {\n const { prompt } = dependencies;\n if (!prompt.isInteractive()) {\n throw new Error(\n \"Interactive repository selection requires a terminal. Provide a CSV with 'codex-security bulk-scan repositories.csv --output-dir ./security-scans'.\",\n );\n }\n signal?.throwIfAborted();\n\n const githubHost = dependencies.githubHost ?? \"github.com\";\n const github = await dependencies.createGitHub(githubHost, signal);\n const owner = await selectGitHubOwner(github, prompt, signal);\n prompt.write(\"\\nFinding active repositories...\\n\");\n const discovered = await discoverGitHubRepositories(\n github,\n githubHost,\n owner,\n dependencies.now() - 90 * 86_400_000,\n signal,\n );\n if (discovered.length === 0) {\n prompt.write(\"\\nNo repositories matched your selection.\\n\");\n return null;\n }\n\n prompt.write(`\\nFound ${discovered.length} repositories.\\n`);\n const repositories = await selectGitHubRepositories(discovered, prompt);\n\n const outputDir = resolve(\n dependencies.currentDirectory(),\n expandHome(\n await prompt.input(\n \"Where should scan results be saved?\",\n \"./security-scans\",\n ),\n ),\n );\n const inputPath = join(outputDir, \"repositories.csv\");\n await validateWizardOutput(outputDir);\n prompt.write(\n `\\nReady to scan ${repositories.length} repositories?\\n` +\n `Results: ${outputDir}\\nRepository list: ${inputPath}\\n`,\n );\n if (!(await prompt.confirm(\"Start scanning?\"))) {\n prompt.write(\"\\nScan canceled.\\n\");\n return null;\n }\n signal?.throwIfAborted();\n\n await mkdir(outputDir, { recursive: true, mode: 0o700 });\n await writeFile(\n inputPath,\n `${Papa.unparse(\n repositories.map(({ fullName, url, revision }) => ({\n id: repositoryId(fullName),\n repository: url,\n revision,\n })),\n )}\\n`,\n { flag: \"wx\", mode: 0o600, ...(signal === undefined ? {} : { signal }) },\n );\n return { inputPath, outputDir, githubHost };\n}\n\nasync function selectGitHubOwner(\n github: Octokit,\n prompt: BulkScanPrompt,\n signal?: AbortSignal,\n): Promise<string> {\n const [firstPage, user] = await Promise.all([\n github.request(\"GET /user/orgs\", { per_page: 100, request: { signal } }),\n github.request(\"GET /user\", { request: { signal } }),\n ]);\n const organizations = [...firstPage.data];\n let response = firstPage;\n let page = 1;\n while (response.headers.link?.includes('rel=\"next\"')) {\n signal?.throwIfAborted();\n response = await github.request(\"GET /user/orgs\", {\n per_page: 100,\n page: ++page,\n request: { signal },\n });\n organizations.push(...response.data);\n }\n const personal = user.data.login;\n const owners = [personal, ...organizations.map(({ login }) => login)].sort();\n if (owners.length > 1) {\n return await prompt.select(\n \"Which account or organization should we scan?\",\n owners.map((owner) => ({ label: owner, value: owner })),\n );\n }\n prompt.write(`\\nFinding repositories in ${personal}.\\n`);\n return personal;\n}\n\nasync function selectGitHubRepositories(\n repositories: GitHubRepository[],\n prompt: BulkScanPrompt,\n): Promise<GitHubRepository[]> {\n const selected = new Set<string>();\n while (selected.size < repositories.length) {\n const choice = await prompt.select(\n \"Select repositories to scan (type to filter)\",\n [\n {\n label: selected.size\n ? `Done (${selected.size} selected)`\n : `All ${repositories.length} repositories`,\n value: \"\",\n },\n ...repositories\n .filter(({ fullName }) => !selected.has(fullName))\n .map(({ fullName }) => ({ label: fullName, value: fullName })),\n ],\n );\n if (!choice) break;\n selected.add(choice);\n }\n return selected.size\n ? repositories.filter(({ fullName }) => selected.has(fullName))\n : repositories;\n}\n\nasync function discoverGitHubRepositories(\n github: Octokit,\n host: string,\n owner: string,\n cutoff: number,\n signal?: AbortSignal,\n): Promise<GitHubRepository[]> {\n const repositories: GitHubRepository[] = [];\n let cursor: string | null = null;\n\n do {\n signal?.throwIfAborted();\n const result: GitHubRepositoriesResponse = await github.graphql(\n GITHUB_REPOSITORIES_QUERY,\n { owner, cursor, request: { signal } },\n );\n const connection = result.repositoryOwner?.repositories;\n if (connection === undefined) {\n throw new Error(\"GitHub could not list repositories for this account.\");\n }\n\n for (const repository of connection.nodes) {\n if (Date.parse(repository.pushedAt) < cutoff) return repositories;\n if (repository.defaultBranchRef === null) continue;\n repositories.push({\n fullName: repository.nameWithOwner,\n url: `https://${host}/${repository.nameWithOwner}.git`,\n revision: repository.defaultBranchRef.target.oid.toLowerCase(),\n });\n }\n cursor = connection.pageInfo.hasNextPage\n ? connection.pageInfo.endCursor\n : null;\n } while (cursor !== null);\n\n return repositories;\n}\n\nfunction repositoryId(fullName: string): string {\n const id = fullName.replace(\"/\", \"--\");\n if (id.length <= 128) return id;\n const hash = createHash(\"sha256\").update(fullName).digest(\"hex\").slice(0, 16);\n return `${id.slice(0, 111)}-${hash}`;\n}\n\nasync function validateWizardOutput(outputDir: string): Promise<void> {\n let metadata;\n try {\n metadata = await lstat(outputDir);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return;\n throw error;\n }\n if (!metadata.isDirectory()) {\n throw new Error(\"The scan output must be a real directory.\");\n }\n\n for (const name of [\"repositories.csv\", \"manifest.json\"]) {\n try {\n await lstat(join(outputDir, name));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") continue;\n throw error;\n }\n throw new Error(\n \"The selected output directory already contains a repository list or scan. Choose a new directory or resume the existing scan.\",\n );\n }\n}\n\nfunction createTerminalPrompt(output: PromptOutput): BulkScanPrompt {\n const context = (signal?: AbortSignal) => {\n const stream = new Writable({\n write(chunk: Buffer, _encoding, callback) {\n output.write(chunk.toString(\"utf8\"));\n callback();\n },\n });\n Object.defineProperty(stream, \"columns\", {\n configurable: true,\n get: () => output.columns,\n });\n return { input: stdin, output: stream, signal };\n };\n\n return {\n isInteractive: () => stdin.isTTY === true && output.isTTY === true,\n write: (value) => {\n output.write(value);\n },\n confirm: (message, defaultValue = false, signal) =>\n confirm({ message, default: defaultValue }, context(signal)),\n input: (message, defaultValue, signal) =>\n input({ message, default: defaultValue }, context(signal)),\n checkbox: (message, options, presentation, signal) =>\n checkbox(\n {\n message,\n choices: [\n ...(presentation?.header === undefined\n ? []\n : [new Separator(presentation.header)]),\n ...options.map(({ label, value, short }) => ({\n name: label,\n value,\n ...(short === undefined ? {} : { short }),\n })),\n ],\n required: presentation?.required,\n },\n context(signal),\n ),\n select: (message, options, presentation, signal) =>\n search(\n {\n message,\n ...(presentation?.header === undefined\n ? {}\n : {\n theme: {\n style: {\n searchTerm: (term: string) =>\n `${term}\\n ${presentation.header}`,\n },\n },\n }),\n source: (term) =>\n options\n .filter(({ label }) =>\n label.toLowerCase().includes(term?.toLowerCase() ?? \"\"),\n )\n .map(({ label, value, short }) => ({\n name: label,\n value,\n ...(short === undefined ? {} : { short }),\n })),\n },\n context(signal),\n ),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bulk-scan-discovery.js","sourceRoot":"","sources":["../src/bulk-scan-discovery.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AC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;iBAC1C,CAAC,CAAC;aACJ;YACD,QAAQ,EAAE,YAAY,EAAE,QAAQ;SACjC,EACD,OAAO,CAAC,MAAM,CAAC,CAChB;QACH,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,CACjD,MAAM,CACJ;YACE,OAAO;YACP,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,SAAS;gBACpC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC;oBACE,KAAK,EAAE;wBACL,KAAK,EAAE;4BACL,UAAU,EAAE,CAAC,IAAY,EAAE,EAAE,CAC3B,GAAG,IAAI,OAAO,YAAY,CAAC,MAAM,EAAE;yBACtC;qBACF;iBACF,CAAC;YACN,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CACf,OAAO;iBACJ,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACpB,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CACxD;iBACA,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACjC,IAAI,EAAE,KAAK;gBACX,KAAK;gBACL,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;aAC1C,CAAC,CAAC;SACR,EACD,OAAO,CAAC,MAAM,CAAC,CAChB;KACJ,CAAC;AACJ,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstat, mkdir, writeFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { stdin } from \"node:process\";\nimport { Writable } from \"node:stream\";\nimport { checkbox, confirm, input, search, Separator } from \"@inquirer/prompts\";\nimport { Octokit } from \"@octokit/core\";\nimport Papa from \"papaparse\";\nimport { createAuthenticatedGitHub } from \"./github.js\";\nimport { expandHome } from \"./runtime.js\";\n\nconst GITHUB_REPOSITORIES_QUERY = `\n query($owner: String!, $cursor: String) {\n repositoryOwner(login: $owner) {\n repositories(\n first: 100\n after: $cursor\n isArchived: false\n isFork: false\n orderBy: { field: PUSHED_AT, direction: DESC }\n ) {\n nodes {\n nameWithOwner\n pushedAt\n defaultBranchRef { target { oid } }\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n }\n`;\n\ninterface GitHubRepository {\n fullName: string;\n url: string;\n revision: string;\n}\n\ninterface GitHubRepositoriesResponse {\n repositoryOwner: {\n repositories: {\n nodes: Array<{\n nameWithOwner: string;\n pushedAt: string;\n defaultBranchRef: { target: { oid: string } } | null;\n }>;\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n };\n } | null;\n}\n\nexport interface BulkScanPrompt {\n isInteractive(): boolean;\n write(value: string): void;\n confirm(\n question: string,\n defaultValue?: boolean,\n signal?: AbortSignal,\n ): Promise<boolean>;\n input(\n question: string,\n defaultValue?: string,\n signal?: AbortSignal,\n ): Promise<string>;\n select<Value extends string>(\n question: string,\n options: readonly { label: string; value: Value; short?: string }[],\n presentation?: { header?: string },\n signal?: AbortSignal,\n ): Promise<Value>;\n checkbox<Value extends string>(\n question: string,\n options: readonly { label: string; value: Value; short?: string }[],\n presentation?: { header?: string; required?: boolean },\n signal?: AbortSignal,\n ): Promise<Value[]>;\n}\n\nexport interface BulkScanDiscoveryDependencies {\n prompt: BulkScanPrompt;\n now(): number;\n currentDirectory(): string;\n githubHost?: string;\n createGitHub(host: string, signal?: AbortSignal): Promise<Octokit>;\n}\n\nexport interface BulkScanWizardResult {\n inputPath: string;\n outputDir: string;\n githubHost: string;\n}\n\ninterface PromptOutput {\n write(value: string): unknown;\n readonly isTTY?: boolean;\n readonly columns?: number;\n}\n\nexport function createBulkScanDiscoveryDependencies(options: {\n output: PromptOutput;\n now(): number;\n currentDirectory(): string;\n}): BulkScanDiscoveryDependencies {\n return {\n prompt: createTerminalPrompt(options.output),\n now: options.now,\n currentDirectory: options.currentDirectory,\n ...(process.env[\"GH_HOST\"]?.trim()\n ? { githubHost: process.env[\"GH_HOST\"].trim() }\n : {}),\n createGitHub: (host, signal) =>\n createAuthenticatedGitHub(host, {\n environment: process.env,\n currentDirectory: options.currentDirectory(),\n signal,\n }),\n };\n}\n\nexport async function runBulkScanWizard(\n dependencies: BulkScanDiscoveryDependencies,\n signal?: AbortSignal,\n): Promise<BulkScanWizardResult | null> {\n const { prompt } = dependencies;\n if (!prompt.isInteractive()) {\n throw new Error(\n \"Interactive repository selection requires a terminal. Provide a CSV with 'codex-security bulk-scan repositories.csv --output-dir ./security-scans'.\",\n );\n }\n signal?.throwIfAborted();\n\n const githubHost = dependencies.githubHost ?? \"github.com\";\n const github = await dependencies.createGitHub(githubHost, signal);\n const owner = await selectGitHubOwner(github, prompt, signal);\n prompt.write(\"\\nFinding active repositories...\\n\");\n const discovered = await discoverGitHubRepositories(\n github,\n githubHost,\n owner,\n dependencies.now() - 90 * 86_400_000,\n signal,\n );\n if (discovered.length === 0) {\n prompt.write(\"\\nNo repositories matched your selection.\\n\");\n return null;\n }\n\n prompt.write(`\\nFound ${discovered.length} repositories.\\n`);\n const repositories = await selectGitHubRepositories(discovered, prompt);\n\n const outputDir = resolve(\n dependencies.currentDirectory(),\n expandHome(\n await prompt.input(\n \"Where should scan results be saved?\",\n \"./security-scans\",\n ),\n ),\n );\n const inputPath = join(outputDir, \"repositories.csv\");\n await validateWizardOutput(outputDir);\n prompt.write(\n `\\nReady to scan ${repositories.length} repositories?\\n` +\n `Results: ${outputDir}\\nRepository list: ${inputPath}\\n`,\n );\n if (!(await prompt.confirm(\"Start scanning?\"))) {\n prompt.write(\"\\nScan canceled.\\n\");\n return null;\n }\n signal?.throwIfAborted();\n\n await mkdir(outputDir, { recursive: true, mode: 0o700 });\n await writeFile(\n inputPath,\n `${Papa.unparse(\n repositories.map(({ fullName, url, revision }) => ({\n id: repositoryId(fullName),\n repository: url,\n revision,\n })),\n )}\\n`,\n { flag: \"wx\", mode: 0o600, ...(signal === undefined ? {} : { signal }) },\n );\n return { inputPath, outputDir, githubHost };\n}\n\nasync function selectGitHubOwner(\n github: Octokit,\n prompt: BulkScanPrompt,\n signal?: AbortSignal,\n): Promise<string> {\n const [firstPage, user] = await Promise.all([\n github.request(\"GET /user/orgs\", { per_page: 100, request: { signal } }),\n github.request(\"GET /user\", { request: { signal } }),\n ]);\n const organizations = [...firstPage.data];\n let response = firstPage;\n let page = 1;\n while (response.headers.link?.includes('rel=\"next\"')) {\n signal?.throwIfAborted();\n response = await github.request(\"GET /user/orgs\", {\n per_page: 100,\n page: ++page,\n request: { signal },\n });\n organizations.push(...response.data);\n }\n const personal = user.data.login;\n const owners = [personal, ...organizations.map(({ login }) => login)].sort();\n if (owners.length > 1) {\n return await prompt.select(\n \"Which account or organization should we scan?\",\n owners.map((owner) => ({ label: owner, value: owner })),\n );\n }\n prompt.write(`\\nFinding repositories in ${personal}.\\n`);\n return personal;\n}\n\nasync function selectGitHubRepositories(\n repositories: GitHubRepository[],\n prompt: BulkScanPrompt,\n): Promise<GitHubRepository[]> {\n const selected = new Set<string>();\n while (selected.size < repositories.length) {\n const choice = await prompt.select(\n \"Select repositories to scan (type to filter)\",\n [\n {\n label: selected.size\n ? `Done (${selected.size} selected)`\n : `All ${repositories.length} repositories`,\n value: \"\",\n },\n ...repositories\n .filter(({ fullName }) => !selected.has(fullName))\n .map(({ fullName }) => ({ label: fullName, value: fullName })),\n ],\n );\n if (!choice) break;\n selected.add(choice);\n }\n return selected.size\n ? repositories.filter(({ fullName }) => selected.has(fullName))\n : repositories;\n}\n\nasync function discoverGitHubRepositories(\n github: Octokit,\n host: string,\n owner: string,\n cutoff: number,\n signal?: AbortSignal,\n): Promise<GitHubRepository[]> {\n const repositories: GitHubRepository[] = [];\n let cursor: string | null = null;\n\n do {\n signal?.throwIfAborted();\n const result: GitHubRepositoriesResponse = await github.graphql(\n GITHUB_REPOSITORIES_QUERY,\n { owner, cursor, request: { signal } },\n );\n const connection = result.repositoryOwner?.repositories;\n if (connection === undefined) {\n throw new Error(\"GitHub could not list repositories for this account.\");\n }\n\n for (const repository of connection.nodes) {\n if (Date.parse(repository.pushedAt) < cutoff) return repositories;\n if (repository.defaultBranchRef === null) continue;\n repositories.push({\n fullName: repository.nameWithOwner,\n url: `https://${host}/${repository.nameWithOwner}.git`,\n revision: repository.defaultBranchRef.target.oid.toLowerCase(),\n });\n }\n cursor = connection.pageInfo.hasNextPage\n ? connection.pageInfo.endCursor\n : null;\n } while (cursor !== null);\n\n return repositories;\n}\n\nfunction repositoryId(fullName: string): string {\n const id = fullName.replace(\"/\", \"--\");\n if (id.length <= 128) return id;\n const hash = createHash(\"sha256\").update(fullName).digest(\"hex\").slice(0, 16);\n return `${id.slice(0, 111)}-${hash}`;\n}\n\nasync function validateWizardOutput(outputDir: string): Promise<void> {\n let metadata;\n try {\n metadata = await lstat(outputDir);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return;\n throw error;\n }\n if (!metadata.isDirectory()) {\n throw new Error(\"The scan output must be a real directory.\");\n }\n\n for (const name of [\"repositories.csv\", \"manifest.json\"]) {\n try {\n await lstat(join(outputDir, name));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") continue;\n throw error;\n }\n throw new Error(\n \"The selected output directory already contains a repository list or scan. Choose a new directory or resume the existing scan.\",\n );\n }\n}\n\nfunction createTerminalPrompt(output: PromptOutput): BulkScanPrompt {\n const context = (signal?: AbortSignal) => {\n const stream = new Writable({\n write(chunk: Buffer, _encoding, callback) {\n output.write(chunk.toString(\"utf8\"));\n callback();\n },\n });\n Object.defineProperty(stream, \"columns\", {\n configurable: true,\n get: () => output.columns,\n });\n return { input: stdin, output: stream, signal };\n };\n\n return {\n isInteractive: () => stdin.isTTY === true && output.isTTY === true,\n write: (value) => {\n output.write(value);\n },\n confirm: (message, defaultValue = false, signal) =>\n confirm({ message, default: defaultValue }, context(signal)),\n input: (message, defaultValue, signal) =>\n input({ message, default: defaultValue }, context(signal)),\n checkbox: (message, options, presentation, signal) =>\n checkbox(\n {\n message,\n choices: [\n ...(presentation?.header === undefined\n ? []\n : [new Separator(presentation.header)]),\n ...options.map(({ label, value, short }) => ({\n name: label,\n value,\n ...(short === undefined ? {} : { short }),\n })),\n ],\n required: presentation?.required,\n },\n context(signal),\n ),\n select: (message, options, presentation, signal) =>\n search(\n {\n message,\n ...(presentation?.header === undefined\n ? {}\n : {\n theme: {\n style: {\n searchTerm: (term: string) =>\n `${term}\\n ${presentation.header}`,\n },\n },\n }),\n source: (term) =>\n options\n .filter(({ label }) =>\n label.toLowerCase().includes(term?.toLowerCase() ?? \"\"),\n )\n .map(({ label, value, short }) => ({\n name: label,\n value,\n ...(short === undefined ? {} : { short }),\n })),\n },\n context(signal),\n ),\n };\n}\n"]}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { CodexSecurity } from "./api.js";
|
|
3
|
-
import {
|
|
3
|
+
import { publishScanToCustom } from "./custom-publish.js";
|
|
4
|
+
import { deduplicateScanInternal } from "./deduplication/scan.js";
|
|
5
|
+
import { publishFindingsCsvToCloud, publishScanToCloud } from "./cloud-publish.js";
|
|
4
6
|
import { type BulkScanDiscoveryDependencies, type BulkScanPrompt } from "./bulk-scan-discovery.js";
|
|
5
7
|
import { type CodexSecurityConfig, type ExternalModelProvider, type JsonObject } from "./config.js";
|
|
8
|
+
import { importGitHubCodeScanningAlerts } from "./github.js";
|
|
6
9
|
import { type LinearClientFactory } from "./linear.js";
|
|
7
10
|
import type { Finding } from "./models.js";
|
|
8
11
|
import { planComponents } from "./component-plan.js";
|
|
9
12
|
import { checkScanPublication, publishScan } from "./publish.js";
|
|
10
13
|
import { type CodexCommand } from "./runtime.js";
|
|
11
14
|
import { type matchScanFindings } from "./scan-comparison.js";
|
|
15
|
+
import { CODEX_SECURITY_THREAD_SOURCES, type CodexSecurityThreadSource } from "./thread-source.js";
|
|
12
16
|
import type { PatchSelection } from "./patch-tui.js";
|
|
13
17
|
import { type UpdateNotice } from "./version.js";
|
|
14
18
|
type Writable = Pick<NodeJS.WriteStream, "write"> & {
|
|
@@ -34,6 +38,7 @@ interface ExportArguments {
|
|
|
34
38
|
sourceRoot?: string;
|
|
35
39
|
pythonPath?: string;
|
|
36
40
|
}
|
|
41
|
+
type SkillThreadSource = Extract<CodexSecurityThreadSource, typeof CODEX_SECURITY_THREAD_SOURCES.remediation | typeof CODEX_SECURITY_THREAD_SOURCES.validation>;
|
|
37
42
|
interface SkillCommandOutput {
|
|
38
43
|
readonly command: "validate" | "patch" | "verify-fix";
|
|
39
44
|
readonly stdout: Writable;
|
|
@@ -41,10 +46,21 @@ interface SkillCommandOutput {
|
|
|
41
46
|
readonly appServer?: {
|
|
42
47
|
readonly directory: string;
|
|
43
48
|
readonly prompt: string;
|
|
49
|
+
readonly threadSource: SkillThreadSource;
|
|
44
50
|
readonly sandbox?: "read-only" | "workspace-write";
|
|
45
51
|
readonly onEvent?: (event: Readonly<Record<string, unknown>>) => void;
|
|
46
52
|
};
|
|
47
53
|
}
|
|
54
|
+
interface PatchRiskRequest {
|
|
55
|
+
repository: string;
|
|
56
|
+
base: string;
|
|
57
|
+
files?: readonly string[];
|
|
58
|
+
codexOverrides: readonly string[];
|
|
59
|
+
effort: ScanReasoningEffort | undefined;
|
|
60
|
+
}
|
|
61
|
+
interface PatchRiskReport {
|
|
62
|
+
report: string;
|
|
63
|
+
}
|
|
48
64
|
interface CliDependencies {
|
|
49
65
|
createSecurity(config: CodexSecurityConfig): Pick<CodexSecurity, "run" | "preflight" | "close">;
|
|
50
66
|
environment: NodeJS.ProcessEnv;
|
|
@@ -54,7 +70,10 @@ interface CliDependencies {
|
|
|
54
70
|
publishPrompt?: Pick<BulkScanPrompt, "isInteractive" | "select"> & Partial<Pick<BulkScanPrompt, "checkbox">>;
|
|
55
71
|
checkScanPublication?: typeof checkScanPublication;
|
|
56
72
|
publishScan?: typeof publishScan;
|
|
73
|
+
deduplicateScan?: typeof deduplicateScanInternal;
|
|
74
|
+
publishFindingsCsvToCloud?: typeof publishFindingsCsvToCloud;
|
|
57
75
|
publishScanToCloud?: typeof publishScanToCloud;
|
|
76
|
+
publishScanToCustom?: typeof publishScanToCustom;
|
|
58
77
|
confirmPatchReview?: (question: string) => Promise<boolean>;
|
|
59
78
|
patchEditor?: (repository: string, findings: readonly Finding[]) => Promise<PatchSelection | null>;
|
|
60
79
|
currentDirectory(): string;
|
|
@@ -64,13 +83,19 @@ interface CliDependencies {
|
|
|
64
83
|
addSignalListener(signal: SignalName, listener: () => void): void;
|
|
65
84
|
removeSignalListener(signal: SignalName, listener: () => void): void;
|
|
66
85
|
writeSynchronously(stream: Writable, value: string): void;
|
|
86
|
+
terminatePublishers?(): void;
|
|
67
87
|
forceExit(signal: SignalName): void;
|
|
68
88
|
exportFindings(arguments_: ExportArguments, output?: Writable): Promise<Uint8Array | undefined>;
|
|
69
89
|
runCodex(args: readonly string[], output?: SkillCommandOutput, environment?: NodeJS.ProcessEnv, input?: string): Promise<number>;
|
|
70
|
-
runRepositoryCommand(command: "git" | "gh", args: readonly string[], repository: string
|
|
90
|
+
runRepositoryCommand(command: "git" | "gh", args: readonly string[], repository: string, options?: {
|
|
91
|
+
trim?: boolean;
|
|
92
|
+
environment?: NodeJS.ProcessEnv;
|
|
93
|
+
}): Promise<string>;
|
|
94
|
+
assessPatchRisk?: (request: PatchRiskRequest) => Promise<PatchRiskReport>;
|
|
71
95
|
bulkScan?: BulkScanDiscoveryDependencies;
|
|
72
96
|
planComponents?: typeof planComponents;
|
|
73
97
|
linearClient?: LinearClientFactory;
|
|
98
|
+
importGitHubAlerts?: typeof importGitHubCodeScanningAlerts;
|
|
74
99
|
runWorkbench(args: readonly string[], input?: string): Promise<JsonObject>;
|
|
75
100
|
matchFindings: typeof matchScanFindings;
|
|
76
101
|
checkForUpdate(signal: AbortSignal): Promise<UpdateNotice | undefined>;
|
|
@@ -81,6 +106,7 @@ export declare function main(argv?: readonly string[], output?: Writable, errorO
|
|
|
81
106
|
export declare function readSkillCommandOutput(stream: AsyncIterable<Buffer | string>, appServer?: {
|
|
82
107
|
readonly directory?: string;
|
|
83
108
|
readonly prompt: string;
|
|
109
|
+
readonly threadSource: SkillThreadSource;
|
|
84
110
|
readonly input: NodeJS.WritableStream;
|
|
85
111
|
readonly sandbox?: "read-only" | "workspace-write";
|
|
86
112
|
readonly onEvent?: (event: Readonly<Record<string, unknown>>) => void;
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAiDA,OAAO,EAEL,aAAa,EAUd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAMlE,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAcrB,OAAO,EAEL,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAuB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EACL,oBAAoB,EAEpB,WAAW,EAIZ,MAA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