@atolis-hq/wake 0.3.99 → 0.3.100
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.
|
@@ -3,14 +3,22 @@ import { GitHubBuiltInCommand } from '../contracts/vocabulary.js';
|
|
|
3
3
|
export function isHumanNonWakeReply(actorKind, body) {
|
|
4
4
|
return actorKind === ReviewActorKind.Human && !body.includes('<!-- wake:');
|
|
5
5
|
}
|
|
6
|
+
function commandLine(body) {
|
|
7
|
+
const trimmed = body.trim();
|
|
8
|
+
const newlineIndex = trimmed.indexOf('\n');
|
|
9
|
+
const line = newlineIndex === -1 ? trimmed : trimmed.slice(0, newlineIndex);
|
|
10
|
+
return line.trim().toLowerCase();
|
|
11
|
+
}
|
|
12
|
+
function matchesCommand(line, command) {
|
|
13
|
+
return line === command || (line.startsWith(command) && /\s/.test(line.charAt(command.length)));
|
|
14
|
+
}
|
|
6
15
|
export function recognizedCommand(body) {
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
16
|
+
const line = commandLine(body);
|
|
17
|
+
if (matchesCommand(line, GitHubBuiltInCommand.Approved))
|
|
9
18
|
return GitHubBuiltInCommand.Approved;
|
|
10
|
-
if (
|
|
11
|
-
normalized.startsWith(`${GitHubBuiltInCommand.Changes} `))
|
|
19
|
+
if (matchesCommand(line, GitHubBuiltInCommand.Changes))
|
|
12
20
|
return GitHubBuiltInCommand.Changes;
|
|
13
|
-
if (
|
|
21
|
+
if (matchesCommand(line, GitHubBuiltInCommand.Retry))
|
|
14
22
|
return GitHubBuiltInCommand.Retry;
|
|
15
23
|
return null;
|
|
16
24
|
}
|