claude-cli-advanced-starter-pack 1.8.3 → 1.8.5

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.
@@ -1,197 +0,0 @@
1
- /**
2
- * GitHub Progress Hook
3
- *
4
- * Automatically updates GitHub issues as tasks are completed.
5
- * Monitors TodoWrite/TaskUpdate calls and syncs progress to linked GitHub issues.
6
- *
7
- * Event: PostToolUse
8
- * Priority: {{hooks.priorities.automation}}
9
- */
10
-
11
- const { execSync } = require('child_process');
12
- const fs = require('fs');
13
- const path = require('path');
14
-
15
- // Configuration from tech-stack.json
16
- const CONFIG = {
17
- owner: '{{versionControl.owner}}',
18
- repo: '{{versionControl.repo}}',
19
- projectNumber: {{versionControl.projectBoard.number}},
20
- enabled: '{{versionControl.projectBoard.type}}' === 'github-projects',
21
- };
22
-
23
- const PROGRESS_FILE = '.claude/hooks/cache/github-progress.json';
24
-
25
- /**
26
- * Load progress tracking data
27
- */
28
- function loadProgress() {
29
- const progressPath = path.join(process.cwd(), PROGRESS_FILE);
30
-
31
- if (fs.existsSync(progressPath)) {
32
- try {
33
- return JSON.parse(fs.readFileSync(progressPath, 'utf8'));
34
- } catch (error) {
35
- console.warn('[github-progress] Could not parse progress file');
36
- }
37
- }
38
-
39
- return {
40
- linkedIssue: null,
41
- tasks: [],
42
- completedTasks: [],
43
- lastUpdate: null,
44
- };
45
- }
46
-
47
- /**
48
- * Save progress tracking data
49
- */
50
- function saveProgress(progress) {
51
- const progressPath = path.join(process.cwd(), PROGRESS_FILE);
52
- const progressDir = path.dirname(progressPath);
53
-
54
- if (!fs.existsSync(progressDir)) {
55
- fs.mkdirSync(progressDir, { recursive: true });
56
- }
57
-
58
- progress.lastUpdate = new Date().toISOString();
59
- fs.writeFileSync(progressPath, JSON.stringify(progress, null, 2), 'utf8');
60
- }
61
-
62
- /**
63
- * Check if gh CLI is available
64
- */
65
- function hasGhCli() {
66
- try {
67
- execSync('gh --version', { stdio: 'ignore' });
68
- return true;
69
- } catch {
70
- return false;
71
- }
72
- }
73
-
74
- /**
75
- * Update GitHub issue with progress
76
- */
77
- function updateGitHubIssue(issueNumber, completedTasks, totalTasks, latestTask) {
78
- if (!hasGhCli()) {
79
- console.warn('[github-progress] gh CLI not available');
80
- return false;
81
- }
82
-
83
- try {
84
- // Create progress comment
85
- const percentage = Math.round((completedTasks / totalTasks) * 100);
86
- const progressBar = '█'.repeat(Math.floor(percentage / 10)) + '░'.repeat(10 - Math.floor(percentage / 10));
87
-
88
- const comment = `### Progress Update
89
-
90
- ${progressBar} ${percentage}% (${completedTasks}/${totalTasks} tasks)
91
-
92
- **Latest completed:** ${latestTask || 'N/A'}
93
-
94
- ---
95
- *Auto-updated by Claude Code github-progress-hook*`;
96
-
97
- // Add comment to issue
98
- execSync(
99
- `gh issue comment ${issueNumber} --repo ${CONFIG.owner}/${CONFIG.repo} --body "${comment.replace(/"/g, '\\"')}"`,
100
- { stdio: 'ignore' }
101
- );
102
-
103
- return true;
104
- } catch (error) {
105
- console.warn('[github-progress] Failed to update GitHub:', error.message);
106
- return false;
107
- }
108
- }
109
-
110
- /**
111
- * Extract linked issue from task metadata or context
112
- */
113
- function findLinkedIssue(input, progress) {
114
- // Check if issue is already linked
115
- if (progress.linkedIssue) {
116
- return progress.linkedIssue;
117
- }
118
-
119
- // Try to extract from task description
120
- if (input && input.description) {
121
- const issueMatch = input.description.match(/#(\d+)/);
122
- if (issueMatch) {
123
- return parseInt(issueMatch[1], 10);
124
- }
125
- }
126
-
127
- // Try to extract from subject
128
- if (input && input.subject) {
129
- const issueMatch = input.subject.match(/#(\d+)/);
130
- if (issueMatch) {
131
- return parseInt(issueMatch[1], 10);
132
- }
133
- }
134
-
135
- return null;
136
- }
137
-
138
- /**
139
- * Main hook handler
140
- */
141
- module.exports = async function githubProgressHook(context) {
142
- // Skip if not configured
143
- if (!CONFIG.enabled || !CONFIG.owner || !CONFIG.repo) {
144
- return { continue: true };
145
- }
146
-
147
- const { tool, input } = context;
148
-
149
- // Only process task-related tools
150
- if (!['TodoWrite', 'TaskUpdate', 'TaskCreate'].includes(tool)) {
151
- return { continue: true };
152
- }
153
-
154
- // Load progress tracking
155
- const progress = loadProgress();
156
-
157
- // Check for linked issue
158
- const issueNumber = findLinkedIssue(input, progress);
159
-
160
- if (issueNumber && !progress.linkedIssue) {
161
- progress.linkedIssue = issueNumber;
162
- console.log(`[github-progress] Linked to issue #${issueNumber}`);
163
- }
164
-
165
- // Track task completion
166
- if (tool === 'TaskUpdate' && input && input.status === 'completed') {
167
- const taskId = input.taskId;
168
- if (taskId && !progress.completedTasks.includes(taskId)) {
169
- progress.completedTasks.push(taskId);
170
-
171
- // Update GitHub if we have a linked issue
172
- if (progress.linkedIssue) {
173
- const totalTasks = progress.tasks.length || progress.completedTasks.length;
174
- updateGitHubIssue(
175
- progress.linkedIssue,
176
- progress.completedTasks.length,
177
- totalTasks,
178
- input.subject || `Task ${taskId}`
179
- );
180
- }
181
- }
182
- }
183
-
184
- // Track new tasks
185
- if (tool === 'TaskCreate' && input && input.subject) {
186
- progress.tasks.push({
187
- id: Date.now().toString(),
188
- subject: input.subject,
189
- created: new Date().toISOString(),
190
- });
191
- }
192
-
193
- // Save updated progress
194
- saveProgress(progress);
195
-
196
- return { continue: true };
197
- };