episoda 0.2.28 → 0.2.30

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/index.js CHANGED
@@ -4886,6 +4886,60 @@ ${exportLine}
4886
4886
 
4887
4887
  // src/commands/status.ts
4888
4888
  var import_core8 = __toESM(require_dist());
4889
+
4890
+ // src/utils/update-checker.ts
4891
+ var import_child_process7 = require("child_process");
4892
+ var semver = __toESM(require("semver"));
4893
+ var PACKAGE_NAME = "episoda";
4894
+ var NPM_REGISTRY = "https://registry.npmjs.org";
4895
+ async function checkForUpdates(currentVersion) {
4896
+ try {
4897
+ const controller = new AbortController();
4898
+ const timeoutId = setTimeout(() => controller.abort(), 5e3);
4899
+ const response = await fetch(`${NPM_REGISTRY}/${PACKAGE_NAME}/latest`, {
4900
+ signal: controller.signal
4901
+ });
4902
+ clearTimeout(timeoutId);
4903
+ if (!response.ok) {
4904
+ return { currentVersion, latestVersion: currentVersion, updateAvailable: false };
4905
+ }
4906
+ const data = await response.json();
4907
+ const latestVersion = data.version;
4908
+ return {
4909
+ currentVersion,
4910
+ latestVersion,
4911
+ updateAvailable: semver.gt(latestVersion, currentVersion)
4912
+ };
4913
+ } catch (error) {
4914
+ return { currentVersion, latestVersion: currentVersion, updateAvailable: false, offline: true };
4915
+ }
4916
+ }
4917
+ function performBackgroundUpdate() {
4918
+ try {
4919
+ const child = (0, import_child_process7.spawn)("npm", ["update", "-g", PACKAGE_NAME], {
4920
+ detached: true,
4921
+ stdio: "ignore",
4922
+ // Use shell on Windows for proper npm execution
4923
+ shell: process.platform === "win32"
4924
+ });
4925
+ child.unref();
4926
+ } catch (error) {
4927
+ }
4928
+ }
4929
+ function getInstalledVersion() {
4930
+ try {
4931
+ const output = (0, import_child_process7.execSync)(`npm list -g ${PACKAGE_NAME} --json`, {
4932
+ stdio: ["pipe", "pipe", "pipe"],
4933
+ timeout: 1e4
4934
+ }).toString();
4935
+ const data = JSON.parse(output);
4936
+ return data?.dependencies?.[PACKAGE_NAME]?.version || null;
4937
+ } catch {
4938
+ return null;
4939
+ }
4940
+ }
4941
+
4942
+ // src/commands/status.ts
4889
4943
  async function statusCommand(options = {}) {
4890
4944
  status.info("Checking CLI status...");
4891
4945
  status.info("");
@@ -4904,7 +4958,17 @@ async function statusCommand(options = {}) {
4904
4958
  status.info("Configuration:");
4905
4959
  status.info(` Project ID: ${config.project_id}`);
4906
4960
  status.info(` API URL: ${config.api_url}`);
4907
- status.info(` CLI Version: ${import_core8.VERSION}`);
4961
+ if (!options.skipUpdateCheck) {
4962
+ const updateResult = await checkForUpdates(import_core8.VERSION);
4963
+ if (updateResult.updateAvailable) {
4964
+ status.info(` CLI Version: ${import_core8.VERSION} \u2B06 updating to ${updateResult.latestVersion}...`);
4965
+ performBackgroundUpdate();
4966
+ } else {
4967
+ status.info(` CLI Version: ${import_core8.VERSION} \u2713`);
4968
+ }
4969
+ } else {
4970
+ status.info(` CLI Version: ${import_core8.VERSION}`);
4971
+ }
4908
4972
  status.info(` Config file: ${(0, import_core8.getConfigPath)()}`);
4909
4973
  status.info("");
4910
4974
  if (!config.access_token || config.access_token === "") {
@@ -5800,48 +5864,6 @@ async function listWorktrees(options) {
5800
5864
  // src/commands/update.ts
5801
5865
  var import_child_process8 = require("child_process");
5802
5866
  var import_core14 = __toESM(require_dist());
5803
-
5804
- // src/utils/update-checker.ts
5805
- var import_child_process7 = require("child_process");
5806
- var semver = __toESM(require("semver"));
5807
- var PACKAGE_NAME = "episoda";
5808
- var NPM_REGISTRY = "https://registry.npmjs.org";
5809
- async function checkForUpdates(currentVersion) {
5810
- try {
5811
- const controller = new AbortController();
5812
- const timeoutId = setTimeout(() => controller.abort(), 5e3);
5813
- const response = await fetch(`${NPM_REGISTRY}/${PACKAGE_NAME}/latest`, {
5814
- signal: controller.signal
5815
- });
5816
- clearTimeout(timeoutId);
5817
- if (!response.ok) {
5818
- return { currentVersion, latestVersion: currentVersion, updateAvailable: false };
5819
- }
5820
- const data = await response.json();
5821
- const latestVersion = data.version;
5822
- return {
5823
- currentVersion,
5824
- latestVersion,
5825
- updateAvailable: semver.gt(latestVersion, currentVersion)
5826
- };
5827
- } catch (error) {
5828
- return { currentVersion, latestVersion: currentVersion, updateAvailable: false, offline: true };
5829
- }
5830
- }
5831
- function getInstalledVersion() {
5832
- try {
5833
- const output = (0, import_child_process7.execSync)(`npm list -g ${PACKAGE_NAME} --json`, {
5834
- stdio: ["pipe", "pipe", "pipe"],
5835
- timeout: 1e4
5836
- }).toString();
5837
- const data = JSON.parse(output);
5838
- return data?.dependencies?.[PACKAGE_NAME]?.version || null;
5839
- } catch {
5840
- return null;
5841
- }
5842
- }
5843
-
5844
- // src/commands/update.ts
5845
5867
  async function isDaemonRunning2() {
5846
5868
  try {
5847
5869
  const daemonStatus = await getStatus();
@@ -6006,9 +6028,13 @@ import_commander.program.command("dev").description("Connect to Episoda and star
6006
6028
  process.exit(1);
6007
6029
  }
6008
6030
  });
6009
- import_commander.program.command("status").description("Show connection status").option("--verify", "Verify connection is healthy (not just connected)").option("--local", "Only check local daemon state (faster, but may be stale)").action(async (options) => {
6031
+ import_commander.program.command("status").description("Show connection status").option("--verify", "Verify connection is healthy (not just connected)").option("--local", "Only check local daemon state (faster, but may be stale)").option("--skip-update-check", "Skip CLI version update check (faster)").action(async (options) => {
6010
6032
  try {
6011
- await statusCommand({ verify: options.verify, local: options.local });
6033
+ await statusCommand({
6034
+ verify: options.verify,
6035
+ local: options.local,
6036
+ skipUpdateCheck: options.skipUpdateCheck
6037
+ });
6012
6038
  } catch (error) {
6013
6039
  status.error(`Status check failed: ${error instanceof Error ? error.message : String(error)}`);
6014
6040
  process.exit(1);