claude-code-templates 1.14.2 → 1.14.4
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/package.json +1 -1
- package/src/tracking-service.js +31 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-templates",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.4",
|
|
4
4
|
"description": "CLI tool to setup Claude Code configurations with framework-specific commands, automation hooks and MCP Servers for your projects",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
package/src/tracking-service.js
CHANGED
|
@@ -45,12 +45,18 @@ class TrackingService {
|
|
|
45
45
|
this.sendTrackingData(trackingData)
|
|
46
46
|
.catch(error => {
|
|
47
47
|
// Silent failure - tracking should never impact functionality
|
|
48
|
-
|
|
48
|
+
// Only show debug info when explicitly enabled
|
|
49
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
50
|
+
console.debug('📊 Tracking info (non-critical):', error.message);
|
|
51
|
+
}
|
|
49
52
|
});
|
|
50
53
|
|
|
51
54
|
} catch (error) {
|
|
52
55
|
// Silently handle any tracking errors
|
|
53
|
-
|
|
56
|
+
// Only show debug info when explicitly enabled
|
|
57
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
58
|
+
console.debug('📊 Analytics error (non-critical):', error.message);
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
|
|
@@ -77,37 +83,36 @@ class TrackingService {
|
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
/**
|
|
80
|
-
* Send tracking data
|
|
86
|
+
* Send tracking data via GitHub Repository Dispatch (anonymous)
|
|
81
87
|
*/
|
|
82
88
|
async sendTrackingData(trackingData) {
|
|
83
|
-
const title = `📊 ${trackingData.component_type}:${trackingData.component_name} - ${trackingData.timestamp.split('T')[0]}`;
|
|
84
|
-
|
|
85
|
-
const body = `\`\`\`json
|
|
86
|
-
${JSON.stringify(trackingData, null, 2)}
|
|
87
|
-
\`\`\`
|
|
88
|
-
|
|
89
|
-
<!-- ANALYTICS_DATA -->
|
|
90
|
-
Component: **${trackingData.component_name}** (${trackingData.component_type})
|
|
91
|
-
Platform: ${trackingData.environment.platform} ${trackingData.environment.arch}
|
|
92
|
-
Node: ${trackingData.environment.node_version}
|
|
93
|
-
CLI: ${trackingData.environment.cli_version}
|
|
94
|
-
Session: \`${trackingData.session_id}\`
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
89
|
const controller = new AbortController();
|
|
98
90
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
99
91
|
|
|
100
92
|
try {
|
|
101
|
-
|
|
93
|
+
// Use GitHub Repository Dispatch API (public endpoint, no auth needed)
|
|
94
|
+
const response = await fetch(`https://api.github.com/repos/${this.repoOwner}/${this.repoName}/dispatches`, {
|
|
102
95
|
method: 'POST',
|
|
103
96
|
headers: {
|
|
104
97
|
'Content-Type': 'application/json',
|
|
98
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
105
99
|
'User-Agent': 'claude-code-templates-cli'
|
|
106
100
|
},
|
|
107
101
|
body: JSON.stringify({
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
event_type: 'component_download',
|
|
103
|
+
client_payload: {
|
|
104
|
+
component_type: trackingData.component_type,
|
|
105
|
+
component_name: trackingData.component_name,
|
|
106
|
+
timestamp: trackingData.timestamp,
|
|
107
|
+
session_id: trackingData.session_id,
|
|
108
|
+
environment: {
|
|
109
|
+
platform: trackingData.environment.platform,
|
|
110
|
+
arch: trackingData.environment.arch,
|
|
111
|
+
node_version: trackingData.environment.node_version,
|
|
112
|
+
cli_version: trackingData.environment.cli_version
|
|
113
|
+
},
|
|
114
|
+
metadata: trackingData.metadata || {}
|
|
115
|
+
}
|
|
111
116
|
}),
|
|
112
117
|
signal: controller.signal
|
|
113
118
|
});
|
|
@@ -115,10 +120,13 @@ Session: \`${trackingData.session_id}\`
|
|
|
115
120
|
clearTimeout(timeoutId);
|
|
116
121
|
|
|
117
122
|
if (!response.ok) {
|
|
118
|
-
throw new Error(`GitHub API responded with ${response.status}`);
|
|
123
|
+
throw new Error(`GitHub Dispatch API responded with ${response.status}`);
|
|
119
124
|
}
|
|
120
125
|
|
|
121
|
-
|
|
126
|
+
// Only show success message when debugging
|
|
127
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
128
|
+
console.debug('📊 Download tracked successfully via repository dispatch');
|
|
129
|
+
}
|
|
122
130
|
|
|
123
131
|
} catch (error) {
|
|
124
132
|
clearTimeout(timeoutId);
|