@driftless-sh/cli 0.1.48 → 0.1.49
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 +53 -14
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -213387,15 +213387,23 @@ var require_nestjs_extractor = __commonJS({
|
|
|
213387
213387
|
};
|
|
213388
213388
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
213389
213389
|
exports2.extractNestJS = extractNestJS;
|
|
213390
|
+
exports2.extractNestJSWithReport = extractNestJSWithReport;
|
|
213390
213391
|
var node_path_1 = __importDefault(require("node:path"));
|
|
213391
213392
|
var node_fs_1 = __importDefault(require("node:fs"));
|
|
213392
213393
|
var typescript_1 = __importDefault(require_typescript());
|
|
213393
|
-
|
|
213394
|
+
var DEFAULT_MAX_FILE_BYTES = 15e5;
|
|
213395
|
+
function maxFileBytes() {
|
|
213396
|
+
const raw = Number(process.env.DRIFTLESS_MAX_FILE_BYTES);
|
|
213397
|
+
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : DEFAULT_MAX_FILE_BYTES;
|
|
213398
|
+
}
|
|
213399
|
+
function discoverScanFiles(rootPath) {
|
|
213394
213400
|
const files = [];
|
|
213401
|
+
const skipped = [];
|
|
213395
213402
|
const srcDir = node_fs_1.default.existsSync(node_path_1.default.join(rootPath, "src")) ? node_path_1.default.join(rootPath, "src") : rootPath;
|
|
213396
213403
|
if (!node_fs_1.default.existsSync(srcDir))
|
|
213397
|
-
return files;
|
|
213404
|
+
return { files, skipped };
|
|
213398
213405
|
const SKIP = /* @__PURE__ */ new Set(["node_modules", "dist", ".next", "build", ".turbo", "coverage"]);
|
|
213406
|
+
const cap = maxFileBytes();
|
|
213399
213407
|
function walk(dir) {
|
|
213400
213408
|
const entries = node_fs_1.default.readdirSync(dir, { withFileTypes: true });
|
|
213401
213409
|
for (const entry of entries) {
|
|
@@ -213404,13 +213412,23 @@ var require_nestjs_extractor = __commonJS({
|
|
|
213404
213412
|
if (SKIP.has(entry.name))
|
|
213405
213413
|
continue;
|
|
213406
213414
|
walk(full);
|
|
213407
|
-
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts") && !entry.name.endsWith(".spec.ts") && !entry.name.endsWith(".test.ts")) {
|
|
213408
|
-
|
|
213415
|
+
} else if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx")) && !entry.name.endsWith(".d.ts") && !entry.name.endsWith(".spec.ts") && !entry.name.endsWith(".test.ts")) {
|
|
213416
|
+
let size = 0;
|
|
213417
|
+
try {
|
|
213418
|
+
size = node_fs_1.default.statSync(full).size;
|
|
213419
|
+
} catch {
|
|
213420
|
+
continue;
|
|
213421
|
+
}
|
|
213422
|
+
if (size > cap) {
|
|
213423
|
+
skipped.push({ path: node_path_1.default.relative(rootPath, full), bytes: size });
|
|
213424
|
+
} else {
|
|
213425
|
+
files.push(full);
|
|
213426
|
+
}
|
|
213409
213427
|
}
|
|
213410
213428
|
}
|
|
213411
213429
|
}
|
|
213412
213430
|
walk(srcDir);
|
|
213413
|
-
return files;
|
|
213431
|
+
return { files, skipped };
|
|
213414
213432
|
}
|
|
213415
213433
|
function parseFile(filePath, rootPath) {
|
|
213416
213434
|
const sourceText = node_fs_1.default.readFileSync(filePath, "utf8");
|
|
@@ -213880,10 +213898,15 @@ var require_nestjs_extractor = __commonJS({
|
|
|
213880
213898
|
return c;
|
|
213881
213899
|
}
|
|
213882
213900
|
function extractNestJS(rootPath) {
|
|
213901
|
+
return extractNestJSWithReport(rootPath).components;
|
|
213902
|
+
}
|
|
213903
|
+
function extractNestJSWithReport(rootPath) {
|
|
213883
213904
|
const components = [];
|
|
213884
|
-
const
|
|
213905
|
+
const discovered = discoverScanFiles(rootPath);
|
|
213906
|
+
const files = discovered.files.filter((f) => isInSourceDir(node_path_1.default.relative(rootPath, f))).sort();
|
|
213907
|
+
const skipped = discovered.skipped.filter((s) => isInSourceDir(s.path));
|
|
213885
213908
|
if (files.length === 0)
|
|
213886
|
-
return components;
|
|
213909
|
+
return { components, skipped };
|
|
213887
213910
|
const symbolIndex = /* @__PURE__ */ new Map();
|
|
213888
213911
|
const moduleByDir = /* @__PURE__ */ new Map();
|
|
213889
213912
|
for (const file of files) {
|
|
@@ -214051,7 +214074,7 @@ var require_nestjs_extractor = __commonJS({
|
|
|
214051
214074
|
}
|
|
214052
214075
|
}
|
|
214053
214076
|
}
|
|
214054
|
-
return components;
|
|
214077
|
+
return { components, skipped };
|
|
214055
214078
|
}
|
|
214056
214079
|
function extractModuleRelations(cls, symbolIndex) {
|
|
214057
214080
|
const meta = cls.moduleMeta;
|
|
@@ -214326,7 +214349,7 @@ var require_dist = __commonJS({
|
|
|
214326
214349
|
"../../libs/scanner/dist/index.js"(exports2) {
|
|
214327
214350
|
"use strict";
|
|
214328
214351
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
214329
|
-
exports2.enrichComponents = exports2.extractNestJS = exports2.identifyRepo = void 0;
|
|
214352
|
+
exports2.enrichComponents = exports2.extractNestJSWithReport = exports2.extractNestJS = exports2.identifyRepo = void 0;
|
|
214330
214353
|
exports2.scanRepo = scanRepo2;
|
|
214331
214354
|
var identity_1 = require_identity();
|
|
214332
214355
|
Object.defineProperty(exports2, "identifyRepo", { enumerable: true, get: function() {
|
|
@@ -214336,6 +214359,9 @@ var require_dist = __commonJS({
|
|
|
214336
214359
|
Object.defineProperty(exports2, "extractNestJS", { enumerable: true, get: function() {
|
|
214337
214360
|
return nestjs_extractor_1.extractNestJS;
|
|
214338
214361
|
} });
|
|
214362
|
+
Object.defineProperty(exports2, "extractNestJSWithReport", { enumerable: true, get: function() {
|
|
214363
|
+
return nestjs_extractor_1.extractNestJSWithReport;
|
|
214364
|
+
} });
|
|
214339
214365
|
var enricher_1 = require_enricher();
|
|
214340
214366
|
Object.defineProperty(exports2, "enrichComponents", { enumerable: true, get: function() {
|
|
214341
214367
|
return enricher_1.enrichComponents;
|
|
@@ -214344,8 +214370,9 @@ var require_dist = __commonJS({
|
|
|
214344
214370
|
const startMs = Date.now();
|
|
214345
214371
|
const startMem = process.memoryUsage().heapUsed;
|
|
214346
214372
|
const identity = (0, identity_1.identifyRepo)(rootPath);
|
|
214347
|
-
|
|
214348
|
-
|
|
214373
|
+
const extracted = (0, nestjs_extractor_1.extractNestJSWithReport)(rootPath);
|
|
214374
|
+
const skipped = extracted.skipped;
|
|
214375
|
+
let components = await (0, enricher_1.enrichComponents)(extracted.components);
|
|
214349
214376
|
const uniqueFiles = new Set(components.map((c) => c.file_path));
|
|
214350
214377
|
const stats = {
|
|
214351
214378
|
total_files: uniqueFiles.size,
|
|
@@ -214364,7 +214391,8 @@ var require_dist = __commonJS({
|
|
|
214364
214391
|
telemetry: {
|
|
214365
214392
|
duration_ms: durationMs,
|
|
214366
214393
|
memory_mb: memoryMb,
|
|
214367
|
-
files_parsed: uniqueFiles.size
|
|
214394
|
+
files_parsed: uniqueFiles.size,
|
|
214395
|
+
skipped_files: skipped
|
|
214368
214396
|
}
|
|
214369
214397
|
};
|
|
214370
214398
|
}
|
|
@@ -214597,7 +214625,7 @@ async function installSkillCommand() {
|
|
|
214597
214625
|
// src/commands/init.ts
|
|
214598
214626
|
function getVersion() {
|
|
214599
214627
|
try {
|
|
214600
|
-
return "0.1.
|
|
214628
|
+
return "0.1.49";
|
|
214601
214629
|
} catch {
|
|
214602
214630
|
return "0.0.0";
|
|
214603
214631
|
}
|
|
@@ -214992,6 +215020,17 @@ async function initCommand(args) {
|
|
|
214992
215020
|
} else {
|
|
214993
215021
|
console.log(` Scan: ${scanMs}ms`);
|
|
214994
215022
|
}
|
|
215023
|
+
const skippedFiles = telemetry?.skipped_files ?? [];
|
|
215024
|
+
if (skippedFiles.length > 0) {
|
|
215025
|
+
const mb = (n) => `${(n / 1e6).toFixed(1)} MB`;
|
|
215026
|
+
console.warn(` \u26A0 ${skippedFiles.length} file(s) skipped \u2014 over the per-file scan cap (not parsed):`);
|
|
215027
|
+
for (const f of skippedFiles.slice(0, 10)) {
|
|
215028
|
+
console.warn(` ${f.path} (${mb(f.bytes)})`);
|
|
215029
|
+
}
|
|
215030
|
+
if (skippedFiles.length > 10) console.warn(` \u2026 and ${skippedFiles.length - 10} more`);
|
|
215031
|
+
console.warn(" Generated/minified/vendored bundles are skipped to avoid OOM.");
|
|
215032
|
+
console.warn(" Override with DRIFTLESS_MAX_FILE_BYTES=<bytes> if a real source file was skipped.");
|
|
215033
|
+
}
|
|
214995
215034
|
console.log("");
|
|
214996
215035
|
let repo;
|
|
214997
215036
|
try {
|
|
@@ -216713,7 +216752,7 @@ async function graphCommand(args) {
|
|
|
216713
216752
|
}
|
|
216714
216753
|
|
|
216715
216754
|
// src/index.ts
|
|
216716
|
-
var VERSION = "0.1.
|
|
216755
|
+
var VERSION = "0.1.49";
|
|
216717
216756
|
var HELP_TEXT = `Driftless CLI v${VERSION} \u2014 Living repo context for humans and coding agents
|
|
216718
216757
|
|
|
216719
216758
|
Install: npm install -g @driftless-sh/cli
|