@insforge/cli 0.1.39 → 0.1.41
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/index.js +33 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1914,6 +1914,16 @@ function captureEvent(distinctId, event, properties) {
|
|
|
1914
1914
|
} catch {
|
|
1915
1915
|
}
|
|
1916
1916
|
}
|
|
1917
|
+
function trackDiagnose(subcommand, config) {
|
|
1918
|
+
captureEvent(config.project_id, "cli_diagnose_invoked", {
|
|
1919
|
+
subcommand,
|
|
1920
|
+
project_id: config.project_id,
|
|
1921
|
+
project_name: config.project_name,
|
|
1922
|
+
org_id: config.org_id,
|
|
1923
|
+
region: config.region,
|
|
1924
|
+
oss_mode: config.project_id === "oss-project"
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1917
1927
|
async function shutdownAnalytics() {
|
|
1918
1928
|
try {
|
|
1919
1929
|
if (client) await client.shutdown();
|
|
@@ -2045,6 +2055,10 @@ function registerDeploymentsDeployCommand(deploymentsCmd2) {
|
|
|
2045
2055
|
if (!stats?.isDirectory()) {
|
|
2046
2056
|
throw new CLIError(`"${sourceDir}" is not a valid directory.`);
|
|
2047
2057
|
}
|
|
2058
|
+
const dirName = path2.basename(sourceDir);
|
|
2059
|
+
if (EXCLUDE_PATTERNS.includes(dirName)) {
|
|
2060
|
+
throw new CLIError(`"${dirName}" is an excluded directory and cannot be used as a deploy source. Please specify your project root or output directory instead.`);
|
|
2061
|
+
}
|
|
2048
2062
|
const s = !json ? clack9.spinner() : null;
|
|
2049
2063
|
const startBody = {};
|
|
2050
2064
|
if (opts.env) {
|
|
@@ -3461,6 +3475,7 @@ function registerDiagnoseMetricsCommand(diagnoseCmd2) {
|
|
|
3461
3475
|
"Metrics requires InsForge Platform login. Not available when linked via --api-key."
|
|
3462
3476
|
);
|
|
3463
3477
|
}
|
|
3478
|
+
trackDiagnose("metrics", config);
|
|
3464
3479
|
const params = new URLSearchParams({ range: opts.range });
|
|
3465
3480
|
if (opts.metrics) params.set("metrics", opts.metrics);
|
|
3466
3481
|
const res = await platformFetch(
|
|
@@ -3501,6 +3516,8 @@ function registerDiagnoseMetricsCommand(diagnoseCmd2) {
|
|
|
3501
3516
|
} catch (err) {
|
|
3502
3517
|
await reportCliUsage("cli.diagnose.metrics", false);
|
|
3503
3518
|
handleError(err, json);
|
|
3519
|
+
} finally {
|
|
3520
|
+
await shutdownAnalytics();
|
|
3504
3521
|
}
|
|
3505
3522
|
});
|
|
3506
3523
|
}
|
|
@@ -3522,6 +3539,7 @@ function registerDiagnoseAdvisorCommand(diagnoseCmd2) {
|
|
|
3522
3539
|
"Advisor requires InsForge Platform login. Not available when linked via --api-key."
|
|
3523
3540
|
);
|
|
3524
3541
|
}
|
|
3542
|
+
trackDiagnose("advisor", config);
|
|
3525
3543
|
const projectId = config.project_id;
|
|
3526
3544
|
const scanRes = await platformFetch(
|
|
3527
3545
|
`/projects/v1/${projectId}/advisor/latest`,
|
|
@@ -3565,6 +3583,8 @@ function registerDiagnoseAdvisorCommand(diagnoseCmd2) {
|
|
|
3565
3583
|
} catch (err) {
|
|
3566
3584
|
await reportCliUsage("cli.diagnose.advisor", false);
|
|
3567
3585
|
handleError(err, json);
|
|
3586
|
+
} finally {
|
|
3587
|
+
await shutdownAnalytics();
|
|
3568
3588
|
}
|
|
3569
3589
|
});
|
|
3570
3590
|
}
|
|
@@ -3715,7 +3735,9 @@ function registerDiagnoseDbCommand(diagnoseCmd2) {
|
|
|
3715
3735
|
const { json } = getRootOpts(cmd);
|
|
3716
3736
|
try {
|
|
3717
3737
|
await requireAuth();
|
|
3718
|
-
|
|
3738
|
+
const config = getProjectConfig();
|
|
3739
|
+
if (!config) throw new ProjectNotLinkedError();
|
|
3740
|
+
trackDiagnose("db", config);
|
|
3719
3741
|
const checkNames = opts.check === "all" ? ALL_CHECKS : opts.check.split(",").map((s) => s.trim());
|
|
3720
3742
|
const results = {};
|
|
3721
3743
|
for (const name of checkNames) {
|
|
@@ -3750,6 +3772,8 @@ function registerDiagnoseDbCommand(diagnoseCmd2) {
|
|
|
3750
3772
|
} catch (err) {
|
|
3751
3773
|
await reportCliUsage("cli.diagnose.db", false);
|
|
3752
3774
|
handleError(err, json);
|
|
3775
|
+
} finally {
|
|
3776
|
+
await shutdownAnalytics();
|
|
3753
3777
|
}
|
|
3754
3778
|
});
|
|
3755
3779
|
}
|
|
@@ -3803,7 +3827,9 @@ function registerDiagnoseLogsCommand(diagnoseCmd2) {
|
|
|
3803
3827
|
const { json } = getRootOpts(cmd);
|
|
3804
3828
|
try {
|
|
3805
3829
|
await requireAuth();
|
|
3806
|
-
|
|
3830
|
+
const config = getProjectConfig();
|
|
3831
|
+
if (!config) throw new ProjectNotLinkedError();
|
|
3832
|
+
trackDiagnose("logs", config);
|
|
3807
3833
|
const limit = parseInt(opts.limit, 10) || 100;
|
|
3808
3834
|
const sources = opts.source ? [opts.source] : [...LOG_SOURCES];
|
|
3809
3835
|
const summaries = [];
|
|
@@ -3836,6 +3862,8 @@ function registerDiagnoseLogsCommand(diagnoseCmd2) {
|
|
|
3836
3862
|
} catch (err) {
|
|
3837
3863
|
await reportCliUsage("cli.diagnose.logs", false);
|
|
3838
3864
|
handleError(err, json);
|
|
3865
|
+
} finally {
|
|
3866
|
+
await shutdownAnalytics();
|
|
3839
3867
|
}
|
|
3840
3868
|
});
|
|
3841
3869
|
}
|
|
@@ -3854,6 +3882,7 @@ function registerDiagnoseCommands(diagnoseCmd2) {
|
|
|
3854
3882
|
const projectId = config.project_id;
|
|
3855
3883
|
const projectName = config.project_name;
|
|
3856
3884
|
const ossMode = config.project_id === "oss-project";
|
|
3885
|
+
trackDiagnose("report", config);
|
|
3857
3886
|
const metricsPromise = ossMode ? Promise.reject(new Error("Platform login required (linked via --api-key)")) : fetchMetricsSummary(projectId, apiUrl);
|
|
3858
3887
|
const advisorPromise = ossMode ? Promise.reject(new Error("Platform login required (linked via --api-key)")) : fetchAdvisorSummary(projectId, apiUrl);
|
|
3859
3888
|
const [metricsResult, advisorResult, dbResult, logsResult] = await Promise.allSettled([
|
|
@@ -3973,6 +4002,8 @@ function registerDiagnoseCommands(diagnoseCmd2) {
|
|
|
3973
4002
|
} catch (err) {
|
|
3974
4003
|
await reportCliUsage("cli.diagnose", false);
|
|
3975
4004
|
handleError(err, json);
|
|
4005
|
+
} finally {
|
|
4006
|
+
await shutdownAnalytics();
|
|
3976
4007
|
}
|
|
3977
4008
|
});
|
|
3978
4009
|
registerDiagnoseMetricsCommand(diagnoseCmd2);
|