@oozou/velocity 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +63 -1
  2. package/package.json +4 -2
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { Command } from "commander";
5
+ import updateNotifier from "update-notifier";
5
6
 
6
7
  // src/commands/auth.ts
7
8
  import open from "open";
@@ -1268,6 +1269,52 @@ var registerProjectMetaCommands = (program2) => {
1268
1269
  });
1269
1270
  };
1270
1271
 
1272
+ // src/commands/update.ts
1273
+ import { spawn } from "child_process";
1274
+ var PKG = "@oozou/velocity";
1275
+ var runUpdate5 = async (cmd) => {
1276
+ return new Promise((resolve, reject) => {
1277
+ process.stderr.write(
1278
+ `Updating ${PKG} via \`npm i -g ${PKG}@latest\`...
1279
+ `
1280
+ );
1281
+ const proc = spawn(
1282
+ "npm",
1283
+ ["i", "-g", `${PKG}@latest`, "--no-update-notifier"],
1284
+ { stdio: "inherit" }
1285
+ );
1286
+ proc.on("error", (err) => {
1287
+ reject(
1288
+ new Error(
1289
+ `Could not invoke npm: ${err.message}. Run \`npm i -g ${PKG}@latest\` manually.`
1290
+ )
1291
+ );
1292
+ });
1293
+ proc.on("exit", (code) => {
1294
+ if (code === 0) {
1295
+ writeResult(
1296
+ cmd,
1297
+ { status: "ok", package: PKG },
1298
+ () => `Updated ${PKG} to the latest version on npm.
1299
+ `
1300
+ );
1301
+ resolve();
1302
+ } else {
1303
+ reject(new Error(`npm exited with code ${code}`));
1304
+ }
1305
+ });
1306
+ });
1307
+ };
1308
+ var registerUpdateCommand = (program2) => {
1309
+ program2.command("update").description("Update the Velocity CLI to the latest version on npm").action(async function() {
1310
+ try {
1311
+ await runUpdate5(this);
1312
+ } catch (err) {
1313
+ exitWithError(err, this);
1314
+ }
1315
+ });
1316
+ };
1317
+
1271
1318
  // src/commands/agent-help.ts
1272
1319
  var HELP_TEXT = `# Velocity CLI agent guide
1273
1320
 
@@ -1307,6 +1354,8 @@ projects list
1307
1354
  projects get [slug-or-id]
1308
1355
  projects use <slug-or-id> | current | reset
1309
1356
 
1357
+ update # upgrade the CLI to the latest version on npm
1358
+
1310
1359
  stories list
1311
1360
  stories get <number>
1312
1361
  stories create --title --type --status --priority [--description --assignee --sprint --release --parent --points --complexity]
@@ -1366,7 +1415,19 @@ var registerAgentHelpCommand = (program2) => {
1366
1415
  };
1367
1416
 
1368
1417
  // src/index.ts
1369
- var VERSION = "0.1.1";
1418
+ var VERSION = "0.1.2";
1419
+ if (process.stdout.isTTY && process.env.VELOCITY_NO_UPDATE_NOTIFIER !== "1") {
1420
+ try {
1421
+ updateNotifier({
1422
+ pkg: { name: "@oozou/velocity", version: VERSION },
1423
+ updateCheckInterval: 1e3 * 60 * 60 * 24
1424
+ }).notify({
1425
+ defer: false,
1426
+ message: "Update available {currentVersion} \u2192 {latestVersion}\nRun `velocity update` or `npm i -g {packageName}@latest`"
1427
+ });
1428
+ } catch {
1429
+ }
1430
+ }
1370
1431
  var program = new Command();
1371
1432
  program.name("velocity").description("CLI for Velocity").version(VERSION).option("--json", "force JSON output regardless of TTY", false).option("--human", "force human output regardless of TTY", false).option("--env <name>", "Target a named env (production, local)").option("--api-base <url>", "Override the Velocity API base URL").option("--project <id>", "Target a specific project for this invocation");
1372
1433
  registerAuthCommands(program);
@@ -1380,6 +1441,7 @@ registerCommentsCommands(program);
1380
1441
  registerNotesCommands(program);
1381
1442
  registerTodosCommands(program);
1382
1443
  registerProjectMetaCommands(program);
1444
+ registerUpdateCommand(program);
1383
1445
  registerAgentHelpCommand(program);
1384
1446
  program.parseAsync(process.argv).catch((err) => {
1385
1447
  writeError(err, program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oozou/velocity",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Velocity CLI — browser-based auth + REST client for the Velocity project management API.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://velocity.oozou.com",
@@ -41,10 +41,12 @@
41
41
  "dependencies": {
42
42
  "commander": "^12.1.0",
43
43
  "env-paths": "^3.0.0",
44
- "open": "^10.1.0"
44
+ "open": "^10.1.0",
45
+ "update-notifier": "^7.3.1"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@types/node": "^20",
49
+ "@types/update-notifier": "^6.0.8",
48
50
  "@velocity/shared": "workspace:*",
49
51
  "tsup": "^8.3.5",
50
52
  "typescript": "^5.9.3"