prodex 1.4.11 → 2.0.1

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 (142) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +240 -234
  3. package/bin/prodex.js +0 -0
  4. package/dist/app/execute-run.d.ts +2 -0
  5. package/dist/app/execute-run.js +74 -0
  6. package/dist/app/project-context.d.ts +12 -0
  7. package/dist/app/project-context.js +48 -0
  8. package/dist/app/run-plans.d.ts +11 -0
  9. package/dist/app/run-plans.js +61 -0
  10. package/dist/cache/cache-keys.d.ts +9 -0
  11. package/dist/cache/cache-manager.d.ts +9 -0
  12. package/dist/{core/managers/cache.js → cache/cache-manager.js} +5 -18
  13. package/dist/cli/cli-input.d.ts +2 -0
  14. package/dist/cli/cli-input.js +138 -124
  15. package/dist/cli/flag-specs.d.ts +12 -0
  16. package/dist/cli/flag-specs.js +28 -0
  17. package/dist/cli/help.d.ts +2 -0
  18. package/dist/cli/help.js +83 -0
  19. package/dist/cli/report-command.d.ts +2 -0
  20. package/dist/cli/report-command.js +101 -0
  21. package/dist/cli/reporter.d.ts +2 -0
  22. package/dist/cli/reporter.js +8 -0
  23. package/dist/commands/init-command.d.ts +1 -0
  24. package/dist/commands/init-command.js +9 -0
  25. package/dist/commands/migrate-command.d.ts +7 -0
  26. package/dist/commands/migrate-command.js +76 -0
  27. package/dist/commands/profiles-command.d.ts +6 -0
  28. package/dist/commands/profiles-command.js +16 -0
  29. package/dist/commands/run-command.d.ts +11 -0
  30. package/dist/commands/run-command.js +17 -0
  31. package/dist/config/build-config.d.ts +13 -0
  32. package/dist/config/build-config.js +127 -0
  33. package/dist/config/create-default-config.d.ts +9 -0
  34. package/dist/config/create-default-config.js +25 -0
  35. package/dist/config/default-config.d.ts +2 -0
  36. package/dist/config/default-config.js +23 -0
  37. package/dist/config/json.d.ts +2 -0
  38. package/dist/config/json.js +10 -0
  39. package/dist/config/load.d.ts +9 -0
  40. package/dist/config/load.js +48 -0
  41. package/dist/config/migration/detect.d.ts +4 -0
  42. package/dist/config/migration/detect.js +22 -0
  43. package/dist/config/migration/index.d.ts +4 -0
  44. package/dist/{shared → config/migration}/index.js +4 -3
  45. package/dist/config/migration/messages.d.ts +2 -0
  46. package/dist/config/migration/messages.js +35 -0
  47. package/dist/config/migration/transform.d.ts +2 -0
  48. package/dist/config/migration/transform.js +80 -0
  49. package/dist/config/migration/types.d.ts +16 -0
  50. package/dist/config/string-list.d.ts +2 -0
  51. package/dist/config/string-list.js +17 -0
  52. package/dist/diagnostics/logger.d.ts +3 -0
  53. package/dist/diagnostics/logger.js +33 -0
  54. package/dist/filesystem/glob-scan.d.ts +4 -0
  55. package/dist/filesystem/glob-scan.js +26 -0
  56. package/dist/filesystem/inspect.d.ts +1 -0
  57. package/dist/filesystem/inspect.js +15 -0
  58. package/dist/filesystem/path.d.ts +2 -0
  59. package/dist/filesystem/path.js +11 -0
  60. package/dist/filesystem/read-file.d.ts +8 -0
  61. package/dist/{shared/io.js → filesystem/read-file.js} +0 -25
  62. package/dist/filesystem/stat-cache.d.ts +1 -0
  63. package/dist/filesystem/stat-cache.js +22 -0
  64. package/dist/index.d.ts +3 -0
  65. package/dist/index.js +76 -83
  66. package/dist/output/markdown.d.ts +12 -0
  67. package/dist/output/markdown.js +150 -0
  68. package/dist/output/naming.d.ts +2 -0
  69. package/dist/output/naming.js +30 -0
  70. package/dist/output/produce-output.d.ts +2 -0
  71. package/dist/output/produce-output.js +35 -0
  72. package/dist/output/render-constants.d.ts +21 -0
  73. package/dist/{constants → output}/render-constants.js +2 -1
  74. package/dist/output/text.d.ts +2 -0
  75. package/dist/output/text.js +14 -0
  76. package/dist/resolvers/js/extract-imports.d.ts +1 -0
  77. package/dist/resolvers/js/js-resolver.d.ts +2 -0
  78. package/dist/resolvers/js/js-resolver.js +45 -89
  79. package/dist/resolvers/js/resolve-alias.d.ts +2 -0
  80. package/dist/resolvers/js/resolve-alias.js +12 -20
  81. package/dist/resolvers/php/bindings.d.ts +8 -0
  82. package/dist/resolvers/php/bindings.js +8 -9
  83. package/dist/resolvers/php/extract-imports.d.ts +13 -0
  84. package/dist/resolvers/php/extract-imports.js +1 -1
  85. package/dist/resolvers/php/php-resolver.d.ts +2 -0
  86. package/dist/resolvers/php/php-resolver.js +61 -90
  87. package/dist/resolvers/php/psr4.d.ts +5 -0
  88. package/dist/resolvers/php/psr4.js +7 -7
  89. package/dist/resolvers/resolver-constants.d.ts +4 -0
  90. package/dist/resolvers/resolver-constants.js +7 -0
  91. package/dist/resolvers/resolver-result.d.ts +5 -0
  92. package/dist/resolvers/resolver-result.js +18 -0
  93. package/dist/tracing/exclude.d.ts +6 -0
  94. package/dist/{shared/patterns.js → tracing/exclude.js} +4 -4
  95. package/dist/tracing/follow-chain.d.ts +5 -0
  96. package/dist/tracing/follow-chain.js +63 -0
  97. package/dist/tracing/include-files.d.ts +2 -0
  98. package/dist/tracing/include-files.js +36 -0
  99. package/dist/tracing/resolver-registry.d.ts +5 -0
  100. package/dist/tracing/resolver-registry.js +20 -0
  101. package/dist/tracing/trace-run.d.ts +2 -0
  102. package/dist/tracing/trace-run.js +21 -0
  103. package/dist/tracing/trace-stats.d.ts +4 -0
  104. package/dist/tracing/trace-stats.js +16 -0
  105. package/dist/types/app.types.d.ts +62 -0
  106. package/dist/types/app.types.js +2 -0
  107. package/dist/types/cli.types.d.ts +22 -0
  108. package/dist/types/cli.types.js +0 -10
  109. package/dist/types/config.types.d.ts +34 -0
  110. package/dist/types/index.d.ts +7 -0
  111. package/dist/types/index.js +3 -1
  112. package/dist/types/output.types.d.ts +6 -0
  113. package/dist/types/output.types.js +2 -0
  114. package/dist/types/resolver.types.d.ts +23 -0
  115. package/dist/types/tracing.types.d.ts +23 -0
  116. package/dist/types/tracing.types.js +2 -0
  117. package/dist/types/utils.types.d.ts +10 -0
  118. package/package.json +35 -12
  119. package/schema/prodex.schema.json +122 -0
  120. package/dist/cli/init.js +0 -21
  121. package/dist/cli/picker.js +0 -83
  122. package/dist/cli/summary.js +0 -32
  123. package/dist/constants/config.js +0 -27
  124. package/dist/constants/default-config.js +0 -43
  125. package/dist/constants/flags.js +0 -79
  126. package/dist/constants/index.js +0 -20
  127. package/dist/core/combine.js +0 -56
  128. package/dist/core/dependency.js +0 -98
  129. package/dist/core/helpers.js +0 -85
  130. package/dist/core/managers/config.js +0 -140
  131. package/dist/core/output.js +0 -49
  132. package/dist/core/renderers.js +0 -210
  133. package/dist/debug.js +0 -15
  134. package/dist/lib/logger.js +0 -42
  135. package/dist/lib/polyfills.js +0 -17
  136. package/dist/lib/prompt.js +0 -34
  137. package/dist/lib/questions.js +0 -28
  138. package/dist/lib/utils.js +0 -46
  139. package/dist/shared/collections.js +0 -33
  140. package/dist/store.js +0 -15
  141. /package/dist/{constants → cache}/cache-keys.js +0 -0
  142. /package/dist/{types/core.types.js → config/migration/types.js} +0 -0
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Zeki
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Zeki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,234 +1,240 @@
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
2
+
3
+ Focused code-context extraction for large, multi-file projects.
4
+
5
+ Prodex starts from real project entrypoints, follows supported dependencies, adds explicitly included files, and exports a clean Markdown trace. It helps you isolate the files that matter for a feature, review, debug session, documentation pass, handoff, or AI-assisted workflow without manually collecting every related file.
6
+
7
+ Prodex is intentionally narrow: it creates readable, reproducible context bundles. It is not trying to be a full IDE indexer, static analysis platform, architecture rule engine, or graph visualizer.
8
+
9
+ ## Why Prodex
10
+
11
+ Large projects make context gathering expensive. A feature can start in one route or component, then spread through shared utilities, types, controllers, services, bindings, and framework conventions. Copying those files by hand is slow, inconsistent, and easy to get wrong.
12
+
13
+ Prodex gives that workflow a repeatable shape:
14
+
15
+ 1. Choose one or more entry files or globs.
16
+ 2. Trace the dependencies Prodex can resolve.
17
+ 3. Add any extra files you explicitly include.
18
+ 4. Exclude noisy paths such as generated output, vendor code, or UI primitives.
19
+ 5. Export a Markdown bundle with an index and file sections.
20
+
21
+ The result is a focused project trace you can read, share, review, archive, or hand to another tool.
22
+
23
+ ## How It Works
24
+
25
+ ```bash
26
+ prodex run --entry src/index.ts
27
+ ```
28
+
29
+ Prodex resolves the requested entrypoints from your project root, follows supported dependency references, applies include and exclude rules, then writes a versioned Markdown file to `./prodex/` by default.
30
+
31
+ For example:
32
+
33
+ ```bash
34
+ prodex run --entry resources/js/pages/Dashboard.tsx --include "routes/**/*.php"
35
+ ```
36
+
37
+ This traces the dashboard entrypoint and adds the matching route files to the exported context.
38
+
39
+ ## Profiles
40
+
41
+ Profiles are reusable named context maps stored in `prodex.json`.
42
+
43
+ They are one of Prodex's most useful workflow features: instead of rebuilding the same trace commands every time, teams can save important project areas as named profiles such as `dashboard`, `auth`, `billing`, `api`, `admin`, or `checkout`.
44
+
45
+ ```bash
46
+ prodex run --profile dashboard
47
+ prodex run --profile auth,billing
48
+ prodex run --all
49
+ prodex profiles
50
+ ```
51
+
52
+ Use profiles when a project has recurring review surfaces or ownership areas. A profile can define its own entries, includes, excludes, and optional output name; when no output name is set, the profile key becomes the trace basename. This makes context extraction repeatable across debugging, reviews, documentation, handoffs, and release work. Run one profile, a comma-separated set of profiles, or all profiles with `--all` when you need a broader pass.
53
+
54
+ Example:
55
+
56
+ ```json
57
+ {
58
+ "version": 4,
59
+ "$schema": "https://raw.githubusercontent.com/emxhive/prodex/main/schema/prodex.schema.json",
60
+ "output": {
61
+ "dir": "prodex",
62
+ "format": "md",
63
+ "versioned": true
64
+ },
65
+ "entry": [],
66
+ "include": [],
67
+ "exclude": ["node_modules/**", "vendor/**", "dist/**"],
68
+ "resolve": {
69
+ "aliases": {
70
+ "@": "resources/js"
71
+ },
72
+ "maxDepth": 10,
73
+ "maxFiles": 200
74
+ },
75
+ "profiles": {
76
+ "dashboard": {
77
+ "entry": ["resources/js/pages/Dashboard.tsx"],
78
+ "include": ["routes/**/*.php", "resources/js/types/**/*.d.ts"],
79
+ "exclude": ["resources/js/components/ui/**"]
80
+ },
81
+ "api": {
82
+ "entry": ["routes/api.php"],
83
+ "include": ["app/Http/Requests/**/*.php"],
84
+ "exclude": ["vendor/**"]
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ ## Markdown Output
91
+
92
+ Markdown is the primary Prodex output.
93
+
94
+ Each generated trace includes:
95
+
96
+ - A file index
97
+ - A total file count marker
98
+ - Links to each exported file section
99
+ - Line ranges for the generated sections
100
+ - Syntax-highlighted code fences where possible
101
+ - The collected source content in one readable bundle
102
+
103
+ Versioned filenames are enabled by default so repeated runs do not overwrite earlier traces.
104
+
105
+ ## Current Support
106
+
107
+ Prodex's broader identity is controlled context extraction, not a single-framework tool.
108
+
109
+ Include-only extraction is language-agnostic: any source or text file matched by `--include` or a profile `include` rule can be added to a trace.
110
+
111
+ Dependency tracing is resolver-based. Today Prodex traces JavaScript, TypeScript, TSX, declaration files, and PHP entrypoints. Current tracing support includes JS/TS imports, dynamic imports, CommonJS `require`, re-exports, static PHP include/require statements, PHP namespace imports, PSR-4 resolution, and some Laravel binding awareness.
112
+
113
+ Unsupported or dynamic relationships may need to be added with `--include` or profile `include` rules. That is expected: Prodex favors a focused, readable trace over pretending to understand every runtime edge in a project.
114
+
115
+ ## Installation
116
+
117
+ ```bash
118
+ npm install -g prodex
119
+ ```
120
+
121
+ Or run it ad hoc:
122
+
123
+ ```bash
124
+ npx prodex run --entry src/index.ts
125
+ ```
126
+
127
+ Create a starter config:
128
+
129
+ ```bash
130
+ prodex init
131
+ ```
132
+
133
+ ## Common Commands
134
+
135
+ ```bash
136
+ prodex run [root] --entry src/index.ts
137
+ prodex run [root] --entry routes/web.php --include "**/*.d.ts"
138
+ prodex run [root] --profile dashboard
139
+ prodex run [root] --profile dashboard,api
140
+ prodex run [root] --all
141
+ prodex profiles [root]
142
+ prodex migrate [root]
143
+ ```
144
+
145
+ `prodex run` requires the `run` command. Root-only positional command shortcuts are intentionally not supported.
146
+
147
+ ## CLI Reference
148
+
149
+ | Flag | Short | Type | Description |
150
+ | --- | --- | --- | --- |
151
+ | `--entry` | `-e` | list | Entry file or glob to trace. Repeatable and comma-aware. |
152
+ | `--include` | `-i` | list | Extra file or glob to add without dependency tracing. Repeatable and comma-aware. |
153
+ | `--exclude` | `-x` | list | File or glob to skip during traversal. Repeatable and comma-aware. |
154
+ | `--profile` | `-p` | list | Named profile to run. Comma-aware and repeatable. |
155
+ | `--all` | `-a` | boolean | Run every configured profile. `--all-profiles` remains available as an explicit alias. |
156
+ | `--name` | `-n` | string | Output basename for this run. |
157
+ | `--format` | `-F` | `md`/`txt` | Output format. Markdown is the default. |
158
+ | `--max-depth` | | number | Maximum dependency traversal depth. |
159
+ | `--max-files` | | number | Maximum traced file count. |
160
+
161
+ Global metadata flags:
162
+
163
+ ```bash
164
+ prodex --version
165
+ prodex run --help
166
+ prodex profiles --help
167
+ prodex migrate --help
168
+ ```
169
+
170
+ ## Configuration
171
+
172
+ Prodex reads `prodex.json` from the project root.
173
+
174
+ ```json
175
+ {
176
+ "version": 4,
177
+ "$schema": "https://raw.githubusercontent.com/emxhive/prodex/main/schema/prodex.schema.json",
178
+ "output": {
179
+ "dir": "prodex",
180
+ "format": "md",
181
+ "versioned": true
182
+ },
183
+ "entry": ["src/index.ts"],
184
+ "include": [],
185
+ "exclude": ["node_modules/**", "vendor/**", "dist/**"],
186
+ "resolve": {
187
+ "aliases": {
188
+ "@": "resources/js"
189
+ },
190
+ "maxDepth": 10,
191
+ "maxFiles": 200
192
+ },
193
+ "profiles": {}
194
+ }
195
+ ```
196
+
197
+ Naming precedence:
198
+
199
+ 1. `--name`
200
+ 2. `profile.name`
201
+ 3. Profile key, when running a named profile
202
+ 4. Automatic name from entries
203
+ 5. Internal fallback: `combined`
204
+
205
+ CLI flags override config values for a run. Profile arrays replace base arrays for that profile run.
206
+
207
+ ## Migrating Configs
208
+
209
+ Prodex requires config version 4. If a project has an older `prodex.json`, `prodex run` and `prodex profiles` fail with migration instructions instead of guessing.
210
+
211
+ Preview a migration:
212
+
213
+ ```bash
214
+ prodex migrate
215
+ ```
216
+
217
+ Check whether migration is needed:
218
+
219
+ ```bash
220
+ prodex migrate --check
221
+ ```
222
+
223
+ Write the migration:
224
+
225
+ ```bash
226
+ prodex migrate --write
227
+ ```
228
+
229
+ `--write` creates a backup before replacing `prodex.json`.
230
+
231
+ ## Requirements
232
+
233
+ - Node.js 22+
234
+ - A project with JS, TS, TSX, declaration-file, or PHP entrypoints for dependency tracing
235
+ - Any file type can be added through include-only extraction
236
+ - Optional `prodex.json` for saved defaults and profiles
237
+
238
+ ## License
239
+
240
+ MIT
package/bin/prodex.js CHANGED
File without changes
@@ -0,0 +1,2 @@
1
+ import type { RunPlan, RunResult } from "../types";
2
+ export declare function executeRun(plan: RunPlan): Promise<RunResult>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeRun = executeRun;
4
+ const cache_manager_1 = require("../cache/cache-manager");
5
+ const glob_scan_1 = require("../filesystem/glob-scan");
6
+ const trace_run_1 = require("../tracing/trace-run");
7
+ const logger_1 = require("../diagnostics/logger");
8
+ async function executeRun(plan) {
9
+ cache_manager_1.CacheManager.clear();
10
+ (0, logger_1.setLoggerOptions)(plan.flags);
11
+ const warnings = [];
12
+ const errors = [];
13
+ const entries = await resolveHeadlessEntries(plan);
14
+ const includes = plan.config.include ?? [];
15
+ const mode = getRunMode(entries.length, includes.length);
16
+ if (!entries.length && !includes.length) {
17
+ return {
18
+ ok: false,
19
+ root: plan.root,
20
+ mode,
21
+ entries,
22
+ includes,
23
+ files: [],
24
+ warnings,
25
+ errors: ["No entry files found and no include patterns were configured."],
26
+ profile: plan.profile,
27
+ };
28
+ }
29
+ const result = await (0, trace_run_1.runTrace)({
30
+ cfg: plan.config,
31
+ opts: {
32
+ entries,
33
+ outputName: plan.outputName,
34
+ },
35
+ });
36
+ if (!result.outputPath) {
37
+ return {
38
+ ok: false,
39
+ root: plan.root,
40
+ mode,
41
+ entries,
42
+ includes,
43
+ files: result.files,
44
+ stats: result.stats,
45
+ warnings,
46
+ errors: ["No files matched the selected entries or include patterns."],
47
+ profile: plan.profile,
48
+ };
49
+ }
50
+ return {
51
+ ok: true,
52
+ root: plan.root,
53
+ mode,
54
+ outputPath: result.outputPath,
55
+ outputName: plan.outputName,
56
+ entries,
57
+ includes,
58
+ files: result.files,
59
+ stats: result.stats,
60
+ warnings,
61
+ errors,
62
+ profile: plan.profile,
63
+ };
64
+ }
65
+ async function resolveHeadlessEntries(plan) {
66
+ return (await (0, glob_scan_1.globScan)(plan.config.entry, { cwd: plan.root })).files;
67
+ }
68
+ function getRunMode(entryCount, includePatternCount) {
69
+ if (entryCount && includePatternCount)
70
+ return "mixed";
71
+ if (entryCount)
72
+ return "trace";
73
+ return "include-only";
74
+ }
@@ -0,0 +1,12 @@
1
+ import type { ProdexConfigFile } from "../types";
2
+ export interface ProjectContext {
3
+ root: string;
4
+ config: ProdexConfigFile;
5
+ configPath: string;
6
+ configExists: boolean;
7
+ warnings: string[];
8
+ errors: string[];
9
+ }
10
+ export declare function loadProjectContext(rootArg?: string, cwd?: string): ProjectContext;
11
+ export declare function resolveRoot(rootArg?: string, cwd?: string): string;
12
+ export declare function validateRoot(root: string, rootArg?: string): string[];