@aiready/core 0.7.10 → 0.7.12

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/README.md CHANGED
@@ -117,4 +117,4 @@ MIT - See [LICENSE](./LICENSE)
117
117
 
118
118
  ---
119
119
 
120
- **Part of the [AIReady](https://github.com/caopengau/aiready) toolkit** | Docs: see the monorepo [README](https://github.com/caopengau/aiready#readme) | Status: website not live yet
120
+ **Part of the [AIReady](https://getaiready.dev) toolkit** | Learn more at [getaiready.dev](https://getaiready.dev)
package/dist/index.js CHANGED
@@ -54,6 +54,8 @@ module.exports = __toCommonJS(index_exports);
54
54
  // src/utils/file-scanner.ts
55
55
  var import_glob = require("glob");
56
56
  var import_promises = require("fs/promises");
57
+ var import_fs = require("fs");
58
+ var import_path = require("path");
57
59
  var DEFAULT_EXCLUDE = [
58
60
  // Dependencies
59
61
  "**/node_modules/**",
@@ -106,7 +108,17 @@ async function scanFiles(options) {
106
108
  // Broad default - tools should filter further
107
109
  exclude
108
110
  } = options;
109
- const finalExclude = exclude ? [.../* @__PURE__ */ new Set([...DEFAULT_EXCLUDE, ...exclude])] : DEFAULT_EXCLUDE;
111
+ const ignoreFilePath = (0, import_path.join)(rootDir || ".", ".aireadyignore");
112
+ let ignoreFromFile = [];
113
+ if ((0, import_fs.existsSync)(ignoreFilePath)) {
114
+ try {
115
+ const txt = await (0, import_promises.readFile)(ignoreFilePath, "utf-8");
116
+ ignoreFromFile = txt.split(/\r?\n/).map((s) => s.trim()).filter(Boolean).filter((l) => !l.startsWith("#")).filter((l) => !l.startsWith("!"));
117
+ } catch (e) {
118
+ ignoreFromFile = [];
119
+ }
120
+ }
121
+ const finalExclude = [.../* @__PURE__ */ new Set([...exclude || [], ...ignoreFromFile, ...DEFAULT_EXCLUDE])];
110
122
  const files = await (0, import_glob.glob)(include, {
111
123
  cwd: rootDir,
112
124
  ignore: finalExclude,
@@ -305,8 +317,8 @@ function estimateTokens(text) {
305
317
  }
306
318
 
307
319
  // src/utils/config.ts
308
- var import_fs = require("fs");
309
- var import_path = require("path");
320
+ var import_fs2 = require("fs");
321
+ var import_path2 = require("path");
310
322
  var import_url = require("url");
311
323
  var CONFIG_FILES = [
312
324
  "aiready.json",
@@ -317,11 +329,11 @@ var CONFIG_FILES = [
317
329
  ".aireadyrc.js"
318
330
  ];
319
331
  async function loadConfig(rootDir) {
320
- let currentDir = (0, import_path.resolve)(rootDir);
332
+ let currentDir = (0, import_path2.resolve)(rootDir);
321
333
  while (true) {
322
334
  for (const configFile of CONFIG_FILES) {
323
- const configPath = (0, import_path.join)(currentDir, configFile);
324
- if ((0, import_fs.existsSync)(configPath)) {
335
+ const configPath = (0, import_path2.join)(currentDir, configFile);
336
+ if ((0, import_fs2.existsSync)(configPath)) {
325
337
  try {
326
338
  let config;
327
339
  if (configFile.endsWith(".js")) {
@@ -329,7 +341,7 @@ async function loadConfig(rootDir) {
329
341
  const module2 = await import(`${fileUrl}?t=${Date.now()}`);
330
342
  config = module2.default || module2;
331
343
  } else {
332
- const content = (0, import_fs.readFileSync)(configPath, "utf-8");
344
+ const content = (0, import_fs2.readFileSync)(configPath, "utf-8");
333
345
  config = JSON.parse(content);
334
346
  }
335
347
  if (typeof config !== "object" || config === null) {
@@ -342,7 +354,7 @@ async function loadConfig(rootDir) {
342
354
  }
343
355
  }
344
356
  }
345
- const parent = (0, import_path.dirname)(currentDir);
357
+ const parent = (0, import_path2.dirname)(currentDir);
346
358
  if (parent === currentDir) {
347
359
  break;
348
360
  }
@@ -374,19 +386,19 @@ function mergeConfigWithDefaults(userConfig, defaults) {
374
386
  }
375
387
 
376
388
  // src/utils/cli-helpers.ts
377
- var import_fs2 = require("fs");
378
- var import_path2 = require("path");
389
+ var import_fs3 = require("fs");
390
+ var import_path3 = require("path");
379
391
  function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
380
392
  let outputPath;
381
393
  if (userPath) {
382
394
  outputPath = userPath;
383
395
  } else {
384
- const aireadyDir = (0, import_path2.join)(workingDir, ".aiready");
385
- outputPath = (0, import_path2.join)(aireadyDir, defaultFilename);
396
+ const aireadyDir = (0, import_path3.join)(workingDir, ".aiready");
397
+ outputPath = (0, import_path3.join)(aireadyDir, defaultFilename);
386
398
  }
387
- const parentDir = (0, import_path2.dirname)(outputPath);
388
- if (!(0, import_fs2.existsSync)(parentDir)) {
389
- (0, import_fs2.mkdirSync)(parentDir, { recursive: true });
399
+ const parentDir = (0, import_path3.dirname)(outputPath);
400
+ if (!(0, import_fs3.existsSync)(parentDir)) {
401
+ (0, import_fs3.mkdirSync)(parentDir, { recursive: true });
390
402
  }
391
403
  return outputPath;
392
404
  }
@@ -402,11 +414,11 @@ async function loadMergedConfig(directory, defaults, cliOptions) {
402
414
  }
403
415
  function handleJSONOutput(data, outputFile, successMessage) {
404
416
  if (outputFile) {
405
- const dir = (0, import_path2.dirname)(outputFile);
406
- if (!(0, import_fs2.existsSync)(dir)) {
407
- (0, import_fs2.mkdirSync)(dir, { recursive: true });
417
+ const dir = (0, import_path3.dirname)(outputFile);
418
+ if (!(0, import_fs3.existsSync)(dir)) {
419
+ (0, import_fs3.mkdirSync)(dir, { recursive: true });
408
420
  }
409
- (0, import_fs2.writeFileSync)(outputFile, JSON.stringify(data, null, 2));
421
+ (0, import_fs3.writeFileSync)(outputFile, JSON.stringify(data, null, 2));
410
422
  console.log(successMessage || `\u2705 Results saved to ${outputFile}`);
411
423
  } else {
412
424
  console.log(JSON.stringify(data, null, 2));
package/dist/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  // src/utils/file-scanner.ts
2
2
  import { glob } from "glob";
3
3
  import { readFile } from "fs/promises";
4
+ import { existsSync } from "fs";
5
+ import { join } from "path";
4
6
  var DEFAULT_EXCLUDE = [
5
7
  // Dependencies
6
8
  "**/node_modules/**",
@@ -53,7 +55,17 @@ async function scanFiles(options) {
53
55
  // Broad default - tools should filter further
54
56
  exclude
55
57
  } = options;
56
- const finalExclude = exclude ? [.../* @__PURE__ */ new Set([...DEFAULT_EXCLUDE, ...exclude])] : DEFAULT_EXCLUDE;
58
+ const ignoreFilePath = join(rootDir || ".", ".aireadyignore");
59
+ let ignoreFromFile = [];
60
+ if (existsSync(ignoreFilePath)) {
61
+ try {
62
+ const txt = await readFile(ignoreFilePath, "utf-8");
63
+ ignoreFromFile = txt.split(/\r?\n/).map((s) => s.trim()).filter(Boolean).filter((l) => !l.startsWith("#")).filter((l) => !l.startsWith("!"));
64
+ } catch (e) {
65
+ ignoreFromFile = [];
66
+ }
67
+ }
68
+ const finalExclude = [.../* @__PURE__ */ new Set([...exclude || [], ...ignoreFromFile, ...DEFAULT_EXCLUDE])];
57
69
  const files = await glob(include, {
58
70
  cwd: rootDir,
59
71
  ignore: finalExclude,
@@ -252,8 +264,8 @@ function estimateTokens(text) {
252
264
  }
253
265
 
254
266
  // src/utils/config.ts
255
- import { readFileSync, existsSync } from "fs";
256
- import { join, resolve, dirname } from "path";
267
+ import { readFileSync, existsSync as existsSync2 } from "fs";
268
+ import { join as join2, resolve, dirname } from "path";
257
269
  import { pathToFileURL } from "url";
258
270
  var CONFIG_FILES = [
259
271
  "aiready.json",
@@ -267,8 +279,8 @@ async function loadConfig(rootDir) {
267
279
  let currentDir = resolve(rootDir);
268
280
  while (true) {
269
281
  for (const configFile of CONFIG_FILES) {
270
- const configPath = join(currentDir, configFile);
271
- if (existsSync(configPath)) {
282
+ const configPath = join2(currentDir, configFile);
283
+ if (existsSync2(configPath)) {
272
284
  try {
273
285
  let config;
274
286
  if (configFile.endsWith(".js")) {
@@ -321,18 +333,18 @@ function mergeConfigWithDefaults(userConfig, defaults) {
321
333
  }
322
334
 
323
335
  // src/utils/cli-helpers.ts
324
- import { writeFileSync, mkdirSync, existsSync as existsSync2 } from "fs";
325
- import { join as join2, dirname as dirname2 } from "path";
336
+ import { writeFileSync, mkdirSync, existsSync as existsSync3 } from "fs";
337
+ import { join as join3, dirname as dirname2 } from "path";
326
338
  function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
327
339
  let outputPath;
328
340
  if (userPath) {
329
341
  outputPath = userPath;
330
342
  } else {
331
- const aireadyDir = join2(workingDir, ".aiready");
332
- outputPath = join2(aireadyDir, defaultFilename);
343
+ const aireadyDir = join3(workingDir, ".aiready");
344
+ outputPath = join3(aireadyDir, defaultFilename);
333
345
  }
334
346
  const parentDir = dirname2(outputPath);
335
- if (!existsSync2(parentDir)) {
347
+ if (!existsSync3(parentDir)) {
336
348
  mkdirSync(parentDir, { recursive: true });
337
349
  }
338
350
  return outputPath;
@@ -350,7 +362,7 @@ async function loadMergedConfig(directory, defaults, cliOptions) {
350
362
  function handleJSONOutput(data, outputFile, successMessage) {
351
363
  if (outputFile) {
352
364
  const dir = dirname2(outputFile);
353
- if (!existsSync2(dir)) {
365
+ if (!existsSync3(dir)) {
354
366
  mkdirSync(dir, { recursive: true });
355
367
  }
356
368
  writeFileSync(outputFile, JSON.stringify(data, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/core",
3
- "version": "0.7.10",
3
+ "version": "0.7.12",
4
4
  "description": "Shared utilities for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",