Skip to content

Commit 74b5784

Browse files
code hygiene improvements
1 parent 8604b52 commit 74b5784

22 files changed

Lines changed: 883 additions & 924 deletions

.claude/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"hooks": {
3+
"PostToolUse": [
4+
{
5+
"matcher": "Write|Edit|MultiEdit",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "pnpm format:changed",
10+
"timeout": 120
11+
}
12+
]
13+
}
14+
]
15+
}
16+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Run repo formatting after code edits
3+
globs:
4+
alwaysApply: true
5+
---
6+
7+
After making code edits, run `pnpm format` before handing work back when the change spans multiple files or packages.
8+
9+
For small, localized changes, run `pnpm format:changed` or `pnpm format:staged`.
10+
11+
Do not skip formatting. This repository uses `oxfmt`, CI checks `pnpm format:check`, shared Claude settings run `pnpm format:changed` after edit tools, and a pre-commit hook runs `pnpm format:staged` on staged files.

.githooks/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
pnpm format:staged

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ When working on Convex code, **always read `convex/_generated/ai/guidelines.md`
77
Convex agent skills for common tasks can be installed by running `npx convex ai-files install`.
88

99
<!-- convex-ai-end -->
10+
11+
After making code edits, run `pnpm format` before handing work back when the change spans multiple files or packages.
12+
13+
For small, localized changes, `pnpm format:changed` or `pnpm format:staged` is acceptable. A pre-commit hook runs `pnpm format:staged` automatically on staged files, and shared Claude settings run `pnpm format:changed` after edit tools.

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ When working on Convex code, **always read `convex/_generated/ai/guidelines.md`
77
Convex agent skills for common tasks can be installed by running `npx convex ai-files install`.
88

99
<!-- convex-ai-end -->
10+
11+
After making code edits, run `pnpm format` before handing work back when the change spans multiple files or packages.
12+
13+
For small, localized changes, `pnpm format:changed` or `pnpm format:staged` is acceptable. A pre-commit hook runs `pnpm format:staged` automatically on staged files, and shared Claude settings run `pnpm format:changed` after edit tools.

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ pnpm test # Run all tests
4242
pnpm test:cli # CLI tests only
4343
pnpm test:vscode-extension # VS Code extension tests only
4444
pnpm lint # Lint
45-
pnpm format # Format
45+
pnpm format # Format the entire repo
46+
pnpm format:changed # Format modified and untracked files
47+
pnpm format:staged # Format only staged files
4648
```
4749

4850
## Submitting a PR

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
![PatchPulse Banner](./assets/banner.png)
44

5+
[![CI](https://github.com/barrymichaeldoyle/patch-pulse/actions/workflows/ci.yml/badge.svg)](https://github.com/barrymichaeldoyle/patch-pulse/actions/workflows/ci.yml)
6+
[![npm version](https://img.shields.io/npm/v/patch-pulse)](https://www.npmjs.com/package/patch-pulse)
7+
[![npm downloads](https://img.shields.io/npm/dm/patch-pulse)](https://www.npmjs.com/package/patch-pulse)
8+
[![GitHub stars](https://img.shields.io/github/stars/barrymichaeldoyle/patch-pulse)](https://github.com/barrymichaeldoyle/patch-pulse/stargazers)
9+
510
PatchPulse helps you stay on top of npm dependency updates across your projects.
611

712
Live docs: https://barrymichaeldoyle.github.io/patch-pulse/

knip.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
"project": ["convex/**/*.ts", "!convex/_generated/**"]
1515
},
1616
"packages/vscode-extension": {
17-
"entry": ["src/extension.ts", "src/test/**/*.ts", ".vscode-test.mjs"],
18-
"project": ["src/**/*.ts"],
19-
"ignoreDependencies": ["@vscode/test-electron"]
17+
"entry": ["src/extension.ts"],
18+
"project": ["src/**/*.ts"]
2019
}
2120
}
2221
}

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,20 @@
3434
"dev:vscode-extension": "pnpm --filter patch-pulse-vscode-extension watch",
3535
"format": "pnpm exec oxfmt --write . '!packages/docs/.astro/**' '!packages/*/convex/_generated/**'",
3636
"format:check": "pnpm exec oxfmt --check . '!packages/docs/.astro/**' '!packages/*/convex/_generated/**'",
37+
"format:changed": "node scripts/format-changed.mjs",
38+
"format:staged": "node scripts/format-staged.mjs",
3739
"ci:check": "pnpm lint && pnpm format:check && pnpm knip && pnpm typecheck && pnpm test:shared && pnpm test:cli && pnpm test:notifier && pnpm build:cli && pnpm build:vscode-extension && pnpm build:docs",
3840
"knip": "pnpm exec knip",
3941
"lint": "pnpm exec oxlint .",
4042
"lint:fix": "pnpm exec oxlint --fix .",
4143
"test:cli": "pnpm --filter patch-pulse test:run",
4244
"test:notifier": "pnpm --filter @patch-pulse/notifier-bot test",
4345
"test:shared": "pnpm --filter @patch-pulse/shared test",
44-
"test:vscode-extension": "pnpm --filter patch-pulse-vscode-extension test",
4546
"test": "pnpm run test:shared && pnpm run test:cli && pnpm run test:notifier",
4647
"typecheck": "pnpm --filter patch-pulse typecheck && pnpm --filter @patch-pulse/notifier-bot typecheck",
4748
"changeset": "changeset",
4849
"changeset:version": "changeset version && pnpm --filter patch-pulse exec node scripts/generate-version.cjs",
49-
"changeset:publish": "pnpm build:cli && changeset publish"
50+
"changeset:publish": "pnpm build:cli && changeset publish",
51+
"prepare": "node scripts/setup-git-hooks.mjs"
5052
}
5153
}

packages/notifier-bot/convex/aiSummary.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ function buildSummaryPrompt(args: {
4545
async function callOpenAiSummary(
4646
model: string,
4747
prompt: string,
48-
): Promise<string> {
49-
const apiKey = process.env.OPENAI_API_KEY;
50-
if (!apiKey) return '';
48+
): Promise<string | null> {
49+
// Caller (summarizeReleaseEvidence) guards that the key exists before calling.
50+
const apiKey = process.env.OPENAI_API_KEY!;
5151

5252
const response = await fetch(OPENAI_API_URL, {
5353
method: 'POST',
@@ -86,7 +86,7 @@ async function callOpenAiSummary(
8686
output_text?: string;
8787
};
8888

89-
return data.output_text?.trim() ?? '';
89+
return data.output_text?.trim() || null;
9090
}
9191

9292
export async function summarizeReleaseEvidence(args: {
@@ -98,6 +98,8 @@ export async function summarizeReleaseEvidence(args: {
9898
}): Promise<{ model: string; summary: string } | null> {
9999
const prompt = buildSummaryPrompt(args);
100100

101+
if (!process.env.OPENAI_API_KEY) return null;
102+
101103
for (const model of [
102104
process.env.OPENAI_SUMMARY_NANO_MODEL ?? DEFAULT_NANO_MODEL,
103105
process.env.OPENAI_SUMMARY_MINI_MODEL ?? DEFAULT_MINI_MODEL,

0 commit comments

Comments
 (0)