prodex 1.0.5 โ†’ 1.0.7

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.7
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`).
@@ -13,6 +14,16 @@
13
14
 
14
15
  ---
15
16
 
17
+ ---
18
+
19
+ ## ๐Ÿ“ฆ Installation
20
+
21
+ ### Global install (recommended)
22
+ ```bash
23
+ npm install -g prodex
24
+ ```
25
+
26
+
16
27
  ## ๐Ÿš€ Features
17
28
 
18
29
  | Feature | Description |
@@ -27,64 +38,6 @@
27
38
 
28
39
  ---
29
40
 
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
41
  ## โš™๏ธ Configuration
89
42
 
90
43
  Optional `.prodex.json` (in project root):
@@ -107,36 +60,31 @@ Optional `.prodex.json` (in project root):
107
60
  "importExcludes": [
108
61
  "node_modules",
109
62
  "@shadcn/"
110
- ]
63
+ ],
64
+ "priorityFiles": [
65
+ "routes/web.php",
66
+ "routes/api.php",
67
+ "index.",
68
+ "main.",
69
+ "app."
70
+ ]
111
71
  }
112
72
  ```
113
73
 
114
- ---
74
+ ```
115
75
 
116
- ## โšก CLI Flags (UNTESTED)
117
76
 
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
77
 
126
- Example:
127
- ```bash
128
- prodex --depth 3 --output ./dump --limit 500
129
78
  ```
130
79
 
131
- ---
132
80
 
133
- ## ๐Ÿงฉ Workflow Overview
134
81
 
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.
82
+ Files are matched using `.includes()` (case-insensitive), so `"index."` will match `src/index.js`, `app/index.tsx`, etc.
83
+ Popular entries appear at the top of the picker.
84
+
85
+
86
+
87
+
140
88
 
141
89
  ---
142
90
 
@@ -188,4 +136,5 @@ Issues and contributions welcome:
188
136
 
189
137
  ---
190
138
 
191
- **Prodex** โ€” *because every project deserves a clear map, not a maze.*
139
+ **Prodex** โ€” *Codebase, decoded*
140
+
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.7
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`).
@@ -13,6 +14,16 @@
13
14
 
14
15
  ---
15
16
 
17
+ ---
18
+
19
+ ## ๐Ÿ“ฆ Installation
20
+
21
+ ### Global install (recommended)
22
+ ```bash
23
+ npm install -g prodex
24
+ ```
25
+
26
+
16
27
  ## ๐Ÿš€ Features
17
28
 
18
29
  | Feature | Description |
@@ -27,64 +38,6 @@
27
38
 
28
39
  ---
29
40
 
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
41
  ## โš™๏ธ Configuration
89
42
 
90
43
  Optional `.prodex.json` (in project root):
@@ -107,36 +60,31 @@ Optional `.prodex.json` (in project root):
107
60
  "importExcludes": [
108
61
  "node_modules",
109
62
  "@shadcn/"
110
- ]
63
+ ],
64
+ "priorityFiles": [
65
+ "routes/web.php",
66
+ "routes/api.php",
67
+ "index.",
68
+ "main.",
69
+ "app."
70
+ ]
111
71
  }
112
72
  ```
113
73
 
114
- ---
74
+ ```
115
75
 
116
- ## โšก CLI Flags (UNTESTED)
117
76
 
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
77
 
126
- Example:
127
- ```bash
128
- prodex --depth 3 --output ./dump --limit 500
129
78
  ```
130
79
 
131
- ---
132
80
 
133
- ## ๐Ÿงฉ Workflow Overview
134
81
 
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.
82
+ Files are matched using `.includes()` (case-insensitive), so `"index."` will match `src/index.js`, `app/index.tsx`, etc.
83
+ Popular entries appear at the top of the picker.
84
+
85
+
86
+
87
+
140
88
 
141
89
  ---
142
90
 
@@ -188,4 +136,5 @@ Issues and contributions welcome:
188
136
 
189
137
  ---
190
138
 
191
- **Prodex** โ€” *because every project deserves a clear map, not a maze.*
139
+ **Prodex** โ€” *Codebase, decoded*
140
+
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prodex",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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: 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,11 +2,11 @@ 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,
9
- BASE_DIRS
8
+ BASE_DIRS,
9
+ PRIORITY_FILES
10
10
  } from "./config.js";
11
11
 
12
12
  /**
@@ -28,12 +28,10 @@ export function loadProdexConfig() {
28
28
  }
29
29
  }
30
30
 
31
- // Resolve output directory (always a folder now)
32
31
  const outputDir = userConfig.output
33
32
  ? path.resolve(ROOT, userConfig.output)
34
33
  : path.join(ROOT, "prodex");
35
34
 
36
- // Ensure directory exists
37
35
  try {
38
36
  fs.mkdirSync(outputDir, { recursive: true });
39
37
  } catch (e) {
@@ -48,18 +46,19 @@ export function loadProdexConfig() {
48
46
  importExcludes: [...IMPORT_EXCLUDES, ...(userConfig.importExcludes || [])],
49
47
  baseDirs: [...new Set([...(userConfig.baseDirs || []), ...BASE_DIRS])],
50
48
  aliasOverrides: userConfig.aliasOverrides || {},
51
- limit: userConfig.limit || 200
49
+ limit: userConfig.limit || 200,
50
+ priorityFiles: userConfig.priorityFiles || PRIORITY_FILES
52
51
  };
53
52
 
54
- console.log("?? Active Config:");
55
- console.log(" โ€ข Output Directory:", merged.output);
56
- console.log(" โ€ข Scan Depth:", merged.scanDepth);
57
- console.log(" โ€ข Base Dirs:", merged.baseDirs.join(", "));
58
- if (userConfig.entryExcludes || userConfig.importExcludes)
59
- console.log(" โ€ข Custom Exclusions:", {
60
- entries: userConfig.entryExcludes?.length || 0,
61
- imports: userConfig.importExcludes?.length || 0
62
- });
53
+ // console.log("?? Active Config:");
54
+ // console.log(" โ€ข Output Directory:", merged.output);
55
+ // console.log(" โ€ข Scan Depth:", merged.scanDepth);
56
+ // console.log(" โ€ข Base Dirs:", merged.baseDirs.join(", "));
57
+ // if (userConfig.entryExcludes || userConfig.importExcludes)
58
+ // console.log(" โ€ข Custom Exclusions:", {
59
+ // entries: userConfig.entryExcludes?.length || 0,
60
+ // imports: userConfig.importExcludes?.length || 0
61
+ // });
63
62
 
64
63
  return merged;
65
64
  }
@@ -29,7 +29,13 @@ export const IMPORT_EXCLUDES = [
29
29
  ];
30
30
  export const BASE_DIRS = ["src", "bin", "schema", "app", "routes", "resources/js"];
31
31
 
32
-
32
+ export const PRIORITY_FILES = [
33
+ "routes/web.php",
34
+ "routes/api.php",
35
+ "index.",
36
+ "main.",
37
+ "app."
38
+ ]
33
39
  /**
34
40
  * Resolver map โ€” links file extensions to their resolver functions.
35
41
  * Extend this to support new formats (.vue, .jsx, etc.).
@@ -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.7",
4
4
  "description": "Unified Project Indexer & Dependency Extractor for Laravel + React + Node stacks.",
5
5
  "type": "module",
6
6
  "bin": {