specweave 0.17.15 → 0.17.17
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/CLAUDE.md +405 -2495
- package/README.md +92 -2
- package/dist/locales/de/.gitkeep +0 -0
- package/dist/locales/de/cli.json +108 -0
- package/dist/locales/en/cli.json +287 -0
- package/dist/locales/en/errors.json +7 -0
- package/dist/locales/en/templates.json +6 -0
- package/dist/locales/es/.gitkeep +0 -0
- package/dist/locales/es/cli.json +41 -0
- package/dist/locales/fr/.gitkeep +0 -0
- package/dist/locales/fr/cli.json +108 -0
- package/dist/locales/ja/.gitkeep +0 -0
- package/dist/locales/ja/cli.json +108 -0
- package/dist/locales/ko/.gitkeep +0 -0
- package/dist/locales/ko/cli.json +108 -0
- package/dist/locales/pt/.gitkeep +0 -0
- package/dist/locales/pt/cli.json +108 -0
- package/dist/locales/ru/.gitkeep +0 -0
- package/dist/locales/ru/cli.json +269 -0
- package/dist/locales/zh/.gitkeep +0 -0
- package/dist/locales/zh/cli.json +108 -0
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +188 -36
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts +54 -0
- package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-status-sync.js +86 -0
- package/dist/plugins/specweave-ado/lib/ado-status-sync.js.map +1 -0
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts +25 -0
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js +191 -0
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +139 -0
- package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/duplicate-detector.js +389 -0
- package/dist/plugins/specweave-github/lib/duplicate-detector.js.map +1 -0
- package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts +26 -0
- package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/enhanced-github-sync.js +249 -0
- package/dist/plugins/specweave-github/lib/enhanced-github-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-client.d.ts +1 -1
- package/dist/plugins/specweave-github/lib/github-client.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-client.js +25 -13
- package/dist/plugins/specweave-github/lib/github-client.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +83 -0
- package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-epic-sync.js +451 -0
- package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-status-sync.d.ts +43 -0
- package/dist/plugins/specweave-github/lib/github-status-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-status-sync.js +82 -0
- package/dist/plugins/specweave-github/lib/github-status-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/task-sync.d.ts +5 -0
- package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/task-sync.js +38 -2
- package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts +26 -0
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js +195 -0
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts +66 -0
- package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-epic-sync.js +274 -0
- package/dist/plugins/specweave-jira/lib/jira-epic-sync.js.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts +56 -0
- package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-status-sync.js +93 -0
- package/dist/plugins/specweave-jira/lib/jira-status-sync.js.map +1 -0
- package/dist/spec-parser.js +629 -0
- package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.js +48 -3
- package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts +142 -0
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -0
- package/dist/src/core/living-docs/hierarchy-mapper.js +453 -0
- package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -0
- package/dist/src/core/living-docs/index.d.ts +10 -84
- package/dist/src/core/living-docs/index.d.ts.map +1 -1
- package/dist/src/core/living-docs/index.js +10 -164
- package/dist/src/core/living-docs/index.js.map +1 -1
- package/dist/src/core/living-docs/spec-distributor.d.ts +106 -0
- package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -0
- package/dist/src/core/living-docs/spec-distributor.js +823 -0
- package/dist/src/core/living-docs/spec-distributor.js.map +1 -0
- package/dist/src/core/living-docs/types.d.ts +201 -0
- package/dist/src/core/living-docs/types.d.ts.map +1 -0
- package/dist/src/core/living-docs/types.js +15 -0
- package/dist/src/core/living-docs/types.js.map +1 -0
- package/dist/src/core/logging/prompt-logger.d.ts +70 -0
- package/dist/src/core/logging/prompt-logger.d.ts.map +1 -0
- package/dist/src/core/logging/prompt-logger.js +247 -0
- package/dist/src/core/logging/prompt-logger.js.map +1 -0
- package/dist/src/core/status-line/status-line-manager.d.ts +15 -24
- package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
- package/dist/src/core/status-line/status-line-manager.js +33 -70
- package/dist/src/core/status-line/status-line-manager.js.map +1 -1
- package/dist/src/core/status-line/types.d.ts +19 -31
- package/dist/src/core/status-line/types.d.ts.map +1 -1
- package/dist/src/core/status-line/types.js +5 -9
- package/dist/src/core/status-line/types.js.map +1 -1
- package/dist/src/core/sync/conflict-resolver.d.ts +66 -0
- package/dist/src/core/sync/conflict-resolver.d.ts.map +1 -0
- package/dist/src/core/sync/conflict-resolver.js +108 -0
- package/dist/src/core/sync/conflict-resolver.js.map +1 -0
- package/dist/src/core/sync/enhanced-content-builder.d.ts +77 -0
- package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -0
- package/dist/src/core/sync/enhanced-content-builder.js +199 -0
- package/dist/src/core/sync/enhanced-content-builder.js.map +1 -0
- package/dist/src/core/sync/label-detector.d.ts +66 -0
- package/dist/src/core/sync/label-detector.d.ts.map +1 -0
- package/dist/src/core/sync/label-detector.js +211 -0
- package/dist/src/core/sync/label-detector.js.map +1 -0
- package/dist/src/core/sync/retry-logic.d.ts +64 -0
- package/dist/src/core/sync/retry-logic.d.ts.map +1 -0
- package/dist/src/core/sync/retry-logic.js +165 -0
- package/dist/src/core/sync/retry-logic.js.map +1 -0
- package/dist/src/core/sync/spec-content-sync.d.ts +88 -0
- package/dist/src/core/sync/spec-content-sync.d.ts.map +1 -0
- package/dist/src/core/sync/spec-content-sync.js +5 -0
- package/dist/src/core/sync/spec-content-sync.js.map +1 -0
- package/dist/src/core/sync/spec-increment-mapper.d.ts +100 -0
- package/dist/src/core/sync/spec-increment-mapper.d.ts.map +1 -0
- package/dist/src/core/sync/spec-increment-mapper.js +424 -0
- package/dist/src/core/sync/spec-increment-mapper.js.map +1 -0
- package/dist/src/core/sync/status-cache.d.ts +91 -0
- package/dist/src/core/sync/status-cache.d.ts.map +1 -0
- package/dist/src/core/sync/status-cache.js +140 -0
- package/dist/src/core/sync/status-cache.js.map +1 -0
- package/dist/src/core/sync/status-mapper.d.ts +69 -0
- package/dist/src/core/sync/status-mapper.d.ts.map +1 -0
- package/dist/src/core/sync/status-mapper.js +90 -0
- package/dist/src/core/sync/status-mapper.js.map +1 -0
- package/dist/src/core/sync/status-sync-engine.d.ts +162 -0
- package/dist/src/core/sync/status-sync-engine.d.ts.map +1 -0
- package/dist/src/core/sync/status-sync-engine.js +347 -0
- package/dist/src/core/sync/status-sync-engine.js.map +1 -0
- package/dist/src/core/sync/sync-event-logger.d.ts +99 -0
- package/dist/src/core/sync/sync-event-logger.d.ts.map +1 -0
- package/dist/src/core/sync/sync-event-logger.js +103 -0
- package/dist/src/core/sync/sync-event-logger.js.map +1 -0
- package/dist/src/core/sync/workflow-detector.d.ts +95 -0
- package/dist/src/core/sync/workflow-detector.d.ts.map +1 -0
- package/dist/src/core/sync/workflow-detector.js +175 -0
- package/dist/src/core/sync/workflow-detector.js.map +1 -0
- package/dist/src/core/types/config.d.ts.map +1 -1
- package/dist/src/core/types/config.js +31 -0
- package/dist/src/core/types/config.js.map +1 -1
- package/dist/src/utils/github-url.d.ts +53 -0
- package/dist/src/utils/github-url.d.ts.map +1 -0
- package/dist/src/utils/github-url.js +90 -0
- package/dist/src/utils/github-url.js.map +1 -0
- package/dist/src/utils/plugin-validator.d.ts +9 -0
- package/dist/src/utils/plugin-validator.d.ts.map +1 -1
- package/dist/src/utils/plugin-validator.js +86 -19
- package/dist/src/utils/plugin-validator.js.map +1 -1
- package/dist/src/utils/spec-parser.d.ts +145 -0
- package/dist/src/utils/spec-parser.d.ts.map +1 -0
- package/dist/src/utils/spec-parser.js +640 -0
- package/dist/src/utils/spec-parser.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
- package/plugins/specweave/agents/pm/AGENT.md +1 -1
- package/plugins/specweave/agents/pm/templates/increment-spec.md +158 -0
- package/plugins/specweave/agents/pm/templates/living-docs-spec.md +113 -0
- package/plugins/specweave/commands/specweave-done.md +163 -0
- package/plugins/specweave/hooks/lib/update-status-line.sh +79 -111
- package/plugins/specweave/hooks/post-increment-planning.sh +107 -35
- package/plugins/specweave/lib/hooks/sync-living-docs.js +139 -34
- package/plugins/specweave/lib/hooks/sync-living-docs.ts +234 -38
- package/plugins/specweave/skills/SKILLS-INDEX.md +4 -24
- package/plugins/specweave/skills/increment-planner/SKILL.md +94 -0
- package/plugins/specweave/skills/increment-work-router/SKILL.md +466 -0
- package/plugins/specweave/skills/plugin-validator/SKILL.md +16 -13
- package/plugins/specweave-ado/lib/ado-status-sync.js +80 -0
- package/plugins/specweave-ado/lib/ado-status-sync.ts +121 -0
- package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
- package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +205 -0
- package/plugins/specweave-github/commands/specweave-github-sync-epic.md +248 -0
- package/plugins/specweave-github/lib/duplicate-detector.js +370 -0
- package/plugins/specweave-github/lib/duplicate-detector.ts +525 -0
- package/plugins/specweave-github/lib/enhanced-github-sync.js +220 -0
- package/plugins/specweave-github/lib/enhanced-github-sync.ts +322 -0
- package/plugins/specweave-github/lib/github-client.js +21 -10
- package/plugins/specweave-github/lib/github-client.ts +27 -16
- package/plugins/specweave-github/lib/github-epic-sync.js +489 -0
- package/plugins/specweave-github/lib/github-epic-sync.ts +690 -0
- package/plugins/specweave-github/lib/github-status-sync.js +71 -0
- package/plugins/specweave-github/lib/github-status-sync.ts +107 -0
- package/plugins/specweave-github/lib/task-sync.js +33 -2
- package/plugins/specweave-github/lib/task-sync.ts +44 -2
- package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +267 -0
- package/plugins/specweave-jira/lib/enhanced-jira-sync.ts.disabled +222 -0
- package/plugins/specweave-jira/lib/jira-epic-sync.js +304 -0
- package/plugins/specweave-jira/lib/jira-epic-sync.ts +459 -0
- package/plugins/specweave-jira/lib/jira-status-sync.js +79 -0
- package/plugins/specweave-jira/lib/jira-status-sync.ts +139 -0
- package/src/templates/AGENTS.md.template +88 -1
- package/src/templates/CLAUDE.md.template +49 -0
- package/plugins/specweave/skills/increment-quality-judge/SKILL.md +0 -524
- package/plugins/specweave/skills/plugin-installer/SKILL.md +0 -353
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Content Builder
|
|
3
|
+
*
|
|
4
|
+
* Builds rich external issue descriptions with full spec content including:
|
|
5
|
+
* - Executive summary
|
|
6
|
+
* - User stories with collapsible sections
|
|
7
|
+
* - Acceptance criteria
|
|
8
|
+
* - Task links with GitHub issue numbers
|
|
9
|
+
* - Architecture references
|
|
10
|
+
* - Source links
|
|
11
|
+
*/
|
|
12
|
+
export class EnhancedContentBuilder {
|
|
13
|
+
/**
|
|
14
|
+
* Build complete external issue description with all spec content
|
|
15
|
+
*/
|
|
16
|
+
buildExternalDescription(spec) {
|
|
17
|
+
const sections = [];
|
|
18
|
+
// Summary section
|
|
19
|
+
sections.push(this.buildSummarySection(spec));
|
|
20
|
+
// User stories section
|
|
21
|
+
if (spec.userStories && spec.userStories.length > 0) {
|
|
22
|
+
sections.push(this.buildUserStoriesSection(spec.userStories));
|
|
23
|
+
}
|
|
24
|
+
// Tasks section
|
|
25
|
+
if (spec.taskMapping) {
|
|
26
|
+
sections.push(this.buildTasksSection(spec.taskMapping));
|
|
27
|
+
}
|
|
28
|
+
// Architecture section
|
|
29
|
+
if (spec.architectureDocs && spec.architectureDocs.length > 0) {
|
|
30
|
+
sections.push(this.buildArchitectureSection(spec.architectureDocs));
|
|
31
|
+
}
|
|
32
|
+
// Source links section
|
|
33
|
+
if (spec.sourceLinks) {
|
|
34
|
+
sections.push(this.buildSourceLinksSection(spec.sourceLinks));
|
|
35
|
+
}
|
|
36
|
+
return sections.filter(s => s.length > 0).join('\n\n---\n\n');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Build summary section with executive overview
|
|
40
|
+
*/
|
|
41
|
+
buildSummarySection(spec) {
|
|
42
|
+
return `## Summary\n\n${spec.summary || spec.description}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build user stories section with collapsible GitHub sections
|
|
46
|
+
*/
|
|
47
|
+
buildUserStoriesSection(userStories) {
|
|
48
|
+
const lines = ['## User Stories'];
|
|
49
|
+
for (const story of userStories) {
|
|
50
|
+
lines.push('');
|
|
51
|
+
lines.push(`<details>`);
|
|
52
|
+
lines.push(`<summary><strong>${story.id}: ${story.title}</strong></summary>`);
|
|
53
|
+
lines.push('');
|
|
54
|
+
if (story.acceptanceCriteria && story.acceptanceCriteria.length > 0) {
|
|
55
|
+
lines.push('**Acceptance Criteria**:');
|
|
56
|
+
for (const ac of story.acceptanceCriteria) {
|
|
57
|
+
const priority = ac.priority ? ` (${ac.priority}` : '';
|
|
58
|
+
const testable = ac.testable ? ', testable)' : ')';
|
|
59
|
+
const suffix = priority || ac.testable ? `${priority}${testable}` : '';
|
|
60
|
+
const checkbox = ac.completed ? '[x]' : '[ ]';
|
|
61
|
+
lines.push(`- ${checkbox} **${ac.id}**: ${ac.description}${suffix}`);
|
|
62
|
+
}
|
|
63
|
+
lines.push('');
|
|
64
|
+
}
|
|
65
|
+
lines.push('</details>');
|
|
66
|
+
}
|
|
67
|
+
return lines.join('\n');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Build tasks section with checkboxes (GitHub/Jira/ADO compatible)
|
|
71
|
+
*
|
|
72
|
+
* NEW: Shows tasks as checkboxes with completion status
|
|
73
|
+
*/
|
|
74
|
+
buildTasksSection(taskMapping, options) {
|
|
75
|
+
const { showCheckboxes = true, showProgressBar = true, showCompletionStatus = true, provider = 'github' } = options || {};
|
|
76
|
+
const lines = ['## Tasks'];
|
|
77
|
+
lines.push('');
|
|
78
|
+
// Calculate progress
|
|
79
|
+
const total = taskMapping.tasks.length;
|
|
80
|
+
const completed = taskMapping.tasks.filter(t => t.completed || t.status === 'completed').length;
|
|
81
|
+
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
|
82
|
+
// Progress header with count
|
|
83
|
+
lines.push(`**Progress**: ${completed}/${total} tasks completed (${percent}%)`);
|
|
84
|
+
lines.push('');
|
|
85
|
+
// Progress bar (visual)
|
|
86
|
+
if (showProgressBar && total > 0) {
|
|
87
|
+
const barWidth = 12;
|
|
88
|
+
const filled = Math.round((completed / total) * barWidth);
|
|
89
|
+
const bar = '█'.repeat(filled) + '░'.repeat(barWidth - filled);
|
|
90
|
+
lines.push(`\`${bar}\` ${percent}%`);
|
|
91
|
+
lines.push('');
|
|
92
|
+
}
|
|
93
|
+
// Tasks list
|
|
94
|
+
if (showCheckboxes) {
|
|
95
|
+
// Show tasks as checkboxes (provider-specific format)
|
|
96
|
+
for (const task of taskMapping.tasks) {
|
|
97
|
+
const isCompleted = task.completed || task.status === 'completed';
|
|
98
|
+
// Provider-specific checkbox format
|
|
99
|
+
let checkbox;
|
|
100
|
+
if (provider === 'jira') {
|
|
101
|
+
// Jira uses (x) for checked, ( ) for unchecked
|
|
102
|
+
checkbox = isCompleted ? '(x)' : '( )';
|
|
103
|
+
}
|
|
104
|
+
else if (provider === 'ado') {
|
|
105
|
+
// ADO uses HTML checkboxes (rendered in description)
|
|
106
|
+
checkbox = isCompleted ? '[x]' : '[ ]';
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// GitHub uses markdown checkboxes
|
|
110
|
+
checkbox = isCompleted ? '[x]' : '[ ]';
|
|
111
|
+
}
|
|
112
|
+
const statusEmoji = isCompleted && showCompletionStatus && provider === 'github' ? ' ✅' : '';
|
|
113
|
+
// Issue link (provider-specific)
|
|
114
|
+
let issueLink = '';
|
|
115
|
+
if (provider === 'github' && task.githubIssue) {
|
|
116
|
+
issueLink = ` [#${task.githubIssue}](https://github.com/issue/${task.githubIssue})`;
|
|
117
|
+
}
|
|
118
|
+
else if (provider === 'jira' && task.jiraIssue) {
|
|
119
|
+
issueLink = ` [${task.jiraIssue}]`;
|
|
120
|
+
}
|
|
121
|
+
else if (provider === 'ado' && task.adoWorkItem) {
|
|
122
|
+
issueLink = ` [#${task.adoWorkItem}]`;
|
|
123
|
+
}
|
|
124
|
+
// User stories
|
|
125
|
+
const userStories = task.userStories && task.userStories.length > 0
|
|
126
|
+
? ` (implements ${task.userStories.join(', ')})`
|
|
127
|
+
: '';
|
|
128
|
+
lines.push(`- ${checkbox} **${task.id}**: ${task.title}${userStories}${issueLink}${statusEmoji}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// Fallback: show as bullet list (backward compatibility)
|
|
133
|
+
for (const task of taskMapping.tasks) {
|
|
134
|
+
const issueLink = task.githubIssue ? ` (#${task.githubIssue})` : '';
|
|
135
|
+
lines.push(`- **${task.id}**: ${task.title}${issueLink}`);
|
|
136
|
+
if (task.userStories && task.userStories.length > 0) {
|
|
137
|
+
lines.push(` - Implements: ${task.userStories.join(', ')}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
lines.push('');
|
|
142
|
+
lines.push(`**Full task list**: [tasks.md](${taskMapping.tasksUrl})`);
|
|
143
|
+
return lines.join('\n');
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Build architecture references section
|
|
147
|
+
*/
|
|
148
|
+
buildArchitectureSection(architectureDocs) {
|
|
149
|
+
if (architectureDocs.length === 0) {
|
|
150
|
+
return '';
|
|
151
|
+
}
|
|
152
|
+
const lines = ['## Architecture'];
|
|
153
|
+
lines.push('');
|
|
154
|
+
// Group by type
|
|
155
|
+
const adrs = architectureDocs.filter(doc => doc.type === 'adr');
|
|
156
|
+
const hlds = architectureDocs.filter(doc => doc.type === 'hld');
|
|
157
|
+
const diagrams = architectureDocs.filter(doc => doc.type === 'diagram');
|
|
158
|
+
if (adrs.length > 0) {
|
|
159
|
+
lines.push('**Architecture Decision Records (ADRs)**:');
|
|
160
|
+
for (const adr of adrs) {
|
|
161
|
+
lines.push(`- [${adr.title}](${adr.path})`);
|
|
162
|
+
}
|
|
163
|
+
lines.push('');
|
|
164
|
+
}
|
|
165
|
+
if (hlds.length > 0) {
|
|
166
|
+
lines.push('**High-Level Design (HLD)**:');
|
|
167
|
+
for (const hld of hlds) {
|
|
168
|
+
lines.push(`- [${hld.title}](${hld.path})`);
|
|
169
|
+
}
|
|
170
|
+
lines.push('');
|
|
171
|
+
}
|
|
172
|
+
if (diagrams.length > 0) {
|
|
173
|
+
lines.push('**Diagrams**:');
|
|
174
|
+
for (const diagram of diagrams) {
|
|
175
|
+
lines.push(`- [${diagram.title}](${diagram.path})`);
|
|
176
|
+
}
|
|
177
|
+
lines.push('');
|
|
178
|
+
}
|
|
179
|
+
return lines.join('\n').trim();
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Build source links section
|
|
183
|
+
*/
|
|
184
|
+
buildSourceLinksSection(sourceLinks) {
|
|
185
|
+
const lines = ['## Source'];
|
|
186
|
+
lines.push('');
|
|
187
|
+
if (sourceLinks.spec) {
|
|
188
|
+
lines.push(`- [spec.md](${sourceLinks.spec})`);
|
|
189
|
+
}
|
|
190
|
+
if (sourceLinks.plan) {
|
|
191
|
+
lines.push(`- [plan.md](${sourceLinks.plan})`);
|
|
192
|
+
}
|
|
193
|
+
if (sourceLinks.tasks) {
|
|
194
|
+
lines.push(`- [tasks.md](${sourceLinks.tasks})`);
|
|
195
|
+
}
|
|
196
|
+
return lines.join('\n');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=enhanced-content-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced-content-builder.js","sourceRoot":"","sources":["../../../../src/core/sync/enhanced-content-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAwCH,MAAM,OAAO,sBAAsB;IACjC;;OAEG;IACH,wBAAwB,CAAC,IAAyB;QAChD,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,kBAAkB;QAClB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;QAE9C,u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,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC5B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC/B,KAAK,CAAC,IAAI,CAAC,MAAM,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;YACtD,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,uBAAuB,CAAC,WAAwB;QAC9C,MAAM,KAAK,GAAa,CAAC,WAAW,CAAC,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEf,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAAC,eAAe,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAAC,eAAe,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,gBAAgB,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Label Detector
|
|
3
|
+
*
|
|
4
|
+
* Detects increment type and applies appropriate labels for external tools.
|
|
5
|
+
* Supports GitHub labels, Jira labels, and ADO tags.
|
|
6
|
+
*
|
|
7
|
+
* @author SpecWeave Team
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
export type IncrementType = 'bug' | 'feature' | 'docs' | 'hotfix' | 'refactor' | 'chore' | 'experiment';
|
|
11
|
+
export interface LabelConfig {
|
|
12
|
+
bug: string;
|
|
13
|
+
feature: string;
|
|
14
|
+
docs: string;
|
|
15
|
+
hotfix?: string;
|
|
16
|
+
refactor?: string;
|
|
17
|
+
chore?: string;
|
|
18
|
+
experiment?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DetectionResult {
|
|
21
|
+
type: IncrementType;
|
|
22
|
+
confidence: number;
|
|
23
|
+
labels: string[];
|
|
24
|
+
detectionMethod: 'frontmatter' | 'title' | 'content' | 'filename';
|
|
25
|
+
}
|
|
26
|
+
export declare class LabelDetector {
|
|
27
|
+
private labelConfig;
|
|
28
|
+
constructor(labelConfig?: Partial<LabelConfig>, useUserFormat?: boolean);
|
|
29
|
+
/**
|
|
30
|
+
* Detect increment type from spec content
|
|
31
|
+
*/
|
|
32
|
+
detectType(specContent: string, incrementId?: string): DetectionResult;
|
|
33
|
+
/**
|
|
34
|
+
* Detect from YAML frontmatter (type: bug, type: feature, etc.)
|
|
35
|
+
*/
|
|
36
|
+
private detectFromFrontmatter;
|
|
37
|
+
/**
|
|
38
|
+
* Detect from title/heading (# Fix: Bug Title, # Feature: New Feature, etc.)
|
|
39
|
+
*/
|
|
40
|
+
private detectFromTitle;
|
|
41
|
+
/**
|
|
42
|
+
* Detect from increment filename (0001-bugfix-auth, 0002-feature-dashboard, etc.)
|
|
43
|
+
*/
|
|
44
|
+
private detectFromFilename;
|
|
45
|
+
/**
|
|
46
|
+
* Detect from content keywords
|
|
47
|
+
*/
|
|
48
|
+
private detectFromContent;
|
|
49
|
+
/**
|
|
50
|
+
* Get labels for GitHub (standard format)
|
|
51
|
+
*/
|
|
52
|
+
getGitHubLabels(type: IncrementType): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Get labels for Jira (supports labels)
|
|
55
|
+
*/
|
|
56
|
+
getJiraLabels(type: IncrementType): string[];
|
|
57
|
+
/**
|
|
58
|
+
* Get tags for Azure DevOps (supports tags)
|
|
59
|
+
*/
|
|
60
|
+
getAdoTags(type: IncrementType): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Get user-friendly labels (with brackets: [Bug], [Feature], etc.)
|
|
63
|
+
*/
|
|
64
|
+
getUserLabels(type: IncrementType): string[];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=label-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-detector.d.ts","sourceRoot":"","sources":["../../../../src/core/sync/label-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC;AAExG,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;CACnE;AAsBD,qBAAa,aAAa;IACxB,OAAO,CAAC,WAAW,CAAc;gBAErB,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,aAAa,GAAE,OAAc;IAK7E;;OAEG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe;IAyBtE;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;OAEG;IACH,OAAO,CAAC,eAAe;IA8BvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6B1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA0CzB;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE;IAc9C;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE;IAI5C;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE;IAIzC;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE;CAG7C"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Label Detector
|
|
3
|
+
*
|
|
4
|
+
* Detects increment type and applies appropriate labels for external tools.
|
|
5
|
+
* Supports GitHub labels, Jira labels, and ADO tags.
|
|
6
|
+
*
|
|
7
|
+
* @author SpecWeave Team
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_GITHUB_LABELS = {
|
|
11
|
+
bug: 'bug',
|
|
12
|
+
feature: 'enhancement',
|
|
13
|
+
docs: 'documentation',
|
|
14
|
+
hotfix: 'hotfix',
|
|
15
|
+
refactor: 'refactor',
|
|
16
|
+
chore: 'chore',
|
|
17
|
+
experiment: 'experiment'
|
|
18
|
+
};
|
|
19
|
+
const DEFAULT_USER_LABELS = {
|
|
20
|
+
bug: '[Bug]',
|
|
21
|
+
feature: '[Feature]',
|
|
22
|
+
docs: '[Docs]',
|
|
23
|
+
hotfix: '[Hotfix]',
|
|
24
|
+
refactor: '[Refactor]',
|
|
25
|
+
chore: '[Chore]',
|
|
26
|
+
experiment: '[Experiment]'
|
|
27
|
+
};
|
|
28
|
+
export class LabelDetector {
|
|
29
|
+
constructor(labelConfig, useUserFormat = true) {
|
|
30
|
+
const defaults = useUserFormat ? DEFAULT_USER_LABELS : DEFAULT_GITHUB_LABELS;
|
|
31
|
+
this.labelConfig = { ...defaults, ...labelConfig };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Detect increment type from spec content
|
|
35
|
+
*/
|
|
36
|
+
detectType(specContent, incrementId) {
|
|
37
|
+
// Try detection methods in order of confidence
|
|
38
|
+
const methods = [
|
|
39
|
+
() => this.detectFromFrontmatter(specContent),
|
|
40
|
+
() => this.detectFromTitle(specContent),
|
|
41
|
+
() => this.detectFromFilename(incrementId),
|
|
42
|
+
() => this.detectFromContent(specContent)
|
|
43
|
+
];
|
|
44
|
+
for (const method of methods) {
|
|
45
|
+
const result = method();
|
|
46
|
+
if (result && result.confidence >= 70) {
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Fallback: default to feature with low confidence
|
|
51
|
+
return {
|
|
52
|
+
type: 'feature',
|
|
53
|
+
confidence: 30,
|
|
54
|
+
labels: [this.labelConfig.feature],
|
|
55
|
+
detectionMethod: 'content'
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Detect from YAML frontmatter (type: bug, type: feature, etc.)
|
|
60
|
+
*/
|
|
61
|
+
detectFromFrontmatter(content) {
|
|
62
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
63
|
+
if (!frontmatterMatch)
|
|
64
|
+
return null;
|
|
65
|
+
const frontmatter = frontmatterMatch[1];
|
|
66
|
+
// Look for "type: bug" or "type: feature"
|
|
67
|
+
const typeMatch = frontmatter.match(/^type:\s*(.+)$/m);
|
|
68
|
+
if (!typeMatch)
|
|
69
|
+
return null;
|
|
70
|
+
const type = typeMatch[1].trim().toLowerCase();
|
|
71
|
+
const label = this.labelConfig[type];
|
|
72
|
+
if (!label)
|
|
73
|
+
return null;
|
|
74
|
+
return {
|
|
75
|
+
type,
|
|
76
|
+
confidence: 100,
|
|
77
|
+
labels: [label],
|
|
78
|
+
detectionMethod: 'frontmatter'
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Detect from title/heading (# Fix: Bug Title, # Feature: New Feature, etc.)
|
|
83
|
+
*/
|
|
84
|
+
detectFromTitle(content) {
|
|
85
|
+
const titleMatch = content.match(/^#\s+(?:Increment\s+\d+:\s+)?(.+)$/m);
|
|
86
|
+
if (!titleMatch)
|
|
87
|
+
return null;
|
|
88
|
+
const title = titleMatch[1].toLowerCase();
|
|
89
|
+
// Check for explicit markers
|
|
90
|
+
const markers = {
|
|
91
|
+
bug: ['fix:', 'bug:', 'bugfix:', 'hotfix:'],
|
|
92
|
+
feature: ['feature:', 'feat:', 'add:', 'implement:'],
|
|
93
|
+
docs: ['docs:', 'doc:', 'documentation:'],
|
|
94
|
+
hotfix: ['hotfix:', 'emergency:', 'critical:'],
|
|
95
|
+
refactor: ['refactor:', 'refactoring:', 'cleanup:'],
|
|
96
|
+
chore: ['chore:', 'maintenance:']
|
|
97
|
+
};
|
|
98
|
+
for (const [type, patterns] of Object.entries(markers)) {
|
|
99
|
+
if (patterns.some(p => title.startsWith(p))) {
|
|
100
|
+
return {
|
|
101
|
+
type: type,
|
|
102
|
+
confidence: 90,
|
|
103
|
+
labels: [this.labelConfig[type]],
|
|
104
|
+
detectionMethod: 'title'
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Detect from increment filename (0001-bugfix-auth, 0002-feature-dashboard, etc.)
|
|
112
|
+
*/
|
|
113
|
+
detectFromFilename(incrementId) {
|
|
114
|
+
if (!incrementId)
|
|
115
|
+
return null;
|
|
116
|
+
const filename = incrementId.toLowerCase();
|
|
117
|
+
const patterns = {
|
|
118
|
+
bug: /\b(bug|bugfix|fix)\b/,
|
|
119
|
+
feature: /\b(feature|feat)\b/,
|
|
120
|
+
docs: /\b(docs?|documentation)\b/,
|
|
121
|
+
hotfix: /\b(hotfix|emergency)\b/,
|
|
122
|
+
refactor: /\b(refactor|cleanup)\b/,
|
|
123
|
+
chore: /\b(chore|maintenance)\b/,
|
|
124
|
+
experiment: /\b(experiment|poc|spike)\b/
|
|
125
|
+
};
|
|
126
|
+
for (const [type, pattern] of Object.entries(patterns)) {
|
|
127
|
+
if (pattern.test(filename)) {
|
|
128
|
+
return {
|
|
129
|
+
type: type,
|
|
130
|
+
confidence: 80,
|
|
131
|
+
labels: [this.labelConfig[type]],
|
|
132
|
+
detectionMethod: 'filename'
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Detect from content keywords
|
|
140
|
+
*/
|
|
141
|
+
detectFromContent(content) {
|
|
142
|
+
const lower = content.toLowerCase();
|
|
143
|
+
// Bug indicators
|
|
144
|
+
const bugKeywords = ['error', 'crash', 'issue', 'problem', 'broken', 'not working'];
|
|
145
|
+
const bugCount = bugKeywords.filter(k => lower.includes(k)).length;
|
|
146
|
+
// Feature indicators
|
|
147
|
+
const featureKeywords = ['implement', 'add', 'create', 'new feature', 'enhancement'];
|
|
148
|
+
const featureCount = featureKeywords.filter(k => lower.includes(k)).length;
|
|
149
|
+
// Docs indicators
|
|
150
|
+
const docsKeywords = ['documentation', 'readme', 'guide', 'tutorial', 'docs'];
|
|
151
|
+
const docsCount = docsKeywords.filter(k => lower.includes(k)).length;
|
|
152
|
+
// Determine type by keyword frequency
|
|
153
|
+
const max = Math.max(bugCount, featureCount, docsCount);
|
|
154
|
+
if (max === 0)
|
|
155
|
+
return null;
|
|
156
|
+
let type;
|
|
157
|
+
let confidence;
|
|
158
|
+
if (bugCount === max) {
|
|
159
|
+
type = 'bug';
|
|
160
|
+
confidence = Math.min(50 + bugCount * 10, 100);
|
|
161
|
+
}
|
|
162
|
+
else if (featureCount === max) {
|
|
163
|
+
type = 'feature';
|
|
164
|
+
confidence = Math.min(50 + featureCount * 10, 100);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
type = 'docs';
|
|
168
|
+
confidence = Math.min(50 + docsCount * 10, 100);
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
type,
|
|
172
|
+
confidence,
|
|
173
|
+
labels: [this.labelConfig[type]],
|
|
174
|
+
detectionMethod: 'content'
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get labels for GitHub (standard format)
|
|
179
|
+
*/
|
|
180
|
+
getGitHubLabels(type) {
|
|
181
|
+
const githubLabels = {
|
|
182
|
+
bug: 'bug',
|
|
183
|
+
feature: 'enhancement',
|
|
184
|
+
docs: 'documentation',
|
|
185
|
+
hotfix: 'hotfix',
|
|
186
|
+
refactor: 'refactor',
|
|
187
|
+
chore: 'chore',
|
|
188
|
+
experiment: 'experiment'
|
|
189
|
+
};
|
|
190
|
+
return [githubLabels[type]];
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get labels for Jira (supports labels)
|
|
194
|
+
*/
|
|
195
|
+
getJiraLabels(type) {
|
|
196
|
+
return [type]; // Jira labels are just lowercase type names
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Get tags for Azure DevOps (supports tags)
|
|
200
|
+
*/
|
|
201
|
+
getAdoTags(type) {
|
|
202
|
+
return [type]; // ADO tags are also lowercase type names
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get user-friendly labels (with brackets: [Bug], [Feature], etc.)
|
|
206
|
+
*/
|
|
207
|
+
getUserLabels(type) {
|
|
208
|
+
return [this.labelConfig[type]];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=label-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-detector.js","sourceRoot":"","sources":["../../../../src/core/sync/label-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqBH,MAAM,qBAAqB,GAAgB;IACzC,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,eAAe;I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W,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry Logic
|
|
3
|
+
*
|
|
4
|
+
* Provides retry functionality with exponential backoff.
|
|
5
|
+
* Handles transient errors (network, rate limits, timeouts).
|
|
6
|
+
*
|
|
7
|
+
* Retry Strategy:
|
|
8
|
+
* - Max 3 retries
|
|
9
|
+
* - Exponential backoff: 1s, 2s, 4s
|
|
10
|
+
* - Special handling for rate limits (wait and retry)
|
|
11
|
+
*
|
|
12
|
+
* @module retry-logic
|
|
13
|
+
*/
|
|
14
|
+
export interface RetryOptions {
|
|
15
|
+
maxRetries?: number;
|
|
16
|
+
initialDelayMs?: number;
|
|
17
|
+
maxDelayMs?: number;
|
|
18
|
+
retryableErrors?: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface RetryResult<T> {
|
|
21
|
+
success: boolean;
|
|
22
|
+
result?: T;
|
|
23
|
+
error?: Error;
|
|
24
|
+
attempts: number;
|
|
25
|
+
totalDelayMs: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if error is retryable
|
|
29
|
+
*
|
|
30
|
+
* @param error - Error to check
|
|
31
|
+
* @returns True if error is retryable
|
|
32
|
+
*/
|
|
33
|
+
export declare function isRetryableError(error: Error): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Extract rate limit wait time from error
|
|
36
|
+
*
|
|
37
|
+
* @param error - Error that may contain rate limit info
|
|
38
|
+
* @returns Wait time in milliseconds, or null if not rate limit error
|
|
39
|
+
*/
|
|
40
|
+
export declare function extractRateLimitWaitTime(error: Error): number | null;
|
|
41
|
+
/**
|
|
42
|
+
* Retry function with exponential backoff
|
|
43
|
+
*
|
|
44
|
+
* @param fn - Function to retry
|
|
45
|
+
* @param options - Retry options
|
|
46
|
+
* @returns Retry result
|
|
47
|
+
*/
|
|
48
|
+
export declare function retryWithBackoff<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<RetryResult<T>>;
|
|
49
|
+
/**
|
|
50
|
+
* Create error message with retry information
|
|
51
|
+
*
|
|
52
|
+
* @param error - Original error
|
|
53
|
+
* @param attempts - Number of attempts made
|
|
54
|
+
* @returns Enhanced error message
|
|
55
|
+
*/
|
|
56
|
+
export declare function createRetryErrorMessage(error: Error, attempts: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* Check if error is permanent (not worth retrying)
|
|
59
|
+
*
|
|
60
|
+
* @param error - Error to check
|
|
61
|
+
* @returns True if error is permanent
|
|
62
|
+
*/
|
|
63
|
+
export declare function isPermanentError(error: Error): boolean;
|
|
64
|
+
//# sourceMappingURL=retry-logic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-logic.d.ts","sourceRoot":"","sources":["../../../../src/core/sync/retry-logic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAkCtD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAqBpE;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CA4DzB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAwBtD"}
|