prodex 1.4.1 β†’ 1.4.5

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
@@ -1,234 +1,234 @@
1
- # 🧩 Prodex v1.2.0
2
-
3
- > **Build the maze, I'll write a map.**
4
-
5
- ---
6
-
7
- ## 🧠 What’s New β€” v1.2.0
8
-
9
- - πŸ†• **Full CLI support with integrated [Sade](https://github.com/lukeed/sade).**
10
- Prodex now runs entirely from the terminal β€” no `prodex.json` required.
11
- Supports short flags and native glob patterns for flexible targeting.
12
-
13
- ```bash
14
- prodex -f "**/web.php,**/app.tsx" -i "**/*.d.ts" -x "node_modules/**"
15
- ```
16
-
17
- ```bash
18
- prodex --files "**/web.php,**/app.tsx" --include **/*types.ts --exclude "@shadcn/**"
19
- ```
20
-
21
- - 🧾 **Markdown mode added and now default.**
22
- Output is fully fenced and linkable β€” jump between the index and any code block.
23
- Text mode remains available using `--txt` or `-t`.
24
-
25
- - πŸ—‚ **Output naming improved.**
26
- Output files are now versioned by default.
27
- Custom names are supported using `--name` or `-n`.
28
- Naming conventions have been updated for cleaner, consistent results.
29
-
30
- ---
31
-
32
- ## βš™οΈ Usage
33
-
34
- Prodex v1.2.0 runs entirely from the command line.
35
- Interactive mode is currently unstable β€” use CLI flags instead.
36
-
37
- ### Installation
38
-
39
- ```bash
40
- npm install -g prodex
41
- ```
42
-
43
- Or run without installing:
44
-
45
- ```bash
46
- npx prodex
47
- ```
48
-
49
- ---
50
-
51
- ### Basic Run
52
-
53
- ```bash
54
- prodex -f "**/web.php,**/app.tsx"
55
- ```
56
-
57
- ### With Includes, exclude, and Custom Name
58
-
59
- ```bash
60
- prodex -f "**/web.php,**/app.tsx" -i "**/*.d.ts" -x "node_modules/**" -n "combined-output"
61
- ```
62
-
63
- ### Flag Reference
64
-
65
- | Flag | Short | Description |
66
- | ----------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
67
- | `--files` | `-f` | Entry files β€” starting points for dependency resolution. Accepts multiple names or globs. |
68
- | `--include` | `-i` | Adds extra files or patterns to include (e.g. `.d.ts`, interface, or type files). These files are **not dependency-resolved** β€” they’re appended as-is. |
69
- | `--exclude` | `-x` | Patterns or folders to skip during the scan. |
70
- | `--name` | `-n` | Custom output filename (without extension). Versioning still applies automatically. |
71
-
72
- > Globs are powered by [Fast-Glob](https://github.com/mrmlnc/fast-glob).
73
- > Use **comma-separated values** for multiple entries.
74
- > Wrap globs in quotes when they include special characters like `|` or `&`.
75
-
76
- ---
77
-
78
- ## 🧭 Plans
79
-
80
- - **Alias Resolution Improvements**
81
- Planned overhaul of alias handling to support deeper nested paths, wildcard matching, and auto-mapped imports across mixed stacks.
82
-
83
- - **Language Support**
84
- Currently supports **JavaScript**, **React**, and **Laravel + React** stacks.
85
- May work with other frameworks but remains untested.
86
- Broader multi-language support is planned for future versions.
87
-
88
- - **Combined Output**
89
- All code from multiple entries is merged into a single output file.
90
- There’s currently **no limit** on output size, but it’s advised to avoid combining _too many large entries_ in a single run.
91
- Future versions will include **smart naming** and **automatic splitting** for oversized outputs.
92
-
93
- - **Performance Optimizations**
94
- Planned improvements to resolver speed and dependency traversal for faster processing on large projects.
95
-
96
- ---
97
-
98
- ## 🧩 Features
99
-
100
- | Status | Feature | Description |
101
- | :----: | --------------------------- | ---------------------------------------------------------------------------------------------- |
102
- | βœ… | **Cross-language indexing** | Resolves imports across JS, TS, React, and PHP (Laravel) projects. |
103
- | βœ… | **Markdown output** | Generates clean `.md` files with anchors, back-to-top links, and fenced code blocks. |
104
- | βœ… | **Text output** | Optional `.txt` mode using `--txt` or `-t`. |
105
- | βœ… | **Glob support** | Works with flexible glob patterns powered by [Fast-Glob](https://github.com/mrmlnc/fast-glob). |
106
- | βœ… | **Custom output names** | Define your own output prefix using `--name` or `-n`. |
107
- | ⚠️ | **Interactive picker (UI)** | Still unstable β€” not recommended for production use. |
108
- | ⚠️ | **Alias resolution** | Basic alias mapping supported; advanced cases in progress. |
109
- | 🚧 | **Smart file splitting** | Planned for large combined outputs. |
110
- | 🚧 | **PSR-4 deep scan** | Planned to improve PHP dependency resolution. |
111
- | 🚧 | **Speed optimization** | Further resolver and I/O improvements under development. |
112
-
113
- ---
114
-
115
- ## 🧱 Use Cases
116
-
117
- Prodex can technically combine your entire codebase into one file β€”
118
- but it’s **best used in parts**, focusing on specific sections or features.
119
- Each run produces a clean, self-contained map showing all related files and dependencies.
120
-
121
- ### 🧩 Common Scenarios
122
-
123
- - **πŸ€– Project Awareness for AI Assistants**
124
- Generate compact `.md` summaries of key parts of your project.
125
- These can be shared with AI tools (like ChatGPT, Claude, or Copilot) to give them structured context about your codebase β€” without exposing unnecessary files.
126
-
127
- - **πŸ“¦ Feature or Module Mapping**
128
- Combine everything connected to a specific feature (e.g., `Checkout`, `Dashboard`, or `Payments`).
129
- Prodex gathers all linked imports, helpers, and files into one readable document.
130
-
131
- - **πŸ” Dependency Insight**
132
- Trace how a particular entry file connects through your stack β€” whether it’s `app.tsx` on the frontend or `routes/web.php` on the backend.
133
- Great for debugging, refactoring, or understanding cross-stack dependencies.
134
-
135
- - **πŸ“– Documentation Bundles**
136
- Create readable Markdown maps per module or domain instead of one large export.
137
- Each output acts as a focused, navigable view of your code relationships.
138
-
139
- - **🧠 Team Handoffs**
140
- Share isolated code scopes (like `Auth`, `Payments`, or `User Management`) with full dependency context.
141
- Makes onboarding and code reviews significantly faster.
142
-
143
- ---
144
-
145
- ## 🧩 Recommended Workflow
146
-
147
- Prodex works best when used to **map and export projects in logical parts** rather than all at once.
148
- Each run focuses on one or more entry points, and Prodex automatically **loads all imports recursively** for those files β€”
149
- then appends any files matched by the `--include` flag.
150
-
151
- ### 🧠 Suggested Pattern
152
-
153
- 1. **Pick a meaningful entry file**
154
- Example:
155
-
156
- - Frontend: `resources/js/**/dashboard.tsx`
157
- - Backend: `routes/**/(web|api).php`
158
- - Shared logic: `app/Services/**/PaymentService.php`
159
-
160
- 2. **Run Prodex with includes for type or interface files**
161
-
162
- ```bash
163
- prodex -f "**/dashboard.tsx" -i "**/*.d.ts,**/*.interface.ts"
164
- ```
165
-
166
- 3. **Export separate maps for each major area**
167
-
168
- ```bash
169
- prodex -f "**/dashboard.tsx" -n "dashboard-map"
170
- prodex -f "**/(web|api).php" -n "backend-map"
171
- ```
172
-
173
- 4. **Use them together**
174
- Store each output in `/prodex/`
175
- These maps can be shared with teammates or loaded into AI tools for structured, code-aware assistance.
176
-
177
- > ⚑ Each run recursively resolves every import, applies includes, and outputs one complete dependency map for that section.
178
-
179
- ---
180
-
181
- ## βš™οΈ Optional β€” `prodex.json`
182
-
183
- `prodex.json` is **fully optional** in v1.2.0.
184
- You can run Prodex entirely from the command line, but the config file can be useful for saved defaults.
185
-
186
- ### πŸͺ„ Quick Setup
187
-
188
- You can generate a ready-to-use config file with:
189
-
190
- ```bash
191
- prodex init
192
- ```
193
-
194
- This creates a `prodex.json` file in your project root with sensible defaults β€” including base directories, globs, and priority files.
195
-
196
- ### 🧩 Running with a Config File
197
-
198
- If you’ve defined your entry files in the config under `entry.files`,
199
- you can run Prodex directly without specifying `--files`:
200
-
201
- ```bash
202
- prodex -c
203
- ```
204
-
205
- The `-c` (or `--ci`) flag skips interactive mode and uses the config values automatically.
206
- Specifying `-f` ( or `--files`) from the CLI also disables the picker by default.
207
-
208
- You can permanently disable the picker in the config by setting:
209
-
210
- ```json
211
- "entry": {
212
- "ui": {
213
- "enablePicker": false
214
- }
215
- }
216
- ```
217
-
218
- ---
219
-
220
- ## πŸ“œ License
221
-
222
- **MIT License**
223
- Β© 2025 [emxhive](https://github.com/emxhive)
224
-
225
- ---
226
-
227
- ## ⚠️ Note from the Author
228
-
229
- Prodex is still a **work in progress**.
230
- Some parts of the experience may be rough, especially around interactive mode and advanced resolvers.
231
- Updates are released **multiple times per week β€” sometimes daily** β€” to keep improving stability and support.
232
-
233
- Please stay up to date for the best experience.
234
- Thank you for testing Prodex early. ❀️
1
+ # 🧩 Prodex v1.2.0
2
+
3
+ > **Build the maze, I'll write a map.**
4
+
5
+ ---
6
+
7
+ ## 🧠 What’s New β€” v1.2.0
8
+
9
+ - πŸ†• **Full CLI support with integrated [Sade](https://github.com/lukeed/sade).**
10
+ Prodex now runs entirely from the terminal β€” no `prodex.json` required.
11
+ Supports short flags and native glob patterns for flexible targeting.
12
+
13
+ ```bash
14
+ prodex -f "**/web.php,**/app.tsx" -i "**/*.d.ts" -x "node_modules/**"
15
+ ```
16
+
17
+ ```bash
18
+ prodex --files "**/web.php,**/app.tsx" --include **/*types.ts --exclude "@shadcn/**"
19
+ ```
20
+
21
+ - 🧾 **Markdown mode added and now default.**
22
+ Output is fully fenced and linkable β€” jump between the index and any code block.
23
+ Text mode remains available using `--txt` or `-t`.
24
+
25
+ - πŸ—‚ **Output naming improved.**
26
+ Output files are now versioned by default.
27
+ Custom names are supported using `--name` or `-n`.
28
+ Naming conventions have been updated for cleaner, consistent results.
29
+
30
+ ---
31
+
32
+ ## βš™οΈ Usage
33
+
34
+ Prodex v1.2.0 runs entirely from the command line.
35
+ Interactive mode is currently unstable β€” use CLI flags instead.
36
+
37
+ ### Installation
38
+
39
+ ```bash
40
+ npm install -g prodex
41
+ ```
42
+
43
+ Or run without installing:
44
+
45
+ ```bash
46
+ npx prodex
47
+ ```
48
+
49
+ ---
50
+
51
+ ### Basic Run
52
+
53
+ ```bash
54
+ prodex -f "**/web.php,**/app.tsx"
55
+ ```
56
+
57
+ ### With Includes, exclude, and Custom Name
58
+
59
+ ```bash
60
+ prodex -f "**/web.php,**/app.tsx" -i "**/*.d.ts" -x "node_modules/**" -n "combined-output"
61
+ ```
62
+
63
+ ### Flag Reference
64
+
65
+ | Flag | Short | Description |
66
+ | ----------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
67
+ | `--files` | `-f` | Entry files β€” starting points for dependency resolution. Accepts multiple names or globs. |
68
+ | `--include` | `-i` | Adds extra files or patterns to include (e.g. `.d.ts`, interface, or type files). These files are **not dependency-resolved** β€” they’re appended as-is. |
69
+ | `--exclude` | `-x` | Patterns or folders to skip during the scan. |
70
+ | `--name` | `-n` | Custom output filename (without extension). Versioning still applies automatically. |
71
+
72
+ > Globs are powered by [Fast-Glob](https://github.com/mrmlnc/fast-glob).
73
+ > Use **comma-separated values** for multiple entries.
74
+ > Wrap globs in quotes when they include special characters like `|` or `&`.
75
+
76
+ ---
77
+
78
+ ## 🧭 Plans
79
+
80
+ - **Alias Resolution Improvements**
81
+ Planned overhaul of alias handling to support deeper nested paths, wildcard matching, and auto-mapped imports across mixed stacks.
82
+
83
+ - **Language Support**
84
+ Currently supports **JavaScript**, **React**, and **Laravel + React** stacks.
85
+ May work with other frameworks but remains untested.
86
+ Broader multi-language support is planned for future versions.
87
+
88
+ - **Combined Output**
89
+ All code from multiple entries is merged into a single output file.
90
+ There’s currently **no limit** on output size, but it’s advised to avoid combining _too many large entries_ in a single run.
91
+ Future versions will include **smart naming** and **automatic splitting** for oversized outputs.
92
+
93
+ - **Performance Optimizations**
94
+ Planned improvements to resolver speed and dependency traversal for faster processing on large projects.
95
+
96
+ ---
97
+
98
+ ## 🧩 Features
99
+
100
+ | Status | Feature | Description |
101
+ | :----: | --------------------------- | ---------------------------------------------------------------------------------------------- |
102
+ | βœ… | **Cross-language indexing** | Resolves imports across JS, TS, React, and PHP (Laravel) projects. |
103
+ | βœ… | **Markdown output** | Generates clean `.md` files with anchors, back-to-top links, and fenced code blocks. |
104
+ | βœ… | **Text output** | Optional `.txt` mode using `--txt` or `-t`. |
105
+ | βœ… | **Glob support** | Works with flexible glob patterns powered by [Fast-Glob](https://github.com/mrmlnc/fast-glob). |
106
+ | βœ… | **Custom output names** | Define your own output prefix using `--name` or `-n`. |
107
+ | ⚠️ | **Interactive picker (UI)** | Still unstable β€” not recommended for production use. |
108
+ | ⚠️ | **Alias resolution** | Basic alias mapping supported; advanced cases in progress. |
109
+ | 🚧 | **Smart file splitting** | Planned for large combined outputs. |
110
+ | 🚧 | **PSR-4 deep scan** | Planned to improve PHP dependency resolution. |
111
+ | 🚧 | **Speed optimization** | Further resolver and I/O improvements under development. |
112
+
113
+ ---
114
+
115
+ ## 🧱 Use Cases
116
+
117
+ Prodex can technically combine your entire codebase into one file β€”
118
+ but it’s **best used in parts**, focusing on specific sections or features.
119
+ Each run produces a clean, self-contained map showing all related files and dependencies.
120
+
121
+ ### 🧩 Common Scenarios
122
+
123
+ - **πŸ€– Project Awareness for AI Assistants**
124
+ Generate compact `.md` summaries of key parts of your project.
125
+ These can be shared with AI tools (like ChatGPT, Claude, or Copilot) to give them structured context about your codebase β€” without exposing unnecessary files.
126
+
127
+ - **πŸ“¦ Feature or Module Mapping**
128
+ Combine everything connected to a specific feature (e.g., `Checkout`, `Dashboard`, or `Payments`).
129
+ Prodex gathers all linked imports, helpers, and files into one readable document.
130
+
131
+ - **πŸ” Dependency Insight**
132
+ Trace how a particular entry file connects through your stack β€” whether it’s `app.tsx` on the frontend or `routes/web.php` on the backend.
133
+ Great for debugging, refactoring, or understanding cross-stack dependencies.
134
+
135
+ - **πŸ“– Documentation Bundles**
136
+ Create readable Markdown maps per module or domain instead of one large export.
137
+ Each output acts as a focused, navigable view of your code relationships.
138
+
139
+ - **🧠 Team Handoffs**
140
+ Share isolated code scopes (like `Auth`, `Payments`, or `User Management`) with full dependency context.
141
+ Makes onboarding and code reviews significantly faster.
142
+
143
+ ---
144
+
145
+ ## 🧩 Recommended Workflow
146
+
147
+ Prodex works best when used to **map and export projects in logical parts** rather than all at once.
148
+ Each run focuses on one or more entry points, and Prodex automatically **loads all imports recursively** for those files β€”
149
+ then appends any files matched by the `--include` flag.
150
+
151
+ ### 🧠 Suggested Pattern
152
+
153
+ 1. **Pick a meaningful entry file**
154
+ Example:
155
+
156
+ - Frontend: `resources/js/**/dashboard.tsx`
157
+ - Backend: `routes/**/(web|api).php`
158
+ - Shared logic: `app/Services/**/PaymentService.php`
159
+
160
+ 2. **Run Prodex with includes for type or interface files**
161
+
162
+ ```bash
163
+ prodex -f "**/dashboard.tsx" -i "**/*.d.ts,**/*.interface.ts"
164
+ ```
165
+
166
+ 3. **Export separate maps for each major area**
167
+
168
+ ```bash
169
+ prodex -f "**/dashboard.tsx" -n "dashboard-map"
170
+ prodex -f "**/(web|api).php" -n "backend-map"
171
+ ```
172
+
173
+ 4. **Use them together**
174
+ Store each output in `/prodex/`
175
+ These maps can be shared with teammates or loaded into AI tools for structured, code-aware assistance.
176
+
177
+ > ⚑ Each run recursively resolves every import, applies includes, and outputs one complete dependency map for that section.
178
+
179
+ ---
180
+
181
+ ## βš™οΈ Optional β€” `prodex.json`
182
+
183
+ `prodex.json` is **fully optional** in v1.2.0.
184
+ You can run Prodex entirely from the command line, but the config file can be useful for saved defaults.
185
+
186
+ ### πŸͺ„ Quick Setup
187
+
188
+ You can generate a ready-to-use config file with:
189
+
190
+ ```bash
191
+ prodex init
192
+ ```
193
+
194
+ This creates a `prodex.json` file in your project root with sensible defaults β€” including base directories, globs, and priority files.
195
+
196
+ ### 🧩 Running with a Config File
197
+
198
+ If you’ve defined your entry files in the config under `entry.files`,
199
+ you can run Prodex directly without specifying `--files`:
200
+
201
+ ```bash
202
+ prodex -c
203
+ ```
204
+
205
+ The `-c` (or `--ci`) flag skips interactive mode and uses the config values automatically.
206
+ Specifying `-f` ( or `--files`) from the CLI also disables the picker by default.
207
+
208
+ You can permanently disable the picker in the config by setting:
209
+
210
+ ```json
211
+ "entry": {
212
+ "ui": {
213
+ "enablePicker": false
214
+ }
215
+ }
216
+ ```
217
+
218
+ ---
219
+
220
+ ## πŸ“œ License
221
+
222
+ **MIT License**
223
+ Β© 2025 [emxhive](https://github.com/emxhive)
224
+
225
+ ---
226
+
227
+ ## ⚠️ Note from the Author
228
+
229
+ Prodex is still a **work in progress**.
230
+ Some parts of the experience may be rough, especially around interactive mode and advanced resolvers.
231
+ Updates are released **multiple times per week β€” sometimes daily** β€” to keep improving stability and support.
232
+
233
+ Please stay up to date for the best experience.
234
+ Thank you for testing Prodex early. ❀️
@@ -22,10 +22,15 @@ function parseCliInput(argv = process.argv) {
22
22
  registerFlags(program);
23
23
  let parsed = { rootArg: "", root: undefined, flags: {} };
24
24
  program.action((root, opts) => {
25
+ let lroot = root;
25
26
  const cwd = process.cwd();
27
+ if (root?.startsWith("@")) {
28
+ opts.shortcut = root.slice(1).trim();
29
+ lroot = undefined;
30
+ }
26
31
  parsed = {
27
- rootArg: root,
28
- root: root ? path_1.default.resolve(cwd, root) : cwd,
32
+ rootArg: lroot,
33
+ root: lroot ? path_1.default.resolve(cwd, lroot) : cwd,
29
34
  flags: { ...opts },
30
35
  };
31
36
  });
package/dist/cli/init.js CHANGED
@@ -7,6 +7,7 @@ exports.initProdex = initProdex;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const default_config_1 = require("../constants/default-config");
10
+ const utils_1 = require("../lib/utils");
10
11
  async function initProdex() {
11
12
  console.log("πŸͺ„ Prodex Init β€” Configuration Wizard (v3");
12
13
  const dest = path_1.default.join(process.cwd(), "prodex.json");
@@ -14,7 +15,7 @@ async function initProdex() {
14
15
  console.error("prodex.json already exists. Delete or modify it manually.\n");
15
16
  return;
16
17
  }
17
- fs_1.default.writeFileSync(dest, JSON.stringify(default_config_1.DEFAULT_PRODEX_CONFIG, null, 2) + "\n", "utf8");
18
+ fs_1.default.writeFileSync(dest, (0, utils_1.toJson)(default_config_1.DEFAULT_PRODEX_CONFIG) + "\n", "utf8");
18
19
  console.log(`βœ… Created ${dest}`);
19
20
  console.log("πŸ’‘ Globs supported everywhere (include, exclude, priority).");
20
21
  }
@@ -24,4 +24,4 @@ exports.SUFFIX = "trace";
24
24
  * - Trims and removes empty elements.
25
25
  * - Filters out invalid or unusable characters for Fast-Glob.
26
26
  */
27
- exports.VALID_GLOB_CHARS = /^[\w\-@./*?|!{}\[\]^$()+]+$/; // allows Fast-Glob-safe symbolsexport const REAL_EXTS = new Set<string>([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".d.ts", ".json"]);
27
+ exports.VALID_GLOB_CHARS = /^[\w\-@./*?|!{}\[\]^$()+]+$/;
@@ -7,6 +7,7 @@ exports.DEFAULT_PRODEX_CONFIG = void 0;
7
7
  */
8
8
  exports.DEFAULT_PRODEX_CONFIG = {
9
9
  version: 3.1,
10
+ $schema: "https://raw.githubusercontent.com/emxhive/prodex/main/schema/prodex.schema.json",
10
11
  output: {
11
12
  dir: "prodex",
12
13
  versioned: true,
@@ -18,17 +19,25 @@ exports.DEFAULT_PRODEX_CONFIG = {
18
19
  ui: {
19
20
  roots: ["app", "routes", "resources/js/**"],
20
21
  scanDepth: 2,
21
- priority: ["**/routes/web.php", "**/routes/api.php", "**/*index.*", "**/*main.*", "**/app.*"],
22
+ priority: ["**/routes/web.php", "**/app.*"],
22
23
  },
23
24
  },
24
25
  resolve: {
25
- include: ["**/*.d.ts", "**/*.interface.ts"],
26
+ include: ["**/*.d.ts"],
26
27
  aliases: {
27
- "@hooks": "resources/js/hooks",
28
- "@data": "resources/js/data",
28
+ "@": "resources/js",
29
29
  },
30
30
  exclude: ["node_modules/**", "@shadcn/**", "**/components/ui/**"],
31
31
  depth: 10,
32
32
  limit: 200,
33
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
+ },
34
43
  };
@@ -50,6 +50,12 @@ exports.FLAG_MAP = {
50
50
  description: "Enable debug logs.",
51
51
  apply: () => { },
52
52
  },
53
+ shortcut: {
54
+ short: "a",
55
+ type: "string",
56
+ description: "Apply a config shortcut by name.",
57
+ apply: () => { },
58
+ },
53
59
  help: {
54
60
  short: "h",
55
61
  type: "boolean",
@@ -15,12 +15,15 @@ const store_1 = require("../../store");
15
15
  * Unified loader, merger, and flag applier.
16
16
  */
17
17
  class ConfigManager {
18
+ static rawFile = null;
18
19
  static load(cwd) {
19
20
  const file = path_1.default.join(cwd, "prodex.json");
20
21
  if (!fs_1.default.existsSync(file))
21
22
  return default_config_1.DEFAULT_PRODEX_CONFIG;
22
23
  try {
23
- return JSON.parse(fs_1.default.readFileSync(file, "utf8"));
24
+ const parsed = JSON.parse(fs_1.default.readFileSync(file, "utf8"));
25
+ this.rawFile = parsed; // <-- SAVE RAW COPY
26
+ return parsed;
24
27
  }
25
28
  catch {
26
29
  console.warn("⚠️ Invalid prodex.json β€” using defaults.");
@@ -29,7 +32,7 @@ class ConfigManager {
29
32
  }
30
33
  static merge(user, flags, cwd = process.cwd()) {
31
34
  const merged = {
32
- ...default_config_1.DEFAULT_PRODEX_CONFIG,
35
+ // ...rest,
33
36
  ...user,
34
37
  output: { ...default_config_1.DEFAULT_PRODEX_CONFIG.output, ...user.output },
35
38
  entry: {
@@ -57,6 +60,34 @@ class ConfigManager {
57
60
  const hasFiles = Array.isArray(flags.files) ? flags.files.length > 0 : !!flags.files;
58
61
  if (hasFiles && !flags.include)
59
62
  cfg.resolve.include = [];
63
+ if (flags.shortcut && cfg.shortcuts && cfg.shortcuts[flags.shortcut])
64
+ return this.applyShortcuts(cfg, flags);
65
+ return cfg;
66
+ }
67
+ static applyShortcuts(cfg, flags) {
68
+ const shortcut = cfg.shortcuts?.[flags.shortcut];
69
+ if (!shortcut)
70
+ return cfg;
71
+ const mergeOrReplace = (key, target) => {
72
+ const flagValues = (flags[key] || []);
73
+ const hasFlags = !(0, utils_1.ArrisEmpty)(flagValues);
74
+ let values = shortcut[key];
75
+ if (!values && !hasFlags) {
76
+ target[key] = [];
77
+ return;
78
+ }
79
+ if (!values)
80
+ values = [];
81
+ target[key] = hasFlags ? [...flagValues, ...values] : values;
82
+ };
83
+ // include / exclude live in cfg.resolve
84
+ mergeOrReplace("include", cfg.resolve);
85
+ mergeOrReplace("exclude", cfg.resolve);
86
+ // files live in cfg.entry
87
+ mergeOrReplace("files", cfg.entry);
88
+ // name override
89
+ if (shortcut.prefix)
90
+ cfg.name = shortcut.prefix;
60
91
  return cfg;
61
92
  }
62
93
  static normalize(cfg) {
@@ -69,11 +100,14 @@ class ConfigManager {
69
100
  static persist(partial) {
70
101
  const cfg = (0, store_1.getConfig)();
71
102
  const dest = path_1.default.join(cfg.root, "prodex.json");
72
- const { root, name, ...pure } = cfg;
73
- const merged = deepMerge(pure, partial);
103
+ // Start from the raw config, never the merged runtime version
104
+ const base = ConfigManager.rawFile
105
+ ? JSON.parse(JSON.stringify(ConfigManager.rawFile)) // deep clone to avoid mutation
106
+ : {};
107
+ // Apply only the partial updates (aliases, etc.)
108
+ const patched = deepMerge(base, partial);
74
109
  try {
75
- fs_1.default.writeFileSync(dest, JSON.stringify(merged, null, 2) + "\n", "utf8");
76
- console.log(`βœ… Updated ${dest}`);
110
+ fs_1.default.writeFileSync(dest, (0, utils_1.toJson)(patched) + "\n", "utf8");
77
111
  }
78
112
  catch (err) {
79
113
  console.warn("⚠️ Failed to persist config:", err?.message || err);
package/dist/debug.js CHANGED
@@ -4,9 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const index_1 = __importDefault(require("./index"));
7
+ require("source-map-support/register");
7
8
  (async () => {
8
- const mockArgs = ["node", "prodex", "C:\\Users\\USER\\Herd\\fireshot", "-f", "**/(dashboard|accounts).tsx", "-cd"];
9
+ const mockArgs = ["node", "prodex", "@web", "-cd"];
9
10
  process.argv = mockArgs;
11
+ //"-f", "**/(dashboard|accounts).tsx",
10
12
  console.log("🧩 Debug runner starting...");
11
13
  await (0, index_1.default)();
12
14
  console.log("🧩 Debug runner done.");
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ async function startProdex(args = process.argv) {
47
47
  const config = config_1.ConfigManager.merge(userConfig, flags, root);
48
48
  (0, store_1.setGlobals)(config, flags);
49
49
  const opts = {
50
- showUi: !flags.ci && !flags?.files?.length && !config?.entry?.ui?.enablePicker,
50
+ showUi: !flags.ci && !flags?.files?.length && config?.entry?.ui?.enablePicker && !flags.shortcut,
51
51
  cliName: config.name,
52
52
  };
53
53
  await Promise.resolve().then(() => __importStar(require("./lib/polyfills")));
package/dist/lib/utils.js CHANGED
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shortTimestamp = shortTimestamp;
4
4
  exports.normalizePatterns = normalizePatterns;
5
+ exports.ArrisEmpty = ArrisEmpty;
6
+ exports.toJson = toJson;
5
7
  const config_1 = require("../constants/config");
6
8
  /** Compact YYMMDD-HHmm timestamp for versioned filenames. */
7
9
  function shortTimestamp() {
@@ -36,3 +38,9 @@ function normalizePatterns(input) {
36
38
  return valid;
37
39
  });
38
40
  }
41
+ function ArrisEmpty(arr) {
42
+ return !arr || Array.isArray(arr) && arr.length === 0;
43
+ }
44
+ function toJson(obj) {
45
+ return JSON.stringify(obj, null, 4);
46
+ }
@@ -36,8 +36,7 @@ async function resolveJsImports({ filePath, visited = new Set(), depth = 0, maxD
36
36
  if (!imports.size)
37
37
  return (0, collections_1.emptyResult)(visited);
38
38
  // Trackers ----------------------------------------------
39
- const expected = new Set();
40
- const resolved = new Set();
39
+ const stats = (0, collections_1.newStats)();
41
40
  const files = [];
42
41
  // Main resolution loop ----------------------------------
43
42
  for (const imp of imports) {
@@ -62,11 +61,17 @@ async function resolveJsImports({ filePath, visited = new Set(), depth = 0, maxD
62
61
  if (!base)
63
62
  continue;
64
63
  const absBase = path_1.default.resolve(base);
65
- expected.add(absBase);
64
+ // Exclusion check after alias resolution
65
+ if ((0, shared_1.isExcluded)(absBase, excludePatterns))
66
+ continue;
66
67
  const resolvedPath = await tryResolveImport(absBase);
68
+ // Exclusion check after final resolution
69
+ if ((0, shared_1.isExcluded)(resolvedPath, excludePatterns))
70
+ continue;
71
+ stats.expected.add(absBase);
67
72
  if (!resolvedPath)
68
73
  continue;
69
- resolved.add(absBase);
74
+ stats.resolved.add(absBase);
70
75
  files.push(resolvedPath);
71
76
  // Recursive traversal
72
77
  const sub = await resolveJsImports({
@@ -76,17 +81,14 @@ async function resolveJsImports({ filePath, visited = new Set(), depth = 0, maxD
76
81
  maxDepth: limitDepth,
77
82
  });
78
83
  files.push(...sub.files);
79
- for (const e of sub.stats.expected)
80
- expected.add(e);
81
- for (const r of sub.stats.resolved)
82
- resolved.add(r);
84
+ (0, collections_1.mergeStats)(stats, sub.stats);
83
85
  }
84
86
  const uniqueFiles = (0, collections_1.unique)(files);
85
- const diff = (0, shared_2.setDiff)(expected, resolved);
86
- logger_1.logger.debug(`πŸͺΆ [js-resolver] ${filePath} β†’ expected: ${expected.size}, resolved: ${resolved.size}`);
87
+ const diff = (0, shared_2.setDiff)(stats.expected, stats.resolved);
88
+ logger_1.logger.debug(`πŸͺΆ [js-resolver] ${filePath} β†’ expected: ${stats.expected.size}, resolved: ${stats.resolved.size}`);
87
89
  if (diff.size)
88
90
  logger_1.logger.debug([...diff], "πŸ”΄ THE diff");
89
- return { files: uniqueFiles, visited, stats: { expected, resolved } };
91
+ return { files: uniqueFiles, visited, stats };
90
92
  }
91
93
  // ---------------------------------------------------------
92
94
  // tryResolveImport (pure)
@@ -8,6 +8,7 @@ const path_1 = __importDefault(require("path"));
8
8
  const cache_1 = require("../../core/managers/cache");
9
9
  const constants_1 = require("../../constants");
10
10
  const helpers_1 = require("../../core/helpers");
11
+ const shared_1 = require("../../shared");
11
12
  /**
12
13
  * 🧩 resolveAliasPath()
13
14
  * Unifies alias lookup across config, cache, and fallback discovery.
@@ -39,19 +40,21 @@ async function resolveAliasPath(specifier, root, cfg) {
39
40
  const hasExt = /\.[a-z0-9]+$/i.test(stripped);
40
41
  const patterns = hasExt ? [`**/${stripped}`] : [`**/${stripped}.*`, `**/${stripped}/index.*`];
41
42
  const { files: matches } = await (0, helpers_1.globScan)(patterns, { cwd: root });
42
- if (matches.length === 1) {
43
- return resolveMatches(matches, remainder, aliasKey);
44
- }
45
- //There are multiple matches, Assuming they match the target approximate folder.
46
- if (matches.length > 1) {
47
- const resolvedMatch = resolveMatches(matches, remainder, aliasKey);
48
- return resolvedMatch.replace(/\.[^/.]+$/, "");
43
+ if (matches.length) {
44
+ const resolvedMatch = resolveMatches(matches, remainder);
45
+ // .replace(/\.[^/.]+$/, "")
46
+ if (!resolvedMatch)
47
+ return null;
48
+ const relPath = (0, shared_1.rel)(resolvedMatch, cfg.root);
49
+ cache_1.CacheManager.set(constants_1.CACHE_KEYS.ALIASES, aliasKey, relPath);
50
+ return relPath;
49
51
  }
50
52
  return null;
51
53
  }
52
- function resolveMatches(matches, remainder, aliasKey) {
53
- const foundFile = matches[0];
54
- const aliasRoot = foundFile.split(remainder)[0].replace(/\\/g, "/");
55
- cache_1.CacheManager.set(constants_1.CACHE_KEYS.ALIASES, aliasKey, aliasRoot);
56
- return foundFile;
54
+ function resolveMatches(matches, remainder) {
55
+ const foundFile = matches[0].norm();
56
+ const dSplit = foundFile.split(remainder);
57
+ if (dSplit.length < 2)
58
+ return "";
59
+ return dSplit[0].replace(/\\/g, "/");
57
60
  }
@@ -15,6 +15,7 @@ const store_1 = require("../../store");
15
15
  const constants_1 = require("../../constants");
16
16
  const cache_1 = require("../../core/managers/cache");
17
17
  const collections_1 = require("../../shared/collections");
18
+ const promises_1 = __importDefault(require("fs/promises")); // (add near the top if not present)
18
19
  /** Ensure we have a PHP resolver context for the current root */
19
20
  function buildPhpCtx(root, prev) {
20
21
  if (prev?.kind === "php")
@@ -53,7 +54,6 @@ async function resolvePhpImports({ filePath, visited = new Set(), depth = 0, max
53
54
  return (0, collections_1.emptyResult)(visited);
54
55
  // Context + exclusions
55
56
  const phpCtx = buildPhpCtx(ROOT, ctx);
56
- const isExcluded = (0, shared_1.makeExcludeMatcher)(excludePatterns);
57
57
  // Parse imports (expand grouped `use` syntax)
58
58
  const raw = (0, extract_imports_1.extractPhpImports)(code);
59
59
  const imports = (0, extract_imports_1.expandGroupedUses)(raw);
@@ -70,11 +70,14 @@ async function resolvePhpImports({ filePath, visited = new Set(), depth = 0, max
70
70
  // Only resolve PSR-4 mapped namespaces
71
71
  if (!startsWithAnyNamespace(imp, phpCtx.nsKeys))
72
72
  continue;
73
- if (isExcluded(imp))
73
+ if ((0, shared_1.isExcluded)(imp, excludePatterns))
74
74
  continue;
75
- stats.expected.add(imp);
76
75
  // Resolve namespace β†’ file path (sync helper retained)
77
76
  const resolvedPath = await tryResolvePhpFile(imp, filePath, phpCtx.psr4);
77
+ // Exclusion check after final resolution
78
+ if ((0, shared_1.isExcluded)(resolvedPath, excludePatterns))
79
+ continue;
80
+ stats.expected.add(imp);
78
81
  if (!resolvedPath)
79
82
  continue;
80
83
  stats.resolved.add(imp);
@@ -97,7 +100,6 @@ async function resolvePhpImports({ filePath, visited = new Set(), depth = 0, max
97
100
  logger_1.logger.debug("[php-resolver] unresolved:", [...unresolved]);
98
101
  return { files: out, visited, stats };
99
102
  }
100
- const promises_1 = __importDefault(require("fs/promises")); // (add near the top if not present)
101
103
  async function tryResolvePhpFile(imp, fromFile, psr4) {
102
104
  const key = `php:${imp}:${fromFile}`;
103
105
  const cached = cache_1.CacheManager.get(constants_1.CACHE_KEYS.PHP_FILECACHE, key);
@@ -11,9 +11,11 @@ const micromatch_1 = __importDefault(require("micromatch"));
11
11
  * Returns true if a given path matches any of the provided glob patterns.
12
12
  * Equivalent to core/helpers.isExcluded().
13
13
  */
14
- function isExcluded(p, patterns = [], root = process.cwd()) {
14
+ function isExcluded(p = "", patterns = [], root = process.cwd()) {
15
15
  if (!patterns?.length)
16
16
  return false;
17
+ if (!p)
18
+ return false;
17
19
  const relPath = p.replaceAll("\\", "/");
18
20
  return micromatch_1.default.isMatch(relPath, patterns);
19
21
  }
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "prodex",
3
- "version": "1.4.1",
3
+ "version": "1.4.5",
4
4
  "description": "Unified Project Indexer & Dependency Extractor for Laravel + React + Node stacks.",
5
5
  "type": "commonjs",
6
6
  "bin": {
7
7
  "prodex": "./bin/prodex.js"
8
8
  },
9
9
  "main": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
11
10
  "files": [
12
11
  "dist/",
13
12
  "bin/",
@@ -27,7 +26,8 @@
27
26
  "scripts": {
28
27
  "build": "tsc",
29
28
  "dev": "tsc --watch",
30
- "prepare": "npm run build",
29
+ "gen:schema": "node schema/generate.js",
30
+ "prepare": "npm run build && npm run gen:schema",
31
31
  "d:w": "nodemon --watch dist --delay 500ms --exec node --inspect-brk dist/debug.js"
32
32
  },
33
33
  "engines": {
@@ -38,6 +38,7 @@
38
38
  "devDependencies": {
39
39
  "@types/node": "^24.9.2",
40
40
  "nodemon": "^3.1.10",
41
+ "ts-json-schema-generator": "^2.4.0",
41
42
  "typescript": "^5.9.3"
42
43
  },
43
44
  "dependencies": {
@@ -45,6 +46,7 @@
45
46
  "fast-glob": "^3.3.3",
46
47
  "inquirer": "^12.10.0",
47
48
  "micromatch": "^4.0.8",
48
- "sade": "^1.8.1"
49
+ "sade": "^1.8.1",
50
+ "source-map-support": "^0.5.21"
49
51
  }
50
52
  }