@codyswann/lisa 4.21.4 → 4.21.6

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.
Files changed (126) hide show
  1. package/dist/cli/doctor-nightly-e2e-guard-command-files.d.ts +19 -0
  2. package/dist/cli/doctor-nightly-e2e-guard-command-files.d.ts.map +1 -0
  3. package/dist/cli/doctor-nightly-e2e-guard-command-files.js +221 -0
  4. package/dist/cli/doctor-nightly-e2e-guard-command-files.js.map +1 -0
  5. package/dist/cli/doctor-nightly-e2e-guard-contract.d.ts +113 -0
  6. package/dist/cli/doctor-nightly-e2e-guard-contract.d.ts.map +1 -0
  7. package/dist/cli/doctor-nightly-e2e-guard-contract.js +87 -0
  8. package/dist/cli/doctor-nightly-e2e-guard-contract.js.map +1 -0
  9. package/dist/cli/doctor-nightly-e2e-guard-deadline.d.ts +61 -0
  10. package/dist/cli/doctor-nightly-e2e-guard-deadline.d.ts.map +1 -0
  11. package/dist/cli/doctor-nightly-e2e-guard-deadline.js +97 -0
  12. package/dist/cli/doctor-nightly-e2e-guard-deadline.js.map +1 -0
  13. package/dist/cli/doctor-nightly-e2e-guard-evidence.d.ts +52 -0
  14. package/dist/cli/doctor-nightly-e2e-guard-evidence.d.ts.map +1 -0
  15. package/dist/cli/doctor-nightly-e2e-guard-evidence.js +68 -0
  16. package/dist/cli/doctor-nightly-e2e-guard-evidence.js.map +1 -0
  17. package/dist/cli/doctor-nightly-e2e-guard-graph.d.ts +14 -0
  18. package/dist/cli/doctor-nightly-e2e-guard-graph.d.ts.map +1 -0
  19. package/dist/cli/doctor-nightly-e2e-guard-graph.js +130 -0
  20. package/dist/cli/doctor-nightly-e2e-guard-graph.js.map +1 -0
  21. package/dist/cli/doctor-nightly-e2e-guard-io.d.ts +41 -0
  22. package/dist/cli/doctor-nightly-e2e-guard-io.d.ts.map +1 -0
  23. package/dist/cli/doctor-nightly-e2e-guard-io.js +239 -0
  24. package/dist/cli/doctor-nightly-e2e-guard-io.js.map +1 -0
  25. package/dist/cli/doctor-nightly-e2e-guard-job.d.ts +31 -0
  26. package/dist/cli/doctor-nightly-e2e-guard-job.d.ts.map +1 -0
  27. package/dist/cli/doctor-nightly-e2e-guard-job.js +156 -0
  28. package/dist/cli/doctor-nightly-e2e-guard-job.js.map +1 -0
  29. package/dist/cli/doctor-nightly-e2e-guard-proof.d.ts +42 -0
  30. package/dist/cli/doctor-nightly-e2e-guard-proof.d.ts.map +1 -0
  31. package/dist/cli/doctor-nightly-e2e-guard-proof.js +57 -0
  32. package/dist/cli/doctor-nightly-e2e-guard-proof.js.map +1 -0
  33. package/dist/cli/doctor-nightly-e2e-guard-remediation.d.ts +32 -0
  34. package/dist/cli/doctor-nightly-e2e-guard-remediation.d.ts.map +1 -0
  35. package/dist/cli/doctor-nightly-e2e-guard-remediation.js +55 -0
  36. package/dist/cli/doctor-nightly-e2e-guard-remediation.js.map +1 -0
  37. package/dist/cli/doctor-nightly-e2e-guard-runtime.d.ts +34 -0
  38. package/dist/cli/doctor-nightly-e2e-guard-runtime.d.ts.map +1 -0
  39. package/dist/cli/doctor-nightly-e2e-guard-runtime.js +93 -0
  40. package/dist/cli/doctor-nightly-e2e-guard-runtime.js.map +1 -0
  41. package/dist/cli/doctor-nightly-e2e-guard-scan.d.ts +17 -0
  42. package/dist/cli/doctor-nightly-e2e-guard-scan.d.ts.map +1 -0
  43. package/dist/cli/doctor-nightly-e2e-guard-scan.js +86 -0
  44. package/dist/cli/doctor-nightly-e2e-guard-scan.js.map +1 -0
  45. package/dist/cli/doctor-nightly-e2e-guard-shell-lexer.d.ts +38 -0
  46. package/dist/cli/doctor-nightly-e2e-guard-shell-lexer.d.ts.map +1 -0
  47. package/dist/cli/doctor-nightly-e2e-guard-shell-lexer.js +160 -0
  48. package/dist/cli/doctor-nightly-e2e-guard-shell-lexer.js.map +1 -0
  49. package/dist/cli/doctor-nightly-e2e-guard-shell.d.ts +40 -0
  50. package/dist/cli/doctor-nightly-e2e-guard-shell.d.ts.map +1 -0
  51. package/dist/cli/doctor-nightly-e2e-guard-shell.js +201 -0
  52. package/dist/cli/doctor-nightly-e2e-guard-shell.js.map +1 -0
  53. package/dist/cli/doctor-nightly-e2e-guard.d.ts +36 -0
  54. package/dist/cli/doctor-nightly-e2e-guard.d.ts.map +1 -0
  55. package/dist/cli/doctor-nightly-e2e-guard.js +186 -0
  56. package/dist/cli/doctor-nightly-e2e-guard.js.map +1 -0
  57. package/dist/cli/doctor.d.ts.map +1 -1
  58. package/dist/cli/doctor.js +7 -0
  59. package/dist/cli/doctor.js.map +1 -1
  60. package/dist/core/nightly-e2e-guard-behavior-certificate.d.ts +25 -0
  61. package/dist/core/nightly-e2e-guard-behavior-certificate.d.ts.map +1 -0
  62. package/dist/core/nightly-e2e-guard-behavior-certificate.js +30 -0
  63. package/dist/core/nightly-e2e-guard-behavior-certificate.js.map +1 -0
  64. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  65. package/dist/core/upstream-evidence-manifest.js +30 -3
  66. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  67. package/package.json +5 -3
  68. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  70. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/publish-aws-bootstrap.mjs +17 -2
  71. package/plugins/lisa/skills/lisa-secrets-access/scripts/publish-aws-bootstrap.mjs +17 -2
  72. package/plugins/lisa-agy/plugin.json +1 -1
  73. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/publish-aws-bootstrap.mjs +17 -2
  74. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  76. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  77. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/publish-aws-bootstrap.mjs +17 -2
  81. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/publish-aws-bootstrap.mjs +17 -2
  83. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  85. package/plugins/lisa-expo-agy/plugin.json +1 -1
  86. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  90. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  91. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  93. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  95. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  96. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  100. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  101. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  104. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  105. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  106. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  107. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  108. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  109. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  110. package/plugins/lisa-rails-agy/plugin.json +1 -1
  111. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  112. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  113. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  114. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  115. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  116. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  117. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  118. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  119. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  120. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  121. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  122. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  123. package/plugins/src/base/skills/lisa-secrets-access/scripts/publish-aws-bootstrap.mjs +17 -2
  124. package/scripts/check-derived-artifacts.mjs +32 -5
  125. package/scripts/generate-nightly-e2e-guard-certificate.mjs +370 -0
  126. package/scripts/two-channel-couplings.json +16 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-nightly-e2e-guard-scan.js","sourceRoot":"","sources":["../../src/cli/doctor-nightly-e2e-guard-scan.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,mCAAmC,EACnC,kCAAkC,EAClC,uBAAuB,EAGvB,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OAAkC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @file doctor-nightly-e2e-guard-shell-lexer.ts
3
+ * @description Bounded comment-aware lexer for the supported guard run grammar
4
+ * @module cli/doctor-nightly-e2e-guard-shell-lexer
5
+ */
6
+ /** How a shell word acquired its bytes. */
7
+ type QuoteKind = "unquoted" | "single" | "double" | "mixed";
8
+ /** One decoded shell word retained by the supported grammar. */
9
+ export interface ShellWord {
10
+ readonly kind: "word";
11
+ readonly value: string;
12
+ readonly quote: QuoteKind;
13
+ /** Shell expansion or unquoted glob syntax prevents exact byte proof. */
14
+ readonly dynamic: boolean;
15
+ }
16
+ /** One command separator or unsupported shell operator. */
17
+ interface ShellOperator {
18
+ readonly kind: "operator";
19
+ readonly value: string;
20
+ }
21
+ /** Bounded lexical token used only by the static interpreter. */
22
+ export type ShellToken = ShellWord | ShellOperator;
23
+ /** Result of lexing one YAML-decoded run scalar. */
24
+ export interface ShellLexResult {
25
+ readonly tokens?: readonly ShellToken[];
26
+ readonly reason?: string;
27
+ }
28
+ /**
29
+ * Lex shell words/operators while applying POSIX comment boundaries.
30
+ *
31
+ * `#` begins a comment only outside quotes at the start of a word. The scan is
32
+ * bounded by the 1 MiB workflow read and a 64-token grammar ceiling.
33
+ * @param source - YAML-decoded run scalar
34
+ * @returns Tokens or one fail-closed grammar reason
35
+ */
36
+ export declare function lexNightlyGuardRun(source: string): ShellLexResult;
37
+ export {};
38
+ //# sourceMappingURL=doctor-nightly-e2e-guard-shell-lexer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-nightly-e2e-guard-shell-lexer.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-nightly-e2e-guard-shell-lexer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,2CAA2C;AAC3C,KAAK,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5D,gEAAgE;AAChE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,2DAA2D;AAC3D,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAcnD,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AA2KD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAoBjE"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * @file doctor-nightly-e2e-guard-shell-lexer.ts
3
+ * @description Bounded comment-aware lexer for the supported guard run grammar
4
+ * @module cli/doctor-nightly-e2e-guard-shell-lexer
5
+ */
6
+ const MAX_SHELL_TOKENS = 64;
7
+ const QUOTE_CHARACTERS = ["'", '"'];
8
+ const HORIZONTAL_WHITESPACE = [" ", "\t", "\r"];
9
+ const COMMAND_BOUNDARIES = ["\n", ";"];
10
+ const SHELL_OPERATORS = [">", "<", "&", "|", "(", ")"];
11
+ const quoteFor = (mask) => {
12
+ if (mask === 2)
13
+ return "single";
14
+ if (mask === 4)
15
+ return "double";
16
+ if (mask === 0 || mask === 1)
17
+ return "unquoted";
18
+ return "mixed";
19
+ };
20
+ const withToken = (state, token) => state.tokens.length >= MAX_SHELL_TOKENS
21
+ ? {
22
+ ...state,
23
+ error: `shell token limit ${MAX_SHELL_TOKENS} exceeded`,
24
+ }
25
+ : { ...state, tokens: [...state.tokens, token] };
26
+ const flushWord = (state) => state.word.length === 0
27
+ ? state
28
+ : withToken({ ...state, word: "", quoteMask: 0, dynamic: false }, {
29
+ kind: "word",
30
+ value: state.word,
31
+ quote: quoteFor(state.quoteMask),
32
+ dynamic: state.dynamic,
33
+ });
34
+ const withOperator = (state, value) => withToken(flushWord(state), { kind: "operator", value });
35
+ const withoutQuote = (state) => ({
36
+ tokens: state.tokens,
37
+ word: state.word,
38
+ quoteMask: state.quoteMask,
39
+ dynamic: state.dynamic,
40
+ comment: state.comment,
41
+ skipNext: state.skipNext,
42
+ ...(state.error ? { error: state.error } : {}),
43
+ });
44
+ const quotedCharacter = (state, source, character, index) => {
45
+ if ((character === "'" && state.quote === "single") ||
46
+ (character === '"' && state.quote === "double")) {
47
+ return withoutQuote(state);
48
+ }
49
+ if (character !== "\\" || state.quote !== "double") {
50
+ return {
51
+ ...state,
52
+ word: `${state.word}${character}`,
53
+ dynamic: state.dynamic ||
54
+ (state.quote === "double" && ["$", "`"].includes(character)),
55
+ };
56
+ }
57
+ const next = source[index + 1];
58
+ if (next === undefined) {
59
+ return { ...state, error: "unterminated shell escape" };
60
+ }
61
+ if (next === "\n")
62
+ return { ...state, skipNext: true };
63
+ return ["$", "`", '"', "\\"].includes(next)
64
+ ? { ...state, word: `${state.word}${next}`, skipNext: true }
65
+ : { ...state, word: `${state.word}\\` };
66
+ };
67
+ const escapedCharacter = (state, source, index) => {
68
+ const next = source[index + 1];
69
+ if (next === undefined) {
70
+ return { ...state, error: "unterminated shell escape" };
71
+ }
72
+ if (next === "\n")
73
+ return { ...state, skipNext: true };
74
+ return {
75
+ ...state,
76
+ word: `${state.word}${next}`,
77
+ quoteMask: state.quoteMask | 1,
78
+ skipNext: true,
79
+ };
80
+ };
81
+ const quotedStart = (state, character) => {
82
+ const single = character === "'";
83
+ return {
84
+ ...state,
85
+ quote: single ? "single" : "double",
86
+ quoteMask: state.quoteMask | (single ? 2 : 4),
87
+ };
88
+ };
89
+ const ordinaryCharacter = (state, character) => ({
90
+ ...state,
91
+ word: `${state.word}${character}`,
92
+ quoteMask: state.quoteMask | 1,
93
+ dynamic: state.dynamic || ["$", "`", "*", "?", "[", "~", "{"].includes(character),
94
+ });
95
+ const operatorCharacter = (state, source, character, index) => {
96
+ const doubled = source[index + 1] === character;
97
+ return {
98
+ ...withOperator(state, doubled ? `${character}${character}` : character),
99
+ skipNext: doubled,
100
+ };
101
+ };
102
+ const unquotedCharacter = (state, source, character, index) => {
103
+ if (QUOTE_CHARACTERS.includes(character)) {
104
+ return quotedStart(state, character);
105
+ }
106
+ if (character === "\\")
107
+ return escapedCharacter(state, source, index);
108
+ if (character === "#" && state.word.length === 0) {
109
+ return { ...state, comment: true };
110
+ }
111
+ if (HORIZONTAL_WHITESPACE.includes(character))
112
+ return flushWord(state);
113
+ if (COMMAND_BOUNDARIES.includes(character)) {
114
+ return withOperator(state, character);
115
+ }
116
+ return SHELL_OPERATORS.includes(character)
117
+ ? operatorCharacter(state, source, character, index)
118
+ : ordinaryCharacter(state, character);
119
+ };
120
+ const lexCharacter = (state, source, character, index) => {
121
+ if (state.error)
122
+ return state;
123
+ if (state.skipNext)
124
+ return { ...state, skipNext: false };
125
+ if (state.comment) {
126
+ return character === "\n"
127
+ ? { ...withOperator(state, "\n"), comment: false }
128
+ : state;
129
+ }
130
+ return state.quote
131
+ ? quotedCharacter(state, source, character, index)
132
+ : unquotedCharacter(state, source, character, index);
133
+ };
134
+ /**
135
+ * Lex shell words/operators while applying POSIX comment boundaries.
136
+ *
137
+ * `#` begins a comment only outside quotes at the start of a word. The scan is
138
+ * bounded by the 1 MiB workflow read and a 64-token grammar ceiling.
139
+ * @param source - YAML-decoded run scalar
140
+ * @returns Tokens or one fail-closed grammar reason
141
+ */
142
+ export function lexNightlyGuardRun(source) {
143
+ const scanned = source
144
+ .split("")
145
+ .reduce((state, character, index) => lexCharacter(state, source, character, index), {
146
+ tokens: [],
147
+ word: "",
148
+ quoteMask: 0,
149
+ dynamic: false,
150
+ comment: false,
151
+ skipNext: false,
152
+ });
153
+ const completed = flushWord(scanned);
154
+ if (completed.error)
155
+ return { reason: completed.error };
156
+ return completed.quote
157
+ ? { reason: "unterminated shell quote" }
158
+ : { tokens: completed.tokens };
159
+ }
160
+ //# sourceMappingURL=doctor-nightly-e2e-guard-shell-lexer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-nightly-e2e-guard-shell-lexer.js","sourceRoot":"","sources":["../../src/cli/doctor-nightly-e2e-guard-shell-lexer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACpC,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAChD,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACvC,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAyCvD,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAa,EAAE;IAC3C,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChC,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChC,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC;IAChD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAChB,KAAsB,EACtB,KAAiB,EACA,EAAE,CACnB,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,gBAAgB;IACrC,CAAC,CAAC;QACE,GAAG,KAAK;QACR,KAAK,EAAE,qBAAqB,gBAAgB,WAAW;KACxD;IACH,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,MAA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AK;QACpB,CAAC,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE;QACxC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type NightlyGuardCommandFileWrite } from "./doctor-nightly-e2e-guard-command-files.js";
2
+ import { type NightlyGuardRuntimeContext } from "./doctor-nightly-e2e-guard-runtime.js";
3
+ /** Supported interpretation of one `run` scalar. */
4
+ export interface NightlyGuardRunInspection {
5
+ /** Literal target or an environment-resolution refusal. */
6
+ readonly target?: string;
7
+ /** Any Node token whose command did not fit the supported grammar. */
8
+ readonly reason?: string;
9
+ /** The command is the non-gating contract/report operation. */
10
+ readonly reportingOnly: boolean;
11
+ /** A Node command occurred after comment removal. */
12
+ readonly containsNode: boolean;
13
+ /** Executable shell construction of bypass state. */
14
+ readonly bypassWiring?: "inline environment" | "GITHUB_ENV";
15
+ /** Comment-stripped executable evidence that this step controls bypass. */
16
+ readonly bypassEvidence: boolean;
17
+ /** Ordered command-file effects retained for later guard-step attribution. */
18
+ readonly commandFileWrites?: readonly NightlyGuardCommandFileWrite[];
19
+ }
20
+ /**
21
+ * Compare bypass vocabulary independently of label case and punctuation.
22
+ * @param value - Executable expression or literal environment value
23
+ * @returns Whether the normalized text can denote nightly bypass state
24
+ */
25
+ export declare const hasNightlyBypassReference: (value: string) => boolean;
26
+ /**
27
+ * Match the exact environment names implemented by the shipped guard.
28
+ * @param value - YAML or shell environment name
29
+ * @returns Whether the name is part of the bounded-waiver contract
30
+ */
31
+ export declare const isNightlyBypassEnvironmentName: (value: string) => boolean;
32
+ /**
33
+ * Interpret the supported Node grammar after bounded comment-aware lexing.
34
+ * @param run - YAML-decoded shell scalar
35
+ * @param env - Literal YAML environment levels available to this step
36
+ * @param context - Runner and effective shell metadata proving POSIX semantics
37
+ * @returns Static target/reporting/refusal and bypass-wiring evidence
38
+ */
39
+ export declare function inspectNightlyGuardRun(run: string, env: Readonly<Record<string, string>>, context: NightlyGuardRuntimeContext): NightlyGuardRunInspection;
40
+ //# sourceMappingURL=doctor-nightly-e2e-guard-shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-nightly-e2e-guard-shell.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-nightly-e2e-guard-shell.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,6CAA6C,CAAC;AAMrD,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,uCAAuC,CAAC;AAc/C,oDAAoD;AACpD,MAAM,WAAW,yBAAyB;IACxC,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,qDAAqD;IACrD,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,GAAG,YAAY,CAAC;IAC5D,2EAA2E;IAC3E,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,4BAA4B,EAAE,CAAC;CACtE;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,KAAG,OAiBzD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,GAAI,OAAO,MAAM,KAAG,OACM,CAAC;AAqMtE;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACrC,OAAO,EAAE,0BAA0B,GAClC,yBAAyB,CA6B3B"}
@@ -0,0 +1,201 @@
1
+ /**
2
+ * @file doctor-nightly-e2e-guard-shell.ts
3
+ * @description Static interpreter for the intentionally small guard run grammar
4
+ * @module cli/doctor-nightly-e2e-guard-shell
5
+ */
6
+ import { normalizeNightlyGuardTarget } from "./doctor-nightly-e2e-guard-contract.js";
7
+ import { inspectNightlyGuardCommandFileWrites, } from "./doctor-nightly-e2e-guard-command-files.js";
8
+ import { lexNightlyGuardRun, } from "./doctor-nightly-e2e-guard-shell-lexer.js";
9
+ import { isExecutionChangingEnvironmentName, nightlyGuardEnvironmentFailure, nightlyGuardPosixContextFailure, } from "./doctor-nightly-e2e-guard-runtime.js";
10
+ const ENVIRONMENT_NAME = /^[A-Z][A-Z0-9_]*$/u;
11
+ const ENVIRONMENT_TARGET = /^\$(?:\{([A-Z][A-Z0-9_]*)\}|([A-Z][A-Z0-9_]*))$/u;
12
+ const BYPASS_ENVIRONMENT_NAMES = new Set([
13
+ "GATE_BYPASS",
14
+ "NIGHTLY_BYPASS",
15
+ "NIGHTLY_BYPASS_LABEL",
16
+ "NIGHTLY_BYPASS_MAX_HOURS",
17
+ "NIGHTLY_BYPASS_REASON_PATTERN",
18
+ ]);
19
+ const EXACT_BYPASS_REFERENCE = /(?:^|[^A-Z0-9_])(?:GATE_BYPASS|NIGHTLY_BYPASS)(?=$|[^A-Z0-9_])/iu;
20
+ /**
21
+ * Compare bypass vocabulary independently of label case and punctuation.
22
+ * @param value - Executable expression or literal environment value
23
+ * @returns Whether the normalized text can denote nightly bypass state
24
+ */
25
+ export const hasNightlyBypassReference = (value) => {
26
+ const terms = value
27
+ .toLowerCase()
28
+ .split(/[^a-z0-9]+/u)
29
+ .filter(Boolean);
30
+ const candidates = value
31
+ .split(/['"`()$,{}[\]]+/u)
32
+ .map(candidate => candidate.toLowerCase().replace(/[^a-z0-9]/gu, ""));
33
+ const constructedExpression = /\$\{\{[\s\S]*\}\}/u.test(value) &&
34
+ ["nightly", "e2e", "bypass"].every(term => terms.includes(term)) &&
35
+ !terms.includes("cache");
36
+ return (EXACT_BYPASS_REFERENCE.test(value) ||
37
+ candidates.includes("nightlye2ebypass") ||
38
+ constructedExpression);
39
+ };
40
+ /**
41
+ * Match the exact environment names implemented by the shipped guard.
42
+ * @param value - YAML or shell environment name
43
+ * @returns Whether the name is part of the bounded-waiver contract
44
+ */
45
+ export const isNightlyBypassEnvironmentName = (value) => ENVIRONMENT_NAME.test(value) && BYPASS_ENVIRONMENT_NAMES.has(value);
46
+ const words = (tokens) => tokens.filter((token) => token.kind === "word");
47
+ const actualEnvironmentTarget = (word) => word.quote === "single"
48
+ ? undefined
49
+ : ENVIRONMENT_TARGET.exec(word.value)?.[0];
50
+ const environmentName = (word) => {
51
+ const match = ENVIRONMENT_TARGET.exec(word.value);
52
+ return match?.[1] ?? match?.[2];
53
+ };
54
+ const targetFromWord = (word, env) => {
55
+ if (word.quote === "single" && ENVIRONMENT_TARGET.test(word.value)) {
56
+ return {
57
+ reason: "single-quoted environment target is a literal shell string and cannot resolve a guard",
58
+ };
59
+ }
60
+ const variable = actualEnvironmentTarget(word);
61
+ const candidate = variable ? env[environmentName(word) ?? ""] : word.value;
62
+ if (candidate === undefined) {
63
+ return {
64
+ reason: "could not resolve the Node target from one unquoted or double-quoted literal environment level",
65
+ };
66
+ }
67
+ const target = normalizeNightlyGuardTarget(candidate);
68
+ return target
69
+ ? { target }
70
+ : {
71
+ reason: "Node target must be one literal contained relative ASCII .js/.mjs/.cjs path; expressions, substitutions, absolute/escaping paths, and multiple commands are unsupported",
72
+ };
73
+ };
74
+ const bypassAssignment = (word) => {
75
+ const equals = word.value.indexOf("=");
76
+ if (equals <= 0)
77
+ return false;
78
+ const name = word.value.slice(0, equals);
79
+ return isNightlyBypassEnvironmentName(name);
80
+ };
81
+ const safeEnvironmentFileName = (name) => !isNightlyBypassEnvironmentName(name) &&
82
+ !hasNightlyBypassReference(name) &&
83
+ !isExecutionChangingEnvironmentName(name);
84
+ const runMetadata = (tokens) => {
85
+ const commandWords = words(tokens);
86
+ const node = commandWords.findIndex(word => word.value === "node");
87
+ const containsNode = node >= 0;
88
+ const fileWrites = inspectNightlyGuardCommandFileWrites(tokens, safeEnvironmentFileName);
89
+ const bypassEvidence = commandWords.some(word => bypassAssignment(word) || hasNightlyBypassReference(word.value));
90
+ const normalizedRun = commandWords.map(word => word.value).join(" ");
91
+ const inlineEnvironment = containsNode &&
92
+ (commandWords.slice(0, node).some(bypassAssignment) ||
93
+ (commandWords[0]?.value === "env" &&
94
+ hasNightlyBypassReference(normalizedRun)));
95
+ const bypassWiring = fileWrites.some(write => write.file === "GITHUB_ENV" && write.safety !== "safe")
96
+ ? "GITHUB_ENV"
97
+ : inlineEnvironment
98
+ ? "inline environment"
99
+ : undefined;
100
+ return {
101
+ commandWords,
102
+ node,
103
+ containsNode,
104
+ bypassEvidence,
105
+ ...(bypassWiring ? { bypassWiring } : {}),
106
+ ...(fileWrites.length > 0 ? { commandFileWrites: fileWrites } : {}),
107
+ };
108
+ };
109
+ const resultBase = (metadata) => ({
110
+ reportingOnly: false,
111
+ containsNode: metadata.containsNode,
112
+ bypassEvidence: metadata.bypassEvidence,
113
+ ...(metadata.bypassWiring ? { bypassWiring: metadata.bypassWiring } : {}),
114
+ ...(metadata.commandFileWrites
115
+ ? { commandFileWrites: metadata.commandFileWrites }
116
+ : {}),
117
+ });
118
+ const commandGroups = (tokens) => tokens
119
+ .reduce((groups, token) => {
120
+ if (token.kind === "operator" &&
121
+ (token.value === "\n" || token.value === ";")) {
122
+ return groups.at(-1)?.length === 0 ? groups : [...groups, []];
123
+ }
124
+ const prior = groups.slice(0, -1);
125
+ const last = groups.at(-1) ?? [];
126
+ return [...prior, [...last, token]];
127
+ }, [[]])
128
+ .filter(group => group.length > 0);
129
+ const unsupportedCommandShape = (tokens) => tokens.some(token => token.kind === "operator" && token.value !== "\n" && token.value !== ";") || commandGroups(tokens).length !== 1;
130
+ const nodePrefixFailure = (commandWords, node) => {
131
+ const prefix = commandWords.slice(0, node);
132
+ if (prefix.length === 0 ||
133
+ (prefix.length === 1 && prefix[0]?.value === "env")) {
134
+ return undefined;
135
+ }
136
+ const assignments = prefix.filter(word => word.value.includes("="));
137
+ const dangerous = assignments.find(word => isExecutionChangingEnvironmentName(word.value.slice(0, word.value.indexOf("="))));
138
+ if (dangerous) {
139
+ return `${dangerous.value.slice(0, dangerous.value.indexOf("="))} pre-node assignment is unsafe`;
140
+ }
141
+ return assignments.length > 0
142
+ ? "pre-node environment assignments are unsupported because they can change certified handler behavior"
143
+ : "Node command does not match the supported literal grammar";
144
+ };
145
+ const inspectNodeCommand = (metadata, env, environmentFailure) => {
146
+ const base = resultBase(metadata);
147
+ const afterNode = metadata.commandWords.slice(metadata.node + 1);
148
+ const prefixFailure = nodePrefixFailure(metadata.commandWords, metadata.node);
149
+ const refusal = environmentFailure ?? prefixFailure;
150
+ if (refusal || (afterNode.length !== 1 && afterNode.length !== 2)) {
151
+ return {
152
+ ...base,
153
+ reason: refusal ?? "Node command does not match the supported literal grammar",
154
+ };
155
+ }
156
+ const option = afterNode[1]?.value;
157
+ if (option === "--contract-version" || option === "--report-issues") {
158
+ return { ...base, reportingOnly: true };
159
+ }
160
+ if (afterNode.length !== 1) {
161
+ return { ...base, reason: "Node target has unsupported arguments" };
162
+ }
163
+ return {
164
+ ...base,
165
+ ...targetFromWord(afterNode[0], env),
166
+ };
167
+ };
168
+ /**
169
+ * Interpret the supported Node grammar after bounded comment-aware lexing.
170
+ * @param run - YAML-decoded shell scalar
171
+ * @param env - Literal YAML environment levels available to this step
172
+ * @param context - Runner and effective shell metadata proving POSIX semantics
173
+ * @returns Static target/reporting/refusal and bypass-wiring evidence
174
+ */
175
+ export function inspectNightlyGuardRun(run, env, context) {
176
+ const lexical = lexNightlyGuardRun(run);
177
+ if (!lexical.tokens) {
178
+ return {
179
+ reportingOnly: false,
180
+ containsNode: /(?:^|[ \t])node(?:[ \t]|$)/u.test(run),
181
+ bypassEvidence: hasNightlyBypassReference(run),
182
+ ...(lexical.reason ? { reason: lexical.reason } : {}),
183
+ };
184
+ }
185
+ const tokens = lexical.tokens;
186
+ const metadata = runMetadata(tokens);
187
+ const contextFailure = nightlyGuardPosixContextFailure(run, context);
188
+ if (contextFailure) {
189
+ return { ...resultBase(metadata), reason: contextFailure };
190
+ }
191
+ if (!metadata.containsNode)
192
+ return resultBase(metadata);
193
+ if (unsupportedCommandShape(tokens)) {
194
+ return {
195
+ ...resultBase(metadata),
196
+ reason: "multiple commands, pipelines, and shell operators are unsupported",
197
+ };
198
+ }
199
+ return inspectNodeCommand(metadata, env, nightlyGuardEnvironmentFailure(context.environment));
200
+ }
201
+ //# sourceMappingURL=doctor-nightly-e2e-guard-shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-nightly-e2e-guard-shell.js","sourceRoot":"","sources":["../../src/cli/doctor-nightly-e2e-guard-shell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EACL,oCAAoC,GAErC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,kBAAkB,GAGnB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,+BAA+B,GAEhC,MAAM,uCAAuC,CAAC;AAE/C,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAC9C,MAAM,kBAAkB,GAAG,kDAAkD,CAAC;AAC9E,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IACvC,aAAa;IACb,gBAAgB;IAChB,sBAAsB;IACtB,0BAA0B;IAC1B,+BAA+B;CAChC,CAAC,CAAC;AACH,MAAM,sBAAsB,GAC1B,kEAAkE,CAAC;AAoBrE;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAW,EAAE;IAClE,MAAM,KAAK,GAAG,KAAK;SAChB,WAAW,EAAE;SACb,KAAK,CAAC,aAAa,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CAAC;IACnB,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,CAAC,WAAW,CAAC,CACpD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { HashLedger } from "../core/lisa-owned-provenance.js";
2
+ import type { DoctorCheck } from "./doctor.js";
3
+ import { type NightlyGuardProbeResult, type NightlyGuardScanResult } from "./doctor-nightly-e2e-guard-contract.js";
4
+ import { proveNightlyE2eGuardTarget, type NightlyGuardBehaviorCertificates, type NightlyGuardProofDependencies } from "./doctor-nightly-e2e-guard-proof.js";
5
+ import { type NightlyGuardScanDependencies } from "./doctor-nightly-e2e-guard-scan.js";
6
+ /** Stable doctor row name shared by human and JSON output. */
7
+ export declare const NIGHTLY_GUARD_CHECK_NAME = "Nightly E2E bypass guard bounded?";
8
+ /** Injected read-only collaborators for deterministic deadline/provenance tests. */
9
+ export interface NightlyGuardDependencies {
10
+ /** Installed Lisa root, for package-copy remediation classification. */
11
+ readonly lisaRoot?: string;
12
+ /** Known shipped hashes, injectable for provenance bite controls. */
13
+ readonly ledger?: HashLedger;
14
+ /** Exact behavior certificates, injectable for package fixture tests. */
15
+ readonly certificates?: NightlyGuardBehaviorCertificates;
16
+ /** Monotonic clock started before discovery. */
17
+ readonly now?: () => number;
18
+ /** Discovery seam used to prove the outer deadline includes scanning. */
19
+ readonly scanImpl?: (projectRoot: string, dependencies?: NightlyGuardScanDependencies) => Promise<NightlyGuardScanResult>;
20
+ /** Static target proof seam used to prove target deduplication. */
21
+ readonly probeImpl?: (projectRoot: string, target: string, dependencies?: NightlyGuardProofDependencies) => Promise<NightlyGuardProbeResult>;
22
+ /** Target ceiling override used only by deterministic tests. */
23
+ readonly timeoutMs?: number;
24
+ }
25
+ /**
26
+ * Report whether every active bypass-bearing nightly caller runs a trusted,
27
+ * compatible major-1 guard without evaluating any target bytes.
28
+ * @param projectRoot - Project root to inspect without mutation
29
+ * @param dependencies - Optional read-only collaborators for tests
30
+ * @returns Existing `DoctorCheck` shape used by both renderers and exit logic
31
+ */
32
+ export declare function checkNightlyE2eGuard(projectRoot: string, dependencies?: NightlyGuardDependencies): Promise<DoctorCheck>;
33
+ /** Backward-compatible name for direct callers of the former executable probe. */
34
+ export declare const probeNightlyE2eGuardTarget: typeof proveNightlyE2eGuardTarget;
35
+ export type { NightlyGuardProbeResult } from "./doctor-nightly-e2e-guard-contract.js";
36
+ //# sourceMappingURL=doctor-nightly-e2e-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-nightly-e2e-guard.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-nightly-e2e-guard.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC5B,MAAM,wCAAwC,CAAC;AAOhD,OAAO,EACL,0BAA0B,EAC1B,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EACnC,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,oCAAoC,CAAC;AAE5C,8DAA8D;AAC9D,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAqB5E,oFAAoF;AACpF,MAAM,WAAW,wBAAwB;IACvC,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,gCAAgC,CAAC;IACzD,gDAAgD;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAClB,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,4BAA4B,KACxC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrC,mEAAmE;IACnE,QA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