@decantr/cli 1.7.13 → 1.7.14

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,14 +1,15 @@
1
1
  import {
2
- buildGuardRegistryContext
3
- } from "./chunk-KUDAVJOR.js";
2
+ buildGuardRegistryContext,
3
+ scanProjectInteractions
4
+ } from "./chunk-QRQCPD3C.js";
4
5
 
5
6
  // src/commands/heal.ts
6
- import { readFileSync as readFileSync2, existsSync as existsSync2 } from "fs";
7
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
7
8
  import { join as join2 } from "path";
8
- import { validateEssence, evaluateGuard } from "@decantr/essence-spec";
9
+ import { evaluateGuard, validateEssence } from "@decantr/essence-spec";
9
10
 
10
11
  // src/telemetry.ts
11
- import { readFileSync, writeFileSync, existsSync } from "fs";
12
+ import { existsSync, readFileSync, writeFileSync } from "fs";
12
13
  import { join } from "path";
13
14
  var TELEMETRY_ENDPOINT = "https://api.decantr.ai/v1/telemetry/guard";
14
15
  var TELEMETRY_TIMEOUT_MS = 3e3;
@@ -112,8 +113,17 @@ async function cmdHeal(projectRoot = process.cwd(), options = {}) {
112
113
  });
113
114
  }
114
115
  }
116
+ let interactionIssues = [];
115
117
  try {
116
- const violations = evaluateGuard(essence, buildGuardRegistryContext(projectRoot));
118
+ interactionIssues = scanProjectInteractions(projectRoot);
119
+ } catch {
120
+ }
121
+ try {
122
+ const guardContext = buildGuardRegistryContext(projectRoot);
123
+ const violations = evaluateGuard(essence, {
124
+ ...guardContext,
125
+ interaction_issues: interactionIssues
126
+ });
117
127
  for (const v of violations) {
118
128
  issues.push({
119
129
  type: v.severity === "error" ? "error" : "warning",
@@ -140,13 +150,19 @@ async function cmdHeal(projectRoot = process.cwd(), options = {}) {
140
150
  }
141
151
  console.log(`
142
152
  ${YELLOW}Manual fixes required. Review the issues above.${RESET}`);
153
+ const hasError = issues.some((i) => i.type === "error");
154
+ if (hasError) {
155
+ process.exitCode = 1;
156
+ }
143
157
  await maybeSendTelemetry(projectRoot, essence, issues, options);
144
158
  }
145
159
  async function maybeSendTelemetry(projectRoot, essence, issues, options) {
146
160
  if (options.telemetry && !isOptedIn(projectRoot)) {
147
161
  optIn(projectRoot);
148
- console.log(`
149
- ${CYAN}Telemetry enabled.${RESET} Anonymous guard metrics will be sent on future checks.`);
162
+ console.log(
163
+ `
164
+ ${CYAN}Telemetry enabled.${RESET} Anonymous guard metrics will be sent on future checks.`
165
+ );
150
166
  console.log(`${DIM}Set "telemetry": false in .decantr/project.json to opt out.${RESET}`);
151
167
  }
152
168
  if (isOptedIn(projectRoot)) {
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import "./chunk-YSBFK43A.js";
2
- import "./chunk-NZ4SGTDS.js";
3
- import "./chunk-KUDAVJOR.js";
1
+ import "./chunk-M2DFCY3N.js";
2
+ import "./chunk-WINKQSUX.js";
3
+ import "./chunk-QRQCPD3C.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  RegistryClient,
3
3
  refreshDerivedFiles
4
- } from "./chunk-NZ4SGTDS.js";
4
+ } from "./chunk-WINKQSUX.js";
5
5
 
6
6
  // src/commands/upgrade.ts
7
- import { readFileSync, writeFileSync, existsSync } from "fs";
7
+ import { existsSync, readFileSync, writeFileSync } from "fs";
8
8
  import { join } from "path";
9
9
  import { isV3 } from "@decantr/essence-spec";
10
10
  var GREEN = "\x1B[32m";
@@ -69,7 +69,9 @@ async function cmdUpgrade(projectRoot = process.cwd(), options = {}) {
69
69
  }
70
70
  console.log("Available upgrades:\n");
71
71
  for (const u of upgrades) {
72
- console.log(` ${u.type}/${u.id}: ${DIM}${u.currentVersion}${RESET} -> ${GREEN}${u.latestVersion}${RESET}`);
72
+ console.log(
73
+ ` ${u.type}/${u.id}: ${DIM}${u.currentVersion}${RESET} -> ${GREEN}${u.latestVersion}${RESET}`
74
+ );
73
75
  }
74
76
  if (!options.apply) {
75
77
  console.log(`
@@ -114,9 +116,13 @@ ${CYAN}Applying upgrades...${RESET}
114
116
  Regenerating context files...`);
115
117
  try {
116
118
  const result = await refreshDerivedFiles(projectRoot, essence, client);
117
- console.log(` ${GREEN}Updated ${result.contextFiles.length} context file(s) and ${result.cssFiles.length} CSS file(s).${RESET}`);
119
+ console.log(
120
+ ` ${GREEN}Updated ${result.contextFiles.length} context file(s) and ${result.cssFiles.length} CSS file(s).${RESET}`
121
+ );
118
122
  } catch (e) {
119
- console.log(` ${YELLOW}Warning: Could not regenerate context files: ${e.message}${RESET}`);
123
+ console.log(
124
+ ` ${YELLOW}Warning: Could not regenerate context files: ${e.message}${RESET}`
125
+ );
120
126
  }
121
127
  }
122
128
  console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/cli",
3
- "version": "1.7.13",
3
+ "version": "1.7.14",
4
4
  "description": "Decantr CLI — scaffold, audit, and maintain Decantr projects from the terminal",
5
5
  "author": "Decantr AI",
6
6
  "license": "MIT",
@@ -28,15 +28,16 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@decantr/core": "1.0.2",
31
- "@decantr/essence-spec": "1.0.4",
31
+ "@decantr/verifier": "1.0.2",
32
32
  "@decantr/registry": "1.0.2",
33
- "@decantr/verifier": "1.0.2"
33
+ "@decantr/essence-spec": "1.0.4"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup",
37
37
  "certify:blueprints": "pnpm build && node scripts/certify-blueprints.mjs",
38
38
  "certify:workflows": "pnpm build && node scripts/certify-workflows.mjs",
39
39
  "test": "vitest run",
40
- "test:watch": "vitest"
40
+ "test:watch": "vitest",
41
+ "preversion": "pnpm build && pnpm test"
41
42
  }
42
43
  }
@@ -1,46 +0,0 @@
1
- // src/guard-context.ts
2
- import { existsSync, readdirSync, readFileSync } from "fs";
3
- import { join } from "path";
4
- function loadJsonEntries(dir) {
5
- if (!existsSync(dir)) return [];
6
- try {
7
- return readdirSync(dir).filter((file) => file.endsWith(".json") && file !== "index.json").map((file) => JSON.parse(readFileSync(join(dir, file), "utf-8")));
8
- } catch {
9
- return [];
10
- }
11
- }
12
- function buildGuardRegistryContext(projectRoot = process.cwd()) {
13
- const themeRegistry = /* @__PURE__ */ new Map();
14
- const patternRegistry = /* @__PURE__ */ new Map();
15
- const cacheDir = join(projectRoot, ".decantr", "cache");
16
- const customDir = join(projectRoot, ".decantr", "custom");
17
- for (const data of loadJsonEntries(join(cacheDir, "@official", "themes"))) {
18
- if (typeof data.id === "string" && !themeRegistry.has(data.id)) {
19
- themeRegistry.set(data.id, {
20
- modes: Array.isArray(data.modes) ? data.modes.filter((mode) => typeof mode === "string") : ["light", "dark"]
21
- });
22
- }
23
- }
24
- for (const data of loadJsonEntries(join(customDir, "themes"))) {
25
- if (typeof data.id === "string") {
26
- themeRegistry.set(`custom:${data.id}`, {
27
- modes: Array.isArray(data.modes) ? data.modes.filter((mode) => typeof mode === "string") : ["light", "dark"]
28
- });
29
- }
30
- }
31
- for (const data of loadJsonEntries(join(cacheDir, "@official", "patterns"))) {
32
- if (typeof data.id === "string" && !patternRegistry.has(data.id)) {
33
- patternRegistry.set(data.id, data);
34
- }
35
- }
36
- for (const data of loadJsonEntries(join(customDir, "patterns"))) {
37
- if (typeof data.id === "string") {
38
- patternRegistry.set(data.id, data);
39
- }
40
- }
41
- return { themeRegistry, patternRegistry };
42
- }
43
-
44
- export {
45
- buildGuardRegistryContext
46
- };