claude-code-templates 1.26.3 → 1.27.0
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/components/sandbox/docker/Dockerfile +38 -0
- package/components/sandbox/docker/README.md +453 -0
- package/components/sandbox/docker/docker-launcher.js +184 -0
- package/components/sandbox/docker/execute.js +251 -0
- package/components/sandbox/docker/package.json +26 -0
- package/package.json +2 -1
- package/src/index.js +241 -18
- package/src/tracking-service.js +72 -0
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
|