text stringlengths 3 8.33k | repo stringclasses 52
values | path stringlengths 6 141 | language stringclasses 35
values | sha stringlengths 64 64 | chunk_index int32 0 273 | n_tokens int32 1 896 |
|---|---|---|---|---|---|---|
import { Octokit } from "@octokit/rest";
import { loadRepoConfig } from "@/lib/config";
import { DEFAULT_CLAWGUARD_CONFIG } from "@/lib/config/defaults";
import { appendLearningRepo, extractLearningFromComment } from "@/lib/learnings";
import { correlateIssueToPrediction } from "@/lib/tracking/correlator";
import { rec... | clawguard | lib/github-issues-webhook.ts | TypeScript | 17432af23760755efe0f9e35b44d8f542f8cf7cdde8cc0bb80a852afc4cb99d4 | 0 | 857 |
/**
* Chat SDK mention detection uses `@${userName}\b`. That does not match `@clawguardbot`
* when `userName` is `clawguard` (no word boundary between `d` and `b`). We register an
* extra pattern for alternate @handles (GitHub App slug is often `somethingbot`).
*/
function escapeRegex(s: string): string {
return ... | clawguard | lib/github-mention-pattern.ts | TypeScript | f3d04ebfb3ab2ef395edc1b1361bbf0a758c96c32136cfc56f03309f154a9129 | 0 | 438 |
import { Octokit } from "@octokit/rest";
let cachedTokenUserId: number | null | undefined;
/**
* Numeric GitHub user id for `GITHUB_TOKEN` (PAT). Used to filter our own API
* comments when the adapter cannot use installation bot identity.
*/
export async function getGithubTokenUserId(): Promise<number | null> {
... | clawguard | lib/github-pat-user.ts | TypeScript | d3bc365c993f85ea4a2bcdf621cd36f8759e41ee51e96d8f9a385f68ba9f3e8b | 0 | 151 |
import { Octokit } from "@octokit/rest";
import {
isAuditCooldownActive,
releaseAuditLock,
setAuditCooldown,
tryAcquireAuditLock,
} from "@/lib/auto-trigger-redis";
import { loadRepoConfig } from "@/lib/config";
import { DEFAULT_CLAWGUARD_CONFIG } from "@/lib/config/defaults";
import { runAuditPipeline } from "... | clawguard | lib/github-pull-request-webhook.ts | TypeScript | 591f8e6a19a56f846f1425381ce4d6cefdd0e7aaecfdab1c549846fae314cb85 | 0 | 896 |
) => {
await octokit.issues.updateComment({
owner: ownerLogin,
repo: repoName,
comment_id: commentId,
body: markdown,
});
},
};
await runAuditPipeline(octokit, ownerLogin, repoName, prNumber, editor, {
preloadedConfig: prelo... | clawguard | lib/github-pull-request-webhook.ts | TypeScript | 8b7c6e26f25afe2377b2d629c693cc5ec3c3f8ad8785d6239a096bf24530b1d3 | 1 | 141 |
import { gateway } from "@ai-sdk/gateway";
import { generateText } from "ai";
import type { Intent } from "@/lib/intent-types";
const INTENT_MODEL = process.env.CLAWGUARD_INTENT_MODEL ?? "openai/gpt-4o-mini";
export async function classifyIntentWithLlm(body: string, botName: string): Promise<Intent | null> {
const ... | clawguard | lib/intent-classifier.ts | TypeScript | 84f1a748677c0ad3061371d6e159191d7b7fa2710683181bfed34f93a0c30299 | 0 | 438 |
export type Intent =
| { type: "fix-all" }
| { type: "fix-finding"; target: string }
| { type: "re-audit" }
| { type: "feedback"; raw: string }
| { type: "unknown" };
| clawguard | lib/intent-types.ts | TypeScript | 904a8f1e3b91fd8626cd01088514088370b62f96fabc3c7a0325e903bfecafe6 | 0 | 59 |
import { Shield } from "lucide-react";
import { FirstBentoAnimation } from "@/components/first-bento-animation";
import { FourthBentoAnimation } from "@/components/fourth-bento-animation";
import { SecondBentoAnimation } from "@/components/second-bento-animation";
import { ThirdBentoAnimation } from "@/components/third... | clawguard | lib/landing-config.tsx | TypeScript | f54563ca193dd0d54a5ea108e0abb1a277b2bc71033a75933c694ce98a047641 | 0 | 896 |
6.16797 42.0822 6.16797C37.7054 6.16797 34.5469 9.59721 34.5469 14.5155ZM46.7298 14.5155C46.7298 18.035 44.8121 20.3137 42.0822 20.3137C39.3524 20.3137 37.4347 18.035 37.4347 14.5155C37.4347 10.996 39.3524 8.71736 42.0822 8.71736C44.8121 8.71736 46.7298 10.996 46.7298 14.5155Z" />
<path d="M57.7468 22.8652C... | clawguard | lib/landing-config.tsx | TypeScript | 052ae5bceb84ca34e0559a47a84a7dd1404aba8e71df215d88bdcf74e4049797 | 1 | 896 |
7879 2.02139 16.0626 2.48389 17.075 3.32618C17.0289 3.3506 16.95 3.39479 16.8973 3.42677L10.9074 6.88612C10.6009 7.06002 10.4129 7.38526 10.4148 7.73778L10.411 16.1784V16.1803ZM11.7863 13.2154L15.0436 11.3344L18.3008 13.2145V16.9756L15.0436 18.8556L11.7863 16.9756V13.2154Z" />
</svg>
),
},
... | clawguard | lib/landing-config.tsx | TypeScript | 2c5976728dc36d4dab74d76faf0323a6d902a02459f7276349e8c85131aa93fe | 2 | 896 |
-black"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M72.2313 15.5944C72.2313 10.4676 69.7478 6.4222 65.0013 6.4222C60.2348 6.4222 57.3508 10.4676 57.3508 15.5543C57.3508 21.5824 60.7558 24.6264 65.6423 24.6264C68.0253 24.6264 69.8278 24.0857 71.1898 2... | clawguard | lib/landing-config.tsx | TypeScript | 0d5013bbbf72e1000b8981a7ac86dcf5a332861bc101b7b711941fe1a79661a7 | 3 | 896 |
67.5174 5.18671 69.132 5.18671Z" />
</svg>
),
},
{
id: 5,
name: "Company 5",
logo: (
<svg
width="99"
height="31"
viewBox="0 0 99 31"
fill="none"
xmlns="http://www.w3.org/2000/svg"
clas... | clawguard | lib/landing-config.tsx | TypeScript | e16ce4bf9650980f075b1bc677bd99c1a88d75a2bb77b43eba2faa3412914dd0 | 4 | 896 |
17.4292 72.4968 16.3842 73.3307 14.6598L73.5704 14.7442C73.0957 17.9527 71.1917 20.343 67.9221 20.343C64.1966 20.343 62.0993 17.24 62.0093 13.3573C62.0067 13.2072 62.0077 13.058 62.0108 12.9098C62.0128 12.8174 62.0164 12.7253 62.021 12.6336C62.0235 12.5845 62.026 12.5385 62.0296 12.4871C62.0332 12.4357 62.0367 12.3843 ... | clawguard | lib/landing-config.tsx | TypeScript | b13eba511eb413c1fa82dc043472c36b164f58d8a9a14003c08f7ea0510a7cd5 | 5 | 896 |
32.3675 2.26172 33.322 2.26172C34.2766 2.26172 35.0496 5.99763 35.0496 10.6057Z" />
</svg>
),
},
{
id: 7,
name: "Company 7",
logo: (
<svg
width="134"
height="31"
viewBox="0 0 134 31"
fill="none"
x... | clawguard | lib/landing-config.tsx | TypeScript | 281d790cfaf08fb5792120b3d37a87ff7fab2b11050a9e648e71d82c0b1ff33c | 6 | 896 |
78.7574 8.04688 78.9013 8.04688H80.4629C80.6063 8.04688 80.7444 8.10394 80.8456 8.20559C80.9475 8.30719 81.0042 8.44502 81.0042 8.58875V13.2931C81.3923 12.7737 81.8997 12.3552 82.4832 12.0729C83.0668 11.7906 83.7094 11.6526 84.3579 11.6708C86.6709 11.6708 88.0223 13.3168 88.0223 15.6672V22.3732C88.0223 22.5168 87.9655 ... | clawguard | lib/landing-config.tsx | TypeScript | 1bde2f9dbe9c46a58e9cbc7afcbe7b50a641f3a8d9918650ff71db5f0ae91967 | 7 | 896 |
11.1812 30.1293H20.0508C22.9893 30.1293 24.4552 30.1293 26.0362 29.6283C26.8919 29.3184 27.669 28.8243 28.3125 28.1808C28.9561 27.5373 29.4503 26.7602 29.7601 25.9045C30.2612 24.3202 30.2612 22.8544 30.2612 19.9194V11.0771C30.2612 8.13871 30.2612 6.67286 29.7601 5.09194C29.4503 4.23631 28.9561 3.45917 28.3125 2.8157C27... | clawguard | lib/landing-config.tsx | TypeScript | f75726dd9ae0ac9def10e413fec53d0be373129300219145188c6acc4878934a | 8 | 896 |
15.8882 76.2181 15.0348 75.6152 14.4533C75.0217 13.8625 74.2256 13.567 73.2267 13.567C72.586 13.567 72.0019 13.6983 71.4743 13.9609C70.9468 14.2235 70.5275 14.6268 70.2165 15.1708C69.9056 15.7147 69.7501 16.4134 69.7501 17.2669ZM100.334 25.567C101.107 25.8952 101.993 26.0594 102.991 26.0594C103.811 26.0594 104.513 25.9... | clawguard | lib/landing-config.tsx | TypeScript | 5939f02442f239fd9c38ae437a0a2f25736c4af49bd5e6e6380fae168061b0ba | 9 | 896 |
isolated Vercel Sandbox for recon, static analysis, and threat modeling with CWE/OWASP mapping.",
image: pubScreenshot.threatModel,
},
{
id: 3,
title: "Interactive security report",
content:
"Explore findings through charts, severity breakdowns, Mermaid data-flow di... | clawguard | lib/landing-config.tsx | TypeScript | 328b725bec1dd94e2ba3d654b63f8db4da9d079b9072847d31f387cab64ee934 | 10 | 896 |
45.6338 249.754 50.4314C253.64 50.9018 257.221 52.6601 259.855 55.3912C262.489 58.1223 264.005 61.6477 264.13 65.3354C265.616 106.338 254.748 146.9 232.782 182.329C210.816 217.759 178.649 246.61 140.002 265.547C137.645 266.701 135.028 267.301 132.371 267.298C129.715 267.294 127.1 266.686 124.747 265.526C86.0991 246.59 ... | clawguard | lib/landing-config.tsx | TypeScript | e334359d0bcaaee4934b29d88a400f51a03af137c09b08e5008a7e1343139ba1 | 11 | 896 |
BackgroundImageFix"
result="effect1_dropShadow_2_33"
/>
<feColorMatrix
in="SourceAlpha"
type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha... | clawguard | lib/landing-config.tsx | TypeScript | d11c433801e5265d4ca6dda8de3360690ef46f2fbe117449581ccd4104f291cc | 12 | 896 |
0 0 0 0 0 0 0 0 0.1 0"
/>
<feBlend
mode="normal"
in2="shape"
result="effect1_innerShadow_2_34"
/>
<feColorMatrix
in="SourceAlpha"
... | clawguard | lib/landing-config.tsx | TypeScript | d87243dcb172766569fc8c58c858397f0d44db46130f5116b9f7d2b48fbe0ca8 | 13 | 896 |
a ClawGuard audit?",
answer:
"Install the GitHub App and @mention @clawguard on a pull request. The bot runs a multi-phase security review and posts a summary with a link to the full interactive report.",
},
{
id: 2,
question: "What does the audit include?",
answer:... | clawguard | lib/landing-config.tsx | TypeScript | e8b048c0c8667b806af7239c8580f1d58f151faab90f695b20124868ad29d77c | 14 | 495 |
export type LogScope = "audit" | "bot" | "fix" | "rate-limit" | "agent" | "tool" | "rag";
export function logAudit(
scope: LogScope,
message: string,
ctx: Record<string, string | number | undefined>,
): void {
const payload: Record<string, unknown> = { scope, msg: message, ts: Date.now() };
for (const [k, v]... | clawguard | lib/logger.ts | TypeScript | 66a19a00a44be5587f41ad738aaeaecbbea3b58a2c473d939ba5b00f32e17073 | 0 | 246 |
type MermaidAPI = typeof import("mermaid").default;
let mermaidInstance: MermaidAPI | null = null;
export async function getMermaid(): Promise<MermaidAPI> {
if (mermaidInstance) return mermaidInstance;
const mod = await import("mermaid");
mermaidInstance = mod.default;
/* Matches app `.dark` tokens: --seconda... | clawguard | lib/mermaid-init.ts | TypeScript | 326a16263c63abff5afd03a3be75e7b020fbd9e7670e090571157ce014066b7f | 0 | 226 |
import { redis } from "@/lib/redis";
const GLOBAL_KEY = "pipeline:eta:avg_ms";
const SAMPLES_MAX = 20;
/**
* Rolling average pipeline duration (ms) for rough ETA hints in UI.
*/
export async function recordPipelineDurationMs(durationMs: number): Promise<void> {
try {
const raw = await redis.get<number>(GLOBAL... | clawguard | lib/pipeline-eta.ts | TypeScript | 7e1384b4b224d59783721f3c5eeda12cceac62eddd5eed8bc142b38187b79da8 | 0 | 214 |
import { after } from "next/server";
type Platform = "slack" | "discord" | "teams" | "linear";
export async function handleChatPlatformWebhook(
request: Request,
platform: Platform,
): Promise<Response> {
const { bot } = await import("@/lib/bot");
const handler = bot.webhooks[platform];
if (!handler) {
... | clawguard | lib/platform-webhook.ts | TypeScript | f2acf92ecaeaeebad9c0ca9aa500baaab39ba32a2f7ccc825fc034ad3d0a5f6e | 0 | 171 |
/** Public, unauthenticated demo: mirrors the real GitHub org/repo for this product. */
export const DEMO_OWNER = "julian-at";
export const DEMO_REPO = "clawguard";
export const DEMO_DASHBOARD_HUB_PATH = `/dashboard/${DEMO_OWNER}/${DEMO_REPO}`;
const LEGACY_DEMO = "/dashboard/demo/demo";
/** Paths allowed without a ... | clawguard | lib/public-demo-dashboard.ts | TypeScript | 8803c665b88752146dec1ddac8f23472ae9c7634360e129378de446b7d12fd24 | 0 | 317 |
import { redis } from "@/lib/redis";
const WINDOW_SEC = 3600;
const MAX_AUDITS_PER_INSTALL_PER_HOUR = 30;
const MAX_AUDITS_PER_PR_PER_HOUR = 8;
function keyInstall(installationId: string): string {
return `ratelimit:install:${installationId}`;
}
function keyPr(owner: string, repo: string, pr: number): string {
r... | clawguard | lib/rate-limit.ts | TypeScript | 50365912c9491a4c20bb03a82f7aa2944f9619b8ff1a2e6be8c342e5ce0f76fc | 0 | 394 |
import type { AuditData } from "@/lib/redis";
import { redis } from "@/lib/redis";
const KEY_PATTERN = /^([^/]+)\/([^/]+)\/pr\/(\d+)$/;
/**
* Stored audit JSON uses keys `owner/repo/pr/n` only. Broad SCAN patterns also match
* stream-prefixed keys (LIST for SSE) — GET on those returns WRONGTYPE.
*/
export function... | clawguard | lib/redis-queries.ts | TypeScript | eb7f2769e0f3f27f0cb62a9674c698fd0895d2792293c83c58a064e692284f34 | 0 | 705 |
import { Redis } from "@upstash/redis";
import type { AuditData } from "@/lib/audit-data";
export type { AuditData } from "@/lib/audit-data";
/** Vercel KV uses `KV_*`; Upstash console uses `UPSTASH_REDIS_REST_*`. */
export const redis = new Redis({
url: process.env.KV_REST_API_URL ?? process.env.UPSTASH_REDIS_REST... | clawguard | lib/redis.ts | TypeScript | bd796126ea4c157407828b7b88a8c17d40fe3550ba38f563a7de201e68cbadd3 | 0 | 282 |
import {
type PipelineInput,
type ProgressCallback,
runSecurityPipeline,
} from "./analysis/pipeline";
import type { AuditResult } from "./analysis/types";
export type { PipelineInput as ReviewInput, ProgressCallback };
export async function reviewPullRequest(
input: PipelineInput,
onProgress?: ProgressCall... | clawguard | lib/review.ts | TypeScript | f220dc804f16c63960685a503785079b537f52a25929b6417e36cc6264da5226 | 0 | 74 |
/** Install/settings page for the ClawGuard GitHub App (`NEXT_PUBLIC_GITHUB_APP_URL` overrides in the UI). */
export const GITHUB_APP_INSTALL_URL = "https://github.com/apps/clawguardbot" as const;
/** Default social preview (`public/` path; filename is URL-encoded for crawlers). */
export const OG_IMAGE_PATH =
"/Scr... | clawguard | lib/site.ts | TypeScript | 90d1a24514dd0fae7edc9712e8d9798e6632540733f3cda678c2af710b77c3fa | 0 | 233 |
import { redis } from "@/lib/redis";
export async function pushStreamEvent(
channelKey: string,
event: string,
payload: unknown,
): Promise<void> {
await redis.rpush(channelKey, JSON.stringify({ event, payload }));
await redis.expire(channelKey, 3600);
}
export function getStreamKey(owner: string, repo: str... | clawguard | lib/stream-events.ts | TypeScript | ca030a980a999c45cf84fdcdf7f0df7aea6b72df98d8eb96eacf70a365b76092 | 0 | 109 |
import { type ClassValue, clsx } from "clsx";
import * as Color from "color-bits";
import type * as React from "react";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
/** Resolve a CSS color (including `var(...)`) to an rgba string for canvas/... | clawguard | lib/utils.ts | TypeScript | 293229c20e24a4a2d3f4eaa6104c40a15f622f8b31d1287ff596d43939051fe0 | 0 | 359 |
import "./definitions";
export { PipelineMemory } from "./memory";
export { AgentOrchestrator, type OrchestratorInput } from "./orchestrator";
export { getAgent, getAllAgents, registerAgent } from "./registry";
export { createOnStepFinish, summarizeToolInput } from "./step-hooks";
export type {
AgentContext,
Agent... | clawguard | lib/agents/index.ts | TypeScript | 4b1f0ddda220d771af82976c022996f23aac0cbf967e38f4d0ab01ab141eabe8 | 0 | 87 |
import type { Finding } from "@/lib/analysis/types";
import type { AgentMemory } from "./types";
export class PipelineMemory implements AgentMemory {
private store = new Map<string, unknown>();
private findings = new Map<string, Finding[]>();
get<T = unknown>(key: string): T | undefined {
return this.store.... | clawguard | lib/agents/memory.ts | TypeScript | c396cccf117d6ec5463c82dcf8d326dd0987bf353ec4af5da734bf6a5e3e0529 | 0 | 225 |
import { randomUUID } from "node:crypto";
import type { Sandbox } from "@vercel/sandbox";
import type { ReconResult } from "@/lib/analysis/types";
import type { ClawGuardConfig, PolicyRule } from "@/lib/config/schemas";
import { handleError } from "@/lib/error-handler";
import { PipelineMemory } from "./memory";
import... | clawguard | lib/agents/orchestrator.ts | TypeScript | 1edc5bdd99775d58aafa1d12b85762a61c4e89d839667db880af8d18068bfe1d | 0 | 896 |
> {
const agentId = randomUUID();
input.onStreamEvent?.("agent:started", {
agentName: agentDef.name,
runId: input.runId,
});
const context: AgentContext = {
runId: input.runId,
agentId,
sandbox: input.sandbox,
recon: input.rec... | clawguard | lib/agents/orchestrator.ts | TypeScript | e017b3951f0d5125c6df7baff59e1cf3e2f03a6a3e2973bf5b7729f14f4e6fa0 | 1 | 645 |
import type { AgentDefinition } from "./types";
const agents = new Map<string, AgentDefinition>();
export function registerAgent(agent: AgentDefinition): void {
agents.set(agent.name, agent);
}
export function getAgent(name: string): AgentDefinition | undefined {
return agents.get(name);
}
export function getAl... | clawguard | lib/agents/registry.ts | TypeScript | 7e1a3c112331e637ff1a9eb26e3192a23c38e4ea63a0b1a84b7a127ca06a6d13 | 0 | 153 |
import { detailFromToolCalls } from "@/lib/analysis/step-detail";
import type { AgentContext } from "./types";
export function summarizeToolInput(input: unknown): string {
if (!input || typeof input !== "object") return "";
const rec = input as Record<string, unknown>;
if (typeof rec.command === "string") {
... | clawguard | lib/agents/step-hooks.ts | TypeScript | e5d17324c9a16464a9d6cf5a7ca3800329d493089b1c8208d938d59ec4b28c6a | 0 | 468 |
import type { Finding, ReconResult, ThreatModel } from "@/lib/analysis/types";
import type { ToolPermission } from "@/lib/tools/types";
export interface AgentResult {
agentName: string;
findings: Finding[];
summary: string;
durationMs: number;
error?: string;
metadata?: Record<string, unknown>;
}
export t... | clawguard | lib/agents/types.ts | TypeScript | 1273751f1278928f078cc4caa0cf3eaec056c9ab9bb5057b69ccfa63086db6c1 | 0 | 574 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { createBashTool } from "bash-tool";
import { z } from "zod";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
import type { AgentContext, AgentR... | clawguard | lib/agents/definitions/api-security.ts | TypeScript | 98131a3fb446a74b2784fe2e8fa4b32604fb13a8e2ac0cb9e71f5204600f4bb3 | 0 | 896 |
confidence.",
"Prefer actionable fixes (validation, authz checks, CORS tightening, consistent error shape).",
"If the PR does not touch API code, return empty findings and a one-line summary.",
].join("\n");
const instructions = injectSkills(baseInstructions, AGENT_NAME, [...REQUIRED_SKILLS]);
... | clawguard | lib/agents/definitions/api-security.ts | TypeScript | 568d92fa7d7ed4a9da14dfd131021ddc161927fa49381ed438c1b84bfbdca542 | 1 | 306 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { z } from "zod";
import { mergeBashAndClawTools } from "@/lib/agents/helpers/merge-tools";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
impo... | clawguard | lib/agents/definitions/architecture.ts | TypeScript | 1e8ae41c0c98963e97d800aab0cf32fba47db373e54c8830d0e097ea41950708 | 0 | 689 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { z } from "zod";
import { mergeBashAndClawTools } from "@/lib/agents/helpers/merge-tools";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
impo... | clawguard | lib/agents/definitions/code-quality.ts | TypeScript | 982583b58d4307b32ac24d84434343bc89d426e87ba69c866716373f396a8e09 | 0 | 777 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { createBashTool } from "bash-tool";
import { z } from "zod";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
import type { AgentContext, AgentR... | clawguard | lib/agents/definitions/compliance-auditor.ts | TypeScript | 3255371fe01f3024800b26d397f546d120f0211c61b47b9c07336f9bd28ab385 | 0 | 896 |
= `${context.config.model.provider}/${context.config.model.model}`;
const baseInstructions = [
"You are a compliance analyst. You only receive prior findings and policies — no duplicate scanning.",
"If priorFindings is empty, return findings: [] and summarize that no compliance mapping is possible yet.... | clawguard | lib/agents/definitions/compliance-auditor.ts | TypeScript | 16234515bab192d469a38dc69d6d4a278703f30c80d1c7e1caa63c9d120b5ef4 | 1 | 390 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { createBashTool } from "bash-tool";
import { z } from "zod";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
import type { AgentContext, AgentR... | clawguard | lib/agents/definitions/dependency-audit.ts | TypeScript | c249ab82ce3b5263eb6aa5885451d961cbf558f9ad6b8b5e51966843181ddaa4 | 0 | 896 |
or lockfile path), line (use 1 if file-level), cweId when applicable (e.g. CWE-1104 for vulnerable components), owaspCategory (often A06:2021 Vulnerable and Outdated Components).",
"Include attackScenario describing how the vulnerable dependency could be reached at runtime if applicable.",
"If audit is clea... | clawguard | lib/agents/definitions/dependency-audit.ts | TypeScript | 79d65be745386cb4a60fd16f581822300105b34ff13ae068eb13c08df47bdd2f | 1 | 346 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { z } from "zod";
import { mergeBashAndClawTools } from "@/lib/agents/helpers/merge-tools";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
impo... | clawguard | lib/agents/definitions/documentation.ts | TypeScript | d5cb25a073f6520a48b38c3c2b3f89e72e1e82c8dd75cbec53e85a034bcaf56f | 0 | 675 |
import "./security-scan";
import "./dependency-audit";
import "./secret-scanner";
import "./infrastructure-review";
import "./api-security";
import "./compliance-auditor";
import "./pentest";
import "./code-quality";
import "./architecture";
import "./test-coverage";
import "./documentation";
import "./performance";
im... | clawguard | lib/agents/definitions/index.ts | TypeScript | 50ec3277ab10c3666dd998fbbc0e85b5bc531899098977bb70a9f2f2334e41b1 | 0 | 116 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { createBashTool } from "bash-tool";
import { z } from "zod";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
import type { AgentContext, AgentR... | clawguard | lib/agents/definitions/infrastructure-review.ts | TypeScript | 9b7e0999a4127cfb5eec760c6c6eea56a8a110f38cb6c6ef968dc5eb4a006a36 | 0 | 896 |
: AgentContext): Promise<AgentResult> {
const start = Date.now();
const modelRef = `${context.config.model.provider}/${context.config.model.model}`;
const baseInstructions = [
"You are a cloud and platform security engineer. Stay within infra and pipelines — not application business logic.",
"F... | clawguard | lib/agents/definitions/infrastructure-review.ts | TypeScript | 75719e261310e6fdca3293836482a86c03a27a940334c5f9b1536bd8072242ef | 1 | 414 |
import { gateway } from "@ai-sdk/gateway";
import { generateObject } from "ai";
import { z } from "zod";
import { registerAgent } from "@/lib/agents/registry";
import type { AgentContext, AgentDefinition, AgentResult } from "@/lib/agents/types";
import {
type Finding,
FindingSchema,
ReviewVerdictResultSchema,
T... | clawguard | lib/agents/definitions/learnings.ts | TypeScript | 87b90cf20fdd9ada3724cd55d9da5103a9388b112131a4c32bec6b18ab6a7702 | 0 | 771 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { createBashTool } from "bash-tool";
import { z } from "zod";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
import type { AgentContext, AgentR... | clawguard | lib/agents/definitions/pentest.ts | TypeScript | 4b1c81885a0914bd75967b421c1f265b1b0c887314b739a77a93a09767e2a271 | 0 | 896 |
issue, outline a plausible proof sequence (preconditions → action → observable impact). Do not claim live exploitation — phrase as conditional on deployment context.",
"",
"## Findings",
"Only emit findings where a credible chain exists. Avoid duplicating pure dependency or secret-scan issues unless t... | clawguard | lib/agents/definitions/pentest.ts | TypeScript | 9292a19f8735baac2bda54fff74d547a9c8335e9e306283843a1afd7eba2d671 | 1 | 348 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { z } from "zod";
import { mergeBashAndClawTools } from "@/lib/agents/helpers/merge-tools";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
impo... | clawguard | lib/agents/definitions/performance.ts | TypeScript | 092bdde07c9362f22bd62a7d45f33b897a330737eac599f23b69ada37ae80074 | 0 | 679 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { z } from "zod";
import { mergeBashAndClawTools } from "@/lib/agents/helpers/merge-tools";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
impo... | clawguard | lib/agents/definitions/pr-summary.ts | TypeScript | cc455aa1c9a6f18d80ffad083fbf62e780126107cbfbda8cd7dcf36187533da0 | 0 | 798 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { createBashTool } from "bash-tool";
import { z } from "zod";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
import type { AgentContext, AgentR... | clawguard | lib/agents/definitions/secret-scanner.ts | TypeScript | da104828baa4fbe04c880eb8521eb319b4c8f3f3dd41158c4712c5c7120cd1c5 | 0 | 896 |
, context);
try {
const loop = new ToolLoopAgent({
model: gateway(modelRef),
tools,
output: Output.object({ schema: OutputSchema }),
stopWhen: stepCountIs(maxSteps),
instructions,
onStepFinish,
});
const result = await loop.generate({
promp... | clawguard | lib/agents/definitions/secret-scanner.ts | TypeScript | 5ecac1192983b28f5e1c25426a4369a9af3df2d1b5a43fe1f96e8e6ae9de4e5f | 1 | 184 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { createBashTool } from "bash-tool";
import { z } from "zod";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
import type { AgentContext, AgentR... | clawguard | lib/agents/definitions/security-scan.ts | TypeScript | aadf29811c22f31337243a1b882d174fad7abf85c36f777ba16064af9a075bde | 0 | 896 |
new ToolLoopAgent({
model: gateway(modelRef),
tools,
output: Output.object({ schema: OutputSchema }),
stopWhen: stepCountIs(maxSteps),
instructions,
onStepFinish,
});
const result = await loop.generate({
prompt,
abortSignal: context.abortSignal... | clawguard | lib/agents/definitions/security-scan.ts | TypeScript | b2c8173159f94e2e09b68a2d1966bb2d767fd74c8cd9d09bd7f1c9429f85e81b | 1 | 401 |
import { gateway } from "@ai-sdk/gateway";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { z } from "zod";
import { mergeBashAndClawTools } from "@/lib/agents/helpers/merge-tools";
import { registerAgent } from "@/lib/agents/registry";
import { createOnStepFinish } from "@/lib/agents/step-hooks";
impo... | clawguard | lib/agents/definitions/test-coverage.ts | TypeScript | 0fa6867acf66fb5cc5972cdd4dcf135493c252c7ffabdc3b7fc588aedbc54825 | 0 | 680 |
import { createBashTool } from "bash-tool";
import type { AgentContext } from "@/lib/agents/types";
import { buildClawAgentTools } from "@/lib/tools/agent-tools";
/** Bash (read/write/shell) + ClawGuard custom tools for specialist agents */
export async function mergeBashAndClawTools(context: AgentContext) {
const {... | clawguard | lib/agents/helpers/merge-tools.ts | TypeScript | b086a6bfee0f8bfda681b3c737976847ba7ae963455a05db5f2b9d5489d7b6a2 | 0 | 119 |
import { gateway } from "@ai-sdk/gateway";
import { generateObject } from "ai";
import type { ClawGuardConfig } from "@/lib/config/schemas";
import { type PRSummary, PRSummarySchema, type ReconResult } from "./types";
/**
* High-level PR summary: narrative, Mermaid sequence diagrams, dependency impact, breaking chang... | clawguard | lib/analysis/change-analysis.ts | TypeScript | 9fc78ee23c753a7b07ffb171fdf668029860b51e015e55abbce172a2cfa34f3b | 0 | 572 |
/**
* Structured unified diff parse (no external deps).
*/
export interface DiffHunk {
oldStart: number;
oldLines: number;
newStart: number;
newLines: number;
/** Lines prefixed with space (context) */
contextLines: string[];
/** Added lines (without leading +) */
additions: string[];
/** Removed l... | clawguard | lib/analysis/parse-diff.ts | TypeScript | 8bcbac899d8ac4a2300084b41e2f4ceee2fb5f0c4a86b2b23ef79ee04ca6f423 | 0 | 778 |
import { randomUUID } from "node:crypto";
import { Octokit } from "@octokit/rest";
import { Sandbox } from "@vercel/sandbox";
import { createBashTool } from "bash-tool";
import { AgentOrchestrator } from "@/lib/agents";
import { getAllAgents } from "@/lib/agents/registry";
import type { OrchestratorResult } from "@/lib... | clawguard | lib/analysis/pipeline.ts | TypeScript | 1737e327bd2f5fdaa1da9736be7dab1c9ed472d6b2c5cde69f205b95ce1c658e | 0 | 896 |
;
/** Correlates logs, SSE, and orchestrator runs */
runId?: string;
/** Real-time report stream (Redis SSE) */
onStreamEvent?: (event: string, payload: unknown) => void;
}
export async function runSecurityPipeline(
input: PipelineInput,
onProgress?: ProgressCallback,
): Promise<AuditResult> {
const star... | clawguard | lib/analysis/pipeline.ts | TypeScript | 4890eb3482c54157c326fbe1bd2ccbffb518eaa3328c55723020a44bb32d5544 | 1 | 896 |
undefined;
prSummary = fromAgent ?? (await runChangeAnalysis(recon, config));
}
await onProgress?.({ stage: "change-analysis", status: "complete" });
await onProgress?.({
stage: "threat-synthesis",
status: "running",
detail: "Threat model & deduplication",
});
const threat =... | clawguard | lib/analysis/pipeline.ts | TypeScript | fe80964abb43daf290d384dbf1439b4b9c1522dcc09d512e213e65629e8af485 | 2 | 673 |
import micromatch from "micromatch";
import type { ClawGuardConfig } from "@/lib/config/schemas";
import { SEVERITY_ORDER } from "@/lib/constants";
import { calculateScore, getGrade } from "./scoring";
import type { Finding, ReconResult, ThreatModel } from "./types";
import { FindingSchema } from "./types";
function e... | clawguard | lib/analysis/post-process.ts | TypeScript | 4e0be77ca1972a3b1e87341faddabf175462d32164d66db2413ecd0f96cbae93 | 0 | 735 |
import type { PolicyRule } from "@/lib/config/schemas";
import type { ReconResult } from "./types";
export function policiesBlockForScan(policies: PolicyRule[]): string {
if (policies.length === 0) return "(No custom policies in .clawguard/policies.yml)";
return policies.map((p) => `- [${p.severity}] ${p.name}: ${... | clawguard | lib/analysis/recon-context.ts | TypeScript | bc131c8eef021061840babc5fcfeec9f532281e5257108aafda766c101091d1e | 0 | 733 |
import type { Sandbox } from "@vercel/sandbox";
import type { ClawGuardConfig } from "@/lib/config/schemas";
import { logWarn } from "@/lib/logger";
import type { DependencyGraph, ReconResult } from "./types";
const MAX_EXCERPT_LINES = 120;
const MAX_EXCERPT_CHARS = 48_000;
export function parseChangedFilesFromDiff(d... | clawguard | lib/analysis/recon.ts | TypeScript | 5ddb63eb614e84a9059eca4822e62821e603ae505cd1c481eccfbc7c9bec4fa2 | 0 | 896 |
("\n");
const excerpt = lines.slice(0, MAX_EXCERPT_LINES).join("\n");
fileExcerpts[path] =
excerpt.length > MAX_EXCERPT_CHARS
? `${excerpt.slice(0, MAX_EXCERPT_CHARS)}\n/* … truncated … */`
: excerpt;
} catch (err) {
logWarn("audit", `Skipped unreadable file: ${path}`, ... | clawguard | lib/analysis/recon.ts | TypeScript | c0d6e08ed84e54553f4bee451f0cdd89db58d73793595b47f3eff4745a3a3ec7 | 1 | 896 |
+(?:async\s+)?function\s+(\w+)|export\s+const\s+(\w+)|export\s+class\s+(\w+))/gm;
const exportsUsedElsewhere: string[] = [];
let em: RegExpExecArray | null;
em = exportRe.exec(text);
while (em !== null) {
const name = em[1] ?? em[2] ?? em[3];
if (name) exportsUsedElsewhere.push(name);
... | clawguard | lib/analysis/recon.ts | TypeScript | f7bced101c91a39cc7f349bf1b8266912b4b329c7d09f7ecc2330e3192efa1ea | 2 | 896 |
A-Z ]+PRIVATE KEY-----/ },
];
for (const { label, re } of checks) {
if (re.test(diff)) hints.push(label);
}
return [...new Set(hints)].slice(0, 8);
}
| clawguard | lib/analysis/recon.ts | TypeScript | 0ae4d30b0d428e18eaf24087b72428c0f755e6cb0f8c285da966da7a2014c62e | 3 | 66 |
import { GRADE_THRESHOLDS, SEVERITY_DEDUCTIONS } from "@/lib/constants";
import type { Finding, FindingCategory, Severity } from "./types";
export { GRADE_THRESHOLDS };
/** Non-security findings affect score less so the grade stays security-focused */
const CATEGORY_SCORE_WEIGHT: Record<FindingCategory, number> = {
... | clawguard | lib/analysis/scoring.ts | TypeScript | 01f46b34723297126e82e3661f8e97c510e1592419b71bb66c865c05f98d4107 | 0 | 294 |
import { gateway } from "@ai-sdk/gateway";
import type { ToolSet } from "ai";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { z } from "zod";
import type { ClawGuardConfig, PolicyRule } from "@/lib/config/schemas";
import { buildSecurityScanPrompt } from "./recon-context";
import { detailFromToolCalls... | clawguard | lib/analysis/security-scan.ts | TypeScript | 04cbfd4f70dc88dfe39880efcc77e9a8e9855298cec84dcfa09585cd8a9a0773 | 0 | 896 |
policies, {
learnings: extras?.learningsBlock,
knowledge: extras?.knowledgeBlock,
});
try {
const out = await runScanOnce(tools, prompt, config, fullInstructions, onStepFinish);
return {
findings: out.findings,
summary: out.summary,
partialFailure: false,
};
} catch (firstEr... | clawguard | lib/analysis/security-scan.ts | TypeScript | 1cf3ef7def9b65a9b0b272f78bea7280bdf9076bf3df4b53d3db80937d82b960 | 1 | 308 |
/**
* Derive a short human-readable line from the last tool call in a step (bash/read/write).
*/
export function detailFromToolCalls(
toolCalls: Array<{ toolName?: string; input?: unknown }>,
): string | undefined {
if (!toolCalls?.length) return undefined;
const last = toolCalls[toolCalls.length - 1];
const ... | clawguard | lib/analysis/step-detail.ts | TypeScript | 84724e5ae94b23eab8cfd9290e62628ebb9127ccb9d64697b6f04d34f5618ebc | 0 | 223 |
import { gateway } from "@ai-sdk/gateway";
import type { ToolSet } from "ai";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { z } from "zod";
import type { ClawGuardConfig } from "@/lib/config/schemas";
import {
type Finding,
FindingSchema,
type ReconResult,
type ThreatModel,
ThreatModelSche... | clawguard | lib/analysis/threat-synthesis.ts | TypeScript | 65a02439cfde7852d49452398a90579e9a228de8f772ca6aef4143bdb126a750 | 0 | 797 |
import { z } from "zod";
export const SeveritySchema = z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"]);
export type Severity = z.infer<typeof SeveritySchema>;
export const ConfidenceSchema = z.enum(["HIGH", "MEDIUM", "LOW"]);
export type Confidence = z.infer<typeof ConfidenceSchema>;
export const RemediationEf... | clawguard | lib/analysis/types.ts | TypeScript | 1d44283f563e9ca4a6ca0629723f883ab9f17c90c4de440c8880d30a3600b07c | 0 | 896 |
const TeamPatternSchema = z.object({
pattern: z.string(),
evidence: z.string(),
elevated: z.boolean().optional(),
});
export type TeamPattern = z.infer<typeof TeamPatternSchema>;
export const PhaseResultSchema = z.object({
phase: z.enum(["code-quality", "vulnerability-scan", "threat-model", "security-scan"]).o... | clawguard | lib/analysis/types.ts | TypeScript | b9e7a4415dfd668f073c55d3c9951311a615f52a2434a8057ea52140dae6c68a | 1 | 896 |
()),
staticAnalysisSnippet: z.string().optional(),
diff: z.string(),
/** Truncated path -> excerpt for agent context */
fileExcerpts: z.record(z.string(), z.string()).optional(),
/** Approximate changed hunk lines in diff */
linesChanged: z.number().optional(),
/** Truncated npm/pnpm audit --json output *... | clawguard | lib/analysis/types.ts | TypeScript | d8e8111526a5c5259840213a68d7157269839ec644851cdf30eaf6540f3db3ac | 2 | 896 |
.isArray(d.nodes)) {
d.nodes = [];
}
return d;
}
function normalizeConfidence(value: unknown): "HIGH" | "MEDIUM" | "LOW" {
if (typeof value === "string") {
const u = value.trim().toUpperCase();
if (u === "HIGH" || u === "MEDIUM" || u === "LOW") return u;
}
return "MEDIUM";
}
/**
* Coerces a sin... | clawguard | lib/analysis/types.ts | TypeScript | 2ab105599428ad4a66dd60334a05993f2dc017b94925b855a94584c10cf2fa7c | 3 | 847 |
/** @jsxImportSource chat */
import { Actions, Button, Card, CardText, Divider, LinkButton, Table } from "chat";
import { countBySeverity } from "@/lib/analysis/scoring";
import type { AuditResult, Finding } from "@/lib/analysis/types";
import { SEVERITY_ORDER } from "@/lib/constants";
import { getPublicBaseUrl } from ... | clawguard | lib/cards/summary-card.tsx | TypeScript | 95fd7be33925a0eb96d03ef23c51be11badf4878a240def30b0d27fcbdb1eea5 | 0 | 896 |
}
/>
) : (
<CardText>No medium or higher severity findings.</CardText>
)}
<Divider />
{fixableCount > 0 && (
<CardText>
{`Reply \`@clawguard fix all\` to auto-fix ${fixableCount} CRITICAL+HIGH finding(s), or \`@clawguard fix <type>\` for a specific issue.`}
... | clawguard | lib/cards/summary-card.tsx | TypeScript | 05ed65dae69d17b670837e2ea742a88673983e3de5b93ff88c3a16b7e81855a6 | 1 | 896 |
.push(
"",
`Reply \`@clawguard fix all\` to auto-fix ${fixableCount} CRITICAL+HIGH finding(s), or \`@clawguard fix <type>\` for a specific issue.`,
);
}
return lines.join("\n");
}
| clawguard | lib/cards/summary-card.tsx | TypeScript | 5ed4427cb93a33a28d7d632c7f0e295e241a03e1ee7b5e709486b8cb71f4c756 | 2 | 65 |
import type { ClawGuardConfig } from "./schemas";
export const DEFAULT_CLAWGUARD_CONFIG: ClawGuardConfig = {
autoFix: {
enabled: true,
commitDirectly: true,
maxFixesPerRun: 10,
requireValidation: true,
},
thresholds: {
blockMerge: "CRITICAL",
requestChanges: "HIGH",
commentOnly: "MEDI... | clawguard | lib/config/defaults.ts | TypeScript | c76809bf983e1e1368307f9d3591f425d98501a7d4901ec8832fc503c7298cb0 | 0 | 354 |
export { DEFAULT_CLAWGUARD_CONFIG } from "./defaults";
export {
type LoadRepoConfigResult,
loadRepoConfig,
} from "./reader";
export {
AdaptersConfigSchema,
AnalysisConfigSchema,
BotConfigSchema,
type ClawGuardConfig,
ClawGuardConfigFileSchema,
ClawGuardConfigSchema,
LearningsConfigSchema,
Notificat... | clawguard | lib/config/index.ts | TypeScript | ada866b05bec3ddf45056b052b48f1535ddb815d1b90fc7220c820bec43bceec | 0 | 68 |
import type { Octokit } from "@octokit/rest";
import { parse as parseYaml } from "yaml";
import { ConfigError } from "@/lib/errors";
import { DEFAULT_CLAWGUARD_CONFIG } from "./defaults";
import {
type ClawGuardConfig,
ClawGuardConfigFileSchema,
ClawGuardConfigSchema,
PoliciesFileSchema,
type PolicyRule,
} fr... | clawguard | lib/config/reader.ts | TypeScript | dc847ad46bb7351132cbf89b83c920da5a895156a9f1cbed7ad1f95abf807743 | 0 | 896 |
{
cause: e,
});
}
}
let policies: PolicyRule[] = [];
if (policiesYaml) {
try {
const raw = parseYaml(policiesYaml);
const parsed = PoliciesFileSchema.safeParse(raw);
if (!parsed.success) {
throw new ConfigError("Invalid .clawguard/policies.yml", {
context... | clawguard | lib/config/reader.ts | TypeScript | 2ae1cfea759730c1347628aa42674c32de79e42ed37881b44fe8faab933e3848 | 1 | 153 |
import { z } from "zod";
export const SeverityThresholdSchema = z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"]);
export const BotConfigSchema = z.object({
verbosity: z.enum(["minimal", "normal", "verbose"]),
autoSubscribe: z.boolean(),
language: z.string(),
});
export const ScanningConfigSchema = z.objec... | clawguard | lib/config/schemas.ts | TypeScript | 95f006294714296a12ece4147a605560508705c330c1d2acf744f9412251d684 | 0 | 896 |
),
maxSteps: z.number().int().positive().optional(),
})
.optional(),
bot: z
.object({
verbosity: BotConfigSchema.shape.verbosity.optional(),
autoSubscribe: z.boolean().optional(),
language: z.string().optional(),
})
.optional(),
scanning: z
.ob... | clawguard | lib/config/schemas.ts | TypeScript | 6f645a545c025f31f06b79d8389c65db151da744de366367ace55ea61c8ec3f3 | 1 | 859 |
import { gateway } from "@ai-sdk/gateway";
import type { Sandbox } from "@vercel/sandbox";
import { Output, stepCountIs, ToolLoopAgent } from "ai";
import { createBashTool } from "bash-tool";
import { z } from "zod";
import type { Finding } from "@/lib/analysis/types";
import type { ApplyResult } from "@/lib/fix/types"... | clawguard | lib/fix/agent.ts | TypeScript | 598890f5e69cb45b7be41e62a8dccde26b703c47527311655cb1bf00b624ea7f | 0 | 706 |
import type { Sandbox } from "@vercel/sandbox";
import type { Finding } from "@/lib/analysis/types";
import type { ApplyResult } from "@/lib/fix/types";
import { runValidation } from "@/lib/fix/validate";
function normalizeLineEndings(text: string): string {
return text.replace(/\r\n/g, "\n");
}
/** Line-by-line fu... | clawguard | lib/fix/apply.ts | TypeScript | 4142d2092db1d322b2072b22cd81e88f6532361cf2bc074b263d1780ac82fbb4 | 0 | 788 |
import type { Octokit } from "@octokit/rest";
import type { Finding } from "@/lib/analysis/types";
/** Commits via Contents API; always fetches current blob SHA before update. */
export async function commitFixToGitHub(
octokit: Octokit,
params: {
owner: string;
repo: string;
branch: string;
filePa... | clawguard | lib/fix/commit.ts | TypeScript | 1cb1d3022247e58589f173e16157b16c1ededdf6dddf6818007e371fe1db60f7 | 0 | 770 |
import { Sandbox } from "@vercel/sandbox";
import type { Thread } from "chat";
import type { AuditResult, Finding } from "@/lib/analysis/types";
import { SEVERITY_ORDER } from "@/lib/constants";
import { generateFixWithAgent } from "@/lib/fix/agent";
import { applyStoredFix } from "@/lib/fix/apply";
import { commitBatc... | clawguard | lib/fix/index.ts | TypeScript | 81eab8cbadda246a55556a92f7afc6e31a7d5febd3c9bf068435f48339ca3baa | 0 | 896 |
.result) {
throw new Error("No audit results found");
}
const { result: auditResult } = auditData;
const githubToken = process.env.GITHUB_TOKEN;
if (!githubToken) {
throw new Error("GITHUB_TOKEN is required to run fixes in the sandbox");
}
const fixable = auditResult.findings
.filter((f) => [... | clawguard | lib/fix/index.ts | TypeScript | df9c834f0def7d2b1baf2cba5e3e01f742ae1c07665f2667461caceb138c867d | 1 | 734 |
import type { Octokit } from "@octokit/rest";
import type { Finding } from "@/lib/analysis/types";
export interface FixResult {
finding: Finding;
status: "fixed" | "skipped";
commitSha?: string;
error?: string;
tier: "fast" | "agent";
}
export interface FixContext {
owner: string;
repo: string;
prBran... | clawguard | lib/fix/types.ts | TypeScript | 44c86a41e2ce611c8cb858b563cf25f6991ef8479c6b14ee1acd4af2d37d648a | 0 | 129 |
import type { Sandbox } from "@vercel/sandbox";
import type { ValidationResult } from "@/lib/fix/types";
const ESLINT_CONFIGS = [
"eslint.config.js",
"eslint.config.mjs",
"eslint.config.ts",
".eslintrc.js",
".eslintrc.json",
".eslintrc.yml",
];
const DEFAULT_TEST_STUB = 'echo "Error: no test specified" &&... | clawguard | lib/fix/validate.ts | TypeScript | 542fec21b414e5e75d1e4fed82c9249cf3fa568e0a9da9c4cb3daa7a7a9ecaab | 0 | 653 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.