prodex 1.4.1 → 1.4.4

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.
Files changed (86) hide show
  1. package/README.md +234 -234
  2. package/dist/cli/cli-input.js +8 -2
  3. package/dist/cli/cli-input.js.map +1 -0
  4. package/dist/cli/init.js +3 -1
  5. package/dist/cli/init.js.map +1 -0
  6. package/dist/cli/picker.js +1 -0
  7. package/dist/cli/picker.js.map +1 -0
  8. package/dist/cli/summary.js +1 -0
  9. package/dist/cli/summary.js.map +1 -0
  10. package/dist/constants/cache-keys.js +1 -0
  11. package/dist/constants/cache-keys.js.map +1 -0
  12. package/dist/constants/config.js +2 -1
  13. package/dist/constants/config.js.map +1 -0
  14. package/dist/constants/default-config.js +14 -4
  15. package/dist/constants/default-config.js.map +1 -0
  16. package/dist/constants/flags.js +7 -0
  17. package/dist/constants/flags.js.map +1 -0
  18. package/dist/constants/index.js +1 -0
  19. package/dist/constants/index.js.map +1 -0
  20. package/dist/constants/render-constants.js +1 -0
  21. package/dist/constants/render-constants.js.map +1 -0
  22. package/dist/core/combine.js +1 -0
  23. package/dist/core/combine.js.map +1 -0
  24. package/dist/core/dependency.js +1 -0
  25. package/dist/core/dependency.js.map +1 -0
  26. package/dist/core/helpers.js +1 -0
  27. package/dist/core/helpers.js.map +1 -0
  28. package/dist/core/managers/cache.js +1 -0
  29. package/dist/core/managers/cache.js.map +1 -0
  30. package/dist/core/managers/config.js +39 -6
  31. package/dist/core/managers/config.js.map +1 -0
  32. package/dist/core/output.js +1 -0
  33. package/dist/core/output.js.map +1 -0
  34. package/dist/core/renderers.js +1 -0
  35. package/dist/core/renderers.js.map +1 -0
  36. package/dist/debug.js +3 -1
  37. package/dist/debug.js.map +1 -0
  38. package/dist/index.js +2 -1
  39. package/dist/index.js.map +1 -0
  40. package/dist/lib/logger.js +1 -0
  41. package/dist/lib/logger.js.map +1 -0
  42. package/dist/lib/polyfills.js +1 -0
  43. package/dist/lib/polyfills.js.map +1 -0
  44. package/dist/lib/prompt.js +1 -0
  45. package/dist/lib/prompt.js.map +1 -0
  46. package/dist/lib/questions.js +1 -0
  47. package/dist/lib/questions.js.map +1 -0
  48. package/dist/lib/utils.js +9 -0
  49. package/dist/lib/utils.js.map +1 -0
  50. package/dist/resolvers/js/extract-imports.js +1 -0
  51. package/dist/resolvers/js/extract-imports.js.map +1 -0
  52. package/dist/resolvers/js/js-resolver.js +14 -11
  53. package/dist/resolvers/js/js-resolver.js.map +1 -0
  54. package/dist/resolvers/js/resolve-alias.js +16 -12
  55. package/dist/resolvers/js/resolve-alias.js.map +1 -0
  56. package/dist/resolvers/php/bindings.js +1 -0
  57. package/dist/resolvers/php/bindings.js.map +1 -0
  58. package/dist/resolvers/php/extract-imports.js +1 -0
  59. package/dist/resolvers/php/extract-imports.js.map +1 -0
  60. package/dist/resolvers/php/php-resolver.js +7 -4
  61. package/dist/resolvers/php/php-resolver.js.map +1 -0
  62. package/dist/resolvers/php/psr4.js +1 -0
  63. package/dist/resolvers/php/psr4.js.map +1 -0
  64. package/dist/shared/collections.js +1 -0
  65. package/dist/shared/collections.js.map +1 -0
  66. package/dist/shared/index.js +1 -0
  67. package/dist/shared/index.js.map +1 -0
  68. package/dist/shared/io.js +1 -0
  69. package/dist/shared/io.js.map +1 -0
  70. package/dist/shared/patterns.js +4 -1
  71. package/dist/shared/patterns.js.map +1 -0
  72. package/dist/store.js +1 -0
  73. package/dist/store.js.map +1 -0
  74. package/dist/types/cli.types.js +1 -0
  75. package/dist/types/cli.types.js.map +1 -0
  76. package/dist/types/config.types.js +1 -0
  77. package/dist/types/config.types.js.map +1 -0
  78. package/dist/types/core.types.js +1 -0
  79. package/dist/types/core.types.js.map +1 -0
  80. package/dist/types/index.js +1 -0
  81. package/dist/types/index.js.map +1 -0
  82. package/dist/types/resolver.types.js +1 -0
  83. package/dist/types/resolver.types.js.map +1 -0
  84. package/dist/types/utils.types.js +1 -0
  85. package/dist/types/utils.types.js.map +1 -0
  86. package/package.json +6 -4
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
  });
@@ -98,3 +103,4 @@ function validateArgs(parsed, warnings, errors) {
98
103
  process.exit(1);
99
104
  }
100
105
  }
106
+ //# sourceMappingURL=cli-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-input.js","sourceRoot":"","sources":["../../src/cli/cli-input.ts"],"names":[],"mappings":";;;;;AAWA,sCAkCC;AA7CD,gDAAwB;AACxB,gDAAwB;AACxB,sEAAqC;AACrC,4CAAoB;AACpB,8CAA8C;AAG9C;;;GAGG;AACH,SAAgB,aAAa,CAAC,OAAiB,OAAO,CAAC,IAAI;IAC1D,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,WAAW,sBAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,cAAI,EAAC,eAAe,CAAC,CAAC;IACtC,aAAa,CAAC,OAAO,CAAC,CAAC;IAEvB,IAAI,MAAM,GAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAEtE,OAAO,CAAC,MAAM,CAAC,CAAC,IAAwB,EAAE,IAAyB,EAAE,EAAE;QACtE,IAAI,KAAK,GAAE,IAAI,CAAC;QAChB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,IAAG,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EAAC,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,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,CAAC;QACb,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,IAAI,CAAC,2BAA2B,OAAO,mBAAmB,CAAC,CAAC;QACpE,CAAC;aAAM,IAAI,CAAC,YAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACpD,MAAM,CAAC,IAAI,CAAC,kBAAkB,OAAO,uBAAuB,CAAC,CAAC;QAC/D,CAAC;IACF,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;IACtC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,oCAAoC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAC9F,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM;QAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACzD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,KAAK,MAAM,GAAG,IAAI,MAAM;YAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACF,CAAC","sourcesContent":["import sade from \"sade\";\nimport path from \"path\";\nimport pkg from \"../../package.json\";\nimport fs from \"fs\";\nimport { FLAG_MAP } from \"../constants/flags\";\nimport type { ParsedInput } from \"../types\";\n\n/**\n * Unified CLI parser powered by Sade and FLAG_MAP.\n * Returns { root, flags, warnings, errors }.\n */\nexport function parseCliInput(argv: string[] = process.argv) {\n\tif (argv.includes(\"-v\") || argv.includes(\"--version\")) {\n\t\tconsole.log(`prodex v${pkg.version}`);\n\t\tprocess.exit(0);\n\t}\n\n\tconst program = sade(\"prodex [root]\");\n\tregisterFlags(program);\n\n\tlet parsed: ParsedInput = { rootArg: \"\", root: undefined, flags: {} };\n\n\tprogram.action((root: string | undefined, opts: Record<string, any>) => {\n\t\tlet lroot= root;\n\t\tconst cwd = process.cwd();\n\t\tif(root?.startsWith(\"@\")){\n\t\t\topts.shortcut= root.slice(1).trim();\n\t\t\tlroot= undefined;\n\t\t}\n\t\tparsed = {\n\t\t\trootArg: lroot,\n\t\t\troot: lroot ? path.resolve(cwd, lroot) : cwd,\n\t\t\tflags: { ...opts },\n\t\t};\n\t});\n\n\tprogram.parse(argv);\n\n\tconst warnings: string[] = [];\n\tconst errors: string[] = [];\n\n\tparsed.flags = normalizeFlags(parsed.flags, warnings, errors);\n\tvalidateArgs(parsed, warnings, errors);\n\n\treturn { ...parsed, warnings, errors };\n}\n\nfunction registerFlags(program: ReturnType<typeof sade>) {\n\tfor (const [key, meta] of Object.entries(FLAG_MAP)) {\n\t\tconst short = meta.short ? `-${meta.short}, ` : \"\";\n\t\tconst long = `--${key}`;\n\t\tconst desc = meta.description;\n\t\tconst defaultVal = meta.type === \"boolean\" ? false : undefined;\n\t\tprogram.option(`${short}${long}`, desc, defaultVal);\n\t}\n}\n\n/** Convert flag values to correct types based on FLAG_MAP metadata. */\nfunction normalizeFlags(flags: Record<string, any>, warnings: string[], errors: string[]) {\n\tfor (const [key, meta] of Object.entries(FLAG_MAP)) {\n\t\tconst raw = flags[key];\n\t\tif (raw === undefined) continue;\n\n\t\tswitch (meta.type) {\n\t\t\tcase \"number\": {\n\t\t\t\tconst num = Number(raw);\n\t\t\t\tif (Number.isNaN(num)) errors.push(`Flag --${key} expected a number but got \"${raw}\"`);\n\t\t\t\telse flags[key] = num;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"list\": {\n\t\t\t\tflags[key] = String(raw)\n\t\t\t\t\t.split(\",\")\n\t\t\t\t\t.map((v) => v.trim())\n\t\t\t\t\t.filter(Boolean);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tif (meta.type === \"string\") flags[key] = String(raw);\n\t\t\t}\n\t\t}\n\t}\n\treturn flags;\n}\n\n/** Validate path argument and report unrecognized flags. */\nfunction validateArgs(parsed: ParsedInput, warnings: string[], errors: string[]) {\n\tconst { rootArg } = parsed;\n\n\tif (rootArg) {\n\t\tif (!fs.existsSync(parsed.root)) {\n\t\t\terrors.push(`Invalid path argument: \"${rootArg}\" does not exist.`);\n\t\t} else if (!fs.statSync(parsed.root).isDirectory()) {\n\t\t\terrors.push(`Path argument \"${rootArg}\" is not a directory.`);\n\t\t}\n\t}\n\n\tconst unknown = parsed.flags?._ || [];\n\tif (unknown.length) {\n\t\twarnings.push(`Unrecognized arguments detected [${unknown.join(\", \")}]- They were ignored.`);\n\t}\n\n\tif (warnings.length) console.warn(\"Warnings:\", warnings);\n\tif (errors.length) {\n\t\tfor (const err of errors) console.error(err);\n\t\tprocess.exit(1);\n\t}\n}\n"]}
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,8 @@ 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
  }
22
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":";;;;;AAKA,gCAaC;AAlBD,4CAAoB;AACpB,gDAAwB;AACxB,gEAAoE;AACpE,wCAAsC;AAE/B,KAAK,UAAU,UAAU;IAC/B,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;IAEzD,MAAM,IAAI,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;IAErD,IAAI,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;QAC7E,OAAO;IACR,CAAC;IAED,YAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAA,cAAM,EAAC,sCAAqB,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { DEFAULT_PRODEX_CONFIG } from \"../constants/default-config\";\nimport { toJson } from \"../lib/utils\";\n\nexport async function initProdex() {\n\tconsole.log(\"🪄 Prodex Init — Configuration Wizard (v3\");\n\n\tconst dest = path.join(process.cwd(), \"prodex.json\");\n\n\tif (fs.existsSync(dest)) {\n\t\tconsole.error(\"prodex.json already exists. Delete or modify it manually.\\n\");\n\t\treturn;\n\t}\n\n\tfs.writeFileSync(dest, toJson(DEFAULT_PRODEX_CONFIG) + \"\\n\", \"utf8\");\n\tconsole.log(`✅ Created ${dest}`);\n\tconsole.log(\"💡 Globs supported everywhere (include, exclude, priority).\");\n}\n"]}
@@ -81,3 +81,4 @@ async function getFilesAtDepth(depth, cfg, scanCache) {
81
81
  logger_1.logger.debug(`[picker] depth=${depth} found=${files.length}`);
82
82
  return files;
83
83
  }
84
+ //# sourceMappingURL=picker.js.map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AG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;IAC1C,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,eAAM,CAAC,KAAK,CAAC,8BAA8B,KAAK,EAAE,CAAC,CAAC;QACpD,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;IAC9B,CAAC;IAED,eAAM,CAAC,KAAK,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;IAEnD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,YAAY,GAAG,EAAE,GAAG,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAElD,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,SAAS;QACnC,KAAK,MAAM,CAAC,IAAI,IAAA,cAAI,EAAC,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC5B,eAAM,CAAC,KAAK,CAAC,kBAAkB,KAAK,UAAU,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport inquirer from \"inquirer\";\nimport { walk, orderByPriority } from \"../core/helpers\";\nimport { rel } from \"../shared/io\";\nimport { globScan } from \"../core/helpers\";\nimport { unique } from \"../shared/collections\";\nimport { logger } from \"../lib/logger\";\nimport { prompt } from \"../lib/prompt\";\nimport type { QuestionSet, ProdexConfig } from \"../types\";\nimport { PICK_ENTRIES_QUESTION } from \"../lib/questions\";\n\n/**\n * Interactive entry picker for Prodex.\n * Handles depth-based scanning, caching, and priority ordering.\n */\nexport async function pickEntries(cfg: ProdexConfig) {\n\tconst {\n\t\troot,\n\t\tentry: {\n\t\t\tfiles,\n\t\t\tui: { roots = [], priority = [], scanDepth },\n\t\t},\n\t} = cfg;\n\n\tlet depth = scanDepth;\n\tconst entryPatterns = files || [];\n\tconst priorities = [...entryPatterns, ...priority];\n\n\t// 1️⃣ Resolve pre-defined entry patterns\n\tconst resolvedEntries = (await globScan(entryPatterns, { cwd: root })).files;\n\tlet selected = [...resolvedEntries];\n\n\t// cache: depth → files[]\n\tconst scanCache = new Map<number, string[]>();\n\n\tfor (;;) {\n\t\tconst files = await getFilesAtDepth(depth, cfg, scanCache);\n\n\t\t// Merge resolved entries with current scan results\n\t\tconst combined = unique([...resolvedEntries, ...files]);\n\t\tconst sorted = orderByPriority(combined, priorities);\n\n\t\t// Build UI selection list\n\t\tconst choices = sorted.map((f) => ({\n\t\t\tname: rel(f, root),\n\t\t\tvalue: f,\n\t\t\tchecked: selected.includes(f),\n\t\t}));\n\n\t\tif (depth < scanDepth + 5) {\n\t\t\tchoices.push(new inquirer.Separator());\n\t\t\tchoices.push({ name: \"🔽 Load more (go deeper)\", value: \"__loadmore\" });\n\t\t}\n\n\t\t// 🧠 Use unified prompt wrapper\n\t\tconst answers = await prompt(PICK_ENTRIES_QUESTION(choices, depth), { picks: [] });\n\t\tif (!answers) return unique(selected);\n\n\t\tconst { picks } = answers;\n\n\t\tif (picks.includes(\"__loadmore\")) {\n\t\t\tdepth++;\n\t\t\tselected = picks.filter((p) => p !== \"__loadmore\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tselected = picks.filter((p) => p !== \"__loadmore\");\n\t\tbreak;\n\t}\n\n\treturn unique(selected);\n}\n\n/**\n * Depth-based directory scanner with caching.\n */\nasync function getFilesAtDepth(depth: number, cfg: ProdexConfig, scanCache: Map<number, string[]>) {\n\tconst baseDirs = cfg.entry.ui.roots || [];\n\tif (scanCache.has(depth)) {\n\t\tlogger.debug(`[picker] cache hit → depth=${depth}`);\n\t\treturn scanCache.get(depth)!;\n\t}\n\n\tlogger.debug(`[picker] scanning → depth=${depth}`);\n\n\tconst files: string[] = [];\n\tconst effectiveCfg = { ...cfg, scanDepth: depth };\n\n\tfor (const base of baseDirs) {\n\t\tconst full = path.join(cfg.root, base);\n\t\tif (!fs.existsSync(full)) continue;\n\t\tfor (const f of walk(full, effectiveCfg, 0)) files.push(f.norm());\n\t}\n\n\tscanCache.set(depth, files);\n\tlogger.debug(`[picker] depth=${depth} found=${files.length}`);\n\treturn files;\n}\n"]}
@@ -30,3 +30,4 @@ function entrySummary(entries) {
30
30
  if (entries?.length)
31
31
  logger_1.logger.log(result);
32
32
  }
33
+ //# sourceMappingURL=summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/cli/summary.ts"],"names":[],"mappings":";;AAMA,gCAMC;AAED,oCAQC;AAED,oCAIC;AA5BD,0CAAuC;AACvC,qCAAmC;AACnC,oCAA+C;AAE/C,IAAI,MAAM,CAAC;AACX,IAAI,KAAK,CAAC;AACV,SAAgB,UAAU,CAAC,GAAG,EAAE,MAAM;IACrC,eAAM,CAAC,KAAK,CAAC;8BACgB,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI;8BAC5B,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI;CACzD,CAAC,CAAC;IACF,eAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC;AAED,SAAgB,YAAY;IAC3B,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IACrB,KAAK,GAAG,IAAA,gBAAQ,GAAE,CAAC;IAEnB,eAAM,CAAC,GAAG,CAAC,wBAAwB,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,+BAA+B,CAAC,CAAC;IACnG,gCAAgC;IAChC,eAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACrD,eAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,SAAgB,YAAY,CAAC,OAAiB;IAC7C,IAAI,MAAM,GAAG,kBAAkB,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,OAAO;QAAE,MAAM,IAAI,QAAQ,GAAG,IAAA,QAAG,EAAC,CAAC,CAAC,CAAC;IACrD,IAAI,OAAO,EAAE,MAAM;QAAE,eAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { logger } from \"../lib/logger\";\nimport { rel } from \"../shared/io\";\nimport { getConfig, getFlags } from \"../store\";\n\nlet CONFIG;\nlet FLAGS;\nexport function endSummary(out, result) {\n\tlogger.debug(`🧩 Summary:\n • Unique imports expected: ${result?.stats?.expected.size}\n • Unique imports resolved: ${result?.stats?.resolved.size}\n`);\n\tlogger.log(`✅ ${out.norm()}`);\n}\n\nexport function introSummary() {\n\tCONFIG = getConfig();\n\tFLAGS = getFlags();\n\n\tlogger.log(`------- PRODEx RUN @ ${new Date().toLocaleTimeString()} — Codebase decoded -------\\n`);\n\t// Log parse results for testing\n\tlogger.debug(\"🧩 Parsed CLI input:\", _2j({ FLAGS }));\n\tlogger.debug(\"Final merged config:\", _2j(CONFIG));\n}\n\nexport function entrySummary(entries: string[]) {\n\tlet result = \"📋 You selected:\";\n\tfor (const e of entries) result += \"\\n -\" + rel(e);\n\tif (entries?.length) logger.log(result);\n}\n"]}
@@ -9,3 +9,4 @@ exports.CACHE_KEYS = {
9
9
  PHP_BINDINGS: "php:bindings",
10
10
  PHP_FILECACHE: "php:fileCache",
11
11
  };
12
+ //# sourceMappingURL=cache-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-keys.js","sourceRoot":"","sources":["../../src/constants/cache-keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACzB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;CACrB,CAAC","sourcesContent":["export const CACHE_KEYS = {\r\n\tALIASES: \"aliases\",\r\n\tJS_IMPORTS: \"js:imports\",\r\n\tJS_STATS: \"js:stats\",\r\n\tPHP_PSR4: \"php:psr4\",\r\n\tPHP_BINDINGS: \"php:bindings\",\r\n\tPHP_FILECACHE: \"php:fileCache\",\r\n} as const;\r\n\r\nexport type CacheNamespace = (typeof CACHE_KEYS)[keyof typeof CACHE_KEYS];\r\n"]}
@@ -24,4 +24,5 @@ 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\-@./*?|!{}\[\]^$()+]+$/;
28
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/constants/config.ts"],"names":[],"mappings":";;;AAAA,6DAA+D;AAC/D,gEAAkE;AAErD,QAAA,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC5D,QAAA,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACnD,QAAA,SAAS,GAAG,IAAI,GAAG,CAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9F,QAAA,OAAO,GAAG,OAAO,CAAC;AAElB,QAAA,SAAS,GAAG;IACxB,MAAM,EAAE,gCAAiB;IACzB,KAAK,EAAE,8BAAgB;IACvB,MAAM,EAAE,8BAAgB;IACxB,OAAO,EAAE,8BAAgB;IACzB,KAAK,EAAE,8BAAgB;CACvB,CAAC;AAEW,QAAA,aAAa,GAAG,CAAC,oBAAoB,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AAErE,QAAA,MAAM,GAAG,OAAO,CAAC;AAE9B;;;;;;;GAOG;AACU,QAAA,gBAAgB,GAAG,6BAA6B,CAAC","sourcesContent":["import { resolveJsImports } from \"../resolvers/js/js-resolver\";\nimport { resolvePhpImports } from \"../resolvers/php/php-resolver\";\n\nexport const CODE_EXTS = [\".js\", \".mjs\", \".ts\", \".tsx\", \".d.ts\", \".php\"];\nexport const BASE_EXTS = [\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\"];\nexport const REAL_EXTS = new Set<string>([\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\", \".d.ts\", \".json\"]);\nexport const DTS_EXT = \".d.ts\";\n\nexport const RESOLVERS = {\n\t\".php\": resolvePhpImports,\n\t\".ts\": resolveJsImports,\n\t\".tsx\": resolveJsImports,\n\t\".d.ts\": resolveJsImports,\n\t\".js\": resolveJsImports,\n};\n\nexport const GLOBAL_IGNORE = [\"**/node_modules/**\", \"**/vendor/**\", \"**/dist/**\"];\n\nexport const SUFFIX = \"trace\";\n\n/**\n * Normalize and sanitize pattern fields.\n * - Always returns an array.\n * - Accepts string or string[].\n * - Splits comma-separated strings.\n * - Trims and removes empty elements.\n * - Filters out invalid or unusable characters for Fast-Glob.\n */\nexport const VALID_GLOB_CHARS = /^[\\w\\-@./*?|!{}\\[\\]^$()+]+$/;\n"]}
@@ -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,26 @@ 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
  };
44
+ //# sourceMappingURL=default-config.js.map