Skip to content

Commit 39dacce

Browse files
authored
Merge pull request #2 from PostHog/chore/config-housekeeping
2 parents 7bbd1c6 + df24d51 commit 39dacce

15 files changed

+117
-87
lines changed

mprocs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ procs:
44
cwd: .
55
color: blue
66

7-
main:
8-
cmd: ["pnpm", "run", "dev:main"]
7+
node:
8+
cmd: ["pnpm", "run", "dev:node"]
99
cwd: .
1010
color: green
1111

@@ -15,4 +15,4 @@ procs:
1515
color: yellow
1616
depends_on:
1717
- vite
18-
- main
18+
- node

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
"scripts": {
1212
"dev": "mprocs",
1313
"dev:vite": "vite",
14-
"dev:main": "tsc -p tsconfig.json --watch & tsc -p tsconfig.preload.json --watch",
14+
"dev:node": "tsc -p tsconfig.node.json --watch",
1515
"dev:electron": "wait-on tcp:5173 && wait-on dist/main/index.js && electron . --dev",
16-
"build": "pnpm run build:main && pnpm run build:vite && pnpm run build:electron",
17-
"build:main": "tsc -p tsconfig.json && tsc -p tsconfig.preload.json && echo '{\"type\":\"module\"}' > dist/main/package.json",
16+
"build": "pnpm run build:node && pnpm run build:vite && pnpm run build:electron",
17+
"build:node": "tsc -p tsconfig.node.json",
1818
"build:vite": "vite build",
1919
"build:electron": "electron-builder",
2020
"preview": "vite preview",
21-
"typecheck": "tsc --noEmit",
21+
"typecheck": "tsc -p tsconfig.node.json --noEmit && tsc -p tsconfig.web.json --noEmit",
2222
"lint": "eslint src --ext .ts,.tsx",
2323
"generate-client": "tsx scripts/update-openapi-client.ts"
2424
},

src/api/posthogClient.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class PostHogAPIClient {
66
private api: ReturnType<typeof createApiClient>;
77
private _teamId: number | null = null;
88

9-
constructor(private apiKey: string, private apiHost: string) {
9+
constructor(apiKey: string, apiHost: string) {
1010
const baseUrl = apiHost.endsWith('/') ? apiHost.slice(0, -1) : apiHost;
1111
this.api = createApiClient(
1212
buildApiFetcher({ apiToken: apiKey }),
@@ -64,24 +64,24 @@ export class PostHogAPIClient {
6464
}
6565

6666
async createTask(
67-
title: string,
67+
title: string,
6868
description: string,
6969
repositoryConfig?: { organization: string; repository: string }
7070
) {
7171
const teamId = await this.getTeamId();
72-
72+
7373
const payload = {
7474
title,
7575
description,
76-
origin_product: 'user_created',
76+
origin_product: 'user_created' as const,
7777
...(repositoryConfig && { repository_config: repositoryConfig }),
7878
};
79-
79+
8080
const data = await this.api.post(`/api/projects/{project_id}/tasks/`, {
8181
path: {project_id: teamId.toString()},
82-
body: payload
82+
body: payload as Schemas.Task
8383
});
84-
84+
8585
return data;
8686
}
8787

src/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { app, BrowserWindow, Menu, MenuItemConstructorOptions } from 'electron';
1+
import { app, BrowserWindow, Menu, type MenuItemConstructorOptions } from 'electron';
22
import path from 'path';
33
import { fileURLToPath } from 'url';
44
import { registerPosthogIpc } from './services/posthog.js';

src/main/preload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
1+
import { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron';
22

33
interface MessageBoxOptions {
44
type?: 'info' | 'error' | 'warning' | 'question';

src/main/services/agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ipcMain, BrowserWindow, IpcMainInvokeEvent } from 'electron';
1+
import { ipcMain, BrowserWindow, type IpcMainInvokeEvent } from 'electron';
22
import { getCurrentBranch } from './git.js';
33
import { createAgent, ClaudeCodeAgent } from '@posthog/code-agent';
44

@@ -15,7 +15,7 @@ interface TaskController {
1515
}
1616

1717
export function registerAgentIpc(taskControllers: Map<string, TaskController>, getMainWindow: () => BrowserWindow | null): void {
18-
ipcMain.handle('agent-start', async (_event: IpcMainInvokeEvent, { prompt, repoPath, model }: AgentStartParams): Promise<{ taskId: string; channel: string }> => {
18+
ipcMain.handle('agent-start', async (_event: IpcMainInvokeEvent, { prompt, repoPath }: AgentStartParams): Promise<{ taskId: string; channel: string }> => {
1919
if (!prompt || !repoPath) {
2020
throw new Error('prompt and repoPath are required');
2121
}

src/main/services/os.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ipcMain, dialog, BrowserWindow, IpcMainInvokeEvent } from 'electron';
1+
import { ipcMain, dialog, BrowserWindow, type IpcMainInvokeEvent } from 'electron';
22
import path from 'path';
33
import fs from 'fs';
44
import { promisify } from 'util';

src/main/services/posthog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ipcMain, safeStorage, IpcMainInvokeEvent } from 'electron';
1+
import { ipcMain, safeStorage, type IpcMainInvokeEvent } from 'electron';
22

33
export function registerPosthogIpc(): void {
44
// IPC handlers for secure storage

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { radixThemePreset } = require('radix-themes-tw');
1+
import { radixThemePreset } from 'radix-themes-tw';
22

33
/** @type {import('tailwindcss').Config} */
44
module.exports = {

tsconfig.json

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,51 @@
11
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
23
"compilerOptions": {
3-
"target": "ES2020",
4-
"module": "ESNext",
5-
"lib": ["ES2020"],
6-
"moduleResolution": "node",
4+
"allowJs": true,
5+
"baseUrl": "./src",
6+
"declaration": true,
7+
"declarationMap": true,
78
"esModuleInterop": true,
9+
"forceConsistentCasingInFileNames": true,
10+
"inlineSources": true,
11+
"isolatedModules": true,
12+
"jsx": "preserve",
13+
"module": "esnext",
14+
"moduleResolution": "bundler",
15+
"noEmit": true,
16+
"noImplicitAny": true,
17+
"noImplicitReturns": true,
18+
"noUnusedLocals": true,
19+
"noUnusedParameters": true,
20+
"paths": {
21+
"@/*": [
22+
"./*"
23+
],
24+
"@api/*": [
25+
"api/*"
26+
],
27+
"@main/*": [
28+
"main/*"
29+
],
30+
"@renderer/*": [
31+
"renderer/*"
32+
],
33+
"@shared/*": [
34+
"shared/*"
35+
]
36+
},
37+
"resolveJsonModule": true,
838
"skipLibCheck": true,
39+
"sourceMap": true,
940
"strict": true,
10-
"resolveJsonModule": true,
11-
"outDir": "dist/main",
12-
"rootDir": "src/main",
13-
"types": ["node"]
41+
"target": "esnext"
1442
},
15-
"include": ["src/main/**/*"],
16-
"exclude": ["node_modules", "src/main/preload.ts"]
43+
"exclude": [
44+
"node_modules",
45+
"dist",
46+
"release"
47+
],
48+
"include": [
49+
"src/**/*"
50+
]
1751
}

0 commit comments

Comments
 (0)