@decantr/cli 3.5.2 → 3.5.4

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-6FR73WZ6.js";
2
+ import "./chunk-GPGBJFMF.js";
3
3
  import "./chunk-SIDKK73N.js";
4
- import "./chunk-GDPC7PCB.js";
5
- import "./chunk-GJG3O4QS.js";
6
- import "./chunk-PM7DKABI.js";
4
+ import "./chunk-UDBPH25I.js";
5
+ import "./chunk-EWUWVQYM.js";
6
+ import "./chunk-4WVKE2AQ.js";
@@ -458,6 +458,8 @@ function walkSvelteKitRoutes(dir, baseDir, segments) {
458
458
  var ROUTER_FILE_EXTENSIONS = /* @__PURE__ */ new Set([".tsx", ".ts", ".jsx", ".js"]);
459
459
  var ROUTE_VARIABLE_NAMES = "(?:path|pathname|route|currentPath|currentRoute|locationPath|activePath)";
460
460
  var ROUTE_ASSET_EXTENSION_RE = /\.(?:avif|bmp|css|gif|ico|jpeg|jpg|js|json|map|mp4|pdf|png|svg|webp|woff2?)$/i;
461
+ var JSX_ROUTE_PATH_RE = /<(?:Route|[A-Z][\w.]*Route)\b[^>]*\bpath\s*=\s*(?:"([^"]+)"|'([^']+)'|{\s*"([^"]+)"\s*}|{\s*'([^']+)'\s*}|{\s*`([^`]+)`\s*})/g;
462
+ var OBJECT_ROUTE_PATH_RE = /\bpath\s*:\s*(?:"([^"]+)"|'([^']+)'|`([^`]+)`)/g;
461
463
  function collectRouteCandidateFiles(dir, files, depth = 0) {
462
464
  if (depth > 5) return;
463
465
  let entries;
@@ -501,13 +503,18 @@ function scanReactRouter(projectRoot) {
501
503
  const relativePath = relative2(projectRoot, absolutePath);
502
504
  const pathMatches = /* @__PURE__ */ new Set();
503
505
  if (isReactRouterFile) {
504
- for (const match of content.matchAll(/<Route\b[^>]*\bpath=["'`]([^"'`]+)["'`]/g)) {
505
- pathMatches.add(match[1]);
506
+ for (const match of content.matchAll(JSX_ROUTE_PATH_RE)) {
507
+ const route = firstRouteLiteralMatch(match);
508
+ if (route) pathMatches.add(route);
506
509
  }
507
- for (const match of content.matchAll(/\bpath\s*:\s*["'`]([^"'`]+)["'`]/g)) {
508
- pathMatches.add(match[1]);
510
+ for (const match of content.matchAll(OBJECT_ROUTE_PATH_RE)) {
511
+ const route = firstRouteLiteralMatch(match);
512
+ if (route) pathMatches.add(route);
509
513
  }
510
514
  }
515
+ for (const route of detectDeclarativeRouteSpecRoutes(content)) {
516
+ pathMatches.add(route);
517
+ }
511
518
  for (const route of detectPathnameBranchRoutes(content)) {
512
519
  pathMatches.add(route);
513
520
  }
@@ -516,32 +523,48 @@ function scanReactRouter(projectRoot) {
516
523
  pathMatches.add("/");
517
524
  }
518
525
  for (const path of pathMatches) {
519
- const routePath = normalizeDetectedRouteLiteral(path);
520
- if (!routePath || routeMap.has(routePath)) continue;
521
- routeMap.set(routePath, {
522
- path: routePath,
523
- file: relativePath,
524
- hasLayout: false
525
- });
526
+ for (const routePath of normalizeDetectedRouteLiterals(path)) {
527
+ if (routeMap.has(routePath)) continue;
528
+ routeMap.set(routePath, {
529
+ path: routePath,
530
+ file: relativePath,
531
+ hasLayout: false
532
+ });
533
+ }
526
534
  }
527
535
  }
528
536
  return [...routeMap.values()];
529
537
  }
530
- function normalizeDetectedRouteLiteral(value) {
531
- const cleaned = value.trim().split(/[?#]/)[0];
532
- if (!cleaned || cleaned === "/") return "/";
533
- if (cleaned === "*" || cleaned === "**" || cleaned.startsWith("#")) return null;
534
- if (!cleaned.startsWith("/") || cleaned.startsWith("//")) return null;
535
- if (ROUTE_ASSET_EXTENSION_RE.test(cleaned)) return null;
536
- return cleaned.replace(/\/+$/g, "") || "/";
538
+ function firstRouteLiteralMatch(match) {
539
+ return match.slice(1).find((value) => typeof value === "string") ?? null;
540
+ }
541
+ function normalizeDetectedRouteLiterals(value) {
542
+ const withoutHash = value.trim().split("#")[0];
543
+ const cleaned = withoutHash.includes("?") && !withoutHash.endsWith(")?") ? withoutHash.split("?")[0] : withoutHash;
544
+ if (!cleaned || cleaned === "/") return ["/"];
545
+ if (cleaned === "*" || cleaned === "**" || cleaned.startsWith("#")) return [];
546
+ if (cleaned === "/*" || cleaned === "/**") return [];
547
+ if (!cleaned.startsWith("/") || cleaned.startsWith("//")) return [];
548
+ if (ROUTE_ASSET_EXTENSION_RE.test(cleaned)) return [];
549
+ const optionalGroup = cleaned.match(/^\/\(([^()]+)\)\?$/);
550
+ if (optionalGroup) {
551
+ return [
552
+ "/",
553
+ ...optionalGroup[1].split("|").map((segment) => segment.trim()).filter(Boolean).map((segment) => `/${segment}`)
554
+ ];
555
+ }
556
+ const withoutTrailingWildcard = cleaned.endsWith("*") && !cleaned.endsWith("/*") && !/:\w+\*$/.test(cleaned) ? cleaned.slice(0, -1) : cleaned;
557
+ const normalized2 = withoutTrailingWildcard.replace(/\/+$/g, "") || "/";
558
+ if (normalized2 === "/*" || normalized2 === "/**") return [];
559
+ return [normalized2];
537
560
  }
538
561
  function collectRouteLiterals(pattern, content, routes) {
539
562
  let count = 0;
540
563
  for (const match of content.matchAll(pattern)) {
541
- const route = normalizeDetectedRouteLiteral(match[1] ?? "");
542
- if (!route) continue;
543
- routes.add(route);
544
- count += 1;
564
+ for (const route of normalizeDetectedRouteLiterals(match[1] ?? "")) {
565
+ routes.add(route);
566
+ count += 1;
567
+ }
545
568
  }
546
569
  return count;
547
570
  }
@@ -569,6 +592,17 @@ function detectPathnameBranchRoutes(content) {
569
592
  }
570
593
  return [...routes];
571
594
  }
595
+ function detectDeclarativeRouteSpecRoutes(content) {
596
+ const routes = /* @__PURE__ */ new Set();
597
+ const hasRouteSpecSignal = content.includes("@wasp.sh/spec") || /\b(?:const|export\s+const)\s+\w*Spec\b/.test(content) || /\bapp\s*\(\s*\{[\s\S]*\bspec\s*:/.test(content);
598
+ if (!hasRouteSpecSignal) return [];
599
+ collectRouteLiterals(
600
+ /\broute\s*\(\s*["'`][^"'`]*["'`]\s*,\s*["'`](\/[^"'`]*)["'`]\s*,\s*page\s*\(/g,
601
+ content,
602
+ routes
603
+ );
604
+ return [...routes];
605
+ }
572
606
  function hasReactRouterDependency(projectRoot) {
573
607
  return hasDependency(projectRoot, ["react-router", "react-router-dom"]);
574
608
  }
@@ -3,7 +3,7 @@ import {
3
3
  sendProjectHealthCiFailedTelemetry,
4
4
  sendProjectHealthPromptTelemetry,
5
5
  sendProjectHealthReportTelemetry
6
- } from "./chunk-PM7DKABI.js";
6
+ } from "./chunk-4WVKE2AQ.js";
7
7
 
8
8
  // src/commands/health.ts
9
9
  import { execFileSync as execFileSync2 } from "child_process";
@@ -22,7 +22,7 @@ import {
22
22
  listWorkspaceCandidates,
23
23
  listWorkspaceProjects,
24
24
  shouldFailWorkspaceHealth
25
- } from "./chunk-GDPC7PCB.js";
25
+ } from "./chunk-UDBPH25I.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-GJG3O4QS.js";
55
+ } from "./chunk-EWUWVQYM.js";
56
56
  import {
57
57
  buildGuardRegistryContext,
58
58
  createDoctrineMap,
@@ -69,7 +69,7 @@ import {
69
69
  sendCliCommandTelemetry,
70
70
  sendNewProjectCompletedTelemetry,
71
71
  writeDoctrineMap
72
- } from "./chunk-PM7DKABI.js";
72
+ } from "./chunk-4WVKE2AQ.js";
73
73
 
74
74
  // src/index.ts
75
75
  import { existsSync as existsSync29, mkdirSync as mkdirSync16, readdirSync as readdirSync8, readFileSync as readFileSync22, writeFileSync as writeFileSync19 } from "fs";
@@ -6220,11 +6220,16 @@ function walkFiles(dir) {
6220
6220
  return files;
6221
6221
  }
6222
6222
  function trackedGeneratedFiles(projectRoot) {
6223
- return [
6223
+ const files = [
6224
6224
  join24(projectRoot, "DECANTR.md"),
6225
- ...walkFiles(join24(projectRoot, ".decantr", "context")),
6226
- ...["global.css", "tokens.css", "treatments.css", "decantr-bridge.css"].map((file) => join24(projectRoot, "src", "styles", file)).filter((path) => existsSync22(path))
6227
- ].filter((path) => existsSync22(path));
6225
+ ...walkFiles(join24(projectRoot, ".decantr", "context"))
6226
+ ];
6227
+ if (!isContractOnlyProject2(projectRoot)) {
6228
+ files.push(
6229
+ ...["global.css", "tokens.css", "treatments.css", "decantr-bridge.css"].map((file) => join24(projectRoot, "src", "styles", file)).filter((path) => existsSync22(path))
6230
+ );
6231
+ }
6232
+ return files.filter((path) => existsSync22(path));
6228
6233
  }
6229
6234
  function snapshotGeneratedFiles(projectRoot) {
6230
6235
  const map = /* @__PURE__ */ new Map();
@@ -11073,7 +11078,7 @@ async function cmdAdoptWorkflow(args) {
11073
11078
  await cmdGraph(projectRoot, { displayRoot: process.cwd() });
11074
11079
  if (process.exitCode && process.exitCode !== 0) return;
11075
11080
  if (runVerify) {
11076
- const { cmdHealth } = await import("./health-G7Z7L5TV.js");
11081
+ const { cmdHealth } = await import("./health-WO2BQYIC.js");
11077
11082
  await cmdHealth(projectRoot, {
11078
11083
  browser: runBrowser,
11079
11084
  browserBaseUrl: baseUrl,
@@ -11147,7 +11152,7 @@ async function cmdVerifyWorkflow(args) {
11147
11152
  return;
11148
11153
  }
11149
11154
  if (workspaceMode) {
11150
- const { cmdWorkspace } = await import("./workspace-F3KQMALN.js");
11155
+ const { cmdWorkspace } = await import("./workspace-G6PN53XI.js");
11151
11156
  await cmdWorkspace(process.cwd(), ["workspace", "health", ...withoutWorkflowOnlyFlags(args)]);
11152
11157
  return;
11153
11158
  }
@@ -11180,7 +11185,7 @@ async function cmdVerifyWorkflow(args) {
11180
11185
  }
11181
11186
  let guardExitCode;
11182
11187
  if (brownfield) {
11183
- const { cmdHeal, collectCheckIssues } = await import("./heal-YXWB6LTI.js");
11188
+ const { cmdHeal, collectCheckIssues } = await import("./heal-4BQCO4ST.js");
11184
11189
  if (quietOutput) {
11185
11190
  const result = collectCheckIssues(workspaceInfo.appRoot, { brownfield: true });
11186
11191
  guardExitCode = result.issues.some((issue) => issue.type === "error") ? 1 : void 0;
@@ -11190,7 +11195,7 @@ async function cmdVerifyWorkflow(args) {
11190
11195
  process.exitCode = void 0;
11191
11196
  }
11192
11197
  }
11193
- const { cmdHealth, parseHealthArgs } = await import("./health-G7Z7L5TV.js");
11198
+ const { cmdHealth, parseHealthArgs } = await import("./health-WO2BQYIC.js");
11194
11199
  await cmdHealth(workspaceInfo.appRoot, parseHealthArgs(healthArgs));
11195
11200
  if (localPatterns) {
11196
11201
  const validation = validateLocalLaw(workspaceInfo.appRoot);
@@ -12827,7 +12832,7 @@ async function main() {
12827
12832
  `${YELLOW13}Note: \`decantr heal\` is deprecated. Use \`decantr check\` instead.${RESET17}`
12828
12833
  );
12829
12834
  }
12830
- const { cmdHeal } = await import("./heal-YXWB6LTI.js");
12835
+ const { cmdHeal } = await import("./heal-4BQCO4ST.js");
12831
12836
  const { flags } = parseLooseArgs(args);
12832
12837
  const workspaceInfo = resolveWorkflowProject(flags, "check");
12833
12838
  if (!workspaceInfo) break;
@@ -12852,7 +12857,7 @@ async function main() {
12852
12857
  const { flags } = parseLooseArgs(args);
12853
12858
  const workspaceInfo = resolveWorkflowProject(flags, "health");
12854
12859
  if (!workspaceInfo) break;
12855
- const { cmdHealth, parseHealthArgs } = await import("./health-G7Z7L5TV.js");
12860
+ const { cmdHealth, parseHealthArgs } = await import("./health-WO2BQYIC.js");
12856
12861
  await cmdHealth(workspaceInfo.appRoot, parseHealthArgs(stripProjectArgs(args)));
12857
12862
  } catch (e) {
12858
12863
  console.error(error2(e.message));
@@ -12880,7 +12885,7 @@ async function main() {
12880
12885
  cmdStudioHelp();
12881
12886
  break;
12882
12887
  }
12883
- const { cmdStudio, parseStudioArgs } = await import("./studio-QG7MX3QS.js");
12888
+ const { cmdStudio, parseStudioArgs } = await import("./studio-TXFV3PDM.js");
12884
12889
  await cmdStudio(process.cwd(), parseStudioArgs(args));
12885
12890
  } catch (e) {
12886
12891
  console.error(error2(e.message));
@@ -12894,7 +12899,7 @@ async function main() {
12894
12899
  cmdWorkspaceHelp();
12895
12900
  break;
12896
12901
  }
12897
- const { cmdWorkspace } = await import("./workspace-F3KQMALN.js");
12902
+ const { cmdWorkspace } = await import("./workspace-G6PN53XI.js");
12898
12903
  await cmdWorkspace(process.cwd(), args);
12899
12904
  } catch (e) {
12900
12905
  console.error(error2(e.message));
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createProjectHealthReport,
3
3
  listWorkspaceAppCandidates
4
- } from "./chunk-GJG3O4QS.js";
4
+ } from "./chunk-EWUWVQYM.js";
5
5
 
6
6
  // src/commands/workspace.ts
7
7
  import { execFileSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cmdHeal,
3
3
  collectCheckIssues
4
- } from "./chunk-PM7DKABI.js";
4
+ } from "./chunk-4WVKE2AQ.js";
5
5
  export {
6
6
  cmdHeal,
7
7
  collectCheckIssues
@@ -13,8 +13,8 @@ import {
13
13
  renderProjectHealthCiWorkflow,
14
14
  shouldFailHealth,
15
15
  writeProjectHealthCiWorkflow
16
- } from "./chunk-GJG3O4QS.js";
17
- import "./chunk-PM7DKABI.js";
16
+ } from "./chunk-EWUWVQYM.js";
17
+ import "./chunk-4WVKE2AQ.js";
18
18
  export {
19
19
  cmdHealth,
20
20
  collectDesignTokenEvidence,
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./chunk-6FR73WZ6.js";
1
+ import "./chunk-GPGBJFMF.js";
2
2
  import "./chunk-SIDKK73N.js";
3
- import "./chunk-GDPC7PCB.js";
4
- import "./chunk-GJG3O4QS.js";
5
- import "./chunk-PM7DKABI.js";
3
+ import "./chunk-UDBPH25I.js";
4
+ import "./chunk-EWUWVQYM.js";
5
+ import "./chunk-4WVKE2AQ.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createWorkspaceHealthReport
3
- } from "./chunk-GDPC7PCB.js";
3
+ } from "./chunk-UDBPH25I.js";
4
4
  import {
5
5
  createProjectHealthReport
6
- } from "./chunk-GJG3O4QS.js";
6
+ } from "./chunk-EWUWVQYM.js";
7
7
  import {
8
8
  sendStudioHealthRefreshedTelemetry,
9
9
  sendStudioStartedTelemetry
10
- } from "./chunk-PM7DKABI.js";
10
+ } from "./chunk-4WVKE2AQ.js";
11
11
 
12
12
  // src/commands/studio.ts
13
13
  import { existsSync, readFileSync } from "fs";
@@ -7,9 +7,9 @@ import {
7
7
  listWorkspaceProjects,
8
8
  parseWorkspaceArgs,
9
9
  shouldFailWorkspaceHealth
10
- } from "./chunk-GDPC7PCB.js";
11
- import "./chunk-GJG3O4QS.js";
12
- import "./chunk-PM7DKABI.js";
10
+ } from "./chunk-UDBPH25I.js";
11
+ import "./chunk-EWUWVQYM.js";
12
+ import "./chunk-4WVKE2AQ.js";
13
13
  export {
14
14
  cmdWorkspace,
15
15
  createWorkspaceHealthReport,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/cli",
3
- "version": "3.5.2",
3
+ "version": "3.5.4",
4
4
  "description": "Decantr CLI - adopt, verify, graph, and govern frontend codebases touched by AI agents",
5
5
  "keywords": [
6
6
  "decantr",
@@ -49,11 +49,11 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "ajv": "^8.20.0",
52
- "@decantr/core": "3.5.0",
53
52
  "@decantr/essence-spec": "3.4.0",
53
+ "@decantr/core": "3.5.0",
54
54
  "@decantr/telemetry": "3.4.0",
55
55
  "@decantr/registry": "3.4.0",
56
- "@decantr/verifier": "3.5.0"
56
+ "@decantr/verifier": "3.5.4"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",