prodex 1.0.5 โ†’ 1.0.6

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
@@ -5,7 +5,8 @@
5
5
 
6
6
  ---
7
7
 
8
- ## ๐Ÿง  Recent Fixes & Updates โ€” v1.0.4
8
+ ## ๐Ÿง  Recent Fixes & Updates โ€” v1.0.6
9
+ - โญ **Priority Files Support** โ€” priority files will now appear **first** on the entry selection list.
9
10
 
10
11
  - ๐ŸชŸ **Windows path resolution fixed** โ€” now uses proper `file://` URLs for full ESM compatibility.
11
12
  - ๐Ÿงพ **Improved output naming** โ€” automatic, context-aware filenames (e.g. `prodex-[entries]-combined.txt`).
@@ -27,64 +28,6 @@
27
28
 
28
29
  ---
29
30
 
30
- ## ๐Ÿ“ฆ Installation
31
-
32
- ```bash
33
- npm install -g prodex
34
- ```
35
-
36
- or locally:
37
-
38
- ```bash
39
- npm install --save-dev prodex
40
- ```
41
-
42
- ---
43
-
44
- ## ๐Ÿงฐ Usage
45
-
46
- Run from your project root:
47
-
48
- ```bash
49
- prodex
50
- ```
51
-
52
- or:
53
-
54
- ```bash
55
- npx prodex
56
- ```
57
-
58
- Youโ€™ll be guided through an interactive CLI:
59
-
60
- ```
61
- ๐Ÿงฉ Prodex โ€” Project Indexer
62
- ๐Ÿงฉ Active Config:
63
- โ€ข Output Directory: ./prodex/
64
- โ€ข Scan Depth: 2
65
- โ€ข Base Dirs: app, routes, resources/js
66
- ```
67
-
68
- After selecting entries:
69
-
70
- ```
71
- โœ… prodex-[entries]-combined.txt written (12 file(s)).
72
- ```
73
-
74
- ---
75
-
76
- ## ๐Ÿ—‚ Output Example
77
-
78
- ```
79
- ## ==== path: app/Services/Shots/ComputeService.php ====
80
- ## #region app/Services/Shots/ComputeService.php
81
- <?php
82
- // your code here...
83
- ## #endregion
84
- ```
85
-
86
- ---
87
-
88
31
  ## โš™๏ธ Configuration
89
32
 
90
33
  Optional `.prodex.json` (in project root):
@@ -107,36 +50,31 @@ Optional `.prodex.json` (in project root):
107
50
  "importExcludes": [
108
51
  "node_modules",
109
52
  "@shadcn/"
110
- ]
53
+ ],
54
+ "priorityFiles": [
55
+ "routes/web.php",
56
+ "routes/api.php",
57
+ "index",
58
+ "main",
59
+ "app"
60
+ ]
111
61
  }
112
62
  ```
113
63
 
114
- ---
64
+ ```
115
65
 
116
- ## โšก CLI Flags (UNTESTED)
117
66
 
118
- | Flag | Description |
119
- |------|-------------|
120
- | `--limit <n>` | Override max dependency count |
121
- | `--output <dir>` | Custom output directory |
122
- | `--depth <n>` | Set scan depth |
123
- | `--no-chain` | Disable dependency chain following |
124
- | `--debug` | Enable verbose logging |
125
67
 
126
- Example:
127
- ```bash
128
- prodex --depth 3 --output ./dump --limit 500
129
68
  ```
130
69
 
131
- ---
132
70
 
133
- ## ๐Ÿงฉ Workflow Overview
134
71
 
135
- 1. **Config Loader** โ€” merges `.prodex.json` with defaults and alias maps.
136
- 2. **Resolvers** โ€”
137
- - JS/TS: follows imports, re-exports, dynamic imports.
138
- - PHP: expands `use`, grouped imports, PSR-4 mappings.
139
- 3. **Combiner** โ€” normalizes indentation, strips comments, merges all code into one readable combined file.
72
+ Files are matched using `.includes()` (case-insensitive), so `"index"` will match `src/index.js`, `app/index.tsx`, etc.
73
+ Recommended entries appear at the top of the picker under a **โญ Recommended entries** section.
74
+
75
+
76
+
77
+
140
78
 
141
79
  ---
142
80
 
@@ -188,4 +126,5 @@ Issues and contributions welcome:
188
126
 
189
127
  ---
190
128
 
191
- **Prodex** โ€” *because every project deserves a clear map, not a maze.*
129
+ **Prodex** โ€” *Codebase, decoded*
130
+
package/dist/README.md CHANGED
@@ -5,7 +5,8 @@
5
5
 
6
6
  ---
7
7
 
8
- ## ๐Ÿง  Recent Fixes & Updates โ€” v1.0.4
8
+ ## ๐Ÿง  Recent Fixes & Updates โ€” v1.0.6
9
+ - โญ **Priority Files Support** โ€” priority files will now appear **first** on the entry selection list.
9
10
 
10
11
  - ๐ŸชŸ **Windows path resolution fixed** โ€” now uses proper `file://` URLs for full ESM compatibility.
11
12
  - ๐Ÿงพ **Improved output naming** โ€” automatic, context-aware filenames (e.g. `prodex-[entries]-combined.txt`).
@@ -27,64 +28,6 @@
27
28
 
28
29
  ---
29
30
 
30
- ## ๐Ÿ“ฆ Installation
31
-
32
- ```bash
33
- npm install -g prodex
34
- ```
35
-
36
- or locally:
37
-
38
- ```bash
39
- npm install --save-dev prodex
40
- ```
41
-
42
- ---
43
-
44
- ## ๐Ÿงฐ Usage
45
-
46
- Run from your project root:
47
-
48
- ```bash
49
- prodex
50
- ```
51
-
52
- or:
53
-
54
- ```bash
55
- npx prodex
56
- ```
57
-
58
- Youโ€™ll be guided through an interactive CLI:
59
-
60
- ```
61
- ๐Ÿงฉ Prodex โ€” Project Indexer
62
- ๐Ÿงฉ Active Config:
63
- โ€ข Output Directory: ./prodex/
64
- โ€ข Scan Depth: 2
65
- โ€ข Base Dirs: app, routes, resources/js
66
- ```
67
-
68
- After selecting entries:
69
-
70
- ```
71
- โœ… prodex-[entries]-combined.txt written (12 file(s)).
72
- ```
73
-
74
- ---
75
-
76
- ## ๐Ÿ—‚ Output Example
77
-
78
- ```
79
- ## ==== path: app/Services/Shots/ComputeService.php ====
80
- ## #region app/Services/Shots/ComputeService.php
81
- <?php
82
- // your code here...
83
- ## #endregion
84
- ```
85
-
86
- ---
87
-
88
31
  ## โš™๏ธ Configuration
89
32
 
90
33
  Optional `.prodex.json` (in project root):
@@ -107,36 +50,31 @@ Optional `.prodex.json` (in project root):
107
50
  "importExcludes": [
108
51
  "node_modules",
109
52
  "@shadcn/"
110
- ]
53
+ ],
54
+ "priorityFiles": [
55
+ "routes/web.php",
56
+ "routes/api.php",
57
+ "index",
58
+ "main",
59
+ "app"
60
+ ]
111
61
  }
112
62
  ```
113
63
 
114
- ---
64
+ ```
115
65
 
116
- ## โšก CLI Flags (UNTESTED)
117
66
 
118
- | Flag | Description |
119
- |------|-------------|
120
- | `--limit <n>` | Override max dependency count |
121
- | `--output <dir>` | Custom output directory |
122
- | `--depth <n>` | Set scan depth |
123
- | `--no-chain` | Disable dependency chain following |
124
- | `--debug` | Enable verbose logging |
125
67
 
126
- Example:
127
- ```bash
128
- prodex --depth 3 --output ./dump --limit 500
129
68
  ```
130
69
 
131
- ---
132
70
 
133
- ## ๐Ÿงฉ Workflow Overview
134
71
 
135
- 1. **Config Loader** โ€” merges `.prodex.json` with defaults and alias maps.
136
- 2. **Resolvers** โ€”
137
- - JS/TS: follows imports, re-exports, dynamic imports.
138
- - PHP: expands `use`, grouped imports, PSR-4 mappings.
139
- 3. **Combiner** โ€” normalizes indentation, strips comments, merges all code into one readable combined file.
72
+ Files are matched using `.includes()` (case-insensitive), so `"index"` will match `src/index.js`, `app/index.tsx`, etc.
73
+ Recommended entries appear at the top of the picker under a **โญ Recommended entries** section.
74
+
75
+
76
+
77
+
140
78
 
141
79
  ---
142
80
 
@@ -188,4 +126,5 @@ Issues and contributions welcome:
188
126
 
189
127
  ---
190
128
 
191
- **Prodex** โ€” *because every project deserves a clear map, not a maze.*
129
+ **Prodex** โ€” *Codebase, decoded*
130
+
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prodex",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Unified Project Indexer & Dependency Extractor for Laravel + React + Node stacks.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,6 +26,13 @@ export async function initProdex() {
26
26
  "@hooks": "resources/js/hooks",
27
27
  "@data": "resources/js/data"
28
28
  },
29
+ "priorityFiles": [
30
+ "routes/web.php",
31
+ "routes/api.php",
32
+ "index",
33
+ "main",
34
+ "app"
35
+ ],
29
36
  "entryExcludes": [
30
37
  "resources/js/components/ui/",
31
38
  "app/DTOs/"
@@ -2,9 +2,9 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import inquirer from "inquirer";
4
4
  import { ROOT } from "../constants/config.js";
5
- import { walk, rel } from "../core/helpers.js";
5
+ import { walk, rel, sortWithPriority } from "../core/helpers.js";
6
6
 
7
- export async function pickEntries(baseDirs, depth = 2) {
7
+ export async function pickEntries(baseDirs, depth = 2, cfg = {}) {
8
8
  let selected = [];
9
9
  while (true) {
10
10
  const files = [];
@@ -14,10 +14,23 @@ export async function pickEntries(baseDirs, depth = 2) {
14
14
  for (const f of walk(full, 0, depth)) files.push(f);
15
15
  }
16
16
 
17
- const choices = files.map(f => ({ name: rel(f), value: f }));
18
- choices.push(new inquirer.Separator());
19
- choices.push({ name: "๐Ÿ”ฝ Load more (go deeper)", value: "__loadmore" });
20
- choices.push({ name: "๐Ÿ“ Enter custom path", value: "__manual" });
17
+ const sorted = sortWithPriority(files, cfg.priorityFiles);
18
+
19
+ const prioritized = sorted.filter(f =>
20
+ cfg.priorityFiles?.some(p =>
21
+ rel(f).replaceAll("\\", "/").toLowerCase().includes(p.toLowerCase())
22
+ )
23
+ );
24
+
25
+ const choices = sorted.map(f => ({
26
+ name: prioritized.includes(f) ? `โญ ${rel(f)}` : rel(f),
27
+ value: f
28
+ }));
29
+
30
+ if (prioritized.length) {
31
+ choices.unshift(new inquirer.Separator("โญ Recommended entries"));
32
+ choices.splice(prioritized.length + 1, 0, new inquirer.Separator("โ”€ Other files"));
33
+ }
21
34
 
22
35
  const { picks } = await inquirer.prompt([
23
36
  {
@@ -2,7 +2,6 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import {
4
4
  ROOT,
5
-
6
5
  CODE_EXTS,
7
6
  ENTRY_EXCLUDES,
8
7
  IMPORT_EXCLUDES,
@@ -28,12 +27,10 @@ export function loadProdexConfig() {
28
27
  }
29
28
  }
30
29
 
31
- // Resolve output directory (always a folder now)
32
30
  const outputDir = userConfig.output
33
31
  ? path.resolve(ROOT, userConfig.output)
34
32
  : path.join(ROOT, "prodex");
35
33
 
36
- // Ensure directory exists
37
34
  try {
38
35
  fs.mkdirSync(outputDir, { recursive: true });
39
36
  } catch (e) {
@@ -48,7 +45,8 @@ export function loadProdexConfig() {
48
45
  importExcludes: [...IMPORT_EXCLUDES, ...(userConfig.importExcludes || [])],
49
46
  baseDirs: [...new Set([...(userConfig.baseDirs || []), ...BASE_DIRS])],
50
47
  aliasOverrides: userConfig.aliasOverrides || {},
51
- limit: userConfig.limit || 200
48
+ limit: userConfig.limit || 200,
49
+ priorityFiles: userConfig.priorityFiles || []
52
50
  };
53
51
 
54
52
  console.log("?? Active Config:");
@@ -20,7 +20,7 @@ export async function runCombine() {
20
20
  const cfg = loadProdexConfig();
21
21
  const { baseDirs, scanDepth } = cfg;
22
22
 
23
- const entries = await pickEntries(baseDirs, scanDepth);
23
+ const entries = await pickEntries(baseDirs, scanDepth, cfg);
24
24
  if (!entries.length) {
25
25
  console.log("โŒ No entries selected.");
26
26
  return;
@@ -41,7 +41,6 @@ export async function runCombine() {
41
41
  proceed = true;
42
42
 
43
43
  if (!yesToAll) {
44
- // clone static prompts with dynamic defaults
45
44
  const combinePrompts = PROMPTS.combine.map(p => ({
46
45
  ...p,
47
46
  default:
@@ -64,7 +63,6 @@ export async function runCombine() {
64
63
  return;
65
64
  }
66
65
 
67
- // ensure output directory exists
68
66
  try {
69
67
  fs.mkdirSync(outputDir, { recursive: true });
70
68
  } catch {
@@ -104,8 +102,6 @@ const regionEnd = "##endregion";
104
102
  function render(p) {
105
103
  const ext = path.extname(p);
106
104
  let s = read(p);
107
- // s = stripComments(s, ext);
108
- // s = normalizeIndent(s);
109
105
  return `${header(p)}\n${regionStart(p)}\n${s}\n${regionEnd}\n\n`;
110
106
  }
111
107
 
@@ -23,14 +23,12 @@ export function normalizeIndent(s) {
23
23
  }
24
24
 
25
25
  export function stripComments(code, ext) {
26
- // Fast path for PHP or non-JS files โ€” simple regex is fine
27
26
  if (ext === ".php") {
28
27
  return code
29
- .replace(/\/\*[\s\S]*?\*\//g, "") // block comments
30
- .replace(/^\s*#.*$/gm, ""); // line comments
28
+ .replace(/\/\*[\s\S]*?\*\//g, "")
29
+ .replace(/^\s*#.*$/gm, "");
31
30
  }
32
31
 
33
- // Robust JS/TS-safe parser โ€” avoids stripping inside strings
34
32
  let out = "";
35
33
  let inStr = false;
36
34
  let strChar = "";
@@ -93,7 +91,6 @@ export function stripComments(code, ext) {
93
91
  return out;
94
92
  }
95
93
 
96
-
97
94
  export function isEntryExcluded(p) {
98
95
  const r = rel(p);
99
96
  return ENTRY_EXCLUDES.some(ex => r.startsWith(ex) || r.includes(ex));
@@ -114,3 +111,17 @@ export function* walk(dir, depth = 0, maxDepth = 2) {
114
111
  }
115
112
  }
116
113
  }
114
+
115
+ export function sortWithPriority(files, priorityList = []) {
116
+ if (!priorityList.length) return files;
117
+ const prioritized = [];
118
+ const normal = [];
119
+
120
+ for (const f of files) {
121
+ const normalized = f.replaceAll("\\", "/").toLowerCase();
122
+ if (priorityList.some(p => normalized.includes(p.toLowerCase()))) prioritized.push(f);
123
+ else normal.push(f);
124
+ }
125
+
126
+ return [...new Set([...prioritized, ...normal])];
127
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prodex",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Unified Project Indexer & Dependency Extractor for Laravel + React + Node stacks.",
5
5
  "type": "module",
6
6
  "bin": {