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 |
|---|---|---|---|---|---|---|
# Roadmap: ClawGuard
## Overview
ClawGuard delivers a complete AI security agent for GitHub PRs: from @mention trigger through vulnerability detection, interactive reporting, and autonomous remediation. The build order is risk-first -- validating the highest-uncertainty integration (Chat SDK + Next.js) immediately, t... | clawguard | .planning/ROADMAP.md | Markdown | 3f5dd56191feae38e838591cd6ab4bcec97e5d717d4865e9da4939f66fa7b512 | 0 | 896 |
, type, file:line location, CWE ID, OWASP Top 10 category, description, attack scenario, data flow chain, before/after code fix, and compliance mapping
4. The summary card includes a "View Full Report" link pointing to `/report/[owner]/[repo]/[pr]`
**Plans**: 3 plans
Plans:
- [x] 02-01-PLAN.md — Types, scoring, summ... | clawguard | .planning/ROADMAP.md | Markdown | 18b845b9a25d8f3213abe0c0ad73add104f412188e89fc48ccc004f34e5abbc7 | 1 | 896 |
/ui, enhanced schemas, mock data, page shell
- [ ] 04-02: TBD
- [ ] 04-03: TBD
### Phase 5: Chat, Config & Dashboard
**Goal**: The product behaves like a real SaaS tool with conversational follow-up in PR threads, per-repo configuration and custom security policies, and an authenticated dashboard showing audit history... | clawguard | .planning/ROADMAP.md | Markdown | 7859aa415ca7eb12c406187111f8935cc1b438c61db31f0df45decbefcc10b0e | 2 | 854 |
---
gsd_state_version: 1.0
milestone: v1.0
milestone_name: milestone
status: verifying
stopped_at: Phase 5 UI-SPEC approved
last_updated: "2026-03-28T03:44:43.698Z"
last_activity: 2026-03-28
progress:
total_phases: 6
completed_phases: 3
total_plans: 8
completed_plans: 11
percent: 15
---
# Project State
## P... | clawguard | .planning/STATE.md | Markdown | 801e68d12c7a8bdc9642d650be79691b9a91c1630fd8298ae014316d350b1f71 | 0 | 896 |
color thresholds for score visualization
- [Phase 04]: Mermaid dynamic import pattern for browser-only rendering with dark theme
- [Phase 04]: next/dynamic SSR-off for react-diff-viewer-continued code diffs
- [Phase 04]: createClient from v0-sdk for configurable API key, chats.sendMessage after chats.init for template ... | clawguard | .planning/STATE.md | Markdown | 7e73f91628d3fad9eaa1c6aa57a737ab36fd9398f0485bf68824ab2b1af463b5 | 1 | 214 |
---
phase: 01-foundation-bot-wiring
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- package.json
- tsconfig.json
- next.config.ts
- postcss.config.mjs
- app/globals.css
- app/layout.tsx
- app/page.tsx
- .env.example
- .gitignore
- vitest.config.ts
- lib/redis.ts
- lib/review.ts
a... | clawguard | .planning/phases/01-foundation-bot-wiring/01-01-PLAN.md | Markdown | bde54a2865f66b2316a858930b9c9d80a3774ec977895228b0059da5b8482b86 | 0 | 896 |
)
- clawguard-plan.md (§3 Architecture — file layout with app/ and lib/ at project root, no src/ directory)
</read_first>
<action>
1. **Scaffold the Next.js project** in the repo root (no src/ directory per battle plan):
```
npx create-next-app@latest . --ts --tailwind --eslint --app --no-src-... | clawguard | .planning/phases/01-foundation-bot-wiring/01-01-PLAN.md | Markdown | 0fd8eb1ee991b8c02940d692bbb369dad2de009316a42e7280955607738e1ef0 | 1 | 896 |
contains `"@upstash/redis": "1.37.0"`
- package.json contains `"bash-tool": "1.3.15"`
- package.json contains `"@octokit/rest": "22.0.1"`
- package.json contains `"vitest"` in devDependencies
- .env.example contains `GITHUB_APP_ID=`
- .env.example contains `UPSTASH_REDIS_REST_URL=`
- .env.exampl... | clawguard | .planning/phases/01-foundation-bot-wiring/01-01-PLAN.md | Markdown | f023c61de8956be7eccff0d998abf95b0c36f44bba159b90a2be189c8cd6f308 | 2 | 896 |
with git source:
```typescript
const sandbox = await Sandbox.create({
source: {
type: "git",
url: `https://github.com/${input.owner}/${input.repo}`,
username: "x-access-token",
password: process.env.GITHUB_TOKEN!,
depth: 50,
},
... | clawguard | .planning/phases/01-foundation-bot-wiring/01-01-PLAN.md | Markdown | 58ec31df9b29eaae5b4e9f66360fe632b46f266a4d0bf0162324d210c9963649 | 3 | 896 |
` exits 0 — project compiles as a Next.js production build
2. `npx tsc --noEmit` exits 0 — all types resolve
3. package.json has all Phase 1 deps at pinned versions
4. lib/redis.ts exports storeAuditResult, getAuditResult, redis, AuditData
5. lib/review.ts exports reviewPullRequest, ReviewInput
6. .env.example document... | clawguard | .planning/phases/01-foundation-bot-wiring/01-01-PLAN.md | Markdown | fb5801cf8ef5e4f46c33dc1ea43af8dc78e50969db10f962a323562646f27418 | 4 | 207 |
---
phase: 01-foundation-bot-wiring
plan: 01
subsystem: infra
tags: [next.js, tailwind-v4, vitest, upstash-redis, vercel-sandbox, ai-sdk, bash-tool, chat-sdk]
# Dependency graph
requires: []
provides:
- "Next.js 16.2.1 project scaffold with App Router and Tailwind v4"
- "All Phase 1 runtime dependencies installed ... | clawguard | .planning/phases/01-foundation-bot-wiring/01-01-SUMMARY.md | Markdown | de6e84b3f5143c1d525c08120b631caabcd50867d20baaceee8a7ca4389c7775 | 0 | 896 |
2: Create Core Library Modules — Redis Client & Review Pipeline** - `082eec1` (feat)
## Files Created/Modified
- `package.json` - Project manifest with all Phase 1 dependencies at pinned versions
- `tsconfig.json` - TypeScript config with @/* path alias
- `next.config.ts` - Next.js configuration
- `postcss.config.mjs`... | clawguard | .planning/phases/01-foundation-bot-wiring/01-01-SUMMARY.md | Markdown | 163405a95b1230bd0eee6e8cdc18d475b7b6d80d232d5e78b25273fe43a64402 | 1 | 520 |
---
phase: 01-foundation-bot-wiring
plan: 02
type: execute
wave: 2
depends_on:
- "01-01"
files_modified:
- lib/bot.ts
- app/api/webhooks/github/route.ts
- tests/redis.test.ts
- tests/review.test.ts
- tests/webhook-handler.test.ts
- tests/bot.test.ts
autonomous: false
requirements:
- HOOK-01
- HOOK-02
... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-PLAN.md | Markdown | 6e979d643451ecbedd818f192cdd59a67af4fb21245a1819861ec591ecdfea77 | 0 | 896 |
delegation"
pattern: "bot\\.webhooks\\.github"
- from: "app/api/webhooks/github/route.ts"
to: "lib/redis.ts"
via: "redis.set() with nx:true for idempotency check"
pattern: "redis\\.set.*nx.*true"
- from: "app/api/webhooks/github/route.ts"
to: "next/server"
via: "after(() => t... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-PLAN.md | Markdown | 9aa1e6a544284247a92021906db8e5aa6fe485f7769fdadf21f436e13af5ede9 | 1 | 896 |
-04: live progress for demo; D-05: bare minimum storage; D-06: key format; D-07: friendly generic error messages)
- lib/redis.ts (current code — need to import redis for idempotency, storeAuditResult for storage)
- lib/review.ts (current code — need to import reviewPullRequest and understand ReviewInput)
</re... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-PLAN.md | Markdown | 7e7cefa40270ca81e5961cf8ddcea81880877a205c8fd04bb3f3c3d4eab5a78b | 2 | 896 |
delivery");
b. Idempotency check via Redis SETNX with 1-hour TTL:
if (deliveryId) {
const key = `webhook:delivery:${deliveryId}`;
const isNew = await redis.set(key, "1", { nx: true, ex: 3600 });
if (!isNew) return new Response("OK", { status: 200 });
}
... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-PLAN.md | Markdown | 8fe7dafe50a2d819dea8e3a91a06920b02b44e9a0044567fbb561f4754996a33 | 3 | 896 |
, requirement-to-test map)
- vitest.config.ts (verify test file pattern matches tests/**/*.test.ts)
- lib/redis.ts (functions to test: storeAuditResult, getAuditResult, redis)
- lib/review.ts (function to test: reviewPullRequest)
- lib/bot.ts (bot configuration and event handler structure)
- app/api... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-PLAN.md | Markdown | f74b9f4b86a55a5876606b2d7880c2faaa23ea059e9eb06f571b825e89a49546 | 4 | 896 |
and response status is 200
- `"passes waitUntil option that uses after() (HOOK-03)"` — call POST, inspect the second argument passed to bot.webhooks.github, verify it has a waitUntil function
- `"delegates signature verification to Chat SDK (HOOK-04)"` — verify the request object is passed unmodified to b... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-PLAN.md | Markdown | a94098bd8a1cb1e718428f444539a92a1ca3121d83f30a9738cc01b559beca07 | 5 | 896 |
>
Human verification of the complete end-to-end chain with real GitHub webhook delivery.
No code changes — this task verifies that the infrastructure chain works against live services.
</action>
<how-to-verify>
1. Populate `.env.local` with real credentials (see user_setup in this plan's frontmatter for... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-PLAN.md | Markdown | 2c52ddee7d1ce96290911a3afe973f2712ccef087e259259f1bf69282706f842 | 6 | 752 |
---
phase: 01-foundation-bot-wiring
plan: 02
subsystem: webhook, bot, testing
tags: [chat-sdk, github-adapter, redis-state, vitest, webhook, idempotency, after]
# Dependency graph
requires:
- phase: 01-foundation-bot-wiring
plan: 01
provides: "lib/redis.ts (audit storage), lib/review.ts (sandbox pipeline), v... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-SUMMARY.md | Markdown | cf51ba1dc80c58258f67116ad91a0746cc21873c3a913c678a5e7c6be5ac8d04 | 0 | 896 |
: Create Automated Tests for All Phase 1 Requirements** - `3047836` (test)
3. **Task 3: Verify End-to-End Chain with Real GitHub Webhook** - PENDING (checkpoint:human-verify)
## Files Created/Modified
- `lib/bot.ts` - Chat SDK bot with GitHub adapter, onNewMention (ack -> review -> store -> complete), onSubscribedMess... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-SUMMARY.md | Markdown | 930a9ac50f85d4b2294c4f9117da5b8c0f09eb0fe3c83d1b3751feee4bfc52dc | 1 | 896 |
's infrastructure locally -- resolved by creating matching interface files
- Vitest 4.x `vi.mock()` factory hoisting required `vi.hoisted()` pattern -- documented as established pattern
## Known Stubs
None -- all code is fully wired with real imports and types.
## User Setup Required
**External services require manu... | clawguard | .planning/phases/01-foundation-bot-wiring/01-02-SUMMARY.md | Markdown | b9f72aeb52d3b87c69e56fc484ba644dd3e2f27a027d960188f103e611da6e9c | 2 | 263 |
# Phase 1: Foundation & Bot Wiring - Context
**Gathered:** 2026-03-27
**Status:** Ready for planning
<domain>
## Phase Boundary
Prove the full infrastructure chain end-to-end: a GitHub @mention reaches the app, triggers background processing in a Vercel Sandbox, stores results in Upstash Redis, and posts a response ... | clawguard | .planning/phases/01-foundation-bot-wiring/01-CONTEXT.md | Markdown | e038e8e61942a4f8c859ca6cf759251f12d9489f1a7cee782b8463e531d32998 | 0 | 896 |
HOOK-01 through HOOK-05
- `.planning/REQUIREMENTS.md` §Security Analysis Pipeline — SCAN-01, SCAN-07, SCAN-08
</canonical_refs>
<code_context>
## Existing Code Insights
### Reusable Assets
- None — greenfield project, no existing code
### Established Patterns
- None yet — Phase 1 establishes the foundational patter... | clawguard | .planning/phases/01-foundation-bot-wiring/01-CONTEXT.md | Markdown | 7c327b7babf25b1a911cf36129810ccfd7f38b7b7e5b5140d8de901271f47339 | 1 | 315 |
# Phase 1: Foundation & Bot Wiring - Discussion Log
> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
**Date:** 2026-03-27
**Phase:** 01-foundation-bot-wiring
**Areas discussed:** Chat SDK ri... | clawguard | .planning/phases/01-foundation-bot-wiring/01-DISCUSSION-LOG.md | Markdown | 9d486d6440e04f5132258f239cf55b12798490d4259220cc05de36f82a7b295a | 0 | 896 |
-----|----------|
| Specific diagnostics | Post actual errors to the thread. Helpful but exposes internals. | |
| Friendly generic errors | Clean messages, no internals exposed. Polished look. | ✓ |
| Tiered approach | Known failures get specific messages, unknown get generic. | |
| You decide | Claude picks balancing ... | clawguard | .planning/phases/01-foundation-bot-wiring/01-DISCUSSION-LOG.md | Markdown | 5c0838b27e2b25538d50b498447a1b4bd2d0f700b833c919a97687607df3f44b | 1 | 170 |
# Phase 1: Foundation & Bot Wiring - Research
**Researched:** 2026-03-27
**Domain:** Chat SDK + Next.js webhook integration, Vercel Sandbox, Upstash Redis, AI SDK agents
**Confidence:** HIGH
## Summary
Phase 1 proves the full infrastructure chain: GitHub @mention → webhook → background processing → sandbox → Redis →... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | c3e3342cbb85511a07167b05f24d0f823e9f906d9783335feaa367f3dae1d09b | 0 | 896 |
js guide provides exact Route Handler pattern with `after()` for background processing |
| HOOK-02 | Chat SDK GitHub adapter handles PR thread interactions (post messages, edit messages, post cards) | GitHub adapter docs confirm post/edit/delete support; cards render as GFM Markdown; no streaming |
| HOOK-03 | Backgrou... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | 5d1373d16e62b3c181a67e67cc30269d1a48e129d0d458207fa01c8195ddf5cd | 1 | 896 |
---------|---------|---------|-------------|
| @octokit/rest | 22.0.1 | Direct GitHub API calls | PR metadata fetching (head/base branch refs). Adapter bundles this but install separately for direct use. |
### Alternatives Considered
| Instead of | Could Use | Tradeoff |
|------------|-----------|----------|
| Chat S... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | 4578b704580432ad3611bf96164632f295cc786ed58bf4fd18e28ae5075f39d6 | 2 | 896 |
**What:** Creates a Chat bot that auto-detects GitHub credentials from env vars and routes webhook events to handlers.
**When to use:** Single bot instance shared across the app.
**Source:** Chat SDK code review guide + GitHub adapter docs
```typescript
// lib/bot.ts
import { Chat } from "chat";
import { createGitHubA... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | ff20cb5bb59e30542e6aaa048c06fc6dbb611d9e7719b5f1748b2b29e1ad4d77 | 3 | 896 |
;
return result.text;
} finally {
await sandbox.stop();
}
}
```
### Pattern 5: Idempotency via X-GitHub-Delivery Header
**What:** Prevents duplicate processing when GitHub retries webhook deliveries.
**When to use:** Webhook route handler, before passing request to Chat SDK.
```typescript
import { redis... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | eb92b4a385f22fd987e702ea89f995f5da400d870d98b712beca2ed12764f8ee | 4 | 896 |
can be delegated to a library should be — the risk is in integration, not implementation.
## Common Pitfalls
### Pitfall 1: Request Body Double-Read in Webhook Handler
**What goes wrong:** Calling `request.json()` or `request.text()` before passing the request to the Chat SDK handler consumes the body stream. The SDK... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | 2b5142e1bd9db381d1ebcb69647bce89ce76559b4b19bc54625a44f79bc59f10 | 5 | 896 |
= 300` from the route handler file. The `after()` callback respects this timeout.
**Warning signs:** Function timeout errors in Vercel logs, partial results, sandbox left running without cleanup.
### Pitfall 7: bash-tool Uses Zod 3, Project Uses Zod 4
**What goes wrong:** Potential type mismatches if passing bash-tool... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | 9b86f11a1ab383d71afad6a6a55078270e5486b1e3145ea64727eba0f029b05e | 6 | 896 |
: "complete",
},
});
await thread.post(`Security review complete for PR #${prNumber}.`);
} catch (error) {
await thread.post(
"Something went wrong during the security review. Please try again."
);
}
});
bot.onSubscribedMessage(async (thread, message) => {
await thread.post(
"I'v... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | 1ac58e075609fe9705120076d1fa2816907fcfa89fa53f7289ce7cffa44257c9 | 7 | 896 |
Yes | `thread.subscribe()` for follow-up messages |
| Fetch messages | Yes | `thread.allMessages` for history |
**Thread ID format:** `github:{owner}/{repo}:{prNumber}`
**Implication for Phase 1:** Phased status updates (D-03) must use `thread.post()` + `thread.editMessage()` since streaming is not available. Future ... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | fbdd831acbcaee997ac09c49af4c4fe7aa7b4062225ef74bbe96ad1a15e1e27f | 8 | 896 |
-01 | Webhook route returns 200, routes to pipeline | integration | `npx vitest run tests/webhook-handler.test.ts -t "routes mention to pipeline"` | ❌ Wave 0 |
| HOOK-02 | Bot posts message to PR thread | integration (mock) | `npx vitest run tests/bot.test.ts -t "posts acknowledgment"` | ❌ Wave 0 |
| HOOK-03 | Backgrou... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | 8bc6fc7d015c60e0546b15ca2073d1a11cb9ea57f79d20d367f53cd8dd365b4e | 9 | 896 |
, runCommand, readFile, writeFiles, stop
- Next.js `after()`: https://nextjs.org/docs/app/api-reference/functions/after — Background task API, Route Handler usage
- npm registry — all version numbers verified 2026-03-27
### Secondary (MEDIUM confidence)
- bash-tool GitHub: https://github.com/vercel-labs/bash-tool — To... | clawguard | .planning/phases/01-foundation-bot-wiring/01-RESEARCH.md | Markdown | 4c77cb21d1f24f0f71b685ad2f5e8d57176809d4321b5c1411ca40a6fab6b9de | 10 | 263 |
---
phase: 1
slug: foundation-bot-wiring
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-27
---
# Phase 1 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework**... | clawguard | .planning/phases/01-foundation-bot-wiring/01-VALIDATION.md | Markdown | 41859bcb598642118e124868672bc0d8cfd150d742c40c4e7e6090f17eb53506 | 0 | 813 |
---
phase: 02-security-analysis-pipeline
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- lib/analysis/types.ts
- lib/analysis/scoring.ts
- lib/cards/summary-card.ts
- lib/redis.ts
- tests/analysis/types.test.ts
- tests/analysis/scoring.test.ts
- tests/cards/summary-card.test.ts
- tests/r... | clawguard | .planning/phases/02-security-analysis-pipeline/02-01-PLAN.md | Markdown | 27a17644667e57bae112006c999284e25baf0fcf88c2bb452b0912e73f93f98e | 0 | 896 |
@.planning/phases/02-security-analysis-pipeline/02-CONTEXT.md
@.planning/phases/02-security-analysis-pipeline/02-RESEARCH.md
@lib/redis.ts
@tests/redis.test.ts
</context>
<tasks>
<task type="auto" tdd="true">
<name>Task 1: Create Analysis Types and Scoring Module with Tests</name>
<files>lib/analysis/types.ts, l... | clawguard | .planning/phases/02-security-analysis-pipeline/02-01-PLAN.md | Markdown | 9456ed4dbe1a9c1e5e53877d94d345afca2791c1b0284d081c7602838ec79205 | 1 | 896 |
z.string() })
- `complianceMapping`: z.object({ pciDss: z.string().optional(), soc2: z.string().optional(), hipaa: z.string().optional(), nist: z.string().optional(), owaspAsvs: z.string().optional() })
`PhaseResultSchema`: `z.object({ summary: z.string(), findings: z.array(FindingSchema) })`
`AuditResult... | clawguard | .planning/phases/02-security-analysis-pipeline/02-01-PLAN.md | Markdown | 8ac27b900e0e346653c508aae5af00c665ad0683430a4d1172e023468e4a60ea | 2 | 896 |
lib/analysis/types.ts does NOT contain `z.interface` (use z.object only)
- lib/analysis/scoring.ts contains `export function calculateScore`
- lib/analysis/scoring.ts contains `export function countBySeverity`
- lib/analysis/scoring.ts contains `CRITICAL: 25` and `HIGH: 15` and `MEDIUM: 8` and `LOW: 3` and ... | clawguard | .planning/phases/02-security-analysis-pipeline/02-01-PLAN.md | Markdown | e1bdf1d71aa09cd6c5673b048a000e583b149f79d9b8a33bfef46bf27117d477 | 3 | 896 |
`import type { AuditResult } from "@/lib/analysis/types";`
Change the `AuditData` interface:
```
export interface AuditData {
result: AuditResult; // CHANGED from string
timestamp: string;
pr: { owner: string; repo: string; number: number; title: string };
status: "processing" | "c... | clawguard | .planning/phases/02-security-analysis-pipeline/02-01-PLAN.md | Markdown | e0f9700a8e17f1a3f59c8b326522a5195c77744abc12554a0c42fac4ddd8d0ef | 4 | 896 |
summary-card.test.ts exits 0
- tests/redis.test.ts exits 0
- `npx vitest run` (full suite) exits 0 — no regressions
</acceptance_criteria>
<done>Card builder produces branded GFM markdown with score/grade header (D-01), severity badges (D-02), top 5 MEDIUM+ findings table (D-03, D-05), and report link (D-04... | clawguard | .planning/phases/02-security-analysis-pipeline/02-01-PLAN.md | Markdown | d986a22f68d23faaae30e341969c3e35c320dabc9bc6d0babbb969c89a516606 | 5 | 318 |
---
phase: 02-security-analysis-pipeline
plan: 01
subsystem: analysis
tags: [zod, scoring, gfm-card, redis, types]
# Dependency graph
requires:
- phase: 01-foundation-bot-wiring
provides: "Next.js scaffold, Redis client, bot handlers, review pipeline"
provides:
- "Zod schemas for Finding, PhaseResult, AuditRes... | clawguard | .planning/phases/02-security-analysis-pipeline/02-01-SUMMARY.md | Markdown | 05b90821b812ddec39233de90b702083e241aa14fef4dbdd5e5cf4ede97c969f | 0 | 896 |
, SeveritySchema, ConfidenceSchema + inferred types
- `lib/analysis/scoring.ts` - calculateScore (fixed deduction formula), countBySeverity, DEDUCTIONS, GRADE_THRESHOLDS
- `lib/cards/summary-card.ts` - buildSummaryCard (GFM markdown), severityEmoji, SEVERITY_ORDER
- `lib/redis.ts` - AuditData.result changed from string... | clawguard | .planning/phases/02-security-analysis-pipeline/02-01-SUMMARY.md | Markdown | addf113e1b3da81f2fa6cbd9af1143da5c204de709442ae5ea3116973aee11c1 | 1 | 572 |
---
phase: 02-security-analysis-pipeline
plan: 02
type: execute
wave: 2
depends_on: ["02-01"]
files_modified:
- lib/analysis/phase1-quality.ts
- lib/analysis/phase2-vuln.ts
- lib/analysis/phase3-threat.ts
- lib/analysis/pipeline.ts
- lib/review.ts
- tests/analysis/pipeline.test.ts
- tests/review.test.ts
a... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-PLAN.md | Markdown | ef9d432fcb5f9821d60d2fa4d88e832b062944d6128768cb15344257a51ae2e1 | 0 | 896 |
-pipeline/02-CONTEXT.md
@.planning/phases/02-security-analysis-pipeline/02-RESEARCH.md
@lib/review.ts
@lib/redis.ts
@tests/review.test.ts
<interfaces>
<!-- Key types and contracts from Plan 01. Executor should use these directly. -->
From lib/analysis/types.ts (created by Plan 01):
```typescript
export const Severit... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-PLAN.md | Markdown | cb80f9b069e678ace266eb84c444f134ce327ec7073e8af8112b9079d410ad62 | 1 | 896 |
} from "./types";
export async function runXxx(tools: Record<string, any>, diff: string, ...priorContext): Promise<PhaseResult> {
const agent = new ToolLoopAgent({
model: gateway("anthropic/claude-sonnet-4.6"),
tools,
output: Output.object({ schema: PhaseResultSchema }),
stopW... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-PLAN.md | Markdown | 69afe531873e3151d6ca2efbe486e44e8d1379400ac6fb335ef2ede00b72d515 | 2 | 896 |
on the PR changes and findings from Phase 1 and Phase 2, perform threat modeling."
- Focus areas: attack surface mapping (new endpoints, data inputs, trust boundaries), attack path analysis (how individual vulnerabilities chain for compound exploits), compound risk assessment, trust boundary violations, authenticat... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-PLAN.md | Markdown | f7d2ccad6de9cdfff6925e4a691cc80ce7653e95a6822509e35248ecbd7933e5 | 3 | 896 |
to be replaced)
- tests/review.test.ts (current tests — to be updated for new return type)
- .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md (Pattern 2: Sequential Pipeline, lines 141-172; Pattern 5: Progress Callback, lines 228-244; Pitfall 3: Sandbox timeout, lines 281-284)
</read_first>
<ac... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-PLAN.md | Markdown | 1d24c493be2b96e6008dd2ff275a934bd5ecfa579dbfd05c099c7a448df75fa2 | 4 | 896 |
?: ProgressCallback
): Promise<AuditResult> {
return runSecurityPipeline(input, onProgress);
}
```
This is now a thin wrapper that delegates to the pipeline. The `ReviewInput` type alias maintains backward compatibility. Return type changes from `Promise<string>` to `Promise<AuditResult>`.
*... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-PLAN.md | Markdown | 5c8fd3371dc0a2ba2bbf183e3b964530b54a39efb1a25f2ba0826ae284b351ce | 5 | 896 |
(moved to agents)
- tests/analysis/pipeline.test.ts exits 0
- tests/review.test.ts exits 0
- `npx vitest run` (full suite) exits 0
</acceptance_criteria>
<done>Pipeline orchestrates three sequential analysis phases with progress callbacks, aggregates findings, calculates score. Review module delegates t... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-PLAN.md | Markdown | c83c8e8305d835143828cb338b776d7605490b8a98e5c0bf29812afc7916c4bb | 6 | 291 |
---
phase: 02-security-analysis-pipeline
plan: 02
subsystem: analysis
tags: [ai-sdk, toolloopagent, vercel-sandbox, zod-structured-output, security-pipeline]
requires:
- phase: 02-01
provides: "Analysis types (FindingSchema, PhaseResultSchema, AuditResultSchema), scoring module (calculateScore, countBySeverity)"... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-SUMMARY.md | Markdown | 2ddfff20bf5a89b689c3a497c08c9040a218126862f51590e4bf84ac6a627495 | 0 | 896 |
returns AuditResult
- `lib/bot.ts` - Removed TODO cast, now uses AuditResult directly from review
- `tests/analysis/pipeline.test.ts` - 10 tests covering phase ordering, context passing, aggregation, progress callbacks
- `tests/review.test.ts` - 3 tests updated for new AuditResult return type
## Decisions Made
- stepC... | clawguard | .planning/phases/02-security-analysis-pipeline/02-02-SUMMARY.md | Markdown | 8e98aee252716434d6284c31e49716dfd58dd174bb47de0d23a806a5b2729fb3 | 1 | 582 |
---
phase: 02-security-analysis-pipeline
plan: 03
type: execute
wave: 3
depends_on: ["02-01", "02-02"]
files_modified:
- lib/bot.ts
- tests/bot.test.ts
autonomous: true
requirements: [CARD-01, CARD-02, CARD-03]
must_haves:
truths:
- "Bot posts live progress message with checkmarks as each analysis phase comp... | clawguard | .planning/phases/02-security-analysis-pipeline/02-03-PLAN.md | Markdown | 66506051e58b47d4c967fbf6b92d9b1846609b4f487066a9ba083d0b83ed495a | 0 | 896 |
; repo: string; number: number; title: string };
status: "processing" | "complete" | "error";
}
```
</interfaces>
</context>
<tasks>
<task type="auto">
<name>Task 1: Update Bot Handlers with Live Progress and Summary Card Posting</name>
<files>lib/bot.ts</files>
<read_first>
- lib/bot.ts (current implemen... | clawguard | .planning/phases/02-security-analysis-pipeline/02-03-PLAN.md | Markdown | 29493f5a95ea9ff0ca7ccfc0602defea77c4e37eb8d7228fdbedffa2806eee4f | 1 | 896 |
07):
```
const card = buildSummaryCard(auditResult, { owner, repo, number: prNumber });
await status.edit(card);
```
**3. Update `onNewMention` handler:**
Replace the current implementation body with:
```
bot.onNewMention(async (thread, message) => {
const raw = message.raw as Gi... | clawguard | .planning/phases/02-security-analysis-pipeline/02-03-PLAN.md | Markdown | 7be37a59989f5a60cf75b573980f971098e82432bd3de2a8f39f55af248c3301 | 2 | 896 |
— source code analysis pattern using readFileSync)
- lib/bot.ts (updated by Task 1)
</read_first>
<action>
**Update `tests/bot.test.ts`:**
The existing bot tests use source code analysis via `readFileSync` to avoid Chat SDK initialization side effects (established pattern from Phase 1). Continue this p... | clawguard | .planning/phases/02-security-analysis-pipeline/02-03-PLAN.md | Markdown | 67bc8670dbceac11a59519e89072944da9133f4e01998a8d92cccfdbaae17904 | 3 | 896 |
posting, and structured data storage. Full test suite passes with zero failures across all Phase 1 and Phase 2 tests.</done>
</task>
</tasks>
<verification>
1. `npx vitest run` — ALL tests pass (Phase 1 + Phase 2 combined)
2. `npx tsc --noEmit` — TypeScript compiles cleanly
3. `grep "buildSummaryCard" lib/bot.ts` — b... | clawguard | .planning/phases/02-security-analysis-pipeline/02-03-PLAN.md | Markdown | a50eb399e40fbbf2fbd81d1d1f3f15aea1029496b1cb142b08e78e31c33ab34e | 4 | 256 |
---
phase: 02-security-analysis-pipeline
plan: 03
subsystem: api
tags: [chat-sdk, bot-handlers, progress-updates, summary-card, redis]
# Dependency graph
requires:
- phase: 02-01
provides: "AuditResult type, scoring module, buildSummaryCard function"
- phase: 02-02
provides: "3-phase pipeline with Progress... | clawguard | .planning/phases/02-security-analysis-pipeline/02-03-SUMMARY.md | Markdown | 4ebb32aacd55590fbd9c90a46b14f993a110c7d5d3b97ef760a7e9bd317d0a3c | 0 | 861 |
# Phase 2: Security Analysis Pipeline - Context
**Gathered:** 2026-03-27
**Status:** Ready for planning
<domain>
## Phase Boundary
Build the 3-phase security audit pipeline (code quality review, vulnerability scan, threat model) that produces structured findings with severity scores and CWE/OWASP mappings. Post a br... | clawguard | .planning/phases/02-security-analysis-pipeline/02-CONTEXT.md | Markdown | c36ccec5a33527f3277f088fda3e14c60963d8929cc568747263247ea63b8f88 | 0 | 896 |
/redis.ts` — `AuditData` interface and store/get helpers (result type needs to change from `string` to structured)
- `lib/bot.ts` — `onNewMention`/`onSubscribedMessage` handlers with status edit pattern (to be extended with phase progress updates)
### Stack & Compatibility
- `.planning/research/STACK.md` — Package ver... | clawguard | .planning/phases/02-security-analysis-pipeline/02-CONTEXT.md | Markdown | 2cd9c6d2567dbadd7c6d50929a087871151faf078626a35479be7cc10cc5aa3f | 1 | 737 |
# Phase 2: Security Analysis Pipeline - Discussion Log
> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
**Date:** 2026-03-27
**Phase:** 02-security-analysis-pipeline
**Areas discussed:** Sum... | clawguard | .planning/phases/02-security-analysis-pipeline/02-DISCUSSION-LOG.md | Markdown | e1233c3255a5efc3f0df99a609a96d9a3bd25eceb6dd7bb80f07d7d4454c6049 | 0 | 896 |
only. All severities in stored JSON and report. | ✓ |
| All severities everywhere | Everything at every level, card shows top 5 from all. | |
| Critical + High only in card | Maximum signal, zero noise. Most dramatic for demo. | |
**User's choice:** Medium+ in card, all in data
**Notes:** Card is the "hook" — keep pun... | clawguard | .planning/phases/02-security-analysis-pipeline/02-DISCUSSION-LOG.md | Markdown | 5a90a7e50a7cc3ba41bd6d9be46c282790667bdd59c06c5abd2a24600e82acaf | 1 | 569 |
---
status: partial
phase: 02-security-analysis-pipeline
source: [02-VERIFICATION.md]
started: 2026-03-27T23:37:00Z
updated: 2026-03-27T23:37:00Z
---
## Current Test
[awaiting human testing]
## Tests
### 1. Live Progress Updates Render Correctly in GitHub PR
expected: Initial message shows three unchecked boxes, ea... | clawguard | .planning/phases/02-security-analysis-pipeline/02-HUMAN-UAT.md | Markdown | fa8767c0fff0fedce0b40cc0ace5358c4f9c3fc1da36075633175ca7d14443e1 | 0 | 228 |
# Phase 2: Security Analysis Pipeline - Research
**Researched:** 2026-03-27
**Domain:** AI agent orchestration, structured output, security analysis, GFM card rendering
**Confidence:** HIGH
## Summary
Phase 2 transforms the single-pass plain-text agent in `lib/review.ts` into a 3-phase sequential analysis pipeline w... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | 2906a7b1f472856cdd57a5b55c54f45bfa11f7c4843237586a40cd3430bfad3a | 0 | 896 |
not the card.
### Claude's Discretion
- Exact agent system prompts and prompt engineering for each analysis phase
- Zod schema structure for findings (must satisfy SCAN-05 field requirements)
- How context flows between the 3 sequential phases (full output vs. summary)
- GFM markdown formatting details for severity ba... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | af92e26c4d28ed59f7c99bd527d5761da4c63956aaea0f889aaa0724d0640f54 | 1 | 896 |
-----|---------|---------|----------|
| ai | 6.0.141 | ToolLoopAgent, Output.object, stepCountIs | `Output.object` confirmed via `require('ai').Output.object` |
| zod | 4.3.6 | Structured output schemas for all findings | Complex nested schemas verified working |
| @vercel/sandbox | 1.9.0 | Isolated repo clone + bash t... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | 7c592572745294f9e6782419398b6c3ae596bfb4a9d15f4cca5568c17d2162a6 | 2 | 896 |
// Phase 1: Code Quality
const phase1 = await qualityAgent(tools, diff);
// Phase 2: Vulnerability Scan (receives Phase 1 context)
const phase2 = await vulnAgent(tools, diff, phase1);
// Phase 3: Threat Model (receives Phase 1 + Phase 2 context)
const phase3 = await threatAgent(tools, diff, phase1... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | 9d00077593aa26a00e9a78e506bb28179f9888a629c6c520d2ea8ec388328fe0 | 3 | 896 |
to the bot's status.edit() calls.
**Example:**
```typescript
type ProgressCallback = (phase: string, status: 'running' | 'complete' | 'error') => Promise<void>;
async function runSecurityPipeline(
input: PipelineInput,
onProgress?: ProgressCallback
): Promise<AuditResult> {
// ...
await onProgress?.('quality',... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | 98c55e759bc5b7739d7aab9394ec62c6ab17575af2e55ecb58669d97bbe8835a | 4 | 896 |
Zod 4 feature, but the installed zod@4.3.6 does NOT export `z.interface`. It may be available via a different import path or not yet released.
**How to avoid:** Use `z.object()` exclusively. Verified working for all schema needs.
**Warning signs:** TypeScript or runtime errors mentioning `z.interface`.
### Pitfall 3: ... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | 6f580aedd99bee989bb68556bf9fce23357a47d1fb7fe6cf3a1b81eba3e7f0d9 | 5 | 896 |
File path relative to repo root"),
line: z.number().describe("Line number where the vulnerability exists"),
}),
cweId: z.string().describe("CWE identifier, e.g. 'CWE-89'"),
owaspCategory: z.string().describe("OWASP Top 10 2021 category, e.g. 'A03:2021-Injection'"),
description: z.string().describe("Detailed... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | 2cfbb2c28b78b3f576914904b5b5d40604055fc389ec3401e5ce78dbe705addc | 6 | 896 |
Output.object (Verified API)
```typescript
// Source: ai@6.0.141 type definitions (index.d.ts lines 3240-3462)
import { ToolLoopAgent, Output, stepCountIs } from "ai";
// Confirmed exports via runtime:
// - Output.object: function (returns Output<OBJECT, DeepPartial<OBJECT>, never>)
// - Output.array: function
// - Ou... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | b0487418648a3233a18d9980301fb44b2bb443910dcb9a491c6f6fefc0dbee71 | 7 | 896 |
**NoObjectGeneratedError handling**
- What we know: `Output.object` throws `NoObjectGeneratedError` when the model cannot produce valid JSON matching the schema. Error includes `text`, `response`, `usage`, `cause`.
- What's unclear: How reliably Claude Sonnet 4.6 produces valid JSON for complex schemas with 12+ f... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | d5bef5b254174953ba7ff88ddd815db3e33cc444bac5b11154851b18e335227d | 8 | 896 |
builder tests (CARD-01, CARD-02, CARD-03)
- [ ] Update `tests/review.test.ts` -- Existing tests must be updated for new structured return type
- [ ] Update `tests/redis.test.ts` -- Existing tests must be updated for new AuditData interface
### Existing Tests to Update
| Test File | Current State | Required Change |
|-... | clawguard | .planning/phases/02-security-analysis-pipeline/02-RESEARCH.md | Markdown | cadd07935446a84abee521bf9d9156eaeb0c514039da85472f8f901cc7bbce90 | 9 | 702 |
---
phase: 02
slug: security-analysis-pipeline
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-27
---
# Phase 02 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Fram... | clawguard | .planning/phases/02-security-analysis-pipeline/02-VALIDATION.md | Markdown | a9feea1bacdfca0a778626e1564ff5975a9937a38af1e5134cc90742bd689f7a | 0 | 783 |
---
phase: 02-security-analysis-pipeline
verified: 2026-03-27T23:42:00Z
status: passed
score: 4/4 must-haves verified
re_verification: false
---
# Phase 2: Security Analysis Pipeline Verification Report
**Phase Goal:** The 3-phase security audit (code quality, vulnerability scan, threat model) produces structured fin... | clawguard | .planning/phases/02-security-analysis-pipeline/02-VERIFICATION.md | Markdown | 316ce840a35188c1ab819a2372e929ed6f49de5883c83c5bbd3328d91149acd2 | 0 | 896 |
| VERIFIED | 65 lines. Exports FindingSchema, PhaseResultSchema, AuditResultSchema, SeveritySchema, ConfidenceSchema + 5 inferred types. Uses z.object() only (no z.interface). .describe() on all fields. |
| `lib/analysis/scoring.ts` | Score calculation and severity counting | VERIFIED | 46 lines. Exports calculateScore... | clawguard | .planning/phases/02-security-analysis-pipeline/02-VERIFICATION.md | Markdown | 9c36eec00a52deefe259db3bb506c6467b43247e94b4cd4786fc85273ac14de4 | 1 | 896 |
| Line 4, used at line 74 |
| `lib/analysis/pipeline.ts` | `lib/analysis/phase3-threat.ts` | `import { runThreatModel }` | WIRED | Line 5, used at line 79 |
| `lib/analysis/pipeline.ts` | `lib/analysis/scoring.ts` | `import { calculateScore, countBySeverity }` | WIRED | Line 6, used at lines 95-96 |
| `lib/review.ts` |... | clawguard | .planning/phases/02-security-analysis-pipeline/02-VERIFICATION.md | Markdown | d88e7775d749a97094048a98365166fd3386fc14fceb781c99ca20d4c3a46abf | 2 | 896 |
.ts stores result: auditResult (structured). |
| SCAN-06 | 02-01 | Security score: 0-100 with A-F grade, fixed deductions | SATISFIED | `lib/analysis/scoring.ts` DEDUCTIONS constant matches spec exactly. 16 scoring tests cover all grade boundaries. calculateScore floors at 0. |
| CARD-01 | 02-01, 02-03 | Summary card w... | clawguard | .planning/phases/02-security-analysis-pipeline/02-VERIFICATION.md | Markdown | 1f5c6a7cfc396d22582522f030a380f56a37cf60fe71427c5d7eb70d9ba194a8 | 3 | 828 |
---
phase: 03-auto-fix-commit-loop
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- lib/fix/types.ts
- lib/fix/apply.ts
- lib/fix/validate.ts
- lib/fix/commit.ts
- lib/fix/agent.ts
- tests/fix/apply.test.ts
- tests/fix/validate.test.ts
- tests/fix/commit.test.ts
autonomous: true
requireme... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-01-PLAN.md | Markdown | 120773d20c26bfebe499485ebfc2358d300ac83403479bd249989f1bd4583caf | 0 | 896 |
@lib/review.ts
<interfaces>
<!-- Key types and contracts the executor needs. Extracted from codebase. -->
From lib/analysis/types.ts:
```typescript
export type Severity = "CRITICAL" | "HIGH" | "MEDIUM" | "LOW" | "INFO";
export type Confidence = "high" | "medium" | "low";
export type Finding = {
severity: Severity;
... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-01-PLAN.md | Markdown | 6379624656977158469ede621e3dcf3c3acfe035117272e80bcfbec946c0a02a | 1 | 896 |
from sandbox via `sandbox.readFileToBuffer({ path: finding.location.file })`
- Replaces `finding.fix.before` with `finding.fix.after` using `String.replace()`
- IMPORTANT: Normalize whitespace before comparison -- trim both `fix.before` and the content lines, normalize line endings with `.replace(/\r\n/g, "\n")... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-01-PLAN.md | Markdown | f0cc35884a651d063a84d8d54edbeb8a75d5e00b9079ce5da49aaf1c3a5c14d6 | 2 | 896 |
.ts contains `export interface ValidationResult`
- lib/fix/types.ts contains `export interface ApplyResult`
- lib/fix/apply.ts contains `export async function applyStoredFix`
- lib/fix/apply.ts contains `sandbox.readFileToBuffer`
- lib/fix/apply.ts contains `sandbox.writeFiles`
- lib/fix/apply.ts co... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-01-PLAN.md | Markdown | f427129a8a7700accd65eb0ac3750a5a79705d14c6d899b5a7de825b5c56da93 | 3 | 896 |
.ts** — Fallback ToolLoopAgent for complex fixes per D-06. Named export `generateFixWithAgent`:
```typescript
import type { Sandbox } from "@vercel/sandbox";
import type { Finding } from "@/lib/analysis/types";
import type { ApplyResult } from "@/lib/fix/types";
export async function generateFixWit... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-01-PLAN.md | Markdown | bbd5a32837d7c27ac257cd4df2d558667ab5a04c59fb8bd5f1d6243468ede57d | 4 | 896 |
.isArray`)
All test files follow the established project pattern:
```typescript
import { describe, it, expect } from "vitest";
import { readFileSync } from "fs";
import { resolve } from "path";
const source = readFileSync(resolve(__dirname, "../../lib/fix/MODULE.ts"), "utf-8");
```
</acti... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-01-PLAN.md | Markdown | 106dc85cfb15aacc2e31fd6b4dc3d23d5b16b83790b3e1ba967a3c8b7b718002 | 5 | 624 |
---
phase: 03-auto-fix-commit-loop
plan: 01
subsystem: fix-pipeline
tags: [sandbox, octokit, toolloopagent, validation, auto-fix, vercel-ai-sdk]
# Dependency graph
requires:
- phase: 02-security-analysis-pipeline
provides: Finding type with fix.before/fix.after, Sandbox patterns, ToolLoopAgent usage
provides:
... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-01-SUMMARY.md | Markdown | 5965e416f849ae30008f24ffd0697fe518b854db851216d034954822a1a0cbc7 | 0 | 896 |
- `tests/fix/apply.test.ts` - 11 tests for fix application module
- `tests/fix/validate.test.ts` - 11 tests for validation module
- `tests/fix/commit.test.ts` - 12 tests for commit module
## Decisions Made
- Fuzzy line-by-line matching with trim() as fallback when exact fix.before match fails due to indentation differ... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-01-SUMMARY.md | Markdown | 7932cda1dd0b08b9fcbefe8efadc49107d4cf49006dfc7d124ce07f7436a744d | 1 | 285 |
---
phase: 03-auto-fix-commit-loop
plan: 02
type: execute
wave: 1
depends_on: []
files_modified:
- lib/cards/summary-card.tsx
- lib/cards/summary-card.ts
- tests/cards/summary-card.test.ts
autonomous: true
requirements: [CARD-04, FIX-07]
must_haves:
truths:
- "Summary card renders as Chat SDK JSX Card with... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-02-PLAN.md | Markdown | fe7ca700abb540ea154329c9cf6bcaea32e7aeb2b70b10f6ec5cd776060a4f48 | 0 | 896 |
string };
};
export type AuditResult = {
allFindings: Finding[];
score: number;
grade: string;
severityCounts: Record<string, number>;
};
```
From lib/analysis/scoring.ts:
```typescript
export function countBySeverity(findings: Finding[]): Record<string, number>;
```
<!-- Chat SDK JSX components (from researc... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-02-PLAN.md | Markdown | cee23fd84e04f88d9a25c9ee2f1a73a189b1a74fe1e83b8caae3b9a69fcbe865 | 1 | 896 |
0)} />
<Field label="HIGH" value={String(counts.HIGH ?? 0)} />
<Field label="MEDIUM" value={String(counts.MEDIUM ?? 0)} />
<Field label="LOW" value={String(counts.LOW ?? 0)} />
</Fields>
{topFindings.length > 0 ? (
<Table
headers={["Sever... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-02-PLAN.md | Markdown | bb1acfcbcb9635cf9079a76e00aa24cb005fb7d0337217aaefa798f50a58e291 | 2 | 896 |
, text instructions for fix commands, and the same data display (severity fields, findings table) as before.</done>
</task>
<task type="auto">
<name>Task 2: Update summary card tests for JSX Card format</name>
<files>tests/cards/summary-card.test.ts</files>
<read_first>
- lib/cards/summary-card.tsx (the new ... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-02-PLAN.md | Markdown | 0eeda84aa2ed4853c815c941a40289aaf4e8ec6483bb4655038e895f1e578174 | 3 | 896 |
<Button id="fix-all"');
expect(cardSource).toContain("Fix All");
});
// CARD-04: text instructions for fix commands
it("includes text instructions for fix commands (CARD-04)", () => {
expect(cardSource).toContain("@clawguard fix all");
expect(cardSource).toContain(... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-02-PLAN.md | Markdown | fae98893053988740cf2df2801c3306448dcb2ddd576c687d5a52d7e42ac44fc | 4 | 843 |
---
phase: 03-auto-fix-commit-loop
plan: 02
subsystem: ui
tags: [chat-sdk, jsx, card, summary-card, action-buttons]
# Dependency graph
requires:
- phase: 02-security-analysis-pipeline
provides: AuditResult type, Finding type, countBySeverity function, existing summary card
provides:
- JSX Card version of build... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-02-SUMMARY.md | Markdown | 9e94946c1e1cf8f8d19bcce6b020170025e3db5102a7c62ae4f1ca00fa0a2ddb | 0 | 852 |
---
phase: 03-auto-fix-commit-loop
plan: 03
type: execute
wave: 2
depends_on: ["03-01", "03-02"]
files_modified:
- lib/fix/index.ts
- lib/bot.ts
- tests/fix/index.test.ts
- tests/bot.test.ts
autonomous: true
requirements: [FIX-04, FIX-05, FIX-06]
must_haves:
truths:
- "fixFinding applies tiered fix (fast... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-03-PLAN.md | Markdown | 0523aa1545b43292b16b05edc536c99e53b88f2c90e752723d3daa20116d8730 | 0 | 896 |
fix-commit-loop/03-CONTEXT.md
@.planning/phases/03-auto-fix-commit-loop/03-RESEARCH.md
# Prior plan summaries from this phase (needed for types/exports)
@.planning/phases/03-auto-fix-commit-loop/03-01-SUMMARY.md
@.planning/phases/03-auto-fix-commit-loop/03-02-SUMMARY.md
@lib/fix/types.ts
@lib/fix/apply.ts
@lib/fix/va... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-03-PLAN.md | Markdown | 7b3a84488000ea8017b1ae3f067fad68a8fd64b5867e2abee2d998eece35ab49 | 1 | 896 |
onSubscribedMessage(async (thread, message) => {...});
// async function runAuditAndPost(thread, raw, status): Promise<void>;
// Uses: GitHubRawMessage with raw.repository.owner.login, raw.repository.name, raw.prNumber
// Uses: octokit.pulls.get({ owner, repo, pull_number })
```
From lib/analysis/pipeline.ts:
```types... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-03-PLAN.md | Markdown | 60fff5b79d40bd1962c251128ebf577c931743476765a62fc5f68501aaf52cf6 | 2 | 896 |
;
onFixProgress?: (result: FixResult) => Promise<void>;
}
): Promise<{
results: FixResult[];
reauditResult?: AuditResult;
}>
```
Implementation:
1. Load audit data: `const auditData = await getAuditResult("${context.owner}/${context.repo}/pr/${context.prNumber}")`
2. If... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-03-PLAN.md | Markdown | 9aebca5f982b3a9567e05d5c0ad27292a3adefa907215d39907eac50cbfe5b20 | 3 | 896 |
index.ts contains `storeAuditResult` (persist re-audit)
- lib/fix/index.ts contains `getAuditResult` (load findings)
- lib/fix/index.ts contains `Sandbox.create` (sandbox lifecycle)
- lib/fix/index.ts contains `sandbox.stop()` (cleanup in finally)
- lib/fix/index.ts contains `npm.*install.*--ignore-scri... | clawguard | .planning/phases/03-auto-fix-commit-loop/03-03-PLAN.md | Markdown | 512fa0804d630dd4abe28729d892ad1d8a9929846941a05c0f2168974461e61a | 4 | 896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.