@driftless-sh/cli 0.1.45 → 0.1.47
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 +43 -10
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -213426,11 +213426,26 @@ var require_nestjs_extractor = __commonJS({
|
|
|
213426
213426
|
}
|
|
213427
213427
|
return null;
|
|
213428
213428
|
}
|
|
213429
|
+
function calleeName(expr) {
|
|
213430
|
+
if (typescript_1.default.isIdentifier(expr))
|
|
213431
|
+
return expr.text;
|
|
213432
|
+
if (typescript_1.default.isPropertyAccessExpression(expr) && typescript_1.default.isIdentifier(expr.name))
|
|
213433
|
+
return expr.name.text;
|
|
213434
|
+
return null;
|
|
213435
|
+
}
|
|
213429
213436
|
function argText(arg) {
|
|
213430
213437
|
if (typescript_1.default.isStringLiteralLike(arg))
|
|
213431
213438
|
return [arg.text];
|
|
213432
213439
|
if (typescript_1.default.isIdentifier(arg))
|
|
213433
213440
|
return [arg.text];
|
|
213441
|
+
if (typescript_1.default.isCallExpression(arg) || typescript_1.default.isNewExpression(arg)) {
|
|
213442
|
+
const n = calleeName(arg.expression);
|
|
213443
|
+
return n ? [n] : [];
|
|
213444
|
+
}
|
|
213445
|
+
if (typescript_1.default.isPropertyAccessExpression(arg)) {
|
|
213446
|
+
const n = calleeName(arg);
|
|
213447
|
+
return n ? [n] : [];
|
|
213448
|
+
}
|
|
213434
213449
|
if (typescript_1.default.isObjectLiteralExpression(arg)) {
|
|
213435
213450
|
const out = [];
|
|
213436
213451
|
for (const prop of arg.properties) {
|
|
@@ -213873,11 +213888,12 @@ var require_nestjs_extractor = __commonJS({
|
|
|
213873
213888
|
const controllerName = className || "UnknownController";
|
|
213874
213889
|
const controllerPath = extractControllerPath(cls);
|
|
213875
213890
|
const moduleName = moduleByDir.get(node_path_1.default.dirname(facts.filePath)) ?? null;
|
|
213891
|
+
const classGuards = (cls.decoratorArgs["UseGuards"] ?? []).filter((g) => /^[A-Z]\w*$/.test(g));
|
|
213876
213892
|
for (const method of methods) {
|
|
213877
213893
|
const endpointDecorators = extractEndpointPath(method, controllerPath);
|
|
213878
213894
|
if (endpointDecorators.length === 0)
|
|
213879
213895
|
continue;
|
|
213880
|
-
const methodGuards = extractGuardsFromMethod(method);
|
|
213896
|
+
const methodGuards = [.../* @__PURE__ */ new Set([...classGuards, ...extractGuardsFromMethod(method)])];
|
|
213881
213897
|
methodGuards.forEach((g) => guardNames.add(g));
|
|
213882
213898
|
const { params, bodyDto, return_type } = extractEndpointParams(method);
|
|
213883
213899
|
const paramInfos = params.filter((p) => p.source === "param");
|
|
@@ -214560,7 +214576,7 @@ async function installSkillCommand() {
|
|
|
214560
214576
|
// src/commands/init.ts
|
|
214561
214577
|
function getVersion() {
|
|
214562
214578
|
try {
|
|
214563
|
-
return "0.1.
|
|
214579
|
+
return "0.1.47";
|
|
214564
214580
|
} catch {
|
|
214565
214581
|
return "0.0.0";
|
|
214566
214582
|
}
|
|
@@ -216612,11 +216628,15 @@ async function graphCommand(args) {
|
|
|
216612
216628
|
console.log(`No scanned components for ${path}. Run \`driftless init\` (or --src for monorepos).`);
|
|
216613
216629
|
process.exit(0);
|
|
216614
216630
|
}
|
|
216615
|
-
|
|
216631
|
+
const header = g2.file && g2.file !== g2.query_path ? `\u258C ${path} \u2192 ${g2.file}` : `\u258C ${path}`;
|
|
216632
|
+
console.log(`${header}
|
|
216616
216633
|
`);
|
|
216617
216634
|
if (g2.entrypoints.length) {
|
|
216618
|
-
console.log("entrypoints:");
|
|
216619
|
-
for (const e of g2.entrypoints)
|
|
216635
|
+
console.log("entrypoints (routes that reach this):");
|
|
216636
|
+
for (const e of g2.entrypoints) {
|
|
216637
|
+
const guards = e.guards && e.guards.length ? ` [${e.guards.join(", ")}]` : "";
|
|
216638
|
+
console.log(` ${e.method ?? "?"} ${e.path ?? "?"} \u2192 ${e.handler}${guards}`);
|
|
216639
|
+
}
|
|
216620
216640
|
console.log("");
|
|
216621
216641
|
}
|
|
216622
216642
|
console.log(`upstream (${g2.upstream.length}): ${g2.upstream.slice(0, 12).join(", ")}${g2.upstream.length > 12 ? " \u2026" : ""}`);
|
|
@@ -216630,7 +216650,9 @@ async function graphCommand(args) {
|
|
|
216630
216650
|
console.error('Usage: driftless graph impact --files "a,b"');
|
|
216631
216651
|
process.exit(1);
|
|
216632
216652
|
}
|
|
216633
|
-
const
|
|
216653
|
+
const dirIdx = args.indexOf("--direction");
|
|
216654
|
+
const dir = dirIdx !== -1 && args[dirIdx + 1] ? `&direction=${encodeURIComponent(args[dirIdx + 1])}` : "";
|
|
216655
|
+
const g = await api.get(`${base}/impact?files=${encodeURIComponent(filesCsv)}${depth}${dir}`);
|
|
216634
216656
|
if (isJSON) {
|
|
216635
216657
|
emitJSON4(g);
|
|
216636
216658
|
process.exit(0);
|
|
@@ -216639,10 +216661,21 @@ async function graphCommand(args) {
|
|
|
216639
216661
|
console.log("No scanned components for those files. Run `driftless init`.");
|
|
216640
216662
|
process.exit(0);
|
|
216641
216663
|
}
|
|
216642
|
-
|
|
216664
|
+
const consumers = g.impacted_consumers ?? [];
|
|
216665
|
+
const eps = g.impacted_entrypoints ?? [];
|
|
216666
|
+
console.log(`Blast radius of ${g.files.length} file(s) \u2014 what can BREAK if you change them:
|
|
216643
216667
|
`);
|
|
216644
|
-
|
|
216645
|
-
if (
|
|
216668
|
+
console.log(` ${consumers.length} consumer component(s) across ${g.impacted_files.length} file(s)`);
|
|
216669
|
+
if (eps.length) {
|
|
216670
|
+
console.log(` ${eps.length} reachable endpoint(s):`);
|
|
216671
|
+
for (const e of eps.slice(0, 15)) console.log(` ${e.method ?? "?"} ${e.path ?? "?"} \u2192 ${e.handler}`);
|
|
216672
|
+
if (eps.length > 15) console.log(` \u2026 and ${eps.length - 15} more`);
|
|
216673
|
+
}
|
|
216674
|
+
console.log("");
|
|
216675
|
+
for (const f of g.impacted_files.slice(0, 25)) console.log(` ${f}`);
|
|
216676
|
+
if (g.impacted_files.length > 25) console.log(` \u2026 and ${g.impacted_files.length - 25} more`);
|
|
216677
|
+
if ((g.depends_on ?? []).length) console.log(`
|
|
216678
|
+
(depends_on: ${g.depends_on.length} downstream \u2014 use --direction both for detail)`);
|
|
216646
216679
|
process.exit(0);
|
|
216647
216680
|
} catch (e) {
|
|
216648
216681
|
console.error(`graph failed: ${formatError(e)}`);
|
|
@@ -216652,7 +216685,7 @@ async function graphCommand(args) {
|
|
|
216652
216685
|
}
|
|
216653
216686
|
|
|
216654
216687
|
// src/index.ts
|
|
216655
|
-
var VERSION = "0.1.
|
|
216688
|
+
var VERSION = "0.1.47";
|
|
216656
216689
|
var HELP_TEXT = `Driftless CLI v${VERSION} \u2014 Living repo context for humans and coding agents
|
|
216657
216690
|
|
|
216658
216691
|
Install: npm install -g @driftless-sh/cli
|