@aiready/core 0.7.0 → 0.7.2
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 +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +9 -6
- package/dist/index.mjs +9 -13
- package/package.json +9 -10
package/dist/index.d.mts
CHANGED
|
@@ -58,6 +58,11 @@ interface AIReadyConfig {
|
|
|
58
58
|
domainPatterns?: string[];
|
|
59
59
|
pathDomainMap?: Record<string, string>;
|
|
60
60
|
};
|
|
61
|
+
'consistency'?: {
|
|
62
|
+
acceptedAbbreviations?: string[];
|
|
63
|
+
shortWords?: string[];
|
|
64
|
+
disableChecks?: ('single-letter' | 'abbreviation' | 'convention-mix' | 'unclear' | 'poor-naming')[];
|
|
65
|
+
};
|
|
61
66
|
};
|
|
62
67
|
output?: {
|
|
63
68
|
format?: 'console' | 'json' | 'html';
|
|
@@ -141,7 +146,7 @@ declare function extractImports(ast: ASTNode): string[];
|
|
|
141
146
|
*/
|
|
142
147
|
declare function estimateTokens(text: string): number;
|
|
143
148
|
|
|
144
|
-
declare function loadConfig(rootDir: string): AIReadyConfig | null
|
|
149
|
+
declare function loadConfig(rootDir: string): Promise<AIReadyConfig | null>;
|
|
145
150
|
declare function mergeConfigWithDefaults(userConfig: AIReadyConfig | null, defaults: any): any;
|
|
146
151
|
|
|
147
152
|
/**
|
|
@@ -165,9 +170,9 @@ declare function resolveOutputPath(userPath: string | undefined, defaultFilename
|
|
|
165
170
|
/**
|
|
166
171
|
* Load and merge configuration with CLI options
|
|
167
172
|
*/
|
|
168
|
-
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): T & {
|
|
173
|
+
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): Promise<T & {
|
|
169
174
|
rootDir: string;
|
|
170
|
-
}
|
|
175
|
+
}>;
|
|
171
176
|
/**
|
|
172
177
|
* Handle JSON output for CLI commands
|
|
173
178
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,11 @@ interface AIReadyConfig {
|
|
|
58
58
|
domainPatterns?: string[];
|
|
59
59
|
pathDomainMap?: Record<string, string>;
|
|
60
60
|
};
|
|
61
|
+
'consistency'?: {
|
|
62
|
+
acceptedAbbreviations?: string[];
|
|
63
|
+
shortWords?: string[];
|
|
64
|
+
disableChecks?: ('single-letter' | 'abbreviation' | 'convention-mix' | 'unclear' | 'poor-naming')[];
|
|
65
|
+
};
|
|
61
66
|
};
|
|
62
67
|
output?: {
|
|
63
68
|
format?: 'console' | 'json' | 'html';
|
|
@@ -141,7 +146,7 @@ declare function extractImports(ast: ASTNode): string[];
|
|
|
141
146
|
*/
|
|
142
147
|
declare function estimateTokens(text: string): number;
|
|
143
148
|
|
|
144
|
-
declare function loadConfig(rootDir: string): AIReadyConfig | null
|
|
149
|
+
declare function loadConfig(rootDir: string): Promise<AIReadyConfig | null>;
|
|
145
150
|
declare function mergeConfigWithDefaults(userConfig: AIReadyConfig | null, defaults: any): any;
|
|
146
151
|
|
|
147
152
|
/**
|
|
@@ -165,9 +170,9 @@ declare function resolveOutputPath(userPath: string | undefined, defaultFilename
|
|
|
165
170
|
/**
|
|
166
171
|
* Load and merge configuration with CLI options
|
|
167
172
|
*/
|
|
168
|
-
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): T & {
|
|
173
|
+
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): Promise<T & {
|
|
169
174
|
rootDir: string;
|
|
170
|
-
}
|
|
175
|
+
}>;
|
|
171
176
|
/**
|
|
172
177
|
* Handle JSON output for CLI commands
|
|
173
178
|
*/
|
package/dist/index.js
CHANGED
|
@@ -291,6 +291,7 @@ function estimateTokens(text) {
|
|
|
291
291
|
// src/utils/config.ts
|
|
292
292
|
var import_fs = require("fs");
|
|
293
293
|
var import_path = require("path");
|
|
294
|
+
var import_url = require("url");
|
|
294
295
|
var CONFIG_FILES = [
|
|
295
296
|
"aiready.json",
|
|
296
297
|
"aiready.config.json",
|
|
@@ -299,7 +300,7 @@ var CONFIG_FILES = [
|
|
|
299
300
|
"aiready.config.js",
|
|
300
301
|
".aireadyrc.js"
|
|
301
302
|
];
|
|
302
|
-
function loadConfig(rootDir) {
|
|
303
|
+
async function loadConfig(rootDir) {
|
|
303
304
|
let currentDir = (0, import_path.resolve)(rootDir);
|
|
304
305
|
while (true) {
|
|
305
306
|
for (const configFile of CONFIG_FILES) {
|
|
@@ -308,8 +309,9 @@ function loadConfig(rootDir) {
|
|
|
308
309
|
try {
|
|
309
310
|
let config;
|
|
310
311
|
if (configFile.endsWith(".js")) {
|
|
311
|
-
|
|
312
|
-
|
|
312
|
+
const fileUrl = (0, import_url.pathToFileURL)(configPath).href;
|
|
313
|
+
const module2 = await import(`${fileUrl}?t=${Date.now()}`);
|
|
314
|
+
config = module2.default || module2;
|
|
313
315
|
} else {
|
|
314
316
|
const content = (0, import_fs.readFileSync)(configPath, "utf-8");
|
|
315
317
|
config = JSON.parse(content);
|
|
@@ -319,7 +321,8 @@ function loadConfig(rootDir) {
|
|
|
319
321
|
}
|
|
320
322
|
return config;
|
|
321
323
|
} catch (error) {
|
|
322
|
-
|
|
324
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
325
|
+
throw new Error(`Failed to load config from ${configPath}: ${errorMessage}`);
|
|
323
326
|
}
|
|
324
327
|
}
|
|
325
328
|
}
|
|
@@ -371,8 +374,8 @@ function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()
|
|
|
371
374
|
}
|
|
372
375
|
return outputPath;
|
|
373
376
|
}
|
|
374
|
-
function loadMergedConfig(directory, defaults, cliOptions) {
|
|
375
|
-
const config = loadConfig(directory);
|
|
377
|
+
async function loadMergedConfig(directory, defaults, cliOptions) {
|
|
378
|
+
const config = await loadConfig(directory);
|
|
376
379
|
const mergedConfig = mergeConfigWithDefaults(config, defaults);
|
|
377
380
|
const result = {
|
|
378
381
|
...mergedConfig,
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
1
|
// src/utils/file-scanner.ts
|
|
9
2
|
import { glob } from "glob";
|
|
10
3
|
import { readFile } from "fs/promises";
|
|
@@ -255,6 +248,7 @@ function estimateTokens(text) {
|
|
|
255
248
|
// src/utils/config.ts
|
|
256
249
|
import { readFileSync, existsSync } from "fs";
|
|
257
250
|
import { join, resolve, dirname } from "path";
|
|
251
|
+
import { pathToFileURL } from "url";
|
|
258
252
|
var CONFIG_FILES = [
|
|
259
253
|
"aiready.json",
|
|
260
254
|
"aiready.config.json",
|
|
@@ -263,7 +257,7 @@ var CONFIG_FILES = [
|
|
|
263
257
|
"aiready.config.js",
|
|
264
258
|
".aireadyrc.js"
|
|
265
259
|
];
|
|
266
|
-
function loadConfig(rootDir) {
|
|
260
|
+
async function loadConfig(rootDir) {
|
|
267
261
|
let currentDir = resolve(rootDir);
|
|
268
262
|
while (true) {
|
|
269
263
|
for (const configFile of CONFIG_FILES) {
|
|
@@ -272,8 +266,9 @@ function loadConfig(rootDir) {
|
|
|
272
266
|
try {
|
|
273
267
|
let config;
|
|
274
268
|
if (configFile.endsWith(".js")) {
|
|
275
|
-
|
|
276
|
-
|
|
269
|
+
const fileUrl = pathToFileURL(configPath).href;
|
|
270
|
+
const module = await import(`${fileUrl}?t=${Date.now()}`);
|
|
271
|
+
config = module.default || module;
|
|
277
272
|
} else {
|
|
278
273
|
const content = readFileSync(configPath, "utf-8");
|
|
279
274
|
config = JSON.parse(content);
|
|
@@ -283,7 +278,8 @@ function loadConfig(rootDir) {
|
|
|
283
278
|
}
|
|
284
279
|
return config;
|
|
285
280
|
} catch (error) {
|
|
286
|
-
|
|
281
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
282
|
+
throw new Error(`Failed to load config from ${configPath}: ${errorMessage}`);
|
|
287
283
|
}
|
|
288
284
|
}
|
|
289
285
|
}
|
|
@@ -335,8 +331,8 @@ function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()
|
|
|
335
331
|
}
|
|
336
332
|
return outputPath;
|
|
337
333
|
}
|
|
338
|
-
function loadMergedConfig(directory, defaults, cliOptions) {
|
|
339
|
-
const config = loadConfig(directory);
|
|
334
|
+
async function loadMergedConfig(directory, defaults, cliOptions) {
|
|
335
|
+
const config = await loadConfig(directory);
|
|
340
336
|
const mergedConfig = mergeConfigWithDefaults(config, defaults);
|
|
341
337
|
const result = {
|
|
342
338
|
...mergedConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Shared utilities for AIReady analysis tools",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -12,14 +12,6 @@
|
|
|
12
12
|
"import": "./dist/index.mjs"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
17
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
18
|
-
"lint": "eslint src",
|
|
19
|
-
"clean": "rm -rf dist",
|
|
20
|
-
"prepublishOnly": "pnpm build",
|
|
21
|
-
"release": "pnpm build && pnpm publish --no-git-checks"
|
|
22
|
-
},
|
|
23
15
|
"keywords": [
|
|
24
16
|
"aiready",
|
|
25
17
|
"code-analysis",
|
|
@@ -51,5 +43,12 @@
|
|
|
51
43
|
"chalk": "^5.4.1",
|
|
52
44
|
"glob": "^13.0.0",
|
|
53
45
|
"typescript": "^5.9.3"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
49
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
50
|
+
"lint": "eslint src",
|
|
51
|
+
"clean": "rm -rf dist",
|
|
52
|
+
"release": "pnpm build && pnpm publish --no-git-checks"
|
|
54
53
|
}
|
|
55
|
-
}
|
|
54
|
+
}
|