Skip to content

Commit 83501fc

Browse files
committed
more ai slop... added tests, csp security with nonce genration, logging, ipc handlers, keytar for api keys, and some more improvements
1 parent eaaf577 commit 83501fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+10951
-6524
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Dependency Audit
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
# Run weekly on Sundays at 2 AM UTC
10+
- cron: '0 2 * * 0'
11+
12+
jobs:
13+
audit:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
cache: 'pnpm'
25+
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: latest
30+
31+
- name: Install dependencies
32+
run: pnpm install --frozen-lockfile
33+
34+
- name: Security Audit
35+
run: pnpm run audit:security
36+
continue-on-error: true
37+
38+
- name: Check Unused Dependencies
39+
run: pnpm run audit:unused
40+
continue-on-error: true
41+
42+
- name: License Compatibility Check
43+
run: pnpm run audit:licenses
44+
continue-on-error: true
45+
46+
- name: Build Size Check
47+
run: |
48+
pnpm build
49+
node scripts/audit-deps.js
50+
continue-on-error: true
51+
52+
- name: Upload Audit Results
53+
uses: actions/upload-artifact@v4
54+
if: always()
55+
with:
56+
name: audit-results
57+
path: |
58+
logs/
59+
.pnpm-audit-report.json
60+
retention-days: 30
61+
62+
security-alerts:
63+
runs-on: ubuntu-latest
64+
if: github.event_name == 'schedule' || github.event_name == 'push'
65+
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v4
69+
70+
- name: Setup Node.js
71+
uses: actions/setup-node@v4
72+
with:
73+
node-version: '20'
74+
cache: 'pnpm'
75+
76+
- name: Install pnpm
77+
uses: pnpm/action-setup@v4
78+
with:
79+
version: latest
80+
81+
- name: Install dependencies
82+
run: pnpm install --frozen-lockfile
83+
84+
- name: Generate Security Report
85+
run: |
86+
echo "# Dependency Security Report" > security-report.md
87+
echo "Generated: $(date)" >> security-report.md
88+
echo "" >> security-report.md
89+
90+
echo "## Security Vulnerabilities" >> security-report.md
91+
pnpm audit --audit-level moderate --long || echo "Vulnerabilities found - see details above" >> security-report.md
92+
echo "" >> security-report.md
93+
94+
echo "## License Issues" >> security-report.md
95+
node scripts/license-check.js >> security-report.md || true
96+
echo "" >> security-report.md
97+
98+
echo "## Unused Dependencies" >> security-report.md
99+
pnpm run audit:unused >> security-report.md || true
100+
101+
- name: Create Issue on Security Findings
102+
uses: actions/github-script@v7
103+
if: failure()
104+
with:
105+
script: |
106+
const fs = require('fs');
107+
108+
try {
109+
const report = fs.readFileSync('security-report.md', 'utf8');
110+
111+
await github.rest.issues.create({
112+
owner: context.repo.owner,
113+
repo: context.repo.repo,
114+
title: `🔒 Security Audit Alert - ${new Date().toISOString().split('T')[0]}`,
115+
body: `Automated security audit found issues requiring attention:\n\n${report}`,
116+
labels: ['security', 'dependencies', 'audit']
117+
});
118+
} catch (error) {
119+
console.log('No security report generated or issue creation failed:', error.message);
120+
}

app/api/git/branches/route.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Stub API route for Electron static export fallback
2+
// Provides shape expected by TypeScript/Next route validator.
3+
export const dynamic = "force-static";
4+
export const revalidate = 0;
5+
export async function POST(_req: Request) {
6+
return Response.json({ error: "'git/branches' API not available in Electron export build" }, { status: 501 });
7+
}

app/api/git/commits/route.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const dynamic = "force-static";
2+
export const revalidate = 0;
3+
4+
export async function POST(_req: Request) {
5+
return Response.json({ error: "'git/commits' API not available in Electron export build" }, { status: 501 });
6+
}

app/api/git/diff/route.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const dynamic = "force-static";
2+
export const revalidate = 0;
3+
4+
export async function POST(_req: Request) {
5+
return Response.json({ error: "'git/diff' API not available in Electron export build" }, { status: 501 });
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const dynamic = "force-static";
2+
export const revalidate = 0;
3+
4+
export async function GET() {
5+
return Response.json({ error: "'vibe/compatibility' API not available in Electron export build" }, { status: 501 });
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const dynamic = "force-static";
2+
export const revalidate = 0;
3+
4+
export async function POST(_req: Request) {
5+
return Response.json({ error: "'vibe/execute_command' API not available in Electron export build" }, { status: 501 });
6+
}

app/api/vibe/info/route.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const dynamic = "force-static";
2+
export const revalidate = 0;
3+
4+
export async function GET() {
5+
return Response.json({ error: "'vibe/info' API not available in Electron export build" }, { status: 501 });
6+
}

app/api/vibe/run_command/route.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const dynamic = "force-static";
2+
export const revalidate = 0;
3+
4+
export async function POST(_req: Request) {
5+
return Response.json({ error: "'vibe/run_command' API not available in Electron export build" }, { status: 501 });
6+
}

app/globals.css

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,147 @@
134134
right: initial !important;
135135
z-index: auto !important;
136136
}
137+
138+
/* Dark mode overrides for diff2html */
139+
.dark .diff2html-wrapper {
140+
/* File header styling */
141+
.d2h-file-header {
142+
background-color: oklch(0.2 0 0) !important;
143+
border-color: oklch(0.3 0 0) !important;
144+
color: oklch(0.9 0 0) !important;
145+
}
146+
147+
/* File name styling */
148+
.d2h-file-name {
149+
color: oklch(0.85 0 0) !important;
150+
}
151+
152+
/* File stats */
153+
.d2h-file-stats {
154+
color: oklch(0.7 0 0) !important;
155+
}
156+
157+
/* Code line numbers */
158+
.d2h-code-linenumber,
159+
.d2h-code-side-linenumber {
160+
background-color: oklch(0.18 0 0) !important;
161+
border-color: oklch(0.25 0 0) !important;
162+
color: oklch(0.65 0 0) !important;
163+
}
164+
165+
/* Code lines */
166+
.d2h-code-line {
167+
background-color: oklch(0.15 0 0) !important;
168+
color: oklch(0.9 0 0) !important;
169+
}
170+
171+
/* Added lines (green) */
172+
.d2h-ins {
173+
background-color: oklch(0.2 0.1 150) !important;
174+
border-color: oklch(0.4 0.15 150) !important;
175+
}
176+
177+
.d2h-ins .d2h-code-line {
178+
background-color: oklch(0.18 0.08 150) !important;
179+
}
180+
181+
.d2h-ins .d2h-code-linenumber,
182+
.d2h-ins .d2h-code-side-linenumber {
183+
background-color: oklch(0.16 0.06 150) !important;
184+
border-color: oklch(0.3 0.12 150) !important;
185+
}
186+
187+
/* Deleted lines (red) */
188+
.d2h-del {
189+
background-color: oklch(0.2 0.1 25) !important;
190+
border-color: oklch(0.4 0.15 25) !important;
191+
}
192+
193+
.d2h-del .d2h-code-line {
194+
background-color: oklch(0.18 0.08 25) !important;
195+
}
196+
197+
.d2h-del .d2h-code-linenumber,
198+
.d2h-del .d2h-code-side-linenumber {
199+
background-color: oklch(0.16 0.06 25) !important;
200+
border-color: oklch(0.3 0.12 25) !important;
201+
}
202+
203+
/* Changed/context lines */
204+
.d2h-cntx {
205+
background-color: oklch(0.15 0 0) !important;
206+
border-color: oklch(0.25 0 0) !important;
207+
}
208+
209+
.d2h-cntx .d2h-code-line {
210+
background-color: oklch(0.15 0 0) !important;
211+
}
212+
213+
.d2h-cntx .d2h-code-linenumber,
214+
.d2h-cntx .d2h-code-side-linenumber {
215+
background-color: oklch(0.18 0 0) !important;
216+
}
217+
218+
/* Inline changes (word-level diffs) */
219+
.d2h-ins .d2h-change {
220+
background-color: oklch(0.3 0.15 150) !important;
221+
color: oklch(0.95 0 0) !important;
222+
}
223+
224+
.d2h-del .d2h-change {
225+
background-color: oklch(0.3 0.15 25) !important;
226+
color: oklch(0.95 0 0) !important;
227+
}
228+
229+
/* Move detection */
230+
.d2h-moved {
231+
background-color: oklch(0.2 0.1 270) !important;
232+
border-color: oklch(0.4 0.15 270) !important;
233+
}
234+
235+
.d2h-moved .d2h-code-line {
236+
background-color: oklch(0.18 0.08 270) !important;
237+
}
238+
239+
/* Info/metadata */
240+
.d2h-info {
241+
background-color: oklch(0.22 0.05 240) !important;
242+
color: oklch(0.8 0 0) !important;
243+
border-color: oklch(0.3 0.08 240) !important;
244+
}
245+
246+
/* Selection highlighting */
247+
.d2h-code-line:hover {
248+
background-color: oklch(0.2 0 0) !important;
249+
}
250+
251+
/* Side-by-side view specific styles */
252+
.d2h-code-side-line {
253+
background-color: oklch(0.15 0 0) !important;
254+
}
255+
256+
/* File wrapper borders */
257+
.d2h-file-wrapper {
258+
border-color: oklch(0.25 0 0) !important;
259+
}
260+
261+
/* Table borders and backgrounds */
262+
table.d2h-diff-table {
263+
background-color: oklch(0.15 0 0) !important;
264+
border-color: oklch(0.25 0 0) !important;
265+
}
266+
267+
/* Ensure proper text contrast */
268+
.d2h-code-line-prefix {
269+
color: oklch(0.7 0 0) !important;
270+
}
271+
272+
/* Fix any remaining light backgrounds */
273+
.d2h-diff-tbody tr {
274+
background-color: oklch(0.15 0 0) !important;
275+
}
276+
277+
.d2h-diff-tbody tr td {
278+
border-color: oklch(0.25 0 0) !important;
279+
}
280+
}

app/layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type React from "react";
22
import type { Metadata } from "next";
33
import { Geist, Geist_Mono } from "next/font/google";
44
import { ThemeProvider } from "@/components/theme-provider";
5-
import { ConsoleProvider } from "@/components/streaming-console";
65
import "./globals.css";
76
import "diff2html/bundles/css/diff2html.min.css";
87

@@ -41,7 +40,7 @@ export default function RootLayout({
4140
<html lang="en" suppressHydrationWarning>
4241
<body className={`font-sans antialiased`}>
4342
<ThemeProvider>
44-
<ConsoleProvider>{children}</ConsoleProvider>
43+
{children}
4544
</ThemeProvider>
4645
</body>
4746
</html>

0 commit comments

Comments
 (0)