prodex 1.2.0 β†’ 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,228 +1,234 @@
1
-
2
- # 🧩 Prodex v1.2.0
3
-
4
- > **Because every project deserves a clear map, not a maze.**
5
-
6
- ---
7
-
8
- ## 🧠 What’s New β€” v1.2.0
9
-
10
- - πŸ†• **Full CLI support with integrated [Sade](https://github.com/lukeed/sade).**
11
- Prodex now runs entirely from the terminal β€” no `prodex.json` required.
12
- Supports short flags and native glob patterns for flexible targeting.
13
- ```bash
14
- prodex -f "**/web.php,**/app.tsx" -i "**/*.d.ts" -x "node_modules/**"
15
- prodex --files **/web.php **/app.tsx --include **/*.interface.ts --exclude @shadcn/**
16
- ```
17
-
18
- - 🧾 **Markdown mode added and now default.**
19
- Output is fully fenced and linkable β€” jump between the index and any code block.
20
- Text mode remains available using `--txt` or `-t`.
21
-
22
- - πŸ—‚ **Output naming improved.**
23
- Output files are now versioned by default.
24
- Custom names are supported using `--name` or `-n`.
25
- Naming conventions have been updated for cleaner, consistent results.
26
-
27
- ---
28
-
29
- ## βš™οΈ Usage
30
-
31
- Prodex v1.2.0 runs entirely from the command line.
32
- Interactive mode is currently unstable β€” use CLI flags instead.
33
-
34
- ### Installation
35
-
36
- ```bash
37
- npm install -g prodex
38
- ```
39
-
40
- Or run without installing:
41
-
42
- ```bash
43
- npx prodex
44
- ```
45
-
46
- ---
47
-
48
- ### Basic Run
49
-
50
- ```bash
51
- prodex -f "**/web.php,**/app.tsx"
52
- ```
53
-
54
- ### With Includes, exclude, and Custom Name
55
-
56
- ```bash
57
- prodex -f "**/web.php,**/app.tsx" -i "**/*.d.ts" -x "node_modules/**" -n "combined-output"
58
- ```
59
-
60
- ### Flag Reference
61
-
62
- | Flag | Short | Description |
63
- |------|--------|-------------|
64
- | `--files` | `-f` | Entry files β€” starting points for dependency resolution. Accepts multiple names or globs. |
65
- | `--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. |
66
- | `--exclude` | `-x` | Patterns or folders to skip during the scan. |
67
- | `--name` | `-n` | Custom output filename (without extension). Versioning still applies automatically. |
68
-
69
- > Globs are powered by [Fast-Glob](https://github.com/mrmlnc/fast-glob).
70
- > Use **comma-separated values** for multiple entries.
71
- > Wrap globs in quotes when they include special characters like `|` or `&`.
72
-
73
- ---
74
-
75
- ## 🧭 Plans
76
-
77
- - **Alias Resolution Improvements**
78
- Planned overhaul of alias handling to support deeper nested paths, wildcard matching, and auto-mapped imports across mixed stacks.
79
-
80
- - **Language Support**
81
- Currently supports **JavaScript**, **React**, and **Laravel + React** stacks.
82
- May work with other frameworks but remains untested.
83
- Broader multi-language support is planned for future versions.
84
-
85
- - **Combined Output**
86
- All code from multiple entries is merged into a single output file.
87
- There’s currently **no limit** on output size, but it’s advised to avoid combining *too many large entries* in a single run.
88
- Future versions will include **smart naming** and **automatic splitting** for oversized outputs.
89
-
90
- - **Performance Optimizations**
91
- Planned improvements to resolver speed and dependency traversal for faster processing on large projects.
92
-
93
- ---
94
-
95
- ## 🧩 Features
96
-
97
- | Status | Feature | Description |
98
- |:--:|----------|--------------|
99
- | βœ… | **Cross-language indexing** | Resolves imports across JS, TS, React, and PHP (Laravel) projects. |
100
- | βœ… | **Markdown output** | Generates clean `.md` files with anchors, back-to-top links, and fenced code blocks. |
101
- | βœ… | **Text output** | Optional `.txt` mode using `--txt` or `-t`. |
102
- | βœ… | **Glob support** | Works with flexible glob patterns powered by [Fast-Glob](https://github.com/mrmlnc/fast-glob). |
103
- | βœ… | **Custom output names** | Define your own output prefix using `--name` or `-n`. |
104
- | ⚠️ | **Interactive picker (UI)** | Still unstable β€” not recommended for production use. |
105
- | ⚠️ | **Alias resolution** | Basic alias mapping supported; advanced cases in progress. |
106
- | 🚧 | **Smart file splitting** | Planned for large combined outputs. |
107
- | 🚧 | **PSR-4 deep scan** | Planned to improve PHP dependency resolution. |
108
- | 🚧 | **Speed optimization** | Further resolver and I/O improvements under development. |
109
-
110
- ---
111
-
112
- ## 🧱 Use Cases
113
-
114
- Prodex can technically combine your entire codebase into one file β€”
115
- but it’s **best used in parts**, focusing on specific sections or features.
116
- Each run produces a clean, self-contained map showing all related files and dependencies.
117
-
118
- ### 🧩 Common Scenarios
119
-
120
- - **πŸ€– Project Awareness for AI Assistants**
121
- Generate compact `.md` summaries of key parts of your project.
122
- These can be shared with AI tools (like ChatGPT, Claude, or Copilot) to give them structured context about your codebase β€” without exposing unnecessary files.
123
-
124
- - **πŸ“¦ Feature or Module Mapping**
125
- Combine everything connected to a specific feature (e.g., `Checkout`, `Dashboard`, or `Payments`).
126
- Prodex gathers all linked imports, helpers, and files into one readable document.
127
-
128
- - **πŸ” Dependency Insight**
129
- 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.
130
- Great for debugging, refactoring, or understanding cross-stack dependencies.
131
-
132
- - **πŸ“– Documentation Bundles**
133
- Create readable Markdown maps per module or domain instead of one large export.
134
- Each output acts as a focused, navigable view of your code relationships.
135
-
136
- - **🧠 Team Handoffs**
137
- Share isolated code scopes (like `Auth`, `Payments`, or `User Management`) with full dependency context.
138
- Makes onboarding and code reviews significantly faster.
139
-
140
- ---
141
-
142
- ## 🧩 Recommended Workflow
143
-
144
- Prodex works best when used to **map and export projects in logical parts** rather than all at once.
145
- Each run focuses on one or more entry points, and Prodex automatically **loads all imports recursively** for those files β€”
146
- then appends any files matched by the `--include` flag.
147
-
148
- ### 🧠 Suggested Pattern
149
-
150
- 1. **Pick a meaningful entry file**
151
- Example:
152
- - Frontend: `resources/js/**/dashboard.tsx`
153
- - Backend: `routes/**/(web|api).php`
154
- - Shared logic: `app/Services/**/PaymentService.php`
155
-
156
- 2. **Run Prodex with includes for type or interface files**
157
- ```bash
158
- prodex -f "**/dashboard.tsx" -i "**/*.d.ts,**/*.interface.ts"
159
- ```
160
-
161
- 3. **Export separate maps for each major area**
162
- ```bash
163
- prodex -f "**/dashboard.tsx" -n "dashboard-map"
164
- prodex -f "**/web|api.php" -n "backend-map"
165
- ```
166
-
167
- 4. **Use them together**
168
- Store each output in `/prodex/` or `/docs/maps/`.
169
- These maps can be shared with teammates or loaded into AI tools for structured, code-aware assistance.
170
-
171
- > ⚑ Each run recursively resolves every import, applies includes, and outputs one complete dependency map for that section.
172
-
173
- ---
174
-
175
- ## βš™οΈ Optional β€” `prodex.json`
176
-
177
- `prodex.json` is **fully optional** in v1.2.0.
178
- You can run Prodex entirely from the command line, but the config file can be useful for saved defaults.
179
-
180
- ### πŸͺ„ Quick Setup
181
-
182
- You can generate a ready-to-use config file with:
183
-
184
- ```bash
185
- prodex init
186
- ```
187
-
188
- This creates a `prodex.json` file in your project root with sensible defaults β€” including base directories, globs, and priority files.
189
-
190
- ### 🧩 Running with a Config File
191
-
192
- If you’ve defined your entry files in the config under `entry.files`,
193
- you can run Prodex directly without specifying `--files`:
194
-
195
- ```bash
196
- prodex -c
197
- ```
198
-
199
- The `-c` (or `--ci`) flag skips interactive mode and uses the config values automatically.
200
- Specifying `-f` ( or `--files`) from the CLI also disables the picker by default.
201
-
202
- You can permanently disable the picker in the config by setting:
203
-
204
- ```json
205
- "entry": {
206
- "ui": {
207
- "enablePicker": false
208
- }
209
- }
210
- ```
211
-
212
- ---
213
-
214
- ## πŸ“œ License
215
-
216
- **MIT License**
217
- Β© 2025 [emxhive](https://github.com/emxhive)
218
-
219
- ---
220
-
221
- ## ⚠️ Note from the Author
222
-
223
- Prodex is still a **work in progress**.
224
- Some parts of the experience may be rough, especially around interactive mode and advanced resolvers.
225
- Updates are released **multiple times per week β€” sometimes daily** β€” to keep improving stability and support.
226
-
227
- Please stay up to date for the best experience.
228
- 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. ❀️
@@ -9,6 +9,7 @@ const flags_1 = require("./flags");
9
9
  const logger_1 = require("../lib/logger");
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const package_json_1 = __importDefault(require("../../package.json"));
12
+ const fs_1 = __importDefault(require("fs"));
12
13
  /**
13
14
  * Unified CLI parser powered by Sade.
14
15
  * Returns { root, entries (from --files), flags, warnings, errors }.
@@ -19,31 +20,13 @@ function parseCliInput(argv = process.argv) {
19
20
  process.exit(0);
20
21
  }
21
22
  const program = (0, sade_1.default)("prodex [root]");
22
- // Register flags dynamically
23
- for (const [key, meta] of Object.entries(flags_1.PRODEX_FLAGS)) {
24
- const short = meta.short ? `-${meta.short}, ` : "";
25
- const long = `--${key}`;
26
- const desc = meta.description;
27
- let defaultVal;
28
- switch (meta.type) {
29
- case "boolean":
30
- defaultVal = false;
31
- break;
32
- default:
33
- defaultVal = undefined; // defer strings/numbers/lists
34
- }
35
- if (defaultVal !== undefined) {
36
- program.option(`${short}${long}`, desc, defaultVal);
37
- }
38
- else {
39
- program.option(`${short}${long}`, desc);
40
- }
41
- }
42
- let parsed = { root: undefined, flags: {} };
43
- // Define default command (root optional)
23
+ registerFlags(program);
24
+ let parsed = { rootArg: "", root: undefined, flags: {} };
25
+ // Define action
44
26
  program.action((root, opts) => {
45
27
  const cwd = process.cwd();
46
28
  parsed = {
29
+ rootArg: root,
47
30
  root: root ? path_1.default.resolve(cwd, root) : cwd,
48
31
  flags: { ...opts },
49
32
  };
@@ -52,20 +35,40 @@ function parseCliInput(argv = process.argv) {
52
35
  const warnings = [];
53
36
  const errors = [];
54
37
  // Post-parse casting + normalization
38
+ parsed.flags = normalizeFlags(parsed.flags, warnings, errors);
39
+ validateArgs(parsed, warnings, errors);
40
+ return {
41
+ ...parsed,
42
+ warnings,
43
+ errors,
44
+ };
45
+ }
46
+ function registerFlags(program) {
55
47
  for (const [key, meta] of Object.entries(flags_1.PRODEX_FLAGS)) {
56
- const raw = parsed.flags[key];
48
+ const short = meta.short ? `-${meta.short}, ` : "";
49
+ const long = `--${key}`;
50
+ const desc = meta.description;
51
+ let defaultVal;
52
+ if (meta.type === "boolean")
53
+ defaultVal = false;
54
+ if (defaultVal !== undefined)
55
+ program.option(`${short}${long}`, desc, defaultVal);
56
+ else
57
+ program.option(`${short}${long}`, desc);
58
+ }
59
+ }
60
+ function normalizeFlags(flags, warnings, errors) {
61
+ for (const [key, meta] of Object.entries(flags_1.PRODEX_FLAGS)) {
62
+ const raw = flags[key];
57
63
  if (raw === undefined)
58
64
  continue;
59
- const obj = {};
60
65
  switch (meta.type) {
61
66
  case "number": {
62
67
  const num = Number(raw);
63
- if (Number.isNaN(num)) {
68
+ if (Number.isNaN(num))
64
69
  errors.push(`Flag --${key} expected a number but got "${raw}"`);
65
- }
66
- else {
67
- parsed.flags[key] = num;
68
- }
70
+ else
71
+ flags[key] = num;
69
72
  break;
70
73
  }
71
74
  case "list": {
@@ -73,14 +76,31 @@ function parseCliInput(argv = process.argv) {
73
76
  .split(",")
74
77
  .map((v) => v.trim())
75
78
  .filter(Boolean);
76
- parsed.flags[key] = arr;
79
+ flags[key] = arr;
77
80
  break;
78
81
  }
79
82
  }
80
83
  }
81
- return {
82
- ...parsed,
83
- warnings,
84
- errors,
85
- };
84
+ return flags;
85
+ }
86
+ function validateArgs(parsed, warnings, errors) {
87
+ const { rootArg, flags: { _: unknown }, } = parsed;
88
+ if (rootArg) {
89
+ if (!fs_1.default.existsSync(parsed.root)) {
90
+ errors.push(`Invalid path argument: "${rootArg}" does not exist.`);
91
+ }
92
+ else if (!fs_1.default.statSync(parsed.root).isDirectory()) {
93
+ errors.push(`Path argument "${rootArg}" is not a directory.`);
94
+ }
95
+ }
96
+ if (unknown.length) {
97
+ warnings.push(`Unrecognized arguments detected [${unknown.join(", ")}]- They were ignored.`);
98
+ }
99
+ if (warnings.length)
100
+ logger_1.logger.warn("Warnings:", warnings);
101
+ if (errors.length) {
102
+ for (const err of errors)
103
+ logger_1.logger.error(err);
104
+ process.exit(1);
105
+ }
86
106
  }