@decantr/cli 2.1.1 → 2.3.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/README.md +27 -3
- package/dist/bin.js +2 -2
- package/dist/{chunk-DPFORHLL.js → chunk-3H3HWDJA.js} +2 -2
- package/dist/{chunk-GOX5EJ56.js → chunk-FSZ6OIAC.js} +296 -129
- package/dist/{chunk-JYEEXSUX.js → chunk-IEW2QFYI.js} +53 -0
- package/dist/{chunk-LLQCXOHK.js → chunk-NBJCO4G5.js} +1 -1
- package/dist/{heal-NWQNJ6PU.js → heal-M6PRCIIF.js} +2 -2
- package/dist/{health-WJJ55W3H.js → health-EENY3BFS.js} +3 -3
- package/dist/index.js +2 -2
- package/dist/studio-TBJPZZHA.js +1202 -0
- package/package.json +2 -2
- package/dist/studio-FJNGWWRM.js +0 -326
|
@@ -134,6 +134,30 @@ async function sendProjectHealthReportTelemetry(input) {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
+
async function sendAnalyzeCompletedTelemetry(input) {
|
|
138
|
+
const projectRoot = input.projectRoot ?? process.cwd();
|
|
139
|
+
const metadata = readProjectTelemetryMetadata(projectRoot);
|
|
140
|
+
const properties = {
|
|
141
|
+
command: "analyze",
|
|
142
|
+
success: input.success,
|
|
143
|
+
durationMs: input.durationMs,
|
|
144
|
+
adoptionMode: metadata.adoptionMode ?? "contract-only",
|
|
145
|
+
componentCount: input.componentCount,
|
|
146
|
+
dependencyCategoryCount: input.dependencyCategoryCount,
|
|
147
|
+
errorCode: input.success ? void 0 : "analyze_failed",
|
|
148
|
+
pageCount: input.pageCount,
|
|
149
|
+
projectScope: metadata.projectScope ?? inferProjectScope(projectRoot),
|
|
150
|
+
routeCount: input.routeCount,
|
|
151
|
+
targetFramework: input.targetFramework,
|
|
152
|
+
workflowMode: metadata.workflowMode ?? "brownfield-attach"
|
|
153
|
+
};
|
|
154
|
+
await captureCliTelemetryEvent({
|
|
155
|
+
args: ["analyze"],
|
|
156
|
+
name: "decantr.analyze.completed",
|
|
157
|
+
projectRoot,
|
|
158
|
+
properties
|
|
159
|
+
});
|
|
160
|
+
}
|
|
137
161
|
async function sendNewProjectCompletedTelemetry(input) {
|
|
138
162
|
const projectRoot = input.projectRoot ?? process.cwd();
|
|
139
163
|
const args = input.args ?? ["new"];
|
|
@@ -303,6 +327,19 @@ function collectMetrics(essence, issues) {
|
|
|
303
327
|
theme: theme.id ?? "unknown"
|
|
304
328
|
};
|
|
305
329
|
}
|
|
330
|
+
function getCliTelemetryIdentityStatus(projectRoot, options = {}) {
|
|
331
|
+
const projectJsonPath = join(projectRoot, ".decantr", "project.json");
|
|
332
|
+
const hasProjectConfig = existsSync(projectJsonPath);
|
|
333
|
+
const identities = options.create ? ensureTelemetryIdentities(projectRoot) : null;
|
|
334
|
+
const projectData = readProjectJson(projectRoot);
|
|
335
|
+
return {
|
|
336
|
+
enabled: projectData?.telemetry === true,
|
|
337
|
+
hasProjectConfig,
|
|
338
|
+
installId: identities?.installId ?? readExistingInstallId(),
|
|
339
|
+
projectId: identities?.projectId ?? readStringProperty(projectData, "telemetryProjectId"),
|
|
340
|
+
projectRoot
|
|
341
|
+
};
|
|
342
|
+
}
|
|
306
343
|
function ensureTelemetryIdentities(projectRoot) {
|
|
307
344
|
const installId = getOrCreateInstallId();
|
|
308
345
|
const projectJsonPath = join(projectRoot, ".decantr", "project.json");
|
|
@@ -348,6 +385,16 @@ function getOrCreateInstallId() {
|
|
|
348
385
|
return `install_${randomUUID()}`;
|
|
349
386
|
}
|
|
350
387
|
}
|
|
388
|
+
function readExistingInstallId() {
|
|
389
|
+
const configPath = join(getConfigDir(), "config.json");
|
|
390
|
+
if (!existsSync(configPath)) return void 0;
|
|
391
|
+
try {
|
|
392
|
+
const data = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
393
|
+
return readStringProperty(data, "telemetryInstallId");
|
|
394
|
+
} catch {
|
|
395
|
+
return void 0;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
351
398
|
function getConfigDir() {
|
|
352
399
|
return process.env.DECANTR_CONFIG_DIR || join(homedir(), ".config", "decantr");
|
|
353
400
|
}
|
|
@@ -386,6 +433,10 @@ function readProjectJson(projectRoot) {
|
|
|
386
433
|
return null;
|
|
387
434
|
}
|
|
388
435
|
}
|
|
436
|
+
function readStringProperty(value, key) {
|
|
437
|
+
const property = value?.[key];
|
|
438
|
+
return typeof property === "string" && property.trim() ? property : void 0;
|
|
439
|
+
}
|
|
389
440
|
function isRecord(value) {
|
|
390
441
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
391
442
|
}
|
|
@@ -1650,12 +1701,14 @@ export {
|
|
|
1650
1701
|
optIn,
|
|
1651
1702
|
sendCliCommandTelemetry,
|
|
1652
1703
|
sendProjectHealthReportTelemetry,
|
|
1704
|
+
sendAnalyzeCompletedTelemetry,
|
|
1653
1705
|
sendNewProjectCompletedTelemetry,
|
|
1654
1706
|
sendProjectHealthPromptTelemetry,
|
|
1655
1707
|
sendProjectHealthCiFailedTelemetry,
|
|
1656
1708
|
sendStudioStartedTelemetry,
|
|
1657
1709
|
sendStudioHealthRefreshedTelemetry,
|
|
1658
1710
|
collectMetrics,
|
|
1711
|
+
getCliTelemetryIdentityStatus,
|
|
1659
1712
|
buildGuardRegistryContext,
|
|
1660
1713
|
scanProjectInteractions
|
|
1661
1714
|
};
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
renderProjectHealthCiWorkflow,
|
|
9
9
|
shouldFailHealth,
|
|
10
10
|
writeProjectHealthCiWorkflow
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-3H3HWDJA.js";
|
|
12
|
+
import "./chunk-NBJCO4G5.js";
|
|
13
|
+
import "./chunk-IEW2QFYI.js";
|
|
14
14
|
export {
|
|
15
15
|
cmdHealth,
|
|
16
16
|
createProjectHealthReport,
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-FSZ6OIAC.js";
|
|
2
2
|
import "./chunk-WDA4SHIQ.js";
|
|
3
|
-
import "./chunk-
|
|
3
|
+
import "./chunk-IEW2QFYI.js";
|