@aiready/core 0.5.4 → 0.5.6

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.d.mts CHANGED
@@ -76,6 +76,7 @@ interface Report {
76
76
  };
77
77
  }
78
78
 
79
+ declare const DEFAULT_EXCLUDE: string[];
79
80
  declare function scanFiles(options: ScanOptions): Promise<string[]>;
80
81
  declare function readFileContent(filePath: string): Promise<string>;
81
82
  declare function getFileExtension(filePath: string): string;
@@ -118,6 +119,7 @@ interface CLIOptions {
118
119
  }
119
120
  /**
120
121
  * Resolve output file path, defaulting to .aiready directory
122
+ * Creates parent directories if they don't exist.
121
123
  * @param userPath - User-provided output path (optional)
122
124
  * @param defaultFilename - Default filename to use
123
125
  * @param workingDir - Working directory (default: process.cwd())
@@ -143,4 +145,4 @@ declare function handleCLIError(error: unknown, commandName: string): never;
143
145
  */
144
146
  declare function getElapsedTime(startTime: number): string;
145
147
 
146
- export { type AIReadyConfig, type ASTNode, type AnalysisResult, type CLIOptions, type Issue, type IssueType, type Location, type Metrics, type Report, type ScanOptions, estimateTokens, extractFunctions, extractImports, getElapsedTime, getFileExtension, handleCLIError, handleJSONOutput, isSourceFile, loadConfig, loadMergedConfig, mergeConfigWithDefaults, parseCode, readFileContent, resolveOutputPath, scanFiles };
148
+ export { type AIReadyConfig, type ASTNode, type AnalysisResult, type CLIOptions, DEFAULT_EXCLUDE, type Issue, type IssueType, type Location, type Metrics, type Report, type ScanOptions, estimateTokens, extractFunctions, extractImports, getElapsedTime, getFileExtension, handleCLIError, handleJSONOutput, isSourceFile, loadConfig, loadMergedConfig, mergeConfigWithDefaults, parseCode, readFileContent, resolveOutputPath, scanFiles };
package/dist/index.d.ts CHANGED
@@ -76,6 +76,7 @@ interface Report {
76
76
  };
77
77
  }
78
78
 
79
+ declare const DEFAULT_EXCLUDE: string[];
79
80
  declare function scanFiles(options: ScanOptions): Promise<string[]>;
80
81
  declare function readFileContent(filePath: string): Promise<string>;
81
82
  declare function getFileExtension(filePath: string): string;
@@ -118,6 +119,7 @@ interface CLIOptions {
118
119
  }
119
120
  /**
120
121
  * Resolve output file path, defaulting to .aiready directory
122
+ * Creates parent directories if they don't exist.
121
123
  * @param userPath - User-provided output path (optional)
122
124
  * @param defaultFilename - Default filename to use
123
125
  * @param workingDir - Working directory (default: process.cwd())
@@ -143,4 +145,4 @@ declare function handleCLIError(error: unknown, commandName: string): never;
143
145
  */
144
146
  declare function getElapsedTime(startTime: number): string;
145
147
 
146
- export { type AIReadyConfig, type ASTNode, type AnalysisResult, type CLIOptions, type Issue, type IssueType, type Location, type Metrics, type Report, type ScanOptions, estimateTokens, extractFunctions, extractImports, getElapsedTime, getFileExtension, handleCLIError, handleJSONOutput, isSourceFile, loadConfig, loadMergedConfig, mergeConfigWithDefaults, parseCode, readFileContent, resolveOutputPath, scanFiles };
148
+ export { type AIReadyConfig, type ASTNode, type AnalysisResult, type CLIOptions, DEFAULT_EXCLUDE, type Issue, type IssueType, type Location, type Metrics, type Report, type ScanOptions, estimateTokens, extractFunctions, extractImports, getElapsedTime, getFileExtension, handleCLIError, handleJSONOutput, isSourceFile, loadConfig, loadMergedConfig, mergeConfigWithDefaults, parseCode, readFileContent, resolveOutputPath, scanFiles };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ DEFAULT_EXCLUDE: () => DEFAULT_EXCLUDE,
23
24
  estimateTokens: () => estimateTokens,
24
25
  extractFunctions: () => extractFunctions,
25
26
  extractImports: () => extractImports,
@@ -85,11 +86,12 @@ async function scanFiles(options) {
85
86
  const {
86
87
  rootDir,
87
88
  include = ["**/*.{ts,tsx,js,jsx,py,java}"],
88
- exclude = DEFAULT_EXCLUDE
89
+ exclude
89
90
  } = options;
91
+ const finalExclude = exclude ? [.../* @__PURE__ */ new Set([...DEFAULT_EXCLUDE, ...exclude])] : DEFAULT_EXCLUDE;
90
92
  const files = await (0, import_glob.glob)(include, {
91
93
  cwd: rootDir,
92
- ignore: exclude,
94
+ ignore: finalExclude,
93
95
  absolute: true
94
96
  });
95
97
  return files;
@@ -191,14 +193,18 @@ function mergeConfigWithDefaults(userConfig, defaults) {
191
193
  var import_fs2 = require("fs");
192
194
  var import_path2 = require("path");
193
195
  function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
196
+ let outputPath;
194
197
  if (userPath) {
195
- return userPath;
198
+ outputPath = userPath;
199
+ } else {
200
+ const aireadyDir = (0, import_path2.join)(workingDir, ".aiready");
201
+ outputPath = (0, import_path2.join)(aireadyDir, defaultFilename);
196
202
  }
197
- const aireadyDir = (0, import_path2.join)(workingDir, ".aiready");
198
- if (!(0, import_fs2.existsSync)(aireadyDir)) {
199
- (0, import_fs2.mkdirSync)(aireadyDir, { recursive: true });
203
+ const parentDir = (0, import_path2.dirname)(outputPath);
204
+ if (!(0, import_fs2.existsSync)(parentDir)) {
205
+ (0, import_fs2.mkdirSync)(parentDir, { recursive: true });
200
206
  }
201
- return (0, import_path2.join)(aireadyDir, defaultFilename);
207
+ return outputPath;
202
208
  }
203
209
  function loadMergedConfig(directory, defaults, cliOptions) {
204
210
  const config = loadConfig(directory);
@@ -231,6 +237,7 @@ function getElapsedTime(startTime) {
231
237
  }
232
238
  // Annotate the CommonJS export names for ESM import in node:
233
239
  0 && (module.exports = {
240
+ DEFAULT_EXCLUDE,
234
241
  estimateTokens,
235
242
  extractFunctions,
236
243
  extractImports,
package/dist/index.mjs CHANGED
@@ -52,11 +52,12 @@ async function scanFiles(options) {
52
52
  const {
53
53
  rootDir,
54
54
  include = ["**/*.{ts,tsx,js,jsx,py,java}"],
55
- exclude = DEFAULT_EXCLUDE
55
+ exclude
56
56
  } = options;
57
+ const finalExclude = exclude ? [.../* @__PURE__ */ new Set([...DEFAULT_EXCLUDE, ...exclude])] : DEFAULT_EXCLUDE;
57
58
  const files = await glob(include, {
58
59
  cwd: rootDir,
59
- ignore: exclude,
60
+ ignore: finalExclude,
60
61
  absolute: true
61
62
  });
62
63
  return files;
@@ -158,14 +159,18 @@ function mergeConfigWithDefaults(userConfig, defaults) {
158
159
  import { writeFileSync, mkdirSync, existsSync as existsSync2 } from "fs";
159
160
  import { join as join2, dirname as dirname2 } from "path";
160
161
  function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
162
+ let outputPath;
161
163
  if (userPath) {
162
- return userPath;
164
+ outputPath = userPath;
165
+ } else {
166
+ const aireadyDir = join2(workingDir, ".aiready");
167
+ outputPath = join2(aireadyDir, defaultFilename);
163
168
  }
164
- const aireadyDir = join2(workingDir, ".aiready");
165
- if (!existsSync2(aireadyDir)) {
166
- mkdirSync(aireadyDir, { recursive: true });
169
+ const parentDir = dirname2(outputPath);
170
+ if (!existsSync2(parentDir)) {
171
+ mkdirSync(parentDir, { recursive: true });
167
172
  }
168
- return join2(aireadyDir, defaultFilename);
173
+ return outputPath;
169
174
  }
170
175
  function loadMergedConfig(directory, defaults, cliOptions) {
171
176
  const config = loadConfig(directory);
@@ -197,6 +202,7 @@ function getElapsedTime(startTime) {
197
202
  return ((Date.now() - startTime) / 1e3).toFixed(2);
198
203
  }
199
204
  export {
205
+ DEFAULT_EXCLUDE,
200
206
  estimateTokens,
201
207
  extractFunctions,
202
208
  extractImports,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/core",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Shared utilities for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",