notican 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.env.example +14 -0
  2. package/README.md +175 -0
  3. package/dist/__fixtures__/index.d.ts +11 -0
  4. package/dist/__fixtures__/index.d.ts.map +1 -0
  5. package/dist/__fixtures__/index.js +160 -0
  6. package/dist/__fixtures__/index.js.map +1 -0
  7. package/dist/config.d.ts +17 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +37 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/github/client.d.ts +29 -0
  12. package/dist/github/client.d.ts.map +1 -0
  13. package/dist/github/client.js +121 -0
  14. package/dist/github/client.js.map +1 -0
  15. package/dist/handlers/index.d.ts +11 -0
  16. package/dist/handlers/index.d.ts.map +1 -0
  17. package/dist/handlers/index.js +35 -0
  18. package/dist/handlers/index.js.map +1 -0
  19. package/dist/handlers/issue.d.ts +6 -0
  20. package/dist/handlers/issue.d.ts.map +1 -0
  21. package/dist/handlers/issue.js +114 -0
  22. package/dist/handlers/issue.js.map +1 -0
  23. package/dist/handlers/pr.d.ts +6 -0
  24. package/dist/handlers/pr.d.ts.map +1 -0
  25. package/dist/handlers/pr.js +126 -0
  26. package/dist/handlers/pr.js.map +1 -0
  27. package/dist/handlers/push.d.ts +7 -0
  28. package/dist/handlers/push.d.ts.map +1 -0
  29. package/dist/handlers/push.js +151 -0
  30. package/dist/handlers/push.js.map +1 -0
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +37 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/notion/client.d.ts +40 -0
  36. package/dist/notion/client.d.ts.map +1 -0
  37. package/dist/notion/client.js +289 -0
  38. package/dist/notion/client.js.map +1 -0
  39. package/dist/processors/claude.d.ts +29 -0
  40. package/dist/processors/claude.d.ts.map +1 -0
  41. package/dist/processors/claude.js +245 -0
  42. package/dist/processors/claude.js.map +1 -0
  43. package/dist/server/index.d.ts +4 -0
  44. package/dist/server/index.d.ts.map +1 -0
  45. package/dist/server/index.js +77 -0
  46. package/dist/server/index.js.map +1 -0
  47. package/dist/types/index.d.ts +142 -0
  48. package/dist/types/index.d.ts.map +1 -0
  49. package/dist/types/index.js +12 -0
  50. package/dist/types/index.js.map +1 -0
  51. package/dist/watcher/notion-tasks.d.ts +10 -0
  52. package/dist/watcher/notion-tasks.d.ts.map +1 -0
  53. package/dist/watcher/notion-tasks.js +135 -0
  54. package/dist/watcher/notion-tasks.js.map +1 -0
  55. package/package.json +61 -0
  56. package/scripts/setup-notion.ts +216 -0
@@ -0,0 +1,289 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notion = void 0;
4
+ exports.markdownToNotionBlocks = markdownToNotionBlocks;
5
+ exports.createPage = createPage;
6
+ exports.updatePage = updatePage;
7
+ exports.findPageByExternalId = findPageByExternalId;
8
+ exports.createOrUpdatePage = createOrUpdatePage;
9
+ exports.getTasksToSync = getTasksToSync;
10
+ exports.markTaskSynced = markTaskSynced;
11
+ const client_1 = require("@notionhq/client");
12
+ const config_1 = require("../config");
13
+ const notion = new client_1.Client({ auth: config_1.config.NOTION_TOKEN });
14
+ exports.notion = notion;
15
+ /**
16
+ * Convert a markdown string to an array of Notion block objects.
17
+ * Handles headings, bullet lists, numbered lists, code blocks, and paragraphs.
18
+ */
19
+ function markdownToNotionBlocks(markdown) {
20
+ const blocks = [];
21
+ const lines = markdown.split('\n');
22
+ let inCodeBlock = false;
23
+ let codeLines = [];
24
+ let codeLang = '';
25
+ for (const line of lines) {
26
+ // Handle fenced code blocks
27
+ if (line.startsWith('```')) {
28
+ if (!inCodeBlock) {
29
+ inCodeBlock = true;
30
+ codeLang = line.slice(3).trim() || 'plain text';
31
+ codeLines = [];
32
+ }
33
+ else {
34
+ inCodeBlock = false;
35
+ blocks.push({
36
+ type: 'code',
37
+ code: {
38
+ language: codeLang,
39
+ rich_text: [{ type: 'text', text: { content: codeLines.join('\n').slice(0, 2000) } }],
40
+ },
41
+ });
42
+ codeLines = [];
43
+ codeLang = '';
44
+ }
45
+ continue;
46
+ }
47
+ if (inCodeBlock) {
48
+ codeLines.push(line);
49
+ continue;
50
+ }
51
+ // Headings
52
+ if (line.startsWith('### ')) {
53
+ blocks.push({
54
+ type: 'heading_3',
55
+ heading_3: { rich_text: [{ type: 'text', text: { content: line.slice(4) } }] },
56
+ });
57
+ }
58
+ else if (line.startsWith('## ')) {
59
+ blocks.push({
60
+ type: 'heading_2',
61
+ heading_2: { rich_text: [{ type: 'text', text: { content: line.slice(3) } }] },
62
+ });
63
+ }
64
+ else if (line.startsWith('# ')) {
65
+ blocks.push({
66
+ type: 'heading_1',
67
+ heading_1: { rich_text: [{ type: 'text', text: { content: line.slice(2) } }] },
68
+ });
69
+ }
70
+ else if (line.startsWith('- ') || line.startsWith('* ')) {
71
+ blocks.push({
72
+ type: 'bulleted_list_item',
73
+ bulleted_list_item: {
74
+ rich_text: [{ type: 'text', text: { content: line.slice(2) } }],
75
+ },
76
+ });
77
+ }
78
+ else if (/^\d+\.\s/.test(line)) {
79
+ blocks.push({
80
+ type: 'numbered_list_item',
81
+ numbered_list_item: {
82
+ rich_text: [{ type: 'text', text: { content: line.replace(/^\d+\.\s/, '') } }],
83
+ },
84
+ });
85
+ }
86
+ else if (line.trim() === '' || line.trim() === '---') {
87
+ blocks.push({ type: 'paragraph', paragraph: { rich_text: [] } });
88
+ }
89
+ else {
90
+ blocks.push({
91
+ type: 'paragraph',
92
+ paragraph: {
93
+ rich_text: [{ type: 'text', text: { content: line.slice(0, 2000) } }],
94
+ },
95
+ });
96
+ }
97
+ }
98
+ return blocks;
99
+ }
100
+ /**
101
+ * Create a new page in a Notion database.
102
+ * Returns the created page ID.
103
+ */
104
+ async function createPage(databaseId, title, content, metadata) {
105
+ try {
106
+ const blocks = markdownToNotionBlocks(content);
107
+ const properties = {
108
+ title: {
109
+ title: [{ type: 'text', text: { content: title } }],
110
+ },
111
+ };
112
+ // Map metadata to Notion properties
113
+ for (const [key, value] of Object.entries(metadata)) {
114
+ if (value === null)
115
+ continue;
116
+ if (typeof value === 'string') {
117
+ properties[key] = { rich_text: [{ type: 'text', text: { content: value } }] };
118
+ }
119
+ else if (typeof value === 'number') {
120
+ properties[key] = { number: value };
121
+ }
122
+ else if (typeof value === 'boolean') {
123
+ properties[key] = { checkbox: value };
124
+ }
125
+ }
126
+ const page = await notion.pages.create({
127
+ parent: { database_id: databaseId },
128
+ properties,
129
+ children: blocks.slice(0, 100), // Notion API limit
130
+ });
131
+ // If content exceeds block limit, append remaining blocks
132
+ if (blocks.length > 100) {
133
+ await appendBlocks(page.id, blocks.slice(100));
134
+ }
135
+ return page.id;
136
+ }
137
+ catch (err) {
138
+ const error = err;
139
+ throw new Error(`Failed to create Notion page "${title}": ${error.message}`);
140
+ }
141
+ }
142
+ /**
143
+ * Append blocks to an existing Notion page in batches.
144
+ */
145
+ async function appendBlocks(pageId, blocks) {
146
+ const batchSize = 100;
147
+ for (let i = 0; i < blocks.length; i += batchSize) {
148
+ const batch = blocks.slice(i, i + batchSize);
149
+ await notion.blocks.children.append({
150
+ block_id: pageId,
151
+ children: batch,
152
+ });
153
+ }
154
+ }
155
+ /**
156
+ * Update an existing Notion page's content by archiving old blocks and writing new ones.
157
+ */
158
+ async function updatePage(pageId, content) {
159
+ try {
160
+ // Retrieve existing children blocks and delete them
161
+ const existingBlocks = await notion.blocks.children.list({ block_id: pageId });
162
+ for (const block of existingBlocks.results) {
163
+ await notion.blocks.delete({ block_id: block.id });
164
+ }
165
+ // Append new content
166
+ const blocks = markdownToNotionBlocks(content);
167
+ await appendBlocks(pageId, blocks);
168
+ }
169
+ catch (err) {
170
+ const error = err;
171
+ throw new Error(`Failed to update Notion page ${pageId}: ${error.message}`);
172
+ }
173
+ }
174
+ /**
175
+ * Find a Notion page in a database by a rich_text property matching an external ID.
176
+ * Returns the page ID if found, null otherwise.
177
+ */
178
+ async function findPageByExternalId(databaseId, externalId, propertyName = 'github_pr_number') {
179
+ try {
180
+ const response = await notion.databases.query({
181
+ database_id: databaseId,
182
+ filter: {
183
+ property: propertyName,
184
+ rich_text: { equals: externalId },
185
+ },
186
+ });
187
+ if (response.results.length === 0)
188
+ return null;
189
+ return response.results[0].id;
190
+ }
191
+ catch (err) {
192
+ const error = err;
193
+ throw new Error(`Failed to find page by external ID "${externalId}": ${error.message}`);
194
+ }
195
+ }
196
+ /**
197
+ * Idempotent create-or-update: finds an existing page by externalId or creates a new one.
198
+ * Returns the page ID.
199
+ */
200
+ async function createOrUpdatePage(databaseId, externalId, title, content, metadata) {
201
+ const existingId = await findPageByExternalId(databaseId, externalId);
202
+ if (existingId) {
203
+ await updatePage(existingId, content);
204
+ return existingId;
205
+ }
206
+ return createPage(databaseId, title, content, { ...metadata, github_pr_number: externalId });
207
+ }
208
+ /**
209
+ * Query the Tasks database for pages where github_sync checkbox is true
210
+ * and github_issue_number is not yet set.
211
+ */
212
+ async function getTasksToSync() {
213
+ try {
214
+ const response = await notion.databases.query({
215
+ database_id: config_1.config.NOTION_DATABASE_TASKS,
216
+ filter: {
217
+ and: [
218
+ {
219
+ property: 'github_sync',
220
+ checkbox: { equals: true },
221
+ },
222
+ {
223
+ property: 'github_issue_number',
224
+ number: { is_empty: true },
225
+ },
226
+ ],
227
+ },
228
+ });
229
+ return response.results
230
+ .filter(client_1.isFullPage)
231
+ .map((page) => {
232
+ const props = page.properties;
233
+ const titleProp = props['title'] ?? props['Name'];
234
+ const title = titleProp?.type === 'title'
235
+ ? titleProp.title.map((t) => t.plain_text).join('')
236
+ : 'Untitled';
237
+ const bodyProp = props['body'] ?? props['Description'];
238
+ const body = bodyProp?.type === 'rich_text'
239
+ ? bodyProp.rich_text.map((t) => t.plain_text).join('')
240
+ : '';
241
+ const labelsProp = props['labels'];
242
+ const labels = labelsProp?.type === 'multi_select'
243
+ ? labelsProp.multi_select.map((s) => s.name)
244
+ : [];
245
+ const assigneesProp = props['assignees'];
246
+ const assignees = assigneesProp?.type === 'rich_text'
247
+ ? assigneesProp.rich_text.map((t) => t.plain_text)
248
+ : [];
249
+ return {
250
+ id: page.id,
251
+ title,
252
+ body,
253
+ labels,
254
+ assignees,
255
+ githubSync: true,
256
+ };
257
+ });
258
+ }
259
+ catch (err) {
260
+ const error = err;
261
+ throw new Error(`Failed to query tasks to sync: ${error.message}`);
262
+ }
263
+ }
264
+ /**
265
+ * Mark a Notion task as synced by setting the github_issue_number and
266
+ * unchecking github_sync.
267
+ */
268
+ async function markTaskSynced(pageId, issueNumber, issueUrl) {
269
+ try {
270
+ await notion.pages.update({
271
+ page_id: pageId,
272
+ properties: {
273
+ github_issue_number: { number: issueNumber },
274
+ github_issue_url: {
275
+ url: issueUrl,
276
+ },
277
+ github_sync: { checkbox: false },
278
+ status: {
279
+ select: { name: 'In Progress' },
280
+ },
281
+ },
282
+ });
283
+ }
284
+ catch (err) {
285
+ const error = err;
286
+ throw new Error(`Failed to mark task ${pageId} as synced: ${error.message}`);
287
+ }
288
+ }
289
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/notion/client.ts"],"names":[],"mappings":";;;AAcA,wDA6EC;AAMD,gCA2CC;AAmBD,gCAeC;AAMD,oDAoBC;AAMD,gDAeC;AAMD,wCA4DC;AAMD,wCAuBC;AA5TD,6CAAsD;AAKtD,sCAAmC;AAGnC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,EAAE,IAAI,EAAE,eAAM,CAAC,YAAY,EAAE,CAAC,CAAC;AAsThD,wBAAM;AApTf;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,QAAgB;IACrD,MAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,SAAS,GAAa,EAAE,CAAC;IA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ET,OAAO;gBACL,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,KAAK;gBACL,IAAI;gBACJ,MAAM;gBACN,SAAS;gBACT,UAAU,EAAE,IAAI;aACjB,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,GAAY,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;AACH,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,WAAmB,EACnB,QAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;YACxB,OAAO,EAAE,MAAM;YACf,UAAU,EAAE;gBACV,mBAAmB,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;gBAC5C,gBAAgB,EAAE;oBAChB,GAAG,EAAE,QAAQ;iBACd;gBACD,WAAW,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAChC,MAAM,EAAE;oBACN,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;iBAChC;aACF;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,GAAY,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,eAAe,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { ProcessedDoc, PullRequestEvent, ADRContext, RunbookContext, ChangedFile } from '../types';
2
+ import { NotionDocType as DocType } from '../types';
3
+ /**
4
+ * Analyze a PR diff and determine which documents to generate.
5
+ * Returns an array of ProcessedDoc ready to be written to Notion.
6
+ */
7
+ export declare function analyzeDiff(diff: string, prTitle: string, prBody: string): Promise<ProcessedDoc[]>;
8
+ /**
9
+ * Generate a changelog entry for a merged PR.
10
+ */
11
+ export declare function generateChangelog(pr: PullRequestEvent): Promise<string>;
12
+ /**
13
+ * Generate an Architecture Decision Record from a PR context.
14
+ */
15
+ export declare function generateADR(context: ADRContext): Promise<string>;
16
+ /**
17
+ * Generate API Reference documentation update from changed files.
18
+ */
19
+ export declare function generateAPIRefUpdate(files: ChangedFile[]): Promise<string>;
20
+ /**
21
+ * Generate a Runbook for infrastructure or operational changes.
22
+ */
23
+ export declare function generateRunbook(context: RunbookContext): Promise<string>;
24
+ /**
25
+ * Generate a brief PR summary for team review context.
26
+ */
27
+ export declare function summarizePR(pr: PullRequestEvent): Promise<string>;
28
+ export { DocType };
29
+ //# sourceMappingURL=claude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/processors/claude.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,WAAW,EAEZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AAuBpD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,EAAE,CAAC,CAiEzB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB7E;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAiCtE;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBhF;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC9E;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BvE;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DocType = void 0;
7
+ exports.analyzeDiff = analyzeDiff;
8
+ exports.generateChangelog = generateChangelog;
9
+ exports.generateADR = generateADR;
10
+ exports.generateAPIRefUpdate = generateAPIRefUpdate;
11
+ exports.generateRunbook = generateRunbook;
12
+ exports.summarizePR = summarizePR;
13
+ const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
14
+ const config_1 = require("../config");
15
+ const types_1 = require("../types");
16
+ Object.defineProperty(exports, "DocType", { enumerable: true, get: function () { return types_1.NotionDocType; } });
17
+ const anthropic = new sdk_1.default({ apiKey: config_1.config.ANTHROPIC_API_KEY });
18
+ const MODEL = 'claude-sonnet-4-6';
19
+ /**
20
+ * Call Claude with a system prompt and user message, returning the text response.
21
+ */
22
+ async function callClaude(systemPrompt, userMessage) {
23
+ const response = await anthropic.messages.create({
24
+ model: MODEL,
25
+ max_tokens: 4096,
26
+ system: systemPrompt,
27
+ messages: [{ role: 'user', content: userMessage }],
28
+ });
29
+ const content = response.content[0];
30
+ if (content.type !== 'text') {
31
+ throw new Error('Unexpected response type from Claude');
32
+ }
33
+ return content.text;
34
+ }
35
+ /**
36
+ * Analyze a PR diff and determine which documents to generate.
37
+ * Returns an array of ProcessedDoc ready to be written to Notion.
38
+ */
39
+ async function analyzeDiff(diff, prTitle, prBody) {
40
+ const systemPrompt = `You are an expert software engineering documentation assistant embedded in a CI/CD pipeline.
41
+ Your job is to analyze pull request diffs and determine which technical documents to generate.
42
+
43
+ You can generate the following document types:
44
+ - CHANGELOG: Always generate for merged PRs. Describes user-facing changes.
45
+ - ADR (Architecture Decision Record): Generate when the diff shows significant architectural changes,
46
+ new patterns, technology choices, or decisions that future engineers should understand.
47
+ - API_REF: Generate when API endpoints, request/response schemas, or public interfaces are modified.
48
+ - RUNBOOK: Generate when infrastructure, deployment, or operational procedures change.
49
+
50
+ Respond with a JSON array of documents to generate. Each document should have:
51
+ {
52
+ "type": "CHANGELOG" | "ADR" | "API_REF" | "RUNBOOK",
53
+ "title": "descriptive title",
54
+ "content": "full markdown content",
55
+ "metadata": { "key": "value" }
56
+ }
57
+
58
+ Guidelines:
59
+ - Be concise but thorough. Documentation should be immediately useful.
60
+ - For CHANGELOG: follow Keep a Changelog format. Group by Added/Changed/Fixed/Removed.
61
+ - For ADR: follow the MADR (Markdown Any Decision Records) format with Context, Decision, Consequences.
62
+ - For API_REF: document endpoints, parameters, request/response examples.
63
+ - For RUNBOOK: include step-by-step operational procedures, prerequisites, and rollback steps.
64
+ - Only generate documents that are clearly warranted by the diff.`;
65
+ const userMessage = `Analyze this pull request and generate appropriate documentation.
66
+
67
+ PR Title: ${prTitle}
68
+ PR Body: ${prBody || '(no description provided)'}
69
+
70
+ Diff:
71
+ \`\`\`diff
72
+ ${diff.slice(0, 15000)}
73
+ \`\`\`
74
+
75
+ Respond with a valid JSON array of document objects.`;
76
+ try {
77
+ const response = await callClaude(systemPrompt, userMessage);
78
+ // Extract JSON from response (Claude may wrap it in markdown code blocks)
79
+ const jsonMatch = response.match(/\[[\s\S]*\]/);
80
+ if (!jsonMatch) {
81
+ throw new Error('No JSON array found in Claude response');
82
+ }
83
+ const docs = JSON.parse(jsonMatch[0]);
84
+ return docs.map((doc) => ({
85
+ type: doc.type,
86
+ title: doc.title,
87
+ content: doc.content,
88
+ metadata: doc.metadata ?? {},
89
+ }));
90
+ }
91
+ catch (err) {
92
+ const error = err;
93
+ throw new Error(`Failed to analyze diff with Claude: ${error.message}`);
94
+ }
95
+ }
96
+ /**
97
+ * Generate a changelog entry for a merged PR.
98
+ */
99
+ async function generateChangelog(pr) {
100
+ const systemPrompt = `You are a technical writer generating changelog entries for a software project.
101
+ Follow the Keep a Changelog format (https://keepachangelog.com).
102
+ Be precise, developer-friendly, and focus on user-facing impact.
103
+ Output clean Markdown suitable for inclusion in a CHANGELOG.md or a Notion page.`;
104
+ const { pull_request: pullRequest, repository } = pr;
105
+ const userMessage = `Generate a changelog entry for this merged pull request:
106
+
107
+ Repository: ${repository.full_name}
108
+ PR #${pullRequest.number}: ${pullRequest.title}
109
+ Author: ${pullRequest.user.login}
110
+ Branch: ${pullRequest.head.ref} → ${pullRequest.base.ref}
111
+ Files changed: ${pullRequest.changed_files}
112
+ Additions: +${pullRequest.additions} | Deletions: -${pullRequest.deletions}
113
+ URL: ${pullRequest.html_url}
114
+
115
+ PR Description:
116
+ ${pullRequest.body || '(no description provided)'}
117
+
118
+ Generate a concise changelog entry with appropriate sections (Added/Changed/Fixed/Removed/Deprecated/Security).
119
+ Include the PR number as a reference link.`;
120
+ return callClaude(systemPrompt, userMessage);
121
+ }
122
+ /**
123
+ * Generate an Architecture Decision Record from a PR context.
124
+ */
125
+ async function generateADR(context) {
126
+ const systemPrompt = `You are a principal engineer writing Architecture Decision Records (ADRs) using the MADR format.
127
+ ADRs capture important architectural decisions made during development.
128
+ Format: Use clear Markdown with these sections:
129
+ # ADR-XXXX: [Title]
130
+ ## Status
131
+ ## Context
132
+ ## Decision
133
+ ## Consequences
134
+ ## Alternatives Considered
135
+
136
+ Be thorough but concise. Focus on the "why" not just the "what".`;
137
+ const userMessage = `Generate an ADR for this pull request that introduces architectural changes:
138
+
139
+ PR #${context.prNumber}: ${context.prTitle}
140
+ Author: ${context.author}
141
+ URL: ${context.prUrl}
142
+
143
+ PR Description:
144
+ ${context.prBody || '(no description provided)'}
145
+
146
+ Changed files (${context.changedFiles.length} total):
147
+ ${context.changedFiles.map((f) => ` ${f.status}: ${f.filename}`).join('\n')}
148
+
149
+ Relevant diff excerpt:
150
+ \`\`\`diff
151
+ ${context.diff.slice(0, 8000)}
152
+ \`\`\`
153
+
154
+ Write a complete ADR that future engineers will find valuable when understanding why this decision was made.`;
155
+ return callClaude(systemPrompt, userMessage);
156
+ }
157
+ /**
158
+ * Generate API Reference documentation update from changed files.
159
+ */
160
+ async function generateAPIRefUpdate(files) {
161
+ const systemPrompt = `You are a technical writer specializing in API documentation.
162
+ Generate clear, accurate API reference documentation in Markdown format.
163
+ Include: endpoint descriptions, HTTP methods, request parameters, request/response schemas,
164
+ authentication requirements, error codes, and usage examples.
165
+ Format for Notion pages with clear headings and code blocks.`;
166
+ const changedContent = files
167
+ .filter((f) => f.patch)
168
+ .map((f) => `### ${f.filename}\n\`\`\`diff\n${f.patch?.slice(0, 2000) ?? ''}\n\`\`\``)
169
+ .join('\n\n');
170
+ const userMessage = `Generate API reference documentation for these API-related file changes:
171
+
172
+ Changed API files:
173
+ ${files.map((f) => `- ${f.status}: ${f.filename} (+${f.additions}/-${f.deletions})`).join('\n')}
174
+
175
+ File changes:
176
+ ${changedContent}
177
+
178
+ Generate comprehensive API documentation covering all changed endpoints and interfaces.
179
+ Format as a Notion-friendly Markdown document with clear sections.`;
180
+ return callClaude(systemPrompt, userMessage);
181
+ }
182
+ /**
183
+ * Generate a Runbook for infrastructure or operational changes.
184
+ */
185
+ async function generateRunbook(context) {
186
+ const systemPrompt = `You are a senior DevOps/SRE engineer writing operational runbooks.
187
+ Runbooks provide step-by-step instructions for deploying, operating, and troubleshooting systems.
188
+ Format: Clear numbered steps, prerequisites, verification steps, rollback procedures.
189
+ Be specific, actionable, and assume the reader has intermediate DevOps knowledge.`;
190
+ const userMessage = `Generate a runbook for these infrastructure/deployment changes:
191
+
192
+ Repository: ${context.repoName}
193
+ Branch/ref: ${context.ref}
194
+ URL: ${context.repoUrl}
195
+
196
+ Changed files:
197
+ ${context.changedFiles.map((f) => `- ${f.status}: ${f.filename}`).join('\n')}
198
+
199
+ Recent commit messages:
200
+ ${context.commitMessages.map((m) => `- ${m}`).join('\n')}
201
+
202
+ File changes:
203
+ ${context.changedFiles
204
+ .filter((f) => f.patch)
205
+ .map((f) => `### ${f.filename}\n\`\`\`diff\n${f.patch?.slice(0, 1500) ?? ''}\n\`\`\``)
206
+ .join('\n\n')}
207
+
208
+ Write a complete runbook including:
209
+ 1. Overview of what changed
210
+ 2. Prerequisites
211
+ 3. Deployment steps
212
+ 4. Verification steps
213
+ 5. Rollback procedure
214
+ 6. Troubleshooting tips`;
215
+ return callClaude(systemPrompt, userMessage);
216
+ }
217
+ /**
218
+ * Generate a brief PR summary for team review context.
219
+ */
220
+ async function summarizePR(pr) {
221
+ const systemPrompt = `You are a helpful engineering assistant that writes concise PR summaries for team review.
222
+ Your summary helps reviewers quickly understand: what changed, why it changed, what to focus on,
223
+ and any risks or concerns. Keep it brief (under 300 words) but informative.
224
+ Format in Markdown with clear sections.`;
225
+ const { pull_request: pullRequest, repository } = pr;
226
+ const userMessage = `Summarize this pull request for team review:
227
+
228
+ Repository: ${repository.full_name}
229
+ PR #${pullRequest.number}: ${pullRequest.title}
230
+ Author: ${pullRequest.user.login}
231
+ From: ${pullRequest.head.ref} → ${pullRequest.base.ref}
232
+ Stats: ${pullRequest.changed_files} files | +${pullRequest.additions} / -${pullRequest.deletions}
233
+ URL: ${pullRequest.html_url}
234
+
235
+ Description:
236
+ ${pullRequest.body || '(no description provided)'}
237
+
238
+ Write a team-friendly summary covering:
239
+ - What this PR does (1-2 sentences)
240
+ - Key changes to review
241
+ - Potential risks or areas of concern
242
+ - Testing considerations`;
243
+ return callClaude(systemPrompt, userMessage);
244
+ }
245
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/processors/claude.ts"],"names":[],"mappings":";;;;;;AAqCA,kCAqEC;AAKD,8CAwBC;AAKD,kCAiCC;AAKD,oDAwBC;AAKD,0CAiCC;AAKD,kCA0BC;AA/QD,4DAA0C;AAC1C,sCAAmC;AASnC,oCAAoD;AAuQ3C,wFAvQiB,qBAAO,OA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CAAC,IAAI,CAAC,GAAG;SAC7C,WAAW,CAAC,aAAa,aAAa,WAAW,CAAC,SAAS,OAAO,WAAW,CAAC,SAAS;OACzF,WAAW,CAAC,QAAQ;;;EAGzB,WAAW,CAAC,IAAI,IAAI,2BAA2B;;;;;;yBAMxB,CAAC;IAExB,OAAO,UAAU,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,4 @@
1
+ declare const app: import("express-serve-static-core").Express;
2
+ export declare function startServer(): void;
3
+ export { app };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,GAAG,6CAAY,CAAC;AAqEtB,wBAAgB,WAAW,IAAI,IAAI,CAMlC;AAED,OAAO,EAAE,GAAG,EAAE,CAAC"}