claude-code-templates 1.26.3 → 1.26.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/index.js +18 -5
- package/src/tracking-service.js +72 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-templates",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.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/index.js
CHANGED
|
@@ -126,6 +126,10 @@ async function createClaudeConfig(options = {}) {
|
|
|
126
126
|
|
|
127
127
|
// Handle sandbox execution FIRST (before individual components)
|
|
128
128
|
if (options.sandbox) {
|
|
129
|
+
trackingService.trackCommandExecution('sandbox', {
|
|
130
|
+
provider: options.sandbox,
|
|
131
|
+
hasPrompt: !!options.prompt
|
|
132
|
+
});
|
|
129
133
|
await executeSandbox(options, targetDir);
|
|
130
134
|
return;
|
|
131
135
|
}
|
|
@@ -174,24 +178,28 @@ async function createClaudeConfig(options = {}) {
|
|
|
174
178
|
|
|
175
179
|
// Handle command stats analysis (both singular and plural)
|
|
176
180
|
if (options.commandStats || options.commandsStats) {
|
|
181
|
+
trackingService.trackCommandExecution('command-stats');
|
|
177
182
|
await runCommandStats(options);
|
|
178
183
|
return;
|
|
179
184
|
}
|
|
180
|
-
|
|
185
|
+
|
|
181
186
|
// Handle hook stats analysis (both singular and plural)
|
|
182
187
|
if (options.hookStats || options.hooksStats) {
|
|
188
|
+
trackingService.trackCommandExecution('hook-stats');
|
|
183
189
|
await runHookStats(options);
|
|
184
190
|
return;
|
|
185
191
|
}
|
|
186
|
-
|
|
192
|
+
|
|
187
193
|
// Handle MCP stats analysis (both singular and plural)
|
|
188
194
|
if (options.mcpStats || options.mcpsStats) {
|
|
195
|
+
trackingService.trackCommandExecution('mcp-stats');
|
|
189
196
|
await runMCPStats(options);
|
|
190
197
|
return;
|
|
191
198
|
}
|
|
192
199
|
|
|
193
200
|
// Handle analytics dashboard
|
|
194
201
|
if (options.analytics) {
|
|
202
|
+
trackingService.trackCommandExecution('analytics', { tunnel: options.tunnel || false });
|
|
195
203
|
trackingService.trackAnalyticsDashboard({ page: 'dashboard', source: 'command_line' });
|
|
196
204
|
await runAnalytics(options);
|
|
197
205
|
return;
|
|
@@ -199,6 +207,7 @@ async function createClaudeConfig(options = {}) {
|
|
|
199
207
|
|
|
200
208
|
// Handle plugin dashboard
|
|
201
209
|
if (options.plugins) {
|
|
210
|
+
trackingService.trackCommandExecution('plugins');
|
|
202
211
|
trackingService.trackAnalyticsDashboard({ page: 'plugins', source: 'command_line' });
|
|
203
212
|
await runPluginDashboard(options);
|
|
204
213
|
return;
|
|
@@ -206,20 +215,23 @@ async function createClaudeConfig(options = {}) {
|
|
|
206
215
|
|
|
207
216
|
// Handle chats dashboard (now points to mobile chats interface)
|
|
208
217
|
if (options.chats) {
|
|
218
|
+
trackingService.trackCommandExecution('chats', { tunnel: options.tunnel || false });
|
|
209
219
|
trackingService.trackAnalyticsDashboard({ page: 'chats-mobile', source: 'command_line' });
|
|
210
220
|
await startChatsMobile(options);
|
|
211
221
|
return;
|
|
212
222
|
}
|
|
213
|
-
|
|
223
|
+
|
|
214
224
|
// Handle agents dashboard (separate from chats)
|
|
215
225
|
if (options.agents) {
|
|
226
|
+
trackingService.trackCommandExecution('agents', { tunnel: options.tunnel || false });
|
|
216
227
|
trackingService.trackAnalyticsDashboard({ page: 'agents', source: 'command_line' });
|
|
217
228
|
await runAnalytics({ ...options, openTo: 'agents' });
|
|
218
229
|
return;
|
|
219
230
|
}
|
|
220
|
-
|
|
231
|
+
|
|
221
232
|
// Handle mobile chats interface
|
|
222
233
|
if (options.chatsMobile) {
|
|
234
|
+
trackingService.trackCommandExecution('chats-mobile', { tunnel: options.tunnel || false });
|
|
223
235
|
trackingService.trackAnalyticsDashboard({ page: 'chats-mobile', source: 'command_line' });
|
|
224
236
|
await startChatsMobile(options);
|
|
225
237
|
return;
|
|
@@ -269,8 +281,9 @@ async function createClaudeConfig(options = {}) {
|
|
|
269
281
|
// Handle health check
|
|
270
282
|
let shouldRunSetup = false;
|
|
271
283
|
if (options.healthCheck || options.health || options.check || options.verify) {
|
|
284
|
+
trackingService.trackCommandExecution('health-check');
|
|
272
285
|
const healthResult = await runHealthCheck();
|
|
273
|
-
|
|
286
|
+
|
|
274
287
|
// Track health check usage
|
|
275
288
|
trackingService.trackHealthCheck({
|
|
276
289
|
setup_recommended: healthResult.runSetup,
|
package/src/tracking-service.js
CHANGED
|
@@ -214,6 +214,78 @@ class TrackingService {
|
|
|
214
214
|
...metadata
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Track CLI command execution
|
|
220
|
+
* @param {string} commandName - Command name (chats, analytics, health-check, plugins, sandbox, etc.)
|
|
221
|
+
* @param {object} metadata - Additional context (optional)
|
|
222
|
+
*/
|
|
223
|
+
async trackCommandExecution(commandName, metadata = {}) {
|
|
224
|
+
if (!this.trackingEnabled) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
try {
|
|
229
|
+
const payload = {
|
|
230
|
+
command: commandName,
|
|
231
|
+
cliVersion: this.getCliVersion(),
|
|
232
|
+
nodeVersion: process.version,
|
|
233
|
+
platform: process.platform,
|
|
234
|
+
arch: process.arch,
|
|
235
|
+
sessionId: this.generateSessionId(),
|
|
236
|
+
metadata: metadata
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// Fire-and-forget to Neon Database
|
|
240
|
+
this.sendCommandTracking(payload)
|
|
241
|
+
.catch(error => {
|
|
242
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
243
|
+
console.debug('📊 Command tracking info (non-critical):', error.message);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
} catch (error) {
|
|
248
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
249
|
+
console.debug('📊 Command tracking error (non-critical):', error.message);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Send command tracking to Neon Database
|
|
256
|
+
*/
|
|
257
|
+
async sendCommandTracking(payload) {
|
|
258
|
+
const controller = new AbortController();
|
|
259
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
260
|
+
|
|
261
|
+
try {
|
|
262
|
+
const response = await fetch('https://www.aitmpl.com/api/track-command-usage', {
|
|
263
|
+
method: 'POST',
|
|
264
|
+
headers: {
|
|
265
|
+
'Content-Type': 'application/json',
|
|
266
|
+
'User-Agent': `claude-code-templates/${payload.cliVersion}`
|
|
267
|
+
},
|
|
268
|
+
body: JSON.stringify(payload),
|
|
269
|
+
signal: controller.signal
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
clearTimeout(timeoutId);
|
|
273
|
+
|
|
274
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
275
|
+
if (response.ok) {
|
|
276
|
+
console.debug('📊 Command execution tracked successfully');
|
|
277
|
+
} else {
|
|
278
|
+
console.debug(`📊 Command tracking failed with status: ${response.status}`);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
} catch (error) {
|
|
283
|
+
clearTimeout(timeoutId);
|
|
284
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
285
|
+
console.debug('📊 Command tracking failed (non-critical):', error.message);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
217
289
|
}
|
|
218
290
|
|
|
219
291
|
// Export singleton instance
|