@xynogen/pix-gate 0.2.12 → 0.2.13

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/prompt.ts +11 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-gate",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Pi extension — permission gate for dangerous bash commands (confirm/block with TUI dialog)",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/prompt.ts CHANGED
@@ -26,6 +26,11 @@ export interface Concern {
26
26
 
27
27
  export type GatePromptUI = ExtensionContext["ui"];
28
28
 
29
+ /** Title Case a severity tier for dialog titles: "critical" → "Critical". */
30
+ function titleCase(word: string): string {
31
+ return word ? word[0]!.toUpperCase() + word.slice(1).toLowerCase() : word;
32
+ }
33
+
29
34
  const TIMEOUT_MS: Record<Rule["severity"], number> = {
30
35
  critical: 15_000,
31
36
  dangerous: 30_000,
@@ -73,7 +78,7 @@ export async function promptPathDecision(
73
78
  path: string,
74
79
  ): Promise<GateDecision> {
75
80
  const icon = PATH_SEVERITY_ICON[hit.severity];
76
- const label = hit.severity.toUpperCase();
81
+ const label = titleCase(hit.severity);
77
82
  const accent = PATH_SEVERITY_COLOR[hit.severity];
78
83
 
79
84
  const choices =
@@ -105,7 +110,8 @@ export async function promptPathDecision(
105
110
 
106
111
  const result: OverlayResult = await showOverlay(ui as Parameters<typeof showOverlay>[0], {
107
112
  mode: "confirm",
108
- title: `${icon} ${label} — ${hit.reason}`,
113
+ icon,
114
+ title: `${label} — ${hit.reason}`,
109
115
  body: [`${op.toUpperCase()} ${path}`],
110
116
  accent,
111
117
  timeoutMs: PATH_TIMEOUT_MS[hit.severity],
@@ -231,7 +237,7 @@ export async function promptGateDecision(
231
237
  command: string,
232
238
  ): Promise<GateDecision> {
233
239
  const icon = SEVERITY_ICON[hit.severity];
234
- const label = hit.severity.toUpperCase();
240
+ const label = titleCase(hit.severity);
235
241
  const accent = SEVERITY_COLOR[hit.severity];
236
242
 
237
243
  // critical: deny listed first so it's the default selected item
@@ -260,7 +266,8 @@ export async function promptGateDecision(
260
266
 
261
267
  const result: OverlayResult = await showOverlay(ui as Parameters<typeof showOverlay>[0], {
262
268
  mode: "confirm",
263
- title: `${icon} ${label} — ${hit.reason}`,
269
+ icon,
270
+ title: `${label} — ${hit.reason}`,
264
271
  body: [command],
265
272
  accent,
266
273
  timeoutMs: TIMEOUT_MS[hit.severity],