@decantr/cli 3.5.0 → 3.5.2

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/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-LTNGAAV4.js";
2
+ import "./chunk-6FR73WZ6.js";
3
3
  import "./chunk-SIDKK73N.js";
4
- import "./chunk-RJ6PT7WP.js";
5
- import "./chunk-T45GFC6F.js";
4
+ import "./chunk-GDPC7PCB.js";
5
+ import "./chunk-GJG3O4QS.js";
6
6
  import "./chunk-PM7DKABI.js";
@@ -22,7 +22,7 @@ import {
22
22
  listWorkspaceCandidates,
23
23
  listWorkspaceProjects,
24
24
  shouldFailWorkspaceHealth
25
- } from "./chunk-RJ6PT7WP.js";
25
+ } from "./chunk-GDPC7PCB.js";
26
26
  import {
27
27
  acceptBrownfieldLocalLaw,
28
28
  acceptStyleBridge,
@@ -52,7 +52,7 @@ import {
52
52
  writeBrownfieldCodifyProposal,
53
53
  writeHostedPatternMappingProposal,
54
54
  writeStyleBridgeProposal
55
- } from "./chunk-T45GFC6F.js";
55
+ } from "./chunk-GJG3O4QS.js";
56
56
  import {
57
57
  buildGuardRegistryContext,
58
58
  createDoctrineMap,
@@ -4178,7 +4178,7 @@ function cmdCreate(type, name, projectRoot = process.cwd()) {
4178
4178
  }
4179
4179
 
4180
4180
  // src/commands/doctor.ts
4181
- import { existsSync as existsSync15, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "fs";
4181
+ import { existsSync as existsSync15, readdirSync as readdirSync5, readFileSync as readFileSync12, statSync as statSync5 } from "fs";
4182
4182
  import { dirname as dirname4, join as join17, relative as relative4 } from "path";
4183
4183
  import { fileURLToPath } from "url";
4184
4184
  import { isV4 as isV43 } from "@decantr/essence-spec";
@@ -4302,7 +4302,7 @@ function detectDesignAuthority(workspaceRoot, appRoot) {
4302
4302
  function findCiFiles(root) {
4303
4303
  const files = [];
4304
4304
  const workflows = join17(root, ".github", "workflows");
4305
- if (existsSync15(workflows)) {
4305
+ if (pathIsDirectory(workflows)) {
4306
4306
  for (const entry of readdirSync5(workflows, { withFileTypes: true })) {
4307
4307
  if (!entry.isFile()) continue;
4308
4308
  const path = join17(workflows, entry.name);
@@ -4312,12 +4312,26 @@ function findCiFiles(root) {
4312
4312
  }
4313
4313
  for (const candidate of ["Jenkinsfile", ".gitlab-ci.yml", "azure-pipelines.yml", "BUILD"]) {
4314
4314
  const path = join17(root, candidate);
4315
- if (existsSync15(path) && readFileSync12(path, "utf-8").includes("decantr")) {
4315
+ if (pathIsFile(path) && readFileSync12(path, "utf-8").includes("decantr")) {
4316
4316
  files.push(candidate);
4317
4317
  }
4318
4318
  }
4319
4319
  return files.sort();
4320
4320
  }
4321
+ function pathIsFile(path) {
4322
+ try {
4323
+ return statSync5(path).isFile();
4324
+ } catch {
4325
+ return false;
4326
+ }
4327
+ }
4328
+ function pathIsDirectory(path) {
4329
+ try {
4330
+ return statSync5(path).isDirectory();
4331
+ } catch {
4332
+ return false;
4333
+ }
4334
+ }
4321
4335
  function statusFromIssues(issues, essenceVersion) {
4322
4336
  if (!essenceVersion) return "needs-setup";
4323
4337
  if (essenceVersion && essenceVersion !== "4.0.0") return "needs-migration";
@@ -4460,13 +4474,16 @@ function inspectGraphArtifacts(appRoot, workspaceRoot) {
4460
4474
  };
4461
4475
  }
4462
4476
  }
4463
- function buildDoctorReport(root, args) {
4464
- let projectArg;
4477
+ function parseDoctorProjectArg(args) {
4465
4478
  for (let index = 1; index < args.length; index += 1) {
4466
4479
  const arg = args[index];
4467
- if (arg === "--project" && args[index + 1]) projectArg = args[++index];
4468
- else if (arg.startsWith("--project=")) projectArg = arg.slice("--project=".length);
4480
+ if (arg === "--project" && args[index + 1]) return args[index + 1];
4481
+ if (arg.startsWith("--project=")) return arg.slice("--project=".length);
4469
4482
  }
4483
+ return void 0;
4484
+ }
4485
+ function buildDoctorReport(root, args) {
4486
+ const projectArg = parseDoctorProjectArg(args);
4470
4487
  const workspaceMode = args.includes("--workspace");
4471
4488
  const workspaceInfo = resolveWorkspaceInfo(root, projectArg);
4472
4489
  const workspaceRoot = workspaceInfo.workspaceRoot;
@@ -4829,6 +4846,18 @@ ${BOLD3}Examples:${RESET4}
4829
4846
  `);
4830
4847
  }
4831
4848
  async function cmdDoctor(args = ["doctor"], root = process.cwd()) {
4849
+ const projectArg = parseDoctorProjectArg(args);
4850
+ const workspaceMode = args.includes("--workspace");
4851
+ if (projectArg && !args.includes("--json")) {
4852
+ const workspaceInfo = resolveWorkspaceInfo(root, projectArg);
4853
+ const appRoot = workspaceMode ? workspaceInfo.workspaceRoot : workspaceInfo.appRoot;
4854
+ if (!existsSync15(appRoot)) {
4855
+ console.error(`${RED3}Project path does not exist: ${projectArg}${RESET4}`);
4856
+ console.error(`${DIM4}Run decantr workspace list to see detected app candidates.${RESET4}`);
4857
+ process.exitCode = 1;
4858
+ return;
4859
+ }
4860
+ }
4832
4861
  const report = buildDoctorReport(root, args);
4833
4862
  if (args.includes("--json")) {
4834
4863
  console.log(JSON.stringify(report, null, 2));
@@ -6166,7 +6195,7 @@ async function cmdPublish(type, name, projectRoot = process.cwd()) {
6166
6195
 
6167
6196
  // src/commands/refresh.ts
6168
6197
  import { createHash } from "crypto";
6169
- import { existsSync as existsSync22, readdirSync as readdirSync6, readFileSync as readFileSync16, statSync as statSync5 } from "fs";
6198
+ import { existsSync as existsSync22, readdirSync as readdirSync6, readFileSync as readFileSync16, statSync as statSync6 } from "fs";
6170
6199
  import { isAbsolute as isAbsolute2, join as join24, relative as relative5 } from "path";
6171
6200
  import { isV4 as isV45 } from "@decantr/essence-spec";
6172
6201
  import { collectMissingPackManifestFiles as collectMissingPackManifestFiles2 } from "@decantr/verifier";
@@ -6211,7 +6240,7 @@ function snapshotGeneratedFiles(projectRoot) {
6211
6240
  }
6212
6241
  function fileMtimeMs(path) {
6213
6242
  try {
6214
- return statSync5(path).mtimeMs;
6243
+ return statSync6(path).mtimeMs;
6215
6244
  } catch {
6216
6245
  return 0;
6217
6246
  }
@@ -11044,7 +11073,7 @@ async function cmdAdoptWorkflow(args) {
11044
11073
  await cmdGraph(projectRoot, { displayRoot: process.cwd() });
11045
11074
  if (process.exitCode && process.exitCode !== 0) return;
11046
11075
  if (runVerify) {
11047
- const { cmdHealth } = await import("./health-RKUKPG72.js");
11076
+ const { cmdHealth } = await import("./health-G7Z7L5TV.js");
11048
11077
  await cmdHealth(projectRoot, {
11049
11078
  browser: runBrowser,
11050
11079
  browserBaseUrl: baseUrl,
@@ -11118,7 +11147,7 @@ async function cmdVerifyWorkflow(args) {
11118
11147
  return;
11119
11148
  }
11120
11149
  if (workspaceMode) {
11121
- const { cmdWorkspace } = await import("./workspace-RJCFPVBL.js");
11150
+ const { cmdWorkspace } = await import("./workspace-F3KQMALN.js");
11122
11151
  await cmdWorkspace(process.cwd(), ["workspace", "health", ...withoutWorkflowOnlyFlags(args)]);
11123
11152
  return;
11124
11153
  }
@@ -11161,7 +11190,7 @@ async function cmdVerifyWorkflow(args) {
11161
11190
  process.exitCode = void 0;
11162
11191
  }
11163
11192
  }
11164
- const { cmdHealth, parseHealthArgs } = await import("./health-RKUKPG72.js");
11193
+ const { cmdHealth, parseHealthArgs } = await import("./health-G7Z7L5TV.js");
11165
11194
  await cmdHealth(workspaceInfo.appRoot, parseHealthArgs(healthArgs));
11166
11195
  if (localPatterns) {
11167
11196
  const validation = validateLocalLaw(workspaceInfo.appRoot);
@@ -12823,7 +12852,7 @@ async function main() {
12823
12852
  const { flags } = parseLooseArgs(args);
12824
12853
  const workspaceInfo = resolveWorkflowProject(flags, "health");
12825
12854
  if (!workspaceInfo) break;
12826
- const { cmdHealth, parseHealthArgs } = await import("./health-RKUKPG72.js");
12855
+ const { cmdHealth, parseHealthArgs } = await import("./health-G7Z7L5TV.js");
12827
12856
  await cmdHealth(workspaceInfo.appRoot, parseHealthArgs(stripProjectArgs(args)));
12828
12857
  } catch (e) {
12829
12858
  console.error(error2(e.message));
@@ -12851,7 +12880,7 @@ async function main() {
12851
12880
  cmdStudioHelp();
12852
12881
  break;
12853
12882
  }
12854
- const { cmdStudio, parseStudioArgs } = await import("./studio-C2F72QL6.js");
12883
+ const { cmdStudio, parseStudioArgs } = await import("./studio-QG7MX3QS.js");
12855
12884
  await cmdStudio(process.cwd(), parseStudioArgs(args));
12856
12885
  } catch (e) {
12857
12886
  console.error(error2(e.message));
@@ -12865,7 +12894,7 @@ async function main() {
12865
12894
  cmdWorkspaceHelp();
12866
12895
  break;
12867
12896
  }
12868
- const { cmdWorkspace } = await import("./workspace-RJCFPVBL.js");
12897
+ const { cmdWorkspace } = await import("./workspace-F3KQMALN.js");
12869
12898
  await cmdWorkspace(process.cwd(), args);
12870
12899
  } catch (e) {
12871
12900
  console.error(error2(e.message));
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createProjectHealthReport,
3
3
  listWorkspaceAppCandidates
4
- } from "./chunk-T45GFC6F.js";
4
+ } from "./chunk-GJG3O4QS.js";
5
5
 
6
6
  // src/commands/workspace.ts
7
7
  import { execFileSync } from "child_process";
@@ -1836,7 +1836,7 @@ function pathAliasTargetCandidates(source, config) {
1836
1836
  if (!source.startsWith(prefix) || !source.endsWith(suffix)) continue;
1837
1837
  const matched = source.slice(prefix.length, source.length - suffix.length);
1838
1838
  for (const target of alias.targets) {
1839
- candidates.push(target.replace("*", matched));
1839
+ candidates.push(target.split("*").join(matched));
1840
1840
  }
1841
1841
  }
1842
1842
  if (config.baseUrl) {
@@ -2733,18 +2733,20 @@ function buildGraphArtifacts(projectRoot, options = {}) {
2733
2733
  const sources = sourceArtifacts(projectRoot, componentReuseAudit);
2734
2734
  const combinedSourceHash = sourceHash(sources);
2735
2735
  const previousSnapshot = readJsonFile3(paths.snapshot);
2736
- const createdAt = previousSnapshot?.source_hash === combinedSourceHash ? previousSnapshot.created_at : (/* @__PURE__ */ new Date()).toISOString();
2736
+ const previousDiff = readJsonFile3(paths.diff);
2737
+ const sourceUnchanged = previousSnapshot?.source_hash === combinedSourceHash;
2738
+ const createdAt = sourceUnchanged ? previousSnapshot.created_at : (/* @__PURE__ */ new Date()).toISOString();
2737
2739
  const snapshotId = `graph:${combinedSourceHash.replace(/^sha256:/, "").slice(0, 12)}`;
2738
2740
  paths = withSnapshotHistoryPath(paths, snapshotId);
2739
2741
  const baseSnapshot = buildGraphSnapshotFromEssence(essence, {
2740
2742
  snapshotId,
2741
- parentId: previousSnapshot && previousSnapshot.id !== snapshotId ? previousSnapshot.id : void 0,
2743
+ parentId: sourceUnchanged ? previousSnapshot.parent_id : previousSnapshot ? previousSnapshot.id : void 0,
2742
2744
  sourceHash: combinedSourceHash,
2743
2745
  createdAt,
2744
2746
  sourceArtifact: sources[0]
2745
2747
  });
2746
2748
  const snapshot = augmentProjectGraph(baseSnapshot, projectRoot, sources, componentReuseAudit);
2747
- const diff = previousSnapshot ? diffGraphSnapshots(previousSnapshot, snapshot) : {
2749
+ const diff = sourceUnchanged && previousDiff?.to === snapshot.id ? previousDiff : previousSnapshot ? diffGraphSnapshots(previousSnapshot, snapshot) : {
2748
2750
  $schema: GRAPH_DIFF_SCHEMA_URL,
2749
2751
  id: `diff:${snapshot.id}:${snapshot.id}`,
2750
2752
  from: snapshot.id,
@@ -13,7 +13,7 @@ import {
13
13
  renderProjectHealthCiWorkflow,
14
14
  shouldFailHealth,
15
15
  writeProjectHealthCiWorkflow
16
- } from "./chunk-T45GFC6F.js";
16
+ } from "./chunk-GJG3O4QS.js";
17
17
  import "./chunk-PM7DKABI.js";
18
18
  export {
19
19
  cmdHealth,
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./chunk-LTNGAAV4.js";
1
+ import "./chunk-6FR73WZ6.js";
2
2
  import "./chunk-SIDKK73N.js";
3
- import "./chunk-RJ6PT7WP.js";
4
- import "./chunk-T45GFC6F.js";
3
+ import "./chunk-GDPC7PCB.js";
4
+ import "./chunk-GJG3O4QS.js";
5
5
  import "./chunk-PM7DKABI.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createWorkspaceHealthReport
3
- } from "./chunk-RJ6PT7WP.js";
3
+ } from "./chunk-GDPC7PCB.js";
4
4
  import {
5
5
  createProjectHealthReport
6
- } from "./chunk-T45GFC6F.js";
6
+ } from "./chunk-GJG3O4QS.js";
7
7
  import {
8
8
  sendStudioHealthRefreshedTelemetry,
9
9
  sendStudioStartedTelemetry
@@ -7,8 +7,8 @@ import {
7
7
  listWorkspaceProjects,
8
8
  parseWorkspaceArgs,
9
9
  shouldFailWorkspaceHealth
10
- } from "./chunk-RJ6PT7WP.js";
11
- import "./chunk-T45GFC6F.js";
10
+ } from "./chunk-GDPC7PCB.js";
11
+ import "./chunk-GJG3O4QS.js";
12
12
  import "./chunk-PM7DKABI.js";
13
13
  export {
14
14
  cmdWorkspace,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/cli",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "Decantr CLI - adopt, verify, graph, and govern frontend codebases touched by AI agents",
5
5
  "keywords": [
6
6
  "decantr",
@@ -50,10 +50,10 @@
50
50
  "dependencies": {
51
51
  "ajv": "^8.20.0",
52
52
  "@decantr/core": "3.5.0",
53
- "@decantr/registry": "3.4.0",
54
- "@decantr/verifier": "3.5.0",
53
+ "@decantr/essence-spec": "3.4.0",
55
54
  "@decantr/telemetry": "3.4.0",
56
- "@decantr/essence-spec": "3.4.0"
55
+ "@decantr/registry": "3.4.0",
56
+ "@decantr/verifier": "3.5.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",