prodex 2.0.0 → 2.1.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 +369 -146
- package/dist/app/dependency-source-provider.d.ts +2 -0
- package/dist/app/dependency-source-provider.js +66 -0
- package/dist/app/entry-resolver.d.ts +7 -0
- package/dist/app/entry-resolver.js +26 -0
- package/dist/app/execute-run.d.ts +2 -2
- package/dist/app/execute-run.js +138 -36
- package/dist/app/git-source-provider.d.ts +4 -0
- package/dist/app/git-source-provider.js +551 -0
- package/dist/app/grep-source-provider.d.ts +2 -0
- package/dist/app/grep-source-provider.js +226 -0
- package/dist/app/planner.d.ts +12 -0
- package/dist/app/planner.js +106 -0
- package/dist/app/planners/attachment-options.d.ts +2 -0
- package/dist/app/planners/attachment-options.js +39 -0
- package/dist/app/planners/git-plan.d.ts +13 -0
- package/dist/app/planners/git-plan.js +141 -0
- package/dist/app/planners/grep-plan.d.ts +13 -0
- package/dist/app/planners/grep-plan.js +115 -0
- package/dist/app/planners/list-utils.d.ts +1 -0
- package/dist/app/planners/list-utils.js +6 -0
- package/dist/app/planners/pack-plan.d.ts +13 -0
- package/dist/app/planners/pack-plan.js +65 -0
- package/dist/app/planners/scope-plan.d.ts +17 -0
- package/dist/app/planners/scope-plan.js +143 -0
- package/dist/app/planners/trace-plan.d.ts +13 -0
- package/dist/app/planners/trace-plan.js +77 -0
- package/dist/app/source-collector.d.ts +5 -0
- package/dist/app/source-collector.js +33 -0
- package/dist/app/target-resolver.d.ts +7 -0
- package/dist/app/target-resolver.js +110 -0
- package/dist/cli/cli-input.js +70 -19
- package/dist/cli/flag-specs.d.ts +7 -3
- package/dist/cli/flag-specs.js +58 -7
- package/dist/cli/help-specs.d.ts +205 -0
- package/dist/cli/help-specs.js +136 -0
- package/dist/cli/help.js +107 -28
- package/dist/cli/report-command.js +59 -26
- package/dist/commands/{run-command.d.ts → git-command.d.ts} +3 -3
- package/dist/commands/git-command.js +7 -0
- package/dist/commands/grep-command.d.ts +11 -0
- package/dist/commands/grep-command.js +7 -0
- package/dist/commands/pack-command.d.ts +11 -0
- package/dist/commands/pack-command.js +7 -0
- package/dist/commands/scope-command.d.ts +12 -0
- package/dist/commands/scope-command.js +7 -0
- package/dist/commands/shared-runner.d.ts +12 -0
- package/dist/commands/shared-runner.js +30 -0
- package/dist/commands/trace-command.d.ts +11 -0
- package/dist/commands/trace-command.js +7 -0
- package/dist/config/default-config.js +7 -11
- package/dist/config/load.d.ts +1 -0
- package/dist/config/load.js +269 -4
- package/dist/config/migration/detect.d.ts +2 -1
- package/dist/config/migration/detect.js +10 -2
- package/dist/config/migration/messages.js +12 -11
- package/dist/config/migration/transform.js +77 -32
- package/dist/filesystem/binary.d.ts +2 -0
- package/dist/filesystem/binary.js +30 -0
- package/dist/filesystem/entry-discovery.d.ts +14 -0
- package/dist/filesystem/entry-discovery.js +78 -0
- package/dist/filesystem/file-set.d.ts +7 -0
- package/dist/filesystem/file-set.js +57 -0
- package/dist/filesystem/glob-scan.d.ts +6 -2
- package/dist/filesystem/glob-scan.js +12 -7
- package/dist/filesystem/path-patterns.d.ts +20 -0
- package/dist/filesystem/path-patterns.js +70 -0
- package/dist/index.js +51 -29
- package/dist/output/markdown-sections.d.ts +5 -0
- package/dist/output/markdown-sections.js +103 -0
- package/dist/output/markdown-toc.d.ts +31 -0
- package/dist/output/markdown-toc.js +287 -0
- package/dist/output/markdown.d.ts +5 -8
- package/dist/output/markdown.js +80 -127
- package/dist/output/produce-output.d.ts +4 -1
- package/dist/output/produce-output.js +6 -7
- package/dist/output/render-helpers.d.ts +4 -0
- package/dist/output/render-helpers.js +14 -0
- package/dist/output/text.d.ts +2 -2
- package/dist/output/text.js +47 -8
- package/dist/resolvers/js/resolve-alias.js +10 -41
- package/dist/resolvers/php/bindings.js +6 -6
- package/dist/resolvers/php/extract-imports.d.ts +19 -7
- package/dist/resolvers/php/extract-imports.js +146 -26
- package/dist/resolvers/php/php-resolver.js +55 -24
- package/dist/resolvers/php/psr4.d.ts +1 -1
- package/dist/resolvers/php/psr4.js +7 -1
- package/dist/runtime/shell-command-runner.d.ts +5 -0
- package/dist/runtime/shell-command-runner.js +118 -0
- package/dist/tracing/collect-trace.d.ts +10 -0
- package/dist/tracing/collect-trace.js +23 -0
- package/dist/tracing/exclude.d.ts +0 -5
- package/dist/tracing/exclude.js +16 -12
- package/dist/tracing/follow-chain.js +2 -2
- package/dist/types/app.types.d.ts +38 -8
- package/dist/types/artifact.types.d.ts +50 -0
- package/dist/types/artifact.types.js +2 -0
- package/dist/types/cli.types.d.ts +52 -4
- package/dist/types/config.types.d.ts +37 -20
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/output.types.d.ts +12 -3
- package/dist/types/planner.types.d.ts +76 -0
- package/dist/types/planner.types.js +2 -0
- package/dist/types/resolver.types.d.ts +1 -1
- package/dist/types/tracing.types.d.ts +0 -11
- package/package.json +2 -2
- package/schema/prodex.schema.json +59 -41
- package/dist/app/run-plans.d.ts +0 -11
- package/dist/app/run-plans.js +0 -61
- package/dist/commands/profiles-command.d.ts +0 -6
- package/dist/commands/profiles-command.js +0 -16
- package/dist/commands/run-command.js +0 -17
- package/dist/config/build-config.d.ts +0 -13
- package/dist/config/build-config.js +0 -127
- package/dist/tracing/include-files.d.ts +0 -2
- package/dist/tracing/include-files.js +0 -36
- package/dist/tracing/trace-run.d.ts +0 -2
- package/dist/tracing/trace-run.js +0 -21
package/README.md
CHANGED
|
@@ -1,237 +1,460 @@
|
|
|
1
1
|
# Prodex
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Prodex packages the code an AI tool, reviewer, or teammate needs to see into readable Markdown or TXT.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use it to snapshot Git changes, collect files by search, save repeatable scopes, attach command output, or gather explicit files — without copy-pasting half your repo into a chat window.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g prodex
|
|
11
|
+
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Or run it ad hoc without installing:
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
```bash
|
|
16
|
+
npx prodex git --against origin/main
|
|
17
|
+
```
|
|
14
18
|
|
|
15
|
-
|
|
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.
|
|
19
|
+
Create a starter config:
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
```bash
|
|
22
|
+
prodex init
|
|
23
|
+
```
|
|
22
24
|
|
|
23
|
-
##
|
|
25
|
+
## Quick Start
|
|
24
26
|
|
|
25
27
|
```bash
|
|
26
|
-
|
|
28
|
+
# Package all files changed in your current branch vs. origin/main
|
|
29
|
+
prodex git --against origin/main
|
|
30
|
+
|
|
31
|
+
# Include the diff beside the changed files
|
|
32
|
+
prodex git --changed --include-diff
|
|
33
|
+
|
|
34
|
+
# Collect every file that references a term or symbol
|
|
35
|
+
prodex grep --query "StripeWebhookHandler"
|
|
36
|
+
|
|
37
|
+
# Run a saved context selection
|
|
38
|
+
prodex scope -k billing
|
|
39
|
+
|
|
40
|
+
# Attach test output beside the code
|
|
41
|
+
prodex scope -k auth --cmd "npm test -- auth"
|
|
42
|
+
|
|
43
|
+
# Collect explicit files without dependency tracing
|
|
44
|
+
prodex pack -i src/config/database.ts,src/models/User.ts,docs/schema.md
|
|
45
|
+
|
|
46
|
+
# Trace imports from an entry file (JS, TS, PHP)
|
|
47
|
+
prodex trace -t src/api/router.ts
|
|
27
48
|
```
|
|
28
49
|
|
|
29
|
-
|
|
50
|
+
By default, commands write a versioned Markdown file to `./prodex/`. You can switch to TXT with `--format txt`. Output filenames include a `-trace` suffix and a timestamp when versioning is enabled (e.g. `billing-trace_260620-0430.md`). The output includes a file index, line ranges, and the collected source content in a single readable document.
|
|
51
|
+
|
|
52
|
+
## Common Workflows
|
|
30
53
|
|
|
31
|
-
|
|
54
|
+
### Review your current branch against origin/main
|
|
32
55
|
|
|
33
56
|
```bash
|
|
34
|
-
prodex
|
|
57
|
+
prodex git --against origin/main
|
|
35
58
|
```
|
|
36
59
|
|
|
37
|
-
|
|
60
|
+
Snapshots every file changed between your current HEAD and the merge-base with `origin/main`. Good for pre-PR review or sending a branch summary to an AI assistant.
|
|
38
61
|
|
|
39
|
-
|
|
62
|
+
### Include the diff beside changed files
|
|
40
63
|
|
|
41
|
-
|
|
64
|
+
```bash
|
|
65
|
+
prodex git --changed --include-diff
|
|
66
|
+
```
|
|
42
67
|
|
|
43
|
-
|
|
68
|
+
Includes the raw Git diff in the output alongside the collected files. In working-tree mode, two diff sections are added: one for unstaged changes and one for staged changes.
|
|
69
|
+
|
|
70
|
+
### Collect files by search
|
|
44
71
|
|
|
45
72
|
```bash
|
|
46
|
-
prodex
|
|
47
|
-
prodex
|
|
48
|
-
prodex
|
|
49
|
-
prodex profiles
|
|
73
|
+
prodex grep --query "legacyPaymentClient"
|
|
74
|
+
prodex grep --any "AuthService,SessionManager"
|
|
75
|
+
prodex grep --regex "use.*Repository"
|
|
50
76
|
```
|
|
51
77
|
|
|
52
|
-
|
|
78
|
+
Finds files containing the term or pattern and packages them into one document. Use this when the files you need are spread across the codebase and defined by what they reference, not where they live.
|
|
53
79
|
|
|
54
|
-
|
|
80
|
+
### Run a saved scope
|
|
55
81
|
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
}
|
|
82
|
+
```bash
|
|
83
|
+
prodex scope -k billing
|
|
84
|
+
prodex scope -k auth,billing
|
|
85
|
+
prodex scope --all
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Runs a named context selection you configured in `prodex.json`. Scopes are the repeatable version of an ad hoc command — same files, every time, no manual reassembly.
|
|
89
|
+
|
|
90
|
+
### Attach command output beside the code
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
prodex scope -k auth --cmd "npm test -- auth"
|
|
94
|
+
prodex git --against origin/main --cmd "npm run lint"
|
|
88
95
|
```
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
Runs the command after collecting files and embeds its output in the document. The AI sees the failing test or lint result right next to the source that produced it.
|
|
98
|
+
|
|
99
|
+
### Collect explicit files
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
prodex pack -i src/config/database.ts,src/models/User.ts,docs/schema.md
|
|
103
|
+
prodex pack -i "app/Http/Controllers/**"
|
|
104
|
+
```
|
|
91
105
|
|
|
92
|
-
|
|
106
|
+
Adds files directly by path or glob without dependency tracing. Use this when you know exactly which files you want and do not need imports followed automatically.
|
|
93
107
|
|
|
94
|
-
|
|
108
|
+
### Trace imports from an entry file
|
|
95
109
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- Syntax-highlighted code fences where possible
|
|
101
|
-
- The collected source content in one readable bundle
|
|
110
|
+
```bash
|
|
111
|
+
prodex trace -t src/api/router.ts
|
|
112
|
+
prodex pack -e app/Http/Controllers/CheckoutController.php
|
|
113
|
+
```
|
|
102
114
|
|
|
103
|
-
|
|
115
|
+
Follows import and require statements from the entry file to collect the files it depends on. Supported for JavaScript, TypeScript, TSX, declaration files, and PHP. See [Dependency Tracing](#dependency-tracing) for current language support details.
|
|
104
116
|
|
|
105
|
-
|
|
117
|
+
`prodex trace` resolves targets by exact path, extensionless name, or bare module name — it does not accept glob patterns. Use `prodex pack --entry <glob>` to collect files by glob.
|
|
106
118
|
|
|
107
|
-
|
|
119
|
+
## How Prodex Collects Context
|
|
108
120
|
|
|
109
|
-
|
|
121
|
+
Prodex can collect context from Git changes, search results, saved scopes, explicit files, or traced entrypoints. Command output can be attached to any run.
|
|
110
122
|
|
|
111
|
-
|
|
123
|
+
### Git
|
|
112
124
|
|
|
113
|
-
|
|
125
|
+
`prodex git` reads your repository's Git history or working tree and snapshots the files involved.
|
|
126
|
+
|
|
127
|
+
Working-tree modes read file contents from disk:
|
|
128
|
+
- `--changed` (default): staged, unstaged, and untracked files
|
|
129
|
+
- `--staged`: staged files only
|
|
130
|
+
- `--unstaged`: unstaged files only
|
|
131
|
+
- `--untracked`: untracked files only
|
|
132
|
+
|
|
133
|
+
Historical modes read file contents from Git instead of the working tree:
|
|
134
|
+
- `--commit <rev>`: files changed by one commit; contents from that commit
|
|
135
|
+
- `--range <base..head>` or `<base...head>`: files changed between two refs; contents from `head`
|
|
136
|
+
- `--against <base>`: files changed between the merge-base of `<base>` and `HEAD`; contents from `HEAD`
|
|
137
|
+
|
|
138
|
+
Add `--include-diff` to any git run to include the raw diff output alongside the file contents. In working-tree mode this adds two sections — one for unstaged changes (`Full Diff`) and one for staged changes (`Cached Full Diff`).
|
|
139
|
+
|
|
140
|
+
### Search
|
|
141
|
+
|
|
142
|
+
`prodex grep` searches your project for files containing a term or pattern and packages the matching files.
|
|
143
|
+
|
|
144
|
+
Search modes:
|
|
145
|
+
- `--query <text>`: files containing a fixed string
|
|
146
|
+
- `--any <list>`: files containing any of the terms (OR)
|
|
147
|
+
- `--all <list>`: files containing all of the terms (AND)
|
|
148
|
+
- `--regex <pattern>`: files matching a regular expression
|
|
149
|
+
|
|
150
|
+
Narrow the search with `--within <path>` or exclude paths with `--skip <path>`. Filter out files whose contents contain a term using `--not <text>`.
|
|
151
|
+
|
|
152
|
+
### Scopes
|
|
153
|
+
|
|
154
|
+
Saved named selections in `prodex.json`. See [Saved Scopes](#saved-scopes).
|
|
155
|
+
|
|
156
|
+
### Pack
|
|
157
|
+
|
|
158
|
+
`prodex pack` accepts `--include` for direct file collection, `--entry` to trace imports from an entry file, or both together. It is the same tracing engine as `prodex trace` with the option to mix in explicit files in the same run.
|
|
159
|
+
|
|
160
|
+
### Command Output
|
|
161
|
+
|
|
162
|
+
`--cmd` runs a shell command after files are collected and embeds the output in the document. See [Command Attachments](#command-attachments).
|
|
163
|
+
|
|
164
|
+
## Saved Scopes
|
|
165
|
+
|
|
166
|
+
Scopes are named, reusable context selections you configure once in `prodex.json` and run any time.
|
|
167
|
+
|
|
168
|
+
A scope can collect files in two ways:
|
|
169
|
+
|
|
170
|
+
- **By path**: select files and folders you know by name.
|
|
171
|
+
- **By search**: select files by what they contain.
|
|
114
172
|
|
|
115
173
|
```bash
|
|
116
|
-
|
|
174
|
+
prodex scope -k dashboard # run one scope
|
|
175
|
+
prodex scope -k auth,billing # run multiple
|
|
176
|
+
prodex scope --all # run all configured scopes
|
|
177
|
+
prodex scope --list # show available scope keys
|
|
117
178
|
```
|
|
118
179
|
|
|
119
|
-
|
|
180
|
+
### File scope example
|
|
120
181
|
|
|
121
|
-
|
|
122
|
-
|
|
182
|
+
Selects files by path, with optional dependency tracing from `entry` files:
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"version": 5,
|
|
187
|
+
"scopes": {
|
|
188
|
+
"dashboard": {
|
|
189
|
+
"entry": ["resources/js/pages/Dashboard.tsx"],
|
|
190
|
+
"include": ["routes/web.php"],
|
|
191
|
+
"exclude": ["resources/js/components/ui"]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
123
195
|
```
|
|
124
196
|
|
|
125
|
-
|
|
197
|
+
`entry` traces imports. `include` adds files directly. Both are optional — a scope can use either or both.
|
|
126
198
|
|
|
127
|
-
|
|
128
|
-
|
|
199
|
+
### Search scope example
|
|
200
|
+
|
|
201
|
+
Selects files by what they contain:
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"version": 5,
|
|
206
|
+
"scopes": {
|
|
207
|
+
"payments": {
|
|
208
|
+
"grep": {
|
|
209
|
+
"query": "StripeWebhookHandler",
|
|
210
|
+
"within": ["app", "tests"],
|
|
211
|
+
"skip": ["vendor"]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
129
216
|
```
|
|
130
217
|
|
|
131
|
-
|
|
218
|
+
Search scope options under `grep`:
|
|
219
|
+
- `query`: fixed-string match
|
|
220
|
+
- `any`: list — files containing any term
|
|
221
|
+
- `all`: list — files containing all terms
|
|
222
|
+
- `regex`: regular expression
|
|
223
|
+
- `not`: filter out files whose contents contain these terms
|
|
224
|
+
- `within`: search only these paths
|
|
225
|
+
- `skip`: skip these paths
|
|
132
226
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
227
|
+
A scope can collect by path using `entry` and/or `include`, or by search using `grep`. A search scope may also use `include` for extra files, but it cannot define `entry`.
|
|
228
|
+
|
|
229
|
+
### Scope keys and names
|
|
230
|
+
|
|
231
|
+
The scope key is the identifier used in CLI selection. The optional `name` field sets the output filename:
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
"scopes": {
|
|
235
|
+
"dashboard": {
|
|
236
|
+
"name": "frontend-dashboard",
|
|
237
|
+
"entry": ["resources/js/pages/Dashboard.tsx"]
|
|
238
|
+
}
|
|
239
|
+
}
|
|
141
240
|
```
|
|
142
241
|
|
|
143
|
-
|
|
242
|
+
```bash
|
|
243
|
+
prodex scope -k dashboard # output filename: frontend-dashboard
|
|
244
|
+
```
|
|
144
245
|
|
|
145
|
-
|
|
246
|
+
If `name` is omitted, the scope key is used as the output filename.
|
|
146
247
|
|
|
147
|
-
|
|
148
|
-
| --- | --- | --- | --- |
|
|
149
|
-
| `--entry` | `-e` | list | Entry file or glob to trace. Repeatable and comma-aware. |
|
|
150
|
-
| `--include` | `-i` | list | Extra file or glob to add without dependency tracing. Repeatable and comma-aware. |
|
|
151
|
-
| `--exclude` | `-x` | list | File or glob to skip during traversal. Repeatable and comma-aware. |
|
|
152
|
-
| `--profile` | `-p` | list | Named profile to run. Comma-aware and repeatable. |
|
|
153
|
-
| `--all-profiles` | | boolean | Run every configured profile. |
|
|
154
|
-
| `--name` | `-n` | string | Output basename for this run. |
|
|
155
|
-
| `--format` | `-F` | `md`/`txt` | Output format. Markdown is the default. |
|
|
156
|
-
| `--max-depth` | | number | Maximum dependency traversal depth. |
|
|
157
|
-
| `--max-files` | | number | Maximum traced file count. |
|
|
158
|
-
| `--debug` | `-d` | boolean | Emit debug logs during traversal. |
|
|
248
|
+
## Command Attachments
|
|
159
249
|
|
|
160
|
-
|
|
250
|
+
Add `--cmd` to any run to capture shell command output and embed it in the document alongside the collected files.
|
|
161
251
|
|
|
162
252
|
```bash
|
|
163
|
-
prodex --
|
|
164
|
-
prodex run
|
|
165
|
-
prodex
|
|
166
|
-
prodex migrate --help
|
|
253
|
+
prodex scope -k auth --cmd "npm test -- auth"
|
|
254
|
+
prodex git --against origin/main --cmd "npm run lint"
|
|
255
|
+
prodex pack -e src/index.ts --cmd "npm run build"
|
|
167
256
|
```
|
|
168
257
|
|
|
258
|
+
`--cmd` is repeatable. Commands run sequentially after files are collected, and each output is included as a separate section.
|
|
259
|
+
|
|
260
|
+
By default, a failed command adds a warning but still produces the output file. Use `--fail-on-cmd-error` to exit with an error instead.
|
|
261
|
+
|
|
262
|
+
Use `--dry-run` to preview which commands would run without executing them.
|
|
263
|
+
|
|
264
|
+
## Dependency Tracing
|
|
265
|
+
|
|
266
|
+
`prodex pack --entry` and `prodex trace` follow import statements from an entry file to collect the files it depends on.
|
|
267
|
+
|
|
268
|
+
**Currently supported:**
|
|
269
|
+
|
|
270
|
+
- JavaScript and TypeScript: ES module imports, dynamic imports, CommonJS `require`, re-exports
|
|
271
|
+
- TSX and declaration files (`.d.ts`)
|
|
272
|
+
- PHP: static `include`/`require` statements, namespace imports, PSR-4 resolution, some Laravel service binding awareness
|
|
273
|
+
|
|
274
|
+
**Limitations:**
|
|
275
|
+
|
|
276
|
+
- Dynamic imports that are computed at runtime may not be followed
|
|
277
|
+
- Framework-injected dependencies (e.g., auto-resolved services, IoC containers) may not be resolved automatically
|
|
278
|
+
- Languages other than JS, TS, TSX, and PHP are not traced — use `--include` or a file scope to add those files directly
|
|
279
|
+
|
|
280
|
+
When tracing does not follow a relationship, add the file manually with `--include` or in the scope's `include` list. Prodex does not attempt to guess at runtime behaviour.
|
|
281
|
+
|
|
169
282
|
## Configuration
|
|
170
283
|
|
|
171
|
-
Prodex reads `prodex.json` from the project root.
|
|
284
|
+
Prodex reads `prodex.json` from the project root. All fields are optional — Prodex works without a config file.
|
|
172
285
|
|
|
173
286
|
```json
|
|
174
287
|
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
"maxDepth": 10,
|
|
190
|
-
"maxFiles": 200
|
|
191
|
-
},
|
|
192
|
-
"profiles": {}
|
|
288
|
+
"version": 5,
|
|
289
|
+
"$schema": "https://raw.githubusercontent.com/emxhive/prodex/main/schema/prodex.schema.json",
|
|
290
|
+
"output": {
|
|
291
|
+
"dir": "prodex",
|
|
292
|
+
"format": "md",
|
|
293
|
+
"versioned": true
|
|
294
|
+
},
|
|
295
|
+
"exclude": ["node_modules", "vendor", "dist"],
|
|
296
|
+
"aliases": {
|
|
297
|
+
"@": "resources/js"
|
|
298
|
+
},
|
|
299
|
+
"depth": 2,
|
|
300
|
+
"scopes": {}
|
|
193
301
|
}
|
|
194
302
|
```
|
|
195
303
|
|
|
196
|
-
|
|
304
|
+
`exclude`, `include`, and similar path fields accept file paths, folder names, or glob patterns.
|
|
197
305
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
306
|
+
**Naming precedence** (highest to lowest):
|
|
307
|
+
|
|
308
|
+
1. `--name` flag
|
|
309
|
+
2. `scope.name` in config
|
|
310
|
+
3. Scope key, when running a configured scope
|
|
311
|
+
4. Automatic name derived from entries
|
|
202
312
|
5. Internal fallback: `combined`
|
|
203
313
|
|
|
204
|
-
CLI flags override config values for a run.
|
|
314
|
+
CLI flags override config values for a run. Excludes are additive: root excludes, scope excludes, and CLI excludes are all applied together.
|
|
205
315
|
|
|
206
|
-
##
|
|
316
|
+
## CLI Reference
|
|
317
|
+
|
|
318
|
+
### `git` — Snapshot Git changes
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
prodex git [root] --against <base>
|
|
322
|
+
prodex git [root] --changed
|
|
323
|
+
prodex git [root] --staged
|
|
324
|
+
prodex git [root] --unstaged
|
|
325
|
+
prodex git [root] --untracked
|
|
326
|
+
prodex git [root] --commit <rev>
|
|
327
|
+
prodex git [root] --range <base..head>
|
|
328
|
+
prodex git [root] --range <base...head>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
| Flag | Type | Description |
|
|
332
|
+
|---|---|---|
|
|
333
|
+
| `--changed` | boolean | Staged, unstaged, and untracked files (default) |
|
|
334
|
+
| `--staged` | boolean | Staged files only |
|
|
335
|
+
| `--unstaged` | boolean | Unstaged files only |
|
|
336
|
+
| `--untracked` | boolean | Untracked files only |
|
|
337
|
+
| `--commit <rev>` | string | Files changed by one commit; contents from that commit |
|
|
338
|
+
| `--range <spec>` | string | Files changed between two refs; contents from head |
|
|
339
|
+
| `--against <base>` | string | Files changed between merge-base and HEAD |
|
|
340
|
+
| `--include-diff` | boolean | Include full diff output in the document |
|
|
341
|
+
| `--include` / `-i` | list | Extra files to add |
|
|
342
|
+
| `--exclude` / `-x` | list | Files or paths to skip |
|
|
343
|
+
| `--name` / `-n` | string | Output filename |
|
|
344
|
+
| `--format` / `-F` | `md`/`txt` | Output format |
|
|
345
|
+
| `--cmd` | list | Command to run and embed. Repeatable. |
|
|
346
|
+
| `--fail-on-cmd-error` | boolean | Exit nonzero if an attached command fails |
|
|
347
|
+
| `--dry-run` | boolean | Preview without writing output |
|
|
348
|
+
|
|
349
|
+
### `grep` — Collect files by search
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
prodex grep [root] --query <text>
|
|
353
|
+
prodex grep [root] --any <term,term,...>
|
|
354
|
+
prodex grep [root] --all <term,term,...>
|
|
355
|
+
prodex grep [root] --regex <pattern>
|
|
356
|
+
```
|
|
207
357
|
|
|
208
|
-
|
|
358
|
+
| Flag | Short | Type | Description |
|
|
359
|
+
|---|---|---|---|
|
|
360
|
+
| `--query` | `-q` | string | Fixed-string search |
|
|
361
|
+
| `--any` | | list | Files containing any of the terms (OR) |
|
|
362
|
+
| `--all` | | list | Files containing all of the terms (AND) |
|
|
363
|
+
| `--regex` | `-r` | string | Regular expression search |
|
|
364
|
+
| `--not` | | list | Filter out files whose contents contain these terms |
|
|
365
|
+
| `--within` | | list | Search only inside these paths |
|
|
366
|
+
| `--skip` | | list | Skip these paths during search |
|
|
367
|
+
| `--include` | `-i` | list | Add extra files |
|
|
368
|
+
| `--exclude` | `-x` | list | Skip these files |
|
|
369
|
+
| `--name` | `-n` | string | Output filename |
|
|
370
|
+
| `--format` | `-F` | `md`/`txt` | Output format |
|
|
371
|
+
| `--cmd` | | list | Command to run and embed. Repeatable. |
|
|
372
|
+
| `--fail-on-cmd-error` | | boolean | Exit nonzero if an attached command fails |
|
|
373
|
+
| `--dry-run` | | boolean | Preview without writing output |
|
|
374
|
+
|
|
375
|
+
### `scope` — Run saved scopes
|
|
209
376
|
|
|
210
|
-
|
|
377
|
+
```bash
|
|
378
|
+
prodex scope [root] -k <key>
|
|
379
|
+
prodex scope [root] -k <key,key,...>
|
|
380
|
+
prodex scope [root] --all
|
|
381
|
+
prodex scope [root] --list
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
| Flag | Short | Type | Description |
|
|
385
|
+
|---|---|---|---|
|
|
386
|
+
| `--key` | `-k` | list | Scope key to run. Comma-aware and repeatable. |
|
|
387
|
+
| `--all` | `-a` | boolean | Run all configured scopes |
|
|
388
|
+
| `--list` | | boolean | List configured scope keys |
|
|
389
|
+
| `--exclude` | `-x` | list | Additional paths to skip |
|
|
390
|
+
| `--format` | `-F` | `md`/`txt` | Output format |
|
|
391
|
+
| `--cmd` | | list | Command to run and embed. Repeatable. |
|
|
392
|
+
| `--fail-on-cmd-error` | | boolean | Exit nonzero if an attached command fails |
|
|
393
|
+
| `--dry-run` | | boolean | Preview without writing output |
|
|
394
|
+
|
|
395
|
+
### `pack` — Collect explicit files or combine sources
|
|
211
396
|
|
|
212
397
|
```bash
|
|
213
|
-
prodex
|
|
398
|
+
prodex pack [root] -i <glob>
|
|
399
|
+
prodex pack [root] -e <entry> -i <glob>
|
|
214
400
|
```
|
|
215
401
|
|
|
216
|
-
|
|
402
|
+
| Flag | Short | Type | Description |
|
|
403
|
+
|---|---|---|---|
|
|
404
|
+
| `--entry` | `-e` | list | Entry file to trace imports from. Repeatable and comma-aware. |
|
|
405
|
+
| `--include` | `-i` | list | File or glob to add without tracing. Repeatable and comma-aware. |
|
|
406
|
+
| `--exclude` | `-x` | list | File or path to skip. |
|
|
407
|
+
| `--scope` | `-s` | list | Merge a configured scope's files into this pack. |
|
|
408
|
+
| `--name` | `-n` | string | Output filename |
|
|
409
|
+
| `--format` | `-F` | `md`/`txt` | Output format |
|
|
410
|
+
| `--depth` | | number | Maximum tracing depth |
|
|
411
|
+
| `--cmd` | | list | Command to run and embed. Repeatable. |
|
|
412
|
+
| `--fail-on-cmd-error` | | boolean | Exit nonzero if an attached command fails |
|
|
413
|
+
| `--dry-run` | | boolean | Preview without writing output |
|
|
414
|
+
|
|
415
|
+
### `trace` — Trace imports from an entry file
|
|
217
416
|
|
|
218
417
|
```bash
|
|
219
|
-
prodex
|
|
418
|
+
prodex trace [root] -t <file>
|
|
220
419
|
```
|
|
221
420
|
|
|
222
|
-
|
|
421
|
+
| Flag | Short | Type | Description |
|
|
422
|
+
|---|---|---|---|
|
|
423
|
+
| `--target` | `-t` | list | File or module name to trace from. Accepts exact paths, extensionless names, or bare module names — not globs. Repeatable and comma-aware. |
|
|
424
|
+
| `--include` | `-i` | list | Extra files to add |
|
|
425
|
+
| `--exclude` | `-x` | list | Files or paths to skip |
|
|
426
|
+
| `--name` | `-n` | string | Output filename |
|
|
427
|
+
| `--format` | `-F` | `md`/`txt` | Output format |
|
|
428
|
+
| `--depth` | | number | Maximum tracing depth |
|
|
429
|
+
| `--cmd` | | list | Command to run and embed. Repeatable. |
|
|
430
|
+
| `--fail-on-cmd-error` | | boolean | Exit nonzero if an attached command fails |
|
|
431
|
+
| `--dry-run` | | boolean | Preview without writing output |
|
|
432
|
+
|
|
433
|
+
### Global flags
|
|
223
434
|
|
|
224
435
|
```bash
|
|
225
|
-
prodex
|
|
436
|
+
prodex --version
|
|
437
|
+
prodex --help
|
|
438
|
+
prodex <command> --help
|
|
226
439
|
```
|
|
227
440
|
|
|
228
|
-
|
|
441
|
+
## Migrating Configs
|
|
442
|
+
|
|
443
|
+
Prodex requires config version 5. If your project has an older `prodex.json`, Prodex will fail with a prompt to migrate.
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
prodex migrate # preview the migration
|
|
447
|
+
prodex migrate --check # exit nonzero if migration is needed
|
|
448
|
+
prodex migrate --write # apply the migration (creates a backup first)
|
|
449
|
+
```
|
|
229
450
|
|
|
230
451
|
## Requirements
|
|
231
452
|
|
|
232
|
-
- Node.js
|
|
233
|
-
-
|
|
234
|
-
-
|
|
453
|
+
- Node.js 22+
|
|
454
|
+
- `prodex.json` is optional; Prodex works without one
|
|
455
|
+
- Dependency tracing requires JS, TS, TSX, or PHP entrypoints
|
|
456
|
+
- Any file type can be collected with `--include`, `prodex grep`, or a saved scope
|
|
457
|
+
- `prodex grep` and search scopes require [ripgrep](https://github.com/BurntSushi/ripgrep) (`rg`) to be installed and available on your PATH
|
|
235
458
|
|
|
236
459
|
## License
|
|
237
460
|
|