prodex 1.4.11 → 2.0.0
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/LICENSE +20 -20
- package/README.md +238 -234
- package/bin/prodex.js +0 -0
- package/dist/app/execute-run.d.ts +2 -0
- package/dist/app/execute-run.js +73 -0
- package/dist/app/project-context.d.ts +12 -0
- package/dist/app/project-context.js +48 -0
- package/dist/app/run-plans.d.ts +11 -0
- package/dist/app/run-plans.js +61 -0
- package/dist/cache/cache-keys.d.ts +9 -0
- package/dist/cache/cache-manager.d.ts +9 -0
- package/dist/{core/managers/cache.js → cache/cache-manager.js} +5 -18
- package/dist/cli/cli-input.d.ts +2 -0
- package/dist/cli/cli-input.js +138 -124
- package/dist/cli/flag-specs.d.ts +12 -0
- package/dist/cli/flag-specs.js +27 -0
- package/dist/cli/help.d.ts +2 -0
- package/dist/cli/help.js +83 -0
- package/dist/cli/report-command.d.ts +2 -0
- package/dist/cli/report-command.js +80 -0
- package/dist/cli/reporter.d.ts +2 -0
- package/dist/cli/reporter.js +8 -0
- package/dist/commands/init-command.d.ts +1 -0
- package/dist/commands/init-command.js +9 -0
- package/dist/commands/migrate-command.d.ts +7 -0
- package/dist/commands/migrate-command.js +76 -0
- package/dist/commands/profiles-command.d.ts +6 -0
- package/dist/commands/profiles-command.js +16 -0
- package/dist/commands/run-command.d.ts +11 -0
- package/dist/commands/run-command.js +17 -0
- package/dist/config/build-config.d.ts +13 -0
- package/dist/config/build-config.js +127 -0
- package/dist/config/create-default-config.d.ts +9 -0
- package/dist/config/create-default-config.js +25 -0
- package/dist/config/default-config.d.ts +2 -0
- package/dist/config/default-config.js +23 -0
- package/dist/config/json.d.ts +2 -0
- package/dist/config/json.js +10 -0
- package/dist/config/load.d.ts +9 -0
- package/dist/config/load.js +48 -0
- package/dist/config/migration/detect.d.ts +4 -0
- package/dist/config/migration/detect.js +22 -0
- package/dist/config/migration/index.d.ts +4 -0
- package/dist/{shared → config/migration}/index.js +4 -3
- package/dist/config/migration/messages.d.ts +2 -0
- package/dist/config/migration/messages.js +35 -0
- package/dist/config/migration/transform.d.ts +2 -0
- package/dist/config/migration/transform.js +80 -0
- package/dist/config/migration/types.d.ts +16 -0
- package/dist/config/string-list.d.ts +2 -0
- package/dist/config/string-list.js +17 -0
- package/dist/diagnostics/logger.d.ts +3 -0
- package/dist/diagnostics/logger.js +33 -0
- package/dist/filesystem/glob-scan.d.ts +4 -0
- package/dist/filesystem/glob-scan.js +26 -0
- package/dist/filesystem/inspect.d.ts +1 -0
- package/dist/filesystem/inspect.js +15 -0
- package/dist/filesystem/path.d.ts +2 -0
- package/dist/filesystem/path.js +11 -0
- package/dist/filesystem/read-file.d.ts +8 -0
- package/dist/{shared/io.js → filesystem/read-file.js} +0 -25
- package/dist/filesystem/stat-cache.d.ts +1 -0
- package/dist/filesystem/stat-cache.js +22 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +76 -83
- package/dist/output/markdown.d.ts +12 -0
- package/dist/output/markdown.js +150 -0
- package/dist/output/naming.d.ts +2 -0
- package/dist/output/naming.js +30 -0
- package/dist/output/produce-output.d.ts +2 -0
- package/dist/output/produce-output.js +35 -0
- package/dist/output/render-constants.d.ts +21 -0
- package/dist/{constants → output}/render-constants.js +2 -1
- package/dist/output/text.d.ts +2 -0
- package/dist/output/text.js +14 -0
- package/dist/resolvers/js/extract-imports.d.ts +1 -0
- package/dist/resolvers/js/js-resolver.d.ts +2 -0
- package/dist/resolvers/js/js-resolver.js +45 -89
- package/dist/resolvers/js/resolve-alias.d.ts +2 -0
- package/dist/resolvers/js/resolve-alias.js +12 -20
- package/dist/resolvers/php/bindings.d.ts +8 -0
- package/dist/resolvers/php/bindings.js +8 -9
- package/dist/resolvers/php/extract-imports.d.ts +13 -0
- package/dist/resolvers/php/extract-imports.js +1 -1
- package/dist/resolvers/php/php-resolver.d.ts +2 -0
- package/dist/resolvers/php/php-resolver.js +61 -90
- package/dist/resolvers/php/psr4.d.ts +5 -0
- package/dist/resolvers/php/psr4.js +7 -7
- package/dist/resolvers/resolver-constants.d.ts +4 -0
- package/dist/resolvers/resolver-constants.js +7 -0
- package/dist/resolvers/resolver-result.d.ts +5 -0
- package/dist/resolvers/resolver-result.js +18 -0
- package/dist/tracing/exclude.d.ts +6 -0
- package/dist/{shared/patterns.js → tracing/exclude.js} +4 -4
- package/dist/tracing/follow-chain.d.ts +5 -0
- package/dist/tracing/follow-chain.js +63 -0
- package/dist/tracing/include-files.d.ts +2 -0
- package/dist/tracing/include-files.js +36 -0
- package/dist/tracing/resolver-registry.d.ts +5 -0
- package/dist/tracing/resolver-registry.js +20 -0
- package/dist/tracing/trace-run.d.ts +2 -0
- package/dist/tracing/trace-run.js +21 -0
- package/dist/tracing/trace-stats.d.ts +4 -0
- package/dist/tracing/trace-stats.js +16 -0
- package/dist/types/app.types.d.ts +61 -0
- package/dist/types/app.types.js +2 -0
- package/dist/types/cli.types.d.ts +22 -0
- package/dist/types/cli.types.js +0 -10
- package/dist/types/config.types.d.ts +34 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +3 -1
- package/dist/types/output.types.d.ts +6 -0
- package/dist/types/output.types.js +2 -0
- package/dist/types/resolver.types.d.ts +23 -0
- package/dist/types/tracing.types.d.ts +23 -0
- package/dist/types/tracing.types.js +2 -0
- package/dist/types/utils.types.d.ts +10 -0
- package/package.json +35 -12
- package/schema/prodex.schema.json +122 -0
- package/dist/cli/init.js +0 -21
- package/dist/cli/picker.js +0 -83
- package/dist/cli/summary.js +0 -32
- package/dist/constants/config.js +0 -27
- package/dist/constants/default-config.js +0 -43
- package/dist/constants/flags.js +0 -79
- package/dist/constants/index.js +0 -20
- package/dist/core/combine.js +0 -56
- package/dist/core/dependency.js +0 -98
- package/dist/core/helpers.js +0 -85
- package/dist/core/managers/config.js +0 -140
- package/dist/core/output.js +0 -49
- package/dist/core/renderers.js +0 -210
- package/dist/debug.js +0 -15
- package/dist/lib/logger.js +0 -42
- package/dist/lib/polyfills.js +0 -17
- package/dist/lib/prompt.js +0 -34
- package/dist/lib/questions.js +0 -28
- package/dist/lib/utils.js +0 -46
- package/dist/shared/collections.js +0 -33
- package/dist/store.js +0 -15
- /package/dist/{constants → cache}/cache-keys.js +0 -0
- /package/dist/{types/core.types.js → config/migration/types.js} +0 -0
package/dist/types/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./config.types"), exports);
|
|
18
18
|
__exportStar(require("./cli.types"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./tracing.types"), exports);
|
|
20
|
+
__exportStar(require("./output.types"), exports);
|
|
20
21
|
__exportStar(require("./resolver.types"), exports);
|
|
21
22
|
__exportStar(require("./utils.types"), exports);
|
|
23
|
+
__exportStar(require("./app.types"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ProdexConfig } from "./config.types";
|
|
2
|
+
export interface JsResolverCtx {
|
|
3
|
+
kind: "js";
|
|
4
|
+
aliases: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export interface PhpResolverCtx {
|
|
7
|
+
kind: "php";
|
|
8
|
+
psr4: Record<string, string>;
|
|
9
|
+
nsKeys: string[];
|
|
10
|
+
bindings: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export interface ResolverParams {
|
|
13
|
+
cfg: ProdexConfig;
|
|
14
|
+
filePath: string;
|
|
15
|
+
ctx?: JsResolverCtx | PhpResolverCtx;
|
|
16
|
+
}
|
|
17
|
+
export interface ResolverResult {
|
|
18
|
+
files: string[];
|
|
19
|
+
stats: {
|
|
20
|
+
expected: Set<string>;
|
|
21
|
+
resolved: Set<string>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ProdexConfig } from "./config.types";
|
|
2
|
+
export interface TraceStats {
|
|
3
|
+
expected: Set<string>;
|
|
4
|
+
resolved: Set<string>;
|
|
5
|
+
}
|
|
6
|
+
export interface ChainResult {
|
|
7
|
+
files: string[];
|
|
8
|
+
stats: TraceStats;
|
|
9
|
+
}
|
|
10
|
+
export interface TraceOptions {
|
|
11
|
+
entries: string[];
|
|
12
|
+
outputName?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface TraceParams {
|
|
15
|
+
cfg: ProdexConfig;
|
|
16
|
+
opts: TraceOptions;
|
|
17
|
+
}
|
|
18
|
+
export interface TraceResult {
|
|
19
|
+
outputPath?: string;
|
|
20
|
+
entries: string[];
|
|
21
|
+
files: string[];
|
|
22
|
+
stats?: TraceStats;
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prodex",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Focused code-context extractor for large projects.",
|
|
5
5
|
"type": "commonjs",
|
|
6
|
+
"packageManager": "npm@11.12.1",
|
|
6
7
|
"bin": {
|
|
7
8
|
"prodex": "./bin/prodex.js"
|
|
8
9
|
},
|
|
9
10
|
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./schema": "./schema/prodex.schema.json",
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
10
21
|
"files": [
|
|
11
22
|
"dist/",
|
|
12
23
|
"bin/",
|
|
13
24
|
"README.md",
|
|
14
|
-
"LICENSE"
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"schema/prodex.schema.json"
|
|
15
27
|
],
|
|
16
28
|
"keywords": [
|
|
17
29
|
"laravel",
|
|
@@ -24,29 +36,40 @@
|
|
|
24
36
|
"indexer"
|
|
25
37
|
],
|
|
26
38
|
"scripts": {
|
|
27
|
-
"
|
|
39
|
+
"clean": "node scripts/clean-dist.js",
|
|
40
|
+
"build": "npm run clean && tsc && npm run gen:schema",
|
|
28
41
|
"dev": "tsc --watch",
|
|
29
42
|
"gen:schema": "node schema/generate.js",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
43
|
+
"check:architecture": "node scripts/check-architecture.js",
|
|
44
|
+
"test": "npm run check:architecture && npm run build && node --test test/cli-contract.test.js",
|
|
45
|
+
"prepack": "npm run build",
|
|
46
|
+
"pack:check": "npm pack --dry-run"
|
|
47
|
+
},
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/emxhive/prodex.git"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/emxhive/prodex#readme",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/emxhive/prodex/issues"
|
|
32
55
|
},
|
|
33
56
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
57
|
+
"node": ">=22"
|
|
35
58
|
},
|
|
36
59
|
"author": "emxhive",
|
|
37
60
|
"license": "MIT",
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public",
|
|
63
|
+
"registry": "https://registry.npmjs.org/"
|
|
64
|
+
},
|
|
38
65
|
"devDependencies": {
|
|
39
66
|
"@types/node": "^24.9.2",
|
|
40
|
-
"nodemon": "^3.1.10",
|
|
41
67
|
"ts-json-schema-generator": "^2.4.0",
|
|
42
68
|
"typescript": "^5.9.3"
|
|
43
69
|
},
|
|
44
70
|
"dependencies": {
|
|
45
71
|
"es-module-lexer": "^1.7.0",
|
|
46
72
|
"fast-glob": "^3.3.3",
|
|
47
|
-
"
|
|
48
|
-
"micromatch": "^4.0.8",
|
|
49
|
-
"sade": "^1.8.1",
|
|
50
|
-
"source-map-support": "^0.5.21"
|
|
73
|
+
"micromatch": "^4.0.8"
|
|
51
74
|
}
|
|
52
75
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$ref": "#/definitions/ProdexConfigFile",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"ProdexConfigFile": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"version": {
|
|
13
|
+
"type": "number"
|
|
14
|
+
},
|
|
15
|
+
"output": {
|
|
16
|
+
"$ref": "#/definitions/DeepPartial%3Cstructure-184175265-479-545-184175265-470-546-184175265-446-742-184175265-0-743%3E"
|
|
17
|
+
},
|
|
18
|
+
"entry": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"exclude": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"resolve": {
|
|
37
|
+
"$ref": "#/definitions/DeepPartial%3Cstructure-184175265-616-696-184175265-605-697-184175265-446-742-184175265-0-743%3E"
|
|
38
|
+
},
|
|
39
|
+
"profiles": {
|
|
40
|
+
"$ref": "#/definitions/DeepPartial%3Cindexed-type-731470504-74242-74263-731470504-74138-74264-731470504-0-218439%3Cstring%2Cdef-alias-184175265-335-446-184175265-0-743%3E%3E"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": [
|
|
44
|
+
"$schema",
|
|
45
|
+
"version"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"DeepPartial<structure-184175265-479-545-184175265-470-546-184175265-446-742-184175265-0-743>": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"properties": {
|
|
51
|
+
"dir": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
},
|
|
54
|
+
"versioned": {
|
|
55
|
+
"type": "boolean"
|
|
56
|
+
},
|
|
57
|
+
"format": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"enum": [
|
|
60
|
+
"md",
|
|
61
|
+
"txt"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"additionalProperties": false
|
|
66
|
+
},
|
|
67
|
+
"DeepPartial<structure-184175265-616-696-184175265-605-697-184175265-446-742-184175265-0-743>": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"properties": {
|
|
70
|
+
"aliases": {
|
|
71
|
+
"$ref": "#/definitions/DeepPartial%3Cindexed-type-731470504-74242-74263-731470504-74138-74264-731470504-0-218439%3Cstring%2Cstring%3E%3E"
|
|
72
|
+
},
|
|
73
|
+
"maxDepth": {
|
|
74
|
+
"type": "number"
|
|
75
|
+
},
|
|
76
|
+
"maxFiles": {
|
|
77
|
+
"type": "number"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"additionalProperties": false
|
|
81
|
+
},
|
|
82
|
+
"DeepPartial<indexed-type-731470504-74242-74263-731470504-74138-74264-731470504-0-218439<string,string>>": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"additionalProperties": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"DeepPartial<indexed-type-731470504-74242-74263-731470504-74138-74264-731470504-0-218439<string,def-alias-184175265-335-446-184175265-0-743>>": {
|
|
89
|
+
"type": "object",
|
|
90
|
+
"additionalProperties": {
|
|
91
|
+
"$ref": "#/definitions/DeepPartial%3CProdexProfile%3E"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"DeepPartial<ProdexProfile>": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"properties": {
|
|
97
|
+
"name": {
|
|
98
|
+
"type": "string"
|
|
99
|
+
},
|
|
100
|
+
"entry": {
|
|
101
|
+
"type": "array",
|
|
102
|
+
"items": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"include": {
|
|
107
|
+
"type": "array",
|
|
108
|
+
"items": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"exclude": {
|
|
113
|
+
"type": "array",
|
|
114
|
+
"items": {
|
|
115
|
+
"type": "string"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"additionalProperties": false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
package/dist/cli/init.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.initProdex = initProdex;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const default_config_1 = require("../constants/default-config");
|
|
10
|
-
const utils_1 = require("../lib/utils");
|
|
11
|
-
async function initProdex() {
|
|
12
|
-
console.log("🪄 Prodex Init — Configuration Wizard (v3");
|
|
13
|
-
const dest = path_1.default.join(process.cwd(), "prodex.json");
|
|
14
|
-
if (fs_1.default.existsSync(dest)) {
|
|
15
|
-
console.error("prodex.json already exists. Delete or modify it manually.\n");
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
fs_1.default.writeFileSync(dest, (0, utils_1.toJson)(default_config_1.DEFAULT_PRODEX_CONFIG) + "\n", "utf8");
|
|
19
|
-
console.log(`✅ Created ${dest}`);
|
|
20
|
-
console.log("💡 Globs supported everywhere (include, exclude, priority).");
|
|
21
|
-
}
|
package/dist/cli/picker.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.pickEntries = pickEntries;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
-
const helpers_1 = require("../core/helpers");
|
|
11
|
-
const io_1 = require("../shared/io");
|
|
12
|
-
const helpers_2 = require("../core/helpers");
|
|
13
|
-
const collections_1 = require("../shared/collections");
|
|
14
|
-
const logger_1 = require("../lib/logger");
|
|
15
|
-
const prompt_1 = require("../lib/prompt");
|
|
16
|
-
const questions_1 = require("../lib/questions");
|
|
17
|
-
/**
|
|
18
|
-
* Interactive entry picker for Prodex.
|
|
19
|
-
* Handles depth-based scanning, caching, and priority ordering.
|
|
20
|
-
*/
|
|
21
|
-
async function pickEntries(cfg) {
|
|
22
|
-
const { root, entry: { files, ui: { roots = [], priority = [], scanDepth }, }, } = cfg;
|
|
23
|
-
let depth = scanDepth;
|
|
24
|
-
const entryPatterns = files || [];
|
|
25
|
-
const priorities = [...entryPatterns, ...priority];
|
|
26
|
-
// 1️⃣ Resolve pre-defined entry patterns
|
|
27
|
-
const resolvedEntries = (await (0, helpers_2.globScan)(entryPatterns, { cwd: root })).files;
|
|
28
|
-
let selected = [...resolvedEntries];
|
|
29
|
-
// cache: depth → files[]
|
|
30
|
-
const scanCache = new Map();
|
|
31
|
-
for (;;) {
|
|
32
|
-
const files = await getFilesAtDepth(depth, cfg, scanCache);
|
|
33
|
-
// Merge resolved entries with current scan results
|
|
34
|
-
const combined = (0, collections_1.unique)([...resolvedEntries, ...files]);
|
|
35
|
-
const sorted = (0, helpers_1.orderByPriority)(combined, priorities);
|
|
36
|
-
// Build UI selection list
|
|
37
|
-
const choices = sorted.map((f) => ({
|
|
38
|
-
name: (0, io_1.rel)(f, root),
|
|
39
|
-
value: f,
|
|
40
|
-
checked: selected.includes(f),
|
|
41
|
-
}));
|
|
42
|
-
if (depth < scanDepth + 5) {
|
|
43
|
-
choices.push(new inquirer_1.default.Separator());
|
|
44
|
-
choices.push({ name: "🔽 Load more (go deeper)", value: "__loadmore" });
|
|
45
|
-
}
|
|
46
|
-
// 🧠 Use unified prompt wrapper
|
|
47
|
-
const answers = await (0, prompt_1.prompt)((0, questions_1.PICK_ENTRIES_QUESTION)(choices, depth), { picks: [] });
|
|
48
|
-
if (!answers)
|
|
49
|
-
return (0, collections_1.unique)(selected);
|
|
50
|
-
const { picks } = answers;
|
|
51
|
-
if (picks.includes("__loadmore")) {
|
|
52
|
-
depth++;
|
|
53
|
-
selected = picks.filter((p) => p !== "__loadmore");
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
selected = picks.filter((p) => p !== "__loadmore");
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
return (0, collections_1.unique)(selected);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Depth-based directory scanner with caching.
|
|
63
|
-
*/
|
|
64
|
-
async function getFilesAtDepth(depth, cfg, scanCache) {
|
|
65
|
-
const baseDirs = cfg.entry.ui.roots || [];
|
|
66
|
-
if (scanCache.has(depth)) {
|
|
67
|
-
logger_1.logger.debug(`[picker] cache hit → depth=${depth}`);
|
|
68
|
-
return scanCache.get(depth);
|
|
69
|
-
}
|
|
70
|
-
logger_1.logger.debug(`[picker] scanning → depth=${depth}`);
|
|
71
|
-
const files = [];
|
|
72
|
-
const effectiveCfg = { ...cfg, scanDepth: depth };
|
|
73
|
-
for (const base of baseDirs) {
|
|
74
|
-
const full = path_1.default.join(cfg.root, base);
|
|
75
|
-
if (!fs_1.default.existsSync(full))
|
|
76
|
-
continue;
|
|
77
|
-
for (const f of (0, helpers_1.walk)(full, effectiveCfg, 0))
|
|
78
|
-
files.push(f.norm());
|
|
79
|
-
}
|
|
80
|
-
scanCache.set(depth, files);
|
|
81
|
-
logger_1.logger.debug(`[picker] depth=${depth} found=${files.length}`);
|
|
82
|
-
return files;
|
|
83
|
-
}
|
package/dist/cli/summary.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.endSummary = endSummary;
|
|
4
|
-
exports.introSummary = introSummary;
|
|
5
|
-
exports.entrySummary = entrySummary;
|
|
6
|
-
const logger_1 = require("../lib/logger");
|
|
7
|
-
const io_1 = require("../shared/io");
|
|
8
|
-
const store_1 = require("../store");
|
|
9
|
-
let CONFIG;
|
|
10
|
-
let FLAGS;
|
|
11
|
-
function endSummary(out, result) {
|
|
12
|
-
logger_1.logger.debug(`🧩 Summary:
|
|
13
|
-
• Unique imports expected: ${result?.stats?.expected.size}
|
|
14
|
-
• Unique imports resolved: ${result?.stats?.resolved.size}
|
|
15
|
-
`);
|
|
16
|
-
logger_1.logger.log(`✅ ${out.norm()}`);
|
|
17
|
-
}
|
|
18
|
-
function introSummary() {
|
|
19
|
-
CONFIG = (0, store_1.getConfig)();
|
|
20
|
-
FLAGS = (0, store_1.getFlags)();
|
|
21
|
-
logger_1.logger.log(`------- PRODEx RUN @ ${new Date().toLocaleTimeString()} — Codebase decoded -------\n`);
|
|
22
|
-
// Log parse results for testing
|
|
23
|
-
logger_1.logger.debug("🧩 Parsed CLI input:", _2j({ FLAGS }));
|
|
24
|
-
logger_1.logger.debug("Final merged config:", _2j(CONFIG));
|
|
25
|
-
}
|
|
26
|
-
function entrySummary(entries) {
|
|
27
|
-
let result = "📋 You selected:";
|
|
28
|
-
for (const e of entries)
|
|
29
|
-
result += "\n -" + (0, io_1.rel)(e);
|
|
30
|
-
if (entries?.length)
|
|
31
|
-
logger_1.logger.log(result);
|
|
32
|
-
}
|
package/dist/constants/config.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VALID_GLOB_CHARS = exports.SUFFIX = exports.GLOBAL_IGNORE = exports.RESOLVERS = exports.DTS_EXT = exports.REAL_EXTS = exports.BASE_EXTS = exports.CODE_EXTS = void 0;
|
|
4
|
-
const js_resolver_1 = require("../resolvers/js/js-resolver");
|
|
5
|
-
const php_resolver_1 = require("../resolvers/php/php-resolver");
|
|
6
|
-
exports.CODE_EXTS = [".js", ".mjs", ".ts", ".tsx", ".d.ts", ".php"];
|
|
7
|
-
exports.BASE_EXTS = [".ts", ".tsx", ".js", ".jsx", ".mjs"];
|
|
8
|
-
exports.REAL_EXTS = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".d.ts", ".json"]);
|
|
9
|
-
exports.DTS_EXT = ".d.ts";
|
|
10
|
-
exports.RESOLVERS = {
|
|
11
|
-
".php": php_resolver_1.resolvePhpImports,
|
|
12
|
-
".ts": js_resolver_1.resolveJsImports,
|
|
13
|
-
".tsx": js_resolver_1.resolveJsImports,
|
|
14
|
-
".d.ts": js_resolver_1.resolveJsImports,
|
|
15
|
-
".js": js_resolver_1.resolveJsImports,
|
|
16
|
-
};
|
|
17
|
-
exports.GLOBAL_IGNORE = ["**/node_modules/**", "**/vendor/**", "**/dist/**"];
|
|
18
|
-
exports.SUFFIX = "trace";
|
|
19
|
-
/**
|
|
20
|
-
* Normalize and sanitize pattern fields.
|
|
21
|
-
* - Always returns an array.
|
|
22
|
-
* - Accepts string or string[].
|
|
23
|
-
* - Splits comma-separated strings.
|
|
24
|
-
* - Trims and removes empty elements.
|
|
25
|
-
* - Filters out invalid or unusable characters for Fast-Glob.
|
|
26
|
-
*/
|
|
27
|
-
exports.VALID_GLOB_CHARS = /^[\w\-@./*?|!{}\[\]^$()+]+$/;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_PRODEX_CONFIG = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Default configuration for Prodex.
|
|
6
|
-
* Conforms strictly to ProdexConfig for full type safety.
|
|
7
|
-
*/
|
|
8
|
-
exports.DEFAULT_PRODEX_CONFIG = {
|
|
9
|
-
version: 3.1,
|
|
10
|
-
$schema: "https://raw.githubusercontent.com/emxhive/prodex/main/schema/prodex.schema.json",
|
|
11
|
-
output: {
|
|
12
|
-
dir: "prodex",
|
|
13
|
-
versioned: true,
|
|
14
|
-
prefix: "combined",
|
|
15
|
-
format: "md",
|
|
16
|
-
},
|
|
17
|
-
entry: {
|
|
18
|
-
files: [],
|
|
19
|
-
ui: {
|
|
20
|
-
roots: ["app", "routes", "resources/js/**"],
|
|
21
|
-
scanDepth: 2,
|
|
22
|
-
priority: ["**/routes/web.php", "**/app.*"],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
resolve: {
|
|
26
|
-
include: ["**/*.d.ts"],
|
|
27
|
-
aliases: {
|
|
28
|
-
"@": "resources/js",
|
|
29
|
-
},
|
|
30
|
-
exclude: ["node_modules/**", "@shadcn/**", "**/components/ui/**"],
|
|
31
|
-
depth: 10,
|
|
32
|
-
limit: 200,
|
|
33
|
-
},
|
|
34
|
-
shortcuts: {
|
|
35
|
-
dashboard: {
|
|
36
|
-
files: ["**/dashboard.tsx"],
|
|
37
|
-
include: ["**.app.tsx", "**/*.d.ts"],
|
|
38
|
-
},
|
|
39
|
-
web: {
|
|
40
|
-
files: ["**/web.php", "**/api.php"],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
package/dist/constants/flags.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLI_USAGE = exports.FLAG_SHORT_MAP = exports.FLAG_MAP = void 0;
|
|
4
|
-
exports.FLAG_MAP = {
|
|
5
|
-
txt: {
|
|
6
|
-
short: "t",
|
|
7
|
-
type: "boolean",
|
|
8
|
-
description: "Output as .txt instead of .md.",
|
|
9
|
-
apply: (cfg, v) => (cfg.output.format = v ? "txt" : "md"),
|
|
10
|
-
},
|
|
11
|
-
name: {
|
|
12
|
-
short: "n",
|
|
13
|
-
type: "string",
|
|
14
|
-
description: "Custom output filename (without extension).",
|
|
15
|
-
apply: (cfg, v) => (cfg.name = v),
|
|
16
|
-
},
|
|
17
|
-
limit: {
|
|
18
|
-
short: "l",
|
|
19
|
-
type: "number",
|
|
20
|
-
description: "Override traversal limit.",
|
|
21
|
-
apply: (cfg, v) => (cfg.resolve.limit = v),
|
|
22
|
-
},
|
|
23
|
-
include: {
|
|
24
|
-
short: "i",
|
|
25
|
-
type: "list",
|
|
26
|
-
description: "Comma-separated include globs.",
|
|
27
|
-
apply: (cfg, v) => (cfg.resolve.include = v),
|
|
28
|
-
},
|
|
29
|
-
exclude: {
|
|
30
|
-
short: "x",
|
|
31
|
-
type: "list",
|
|
32
|
-
description: "Comma-separated exclude globs.",
|
|
33
|
-
apply: (cfg, v) => (cfg.resolve.exclude = v),
|
|
34
|
-
},
|
|
35
|
-
files: {
|
|
36
|
-
short: "f",
|
|
37
|
-
type: "list",
|
|
38
|
-
description: "Entry files (comma-separated).",
|
|
39
|
-
apply: (cfg, v) => (cfg.entry.files = v),
|
|
40
|
-
},
|
|
41
|
-
ci: {
|
|
42
|
-
short: "c",
|
|
43
|
-
type: "boolean",
|
|
44
|
-
description: "Headless (non-interactive) mode.",
|
|
45
|
-
apply: () => { },
|
|
46
|
-
},
|
|
47
|
-
debug: {
|
|
48
|
-
short: "d",
|
|
49
|
-
type: "boolean",
|
|
50
|
-
description: "Enable debug logs.",
|
|
51
|
-
apply: () => { },
|
|
52
|
-
},
|
|
53
|
-
shortcut: {
|
|
54
|
-
short: "a",
|
|
55
|
-
type: "string",
|
|
56
|
-
description: "Apply a config shortcut by name.",
|
|
57
|
-
apply: () => { },
|
|
58
|
-
},
|
|
59
|
-
help: {
|
|
60
|
-
short: "h",
|
|
61
|
-
type: "boolean",
|
|
62
|
-
description: "Show CLI help and exit.",
|
|
63
|
-
apply: () => { },
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
// Reverse lookup for short aliases
|
|
67
|
-
exports.FLAG_SHORT_MAP = Object.entries(exports.FLAG_MAP).reduce((acc, [k, v]) => {
|
|
68
|
-
//@ts-ignore
|
|
69
|
-
if (v.short)
|
|
70
|
-
acc[v.short] = k;
|
|
71
|
-
return acc;
|
|
72
|
-
}, {});
|
|
73
|
-
exports.CLI_USAGE = `
|
|
74
|
-
Usage: prodex [options]
|
|
75
|
-
|
|
76
|
-
${Object.entries(exports.FLAG_MAP)
|
|
77
|
-
.map(([k, v]) => ` --${k}${v.short ? ` | -${v.short}` : ""}\t${v.description}`)
|
|
78
|
-
.join("\n")}
|
|
79
|
-
`;
|
package/dist/constants/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./cache-keys"), exports);
|
|
18
|
-
__exportStar(require("./default-config"), exports);
|
|
19
|
-
__exportStar(require("./render-constants"), exports);
|
|
20
|
-
__exportStar(require("./config"), exports);
|
package/dist/core/combine.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runCombine = runCombine;
|
|
4
|
-
const picker_1 = require("../cli/picker");
|
|
5
|
-
const summary_1 = require("../cli/summary");
|
|
6
|
-
const constants_1 = require("../constants");
|
|
7
|
-
const cache_1 = require("./managers/cache");
|
|
8
|
-
const config_1 = require("./managers/config");
|
|
9
|
-
const logger_1 = require("../lib/logger");
|
|
10
|
-
const dependency_1 = require("./dependency");
|
|
11
|
-
const helpers_1 = require("./helpers");
|
|
12
|
-
const helpers_2 = require("./helpers");
|
|
13
|
-
const output_1 = require("./output");
|
|
14
|
-
async function runCombine({ cfg, opts }) {
|
|
15
|
-
(0, summary_1.introSummary)();
|
|
16
|
-
const { showUi, cliName } = opts;
|
|
17
|
-
let entries = (await resolveEntries(showUi, cfg)) ?? [];
|
|
18
|
-
(0, summary_1.entrySummary)(entries);
|
|
19
|
-
let result;
|
|
20
|
-
if (!entries.length)
|
|
21
|
-
logger_1.logger.info("No entries found");
|
|
22
|
-
if (entries.length)
|
|
23
|
-
result = await (0, dependency_1.followChain)(entries, cfg);
|
|
24
|
-
const withinclude = await (0, dependency_1.applyIncludes)(cfg, result?.files ?? []);
|
|
25
|
-
if (!withinclude.length)
|
|
26
|
-
return logger_1.logger.info("No Includes found. Exiting process...");
|
|
27
|
-
const autoName = (0, helpers_2.smartNaming)(entries);
|
|
28
|
-
const outputPath = await (0, output_1.produceOutput)({ name: cliName ?? autoName, files: withinclude, cfg, showUi });
|
|
29
|
-
persistAliases();
|
|
30
|
-
(0, summary_1.endSummary)(outputPath, result);
|
|
31
|
-
}
|
|
32
|
-
async function resolveEntries(showUi, cfg) {
|
|
33
|
-
const { root, entry: { files }, resolve: { include }, } = cfg;
|
|
34
|
-
if (!showUi) {
|
|
35
|
-
logger_1.logger.info("CI Mode");
|
|
36
|
-
if (!files?.length) {
|
|
37
|
-
logger_1.logger.warn("No entry files defined and UI mode is disabled.");
|
|
38
|
-
if (!include.length)
|
|
39
|
-
process.exit(1);
|
|
40
|
-
logger_1.logger.info("Applying Includes");
|
|
41
|
-
}
|
|
42
|
-
return (await (0, helpers_1.globScan)(files, { cwd: root })).files;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return await (0, picker_1.pickEntries)(cfg);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 🧩 Persist discovered aliases (if any)
|
|
50
|
-
*/
|
|
51
|
-
function persistAliases() {
|
|
52
|
-
const aliases = cache_1.CacheManager.dump(constants_1.CACHE_KEYS.ALIASES);
|
|
53
|
-
if (Object.keys(aliases).length) {
|
|
54
|
-
config_1.ConfigManager.persist({ resolve: { aliases } });
|
|
55
|
-
}
|
|
56
|
-
}
|