@preapexis/pi-kit 1.0.9 → 1.0.10

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.
@@ -16,6 +16,7 @@ type ShellCommand = {
16
16
 
17
17
  const RUN_CHOICE = "▶ Run selected updates";
18
18
  const CANCEL_CHOICE = "✕ Cancel";
19
+ const UPDATE_STATUS_KEY = "preapexis-update-status";
19
20
 
20
21
  export default function (pi: ExtensionAPI): void {
21
22
  const options: UpdateOption[] = [
@@ -25,20 +26,20 @@ export default function (pi: ExtensionAPI): void {
25
26
  shell:
26
27
  "npm install -g --ignore-scripts @earendil-works/pi-coding-agent@latest"
27
28
  },
29
+ {
30
+ id: "pi-extensions",
31
+ label: "Update installed Pi packages/extensions",
32
+ shell: "pi update --extensions"
33
+ },
28
34
  {
29
35
  id: "kit-local",
30
36
  label: "Re-link this local PreApeXis kit",
31
37
  shell: "pi install -l ."
32
38
  },
33
- {
34
- id: "kit-github",
35
- label: "Update PreApeXis Pi Kit from GitHub",
36
- shell: "pi install git:github.com/VarunGaikwad/preapexis-pi-kit@master"
37
- },
38
39
  {
39
40
  id: "kit-npm",
40
41
  label: "Update PreApeXis Pi Kit from npm",
41
- shell: "pi install npm:preapexis-pi-kit"
42
+ shell: "pi install npm:@preapexis/pi-kit"
42
43
  },
43
44
  {
44
45
  id: "project-npm",
@@ -61,6 +62,28 @@ export default function (pi: ExtensionAPI): void {
61
62
  };
62
63
  }
63
64
 
65
+ function startUpdateStatus(ctx: EventContext, label: string): () => void {
66
+ let seconds = 0;
67
+ let dots = 0;
68
+
69
+ ctx.ui.setStatus(UPDATE_STATUS_KEY, `update: ${label}...`);
70
+
71
+ const timer = setInterval(() => {
72
+ seconds += 1;
73
+ dots = (dots + 1) % 4;
74
+
75
+ ctx.ui.setStatus(
76
+ UPDATE_STATUS_KEY,
77
+ `update: ${label}${".".repeat(dots)} ${seconds}s`
78
+ );
79
+ }, 1000);
80
+
81
+ return () => {
82
+ clearInterval(timer);
83
+ ctx.ui.setStatus(UPDATE_STATUS_KEY, undefined);
84
+ };
85
+ }
86
+
64
87
  function optionLabel(
65
88
  option: UpdateOption,
66
89
  selected: Map<string, UpdateOption>
@@ -151,10 +174,32 @@ export default function (pi: ExtensionAPI): void {
151
174
  ctx.ui.notify(`Running update:\n\n${option.shell}`, "info");
152
175
 
153
176
  const shell = shellCommand(option.shell);
177
+ const stopStatus = startUpdateStatus(ctx, option.label);
154
178
 
155
- const result = await pi.exec(shell.command, shell.args, {
156
- cwd: ctx.cwd
157
- });
179
+ let result: Awaited<ReturnType<typeof pi.exec>>;
180
+
181
+ try {
182
+ result = await pi.exec(shell.command, shell.args, {
183
+ cwd: ctx.cwd
184
+ });
185
+ } catch (error) {
186
+ stopStatus();
187
+
188
+ ctx.ui.notify(
189
+ [
190
+ `Update failed: ${option.label}`,
191
+ "",
192
+ `Command: ${option.shell}`,
193
+ "",
194
+ error instanceof Error ? error.message : String(error)
195
+ ].join("\n"),
196
+ "error"
197
+ );
198
+
199
+ return false;
200
+ }
201
+
202
+ stopStatus();
158
203
 
159
204
  const stdout = result.stdout?.trim() ?? "";
160
205
  const stderr = result.stderr?.trim() ?? "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preapexis/pi-kit",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Personal Pi coding-agent kit with safety extensions, status UI, prompt workflows, skills, and themes.",
5
5
  "keywords": [
6
6
  "pi-package",