@driftless-sh/cli 0.1.45 → 0.1.46

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/index.js CHANGED
@@ -214560,7 +214560,7 @@ async function installSkillCommand() {
214560
214560
  // src/commands/init.ts
214561
214561
  function getVersion() {
214562
214562
  try {
214563
- return "0.1.45";
214563
+ return "0.1.46";
214564
214564
  } catch {
214565
214565
  return "0.0.0";
214566
214566
  }
@@ -216612,11 +216612,15 @@ async function graphCommand(args) {
216612
216612
  console.log(`No scanned components for ${path}. Run \`driftless init\` (or --src for monorepos).`);
216613
216613
  process.exit(0);
216614
216614
  }
216615
- console.log(`\u258C ${path}
216615
+ const header = g2.file && g2.file !== g2.query_path ? `\u258C ${path} \u2192 ${g2.file}` : `\u258C ${path}`;
216616
+ console.log(`${header}
216616
216617
  `);
216617
216618
  if (g2.entrypoints.length) {
216618
- console.log("entrypoints:");
216619
- for (const e of g2.entrypoints) console.log(` ${e.method ?? "?"} ${e.path ?? "?"} \u2192 ${e.handler}`);
216619
+ console.log("entrypoints (routes that reach this):");
216620
+ for (const e of g2.entrypoints) {
216621
+ const guards = e.guards && e.guards.length ? ` [${e.guards.join(", ")}]` : "";
216622
+ console.log(` ${e.method ?? "?"} ${e.path ?? "?"} \u2192 ${e.handler}${guards}`);
216623
+ }
216620
216624
  console.log("");
216621
216625
  }
216622
216626
  console.log(`upstream (${g2.upstream.length}): ${g2.upstream.slice(0, 12).join(", ")}${g2.upstream.length > 12 ? " \u2026" : ""}`);
@@ -216630,7 +216634,9 @@ async function graphCommand(args) {
216630
216634
  console.error('Usage: driftless graph impact --files "a,b"');
216631
216635
  process.exit(1);
216632
216636
  }
216633
- const g = await api.get(`${base}/impact?files=${encodeURIComponent(filesCsv)}${depth}`);
216637
+ const dirIdx = args.indexOf("--direction");
216638
+ const dir = dirIdx !== -1 && args[dirIdx + 1] ? `&direction=${encodeURIComponent(args[dirIdx + 1])}` : "";
216639
+ const g = await api.get(`${base}/impact?files=${encodeURIComponent(filesCsv)}${depth}${dir}`);
216634
216640
  if (isJSON) {
216635
216641
  emitJSON4(g);
216636
216642
  process.exit(0);
@@ -216639,10 +216645,21 @@ async function graphCommand(args) {
216639
216645
  console.log("No scanned components for those files. Run `driftless init`.");
216640
216646
  process.exit(0);
216641
216647
  }
216642
- console.log(`Impact of ${g.files.length} file(s) \u2014 ${g.impacted.length} component(s) across ${g.impacted_files.length} file(s):
216648
+ const consumers = g.impacted_consumers ?? [];
216649
+ const eps = g.impacted_entrypoints ?? [];
216650
+ console.log(`Blast radius of ${g.files.length} file(s) \u2014 what can BREAK if you change them:
216643
216651
  `);
216644
- for (const f of g.impacted_files.slice(0, 30)) console.log(` ${f}`);
216645
- if (g.impacted_files.length > 30) console.log(` \u2026 and ${g.impacted_files.length - 30} more`);
216652
+ console.log(` ${consumers.length} consumer component(s) across ${g.impacted_files.length} file(s)`);
216653
+ if (eps.length) {
216654
+ console.log(` ${eps.length} reachable endpoint(s):`);
216655
+ for (const e of eps.slice(0, 15)) console.log(` ${e.method ?? "?"} ${e.path ?? "?"} \u2192 ${e.handler}`);
216656
+ if (eps.length > 15) console.log(` \u2026 and ${eps.length - 15} more`);
216657
+ }
216658
+ console.log("");
216659
+ for (const f of g.impacted_files.slice(0, 25)) console.log(` ${f}`);
216660
+ if (g.impacted_files.length > 25) console.log(` \u2026 and ${g.impacted_files.length - 25} more`);
216661
+ if ((g.depends_on ?? []).length) console.log(`
216662
+ (depends_on: ${g.depends_on.length} downstream \u2014 use --direction both for detail)`);
216646
216663
  process.exit(0);
216647
216664
  } catch (e) {
216648
216665
  console.error(`graph failed: ${formatError(e)}`);
@@ -216652,7 +216669,7 @@ async function graphCommand(args) {
216652
216669
  }
216653
216670
 
216654
216671
  // src/index.ts
216655
- var VERSION = "0.1.45";
216672
+ var VERSION = "0.1.46";
216656
216673
  var HELP_TEXT = `Driftless CLI v${VERSION} \u2014 Living repo context for humans and coding agents
216657
216674
 
216658
216675
  Install: npm install -g @driftless-sh/cli