@pencil-agent/nano-pencil 1.4.1 → 1.4.2

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.
@@ -24,6 +24,7 @@ export const BUILTIN_SLASH_COMMANDS = [
24
24
  { name: "login", description: "Login with OAuth provider" },
25
25
  { name: "logout", description: "Logout from OAuth provider" },
26
26
  { name: "new", description: "Start a new session" },
27
+ { name: "update", description: "Check for NanoPencil updates" },
27
28
  { name: "compact", description: "Manually compact the session context" },
28
29
  { name: "resume", description: "Resume a different session" },
29
30
  {
@@ -327,5 +327,6 @@ export declare class InteractiveMode {
327
327
  stop(): void;
328
328
  private handleSoulCommand;
329
329
  private handleMemoryCommand;
330
+ private handleUpdateCommand;
330
331
  }
331
332
  //# sourceMappingURL=interactive-mode.d.ts.map
@@ -1611,6 +1611,11 @@ export class InteractiveMode {
1611
1611
  await this.handleClearCommand();
1612
1612
  return;
1613
1613
  }
1614
+ if (text === "/update") {
1615
+ this.handleUpdateCommand();
1616
+ this.editor.setText("");
1617
+ return;
1618
+ }
1614
1619
  if (text === "/compact" || text.startsWith("/compact ")) {
1615
1620
  const customInstructions = text.startsWith("/compact ")
1616
1621
  ? text.slice(9).trim()
@@ -3961,5 +3966,54 @@ export class InteractiveMode {
3961
3966
  this.chatContainer.addChild(new Text(lines.join("\n"), 1, 0));
3962
3967
  this.ui.requestRender();
3963
3968
  }
3969
+ async handleUpdateCommand() {
3970
+ this.chatContainer.addChild(new Spacer(1));
3971
+ this.chatContainer.addChild(new Text(theme.fg("accent", "🔍 Checking for updates..."), 1, 0));
3972
+ this.ui.requestRender();
3973
+ try {
3974
+ const response = await fetch("https://registry.npmjs.org/@pencil-agent/nano-pencil", {
3975
+ signal: AbortSignal.timeout(10000),
3976
+ });
3977
+ if (!response.ok) {
3978
+ throw new Error(`Failed to check for updates: ${response.status}`);
3979
+ }
3980
+ const data = (await response.json());
3981
+ const latestVersion = data.version;
3982
+ const currentVersion = VERSION;
3983
+ const lines = [];
3984
+ lines.push(theme.fg("accent", "📦 NanoPencil Update Checker"));
3985
+ lines.push("");
3986
+ lines.push(`Current version: ${theme.fg("dim", currentVersion)}`);
3987
+ lines.push(`Latest version: ${theme.fg(latestVersion > currentVersion ? "success" : "dim", latestVersion)}`);
3988
+ lines.push("");
3989
+ if (latestVersion > currentVersion) {
3990
+ lines.push(theme.fg("success", "✨ New version available!"));
3991
+ lines.push("");
3992
+ lines.push(theme.fg("dim", "To update, run one of these commands:"));
3993
+ lines.push(theme.fg("dim", " npm update -g @pencil-agent/nano-pencil"));
3994
+ lines.push(theme.fg("dim", " npm install -g @pencil-agent/nano-pencil@latest"));
3995
+ lines.push("");
3996
+ lines.push(theme.fg("dim", `Or visit: ${theme.fg("mdLink", "https://www.npmjs.com/package/@pencil-agent/nano-pencil")}`));
3997
+ }
3998
+ else if (latestVersion < currentVersion) {
3999
+ lines.push(theme.fg("success", "✨ You're ahead!"));
4000
+ lines.push("");
4001
+ lines.push(theme.fg("dim", "You're running a pre-release or newer version than published on npm."));
4002
+ }
4003
+ else {
4004
+ lines.push(theme.fg("success", "✨ Up to date!"));
4005
+ lines.push("");
4006
+ lines.push(theme.fg("dim", "You're running the latest version of NanoPencil."));
4007
+ }
4008
+ this.chatContainer.addChild(new Spacer(1));
4009
+ this.chatContainer.addChild(new Text(lines.join("\n"), 1, 0));
4010
+ }
4011
+ catch (error) {
4012
+ this.chatContainer.addChild(new Spacer(1));
4013
+ this.chatContainer.addChild(new Text(theme.fg("warning", `⚠️ Failed to check for updates: ${error instanceof Error ? error.message : "Unknown error"}`), 1, 0));
4014
+ this.chatContainer.addChild(new Text(theme.fg("dim", "Visit https://www.npmjs.com/package/@pencil-agent/nano-pencil to check manually"), 1, 0));
4015
+ }
4016
+ this.ui.requestRender();
4017
+ }
3964
4018
  }
3965
4019
  //# sourceMappingURL=interactive-mode.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pencil-agent/nano-pencil",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "CLI writing agent with read, bash, edit, write tools and session management. Based on pi; supports DashScope Coding Plan. Soul enabled by default for AI personality evolution.",
5
5
  "type": "module",
6
6
  "bin": {