devark-cli 0.1.2 → 0.1.3
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/dist/checksums.sha256 +2 -2
- package/dist/index.js +35 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/checksums.sha256
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
4e5508903ce1d478e710b2b659be710be26dd3e4233ac1fde8fce9b6a81cb37a index.js
|
|
2
|
+
1af5bc655dd375bcbda2a0274b9441baeebdf921d615302c3c224706f34675cf index.js.map
|
|
3
3
|
137b0f6da8ab3a82dd96e536c9de1c0162f51d5450895af16e935906975671a8 report-template.html
|
package/dist/index.js
CHANGED
|
@@ -2481,7 +2481,7 @@ var require_package = __commonJS({
|
|
|
2481
2481
|
"package.json"(exports2, module2) {
|
|
2482
2482
|
module2.exports = {
|
|
2483
2483
|
name: "devark-cli",
|
|
2484
|
-
version: "0.1.
|
|
2484
|
+
version: "0.1.3",
|
|
2485
2485
|
description: "DevArk - Developer Productivity CLI",
|
|
2486
2486
|
bin: {
|
|
2487
2487
|
devark: "./bin/devark.js"
|
|
@@ -2668,7 +2668,7 @@ async function gatherCLIConfiguration() {
|
|
|
2668
2668
|
return null;
|
|
2669
2669
|
}
|
|
2670
2670
|
}
|
|
2671
|
-
var import_axios, import_crypto2, SecureApiClient, apiClient;
|
|
2671
|
+
var import_axios, import_crypto2, TARGET_BATCH_SIZE_BYTES, BUFFER_PERCENT, SecureApiClient, apiClient;
|
|
2672
2672
|
var init_api_client = __esm({
|
|
2673
2673
|
"src/lib/api-client.ts"() {
|
|
2674
2674
|
"use strict";
|
|
@@ -2681,6 +2681,8 @@ var init_api_client = __esm({
|
|
|
2681
2681
|
init_network_errors();
|
|
2682
2682
|
init_claude_settings_manager();
|
|
2683
2683
|
import_crypto2 = __toESM(require("crypto"));
|
|
2684
|
+
TARGET_BATCH_SIZE_BYTES = 500 * 1024;
|
|
2685
|
+
BUFFER_PERCENT = 0.2;
|
|
2684
2686
|
SecureApiClient = class {
|
|
2685
2687
|
client;
|
|
2686
2688
|
requestCount = 0;
|
|
@@ -2894,20 +2896,45 @@ var init_api_client = __esm({
|
|
|
2894
2896
|
return { valid: false };
|
|
2895
2897
|
}
|
|
2896
2898
|
}
|
|
2899
|
+
estimateSessionSize(session) {
|
|
2900
|
+
return Buffer.byteLength(JSON.stringify(session));
|
|
2901
|
+
}
|
|
2902
|
+
createSizeBatches(sessions, targetSizeBytes = TARGET_BATCH_SIZE_BYTES, bufferPercent = BUFFER_PERCENT) {
|
|
2903
|
+
const effectiveTarget = targetSizeBytes * (1 - bufferPercent);
|
|
2904
|
+
const batches = [];
|
|
2905
|
+
let currentBatch = [];
|
|
2906
|
+
let currentSize = 0;
|
|
2907
|
+
for (const session of sessions) {
|
|
2908
|
+
const sessionSize = this.estimateSessionSize(session);
|
|
2909
|
+
if (currentBatch.length > 0 && currentSize + sessionSize > effectiveTarget) {
|
|
2910
|
+
batches.push(currentBatch);
|
|
2911
|
+
currentBatch = [session];
|
|
2912
|
+
currentSize = sessionSize;
|
|
2913
|
+
} else {
|
|
2914
|
+
currentBatch.push(session);
|
|
2915
|
+
currentSize += sessionSize;
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
if (currentBatch.length > 0) {
|
|
2919
|
+
batches.push(currentBatch);
|
|
2920
|
+
}
|
|
2921
|
+
return batches;
|
|
2922
|
+
}
|
|
2897
2923
|
async uploadSessions(sessions, onProgress) {
|
|
2898
2924
|
const cliConfig = await gatherCLIConfiguration();
|
|
2899
2925
|
const sanitizedSessions = sessions.map((session) => this.sanitizeSession(session));
|
|
2900
|
-
const
|
|
2901
|
-
const chunks = [];
|
|
2902
|
-
for (let i = 0; i < sanitizedSessions.length; i += CHUNK_SIZE) {
|
|
2903
|
-
chunks.push(sanitizedSessions.slice(i, i + CHUNK_SIZE));
|
|
2904
|
-
}
|
|
2926
|
+
const chunks = this.createSizeBatches(sanitizedSessions);
|
|
2905
2927
|
const results = [];
|
|
2906
2928
|
let uploadedCount = 0;
|
|
2907
2929
|
let uploadedSizeKB = 0;
|
|
2908
2930
|
const totalSize = Buffer.byteLength(JSON.stringify(sanitizedSessions)) / 1024;
|
|
2909
2931
|
if (process.env.DEVARK_DEBUG === "true") {
|
|
2910
|
-
console.log(
|
|
2932
|
+
console.log(
|
|
2933
|
+
"[DEBUG] Uploading in",
|
|
2934
|
+
chunks.length,
|
|
2935
|
+
"size-based batches",
|
|
2936
|
+
`(Total: ${totalSize.toFixed(2)} KB, Target: ~${TARGET_BATCH_SIZE_BYTES / 1024}KB per batch)`
|
|
2937
|
+
);
|
|
2911
2938
|
}
|
|
2912
2939
|
for (let i = 0; i < chunks.length; i++) {
|
|
2913
2940
|
const chunk = chunks[i];
|