@decantr/cli 1.10.0 → 2.1.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 +4 -1
- package/dist/bin.js +3 -3
- package/dist/{chunk-FLZVSNB5.js → chunk-5QM6XDZU.js} +3230 -3077
- package/dist/{chunk-K5KCZSEI.js → chunk-KGEEYXSU.js} +87 -9
- package/dist/{chunk-USOO77A5.js → chunk-WDA4SHIQ.js} +190 -283
- package/dist/{chunk-RSDCWAHD.js → chunk-X2HIXQAY.js} +9 -6
- package/dist/{chunk-DI2PLOJ6.js → chunk-ZUUJ24YU.js} +418 -180
- package/dist/{heal-5JHGCLDX.js → heal-MQ56WYX4.js} +2 -2
- package/dist/{health-SIKAOE2Z.js → health-DCT625XN.js} +3 -3
- package/dist/index.js +3 -3
- package/dist/{studio-EQSSNA6D.js → studio-CI7OOGHV.js} +21 -4
- package/dist/{upgrade-4NRDVD5N.js → upgrade-PL755AF7.js} +21 -41
- package/package.json +7 -7
- package/src/templates/decantr-health.workflow.yml.template +5 -5
|
@@ -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-KGEEYXSU.js";
|
|
12
|
+
import "./chunk-X2HIXQAY.js";
|
|
13
|
+
import "./chunk-ZUUJ24YU.js";
|
|
14
14
|
export {
|
|
15
15
|
cmdHealth,
|
|
16
16
|
createProjectHealthReport,
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
import "./chunk-
|
|
3
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-5QM6XDZU.js";
|
|
2
|
+
import "./chunk-WDA4SHIQ.js";
|
|
3
|
+
import "./chunk-ZUUJ24YU.js";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProjectHealthReport
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import
|
|
3
|
+
} from "./chunk-KGEEYXSU.js";
|
|
4
|
+
import "./chunk-X2HIXQAY.js";
|
|
5
|
+
import {
|
|
6
|
+
sendStudioHealthRefreshedTelemetry,
|
|
7
|
+
sendStudioStartedTelemetry
|
|
8
|
+
} from "./chunk-ZUUJ24YU.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
|
-
|
|
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-
|
|
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 {
|
|
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
|
|
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
|
|
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
|
-
|
|
91
|
-
|
|
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
|
-
|
|
115
|
-
console.log(`
|
|
96
|
+
console.log(`
|
|
116
97
|
Regenerating context files...`);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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.
|
|
3
|
+
"version": "2.1.0",
|
|
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",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"ajv": "^8.
|
|
34
|
-
"@decantr/core": "
|
|
35
|
-
"@decantr/essence-spec": "
|
|
36
|
-
"@decantr/registry": "
|
|
37
|
-
"@decantr/
|
|
38
|
-
"@decantr/
|
|
33
|
+
"ajv": "^8.20.0",
|
|
34
|
+
"@decantr/core": "2.0.0",
|
|
35
|
+
"@decantr/essence-spec": "2.0.1",
|
|
36
|
+
"@decantr/registry": "2.0.0",
|
|
37
|
+
"@decantr/verifier": "2.0.0",
|
|
38
|
+
"@decantr/telemetry": "2.1.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsup",
|
|
@@ -38,14 +38,14 @@ jobs:
|
|
|
38
38
|
fi
|
|
39
39
|
|
|
40
40
|
- name: Generate Decantr health JSON
|
|
41
|
-
run: npx --yes {{CLI_PACKAGE}} health --json --output {{JSON_PATH}}
|
|
41
|
+
{{PROJECT_WORKING_DIRECTORY}} run: npx --yes {{CLI_PACKAGE}} health --json --output {{JSON_PATH}}
|
|
42
42
|
|
|
43
43
|
- name: Audit Decantr health
|
|
44
|
-
run: npx --yes {{CLI_PACKAGE}} health --ci --fail-on {{FAIL_ON}} --markdown --output {{REPORT_PATH}}
|
|
44
|
+
{{PROJECT_WORKING_DIRECTORY}} run: npx --yes {{CLI_PACKAGE}} health --ci --fail-on {{FAIL_ON}} --markdown --output {{REPORT_PATH}}
|
|
45
45
|
|
|
46
46
|
- name: Publish health summary
|
|
47
47
|
if: always()
|
|
48
|
-
shell: bash
|
|
48
|
+
{{PROJECT_WORKING_DIRECTORY}} shell: bash
|
|
49
49
|
run: |
|
|
50
50
|
if [ -f {{REPORT_PATH}} ]; then
|
|
51
51
|
cat {{REPORT_PATH}} >> "$GITHUB_STEP_SUMMARY"
|
|
@@ -57,6 +57,6 @@ jobs:
|
|
|
57
57
|
with:
|
|
58
58
|
name: decantr-project-health
|
|
59
59
|
path: |
|
|
60
|
-
{{
|
|
61
|
-
{{
|
|
60
|
+
{{JSON_ARTIFACT_PATH}}
|
|
61
|
+
{{REPORT_ARTIFACT_PATH}}
|
|
62
62
|
if-no-files-found: ignore
|