prodex 2.0.1 → 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 +367 -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 -37
- 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 -8
- 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 +35 -23
- 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 +37 -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/dist/cli/flag-specs.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { ProdexFlags } from "../types";
|
|
2
|
-
export type FlagName = keyof ProdexFlags | "help" | "version" | "profile" | "
|
|
2
|
+
export type FlagName = keyof ProdexFlags | "help" | "version" | "write" | "check" | "profile" | "allProfiles" | "maxDepth";
|
|
3
3
|
export type FlagSpec = {
|
|
4
4
|
long: FlagName;
|
|
5
5
|
short?: string;
|
|
6
|
-
type: "boolean" | "string" | "number" | "list";
|
|
6
|
+
type: "boolean" | "string" | "number" | "list" | "raw-list";
|
|
7
7
|
};
|
|
8
|
-
export declare const COMMANDS: readonly ["
|
|
8
|
+
export declare const COMMANDS: readonly ["pack", "trace", "scope", "git", "grep", "init", "migrate", "run", "profiles"];
|
|
9
9
|
export declare const FLAGS: FlagSpec[];
|
|
10
|
+
export declare const GREP_FLAGS: FlagSpec[];
|
|
10
11
|
export declare const FLAG_ALIASES: Record<string, FlagName>;
|
|
12
|
+
export declare const GREP_FLAG_ALIASES: Record<string, FlagName>;
|
|
11
13
|
export declare const FLAGS_BY_LONG: Map<FlagName, FlagSpec>;
|
|
12
14
|
export declare const FLAGS_BY_SHORT: Map<string, FlagSpec>;
|
|
15
|
+
export declare const GREP_FLAGS_BY_LONG: Map<FlagName, FlagSpec>;
|
|
16
|
+
export declare const GREP_FLAGS_BY_SHORT: Map<string, FlagSpec>;
|
package/dist/cli/flag-specs.js
CHANGED
|
@@ -1,28 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FLAGS_BY_SHORT = exports.FLAGS_BY_LONG = exports.FLAG_ALIASES = exports.FLAGS = exports.COMMANDS = void 0;
|
|
4
|
-
exports.COMMANDS = ["
|
|
3
|
+
exports.GREP_FLAGS_BY_SHORT = exports.GREP_FLAGS_BY_LONG = exports.FLAGS_BY_SHORT = exports.FLAGS_BY_LONG = exports.GREP_FLAG_ALIASES = exports.FLAG_ALIASES = exports.GREP_FLAGS = exports.FLAGS = exports.COMMANDS = void 0;
|
|
4
|
+
exports.COMMANDS = ["pack", "trace", "scope", "git", "grep", "init", "migrate", "run", "profiles"];
|
|
5
5
|
exports.FLAGS = [
|
|
6
6
|
{ long: "entry", short: "e", type: "list" },
|
|
7
|
+
{ long: "target", short: "t", type: "list" },
|
|
7
8
|
{ long: "include", short: "i", type: "list" },
|
|
8
9
|
{ long: "exclude", short: "x", type: "list" },
|
|
9
|
-
{ long: "profile", short: "p", type: "list" },
|
|
10
|
-
{ long: "allProfiles", short: "a", type: "boolean" },
|
|
11
10
|
{ long: "name", short: "n", type: "string" },
|
|
12
11
|
{ long: "format", short: "F", type: "string" },
|
|
13
|
-
{ long: "
|
|
12
|
+
{ long: "depth", short: "d", type: "number" },
|
|
14
13
|
{ long: "maxFiles", type: "number" },
|
|
15
|
-
{ long: "debug",
|
|
14
|
+
{ long: "debug", type: "boolean" },
|
|
15
|
+
{ long: "scope", short: "s", type: "list" },
|
|
16
|
+
{ long: "key", short: "k", type: "list" },
|
|
17
|
+
{ long: "all", short: "a", type: "boolean" },
|
|
18
|
+
{ long: "list", type: "boolean" },
|
|
19
|
+
{ long: "dryRun", type: "boolean" },
|
|
20
|
+
{ long: "cmd", type: "raw-list" },
|
|
21
|
+
{ long: "cmdTimeout", type: "number" },
|
|
22
|
+
{ long: "failOnCmdError", type: "boolean" },
|
|
16
23
|
{ long: "write", type: "boolean" },
|
|
17
24
|
{ long: "check", type: "boolean" },
|
|
18
25
|
{ long: "help", short: "h", type: "boolean" },
|
|
19
26
|
{ long: "version", short: "v", type: "boolean" },
|
|
27
|
+
// Git specific flags
|
|
28
|
+
{ long: "changed", type: "boolean" },
|
|
29
|
+
{ long: "staged", type: "boolean" },
|
|
30
|
+
{ long: "unstaged", type: "boolean" },
|
|
31
|
+
{ long: "untracked", type: "boolean" },
|
|
32
|
+
{ long: "includeDiff", type: "boolean" },
|
|
33
|
+
{ long: "commit", type: "string" },
|
|
34
|
+
{ long: "range", type: "string" },
|
|
35
|
+
{ long: "against", type: "string" },
|
|
36
|
+
// Deprecated / legacy flags (parsed to return guided errors)
|
|
37
|
+
{ long: "profile", short: "p", type: "list" },
|
|
38
|
+
{ long: "allProfiles", type: "boolean" },
|
|
39
|
+
{ long: "maxDepth", type: "number" },
|
|
40
|
+
];
|
|
41
|
+
exports.GREP_FLAGS = [
|
|
42
|
+
{ long: "query", short: "q", type: "string" },
|
|
43
|
+
{ long: "any", type: "list" },
|
|
44
|
+
{ long: "grepAll", type: "list" },
|
|
45
|
+
{ long: "regex", short: "r", type: "string" },
|
|
46
|
+
{ long: "not", type: "list" },
|
|
47
|
+
{ long: "within", type: "list" },
|
|
48
|
+
{ long: "skip", type: "list" },
|
|
49
|
+
{ long: "name", short: "n", type: "string" },
|
|
50
|
+
{ long: "format", short: "F", type: "string" },
|
|
51
|
+
{ long: "dryRun", type: "boolean" },
|
|
52
|
+
{ long: "include", short: "i", type: "list" },
|
|
53
|
+
{ long: "exclude", short: "x", type: "list" },
|
|
54
|
+
{ long: "cmd", type: "raw-list" },
|
|
55
|
+
{ long: "cmdTimeout", type: "number" },
|
|
56
|
+
{ long: "failOnCmdError", type: "boolean" },
|
|
57
|
+
{ long: "maxFiles", type: "number" },
|
|
58
|
+
{ long: "help", short: "h", type: "boolean" },
|
|
59
|
+
{ long: "version", short: "v", type: "boolean" },
|
|
60
|
+
{ long: "debug", type: "boolean" },
|
|
20
61
|
];
|
|
21
62
|
exports.FLAG_ALIASES = {
|
|
22
|
-
|
|
63
|
+
"max-files": "maxFiles",
|
|
64
|
+
"dry-run": "dryRun",
|
|
23
65
|
"all-profiles": "allProfiles",
|
|
24
66
|
"max-depth": "maxDepth",
|
|
25
|
-
"
|
|
67
|
+
"cmd-timeout": "cmdTimeout",
|
|
68
|
+
"fail-on-cmd-error": "failOnCmdError",
|
|
69
|
+
"include-diff": "includeDiff",
|
|
70
|
+
};
|
|
71
|
+
exports.GREP_FLAG_ALIASES = {
|
|
72
|
+
...exports.FLAG_ALIASES,
|
|
73
|
+
"all": "grepAll",
|
|
26
74
|
};
|
|
27
75
|
exports.FLAGS_BY_LONG = new Map(exports.FLAGS.map((flag) => [flag.long, flag]));
|
|
28
76
|
exports.FLAGS_BY_SHORT = new Map(exports.FLAGS.filter((flag) => flag.short).map((flag) => [flag.short, flag]));
|
|
77
|
+
exports.GREP_FLAGS_BY_LONG = new Map(exports.GREP_FLAGS.map((flag) => [flag.long, flag]));
|
|
78
|
+
exports.GREP_FLAGS_BY_SHORT = new Map(exports.GREP_FLAGS.filter((flag) => flag.short).map((flag) => [flag.short, flag]));
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { FlagName } from "./flag-specs";
|
|
2
|
+
export interface HelpFlagSpec {
|
|
3
|
+
long: FlagName;
|
|
4
|
+
description: string;
|
|
5
|
+
hint?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const PUBLIC_FLAGS: {
|
|
8
|
+
readonly entry: {
|
|
9
|
+
readonly long: "entry";
|
|
10
|
+
readonly description: "Entry file/glob. Repeatable and comma-aware.";
|
|
11
|
+
readonly hint: "<glob>";
|
|
12
|
+
};
|
|
13
|
+
readonly target: {
|
|
14
|
+
readonly long: "target";
|
|
15
|
+
readonly description: "Target file/module to resolve and trace from. Repeatable and comma-aware.";
|
|
16
|
+
readonly hint: "<target>";
|
|
17
|
+
};
|
|
18
|
+
readonly include: {
|
|
19
|
+
readonly long: "include";
|
|
20
|
+
readonly description: "Extra file/glob to append. Repeatable and comma-aware.";
|
|
21
|
+
readonly hint: "<glob>";
|
|
22
|
+
};
|
|
23
|
+
readonly exclude: {
|
|
24
|
+
readonly long: "exclude";
|
|
25
|
+
readonly description: "File/glob to skip. Repeatable and comma-aware.";
|
|
26
|
+
readonly hint: "<glob>";
|
|
27
|
+
};
|
|
28
|
+
readonly scope: {
|
|
29
|
+
readonly long: "scope";
|
|
30
|
+
readonly description: "Merge a configured scope's files.";
|
|
31
|
+
readonly hint: "<key>";
|
|
32
|
+
};
|
|
33
|
+
readonly name: {
|
|
34
|
+
readonly long: "name";
|
|
35
|
+
readonly description: "Output basename for this pack.";
|
|
36
|
+
readonly hint: "<name>";
|
|
37
|
+
};
|
|
38
|
+
readonly format: {
|
|
39
|
+
readonly long: "format";
|
|
40
|
+
readonly description: "Output format.";
|
|
41
|
+
readonly hint: "<md|txt>";
|
|
42
|
+
};
|
|
43
|
+
readonly depth: {
|
|
44
|
+
readonly long: "depth";
|
|
45
|
+
readonly description: "Maximum dependency traversal depth.";
|
|
46
|
+
readonly hint: "<number>";
|
|
47
|
+
};
|
|
48
|
+
readonly maxFiles: {
|
|
49
|
+
readonly long: "maxFiles";
|
|
50
|
+
readonly description: "Maximum traced file count.";
|
|
51
|
+
readonly hint: "<number>";
|
|
52
|
+
};
|
|
53
|
+
readonly dryRun: {
|
|
54
|
+
readonly long: "dryRun";
|
|
55
|
+
readonly description: "Perform a dry-run without writing output files.";
|
|
56
|
+
readonly hint: "";
|
|
57
|
+
};
|
|
58
|
+
readonly cmd: {
|
|
59
|
+
readonly long: "cmd";
|
|
60
|
+
readonly description: "Run command sequentially for evidence capture. Repeatable.";
|
|
61
|
+
readonly hint: "<command>";
|
|
62
|
+
};
|
|
63
|
+
readonly cmdTimeout: {
|
|
64
|
+
readonly long: "cmdTimeout";
|
|
65
|
+
readonly description: "Command execution timeout (default: 180).";
|
|
66
|
+
readonly hint: "<seconds>";
|
|
67
|
+
};
|
|
68
|
+
readonly failOnCmdError: {
|
|
69
|
+
readonly long: "failOnCmdError";
|
|
70
|
+
readonly description: "Enforce nonzero exit if commands fail.";
|
|
71
|
+
readonly hint: "";
|
|
72
|
+
};
|
|
73
|
+
readonly key: {
|
|
74
|
+
readonly long: "key";
|
|
75
|
+
readonly description: "Scope key to execute. Repeatable and comma-aware.";
|
|
76
|
+
readonly hint: "<key>";
|
|
77
|
+
};
|
|
78
|
+
readonly all: {
|
|
79
|
+
readonly long: "all";
|
|
80
|
+
readonly description: "Run all configured scopes.";
|
|
81
|
+
readonly hint: "";
|
|
82
|
+
};
|
|
83
|
+
readonly list: {
|
|
84
|
+
readonly long: "list";
|
|
85
|
+
readonly description: "List configured scope keys.";
|
|
86
|
+
readonly hint: "";
|
|
87
|
+
};
|
|
88
|
+
readonly write: {
|
|
89
|
+
readonly long: "write";
|
|
90
|
+
readonly description: "Back up and update prodex.json.";
|
|
91
|
+
readonly hint: "";
|
|
92
|
+
};
|
|
93
|
+
readonly check: {
|
|
94
|
+
readonly long: "check";
|
|
95
|
+
readonly description: "Exit nonzero if migration is required.";
|
|
96
|
+
readonly hint: "";
|
|
97
|
+
};
|
|
98
|
+
readonly help: {
|
|
99
|
+
readonly long: "help";
|
|
100
|
+
readonly description: "Show help.";
|
|
101
|
+
readonly hint: "";
|
|
102
|
+
};
|
|
103
|
+
readonly version: {
|
|
104
|
+
readonly long: "version";
|
|
105
|
+
readonly description: "Show version.";
|
|
106
|
+
readonly hint: "";
|
|
107
|
+
};
|
|
108
|
+
readonly changed: {
|
|
109
|
+
readonly long: "changed";
|
|
110
|
+
readonly description: "Include staged, unstaged, and untracked changes (default).";
|
|
111
|
+
readonly hint: "";
|
|
112
|
+
};
|
|
113
|
+
readonly staged: {
|
|
114
|
+
readonly long: "staged";
|
|
115
|
+
readonly description: "Include staged changes.";
|
|
116
|
+
readonly hint: "";
|
|
117
|
+
};
|
|
118
|
+
readonly unstaged: {
|
|
119
|
+
readonly long: "unstaged";
|
|
120
|
+
readonly description: "Include unstaged changes.";
|
|
121
|
+
readonly hint: "";
|
|
122
|
+
};
|
|
123
|
+
readonly untracked: {
|
|
124
|
+
readonly long: "untracked";
|
|
125
|
+
readonly description: "Include untracked files.";
|
|
126
|
+
readonly hint: "";
|
|
127
|
+
};
|
|
128
|
+
readonly includeDiff: {
|
|
129
|
+
readonly long: "includeDiff";
|
|
130
|
+
readonly description: "Include full git diff output in generic sections.";
|
|
131
|
+
readonly hint: "";
|
|
132
|
+
};
|
|
133
|
+
readonly commit: {
|
|
134
|
+
readonly long: "commit";
|
|
135
|
+
readonly description: "Snapshot files changed by a single commit.";
|
|
136
|
+
readonly hint: "<rev>";
|
|
137
|
+
};
|
|
138
|
+
readonly range: {
|
|
139
|
+
readonly long: "range";
|
|
140
|
+
readonly description: "Snapshot files changed between two commits (base..head or base...head).";
|
|
141
|
+
readonly hint: "<spec>";
|
|
142
|
+
};
|
|
143
|
+
readonly against: {
|
|
144
|
+
readonly long: "against";
|
|
145
|
+
readonly description: "Compare merge-base of <base> and HEAD against HEAD.";
|
|
146
|
+
readonly hint: "<base>";
|
|
147
|
+
};
|
|
148
|
+
readonly query: {
|
|
149
|
+
readonly long: "query";
|
|
150
|
+
readonly description: "fixed-string search";
|
|
151
|
+
readonly hint: "<text>";
|
|
152
|
+
};
|
|
153
|
+
readonly any: {
|
|
154
|
+
readonly long: "any";
|
|
155
|
+
readonly description: "OR fixed-string search";
|
|
156
|
+
readonly hint: "<list>";
|
|
157
|
+
};
|
|
158
|
+
readonly grepAll: {
|
|
159
|
+
readonly long: "grepAll";
|
|
160
|
+
readonly description: "AND fixed-string search";
|
|
161
|
+
readonly hint: "<list>";
|
|
162
|
+
};
|
|
163
|
+
readonly regex: {
|
|
164
|
+
readonly long: "regex";
|
|
165
|
+
readonly description: "regex search";
|
|
166
|
+
readonly hint: "<pattern>";
|
|
167
|
+
};
|
|
168
|
+
readonly not: {
|
|
169
|
+
readonly long: "not";
|
|
170
|
+
readonly description: "fixed-string negative file filter";
|
|
171
|
+
readonly hint: "<list>";
|
|
172
|
+
};
|
|
173
|
+
readonly within: {
|
|
174
|
+
readonly long: "within";
|
|
175
|
+
readonly description: "search only inside these paths/globs";
|
|
176
|
+
readonly hint: "<list>";
|
|
177
|
+
};
|
|
178
|
+
readonly skip: {
|
|
179
|
+
readonly long: "skip";
|
|
180
|
+
readonly description: "do not search inside these paths/globs";
|
|
181
|
+
readonly hint: "<list>";
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
export type PublicHelpFlagName = keyof typeof PUBLIC_FLAGS;
|
|
185
|
+
export type CommandHelpTopic = "pack" | "trace" | "scope" | "git" | "grep" | "migrate";
|
|
186
|
+
export declare const COMMAND_HELP_FLAGS: {
|
|
187
|
+
readonly pack: readonly ["entry", "include", "exclude", "scope", "name", "format", "depth", "dryRun", "cmd", "cmdTimeout", "failOnCmdError", "help"];
|
|
188
|
+
readonly trace: readonly ["target", "depth", "include", "exclude", "name", "format", "dryRun", "cmd", "cmdTimeout", "failOnCmdError", "help"];
|
|
189
|
+
readonly scope: readonly ["key", "all", "list", "exclude", "format", "dryRun", "cmd", "cmdTimeout", "failOnCmdError", "help"];
|
|
190
|
+
readonly git: readonly ["changed", "staged", "unstaged", "untracked", "commit", "range", "against", "includeDiff", "include", "exclude", "name", "format", "dryRun", "cmd", "cmdTimeout", "failOnCmdError", "help"];
|
|
191
|
+
readonly grep: readonly ["query", "any", "grepAll", "regex", "not", "within", "skip", "include", "exclude", "name", "format", "dryRun", "cmd", "cmdTimeout", "failOnCmdError", "help"];
|
|
192
|
+
readonly migrate: readonly ["write", "check"];
|
|
193
|
+
};
|
|
194
|
+
export declare const FLAG_DESCRIPTION_OVERRIDES: {
|
|
195
|
+
readonly trace: {
|
|
196
|
+
readonly name: "Output basename for this trace.";
|
|
197
|
+
readonly depth: "Dependency traversal depth. Defaults to configured depth.";
|
|
198
|
+
};
|
|
199
|
+
readonly git: {
|
|
200
|
+
readonly name: "Output basename for this run.";
|
|
201
|
+
};
|
|
202
|
+
readonly grep: {
|
|
203
|
+
readonly name: "Output basename for this run.";
|
|
204
|
+
};
|
|
205
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FLAG_DESCRIPTION_OVERRIDES = exports.COMMAND_HELP_FLAGS = exports.PUBLIC_FLAGS = void 0;
|
|
4
|
+
exports.PUBLIC_FLAGS = {
|
|
5
|
+
entry: { long: "entry", description: "Entry file/glob. Repeatable and comma-aware.", hint: "<glob>" },
|
|
6
|
+
target: { long: "target", description: "Target file/module to resolve and trace from. Repeatable and comma-aware.", hint: "<target>" },
|
|
7
|
+
include: { long: "include", description: "Extra file/glob to append. Repeatable and comma-aware.", hint: "<glob>" },
|
|
8
|
+
exclude: { long: "exclude", description: "File/glob to skip. Repeatable and comma-aware.", hint: "<glob>" },
|
|
9
|
+
scope: { long: "scope", description: "Merge a configured scope's files.", hint: "<key>" },
|
|
10
|
+
name: { long: "name", description: "Output basename for this pack.", hint: "<name>" },
|
|
11
|
+
format: { long: "format", description: "Output format.", hint: "<md|txt>" },
|
|
12
|
+
depth: { long: "depth", description: "Maximum dependency traversal depth.", hint: "<number>" },
|
|
13
|
+
maxFiles: { long: "maxFiles", description: "Maximum traced file count.", hint: "<number>" },
|
|
14
|
+
dryRun: { long: "dryRun", description: "Perform a dry-run without writing output files.", hint: "" },
|
|
15
|
+
cmd: { long: "cmd", description: "Run command sequentially for evidence capture. Repeatable.", hint: "<command>" },
|
|
16
|
+
cmdTimeout: { long: "cmdTimeout", description: "Command execution timeout (default: 180).", hint: "<seconds>" },
|
|
17
|
+
failOnCmdError: { long: "failOnCmdError", description: "Enforce nonzero exit if commands fail.", hint: "" },
|
|
18
|
+
key: { long: "key", description: "Scope key to execute. Repeatable and comma-aware.", hint: "<key>" },
|
|
19
|
+
all: { long: "all", description: "Run all configured scopes.", hint: "" },
|
|
20
|
+
list: { long: "list", description: "List configured scope keys.", hint: "" },
|
|
21
|
+
write: { long: "write", description: "Back up and update prodex.json.", hint: "" },
|
|
22
|
+
check: { long: "check", description: "Exit nonzero if migration is required.", hint: "" },
|
|
23
|
+
help: { long: "help", description: "Show help.", hint: "" },
|
|
24
|
+
version: { long: "version", description: "Show version.", hint: "" },
|
|
25
|
+
// Git specific flags
|
|
26
|
+
changed: { long: "changed", description: "Include staged, unstaged, and untracked changes (default).", hint: "" },
|
|
27
|
+
staged: { long: "staged", description: "Include staged changes.", hint: "" },
|
|
28
|
+
unstaged: { long: "unstaged", description: "Include unstaged changes.", hint: "" },
|
|
29
|
+
untracked: { long: "untracked", description: "Include untracked files.", hint: "" },
|
|
30
|
+
includeDiff: { long: "includeDiff", description: "Include full git diff output in generic sections.", hint: "" },
|
|
31
|
+
commit: { long: "commit", description: "Snapshot files changed by a single commit.", hint: "<rev>" },
|
|
32
|
+
range: { long: "range", description: "Snapshot files changed between two commits (base..head or base...head).", hint: "<spec>" },
|
|
33
|
+
against: { long: "against", description: "Compare merge-base of <base> and HEAD against HEAD.", hint: "<base>" },
|
|
34
|
+
// Grep specific flags
|
|
35
|
+
query: { long: "query", description: "fixed-string search", hint: "<text>" },
|
|
36
|
+
any: { long: "any", description: "OR fixed-string search", hint: "<list>" },
|
|
37
|
+
grepAll: { long: "grepAll", description: "AND fixed-string search", hint: "<list>" },
|
|
38
|
+
regex: { long: "regex", description: "regex search", hint: "<pattern>" },
|
|
39
|
+
not: { long: "not", description: "fixed-string negative file filter", hint: "<list>" },
|
|
40
|
+
within: { long: "within", description: "search only inside these paths/globs", hint: "<list>" },
|
|
41
|
+
skip: { long: "skip", description: "do not search inside these paths/globs", hint: "<list>" },
|
|
42
|
+
};
|
|
43
|
+
exports.COMMAND_HELP_FLAGS = {
|
|
44
|
+
pack: [
|
|
45
|
+
"entry",
|
|
46
|
+
"include",
|
|
47
|
+
"exclude",
|
|
48
|
+
"scope",
|
|
49
|
+
"name",
|
|
50
|
+
"format",
|
|
51
|
+
"depth",
|
|
52
|
+
"dryRun",
|
|
53
|
+
"cmd",
|
|
54
|
+
"cmdTimeout",
|
|
55
|
+
"failOnCmdError",
|
|
56
|
+
"help",
|
|
57
|
+
],
|
|
58
|
+
trace: [
|
|
59
|
+
"target",
|
|
60
|
+
"depth",
|
|
61
|
+
"include",
|
|
62
|
+
"exclude",
|
|
63
|
+
"name",
|
|
64
|
+
"format",
|
|
65
|
+
"dryRun",
|
|
66
|
+
"cmd",
|
|
67
|
+
"cmdTimeout",
|
|
68
|
+
"failOnCmdError",
|
|
69
|
+
"help",
|
|
70
|
+
],
|
|
71
|
+
scope: [
|
|
72
|
+
"key",
|
|
73
|
+
"all",
|
|
74
|
+
"list",
|
|
75
|
+
"exclude",
|
|
76
|
+
"format",
|
|
77
|
+
"dryRun",
|
|
78
|
+
"cmd",
|
|
79
|
+
"cmdTimeout",
|
|
80
|
+
"failOnCmdError",
|
|
81
|
+
"help",
|
|
82
|
+
],
|
|
83
|
+
git: [
|
|
84
|
+
"changed",
|
|
85
|
+
"staged",
|
|
86
|
+
"unstaged",
|
|
87
|
+
"untracked",
|
|
88
|
+
"commit",
|
|
89
|
+
"range",
|
|
90
|
+
"against",
|
|
91
|
+
"includeDiff",
|
|
92
|
+
"include",
|
|
93
|
+
"exclude",
|
|
94
|
+
"name",
|
|
95
|
+
"format",
|
|
96
|
+
"dryRun",
|
|
97
|
+
"cmd",
|
|
98
|
+
"cmdTimeout",
|
|
99
|
+
"failOnCmdError",
|
|
100
|
+
"help",
|
|
101
|
+
],
|
|
102
|
+
grep: [
|
|
103
|
+
"query",
|
|
104
|
+
"any",
|
|
105
|
+
"grepAll",
|
|
106
|
+
"regex",
|
|
107
|
+
"not",
|
|
108
|
+
"within",
|
|
109
|
+
"skip",
|
|
110
|
+
"include",
|
|
111
|
+
"exclude",
|
|
112
|
+
"name",
|
|
113
|
+
"format",
|
|
114
|
+
"dryRun",
|
|
115
|
+
"cmd",
|
|
116
|
+
"cmdTimeout",
|
|
117
|
+
"failOnCmdError",
|
|
118
|
+
"help",
|
|
119
|
+
],
|
|
120
|
+
migrate: [
|
|
121
|
+
"write",
|
|
122
|
+
"check",
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
exports.FLAG_DESCRIPTION_OVERRIDES = {
|
|
126
|
+
trace: {
|
|
127
|
+
name: "Output basename for this trace.",
|
|
128
|
+
depth: "Dependency traversal depth. Defaults to configured depth.",
|
|
129
|
+
},
|
|
130
|
+
git: {
|
|
131
|
+
name: "Output basename for this run.",
|
|
132
|
+
},
|
|
133
|
+
grep: {
|
|
134
|
+
name: "Output basename for this run.",
|
|
135
|
+
},
|
|
136
|
+
};
|
package/dist/cli/help.js
CHANGED
|
@@ -6,20 +6,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.renderHelp = renderHelp;
|
|
7
7
|
exports.renderVersion = renderVersion;
|
|
8
8
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
9
|
+
const flag_specs_1 = require("./flag-specs");
|
|
10
|
+
const help_specs_1 = require("./help-specs");
|
|
9
11
|
function renderHelp(topic) {
|
|
10
|
-
if (topic === "
|
|
11
|
-
return
|
|
12
|
+
if (topic === "pack")
|
|
13
|
+
return renderPackHelp();
|
|
14
|
+
if (topic === "trace")
|
|
15
|
+
return renderTraceHelp();
|
|
16
|
+
if (topic === "scope")
|
|
17
|
+
return renderScopeHelp();
|
|
18
|
+
if (topic === "git")
|
|
19
|
+
return renderGitHelp();
|
|
20
|
+
if (topic === "grep")
|
|
21
|
+
return renderGrepHelp();
|
|
12
22
|
if (topic === "init")
|
|
13
23
|
return renderInitHelp();
|
|
14
|
-
if (topic === "profiles")
|
|
15
|
-
return renderProfilesHelp();
|
|
16
24
|
if (topic === "migrate")
|
|
17
25
|
return renderMigrateHelp();
|
|
18
26
|
return [
|
|
19
27
|
"Usage:",
|
|
20
|
-
" prodex
|
|
28
|
+
" prodex pack [root] [options]",
|
|
29
|
+
" prodex trace [root] --target <target> [--depth <number>] [options]",
|
|
30
|
+
" prodex scope [root] [options]",
|
|
31
|
+
" prodex git [root] [options]",
|
|
32
|
+
" prodex grep [root] --query \"text\" [options]",
|
|
21
33
|
" prodex init [root]",
|
|
22
|
-
" prodex profiles [root]",
|
|
23
34
|
" prodex migrate [root] [--write|--check]",
|
|
24
35
|
"",
|
|
25
36
|
"Global options:",
|
|
@@ -32,39 +43,90 @@ function renderHelp(topic) {
|
|
|
32
43
|
function renderVersion() {
|
|
33
44
|
return `prodex v${package_json_1.default.version}`;
|
|
34
45
|
}
|
|
35
|
-
function
|
|
46
|
+
function getLongFlagCliName(longFlag, isGrep = false) {
|
|
47
|
+
if (isGrep && longFlag === "grepAll")
|
|
48
|
+
return "all";
|
|
49
|
+
for (const [kebab, camel] of Object.entries(flag_specs_1.FLAG_ALIASES)) {
|
|
50
|
+
if (camel === longFlag)
|
|
51
|
+
return kebab;
|
|
52
|
+
}
|
|
53
|
+
return longFlag.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
54
|
+
}
|
|
55
|
+
function renderCommandHelpOptions(commandName) {
|
|
56
|
+
const allowed = help_specs_1.COMMAND_HELP_FLAGS[commandName];
|
|
57
|
+
if (!allowed)
|
|
58
|
+
return [];
|
|
59
|
+
const isGrep = commandName === "grep";
|
|
60
|
+
const specs = isGrep ? flag_specs_1.GREP_FLAGS : flag_specs_1.FLAGS;
|
|
61
|
+
return allowed.map((flagKey) => {
|
|
62
|
+
const doc = help_specs_1.PUBLIC_FLAGS[flagKey];
|
|
63
|
+
if (!doc) {
|
|
64
|
+
throw new Error(`Missing help documentation for flag "${flagKey}"`);
|
|
65
|
+
}
|
|
66
|
+
const spec = specs.find((s) => s.long === doc.long);
|
|
67
|
+
if (!spec) {
|
|
68
|
+
throw new Error(`Missing parsing spec for flag "${doc.long}"`);
|
|
69
|
+
}
|
|
70
|
+
const cliName = getLongFlagCliName(spec.long, isGrep);
|
|
71
|
+
let leftSide = "";
|
|
72
|
+
if (spec.short) {
|
|
73
|
+
leftSide = ` -${spec.short}, --${cliName}`;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
leftSide = ` --${cliName}`;
|
|
77
|
+
}
|
|
78
|
+
if (doc.hint) {
|
|
79
|
+
leftSide += ` ${doc.hint}`;
|
|
80
|
+
}
|
|
81
|
+
let description = doc.description;
|
|
82
|
+
if (doc.long === "help") {
|
|
83
|
+
description = `Show ${commandName} help.`;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const commandOverrides = help_specs_1.FLAG_DESCRIPTION_OVERRIDES[commandName];
|
|
87
|
+
if (commandOverrides) {
|
|
88
|
+
const override = commandOverrides[doc.long];
|
|
89
|
+
if (override) {
|
|
90
|
+
description = override;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return `${leftSide.padEnd(28)}${description}`;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function renderPackHelp() {
|
|
36
98
|
return [
|
|
37
99
|
"Usage:",
|
|
38
|
-
" prodex
|
|
100
|
+
" prodex pack [root] [options]",
|
|
39
101
|
"",
|
|
40
102
|
"Options:",
|
|
41
|
-
"
|
|
42
|
-
" -i, --include <glob> Extra file/glob to append. Repeatable and comma-aware.",
|
|
43
|
-
" -x, --exclude <glob> File/glob to skip. Repeatable and comma-aware.",
|
|
44
|
-
" -p, --profile <name> Run a named profile. Repeatable.",
|
|
45
|
-
" -a, --all Run every configured profile.",
|
|
46
|
-
" --all-profiles Alias for --all.",
|
|
47
|
-
" -n, --name <name> Output basename for this run.",
|
|
48
|
-
" -F, --format <md|txt> Output format.",
|
|
49
|
-
" --max-depth <number> Maximum dependency traversal depth.",
|
|
50
|
-
" --max-files <number> Maximum traced file count.",
|
|
51
|
-
" -h, --help Show run help.",
|
|
103
|
+
...renderCommandHelpOptions("pack"),
|
|
52
104
|
].join("\n");
|
|
53
105
|
}
|
|
54
|
-
function
|
|
106
|
+
function renderTraceHelp() {
|
|
55
107
|
return [
|
|
56
108
|
"Usage:",
|
|
57
|
-
" prodex
|
|
109
|
+
" prodex trace [root] --target <target> [--depth <number>] [options]",
|
|
58
110
|
"",
|
|
59
|
-
"
|
|
111
|
+
"Options:",
|
|
112
|
+
...renderCommandHelpOptions("trace"),
|
|
60
113
|
].join("\n");
|
|
61
114
|
}
|
|
62
|
-
function
|
|
115
|
+
function renderScopeHelp() {
|
|
63
116
|
return [
|
|
64
117
|
"Usage:",
|
|
65
|
-
" prodex
|
|
118
|
+
" prodex scope [root] [options]",
|
|
66
119
|
"",
|
|
67
|
-
"
|
|
120
|
+
"Options:",
|
|
121
|
+
...renderCommandHelpOptions("scope"),
|
|
122
|
+
].join("\n");
|
|
123
|
+
}
|
|
124
|
+
function renderInitHelp() {
|
|
125
|
+
return [
|
|
126
|
+
"Usage:",
|
|
127
|
+
" prodex init [root]",
|
|
128
|
+
"",
|
|
129
|
+
"Create a prodex.json file in the target root.",
|
|
68
130
|
].join("\n");
|
|
69
131
|
}
|
|
70
132
|
function renderMigrateHelp() {
|
|
@@ -74,10 +136,27 @@ function renderMigrateHelp() {
|
|
|
74
136
|
" prodex migrate [root] --write",
|
|
75
137
|
" prodex migrate [root] --check",
|
|
76
138
|
"",
|
|
77
|
-
"Preview, check, or write a prodex.json migration to config version
|
|
139
|
+
"Preview, check, or write a prodex.json migration to config version 5.",
|
|
140
|
+
"",
|
|
141
|
+
"Options:",
|
|
142
|
+
...renderCommandHelpOptions("migrate"),
|
|
143
|
+
].join("\n");
|
|
144
|
+
}
|
|
145
|
+
function renderGitHelp() {
|
|
146
|
+
return [
|
|
147
|
+
"Usage:",
|
|
148
|
+
" prodex git [root] [options]",
|
|
149
|
+
"",
|
|
150
|
+
"Options:",
|
|
151
|
+
...renderCommandHelpOptions("git"),
|
|
152
|
+
].join("\n");
|
|
153
|
+
}
|
|
154
|
+
function renderGrepHelp() {
|
|
155
|
+
return [
|
|
156
|
+
"Usage:",
|
|
157
|
+
" prodex grep [root] [options]",
|
|
78
158
|
"",
|
|
79
159
|
"Options:",
|
|
80
|
-
"
|
|
81
|
-
" --check Exit nonzero if migration is required.",
|
|
160
|
+
...renderCommandHelpOptions("grep"),
|
|
82
161
|
].join("\n");
|
|
83
162
|
}
|