pi-profiles-manager 1.1.5 → 1.1.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.
- package/package.json +1 -1
- package/src/extension.test.ts +24 -4
- package/src/extension.ts +7 -4
package/package.json
CHANGED
package/src/extension.test.ts
CHANGED
|
@@ -266,7 +266,7 @@ describe("package extension", () => {
|
|
|
266
266
|
);
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
-
it.each(["return", "escape"])(
|
|
269
|
+
it.each(["return", "escape", "a", "space"])(
|
|
270
270
|
"keeps export string visible until %s dismisses it",
|
|
271
271
|
async (dismissKey) => {
|
|
272
272
|
const syncFs = await import("node:fs");
|
|
@@ -320,13 +320,28 @@ describe("package extension", () => {
|
|
|
320
320
|
expect(codingAgentState.copyToClipboard).toHaveBeenCalledWith(
|
|
321
321
|
"piprofile:1:eyJfdHlwZSI6InBpcHJvZmlsZSIsInZlcnNpb24iOjEsInByb2ZpbGUiOnsibmFtZSI6ImFscGhhIiwib3JkZXIiOjAsImZhdm9yaXRlIjpmYWxzZX19",
|
|
322
322
|
);
|
|
323
|
+
expect(tuiState.texts).toContainEqual([
|
|
324
|
+
"📤 Profile Export: 'alpha'",
|
|
325
|
+
1,
|
|
326
|
+
0,
|
|
327
|
+
]);
|
|
328
|
+
expect(tuiState.texts).toContainEqual([
|
|
329
|
+
"Select string below to copy:",
|
|
330
|
+
1,
|
|
331
|
+
0,
|
|
332
|
+
]);
|
|
323
333
|
expect(tuiState.texts).toContainEqual([
|
|
324
334
|
"piprofile:1:eyJfdHlwZSI6InBpcHJvZmlsZSIsInZlcnNpb24iOjEsInByb2ZpbGUiOnsibmFtZSI6ImFscGhhIiwib3JkZXIiOjAsImZhdm9yaXRlIjpmYWxzZX19",
|
|
325
335
|
1,
|
|
326
336
|
0,
|
|
327
337
|
]);
|
|
328
338
|
expect(tuiState.texts).toContainEqual([
|
|
329
|
-
|
|
339
|
+
"[ Press any key or Esc to close ]",
|
|
340
|
+
1,
|
|
341
|
+
0,
|
|
342
|
+
]);
|
|
343
|
+
expect(tuiState.texts).toContainEqual([
|
|
344
|
+
"✓ Copy command sent to terminal clipboard.",
|
|
330
345
|
1,
|
|
331
346
|
0,
|
|
332
347
|
]);
|
|
@@ -343,7 +358,7 @@ describe("package extension", () => {
|
|
|
343
358
|
expect(finishConfirmation).toBeDefined();
|
|
344
359
|
expect(handlerSettled).toBe(true);
|
|
345
360
|
expect(ctx.ui.notify).not.toHaveBeenCalledWith(
|
|
346
|
-
"
|
|
361
|
+
"✓ Copy command sent to terminal clipboard.",
|
|
347
362
|
"info",
|
|
348
363
|
);
|
|
349
364
|
},
|
|
@@ -396,13 +411,18 @@ describe("package extension", () => {
|
|
|
396
411
|
const handling = handler("", ctx).then(() => { handlerSettled = true; });
|
|
397
412
|
await vi.waitFor(() => expect(custom).toHaveBeenCalledTimes(3));
|
|
398
413
|
|
|
414
|
+
expect(tuiState.texts).toContainEqual([
|
|
415
|
+
"📤 Profile Export: 'alpha'",
|
|
416
|
+
1,
|
|
417
|
+
0,
|
|
418
|
+
]);
|
|
399
419
|
expect(tuiState.texts).toContainEqual([
|
|
400
420
|
"piprofile:1:eyJfdHlwZSI6InBpcHJvZmlsZSIsInZlcnNpb24iOjEsInByb2ZpbGUiOnsibmFtZSI6ImFscGhhIiwib3JkZXIiOjAsImZhdm9yaXRlIjpmYWxzZX19",
|
|
401
421
|
1,
|
|
402
422
|
0,
|
|
403
423
|
]);
|
|
404
424
|
expect(tuiState.texts).toContainEqual([
|
|
405
|
-
expect.stringContaining("Failed to copy
|
|
425
|
+
expect.stringContaining("Failed to copy: clipboard unavailable"),
|
|
406
426
|
1,
|
|
407
427
|
0,
|
|
408
428
|
]);
|
package/src/extension.ts
CHANGED
|
@@ -177,19 +177,22 @@ function prompt(ctx: ContextLike, title: string, initial = ""): Promise<string |
|
|
|
177
177
|
function showExportDialog(ctx: ContextLike, profileName: string, exportString: string, copyPromise: Promise<void>): Promise<void> {
|
|
178
178
|
return (ctx.ui.custom as (factory: unknown, options?: unknown) => Promise<void>)((tui: { requestRender: () => void }, theme: { fg: (color: string, text: string) => string; bold: (text: string) => string }, _kb: unknown, done: (value: void) => void) => {
|
|
179
179
|
const container = new Container() as { addChild: (child: unknown) => void; render: (width: number) => unknown; invalidate: () => void };
|
|
180
|
-
const statusText = new Text(theme.fg("accent",
|
|
180
|
+
const statusText = new Text(theme.fg("accent", "Copying to clipboard..."), 1, 0);
|
|
181
181
|
|
|
182
182
|
container.addChild(new DynamicBorder((value: string) => theme.fg("accent", value)));
|
|
183
|
+
container.addChild(new Text(theme.fg("accent", theme.bold(`📤 Profile Export: '${profileName}'`)), 1, 0));
|
|
183
184
|
container.addChild(statusText);
|
|
185
|
+
container.addChild(new Text(theme.fg("dim", "Select string below to copy:"), 1, 0));
|
|
184
186
|
container.addChild(new Text(theme.fg("accent", exportString), 1, 0));
|
|
187
|
+
container.addChild(new Text(theme.fg("dim", "[ Press any key or Esc to close ]"), 1, 0));
|
|
185
188
|
container.addChild(new DynamicBorder((value: string) => theme.fg("accent", value)));
|
|
186
189
|
|
|
187
190
|
copyPromise.then(() => {
|
|
188
|
-
statusText.setText(theme.fg("accent",
|
|
191
|
+
statusText.setText(theme.fg("accent", "✓ Copy command sent to terminal clipboard."));
|
|
189
192
|
container.invalidate();
|
|
190
193
|
tui.requestRender();
|
|
191
194
|
}).catch((error) => {
|
|
192
|
-
statusText.setText(theme.fg("error",
|
|
195
|
+
statusText.setText(theme.fg("error", `Failed to copy: ${error instanceof Error ? error.message : String(error)}`));
|
|
193
196
|
container.invalidate();
|
|
194
197
|
tui.requestRender();
|
|
195
198
|
});
|
|
@@ -198,7 +201,7 @@ function showExportDialog(ctx: ContextLike, profileName: string, exportString: s
|
|
|
198
201
|
render: (width: number) => container.render(width),
|
|
199
202
|
invalidate: () => container.invalidate(),
|
|
200
203
|
handleInput: (data: string) => {
|
|
201
|
-
|
|
204
|
+
done();
|
|
202
205
|
tui.requestRender();
|
|
203
206
|
},
|
|
204
207
|
};
|