@venizia/vulcan 0.4.9 → 0.4.10-1
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 +1 -1
- package/base/hooks/guard-outside.ts +34 -15
- package/base/hooks/guard-remote-hosts.ts +13 -4
- package/base/rules.md +1 -0
- package/base/templates/board.html +315 -77
- package/package.json +3 -3
- package/src/board/common/constants.ts +10 -0
- package/src/board/common/types.ts +21 -0
- package/src/board/fold.ts +138 -6
- package/src/commands/help.command.ts +1 -1
- package/src/config/schema.ts +12 -8
- package/src/events/command.ts +41 -2
- package/src/events/common/constants.ts +9 -0
- package/src/events/common/types.ts +10 -0
- package/src/events/hook.ts +6 -1
- package/src/events/log.ts +56 -5
- package/src/hooks/host-pattern.ts +17 -0
- package/src/hooks/remote-hosts.ts +39 -7
- package/src/router.ts +4 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HookConstants } from './common/index.ts';
|
|
2
|
+
import { HostPatterns } from './host-pattern.ts';
|
|
2
3
|
import type { IWriteHit } from './common/index.ts';
|
|
3
4
|
import { CommandView } from './command-view.ts';
|
|
4
5
|
import { HookDecision } from './decision.ts';
|
|
@@ -18,10 +19,19 @@ interface IRemoteHostsPolicy {
|
|
|
18
19
|
trusted: string[];
|
|
19
20
|
/** Hosts that only the strict read-only forms may reach. */
|
|
20
21
|
readOnly: string[];
|
|
21
|
-
/** Where the personal
|
|
22
|
+
/** Where the personal list lives, for the message. */
|
|
22
23
|
localFile?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
/** What the personal list holds: trusted hosts, read-only hosts, and the numbers of the lines that were skipped. */
|
|
27
|
+
interface IPersonalHosts {
|
|
28
|
+
trusted: string[];
|
|
29
|
+
readOnly: string[];
|
|
30
|
+
skipped: number[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const READONLY_PREFIX = 'readonly:';
|
|
34
|
+
|
|
25
35
|
interface ISegment {
|
|
26
36
|
words: string[];
|
|
27
37
|
/** `$(...)` or a backtick ran inside it: what it reaches is decided at run time. */
|
|
@@ -880,12 +890,34 @@ export class RemoteHosts {
|
|
|
880
890
|
});
|
|
881
891
|
}
|
|
882
892
|
|
|
883
|
-
/**
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
893
|
+
/**
|
|
894
|
+
* The personal list: one host per line, `#` starts a comment, `readonly: <host>` is a read-only host. An entry
|
|
895
|
+
* that is not a host name or a `*` pattern (a lone `*`, a user, a port, a path) is skipped, never trusted, and its
|
|
896
|
+
* line number is returned in `skipped`.
|
|
897
|
+
*/
|
|
898
|
+
static parsePersonalList(opts: { text: string }): IPersonalHosts {
|
|
899
|
+
const personal: IPersonalHosts = { trusted: [], readOnly: [], skipped: [] };
|
|
900
|
+
|
|
901
|
+
opts.text.split('\n').forEach((raw, index) => {
|
|
902
|
+
const line = raw.replace(/#.*$/, '').trim();
|
|
903
|
+
|
|
904
|
+
if (line === '') {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
const isReadOnly = line.startsWith(READONLY_PREFIX);
|
|
909
|
+
const value = isReadOnly ? line.slice(READONLY_PREFIX.length).trim() : line;
|
|
910
|
+
|
|
911
|
+
if (!HostPatterns.isValid({ value })) {
|
|
912
|
+
personal.skipped.push(index + 1);
|
|
913
|
+
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
(isReadOnly ? personal.readOnly : personal.trusted).push(value);
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
return personal;
|
|
889
921
|
}
|
|
890
922
|
|
|
891
923
|
/** Why each host this command reaches may not be reached without asking; empty means nothing to ask. */
|
package/src/router.ts
CHANGED
|
@@ -106,6 +106,10 @@ const ACCEPTED_ARGS: Record<string, IAcceptedArgs> = {
|
|
|
106
106
|
EventFlags.FLOW,
|
|
107
107
|
EventFlags.REF,
|
|
108
108
|
EventFlags.STATUS,
|
|
109
|
+
EventFlags.TITLE,
|
|
110
|
+
EventFlags.WHY,
|
|
111
|
+
EventFlags.CONTEXT,
|
|
112
|
+
EventFlags.NEXT,
|
|
109
113
|
EventFlags.ACTOR,
|
|
110
114
|
EventFlags.DIR,
|
|
111
115
|
EventFlags.SINCE,
|