taktiko 0.3.0 → 0.3.1

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/cli.js CHANGED
@@ -8926,7 +8926,7 @@ function runMcpTools() {
8926
8926
  reply(id, {
8927
8927
  protocolVersion: params?.protocolVersion || "2025-06-18",
8928
8928
  capabilities: { tools: {} },
8929
- serverInfo: { name: "taktiko", version: "0.3.0" }
8929
+ serverInfo: { name: "taktiko", version: "0.3.1" }
8930
8930
  });
8931
8931
  return;
8932
8932
  }
@@ -10040,7 +10040,7 @@ function runDaemon(cfg) {
10040
10040
  connect();
10041
10041
  }
10042
10042
  var program = new Command();
10043
- program.name("taktiko").description("Taktiko daemon \u2014 runs your local agent CLIs").version("0.3.0", "-v, --version", "output the version number");
10043
+ program.name("taktiko").description("Taktiko daemon \u2014 runs your local agent CLIs").version("0.3.1", "-v, --version", "output the version number");
10044
10044
  program.command("hooks <provider> <event>").description("internal: report agent activity for the current Taktiko terminal (called by agent hooks)").action(async (provider, event) => {
10045
10045
  await reportHookActivity(provider, event);
10046
10046
  process.exit(0);
@@ -10123,6 +10123,50 @@ program.command("restart").description("restart the daemon (cycles the installed
10123
10123
  process.exit(1);
10124
10124
  }
10125
10125
  });
10126
+ program.command("update").description("update taktiko to the latest published version (npm i -g), then restart the daemon").option("--check", "only report whether a newer version exists; don't install").option("--force", "reinstall the latest even if already up to date").action(async (opts) => {
10127
+ const npm = process.platform === "win32" ? "npm.cmd" : "npm";
10128
+ const current = "0.3.1";
10129
+ let latest;
10130
+ try {
10131
+ latest = execFileSync2(npm, ["view", "taktiko", "version"], { encoding: "utf8" }).trim();
10132
+ } catch (e) {
10133
+ console.error(`could not reach npm to check the latest version: ${e instanceof Error ? e.message : String(e)}`);
10134
+ process.exit(1);
10135
+ }
10136
+ console.log(`current: ${current}`);
10137
+ console.log(`latest: ${latest}`);
10138
+ const outdated = isNewerVersion(latest, current);
10139
+ if (opts.check) {
10140
+ console.log(outdated ? "a newer version is available \u2014 run `taktiko update` to install it." : "up to date.");
10141
+ return;
10142
+ }
10143
+ if (!outdated && !opts.force) {
10144
+ console.log("already on the latest version (use --force to reinstall).");
10145
+ return;
10146
+ }
10147
+ console.log(`installing taktiko@${latest} ...`);
10148
+ try {
10149
+ execFileSync2(npm, ["install", "-g", `taktiko@${latest}`], { stdio: "inherit" });
10150
+ } catch (e) {
10151
+ console.error(`update failed: ${e instanceof Error ? e.message : String(e)}`);
10152
+ process.exit(1);
10153
+ }
10154
+ console.log(`updated to ${latest}.`);
10155
+ try {
10156
+ if (restartService()) {
10157
+ console.log("restarted the installed taktiko service \u2014 now running the new version.");
10158
+ } else if (isRunning()) {
10159
+ stopRunning();
10160
+ await new Promise((r) => setTimeout(r, 500));
10161
+ const pid = spawnDetached();
10162
+ console.log(`restarted the running daemon (pid ${pid}) \u2014 now running the new version.`);
10163
+ } else {
10164
+ console.log("run `taktiko start` to connect this machine with the new version.");
10165
+ }
10166
+ } catch (e) {
10167
+ console.log(`updated, but the restart failed \u2014 run \`taktiko restart\` manually (${e instanceof Error ? e.message : String(e)}).`);
10168
+ }
10169
+ });
10126
10170
  program.command("status").description("show the local daemon process + server reachability").option("--json", "machine-readable output").action(async (opts) => {
10127
10171
  const info = processInfo();
10128
10172
  const svc = getServiceStatus();
@@ -10216,6 +10260,16 @@ function printTail(n) {
10216
10260
  console.error(`could not read ${LOG_FILE}: ${e instanceof Error ? e.message : String(e)}`);
10217
10261
  }
10218
10262
  }
10263
+ function isNewerVersion(latest, current) {
10264
+ const seg = (v2) => v2.split(".").map((p2) => Number.parseInt(p2, 10) || 0);
10265
+ const a = seg(latest);
10266
+ const b2 = seg(current);
10267
+ for (let i = 0; i < Math.max(a.length, b2.length); i++) {
10268
+ const d = (a[i] ?? 0) - (b2[i] ?? 0);
10269
+ if (d !== 0) return d > 0;
10270
+ }
10271
+ return false;
10272
+ }
10219
10273
  function formatDuration(ms) {
10220
10274
  const s = Math.floor(ms / 1e3);
10221
10275
  if (s < 60) return `${s}s`;