@cullit/core 0.3.0 → 0.4.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 (3) hide show
  1. package/dist/index.d.ts +38 -122
  2. package/dist/index.js +168 -953
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EnrichmentType, AIConfig, OutputFormat, JiraConfig, OpenClawConfig, CullConfig } from '@cullit/config';
1
+ import { EnrichmentType, OutputFormat, AIConfig, CullConfig } from '@cullit/config';
2
2
  export { AIConfig, AIProvider, Audience, CullConfig, EnrichmentType, JiraConfig, LinearConfig, OpenClawConfig, OutputFormat, PublishTarget, PublisherType, SourceConfig, Tone } from '@cullit/config';
3
3
 
4
4
  interface GitCommit {
@@ -62,7 +62,7 @@ interface Generator {
62
62
  generate(context: EnrichedContext, config: AIConfig): Promise<ReleaseNotes>;
63
63
  }
64
64
  interface Publisher {
65
- publish(notes: ReleaseNotes, format: OutputFormat): Promise<void>;
65
+ publish(notes: ReleaseNotes, format: OutputFormat, preformatted?: string): Promise<void>;
66
66
  }
67
67
  interface PipelineResult {
68
68
  notes: ReleaseNotes;
@@ -71,7 +71,7 @@ interface PipelineResult {
71
71
  duration: number;
72
72
  }
73
73
 
74
- declare const VERSION = "0.3.0";
74
+ declare const VERSION = "0.4.0";
75
75
  declare const DEFAULT_CATEGORIES: string[];
76
76
  declare const DEFAULT_MODELS: Record<string, string>;
77
77
 
@@ -115,63 +115,6 @@ declare function getRecentTags(cwd?: string, count?: number): string[];
115
115
  */
116
116
  declare function getLatestTag(cwd?: string): string | null;
117
117
 
118
- /**
119
- * Collects release data directly from Jira (no git required).
120
- * Queries completed issues by JQL (project, sprint, date range, etc.)
121
- * and converts them into the GitDiff format for the pipeline.
122
- *
123
- * Usage:
124
- * --from "project = PROJ AND sprint = 'Sprint 42'"
125
- * --from "project = PROJ AND resolved >= '2025-03-01'"
126
- * --from "project = PROJ AND fixVersion = 'v2.0'"
127
- */
128
- declare class JiraCollector implements Collector {
129
- private config;
130
- constructor(config: JiraConfig);
131
- collect(from: string, to: string): Promise<GitDiff>;
132
- private buildJQL;
133
- private fetchIssues;
134
- }
135
-
136
- /**
137
- * Collects release data directly from Linear (no git required).
138
- * Queries completed issues by project, cycle, or team.
139
- *
140
- * Usage:
141
- * --from "team:ENG" (completed issues from team ENG, last 30 days)
142
- * --from "project:Project Name" (completed issues from a project)
143
- * --from "cycle:current" (current cycle's completed issues)
144
- * --from "label:release-v2" (issues with a specific label)
145
- */
146
- declare class LinearCollector implements Collector {
147
- private apiKey;
148
- constructor(apiKey?: string);
149
- collect(from: string, to: string): Promise<GitDiff>;
150
- private parseFilter;
151
- private fetchIssues;
152
- private buildFilterClause;
153
- }
154
-
155
- /**
156
- * Generates release notes using AI.
157
- * Supports Anthropic, OpenAI, Gemini, Ollama, OpenClaw — BYOK.
158
- */
159
- declare class AIGenerator implements Generator {
160
- private openclawConfig?;
161
- private timeoutMs;
162
- constructor(openclawConfig?: OpenClawConfig, timeoutMs?: number);
163
- private fetch;
164
- generate(context: EnrichedContext, config: AIConfig): Promise<ReleaseNotes>;
165
- private resolveApiKey;
166
- private buildPrompt;
167
- private callAnthropic;
168
- private callOpenAI;
169
- private callGemini;
170
- private callOllama;
171
- private callOpenClaw;
172
- private parseResponse;
173
- }
174
-
175
118
  /**
176
119
  * Template-based release notes generator — no AI required.
177
120
  * Groups commits by conventional commit prefix and ticket type.
@@ -192,7 +135,7 @@ declare function formatNotes(notes: ReleaseNotes, format: OutputFormat): string;
192
135
  * Outputs release notes to stdout (default).
193
136
  */
194
137
  declare class StdoutPublisher implements Publisher {
195
- publish(notes: ReleaseNotes, format: OutputFormat): Promise<void>;
138
+ publish(notes: ReleaseNotes, format: OutputFormat, preformatted?: string): Promise<void>;
196
139
  }
197
140
  /**
198
141
  * Writes release notes to a file.
@@ -200,66 +143,7 @@ declare class StdoutPublisher implements Publisher {
200
143
  declare class FilePublisher implements Publisher {
201
144
  private path;
202
145
  constructor(path: string);
203
- publish(notes: ReleaseNotes, format: OutputFormat): Promise<void>;
204
- }
205
- /**
206
- * Posts release notes to a Slack channel via webhook.
207
- */
208
- declare class SlackPublisher implements Publisher {
209
- private webhookUrl;
210
- constructor(webhookUrl: string);
211
- publish(notes: ReleaseNotes, _format: OutputFormat): Promise<void>;
212
- private buildSlackMessage;
213
- }
214
- /**
215
- * Posts release notes to Discord via webhook.
216
- */
217
- declare class DiscordPublisher implements Publisher {
218
- private webhookUrl;
219
- constructor(webhookUrl: string);
220
- publish(notes: ReleaseNotes, _format: OutputFormat): Promise<void>;
221
- private buildDiscordMessage;
222
- }
223
- /**
224
- * Creates or updates a GitHub Release via the GitHub API.
225
- * Requires GITHUB_TOKEN env var (provided automatically in GitHub Actions).
226
- */
227
- declare class GitHubReleasePublisher implements Publisher {
228
- private token;
229
- private owner;
230
- private repo;
231
- constructor();
232
- publish(notes: ReleaseNotes, format: OutputFormat): Promise<void>;
233
- private getRelease;
234
- private createRelease;
235
- private updateRelease;
236
- private headers;
237
- }
238
-
239
- /**
240
- * Enriches git diff with Jira ticket details.
241
- * Extracts PROJ-123 style keys from commit messages and fetches from Jira REST API.
242
- */
243
- declare class JiraEnricher implements Enricher {
244
- private config;
245
- constructor(config: JiraConfig);
246
- enrich(diff: GitDiff): Promise<EnrichedTicket[]>;
247
- private extractUniqueKeys;
248
- private fetchTicket;
249
- }
250
-
251
- /**
252
- * Enriches git diff with Linear issue details.
253
- * Extracts issue identifiers from commit messages and branch names.
254
- */
255
- declare class LinearEnricher implements Enricher {
256
- private apiKey;
257
- constructor(apiKey?: string);
258
- enrich(diff: GitDiff): Promise<EnrichedTicket[]>;
259
- private fetchIssuesIndividually;
260
- private extractUniqueKeys;
261
- private fetchIssuesBatch;
262
- private fetchIssue;
146
+ publish(notes: ReleaseNotes, format: OutputFormat, preformatted?: string): Promise<void>;
263
147
  }
264
148
 
265
149
  type SemverBump = 'patch' | 'minor' | 'major';
@@ -330,6 +214,38 @@ declare function isEnrichmentAllowed(license: LicenseStatus): boolean;
330
214
  */
331
215
  declare function upgradeMessage(feature: string): string;
332
216
 
217
+ /**
218
+ * Plugin Registry — the seam between free (core) and pro features.
219
+ *
220
+ * Core registers: git collector, template generator, stdout/file publishers.
221
+ * Pro registers: AI generator, Jira/Linear collectors + enrichers, Slack/Discord/GitHub publishers.
222
+ *
223
+ * The CLI calls `await import('@cullit/pro')` to load pro plugins if installed.
224
+ */
225
+
226
+ type CollectorFactory = (...args: any[]) => Collector;
227
+ type EnricherFactory = (...args: any[]) => Enricher;
228
+ type GeneratorFactory = (...args: any[]) => Generator;
229
+ type PublisherFactory = (...args: any[]) => Publisher;
230
+ declare function registerCollector(type: string, factory: CollectorFactory): void;
231
+ declare function registerEnricher(type: string, factory: EnricherFactory): void;
232
+ declare function registerGenerator(provider: string, factory: GeneratorFactory): void;
233
+ declare function registerPublisher(type: string, factory: PublisherFactory): void;
234
+ declare function getCollector(type: string): CollectorFactory | undefined;
235
+ declare function getEnricher(type: string): EnricherFactory | undefined;
236
+ declare function getGenerator(provider: string): GeneratorFactory | undefined;
237
+ declare function getPublisher(type: string): PublisherFactory | undefined;
238
+ declare function hasGenerator(provider: string): boolean;
239
+ declare function hasCollector(type: string): boolean;
240
+ declare function hasPublisher(type: string): boolean;
241
+ declare function hasEnricher(type: string): boolean;
242
+
243
+ /**
244
+ * Shared fetch wrapper with timeout support.
245
+ * Prevents hanging on unresponsive external APIs.
246
+ */
247
+ declare function fetchWithTimeout(url: string, init: RequestInit, timeoutMs?: number): Promise<Response>;
248
+
333
249
  /**
334
250
  * Main pipeline: Collect → Enrich → Generate → Format → Publish
335
251
  */
@@ -339,4 +255,4 @@ declare function runPipeline(from: string, to: string, config: CullConfig, optio
339
255
  logger?: Logger;
340
256
  }): Promise<PipelineResult>;
341
257
 
342
- export { AIGenerator, type ChangeCategory, type ChangeEntry, type Collector, DEFAULT_CATEGORIES, DEFAULT_MODELS, DiscordPublisher, type EnrichedContext, type EnrichedTicket, type Enricher, FilePublisher, type Generator, GitCollector, type GitCommit, type GitDiff, GitHubReleasePublisher, JiraCollector, JiraEnricher, type LicenseStatus, type LicenseTier, LinearCollector, LinearEnricher, type LogLevel, type Logger, type PipelineResult, type Publisher, type ReleaseAdvisory, type ReleaseNotes, type SemverBump, SlackPublisher, StdoutPublisher, TemplateGenerator, VERSION, analyzeReleaseReadiness, createLogger, formatNotes, getLatestTag, getRecentTags, isEnrichmentAllowed, isProviderAllowed, isPublisherAllowed, resolveLicense, runPipeline, upgradeMessage };
258
+ export { type ChangeCategory, type ChangeEntry, type Collector, type CollectorFactory, DEFAULT_CATEGORIES, DEFAULT_MODELS, type EnrichedContext, type EnrichedTicket, type Enricher, type EnricherFactory, FilePublisher, type Generator, type GeneratorFactory, GitCollector, type GitCommit, type GitDiff, type LicenseStatus, type LicenseTier, type LogLevel, type Logger, type PipelineResult, type Publisher, type PublisherFactory, type ReleaseAdvisory, type ReleaseNotes, type SemverBump, StdoutPublisher, TemplateGenerator, VERSION, analyzeReleaseReadiness, createLogger, fetchWithTimeout, formatNotes, getCollector, getEnricher, getGenerator, getLatestTag, getPublisher, getRecentTags, hasCollector, hasEnricher, hasGenerator, hasPublisher, isEnrichmentAllowed, isProviderAllowed, isPublisherAllowed, registerCollector, registerEnricher, registerGenerator, registerPublisher, resolveLicense, runPipeline, upgradeMessage };