chels-code 0.5.1 → 0.5.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.
package/dist/src/cli.js CHANGED
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import { realpathSync } from "node:fs";
5
5
  import { writeFile } from "node:fs/promises";
6
6
  import { createInterface } from "node:readline";
7
+ import { exec } from "node:child_process";
7
8
  import { stdin, stdout } from "node:process";
8
9
  import { fileURLToPath } from "node:url";
9
10
  import { render } from "ink";
@@ -108,6 +109,36 @@ async function ensureApiKeys() {
108
109
  rl.close();
109
110
  }
110
111
  }
112
+ async function checkAndPromptUpdate() {
113
+ try {
114
+ const response = await fetch("https://registry.npmjs.org/chelscode/latest");
115
+ if (!response.ok)
116
+ return;
117
+ const data = (await response.json());
118
+ const latest = data.version;
119
+ if (!latest || latest === VERSION)
120
+ return;
121
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
122
+ const answer = await new Promise((resolve) => {
123
+ rl.question(`A new version of ChelsCode is available (${latest}). Update now? (y/n): `, (res) => resolve(res.trim()));
124
+ });
125
+ rl.close();
126
+ if (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes") {
127
+ await new Promise((resolve, reject) => {
128
+ exec(`npm install -g chelscode@${latest}`, { cwd: process.cwd() }, (error, _stdout, stderr) => {
129
+ if (error)
130
+ reject(error);
131
+ else
132
+ resolve();
133
+ });
134
+ });
135
+ process.exit(0);
136
+ }
137
+ }
138
+ catch {
139
+ // Ignore update-check failures.
140
+ }
141
+ }
111
142
  async function main() {
112
143
  const options = parseOptions(process.argv.slice(2));
113
144
  if (options.help) {
@@ -157,6 +188,7 @@ async function main() {
157
188
  saveSession(session);
158
189
  const restoreTitle = installTerminalTitle("ChelsCode");
159
190
  try {
191
+ await checkAndPromptUpdate();
160
192
  const instance = render(_jsx(App, { apiKeys: apiKeys, workspace: workspace, version: VERSION, sessionId: session.id, resume: resumed, missingKeys: keysMissing }), {
161
193
  exitOnCtrlC: true,
162
194
  kittyKeyboard: { mode: "auto" },
@@ -1 +1 @@
1
- export const VERSION = "0.5.0";
1
+ export const VERSION = "0.5.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chels-code",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "A TypeScript + Ink terminal coding assistant for OpenRouter, NVIDIA, and Groq",
5
5
  "type": "module",
6
6
  "bin": {