@codyswann/lisa 4.23.2 → 4.23.4
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/all/copy-overwrite/scripts/lib/process-tree-runner.mjs +122 -31
- package/all/copy-overwrite/scripts/lisa-hooks/block-no-verify.sh +75 -2
- package/all/copy-overwrite/scripts/lisa-reconcile-policy.mjs +22 -8
- package/all/copy-overwrite/scripts/lisa-work-item.mjs +40 -17
- package/dist/codex/scripts/block-no-verify.sh +63 -0
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +30 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +12 -11
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/opencode/plugin-templates/block-no-verify.sh +75 -2
- package/dist/opencode/plugin-templates/lisa-block-direct-issue-create.ts +17 -7
- package/package.json +3 -3
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-github-sync/SKILL.md +4 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-jira-journey/scripts/parse-plan.py +3 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-setup-remote-env/scripts/setup-remote-env.mjs +34 -6
- package/plugins/lisa/hooks/block-no-verify.agy.sh +63 -0
- package/plugins/lisa/hooks/block-no-verify.sh +75 -2
- package/plugins/lisa/skills/lisa-github-sync/SKILL.md +4 -3
- package/plugins/lisa/skills/lisa-jira-journey/scripts/parse-plan.py +3 -1
- package/plugins/lisa/skills/lisa-setup-remote-env/scripts/setup-remote-env.mjs +34 -6
- package/plugins/lisa-agy/hooks/block-no-verify.agy.sh +63 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-github-sync/SKILL.md +4 -3
- package/plugins/lisa-agy/skills/lisa-jira-journey/scripts/parse-plan.py +3 -1
- package/plugins/lisa-agy/skills/lisa-setup-remote-env/scripts/setup-remote-env.mjs +34 -6
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/hooks/block-no-verify.sh +75 -2
- package/plugins/lisa-copilot/skills/lisa-github-sync/SKILL.md +4 -3
- package/plugins/lisa-copilot/skills/lisa-jira-journey/scripts/parse-plan.py +3 -1
- package/plugins/lisa-copilot/skills/lisa-setup-remote-env/scripts/setup-remote-env.mjs +34 -6
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/block-no-verify.sh +75 -2
- package/plugins/lisa-cursor/skills/lisa-github-sync/SKILL.md +4 -3
- package/plugins/lisa-cursor/skills/lisa-jira-journey/scripts/parse-plan.py +3 -1
- package/plugins/lisa-cursor/skills/lisa-setup-remote-env/scripts/setup-remote-env.mjs +34 -6
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/hooks/block-no-verify.agy.sh +63 -0
- package/plugins/src/base/hooks/block-no-verify.sh +75 -2
- package/plugins/src/base/skills/lisa-github-sync/SKILL.md +4 -3
- package/plugins/src/base/skills/lisa-jira-journey/scripts/parse-plan.py +3 -1
- package/plugins/src/base/skills/lisa-setup-remote-env/scripts/setup-remote-env.mjs +34 -6
- package/typescript/copy-overwrite/scripts/check-skipped-required-checks.mjs +2 -2
- package/typescript/copy-overwrite/scripts/lisa-mutation.mjs +91 -13
|
@@ -43,13 +43,55 @@ function parseArguments(argv) {
|
|
|
43
43
|
return { command, timeoutMs };
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Test a Windows PID without pretending every tree disappeared immediately.
|
|
48
|
+
* `process.kill(pid, 0)` sends no signal; on Windows it is the only portable
|
|
49
|
+
* Node primitive that distinguishes a live root process from an absent one.
|
|
50
|
+
* @param {number} pid Process identifier.
|
|
51
|
+
* @param {(pid:number, signal:number)=>void} probe Injectable process probe.
|
|
52
|
+
* @returns {boolean} Whether the process still exists.
|
|
53
|
+
*/
|
|
54
|
+
export function windowsTreeExists(pid, probe = process.kill) {
|
|
55
|
+
try {
|
|
56
|
+
probe(pid, 0);
|
|
57
|
+
return true;
|
|
58
|
+
} catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Ask Windows to terminate the complete descendant tree and verify a failed
|
|
65
|
+
* native command did not leave its root alive.
|
|
66
|
+
* @param {number} pid Process identifier.
|
|
67
|
+
* @param {string} signal Graceful or forced phase.
|
|
68
|
+
* @param {typeof spawnSync} execute Injectable native command runner.
|
|
69
|
+
* @param {(pid:number)=>boolean} exists Injectable liveness check.
|
|
70
|
+
*/
|
|
71
|
+
export function killWindowsTree(
|
|
72
|
+
pid,
|
|
73
|
+
signal,
|
|
74
|
+
execute = spawnSync,
|
|
75
|
+
exists = windowsTreeExists
|
|
76
|
+
) {
|
|
77
|
+
if (!exists(pid)) return;
|
|
78
|
+
const args = ["/pid", String(pid), "/T"];
|
|
79
|
+
if (signal === "SIGKILL") args.push("/F");
|
|
80
|
+
const result = execute("taskkill", args, {
|
|
81
|
+
stdio: "ignore",
|
|
82
|
+
timeout: KILL_GRACE_MS,
|
|
83
|
+
});
|
|
84
|
+
if ((result.error || result.status !== 0) && exists(pid)) {
|
|
85
|
+
const detail = result.error?.message ?? result.signal ?? result.status;
|
|
86
|
+
throw new Error(`taskkill ${args.join(" ")} failed (${detail})`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
46
90
|
function killTree(pid, signal) {
|
|
47
91
|
if (process.platform === "win32") {
|
|
48
92
|
// Windows has no negative-pid process groups. taskkill /T is the native
|
|
49
93
|
// tree primitive; /F is used only for the escalation.
|
|
50
|
-
|
|
51
|
-
if (signal === "SIGKILL") args.push("/F");
|
|
52
|
-
spawnSync("taskkill", args, { stdio: "ignore", timeout: KILL_GRACE_MS });
|
|
94
|
+
killWindowsTree(pid, signal);
|
|
53
95
|
return;
|
|
54
96
|
}
|
|
55
97
|
try {
|
|
@@ -60,7 +102,7 @@ function killTree(pid, signal) {
|
|
|
60
102
|
}
|
|
61
103
|
|
|
62
104
|
function treeExists(pid) {
|
|
63
|
-
if (process.platform === "win32") return
|
|
105
|
+
if (process.platform === "win32") return windowsTreeExists(pid);
|
|
64
106
|
try {
|
|
65
107
|
process.kill(-pid, 0);
|
|
66
108
|
return true;
|
|
@@ -78,18 +120,36 @@ async function waitForTreeExit(pid, deadline, controls) {
|
|
|
78
120
|
}
|
|
79
121
|
|
|
80
122
|
export async function reapTree(pid, controls = DEFAULT_REAP_CONTROLS) {
|
|
81
|
-
|
|
123
|
+
let gracefulFailure;
|
|
124
|
+
try {
|
|
125
|
+
controls.kill(pid, "SIGTERM");
|
|
126
|
+
} catch (error) {
|
|
127
|
+
// A graceful native termination failure still gets the forced phase. The
|
|
128
|
+
// error becomes terminal only if escalation also leaves the tree alive.
|
|
129
|
+
gracefulFailure = error;
|
|
130
|
+
}
|
|
82
131
|
if (await waitForTreeExit(pid, controls.now() + KILL_GRACE_MS, controls)) {
|
|
83
132
|
return;
|
|
84
133
|
}
|
|
85
134
|
|
|
86
|
-
|
|
135
|
+
let forcedFailure;
|
|
136
|
+
try {
|
|
137
|
+
controls.kill(pid, "SIGKILL");
|
|
138
|
+
} catch (error) {
|
|
139
|
+
forcedFailure = error;
|
|
140
|
+
}
|
|
87
141
|
if (!(await waitForTreeExit(pid, controls.now() + KILL_GRACE_MS, controls))) {
|
|
142
|
+
if (forcedFailure || gracefulFailure) {
|
|
143
|
+
const failure = forcedFailure ?? gracefulFailure;
|
|
144
|
+
throw new Error(
|
|
145
|
+
`gate process tree ${pid} could not be reaped: ${failure instanceof Error ? failure.message : String(failure)}`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
88
148
|
throw new Error(`gate process tree ${pid} survived SIGKILL`);
|
|
89
149
|
}
|
|
90
150
|
}
|
|
91
151
|
|
|
92
|
-
export function supervise(command, timeoutMs) {
|
|
152
|
+
export function supervise(command, timeoutMs, reap = reapTree) {
|
|
93
153
|
return new Promise((resolve, reject) => {
|
|
94
154
|
const shell =
|
|
95
155
|
process.platform === "win32"
|
|
@@ -112,55 +172,85 @@ export function supervise(command, timeoutMs) {
|
|
|
112
172
|
|
|
113
173
|
let timedOut = false;
|
|
114
174
|
let settled = false;
|
|
175
|
+
let settling = false;
|
|
115
176
|
let terminating = false;
|
|
177
|
+
let reapPromise;
|
|
116
178
|
const signalHandlers = new Map();
|
|
117
|
-
const
|
|
179
|
+
const clearDeadline = () => {
|
|
118
180
|
clearTimeout(deadline);
|
|
181
|
+
};
|
|
182
|
+
const clearSignalHandlers = () => {
|
|
119
183
|
for (const [signal, handler] of signalHandlers) {
|
|
120
184
|
process.off(signal, handler);
|
|
121
185
|
}
|
|
122
186
|
signalHandlers.clear();
|
|
123
187
|
};
|
|
188
|
+
const cleanup = () => {
|
|
189
|
+
clearDeadline();
|
|
190
|
+
clearSignalHandlers();
|
|
191
|
+
};
|
|
192
|
+
// Every exit path shares one reap. A signal that arrives while the direct
|
|
193
|
+
// shell's close handler is reaping must join that operation instead of
|
|
194
|
+
// starting a second kill sequence or taking the default signal action.
|
|
195
|
+
const reapOnce = () => {
|
|
196
|
+
reapPromise ??= reap(pid);
|
|
197
|
+
return reapPromise;
|
|
198
|
+
};
|
|
124
199
|
const finish = async (code, signal) => {
|
|
125
|
-
if (settled) return;
|
|
126
|
-
|
|
127
|
-
|
|
200
|
+
if (settled || settling) return;
|
|
201
|
+
settling = true;
|
|
202
|
+
clearDeadline();
|
|
128
203
|
// A command may leave a background descendant after its direct shell
|
|
129
204
|
// exits. Reap that residue fully before returning a verdict too.
|
|
130
205
|
try {
|
|
131
|
-
await
|
|
206
|
+
await reapOnce();
|
|
207
|
+
settled = true;
|
|
208
|
+
cleanup();
|
|
132
209
|
resolve({ code, signal });
|
|
133
210
|
} catch (error) {
|
|
134
|
-
|
|
211
|
+
failReap(error);
|
|
135
212
|
}
|
|
136
213
|
};
|
|
137
214
|
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
215
|
+
const failReap = error => {
|
|
216
|
+
if (settled) return;
|
|
217
|
+
settled = true;
|
|
218
|
+
cleanup();
|
|
219
|
+
// A failed reap means the child may never emit another event. Detaching
|
|
220
|
+
// the handle and rejecting makes the supervisor terminal instead of
|
|
221
|
+
// leaving its promise pending behind a live event-loop reference.
|
|
222
|
+
child.unref();
|
|
223
|
+
reject(
|
|
224
|
+
error instanceof Error
|
|
225
|
+
? error
|
|
226
|
+
: new Error(`gate process-tree supervisor failed: ${String(error)}`)
|
|
141
227
|
);
|
|
142
|
-
process.exitCode = 1;
|
|
143
228
|
};
|
|
144
229
|
|
|
145
230
|
const relaySignal = signal => {
|
|
146
231
|
if (terminating) return;
|
|
147
232
|
terminating = true;
|
|
148
|
-
|
|
149
|
-
|
|
233
|
+
settling = true;
|
|
234
|
+
clearDeadline();
|
|
235
|
+
reapOnce().then(() => {
|
|
236
|
+
cleanup();
|
|
150
237
|
// Restore the signal-shaped exit after the detached tree is gone.
|
|
151
238
|
process.kill(process.pid, signal);
|
|
152
|
-
},
|
|
239
|
+
}, failReap);
|
|
153
240
|
};
|
|
154
241
|
for (const signal of TERMINATING_SIGNALS) {
|
|
155
242
|
const handler = () => relaySignal(signal);
|
|
156
243
|
signalHandlers.set(signal, handler);
|
|
157
|
-
process.
|
|
244
|
+
process.on(signal, handler);
|
|
158
245
|
}
|
|
159
246
|
|
|
160
247
|
const deadline = setTimeout(() => {
|
|
161
248
|
timedOut = true;
|
|
162
|
-
|
|
163
|
-
|
|
249
|
+
terminating = true;
|
|
250
|
+
settling = true;
|
|
251
|
+
clearDeadline();
|
|
252
|
+
reapOnce().then(() => {
|
|
253
|
+
cleanup();
|
|
164
254
|
// A signal-shaped result is the existing gate runner vocabulary for
|
|
165
255
|
// "no verdict". It also prevents an ordinary exit code such as 124
|
|
166
256
|
// from being confused with a user command that returned that code.
|
|
@@ -172,17 +262,18 @@ export function supervise(command, timeoutMs) {
|
|
|
172
262
|
} else {
|
|
173
263
|
process.kill(process.pid, "SIGKILL");
|
|
174
264
|
}
|
|
175
|
-
},
|
|
265
|
+
}, failReap);
|
|
176
266
|
}, timeoutMs);
|
|
177
267
|
|
|
178
268
|
child.once("error", error => {
|
|
179
|
-
if (settled) return;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
269
|
+
if (settled || settling) return;
|
|
270
|
+
settling = true;
|
|
271
|
+
clearDeadline();
|
|
272
|
+
reapOnce().then(() => {
|
|
273
|
+
settled = true;
|
|
274
|
+
cleanup();
|
|
275
|
+
reject(error);
|
|
276
|
+
}, failReap);
|
|
186
277
|
});
|
|
187
278
|
child.once("close", (code, signal) => {
|
|
188
279
|
// On timeout, wait for the forced group reap above before this supervisor
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
# Add a name here in the same commit that closes a vector. A hardening that
|
|
27
27
|
# forgets to is invisible to refresh, and shows up as an unexplained diff at
|
|
28
28
|
# review time instead of a named capability.
|
|
29
|
-
# lisa-guard-capabilities: no-verify-abbrev, husky-env, hookspath-allowlist, config-env, git-config-key, git-config-parameters, git-config-parameters-append, git-config-parameters-expansion, heredoc-shell-word, herestring-aware, no-verify-short, nested-shell-no-verify
|
|
29
|
+
# lisa-guard-capabilities: no-verify-abbrev, husky-env, hookspath-allowlist, config-env, env-split-string, git-config-key, git-config-parameters, git-config-parameters-append, git-config-parameters-expansion, heredoc-shell-word, herestring-aware, no-verify-short, nested-shell-no-verify
|
|
30
30
|
#
|
|
31
31
|
# Shell-token matching avoids false positives from issue bodies, heredocs, and
|
|
32
32
|
# commit-message prose while still catching quoted real argv values such as
|
|
@@ -225,7 +225,9 @@ MAX_SHELL_NESTING = 8
|
|
|
225
225
|
# Prefix options accepted by `env` before the command name. Value-taking
|
|
226
226
|
# options are separate because their operand must never be mistaken for the
|
|
227
227
|
# command (`env -u bash -c ...` consumes `bash` as the variable name).
|
|
228
|
-
ENV_OPTIONS_NO_VALUE = {
|
|
228
|
+
ENV_OPTIONS_NO_VALUE = {
|
|
229
|
+
"-i", "--ignore-environment", "-0", "--null", "-v", "--debug",
|
|
230
|
+
}
|
|
229
231
|
ENV_OPTIONS_SEPARATE_VALUE = {
|
|
230
232
|
"-u", "--unset", "-C", "--chdir", "-S", "--split-string",
|
|
231
233
|
"-a", "--argv0",
|
|
@@ -430,6 +432,72 @@ def shell_starts_command(tokens, index):
|
|
|
430
432
|
return True
|
|
431
433
|
|
|
432
434
|
|
|
435
|
+
def env_short_option_uses_split_string(token):
|
|
436
|
+
"""Whether one GNU env short-option cluster enables split-string."""
|
|
437
|
+
if not token.startswith("-") or token.startswith("--") or token == "-":
|
|
438
|
+
return False
|
|
439
|
+
for letter in token[1:]:
|
|
440
|
+
if letter == "S":
|
|
441
|
+
return True
|
|
442
|
+
if letter in {"u", "C", "a"}:
|
|
443
|
+
# The rest of this token is the option's value, not more options.
|
|
444
|
+
return False
|
|
445
|
+
if letter not in {"i", "0", "v"}:
|
|
446
|
+
return False
|
|
447
|
+
return False
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def env_uses_split_string(tokens, index):
|
|
451
|
+
"""Whether a command-position env invocation uses split-string parsing.
|
|
452
|
+
|
|
453
|
+
`env -S` reparses one opaque argv value as shell-like words. Inspecting the
|
|
454
|
+
outer command cannot prove what executable or nested shell that second
|
|
455
|
+
parse will produce, so the verification guard refuses the ambiguous form.
|
|
456
|
+
|
|
457
|
+
Args:
|
|
458
|
+
tokens: The full operator-aware token list.
|
|
459
|
+
index: Index of the candidate env executable.
|
|
460
|
+
|
|
461
|
+
Returns:
|
|
462
|
+
True when env will reparse a split-string payload.
|
|
463
|
+
"""
|
|
464
|
+
start = index - 1
|
|
465
|
+
while start >= 0 and tokens[start] not in COMMAND_SEPARATORS:
|
|
466
|
+
start -= 1
|
|
467
|
+
prefix = tokens[start + 1:index]
|
|
468
|
+
if not all("=" in token and not token.startswith("=") for token in prefix):
|
|
469
|
+
return False
|
|
470
|
+
|
|
471
|
+
cursor = index + 1
|
|
472
|
+
while cursor < len(tokens):
|
|
473
|
+
token = tokens[cursor]
|
|
474
|
+
if token in COMMAND_SEPARATORS or token == "--":
|
|
475
|
+
return False
|
|
476
|
+
if (
|
|
477
|
+
token in {"-S", "--split-string"}
|
|
478
|
+
or token.startswith("--split-string=")
|
|
479
|
+
or env_short_option_uses_split_string(token)
|
|
480
|
+
):
|
|
481
|
+
return True
|
|
482
|
+
if "=" in token and not token.startswith(("=", "-")):
|
|
483
|
+
cursor += 1
|
|
484
|
+
continue
|
|
485
|
+
if token in ENV_OPTIONS_NO_VALUE or token.startswith(
|
|
486
|
+
tuple(
|
|
487
|
+
option
|
|
488
|
+
for option in ENV_OPTIONS_INLINE_VALUE
|
|
489
|
+
if option != "--split-string="
|
|
490
|
+
)
|
|
491
|
+
):
|
|
492
|
+
cursor += 1
|
|
493
|
+
continue
|
|
494
|
+
if token in ENV_OPTIONS_SEPARATE_VALUE:
|
|
495
|
+
cursor += 2
|
|
496
|
+
continue
|
|
497
|
+
return False
|
|
498
|
+
return False
|
|
499
|
+
|
|
500
|
+
|
|
433
501
|
def nested_shell_payload(tokens, index):
|
|
434
502
|
"""Return a shell `-c` payload, or True when option parsing is ambiguous."""
|
|
435
503
|
cursor = index + 1
|
|
@@ -470,6 +538,11 @@ def git_commit_skips_verification(text, depth=0):
|
|
|
470
538
|
scoped_tokens = shell_tokens(text)
|
|
471
539
|
except ValueError:
|
|
472
540
|
return False
|
|
541
|
+
for index, token in enumerate(scoped_tokens):
|
|
542
|
+
if token.rsplit("/", 1)[-1] == "env" and env_uses_split_string(
|
|
543
|
+
scoped_tokens, index
|
|
544
|
+
):
|
|
545
|
+
return True
|
|
473
546
|
for index, token in enumerate(scoped_tokens):
|
|
474
547
|
# `/usr/bin/git` and a bare `git` are the same program; an env prefix
|
|
475
548
|
# (`HUSKY=1 git commit -n`) simply sits in an earlier token.
|
|
@@ -673,6 +673,8 @@ export function readLivePolicy({ repo, gh }) {
|
|
|
673
673
|
* One record per declared (ruleset, context) pair, from `declaredChecks`.
|
|
674
674
|
* Supplied, it is what the comparison is made of; absent, the name-keyed
|
|
675
675
|
* `homes`/`pins` projection is reconstituted into equivalent records.
|
|
676
|
+
* @param {Array<{context:string, ruleset?:string}>} [options.awaited]
|
|
677
|
+
* Awaited declarations, preserving their ruleset identity.
|
|
676
678
|
* @returns {ContextDrift} Three sets, plus the unsatisfied records.
|
|
677
679
|
*/
|
|
678
680
|
export function reconcileContexts({
|
|
@@ -686,7 +688,7 @@ export function reconcileContexts({
|
|
|
686
688
|
const liveContexts = live ?? [];
|
|
687
689
|
const declaredNames = new Set(declared ?? []);
|
|
688
690
|
const byName = (a, b) => a.localeCompare(b);
|
|
689
|
-
const
|
|
691
|
+
const awaitedDeclarations = awaited ?? [];
|
|
690
692
|
|
|
691
693
|
// The unit of declaration is a (ruleset, context) PAIR, not a name. A name
|
|
692
694
|
// set cannot hold `build` required by both `base` and `release`, so a live
|
|
@@ -727,7 +729,11 @@ export function reconcileContexts({
|
|
|
727
729
|
if (record.ruleset !== undefined) {
|
|
728
730
|
if (
|
|
729
731
|
record.integration_id === undefined &&
|
|
730
|
-
|
|
732
|
+
awaitedDeclarations.some(
|
|
733
|
+
awaitedRecord =>
|
|
734
|
+
awaitedRecord.context === record.context &&
|
|
735
|
+
awaitedRecord.ruleset === record.ruleset
|
|
736
|
+
)
|
|
731
737
|
) {
|
|
732
738
|
return (
|
|
733
739
|
entry.integration_id === null || entry.integration_id === undefined
|
|
@@ -1111,7 +1117,8 @@ export function rulesetPayload(
|
|
|
1111
1117
|
* @param {LivePolicy} options.live Result of `readLivePolicy`.
|
|
1112
1118
|
* @param {boolean} options.prune Whether EXTRA contexts may be removed.
|
|
1113
1119
|
* @param {string|null} options.rulesetName Explicit target ruleset.
|
|
1114
|
-
* @param {string
|
|
1120
|
+
* @param {Array<{context:string, ruleset?:string}>} [options.awaited]
|
|
1121
|
+
* Ruleset-scoped contexts an external app posts.
|
|
1115
1122
|
* @param {Record<string, number>} [options.pins] Declared app id per awaited
|
|
1116
1123
|
* context.
|
|
1117
1124
|
* @returns {RepairAction[]} Planned actions.
|
|
@@ -1221,7 +1228,8 @@ function pinsFor({ pins, groupPins, unpinned }) {
|
|
|
1221
1228
|
* @param {LivePolicy} options.live Result of `readLivePolicy`.
|
|
1222
1229
|
* @param {boolean} options.prune Whether EXTRA contexts may be removed.
|
|
1223
1230
|
* @param {string|null} options.rulesetName Explicit fallback target.
|
|
1224
|
-
* @param {string
|
|
1231
|
+
* @param {Array<{context:string, ruleset?:string}>} options.awaited
|
|
1232
|
+
* Ruleset-scoped contexts an external app posts.
|
|
1225
1233
|
* @param {Record<string, number>} options.pins Declared app id per context.
|
|
1226
1234
|
* @param {Record<string, string>} options.homes Declared ruleset per context.
|
|
1227
1235
|
* @returns {RepairAction[]} Context actions, one per ruleset written.
|
|
@@ -1321,7 +1329,9 @@ function planContextRepairs({
|
|
|
1321
1329
|
payload: rulesetPayload(ruleset, {
|
|
1322
1330
|
add,
|
|
1323
1331
|
remove,
|
|
1324
|
-
awaited
|
|
1332
|
+
awaited: awaited
|
|
1333
|
+
.filter(record => record.ruleset === name)
|
|
1334
|
+
.map(record => record.context),
|
|
1325
1335
|
// The name-keyed map still carries AWAITED pins, which are declared per
|
|
1326
1336
|
// context and have no ruleset of their own, so it stays the base. A
|
|
1327
1337
|
// declared record then overrides it — with its pin, or by deleting the
|
|
@@ -1471,15 +1481,19 @@ export function reconcile({
|
|
|
1471
1481
|
// Only `configured` is passed: it is what the project actually declared. The
|
|
1472
1482
|
// awaited-context homes below are a routing hint for repairs, not a stated
|
|
1473
1483
|
// expectation, and treating them as one would report drift nobody declared.
|
|
1484
|
+
const resolvedAwaitedHome = awaitedHome(live, rulesetName);
|
|
1485
|
+
const awaitedDeclarations = awaited.map(context => ({
|
|
1486
|
+
context,
|
|
1487
|
+
...(resolvedAwaitedHome === null ? {} : { ruleset: resolvedAwaitedHome }),
|
|
1488
|
+
}));
|
|
1474
1489
|
const contexts = reconcileContexts({
|
|
1475
1490
|
declared,
|
|
1476
1491
|
live: live.contexts,
|
|
1477
1492
|
homes: configured.homes,
|
|
1478
1493
|
pins: configured.pins,
|
|
1479
1494
|
records: configured.records,
|
|
1480
|
-
awaited,
|
|
1495
|
+
awaited: awaitedDeclarations,
|
|
1481
1496
|
});
|
|
1482
|
-
const resolvedAwaitedHome = awaitedHome(live, rulesetName);
|
|
1483
1497
|
const settings = reconcileSettings({ policy, live });
|
|
1484
1498
|
const drifted =
|
|
1485
1499
|
contexts.missing.length > 0 ||
|
|
@@ -1499,7 +1513,7 @@ export function reconcile({
|
|
|
1499
1513
|
live,
|
|
1500
1514
|
prune,
|
|
1501
1515
|
rulesetName,
|
|
1502
|
-
awaited,
|
|
1516
|
+
awaited: awaitedDeclarations,
|
|
1503
1517
|
pins: { ...configured.pins, ...awaitedPins(gates, moment) },
|
|
1504
1518
|
// An awaited context has no ruleset in its declaration — it is declared
|
|
1505
1519
|
// on a GATE. Its home defaults to the ruleset Lisa generates from
|
|
@@ -2272,6 +2272,33 @@ function option(args, name, envName) {
|
|
|
2272
2272
|
return value;
|
|
2273
2273
|
}
|
|
2274
2274
|
|
|
2275
|
+
/**
|
|
2276
|
+
* Resolve the canonical pull-request option without letting an environment
|
|
2277
|
+
* fallback outrank either explicit alias.
|
|
2278
|
+
*
|
|
2279
|
+
* Resolving `--pr-url` with an environment fallback before inspecting `--url`
|
|
2280
|
+
* lets `LISA_PR_URL` hide an explicit alias. Conflicting explicit aliases are
|
|
2281
|
+
* refused instead of choosing completion evidence by argument order.
|
|
2282
|
+
* @param {string[]} args Command arguments.
|
|
2283
|
+
* @returns {string | undefined} The explicit or environment URL.
|
|
2284
|
+
*/
|
|
2285
|
+
function pullRequestUrlOption(args) {
|
|
2286
|
+
const explicit = name => {
|
|
2287
|
+
const index = args.indexOf(name);
|
|
2288
|
+
if (index < 0) return undefined;
|
|
2289
|
+
const value = args[index + 1];
|
|
2290
|
+
return value === undefined || value.startsWith("-") ? undefined : value;
|
|
2291
|
+
};
|
|
2292
|
+
const canonical = explicit("--pr-url");
|
|
2293
|
+
const alias = explicit("--url");
|
|
2294
|
+
if (canonical && alias && canonical !== alias) {
|
|
2295
|
+
throw new TrackingError(
|
|
2296
|
+
"Conflicting pull-request evidence: --pr-url and --url name different values"
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
return canonical ?? alias ?? process.env.LISA_PR_URL;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2275
2302
|
function bind(args) {
|
|
2276
2303
|
const contract = trackerContract();
|
|
2277
2304
|
const ref = canonicalizeRef(args[0], contract);
|
|
@@ -2324,9 +2351,7 @@ function backlink(args) {
|
|
|
2324
2351
|
);
|
|
2325
2352
|
}
|
|
2326
2353
|
const ref = canonicalizeRef(supplied ?? bound, contract);
|
|
2327
|
-
const prUrl =
|
|
2328
|
-
option(args, "--pr-url", "LISA_PR_URL") ??
|
|
2329
|
-
option(args, "--url", "LISA_PR_URL");
|
|
2354
|
+
const prUrl = pullRequestUrlOption(args);
|
|
2330
2355
|
if (!prUrl)
|
|
2331
2356
|
throw new TrackingError(`${BACKLINK_COMMAND} requires --pr-url <url>`);
|
|
2332
2357
|
const outcome = postBacklink(ref, prUrl, contract);
|
|
@@ -2478,17 +2503,19 @@ function githubPullRequestUrl(raw) {
|
|
|
2478
2503
|
/**
|
|
2479
2504
|
* Prove that supplied evidence is a merged PR in this repository.
|
|
2480
2505
|
* @param {string} prUrl Canonical pull-request URL.
|
|
2481
|
-
* @param {object} contract Resolved tracker contract.
|
|
2482
2506
|
* @returns {{number:number, repository:string, url:string}} Verified evidence.
|
|
2483
2507
|
*/
|
|
2484
|
-
function mergedPullRequestEvidence(prUrl
|
|
2508
|
+
function mergedPullRequestEvidence(prUrl) {
|
|
2485
2509
|
const parsed = githubPullRequestUrl(prUrl);
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2510
|
+
const repository = currentRepository();
|
|
2511
|
+
if (!repository) {
|
|
2512
|
+
throw new TrackingError(
|
|
2513
|
+
`cannot verify merged pull-request evidence ${parsed.url}: the current GitHub repository is unknown`
|
|
2514
|
+
);
|
|
2515
|
+
}
|
|
2516
|
+
if (parsed.repository.toLowerCase() !== repository.toLowerCase()) {
|
|
2490
2517
|
throw new TrackingError(
|
|
2491
|
-
`refusing to complete from ${parsed.url}: it belongs to ${parsed.repository}, not repository ${
|
|
2518
|
+
`refusing to complete from ${parsed.url}: it belongs to ${parsed.repository}, not repository ${repository}`
|
|
2492
2519
|
);
|
|
2493
2520
|
}
|
|
2494
2521
|
const result = run(
|
|
@@ -2552,7 +2579,7 @@ function completeLinearWorkItem(ref, contract, prUrl) {
|
|
|
2552
2579
|
`LINEAR_API_KEY_${contract.workspace.toLowerCase().replace(/-/g, "_")})`
|
|
2553
2580
|
);
|
|
2554
2581
|
}
|
|
2555
|
-
const evidence = mergedPullRequestEvidence(prUrl
|
|
2582
|
+
const evidence = mergedPullRequestEvidence(prUrl);
|
|
2556
2583
|
const issue = linearCompletionIssue(
|
|
2557
2584
|
ref,
|
|
2558
2585
|
token,
|
|
@@ -2636,9 +2663,7 @@ function complete(args) {
|
|
|
2636
2663
|
);
|
|
2637
2664
|
}
|
|
2638
2665
|
const ref = canonicalizeRef(supplied ?? bound, contract);
|
|
2639
|
-
const prUrl =
|
|
2640
|
-
option(args, "--pr-url", "LISA_PR_URL") ??
|
|
2641
|
-
option(args, "--url", "LISA_PR_URL");
|
|
2666
|
+
const prUrl = pullRequestUrlOption(args);
|
|
2642
2667
|
const { merged, terminal } = completeWorkItem(ref, contract, prUrl);
|
|
2643
2668
|
console.log(
|
|
2644
2669
|
`work-item completed: ${ref} -> ${terminal} (merged: ${merged
|
|
@@ -2797,9 +2822,7 @@ function validatePr(args) {
|
|
|
2797
2822
|
const outcome = commitOutcome(commits);
|
|
2798
2823
|
const bodyFile = option(args, "--body-file", "LISA_PR_BODY_FILE");
|
|
2799
2824
|
const prNumber = option(args, "--pr-number", "LISA_PR_NUMBER");
|
|
2800
|
-
const suppliedUrl =
|
|
2801
|
-
option(args, "--pr-url", "LISA_PR_URL") ??
|
|
2802
|
-
option(args, "--url", "LISA_PR_URL");
|
|
2825
|
+
const suppliedUrl = pullRequestUrlOption(args);
|
|
2803
2826
|
const repository =
|
|
2804
2827
|
option(args, "--repo", "GITHUB_REPOSITORY") ?? currentRepository();
|
|
2805
2828
|
const fetched = bodyFile
|
|
@@ -137,6 +137,14 @@ COMMAND_SEPARATORS = {
|
|
|
137
137
|
";", "|", "||", "&", "&&", "(", ")", "<", ">", ">>", "<<", "&|",
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
ENV_OPTIONS_NO_VALUE = {
|
|
141
|
+
"-i", "--ignore-environment", "-0", "--null", "-v", "--debug",
|
|
142
|
+
}
|
|
143
|
+
ENV_OPTIONS_SEPARATE_VALUE = {
|
|
144
|
+
"-u", "--unset", "-C", "--chdir", "-a", "--argv0",
|
|
145
|
+
}
|
|
146
|
+
ENV_OPTIONS_INLINE_VALUE = ("--unset=", "--chdir=", "--argv0=")
|
|
147
|
+
|
|
140
148
|
# git's own options taking a SEPARATE value token, skipped when looking for the
|
|
141
149
|
# subcommand so `git -c core.hooksPath=x commit` still reaches `commit`.
|
|
142
150
|
GIT_GLOBAL_SEPARATE_VALUE = {
|
|
@@ -278,6 +286,56 @@ def subcommand_after_git(tokens, start):
|
|
|
278
286
|
return None
|
|
279
287
|
|
|
280
288
|
|
|
289
|
+
def env_short_option_uses_split_string(token):
|
|
290
|
+
"""Whether one GNU env short-option cluster enables split-string."""
|
|
291
|
+
if not token.startswith("-") or token.startswith("--") or token == "-":
|
|
292
|
+
return False
|
|
293
|
+
for letter in token[1:]:
|
|
294
|
+
if letter == "S":
|
|
295
|
+
return True
|
|
296
|
+
if letter in {"u", "C", "a"}:
|
|
297
|
+
# The rest of this token is the option's value, not more options.
|
|
298
|
+
return False
|
|
299
|
+
if letter not in {"i", "0", "v"}:
|
|
300
|
+
return False
|
|
301
|
+
return False
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def env_uses_split_string(tokens, index):
|
|
305
|
+
"""Whether a command-position env invocation reparses an opaque payload."""
|
|
306
|
+
start = index - 1
|
|
307
|
+
while start >= 0 and tokens[start] not in COMMAND_SEPARATORS:
|
|
308
|
+
start -= 1
|
|
309
|
+
prefix = tokens[start + 1:index]
|
|
310
|
+
if not all("=" in token and not token.startswith("=") for token in prefix):
|
|
311
|
+
return False
|
|
312
|
+
|
|
313
|
+
cursor = index + 1
|
|
314
|
+
while cursor < len(tokens):
|
|
315
|
+
token = tokens[cursor]
|
|
316
|
+
if token in COMMAND_SEPARATORS or token == "--":
|
|
317
|
+
return False
|
|
318
|
+
if (
|
|
319
|
+
token in {"-S", "--split-string"}
|
|
320
|
+
or token.startswith("--split-string=")
|
|
321
|
+
or env_short_option_uses_split_string(token)
|
|
322
|
+
):
|
|
323
|
+
return True
|
|
324
|
+
if "=" in token and not token.startswith(("=", "-")):
|
|
325
|
+
cursor += 1
|
|
326
|
+
continue
|
|
327
|
+
if token in ENV_OPTIONS_NO_VALUE or token.startswith(
|
|
328
|
+
ENV_OPTIONS_INLINE_VALUE
|
|
329
|
+
):
|
|
330
|
+
cursor += 1
|
|
331
|
+
continue
|
|
332
|
+
if token in ENV_OPTIONS_SEPARATE_VALUE:
|
|
333
|
+
cursor += 2
|
|
334
|
+
continue
|
|
335
|
+
return False
|
|
336
|
+
return False
|
|
337
|
+
|
|
338
|
+
|
|
281
339
|
def git_commit_skips_verification(text):
|
|
282
340
|
"""Whether the command runs `git commit` with the short `-n` bypass.
|
|
283
341
|
|
|
@@ -291,6 +349,11 @@ def git_commit_skips_verification(text):
|
|
|
291
349
|
scoped_tokens = shell_tokens(text)
|
|
292
350
|
except ValueError:
|
|
293
351
|
return False
|
|
352
|
+
for index, token in enumerate(scoped_tokens):
|
|
353
|
+
if token.rsplit("/", 1)[-1] == "env" and env_uses_split_string(
|
|
354
|
+
scoped_tokens, index
|
|
355
|
+
):
|
|
356
|
+
return True
|
|
294
357
|
for index, token in enumerate(scoped_tokens):
|
|
295
358
|
# `/usr/bin/git` and a bare `git` are the same program; an env prefix
|
|
296
359
|
# (`HUSKY=1 git commit -n`) simply sits in an earlier token.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lisa-owned-hash-ledger.d.ts","sourceRoot":"","sources":["../../src/core/lisa-owned-hash-ledger.ts"],"names":[],"mappings":"AACA,6EAA6E;AAE7E;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAC3C,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"lisa-owned-hash-ledger.d.ts","sourceRoot":"","sources":["../../src/core/lisa-owned-hash-ledger.ts"],"names":[],"mappings":"AACA,6EAA6E;AAE7E;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAC3C,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAkwBjC,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CACpD,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAqqBjC,CAAC"}
|