Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 51x 779x 779x 2x 2x 2x 779x 7x 7x 7x 779x 779x 9x 779x 20x 15x 1782x 1779x 3x 3x 2x | export { processInBatches, runPool, Semaphore } from './async.js';
export { getVersion, getMajorVersion } from './version.js';
export {
ExecError,
execNonInteractive,
execFileNonInteractive,
execGitNonInteractive,
GIT_NON_INTERACTIVE_ENV,
} from './exec.js';
export { isPathLike } from './path.js';
export type { ExecOptions } from './exec.js';
/** Default concurrency for parallel trigger/skill execution */
export const DEFAULT_CONCURRENCY = 4;
/**
* Escape HTML special characters to prevent them from being interpreted as HTML.
* Preserves content inside markdown code blocks (```) and inline code (`).
* Used when rendering finding titles/descriptions in GitHub comments.
*/
export function escapeHtml(text: string): string {
// Extract code blocks and inline code, escape HTML in the rest
const codeBlocks: string[] = [];
// Replace code blocks (``` ... ```) and inline code (` ... `) with indexed placeholders
// Process triple backticks first (they may contain single backticks)
let processed = text.replace(/```[\s\S]*?```/g, (match) => {
const idx = codeBlocks.length;
codeBlocks.push(match);
return `\0CODE${idx}\0`;
});
// Then process inline code (single backticks)
processed = processed.replace(/`[^`]+`/g, (match) => {
const idx = codeBlocks.length;
codeBlocks.push(match);
return `\0CODE${idx}\0`;
});
// Escape HTML in the non-code portions
processed = processed
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>');
// Restore code blocks by index
codeBlocks.forEach((block, i) => {
processed = processed.replace(`\0CODE${i}\0`, block);
});
return processed;
}
/**
* Get the Anthropic API key from environment variables.
* Checks WARDEN_ANTHROPIC_API_KEY first, then falls back to ANTHROPIC_API_KEY.
*/
export function getAnthropicApiKey(): string | undefined {
return process.env['WARDEN_ANTHROPIC_API_KEY'] ?? process.env['ANTHROPIC_API_KEY'];
}
/**
* Mirrors WARDEN-prefixed provider API keys to the env names expected by SDKs.
*/
export function bridgeWardenProviderApiKeyEnv(env: NodeJS.ProcessEnv = process.env): void {
for (const [key, value] of Object.entries(env)) {
if (!value || !key.startsWith('WARDEN_') || !key.endsWith('_API_KEY')) {
continue;
}
const providerKey = key.slice('WARDEN_'.length);
if (!env[providerKey]) {
env[providerKey] = value;
}
}
}
|