@decantr/cli 1.11.0 → 2.1.1

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.
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  cmdHeal,
3
3
  collectCheckIssues
4
- } from "./chunk-RSDCWAHD.js";
5
- import "./chunk-DI2PLOJ6.js";
4
+ } from "./chunk-LLQCXOHK.js";
5
+ import "./chunk-JYEEXSUX.js";
6
6
  export {
7
7
  cmdHeal,
8
8
  collectCheckIssues
@@ -8,9 +8,9 @@ import {
8
8
  renderProjectHealthCiWorkflow,
9
9
  shouldFailHealth,
10
10
  writeProjectHealthCiWorkflow
11
- } from "./chunk-6YCFRZZI.js";
12
- import "./chunk-RSDCWAHD.js";
13
- import "./chunk-DI2PLOJ6.js";
11
+ } from "./chunk-DPFORHLL.js";
12
+ import "./chunk-LLQCXOHK.js";
13
+ import "./chunk-JYEEXSUX.js";
14
14
  export {
15
15
  cmdHealth,
16
16
  createProjectHealthReport,
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import "./chunk-5RODH77L.js";
2
- import "./chunk-USOO77A5.js";
3
- import "./chunk-DI2PLOJ6.js";
1
+ import "./chunk-GOX5EJ56.js";
2
+ import "./chunk-WDA4SHIQ.js";
3
+ import "./chunk-JYEEXSUX.js";
@@ -1,8 +1,11 @@
1
1
  import {
2
2
  createProjectHealthReport
3
- } from "./chunk-6YCFRZZI.js";
4
- import "./chunk-RSDCWAHD.js";
5
- import "./chunk-DI2PLOJ6.js";
3
+ } from "./chunk-DPFORHLL.js";
4
+ import "./chunk-LLQCXOHK.js";
5
+ import {
6
+ sendStudioHealthRefreshedTelemetry,
7
+ sendStudioStartedTelemetry
8
+ } from "./chunk-JYEEXSUX.js";
6
9
 
7
10
  // src/commands/studio.ts
8
11
  import { createServer } from "http";
@@ -252,7 +255,15 @@ function createStudioRequestHandler(projectRoot) {
252
255
  return;
253
256
  }
254
257
  if (req.method === "POST" && url.pathname === "/api/refresh") {
255
- sendJson(res, 200, await createProjectHealthReport(projectRoot));
258
+ const startedAt = Date.now();
259
+ const report = await createProjectHealthReport(projectRoot);
260
+ void sendStudioHealthRefreshedTelemetry({
261
+ durationMs: Date.now() - startedAt,
262
+ projectRoot,
263
+ report,
264
+ trigger: "api-refresh"
265
+ });
266
+ sendJson(res, 200, report);
256
267
  return;
257
268
  }
258
269
  sendNotFound(res);
@@ -278,6 +289,12 @@ async function startStudioServer(projectRoot = process.cwd(), options = {}) {
278
289
  }
279
290
  async function cmdStudio(projectRoot = process.cwd(), options = {}) {
280
291
  const handle = await startStudioServer(projectRoot, options);
292
+ const url = new URL(handle.url);
293
+ void sendStudioStartedTelemetry({
294
+ host: url.hostname,
295
+ port: Number.parseInt(url.port, 10),
296
+ projectRoot
297
+ });
281
298
  console.log(`${GREEN}Decantr Studio is running.${RESET}`);
282
299
  console.log(`${CYAN}${handle.url}${RESET}`);
283
300
  console.log("Press Ctrl+C to stop.");
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  RegistryClient,
3
3
  refreshDerivedFiles
4
- } from "./chunk-USOO77A5.js";
4
+ } from "./chunk-WDA4SHIQ.js";
5
5
 
6
6
  // src/commands/upgrade.ts
7
7
  import { existsSync, readFileSync, writeFileSync } from "fs";
8
8
  import { join } from "path";
9
- import { isV3 } from "@decantr/essence-spec";
9
+ import { isV4 } from "@decantr/essence-spec";
10
10
  var GREEN = "\x1B[32m";
11
11
  var YELLOW = "\x1B[33m";
12
12
  var RESET = "\x1B[0m";
@@ -20,19 +20,24 @@ async function cmdUpgrade(projectRoot = process.cwd(), options = {}) {
20
20
  return;
21
21
  }
22
22
  const essence = JSON.parse(readFileSync(essencePath, "utf-8"));
23
+ if (!isV4(essence)) {
24
+ console.error("Active workflows require Essence v4.0.0. Run `decantr migrate --to v4` first.");
25
+ process.exitCode = 1;
26
+ return;
27
+ }
23
28
  const client = new RegistryClient({
24
29
  cacheDir: join(projectRoot, ".decantr", "cache"),
25
30
  projectRoot
26
31
  });
27
32
  console.log("Checking for updates...\n");
28
33
  const upgrades = [];
29
- const themeId = essence.dna?.theme?.id || essence.theme?.id;
34
+ const themeId = essence.dna.theme.id;
30
35
  if (themeId) {
31
36
  const theme = await client.fetchTheme(themeId);
32
37
  if (theme) {
33
38
  const latestVersion = theme.data.version;
34
39
  if (latestVersion) {
35
- const current = essence.dna?.theme?.version || essence.theme?.version || "0.0.0";
40
+ const current = essence.dna.theme.version || "0.0.0";
36
41
  if (latestVersion !== current) {
37
42
  upgrades.push({
38
43
  type: "theme",
@@ -45,24 +50,6 @@ async function cmdUpgrade(projectRoot = process.cwd(), options = {}) {
45
50
  }
46
51
  }
47
52
  }
48
- if (essence.blueprint && typeof essence.blueprint === "string") {
49
- const blueprint = await client.fetchBlueprint(essence.blueprint);
50
- if (blueprint) {
51
- const latestVersion = blueprint.data.version;
52
- if (latestVersion) {
53
- const current = essence.blueprintVersion || "0.0.0";
54
- if (latestVersion !== current) {
55
- upgrades.push({
56
- type: "blueprint",
57
- id: essence.blueprint,
58
- currentVersion: current,
59
- latestVersion,
60
- data: blueprint.data
61
- });
62
- }
63
- }
64
- }
65
- }
66
53
  if (upgrades.length === 0) {
67
54
  console.log(`${GREEN}Everything is up to date.${RESET}`);
68
55
  return;
@@ -87,13 +74,8 @@ ${CYAN}Applying upgrades...${RESET}
87
74
  switch (upgrade.type) {
88
75
  case "theme": {
89
76
  await client.fetchTheme(upgrade.id);
90
- if (essence.dna?.theme) {
91
- essence.dna.theme.version = upgrade.latestVersion;
92
- essenceModified = true;
93
- } else if (essence.theme) {
94
- essence.theme.version = upgrade.latestVersion;
95
- essenceModified = true;
96
- }
77
+ essence.dna.theme.version = upgrade.latestVersion;
78
+ essenceModified = true;
97
79
  console.log(` ${GREEN}Theme cache updated.${RESET}`);
98
80
  break;
99
81
  }
@@ -111,19 +93,17 @@ ${CYAN}Applying upgrades...${RESET}
111
93
  console.log(`
112
94
  ${GREEN}Essence file updated.${RESET}`);
113
95
  }
114
- if (isV3(essence)) {
115
- console.log(`
96
+ console.log(`
116
97
  Regenerating context files...`);
117
- try {
118
- const result = await refreshDerivedFiles(projectRoot, essence, client);
119
- console.log(
120
- ` ${GREEN}Updated ${result.contextFiles.length} context file(s) and ${result.cssFiles.length} CSS file(s).${RESET}`
121
- );
122
- } catch (e) {
123
- console.log(
124
- ` ${YELLOW}Warning: Could not regenerate context files: ${e.message}${RESET}`
125
- );
126
- }
98
+ try {
99
+ const result = await refreshDerivedFiles(projectRoot, essence, client);
100
+ console.log(
101
+ ` ${GREEN}Updated ${result.contextFiles.length} context file(s) and ${result.cssFiles.length} CSS file(s).${RESET}`
102
+ );
103
+ } catch (e) {
104
+ console.log(
105
+ ` ${YELLOW}Warning: Could not regenerate context files: ${e.message}${RESET}`
106
+ );
127
107
  }
128
108
  console.log(`
129
109
  ${GREEN}All upgrades applied.${RESET}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/cli",
3
- "version": "1.11.0",
3
+ "version": "2.1.1",
4
4
  "description": "Decantr CLI - scaffold, audit, inspect Project Health, and maintain Decantr projects from the terminal",
5
5
  "author": "Decantr AI",
6
6
  "license": "MIT",
@@ -31,11 +31,11 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "ajv": "^8.20.0",
34
- "@decantr/core": "1.0.6",
35
- "@decantr/registry": "1.1.0",
36
- "@decantr/telemetry": "0.1.2",
37
- "@decantr/verifier": "1.1.1",
38
- "@decantr/essence-spec": "1.0.8"
34
+ "@decantr/core": "2.0.0",
35
+ "@decantr/telemetry": "2.1.0",
36
+ "@decantr/registry": "2.0.0",
37
+ "@decantr/verifier": "2.0.0",
38
+ "@decantr/essence-spec": "2.0.1"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsup",