@jwilger/pi-development-system 0.8.7 → 0.8.8
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/package.json
CHANGED
|
@@ -6,7 +6,12 @@ export type CommitExtraction =
|
|
|
6
6
|
| { readonly kind: "not-commit" }
|
|
7
7
|
| { readonly kind: "message"; readonly message: string }
|
|
8
8
|
| { readonly kind: "file"; readonly path: string }
|
|
9
|
-
| {
|
|
9
|
+
| {
|
|
10
|
+
readonly kind: "unknown";
|
|
11
|
+
readonly trailers: readonly string[];
|
|
12
|
+
/** A `-m` value is a substitution or variable: the message exists but cannot be read. */
|
|
13
|
+
readonly opaqueMessage: boolean;
|
|
14
|
+
};
|
|
10
15
|
|
|
11
16
|
type Options = {
|
|
12
17
|
messages: string[];
|
|
@@ -77,9 +82,10 @@ function readOptions(args: readonly string[]): Options {
|
|
|
77
82
|
return options;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
const unknown = (trailers: readonly string[] = []): CommitExtraction => ({
|
|
85
|
+
const unknown = (trailers: readonly string[] = [], opaqueMessage = false): CommitExtraction => ({
|
|
81
86
|
kind: "unknown",
|
|
82
87
|
trailers,
|
|
88
|
+
opaqueMessage,
|
|
83
89
|
});
|
|
84
90
|
|
|
85
91
|
const STDIN_PATHS = new Set(["-", "/dev/stdin", "/proc/self/fd/0"]);
|
|
@@ -104,7 +110,7 @@ function extractOne(args: readonly string[], heredoc: string | undefined): Commi
|
|
|
104
110
|
if (options.file !== undefined) return { kind: "file", path: options.file };
|
|
105
111
|
const parts = [...options.messages];
|
|
106
112
|
if (options.opaque) {
|
|
107
|
-
if (heredoc === undefined) return unknown(options.trailers);
|
|
113
|
+
if (heredoc === undefined) return unknown(options.trailers, true);
|
|
108
114
|
parts.push(heredoc);
|
|
109
115
|
}
|
|
110
116
|
if (parts.length === 0) return unknown(options.trailers);
|
|
@@ -170,6 +170,12 @@ export function registerCommitGuard(deps: CommitGuardDeps): void {
|
|
|
170
170
|
why: "the message file cannot be read before the commit runs, so its rationale cannot be checked; use -m or a heredoc",
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
+
if (extractions.some((e) => e.kind === "unknown" && e.opaqueMessage)) {
|
|
174
|
+
all.push({
|
|
175
|
+
gate: RATIONALE,
|
|
176
|
+
why: "the message is built by a substitution or variable and cannot be checked; use a literal -m or a heredoc",
|
|
177
|
+
});
|
|
178
|
+
}
|
|
173
179
|
for (const message of known) {
|
|
174
180
|
for (const need of await needsOf(deps, ctx, message, command)) {
|
|
175
181
|
if (!all.some((n) => n.gate === need.gate)) all.push(need);
|