Skip to content

Commit 4e6d55c

Browse files
backnotpropclaude
andcommitted
style: apply biome formatting and fix lint issues
Formatting: normalize all source files to biome conventions (2-space indent, single quotes, trailing commas, 100 char width, sorted imports). Lint fixes: - Remove unused import (corsHeaders in paste-service handler) - Remove unused variables (sharedGlobalAttachments, validateAgent, availableAgents, DEFAULT_SETTINGS) - Remove unused catch parameters - Add node: protocol to Node.js builtin imports - Replace @ts-ignore with @ts-expect-error - Suppress intentional document.cookie usage in storage utility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 84ef52b commit 4e6d55c

127 files changed

Lines changed: 6169 additions & 4461 deletions

File tree

Some content is hidden

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

apps/hook/dev-mock-api.ts

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -203,23 +203,27 @@ export function devMockApi(): Plugin {
203203
server.middlewares.use((req, res, next) => {
204204
if (req.url === '/api/plan') {
205205
res.setHeader('Content-Type', 'application/json');
206-
res.end(JSON.stringify({
207-
plan: undefined, // Let editor use its own PLAN_CONTENT
208-
origin: 'claude-code',
209-
previousPlan: PLAN_V2,
210-
versionInfo: { version: 3, totalVersions: 3, project: 'demo' },
211-
sharingEnabled: true,
212-
}));
206+
res.end(
207+
JSON.stringify({
208+
plan: undefined, // Let editor use its own PLAN_CONTENT
209+
origin: 'claude-code',
210+
previousPlan: PLAN_V2,
211+
versionInfo: { version: 3, totalVersions: 3, project: 'demo' },
212+
sharingEnabled: true,
213+
}),
214+
);
213215
return;
214216
}
215217

216218
if (req.url === '/api/plan/versions') {
217219
res.setHeader('Content-Type', 'application/json');
218-
res.end(JSON.stringify({
219-
project: 'demo',
220-
slug: 'implementation-plan-real-time-collab',
221-
versions,
222-
}));
220+
res.end(
221+
JSON.stringify({
222+
project: 'demo',
223+
slug: 'implementation-plan-real-time-collab',
224+
versions,
225+
}),
226+
);
223227
return;
224228
}
225229

@@ -239,14 +243,18 @@ export function devMockApi(): Plugin {
239243

240244
if (req.url === '/api/plan/history') {
241245
res.setHeader('Content-Type', 'application/json');
242-
res.end(JSON.stringify({
243-
project: 'demo',
244-
plans: [{
245-
slug: 'implementation-plan-real-time-collab',
246-
versions: 3,
247-
lastModified: new Date(now - 60_000).toISOString(),
248-
}],
249-
}));
246+
res.end(
247+
JSON.stringify({
248+
project: 'demo',
249+
plans: [
250+
{
251+
slug: 'implementation-plan-real-time-collab',
252+
versions: 3,
253+
lastModified: new Date(now - 60_000).toISOString(),
254+
},
255+
],
256+
}),
257+
);
250258
return;
251259
}
252260

apps/hook/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
import App from '@plannotator/editor';
12
import React from 'react';
23
import ReactDOM from 'react-dom/client';
3-
import App from '@plannotator/editor';
44
import '@plannotator/editor/styles';
55

66
const rootElement = document.getElementById('root');
77
if (!rootElement) {
8-
throw new Error("Could not find root element to mount to");
8+
throw new Error('Could not find root element to mount to');
99
}
1010

1111
const root = ReactDOM.createRoot(rootElement);
1212
root.render(
1313
<React.StrictMode>
1414
<App />
15-
</React.StrictMode>
16-
);
15+
</React.StrictMode>,
16+
);

apps/hook/server/index.ts

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,36 @@
2323
* PLANNOTATOR_PORT - Fixed port to use (default: random locally, 19432 for remote)
2424
*/
2525

26-
import {
27-
startPlannotatorServer,
28-
handleServerReady,
29-
} from "@plannotator/server";
30-
import {
31-
startReviewServer,
32-
handleReviewServerReady,
33-
} from "@plannotator/server/review";
34-
import {
35-
startAnnotateServer,
36-
handleAnnotateServerReady,
37-
} from "@plannotator/server/annotate";
38-
import { getGitContext, runGitDiff } from "@plannotator/server/git";
39-
import { writeRemoteShareLink } from "@plannotator/server/share-url";
26+
import { handleServerReady, startPlannotatorServer } from '@plannotator/server';
27+
import { handleAnnotateServerReady, startAnnotateServer } from '@plannotator/server/annotate';
28+
import { getGitContext, runGitDiff } from '@plannotator/server/git';
29+
import { handleReviewServerReady, startReviewServer } from '@plannotator/server/review';
30+
import { writeRemoteShareLink } from '@plannotator/server/share-url';
4031

4132
// Embed the built HTML at compile time
42-
// @ts-ignore - Bun import attribute for text
43-
import planHtml from "../dist/index.html" with { type: "text" };
33+
// @ts-expect-error - Bun import attribute for text
34+
import planHtml from '../dist/index.html' with { type: 'text' };
35+
4436
const planHtmlContent = planHtml as unknown as string;
4537

46-
// @ts-ignore - Bun import attribute for text
47-
import reviewHtml from "../dist/review.html" with { type: "text" };
38+
// @ts-expect-error - Bun import attribute for text
39+
import reviewHtml from '../dist/review.html' with { type: 'text' };
40+
4841
const reviewHtmlContent = reviewHtml as unknown as string;
4942

5043
// Check for subcommand
5144
const args = process.argv.slice(2);
5245

5346
// Check if URL sharing is enabled (default: true)
54-
const sharingEnabled = process.env.PLANNOTATOR_SHARE !== "disabled";
47+
const sharingEnabled = process.env.PLANNOTATOR_SHARE !== 'disabled';
5548

5649
// Custom share portal URL for self-hosting
5750
const shareBaseUrl = process.env.PLANNOTATOR_SHARE_URL || undefined;
5851

5952
// Paste service URL for short URL sharing
6053
const pasteApiUrl = process.env.PLANNOTATOR_PASTE_URL || undefined;
6154

62-
if (args[0] === "review") {
55+
if (args[0] === 'review') {
6356
// ============================================
6457
// CODE REVIEW MODE
6558
// ============================================
@@ -68,18 +61,19 @@ if (args[0] === "review") {
6861
const gitContext = await getGitContext();
6962

7063
// Run git diff HEAD (uncommitted changes - default)
71-
const { patch: rawPatch, label: gitRef, error: diffError } = await runGitDiff(
72-
"uncommitted",
73-
gitContext.defaultBranch
74-
);
64+
const {
65+
patch: rawPatch,
66+
label: gitRef,
67+
error: diffError,
68+
} = await runGitDiff('uncommitted', gitContext.defaultBranch);
7569

7670
// Start review server (even if empty - user can switch diff types)
7771
const server = await startReviewServer({
7872
rawPatch,
7973
gitRef,
8074
error: diffError,
81-
origin: "claude-code",
82-
diffType: "uncommitted",
75+
origin: 'claude-code',
76+
diffType: 'uncommitted',
8377
gitContext,
8478
sharingEnabled,
8579
shareBaseUrl,
@@ -88,7 +82,9 @@ if (args[0] === "review") {
8882
handleReviewServerReady(url, isRemote, port);
8983

9084
if (isRemote && sharingEnabled && rawPatch) {
91-
await writeRemoteShareLink(rawPatch, shareBaseUrl, "review changes", "diff only").catch(() => {});
85+
await writeRemoteShareLink(rawPatch, shareBaseUrl, 'review changes', 'diff only').catch(
86+
() => {},
87+
);
9288
}
9389
},
9490
});
@@ -103,22 +99,21 @@ if (args[0] === "review") {
10399
server.stop();
104100

105101
// Output feedback (captured by slash command)
106-
console.log(result.feedback || "No feedback provided.");
102+
console.log(result.feedback || 'No feedback provided.');
107103
process.exit(0);
108-
109-
} else if (args[0] === "annotate") {
104+
} else if (args[0] === 'annotate') {
110105
// ============================================
111106
// ANNOTATE MODE
112107
// ============================================
113108

114109
const filePath = args[1];
115110
if (!filePath) {
116-
console.error("Usage: plannotator annotate <file.md>");
111+
console.error('Usage: plannotator annotate <file.md>');
117112
process.exit(1);
118113
}
119114

120115
// Resolve to absolute path
121-
const path = await import("path");
116+
const path = await import('node:path');
122117
const absolutePath = path.resolve(filePath);
123118

124119
// Read the markdown file
@@ -133,15 +128,17 @@ if (args[0] === "review") {
133128
const server = await startAnnotateServer({
134129
markdown,
135130
filePath: absolutePath,
136-
origin: "claude-code",
131+
origin: 'claude-code',
137132
sharingEnabled,
138133
shareBaseUrl,
139134
htmlContent: planHtmlContent,
140135
onReady: async (url, isRemote, port) => {
141136
handleAnnotateServerReady(url, isRemote, port);
142137

143138
if (isRemote && sharingEnabled) {
144-
await writeRemoteShareLink(markdown, shareBaseUrl, "annotate", "document only").catch(() => {});
139+
await writeRemoteShareLink(markdown, shareBaseUrl, 'annotate', 'document only').catch(
140+
() => {},
141+
);
145142
}
146143
},
147144
});
@@ -156,9 +153,8 @@ if (args[0] === "review") {
156153
server.stop();
157154

158155
// Output feedback (captured by slash command)
159-
console.log(result.feedback || "No feedback provided.");
156+
console.log(result.feedback || 'No feedback provided.');
160157
process.exit(0);
161-
162158
} else {
163159
// ============================================
164160
// PLAN REVIEW MODE (default)
@@ -167,26 +163,26 @@ if (args[0] === "review") {
167163
// Read hook event from stdin
168164
const eventJson = await Bun.stdin.text();
169165

170-
let planContent = "";
171-
let permissionMode = "default";
166+
let planContent = '';
167+
let permissionMode = 'default';
172168
try {
173169
const event = JSON.parse(eventJson);
174-
planContent = event.tool_input?.plan || "";
175-
permissionMode = event.permission_mode || "default";
170+
planContent = event.tool_input?.plan || '';
171+
permissionMode = event.permission_mode || 'default';
176172
} catch {
177-
console.error("Failed to parse hook event from stdin");
173+
console.error('Failed to parse hook event from stdin');
178174
process.exit(1);
179175
}
180176

181177
if (!planContent) {
182-
console.error("No plan content in hook event");
178+
console.error('No plan content in hook event');
183179
process.exit(1);
184180
}
185181

186182
// Start the plan review server
187183
const server = await startPlannotatorServer({
188184
plan: planContent,
189-
origin: "claude-code",
185+
origin: 'claude-code',
190186
permissionMode,
191187
sharingEnabled,
192188
shareBaseUrl,
@@ -196,7 +192,9 @@ if (args[0] === "review") {
196192
handleServerReady(url, isRemote, port);
197193

198194
if (isRemote && sharingEnabled) {
199-
await writeRemoteShareLink(planContent, shareBaseUrl, "review the plan", "plan only").catch(() => {});
195+
await writeRemoteShareLink(planContent, shareBaseUrl, 'review the plan', 'plan only').catch(
196+
() => {},
197+
);
200198
}
201199
},
202200
});
@@ -216,34 +214,34 @@ if (args[0] === "review") {
216214
const updatedPermissions = [];
217215
if (result.permissionMode) {
218216
updatedPermissions.push({
219-
type: "setMode",
217+
type: 'setMode',
220218
mode: result.permissionMode,
221-
destination: "session",
219+
destination: 'session',
222220
});
223221
}
224222

225223
console.log(
226224
JSON.stringify({
227225
hookSpecificOutput: {
228-
hookEventName: "PermissionRequest",
226+
hookEventName: 'PermissionRequest',
229227
decision: {
230-
behavior: "allow",
228+
behavior: 'allow',
231229
...(updatedPermissions.length > 0 && { updatedPermissions }),
232230
},
233231
},
234-
})
232+
}),
235233
);
236234
} else {
237235
console.log(
238236
JSON.stringify({
239237
hookSpecificOutput: {
240-
hookEventName: "PermissionRequest",
238+
hookEventName: 'PermissionRequest',
241239
decision: {
242-
behavior: "deny",
243-
message: result.feedback || "Plan changes requested",
240+
behavior: 'deny',
241+
message: result.feedback || 'Plan changes requested',
244242
},
245243
},
246-
})
244+
}),
247245
);
248246
}
249247

apps/hook/tsconfig.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@
44
"experimentalDecorators": true,
55
"useDefineForClassFields": false,
66
"module": "ESNext",
7-
"lib": [
8-
"ES2022",
9-
"DOM",
10-
"DOM.Iterable"
11-
],
7+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
128
"skipLibCheck": true,
13-
"types": [
14-
"node"
15-
],
9+
"types": ["node"],
1610
"moduleResolution": "bundler",
1711
"isolatedModules": true,
1812
"moduleDetection": "force",
@@ -27,4 +21,4 @@
2721
"allowImportingTsExtensions": true,
2822
"noEmit": true
2923
}
30-
}
24+
}

apps/hook/vite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import path from 'path';
2-
import { defineConfig } from 'vite';
1+
import path from 'node:path';
2+
import tailwindcss from '@tailwindcss/vite';
33
import react from '@vitejs/plugin-react';
4+
import { defineConfig } from 'vite';
45
import { viteSingleFile } from 'vite-plugin-singlefile';
5-
import tailwindcss from '@tailwindcss/vite';
66
import pkg from '../../package.json';
77
import { devMockApi } from './dev-mock-api';
88

@@ -21,7 +21,7 @@ export default defineConfig({
2121
'@plannotator/ui': path.resolve(__dirname, '../../packages/ui'),
2222
'@plannotator/editor/styles': path.resolve(__dirname, '../../packages/editor/index.css'),
2323
'@plannotator/editor': path.resolve(__dirname, '../../packages/editor/App.tsx'),
24-
}
24+
},
2525
},
2626
build: {
2727
target: 'esnext',

0 commit comments

Comments
 (0)