peterfei/ai-agent-team / .claude/skills/changelog-generator
changelog-generator
Verified智能变更日志生成器 - 自动分析Git提交历史,生成符合规范的CHANGELOG.md。支持语义化版本管理、多种输出格式、增量更新和GitHub/GitLab集成。
| File | Kind | Size |
|---|---|---|
| .gitignore | other | 352 B |
| .npmignore | other | 14 B |
| CHANGELOG.md | markdown | 1.7 KB |
| LICENSE | other | 1.0 KB |
| README.md | markdown | 12.9 KB |
| SKILL.md | skill md | 9.7 KB |
| bin/cli.jsexecutable | script | 17.0 KB |
| docs/PHASE2_IMPLEMENTATION_SUMMARY.md | markdown | 9.8 KB |
| examples/default-config.json | config | 1.7 KB |
| jest.config.js | script | 356 B |
| package.json | manifest | 1.2 KB |
| src/core/ChangelogGenerator.js | script | 8.9 KB |
| src/core/CommitClassifier.js | script | 7.3 KB |
| src/core/GitAnalyzer.js | script | 7.4 KB |
| src/exporters/HTMLExporter.js | script | 15.7 KB |
| src/index.js | script | 389 B |
| src/integrations/GitHubIntegration.js | script | 7.3 KB |
| src/utils/ConfigLoader.js | script | 4.7 KB |
| src/utils/TemplateManager.js | script | 8.5 KB |
| tests/unit/ChangelogGenerator.test.js | script | 7.6 KB |
| tests/unit/CommitClassifier.test.js | script | 6.3 KB |
| tests/unit/GitAnalyzer.test.js | script | 4.5 KB |
| tests/unit/GitHubIntegration.test.js | script | 13.9 KB |
| tests/unit/HTMLExporter.test.js | script | 12.3 KB |
| tests/unit/TemplateManager.test.js | script | 10.4 KB |
tests/unit/HTMLExporter.test.js
View on GitHubconst HTMLExporter = require('../../src/exporters/HTMLExporter');
describe('HTMLExporter', () => {
let exporter;
let config;
beforeEach(() => {
config = {
display: {
emoji: true,
showAuthor: true
},
template: {
prUrl: 'https://github.com/owner/repo/pull/{{id}}',
issueUrl: 'https://github.com/owner/repo/issues/{{id}}',
commitUrl: 'https://github.com/owner/repo/commit/{{hash}}'
}
};
exporter = new HTMLExporter(config);
});
describe('HTML Export', () => {
test('should export basic HTML structure', () => {
const data = {
title: 'Test Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [
{
section: 'Features',
emoji: '✨',
commits: [
{
type: 'feat',
scope: 'core',
subject: 'Add new feature',
author: 'test-user',
references: { prs: [42], issues: [] }
}
]
}
],
breaking: []
}
],
stats: {
total: 10,
included: 8,
excluded: 2,
breaking: 0,
authors: ['test-user'],
byType: { feat: 5, fix: 3 }
}
};
const html = exporter.export(data);
// 验证基本 HTML 结构
expect(html).toContain('<!DOCTYPE html>');
expect(html).toContain('<html lang="zh-CN">');
expect(html).toContain('<title>Test Changelog</title>');
expect(html).toContain('</html>');
});
test('should include version information', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('[1.0.0]');
expect(html).toContain('已发布');
});
test('should include unreleased badge', () => {
const data = {
title: 'Changelog',
versions: [
{
version: 'Unreleased',
date: null,
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('[Unreleased]');
expect(html).toContain('未发布');
});
test('should render features section', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [
{
section: 'Features',
emoji: '✨',
commits: [
{
type: 'feat',
scope: 'api',
subject: 'Add REST API',
author: 'dev1',
references: { prs: [], issues: [] }
}
]
}
],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('Features');
expect(html).toContain('✨');
expect(html).toContain('api');
expect(html).toContain('Add REST API');
});
test('should render breaking changes', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '2.0.0',
date: '2025-12-03',
changes: [],
breaking: [
{
type: 'feat',
scope: 'auth',
subject: 'Remove deprecated API',
references: { prs: [99], issues: [] }
}
]
}
]
};
const html = exporter.export(data);
expect(html).toContain('BREAKING CHANGES');
expect(html).toContain('💥');
expect(html).toContain('Remove deprecated API');
});
test('should include PR links', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [
{
section: 'Bug Fixes',
emoji: '🐛',
commits: [
{
type: 'fix',
subject: 'Fix critical bug',
author: 'dev2',
references: { prs: [123], issues: [] }
}
]
}
],
breaking: []
}
]
};
const html = exporter.export(data);
// PR link should exist in some form (the template renders it with prLink helper)
expect(html).toContain('#123');
expect(html).toContain('Fix critical bug');
});
test('should include author information', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [
{
section: 'Features',
emoji: '✨',
commits: [
{
type: 'feat',
subject: 'New feature',
author: 'john-doe',
references: { prs: [], issues: [] }
}
]
}
],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('by @john-doe');
});
test('should include statistics', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [],
breaking: []
}
],
stats: {
total: 100,
included: 85,
excluded: 15,
breaking: 3,
authors: ['dev1', 'dev2', 'dev3'],
byType: { feat: 50, fix: 35 }
}
};
const html = exporter.export(data);
expect(html).toContain('统计信息');
expect(html).toContain('100'); // total
expect(html).toContain('85'); // included
expect(html).toContain('3'); // breaking
expect(html).toContain('3'); // authors count
});
test('should include search box', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('<input');
expect(html).toContain('searchInput');
expect(html).toContain('搜索版本、功能或修复');
});
test('should include JavaScript for interactivity', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('<script>');
expect(html).toContain('addEventListener');
expect(html).toContain('searchInput');
});
test('should include CSS styles', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('<style>');
expect(html).toContain('.container');
expect(html).toContain('.version');
expect(html).toContain('.commit-item');
});
test('should be responsive', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('@media (max-width: 768px)');
expect(html).toContain('viewport');
});
test('should include print styles', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('@media print');
});
});
describe('Handlebars Helpers', () => {
test('formatDate helper should format dates', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03T00:00:00Z',
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
// Should contain formatted date (Chinese locale)
expect(html).toContain('2025');
expect(html).toContain('12');
expect(html).toContain('3');
});
test('commitLink helper should create links', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [
{
section: 'Features',
emoji: '✨',
commits: [
{
type: 'feat',
subject: 'Test',
hash: 'abc123def456',
shortHash: 'abc123',
references: { prs: [], issues: [] }
}
]
}
],
breaking: []
}
]
};
const html = exporter.export(data);
// Should create proper commit links
expect(html).toContain('commit-link');
});
});
describe('Edge Cases', () => {
test('should handle empty versions array', () => {
const data = {
title: 'Changelog',
versions: []
};
const html = exporter.export(data);
expect(html).toContain('<!DOCTYPE html>');
expect(html).toContain('Changelog');
});
test('should handle version without changes', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('[1.0.0]');
// Check that no actual commit items are rendered (not just CSS class name)
// by checking if li.commit-item exists as an HTML element
expect(html).not.toMatch(/<li class="commit-item">/);
});
test('should handle commits without scope', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [
{
section: 'Features',
emoji: '✨',
commits: [
{
type: 'feat',
scope: null,
subject: 'Feature without scope',
references: { prs: [], issues: [] }
}
]
}
],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('Feature without scope');
expect(html).not.toContain('null:');
});
test('should handle commits without author', () => {
const data = {
title: 'Changelog',
versions: [
{
version: '1.0.0',
date: '2025-12-03',
changes: [
{
section: 'Features',
emoji: '✨',
commits: [
{
type: 'feat',
subject: 'Anonymous commit',
author: null,
references: { prs: [], issues: [] }
}
]
}
],
breaking: []
}
]
};
const html = exporter.export(data);
expect(html).toContain('Anonymous commit');
});
});
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 198k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |