@cullit/core 0.3.0 → 0.5.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.
- package/dist/index.d.ts +65 -124
- package/dist/index.js +246 -980
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnrichmentType,
|
|
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 {
|
|
@@ -31,7 +31,7 @@ interface EnrichedContext {
|
|
|
31
31
|
diff: GitDiff;
|
|
32
32
|
tickets: EnrichedTicket[];
|
|
33
33
|
}
|
|
34
|
-
type ChangeCategory =
|
|
34
|
+
type ChangeCategory = string;
|
|
35
35
|
interface ChangeEntry {
|
|
36
36
|
description: string;
|
|
37
37
|
category: ChangeCategory;
|
|
@@ -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,9 +71,17 @@ interface PipelineResult {
|
|
|
71
71
|
duration: number;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
declare const VERSION = "0.
|
|
74
|
+
declare const VERSION = "0.5.0";
|
|
75
75
|
declare const DEFAULT_CATEGORIES: string[];
|
|
76
76
|
declare const DEFAULT_MODELS: Record<string, string>;
|
|
77
|
+
declare const AI_PROVIDERS: readonly ["anthropic", "openai", "gemini", "ollama", "openclaw", "none"];
|
|
78
|
+
declare const OUTPUT_FORMATS: readonly ["markdown", "html", "json"];
|
|
79
|
+
declare const PUBLISHER_TYPES: readonly ["stdout", "file", "slack", "discord", "github-release"];
|
|
80
|
+
declare const ENRICHMENT_TYPES: readonly ["jira", "linear"];
|
|
81
|
+
declare const CHANGE_CATEGORIES: readonly ["features", "fixes", "breaking", "improvements", "chores", "other"];
|
|
82
|
+
declare const AUDIENCES: readonly ["developer", "end-user", "executive"];
|
|
83
|
+
declare const TONES: readonly ["professional", "casual", "terse"];
|
|
84
|
+
declare const SOURCE_TYPES: readonly ["local", "jira", "linear"];
|
|
77
85
|
|
|
78
86
|
type LogLevel = 'quiet' | 'normal' | 'verbose';
|
|
79
87
|
interface Logger {
|
|
@@ -115,63 +123,6 @@ declare function getRecentTags(cwd?: string, count?: number): string[];
|
|
|
115
123
|
*/
|
|
116
124
|
declare function getLatestTag(cwd?: string): string | null;
|
|
117
125
|
|
|
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
126
|
/**
|
|
176
127
|
* Template-based release notes generator — no AI required.
|
|
177
128
|
* Groups commits by conventional commit prefix and ticket type.
|
|
@@ -186,13 +137,17 @@ declare class TemplateGenerator implements Generator {
|
|
|
186
137
|
private buildSummary;
|
|
187
138
|
}
|
|
188
139
|
|
|
140
|
+
type FormatterFn = (notes: ReleaseNotes) => string;
|
|
141
|
+
declare function registerFormatter(format: string, fn: FormatterFn): void;
|
|
142
|
+
declare function getFormatter(format: string): FormatterFn | undefined;
|
|
143
|
+
declare function listFormatters(): string[];
|
|
189
144
|
declare function formatNotes(notes: ReleaseNotes, format: OutputFormat): string;
|
|
190
145
|
|
|
191
146
|
/**
|
|
192
147
|
* Outputs release notes to stdout (default).
|
|
193
148
|
*/
|
|
194
149
|
declare class StdoutPublisher implements Publisher {
|
|
195
|
-
publish(notes: ReleaseNotes, format: OutputFormat): Promise<void>;
|
|
150
|
+
publish(notes: ReleaseNotes, format: OutputFormat, preformatted?: string): Promise<void>;
|
|
196
151
|
}
|
|
197
152
|
/**
|
|
198
153
|
* Writes release notes to a file.
|
|
@@ -200,66 +155,7 @@ declare class StdoutPublisher implements Publisher {
|
|
|
200
155
|
declare class FilePublisher implements Publisher {
|
|
201
156
|
private path;
|
|
202
157
|
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;
|
|
158
|
+
publish(notes: ReleaseNotes, format: OutputFormat, preformatted?: string): Promise<void>;
|
|
263
159
|
}
|
|
264
160
|
|
|
265
161
|
type SemverBump = 'patch' | 'minor' | 'major';
|
|
@@ -301,6 +197,9 @@ declare function analyzeReleaseReadiness(cwd?: string): ReleaseAdvisory;
|
|
|
301
197
|
*
|
|
302
198
|
* Free tier (no key): provider=none, publish to stdout/file only
|
|
303
199
|
* Pro tier (with key): all providers, all publishers, all enrichments
|
|
200
|
+
*
|
|
201
|
+
* validateLicense() performs async remote validation with caching.
|
|
202
|
+
* resolveLicense() remains sync for quick format-only checks (display).
|
|
304
203
|
*/
|
|
305
204
|
type LicenseTier = 'free' | 'pro';
|
|
306
205
|
interface LicenseStatus {
|
|
@@ -310,9 +209,15 @@ interface LicenseStatus {
|
|
|
310
209
|
}
|
|
311
210
|
/**
|
|
312
211
|
* Resolve the user's license tier from CULLIT_API_KEY env var.
|
|
313
|
-
*
|
|
212
|
+
* Sync format-only check — use for display, not enforcement.
|
|
314
213
|
*/
|
|
315
214
|
declare function resolveLicense(): LicenseStatus;
|
|
215
|
+
/**
|
|
216
|
+
* Validate the license asynchronously with remote server validation.
|
|
217
|
+
* Falls back to format-only check if offline or no validation URL configured.
|
|
218
|
+
* Results are cached for 24 hours per key.
|
|
219
|
+
*/
|
|
220
|
+
declare function validateLicense(): Promise<LicenseStatus>;
|
|
316
221
|
/**
|
|
317
222
|
* Check whether the current license allows the requested provider.
|
|
318
223
|
*/
|
|
@@ -330,6 +235,42 @@ declare function isEnrichmentAllowed(license: LicenseStatus): boolean;
|
|
|
330
235
|
*/
|
|
331
236
|
declare function upgradeMessage(feature: string): string;
|
|
332
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Plugin Registry — the seam between free (core) and pro features.
|
|
240
|
+
*
|
|
241
|
+
* Core registers: git collector, template generator, stdout/file publishers.
|
|
242
|
+
* Pro registers: AI generator, Jira/Linear collectors + enrichers, Slack/Discord/GitHub publishers.
|
|
243
|
+
*
|
|
244
|
+
* The CLI calls `await import('@cullit/pro')` to load pro plugins if installed.
|
|
245
|
+
*/
|
|
246
|
+
|
|
247
|
+
type CollectorFactory = (...args: any[]) => Collector;
|
|
248
|
+
type EnricherFactory = (...args: any[]) => Enricher;
|
|
249
|
+
type GeneratorFactory = (...args: any[]) => Generator;
|
|
250
|
+
type PublisherFactory = (...args: any[]) => Publisher;
|
|
251
|
+
declare function registerCollector(type: string, factory: CollectorFactory): void;
|
|
252
|
+
declare function registerEnricher(type: string, factory: EnricherFactory): void;
|
|
253
|
+
declare function registerGenerator(provider: string, factory: GeneratorFactory): void;
|
|
254
|
+
declare function registerPublisher(type: string, factory: PublisherFactory): void;
|
|
255
|
+
declare function getCollector(type: string): CollectorFactory | undefined;
|
|
256
|
+
declare function getEnricher(type: string): EnricherFactory | undefined;
|
|
257
|
+
declare function getGenerator(provider: string): GeneratorFactory | undefined;
|
|
258
|
+
declare function getPublisher(type: string): PublisherFactory | undefined;
|
|
259
|
+
declare function hasGenerator(provider: string): boolean;
|
|
260
|
+
declare function hasCollector(type: string): boolean;
|
|
261
|
+
declare function hasPublisher(type: string): boolean;
|
|
262
|
+
declare function hasEnricher(type: string): boolean;
|
|
263
|
+
declare function listCollectors(): string[];
|
|
264
|
+
declare function listEnrichers(): string[];
|
|
265
|
+
declare function listGenerators(): string[];
|
|
266
|
+
declare function listPublishers(): string[];
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Shared fetch wrapper with timeout support.
|
|
270
|
+
* Prevents hanging on unresponsive external APIs.
|
|
271
|
+
*/
|
|
272
|
+
declare function fetchWithTimeout(url: string, init: RequestInit, timeoutMs?: number): Promise<Response>;
|
|
273
|
+
|
|
333
274
|
/**
|
|
334
275
|
* Main pipeline: Collect → Enrich → Generate → Format → Publish
|
|
335
276
|
*/
|
|
@@ -339,4 +280,4 @@ declare function runPipeline(from: string, to: string, config: CullConfig, optio
|
|
|
339
280
|
logger?: Logger;
|
|
340
281
|
}): Promise<PipelineResult>;
|
|
341
282
|
|
|
342
|
-
export {
|
|
283
|
+
export { AI_PROVIDERS, AUDIENCES, CHANGE_CATEGORIES, type ChangeCategory, type ChangeEntry, type Collector, type CollectorFactory, DEFAULT_CATEGORIES, DEFAULT_MODELS, ENRICHMENT_TYPES, 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, OUTPUT_FORMATS, PUBLISHER_TYPES, type PipelineResult, type Publisher, type PublisherFactory, type ReleaseAdvisory, type ReleaseNotes, SOURCE_TYPES, type SemverBump, StdoutPublisher, TONES, TemplateGenerator, VERSION, analyzeReleaseReadiness, createLogger, fetchWithTimeout, formatNotes, getCollector, getEnricher, getFormatter, getGenerator, getLatestTag, getPublisher, getRecentTags, hasCollector, hasEnricher, hasGenerator, hasPublisher, isEnrichmentAllowed, isProviderAllowed, isPublisherAllowed, listCollectors, listEnrichers, listFormatters, listGenerators, listPublishers, registerCollector, registerEnricher, registerFormatter, registerGenerator, registerPublisher, resolveLicense, runPipeline, upgradeMessage, validateLicense };
|